ruff_db: use Annotation::get_message in more places

I added this accessor because tests want it, but we can also use it in
other places internally. It's a little nicer because it does the
`as_deref()` for you.
This commit is contained in:
Andrew Gallant 2025-04-10 13:03:21 -04:00 committed by Andrew Gallant
parent 0b2a5b5cd3
commit 81045758d3
2 changed files with 3 additions and 3 deletions

View file

@ -138,7 +138,7 @@ impl Diagnostic {
// in Red Knot, so we do it this way for now to match the old
// semantics. ---AG
self.primary_annotation()
.and_then(|ann| ann.message.as_deref())
.and_then(|ann| ann.get_message())
.unwrap_or_default()
}
@ -170,7 +170,7 @@ impl Diagnostic {
let main = &self.inner.message;
let annotation = self
.primary_annotation()
.and_then(|ann| ann.message.as_deref())
.and_then(|ann| ann.get_message())
.unwrap_or_default();
match (main.is_empty(), annotation.is_empty()) {
(false, true) => ConciseMessage::MainDiagnostic(main),

View file

@ -314,7 +314,7 @@ impl<'a> ResolvedAnnotation<'a> {
range,
line_start,
line_end,
message: ann.message.as_deref(),
message: ann.get_message(),
is_primary: ann.is_primary,
})
}