Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: Port to satisfy latest clippy #115

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions examples/more/src/org_example_more.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>,
Expand All @@ -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 {}
Expand All @@ -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,
Expand All @@ -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<()>;
Expand Down
6 changes: 3 additions & 3 deletions examples/ping/src/org_example_ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {}
Expand All @@ -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<()>;
Expand Down
4 changes: 2 additions & 2 deletions varlink/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -1512,6 +1512,6 @@ impl ConnectionHandler for VarlinkService {
}
}

return Ok((bufreader.buffer().to_vec(), upgraded_iface));
Ok((bufreader.buffer().to_vec(), upgraded_iface))
}
}
4 changes: 2 additions & 2 deletions varlink_generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -794,7 +794,7 @@ fn generate_error_code(
));
}
ts.extend(quote!(
impl<'a> VarlinkCallError for varlink::Call<'a> {}
impl VarlinkCallError for varlink::Call<'_> {}
));
}

Expand Down
6 changes: 3 additions & 3 deletions varlink_generator/tests/org.example.complex.rs_out
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<()>;
Expand Down
36 changes: 18 additions & 18 deletions varlink_parser/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand All @@ -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(),
Expand All @@ -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)
}
Expand All @@ -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())
}
Expand All @@ -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();
Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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()
}
Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions varlink_stdinterfaces/src/org_varlink_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<()>;
Expand Down
Loading