diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-05-19 15:59:52 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-05-19 16:53:06 +1000 |
| commit | 7a37e0c2ff8b8fb0346e519418e1e7cb2a33bc45 (patch) | |
| tree | f2ed640d63ad36e4647814d1bedaddf45ae7d9c8 /compiler/rustc_parse/src/parser/diagnostics.rs | |
| parent | a148a32fdc3f3767487d54147edbbe2c225c4fbf (diff) | |
| download | rust-7a37e0c2ff8b8fb0346e519418e1e7cb2a33bc45.tar.gz rust-7a37e0c2ff8b8fb0346e519418e1e7cb2a33bc45.zip | |
Move condition out of `maybe_report_ambiguous_plus` and `maybe_recover_from_bad_type_plus`.
Diffstat (limited to 'compiler/rustc_parse/src/parser/diagnostics.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 3ed19219fa4..c58b43de1b8 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -1,5 +1,4 @@ use super::pat::Expected; -use super::ty::AllowPlus; use super::{ BlockMode, CommaRecoveryMode, Parser, PathStyle, RecoverColon, RecoverComma, Restrictions, SemiColonMode, SeqSep, TokenExpectType, TokenType, @@ -1236,13 +1235,8 @@ impl<'a> Parser<'a> { } } - pub(super) fn maybe_report_ambiguous_plus( - &mut self, - allow_plus: AllowPlus, - impl_dyn_multi: bool, - ty: &Ty, - ) { - if matches!(allow_plus, AllowPlus::No) && impl_dyn_multi { + pub(super) fn maybe_report_ambiguous_plus(&mut self, impl_dyn_multi: bool, ty: &Ty) { + if impl_dyn_multi { self.sess.emit_err(AmbiguousPlus { sum_ty: pprust::ty_to_string(&ty), span: ty.span }); } } @@ -1268,13 +1262,9 @@ impl<'a> Parser<'a> { } } - pub(super) fn maybe_recover_from_bad_type_plus( - &mut self, - allow_plus: AllowPlus, - ty: &Ty, - ) -> PResult<'a, ()> { + pub(super) fn maybe_recover_from_bad_type_plus(&mut self, ty: &Ty) -> PResult<'a, ()> { // Do not add `+` to expected tokens. - if matches!(allow_plus, AllowPlus::No) || !self.token.is_like_plus() { + if !self.token.is_like_plus() { return Ok(()); } |
