]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui-internal/interning_defined_symbol.fixed
Rollup merge of #105768 - fee1-dead-contrib:iat-style, r=eholk
[rust.git] / src / tools / clippy / tests / ui-internal / interning_defined_symbol.fixed
1 // run-rustfix
2 #![deny(clippy::internal)]
3 #![allow(clippy::missing_clippy_version_attribute, clippy::let_unit_value)]
4 #![feature(rustc_private)]
5
6 extern crate rustc_span;
7
8 use rustc_span::symbol::Symbol;
9
10 macro_rules! sym {
11     ($tt:tt) => {
12         rustc_span::symbol::Symbol::intern(stringify!($tt))
13     };
14 }
15
16 fn main() {
17     // Direct use of Symbol::intern
18     let _ = rustc_span::sym::f32;
19
20     // Using a sym macro
21     let _ = rustc_span::sym::f32;
22
23     // Correct suggestion when symbol isn't stringified constant name
24     let _ = rustc_span::sym::proc_dash_macro;
25
26     // interning a keyword
27     let _ = rustc_span::symbol::kw::SelfLower;
28
29     // Interning a symbol that is not defined
30     let _ = Symbol::intern("xyz123");
31     let _ = sym!(xyz123);
32
33     // Using a different `intern` function
34     let _ = intern("f32");
35 }
36
37 fn intern(_: &str) {}