-
Notifications
You must be signed in to change notification settings - Fork 13.4k
clippy::complexity fixes #89649
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
clippy::complexity fixes #89649
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
1042fcd
to
3cf9a85
Compare
@@ -972,8 +972,7 @@ fn suggest_ampmut<'tcx>( | |||
if let Some(assignment_rhs_span) = opt_assignment_rhs_span { | |||
if let Ok(src) = tcx.sess.source_map().span_to_snippet(assignment_rhs_span) { | |||
let is_mutbl = |ty: &str| -> bool { | |||
if ty.starts_with("mut") { | |||
let rest = &ty[3..]; | |||
if let Some(rest) = ty.strip_prefix("mut") { |
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.
Doing string parsing on types seems weird, what if there's a type named mutex
or something ... ?
But this is pre-existing so it doesn't need to block the PR.
@@ -363,7 +363,7 @@ impl Collector<'tcx> { | |||
.collect::<Vec<_>>(); | |||
if existing.is_empty() { | |||
// Add if not found | |||
let new_name = passed_lib.new_name.as_ref().map(|s| &**s); // &Option<String> -> Option<&str> | |||
let new_name = passed_lib.new_name.as_deref(); // &Option<String> -> Option<&str> |
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 it makes sense to remove this comment at the same time, it's explained in the docs for as_deref.
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.
updated, I replaced the comment by a type annotation on let new_name
r=me with #89649 (comment) addressed :) |
3cf9a85
to
e6f77a1
Compare
@bors r+ rollup |
📌 Commit e6f77a1 has been approved by |
…laumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#86506 (Don't normalize xform_ret_ty during method candidate assembly ) - rust-lang#89538 (Make rustdoc not highlight `->` and `=>` as operators) - rust-lang#89649 (clippy::complexity fixes) - rust-lang#89668 (Cfg hide more conditions for core and alloc) - rust-lang#89669 (Remove special-casing of never primitive in rustdoc-json-types) - rust-lang#89672 (Remove unwrap_or! macro) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
No description provided.