Rollup merge of #89990 - petrochenkov:idempty, r=wesleywiser

rustc_span: `Ident::invalid` -> `Ident::empty`

The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s as well.
This commit is contained in:
Matthias Krüger 2021-10-18 08:13:30 +02:00 committed by GitHub
commit e84537bcdd
3 changed files with 8 additions and 9 deletions

View File

@ -11,6 +11,6 @@ fn main() {
Symbol::intern("foo") == rustc_span::sym::clippy; Symbol::intern("foo") == rustc_span::sym::clippy;
Symbol::intern("foo") == rustc_span::symbol::kw::SelfLower; Symbol::intern("foo") == rustc_span::symbol::kw::SelfLower;
Symbol::intern("foo") != rustc_span::symbol::kw::SelfUpper; Symbol::intern("foo") != rustc_span::symbol::kw::SelfUpper;
Ident::invalid().name == rustc_span::sym::clippy; Ident::empty().name == rustc_span::sym::clippy;
rustc_span::sym::clippy == Ident::invalid().name; rustc_span::sym::clippy == Ident::empty().name;
} }

View File

@ -11,6 +11,6 @@ fn main() {
Symbol::intern("foo").as_str() == "clippy"; Symbol::intern("foo").as_str() == "clippy";
Symbol::intern("foo").to_string() == "self"; Symbol::intern("foo").to_string() == "self";
Symbol::intern("foo").to_ident_string() != "Self"; Symbol::intern("foo").to_ident_string() != "Self";
&*Ident::invalid().as_str() == "clippy"; &*Ident::empty().as_str() == "clippy";
"clippy" == Ident::invalid().to_string(); "clippy" == Ident::empty().to_string();
} }

View File

@ -26,14 +26,13 @@ LL | Symbol::intern("foo").to_ident_string() != "Self";
error: unnecessary `Symbol` to string conversion error: unnecessary `Symbol` to string conversion
--> $DIR/unnecessary_symbol_str.rs:14:5 --> $DIR/unnecessary_symbol_str.rs:14:5
| |
LL | &*Ident::invalid().as_str() == "clippy"; LL | &*Ident::empty().as_str() == "clippy";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Ident::invalid().name == rustc_span::sym::clippy` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Ident::empty().name == rustc_span::sym::clippy`
error: unnecessary `Symbol` to string conversion error: unnecessary `Symbol` to string conversion
--> $DIR/unnecessary_symbol_str.rs:15:5 --> $DIR/unnecessary_symbol_str.rs:15:5
| |
LL | "clippy" == Ident::invalid().to_string(); LL | "clippy" == Ident::empty().to_string();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::sym::clippy == Ident::invalid().name` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::sym::clippy == Ident::empty().name`
error: aborting due to 5 previous errors error: aborting due to 5 previous errors