Skip to content

Commit

Permalink
Rollup merge of rust-lang#129774 - nnethercote:rm-extern-crate-tracin…
Browse files Browse the repository at this point in the history
…g-remainder, r=GuillaumeGomez

Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt

A follow-up to rust-lang#129767 and earlier PRs doing this for `rustc_*` crates.

r? `@GuillaumeGomez`
  • Loading branch information
workingjubilee authored Aug 31, 2024
2 parents b49ba78 + ee5ec5a commit cff2cc2
Show file tree
Hide file tree
Showing 48 changed files with 49 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/librustdoc/clean/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use rustc_span::def_id::DefId;
use rustc_span::symbol::{kw, Symbol};
use rustc_trait_selection::traits::auto_trait::{self, RegionTarget};
use thin_vec::ThinVec;
use tracing::{debug, instrument};

use crate::clean::{
self, clean_generic_param_def, clean_middle_ty, clean_predicate,
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/clean/blanket_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use rustc_span::def_id::DefId;
use rustc_span::DUMMY_SP;
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
use thin_vec::ThinVec;
use tracing::{debug, instrument, trace};

use crate::clean;
use crate::clean::{
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/clean/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use rustc_span::def_id::LOCAL_CRATE;
use rustc_span::hygiene::MacroKind;
use rustc_span::symbol::{sym, Symbol};
use thin_vec::{thin_vec, ThinVec};
use tracing::{debug, trace};
use {rustc_ast as ast, rustc_hir as hir};

use super::Item;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::ExpnKind;
use rustc_trait_selection::traits::wf::object_region_bounds;
use thin_vec::ThinVec;
use tracing::{debug, instrument};
use utils::*;
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};

Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use rustc_span::{FileName, Loc, DUMMY_SP};
use rustc_target::abi::VariantIdx;
use rustc_target::spec::abi::Abi;
use thin_vec::ThinVec;
use tracing::{debug, trace};
use {rustc_ast as ast, rustc_hir as hir};

pub(crate) use self::ItemKind::*;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use rustc_middle::mir;
use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, TyCtxt, TypeVisitableExt};
use rustc_span::symbol::{kw, sym, Symbol};
use thin_vec::{thin_vec, ThinVec};
use tracing::{debug, warn};
use {rustc_ast as ast, rustc_hir as hir};

use crate::clean::auto_trait::synthesize_auto_trait_impls;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub(crate) use rustc_session::config::{Options, UnstableOptions};
use rustc_session::{lint, Session};
use rustc_span::symbol::sym;
use rustc_span::{source_map, Span};
use tracing::{debug, info};

use crate::clean::inline::build_external_trait;
use crate::clean::{self, ItemId};
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use rustc_span::symbol::sym;
use rustc_span::FileName;
use rustc_target::spec::{Target, TargetTriple};
use tempfile::{Builder as TempFileBuilder, TempDir};
use tracing::debug;

use self::rust::HirCollector;
use crate::config::Options as RustdocOptions;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/doctest/make.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use rustc_span::edition::Edition;
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::sym;
use rustc_span::FileName;
use tracing::debug;

use super::GlobalTestOptions;
use crate::html::markdown::LangString;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/formats/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet};
use rustc_middle::ty::{self, TyCtxt};
use rustc_span::Symbol;
use tracing::debug;

use crate::clean::types::ExternalLocation;
use crate::clean::{self, ExternalCrate, ItemId, PrimitiveType};
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/formats/renderer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use rustc_middle::ty::TyCtxt;
use tracing::debug;

use crate::clean;
use crate::config::RenderOptions;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use rustc_middle::ty::TyCtxt;
use rustc_span::symbol::kw;
use rustc_span::{sym, Symbol};
use rustc_target::spec::abi::Abi;
use tracing::{debug, trace};
use {rustc_ast as ast, rustc_hir as hir};

use super::url_parts_builder::{estimate_item_path_byte_length, UrlPartsBuilder};
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub(crate) use rustc_resolve::rustdoc::main_body_opts;
use rustc_resolve::rustdoc::may_be_doc_link;
use rustc_span::edition::Edition;
use rustc_span::{Span, Symbol};
use tracing::{debug, trace};

use crate::clean::RenderedLink;
use crate::doctest;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use rustc_middle::ty::TyCtxt;
use rustc_session::Session;
use rustc_span::edition::Edition;
use rustc_span::{sym, FileName, Symbol};
use tracing::info;

use super::print_item::{full_path, item_path, print_item};
use super::sidebar::{print_sidebar, sidebar_module_like, Sidebar};
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ use rustc_span::symbol::{sym, Symbol};
use rustc_span::{BytePos, FileName, RealFileName, DUMMY_SP};
use serde::ser::SerializeMap;
use serde::{Serialize, Serializer};
use tracing::{debug, info};

