Auto merge of #6551 - phansch:tiny-symbol-cleanup, r=flip1995

Tiny Symbol cleanup

* Renames `sym.rs` to `sym_helper.rs` so that the `sym as rustc_sym` is no longer needed.
* Removes one needless `symbol` from a path

changelog: none
This commit is contained in:
bors 2021-01-05 15:22:57 +00:00
commit 42b9e92af7
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
#[macro_use]
pub mod sym;
pub mod sym_helper;
#[allow(clippy::module_name_repetitions)]
pub mod ast_utils;
@ -56,8 +56,8 @@ use rustc_semver::RustcVersion;
use rustc_session::Session;
use rustc_span::hygiene::{ExpnKind, MacroKind};
use rustc_span::source_map::original_sp;
use rustc_span::sym as rustc_sym;
use rustc_span::symbol::{self, kw, Symbol};
use rustc_span::sym;
use rustc_span::symbol::{kw, Symbol};
use rustc_span::{BytePos, Pos, Span, DUMMY_SP};
use rustc_target::abi::Integer;
use rustc_trait_selection::traits::query::normalize::AtExt;
@ -1121,7 +1121,7 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
/// Checks for the `#[automatically_derived]` attribute all `#[derive]`d
/// implementations have.
pub fn is_automatically_derived(attrs: &[ast::Attribute]) -> bool {
attrs.iter().any(|attr| attr.has_name(rustc_sym::automatically_derived))
attrs.iter().any(|attr| attr.has_name(sym::automatically_derived))
}
/// Remove blocks around an expression.
@ -1514,7 +1514,7 @@ pub fn is_must_use_func_call(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
pub fn is_no_std_crate(krate: &Crate<'_>) -> bool {
krate.item.attrs.iter().any(|attr| {
if let ast::AttrKind::Normal(ref attr, _) = attr.kind {
attr.path == symbol::sym::no_std
attr.path == sym::no_std
} else {
false
}

View File

@ -1,4 +1,5 @@
#[macro_export]
/// Convenience wrapper around rustc's `Symbol::intern`
macro_rules! sym {
($tt:tt) => {
rustc_span::symbol::Symbol::intern(stringify!($tt))