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)
This commit is contained in:
parent
d8d2004c6f
commit
80ed505c41
2 changed files with 4 additions and 4 deletions
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
_ => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue