mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:26 +00:00
Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011)
This commit is contained in:
parent
c5995c40d3
commit
29927f2b59
59 changed files with 210 additions and 425 deletions
|
@ -1,9 +1,9 @@
|
|||
use ruff_db::{Db as SourceDb, Upcast, files::File};
|
||||
use ruff_db::{Db as SourceDb, files::File};
|
||||
|
||||
use crate::PyFormatOptions;
|
||||
|
||||
#[salsa::db]
|
||||
pub trait Db: SourceDb + Upcast<dyn SourceDb> {
|
||||
pub trait Db: SourceDb {
|
||||
/// Returns the formatting options
|
||||
fn format_options(&self, file: File) -> PyFormatOptions;
|
||||
}
|
||||
|
|
|
@ -165,14 +165,14 @@ where
|
|||
pub fn formatted_file(db: &dyn Db, file: File) -> Result<Option<String>, FormatModuleError> {
|
||||
let options = db.format_options(file);
|
||||
|
||||
let parsed = parsed_module(db.upcast(), file).load(db.upcast());
|
||||
let parsed = parsed_module(db, file).load(db);
|
||||
|
||||
if let Some(first) = parsed.errors().first() {
|
||||
return Err(FormatModuleError::ParseError(first.clone()));
|
||||
}
|
||||
|
||||
let comment_ranges = CommentRanges::from(parsed.tokens());
|
||||
let source = source_text(db.upcast(), file);
|
||||
let source = source_text(db, file);
|
||||
|
||||
let formatted = format_node(&parsed, &comment_ranges, &source, options)?;
|
||||
let printed = formatted.print()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue