Rollup merge of #147367 - chenyukang:yukang-trivial-cleanup, r=jieyouxu

Trivial code cleanup in resolve

r? `@jieyouxu`
This commit is contained in:
Stuart Cook 2025-10-05 22:15:07 +11:00 committed by GitHub
commit 94e04993a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -741,14 +741,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
errors.retain(|(_import, err)| match err.module {
// Skip `use` errors for `use foo::Bar;` if `foo.rs` has unrecovered parse errors.
Some(def_id) if self.mods_with_parse_errors.contains(&def_id) => false,
_ => true,
});
errors.retain(|(_import, err)| {
// If we've encountered something like `use _;`, we've already emitted an error stating
// that `_` is not a valid identifier, so we ignore that resolve error.
err.segment != Some(kw::Underscore)
_ => err.segment != Some(kw::Underscore),
});
if errors.is_empty() {
self.tcx.dcx().delayed_bug("expected a parse or \"`_` can't be an identifier\" error");
return;