1
Fork 0

avoid full-slicing slices

If we already have a slice, there is no need to get another full-range slice from that, just use the original.
clippy::redundant_slicing
This commit is contained in:
Matthias Krüger 2021-02-16 00:30:06 +01:00
parent d1206f950f
commit 4390a61b64
19 changed files with 33 additions and 40 deletions

View file

@ -270,7 +270,7 @@ impl<'a, 'b> Context<'a, 'b> {
parse::ArgumentNamed(s) => Named(s),
};
let ty = Placeholder(match &arg.format.ty[..] {
let ty = Placeholder(match arg.format.ty {
"" => "Display",
"?" => "Debug",
"e" => "LowerExp",

View file

@ -312,7 +312,7 @@ pub mod printf {
return Some((Substitution::Escape, &s[start + 2..]));
}
Cur::new_at(&s[..], start)
Cur::new_at(s, start)
};
// This is meant to be a translation of the following regex:
@ -673,7 +673,7 @@ pub mod shell {
_ => { /* fall-through */ }
}
Cur::new_at(&s[..], start)
Cur::new_at(s, start)
};
let at = at.at_next_cp()?;