Skip to content

Commit 2d5884a

Browse files
committed
Enable the unreachable_pub lint for our Rust crates
1 parent 5e0e0cf commit 2d5884a

File tree

7 files changed

+29
-22
lines changed

7 files changed

+29
-22
lines changed

ironfish-rust-nodejs/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44

5+
#![warn(unreachable_pub)]
56
#![warn(unused_qualifications)]
67

78
use std::fmt::Display;

ironfish-rust/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44

5+
#![warn(unreachable_pub)]
56
#![warn(unused_qualifications)]
67

78
#[cfg(feature = "transaction-proofs")]

ironfish-rust/src/mining/thread.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use super::mine;
1111
use fish_hash::Context;
1212

1313
#[derive(Debug)]
14-
pub(crate) enum Command {
14+
pub(super) enum Command {
1515
NewWork(
1616
Vec<u8>, // header bytes
1717
Vec<u8>, // target
@@ -23,17 +23,17 @@ pub(crate) enum Command {
2323
Pause,
2424
}
2525

26-
pub struct FishHashOptions {
27-
pub enabled: bool,
28-
pub full_context: bool,
26+
pub(super) struct FishHashOptions {
27+
pub(super) enabled: bool,
28+
pub(super) full_context: bool,
2929
}
3030

31-
pub(crate) struct Thread {
31+
pub(super) struct Thread {
3232
command_channel: Sender<Command>,
3333
}
3434

3535
impl Thread {
36-
pub(crate) fn new(
36+
pub(super) fn new(
3737
id: u64,
3838
block_found_channel: Sender<(u64, u32)>,
3939
hash_rate_channel: Sender<u32>,
@@ -76,7 +76,7 @@ impl Thread {
7676
}
7777
}
7878

79-
pub(crate) fn new_work(
79+
pub(super) fn new_work(
8080
&self,
8181
header_bytes: Vec<u8>,
8282
target: Vec<u8>,
@@ -93,11 +93,11 @@ impl Thread {
9393
))
9494
}
9595

96-
pub(crate) fn pause(&self) -> Result<(), SendError<Command>> {
96+
pub(super) fn pause(&self) -> Result<(), SendError<Command>> {
9797
self.command_channel.send(Command::Pause)
9898
}
9999

100-
pub(crate) fn stop(&self) -> Result<(), SendError<Command>> {
100+
pub(super) fn stop(&self) -> Result<(), SendError<Command>> {
101101
self.command_channel.send(Command::Stop)
102102
}
103103
}

ironfish-rust/src/transaction/value_balances.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,24 @@ use crate::{
88
errors::{IronfishError, IronfishErrorKind},
99
};
1010

11-
pub struct ValueBalances {
11+
pub(super) struct ValueBalances {
1212
values: HashMap<AssetIdentifier, i64>,
1313
}
1414

1515
impl ValueBalances {
16-
pub fn new() -> Self {
16+
pub(super) fn new() -> Self {
1717
let mut hash_map = HashMap::default();
1818

1919
hash_map.insert(NATIVE_ASSET, 0);
2020

2121
ValueBalances { values: hash_map }
2222
}
2323

24-
pub fn add(&mut self, asset_id: &AssetIdentifier, value: i64) -> Result<(), IronfishError> {
24+
pub(super) fn add(
25+
&mut self,
26+
asset_id: &AssetIdentifier,
27+
value: i64,
28+
) -> Result<(), IronfishError> {
2529
let current_value = self.values.entry(*asset_id).or_insert(0);
2630
let new_value = current_value
2731
.checked_add(value)
@@ -32,7 +36,7 @@ impl ValueBalances {
3236
Ok(())
3337
}
3438

35-
pub fn subtract(
39+
pub(super) fn subtract(
3640
&mut self,
3741
asset_id: &AssetIdentifier,
3842
value: i64,
@@ -47,11 +51,11 @@ impl ValueBalances {
4751
Ok(())
4852
}
4953

50-
pub fn iter(&self) -> hash_map::Iter<AssetIdentifier, i64> {
54+
pub(super) fn iter(&self) -> hash_map::Iter<AssetIdentifier, i64> {
5155
self.values.iter()
5256
}
5357

54-
pub fn fee(&self) -> &i64 {
58+
pub(super) fn fee(&self) -> &i64 {
5559
self.values.get(&NATIVE_ASSET).unwrap()
5660
}
5761
}

ironfish-zkp/src/circuits/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub mod mint_asset;
2-
pub mod output;
3-
pub mod spend;
4-
pub mod util;
1+
pub(crate) mod mint_asset;
2+
pub(crate) mod output;
3+
pub(crate) mod spend;
4+
pub(crate) mod util;

ironfish-zkp/src/circuits/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
primitives::ValueCommitment,
1818
};
1919

20-
pub fn slice_into_boolean_vec_le<Scalar: PrimeField, CS: ConstraintSystem<Scalar>>(
20+
fn slice_into_boolean_vec_le<Scalar: PrimeField, CS: ConstraintSystem<Scalar>>(
2121
mut cs: CS,
2222
value: Option<&[u8]>,
2323
byte_length: u32,
@@ -52,7 +52,7 @@ pub fn slice_into_boolean_vec_le<Scalar: PrimeField, CS: ConstraintSystem<Scalar
5252

5353
/// Exposes a Pedersen commitment to the value as an
5454
/// input to the circuit
55-
pub fn expose_value_commitment<CS>(
55+
pub(crate) fn expose_value_commitment<CS>(
5656
mut cs: CS,
5757
asset_generator: EdwardsPoint,
5858
value_commitment: Option<ValueCommitment>,
@@ -110,7 +110,7 @@ where
110110
Ok(value_bits)
111111
}
112112

113-
pub fn assert_valid_asset_generator<CS: ConstraintSystem<blstrs::Scalar>>(
113+
pub(crate) fn assert_valid_asset_generator<CS: ConstraintSystem<blstrs::Scalar>>(
114114
mut cs: CS,
115115
asset_id: &[u8; ASSET_ID_LENGTH],
116116
asset_generator_repr: &[Boolean],

ironfish-zkp/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![warn(unreachable_pub)]
12
#![warn(unused_qualifications)]
23

34
mod circuits;

0 commit comments

Comments
 (0)