Skip to content

Commit

Permalink
fix(aya-log): remove some useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanaasagi committed May 21, 2023
1 parent 0970300 commit d999a95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
17 changes: 4 additions & 13 deletions aya-log-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ macro_rules! impl_formatter_for_types {
};
}

// Any value impl `ToString`
pub trait DefaultFormatter {}
impl_formatter_for_types!(
DefaultFormatter: {
Expand All @@ -61,24 +60,20 @@ pub trait LowerHexFormatter {}
impl_formatter_for_types!(
LowerHexFormatter: {
i8, i16, i32, i64, isize,
u8, u16, u32, u64, usize
u8, u16, u32, u64, usize,
&[u8]
}
);

pub trait LowerHexDebugFormatter {}
impl LowerHexDebugFormatter for &[u8] {}

pub trait UpperHexFormatter {}
impl_formatter_for_types!(
UpperHexFormatter: {
i8, i16, i32, i64, isize,
u8, u16, u32, u64, usize
u8, u16, u32, u64, usize,
&[u8]
}
);

pub trait UpperHexDebugFormatter {}
impl UpperHexDebugFormatter for &[u8] {}

pub trait Ipv4Formatter {}
impl Ipv4Formatter for u32 {}

Expand All @@ -97,12 +92,8 @@ pub fn check_impl_default<T: DefaultFormatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_lower_hex<T: LowerHexFormatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_lower_hex_debug<T: LowerHexDebugFormatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_upper_hex<T: UpperHexFormatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_upper_hex_debug<T: UpperHexDebugFormatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_ipv4<T: Ipv4Formatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_ipv6<T: Ipv6Formatter>(_v: T) {}
Expand Down
5 changes: 1 addition & 4 deletions aya-log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ impl BpfLogger {
#[allow(clippy::needless_range_loop)]
for i in 0..events.read {
let buf = &mut buffers[i];
match log_buf(buf, &*log) {
Ok(()) => {}
Err(e) => error!("internal error => {:?}", e),
}
log_buf(buf, &*log).unwrap();
}
}
});
Expand Down

0 comments on commit d999a95

Please sign in to comment.