Skip to content

Commit

Permalink
(lrtable) Make the final_state field conditional on cfg(test)
Browse files Browse the repository at this point in the history
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)]`.
  • Loading branch information
ratmice committed Mar 6, 2024
1 parent b5abf08 commit 29c8399
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lrtable/src/lib/statetable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ pub struct StateTable<StorageT> {
prods_len: PIdx<StorageT>,
tokens_len: TIdx<StorageT>,
conflicts: Option<Conflicts<StorageT>>,
#[cfg(test)]
final_state: StIdx<StorageT>,
}

Expand Down Expand Up @@ -370,6 +371,7 @@ where
prods_len: grm.prods_len(),
tokens_len: grm.tokens_len(),
conflicts,
#[cfg(test)]
final_state: final_state.unwrap(),
})
}
Expand Down

0 comments on commit 29c8399

Please sign in to comment.