Skip to content

Commit 1dcbdbd

Browse files
committed
use let instead of match for matches with single bindings (clippy::match_single_binding)
1 parent 54e103b commit 1dcbdbd

File tree

2 files changed

+16
-12
lines changed
  • src
    • librustc_builtin_macros/deriving/generic
    • librustc_typeck/check/method

2 files changed

+16
-12
lines changed

src/librustc_builtin_macros/deriving/generic/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,9 @@ impl<'a> MethodDef<'a> {
10561056
self_: field,
10571057
other: other_fields
10581058
.iter_mut()
1059-
.map(|l| match l.next().unwrap() {
1060-
(.., ex, _) => ex,
1059+
.map(|l| {
1060+
let (.., ex, _) = l.next().unwrap();
1061+
ex
10611062
})
10621063
.collect(),
10631064
attrs,

src/librustc_typeck/check/method/mod.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
368368
let fn_sig = tcx.fn_sig(def_id);
369369
let fn_sig = self.replace_bound_vars_with_fresh_vars(span, infer::FnCall, &fn_sig).0;
370370
let fn_sig = fn_sig.subst(self.tcx, substs);
371-
let fn_sig = match self.normalize_associated_types_in_as_infer_ok(span, &fn_sig) {
372-
InferOk { value, obligations: o } => {
373-
obligations.extend(o);
374-
value
375-
}
371+
372+
let InferOk { value, obligations: o } =
373+
self.normalize_associated_types_in_as_infer_ok(span, &fn_sig);
374+
let fn_sig = {
375+
obligations.extend(o);
376+
value
376377
};
377378

378379
// Register obligations for the parameters. This will include the
@@ -384,12 +385,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
384385
// Note that as the method comes from a trait, it should not have
385386
// any late-bound regions appearing in its bounds.
386387
let bounds = self.tcx.predicates_of(def_id).instantiate(self.tcx, substs);
387-
let bounds = match self.normalize_associated_types_in_as_infer_ok(span, &bounds) {
388-
InferOk { value, obligations: o } => {
389-
obligations.extend(o);
390-
value
391-
}
388+
389+
let InferOk { value, obligations: o } =
390+
self.normalize_associated_types_in_as_infer_ok(span, &bounds);
391+
let bounds = {
392+
obligations.extend(o);
393+
value
392394
};
395+
393396
assert!(!bounds.has_escaping_bound_vars());
394397

395398
let cause = traits::ObligationCause::misc(span, self.body_id);

0 commit comments

Comments
 (0)