-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix #7903 #7906
Fix #7903 #7906
Conversation
That is a negative test because caching the string might be faster than calling |
clippy_utils/src/higher.rs
Outdated
if let Ok(i) = usize::try_from(position); | ||
let arg = &self.args[i]; | ||
if let ExprKind::Call(_, [arg_name, _]) = arg.kind; | ||
if let Some(j) = self.arg_names.iter().position(|pat| match_arg(pat, arg_name)); |
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.
This should work
if let Some(j) = self.arg_names.iter().position(|pat| match_arg(pat, arg_name)); | |
if let Some(j) = self.arg_names.iter().position(|pat| path_to_local_id(arg_name, pat.hir_id)); |
@@ -557,13 +559,15 @@ impl FormatArgsExpn<'tcx> { | |||
_ => None, | |||
}) | |||
.collect(); | |||
if let PatKind::Tuple(arg_names, None) = arm.pat.kind; |
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.
This is okay for now since it fixes an ICE, but note that we want to move away from depending on the exact HIR per #7843.
|
||
println!("error: something failed at {}", Somewhere.to_string()); | ||
println!("{} and again {0}", x.to_string()); |
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.
See my other comment on this. Comments would be helpful here. One to separate // negative tests
and one to explain the intent behind this test since it isn't obvious.
to_string_in_format_args
false negativee6cd02d
to
61bb9b6
Compare
I think I've addressed all of your comments, @camsteffen. Thanks a lot for reviewing this. |
Thanks! I added a changelog line to the PR. @bors r+ |
📌 Commit 5edb02a has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #7903 (cc: @Arnavion)
changelog: none (bug is in same release)
r? @camsteffen