-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
compiler: clippy::complexity fixes #121523
Conversation
Some changes occurred in match checking cc @Nadrieril Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred in exhaustiveness checking cc @Nadrieril |
fn count<'a>( | ||
cx: &ExtCtxt<'a>, | ||
depth_curr: usize, | ||
depth_max: usize, | ||
matched: &NamedMatch, | ||
sp: &DelimSpan, | ||
) -> PResult<'a, usize> { |
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.
cx
and sp
were only used in recursion and thus removed
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.
wow that's a cool lint!
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.
thanks, those are some nice improvements
fn count<'a>( | ||
cx: &ExtCtxt<'a>, | ||
depth_curr: usize, | ||
depth_max: usize, | ||
matched: &NamedMatch, | ||
sp: &DelimSpan, | ||
) -> PResult<'a, usize> { |
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.
wow that's a cool lint!
@@ -555,9 +555,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |||
{ | |||
let args = self.infcx.fresh_args_for_item(call_name.span, assoc.def_id); | |||
let fn_sig = tcx.fn_sig(assoc.def_id).instantiate(tcx, args); | |||
let fn_sig = | |||
self.instantiate_binder_with_fresh_vars(call_name.span, FnCall, fn_sig); | |||
Some((assoc, fn_sig)); |
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.
lol
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.
It looks like this entire similar_assoc
closure doesn't actually do anything except return None
? It should probably be fixed or removed entirely.
return Some((assoc, fn_sig));
seems to be what the author intended here.
&& args.len() >= parent_args.len() + 1 | ||
&& args.len() > parent_args.len() |
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.
wtf
&& !(sess.codegen_units().as_usize() == 1) | ||
&& (sess.codegen_units().as_usize() != 1) |
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.
amazing
} else if obligation.predicate.args.type_at(0).to_opt_closure_kind().is_some() | ||
&& obligation.predicate.args.type_at(1).to_opt_closure_kind().is_some() | ||
{ | ||
true | ||
} else { | ||
false | ||
obligation.predicate.args.type_at(0).to_opt_closure_kind().is_some() |
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.
not sure whether this is really better 🤷
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.
I think if cond { true } else { false }
is kinda silly 😅
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.
alone yes, but in an else if
chain, keeping it consistent can be nicer
@bors r+ rollup |
@@ -555,9 +555,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | |||
{ | |||
let args = self.infcx.fresh_args_for_item(call_name.span, assoc.def_id); | |||
let fn_sig = tcx.fn_sig(assoc.def_id).instantiate(tcx, args); | |||
let fn_sig = | |||
self.instantiate_binder_with_fresh_vars(call_name.span, FnCall, fn_sig); | |||
Some((assoc, fn_sig)); |
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.
It looks like this entire similar_assoc
closure doesn't actually do anything except return None
? It should probably be fixed or removed entirely.
return Some((assoc, fn_sig));
seems to be what the author intended here.
@@ -1264,7 +1264,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { | |||
// LLVM CFI using rustc LTO requires a single codegen unit. | |||
if sess.is_sanitizer_cfi_enabled() | |||
&& sess.lto() == config::Lto::Fat | |||
&& !(sess.codegen_units().as_usize() == 1) | |||
&& (sess.codegen_units().as_usize() != 1) |
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.
&& (sess.codegen_units().as_usize() != 1) | |
&& sess.codegen_units().as_usize() != 1 |
Why doesn't the unused_parens
lint trigger here?
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.
the lint avoids triggering when mixed-precedence operators are involved because it can be useful to clarify them explicitly. here it's a bit silly though, yeah.
compiler: clippy::complexity fixes
💔 Test failed - checks-actions |
@bors retry |
compiler: clippy::complexity fixes
💔 Test failed - checks-actions |
@bors treeclosed=50 |
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot)
|
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot)
|
@bors retry p=51 |
compiler: clippy::complexity fixes
@bors treeclosed- |
💥 Test timed out |
new exciting failure! |
@bors p=0 |
2024-02-24T15:19:00.6213164Z test net::tcp::tests::close_read_wakes_up has been running for a long time :| |
☀️ Test successful - checks-actions |
Finished benchmarking commit (6bdb8a4): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 648.482s -> 649.823s (0.21%) |
The large regression that caused this to be marked overall as a regression is just noise. @rustbot label: +perf-regression-triaged |
No description provided.