Lints and suggestions for the Nix programming language
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #54 from ilkecan/accept-all-config-file-names

Don't reject the given config file based on its name

authored by

Akshay and committed by
GitHub
6b490d71 6422c959

+5 -5
+5 -5
bin/src/config.rs
··· 55 55 #[clap(short = 'o', long, default_value_t, parse(try_from_str))] 56 56 pub format: OutFormat, 57 57 58 - /// Path to statix.toml 58 + /// Path to statix.toml or its parent directory 59 59 #[clap(short = 'c', long = "config", default_value = ".")] 60 60 pub conf_path: PathBuf, 61 61 ··· 102 102 #[clap(short, long = "dry-run")] 103 103 pub diff_only: bool, 104 104 105 - /// Path to statix.toml 105 + /// Path to statix.toml or its parent directory 106 106 #[clap(short = 'c', long = "config", default_value = ".")] 107 107 pub conf_path: PathBuf, 108 108 ··· 167 167 #[clap(short, long = "stdin")] 168 168 pub streaming: bool, 169 169 170 - /// Path to statix.toml 170 + /// Path to statix.toml or its parent directory 171 171 #[clap(short = 'c', long = "config", default_value = ".")] 172 172 pub conf_path: PathBuf, 173 173 } ··· 286 286 pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, ConfigErr> { 287 287 let path = path.as_ref(); 288 288 let config_file = fs::read_to_string(path).map_err(ConfigErr::InvalidPath)?; 289 - (toml::de::from_str(&config_file)).map_err(ConfigErr::ConfFileParse) 289 + toml::de::from_str(&config_file).map_err(ConfigErr::ConfFileParse) 290 290 } 291 291 pub fn discover<P: AsRef<Path>>(path: P) -> Result<Self, ConfigErr> { 292 292 let cannonical_path = fs::canonicalize(path.as_ref()).map_err(ConfigErr::InvalidPath)?; ··· 294 294 let statix_toml_path = if p.is_dir() { 295 295 p.join("statix.toml") 296 296 } else { 297 - p.with_file_name("statix.toml") 297 + p.to_path_buf() 298 298 }; 299 299 if statix_toml_path.exists() { 300 300 return Self::from_path(statix_toml_path);