From 51436dae1343ee6b386db8d030ee2642977bb06e Mon Sep 17 00:00:00 2001 From: Zeeshan Ali Khan Date: Mon, 2 Dec 2024 13:13:34 +0100 Subject: [PATCH 1/2] all: Port to satisfy latest clippy --- examples/more/src/org_example_more.rs | 8 ++--- examples/ping/src/org_example_ping.rs | 6 ++-- varlink/src/lib.rs | 4 +-- varlink_generator/src/lib.rs | 4 +-- .../tests/org.example.complex.rs_out | 6 ++-- varlink_parser/src/format.rs | 36 +++++++++---------- .../src/org_varlink_service.rs | 4 +-- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/more/src/org_example_more.rs b/examples/more/src/org_example_more.rs index 87adc4f..f8641a6 100644 --- a/examples/more/src/org_example_more.rs +++ b/examples/more/src/org_example_more.rs @@ -132,7 +132,7 @@ pub trait VarlinkCallError: varlink::CallTrait { )) } } -impl<'a> VarlinkCallError for varlink::Call<'a> {} +impl VarlinkCallError for varlink::Call<'_> {} #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct r#State { pub r#start: Option, @@ -158,7 +158,7 @@ pub trait Call_Ping: VarlinkCallError { self.reply_struct(Ping_Reply { r#pong }.into()) } } -impl<'a> Call_Ping for varlink::Call<'a> {} +impl Call_Ping for varlink::Call<'_> {} #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct StopServing_Reply {} impl varlink::VarlinkReply for StopServing_Reply {} @@ -170,7 +170,7 @@ pub trait Call_StopServing: VarlinkCallError { self.reply_struct(varlink::Reply::parameters(None)) } } -impl<'a> Call_StopServing for varlink::Call<'a> {} +impl Call_StopServing for varlink::Call<'_> {} #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct TestMore_Reply { pub r#state: State, @@ -186,7 +186,7 @@ pub trait Call_TestMore: VarlinkCallError { self.reply_struct(TestMore_Reply { r#state }.into()) } } -impl<'a> Call_TestMore for varlink::Call<'a> {} +impl Call_TestMore for varlink::Call<'_> {} #[allow(dead_code)] pub trait VarlinkInterface { fn ping(&self, call: &mut dyn Call_Ping, r#ping: String) -> varlink::Result<()>; diff --git a/examples/ping/src/org_example_ping.rs b/examples/ping/src/org_example_ping.rs index 2320ec8..6266578 100644 --- a/examples/ping/src/org_example_ping.rs +++ b/examples/ping/src/org_example_ping.rs @@ -132,7 +132,7 @@ pub trait VarlinkCallError: varlink::CallTrait { )) } } -impl<'a> VarlinkCallError for varlink::Call<'a> {} +impl VarlinkCallError for varlink::Call<'_> {} #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct PingError_Args { pub r#parameter: i64, @@ -152,7 +152,7 @@ pub trait Call_Ping: VarlinkCallError { self.reply_struct(Ping_Reply { r#pong }.into()) } } -impl<'a> Call_Ping for varlink::Call<'a> {} +impl Call_Ping for varlink::Call<'_> {} #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct Upgrade_Reply {} impl varlink::VarlinkReply for Upgrade_Reply {} @@ -164,7 +164,7 @@ pub trait Call_Upgrade: VarlinkCallError { self.reply_struct(varlink::Reply::parameters(None)) } } -impl<'a> Call_Upgrade for varlink::Call<'a> {} +impl Call_Upgrade for varlink::Call<'_> {} #[allow(dead_code)] pub trait VarlinkInterface { fn ping(&self, call: &mut dyn Call_Ping, r#ping: String) -> varlink::Result<()>; diff --git a/varlink/src/lib.rs b/varlink/src/lib.rs index 7661005..9508b4a 100644 --- a/varlink/src/lib.rs +++ b/varlink/src/lib.rs @@ -703,7 +703,7 @@ pub trait CallTrait { } } -impl<'a> CallTrait for Call<'a> { +impl CallTrait for Call<'_> { fn reply_struct(&mut self, mut reply: Reply) -> Result<()> { if self.continues && (!self.wants_more()) { return Err(context!(ErrorKind::CallContinuesMismatch)); @@ -1512,6 +1512,6 @@ impl ConnectionHandler for VarlinkService { } } - return Ok((bufreader.buffer().to_vec(), upgraded_iface)); + Ok((bufreader.buffer().to_vec(), upgraded_iface)) } } diff --git a/varlink_generator/src/lib.rs b/varlink_generator/src/lib.rs index bd4ef73..78ed48d 100644 --- a/varlink_generator/src/lib.rs +++ b/varlink_generator/src/lib.rs @@ -404,7 +404,7 @@ fn varlink_to_rust(idl: &IDL, options: &GeneratorOptions, tosource: bool) -> Res } ts.extend(quote!( - impl<'a> #call_name for varlink::Call<'a> {} + impl #call_name for varlink::Call<'_> {} )); // #server_method_decls @@ -794,7 +794,7 @@ fn generate_error_code( )); } ts.extend(quote!( - impl<'a> VarlinkCallError for varlink::Call<'a> {} + impl VarlinkCallError for varlink::Call<'_> {} )); } diff --git a/varlink_generator/tests/org.example.complex.rs_out b/varlink_generator/tests/org.example.complex.rs_out index 82be71d..339c314 100644 --- a/varlink_generator/tests/org.example.complex.rs_out +++ b/varlink_generator/tests/org.example.complex.rs_out @@ -173,7 +173,7 @@ pub trait VarlinkCallError: varlink::CallTrait { )) } } -impl<'a> VarlinkCallError for varlink::Call<'a> {} +impl VarlinkCallError for varlink::Call<'_> {} #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub enum r#Enum { r#enum, @@ -263,7 +263,7 @@ pub trait Call_Bar: VarlinkCallError { self.reply_struct(varlink::Reply::parameters(None)) } } -impl<'a> Call_Bar for varlink::Call<'a> {} +impl Call_Bar for varlink::Call<'_> {} #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct r#Foo_Args_enum { pub r#b: bool, @@ -305,7 +305,7 @@ pub trait Call_Foo: VarlinkCallError { ) } } -impl<'a> Call_Foo for varlink::Call<'a> {} +impl Call_Foo for varlink::Call<'_> {} #[allow(dead_code)] pub trait VarlinkInterface { fn bar(&self, call: &mut dyn Call_Bar) -> varlink::Result<()>; diff --git a/varlink_parser/src/format.rs b/varlink_parser/src/format.rs index 99f12f8..c77b466 100644 --- a/varlink_parser/src/format.rs +++ b/varlink_parser/src/format.rs @@ -13,7 +13,7 @@ pub trait FormatColored { fn get_multiline_colored(&self, indent: usize, max: usize) -> String; } -impl<'a> Format for VTypeExt<'a> { +impl Format for VTypeExt<'_> { fn get_oneline(&self) -> String { match *self { VTypeExt::Plain(VType::Bool) => "bool".into(), @@ -46,7 +46,7 @@ impl<'a> Format for VTypeExt<'a> { } } -impl<'a> FormatColored for VTypeExt<'a> { +impl FormatColored for VTypeExt<'_> { fn get_oneline_colored(&self) -> String { match *self { VTypeExt::Plain(VType::Bool) => "bool".cyan().to_string(), @@ -83,13 +83,13 @@ impl<'a> FormatColored for VTypeExt<'a> { } } -impl<'a> fmt::Display for VTypeExt<'a> { +impl fmt::Display for VTypeExt<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(&self.get_oneline()) } } -impl<'a> Format for VStructOrEnum<'a> { +impl Format for VStructOrEnum<'_> { fn get_oneline(&self) -> String { match *self { VStructOrEnum::VStruct(ref v) => v.get_oneline(), @@ -105,7 +105,7 @@ impl<'a> Format for VStructOrEnum<'a> { } } -impl<'a> FormatColored for VStructOrEnum<'a> { +impl FormatColored for VStructOrEnum<'_> { fn get_oneline_colored(&self) -> String { match *self { VStructOrEnum::VStruct(ref v) => v.get_oneline_colored(), @@ -121,13 +121,13 @@ impl<'a> FormatColored for VStructOrEnum<'a> { } } -impl<'a> fmt::Display for VStructOrEnum<'a> { +impl fmt::Display for VStructOrEnum<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(&self.get_oneline()) } } -impl<'a> Format for Argument<'a> { +impl Format for Argument<'_> { fn get_oneline(&self) -> String { format!("{}: {}", self.name, self.vtype) } @@ -137,7 +137,7 @@ impl<'a> Format for Argument<'a> { } } -impl<'a> FormatColored for Argument<'a> { +impl FormatColored for Argument<'_> { fn get_oneline_colored(&self) -> String { format!("{}: {}", self.name, self.vtype.get_oneline_colored()) } @@ -151,13 +151,13 @@ impl<'a> FormatColored for Argument<'a> { } } -impl<'a> fmt::Display for Argument<'a> { +impl fmt::Display for Argument<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(&self.get_oneline()) } } -impl<'a> fmt::Display for VStruct<'a> { +impl fmt::Display for VStruct<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "(")?; let mut iter = self.elts.iter(); @@ -171,7 +171,7 @@ impl<'a> fmt::Display for VStruct<'a> { } } -impl<'a> Format for VStruct<'a> { +impl Format for VStruct<'_> { fn get_oneline(&self) -> String { let mut f = String::new(); @@ -224,7 +224,7 @@ impl<'a> Format for VStruct<'a> { } } -impl<'a> FormatColored for VStruct<'a> { +impl FormatColored for VStruct<'_> { fn get_oneline_colored(&self) -> String { let mut f = String::new(); @@ -287,13 +287,13 @@ impl<'a> FormatColored for VStruct<'a> { } } -impl<'a> fmt::Display for VEnum<'a> { +impl fmt::Display for VEnum<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(&self.get_oneline()) } } -impl<'a> Format for VEnum<'a> { +impl Format for VEnum<'_> { fn get_oneline(&self) -> String { let mut f = String::new(); @@ -325,7 +325,7 @@ impl<'a> Format for VEnum<'a> { } } -impl<'a> FormatColored for VEnum<'a> { +impl FormatColored for VEnum<'_> { fn get_oneline_colored(&self) -> String { self.get_oneline() } @@ -335,13 +335,13 @@ impl<'a> FormatColored for VEnum<'a> { } } -impl<'a> fmt::Display for IDL<'a> { +impl fmt::Display for IDL<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(&self.get_multiline(0, 80)) } } -impl<'a> Format for IDL<'a> { +impl Format for IDL<'_> { fn get_oneline(&self) -> String { let mut f = String::new(); @@ -542,7 +542,7 @@ impl<'a> Format for IDL<'a> { } } -impl<'a> FormatColored for IDL<'a> { +impl FormatColored for IDL<'_> { fn get_oneline_colored(&self) -> String { let mut f = String::new(); diff --git a/varlink_stdinterfaces/src/org_varlink_service.rs b/varlink_stdinterfaces/src/org_varlink_service.rs index 3371bbb..347482d 100644 --- a/varlink_stdinterfaces/src/org_varlink_service.rs +++ b/varlink_stdinterfaces/src/org_varlink_service.rs @@ -238,7 +238,7 @@ pub trait Call_GetInfo: varlink::CallTrait { } } -impl<'a> Call_GetInfo for varlink::Call<'a> {} +impl Call_GetInfo for varlink::Call<'_> {} #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] pub struct GetInterfaceDescription_Reply { @@ -258,7 +258,7 @@ pub trait Call_GetInterfaceDescription: varlink::CallTrait { } } -impl<'a> Call_GetInterfaceDescription for varlink::Call<'a> {} +impl Call_GetInterfaceDescription for varlink::Call<'_> {} pub trait VarlinkInterface { fn get_info(&self, call: &mut dyn Call_GetInfo) -> varlink::Result<()>; From 03437e95a2730a31acd20302a348feced0ff5e4d Mon Sep 17 00:00:00 2001 From: Zeeshan Ali Khan Date: Mon, 2 Dec 2024 13:33:43 +0100 Subject: [PATCH 2/2] Switch from long unmaintained actions-rs Everyone use dtolnay/rust-toolchain these days. --- .github/workflows/CI.yml | 3 +-- .github/workflows/lint.yml | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 635b5d6..cfeafaa 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,10 +35,9 @@ jobs: steps: - uses: actions/checkout@v1 - name: Install toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.version }} - override: true components: rustfmt, clippy - name: Build run: cargo build --verbose diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fa08a10..bd8dd9f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,12 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: components: rustfmt toolchain: stable - profile: minimal - override: true - uses: actions-rs/cargo@v1 with: command: fmt @@ -31,12 +29,10 @@ jobs: runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: components: clippy toolchain: stable - profile: minimal - override: true - uses: actions-rs/cargo@v1 with: command: clippy