Skip to content

Commit f946fe8

Browse files
refactor: enable unreachable_pub lint (#522)
1 parent 90152df commit f946fe8

63 files changed

Lines changed: 364 additions & 342 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ exclude = [
3333
[workspace.lints.rust]
3434
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
3535

36+
# == Style, readability == #
37+
unreachable_pub = "warn"
38+
3639
[workspace.dependencies]
3740
uuid = { version = "1.18", default-features = false }
3841
tracing = { version = "0.1", default-features = false }

‎crates/dpapi-pdu/src/gkdi.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ impl arbitrary::Arbitrary<'_> for FfcdhParameters {
339339
let bits = field_order.bits().max(generator.bits());
340340

341341
Ok(Self {
342-
key_length: (bits as u32).div_ceil(8),
342+
key_length: bits.div_ceil(8),
343343
field_order,
344344
generator,
345345
})
@@ -461,7 +461,7 @@ impl arbitrary::Arbitrary<'_> for FfcdhKey {
461461
let bits = field_order.bits().max(generator.bits().max(public_key.bits()));
462462

463463
Ok(Self {
464-
key_length: (bits as u32).div_ceil(8),
464+
key_length: bits.div_ceil(8),
465465
field_order,
466466
generator,
467467
public_key,
@@ -611,7 +611,7 @@ impl arbitrary::Arbitrary<'_> for EcdhKey {
611611

612612
Ok(Self {
613613
curve: u.arbitrary()?,
614-
key_length: (bits as u32).div_ceil(8),
614+
key_length: bits.div_ceil(8),
615615
x,
616616
y,
617617
})

‎crates/dpapi-pdu/src/rpc/bind.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl From<BindError> for DecodeError {
2626
}
2727
}
2828

29-
pub type BindResult<T> = core::result::Result<T, BindError>;
29+
pub(super) type BindResult<T> = core::result::Result<T, BindError>;
3030

3131
/// [BindTimeFeatureNegotiationBitmask](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rpce/cef529cc-77b5-4794-85dc-91e1467e80f0)
3232
///

‎crates/dpapi-pdu/src/rpc/pdu.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl From<PduError> for DecodeError {
7979
}
8080
}
8181

82-
pub type PduResult<T> = core::result::Result<T, PduError>;
82+
pub(super) type PduResult<T> = core::result::Result<T, PduError>;
8383

8484
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, FromPrimitive)]
8585
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]

