mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00
Unify line size settings between ruff and the formatter (#6873)
This commit is contained in:
parent
a6aa16630d
commit
e615870659
28 changed files with 227 additions and 190 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::io;
|
||||
use std::num::NonZeroU16;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use anyhow::Result;
|
||||
|
@ -49,12 +50,8 @@ pub(crate) fn format(cli: &Arguments, overrides: &Overrides) -> Result<ExitStatu
|
|||
}
|
||||
|
||||
let line_length = resolver.resolve(path, &pyproject_config).line_length;
|
||||
// TODO(konstin): Unify `LineWidth` and `LineLength`
|
||||
let line_width = LineWidth::try_from(
|
||||
u16::try_from(line_length.get()).expect("Line shouldn't be larger than 2**16"),
|
||||
)
|
||||
.expect("Configured line length is too large for the formatter");
|
||||
let options = PyFormatOptions::from_extension(path).with_line_width(line_width);
|
||||
let options = PyFormatOptions::from_extension(path)
|
||||
.with_line_width(LineWidth::from(NonZeroU16::from(line_length)));
|
||||
|
||||
format_path(path, options)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue