Rust 1.80+ fixes & accumulated warning cleanup (#3796)

* Update versioning on master to 5.4.0-alpha.0

* updates for 1.80 and other accumulated warnings

* further warning cleanups

* move dead code tag to function defn rather than module
This commit is contained in:
Yeastplume
2024-09-12 20:59:40 +01:00
committed by GitHub
parent 845c41de13
commit 9a23cfe483
17 changed files with 625 additions and 502 deletions
+3 -3
View File
@@ -63,7 +63,7 @@ impl HTTPNodeClient {
Err(e) => {
let report = format!("Error calling {}: {}", method, e);
error!("{}", report);
Err(Error::RPCError(report))
Err(Error::RPCError)
}
Ok(inner) => match inner.clone().into_result() {
Ok(r) => Ok(r),
@@ -71,7 +71,7 @@ impl HTTPNodeClient {
error!("{:?}", inner);
let report = format!("Unable to parse response for {}: {}", method, e);
error!("{}", report);
Err(Error::RPCError(report))
Err(Error::RPCError)
}
},
}
@@ -251,5 +251,5 @@ pub fn client_command(client_args: &ArgMatches<'_>, global_config: GlobalConfig)
#[derive(Debug)]
enum Error {
/// RPC Error
RPCError(String),
RPCError,
}
+7 -5
View File
@@ -16,7 +16,7 @@
use std::cmp::Ordering;
use chrono::prelude::{DateTime, NaiveDateTime, Utc};
use chrono::prelude::{DateTime, Utc};
use cursive::direction::Orientation;
use cursive::event::Key;
use cursive::traits::{Nameable, Resizable};
@@ -64,14 +64,15 @@ impl StratumWorkerColumn {
impl TableViewItem<StratumWorkerColumn> for WorkerStats {
fn to_column(&self, column: StratumWorkerColumn) -> String {
let naive_datetime = NaiveDateTime::from_timestamp_opt(
let naive_datetime = DateTime::<Utc>::from_timestamp(
self.last_seen
.duration_since(time::UNIX_EPOCH)
.unwrap()
.as_secs() as i64,
0,
)
.unwrap_or_default();
.unwrap_or_default()
.naive_utc();
let datetime: DateTime<Utc> = DateTime::from_naive_utc_and_offset(naive_datetime, Utc);
match column {
@@ -127,8 +128,9 @@ impl DiffColumn {
impl TableViewItem<DiffColumn> for DiffBlock {
fn to_column(&self, column: DiffColumn) -> String {
let naive_datetime =
NaiveDateTime::from_timestamp_opt(self.time as i64, 0).unwrap_or_default();
let naive_datetime = DateTime::<Utc>::from_timestamp(self.time as i64, 0)
.unwrap_or_default()
.naive_utc();
let datetime: DateTime<Utc> = DateTime::from_naive_utc_and_offset(naive_datetime, Utc);
match column {
+1 -4
View File
@@ -38,13 +38,10 @@ fn main() {
}
// build and versioning information
let mut opts = built::Options::default();
opts.set_dependencies(true);
let out_dir_path = format!("{}{}", env::var("OUT_DIR").unwrap(), "/built.rs");
// don't fail the build if something's missing, may just be cargo release
let _ = built::write_built_file_with_opts(
&opts,
Path::new(env!("CARGO_MANIFEST_DIR")),
Some(Path::new(env!("CARGO_MANIFEST_DIR"))),
Path::new(&out_dir_path),
);
}