Skip to content

Commit acb90ee

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

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
@@ -1303,17 +1303,17 @@ impl DiagCtxtInner {
13031303
fn emit_diagnostic(&mut self, mut diagnostic: Diagnostic) -> Option<ErrorGuaranteed> {
13041304
assert!(diagnostic.level.can_be_top_or_sub().0);
13051305

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

13191319
if diagnostic.has_future_breakage() {
@@ -1728,13 +1728,6 @@ impl Level {
17281728
matches!(*self, FailureNote)
17291729
}
17301730

1731-
pub fn get_expectation_id(&self) -> Option<LintExpectationId> {
1732-
match self {
1733-
Expect(id) | ForceWarning(Some(id)) => Some(*id),
1734-
_ => None,
1735-
}
1736-
}
1737-
17381731
// Can this level be used in a top-level diagnostic message and/or a
17391732
// subdiagnostic message?
17401733
fn can_be_top_or_sub(&self) -> (bool, bool) {

0 commit comments

Comments
 (0)