File tree Expand file tree Collapse file tree
examples/supplementary/redundant_reference Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,11 +18,11 @@ struct V<'cx, 'tcx> {
1818}
1919
2020impl <'cx , 'tcx > Visitor <'tcx > for V <'cx , 'tcx > {
21- type Map = rustc_middle :: hir :: map :: Map <'tcx >;
21+ type MaybeTyCtxt = rustc_middle :: ty :: TyCtxt <'tcx >;
2222 type NestedFilter = rustc_middle :: hir :: nested_filter :: All ;
2323
24- fn nested_visit_map (& mut self ) -> Self :: Map {
25- self . cx. tcx. hir ()
24+ fn maybe_tcx (& mut self ) -> Self :: MaybeTyCtxt {
25+ self . cx. tcx
2626 }
2727}
2828```
@@ -35,11 +35,11 @@ struct V<'tcx> {
3535}
3636
3737impl <'tcx > Visitor <'tcx > for V <'tcx > {
38- type Map = rustc_middle :: hir :: map :: Map <'tcx >;
38+ type MaybeTyCtxt = rustc_middle :: ty :: TyCtxt <'tcx >;
3939 type NestedFilter = rustc_middle :: hir :: nested_filter :: All ;
4040
41- fn nested_visit_map (& mut self ) -> Self :: Map {
42- self . tcx. hir ()
41+ fn maybe_tcx (& mut self ) -> Self :: MaybeTyCtxt {
42+ self . tcx
4343 }
4444}
4545```
Original file line number Diff line number Diff line change @@ -49,11 +49,11 @@ dylint_linting::impl_late_lint! {
4949 /// }
5050 ///
5151 /// impl<'cx, 'tcx> Visitor<'tcx> for V<'cx, 'tcx> {
52- /// type Map = rustc_middle::hir::map::Map <'tcx>;
52+ /// type MaybeTyCtxt = rustc_middle::ty::TyCtxt <'tcx>;
5353 /// type NestedFilter = rustc_middle::hir::nested_filter::All;
5454 ///
55- /// fn nested_visit_map (&mut self) -> Self::Map {
56- /// self.cx.tcx.hir()
55+ /// fn maybe_tcx (&mut self) -> Self::MaybeTyCtxt {
56+ /// self.cx.tcx
5757 /// }
5858 /// }
5959 /// ```
@@ -73,11 +73,11 @@ dylint_linting::impl_late_lint! {
7373 /// }
7474 ///
7575 /// impl<'tcx> Visitor<'tcx> for V<'tcx> {
76- /// type Map = rustc_middle::hir::map::Map <'tcx>;
76+ /// type MaybeTyCtxt = rustc_middle::ty::TyCtxt <'tcx>;
7777 /// type NestedFilter = rustc_middle::hir::nested_filter::All;
7878 ///
79- /// fn nested_visit_map (&mut self) -> Self::Map {
80- /// self.tcx.hir()
79+ /// fn maybe_tcx (&mut self) -> Self::MaybeTyCtxt {
80+ /// self.tcx
8181 /// }
8282 /// }
8383 /// ```
Original file line number Diff line number Diff line change @@ -39,11 +39,11 @@ mod redundant_reference {
3939 }
4040
4141 impl < ' cx , ' tcx > Visitor < ' tcx > for V < ' cx , ' tcx > {
42- type Map = rustc_middle:: hir :: map :: Map < ' tcx > ;
42+ type MaybeTyCtxt = rustc_middle:: ty :: TyCtxt < ' tcx > ;
4343 type NestedFilter = rustc_middle:: hir:: nested_filter:: All ;
4444
45- fn nested_visit_map ( & mut self ) -> Self :: Map {
46- self . cx . tcx . hir ( )
45+ fn maybe_tcx ( & mut self ) -> Self :: MaybeTyCtxt {
46+ self . cx . tcx
4747 }
4848 }
4949}
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ LL | cx: &'cx LateContext<'tcx>,
77note: read here
88 --> $DIR/main.rs:46:17
99 |
10- LL | self.cx.tcx.hir()
10+ LL | self.cx.tcx
1111 | ^^^^^^^
1212 = help: consider storing a copy of `.cx.tcx` to eliminate the need for `'cx`
1313 = note: `#[warn(redundant_reference)]` on by default
You can’t perform that action at this time.
0 commit comments