From 082ed2a74f61fb8f1e750dfd59925070d60ac7bf Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 20 Jun 2020 03:03:13 +0100 Subject: chore(cheddar): Clean up all clippy lints Change-Id: I5544c10e964b57891fce6ea01f09eeec406e9bef Reviewed-on: https://cl.tvl.fyi/c/depot/+/510 Reviewed-by: lukegb --- tools/cheddar/src/main.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'tools') diff --git a/tools/cheddar/src/main.rs b/tools/cheddar/src/main.rs index b6229aa3f754..a4b9a93ed3cd 100644 --- a/tools/cheddar/src/main.rs +++ b/tools/cheddar/src/main.rs @@ -144,21 +144,21 @@ fn has_callout<'a>(node: &Node<'a, RefCell>) -> Option { match node.first_child().map(|c| c.data.borrow()) { Some(child) => match &child.value { NodeValue::Text(text) => { - if text.starts_with("TODO".as_bytes()) { + if text.starts_with(b"TODO") { return Some(Callout::Todo); - } else if text.starts_with("WARNING".as_bytes()) { + } else if text.starts_with(b"WARNING") { return Some(Callout::Warning); - } else if text.starts_with("QUESTION".as_bytes()) { + } else if text.starts_with(b"QUESTION") { return Some(Callout::Question); - } else if text.starts_with("TIP".as_bytes()) { + } else if text.starts_with(b"TIP") { return Some(Callout::Tip); } - return None; + None } - _ => return None, + _ => None, }, - _ => return None, + _ => None, } } @@ -182,7 +182,6 @@ fn format_markdown(reader: &mut R, writer: &mut W) { reader .read_to_string(&mut buffer) .expect("reading should work"); - drop(reader); buffer }; @@ -199,7 +198,7 @@ fn format_markdown(reader: &mut R, writer: &mut W) { last_line_blank: false, value: NodeValue::HtmlBlock(NodeHtmlBlock { block_type: 1, - literal: "

".as_bytes().to_vec(), + literal: b"

".to_vec(), }), })); @@ -229,7 +228,7 @@ fn format_markdown(reader: &mut R, writer: &mut W) { } fn find_syntax_for_file(filename: &str) -> &'static SyntaxReference { - return (*FILENAME_OVERRIDES) + (*FILENAME_OVERRIDES) .get(filename) .and_then(|name| SYNTAXES.find_syntax_by_name(name)) .or_else(|| { @@ -238,7 +237,7 @@ fn find_syntax_for_file(filename: &str) -> &'static SyntaxReference { .and_then(OsStr::to_str) .and_then(|s| SYNTAXES.find_syntax_by_extension(s)) }) - .unwrap_or_else(|| SYNTAXES.find_syntax_plain_text()); + .unwrap_or_else(|| SYNTAXES.find_syntax_plain_text()) } fn format_code( -- cgit 1.4.1