From: Matthias Krüger Date: Sat, 5 Dec 2020 12:16:34 +0000 (+0100) Subject: use .contains() or .any() instead of find(x).is_some() (clippy::search_is_some) X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;ds=sidebyside;h=0fa461558c85202281b1d33b7b77f27a32459be7;p=rust.git use .contains() or .any() instead of find(x).is_some() (clippy::search_is_some) --- diff --git a/compiler/rustc_mir/src/borrow_check/diagnostics/region_name.rs b/compiler/rustc_mir/src/borrow_check/diagnostics/region_name.rs index 2a90fb042dd..6211cf8a9da 100644 --- a/compiler/rustc_mir/src/borrow_check/diagnostics/region_name.rs +++ b/compiler/rustc_mir/src/borrow_check/diagnostics/region_name.rs @@ -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 { diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index fb17eb462e1..bdbb90837c7 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -391,7 +391,7 @@ fn next(&mut self) -> Option { _, ))) => { 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; }