diff options
| author | Andreas Grois <andi@grois.info> | 2023-04-02 21:38:17 +0200 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2023-04-02 21:53:09 +0200 |
| commit | 418f514fc46f45ae2901753e3398adb33664bed9 (patch) | |
| tree | f8edc0df880a00d4964877d4b835c0eb9e481210 /examples/text-adventure/side_effects.rs | |
| parent | 02d01dd1b544a576caeb8da42912c5db904b94bd (diff) | |
I, for one, welcome our new clippy overlords
Diffstat (limited to 'examples/text-adventure/side_effects.rs')
| -rw-r--r-- | examples/text-adventure/side_effects.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/text-adventure/side_effects.rs b/examples/text-adventure/side_effects.rs index ed0f9e1..dd911dd 100644 --- a/examples/text-adventure/side_effects.rs +++ b/examples/text-adventure/side_effects.rs @@ -11,23 +11,23 @@ pub fn run<'a, 's:'a>(mut game : FreeSausageRoll<'a, 's, ()>) -> std::io::Result while let FreeSausageRoll::Free(command) = game { game = match *command { crate::dsl::SausageRoll::SayDialogueLine { speaker, text, mood, next } => { - println!("{} says: \"{}\" with {} on their face.", speaker.text_description(), text, mood.text_description()); + println!("{} says: \"{text}\" with {} on their face.", speaker.text_description(), mood.text_description()); next }, crate::dsl::SausageRoll::GivePlayerOptions { options, next } => { println!("Your options are:"); for (id, option) in options.iter().enumerate().map(|(i,o)| (i+1,o)){ - println!("{}: {}", id, option); + println!("{id}: {option}"); } let mut input = String::new(); let mut chosen; - while let None = { + while { input.clear(); std::io::stdin().read_line(&mut input)?; chosen = input.trim().parse().ok().filter(|o : &usize| *o > 0 && *o <= options.len()); - chosen + chosen.is_none() } { println!("Invalid choice. Please select one of the options given above."); } @@ -39,7 +39,7 @@ pub fn run<'a, 's:'a>(mut game : FreeSausageRoll<'a, 's, ()>) -> std::io::Result next }, crate::dsl::SausageRoll::Exposition { text, next } => { - println!("{}", text); + println!("{text}"); next }, }; |
