Skip to content

Commit a1e7495

Browse files
Simplify NodeItem
The generic parameter is unused, and so is `map`
1 parent a80ec3b commit a1e7495

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/librustc_middle/traits/specialization_graph.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,9 @@ impl Iterator for Ancestors<'_> {
154154
}
155155
}
156156

157-
pub struct NodeItem<T> {
157+
pub struct NodeItem {
158158
pub node: Node,
159-
pub item: T,
160-
}
161-
162-
impl<T> NodeItem<T> {
163-
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> NodeItem<U> {
164-
NodeItem { node: self.node, item: f(self.item) }
165-
}
159+
pub item: ty::AssocItem,
166160
}
167161

168162
impl<'tcx> Ancestors<'tcx> {
@@ -173,7 +167,7 @@ impl<'tcx> Ancestors<'tcx> {
173167
tcx: TyCtxt<'tcx>,
174168
trait_item_name: Ident,
175169
trait_item_kind: ty::AssocKind,
176-
) -> Option<NodeItem<ty::AssocItem>> {
170+
) -> Option<NodeItem> {
177171
let trait_def_id = self.trait_def_id;
178172
self.find_map(|node| {
179173
node.item(tcx, trait_item_name, trait_item_kind, trait_def_id)
@@ -183,8 +177,10 @@ impl<'tcx> Ancestors<'tcx> {
183177
}
184178

185179
/// Walk up the specialization ancestors of a given impl, starting with that
186-
/// impl itself. Returns `None` if an error was reported while building the
187-
/// specialization graph.
180+
/// impl itself.
181+
///
182+
/// Returns `Err` if an error was reported while building the specialization
183+
/// graph.
188184
pub fn ancestors(
189185
tcx: TyCtxt<'tcx>,
190186
trait_def_id: DefId,

src/librustc_trait_selection/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ fn assoc_ty_def(
14471447
selcx: &SelectionContext<'_, '_>,
14481448
impl_def_id: DefId,
14491449
assoc_ty_def_id: DefId,
1450-
) -> Result<specialization_graph::NodeItem<ty::AssocItem>, ErrorReported> {
1450+
) -> Result<specialization_graph::NodeItem, ErrorReported> {
14511451
let tcx = selcx.tcx();
14521452
let assoc_ty_name = tcx.associated_item(assoc_ty_def_id).ident;
14531453
let trait_def_id = tcx.impl_trait_ref(impl_def_id).unwrap().def_id;

0 commit comments

Comments
 (0)