Skip to content

Commit 6bbc277

Browse files
committed
Add unwrap to options.
1 parent fdb1fff commit 6bbc277

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

clippy_lints/src/matches.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,8 @@ fn all_ranges<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arms: &'tcx [Arm<'_>]) -> Ve
713713
} = *arm
714714
{
715715
if let PatKind::Range(ref lhs, ref rhs, ref range_end) = pat.kind {
716-
let lhs = constant(cx, cx.tables, lhs)?.0;
717-
let rhs = constant(cx, cx.tables, rhs)?.0;
716+
let lhs = constant(cx, cx.tables, lhs.unwrap())?.0;
717+
let rhs = constant(cx, cx.tables, rhs.unwrap())?.0;
718718
let rhs = match *range_end {
719719
RangeEnd::Included => Bound::Included(rhs),
720720
RangeEnd::Excluded => Bound::Excluded(rhs),

clippy_lints/src/utils/author.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,9 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
617617
start_pat, end_pat, end_kind, current
618618
);
619619
self.current = start_pat;
620-
self.visit_expr(start);
620+
self.visit_expr(start.unwrap());
621621
self.current = end_pat;
622-
self.visit_expr(end);
622+
self.visit_expr(end.unwrap());
623623
},
624624
PatKind::Slice(ref start, ref middle, ref end) => {
625625
let start_pat = self.next("start");

clippy_lints/src/utils/hir_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
195195
ls == rs && over(l, r, |l, r| self.eq_pat(l, r))
196196
},
197197
(&PatKind::Range(ref ls, ref le, ref li), &PatKind::Range(ref rs, ref re, ref ri)) => {
198-
self.eq_expr(ls, rs) && self.eq_expr(le, re) && (*li == *ri)
198+
self.eq_expr(ls.unwrap(), rs.unwrap()) && self.eq_expr(le.unwrap(), re.unwrap()) && (*li == *ri)
199199
},
200200
(&PatKind::Ref(ref le, ref lm), &PatKind::Ref(ref re, ref rm)) => lm == rm && self.eq_pat(le, re),
201201
(&PatKind::Slice(ref ls, ref li, ref le), &PatKind::Slice(ref rs, ref ri, ref re)) => {

clippy_lints/src/utils/inspector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ fn print_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, indent: usize) {
483483
},
484484
hir::PatKind::Range(ref l, ref r, ref range_end) => {
485485
println!("{}Range", ind);
486-
print_expr(cx, l, indent + 1);
487-
print_expr(cx, r, indent + 1);
486+
print_expr(cx, l.unwrap(), indent + 1);
487+
print_expr(cx, r.unwrap(), indent + 1);
488488
match *range_end {
489489
hir::RangeEnd::Included => println!("{} end included", ind),
490490
hir::RangeEnd::Excluded => println!("{} end excluded", ind),

0 commit comments

Comments
 (0)