Skip to content

Commit f2187a2

Browse files
committed
Fix redundant_reference tests
1 parent 87e1964 commit f2187a2

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

examples/supplementary/redundant_reference/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ struct V<'cx, 'tcx> {
1818
}
1919

2020
impl<'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

3737
impl<'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
```

examples/supplementary/redundant_reference/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff 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
/// ```

examples/supplementary/redundant_reference/ui/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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
}

examples/supplementary/redundant_reference/ui/main.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | cx: &'cx LateContext<'tcx>,
77
note: 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

0 commit comments

Comments
 (0)