X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir_pretty%2Fsrc%2Flib.rs;h=389e3845c56b9bf6b87568533c6025ce99d1e671;hb=f640438b402b6507e734862026b0b004090c8ac0;hp=4240a4045a1ec7c2ef151c943f31430c18161286;hpb=d26fc45e5bf170907cefcaa83c5b8e6cf6cb1351;p=rust.git diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 4240a4045a1..389e3845c56 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -316,7 +316,7 @@ pub fn print_type(&mut self, ty: &hir::Ty<'_>) { } hir::TyKind::Tup(ref elts) => { self.popen(); - self.commasep(Inconsistent, &elts[..], |s, ty| s.print_type(&ty)); + self.commasep(Inconsistent, &elts, |s, ty| s.print_type(&ty)); if elts.len() == 1 { self.word(","); } @@ -1543,22 +1543,20 @@ pub fn print_expr(&mut self, expr: &hir::Expr<'_>) { hir::ExprKind::Path(ref qpath) => self.print_qpath(qpath, true), hir::ExprKind::Break(destination, ref opt_expr) => { self.word("break"); - self.space(); if let Some(label) = destination.label { - self.print_ident(label.ident); self.space(); + self.print_ident(label.ident); } if let Some(ref expr) = *opt_expr { - self.print_expr_maybe_paren(expr, parser::PREC_JUMP); self.space(); + self.print_expr_maybe_paren(expr, parser::PREC_JUMP); } } hir::ExprKind::Continue(destination) => { self.word("continue"); - self.space(); if let Some(label) = destination.label { + self.space(); self.print_ident(label.ident); - self.space() } } hir::ExprKind::Ret(ref result) => { @@ -1733,7 +1731,7 @@ pub fn print_qpath(&mut self, qpath: &hir::QPath<'_>, colons_before_params: bool colons_before_params, ) } - hir::QPath::LangItem(lang_item, span) => { + hir::QPath::LangItem(lang_item, span, _) => { self.word("#[lang = \""); self.print_ident(Ident::new(lang_item.name(), span)); self.word("\"]"); @@ -1862,7 +1860,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) { self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p)); } } else { - self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p)); + self.commasep(Inconsistent, &elts, |s, p| s.print_pat(&p)); } self.pclose(); } @@ -1875,7 +1873,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) { self.word_space("{"); self.commasep_cmnt( Consistent, - &fields[..], + &fields, |s, f| { s.cbox(INDENT_UNIT); if !f.is_shorthand { @@ -1897,7 +1895,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) { self.word("}"); } PatKind::Or(ref pats) => { - self.strsep("|", true, Inconsistent, &pats[..], |s, p| s.print_pat(&p)); + self.strsep("|", true, Inconsistent, &pats, |s, p| s.print_pat(&p)); } PatKind::Tuple(ref elts, ddpos) => { self.popen(); @@ -1958,7 +1956,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) { } PatKind::Slice(ref before, ref slice, ref after) => { self.word("["); - self.commasep(Inconsistent, &before[..], |s, p| s.print_pat(&p)); + self.commasep(Inconsistent, &before, |s, p| s.print_pat(&p)); if let Some(ref p) = *slice { if !before.is_empty() { self.word_space(","); @@ -1973,7 +1971,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat<'_>) { self.word_space(","); } } - self.commasep(Inconsistent, &after[..], |s, p| s.print_pat(&p)); + self.commasep(Inconsistent, &after, |s, p| s.print_pat(&p)); self.word("]"); } }