From 29c839943e37e1c5ca2714f84f3f37b2b19c4a20 Mon Sep 17 00:00:00 2001 From: matt rice Date: Tue, 5 Mar 2024 20:19:06 -0800 Subject: [PATCH] (lrtable) Make the final_state field conditional on `cfg(test)` This conditionally includes a field into `struct StateTable`. Previously `clippy with --no-default-features -p lrtable` would produce a warning about `final_state` never being read. This was presumably being suppressed by serde derive macros. Since this field was only used in the test cfg. It seemed better to make it conditional rather than `#[allow(dead_code)]`. --- lrtable/src/lib/statetable.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lrtable/src/lib/statetable.rs b/lrtable/src/lib/statetable.rs index 437adbe85..8814436b4 100644 --- a/lrtable/src/lib/statetable.rs +++ b/lrtable/src/lib/statetable.rs @@ -141,6 +141,7 @@ pub struct StateTable { prods_len: PIdx, tokens_len: TIdx, conflicts: Option>, + #[cfg(test)] final_state: StIdx, } @@ -370,6 +371,7 @@ where prods_len: grm.prods_len(), tokens_len: grm.tokens_len(), conflicts, + #[cfg(test)] final_state: final_state.unwrap(), }) }