Skip to content

Commit fb40156

Browse files
committed
Remove #[macro_use] extern crate tracing from rustc_lint.
And rearrange some `use` item lists while adding the `use tracing::*` items.
1 parent 39e02f1 commit fb40156

File tree

11 files changed

+17
-18
lines changed

11 files changed

+17
-18
lines changed

compiler/rustc_lint/src/builtin.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
//! `late_lint_methods!` invocation in `lib.rs`.
2222
2323
use crate::fluent_generated as fluent;
24+
use crate::nonstandard_style::{method_context, MethodLateContext};
2425
use crate::{
2526
errors::BuiltinEllipsisInclusiveRangePatterns,
2627
lints::{
@@ -70,10 +71,8 @@ use rustc_target::abi::Abi;
7071
use rustc_trait_selection::infer::{InferCtxtExt, TyCtxtInferExt};
7172
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
7273
use rustc_trait_selection::traits::{self, misc::type_allowed_to_implement_copy};
73-
74-
use crate::nonstandard_style::{method_context, MethodLateContext};
75-
7674
use std::fmt::Write;
75+
use tracing::debug;
7776

7877
// hardwired lints from rustc_lint_defs
7978
pub use rustc_session::lint::builtin::*;

compiler/rustc_lint/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ use rustc_span::edit_distance::find_best_match_for_names;
3939
use rustc_span::symbol::{sym, Ident, Symbol};
4040
use rustc_span::Span;
4141
use rustc_target::abi;
42-
4342
use std::cell::Cell;
4443
use std::iter;
4544
use std::slice;
45+
use tracing::debug;
4646

4747
mod diagnostics;
4848

compiler/rustc_lint/src/context/diagnostics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use rustc_middle::middle::stability;
88
use rustc_session::lint::BuiltinLintDiag;
99
use rustc_session::Session;
1010
use rustc_span::BytePos;
11+
use tracing::debug;
1112

1213
mod check_cfg;
1314

compiler/rustc_lint/src/early.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use rustc_session::lint::{BufferedEarlyLint, LintBuffer, LintPass};
2626
use rustc_session::Session;
2727
use rustc_span::symbol::Ident;
2828
use rustc_span::Span;
29+
use tracing::debug;
2930

3031
macro_rules! lint_callback { ($cx:expr, $f:ident, $($args:expr),*) => ({
3132
$cx.pass.$f(&$cx.context, $($args),*);

compiler/rustc_lint/src/foreign_modules.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use crate::lints::{BuiltinClashingExtern, BuiltinClashingExternSub};
2+
use crate::{types, LintVec};
13
use rustc_data_structures::stack::ensure_sufficient_stack;
24
use rustc_data_structures::unord::{UnordMap, UnordSet};
35
use rustc_hir as hir;
@@ -8,9 +10,7 @@ use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
810
use rustc_session::declare_lint;
911
use rustc_span::{sym, Span, Symbol};
1012
use rustc_target::abi::FIRST_VARIANT;
11-
12-
use crate::lints::{BuiltinClashingExtern, BuiltinClashingExternSub};
13-
use crate::{types, LintVec};
13+
use tracing::{debug, instrument};
1414

1515
pub(crate) fn provide(providers: &mut Providers) {
1616
*providers = Providers { clashing_extern_declarations, ..*providers };

compiler/rustc_lint/src/internal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
1515
use rustc_span::hygiene::{ExpnKind, MacroKind};
1616
use rustc_span::symbol::{kw, sym, Symbol};
1717
use rustc_span::Span;
18+
use tracing::debug;
1819

1920
declare_tool_lint! {
2021
/// The `default_hash_type` lint detects use of [`std::collections::HashMap`]/[`std::collections::HashSet`],

compiler/rustc_lint/src/late.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ use rustc_middle::ty::{self, TyCtxt};
2626
use rustc_session::lint::LintPass;
2727
use rustc_session::Session;
2828
use rustc_span::Span;
29-
3029
use std::any::Any;
3130
use std::cell::Cell;
31+
use tracing::debug;
3232

3333
/// Extract the [`LintStore`] from [`Session`].
3434
///

compiler/rustc_lint/src/levels.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use crate::errors::{CheckNameUnknownTool, RequestedLevel, UnsupportedGroup};
1+
use crate::errors::{
2+
CheckNameUnknownTool, MalformedAttribute, MalformedAttributeSub, OverruledAttribute,
3+
OverruledAttributeSub, RequestedLevel, UnknownToolInScopedLint, UnsupportedGroup,
4+
};
25
use crate::lints::{
36
DeprecatedLintNameFromCommandLine, RemovedLintFromCommandLine, RenamedLintFromCommandLine,
47
UnknownLintFromCommandLine,
@@ -41,11 +44,7 @@ use rustc_session::parse::feature_err;
4144
use rustc_session::Session;
4245
use rustc_span::symbol::{sym, Symbol};
4346
use rustc_span::{Span, DUMMY_SP};
44-
45-
use crate::errors::{
46-
MalformedAttribute, MalformedAttributeSub, OverruledAttribute, OverruledAttributeSub,
47-
UnknownToolInScopedLint,
48-
};
47+
use tracing::{debug, instrument};
4948

5049
/// Collection of lint levels for the whole crate.
5150
/// This is used by AST-based lints, which do not

compiler/rustc_lint/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@
3939
#![feature(rustc_attrs)]
4040
#![allow(internal_features)]
4141

42-
#[macro_use]
43-
extern crate tracing;
44-
4542
mod async_fn_in_trait;
4643
pub mod builtin;
4744
mod context;

compiler/rustc_lint/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ use rustc_span::{Span, Symbol};
3131
use rustc_target::abi::{Abi, Size, WrappingRange};
3232
use rustc_target::abi::{Integer, TagEncoding, Variants};
3333
use rustc_target::spec::abi::Abi as SpecAbi;
34-
3534
use std::iter;
3635
use std::ops::ControlFlow;
36+
use tracing::debug;
3737

3838
declare_lint! {
3939
/// The `unused_comparisons` lint detects comparisons made useless by

compiler/rustc_lint/src/unused.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use rustc_span::symbol::{kw, sym};
2222
use rustc_span::{BytePos, Span};
2323
use std::iter;
2424
use std::ops::ControlFlow;
25+
use tracing::instrument;
2526

2627
declare_lint! {
2728
/// The `unused_must_use` lint detects unused result of a type flagged as

0 commit comments

Comments
 (0)