mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
17 lines
388 B
Rust
17 lines
388 B
Rust
//@ run-rustfix
|
|
use std::io::stdin;
|
|
|
|
fn get_name() -> String {
|
|
let mut your_name = String::new();
|
|
stdin()
|
|
.read_line(&mut your_name)
|
|
.expect("Failed to read the line for some reason");
|
|
your_name.trim().to_string() //~ ERROR E0308
|
|
}
|
|
|
|
fn main() {
|
|
println!("Hello, What is your name? ");
|
|
let your_name = get_name();
|
|
println!("Hello, {}", your_name)
|
|
}
|