Introduce SourceFile to avoid cloning the message filename (#3904)

This commit is contained in:
Micha Reiser 2023-04-11 10:28:55 +02:00 committed by GitHub
parent 056c212975
commit c33c9dc585
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 296 additions and 271 deletions

View file

@ -18,6 +18,7 @@ use ruff::linter::{lint_fix, lint_only, FixTable, FixerResult, LinterResult};
use ruff::message::Message;
use ruff::settings::{flags, AllSettings, Settings};
use ruff_python_ast::imports::ImportMap;
use ruff_python_ast::source_code::SourceFileBuilder;
use crate::cache;
@ -85,8 +86,7 @@ fn load_jupyter_notebook(path: &Path) -> Result<(String, JupyterIndex), Box<Diag
return Err(Box::new(Diagnostics {
messages: vec![Message::from_diagnostic(
*diagnostic,
path.to_string_lossy().to_string(),
None,
SourceFileBuilder::new(&path.to_string_lossy()).finish(),
1,
)],
..Diagnostics::default()