Skip to content

Commit

Permalink
chore: fix rust 1.83 lints
Browse files Browse the repository at this point in the history
  • Loading branch information
obmarg committed Nov 28, 2024
1 parent 7e2306f commit 604ecb4
Show file tree
Hide file tree
Showing 28 changed files with 111 additions and 131 deletions.
24 changes: 15 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cynic-codegen/src/fragment_derive/arguments/analyse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct Analysis<'schema, 'a> {
variants: HashSet<Rc<VariantDetails<'schema>>>,
}

impl<'schema, 'a> Analysis<'schema, 'a> {
impl<'schema> Analysis<'schema, '_> {
fn enum_variant(
&mut self,
en: schema::EnumType<'schema>,
Expand Down
4 changes: 2 additions & 2 deletions cynic-codegen/src/fragment_derive/arguments/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl ToTokens for ArgumentValueTokens<'_> {
}
}

impl<'a> VariantDetails<'a> {
impl VariantDetails<'_> {
fn ident(&self) -> syn::Ident {
format_ident!("{}{}", self.en.name, to_pascal_case(&self.variant))
}
Expand All @@ -143,7 +143,7 @@ struct VariantDetailsTokens<'a> {
schema_module: &'a syn::Path,
}

impl<'a> quote::ToTokens for VariantDetailsTokens<'a> {
impl quote::ToTokens for VariantDetailsTokens<'_> {
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
let ident = self.details.ident();
let variant_str = proc_macro2::Literal::string(&self.details.variant);
Expand Down
14 changes: 1 addition & 13 deletions cynic-codegen/src/query_variable_literals_derive/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use {
proc_macro2::TokenStream,
quote::{format_ident, quote},
syn::visit_mut::{self, VisitMut},
};
use {proc_macro2::TokenStream, quote::quote};

mod input;

Expand Down Expand Up @@ -69,11 +65,3 @@ pub fn inlineable_variables_derive_impl(
}
})
}

struct TurnLifetimesToStatic;
impl VisitMut for TurnLifetimesToStatic {
fn visit_lifetime_mut(&mut self, i: &mut syn::Lifetime) {
i.ident = format_ident!("static");
visit_mut::visit_lifetime_mut(self, i)
}
}
4 changes: 2 additions & 2 deletions cynic-codegen/src/schema/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ impl SchemaInput {
if let Some(ast) = document_from_path(path)? {
return Ok(SchemaInput::Document(ast));
}
return Err(SchemaLoadError::FileNotFound(
Err(SchemaLoadError::FileNotFound(
path.to_string_lossy().to_string(),
));
))
}

pub fn from_sdl(sdl: &str) -> Result<SchemaInput, SchemaLoadError> {
Expand Down
4 changes: 2 additions & 2 deletions cynic-codegen/src/schema/markers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<'a> TypeMarkerIdent<'a> {
}
}

impl<'a> FieldMarkerModule<'a> {
impl FieldMarkerModule<'_> {
pub fn ident(&self) -> proc_macro2::Ident {
format_ident!("{}", transform_keywords(self.type_name.as_ref()))
}
Expand All @@ -138,7 +138,7 @@ impl<'a> FieldMarkerModule<'a> {
}
}

