chore: Make `Settings::from_paths` return `Self`

This commit is contained in:
Dmitry Dygalo 2022-09-14 10:41:13 +02:00
parent a711569c2c
commit a502098baf
No known key found for this signature in database
GPG Key ID: 0D78E60518FE18BB
2 changed files with 3 additions and 4 deletions

View File

@ -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);
}

View File

@ -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>) {