reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats)

This commit is contained in:
Matthias Krüger 2021-01-02 20:09:17 +01:00
parent 90ccf4f5ad
commit 8a90626a46
28 changed files with 89 additions and 91 deletions

View file

@ -305,8 +305,8 @@ impl AutoTraitFinder<'tcx> {
infcx.resolve_vars_if_possible(Obligation::new(dummy_cause.clone(), new_env, pred));
let result = select.select(&obligation);
match &result {
&Ok(Some(ref impl_source)) => {
match result {
Ok(Some(ref impl_source)) => {
// If we see an explicit negative impl (e.g., `impl !Send for MyStruct`),
// we immediately bail out, since it's impossible for us to continue.
@ -339,8 +339,8 @@ impl AutoTraitFinder<'tcx> {
return None;
}
}
&Ok(None) => {}
&Err(SelectionError::Unimplemented) => {
Ok(None) => {}
Err(SelectionError::Unimplemented) => {
if self.is_param_no_infer(pred.skip_binder().trait_ref.substs) {
already_visited.remove(&pred);
self.add_user_pred(
@ -863,7 +863,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for RegionReplacer<'a, 'tcx> {
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
(match r {
&ty::ReVar(vid) => self.vid_to_region.get(&vid).cloned(),
ty::ReVar(vid) => self.vid_to_region.get(vid).cloned(),
_ => None,
})
.unwrap_or_else(|| r.super_fold_with(self))