diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-02-17 00:56:07 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-02-18 13:07:49 +0300 |
| commit | b185fa3ae233b234760990f4e84bb5fcfd0ca499 (patch) | |
| tree | 754e2017447f99969354c2ad5327fd0623715fd1 | |
| parent | a149f61244738d82769fe226b0f7a812eae5e0c0 (diff) | |
| download | rust-b185fa3ae233b234760990f4e84bb5fcfd0ca499.tar.gz rust-b185fa3ae233b234760990f4e84bb5fcfd0ca499.zip | |
ast: Keep expansion status for out-of-line module items
Also remove `ast::Mod` which is mostly redundant now
| -rw-r--r-- | clippy_lints/src/utils/ast_utils.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clippy_lints/src/utils/ast_utils.rs b/clippy_lints/src/utils/ast_utils.rs index 64232646972..9ff7ef7cc3b 100644 --- a/clippy_lints/src/utils/ast_utils.rs +++ b/clippy_lints/src/utils/ast_utils.rs @@ -241,9 +241,12 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool { && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r)) } - (Mod(l), Mod(r)) => { - l.inline == r.inline && over(&l.items, &r.items, |l, r| eq_item(l, r, eq_item_kind)) - } + (Mod(lu, lmk), Mod(ru, rmk)) => lu == ru && match (lmk, rmk) { + (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, + _ => false, + }, (ForeignMod(l), ForeignMod(r)) => { both(&l.abi, &r.abi, |l, r| eq_str_lit(l, r)) && over(&l.items, &r.items, |l, r| eq_item(l, r, eq_foreign_item_kind)) |
