about summary refs log tree commit diff
path: root/clippy_utils/src/ast_utils/mod.rs
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-08-21 01:12:19 -0400
committerGitHub <noreply@github.com>2025-08-21 01:12:19 -0400
commitbea2e2be484a094654fb5161344d6d8b4c223cd2 (patch)
tree829c18a9a7181eb0aa54861ba80471c0785079eb /clippy_utils/src/ast_utils/mod.rs
parent4b2b9c2a39f252e5c6a6a699646eff9d2f8cf79a (diff)
parentc1dfeea919a8ac54d152c90885704e9d43940c7b (diff)
Rollup merge of #145590 - nnethercote:ModKind-Inline, r=petrochenkov
Prevent impossible combinations in `ast::ModKind`.

`ModKind::Loaded` has an `inline` field and a `had_parse_error` field. If the `inline` field is `Inline::Yes` then `had_parse_error` must be `Ok(())`.

This commit moves the `had_parse_error` field into the `Inline::No` variant. This makes it impossible to create the nonsensical combination of `inline == Inline::Yes` and `had_parse_error = Err(_)`.

r? ```@Urgau```
Diffstat (limited to 'clippy_utils/src/ast_utils/mod.rs')
-rw-r--r--clippy_utils/src/ast_utils/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_utils/src/ast_utils/mod.rs b/clippy_utils/src/ast_utils/mod.rs
index 24e017f7cf7..d80a9d9dd07 100644
--- a/clippy_utils/src/ast_utils/mod.rs
+++ b/clippy_utils/src/ast_utils/mod.rs
@@ -403,7 +403,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
             ls == rs
                 && eq_id(*li, *ri)
                 && match (lmk, rmk) {
-                    (ModKind::Loaded(litems, linline, _, _), ModKind::Loaded(ritems, rinline, _, _)) => {
+                    (ModKind::Loaded(litems, linline, _), ModKind::Loaded(ritems, rinline, _)) => {
                         linline == rinline && over(litems, ritems, |l, r| eq_item(l, r, eq_item_kind))
                     },
                     (ModKind::Unloaded, ModKind::Unloaded) => true,