diff --git a/src/librustc_errors/registry.rs b/src/librustc_errors/registry.rs index c92a9d04775d1..32700c6500bc8 100644 --- a/src/librustc_errors/registry.rs +++ b/src/librustc_errors/registry.rs @@ -27,6 +27,6 @@ impl Registry { if !self.long_descriptions.contains_key(code) { return Err(InvalidErrorCode); } - Ok(self.long_descriptions.get(code).unwrap().clone()) + Ok(*self.long_descriptions.get(code).unwrap()) } } diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index 817a276ff3e73..fd62c80293425 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -1086,7 +1086,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { for param in params { if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(param.span) { - if snippet.starts_with("&") && !snippet.starts_with("&'") { + if snippet.starts_with('&') && !snippet.starts_with("&'") { introduce_suggestion .push((param.span, format!("&'a {}", &snippet[1..]))); } else if snippet.starts_with("&'_ ") { @@ -1118,7 +1118,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { (1, Some(name), Some("'_")) => { suggest_existing(err, name.to_string()); } - (1, Some(name), Some(snippet)) if !snippet.ends_with(">") => { + (1, Some(name), Some(snippet)) if !snippet.ends_with('>') => { suggest_existing(err, format!("{}<{}>", snippet, name)); } (0, _, Some("&")) => { @@ -1127,7 +1127,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { (0, _, Some("'_")) => { suggest_new(err, "'a"); } - (0, _, Some(snippet)) if !snippet.ends_with(">") => { + (0, _, Some(snippet)) if !snippet.ends_with('>') => { suggest_new(err, &format!("{}<'a>", snippet)); } _ => {