Remove Diagnostic::expect_range and all consumers (#20322)

Replace usage with `range().unwrap_or_default()` or more appropriate
alternatives based on context.
This commit is contained in:
Amethyst Reese 2025-09-10 17:19:20 -07:00 committed by GitHub
parent 12c337c948
commit a3ec8ca9df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 53 additions and 63 deletions

View file

@ -231,8 +231,12 @@ impl Workspace {
.map(|msg| ExpandedMessage {
code: msg.secondary_code_or_id().to_string(),
message: msg.body().to_string(),
start_location: source_code.line_column(msg.expect_range().start()).into(),
end_location: source_code.line_column(msg.expect_range().end()).into(),
start_location: source_code
.line_column(msg.range().unwrap_or_default().start())
.into(),
end_location: source_code
.line_column(msg.range().unwrap_or_default().end())
.into(),
fix: msg.fix().map(|fix| ExpandedFix {
message: msg.first_help_text().map(ToString::to_string),
edits: fix