aboutsummaryrefslogtreecommitdiff
path: root/b3sum/src
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2020-05-12 09:55:09 -0400
committerJack O'Connor <[email protected]>2020-05-12 09:58:54 -0400
commit584a66598d0e464cc2741dcac8a12d61023818e3 (patch)
tree69a254473cdc3fdab24a56cb7a68b744ca03cf20 /b3sum/src
parentdc2a79d2669c92795c7214761a0568d629a100e4 (diff)
stop printing the lossy warning
Rather than breaking the check parse with more output, we'll have a rule that a Unicode replacement character (�) in a path name automatically fails the check.
Diffstat (limited to 'b3sum/src')
-rw-r--r--b3sum/src/main.rs12
1 files changed, 0 insertions, 12 deletions
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs
index a87a486..16d2948 100644
--- a/b3sum/src/main.rs
+++ b/b3sum/src/main.rs
@@ -1,6 +1,5 @@
use anyhow::{bail, Context, Result};
use clap::{App, Arg};
-use std::borrow::Cow;
use std::cmp;
use std::convert::TryInto;
use std::ffi::OsStr;
@@ -223,14 +222,12 @@ fn read_key_from_stdin() -> Result<[u8; blake3::KEY_LEN]> {
struct FilepathString {
filepath_string: String,
- was_lossy: bool,
has_escapes: bool,
}
// returns (string, did_escape)
fn filepath_to_string(filepath_osstr: &OsStr) -> FilepathString {
let unicode_cow = filepath_osstr.to_string_lossy();
- let was_lossy = matches!(unicode_cow, Cow::Owned(_));
let mut filepath_string = unicode_cow.to_string();
// If we're on Windows, normalize backslashes to forward slashes. This
// avoids a lot of ugly escaping in the common case, and it makes
@@ -248,7 +245,6 @@ fn filepath_to_string(filepath_osstr: &OsStr) -> FilepathString {
}
FilepathString {
filepath_string,
- was_lossy,
has_escapes,
}
}
@@ -288,16 +284,8 @@ fn main() -> Result<()> {
for filepath_osstr in files {
let FilepathString {
filepath_string,
- was_lossy,
has_escapes,
} = filepath_to_string(filepath_osstr);
- if was_lossy && !raw_output {
- // The conversion was lossy. Print a warning. In addition
- // to being a warning, this prevents the output from being
- // successfully parsed by --check. Thus it goes to stdout
- // rather than stderr.
- println!("b3sum: warning: filepath contains invalid Unicode");
- }
match hash_file(&base_hasher, filepath_osstr, mmap_disabled) {
Ok(output) => {
if raw_output {