review comments

This commit is contained in:
Esteban Küber 2020-06-17 16:29:03 -07:00
parent af45d8a5bb
commit 8d1a3801fa
3 changed files with 8 additions and 6 deletions

View File

@ -485,7 +485,7 @@ fn build_reduced_graph_for_use_tree(
module_path.push(Segment {
ident: Ident { name: kw::PathRoot, span: source.ident.span },
id: Some(self.r.next_node_id()),
has_args: false,
has_generic_args: false,
});
source.ident.name = crate_name;
}

View File

@ -920,7 +920,9 @@ fn collect_enum_variants(&mut self, def_id: DefId) -> Option<Vec<Path>> {
path: &[Segment],
) -> Option<(Span, &'static str, String, Applicability)> {
let (ident, span) = match path {
[segment] if !segment.has_args => (segment.ident.to_string(), segment.ident.span),
[segment] if !segment.has_generic_args => {
(segment.ident.to_string(), segment.ident.span)
}
_ => return None,
};
let mut iter = ident.chars().map(|c| c.is_uppercase());

View File

@ -233,7 +233,7 @@ pub struct Segment {
id: Option<NodeId>,
/// Signals whether this `PathSegment` has generic arguments. Used to avoid providing
/// nonsensical suggestions.
has_args: bool,
has_generic_args: bool,
}
impl Segment {
@ -242,7 +242,7 @@ fn from_path(path: &Path) -> Vec<Segment> {
}
fn from_ident(ident: Ident) -> Segment {
Segment { ident, id: None, has_args: false }
Segment { ident, id: None, has_generic_args: false }
}
fn names_to_string(segments: &[Segment]) -> String {
@ -252,7 +252,7 @@ fn names_to_string(segments: &[Segment]) -> String {
impl<'a> From<&'a ast::PathSegment> for Segment {
fn from(seg: &'a ast::PathSegment) -> Segment {
Segment { ident: seg.ident, id: Some(seg.id), has_args: seg.args.is_some() }
Segment { ident: seg.ident, id: Some(seg.id), has_generic_args: seg.args.is_some() }
}
}
@ -2019,7 +2019,7 @@ fn resolve_path_with_ribs(
path, opt_ns, record_used, path_span, crate_lint,
);
for (i, &Segment { ident, id, has_args: _ }) in path.iter().enumerate() {
for (i, &Segment { ident, id, has_generic_args: _ }) in path.iter().enumerate() {
debug!("resolve_path ident {} {:?} {:?}", i, ident, id);
let record_segment_res = |this: &mut Self, res| {
if record_used {