mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
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:
parent
0b2a5b5cd3
commit
81045758d3
2 changed files with 3 additions and 3 deletions
|
@ -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),
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue