diff --git a/src/controller/controller.rs b/src/controller/controller.rs index 1e5dd78..68e7301 100644 --- a/src/controller/controller.rs +++ b/src/controller/controller.rs @@ -2,7 +2,7 @@ use gtk::*; use gtk4 as gtk; pub fn state_controller(switch: &Switch, label: &Label) -> () { - if switch.state() == true { + if switch.state() { label.set_label("Режим: проверка"); } else { label.set_label("Режим: кодирование"); diff --git a/src/controller/model_utils/hamming_code_seven_four.rs b/src/controller/model_utils/hamming_code_seven_four.rs index 76e7d45..7e8ae63 100644 --- a/src/controller/model_utils/hamming_code_seven_four.rs +++ b/src/controller/model_utils/hamming_code_seven_four.rs @@ -125,8 +125,8 @@ pub fn hamming_decrypt_data(data: &Vec, result_string: &mut String, length_o } } - if data.len() > 0 { - if errors.len() == 0 { + if !data.is_empty() { + if errors.is_empty() { result_string.push_str("Все коды корректны."); } else { result_string.push_str(errors.as_str()); diff --git a/src/controller/view_utils/hamming_code_input_utils.rs b/src/controller/view_utils/hamming_code_input_utils.rs index 94f3b44..03e7f69 100644 --- a/src/controller/view_utils/hamming_code_input_utils.rs +++ b/src/controller/view_utils/hamming_code_input_utils.rs @@ -13,7 +13,7 @@ pub fn start_hamming_algorithm(input: &TextView, output: &TextView, mode: bool) .parse() .unwrap(); - let operation = if mode == false { + let operation = if mode { HammingMode::Encrypt } else { HammingMode::Decrypt