From 280e381b8d515a534c053b2bda83e5c6902c4a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 26 Feb 2020 22:42:29 +0100 Subject: [PATCH] don't take redundant references to operands --- src/libcore/str/pattern.rs | 2 +- src/librustc/ty/error.rs | 2 +- src/librustc_infer/infer/error_reporting/mod.rs | 2 +- src/librustdoc/core.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index ef64d8b0fdf88..6c826e5dcdec0 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -1050,7 +1050,7 @@ impl TwoWaySearcher { // &v[..period]. If it is, we use "Algorithm CP1". Otherwise we use // "Algorithm CP2", which is optimized for when the period of the needle // is large. - if &needle[..crit_pos] == &needle[period..period + crit_pos] { + if needle[..crit_pos] == needle[period..period + crit_pos] { // short period case -- the period is exact // compute a separate critical factorization for the reversed needle // x = u' v' where |v'| < period(x). diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 6c5458e6e58a6..2599ad8ba7b9d 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -341,7 +341,7 @@ impl<'tcx> TyCtxt<'tcx> { db.note("distinct uses of `impl Trait` result in different opaque types"); let e_str = values.expected.to_string(); let f_str = values.found.to_string(); - if &e_str == &f_str && &e_str == "impl std::future::Future" { + if e_str == f_str && &e_str == "impl std::future::Future" { // FIXME: use non-string based check. db.help( "if both `Future`s have the same `Output` type, consider \ diff --git a/src/librustc_infer/infer/error_reporting/mod.rs b/src/librustc_infer/infer/error_reporting/mod.rs index 008658dff425b..fd103c4c3369b 100644 --- a/src/librustc_infer/infer/error_reporting/mod.rs +++ b/src/librustc_infer/infer/error_reporting/mod.rs @@ -745,7 +745,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { .join(", "); if !lifetimes.is_empty() { if sub.regions().count() < len { - value.push_normal(lifetimes + &", "); + value.push_normal(lifetimes + ", "); } else { value.push_normal(lifetimes); } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 8c4e65765d32f..43d3ad218295a 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -283,7 +283,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt .filter_map(|lint| { // We don't want to whitelist *all* lints so let's // ignore those ones. - if whitelisted_lints.iter().any(|l| &lint.name == l) { + if whitelisted_lints.iter().any(|l| lint.name == l) { None } else { Some((lint::LintId::of(lint), lint::Allow))