mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
fix clippy::{needless_bool, manual_unwrap_or}
This commit is contained in:
parent
db6c50998c
commit
b7795e135a
@ -216,9 +216,10 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
|
||||
let discr = self.find_switch_discriminant_info(bb, switch)?;
|
||||
|
||||
// go through each target, finding a discriminant read, and a switch
|
||||
let results = discr.targets_with_values.iter().map(|(value, target)| {
|
||||
self.find_discriminant_switch_pairing(&discr, *target, *value)
|
||||
});
|
||||
let results = discr
|
||||
.targets_with_values
|
||||
.iter()
|
||||
.map(|(value, target)| self.find_discriminant_switch_pairing(&discr, *target, *value));
|
||||
|
||||
// if the optimization did not apply for one of the targets, then abort
|
||||
if results.clone().any(|x| x.is_none()) || results.len() == 0 {
|
||||
|
@ -1109,10 +1109,7 @@ impl Session {
|
||||
}
|
||||
|
||||
pub fn link_dead_code(&self) -> bool {
|
||||
match self.opts.cg.link_dead_code {
|
||||
Some(explicitly_set) => explicitly_set,
|
||||
None => false,
|
||||
}
|
||||
self.opts.cg.link_dead_code.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn mark_attr_known(&self, attr: &Attribute) {
|
||||
|
@ -297,9 +297,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
closure_captures.insert(*var_hir_id, upvar_id);
|
||||
|
||||
let new_capture_kind = if let Some(capture_kind) =
|
||||
upvar_capture_map.get(&upvar_id)
|
||||
{
|
||||
let new_capture_kind =
|
||||
if let Some(capture_kind) = upvar_capture_map.get(&upvar_id) {
|
||||
// upvar_capture_map only stores the UpvarCapture (CaptureKind),
|
||||
// so we create a fake capture info with no expression.
|
||||
let fake_capture_info =
|
||||
|
@ -2141,13 +2141,8 @@ fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicat
|
||||
// * It must be an associated type for this trait (*not* a
|
||||
// supertrait).
|
||||
if let ty::Projection(projection) = ty.kind() {
|
||||
if projection.substs == trait_identity_substs
|
||||
projection.substs == trait_identity_substs
|
||||
&& tcx.associated_item(projection.item_def_id).container.id() == def_id
|
||||
{
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
@ -159,11 +159,7 @@ pub fn check(build: &mut Build) {
|
||||
panic!("the iOS target is only supported on macOS");
|
||||
}
|
||||
|
||||
build
|
||||
.config
|
||||
.target_config
|
||||
.entry(*target)
|
||||
.or_insert(Target::from_triple(&target.triple));
|
||||
build.config.target_config.entry(*target).or_insert(Target::from_triple(&target.triple));
|
||||
|
||||
if target.contains("-none-") || target.contains("nvptx") {
|
||||
if build.no_std(*target) == Some(false) {
|
||||
|
Loading…
Reference in New Issue
Block a user