-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Cleanup libsyntax a bit #7873
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
Cleanup libsyntax a bit #7873
Conversation
} else { | ||
lhs | ||
|
||
match ((*self.token).clone(), (*self.restriction).clone()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the calls to clone
be avoided here?
So I fixed up the problem that was causing the dynamic borrow error. Unfortunately to fix that problem I had to reintroduce the calls to clone @alexcrichton . |
Well I'm not exactly wholly-opposed to having calls to clone, but I just figured it'd be a good idea to not introduce new ones (because there weren't any before). I'm not really basing this from a perf point of view, but rather just a "we should reduce clones" point of view. |
I think you just need to wrap an extra block around the new borrows. Introducing clones as a workaround isn't necessary since you can just limit the scope of the borrows instead. |
@thestinger The fix was slightly more complicated than you described but I was able to fix the dynamic borrow error, and get rid of the clones. |
…shearth Update `str` utils to prevent ICEs and FNs This PR reworks some string handling for lints regarding enum naming. I hope the refactoring will prevent future ICEs and help with new bug free implementations. It might be better to review this PR by going through the commits, as `clippy_utils::camel_case` was renamed to `clippy_utils::str_utils` and then changed further. GH sadly doesn't really make the changes that obvious 🙃 Not too much more to say. Have a nice day 🌞 --- Fixes: rust-lang/rust-clippy#7869 changelog: ICE Fix: [`enum_variant_names`] rust-lang#7869
Test clippy_utils in CI r? `@xFrednet` Since you did the last refactor of the `str_utils` functions in rust-lang#7873 changelog: Make sure tests in `clippy_utils` are passing by testing it in CI
No description provided.