-
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
clippy::complexity fixes #105864
clippy::complexity fixes #105864
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
if field.is_none() { | ||
// Transform repr(transparent) types without non-ZST field into () | ||
ty = tcx.mk_unit(); | ||
} else { | ||
let ty0 = tcx.type_of(field.unwrap().did); | ||
if let Some(field) = field { | ||
let ty0 = tcx.type_of(field.did); | ||
// Generalize any repr(transparent) user-defined type that is either a pointer | ||
// or reference, and either references itself or any other type that contains or | ||
// references itself, to avoid a reference cycle. |
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 switch from if f.is_none() { otherbb } else { f.unwrap() }
to if let Some(f) = f { f } else { otherbb }
here
@@ -488,7 +488,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> { | |||
// If this empty region is from a universe that can | |||
// name the placeholder, then the placeholder is | |||
// larger; otherwise, the only ancestor is `'static`. | |||
if a_ui.can_name(placeholder.universe) { true } else { false } | |||
return a_ui.can_name(placeholder.universe); |
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.
return a_ui.can_name(placeholder.universe); | |
a_ui.can_name(placeholder.universe) |
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 originally skipped the return, but I thought with the return it was more obvious that we get/return a bool here instead of just "computing something"
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.
If you prefer keeping it I'm fine with that.
return tcx.item_name(def_id).as_str() == "c_void" | ||
&& (crate_name == sym::core || crate_name == sym::std || crate_name == sym::libc); |
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.
return tcx.item_name(def_id).as_str() == "c_void" | |
&& (crate_name == sym::core || crate_name == sym::std || crate_name == sym::libc); | |
tcx.item_name(def_id).as_str() == "c_void" | |
&& (crate_name == sym::core || crate_name == sym::std || crate_name == sym::libc) |
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
r? @Nilstrieb Looks good, r=me after the two reviews |
filter_next needless_question_mark bind_instead_of_map manual_find derivable_impls map_identity redundant_slicing skip_while_next unnecessary_unwrap needless_bool
@bors r=Nilstrieb |
Rollup of 5 pull requests Successful merges: - rust-lang#105682 (Use `expose_addr()` in `fmt::Pointer`) - rust-lang#105839 (Suggest a `T: Send` bound for `&mut T` upvars in `Send` generators) - rust-lang#105864 (clippy::complexity fixes) - rust-lang#105882 (Don't ICE in closure arg borrow suggestion) - rust-lang#105889 (Fix `uninlined_format_args` in libtest) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
filter_next
needless_question_mark
bind_instead_of_map
manual_find
derivable_impls
map_identity
redundant_slicing
skip_while_next
unnecessary_unwrap
needless_bool
r? @compiler-errors