Skip to content

Commit 50c05d0

Browse files
committed
Refactor: move map_err macro back inside include! to helpers module
Signed-off-by: Joshua Potts <[email protected]>
1 parent 1977b49 commit 50c05d0

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

russh/src/helpers.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ impl Decode for NameList {
5252
type Error = ssh_encoding::Error;
5353
}
5454

55+
pub(crate) mod macros {
56+
#[allow(clippy::crate_in_macro_def)]
57+
macro_rules! map_err {
58+
($result:expr) => {
59+
$result.map_err(|e| crate::Error::from(e))
60+
};
61+
}
62+
63+
pub(crate) use map_err;
64+
}
65+
66+
#[cfg(any(feature = "ring", feature = "aws-lc-rs"))]
67+
pub(crate) use macros::map_err;
68+
5569
#[doc(hidden)]
5670
pub fn sign_with_hash_alg(key: &PrivateKeyWithHashAlg, data: &[u8]) -> ssh_key::Result<Vec<u8>> {
5771
Ok(match key.key_data() {

russh/src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,3 @@ compile_error!(
9494

9595
#[cfg(any(feature = "ring", feature = "aws-lc-rs"))]
9696
include!("lib_inner.rs");
97-
98-
#[cfg(any(feature = "ring", feature = "aws-lc-rs"))]
99-
#[macro_export]
100-
#[doc(hidden)]
101-
#[allow(clippy::crate_in_macro_def)]
102-
macro_rules! map_err {
103-
($result:expr) => {
104-
$result.map_err(|e| crate::Error::from(e))
105-
};
106-
}

russh/src/lib_inner.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ pub use sshbuffer::SshId;
4040

4141
mod helpers;
4242

43+
pub(crate) use helpers::map_err;
44+
4345
macro_rules! push_packet {
4446
( $buffer:expr, $x:expr ) => {{
4547
use byteorder::{BigEndian, ByteOrder};

0 commit comments

Comments
 (0)