diff --git a/lib/.rustfmt.toml b/lib/.rustfmt.toml index bf96e7743de..65106950efb 100644 --- a/lib/.rustfmt.toml +++ b/lib/.rustfmt.toml @@ -1 +1,2 @@ +unstable_features = true group_imports = "StdExternalCrate" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 6fde0b3b63a..f2bcaee9200 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -9,6 +9,8 @@ default-members = [ "ain-*", ] +resolver = "2" + [profile.release] lto = true diff --git a/lib/Makefile.am b/lib/Makefile.am index 085b4f437ce..b340a32d711 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -74,9 +74,12 @@ test: clippy: $(CARGO) clippy $(CARGO_MANIFEST_ARG) $(CARGO_EXTRA_ARGS) -- -Dwarnings +# We ignore unstable warnings for fmt to enable the use of backward +# compatible nightly features. Stricly backward compatible only, or will +# cause conflicts across toolchains .PHONY: fmt-check fmt-check: - $(CARGO) fmt $(CARGO_MANIFEST_ARG) --all --check + $(CARGO) fmt $(CARGO_MANIFEST_ARG) --all --check 2> >(grep -v -E 'group_imports|unstable_features') .PHONY: fmt fmt: diff --git a/lib/ain-evm/src/log.rs b/lib/ain-evm/src/log.rs index d00680b268b..de9610b05f9 100644 --- a/lib/ain-evm/src/log.rs +++ b/lib/ain-evm/src/log.rs @@ -41,7 +41,7 @@ impl LogService { }; for log in logs { - let map = logs_map.entry(log.address).or_insert(Vec::new()); + let map = logs_map.entry(log.address).or_default(); map.push(LogIndex { block_hash: receipt.block_hash, diff --git a/lib/ain-evm/src/storage/code.rs b/lib/ain-evm/src/storage/code.rs index 4651a8d8eda..db144ee669d 100644 --- a/lib/ain-evm/src/storage/code.rs +++ b/lib/ain-evm/src/storage/code.rs @@ -26,7 +26,7 @@ impl CodeHistory { self.code_map.insert(code_hash, code); self.history .entry(block_number) - .or_insert_with(Vec::new) + .or_default() .push(code_hash); } diff --git a/lib/ain-evm/src/storage/data_handler.rs b/lib/ain-evm/src/storage/data_handler.rs index 9ef35d882f7..33904f43207 100644 --- a/lib/ain-evm/src/storage/data_handler.rs +++ b/lib/ain-evm/src/storage/data_handler.rs @@ -205,9 +205,7 @@ impl LogStorage for BlockchainDataHandler { fn put_logs(&self, address: H160, logs: Vec, block_number: U256) { let mut address_logs_map = self.address_logs_map.write().unwrap(); - let address_map = address_logs_map - .entry(block_number) - .or_insert(HashMap::new()); + let address_map = address_logs_map.entry(block_number).or_default(); address_map.insert(address, logs); } } diff --git a/make.sh b/make.sh index b2c3285b29c..36af3abdd82 100755 --- a/make.sh +++ b/make.sh @@ -36,7 +36,7 @@ setup_vars() { PYTHON_VENV_DIR=${PYTHON_VENV_DIR:-"${BUILD_DIR}/pyenv"} CLANG_DEFAULT_VERSION=${CLANG_DEFAULT_VERSION:-"15"} - RUST_DEFAULT_VERSION=${RUST_DEFAULT_VERSION:-"1.70"} + RUST_DEFAULT_VERSION=${RUST_DEFAULT_VERSION:-"1.71"} MAKE_DEBUG=${MAKE_DEBUG:-"1"} MAKE_USE_CLANG=${MAKE_USE_CLANG:-"$(get_default_use_clang)"}