Skip to content

Commit

Permalink
review comments, new clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hansieodendaal committed Mar 31, 2022
1 parent 5d6c890 commit 5475a3a
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 133 deletions.
40 changes: 0 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions applications/tari_app_utilities/src/initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ pub fn init_configuration(
// Load and apply configuration file
let cfg = bootstrap.load_configuration()?;

// Initialise the logger (Comment out to enable tokio tracing)
// bootstrap.initialize_logging()?;
// Initialise the logger (Comment out to enable tokio tracing via tokio-console)
bootstrap.initialize_logging()?;

log::info!(target: LOG_TARGET, "{} ({})", application_type, consts::APP_VERSION);

Expand Down
10 changes: 4 additions & 6 deletions applications/tari_console_wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ tari_shutdown = { path = "../../infrastructure/shutdown" }
tari_key_manager = { path = "../../base_layer/key_manager" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.3.1" }

# Uncomment for tokio-console tracing
#
console-subscriber = "0.1.3"
tokio = { version = "1.14", features = ["signal", "tracing"] }
# Uncomment for tokio tracing via tokio-console (needs "tracing" featurs)
#console-subscriber = "0.1.3"
#tokio = { version = "1.14", features = ["signal", "tracing"] }
# Uncomment for normal use (non tokio-console tracing)
#
#tokio = { version = "1.11", features = ["signal"] }
tokio = { version = "1.14", features = ["signal"] }

sha2 = "0.9.5"
digest = "0.9.0"
Expand Down
4 changes: 2 additions & 2 deletions applications/tari_console_wallet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ pub mod wallet_modes;

/// Application entry point
fn main() {
// Uncomment to enable tokio tracing
console_subscriber::init();
// Uncomment to enable tokio tracing via tokio-console
// console_subscriber::init();

match main_inner() {
Ok(_) => process::exit(0),
Expand Down
8 changes: 7 additions & 1 deletion applications/tari_mining_node/src/stratum/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub enum Error {
#[error("Can't create TLS connector: {0}")]
Tls(#[from] native_tls::Error),
#[error("Can't establish TLS connection: {0}")]
Tcp(#[from] native_tls::HandshakeError<std::net::TcpStream>),
Tcp(#[from] Box<native_tls::HandshakeError<std::net::TcpStream>>),
#[error("No connected stream")]
NotConnected,
#[error("Can't parse int: {0}")]
Expand All @@ -68,3 +68,9 @@ impl<T> From<std::sync::mpsc::SendError<T>> for Error {
Error::General(format!("Failed to send to a channel: {:?}", error))
}
}

impl From<native_tls::HandshakeError<std::net::TcpStream>> for Error {
fn from(error: native_tls::HandshakeError<std::net::TcpStream>) -> Self {
Error::General(format!("TLS handshake error: {:?}", error))
}
}
4 changes: 2 additions & 2 deletions applications/tari_mining_node/src/stratum/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::stratum::error::Error;

pub(crate) enum Stream {
Stream(BufStream<TcpStream>),
TlsStream(BufStream<TlsStream<TcpStream>>),
TlsStream(Box<BufStream<TlsStream<TcpStream>>>),
}

impl Stream {
Expand All @@ -46,7 +46,7 @@ impl Stream {
let base_host = format!("{}.{}", split_url[split_url.len() - 2], split_url[split_url.len() - 1]);
let mut stream = connector.connect(&base_host, conn)?;
stream.get_mut().set_nonblocking(true)?;
Ok(Self::TlsStream(BufStream::new(stream)))
Ok(Self::TlsStream(Box::from(BufStream::new(stream))))
} else {
conn.set_nonblocking(true)?;
Ok(Self::Stream(BufStream::new(conn)))
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_validator_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use crate::{
const LOG_TARGET: &str = "tari::validator_node::app";

fn main() {
// Uncomment to enable tokio tracing
// Uncomment to enable tokio tracing via tokio-console
// console_subscriber::init();

if let Err(err) = main_inner() {
Expand Down
10 changes: 4 additions & 6 deletions base_layer/wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ tari_storage = { version = "^0.30", path = "../../infrastructure/storage" }
tari_common_sqlite = { path = "../../common_sqlite" }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.3.1" }

# Uncomment for tokio-console tracing
#
console-subscriber = "0.1.3"
tokio = { version = "1.14", features = ["sync", "macros", "tracing"] }
# Uncomment for tokio tracing via tokio-console (needs "tracing" featurs)
#console-subscriber = "0.1.3"
#tokio = { version = "1.14", features = ["sync", "macros", "tracing"] }
# Uncomment for normal use (non tokio-console tracing)
#
#tokio = { version = "1.11", features = ["sync", "macros"] }
tokio = { version = "1.14", features = ["sync", "macros"] }

aes-gcm = "^0.8"
async-trait = "0.1.50"
Expand Down
Loading

0 comments on commit 5475a3a

Please sign in to comment.