From 1cffbe58bb61afbe99dfccc024962823d4c0ebf7 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sat, 6 Jan 2024 10:16:19 -0500 Subject: [PATCH] Use DisplayParseError for stdin parser errors --- crates/ruff_cli/src/diagnostics.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ruff_cli/src/diagnostics.rs b/crates/ruff_cli/src/diagnostics.rs index 037775fe023932..ad9913f083f8bb 100644 --- a/crates/ruff_cli/src/diagnostics.rs +++ b/crates/ruff_cli/src/diagnostics.rs @@ -497,10 +497,10 @@ pub(crate) fn lint_stdin( let imports = imports.unwrap_or_default(); - if let Some(err) = parse_error { + if let Some(error) = parse_error { error!( - "Failed to parse {}: {err}", - path.map_or_else(|| "-".into(), fs::relativize_path).bold() + "{}", + DisplayParseError::from_source_kind(error, path.map(Path::to_path_buf), &transformed) ); }