impl<'a> FieldMarkerIdent<'a> {
impl FieldMarkerIdent<'_> {
pub fn to_path(&self, schema_module_path: &syn::Path) -> syn::Path {
let mut path = schema_module_path.clone();
path.push(self.to_rust_ident());
Expand Down
4 changes: 2 additions & 2 deletions cynic-codegen/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct Schema<'a, State> {
phantom: PhantomData<State>,
}

impl<'a> Schema<'a, Unvalidated> {
impl Schema<'_, Unvalidated> {
pub fn new(input: SchemaInput) -> Self {
let type_index: Box<dyn TypeIndex> = match input {
SchemaInput::Document(ast) => {
Expand Down Expand Up @@ -65,7 +65,7 @@ impl<'a> Schema<'a, Unvalidated> {
}
}

impl<'a> Schema<'a, Validated> {
impl Schema<'_, Validated> {
pub fn root_types(&self) -> Result<SchemaRoots<'_>, SchemaError> {
self.type_index.root_types()
}
Expand Down
8 changes: 4 additions & 4 deletions cynic-codegen/src/schema/names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ impl<'a> FieldName<'a> {
}
}

impl<'a> PartialEq<proc_macro2::Ident> for FieldName<'a> {
impl PartialEq<proc_macro2::Ident> for FieldName<'_> {
fn eq(&self, other: &proc_macro2::Ident) -> bool {
other == self.graphql_name.as_ref()
}
}

impl<'a> PartialEq<str> for FieldName<'a> {
impl PartialEq<str> for FieldName<'_> {
fn eq(&self, other: &str) -> bool {
self.graphql_name == other
}
}

impl<'a> PartialEq<String> for FieldName<'a> {
impl PartialEq<String> for FieldName<'_> {
fn eq(&self, other: &String) -> bool {
self.graphql_name.as_ref() == other
}
}

impl<'a> PartialEq<RenamableFieldIdent> for FieldName<'a> {
impl PartialEq<RenamableFieldIdent> for FieldName<'_> {
fn eq(&self, other: &RenamableFieldIdent) -> bool {
self.graphql_name == other.graphql_name()
}
Expand Down
4 changes: 2 additions & 2 deletions cynic-codegen/src/schema_for_derives/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ fn derive_from_attributes(attrs: &[Attribute]) -> Vec<Derive> {
}
};

return NestedMeta::parse_meta_list(meta_list.tokens.clone())
NestedMeta::parse_meta_list(meta_list.tokens.clone())
.unwrap_or_default()
.iter()
.filter_map(derive_for_nested_meta)
.collect();
.collect()
}

fn derive_for_nested_meta(nested: &NestedMeta) -> Option<Derive> {
Expand Down
2 changes: 1 addition & 1 deletion cynic-codegen/src/types/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum RustType<'a> {
},
}

impl<'a> RustType<'a> {
impl RustType<'_> {
pub fn into_owned(self) -> RustType<'static> {
match self {
RustType::Optional { syn, inner, span } => RustType::Optional {
Expand Down
16 changes: 8 additions & 8 deletions cynic-parser/src/executable/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ where
}
}

impl<'a, T> ExactSizeIterator for Iter<'a, T>
impl<T> ExactSizeIterator for Iter<'_, T>
where
T: IdReader,
T::Id: IdOperations,
{
}

impl<'a, T> FusedIterator for Iter<'a, T>
impl<T> FusedIterator for Iter<'_, T>
where
T: IdReader,
T::Id: IdOperations,
{
}

impl<'a, T> DoubleEndedIterator for Iter<'a, T>
impl<T> DoubleEndedIterator for Iter<'_, T>
where
T: IdReader,
T::Id: IdOperations,
Expand All @@ -92,7 +92,7 @@ where
}
}

impl<'a, T> fmt::Debug for Iter<'a, T>
impl<T> fmt::Debug for Iter<'_, T>
where
T: IdReader + Copy,
Self: Iterator,
Expand Down Expand Up @@ -133,21 +133,21 @@ where
}
}

impl<'a, T> ExactSizeIterator for IdIter<'a, T>
impl<T> ExactSizeIterator for IdIter<'_, T>
where
T: IdReader,
T::Id: IdOperations,
{
}

impl<'a, T> FusedIterator for IdIter<'a, T>
impl<T> FusedIterator for IdIter<'_, T>
where
T: IdReader,
T::Id: IdOperations,
{
}

impl<'a, T> DoubleEndedIterator for IdIter<'a, T>
impl<T> DoubleEndedIterator for IdIter<'_, T>
where
T: IdReader,
T::Id: IdOperations,
Expand All @@ -160,7 +160,7 @@ where
}
}

impl<'a, T> fmt::Debug for IdIter<'a, T>
impl<T> fmt::Debug for IdIter<'_, T>
where
T: IdReader + Copy,
Self: Iterator,
Expand Down
8 changes: 4 additions & 4 deletions cynic-parser/src/type_system/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ where
}
}