pub(crate) use self::context::*;
pub(crate) use self::span_map::{collect_spans_and_sources, LinkFromSrc};
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use rustc_middle::ty::{self, TyCtxt};
use rustc_span::hygiene::MacroKind;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_target::abi::VariantIdx;
use tracing::{debug, info};

use super::type_layout::document_type_layout;
use super::{
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/render/search_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use rustc_span::sym;
use rustc_span::symbol::{kw, Symbol};
use serde::ser::{Serialize, SerializeSeq, SerializeStruct, Serializer};
use thin_vec::ThinVec;
use tracing::instrument;

use crate::clean;
use crate::clean::types::{Function, Generics, ItemId, Type, WherePredicate};
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/render/sidebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_hir::def::CtorKind;
use rustc_hir::def_id::DefIdSet;
use rustc_middle::ty::{self, TyCtxt};
use tracing::debug;

use super::{item_ty_to_section, Context, ItemSection};
use crate::clean;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/html/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use rustc_hir::def_id::LOCAL_CRATE;
use rustc_middle::ty::TyCtxt;
use rustc_session::Session;
use rustc_span::{sym, FileName};
use tracing::info;

use crate::clean;
use crate::clean::utils::has_doc_flag;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use rustdoc_json_types as types;
// the one from rustc_data_structures, as they're different types due to sysroots.
// See #110051 and #127456 for details
use rustdoc_json_types::FxHashMap;
use tracing::{debug, trace};

use crate::clean::types::{ExternalCrate, ExternalLocation};
use crate::clean::ItemKind;
Expand Down
3 changes: 1 addition & 2 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#![allow(rustc::untranslatable_diagnostic)]

extern crate thin_vec;
#[macro_use]
extern crate tracing;

// N.B. these need `extern crate` even in 2018 edition
// because they're loaded implicitly from the sysroot.
Expand Down Expand Up @@ -83,6 +81,7 @@ use rustc_interface::interface;
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{make_crate_type_option, ErrorOutputType, RustcOptGroup};
use rustc_session::{getopts, EarlyDiagCtxt};
use tracing::info;

use crate::clean::utils::DOC_RUST_LANG_ORG_CHANNEL;

Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/passes/calculate_doc_coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use rustc_middle::lint::LintLevelSource;
use rustc_session::lint;
use rustc_span::FileName;
use serde::Serialize;
use tracing::debug;

use crate::clean;
use crate::core::DocContext;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/passes/check_doc_test_visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use rustc_hir as hir;
use rustc_middle::lint::LintLevelSource;
use rustc_session::lint;
use tracing::debug;

use super::Pass;
use crate::clean;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use rustc_span::hygiene::MacroKind;
use rustc_span::symbol::{sym, Ident, Symbol};
use rustc_span::BytePos;
use smallvec::{smallvec, SmallVec};
use tracing::{debug, info, instrument, trace};

use crate::clean::utils::find_nearest_parent_module;
use crate::clean::{self, Crate, Item, ItemLink, PrimitiveType};
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/passes/collect_trait_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, LOCAL_CRATE};
use rustc_middle::ty;
use rustc_span::symbol::sym;
use tracing::debug;

use super::Pass;
use crate::clean::*;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/passes/lint/bare_urls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use pulldown_cmark::{Event, Parser, Tag};
use regex::Regex;
use rustc_errors::Applicability;
use rustc_resolve::rustdoc::source_span_for_markdown_range;
use tracing::trace;

use crate::clean::*;
use crate::core::DocContext;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/passes/strip_hidden.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::mem;
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
use rustc_middle::ty::TyCtxt;
use rustc_span::symbol::sym;
use tracing::debug;

use crate::clean;
use crate::clean::utils::inherits_doc_hidden;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/passes/stripper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::mem;

use rustc_hir::def_id::DefId;
use rustc_middle::ty::{TyCtxt, Visibility};
use tracing::debug;

use crate::clean::utils::inherits_doc_hidden;
use crate::clean::{self, Item, ItemId, ItemIdSet};
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/scrape_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use rustc_session::getopts;
use rustc_span::def_id::{CrateNum, DefPathHash, LOCAL_CRATE};
use rustc_span::edition::Edition;
use rustc_span::{BytePos, FileName, SourceFile};
use tracing::{debug, trace, warn};

use crate::formats::renderer::FormatRenderer;
use crate::html::render::Context;
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/visit_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use rustc_span::def_id::{CRATE_DEF_ID, LOCAL_CRATE};
use rustc_span::hygiene::MacroKind;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::Span;
use tracing::debug;

use crate::clean::cfg::Cfg;
use crate::clean::utils::{inherits_doc_hidden, should_ignore_res};
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use rustc_ast::ast;
use rustc_ast::HasAttrs;
use rustc_span::{symbol::sym, Span};
use tracing::debug;

use self::doc_comment::DocCommentFormatter;
use crate::comment::{contains_comment, rewrite_doc_comment, CommentStyle};
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ use std::cmp::min;

