fix(aya-log): remove some useless code

pull/606/head
Hanaasagi 2 years ago
parent 0970300d1f
commit d999a95b41

@ -43,7 +43,6 @@ macro_rules! impl_formatter_for_types {
}; };
} }
// Any value impl `ToString`
pub trait DefaultFormatter {} pub trait DefaultFormatter {}
impl_formatter_for_types!( impl_formatter_for_types!(
DefaultFormatter: { DefaultFormatter: {
@ -61,24 +60,20 @@ pub trait LowerHexFormatter {}
impl_formatter_for_types!( impl_formatter_for_types!(
LowerHexFormatter: { LowerHexFormatter: {
i8, i16, i32, i64, isize, 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 {} pub trait UpperHexFormatter {}
impl_formatter_for_types!( impl_formatter_for_types!(
UpperHexFormatter: { UpperHexFormatter: {
i8, i16, i32, i64, isize, 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 {} pub trait Ipv4Formatter {}
impl Ipv4Formatter for u32 {} impl Ipv4Formatter for u32 {}
@ -97,12 +92,8 @@ pub fn check_impl_default<T: DefaultFormatter>(_v: T) {}
#[inline(always)] #[inline(always)]
pub fn check_impl_lower_hex<T: LowerHexFormatter>(_v: T) {} pub fn check_impl_lower_hex<T: LowerHexFormatter>(_v: T) {}
#[inline(always)] #[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) {} pub fn check_impl_upper_hex<T: UpperHexFormatter>(_v: T) {}
#[inline(always)] #[inline(always)]
pub fn check_impl_upper_hex_debug<T: UpperHexDebugFormatter>(_v: T) {}
#[inline(always)]
pub fn check_impl_ipv4<T: Ipv4Formatter>(_v: T) {} pub fn check_impl_ipv4<T: Ipv4Formatter>(_v: T) {}
#[inline(always)] #[inline(always)]
pub fn check_impl_ipv6<T: Ipv6Formatter>(_v: T) {} pub fn check_impl_ipv6<T: Ipv6Formatter>(_v: T) {}

@ -126,10 +126,7 @@ impl BpfLogger {
#[allow(clippy::needless_range_loop)] #[allow(clippy::needless_range_loop)]
for i in 0..events.read { for i in 0..events.read {
let buf = &mut buffers[i]; let buf = &mut buffers[i];
match log_buf(buf, &*log) { log_buf(buf, &*log).unwrap();
Ok(()) => {}
Err(e) => error!("internal error => {:?}", e),
}
} }
} }
}); });

Loading…
Cancel
Save