mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:47 +00:00
Make DisplayParseError
an error type (#9325)
## Summary This is a non-behavior-changing refactor to follow-up https://github.com/astral-sh/ruff/pull/9321 by modifying `DisplayParseError` to use owned data and make it useable as a standalone error type (rather than using references and implementing `Display`). I don't feel very strongly either way. I thought it was awkward that the `FormatCommandError` had two branches in the display path, and wanted to represent the `Parse` vs. other cases as a separate enum, so here we are.
This commit is contained in:
parent
b3789cd9e9
commit
da8a3af524
5 changed files with 132 additions and 91 deletions
|
@ -339,7 +339,12 @@ pub fn add_noqa_to_path(
|
|||
if let Some(error) = error {
|
||||
error!(
|
||||
"{}",
|
||||
DisplayParseError::new(&error, &locator.to_source_code(), source_kind, Some(path))
|
||||
DisplayParseError::from_source_code(
|
||||
error,
|
||||
Some(path.to_path_buf()),
|
||||
&locator.to_source_code(),
|
||||
source_kind,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue