瀏覽代碼

Fix rust 1.86.0 clippies

Signed-off-by: Sean Young <sean@mess.org>
Sean Young 3 月之前
父節點
當前提交
f2c81c232d

+ 1 - 1
src/codegen/subexpression_elimination/anticipated_expressions.rs

@@ -42,7 +42,7 @@ impl<'a> AnticipatedExpressions<'a> {
         dag: &Vec<Vec<usize>>,
         dag: &Vec<Vec<usize>>,
         reverse_dag: Vec<Vec<usize>>,
         reverse_dag: Vec<Vec<usize>>,
         traversing_order: Vec<(usize, bool)>,
         traversing_order: Vec<(usize, bool)>,
-    ) -> AnticipatedExpressions<'_> {
+    ) -> AnticipatedExpressions<'a> {
         let mut depth: Vec<u16> = vec![u16::MAX; dag.len()];
         let mut depth: Vec<u16> = vec![u16::MAX; dag.len()];
         AnticipatedExpressions::blocks_depth(dag, 0, 0, &mut depth);
         AnticipatedExpressions::blocks_depth(dag, 0, 0, &mut depth);
         AnticipatedExpressions {
         AnticipatedExpressions {

+ 1 - 1
tests/lir_tests/helpers.rs

@@ -104,7 +104,7 @@ pub(crate) fn identifier(id: usize) -> Operand {
     }
     }
 }
 }
 
 
-pub fn new_printer(v: &Vartable) -> Printer {
+pub fn new_printer(v: &Vartable) -> Printer<'_> {
     Printer::new(v)
     Printer::new(v)
 }
 }
 
 

+ 0 - 6
tests/polkadot_tests/calls.rs

@@ -9,9 +9,6 @@ use solang::{
     Target,
     Target,
 };
 };
 
 
