Lints and suggestions for the Nix programming language
1
fork

Configure Feed

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

fix minor bug with out-format

Akshay cd527e84 5f0a1e67

+18 -4
+18 -4
bin/src/config.rs
··· 1 1 use std::{ 2 2 default::Default, 3 - fs, io, 3 + fmt, fs, io, 4 4 path::{Path, PathBuf}, 5 5 str::FromStr, 6 6 }; ··· 40 40 ignore: Vec<String>, 41 41 42 42 /// Output format. 43 - /// Supported values: errfmt, json (on feature flag only) 44 - #[clap(short = 'o', long, default_value = "OutFormat::StdErr")] 43 + /// Supported values: stderr, errfmt, json (on feature flag only) 44 + #[clap(short = 'o', long, default_value_t, parse(try_from_str))] 45 45 pub format: OutFormat, 46 46 } 47 47 ··· 192 192 vfs.set_file_contents(&file, data.as_bytes()); 193 193 } 194 194 Ok(vfs) 195 - 196 195 } 197 196 198 197 #[derive(Debug, Copy, Clone)] ··· 206 205 impl Default for OutFormat { 207 206 fn default() -> Self { 208 207 OutFormat::StdErr 208 + } 209 + } 210 + 211 + impl fmt::Display for OutFormat { 212 + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 213 + write!( 214 + f, 215 + "{}", 216 + match self { 217 + #[cfg(feature = "json")] 218 + Self::Json => "json", 219 + Self::Errfmt => "errfmt", 220 + Self::StdErr => "stderr", 221 + } 222 + ) 209 223 } 210 224 } 211 225