Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
MedovTimur committed Jul 24, 2024
1 parent 37862ef commit 7e5ca92
Show file tree
Hide file tree
Showing 65 changed files with 1,403 additions and 1,541 deletions.
1,794 changes: 891 additions & 903 deletions contracts/Cargo.lock

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ members = [
"dao/state",
"dao-light",
"dao-light/state",
"ddns",
"ddns/state",
"decentralized-git",
"decentralized-git/master",
"decentralized-git/master/state",
Expand Down Expand Up @@ -161,7 +159,6 @@ concert-io.path = "concert/io"
crowdsale-io.path = "crowdsale/io"
dao-io.path = "dao/io"
dao-light-io.path = "dao-light/io"
ddns-io.path = "ddns/io"
decentralized-git-io.path = "decentralized-git/io"
decentralized-git-master-io.path = "decentralized-git/master/io"
decentralized-git-user-io.path = "decentralized-git/user/io"
Expand Down Expand Up @@ -228,13 +225,13 @@ gstd = "1.4.2"
gear-wasm-builder = "1.4.2"
gmeta = "1.4.2"
gclient = "1.4.2"
gtest = { git = "https://github.com/gear-tech/gear", tag = "v1.4.2" }
gtest = "1.4.2"
gear-core = "1.4.2"

# External

primitive-types = { version = "0.12", default-features = false }
sp-core = { version = "22", default-features = false, features = ["full_crypto", "sp-externalities"] }
sp-core = { version = "21.0.0", default-features = false, features = ["full_crypto", "sp-externalities"] }
sp-core-hashing = { version = "10", default-features = false }
tokio = "1"
blake2-rfc = "0.2"
Expand Down
36 changes: 18 additions & 18 deletions contracts/auto-changed-nft/tests/nft_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ZERO_ID: u64 = 0;
fn mint_success() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let transaction_id: u64 = 0;
let res = mint(&nft, transaction_id, USERS[0]);
let message = NFTEvent::Transfer(NFTTransfer {
Expand Down Expand Up @@ -50,7 +50,7 @@ fn mint_limit_exceed() {

assert!(!res.main_failed());

let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let transaction_id: u64 = 0;
let res = mint(&nft, transaction_id, USERS[0]);
assert!(!res.main_failed());
Expand Down Expand Up @@ -83,7 +83,7 @@ fn mint_authorized() {

assert!(!res.main_failed());

let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let transaction_id: u64 = 0;
let res = mint(&nft, transaction_id, USERS[0]);
assert!(!res.main_failed());
Expand Down Expand Up @@ -116,7 +116,7 @@ fn mint_not_authorized() {

assert!(!res.main_failed());

let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let transaction_id: u64 = 0;
let res = mint(&nft, transaction_id, USERS[0]);
assert!(!res.main_failed());
Expand Down Expand Up @@ -149,7 +149,7 @@ fn mint_added() {

assert!(!res.main_failed());

let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let transaction_id: u64 = 0;
let res = add_minter(&nft, transaction_id, USERS[1].into(), USERS[0]);
assert!(!res.main_failed());
Expand All @@ -164,7 +164,7 @@ fn mint_added() {
fn burn_success() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let mut transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());
transaction_id += 1;
Expand All @@ -182,7 +182,7 @@ fn burn_success() {
fn burn_failures() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let mut transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());
// must fail since the token doesn't exist
Expand All @@ -197,7 +197,7 @@ fn burn_failures() {
fn transfer_success() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let mut transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());
transaction_id += 1;
Expand All @@ -215,7 +215,7 @@ fn transfer_success() {
fn transfer_failures() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let mut transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());

Expand All @@ -234,7 +234,7 @@ fn transfer_failures() {
fn owner_success() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let mut transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());
transaction_id += 1;
Expand All @@ -253,7 +253,7 @@ fn owner_success() {
fn is_approved_to_success() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let mut transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());
transaction_id += 1;
Expand Down Expand Up @@ -284,7 +284,7 @@ fn is_approved_to_success() {
fn is_approved_to_failure() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let mut transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());
transaction_id += 1;
Expand All @@ -298,7 +298,7 @@ fn is_approved_to_failure() {
fn approve_success() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let mut transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());
transaction_id += 1;
Expand All @@ -318,7 +318,7 @@ fn approve_success() {
fn auto_change_success() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());

Expand Down Expand Up @@ -373,7 +373,7 @@ fn auto_change_success() {
fn approve_failures() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let mut transaction_id: u64 = 0;
assert!(!mint(&nft, transaction_id, USERS[0]).main_failed());
transaction_id += 1;
Expand Down Expand Up @@ -401,7 +401,7 @@ fn approve_failures() {
fn delegated_approve_success() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let pair = Sr25519Pair::from_seed(&hex!(
"9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60"
));
Expand Down Expand Up @@ -436,7 +436,7 @@ fn delegated_approve_success() {
fn delegated_approve_failures() {
let sys = System::new();
init_nft(&sys);
let nft = sys.get_program(1);
let nft = sys.get_program(1).unwrap();
let pair = Sr25519Pair::from_seed(&hex!(
"9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60"
));
Expand Down Expand Up @@ -475,7 +475,7 @@ fn delegated_approve_failures() {
assert!(delegated_approve(&nft, transaction_id, USERS[0], message, signature.0).main_failed());
// Must fail if user tries to approve token in wrong contract
init_nft(&sys);
let second_nft = sys.get_program(2);
let second_nft = sys.get_program(2).unwrap();
transaction_id += 1;
assert!(!add_minter(&second_nft, transaction_id, owner_id.into(), USERS[0]).main_failed());
transaction_id += 1;
Expand Down
8 changes: 7 additions & 1 deletion contracts/auto-changed-nft/tests/node_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,13 @@ async fn gclient_auto_changed() -> Result<()> {
name: String::from("MyToken"),
description: String::from("My token"),
};
let actor_id = ActorId::from_slice(&api.account_id().encode()).unwrap();
// let actor_id = ActorId::from_slice(&api.account_id().encode()).unwrap();
let actor_id = ActorId::new(
api.account_id()
.encode()
.try_into()
.expect("Unexpected invalid account id length."),
);
let init_nft = InitNFT {
collection,
royalties: None,
Expand Down
18 changes: 9 additions & 9 deletions contracts/battleship/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn failures_location_ships() {
let system = System::new();
system.init_logger();
init_battleship(&system);
let battleship = system.get_program(1);
let battleship = system.get_program(1).unwrap();
// outfield
let ships = Ships {
ship_1: vec![27],
Expand Down Expand Up @@ -140,7 +140,7 @@ fn failures_test() {
let system = System::new();
system.init_logger();
init_battleship(&system);
let battleship = system.get_program(1);
let battleship = system.get_program(1).unwrap();

// the game hasn't started
let res = battleship.send(
Expand Down Expand Up @@ -255,7 +255,7 @@ fn success_test() {
let system = System::new();
system.init_logger();
init_battleship(&system);
let battleship = system.get_program(1);
let battleship = system.get_program(1).unwrap();
let ships = Ships {
ship_1: vec![19],
ship_2: vec![0, 1, 2],
Expand Down Expand Up @@ -302,7 +302,7 @@ fn create_session_success() {
let system = System::new();
system.init_logger();
init_battleship(&system);
let battleship = system.get_program(1);
let battleship = system.get_program(1).unwrap();

let main_account = 3;
let proxy_account = 10;
Expand Down Expand Up @@ -340,7 +340,7 @@ fn create_session_failures() {
let system = System::new();
system.init_logger();
init_battleship(&system);
let battleship = system.get_program(1);
let battleship = system.get_program(1).unwrap();

// The session duration is too long: the number of blocks is greater than u32::MAX.
let number_of_blocks = u32::MAX as u64 + 1;
Expand Down Expand Up @@ -440,7 +440,7 @@ fn session_deletion_on_expiration() {
let system = System::new();
system.init_logger();
init_battleship(&system);
let battleship = system.get_program(1);
let battleship = system.get_program(1).unwrap();

let main_account = 3;
let proxy_account = 10;
Expand Down Expand Up @@ -483,7 +483,7 @@ fn disallow_game_without_required_actions() {
let proxy_account = 10;

init_battleship(&system);
let battleship = system.get_program(1);
let battleship = system.get_program(1).unwrap();

let duration = MINIMUM_SESSION_SURATION_MS;
let session = Session {
Expand Down Expand Up @@ -610,7 +610,7 @@ fn complete_session_game() {
let proxy_account = 10;

init_battleship(&system);
let battleship = system.get_program(1);
let battleship = system.get_program(1).unwrap();

let duration = MINIMUM_SESSION_SURATION_MS;
let session = Session {
Expand Down Expand Up @@ -701,7 +701,7 @@ fn premature_session_deletion_by_user() {
let proxy_account = 10;

init_battleship(&system);
let battleship = system.get_program(1);
let battleship = system.get_program(1).unwrap();

let duration = MINIMUM_SESSION_SURATION_MS;
let session = Session {
Expand Down
4 changes: 2 additions & 2 deletions contracts/crowdsale/tests/balance_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn balance_after_two_purchases() {
let sys = System::new();
init(&sys);

let ico = sys.get_program(2);
let ico = sys.get_program(2).unwrap();

start_sale(&ico, (TIME_INCREASE_STEP + 1) as _, 0);

Expand Down Expand Up @@ -37,7 +37,7 @@ fn owner_balance() {
let sys = System::new();
init(&sys);

let ico = sys.get_program(2);
let ico = sys.get_program(2).unwrap();

start_sale(&ico, 1, 0);

Expand Down
Loading

0 comments on commit 7e5ca92

Please sign in to comment.