Fmt + Clippy

This commit is contained in:
joeyahines committed 2022-04-09 12:40:37 -06:00
1 parent 59351fb699
commit 6407335362
4 files changed
+28 -21

No files matched your search

+13 -4
View File
@@ -1,18 +1,23 @@
use crate::error::FormatyError;
use crate::parser::parse_bytes_from_input_arg;
use formatter::FormatConfig;
use std::path::PathBuf;
use structopt::StructOpt;
use crate::error::FormatyError;
mod byte_stream;
mod error;
mod formatter;
mod parser;
mod error;
#[derive(Debug, StructOpt)]
#[structopt(name = "Formaty", about = "Arbitrary Binary Data Formatting")]
pub struct Args {
#[structopt(short = "c", long="config", parse(from_os_str), help = "Path to the format config")]
#[structopt(
short = "c",
long = "config",
parse(from_os_str),
help = "Path to the format config"
)]
config: Option<PathBuf>,
#[structopt(help = "Format to parse data as")]
@@ -27,7 +32,11 @@ fn formaty() -> Result<(), FormatyError> {
let config = FormatConfig::new(&args.config)?;
let format = config.formats.iter().find(|f| f.name == args.format).ok_or(FormatyError::FormatNotFound(args.format.to_string()))?;
let format = config
.formats
.iter()
.find(|f| f.name == args.format)
.ok_or_else(|| FormatyError::FormatNotFound(args.format.to_string()))?;
let data = parse_bytes_from_input_arg(args.data).unwrap();