Skip to content

Commit 340414e

Browse files
committed
Review changes
1 parent f1d273c commit 340414e

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

compiler/rustc_lint/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
581581

582582
fn check_impl_item(&mut self, cx: &LateContext<'_>, impl_item: &hir::ImplItem<'_>) {
583583
let context = method_context(cx, impl_item.owner_id.def_id);
584-
584+
585585
match context {
586586
// If the method is an impl for a trait, don't doc.
587587
MethodLateContext::TraitImpl => return,

compiler/rustc_middle/src/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ impl<'tcx> Body<'tcx> {
416416
(self.arg_count + 1..self.local_decls.len()).filter_map(move |index| {
417417
let local = Local::new(index);
418418
let decl = &self.local_decls[local];
419-
if decl.is_user_variable() && decl.mutability.is_mut() { Some(local) } else { None }
419+
(decl.is_user_variable() && decl.mutability.is_mut()).then(|| local)
420420
})
421421
}
422422

compiler/rustc_middle/src/mir/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ fn write_scope_tree(
580580
continue;
581581
}
582582

583-
let mut_str = if local_decl.mutability.is_mut() { "mut " } else { "" };
583+
let mut_str = local_decl.mutability.prefix_str();
584584

585585
let mut indented_decl =
586586
format!("{0:1$}let {2}{3:?}: {4:?}", INDENT, indent, mut_str, local, local_decl.ty);

compiler/rustc_save_analysis/src/sig.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,8 @@ impl<'hir> Sig for hir::ForeignItem<'hir> {
768768
}
769769
hir::ForeignItemKind::Static(ref ty, m) => {
770770
let mut text = "static ".to_owned();
771-
if m.is_mut() {
772-
text.push_str("mut ");
773-
}
771+
text.push_str(m.prefix_str());
772+
774773
let name = self.ident.to_string();
775774
let defs = vec![SigElement {
776775
id: id_from_def_id(self.owner_id.to_def_id()),

0 commit comments

Comments
 (0)