Replace enum ==
s with match
es where it makes sense
This commit is contained in:
parent
f55b0022db
commit
fd649a3cc5
16 changed files with 258 additions and 231 deletions
|
@ -298,14 +298,15 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
|||
self.r.record_partial_res(id, PartialRes::new(res));
|
||||
}
|
||||
if module.is_normal() {
|
||||
if res == Res::Err {
|
||||
Ok(ty::Visibility::Public)
|
||||
} else {
|
||||
let vis = ty::Visibility::Restricted(res.def_id());
|
||||
if self.r.is_accessible_from(vis, parent_scope.module) {
|
||||
Ok(vis.expect_local())
|
||||
} else {
|
||||
Err(VisResolutionError::AncestorOnly(path.span))
|
||||
match res {
|
||||
Res::Err => Ok(ty::Visibility::Public),
|
||||
_ => {
|
||||
let vis = ty::Visibility::Restricted(res.def_id());
|
||||
if self.r.is_accessible_from(vis, parent_scope.module) {
|
||||
Ok(vis.expect_local())
|
||||
} else {
|
||||
Err(VisResolutionError::AncestorOnly(path.span))
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1552,12 +1552,12 @@ impl<'a> Resolver<'a> {
|
|||
if b.is_extern_crate() && ident.span.rust_2018() {
|
||||
help_msgs.push(format!("use `::{ident}` to refer to this {thing} unambiguously"))
|
||||
}
|
||||
if misc == AmbiguityErrorMisc::SuggestCrate {
|
||||
help_msgs
|
||||
.push(format!("use `crate::{ident}` to refer to this {thing} unambiguously"))
|
||||
} else if misc == AmbiguityErrorMisc::SuggestSelf {
|
||||
help_msgs
|
||||
.push(format!("use `self::{ident}` to refer to this {thing} unambiguously"))
|
||||
match misc {
|
||||
AmbiguityErrorMisc::SuggestCrate => help_msgs
|
||||
.push(format!("use `crate::{ident}` to refer to this {thing} unambiguously")),
|
||||
AmbiguityErrorMisc::SuggestSelf => help_msgs
|
||||
.push(format!("use `self::{ident}` to refer to this {thing} unambiguously")),
|
||||
AmbiguityErrorMisc::FromPrelude | AmbiguityErrorMisc::None => {}
|
||||
}
|
||||
|
||||
err.span_note(b.span, ¬e_msg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue