Unify line size settings between ruff and the formatter (#6873)

This commit is contained in:
konsti 2023-08-28 08:44:56 +02:00 committed by GitHub
parent a6aa16630d
commit e615870659
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 227 additions and 190 deletions

View file

@ -7,10 +7,9 @@ use crate::format_element::tag::{Condition, DedentMode};
use crate::prelude::tag::GroupMode;
use crate::prelude::*;
use crate::source_code::SourceCode;
use crate::{format, write, TabWidth};
use crate::{
BufferExtensions, Format, FormatContext, FormatElement, FormatOptions, FormatResult, Formatter,
IndentStyle, LineWidth, PrinterOptions,
format, write, BufferExtensions, Format, FormatContext, FormatElement, FormatOptions,
FormatResult, Formatter, IndentStyle, LineWidth, PrinterOptions, TabWidth,
};
use super::tag::Tag;
@ -222,12 +221,12 @@ impl FormatOptions for IrFormatOptions {
}
fn line_width(&self) -> LineWidth {
LineWidth(80)
LineWidth::try_from(80).unwrap()
}
fn as_print_options(&self) -> PrinterOptions {
PrinterOptions {
print_width: self.line_width().into(),
line_width: self.line_width(),
indent_style: IndentStyle::Space(2),
..PrinterOptions::default()
}