Skip to content

Commit

Permalink
Fix clippy warnings on nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Mar 11, 2024
1 parent ba11ab2 commit da6e299
Show file tree
Hide file tree
Showing 54 changed files with 37 additions and 108 deletions.
5 changes: 1 addition & 4 deletions abci/src/application/kvstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,7 @@ impl KeyValueStoreDriver {
},
Command::Get { key, result_tx } => {
debug!("Getting value for \"{}\"", key);
channel_send(
&result_tx,
(self.height, self.store.get(&key).map(Clone::clone)),
)?;
channel_send(&result_tx, (self.height, self.store.get(&key).cloned()))?;
},
Command::Set {
key,
Expand Down
2 changes: 0 additions & 2 deletions config/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ impl Serialize for Address {

#[cfg(test)]
mod tests {
use tendermint::node;

use super::*;

const EXAMPLE_TCP_ADDR: &str =
Expand Down
1 change: 0 additions & 1 deletion config/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Re-export according to alloc::prelude::v1 because it is not yet stabilized
// https://doc.rust-lang.org/src/alloc/prelude/v1.rs.html
pub use alloc::{
borrow::ToOwned,
format,
string::{String, ToString},
vec,
Expand Down
2 changes: 1 addition & 1 deletion light-client-js/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use tendermint_light_client_verifier::{
types::{LightBlock, TrustThreshold},
Verifier,
};
use wasm_bindgen::{prelude::*, JsValue};
use wasm_bindgen::prelude::*;

// TODO: Use Web Crypto API for cryptographic routines.
// https://github.com/informalsystems/tendermint-rs/issues/1241
Expand Down
2 changes: 1 addition & 1 deletion light-client-verifier/src/operations/voting_power.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Provides an interface and default implementation for the `VotingPower` operation

use alloc::collections::BTreeSet as HashSet;
use core::{convert::TryFrom, fmt, marker::PhantomData};
use core::{fmt, marker::PhantomData};

use serde::{Deserialize, Serialize};
use tendermint::{
Expand Down
4 changes: 2 additions & 2 deletions light-client-verifier/src/predicates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ pub trait VerificationPredicates: Send + Sync {

#[cfg(all(test, feature = "rust-crypto"))]
mod tests {
use core::{convert::TryInto, time::Duration};
use core::time::Duration;

use tendermint::{block::CommitSig, validator::Set};
use tendermint_testgen::{
Expand Down Expand Up @@ -516,7 +516,7 @@ mod tests {
// 3. commit.signatures.len() != validator_set.validators().len()
// must return error
let mut bad_sigs = vec![signatures.clone().swap_remove(1)];
signed_header.commit.signatures = bad_sigs.clone();
signed_header.commit.signatures.clone_from(&bad_sigs);

result_err = vp.valid_commit(&signed_header, &val_set, &commit_validator);

Expand Down
2 changes: 0 additions & 2 deletions light-client/src/components/clock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Provides an interface and a default implementation of the `Clock` component

use std::convert::TryInto;

use time::OffsetDateTime;

use crate::verifier::types::Time;
Expand Down
2 changes: 0 additions & 2 deletions light-client/src/components/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ pub use self::prod::ProdIo;

#[cfg(feature = "rpc-client")]
mod prod {
use std::time::Duration;

use tendermint::{
account::Id as TMAccountId, block::signed_header::SignedHeader as TMSignedHeader,
validator::Set as TMValidatorSet,
Expand Down
2 changes: 0 additions & 2 deletions light-client/src/components/scheduler.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Provides an interface and default implementation of the `Scheduler` component

use core::convert::TryInto;

use contracts::*;

use crate::{store::LightStore, verifier::types::Height};
Expand Down
8 changes: 2 additions & 6 deletions light-client/tests/model_based.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#[cfg(feature = "mbt")]
mod mbt {
use std::{
convert::{TryFrom, TryInto},
str::FromStr,
time::Duration,
};
use std::{str::FromStr, time::Duration};

use rand::Rng;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
Expand Down Expand Up @@ -708,7 +704,7 @@ mod mbt {
output_env.copy_file_from_env_as(env, "test.json", &json_test);

let mut tc: SingleStepTestCase = env.parse_file("test.json").unwrap();
tc.description = json_test.clone();
tc.description.clone_from(&json_test);
output_env.write_file(json_test, &serde_json::to_string_pretty(&tc).unwrap());
single_step_test(tc, env, root_env, output_env);
}
Expand Down
2 changes: 0 additions & 2 deletions p2p/src/secret_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

use std::{
cmp,
convert::{TryFrom, TryInto},
io::{self, Read, Write},
marker::{Send, Sync},
slice,
sync::{
atomic::{AtomicBool, Ordering},
Expand Down
1 change: 0 additions & 1 deletion p2p/src/secret_connection/amino_types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Amino types used by Secret Connection

use core::convert::TryFrom;
use prost_derive::Message;
use tendermint_proto::v0_38 as proto;

Expand Down
2 changes: 0 additions & 2 deletions p2p/src/secret_connection/nonce.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Secret Connection nonces

use std::convert::TryInto;

/// Size of a `ChaCha20` (IETF) nonce
pub const SIZE: usize = 12;

Expand Down
2 changes: 0 additions & 2 deletions p2p/src/secret_connection/protocol.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Secret Connection Protocol: message framing and versioning

use std::convert::TryInto;

use curve25519_dalek_ng::montgomery::MontgomeryPoint as EphemeralPublic;
use prost::Message as _;
use tendermint_proto::v0_38 as proto;
Expand Down
2 changes: 0 additions & 2 deletions pbt-gen/src/time.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! Provides [proptest](https://github.com/AltSysrq/proptest) generators for
//! time-like objects.

use std::convert::TryInto;

use proptest::prelude::*;
use time::{
format_description::well_known::Rfc3339,
Expand Down
2 changes: 1 addition & 1 deletion proto/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This module defines the various errors that be raised during Protobuf conversions.

use core::{convert::TryFrom, fmt::Display, num::TryFromIntError};
use core::{fmt::Display, num::TryFromIntError};

use flex_error::{define_error, DisplayOnly};
use prost::{DecodeError, EncodeError};
Expand Down
2 changes: 1 addition & 1 deletion proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod error;
#[allow(warnings)]
mod tendermint;

use core::{convert::TryFrom, fmt::Display};
use core::fmt::Display;

use bytes::{Buf, BufMut};
pub use error::Error;
Expand Down
1 change: 0 additions & 1 deletion proto/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#[allow(unused_imports)]
pub use alloc::vec;
pub use alloc::{
borrow::ToOwned,
format,
string::{String, ToString},
vec::Vec,
Expand Down
1 change: 1 addition & 0 deletions proto/src/serializers/from_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ where
#[cfg(test)]
mod tests {
use crate::prelude::*;
use alloc::borrow::ToOwned;
use core::convert::Infallible;
use core::str::FromStr;
use serde::Deserialize;
Expand Down
1 change: 1 addition & 0 deletions proto/src/serializers/optional_from_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ where
#[cfg(test)]
mod tests {
use crate::prelude::*;
use alloc::borrow::ToOwned;
use core::convert::Infallible;
use core::str::FromStr;
use serde::Deserialize;
Expand Down
3 changes: 2 additions & 1 deletion proto/src/serializers/part_set_header_total.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
//! string-quoted integer value into an integer value without quotes in Tendermint Core v0.34.0.
//! This deserializer allows backwards-compatibility by deserializing both ways.
//! See also: <https://github.com/informalsystems/tendermint-rs/issues/679>
use core::{convert::TryFrom, fmt::Formatter};

use core::fmt::Formatter;

use serde::{
de::{Error, Visitor},
Expand Down
2 changes: 0 additions & 2 deletions proto/tests/unit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::convert::TryFrom;

use tendermint_proto::v0_38::types::{BlockId as RawBlockId, PartSetHeader as RawPartSetHeader};
use tendermint_proto::Protobuf;

Expand Down
5 changes: 1 addition & 4 deletions rpc/src/client/transport/http.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//! HTTP-based transport for Tendermint RPC Client.

use core::{
convert::{TryFrom, TryInto},
str::FromStr,
};
use core::str::FromStr;

use async_trait::async_trait;
use reqwest::{header, Proxy};
Expand Down
11 changes: 2 additions & 9 deletions rpc/src/client/transport/websocket.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
//! WebSocket-based clients for accessing Tendermint RPC functionality.

use alloc::{borrow::Cow, collections::BTreeMap as HashMap, fmt};
use core::{
convert::{TryFrom, TryInto},
ops::Add,
str::FromStr,
};
use core::{ops::Add, str::FromStr};

use async_trait::async_trait;
use async_tungstenite::{
Expand Down Expand Up @@ -1013,24 +1009,21 @@ impl WebSocketClientDriver {
#[cfg(test)]
mod test {
use alloc::collections::BTreeMap as HashMap;
use core::str::FromStr;
use std::{path::PathBuf, println};

use async_tungstenite::{
tokio::{accept_async, TokioAdapter},
tungstenite::client::IntoClientRequest,
};
use futures::StreamExt;
use http::{header::AUTHORIZATION, Uri};
use tendermint_config::net;
use tokio::{
fs,
net::{TcpListener, TcpStream},
task::JoinHandle,
};

use super::*;
use crate::{client::sync::unbounded, event, query::EventType, request, Id, Method};
use crate::{client::sync::unbounded, query::EventType, request, Method};

// Interface to a driver that manages all incoming WebSocket connections.
struct TestServer {
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl fmt::Display for Id {
mod tests {
use core::fmt::Debug;

use serde::{de::DeserializeOwned, Serialize};
use serde::de::DeserializeOwned;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion rpc/src/paging.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Pagination-related data structures for the Tendermint RPC.

use core::{convert::TryInto, str::FromStr};
use core::str::FromStr;

use serde::{Deserialize, Serialize};

Expand Down
2 changes: 1 addition & 1 deletion rpc/src/rpc_url.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! URL representation for RPC clients.

use core::{convert::TryFrom, fmt, str::FromStr};
use core::{fmt, str::FromStr};

use serde::{de::Error as SerdeError, Deserialize, Deserializer, Serialize, Serializer};

Expand Down
7 changes: 2 additions & 5 deletions tendermint/src/abci/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ impl<K: Into<String>, V: Into<String>> From<(K, V)> for EventAttribute {
mod v0_34 {
use super::{Event, EventAttribute};
use crate::prelude::*;
use core::convert::{TryFrom, TryInto};

use tendermint_proto::v0_34::abci as pb;
use tendermint_proto::Protobuf;
Expand Down Expand Up @@ -266,7 +265,6 @@ mod v0_34 {
mod v0_37 {
use super::{Event, EventAttribute};
use crate::prelude::*;
use core::convert::{TryFrom, TryInto};

use tendermint_proto::v0_37::abci as pb;
use tendermint_proto::Protobuf;
Expand Down Expand Up @@ -325,7 +323,6 @@ mod v0_37 {
mod v0_38 {
use super::{Event, EventAttribute};
use crate::prelude::*;
use core::convert::{TryFrom, TryInto};

use tendermint_proto::v0_38::abci as pb;
use tendermint_proto::Protobuf;
Expand Down Expand Up @@ -382,9 +379,9 @@ mod v0_38 {
}

#[cfg(test)]
#[allow(clippy::bool_assert_comparison)]
#[allow(clippy::redundant_clone)]
mod tests {
#![allow(clippy::bool_assert_comparison)]
#![allow(clippy::redundant_clone)]

use serde::Deserialize;

Expand Down
3 changes: 1 addition & 2 deletions tendermint/src/account.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
//! Tendermint accounts

use core::{
convert::{TryFrom, TryInto},
fmt::{self, Debug, Display},
str::FromStr,
};

use bytes::Bytes;
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use subtle::{self, ConstantTimeEq};
use subtle::ConstantTimeEq;
use subtle_encoding::hex;

use tendermint_proto::Protobuf;
Expand Down
1 change: 0 additions & 1 deletion tendermint/src/block/height.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use core::{
convert::{TryFrom, TryInto},
fmt::{self, Debug, Display},
str::FromStr,
};
Expand Down
1 change: 0 additions & 1 deletion tendermint/src/block/round.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use core::{
convert::{TryFrom, TryInto},
fmt::{self, Debug, Display},
str::FromStr,
};
Expand Down
1 change: 0 additions & 1 deletion tendermint/src/chain/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use core::{
cmp::Ordering,
convert::TryFrom,
fmt::{self, Debug, Display},
hash::{Hash, Hasher},
str::{self, FromStr},
Expand Down
5 changes: 1 addition & 4 deletions tendermint/src/evidence.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//! Evidence of malfeasance by validators (i.e. signing conflicting votes).

use core::{
convert::{TryFrom, TryInto},
slice,
};
use core::slice;

use serde::{Deserialize, Serialize};
use tendermint_proto::google::protobuf::Duration as RawDuration;
Expand Down
1 change: 0 additions & 1 deletion tendermint/src/hash.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Hash functions and their outputs

use core::{
convert::TryFrom,
fmt::{self, Debug, Display},
str::FromStr,
};
Expand Down
2 changes: 1 addition & 1 deletion tendermint/src/node/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::{
};

use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use subtle::{self, ConstantTimeEq};
use subtle::ConstantTimeEq;
use subtle_encoding::hex;

use crate::{error::Error, prelude::*};
Expand Down
2 changes: 0 additions & 2 deletions tendermint/src/proposal/msg_type.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::convert::TryFrom;

use serde::{de::Error as _, Deserialize, Deserializer, Serialize, Serializer};
use tendermint_proto::Protobuf;

Expand Down
Loading

0 comments on commit da6e299

Please sign in to comment.