about summary refs log tree commit diff
path: root/tools/cheddar/src
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-06-20T02·03+0100
committertazjin <mail@tazj.in>2020-06-20T03·00+0000
commit082ed2a74f61fb8f1e750dfd59925070d60ac7bf (patch)
tree6361e002d0b2860e22361b39a99034dcde3222bc /tools/cheddar/src
parente27b0a3013da6cb017850751280c4a3f314740aa (diff)
chore(cheddar): Clean up all clippy lints r/1045
Change-Id: I5544c10e964b57891fce6ea01f09eeec406e9bef
Reviewed-on: https://cl.tvl.fyi/c/depot/+/510
Reviewed-by: lukegb <lukegb@tvl.fyi>
Diffstat (limited to 'tools/cheddar/src')
-rw-r--r--tools/cheddar/src/main.rs21
1 files changed, 10 insertions, 11 deletions
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<Ast>>) -> Option<Callout> {
     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<R: BufRead, W: Write>(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<R: BufRead, W: Write>(reader: &mut R, writer: &mut W) {
         last_line_blank: false,
         value: NodeValue::HtmlBlock(NodeHtmlBlock {
             block_type: 1,
-            literal: "</p>".as_bytes().to_vec(),
+            literal: b"</p>".to_vec(),
         }),
     }));
 
@@ -229,7 +228,7 @@ fn format_markdown<R: BufRead, W: Write>(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<R: BufRead, W: Write>(