fix(cond): remove redundant boolean operations and replace them with their correct analogs
This commit is contained in:
parent
81a8d9b2c6
commit
2e543a22c8
|
@ -2,7 +2,7 @@ use gtk::*;
|
||||||
use gtk4 as gtk;
|
use gtk4 as gtk;
|
||||||
|
|
||||||
pub fn state_controller(switch: &Switch, label: &Label) -> () {
|
pub fn state_controller(switch: &Switch, label: &Label) -> () {
|
||||||
if switch.state() == true {
|
if switch.state() {
|
||||||
label.set_label("Режим: проверка");
|
label.set_label("Режим: проверка");
|
||||||
} else {
|
} else {
|
||||||
label.set_label("Режим: кодирование");
|
label.set_label("Режим: кодирование");
|
||||||
|
|
|
@ -125,8 +125,8 @@ pub fn hamming_decrypt_data(data: &Vec<u8>, result_string: &mut String, length_o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if data.len() > 0 {
|
if !data.is_empty() {
|
||||||
if errors.len() == 0 {
|
if errors.is_empty() {
|
||||||
result_string.push_str("Все коды корректны.");
|
result_string.push_str("Все коды корректны.");
|
||||||
} else {
|
} else {
|
||||||
result_string.push_str(errors.as_str());
|
result_string.push_str(errors.as_str());
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub fn start_hamming_algorithm(input: &TextView, output: &TextView, mode: bool)
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let operation = if mode == false {
|
let operation = if mode {
|
||||||
HammingMode::Encrypt
|
HammingMode::Encrypt
|
||||||
} else {
|
} else {
|
||||||
HammingMode::Decrypt
|
HammingMode::Decrypt
|
||||||
|
|
Loading…
Reference in New Issue