reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats)
This commit is contained in:
parent
90ccf4f5ad
commit
8a90626a46
28 changed files with 89 additions and 91 deletions
|
@ -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))
|
||||
|
|
|
@ -1368,7 +1368,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
code: &ObligationCauseCode<'tcx>,
|
||||
) -> Option<(String, Option<Span>)> {
|
||||
match code {
|
||||
&ObligationCauseCode::BuiltinDerivedObligation(ref data) => {
|
||||
ObligationCauseCode::BuiltinDerivedObligation(data) => {
|
||||
let parent_trait_ref = self.resolve_vars_if_possible(data.parent_trait_ref);
|
||||
match self.get_parent_trait_ref(&data.parent_code) {
|
||||
Some(t) => Some(t),
|
||||
|
|
|
@ -69,16 +69,16 @@ impl IntercrateAmbiguityCause {
|
|||
|
||||
pub fn intercrate_ambiguity_hint(&self) -> String {
|
||||
match self {
|
||||
&IntercrateAmbiguityCause::DownstreamCrate { ref trait_desc, ref self_desc } => {
|
||||
let self_desc = if let &Some(ref ty) = self_desc {
|
||||
IntercrateAmbiguityCause::DownstreamCrate { trait_desc, self_desc } => {
|
||||
let self_desc = if let Some(ty) = self_desc {
|
||||
format!(" for type `{}`", ty)
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
format!("downstream crates may implement trait `{}`{}", trait_desc, self_desc)
|
||||
}
|
||||
&IntercrateAmbiguityCause::UpstreamCrateUpdate { ref trait_desc, ref self_desc } => {
|
||||
let self_desc = if let &Some(ref ty) = self_desc {
|
||||
IntercrateAmbiguityCause::UpstreamCrateUpdate { trait_desc, self_desc } => {
|
||||
let self_desc = if let Some(ty) = self_desc {
|
||||
format!(" for type `{}`", ty)
|
||||
} else {
|
||||
String::new()
|
||||
|
@ -89,7 +89,7 @@ impl IntercrateAmbiguityCause {
|
|||
trait_desc, self_desc
|
||||
)
|
||||
}
|
||||
&IntercrateAmbiguityCause::ReservationImpl { ref message } => message.clone(),
|
||||
IntercrateAmbiguityCause::ReservationImpl { message } => message.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue