]> git.lizzy.rs Git - rust.git/commitdiff
Make `hir::PathSegment::res` non-optional.
authorNicholas Nethercote <n.nethercote@gmail.com>
Tue, 30 Aug 2022 05:10:28 +0000 (15:10 +1000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Mon, 5 Sep 2022 04:20:25 +0000 (14:20 +1000)
clippy_lints/src/operators/op_ref.rs
clippy_lints/src/ref_option_ref.rs
clippy_lints/src/trait_bounds.rs

index 1805672e372544d8b34e64548fd7118a67e3c8b9..1085e608944154beed10801798f9aa684a3fe643 100644 (file)
@@ -185,7 +185,7 @@ fn in_impl<'tcx>(
         if let ItemKind::Impl(item) = &item.kind;
         if let Some(of_trait) = &item.of_trait;
         if let Some(seg) = of_trait.path.segments.last();
-        if let Some(Res::Def(_, trait_id)) = seg.res;
+        if let Res::Def(_, trait_id) = seg.res;
         if trait_id == bin_op;
         if let Some(generic_args) = seg.args;
         if let Some(GenericArg::Type(other_ty)) = generic_args.args.last();
index 909d6971a5497305a7937bd7b70984e7ffb729b6..42514f861be1c25f33bcca47ef88ac7a2cef5b47 100644 (file)
@@ -43,8 +43,7 @@ fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx Ty<'tcx>) {
             if mut_ty.mutbl == Mutability::Not;
             if let TyKind::Path(ref qpath) = &mut_ty.ty.kind;
             let last = last_path_segment(qpath);
-            if let Some(res) = last.res;
-            if let Some(def_id) = res.opt_def_id();
+            if let Some(def_id) = last.res.opt_def_id();
 
             if cx.tcx.is_diagnostic_item(sym::Option, def_id);
             if let Some(params) = last_path_segment(qpath).args ;
index 2ffa022b04f7a4b870e32717c5cd45aa189d23cf..a25be93b8d61696f3f803e48ae294b5f02ef24fc 100644 (file)
@@ -128,7 +128,7 @@ fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx TraitItem<'tc
                 if !bound_predicate.span.from_expansion();
                 if let TyKind::Path(QPath::Resolved(_, Path { segments, .. })) = bound_predicate.bounded_ty.kind;
                 if let Some(PathSegment {
-                    res: Some(Res::SelfTy{ trait_: Some(def_id), alias_to: _ }), ..
+                    res: Res::SelfTy{ trait_: Some(def_id), alias_to: _ }, ..
                 }) = segments.first();
                 if let Some(
                     Node::Item(