Skip to content

Commit

Permalink
Address nightly clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon committed Apr 6, 2024
1 parent 46af9aa commit ea3e618
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions gdnative-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ mod header_binding {
mod api_wrapper {
use proc_macro2::{Ident, TokenStream};
use quote::{format_ident, quote, ToTokens};
use std::convert::AsRef;
use std::fs::File;
use std::io::Write as _;
use std::path;
Expand Down Expand Up @@ -392,44 +391,44 @@ mod api_wrapper {
}
}

// Used to convert [String, String] in JSON into the Argument struct.
impl Deserialize for Argument {
fn begin(out: &mut Option<Self>) -> &mut dyn de::Visitor {
impl de::Visitor for Place<Argument> {
fn seq(&mut self) -> miniserde::Result<Box<dyn de::Seq + '_>> {
Ok(Box::new(ArgumentBuilder {
out: &mut self.out,
tuple: (None, None),
}))
}
}
impl de::Visitor for Place<Argument> {
fn seq(&mut self) -> miniserde::Result<Box<dyn de::Seq + '_>> {
Ok(Box::new(ArgumentBuilder {
out: &mut self.out,
tuple: (None, None),
}))
}
}

struct ArgumentBuilder<'a> {
out: &'a mut Option<Argument>,
tuple: (Option<String>, Option<String>),
}
struct ArgumentBuilder<'a> {
out: &'a mut Option<Argument>,
tuple: (Option<String>, Option<String>),
}

impl<'a> de::Seq for ArgumentBuilder<'a> {
fn element(&mut self) -> miniserde::Result<&mut dyn de::Visitor> {
if self.tuple.0.is_none() {
Ok(Deserialize::begin(&mut self.tuple.0))
} else if self.tuple.1.is_none() {
Ok(Deserialize::begin(&mut self.tuple.1))
} else {
Err(miniserde::Error)
}
}
impl<'a> de::Seq for ArgumentBuilder<'a> {
fn element(&mut self) -> miniserde::Result<&mut dyn de::Visitor> {
if self.tuple.0.is_none() {
Ok(Deserialize::begin(&mut self.tuple.0))
} else if self.tuple.1.is_none() {
Ok(Deserialize::begin(&mut self.tuple.1))
} else {
Err(miniserde::Error)
}
}

fn finish(&mut self) -> miniserde::Result<()> {
if let (Some(a), Some(b)) = (self.tuple.0.take(), self.tuple.1.take()) {
*self.out = Some(Argument { type_: a, name: b });
Ok(())
} else {
Err(miniserde::Error)
}
}
fn finish(&mut self) -> miniserde::Result<()> {
if let (Some(a), Some(b)) = (self.tuple.0.take(), self.tuple.1.take()) {
*self.out = Some(Argument { type_: a, name: b });
Ok(())
} else {
Err(miniserde::Error)
}
}
}

// Used to convert [String, String] in JSON into the Argument struct.
impl Deserialize for Argument {
fn begin(out: &mut Option<Self>) -> &mut dyn de::Visitor {
Place::new(out)
}
}
Expand Down

0 comments on commit ea3e618

Please sign in to comment.