Skip to content

Commit 7e055c6

Browse files
committed
librustdoc: Address some clippy lints
Also ignore clippy's "collapsible if..." lints.
1 parent 256721e commit 7e055c6

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

src/librustdoc/html/render/mod.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1190,11 +1190,9 @@ fn render_deref_methods(
11901190
}
11911191
}
11921192
render_assoc_items_inner(w, cx, container_item, did, what, derefs);
1193-
} else {
1194-
if let Some(prim) = target.primitive_type() {
1195-
if let Some(&did) = cache.primitive_locations.get(&prim) {
1196-
render_assoc_items_inner(w, cx, container_item, did, what, derefs);
1197-
}
1193+
} else if let Some(prim) = target.primitive_type() {
1194+
if let Some(&did) = cache.primitive_locations.get(&prim) {
1195+
render_assoc_items_inner(w, cx, container_item, did, what, derefs);
11981196
}
11991197
}
12001198
}

src/librustdoc/html/render/print_item.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer,
127127
};
128128

129129
let item_vars = ItemVars {
130-
page: page,
130+
page,
131131
static_root_path: page.get_static_root_path(),
132-
typ: typ,
132+
typ,
133133
name: item.name.as_ref().unwrap().as_str(),
134134
item_type: &item.type_().to_string(),
135-
path_components: path_components,
135+
path_components,
136136
stability_since_raw: &stability_since_raw,
137137
src_href: src_href.as_deref(),
138138
};

src/librustdoc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#![feature(iter_intersperse)]
1919
#![recursion_limit = "256"]
2020
#![warn(rustc::internal)]
21+
#![allow(clippy::collapsible_if, clippy::collapsible_else_if)]
2122

2223
#[macro_use]
2324
extern crate tracing;

src/librustdoc/passes/stripper.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ impl<'a> DocFolder for Stripper<'a> {
4343
| clean::TraitAliasItem(..)
4444
| clean::MacroItem(..)
4545
| clean::ForeignTypeItem => {
46-
if i.def_id.is_local() {
47-
if !self.access_levels.is_exported(i.def_id.expect_def_id()) {
48-
debug!("Stripper: stripping {:?} {:?}", i.type_(), i.name);
49-
return None;
50-
}
46+
if i.def_id.is_local() && !self.access_levels.is_exported(i.def_id.expect_def_id())
47+
{
48+
debug!("Stripper: stripping {:?} {:?}", i.type_(), i.name);
49+
return None;
5150
}
5251
}
5352

0 commit comments

Comments
 (0)