Skip to content

Commit

Permalink
limit line length to 79
Browse files Browse the repository at this point in the history
  • Loading branch information
wookietreiber committed Dec 25, 2023
1 parent c11db6f commit c100245
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_width = 79
13 changes: 10 additions & 3 deletions examples/cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use clap::{value_parser, Arg, ArgAction, Command, ValueEnum};
use clap_digest::Digest;
use digest::DynDigest;

fn hash_path(path: impl AsRef<Path>, hasher: &mut dyn DynDigest) -> Result<Box<[u8]>> {
fn hash_path(
path: impl AsRef<Path>,
hasher: &mut dyn DynDigest,
) -> Result<Box<[u8]>> {
let content = std::fs::read_to_string(path)?;
let bytes = content.as_bytes();
hasher.update(bytes);
Expand Down Expand Up @@ -56,8 +59,12 @@ fn cli() -> Command {

Command::new("cksum")
.arg(input)
.arg(clap_digest::arg::digest().required_unless_present("list-digests"))
.arg(
clap_digest::arg::digest().required_unless_present("list-digests"),
)
.arg(clap_digest::arg::list_digests())
.about("simple cksum clone that hashes text files")
.after_help("try `cargo run --example cksum -- -d MD5 Cargo.toml | md5sum -c`")
.after_help(
"try `cargo run --example cksum -- -d MD5 Cargo.toml | md5sum -c`",
)
}
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ pub use digest::DynDigest;
feature = "tiger",
feature = "whirlpool"
)))]
compile_error!("at least one digest algorithm family feature needs to be enabled");
compile_error!(
"at least one digest algorithm family feature needs to be enabled"
);

/// Supported digest algorithms.
#[allow(missing_docs)] // no docs for the variants
Expand Down Expand Up @@ -563,7 +565,9 @@ impl From<Digest> for Box<dyn DynDigest> {
Digest::FSB512 => Box::<fsb::Fsb512>::default(),

#[cfg(feature = "gost94")]
Digest::GOST94CryptoPro => Box::<gost94::Gost94CryptoPro>::default(),
Digest::GOST94CryptoPro => {
Box::<gost94::Gost94CryptoPro>::default()
}

#[cfg(feature = "gost94")]
Digest::GOST94UA => Box::<gost94::Gost94UA>::default(),
Expand Down

0 comments on commit c100245

Please sign in to comment.