Review changes

This commit is contained in:
Maybe Waffle 2023-01-31 07:44:34 +00:00
parent f1d273cbfb
commit 340414ed7b
4 changed files with 5 additions and 6 deletions

View file

@ -581,7 +581,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
fn check_impl_item(&mut self, cx: &LateContext<'_>, impl_item: &hir::ImplItem<'_>) {
let context = method_context(cx, impl_item.owner_id.def_id);
match context {
// If the method is an impl for a trait, don't doc.
MethodLateContext::TraitImpl => return,

View file

@ -416,7 +416,7 @@ impl<'tcx> Body<'tcx> {
(self.arg_count + 1..self.local_decls.len()).filter_map(move |index| {
let local = Local::new(index);
let decl = &self.local_decls[local];
if decl.is_user_variable() && decl.mutability.is_mut() { Some(local) } else { None }
(decl.is_user_variable() && decl.mutability.is_mut()).then(|| local)
})
}

View file

@ -580,7 +580,7 @@ fn write_scope_tree(
continue;
}
let mut_str = if local_decl.mutability.is_mut() { "mut " } else { "" };
let mut_str = local_decl.mutability.prefix_str();
let mut indented_decl =
format!("{0:1$}let {2}{3:?}: {4:?}", INDENT, indent, mut_str, local, local_decl.ty);

View file

@ -768,9 +768,8 @@ impl<'hir> Sig for hir::ForeignItem<'hir> {
}
hir::ForeignItemKind::Static(ref ty, m) => {
let mut text = "static ".to_owned();
if m.is_mut() {
text.push_str("mut ");
}
text.push_str(m.prefix_str());
let name = self.ident.to_string();
let defs = vec![SigElement {
id: id_from_def_id(self.owner_id.to_def_id()),