mirror of https://github.com/astral-sh/ruff
chore: Make `Settings::from_paths` return `Self`
This commit is contained in:
parent
a711569c2c
commit
a502098baf
|
|
@ -183,7 +183,7 @@ fn inner_main() -> Result<ExitCode> {
|
|||
|
||||
set_up_logging(cli.verbose)?;
|
||||
|
||||
let mut settings = Settings::from_paths(&cli.files)?;
|
||||
let mut settings = Settings::from_paths(&cli.files);
|
||||
if !cli.select.is_empty() {
|
||||
settings.select(cli.select);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ use std::collections::BTreeSet;
|
|||
use std::hash::{Hash, Hasher};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Result;
|
||||
use glob::Pattern;
|
||||
|
||||
use crate::checks::CheckCode;
|
||||
|
|
@ -25,7 +24,7 @@ impl Hash for Settings {
|
|||
}
|
||||
|
||||
impl Settings {
|
||||
pub fn from_paths(paths: &[PathBuf]) -> Result<Self> {
|
||||
pub fn from_paths(paths: &[PathBuf]) -> Self {
|
||||
let (project_root, config) = load_config(paths);
|
||||
let mut settings = Settings {
|
||||
line_length: config.line_length.unwrap_or(88),
|
||||
|
|
@ -89,7 +88,7 @@ impl Settings {
|
|||
if let Some(ignore) = &config.ignore {
|
||||
settings.ignore(ignore);
|
||||
}
|
||||
Ok(settings)
|
||||
settings
|
||||
}
|
||||
|
||||
pub fn select(&mut self, codes: Vec<CheckCode>) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue