fix(cond): remove redundant boolean operations and replace them with their correct analogs

This commit is contained in:
doryan 2024-07-22 00:02:16 +04:00
parent 81a8d9b2c6
commit 2e543a22c8
3 changed files with 4 additions and 4 deletions

View File

@ -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("Режим: кодирование");

View File

@ -125,8 +125,8 @@ pub fn hamming_decrypt_data(data: &Vec<u8>, 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());

View File

@ -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