use clippy_utils::diagnostics::span_lint_and_help;
use rustc_ast::ast::{Crate, Inline, Item, ItemKind, ModKind};
use rustc_errors::MultiSpan;
-use rustc_lint::{EarlyContext, EarlyLintPass, LintContext, Level};
+use rustc_lint::{EarlyContext, EarlyLintPass, Level, LintContext};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::{FileName, Span};
use std::collections::BTreeMap;
/// // a.rs
/// use crate::b;
/// ```
- #[clippy::version = "1.62.0"]
+ #[clippy::version = "1.63.0"]
pub DUPLICATE_MOD,
suspicious,
"file loaded as module multiple times"
}
fn check_crate_post(&mut self, cx: &EarlyContext<'_>, _: &Crate) {
- for Modules { local_path, spans, lint_levels } in self.modules.values() {
+ for Modules {
+ local_path,
+ spans,
+ lint_levels,
+ } in self.modules.values()
+ {
if spans.len() < 2 {
continue;
}
// At this point the lint would be emitted
assert_eq!(spans.len(), lint_levels.len());
- let spans: Vec<_> = spans.into_iter().zip(lint_levels).filter_map(|(span, lvl)|{
- if let Some(id) = lvl.get_expectation_id() {
- cx.fulfill_expectation(id);
- }
+ let spans: Vec<_> = spans
+ .iter()
+ .zip(lint_levels)
+ .filter_map(|(span, lvl)| {
+ if let Some(id) = lvl.get_expectation_id() {
+ cx.fulfill_expectation(id);
+ }
- (!matches!(lvl, Level::Allow | Level::Expect(_))).then_some(*span)
- })
- .collect();
+ (!matches!(lvl, Level::Allow | Level::Expect(_))).then_some(*span)
+ })
+ .collect();
if spans.len() < 2 {
continue;