Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: apply nightly clippy lints #2002

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions sn_cli/src/files/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,27 @@ impl UploadedFile {
self.filename
);
}
let serialized = rmp_serde::to_vec(&(&self.filename, &self.data_map)).map_err(|err| {
error!("Failed to serialize UploadedFile");
err
})?;
let serialized =
rmp_serde::to_vec(&(&self.filename, &self.data_map)).inspect_err(|_err| {
error!("Failed to serialize UploadedFile");
})?;

std::fs::write(&uploaded_file_path, serialized).map_err(|err| {
std::fs::write(&uploaded_file_path, serialized).inspect_err(|_err| {
error!(
"Could not write UploadedFile of {:?} to {uploaded_file_path:?}",
self.filename
);
err
})?;

Ok(())
}

pub fn read(path: &Path) -> Result<Self> {
let bytes = std::fs::read(path).map_err(|err| {
let bytes = std::fs::read(path).inspect_err(|_err| {
error!("Error while reading the UploadedFile from {path:?}");
err
})?;
let metadata = rmp_serde::from_slice(&bytes).map_err(|err| {
let metadata = rmp_serde::from_slice(&bytes).inspect_err(|_err| {
error!("Error while deserializing UploadedFile for {path:?}");
err
})?;
Ok(metadata)
}
Expand Down
10 changes: 5 additions & 5 deletions sn_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
//! Here are the key functionalities provided by this crate:
//!
//! 1. **Network Communication**: It handles communication with the Safe Network, enabling clients to
//! send and receive messages from the decentralized nodes that make up the network.
//! send and receive messages from the decentralized nodes that make up the network.
//!
//! 2. **Data Storage and Retrieval**: to store and retrieve data on the Safe Network.
//! This includes both private and public data, ensuring privacy and security.
//! This includes both private and public data, ensuring privacy and security.
//!
//! 3. **Authentication and Access Control**: It provides mechanisms for authenticating users and
//! managing access to data, ensuring that only authorized users can access sensitive information.
//! managing access to data, ensuring that only authorized users can access sensitive information.
//!
//! 4. **File Management**: The crate supports operations related to file management, such as uploading,
//! downloading, and managing files and directories on the Safe Network.
//! downloading, and managing files and directories on the Safe Network.
//!
//! 5. **Token Management**: It includes functionality for managing Safe Network tokens, which can be
//! used for various purposes within the network, including paying for storage and services.
//! used for various purposes within the network, including paying for storage and services.
//!
//! ## Quick links
//! - [Crates.io](https://crates.io/crates/sn_client)
Expand Down
3 changes: 1 addition & 2 deletions sn_faucet/src/faucet_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ use tokio::{fs, io::AsyncWriteExt};
pub async fn run_faucet_server(client: &Client) -> Result<()> {
let root_dir = get_faucet_data_dir();
let wallet = load_account_wallet_or_create_with_mnemonic(&root_dir, None)?;
claim_genesis(client, wallet).await.map_err(|err| {
claim_genesis(client, wallet).await.inspect_err(|_err| {
println!("Faucet Server couldn't start as we failed to claim Genesis");
eprintln!("Faucet Server couldn't start as we failed to claim Genesis");
error!("Faucet Server couldn't start as we failed to claim Genesis");
err
})?;

#[cfg(feature = "initial-data")]
Expand Down
2 changes: 1 addition & 1 deletion sn_transfers/src/wallet/wallet_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub(super) fn remove_unconfirmed_spend_requests(
let spend_hex_name = spend.address().to_hex();
let spend_file_path = spends_dir.join(&spend_hex_name);
debug!("Writing spend to: {spend_file_path:?}");
fs::write(spend_file_path, &spend.to_bytes())?;
fs::write(spend_file_path, spend.to_bytes())?;
}

let unconfirmed_spend_requests_path = wallet_dir.join(UNCONFIRMED_TX_NAME);
Expand Down
Loading