Skip to content

Commit 5249bad

Browse files
committed
Lints
1 parent c83c0b6 commit 5249bad

File tree

105 files changed

+97
-305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+97
-305
lines changed

Cargo.lock

+5-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applications/minotari_app_grpc/src/authentication/basic_auth.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,9 @@ mod tests {
227227
}
228228

229229
mod validate {
230-
use std::{
231-
cmp::{max, min},
232-
thread::sleep,
233-
};
230+
use std::{cmp::max, thread::sleep};
234231

235-
use rand::RngCore;
236-
use tari_utilities::{hex::Hex, ByteArray};
232+
use tari_utilities::hex::Hex;
237233

238234
use super::*;
239235
use crate::authentication::salted_password::create_salted_hashed_password;

applications/minotari_merge_mining_proxy/src/block_template_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::{collections::HashMap, convert::TryFrom, sync::Arc};
2626

2727
#[cfg(not(test))]
2828
use chrono::Duration;
29-
use chrono::{self, DateTime, Utc};
29+
use chrono::{DateTime, Utc};
3030
use minotari_node_grpc_client::grpc;
3131
use tari_common_types::types::FixedHash;
3232
use tari_core::proof_of_work::monero_rx::FixedByteArray;

applications/minotari_miner/src/stratum/controller.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2222
//
2323
use std::{
24-
self,
2524
io::{BufRead, ErrorKind, Write},
2625
sync::mpsc,
2726
thread,

applications/minotari_miner/src/stratum/stratum_controller/controller.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
2121
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2222
//
23-
use std::{self, convert::TryFrom, sync::mpsc, thread, time::SystemTime};
23+
use std::{convert::TryFrom, sync::mpsc, thread, time::SystemTime};
2424

2525
use borsh::BorshDeserialize;
2626
use futures::stream::StreamExt;

applications/minotari_miner/src/stratum/stream.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2222
//
2323
use std::{
24-
self,
2524
io::{self, BufRead, Read, Write},
2625
net::TcpStream,
2726
};

base_layer/chat_ffi/src/contacts_liveness_data.rs

-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ pub unsafe extern "C" fn destroy_contacts_liveness_data(ptr: *mut ContactsLivene
147147

148148
#[cfg(test)]
149149
mod test {
150-
use std::convert::TryFrom;
151-
152150
use chrono::NaiveDateTime;
153151
use tari_contacts::contacts_service::service::{ContactMessageType, ContactOnlineStatus};
154152
use tari_utilities::epoch_time::EpochTime;

base_layer/chat_ffi/src/message.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,12 @@ pub unsafe extern "C" fn read_chat_message_id(message: *mut Message, error_out:
427427

428428
#[cfg(test)]
429429
mod test {
430-
use tari_contacts::contacts_service::types::{Direction, MessageBuilder};
430+
use tari_contacts::contacts_service::types::Direction;
431431
use tari_utilities::epoch_time::EpochTime;
432432

433433
use super::*;
434434
use crate::{
435435
byte_vector::{chat_byte_vector_destroy, chat_byte_vector_get_at, chat_byte_vector_get_length},
436-
message::read_chat_message_id,
437436
tari_address::destroy_tari_address,
438437
};
439438

base_layer/chat_ffi/src/message_metadata.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,12 @@ pub unsafe extern "C" fn destroy_chat_message_metadata(ptr: *mut MessageMetadata
169169

170170
#[cfg(test)]
171171
mod test {
172-
use std::convert::TryFrom;
173-
174-
use libc::c_uint;
175172
use tari_common_types::tari_address::TariAddress;
176173
use tari_contacts::contacts_service::types::MessageBuilder;
177174

178175
use super::*;
179176
use crate::{
180-
byte_vector::{
181-
chat_byte_vector_create,
182-
chat_byte_vector_destroy,
183-
chat_byte_vector_get_at,
184-
chat_byte_vector_get_length,
185-
},
177+
byte_vector::{chat_byte_vector_destroy, chat_byte_vector_get_at, chat_byte_vector_get_length},
186178
message::{chat_metadata_get_at, destroy_chat_message},
187179
};
188180

base_layer/common_types/src/encryption.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ pub fn encrypt_bytes_integral_nonce(
109109

110110
#[cfg(test)]
111111
mod test {
112-
use std::mem::size_of;
113-
114-
use chacha20poly1305::{Key, KeyInit, Tag, XChaCha20Poly1305, XNonce};
115-
use rand::{rngs::OsRng, RngCore};
116-
use tari_utilities::{ByteArray, Hidden};
112+
use chacha20poly1305::{Key, KeyInit};
117113

118114
use super::*;
119115

base_layer/contacts/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ diesel = { version = "2.0.3", features = ["sqlite", "serde_json", "chrono", "64-
2323
diesel_migrations = "2.0.0"
2424
futures = { version = "^0.3.1", features = ["compat", "std"] }
2525
log = "0.4.6"
26-
num-derive = "0.3.3"
26+
num-derive = "0.4.2"
2727
num-traits = "0.2.15"
2828
prost = "0.11.9"
2929
rand = "0.8"

base_layer/contacts/src/contacts_service/storage/sqlite_db.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -221,23 +221,16 @@ where TContactServiceDbConnection: PooledDbConnection<Error = SqliteStorageError
221221

222222
#[cfg(test)]
223223
mod test {
224-
use std::convert::{TryFrom, TryInto};
224+
use std::convert::TryInto;
225225

226226
use rand::rngs::OsRng;
227227
use tari_common::configuration::Network;
228228
use tari_common_sqlite::connection::{DbConnection, DbConnectionUrl};
229-
use tari_common_types::{
230-
tari_address::TariAddress,
231-
types::{PrivateKey, PublicKey},
232-
};
229+
use tari_common_types::types::{PrivateKey, PublicKey};
233230
use tari_crypto::keys::{PublicKey as PublicKeyTrait, SecretKey as SecretKeyTrait};
234231
use tari_test_utils::{paths::with_temp_dir, random::string};
235232

236233
use super::*;
237-
use crate::contacts_service::{
238-
storage::types::contacts::{ContactSql, UpdateContact},
239-
types::Contact,
240-
};
241234

242235
#[test]
243236
fn test_crud() {

base_layer/contacts/src/contacts_service/storage/types/contacts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use std::convert::TryFrom;
2424

2525
use chrono::NaiveDateTime;
26-
use diesel::{prelude::*, SqliteConnection};
26+
use diesel::prelude::*;
2727
use tari_common_sqlite::util::diesel_ext::ExpectedRowsExtension;
2828
use tari_common_types::tari_address::TariAddress;
2929
use tari_comms::peer_manager::NodeId;

base_layer/contacts/src/contacts_service/storage/types/messages.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
use std::convert::TryFrom;
2424

2525
use chrono::NaiveDateTime;
26-
use diesel::{prelude::*, SqliteConnection};
27-
use serde_json;
26+
use diesel::prelude::*;
2827
use tari_common_sqlite::util::diesel_ext::ExpectedRowsExtension;
2928
use tari_common_types::tari_address::TariAddress;
3029

base_layer/core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ log-mdc = "0.1.0"
7474
monero = { version = "0.20.0", features = ["serde-crate"], optional = true }
7575
newtype-ops = "0.1.4"
7676
num-traits = "0.2.15"
77-
num-derive = "0.3.3"
77+
num-derive = "0.4.2"
7878
num-format = "0.4.0"
7979
once_cell = "1.8.0"
8080
prost = "0.11.9"

base_layer/core/src/base_node/chain_metadata_service/service.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,11 @@ mod test {
230230
mock::{create_p2p_liveness_mock, LivenessMockState},
231231
LivenessRequest,
232232
Metadata,
233-
PingPongEvent,
234233
};
235234
use tari_service_framework::reply_channel;
236235
use tari_test_utils::unpack_enum;
237236
use tari_utilities::epoch_time::EpochTime;
238-
use tokio::{sync::broadcast, task};
237+
use tokio::task;
239238

240239
use super::*;
241240
use crate::base_node::comms_interface::{CommsInterfaceError, NodeCommsRequest, NodeCommsResponse};

base_layer/core/src/base_node/proto/request.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
2121
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2222

23-
use std::convert::{From, TryFrom, TryInto};
23+
use std::convert::{TryFrom, TryInto};
2424

2525
use tari_common_types::types::PrivateKey;
2626
use tari_utilities::ByteArray;

base_layer/core/src/base_node/proto/response.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
use std::{
2424
convert::{TryFrom, TryInto},
25-
iter::{FromIterator, Iterator},
25+
iter::FromIterator,
2626
sync::Arc,
2727
};
2828

base_layer/core/src/base_node/sync/header_sync/validator.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,8 @@ mod test {
240240

241241
use super::*;
242242
use crate::{
243-
blocks::{BlockHeader, BlockHeaderAccumulatedData},
244-
chain_storage::async_db::AsyncBlockchainDb,
245-
consensus::ConsensusManager,
246-
proof_of_work::{randomx_factory::RandomXFactory, PowAlgorithm},
243+
blocks::BlockHeader,
244+
proof_of_work::PowAlgorithm,
247245
test_helpers::blockchain::{create_new_blockchain, TempDatabase},
248246
};
249247

@@ -316,7 +314,6 @@ mod test {
316314

317315
mod validate {
318316
use super::*;
319-
use crate::{blocks::BlockHeaderValidationError, validation::ValidationError};
320317

321318
#[tokio::test]
322319
async fn it_passes_if_headers_are_valid() {

base_layer/core/src/base_node/sync/sync_peer.rs

-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ mod test {
140140
use tari_crypto::keys::{PublicKey, SecretKey};
141141

142142
use super::*;
143-
use crate::base_node::chain_metadata_service::PeerChainMetadata;
144143

145144
// Helper function to generate a peer with a given latency
146145
fn generate_peer(latency: Option<usize>) -> SyncPeer {

base_layer/core/src/blocks/genesis_block.rs

-2
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,6 @@ mod test {
401401
use std::convert::TryFrom;
402402

403403
use tari_common_types::{epoch::VnEpoch, types::Commitment};
404-
use tari_utilities::ByteArray;
405-
use Network;
406404

407405
use super::*;
408406
use crate::{

base_layer/core/src/chain_storage/blockchain_database.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2606,7 +2606,6 @@ mod test {
26062606
chain_strength_comparer::strongest_chain,
26072607
consensus_constants::PowAlgorithmConstants,
26082608
ConsensusConstantsBuilder,
2609-
ConsensusManager,
26102609
},
26112610
proof_of_work::Difficulty,
26122611
test_helpers::{
@@ -2910,7 +2909,6 @@ mod test {
29102909

29112910
mod handle_possible_reorg {
29122911
use super::*;
2913-
use crate::test_helpers::blockchain::update_block_and_smt;
29142912

29152913
#[ignore]
29162914
#[tokio::test]

base_layer/core/src/common/limited_reader.rs

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ impl<R: Read> Read for LimitedBytesReader<R> {
4444

4545
#[cfg(test)]
4646
mod test {
47-
use std::io::Read;
48-
4947
use super::*;
5048

5149
impl<R: Read> LimitedBytesReader<R> {

base_layer/core/src/common/one_sided.rs

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
2121
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2222

23-
use core::result::Result;
24-
2523
use blake2::Blake2b;
2624
use digest::consts::U64;
2725
use tari_common_types::types::{PrivateKey, PublicKey, WalletHasher};

base_layer/core/src/consensus/consensus_encoding/hashing.rs

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ impl<M: DomainSeparation, D: Digest + Default> Default for DomainSeparatedConsen
7171
mod tests {
7272
use blake2::Blake2b;
7373
use digest::consts::U32;
74-
use tari_common::configuration::Network;
7574
use tari_crypto::hash_domain;
7675
use tari_script::script;
7776

base_layer/core/src/covenants/fields.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,7 @@ mod test {
565565
use crate::transactions::key_manager::create_memory_db_key_manager;
566566

567567
mod construct_challenge_from {
568-
use blake2::Digest;
569568
use digest::Update;
570-
use tari_crypto::hashing::DomainSeparation;
571569

572570
use super::*;
573571
use crate::transactions::{tari_amount::MicroMinotari, transaction_components::RangeProofType};
@@ -618,11 +616,7 @@ mod test {
618616

619617
mod get_field_value_ref {
620618
use super::*;
621-
use crate::transactions::{
622-
key_manager::create_memory_db_key_manager,
623-
tari_amount::MicroMinotari,
624-
transaction_components::RangeProofType,
625-
};
619+
use crate::transactions::{tari_amount::MicroMinotari, transaction_components::RangeProofType};
626620

627621
#[tokio::test]
628622
async fn it_retrieves_the_value_as_ref() {

base_layer/core/src/proof_of_work/monero_rx/helpers.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,8 @@ mod test {
385385

386386
use borsh::BorshSerialize;
387387
use monero::{
388-
blockdata::transaction::{ExtraField, TxOutTarget},
388+
blockdata::transaction::TxOutTarget,
389389
consensus::deserialize,
390-
cryptonote::hash::Hashable,
391390
util::ringct::{RctSig, RctSigBase, RctType},
392391
Hash,
393392
PublicKey,
@@ -397,7 +396,6 @@ mod test {
397396
TxOut,
398397
};
399398
use tari_common::configuration::Network;
400-
use tari_common_types::types::FixedHash;
401399
use tari_test_utils::unpack_enum;
402400
use tari_utilities::{
403401
epoch_time::EpochTime,
@@ -406,7 +404,7 @@ mod test {
406404
};
407405

408406
use super::*;
409-
use crate::proof_of_work::{monero_rx::fixed_array::FixedByteArray, PowAlgorithm, ProofOfWork};
407+
use crate::proof_of_work::{PowAlgorithm, ProofOfWork};
410408

411409
// This tests checks the hash of monero-rs
412410
#[test]

base_layer/core/src/proof_of_work/proof_of_work.rs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use tari_utilities::hex::Hex;
2929

3030
use crate::proof_of_work::PowAlgorithm;
3131

32+
#[allow(dead_code)]
3233
pub trait AchievedDifficulty {}
3334

3435
/// The proof of work data structure that is included in the block header. There's some non-Rustlike redundancy here

0 commit comments

Comments
 (0)