use rustc_ast::{ast, ptr};
use rustc_span::{symbol, BytePos, Span};
use tracing::debug;

use crate::comment::{rewrite_comment, CharClasses, FullCodeCharKind, RichChar};
use crate::config::{IndentStyle, Version};
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/closures.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use rustc_ast::{ast, ptr};
use rustc_span::Span;
use thin_vec::thin_vec;
use tracing::debug;

use crate::attr::get_attrs_from_stmt;
use crate::config::lists::*;
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{borrow::Cow, iter};

use itertools::{multipeek, MultiPeek};
use rustc_span::Span;
use tracing::{debug, trace};

use crate::config::Config;
use crate::rewrite::RewriteContext;
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use itertools::Itertools;
use rustc_ast::token::{Delimiter, Lit, LitKind};
use rustc_ast::{ast, ptr, token, ForLoopKind, MatchKind};
use rustc_span::{BytePos, Span};
use tracing::debug;

use crate::chains::rewrite_chain;
use crate::closures;
Expand Down
4 changes: 1 addition & 3 deletions src/tools/rustfmt/src/format-diff/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

#![deny(warnings)]

#[macro_use]
extern crate tracing;

use serde::{Deserialize, Serialize};
use serde_json as json;
use thiserror::Error;
use tracing::debug;
use tracing_subscriber::EnvFilter;

use std::collections::HashSet;
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::time::{Duration, Instant};

use rustc_ast::ast;
use rustc_span::Span;
use tracing::debug;

use self::newline_style::apply_newline_style;
use crate::comment::{CharClasses, FullCodeCharKind};
Expand Down
4 changes: 1 addition & 3 deletions src/tools/rustfmt/src/git-rustfmt/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// `rustc_driver`.
#![feature(rustc_private)]

#[macro_use]
extern crate tracing;

use std::env;
use std::io::stdout;
use std::path::{Path, PathBuf};
Expand All @@ -13,6 +10,7 @@ use std::str::FromStr;

use getopts::{Matches, Options};
use rustfmt_nightly as rustfmt;
use tracing::debug;
use tracing_subscriber::EnvFilter;

use crate::rustfmt::{load_config, CliOptions, FormatReportFormatterBuilder, Input, Session};
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use regex::Regex;
use rustc_ast::visit;
use rustc_ast::{ast, ptr};
use rustc_span::{symbol, BytePos, Span, DUMMY_SP};
use tracing::debug;

use crate::attr::filter_inline_attrs;
use crate::comment::{
Expand Down
4 changes: 2 additions & 2 deletions src/tools/rustfmt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#![allow(clippy::match_like_matches_macro)]
#![allow(unreachable_pub)]

#[macro_use]
extern crate tracing;
// #[macro_use]
// extern crate tracing;

// N.B. these crates are loaded from the sysroot, so they need extern crate.
extern crate rustc_ast;
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use rustc_span::{
symbol::{self, kw},
BytePos, Span, Symbol, DUMMY_SP,
};
use tracing::debug;

use crate::comment::{
contains_comment, CharClasses, FindUncommented, FullCodeCharKind, LineClasses,
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::iter::repeat;

use rustc_ast::{ast, ptr, MatchKind};
use rustc_span::{BytePos, Span};
use tracing::debug;

use crate::comment::{combine_strs_with_missing_comments, rewrite_comment, FindUncommented};
use crate::config::lists::*;
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/missed_spans.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use rustc_span::{BytePos, Pos, Span};
use tracing::debug;

use crate::comment::{is_last_comment_block, rewrite_comment, CodeCharKind, CommentCodeSlices};
use crate::config::file_lines::FileLines;
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/modules/visitor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use rustc_ast::ast;
use rustc_ast::visit::Visitor;
use rustc_span::Symbol;
use tracing::debug;

use crate::attr::MetaVisitor;
use crate::parse::macros::cfg_if::parse_cfg_if;
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use itertools::Itertools;
use rustc_ast::token::Delimiter;
use rustc_ast::{ast, ptr};
use rustc_span::Span;
use tracing::debug;

use crate::closures;
use crate::config::Version;
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::source_file;
use crate::{is_nightly_channel, FormatReport, FormatReportFormatterBuilder, Input, Session};

use rustfmt_config_proc_macro::nightly_only_test;
use tracing::{debug, warn};

mod configuration_snippet;
mod mod_resolver;
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustfmt/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::ops::Deref;
use rustc_ast::ast::{self, FnRetTy, Mutability, Term};
use rustc_ast::ptr;
use rustc_span::{symbol::kw, BytePos, Pos, Span};
use tracing::debug;

use crate::comment::{combine_strs_with_missing_comments, contains_comment};
use crate::config::lists::*;
Expand Down
Loading

0 comments on commit cff2cc2

Please sign in to comment.