Skip to content

Commit

Permalink
cf-solana: fix unused imports warning when importing lib::par::prelude
Browse files Browse the repository at this point in the history
Depending whether lib crate is built with Rayon support or not, the
lib::par::prelude module is populated by Rayon traits or empty.
lib::par clients use the prelude to be able to call Rayon trait
methods on Chunks object returned by chunks function.

Alas, when Rayon is not enabled, the prelude is empty and the compiler
recognises it as an unused import.  Disable the warning compiler
produces.
  • Loading branch information
mina86 committed Sep 1, 2024
1 parent e0b0c1e commit 20932c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions common/cf-solana/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub use cf_guest::proof::{
generate_for_trie, verify_for_trie, GenerateError, IbcProof, VerifyError,
};
use lib::hash::CryptoHash;
#[allow(unused_imports)]
use lib::par::prelude::*;

#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions common/lib/src/par.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub type Chunks<'a, T> = core::slice::Chunks<'a, T>;
/// # Example
///
/// ```
/// #[allow(unused_imports)]
/// use lib::par::prelude::*;
///
/// let chunks = lib::par::chunks(&[0, 1, 2, 3, 4], 3)
Expand Down

0 comments on commit 20932c1

Please sign in to comment.