Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- println!("{}", get_username());
- }
- #[allow(unused_mut)] // 💡 A lint attribute used to suppress the warning; username variable does not need to be mutable
- fn get_username() -> String {
- let mut username = String::new();
- // some code to get the name
- if username.is_empty() {
- panic!("Username is empty!");
- }
- username
- }
Add Comment
Please, Sign In to add comment