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
|
@ -2118,7 +2118,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
let consider = format!(
|
||||
"{} {}...",
|
||||
msg,
|
||||
if type_param_span.map(|(_, _, is_impl_trait)| is_impl_trait).unwrap_or(false) {
|
||||
if type_param_span.map_or(false, |(_, _, is_impl_trait)| is_impl_trait) {
|
||||
format!(" `{}` to `{}`", sub, bound_kind)
|
||||
} else {
|
||||
format!("`{}: {}`", bound_kind, sub)
|
||||
|
|
|
@ -1533,7 +1533,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
// Note: if these two lines are combined into one we get
|
||||
// dynamic borrow errors on `self.inner`.
|
||||
let known = self.inner.borrow_mut().type_variables().probe(v).known();
|
||||
known.map(|t| self.shallow_resolve_ty(t)).unwrap_or(typ)
|
||||
known.map_or(typ, |t| self.shallow_resolve_ty(t))
|
||||
}
|
||||
|
||||
ty::Infer(ty::IntVar(v)) => self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue