Skip to content

Commit 78ecc2d

Browse files
authored
structopt -> clap, Rust 1.90/2024, swadm link apply command (#134)
1 parent 5c7f826 commit 78ecc2d

File tree

141 files changed

+2805
-2662
lines changed

Some content is hidden

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

141 files changed

+2805
-2662
lines changed

Cargo.lock

Lines changed: 1259 additions & 1243 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ camino = { version = "1.1", features = ["serde1"] }
6363
cfg-if = "1"
6464
chrono = "0.4"
6565
colored = "2"
66+
clap = { version = "4.5.8", features = [ "derive" ] }
6667
csv = "1.3"
6768
curl = "0.4"
6869
display-error-chain = "0.2"
@@ -96,7 +97,6 @@ slog-async = "2.8"
9697
slog-bunyan = "2.5"
9798
slog-term = "2.9"
9899
socket2 = { version = "0.6", features = ["all"] }
99-
structopt = "0.3"
100100
strum = { version = "0.26.3", features = [ "derive" ] }
101101
syn = { version = "2.0", features = ["extra-traits"]}
102102
tabwriter = { version = "1", features = ["ansi_formatting"] }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ Configuring a nat entry using `swadm`:
307307
``` sh
308308
$ ./target/release/swadm nat add \
309309
-e 10.85.0.211 \
310-
-h 65535 \
310+
-H 65535 \
311311
-m A8:40:25:F6:F9:94 \
312312
-i fd00:1122:3344:101::1 \
313313
-l 1024 \

aal/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "aal"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

aal/src/match_action.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,10 @@ impl TryFrom<&ValueTypes> for u32 {
370370
fn try_from(v: &ValueTypes) -> Result<Self, Self::Error> {
371371
let mask = (1u64 << 32) - 1;
372372

373-
if let ValueTypes::U64(v) = v {
374-
if v & mask == *v {
375-
return Ok((v & mask) as u32);
376-
}
373+
if let ValueTypes::U64(v) = v
374+
&& v & mask == *v
375+
{
376+
return Ok((v & mask) as u32);
377377
}
378378

379379
Err("value not 32 bits")
@@ -400,10 +400,10 @@ impl TryFrom<&ValueTypes> for u8 {
400400
fn try_from(v: &ValueTypes) -> Result<Self, Self::Error> {
401401
let mask = (1u64 << 8) - 1;
402402

403-
if let ValueTypes::U64(v) = v {
404-
if v & mask == *v {
405-
return Ok((v & mask) as u8);
406-
}
403+
if let ValueTypes::U64(v) = v
404+
&& v & mask == *v
405+
{
406+
return Ok((v & mask) as u8);
407407
}
408408

409409
Err("value not 8 bits")

aal_macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
version = "0.0.1"
33
name = "aal_macros"
4-
edition = "2021"
4+
edition = "2024"
55

66
[lib]
77
proc-macro = true

aal_macros/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ fn get_fields<'a>(
370370
return Err(Error::new(
371371
f.span(),
372372
format!("unrecognized key type: {x}"),
373-
))
373+
));
374374
}
375375
},
376376
};
@@ -391,7 +391,7 @@ fn get_fields<'a>(
391391
}
392392

393393
// Parse all of the arguments to an action
394-
fn get_action_args(variant: &Variant) -> Result<Vec<ActionArg>> {
394+
fn get_action_args(variant: &Variant) -> Result<Vec<ActionArg<'_>>> {
395395
let mut args = Vec::new();
396396

397397
let named = match variant.fields {

asic/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "asic"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[features]
77
tofino_asic = [

asic/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fn sde_prep() -> Result<()> {
9797
let sde_dir =
9898
env::var("SDE").with_context(|| "failed to get SDE env var")?;
9999

100-
env::set_var("CFLAGS", format!("-I{sde_dir}/include"));
100+
unsafe { env::set_var("CFLAGS", format!("-I{sde_dir}/include")) };
101101

102102
println!("cargo:rerun-if-changed={TOFINO_DIR}/{FN_FILE}");
103103
println!("cargo:rerun-if-changed={TOFINO_DIR}/{TYPE_FILE}");
@@ -121,7 +121,7 @@ fn sde_prep() -> Result<()> {
121121

122122
fn main() -> Result<()> {
123123
#[cfg(target_os = "illumos")]
124-
{
124+
unsafe {
125125
env::set_var("AR", "/usr/bin/gar");
126126
env::set_var("LIBCLANG_PATH", "/opt/ooce/llvm/lib");
127127
}

asic/src/chaos/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use aal::{
1717
};
1818
use common::ports::{PortFec, PortId, PortMedia, PortPrbsMode, PortSpeed};
1919

20+
use crate::Identifiers;
2021
pub use crate::faux_fsm::FsmState;
2122
pub use crate::faux_fsm::PortFsmState;
22-
use crate::Identifiers;
2323

2424
pub mod table;
2525

@@ -117,11 +117,11 @@ impl TableChaos {
117117
id: &str,
118118
message: &str,
119119
) -> AsicResult<()> {
120-
if let Some(value) = self.values.get(id) {
121-
if *value >= random() {
122-
slog::error!(log, "chaos table error: {}", message);
123-
return Err(AsicError::Synthetic(message.into()));
124-
}
120+
if let Some(value) = self.values.get(id)
121+
&& *value >= random()
122+
{
123+
slog::error!(log, "chaos table error: {}", message);
124+
return Err(AsicError::Synthetic(message.into()));
125125
}
126126
Ok(())
127127
}

0 commit comments

Comments
 (0)