Skip to content

Commit b47f48e

Browse files
d-e-s-odanielocfb
authored andcommitted
Flag absolute path usage in CI
Deny the `absolute_paths` Clippy lint project wide in CI, to enforce a more coherent style in an automated fashion. Signed-off-by: Daniel Müller <[email protected]>
1 parent 8cd9a64 commit b47f48e

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ jobs:
193193
with:
194194
components: rustfmt
195195
- uses: Swatinem/rust-cache@v2
196-
- run: cargo clippy --locked --no-deps --all-targets --tests -- -D warnings
196+
- run: cargo clippy --locked --no-deps --all-targets --tests -- -D warnings -D clippy::absolute_paths
197197
rustfmt:
198198
name: Check code formatting
199199
runs-on: ubuntu-latest

examples/capable/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//
55
// Based on capable(8) by Brendan Gregg
66
use core::time::Duration;
7+
use std::str;
78
use std::str::FromStr;
89

910
use anyhow::bail;
@@ -145,7 +146,7 @@ fn _handle_event(opts: Command, event: capable_types::event) {
145146
"00:00:00".to_string()
146147
};
147148

148-
let comm_str = std::str::from_utf8(&event.comm)
149+
let comm_str = str::from_utf8(&event.comm)
149150
.unwrap()
150151
.trim_end_matches(char::from(0));
151152
let cap_name = match CAPS.get(&event.cap) {

examples/runqslower/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
22

3-
use core::time::Duration;
3+
use std::str;
4+
use std::time::Duration;
45

56
use anyhow::bail;
67
use anyhow::Result;
@@ -66,7 +67,7 @@ fn handle_event(_cpu: i32, data: &[u8]) {
6667
"00:00:00".to_string()
6768
};
6869

69-
let task = std::str::from_utf8(&event.task).unwrap();
70+
let task = str::from_utf8(&event.task).unwrap();
7071

7172
println!(
7273
"{:8} {:16} {:<7} {:<14}",

examples/tc_port_whitelist/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ use libbpf_rs::TC_H_CLSACT;
1818
use libbpf_rs::TC_H_MIN_INGRESS;
1919
use libbpf_rs::TC_INGRESS;
2020

21+
use nix::net::if_::if_nametoindex;
22+
2123
mod tc {
2224
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/bpf/tc.skel.rs"));
2325
}
@@ -71,7 +73,7 @@ fn main() -> Result<()> {
7173
let open = builder.open()?;
7274
let mut skel = open.load()?;
7375
let progs = skel.progs();
74-
let ifidx = nix::net::if_::if_nametoindex(opts.iface.as_str())? as i32;
76+
let ifidx = if_nametoindex(opts.iface.as_str())? as i32;
7577

7678
let mut tc_builder = TcHookBuilder::new(progs.handle_tc().as_fd());
7779
tc_builder

0 commit comments

Comments
 (0)