Skip to content

Instantly share code, notes, and snippets.

@carols10cents
Forked from anonymous/playground.rs
Last active May 29, 2016 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carols10cents/b40f10fdbdccf7a50b691b373ddece91 to your computer and use it in GitHub Desktop.
Save carols10cents/b40f10fdbdccf7a50b691b373ddece91 to your computer and use it in GitHub Desktop.
would clippy catch this copypasta?
fn main() {
let list = vec![0, 1, 2, 3, 4, 5];
let index = 3;
if true {
println!("the magic number is {}", list[index]);
} else {
let other_index = 5;
println!("the index is {}", other_index); // so you wouldn't get "unused variable other_index"
println!("the magic number is {}", list[index]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment