Skip to content

Commit 9f757d2

Browse files
authored
Merge pull request #24 from rex-rs/ci
- tools/memcached_benchmark: format files with new rustfmt config - ci: add check rust formating github workflow - ci: use concurrency to cancel redundant in‑flight runs - {rex, samples}: format files with new rustfmt config - tree-wide/rustfmt: set imports_granularity to Module and group_imports to StdExternalCrate Signed-off-by: Jinghao Jia <jinghao7@illinois.edu>
2 parents 4eda498 + 17222ec commit 9f757d2

File tree

49 files changed

+157
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+157
-99
lines changed

.github/workflows/meson.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
name: Meson Build and Test
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref_name }}
5+
cancel-in-progress: true
6+
27
on:
38
push:
49
branches: [main, ci]

.github/workflows/nix.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
name: Meson Build and Test via nix
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref_name }}
5+
cancel-in-progress: true
6+
27
on:
38
push:
49
branches: [main, ci]

.github/workflows/rustfmt.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Formatting check
2+
3+
on:
4+
push:
5+
branches: [main, ci]
6+
paths-ignore:
7+
- docs/**
8+
- tools/**
9+
- README.md
10+
pull_request:
11+
branches: [main]
12+
paths-ignore:
13+
- docs/**
14+
- tools/**
15+
- README.md
16+
17+
jobs:
18+
formatting:
19+
if: github.repository == 'rex-rs/rex'
20+
name: cargo fmt
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: switch rust nightly
25+
run: |
26+
rustup default nightly
27+
rustup component add rustfmt
28+
- name: formatting rex code
29+
run: cargo fmt
30+
- name: formatting samples code
31+
run: |
32+
for d in $(find ./samples -name Cargo.toml); do
33+
echo "→ Processing $d"
34+
cargo fmt --manifest-path $d --verbose --check
35+
done

rex-macros/src/args.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use std::collections::HashMap;
22

33
use proc_macro2::TokenStream;
44
use proc_macro_error::abort;
5-
use syn::{parse_str, spanned::Spanned, Expr, ExprAssign, Lit, LitStr, Result};
5+
use syn::spanned::Spanned;
6+
use syn::{parse_str, Expr, ExprAssign, Lit, LitStr, Result};
67

78
macro_rules! pop_string_args {
89
($self:expr, $key:expr) => {

rex-macros/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ mod tc;
66
mod tracepoint;
77
mod xdp;
88

9-
use proc_macro::TokenStream;
10-
use proc_macro_error::{abort, proc_macro_error};
11-
use quote::quote;
129
use std::borrow::Cow;
13-
use syn::ItemStatic;
1410

1511
use kprobe::KProbe;
1612
use perf_event::PerfEvent;
13+
use proc_macro::TokenStream;
14+
use proc_macro_error::{abort, proc_macro_error};
15+
use quote::quote;
16+
use syn::ItemStatic;
1717
use tc::SchedCls;
1818
use tracepoint::TracePoint;
1919
use xdp::Xdp;

rex/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#![feature(exit_status_error)]
22

3-
use std::env;
4-
use std::fs;
53
use std::io::Result;
64
use std::path::Path;
75
use std::process::Command;
86
use std::string::String;
7+
use std::{env, fs};
98

109
fn main() -> Result<()> {
1110
let out_dir = env::var("OUT_DIR").unwrap();

rex/rustfmt.toml

Lines changed: 0 additions & 4 deletions
This file was deleted.

rex/src/base_helper.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
// use crate::timekeeping::*;
2+
use core::intrinsics::unlikely;
3+
use core::mem::MaybeUninit;
4+
15
use crate::ffi;
26
use crate::linux::bpf::bpf_map_type;
37
use crate::linux::errno::EINVAL;
48
use crate::map::*;
59
use crate::per_cpu::{cpu_number, this_cpu_read};
610
use crate::random32::bpf_user_rnd_u32;
711
use crate::utils::{to_result, NoRef, Result};
8-
use core::mem::MaybeUninit;
9-
// use crate::timekeeping::*;
10-
11-
use core::intrinsics::unlikely;
1212

1313
macro_rules! termination_check {
1414
($func:expr) => {{
@@ -445,5 +445,4 @@ macro_rules! base_helper_defs {
445445
};
446446
}
447447

448-
pub(crate) use base_helper_defs;
449-
pub(crate) use termination_check;
448+
pub(crate) use {base_helper_defs, termination_check};

rex/src/debug.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use core::ffi::c_uchar;
2-
3-
use core::ffi::c_int;
1+
use core::ffi::{c_int, c_uchar};
42

53
use crate::ffi;
64

rex/src/kprobe/kprobe_impl.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use crate::bindings::uapi::linux::bpf::{bpf_map_type, BPF_PROG_TYPE_KPROBE};
2-
use crate::ffi;
32
use crate::prog_type::rex_prog;
43
use crate::pt_regs::PtRegs;
54
use crate::task_struct::TaskStruct;
6-
use crate::Result;
5+
use crate::{ffi, Result};
76

87
/// First 3 fields should always be rtti, prog_fn, and name
98
///

0 commit comments

Comments
 (0)