]> git.lizzy.rs Git - rust.git/commitdiff
use .contains() or .any() instead of find(x).is_some() (clippy::search_is_some)
authorMatthias Krüger <matthias.krueger@famsik.de>
Sat, 5 Dec 2020 12:16:34 +0000 (13:16 +0100)
committerMatthias Krüger <matthias.krueger@famsik.de>
Tue, 8 Dec 2020 19:27:48 +0000 (20:27 +0100)
compiler/rustc_mir/src/borrow_check/diagnostics/region_name.rs
src/librustdoc/html/markdown.rs

index 2a90fb042dd7183408b0d5d72b73c14c9dff1e89..6211cf8a9da858839483385e094333a79931a83f 100644 (file)
@@ -445,7 +445,7 @@ fn highlight_if_we_cannot_match_hir_ty(
             "highlight_if_we_cannot_match_hir_ty: type_name={:?} needle_fr={:?}",
             type_name, needle_fr
         );
-        if type_name.find(&format!("'{}", counter)).is_some() {
+        if type_name.contains(&format!("'{}", counter)) {
             // Only add a label if we can confirm that a region was labelled.
             RegionNameHighlight::CannotMatchHirTy(span, type_name)
         } else {
index fb17eb462e14556b90d01db8aaa659a0801485d5..bdbb90837c7cd7403332c2d8d7024b640c1b3b98 100644 (file)
@@ -391,7 +391,7 @@ fn next(&mut self) -> Option<Self::Item> {
                 _,
             ))) => {
                 debug!("saw end of shortcut link to {}", dest);
-                if self.links.iter().find(|&link| *link.href == **dest).is_some() {
+                if self.links.iter().any(|link| *link.href == **dest) {
                     assert!(self.shortcut_link.is_some(), "saw closing link without opening tag");
                     self.shortcut_link = None;
                 }