Do String borrow better
This commit is contained in:
parent
e3122519df
commit
ed83cd6b64
@ -11,7 +11,7 @@ fn main() {
|
|||||||
command = arg;
|
command = arg;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_ => command_args.push(arg.as_str().to_string()),
|
_ => command_args.push(arg.clone()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ fn main() {
|
|||||||
eprintln!("ERROR: missing a value to convert");
|
eprintln!("ERROR: missing a value to convert");
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
temp_convert(command_args[0].as_str().to_string())
|
temp_convert(&command_args[0])
|
||||||
}
|
}
|
||||||
"fib" => {
|
"fib" => {
|
||||||
if command_args.len() < 1 {
|
if command_args.len() < 1 {
|
||||||
@ -58,7 +58,7 @@ fn redefine_x() {
|
|||||||
println!("The value of x is: {}", x);
|
println!("The value of x is: {}", x);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn temp_convert(to_convert: String) {
|
fn temp_convert(to_convert: &String) {
|
||||||
let to_convert = to_convert.to_lowercase();
|
let to_convert = to_convert.to_lowercase();
|
||||||
if to_convert.ends_with("c") {
|
if to_convert.ends_with("c") {
|
||||||
let c: f32 = to_convert
|
let c: f32 = to_convert
|
||||||
|
Loading…
x
Reference in New Issue
Block a user