diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a25cea01159..2f81d1c00d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -560,7 +560,7 @@ jobs: with: toolchain: ${{ env.RUST_VERSION }} - uses: Swatinem/rust-cache@v2 - - name: Run forc tests separately + - name: Run forc tests separately env: RUST_BACKTRACE: full run: cargo test --locked --release -p forc -- --nocapture diff --git a/forc-pkg/src/manifest/mod.rs b/forc-pkg/src/manifest/mod.rs index 28729aff757..adc4f6a3abd 100644 --- a/forc-pkg/src/manifest/mod.rs +++ b/forc-pkg/src/manifest/mod.rs @@ -771,7 +771,7 @@ impl std::ops::Deref for PackageManifestFile { /// This can be configured using environment variables: /// - use `FORC_IMPLICIT_STD_PATH` for the path for the std-lib; /// - use `FORC_IMPLICIT_STD_GIT`, `FORC_IMPLICIT_STD_GIT_TAG` and/or `FORC_IMPLICIT_STD_GIT_BRANCH` to configure -/// the git repo of the std-lib. +/// the git repo of the std-lib. fn implicit_std_dep() -> Dependency { if let Ok(path) = std::env::var("FORC_IMPLICIT_STD_PATH") { return Dependency::Detailed(DependencyDetails { diff --git a/forc-plugins/forc-client/tests/deploy.rs b/forc-plugins/forc-client/tests/deploy.rs index a86d8eef75f..722ec652d34 100644 --- a/forc-plugins/forc-client/tests/deploy.rs +++ b/forc-plugins/forc-client/tests/deploy.rs @@ -341,7 +341,7 @@ async fn test_simple_deploy() { node.kill().unwrap(); let expected = vec![DeployedContract { id: ContractId::from_str( - "50fe882cbef5f3da6da82509a66b7e5e0a64a40d70164861c01c908a332198ae", + "47fd96252869c61cc26e8274a7991c8d97bf522d4742036ce09699af59524cbb", ) .unwrap(), proxy: None, @@ -383,7 +383,7 @@ async fn test_deploy_submit_only() { node.kill().unwrap(); let expected = vec![DeployedContract { id: ContractId::from_str( - "50fe882cbef5f3da6da82509a66b7e5e0a64a40d70164861c01c908a332198ae", + "47fd96252869c61cc26e8274a7991c8d97bf522d4742036ce09699af59524cbb", ) .unwrap(), proxy: None, diff --git a/forc/src/cli/commands/build.rs b/forc/src/cli/commands/build.rs index ae88dfebfdc..f55225f4c60 100644 --- a/forc/src/cli/commands/build.rs +++ b/forc/src/cli/commands/build.rs @@ -17,13 +17,13 @@ forc_util::cli_examples! { /// - `script`, `predicate` and `contract` projects will produce their bytecode in binary format `.bin`. /// /// - `script` projects will also produce a file containing the hash of the bytecode binary -/// `-bin-hash` (using `fuel_cypto::Hasher`). +/// `-bin-hash` (using `fuel_cypto::Hasher`). /// /// - `predicate` projects will also produce a file containing the **root** hash of the bytecode binary -/// `-bin-root` (using `fuel_tx::Contract::root_from_code`). +/// `-bin-root` (using `fuel_tx::Contract::root_from_code`). /// /// - `contract` and `library` projects will also produce the public ABI in JSON format -/// `-abi.json`. +/// `-abi.json`. #[derive(Debug, Default, Parser)] #[clap(bin_name = "forc build", version, after_help = help())] pub struct Command { diff --git a/sway-core/src/asm_generation/fuel/analyses.rs b/sway-core/src/asm_generation/fuel/analyses.rs index cfd4cb931d6..9bdcac0d489 100644 --- a/sway-core/src/asm_generation/fuel/analyses.rs +++ b/sway-core/src/asm_generation/fuel/analyses.rs @@ -17,9 +17,9 @@ use crate::asm_lang::{ControlFlowOp, Label, Op, VirtualRegister}; /// Two tables are generated: `live_in` and `live_out`. Each row in the tables corresponds to an /// instruction in the program. /// * A virtual register is in the `live_out` table for a given instruction if it is live on any -/// of that node's out-edges +/// of that node's out-edges /// * A virtual register is in the `live_in` table for a given instruction if it is live on any -/// of that node's in-edges +/// of that node's in-edges /// /// /// Algorithm: diff --git a/sway-core/src/asm_generation/fuel/programs/abstract.rs b/sway-core/src/asm_generation/fuel/programs/abstract.rs index c30f72621e7..de9d3e93b13 100644 --- a/sway-core/src/asm_generation/fuel/programs/abstract.rs +++ b/sway-core/src/asm_generation/fuel/programs/abstract.rs @@ -158,14 +158,12 @@ impl AbstractProgram { /// Builds the asm preamble, which includes metadata and a jump past the metadata. /// Right now, it looks like this: /// - /// WORD OP - /// 1 MOV $scratch $pc - /// - JMPF $zero i2 - /// 2 DATA_START (0-32) (in bytes, offset from $is) - /// - DATA_START (32-64) - /// 3 LW $ds $scratch 1 - /// - ADD $ds $ds $scratch - /// 4 .program_start: + /// | WORD | OP | + /// |------|-------------------------------------------------------------------------| + /// | 1 | MOV $scratch $pc
JMPF $zero i2 | + /// | 2 | DATA_START (0-32) (in bytes, offset from $is)
DATA_START (32-64) | + /// | 3 | LW $ds $scratch 1
ADD $ds $ds $scratch | + /// | 4 | .program_start: | fn build_prologue(&mut self) -> AllocatedAbstractInstructionSet { let label = self.reg_seqr.get_label(); AllocatedAbstractInstructionSet { diff --git a/sway-core/src/asm_generation/fuel/register_allocator.rs b/sway-core/src/asm_generation/fuel/register_allocator.rs index 8e02d2d29fa..6a4c6b8ee3a 100644 --- a/sway-core/src/asm_generation/fuel/register_allocator.rs +++ b/sway-core/src/asm_generation/fuel/register_allocator.rs @@ -106,6 +106,7 @@ impl RegisterPool { } } +#[allow(clippy::doc_lazy_continuation)] /// Given a list of instructions `ops` and a `live_out` table computed using the method /// `liveness_analysis()`, create an interference graph (aka a "conflict" graph): /// * Nodes = virtual registers @@ -191,8 +192,8 @@ pub(crate) fn create_interference_graph( /// * When two registers are coalesced, a new node with a new virtual register (generated using the /// register sequencer) is created in the interference graph. /// * When a MOVE instruction is removed, the offset of each subsequent instruction has to be -/// updated, as well as the immediate values for some or all jump instructions (`ji`, `jnei`, and -/// `jnzi for now). +/// updated, as well as the immediate values for some or all jump instructions (`ji`, `jnei`, and +/// `jnzi for now). /// pub(crate) fn coalesce_registers( ops: &[Op], @@ -373,6 +374,7 @@ fn compute_def_use_points(ops: &[Op]) -> FxHashMap, res } +#[allow(clippy::doc_lazy_continuation)] /// Given an interference graph and a integer k, figure out if the graph k-colorable. Graph /// coloring is an NP-complete problem, but the algorithm below is a simple stack based /// approximation that relies on the fact that any node n in the graph that has fewer than k diff --git a/sway-core/src/language/ty/expression/reassignment.rs b/sway-core/src/language/ty/expression/reassignment.rs index 5d50e93eed2..55122509444 100644 --- a/sway-core/src/language/ty/expression/reassignment.rs +++ b/sway-core/src/language/ty/expression/reassignment.rs @@ -47,6 +47,7 @@ pub enum TyReassignmentTarget { /// E.g.: /// - *my_ref /// - **if x > 0 { &mut &mut a } else { &mut &mut b } + /// /// The [TyExpression] is guaranteed to be of [TyExpressionVariant::Deref]. Deref(Box), } diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs index 15266d2d2a7..67c1618983c 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs @@ -1476,6 +1476,7 @@ fn check_for_unconstrained_type_parameters( ) -> Result<(), ErrorEmitted> { // Create a list of defined generics, with the generic and a span. // Purposefully exclude the "self" type parameters. + #[allow(clippy::mutable_key_type)] let mut defined_generics: HashMap<_, _> = HashMap::from_iter( type_parameters .iter() @@ -1484,6 +1485,7 @@ fn check_for_unconstrained_type_parameters( ); // create a list of the generics in use in the impl signature + #[allow(clippy::mutable_key_type)] let mut generics_in_use = HashSet::new(); for type_arg in trait_type_arguments.iter() { generics_in_use.extend(type_arg.type_id.extract_nested_generics(engines)); diff --git a/sway-core/src/semantic_analysis/ast_node/expression/match_expression/typed/mod.rs b/sway-core/src/semantic_analysis/ast_node/expression/match_expression/typed/mod.rs index c974226d2b7..b547768d094 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/match_expression/typed/mod.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/match_expression/typed/mod.rs @@ -20,12 +20,12 @@ //! for a particular match branch (arm): //! - branch condition: Overall condition that must be `true` for the branch to match. //! - result variable declarations: Variable declarations that needs to be added to the -//! match branch result, before the actual body. Here we distinguish between the variables -//! actually declared in the match arm pattern and so called "tuple variables" that are -//! compiler generated and contain values for variables extracted out of individual OR variants. +//! match branch result, before the actual body. Here we distinguish between the variables +//! actually declared in the match arm pattern and so called "tuple variables" that are +//! compiler generated and contain values for variables extracted out of individual OR variants. //! - OR variant index variables: Variable declarations that are generated in case of having -//! variables in OR patterns. Index variables hold 1-based index of the OR variant being matched -//! or zero if non of the OR variants has matched. +//! variables in OR patterns. Index variables hold 1-based index of the OR variant being matched +//! or zero if non of the OR variants has matched. //! //! Afterwards, these three artifacts coming from every individual branch are glued together in the //! [crate::ty::TyMatchExpression] to form the final desugaring. diff --git a/sway-core/src/semantic_analysis/ast_node/expression/match_expression/typed/typed_match_branch.rs b/sway-core/src/semantic_analysis/ast_node/expression/match_expression/typed/typed_match_branch.rs index 0a1c3870106..2237ea78d45 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/match_expression/typed/typed_match_branch.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/match_expression/typed/typed_match_branch.rs @@ -252,12 +252,12 @@ type CarryOverTupleDeclarations = Vec; /// via [ty::TyMatchBranch]: /// - branch condition: Overall condition that must be `true` for the branch to match. /// - result variable declarations: Variable declarations that needs to be added to the -/// match branch result, before the actual body. Here we distinguish between the variables -/// actually declared in the match arm pattern and so called "tuple variables" that are -/// compiler generated and contain values for variables extracted out of individual OR variants. +/// match branch result, before the actual body. Here we distinguish between the variables +/// actually declared in the match arm pattern and so called "tuple variables" that are +/// compiler generated and contain values for variables extracted out of individual OR variants. /// - OR variant index variables: Variable declarations that are generated in case of having -/// variables in OR patterns. Index variables hold 1-based index of the OR variant being matched -/// or zero if non of the OR variants has matched. +/// variables in OR patterns. Index variables hold 1-based index of the OR variant being matched +/// or zero if non of the OR variants has matched. /// /// ## Algorithm Overview /// The algorithm traverses the `req_decl_tree` bottom up from left to right and collects the diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs index f7505d07b0a..bb802fe5e2c 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs @@ -858,7 +858,8 @@ impl ty::TyExpression { /// Returns the position of the first match arm that is an "interior" arm, meaning: /// - arm is a catch-all arm /// - arm is not the last match arm - /// or `None` if such arm does not exist. + /// - or `None` if such arm does not exist. + /// /// Note that the arm can be the first arm. fn interior_catch_all_arm_position(arms_reachability: &[ReachableReport]) -> Option { arms_reachability diff --git a/sway-core/src/semantic_analysis/type_check_context.rs b/sway-core/src/semantic_analysis/type_check_context.rs index faf8fa72647..1d6704a8ab5 100644 --- a/sway-core/src/semantic_analysis/type_check_context.rs +++ b/sway-core/src/semantic_analysis/type_check_context.rs @@ -1201,6 +1201,7 @@ impl<'a> TypeCheckContext<'a> { } if !maybe_method_decl_refs.is_empty() { + #[allow(clippy::mutable_key_type)] let mut trait_methods = HashMap::<(CallPath, Vec>), DeclRefFunction>::new(); let mut impl_self_method = None; diff --git a/sway-core/src/type_system/id.rs b/sway-core/src/type_system/id.rs index 709a1bf7a23..a6f1d6831cd 100644 --- a/sway-core/src/type_system/id.rs +++ b/sway-core/src/type_system/id.rs @@ -452,6 +452,7 @@ impl TypeId { inner_types } + #[allow(clippy::mutable_key_type)] pub(crate) fn extract_nested_generics( self, engines: &Engines, diff --git a/sway-core/src/type_system/unify/occurs_check.rs b/sway-core/src/type_system/unify/occurs_check.rs index 003878f3fb7..003d7503e34 100644 --- a/sway-core/src/type_system/unify/occurs_check.rs +++ b/sway-core/src/type_system/unify/occurs_check.rs @@ -31,6 +31,7 @@ impl<'a> OccursCheck<'a> { /// case the occurs check would return `false`, as this is a valid /// unification. pub(super) fn check(&self, generic: TypeId, other: TypeId) -> bool { + #[allow(clippy::mutable_key_type)] let other_generics = other.extract_nested_generics(self.engines); other_generics.contains( &self diff --git a/sway-lsp/Cargo.toml b/sway-lsp/Cargo.toml index 7f05b3e649c..c882b6535bc 100644 --- a/sway-lsp/Cargo.toml +++ b/sway-lsp/Cargo.toml @@ -8,6 +8,9 @@ homepage.workspace = true license.workspace = true repository.workspace = true +[package.metadata.cargo-udeps.ignore] +normal = ["tower"] + [dependencies] anyhow.workspace = true crossbeam-channel.workspace = true diff --git a/sway-lsp/src/utils/markdown.rs b/sway-lsp/src/utils/markdown.rs index fd9056a8deb..115f6c9bba3 100644 --- a/sway-lsp/src/utils/markdown.rs +++ b/sway-lsp/src/utils/markdown.rs @@ -50,13 +50,10 @@ fn is_sway_fence(s: &str) -> bool { let mut seen_sway_tags = false; let mut seen_other_tags = false; - let tokens = s - .trim() - .split(|c| matches!(c, ',' | ' ' | '\t')) - .filter_map(|t| { - let t = t.trim(); - (!t.is_empty()).then_some(t) - }); + let tokens = s.trim().split([',', ' ', '\t']).filter_map(|t| { + let t = t.trim(); + (!t.is_empty()).then_some(t) + }); for token in tokens { match token {