Skip to content

Commit 78b328d

Browse files
committed
Inline and remove Level::get_diagnostic_id.
It has a single call site, and this will enable subsequent refactorings.
1 parent e4e34a1 commit 78b328d

File tree

1 file changed

+3
-10
lines changed
  • compiler/rustc_errors/src

1 file changed

+3
-10
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,17 +1300,17 @@ impl DiagCtxtInner {
13001300
fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option<ErrorGuaranteed> {
13011301
assert!(diagnostic.level.can_be_top_or_sub().0);
13021302

1303-
if let Some(expectation_id) = diagnostic.level.get_expectation_id() {
1303+
if let Expect(expect_id) | ForceWarning(Some(expect_id)) = diagnostic.level {
13041304
// The `LintExpectationId` can be stable or unstable depending on when it was created.
13051305
// Diagnostics created before the definition of `HirId`s are unstable and can not yet
13061306
// be stored. Instead, they are buffered until the `LintExpectationId` is replaced by
13071307
// a stable one by the `LintLevelsBuilder`.
1308-
if let LintExpectationId::Unstable { .. } = expectation_id {
1308+
if let LintExpectationId::Unstable { .. } = expect_id {
13091309
self.unstable_expect_diagnostics.push(diagnostic);
13101310
return None;
13111311
}
13121312
self.suppressed_expected_diag = true;
1313-
self.fulfilled_expectations.insert(expectation_id.normalize());
1313+
self.fulfilled_expectations.insert(expect_id.normalize());
13141314
}
13151315

13161316
if diagnostic.has_future_breakage() {
@@ -1689,13 +1689,6 @@ impl Level {
16891689
matches!(*self, FailureNote)
16901690
}
16911691

1692-
pub fn get_expectation_id(&self) -> Option<LintExpectationId> {
1693-
match self {
1694-
Expect(id) | ForceWarning(Some(id)) => Some(*id),
1695-
_ => None,
1696-
}
1697-
}
1698-
16991692
// Can this level be used in a top-level diagnostic message and/or a
17001693
// subdiagnostic message?
17011694
fn can_be_top_or_sub(&self) -> (bool, bool) {

0 commit comments

Comments
 (0)