mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 22:59:27 +00:00
feat: cargo clippy
This commit is contained in:
parent
5ef88ad895
commit
d811f60b00
10 changed files with 26 additions and 34 deletions
|
@ -411,7 +411,7 @@ For more information, see link below:
|
||||||
//---------------------------------------------------------------------------------------------------- Visuals
|
//---------------------------------------------------------------------------------------------------- Visuals
|
||||||
use egui::epaint::{Rounding, Shadow, Stroke};
|
use egui::epaint::{Rounding, Shadow, Stroke};
|
||||||
|
|
||||||
use egui::{style::Spacing, Color32, Visuals};
|
use egui::{Color32, Visuals};
|
||||||
|
|
||||||
use egui::style::{Selection, WidgetVisuals, Widgets};
|
use egui::style::{Selection, WidgetVisuals, Widgets};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
|
@ -817,13 +817,13 @@ impl GupaxP2poolApi {
|
||||||
"GupaxP2poolApi | Deleting old folder at [{}]...",
|
"GupaxP2poolApi | Deleting old folder at [{}]...",
|
||||||
path.display()
|
path.display()
|
||||||
);
|
);
|
||||||
std::fs::remove_dir_all(&path)?;
|
std::fs::remove_dir_all(path)?;
|
||||||
info!(
|
info!(
|
||||||
"GupaxP2poolApi | Creating new default folder at [{}]...",
|
"GupaxP2poolApi | Creating new default folder at [{}]...",
|
||||||
path.display()
|
path.display()
|
||||||
);
|
);
|
||||||
create_gupax_p2pool_dir(&path)?;
|
create_gupax_p2pool_dir(path)?;
|
||||||
Self::create_all_files(&path)?;
|
Self::create_all_files(path)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
use crate::State;
|
use crate::State;
|
||||||
use crate::{constants::*, macros::*, update::*, ErrorState, Restart, Tab};
|
use crate::{constants::*, macros::*, update::*, ErrorState, Restart, Tab};
|
||||||
use egui::{
|
use egui::{
|
||||||
Button, Checkbox, Label, ProgressBar, RichText, SelectableLabel, Slider, Spinner, TextEdit,
|
Button, Checkbox, Label, ProgressBar, RichText, SelectableLabel, Slider, Spinner, TextEdit, Vec2,
|
||||||
TextStyle, TextStyle::Monospace, Vec2,
|
|
||||||
};
|
};
|
||||||
use log::*;
|
use log::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -81,7 +80,7 @@ impl crate::disk::Gupax {
|
||||||
restart: &Arc<Mutex<Restart>>,
|
restart: &Arc<Mutex<Restart>>,
|
||||||
width: f32,
|
width: f32,
|
||||||
height: f32,
|
height: f32,
|
||||||
frame: &mut eframe::Frame,
|
_frame: &mut eframe::Frame,
|
||||||
_ctx: &egui::Context,
|
_ctx: &egui::Context,
|
||||||
ui: &mut egui::Ui,
|
ui: &mut egui::Ui,
|
||||||
) {
|
) {
|
||||||
|
@ -512,7 +511,7 @@ impl crate::disk::Gupax {
|
||||||
lock!(file_window).thread = true;
|
lock!(file_window).thread = true;
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
match rfd::FileDialog::new()
|
match rfd::FileDialog::new()
|
||||||
.set_title(&format!("Select {} Binary for Gupax", name))
|
.set_title(format!("Select {} Binary for Gupax", name))
|
||||||
.pick_file()
|
.pick_file()
|
||||||
{
|
{
|
||||||
Some(path) => {
|
Some(path) => {
|
||||||
|
|
|
@ -1260,7 +1260,7 @@ impl Helper {
|
||||||
// 1a. Create PTY
|
// 1a. Create PTY
|
||||||
debug!("XMRig | Creating PTY...");
|
debug!("XMRig | Creating PTY...");
|
||||||
let pty = portable_pty::native_pty_system();
|
let pty = portable_pty::native_pty_system();
|
||||||
let mut pair = pty
|
let pair = pty
|
||||||
.openpty(portable_pty::PtySize {
|
.openpty(portable_pty::PtySize {
|
||||||
rows: 100,
|
rows: 100,
|
||||||
cols: 1000,
|
cols: 1000,
|
||||||
|
@ -2393,7 +2393,7 @@ impl PubXmrigApi {
|
||||||
// Formats raw private data into ready-to-print human readable version.
|
// Formats raw private data into ready-to-print human readable version.
|
||||||
fn update_from_priv(public: &Arc<Mutex<Self>>, private: PrivXmrigApi) {
|
fn update_from_priv(public: &Arc<Mutex<Self>>, private: PrivXmrigApi) {
|
||||||
let mut public = lock!(public);
|
let mut public = lock!(public);
|
||||||
let hashrate_raw = match private.hashrate.total.get(0) {
|
let hashrate_raw = match private.hashrate.total.first() {
|
||||||
Some(Some(h)) => *h,
|
Some(Some(h)) => *h,
|
||||||
_ => 0.0,
|
_ => 0.0,
|
||||||
};
|
};
|
||||||
|
|
24
src/main.rs
24
src/main.rs
|
@ -29,14 +29,14 @@ compile_error!("gupax is only built for windows/macos/linux");
|
||||||
// egui/eframe
|
// egui/eframe
|
||||||
use eframe::{egui, NativeOptions};
|
use eframe::{egui, NativeOptions};
|
||||||
use egui::{
|
use egui::{
|
||||||
Align, Button, CentralPanel, Color32, FontFamily::Proportional, FontId, Hyperlink, Key, Label,
|
Align, Button, CentralPanel, Color32, FontId, Hyperlink, Key, Label,
|
||||||
Layout, Modifiers, RichText, SelectableLabel, Spinner, Stroke, TextEdit, TextStyle,
|
Layout, Modifiers, RichText, SelectableLabel, Spinner, TextEdit, TextStyle,
|
||||||
TextStyle::*, TopBottomPanel, Vec2,
|
TextStyle::*, TopBottomPanel, Vec2,
|
||||||
};
|
};
|
||||||
use egui_extras::RetainedImage;
|
use egui_extras::RetainedImage;
|
||||||
// Logging
|
// Logging
|
||||||
use env_logger::{
|
use env_logger::{
|
||||||
fmt::style::{AnsiColor, Style},
|
fmt::style::{Style},
|
||||||
Builder, WriteStyle,
|
Builder, WriteStyle,
|
||||||
};
|
};
|
||||||
use log::*;
|
use log::*;
|
||||||
|
@ -237,7 +237,7 @@ impl App {
|
||||||
let cpu = sysinfo.cpus()[0].brand();
|
let cpu = sysinfo.cpus()[0].brand();
|
||||||
let mut json: Vec<Benchmark> =
|
let mut json: Vec<Benchmark> =
|
||||||
serde_json::from_slice(include_bytes!("cpu.json")).unwrap();
|
serde_json::from_slice(include_bytes!("cpu.json")).unwrap();
|
||||||
json.sort_by(|a, b| cmp_f64(strsim::jaro(&b.cpu, &cpu), strsim::jaro(&a.cpu, &cpu)));
|
json.sort_by(|a, b| cmp_f64(strsim::jaro(&b.cpu, cpu), strsim::jaro(&a.cpu, cpu)));
|
||||||
json
|
json
|
||||||
};
|
};
|
||||||
info!("App Init | Assuming user's CPU is: {}", benchmarks[0].cpu);
|
info!("App Init | Assuming user's CPU is: {}", benchmarks[0].cpu);
|
||||||
|
@ -494,7 +494,7 @@ impl App {
|
||||||
og.p2pool.selected_index,
|
og.p2pool.selected_index,
|
||||||
app.og_node_vec.len()
|
app.og_node_vec.len()
|
||||||
);
|
);
|
||||||
let (name, node) = match app.og_node_vec.get(0) {
|
let (name, node) = match app.og_node_vec.first() {
|
||||||
Some(zero) => zero.clone(),
|
Some(zero) => zero.clone(),
|
||||||
None => Node::new_tuple(),
|
None => Node::new_tuple(),
|
||||||
};
|
};
|
||||||
|
@ -517,7 +517,7 @@ impl App {
|
||||||
og.xmrig.selected_index,
|
og.xmrig.selected_index,
|
||||||
app.og_pool_vec.len()
|
app.og_pool_vec.len()
|
||||||
);
|
);
|
||||||
let (name, pool) = match app.og_pool_vec.get(0) {
|
let (name, pool) = match app.og_pool_vec.first() {
|
||||||
Some(zero) => zero.clone(),
|
Some(zero) => zero.clone(),
|
||||||
None => Pool::new_tuple(),
|
None => Pool::new_tuple(),
|
||||||
};
|
};
|
||||||
|
@ -627,7 +627,7 @@ impl App {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let (ip, rpc, zmq) = RemoteNode::get_ip_rpc_zmq(&pinged_node.ip);
|
let (ip, rpc, zmq) = RemoteNode::get_ip_rpc_zmq(pinged_node.ip);
|
||||||
|
|
||||||
let node = Node {
|
let node = Node {
|
||||||
ip: ip.into(),
|
ip: ip.into(),
|
||||||
|
@ -1868,17 +1868,11 @@ impl eframe::App for App {
|
||||||
// They don't need to be compared anyway.
|
// They don't need to be compared anyway.
|
||||||
debug!("App | Checking diff between [og] & [state]");
|
debug!("App | Checking diff between [og] & [state]");
|
||||||
let og = lock!(self.og);
|
let og = lock!(self.og);
|
||||||
if og.status != self.state.status
|
self.diff = og.status != self.state.status
|
||||||
|| og.gupax != self.state.gupax
|
|| og.gupax != self.state.gupax
|
||||||
|| og.p2pool != self.state.p2pool
|
|| og.p2pool != self.state.p2pool
|
||||||
|| og.xmrig != self.state.xmrig
|
|| og.xmrig != self.state.xmrig
|
||||||
|| self.og_node_vec != self.node_vec
|
|| self.og_node_vec != self.node_vec || self.og_pool_vec != self.pool_vec;
|
||||||
|| self.og_pool_vec != self.pool_vec
|
|
||||||
{
|
|
||||||
self.diff = true;
|
|
||||||
} else {
|
|
||||||
self.diff = false;
|
|
||||||
}
|
|
||||||
drop(og);
|
drop(og);
|
||||||
|
|
||||||
// Top: Tabs
|
// Top: Tabs
|
||||||
|
|
|
@ -20,7 +20,7 @@ use egui::Color32;
|
||||||
use hyper::{client::HttpConnector, Body, Client, Request};
|
use hyper::{client::HttpConnector, Body, Client, Request};
|
||||||
use log::*;
|
use log::*;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@ impl Ping {
|
||||||
let mut handles = Vec::with_capacity(REMOTE_NODE_LENGTH);
|
let mut handles = Vec::with_capacity(REMOTE_NODE_LENGTH);
|
||||||
let node_vec = arc_mut!(Vec::with_capacity(REMOTE_NODE_LENGTH));
|
let node_vec = arc_mut!(Vec::with_capacity(REMOTE_NODE_LENGTH));
|
||||||
|
|
||||||
for (ip, _, rpc, zmq) in REMOTE_NODES {
|
for (ip, _, rpc, _zmq) in REMOTE_NODES {
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
let ping = Arc::clone(&ping);
|
let ping = Arc::clone(&ping);
|
||||||
let node_vec = Arc::clone(&node_vec);
|
let node_vec = Arc::clone(&node_vec);
|
||||||
|
|
|
@ -22,7 +22,7 @@ use egui::{
|
||||||
Slider, Spinner, TextEdit, TextStyle::*,
|
Slider, Spinner, TextEdit, TextStyle::*,
|
||||||
};
|
};
|
||||||
use log::*;
|
use log::*;
|
||||||
use regex::Regex;
|
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
impl crate::disk::P2pool {
|
impl crate::disk::P2pool {
|
||||||
|
|
|
@ -21,9 +21,9 @@ use once_cell::sync::Lazy;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Lazy
|
//---------------------------------------------------------------------------------------------------- Lazy
|
||||||
pub static REGEXES: Lazy<Regexes> = Lazy::new(|| Regexes::new());
|
pub static REGEXES: Lazy<Regexes> = Lazy::new(Regexes::new);
|
||||||
pub static P2POOL_REGEX: Lazy<P2poolRegex> = Lazy::new(|| P2poolRegex::new());
|
pub static P2POOL_REGEX: Lazy<P2poolRegex> = Lazy::new(P2poolRegex::new);
|
||||||
pub static XMRIG_REGEX: Lazy<XmrigRegex> = Lazy::new(|| XmrigRegex::new());
|
pub static XMRIG_REGEX: Lazy<XmrigRegex> = Lazy::new(XmrigRegex::new);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- [Regexes] struct
|
//---------------------------------------------------------------------------------------------------- [Regexes] struct
|
||||||
// General purpose Regexes, mostly used in the GUI.
|
// General purpose Regexes, mostly used in the GUI.
|
||||||
|
|
|
@ -20,8 +20,7 @@ use crate::{
|
||||||
ImgXmrig, PayoutView, PubP2poolApi, PubXmrigApi, Submenu, Sys,
|
ImgXmrig, PayoutView, PubP2poolApi, PubXmrigApi, Submenu, Sys,
|
||||||
};
|
};
|
||||||
use egui::{
|
use egui::{
|
||||||
Hyperlink, Label, ProgressBar, RichText, SelectableLabel, Slider, Spinner, TextEdit, TextStyle,
|
Hyperlink, Label, ProgressBar, RichText, SelectableLabel, Slider, Spinner, TextEdit, TextStyle, TextStyle::Name,
|
||||||
TextStyle::Monospace, TextStyle::Name,
|
|
||||||
};
|
};
|
||||||
use log::*;
|
use log::*;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
|
@ -21,7 +21,7 @@ use egui::{
|
||||||
Button, Checkbox, ComboBox, Label, RichText, SelectableLabel, Slider, TextEdit, TextStyle::*,
|
Button, Checkbox, ComboBox, Label, RichText, SelectableLabel, Slider, TextEdit, TextStyle::*,
|
||||||
};
|
};
|
||||||
use log::*;
|
use log::*;
|
||||||
use regex::Regex;
|
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
impl crate::disk::Xmrig {
|
impl crate::disk::Xmrig {
|
||||||
|
|
Loading…
Reference in a new issue