impl<'a, T> ExactSizeIterator for Iter<'a, T>
impl<T> ExactSizeIterator for Iter<'_, T>
where
T: IdReader,
T::Id: IdOperations,
{
}

impl<'a, T> FusedIterator for Iter<'a, T>
impl<T> FusedIterator for Iter<'_, T>
where
T: IdReader,
T::Id: IdOperations,
{
}

impl<'a, T> DoubleEndedIterator for Iter<'a, T>
impl<T> DoubleEndedIterator for Iter<'_, T>
where
T: IdReader,
T::Id: IdOperations,
Expand All @@ -83,7 +83,7 @@ where
}
}

impl<'a, T> fmt::Debug for Iter<'a, T>
impl<T> fmt::Debug for Iter<'_, T>
where
T: IdReader + Copy,
Self: Iterator,
Expand Down
2 changes: 1 addition & 1 deletion cynic-parser/src/values/const_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum ConstValue<'a> {
Object(ConstObject<'a>),
}

impl<'a> ConstValue<'a> {
impl ConstValue<'_> {
pub fn span(&self) -> Span {
match self {
ConstValue::Int(inner) => inner.span(),
Expand Down
8 changes: 4 additions & 4 deletions cynic-parser/src/values/scalars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::{ids::ValueId, Cursor};
#[derive(Clone, Copy)]
pub struct IntValue<'a>(pub(super) Cursor<'a, ValueId>);

impl<'a> IntValue<'a> {
impl IntValue<'_> {
pub fn as_i64(&self) -> i64 {
self.value()
}
Expand Down Expand Up @@ -56,7 +56,7 @@ impl std::fmt::Display for IntValue<'_> {
#[derive(Clone, Copy)]
pub struct FloatValue<'a>(pub(super) Cursor<'a, ValueId>);

impl<'a> FloatValue<'a> {
impl FloatValue<'_> {
pub fn value(&self) -> f64 {
let store = self.0.store;
store.lookup(self.0.id).kind.as_float().unwrap()
Expand Down Expand Up @@ -144,7 +144,7 @@ impl fmt::Display for StringValue<'_> {
#[derive(Clone, Copy)]
pub struct BooleanValue<'a>(pub(super) Cursor<'a, ValueId>);

impl<'a> BooleanValue<'a> {
impl BooleanValue<'_> {
pub fn value(&self) -> bool {
let store = self.0.store;
store.lookup(self.0.id).kind.as_boolean().unwrap()
Expand Down Expand Up @@ -189,7 +189,7 @@ impl fmt::Display for BooleanValue<'_> {
#[derive(Clone, Copy)]
pub struct NullValue<'a>(pub(super) Cursor<'a, ValueId>);

impl<'a> NullValue<'a> {
impl NullValue<'_> {
pub fn span(&self) -> Span {
let store = self.0.store;
store.lookup(self.0.id).span
Expand Down
2 changes: 1 addition & 1 deletion cynic-querygen/src/output/query_fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl<'query, 'schema> FieldArgument<'query, 'schema> {
}
}

impl<'query, 'schema> TypedValue<'query, 'schema> {
impl TypedValue<'_, '_> {
pub fn to_literal(&self, _context: LiteralContext) -> Result<String, Error> {
Ok(match self {
TypedValue::Variable {
Expand Down
2 changes: 1 addition & 1 deletion cynic-querygen/src/output/variables_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum VariablesStructField<'query, 'schema> {
NestedStruct(String),
}

impl<'query, 'schema> VariablesStructField<'query, 'schema> {
impl VariablesStructField<'_, '_> {
fn name(&self) -> String {
match self {
VariablesStructField::Variable(var) => var.name.to_snake_case(),
Expand Down
2 changes: 1 addition & 1 deletion cynic-querygen/src/query_parsing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ struct Namers<'text> {
inline_fragments: Namer<Rc<normalisation::InlineFragments<'text, 'text>>>,
}

impl<'text> Namers<'text> {
impl Namers<'_> {
pub fn new() -> Self {
Namers {
selection_sets: Namer::new(),
Expand Down
Loading

0 comments on commit 604ecb4

Please sign in to comment.