Improve [std|alloc]_instead_of_[alloc|core] lints

* Don't call `TyCtxt::crate_name` unless necessary
* Don't lint on `use std::env`
* Only lint once on `use std::vec`
This commit is contained in:
Jason Newcomb
2022-07-24 20:17:55 -04:00
parent 20e4204730
commit 6bc024df18
4 changed files with 80 additions and 52 deletions

View File

@@ -916,7 +916,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
let verbose_bit_mask_threshold = conf.verbose_bit_mask_threshold;
store.register_late_pass(move || Box::new(operators::Operators::new(verbose_bit_mask_threshold)));
store.register_late_pass(|| Box::new(invalid_utf8_in_unchecked::InvalidUtf8InUnchecked));
store.register_late_pass(|| Box::new(std_instead_of_core::StdReexports));
store.register_late_pass(|| Box::new(std_instead_of_core::StdReexports::default()));
// add lints here, do not remove this comment, it's used in `new_lint`
}