mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Use a slice pattern to neaten a condition.
This commit is contained in:
parent
531b38ac23
commit
dcb72e705f
@ -199,17 +199,12 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
}
|
||||
}
|
||||
if !attr.is_doc_comment()
|
||||
&& attr.get_normal_item().path.segments.len() == 2
|
||||
&& attr.get_normal_item().path.segments[0].ident.name == sym::diagnostic
|
||||
&& let [seg, _] = attr.get_normal_item().path.segments.as_slice()
|
||||
&& seg.ident.name == sym::diagnostic
|
||||
&& !self.features.diagnostic_namespace
|
||||
{
|
||||
let msg = "`#[diagnostic]` attribute name space is experimental";
|
||||
gate_feature_post!(
|
||||
self,
|
||||
diagnostic_namespace,
|
||||
attr.get_normal_item().path.segments[0].ident.span,
|
||||
msg
|
||||
);
|
||||
gate_feature_post!(self, diagnostic_namespace, seg.ident.span, msg);
|
||||
}
|
||||
|
||||
// Emit errors for non-staged-api crates.
|
||||
|
Loading…
Reference in New Issue
Block a user