Thanks clippy!

This commit is contained in:
2016-06-15 16:14:42 +02:00
parent e71ff3d139
commit a2141a2011
2 changed files with 9 additions and 9 deletions

View File

@@ -68,13 +68,13 @@ fn expm(p: f64, ak: f64) -> f64 {
for _ in 1..i + 1 {
if p >= pt {
r = 16.0 * r;
r = r - (r / ak).trunc() * ak;
r *= 16.0;
r -= (r / ak).trunc() * ak;
p -= pt;
}
pt = 0.5 * pt;
pt *= 0.5;
if pt >= 1.0 {
r *= r;

View File

@@ -52,7 +52,7 @@ fn main() {
std::process::exit(1);
}
if matches.free.len() == 0 {
if matches.free.is_empty() {
println!("Missing operand: INPUT OUTPUT");
println!("Try `{} --help` for more information.", program);
std::process::exit(1);
@@ -62,16 +62,16 @@ fn main() {
let input = &matches.free[0];
let output = &matches.free[1];
compress(&input, &output);
compress(input, output);
} else if matches.opt_present("d") {
let input = &matches.free[0];
let output = &matches.free[1];
extract(&input, &output)
extract(input, output)
}
}
fn compress(input: &String, output: &String) {
fn compress(input: &str, output: &str) {
let mut output_file = fs::File::create(output).unwrap();
let input_file = fs::File::open(input).unwrap();
@@ -104,7 +104,7 @@ fn compress(input: &String, output: &String) {
}
}
fn extract(input: &String, output: &String) {
fn extract(input: &str, output: &str) {
let mut input_file = fs::File::open(input).unwrap();
let n_bytes = input_file.metadata().unwrap().len() as u64;
@@ -118,7 +118,7 @@ fn extract(input: &String, output: &String) {
loop {
let size = input_file.read(&mut buf).unwrap();
if size <= 0 {
if size == 0 {
break;
}