Skip to content

Commit

Permalink
Rollup merge of rust-lang#89990 - petrochenkov:idempty, r=wesleywiser
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthiaskrgr committed Oct 18, 2021
2 parents 79b73ac + 5f2ecc3 commit e84537b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/ui-internal/unnecessary_symbol_str.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ fn main() {
Symbol::intern("foo") == rustc_span::sym::clippy;
Symbol::intern("foo") == rustc_span::symbol::kw::SelfLower;
Symbol::intern("foo") != rustc_span::symbol::kw::SelfUpper;
Ident::invalid().name == rustc_span::sym::clippy;
rustc_span::sym::clippy == Ident::invalid().name;
Ident::empty().name == rustc_span::sym::clippy;
rustc_span::sym::clippy == Ident::empty().name;
}
4 changes: 2 additions & 2 deletions tests/ui-internal/unnecessary_symbol_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ fn main() {
Symbol::intern("foo").as_str() == "clippy";
Symbol::intern("foo").to_string() == "self";
Symbol::intern("foo").to_ident_string() != "Self";
&*Ident::invalid().as_str() == "clippy";
"clippy" == Ident::invalid().to_string();
&*Ident::empty().as_str() == "clippy";
"clippy" == Ident::empty().to_string();
}
9 changes: 4 additions & 5 deletions tests/ui-internal/unnecessary_symbol_str.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ LL | Symbol::intern("foo").to_ident_string() != "Self";
error: unnecessary `Symbol` to string conversion
--> $DIR/unnecessary_symbol_str.rs:14:5
|
LL | &*Ident::invalid().as_str() == "clippy";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Ident::invalid().name == rustc_span::sym::clippy`
LL | &*Ident::empty().as_str() == "clippy";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Ident::empty().name == rustc_span::sym::clippy`

error: unnecessary `Symbol` to string conversion
--> $DIR/unnecessary_symbol_str.rs:15:5
|
LL | "clippy" == Ident::invalid().to_string();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::sym::clippy == Ident::invalid().name`
LL | "clippy" == Ident::empty().to_string();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `rustc_span::sym::clippy == Ident::empty().name`

error: aborting due to 5 previous errors

0 comments on commit e84537b

Please sign in to comment.