‎crates/dpapi-transport/src/connect_options.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub enum Error {
3333
UrlParse(#[from] url::ParseError),
3434
}
3535

36-
pub type Result<T> = core::result::Result<T, Error>;
36+
pub(crate) type Result<T> = core::result::Result<T, Error>;
3737

3838
/// Target server connection options.
3939
pub enum ConnectOptions {

‎crates/dpapi-web/src/session_token.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use wasm_bindgen::prelude::*;
77
use wasm_bindgen_futures::JsFuture;
88

99
/// This function wraps a JS-function into a Rust closure which we can pass into the Rust API.
10-
pub fn session_token_fn(get_session_token: js_sys::Function) -> Box<GetSessionTokenFn> {
10+
pub(crate) fn session_token_fn(get_session_token: js_sys::Function) -> Box<GetSessionTokenFn> {
1111
Box::new(move |session_id: Uuid, destination: Url| {
1212
let get_session_token = get_session_token.clone();
1313
Box::pin(async move {

‎crates/dpapi-web/src/transport.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ use gloo_net::websocket::futures::WebSocket;
88
use url::Url;
99
use uuid::Uuid;
1010

11-
pub trait AsyncReadWrite: AsyncRead + AsyncWrite + Unpin {}
11+
pub(crate) trait AsyncReadWrite: AsyncRead + AsyncWrite + Unpin {}
1212

1313
impl<T> AsyncReadWrite for T where T: AsyncRead + AsyncWrite + Unpin + 'static {}
1414

1515
type ErasedReadWrite = Box<dyn AsyncReadWrite>;
1616

17-
pub struct FuturesStream<S> {
17+
pub(crate) struct FuturesStream<S> {
1818
stream: S,
1919
}
2020

@@ -65,7 +65,7 @@ where
6565
/// WASM transport.
6666
///
6767
/// It uses the WEB API under the hood to open the WS connection.
68-
pub struct WasmTransport;
68+
pub(crate) struct WasmTransport;
6969

7070
impl WasmTransport {
7171
/// Connects to the RPC server via the Devolutions Gateway tunneled connection.

‎crates/dpapi/src/crypto/kout.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
macro_rules! kout {
22
($name:ident, $size:ident) => {
3-
pub struct $name;
3+
pub(crate) struct $name;
44

55
impl digest::crypto_common::KeySizeUser for $name {
66
type KeySize = digest::consts::$size;

‎crates/dpapi/src/sid.rs‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub enum SidError {
1414
static SID_PATTERN: LazyLock<Regex> =
1515
LazyLock::new(|| Regex::new(r"^S-(\d)-(\d+)(?:-\d+){1,15}$").expect("valid SID regex"));
1616

17-
pub fn sid_to_bytes(sid: &str) -> Result<Vec<u8>> {
17+
pub(crate) fn sid_to_bytes(sid: &str) -> Result<Vec<u8>> {
1818
if !SID_PATTERN.is_match(sid) {
1919
Err(SidError::InvalidSid(sid.to_owned()))?;
2020
}
@@ -53,7 +53,7 @@ pub fn sid_to_bytes(sid: &str) -> Result<Vec<u8>> {
5353
Ok(data)
5454
}
5555

56-
pub fn ace_to_bytes(sid: &str, access_mask: u32) -> Result<Vec<u8>> {
56+
pub(crate) fn ace_to_bytes(sid: &str, access_mask: u32) -> Result<Vec<u8>> {
5757
let sid = sid_to_bytes(sid)?;
5858

5959
let mut data = Vec::new();
@@ -67,7 +67,7 @@ pub fn ace_to_bytes(sid: &str, access_mask: u32) -> Result<Vec<u8>> {
6767
Ok(data)
6868
}
6969

70-
pub fn acl_to_bytes(aces: &[Vec<u8>]) -> Result<Vec<u8>> {
70+
pub(crate) fn acl_to_bytes(aces: &[Vec<u8>]) -> Result<Vec<u8>> {
7171
let ace_data_len = aces.iter().map(|a| a.len()).sum::<usize>();
7272

7373
let mut data = Vec::new();
@@ -85,7 +85,12 @@ pub fn acl_to_bytes(aces: &[Vec<u8>]) -> Result<Vec<u8>> {
8585
Ok(data)
8686
}
8787

88-
pub fn sd_to_bytes(owner: &str, group: &str, sacl: Option<&[Vec<u8>]>, dacl: Option<&[Vec<u8>]>) -> Result<Vec<u8>> {
88+
pub(crate) fn sd_to_bytes(
89+
owner: &str,
90+
group: &str,
91+
sacl: Option<&[Vec<u8>]>,
92+
dacl: Option<&[Vec<u8>]>,
93+
) -> Result<Vec<u8>> {
8994
// Self-Relative.
9095
let mut control: u16 = 0b10000000 << 8;
9196

‎crates/winscard/src/card_capability_container.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::tlv_tags;
55
// ccc - Card Capability Container
66
// Table 8. Card Capability Container
77
// https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-73-4.pdf#page=39
8-
pub fn build_ccc() -> Vec<u8> {
8+
pub(crate) fn build_ccc() -> Vec<u8> {
99
let mut ccc = Vec::new();
1010

1111
ccc.extend_from_slice(&[tlv_tags::DATA, 0x33]);

0 commit comments

Comments
 (0)