diff --git a/libflux/Cargo.toml b/libflux/Cargo.toml index f50def29a9..7b4e6b62dd 100644 --- a/libflux/Cargo.toml +++ b/libflux/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = ["flux-core", "flux"] +resolver = "2" # https://rustwasm.github.io/docs/book/reference/code-size.html#optimizing-builds-for-code-size [profile.release] diff --git a/libflux/flux-core/src/ast/mod.rs b/libflux/flux-core/src/ast/mod.rs index ba4b13d76f..e84c1712c6 100644 --- a/libflux/flux-core/src/ast/mod.rs +++ b/libflux/flux-core/src/ast/mod.rs @@ -396,7 +396,7 @@ impl PropertyKey { // FunctionBodyExpression = Block | Expression . #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] #[serde(untagged)] -#[allow(missing_docs)] +#[allow(missing_docs, clippy::large_enum_variant)] pub enum FunctionBody { Block(Block), Expr(Expression), diff --git a/libflux/flux-core/src/bin/fluxdoc.rs b/libflux/flux-core/src/bin/fluxdoc.rs index fe35af810e..fea610a406 100644 --- a/libflux/flux-core/src/bin/fluxdoc.rs +++ b/libflux/flux-core/src/bin/fluxdoc.rs @@ -142,7 +142,7 @@ fn dump( fn lint(flux_cmd_path: Option<&Path>, dir: &Path, limit: Option) -> Result<()> { let flux_cmd_path = resolve_default_paths(flux_cmd_path); let limit = match limit { - Some(limit) if limit == 0 => i64::MAX, + Some(0) => i64::MAX, Some(limit) => limit, None => 10, }; @@ -217,7 +217,7 @@ fn consume_sequentially( impl PartialOrd for Element { fn partial_cmp(&self, other: &Self) -> Option { - other.0.partial_cmp(&self.0) + Some(self.cmp(other)) } } diff --git a/libflux/flux-core/src/parser/mod.rs b/libflux/flux-core/src/parser/mod.rs index ac7d4b9a72..a78060da12 100644 --- a/libflux/flux-core/src/parser/mod.rs +++ b/libflux/flux-core/src/parser/mod.rs @@ -1455,6 +1455,7 @@ impl<'input> Parser<'input> { // It returns Result::Ok(po) containing the postfix operator created. // If it fails to find a postix operator, it returns Result::Err(expr) containing the original // expression passed. This allows for further reuse of the given `expr`. + #[allow(clippy::result_large_err)] fn parse_postfix_operator(&mut self, expr: Expression) -> Result { let t = self.peek(); match t.tok { @@ -2010,10 +2011,10 @@ impl<'input> Parser<'input> { } _ => { let t = t.clone(); - let mut expr = self.parse_expression_while_more(None, &[]); - match expr { - None => { - expr = Some(Expression::Bad(Box::new(BadExpr { + let expr = self + .parse_expression_while_more(None, &[]) + .unwrap_or_else(|| { + Expression::Bad(Box::new(BadExpr { // Do not use `self.base_node_*` in order not to steal errors. // The BadExpr is an error per se. We want to leave errors to parents. base: BaseNode { @@ -2025,15 +2026,13 @@ impl<'input> Parser<'input> { }, text: t.lit, expression: None, - }))); - } - Some(_) => (), - }; + })) + }); let rparen = self.close(TokenType::RParen); Expression::Paren(Box::new(ParenExpr { base: self.base_node_from_tokens(&lparen, &rparen), lparen: lparen.comments, - expression: expr.expect("must be Some at this point"), + expression: expr, rparen: rparen.comments, })) } diff --git a/libflux/flux-core/src/semantic/sub.rs b/libflux/flux-core/src/semantic/sub.rs index 7bd0ea748b..e6a02dd74a 100644 --- a/libflux/flux-core/src/semantic/sub.rs +++ b/libflux/flux-core/src/semantic/sub.rs @@ -568,7 +568,7 @@ where self.clone_types = i; self.next = Some(typ); } else { - self.clone_types = usize::max_value(); + self.clone_types = usize::MAX; } self.next() } diff --git a/libflux/flux-core/src/semantic/tests.rs b/libflux/flux-core/src/semantic/tests.rs index 2c2885b828..a7d62f8d6f 100644 --- a/libflux/flux-core/src/semantic/tests.rs +++ b/libflux/flux-core/src/semantic/tests.rs @@ -173,38 +173,32 @@ fn infer_types( /// # Example /// /// ``` -/// #[test] -/// fn instantiation() { -/// test_infer! { -/// env: map![ -/// "f" => "where A: Addable (a: A, b: A) => A", -/// ], -/// src: "x = f", -/// exp: map![ -/// "x" => "where A: Addable (a: A, b: A) => A", -/// ], -/// } +/// test_infer! { +/// env: map![ +/// "f" => "where A: Addable (a: A, b: A) => A", +/// ], +/// src: "x = f", +/// exp: map![ +/// "x" => "where A: Addable (a: A, b: A) => A", +/// ], /// } /// ``` /// /// ``` -/// #[test] -/// fn with_imports() { -/// test_infer! { -/// imp: map![ -/// "path/to/foo" => package![ -/// "f" => "(x: A) => A", -/// ], -/// ], -/// src: r#" -/// import foo "path/to/foo" -/// -/// f = foo.f -/// "#, -/// exp: map![ +/// test_infer! { +/// imp: map![ +/// "path/to/foo" => package![ /// "f" => "(x: A) => A", /// ], -/// } +/// ], +/// src: r#" +/// import foo "path/to/foo" +/// +/// f = foo.f +/// "#, +/// exp: map![ +/// "f" => "(x: A) => A", +/// ], /// } /// ``` /// @@ -243,11 +237,8 @@ macro_rules! test_infer { /// # Example /// /// ``` -/// #[test] -/// fn undeclared_variable() { -/// test_infer_err! { -/// src: "x = f", -/// } +/// test_infer_err! { +/// src: "x = f", /// } /// ``` /// diff --git a/libflux/go/libflux/buildinfo.gen.go b/libflux/go/libflux/buildinfo.gen.go index ab42004774..107b67ca77 100644 --- a/libflux/go/libflux/buildinfo.gen.go +++ b/libflux/go/libflux/buildinfo.gen.go @@ -14,14 +14,14 @@ package libflux //lint:ignore U1000 generated code var sourceHashes = map[string]string{ "libflux/Cargo.lock": "58302d93174bb2def223a5439ddbc596476216bf511a11f0ff2fc23865fc1d0a", - "libflux/Cargo.toml": "91ac4e8b467440c6e8a9438011de0e7b78c2732403bb067d4dd31539ac8a90c1", + "libflux/Cargo.toml": "5fb7dd63ac209ddff2761e189adae7d86f1f3302b15a6a114508872dc92d7f5e", "libflux/flux-core/Cargo.toml": "971f23ba5dd621df72be85c61135abf1583b0bcc18e2cf51eb0d9107d61639db", "libflux/flux-core/src/ast/check/mod.rs": "4a6511e9ccc9718eada01b29544bd4d5c324ae87a85906c25ad7193a890f86fc", - "libflux/flux-core/src/ast/mod.rs": "00fac7d9da0dfb0475a994b208b9e3d97ad2199a8dcc5bac941e2376c94b5f6b", + "libflux/flux-core/src/ast/mod.rs": "5e995891f9cb49d402d3031cda6a67041e12df942070607ec1e97a11ff959c6e", "libflux/flux-core/src/ast/walk/mod.rs": "b0069cedffd1a20c77c4fe12465a8350a50a8916d0f29798ab47212fdd0b0692", "libflux/flux-core/src/bin/README.md": "c1245a4938c923d065647b4dc4f7e19486e85c93d868ef2f7f47ddff62ec81df", "libflux/flux-core/src/bin/analyze_query_log.rs": "39e671b867268e1d8c244325205d7b2493aba337033f1112b1fb59555778fe9d", - "libflux/flux-core/src/bin/fluxdoc.rs": "1f06347f18eace128124b3bcde236584575060b2c5c1e67ae2617db6caf1a5dc", + "libflux/flux-core/src/bin/fluxdoc.rs": "58431044721fbc9783b6ab94d58c494eca5b84be906499eb1a4ab10e8e9958e7", "libflux/flux-core/src/db.rs": "7e9f2d2a732dd3336d24ff9a58deca9f7e91df93ca310826ea376bb3aaead2cb", "libflux/flux-core/src/doc/example.rs": "29008d7fbf26e612107827551d6fb41f725b5973fbd617e0f04b087eff596fd2", "libflux/flux-core/src/doc/mod.rs": "64941b878e1dda70be8b1b03e0bb850ea644755e8045b0b6f648c8af9b2f4dc6", @@ -29,7 +29,7 @@ var sourceHashes = map[string]string{ "libflux/flux-core/src/formatter/mod.rs": "6aaf87b945bbbfd8acc7a680aae6d3f4c84f8964a9ed6cb50b99122bb240fd45", "libflux/flux-core/src/lib.rs": "487c5b2db051f7ed5276c566a9a6b2ee75d6a13459443cf94b51b6d90d20edd2", "libflux/flux-core/src/map.rs": "342c1cc111d343f01b97f38be10a9f1097bdd57cdc56f55e92fd3ed5028e6973", - "libflux/flux-core/src/parser/mod.rs": "abc9f7fe02d4252c4046bf1f680916f328b5f04a73509413ef37b55a0daa1420", + "libflux/flux-core/src/parser/mod.rs": "2e72162206ecf003797f7b4dfd926bfc104e5de1a26205fd03a78535b85dea74", "libflux/flux-core/src/parser/strconv.rs": "005ecd7a1a227d280dfd0bf065b7f9c49f68952daf7efe1c9bc3bfd91a30a909", "libflux/flux-core/src/scanner/mod.rs": "eb7afb2eff162080046ddda7d1e9d01ffd4ec3a165bbcc95a001bf7edefa5e9c", "libflux/flux-core/src/scanner/scanner.rl": "34e1f306994b8f69d0551110ce22efa75e0081b7c5f498ad293a739970bbcbc2", @@ -51,7 +51,7 @@ var sourceHashes = map[string]string{ "libflux/flux-core/src/semantic/infer.rs": "b6d18c94b58da27aebb5828f6471768ccc52e679a1356c6a38d0f3cd01a06dce", "libflux/flux-core/src/semantic/mod.rs": "c152ca3a24b73b80238316b003ec6acfb098bd4b60fecae308a38586a0bfbfe3", "libflux/flux-core/src/semantic/nodes.rs": "848ffb45a24f9c01e0de002a3090cbd42417e3f411d3abd5bee18e22d46042b6", - "libflux/flux-core/src/semantic/sub.rs": "d78826dad39aa9128ec5d7dae23b7672b88ceb6af625b3e4865bb482d3f84903", + "libflux/flux-core/src/semantic/sub.rs": "91fab302cda581be657231084ad5b71ec0eaeb838ab26bf7e8f9b4691cf351b5", "libflux/flux-core/src/semantic/symbols.rs": "f061d57fe4ef7f23d0adad80d43fe1c8ae92d5e25a0da4b81e21b8087e30d253", "libflux/flux-core/src/semantic/types.rs": "d36ddbd121d669c176afe7b9eeef4b75a774fdfcf1a5e9593901b6618bc2981f", "libflux/flux-core/src/semantic/vectorize.rs": "ec4a374bbf406b981b861d5b17d8ccfcbcd22c7f345132fe2335541dacb228e9", diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f5c0da5a83..db35694567 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.72" +channel = "1.82" components = ["rustfmt", "clippy"] targets = [ "wasm32-unknown-unknown",