From 418f514fc46f45ae2901753e3398adb33664bed9 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sun, 2 Apr 2023 21:38:17 +0200 Subject: I, for one, welcome our new clippy overlords --- examples/text-adventure/side_effects.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/text-adventure/side_effects.rs') 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 }, }; -- cgit v1.2.3