1
Fork 0

Don't suggest using use<> syntax to capture APITs

This commit is contained in:
Michael Goulet 2024-04-18 22:04:14 -04:00
parent 6afe1352d9
commit f3fb727b08

View file

@ -194,12 +194,17 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for VisitOpaqueTypes<'tcx> {
.chain(others) .chain(others)
.map(|def_id| self.tcx.item_name(def_id).to_string()) .map(|def_id| self.tcx.item_name(def_id).to_string())
.collect(); .collect();
// Make sure that we're not trying to name any APITs
if generics.iter().all(|name| !name.starts_with("impl ")) {
Some(( Some((
format!(" use<{}>", generics.join(", ")), format!(" use<{}>", generics.join(", ")),
opaque_span.with_lo(opaque_span.lo() + BytePos(4)).shrink_to_lo(), opaque_span.with_lo(opaque_span.lo() + BytePos(4)).shrink_to_lo(),
)) ))
} else { } else {
None None
}
} else {
None
}; };
self.tcx.emit_node_lint( self.tcx.emit_node_lint(