Skip to content

Commit ab8f98e

Browse files
committed
Polish
1 parent c86bd14 commit ab8f98e

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

compiler/rustc_lint/src/late.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,10 @@ fn late_lint_crate<'tcx>(tcx: TyCtxt<'tcx>) {
433433
LintPass::get_lints(pass).iter().any(|&lint| hashmap.contains(&LintId::of(lint)))
434434
}).collect();
435435

436-
// let mut passes: Vec<std::boxed::Box<dyn LateLintPass<'tcx>>> = passes
437-
// .into_iter()
438-
// .filter(|pass| {
439-
// LintPass::get_lints(pass).iter().any(|&lint| )
440-
// })
441-
// .collect();
436+
// filtered_passes may be empty in case of `#[allow(all)]`
437+
if filtered_passes.is_empty() {
438+
return;
439+
}
442440

443441
let pass = RuntimeCombinedLateLintPass { passes: &mut filtered_passes[..] };
444442
late_lint_crate_inner(tcx, context, pass);

compiler/rustc_lint/src/levels.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,11 @@ pub fn lints_that_can_emit(
162162
) -> Vec<LintId> {
163163
let store = unerased_lint_store(&tcx.sess);
164164

165-
// let mut builder = LintLevelsBuilder {
166-
// sess: tcx.sess,
167-
// features: tcx.features(),
168-
// provider:
169-
// warn_about_weird_lints: false,
170-
// store,
171-
// registered_tools: &tcx.registered_tools(()),
172-
// };
173165
let specs = tcx.shallow_lint_levels_on(hir::CRATE_HIR_ID.owner);
174166
let lints = store.get_lints();
175167

176168
let mut hashmap: Vec<LintId> = Vec::new();
177-
hashmap.reserve((lints.len() >> 1) * usize::from(tcx.sess.opts.lint_cap.is_some())); // Avoid allocations, it's better to
169+
hashmap.reserve((lints.len() >> 1) * usize::from(tcx.sess.opts.lint_cap.is_some())); // Avoid allocations
178170

179171
for &lint in lints {
180172
let lint_id = LintId::of(lint);

compiler/rustc_lint/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ pub fn provide(providers: &mut Providers) {
137137
}
138138

139139
fn lint_mod(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) {
140-
if let Some(lint_cap) = tcx.sess.opts.lint_cap && lint_cap == Level::Allow {
141-
return;
142-
}
143140
late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new());
144141
}
145142

0 commit comments

Comments
 (0)