Use Option::map_or instead of .map(..).unwrap_or(..)
This commit is contained in:
parent
d03fe84169
commit
a56bffb4f9
50 changed files with 67 additions and 79 deletions
|
@ -647,8 +647,7 @@ pub fn transparent_newtype_field<'a, 'tcx>(
|
|||
let param_env = tcx.param_env(variant.def_id);
|
||||
for field in &variant.fields {
|
||||
let field_ty = tcx.type_of(field.did);
|
||||
let is_zst =
|
||||
tcx.layout_of(param_env.and(field_ty)).map(|layout| layout.is_zst()).unwrap_or(false);
|
||||
let is_zst = tcx.layout_of(param_env.and(field_ty)).map_or(false, |layout| layout.is_zst());
|
||||
|
||||
if !is_zst {
|
||||
return Some(field);
|
||||
|
|
|
@ -529,8 +529,8 @@ trait UnusedDelimLint {
|
|||
pprust::expr_to_string(value)
|
||||
};
|
||||
let keep_space = (
|
||||
left_pos.map(|s| s >= value.span.lo()).unwrap_or(false),
|
||||
right_pos.map(|s| s <= value.span.hi()).unwrap_or(false),
|
||||
left_pos.map_or(false, |s| s >= value.span.lo()),
|
||||
right_pos.map_or(false, |s| s <= value.span.hi()),
|
||||
);
|
||||
self.emit_unused_delims(cx, value.span, &expr_text, ctx.into(), keep_space);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue