Use more slice patterns inside the compiler
This commit is contained in:
parent
60d146580c
commit
c4c518d2d4
40 changed files with 191 additions and 221 deletions
|
@ -2207,8 +2207,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
attr.name_or_empty(),
|
||||
sym::allow | sym::warn | sym::deny | sym::forbid | sym::expect
|
||||
) && let Some(meta) = attr.meta_item_list()
|
||||
&& meta.len() == 1
|
||||
&& let Some(item) = meta[0].meta_item()
|
||||
&& let [meta] = meta.as_slice()
|
||||
&& let Some(item) = meta.meta_item()
|
||||
&& let MetaItemKind::NameValue(_) = &item.kind
|
||||
&& item.path == sym::reason
|
||||
{
|
||||
|
|
|
@ -19,9 +19,7 @@ impl DebuggerVisualizerCollector<'_> {
|
|||
return;
|
||||
};
|
||||
|
||||
let hint = if hints.len() == 1 {
|
||||
&hints[0]
|
||||
} else {
|
||||
let [hint] = hints.as_slice() else {
|
||||
self.sess.dcx().emit_err(DebugVisualizerInvalid { span: attr.span });
|
||||
return;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue