Skip to content

Commit ecd3718

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

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
@@ -1356,17 +1356,17 @@ impl DiagCtxtInner {
13561356
fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuaranteed> {
13571357
assert!(diagnostic.level.can_be_top_or_sub().0);
13581358

1359-
if let Some(expectation_id) = diagnostic.level.get_expectation_id() {
1359+
if let Expect(expect_id) | ForceWarning(Some(expect_id)) = diagnostic.level {
13601360
// The `LintExpectationId` can be stable or unstable depending on when it was created.
13611361
// Diagnostics created before the definition of `HirId`s are unstable and can not yet
13621362
// be stored. Instead, they are buffered until the `LintExpectationId` is replaced by
13631363
// a stable one by the `LintLevelsBuilder`.
1364-
if let LintExpectationId::Unstable { .. } = expectation_id {
1364+
if let LintExpectationId::Unstable { .. } = expect_id {
13651365
self.unstable_expect_diagnostics.push(diagnostic);
13661366
return None;
13671367
}
13681368
self.suppressed_expected_diag = true;
1369-
self.fulfilled_expectations.insert(expectation_id.normalize());
1369+
self.fulfilled_expectations.insert(expect_id.normalize());
13701370
}
13711371

13721372
if diagnostic.has_future_breakage() {
@@ -1794,13 +1794,6 @@ impl Level {
17941794
matches!(*self, FailureNote)
17951795
}
17961796

1797-
pub fn get_expectation_id(&self) -> Option<LintExpectationId> {
1798-
match self {
1799-
Expect(id) | ForceWarning(Some(id)) => Some(*id),
1800-
_ => None,
1801-
}
1802-
}
1803-
18041797
// Can this level be used in a top-level diagnostic message and/or a
18051798
// subdiagnostic message?
18061799
fn can_be_top_or_sub(&self) -> (bool, bool) {

0 commit comments

Comments
 (0)