Skip to content

Commit

Permalink
Fix: Clippy compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
Zephira58 committed Sep 15, 2023
1 parent f9aa352 commit 6f25aa6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
14 changes: 6 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use config::Config;
use regex::Regex;
use std::{
collections::HashMap,
fs::{self, File},
io::{prelude, BufReader, Read, Write},
fs::{self},
io::Write,
net::{IpAddr, TcpStream},
path::Path,
time::Duration,
Expand Down Expand Up @@ -43,7 +43,7 @@ pub fn config_manager() -> HashMap<String, String> {
.open(dir.to_str().unwrap().to_owned() + "config.toml")
.expect("create failed");

config_file.write_all(b"#Enter your MySQL information below for caching\nip = ''\nport = '3306'\nusername = ''\npassword = ''"); //pre-inputs values if none are already present
let _ = config_file.write_all(b"#Enter your MySQL information below for caching\nip = ''\nport = '3306'\nusername = ''\npassword = ''"); //pre-inputs values if none are already present
}
Ok(_) => {

Expand All @@ -56,16 +56,14 @@ pub fn config_manager() -> HashMap<String, String> {
.unwrap();

//Sets the variable "hi" to a hashmaped version of the config.toml file.
let config = settings

settings
.try_deserialize::<HashMap<String, String>>()
.unwrap();
return config;
.unwrap()

//Reads the hashmap with the key of "test" to get the value
//match hi.get("test") {
// Some(hi) => println!("{}", hi),
// _ => println!("error"),
//}
}

fn make_config_file() {}
16 changes: 3 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use config::Config;

use eframe::egui::{self, Color32};
use egui_notify::{Anchor, Toast, Toasts};
use std::{
collections::HashMap, fs::File, io::prelude::*, net::IpAddr, str::FromStr, thread,
net::IpAddr, str::FromStr, thread,
time::Duration,
};
use vault_gui::*;
Expand Down Expand Up @@ -41,8 +41,6 @@ struct MyApp {
ip: String,
port: i32,

first_time_setup: bool,

login_bool: bool,
username: String,
password: String,
Expand All @@ -67,8 +65,6 @@ impl Default for MyApp {
ip: "127.0.0.1".to_owned(),
port: 3306,

first_time_setup: true,

login_bool: false,
username: "".to_owned(),
password: "".to_owned(),
Expand All @@ -91,7 +87,7 @@ impl eframe::App for MyApp {
};

if !self.config_check {
let config = config_manager();
let _config = config_manager();
self.config_check = true;

//TODO: Add logic that'll check for if the config is empty, if it is then skip past, if not then autofill the application variables
Expand Down Expand Up @@ -186,12 +182,6 @@ impl eframe::App for MyApp {
});
}
},
_ => {
println!("If you see this, something went wrong. Please make an issue on github");
cb(self.toasts.error("If you see this, something went wrong. Please make an issue on github"));
ui.colored_label(Color32::from_rgb(150, 0, 0), "Warning: If you see this, something went wrong. Please make an issue on github");

}
}

if !self.login_bool && self.db_ip_valid {
Expand Down

0 comments on commit 6f25aa6

Please sign in to comment.