Remove from_bool
closure.
The code is clearer and simpler without it. Note that the `a == b` early return at the top of the function means the `a == b` test at the end of the function could never succeed.
This commit is contained in:
parent
fab85ddbeb
commit
3ab6ef1938
1 changed files with 2 additions and 4 deletions
|
@ -757,10 +757,8 @@ pub(crate) fn compare_const_vals<'tcx>(
|
||||||
assert_eq!(a.ty(), b.ty());
|
assert_eq!(a.ty(), b.ty());
|
||||||
assert_eq!(a.ty(), ty);
|
assert_eq!(a.ty(), ty);
|
||||||
|
|
||||||
let from_bool = |v: bool| v.then_some(Ordering::Equal);
|
|
||||||
|
|
||||||
if a == b {
|
if a == b {
|
||||||
return from_bool(true);
|
return Some(Ordering::Equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
let a_bits = a.try_eval_bits(tcx, param_env, ty);
|
let a_bits = a.try_eval_bits(tcx, param_env, ty);
|
||||||
|
@ -790,5 +788,5 @@ pub(crate) fn compare_const_vals<'tcx>(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
from_bool(a == b)
|
None
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue