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,
(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)
})
}
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);
}
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()),