Guest User

Untitled

a guest
Jun 25th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. fn main() {
  2. println!("{}", get_username());
  3. }
  4.  
  5. #[allow(unused_mut)] // 💡 A lint attribute used to suppress the warning; username variable does not need to be mutable
  6. fn get_username() -> String {
  7. let mut username = String::new();
  8.  
  9. // some code to get the name
  10.  
  11. if username.is_empty() {
  12. panic!("Username is empty!");
  13. }
  14.  
  15. username
  16. }
Add Comment
Please, Sign In to add comment