diff options
| author | Philipp Hansch <dev@phansch.net> | 2021-01-05 16:03:39 +0100 |
|---|---|---|
| committer | Philipp Hansch <dev@phansch.net> | 2021-01-05 16:03:39 +0100 |
| commit | ea885d90ad3d041cbd7918ab25b4fb2d5f7bc5e6 (patch) | |
| tree | 13b68de45a98914432f9fb4bf837a18d33109aeb | |
| parent | a6b72d378f71ed8d2c6849d97571a4c1d8e27afa (diff) | |
| download | rust-ea885d90ad3d041cbd7918ab25b4fb2d5f7bc5e6.tar.gz rust-ea885d90ad3d041cbd7918ab25b4fb2d5f7bc5e6.zip | |
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
| -rw-r--r-- | clippy_lints/src/utils/mod.rs | 10 | ||||
| -rw-r--r-- | clippy_lints/src/utils/sym_helper.rs (renamed from clippy_lints/src/utils/sym.rs) | 1 |
2 files changed, 6 insertions, 5 deletions
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 1c68e837c4a..8f54cad7728 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -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 } diff --git a/clippy_lints/src/utils/sym.rs b/clippy_lints/src/utils/sym_helper.rs index 273288c3d52..f47dc80ebad 100644 --- a/clippy_lints/src/utils/sym.rs +++ b/clippy_lints/src/utils/sym_helper.rs @@ -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)) |
