Don't gate the feature twice
This commit is contained in:
parent
e274372689
commit
19e0c984d3
4 changed files with 31 additions and 51 deletions
|
@ -676,6 +676,19 @@ impl Pat {
|
|||
});
|
||||
could_be_never_pattern
|
||||
}
|
||||
|
||||
/// Whether this contains a `!` pattern. This in particular means that a feature gate error will
|
||||
/// be raised if the feature is off. Used to avoid gating the feature twice.
|
||||
pub fn contains_never_pattern(&self) -> bool {
|
||||
let mut contains_never_pattern = false;
|
||||
self.walk(&mut |pat| {
|
||||
if matches!(pat.kind, PatKind::Never) {
|
||||
contains_never_pattern = true;
|
||||
}
|
||||
true
|
||||
});
|
||||
contains_never_pattern
|
||||
}
|
||||
}
|
||||
|
||||
/// A single field in a struct pattern.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue