use semicolons if nothing returned

This commit is contained in:
Daniel Eades
2022-01-30 15:08:26 +01:00
parent a2d5f06be4
commit 784f2e2ea1
56 changed files with 125 additions and 127 deletions
+5 -5
View File
@@ -77,7 +77,7 @@ pub fn main() {
)
.as_bytes(),
)
.unwrap()
.unwrap();
}
k if k.starts_with(override_prefix) => {
mf.write_all(
@@ -97,7 +97,7 @@ pub fn main() {
)
.as_bytes(),
)
.unwrap()
.unwrap();
}
"false" | "true" => {
mf.write_all(
@@ -116,7 +116,7 @@ pub fn main() {
)
.as_bytes(),
)
.unwrap()
.unwrap();
}
"hashsum" => {
mf.write_all(
@@ -150,7 +150,7 @@ pub fn main() {
)
.as_bytes(),
)
.unwrap()
.unwrap();
}
_ => {
mf.write_all(
@@ -169,7 +169,7 @@ pub fn main() {
)
.as_bytes(),
)
.unwrap()
.unwrap();
}
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ fn main() -> io::Result<()> {
} else {
println!("Error writing to {}", p);
}
writeln!(summary, "* [{0}](utils/{0}.md)", name)?
writeln!(summary, "* [{0}](utils/{0}.md)", name)?;
}
Ok(())
}
+1 -1
View File
@@ -743,7 +743,7 @@ This almost certainly means that you have a corrupted file system.\n\
NOTIFY YOUR SYSTEM MANAGER.\n\
The following directory is part of the cycle {}.",
file_name.quote()
)
);
}
#[derive(Debug)]
+3 -3
View File
@@ -742,7 +742,7 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec<S
if options.strip_trailing_slashes {
for source in paths.iter_mut() {
*source = source.components().as_path().to_owned()
*source = source.components().as_path().to_owned();
}
}
@@ -864,7 +864,7 @@ fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResu
}
_ => {
show_error!("{}", error);
non_fatal_errors = true
non_fatal_errors = true;
}
}
}
@@ -1580,5 +1580,5 @@ fn test_cp_localize_to_target() {
)
.unwrap()
== Path::new("target/c.txt")
)
);
}
+2 -2
View File
@@ -491,14 +491,14 @@ pub fn parse_conv_flag_input(matches: &Matches) -> Result<IConvFlags, ParseError
if case.is_some() {
return Err(ParseError::MultipleUCaseLCase);
} else {
case = Some(flag)
case = Some(flag);
}
}
ConvFlag::LCase => {
if case.is_some() {
return Err(ParseError::MultipleUCaseLCase);
} else {
case = Some(flag)
case = Some(flag);
}
}
ConvFlag::Block => match (cbs, iconvflags.unblock) {
+2 -2
View File
@@ -56,10 +56,10 @@ fn unimplemented_flags_should_error() {
let matches = uu_app().try_get_matches_from(args).unwrap();
if parse_iflags(&matches).is_ok() {
succeeded.push(format!("iflag={}", flag))
succeeded.push(format!("iflag={}", flag));
}
if parse_oflags(&matches).is_ok() {
succeeded.push(format!("oflag={}", flag))
succeeded.push(format!("oflag={}", flag));
}
}
+2 -2
View File
@@ -127,7 +127,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let result;
if files.is_empty() {
result = parse(INTERNAL_DB.lines(), &out_format, "")
result = parse(INTERNAL_DB.lines(), &out_format, "");
} else {
if files.len() > 1 {
return Err(UUsageError::new(
@@ -138,7 +138,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
match File::open(files[0]) {
Ok(f) => {
let fin = BufReader::new(f);
result = parse(fin.lines().filter_map(Result::ok), &out_format, files[0])
result = parse(fin.lines().filter_map(Result::ok), &out_format, files[0]);
}
Err(e) => {
return Err(USimpleError::new(
+1 -1
View File
@@ -61,7 +61,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
match p.parent() {
Some(d) => {
if d.components().next() == None {
print!(".")
print!(".");
} else {
print_verbatim(d).unwrap();
}
+2 -2
View File
@@ -335,7 +335,7 @@ fn du(
ErrorKind::PermissionDenied => {
let description = format!("cannot access {}", entry.path().quote());
let error_message = "Permission denied";
show_error_custom_description!(description, "{}", error_message)
show_error_custom_description!(description, "{}", error_message);
}
_ => show_error!("cannot access {}: {}", entry.path().quote(), error),
},
@@ -486,7 +486,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
if options.inodes
&& (matches.is_present(options::APPARENT_SIZE) || matches.is_present(options::BYTES))
{
show_warning!("options --apparent-size and -b are ineffective with --inodes")
show_warning!("options --apparent-size and -b are ineffective with --inodes");
}
let block_size = u64::try_from(read_block_size(matches.value_of(options::BLOCK_SIZE))).unwrap();
+1 -1
View File
@@ -332,7 +332,7 @@ fn expand(options: &Options) -> std::io::Result<()> {
// now dump out either spaces if we're expanding, or a literal tab if we're not
if init || !options.iflag {
if nts <= options.tspaces.len() {
output.write_all(options.tspaces[..nts].as_bytes())?
output.write_all(options.tspaces[..nts].as_bytes())?;
} else {
output.write_all(" ".repeat(nts).as_bytes())?;
};
+1 -1
View File
@@ -370,7 +370,7 @@ fn push_op_to_stack(
},
)) => {
if la && prev_prec >= prec || !la && prev_prec > prec {
out_stack.push(op_stack.pop().unwrap())
out_stack.push(op_stack.pop().unwrap());
} else {
op_stack.push((token_idx, token.clone()));
return Ok(());
+2 -2
View File
@@ -155,8 +155,8 @@ fn push_token_if_not_escaped(acc: &mut Vec<(usize, Token)>, tok_idx: usize, toke
if should_use_as_escaped {
acc.pop();
acc.push((tok_idx, Token::new_value(s)))
acc.push((tok_idx, Token::new_value(s)));
} else {
acc.push((tok_idx, token))
acc.push((tok_idx, token));
}
}
+4 -4
View File
@@ -34,7 +34,7 @@ impl Decomposition {
if let Some((_, e)) = self.0.iter_mut().find(|(f, _)| *f == factor) {
*e += exp;
} else {
self.0.push((factor, exp))
self.0.push((factor, exp));
}
}
@@ -79,11 +79,11 @@ impl Factors {
pub fn add(&mut self, prime: u64, exp: Exponent) {
debug_assert!(miller_rabin::is_prime(prime));
self.0.borrow_mut().add(prime, exp)
self.0.borrow_mut().add(prime, exp);
}
pub fn push(&mut self, prime: u64) {
self.add(prime, 1)
self.add(prime, 1);
}
#[cfg(test)]
@@ -99,7 +99,7 @@ impl fmt::Display for Factors {
for (p, exp) in v.iter() {
for _ in 0..*exp {
write!(f, " {}", p)?
write!(f, " {}", p)?;
}
}
+1 -1
View File
@@ -384,7 +384,7 @@ fn build_best_path<'a>(paths: &[LineBreak<'a>], active: &[usize]) -> Vec<(&'a Wo
None => return breakwords,
Some(prev) => {
breakwords.push((prev, next_best.break_before));
best_idx = next_best.prev
best_idx = next_best.prev;
}
}
}
+1 -1
View File
@@ -44,7 +44,7 @@ impl Digest for md5::Context {
}
fn input(&mut self, input: &[u8]) {
self.consume(input)
self.consume(input);
}
fn result(&mut self, out: &mut [u8]) {
+12 -12
View File
@@ -173,28 +173,28 @@ fn detect_algo(
};
name = n;
alg = Some(val);
output_bits = bits
output_bits = bits;
};
if matches.is_present("md5") {
set_or_crash("MD5", Box::new(Md5::new()), 128)
set_or_crash("MD5", Box::new(Md5::new()), 128);
}
if matches.is_present("sha1") {
set_or_crash("SHA1", Box::new(Sha1::new()), 160)
set_or_crash("SHA1", Box::new(Sha1::new()), 160);
}
if matches.is_present("sha224") {
set_or_crash("SHA224", Box::new(Sha224::new()), 224)
set_or_crash("SHA224", Box::new(Sha224::new()), 224);
}
if matches.is_present("sha256") {
set_or_crash("SHA256", Box::new(Sha256::new()), 256)
set_or_crash("SHA256", Box::new(Sha256::new()), 256);
}
if matches.is_present("sha384") {
set_or_crash("SHA384", Box::new(Sha384::new()), 384)
set_or_crash("SHA384", Box::new(Sha384::new()), 384);
}
if matches.is_present("sha512") {
set_or_crash("SHA512", Box::new(Sha512::new()), 512)
set_or_crash("SHA512", Box::new(Sha512::new()), 512);
}
if matches.is_present("b2sum") {
set_or_crash("BLAKE2", Box::new(blake2b_simd::State::new()), 512)
set_or_crash("BLAKE2", Box::new(blake2b_simd::State::new()), 512);
}
if matches.is_present("sha3") {
match matches.value_of("bits") {
@@ -229,16 +229,16 @@ fn detect_algo(
}
}
if matches.is_present("sha3-224") {
set_or_crash("SHA3-224", Box::new(Sha3_224::new()), 224)
set_or_crash("SHA3-224", Box::new(Sha3_224::new()), 224);
}
if matches.is_present("sha3-256") {
set_or_crash("SHA3-256", Box::new(Sha3_256::new()), 256)
set_or_crash("SHA3-256", Box::new(Sha3_256::new()), 256);
}
if matches.is_present("sha3-384") {
set_or_crash("SHA3-384", Box::new(Sha3_384::new()), 384)
set_or_crash("SHA3-384", Box::new(Sha3_384::new()), 384);
}
if matches.is_present("sha3-512") {
set_or_crash("SHA3-512", Box::new(Sha3_512::new()), 512)
set_or_crash("SHA3-512", Box::new(Sha3_512::new()), 512);
}
if matches.is_present("shake128") {
match matches.value_of("bits") {
+2 -2
View File
@@ -424,7 +424,7 @@ fn uu_head(options: &HeadOptions) -> UResult<()> {
if !first {
println!();
}
println!("==> standard input <==")
println!("==> standard input <==");
}
let stdin = std::io::stdin();
let mut stdin = stdin.lock();
@@ -460,7 +460,7 @@ fn uu_head(options: &HeadOptions) -> UResult<()> {
if !first {
println!();
}
println!("==> {} <==", name)
println!("==> {} <==", name);
}
head_file(&mut file, options)
}
+6 -6
View File
@@ -43,11 +43,11 @@ pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>
// this also saves us 1 heap allocation
'q' => {
quiet = true;
verbose = false
verbose = false;
}
'v' => {
verbose = true;
quiet = false
quiet = false;
}
'z' => zero_terminated = true,
'c' => multiplier = Some(1),
@@ -58,20 +58,20 @@ pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>
_ => return Some(Err(ParseError::Syntax)),
}
if let Some((_, next)) = chars.next() {
c = next
c = next;
} else {
break;
}
}
let mut options = Vec::new();
if quiet {
options.push(OsString::from("-q"))
options.push(OsString::from("-q"));
}
if verbose {
options.push(OsString::from("-v"))
options.push(OsString::from("-v"));
}
if zero_terminated {
options.push(OsString::from("-z"))
options.push(OsString::from("-z"));
}
if let Some(n) = multiplier {
options.push(OsString::from("-c"));
+3 -3
View File
@@ -308,7 +308,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings)
if is_symlink(target_dir) {
if target_dir.is_file() {
if let Err(e) = fs::remove_file(target_dir) {
show_error!("Could not update {}: {}", target_dir.quote(), e)
show_error!("Could not update {}: {}", target_dir.quote(), e);
};
}
if target_dir.is_dir() {
@@ -316,7 +316,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings)
// considered as a dir
// See test_ln::test_symlink_no_deref_dir
if let Err(e) = fs::remove_dir(target_dir) {
show_error!("Could not update {}: {}", target_dir.quote(), e)
show_error!("Could not update {}: {}", target_dir.quote(), e);
};
}
}
@@ -402,7 +402,7 @@ fn link(src: &Path, dst: &Path, settings: &Settings) -> Result<()> {
if !read_yes() {
return Ok(());
}
fs::remove_file(dst)?
fs::remove_file(dst)?;
}
OverwriteMode::Force => fs::remove_file(dst)?,
};
+1 -1
View File
@@ -118,7 +118,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
if matches.is_present(OPT_T) {
tmpdir = env::temp_dir()
tmpdir = env::temp_dir();
}
let res = if dry_run {

Some files were not shown because too many files have changed in this diff Show More