diff --git a/src/main.rs b/src/main.rs index 63ef28a..1970776 100644 --- a/src/main.rs +++ b/src/main.rs @@ -385,11 +385,11 @@ fn handle_connection( return; } - if let Some(pki_path) = &pki_path { - if !Path::is_file(pki_path) { - fail(stream); - return; - } + if let Some(pki_path) = &pki_path + && !Path::is_file(pki_path) + { + fail(stream); + return; } let info = if let Ok(mut context) = context.lock() { @@ -544,11 +544,11 @@ fn handle_relative_connection( let info = info.update(name, text, up, down); - if let Ok(mut file) = File::create(file_paths.data) { - if to_stream::(&info, &mut file).is_err() { - eprintln!("Error saving data!"); - eprintln!(); - } + if let Ok(mut file) = File::create(file_paths.data) + && to_stream::(&info, &mut file).is_err() + { + eprintln!("Error saving data!"); + eprintln!(); } let SiteInfo { diff --git a/src/tabs.rs b/src/tabs.rs index 467b150..6c182f5 100644 --- a/src/tabs.rs +++ b/src/tabs.rs @@ -129,13 +129,13 @@ impl TabInfo { let _ = writeln!(stream, "

Description

"); - if let Some(audio_path) = &file_paths.audio { - if audio_path.is_file() { - let _ = writeln!( - stream, - "

" - ); - } + if let Some(audio_path) = &file_paths.audio + && audio_path.is_file() + { + let _ = writeln!( + stream, + "

" + ); } let lines = BufReader::new(pki_file).lines().map_while(Result::ok); diff --git a/src/vn.rs b/src/vn.rs index c4279e5..056192e 100644 --- a/src/vn.rs +++ b/src/vn.rs @@ -507,36 +507,36 @@ fn apply_block_changes( .flat_map(|l| &l.actions) .chain(&block.final_actions) { - if let Some(state) = states.get_mut(parameter) { - if let Some(change) = changes[parameter].get(*state) { - settings.change(change); - *state += 1; - } + if let Some(state) = states.get_mut(parameter) + && let Some(change) = changes[parameter].get(*state) + { + settings.change(change); + *state += 1; } } } fn load_multilinear(mlc_path: Option<&Path>, mld_path: &Path) -> Option { let mut parser = MultilinearParser::default(); - if let Some(mlc_path) = mlc_path { - if let Ok(file) = File::open(mlc_path) { - for line in BufReader::new(file).lines() { - let Ok(line) = line else { - break; - }; + if let Some(mlc_path) = mlc_path + && let Ok(file) = File::open(mlc_path) + { + for line in BufReader::new(file).lines() { + let Ok(line) = line else { + break; + }; - if let Some((channel, default_value)) = line.split_once(':') { - let _ = parser.add_new_channel(channel, default_value); - continue; - } - - let line = line.trim(); - if line.is_empty() { - continue; - } - - return None; + if let Some((channel, default_value)) = line.split_once(':') { + let _ = parser.add_new_channel(channel, default_value); + continue; } + + let line = line.trim(); + if line.is_empty() { + continue; + } + + return None; } } @@ -601,10 +601,10 @@ pub fn render_novel( let mut choices = Vec::new(); for (i, dialog_sequence) in dialogs.iter().enumerate() { - if let Some(block) = dialog_sequence.blocks.first() { - if simulation.callable(Event(i)) { - choices.push((i, block)) - } + if let Some(block) = dialog_sequence.blocks.first() + && simulation.callable(Event(i)) + { + choices.push((i, block)) } }