diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2020-03-04 20:47:05 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2020-03-04 20:47:05 +0100 |
| commit | 80ed505c41319f2fbbc7e97189e62b38c47b5a70 (patch) | |
| tree | c02fa46f66014a07df55694a22cbe07b46716b7e | |
| parent | d8d2004c6ffb8b66eac90e75aa23012130adf9f9 (diff) | |
| download | rust-80ed505c41319f2fbbc7e97189e62b38c47b5a70.tar.gz rust-80ed505c41319f2fbbc7e97189e62b38c47b5a70.zip | |
Use single-char patter on {ends,starts}_with and remove clone on copy type.
These were introduced since I last fixed most of these occurences. (clippy::clone_on_copy, clippy::single_char_pattern)
| -rw-r--r-- | src/librustc_errors/registry.rs | 2 | ||||
| -rw-r--r-- | src/librustc_resolve/late/diagnostics.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_errors/registry.rs b/src/librustc_errors/registry.rs index c92a9d04775..32700c6500b 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 817a276ff3e..fd62c802934 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)); } _ => { |
