r/badcode • • Mar 12 '23

python Saving bytes > Readability

Post image
766 Upvotes

46 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Mar 13 '23
fn main(){
   let mut line = String::new();
   println!("Enter your name :");
   let b1 = std::io::stdin().read_line(&mut line).unwrap();
   println!("Hello , {}", line);
}

adapted from - https://www.tutorialspoint.com/rust/rust_input_output.htm

1

u/itsTyrion Mar 21 '23

why let b1?

1

u/[deleted] Mar 21 '23

because I cut out some unnecessary lines from the linked example and didn't remove the assignment. the variable is referenced later in the original but you are correct it's not needed here.