From f21d587f1d257fa32164315fc36a4d75a1bb2859 Mon Sep 17 00:00:00 2001 From: abose Date: Mon, 29 Jul 2024 13:19:58 +0530 Subject: [PATCH] refactor: remove unused vars and compiler warnings --- src-tauri/src/bugsnag.rs | 20 +------------------- src-tauri/src/main.rs | 4 +++- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src-tauri/src/bugsnag.rs b/src-tauri/src/bugsnag.rs index 59310ddc..6ea0e875 100644 --- a/src-tauri/src/bugsnag.rs +++ b/src-tauri/src/bugsnag.rs @@ -9,13 +9,11 @@ use reqwest::header::{HeaderMap, CONTENT_TYPE}; use tokio::runtime::Runtime; extern crate chrono; use chrono::prelude::*; -use std::fs::File; -use std::io::{self, BufRead, BufReader}; use std::env; #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -struct JsonFrame { +pub struct JsonFrame { file: String, line_number: u32, column_number: u32, @@ -200,22 +198,6 @@ fn get_current_time() -> String { now.to_rfc3339_opts(SecondsFormat::Millis, true) } -fn get_linux_flavor() -> io::Result { - let os_release_file = File::open("/etc/os-release")?; - let reader = BufReader::new(os_release_file); - - // Parse the os-release file to find the PRETTY_NAME - for line in reader.lines() { - let line = line?; - if line.starts_with("PRETTY_NAME") { - // Typically the line looks like `PRETTY_NAME="Ubuntu 20.04 LTS"` - return Ok(line.split('=').nth(1).unwrap_or("\"Unknown\"").trim_matches('"').to_string()); - } - } - - Ok("Unknown Linux Flavor".to_string()) -} - fn get_sysinfo() -> (String, String, String, String) { let info = os_info::get(); let os_type = info.os_type().to_string(); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index da2b65d7..1d1a91a9 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -285,7 +285,7 @@ fn main() { panic_message ); - let mut should_log_to_bugsnag = false; + let should_log_to_bugsnag; #[cfg(target_os = "linux")] { let choice = dialog::Question::new(&error_message) @@ -294,6 +294,8 @@ fn main() { .expect("Could not display dialog box"); if choice == dialog::Choice::Yes { should_log_to_bugsnag = true; + } else { + should_log_to_bugsnag = false; } }