Skip to content

Commit 354b1cb

Browse files
committed
Avoid rustc_span:: qualifiers.
In several files they are entirely unnecessary, with the relevant names already imported. And in a few I have added the necessary `use` item.
1 parent 1525f54 commit 354b1cb

File tree

7 files changed

+16
-17
lines changed

7 files changed

+16
-17
lines changed

compiler/rustc_attr_parsing/src/attributes/allow_unstable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::session_diagnostics;
1010

1111
pub(crate) struct AllowInternalUnstableParser;
1212
impl CombineAttributeParser for AllowInternalUnstableParser {
13-
const PATH: &'static [rustc_span::Symbol] = &[sym::allow_internal_unstable];
13+
const PATH: &'static [Symbol] = &[sym::allow_internal_unstable];
1414
type Item = (Symbol, Span);
1515
const CONVERT: ConvertFn<Self::Item> = AttributeKind::AllowInternalUnstable;
1616

@@ -24,7 +24,7 @@ impl CombineAttributeParser for AllowInternalUnstableParser {
2424

2525
pub(crate) struct AllowConstFnUnstableParser;
2626
impl CombineAttributeParser for AllowConstFnUnstableParser {
27-
const PATH: &'static [rustc_span::Symbol] = &[sym::rustc_allow_const_fn_unstable];
27+
const PATH: &'static [Symbol] = &[sym::rustc_allow_const_fn_unstable];
2828
type Item = Symbol;
2929
const CONVERT: ConvertFn<Self::Item> = AttributeKind::AllowConstFnUnstable;
3030

compiler/rustc_attr_parsing/src/attributes/deprecation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ fn get(
4242
}
4343

4444
impl SingleAttributeParser for DeprecationParser {
45-
const PATH: &'static [rustc_span::Symbol] = &[sym::deprecated];
45+
const PATH: &'static [Symbol] = &[sym::deprecated];
4646

47-
fn on_duplicate(cx: &AcceptContext<'_>, first_span: rustc_span::Span) {
47+
fn on_duplicate(cx: &AcceptContext<'_>, first_span: Span) {
4848
// FIXME(jdonszelmann): merge with errors from check_attrs.rs
4949
cx.emit_err(session_diagnostics::UnusedMultiple {
5050
this: cx.attr_span,

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use std::marker::PhantomData;
1818

1919
use rustc_attr_data_structures::AttributeKind;
20-
use rustc_span::Span;
20+
use rustc_span::{Span, Symbol};
2121
use thin_vec::ThinVec;
2222

2323
use crate::context::{AcceptContext, FinalizeContext};
@@ -33,7 +33,7 @@ pub(crate) mod transparency;
3333
pub(crate) mod util;
3434

3535
type AcceptFn<T> = fn(&mut T, &AcceptContext<'_>, &ArgParser<'_>);
36-
type AcceptMapping<T> = &'static [(&'static [rustc_span::Symbol], AcceptFn<T>)];
36+
type AcceptMapping<T> = &'static [(&'static [Symbol], AcceptFn<T>)];
3737

3838
/// An [`AttributeParser`] is a type which searches for syntactic attributes.
3939
///
@@ -72,7 +72,7 @@ pub(crate) trait AttributeParser: Default + 'static {
7272
/// [`SingleAttributeParser`] can only convert attributes one-to-one, and cannot combine multiple
7373
/// attributes together like is necessary for `#[stable()]` and `#[unstable()]` for example.
7474
pub(crate) trait SingleAttributeParser: 'static {
75-
const PATH: &'static [rustc_span::Symbol];
75+
const PATH: &'static [Symbol];
7676

7777
/// Caled when a duplicate attribute is found.
7878
///
@@ -119,7 +119,7 @@ type ConvertFn<E> = fn(ThinVec<E>) -> AttributeKind;
119119
/// [`CombineAttributeParser`] can only convert a single kind of attribute, and cannot combine multiple
120120
/// attributes together like is necessary for `#[stable()]` and `#[unstable()]` for example.
121121
pub(crate) trait CombineAttributeParser: 'static {
122-
const PATH: &'static [rustc_span::Symbol];
122+
const PATH: &'static [Symbol];
123123

124124
type Item;
125125
const CONVERT: ConvertFn<Self::Item>;

compiler/rustc_attr_parsing/src/attributes/repr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_abi::Align;
22
use rustc_ast::{IntTy, LitIntType, LitKind, UintTy};
33
use rustc_attr_data_structures::{AttributeKind, IntType, ReprAttr};
4-
use rustc_span::{Span, Symbol, sym};
4+
use rustc_span::{DUMMY_SP, Span, Symbol, sym};
55

66
use super::{CombineAttributeParser, ConvertFn};
77
use crate::context::AcceptContext;
@@ -21,7 +21,7 @@ pub(crate) struct ReprParser;
2121

2222
impl CombineAttributeParser for ReprParser {
2323
type Item = (ReprAttr, Span);
24-
const PATH: &'static [rustc_span::Symbol] = &[sym::repr];
24+
const PATH: &'static [Symbol] = &[sym::repr];
2525
const CONVERT: ConvertFn<Self::Item> = AttributeKind::Repr;
2626

2727
fn extend<'a>(
@@ -99,7 +99,7 @@ fn parse_repr(cx: &AcceptContext<'_>, param: &MetaItemParser<'_>) -> Option<Repr
9999
let (name, ident_span) = if let Some(ident) = param.path_without_args().word() {
100100
(Some(ident.name), ident.span)
101101
} else {
102-
(None, rustc_span::DUMMY_SP)
102+
(None, DUMMY_SP)
103103
};
104104

105105
let args = param.args();

compiler/rustc_attr_parsing/src/attributes/stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl AttributeParser for BodyStabilityParser {
117117
pub(crate) struct ConstStabilityIndirectParser;
118118
// FIXME(jdonszelmann): single word attribute group when we have these
119119
impl SingleAttributeParser for ConstStabilityIndirectParser {
120-
const PATH: &'static [rustc_span::Symbol] = &[sym::rustc_const_stable_indirect];
120+
const PATH: &'static [Symbol] = &[sym::rustc_const_stable_indirect];
121121

122122
// ignore
123123
fn on_duplicate(_cx: &AcceptContext<'_>, _first_span: Span) {}

compiler/rustc_attr_parsing/src/attributes/transparency.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_attr_data_structures::AttributeKind;
22
use rustc_span::hygiene::Transparency;
3-
use rustc_span::sym;
3+
use rustc_span::{Span, Symbol, sym};
44

55
use super::{AcceptContext, SingleAttributeParser};
66
use crate::parser::ArgParser;
@@ -11,9 +11,9 @@ pub(crate) struct TransparencyParser;
1111
#[allow(rustc::untranslatable_diagnostic)]
1212
#[allow(rustc::diagnostic_outside_of_impl)]
1313
impl SingleAttributeParser for TransparencyParser {
14-
const PATH: &'static [rustc_span::Symbol] = &[sym::rustc_macro_transparency];
14+
const PATH: &'static [Symbol] = &[sym::rustc_macro_transparency];
1515

16-
fn on_duplicate(cx: &crate::context::AcceptContext<'_>, first_span: rustc_span::Span) {
16+
fn on_duplicate(cx: &crate::context::AcceptContext<'_>, first_span: Span) {
1717
cx.dcx().span_err(vec![first_span, cx.attr_span], "multiple macro transparency attributes");
1818
}
1919

compiler/rustc_attr_parsing/src/parser.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ use rustc_ast::{AttrArgs, DelimArgs, Expr, ExprKind, LitKind, MetaItemLit, Norma
1212
use rustc_ast_pretty::pprust;
1313
use rustc_errors::DiagCtxtHandle;
1414
use rustc_hir::{self as hir, AttrPath};
15-
use rustc_span::symbol::{Ident, kw, sym};
16-
use rustc_span::{ErrorGuaranteed, Span, Symbol};
15+
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
1716

1817
pub struct SegmentIterator<'a> {
1918
offset: usize,

0 commit comments

Comments
 (0)