refactor(import + some code): change import and refactor some bad blocks of code

This commit is contained in:
doryan 2024-07-19 23:33:50 +04:00
parent fcfb0d1fa6
commit dbf7dab513

View File

@ -1,7 +1,7 @@
use gtk4 as gtk; use gtk4 as gtk;
use crate::controller::model_utils::signal_reducer::*; use crate::controller::model_utils::signal_reducer::*;
use crate::model::model::SchemeCharacteristics; use crate::model::models::SchemeCharacteristics;
use gtk::{prelude::*, *}; use gtk::{prelude::*, *};
pub fn check_characteristics( pub fn check_characteristics(
@ -24,7 +24,7 @@ pub fn check_characteristics(
println!("{:?}", int); println!("{:?}", int);
} }
Err(err) => { Err(err) => {
if output.len() == 0 { if output.is_empty() {
output.push_str("Введите пожалуйста числа в полях"); output.push_str("Введите пожалуйста числа в полях");
println!("{:?}", err); println!("{:?}", err);
} }
@ -32,11 +32,7 @@ pub fn check_characteristics(
} }
} }
if output.len() != 0 { !output.is_empty()
false
} else {
true
}
} }
pub fn start_algorithm( pub fn start_algorithm(
@ -48,7 +44,7 @@ pub fn start_algorithm(
let mut all_inputs_data: Vec<f64> = Vec::new(); let mut all_inputs_data: Vec<f64> = Vec::new();
let mut output: String = String::new(); let mut output: String = String::new();
if let false = check_characteristics(raw_characteristics, &mut all_inputs_data, &mut output) { if !check_characteristics(raw_characteristics, &mut all_inputs_data, &mut output) {
error_log_label.set_text(output.as_str()); error_log_label.set_text(output.as_str());
} else { } else {
error_log_label.set_text(""); error_log_label.set_text("");