Rollup merge of #92868 - pierwill:librustdoc-clippy, r=camelid

librustdoc: Address some clippy lints
This commit is contained in:
Matthias Krüger 2022-01-15 02:25:19 +01:00 committed by GitHub
commit 8f4155909c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 13 deletions

View File

@ -1191,11 +1191,9 @@ fn render_deref_methods(
} }
} }
render_assoc_items_inner(w, cx, container_item, did, what, derefs); render_assoc_items_inner(w, cx, container_item, did, what, derefs);
} else { } else if let Some(prim) = target.primitive_type() {
if let Some(prim) = target.primitive_type() { if let Some(&did) = cache.primitive_locations.get(&prim) {
if let Some(&did) = cache.primitive_locations.get(&prim) { render_assoc_items_inner(w, cx, container_item, did, what, derefs);
render_assoc_items_inner(w, cx, container_item, did, what, derefs);
}
} }
} }
} }

View File

@ -129,12 +129,12 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer,
}; };
let item_vars = ItemVars { let item_vars = ItemVars {
page: page, page,
static_root_path: page.get_static_root_path(), static_root_path: page.get_static_root_path(),
typ: typ, typ,
name: item.name.as_ref().unwrap().as_str(), name: item.name.as_ref().unwrap().as_str(),
item_type: &item.type_().to_string(), item_type: &item.type_().to_string(),
path_components: path_components, path_components,
stability_since_raw: &stability_since_raw, stability_since_raw: &stability_since_raw,
src_href: src_href.as_deref(), src_href: src_href.as_deref(),
}; };

View File

@ -18,6 +18,7 @@
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![recursion_limit = "256"] #![recursion_limit = "256"]
#![warn(rustc::internal)] #![warn(rustc::internal)]
#![allow(clippy::collapsible_if, clippy::collapsible_else_if)]
#[macro_use] #[macro_use]
extern crate tracing; extern crate tracing;

View File

@ -43,11 +43,10 @@ impl<'a> DocFolder for Stripper<'a> {
| clean::TraitAliasItem(..) | clean::TraitAliasItem(..)
| clean::MacroItem(..) | clean::MacroItem(..)
| clean::ForeignTypeItem => { | clean::ForeignTypeItem => {
if i.def_id.is_local() { if i.def_id.is_local() && !self.access_levels.is_exported(i.def_id.expect_def_id())
if !self.access_levels.is_exported(i.def_id.expect_def_id()) { {
debug!("Stripper: stripping {:?} {:?}", i.type_(), i.name); debug!("Stripper: stripping {:?} {:?}", i.type_(), i.name);
return None; return None;
}
} }
} }