]> git.lizzy.rs Git - rust.git/commitdiff
use a variable
authorManish Goregaokar <manishsmail@gmail.com>
Thu, 21 Oct 2021 21:40:33 +0000 (14:40 -0700)
committerManish Goregaokar <manishsmail@gmail.com>
Thu, 21 Oct 2021 21:40:33 +0000 (14:40 -0700)
clippy_lints/src/doc.rs

index c14a3604c2ff85bde7c726ed4078ac65b3096663..ec67adf3f87662ef1c81b75a2bcfc6e8a98a572a 100644 (file)
@@ -578,11 +578,12 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
                     // text "http://example.com" by pulldown-cmark
                     continue;
                 }
-                headers.safety |= in_heading && text.trim() == "Safety";
-                headers.safety |= in_heading && text.trim() == "Implementation safety";
-                headers.safety |= in_heading && text.trim() == "Implementation Safety";
-                headers.errors |= in_heading && text.trim() == "Errors";
-                headers.panics |= in_heading && text.trim() == "Panics";
+                let trimmed_text = text.trim();
+                headers.safety |= in_heading && trimmed_text == "Safety";
+                headers.safety |= in_heading && trimmed_text == "Implementation safety";
+                headers.safety |= in_heading && trimmed_text == "Implementation Safety";
+                headers.errors |= in_heading && trimmed_text == "Errors";
+                headers.panics |= in_heading && trimmed_text == "Panics";
                 if in_code {
                     if is_rust {
                         let edition = edition.unwrap_or_else(|| cx.tcx.sess.edition());