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

@ -1681,7 +1681,7 @@ impl<'a> State<'a> {
self.ibox(INDENT_UNIT);
self.s.word("[");
self.print_inner_attributes_inline(attrs);
self.commasep_exprs(Inconsistent, &exprs[..]);
self.commasep_exprs(Inconsistent, exprs);
self.s.word("]");
self.end();
}
@ -1722,7 +1722,7 @@ impl<'a> State<'a> {
self.print_inner_attributes_inline(attrs);
self.commasep_cmnt(
Consistent,
&fields[..],
fields,
|s, field| {
s.print_outer_attributes(&field.attrs);
s.ibox(INDENT_UNIT);
@ -1757,7 +1757,7 @@ impl<'a> State<'a> {
fn print_expr_tup(&mut self, exprs: &[P<ast::Expr>], attrs: &[ast::Attribute]) {
self.popen();
self.print_inner_attributes_inline(attrs);
self.commasep_exprs(Inconsistent, &exprs[..]);
self.commasep_exprs(Inconsistent, exprs);
if exprs.len() == 1 {
self.s.word(",");
}