Skip to content

Commit

Permalink
Appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed Dec 27, 2024
1 parent b7aeb8b commit f79aadf
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions aya-log-parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ pub fn parse(format_string: &str) -> Result<Vec<Fragment>, String> {
mod test {
use super::*;

// TODO(https://github.com/rust-lang/rust-clippy/issues/13885): narrow this to just the specific
// strings when that doesn't trip the lint.
#[allow(clippy::literal_string_with_formatting_args)]
#[test]
fn test_parse() {
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion aya-obj/src/btf/relocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ impl ComputedRelocation {
}
BtfType::Enum64(en) => {
let variant = &en.variants[accessor.index];
(variant.value_high as u64) << 32 | variant.value_low as u64
((variant.value_high as u64) << 32) | variant.value_low as u64
}
// candidate selection ensures that rel_kind == local_kind == target_kind
_ => unreachable!(),
Expand Down
2 changes: 1 addition & 1 deletion aya/src/maps/lpm_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub struct LpmTrie<T, K, V> {
/// let ipaddr = Ipv4Addr::new(8,8,8,8);
/// let key = Key::new(16, u32::from(ipaddr).to_be());
/// ```
#[repr(packed)]
#[repr(C, packed)]
pub struct Key<K: Pod> {
prefix_len: u32,
data: K,
Expand Down
2 changes: 1 addition & 1 deletion ebpf/aya-ebpf/src/maps/lpm_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct LpmTrie<K, V> {

unsafe impl<K: Sync, V: Sync> Sync for LpmTrie<K, V> {}

#[repr(packed)]
#[repr(C, packed)]
pub struct Key<K> {
/// Represents the number of bits matched against.
pub prefix_len: u32,
Expand Down
2 changes: 1 addition & 1 deletion ebpf/aya-ebpf/src/maps/perf/perf_event_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<T> PerfEventArray<T> {
}

pub fn output_at_index<C: EbpfContext>(&self, ctx: &C, index: u32, data: &T, flags: u32) {
let flags = u64::from(flags) << 32 | u64::from(index);
let flags = (u64::from(flags) << 32) | u64::from(index);
unsafe {
bpf_perf_event_output(
ctx.as_ptr(),
Expand Down
2 changes: 1 addition & 1 deletion ebpf/aya-ebpf/src/maps/perf/perf_event_byte_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl PerfEventByteArray {
}

pub fn output_at_index<C: EbpfContext>(&self, ctx: &C, index: u32, data: &[u8], flags: u32) {
let flags = u64::from(flags) << 32 | u64::from(index);
let flags = (u64::from(flags) << 32) | u64::from(index);
unsafe {
bpf_perf_event_output(
ctx.as_ptr(),
Expand Down

0 comments on commit f79aadf

Please sign in to comment.