Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary Symbol stringification in clippy #92952

Closed
wants to merge 1 commit into from

Conversation

camelid
Copy link
Member

@camelid camelid commented Jan 15, 2022

This should (slightly) improve performance and enhance code quality.

@rust-highfive
Copy link
Collaborator

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 15, 2022
@rust-highfive
Copy link
Collaborator

r? @lcnr

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 15, 2022
@camelid
Copy link
Member Author

camelid commented Jan 15, 2022

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 15, 2022
@bors
Copy link
Contributor

bors commented Jan 15, 2022

⌛ Trying commit e427d340bdb803ed5e4de98b7172790daf0389ff with merge ea957266538b17f07990ca8ba2aa4c18ce94e397...

@camelid camelid added the A-clippy Area: Clippy label Jan 15, 2022
@rust-log-analyzer

This comment has been minimized.

@camelid
Copy link
Member Author

camelid commented Jan 15, 2022

Hmm, it seems like the rustc version is actually hard to get rid of. It also seems to only be used in an error path. So I removed that change.

@camelid camelid changed the title Remove unnecessary Symbol stringification Remove unnecessary Symbol stringification in clippy Jan 15, 2022
@camelid camelid removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 15, 2022
@camelid

This comment has been minimized.

1 similar comment
@camelid
Copy link
Member Author

camelid commented Jan 15, 2022

r? @flip1995

@rust-highfive rust-highfive assigned flip1995 and unassigned lcnr Jan 15, 2022
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking cargo_metadata v0.14.0
    Checking rustfix v0.5.1
    Checking rustc-workspace-hack v1.0.0 (/checkout/src/tools/rustc-workspace-hack)
    Checking clippy_lints v0.1.60 (/checkout/src/tools/clippy/clippy_lints)
error[E0425]: cannot find value `Underscore` in module `sym`
    |
964 |                     let mut ident_bind_name = sym::Underscore;
    |                                                    ^^^^^^^^^^ not found in `sym`
    |
---
1   | use rustc_ast::ExprKind::Underscore;
    |
1   | use rustc_hir::LifetimeName::Underscore;
    |
1   | use rustc_span::symbol::kw::Underscore;

For more information about this error, try `rustc --explain E0425`.
error: could not compile `clippy_lints` due to previous error
Build completed unsuccessfully in 0:03:40

@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-linux failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] rustc_codegen_ssa test:false 46.570
   Compiling rustc_typeck v0.0.0 (/checkout/compiler/rustc_typeck)
[RUSTC-TIMING] rustc_plugin_impl test:false 5.140
   Compiling rustc_borrowck v0.0.0 (/checkout/compiler/rustc_borrowck)
error[E0277]: a value of type `HashSet<std::string::String, BuildHasherDefault<FxHasher>>` cannot be built from an iterator over elements of type `Symbol`
     |
     |
540  |             .collect::<FxHashSet<String>>();
     |              ^^^^^^^ value of type `HashSet<std::string::String, BuildHasherDefault<FxHasher>>` cannot be built from `std::iter::Iterator<Item=Symbol>`
     |
     = help: the trait `FromIterator<Symbol>` is not implemented for `HashSet<std::string::String, BuildHasherDefault<FxHasher>>`
note: required by a bound in `collect`
For more information about this error, try `rustc --explain E0277`.
[RUSTC-TIMING] rustc_typeck test:false 6.038
error: could not compile `rustc_typeck` due to previous error
warning: build failed, waiting for other jobs to finish...

@matthiaskrgr
Copy link
Member

Hm, afaik the rust benchmarking does not touch clippy at all.. 🤔

@Manishearth
Copy link
Member

Yeah clippy isn't perf tested. Are you sure you want to land this PR here? It'll land faster on the clippy repo. We could also rollup, of course

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with landing it here or in Clippy. Since this is a NFC it doesn't have to go through the Clippy repo and the sync process.

But there's still an error:

error[E0425]: cannot find value `Underscore` in module `sym`
   --> src/tools/clippy/clippy_lints/src/matches.rs:964:52
    |
964 |                     let mut ident_bind_name = sym::Underscore;
    |                                                    ^^^^^^^^^^ not found in `sym`
    |
help: consider importing one of these items
    |
1   | use crate::matches::hir::LifetimeName::Underscore;
    |
1   | use rustc_ast::ExprKind::Underscore;
    |
1   | use rustc_hir::LifetimeName::Underscore;
    |
1   | use rustc_span::symbol::kw::Underscore;
    |

@camelid
Copy link
Member Author

camelid commented Jan 17, 2022

What does NFC mean btw?

Also: It seemed to work in rust-analyzer sigh

I'll close this and reopen against the clippy repo (this PR originally changed rustc too, which is why I filed it here).

@camsteffen
Copy link
Contributor

NFC = non-functional change. I think you need kw::Underscore.

@camelid camelid removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 17, 2022
@camelid camelid added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jan 17, 2022
@camelid
Copy link
Member Author

camelid commented Jan 19, 2022

Ok, I've opened rust-lang/rust-clippy#8310. Closing this PR then!

@camelid camelid closed this Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-clippy Area: Clippy S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.