-#[derive(Debug, PartialEq, Eq, Encode, Decode)]
-struct RevertReturn(u32, String);
-
 #[test]
 #[test]
 fn revert() {
 fn revert() {
     let mut runtime = build_solidity(
     let mut runtime = build_solidity(
@@ -283,9 +280,6 @@ fn try_catch_external_calls() {
     runtime.constructor(0, Vec::new());
     runtime.constructor(0, Vec::new());
     runtime.function("test", Vec::new());
     runtime.function("test", Vec::new());
 
 
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct Ret(u32);
-
     let mut runtime = build_solidity(
     let mut runtime = build_solidity(
         r#"
         r#"
         contract dominator {
         contract dominator {

+ 0 - 3
tests/polkadot_tests/contracts.rs

@@ -3,9 +3,6 @@
 use crate::build_solidity;
 use crate::build_solidity;
 use parity_scale_codec::{Decode, Encode};
 use parity_scale_codec::{Decode, Encode};
 
 
-#[derive(Debug, PartialEq, Eq, Encode, Decode)]
-struct RevertReturn(u32, String);
-
 #[test]
 #[test]
 fn external_call() {
 fn external_call() {
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]

+ 0 - 2
tests/polkadot_tests/expressions.rs

@@ -87,8 +87,6 @@ fn digits() {
 
 
 #[test]
 #[test]
 fn large_loops() {
 fn large_loops() {
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct Val32(u32);
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     struct Val64(u64);
     struct Val64(u64);
 
 

+ 0 - 3
tests/polkadot_tests/first.rs

@@ -125,9 +125,6 @@ fn contract_constants() {
 
 
 #[test]
 #[test]
 fn large_contract_variables() {
 fn large_contract_variables() {
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct ValBool(u8);
-
     // parse
     // parse
     let mut runtime = build_solidity("
     let mut runtime = build_solidity("
         contract test {
         contract test {

+ 0 - 3
tests/polkadot_tests/functions.rs

@@ -332,9 +332,6 @@ fn test_example() {
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     struct Val32(i32);
     struct Val32(i32);
 
 
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct Val64(i64);
-
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     struct ValBool(bool);
     struct ValBool(bool);
 
 

+ 0 - 2
tests/polkadot_tests/inheritance.rs

@@ -469,8 +469,6 @@ fn base_contract_on_constructor() {
 
 
 #[test]
 #[test]
 fn call_base_function_via_basename() {
 fn call_base_function_via_basename() {
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct Val(i32);
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     struct Val64(u64);
     struct Val64(u64);
 
 

+ 0 - 3
tests/polkadot_tests/strings.rs

@@ -359,9 +359,6 @@ fn string_storage() {
 
 
 #[test]
 #[test]
 fn bytes_storage() {
 fn bytes_storage() {
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct Val(Vec<u8>);
-
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     #[derive(Debug, PartialEq, Eq, Encode, Decode)]
     struct Ret(u8);
     struct Ret(u8);
 
 

+ 0 - 36
tests/polkadot_tests/structs.rs

@@ -5,12 +5,6 @@ use serde_derive::Deserialize;
 
 
 use crate::build_solidity;
 use crate::build_solidity;
 
 
-#[derive(Debug, PartialEq, Eq, Encode, Decode)]
-struct Val32(u32);
-
-#[derive(Debug, PartialEq, Eq, Encode, Decode)]
-struct Val8(u8);
-
 #[test]
 #[test]
 fn struct_members() {
 fn struct_members() {
     let mut runtime = build_solidity(
     let mut runtime = build_solidity(
@@ -477,21 +471,6 @@ fn return_from_struct_storage() {
 
 
 #[test]
 #[test]
 fn struct_in_init_return() {
 fn struct_in_init_return() {
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct Card {
-        value: u8,
-        suit: u8,
-    }
-
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct Hand {
-        card1: Card,
-        card2: Card,
-        card3: Card,
-        card4: Card,
-        card5: Card,
-    }
-
     let mut runtime = build_solidity(
     let mut runtime = build_solidity(
         r#"
         r#"
         enum suit { club, diamonds, hearts, spades }
         enum suit { club, diamonds, hearts, spades }
@@ -529,21 +508,6 @@ fn struct_in_init_return() {
 
 
 #[test]
 #[test]
 fn struct_struct_in_init_and_return() {
 fn struct_struct_in_init_and_return() {
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct Card {
-        v: u8,
-        s: u8,
-    }
-
-    #[derive(Debug, PartialEq, Eq, Encode, Decode)]
-    struct Hand {
-        card1: Card,
-        card2: Card,
-        card3: Card,
-        card4: Card,
-        card5: Card,
-    }
-
     let mut runtime = build_solidity(
     let mut runtime = build_solidity(
         r#"
         r#"
         contract structs {
         contract structs {

+ 1 - 1
tests/solana.rs

@@ -1474,7 +1474,7 @@ impl VirtualMachine {
         res
         res
     }
     }
 
 
-    fn function(&mut self, name: &str) -> VmFunction {
+    fn function(&mut self, name: &str) -> VmFunction<'_, '_> {
         let idx = if let Some((idx, _)) = self.stack[0]
         let idx = if let Some((idx, _)) = self.stack[0]
             .idl
             .idl
             .as_ref()
             .as_ref()

+ 4 - 3
tests/solana_tests/mappings.rs

@@ -3,6 +3,7 @@
 use crate::{account_new, build_solidity, BorshToken};
 use crate::{account_new, build_solidity, BorshToken};
 use num_bigint::BigInt;
 use num_bigint::BigInt;
 use num_traits::{One, Zero};
 use num_traits::{One, Zero};
+use std::slice;
 
 
 #[test]
 #[test]
 fn simple_mapping() {
 fn simple_mapping() {
@@ -328,7 +329,7 @@ fn contract_mapping() {
 
 
     let returns = vm
     let returns = vm
         .function("get")
         .function("get")
-        .arguments(&[index.clone()])
+        .arguments(slice::from_ref(&index))
         .accounts(vec![("dataAccount", data_account)])
         .accounts(vec![("dataAccount", data_account)])
         .call()
         .call()
         .unwrap();
         .unwrap();
@@ -339,13 +340,13 @@ fn contract_mapping() {
     );
     );
 
 
     vm.function("rm")
     vm.function("rm")
-        .arguments(&[index.clone()])
+        .arguments(slice::from_ref(&index))
         .accounts(vec![("dataAccount", data_account)])
         .accounts(vec![("dataAccount", data_account)])
         .call();
         .call();
 
 
     let returns = vm
     let returns = vm
         .function("get")
         .function("get")
-        .arguments(&[index])
+        .arguments(slice::from_ref(&index))
         .accounts(vec![("dataAccount", data_account)])
         .accounts(vec![("dataAccount", data_account)])
         .call()
         .call()
         .unwrap();
         .unwrap();