From db3706dafa5d1146d9173bb71493fc0ad88f805c Mon Sep 17 00:00:00 2001 From: Sunli Date: Thu, 30 Dec 2021 10:16:49 +0800 Subject: [PATCH] Clippy --- CHANGELOG.md | 1 + README.md | 1 + parser/src/types/executable.rs | 17 +++++++---------- src/error.rs | 1 + src/look_ahead.rs | 1 + src/request.rs | 3 +++ 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1372807..ae1c81b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [3.0.19] 2021-12-28 - Add `InputType` / `OutputType` support for `hashbrown` crate. +- Bump actix-web from `4.0.0-beta.14` to `4.0.0-beta.18`. [#768](https://github.com/async-graphql/async-graphql/pull/768) ## [3.0.18] 2021-12-26 diff --git a/README.md b/README.md index 9b069e59..aa4f54fd 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ This crate offers the following features, all of which are not activated by defa - `decimal`: Integrate with the [`rust_decimal` crate](https://crates.io/crates/rust_decimal). - `cbor`: Support for [serde_cbor](https://crates.io/crates/serde_cbor). - `smol_str`: Integrate with the [`smol_str` crate](https://crates.io/crates/smol_str). +- `hashbrown`: Integrate with the [`hashbrown` crate](https://github.com/rust-lang/hashbrown). ## Apollo Studio diff --git a/parser/src/types/executable.rs b/parser/src/types/executable.rs index 0e70b13a..15afed8b 100644 --- a/parser/src/types/executable.rs +++ b/parser/src/types/executable.rs @@ -126,16 +126,13 @@ impl VariableDefinition { /// `Value::Null` if it is nullable and `None` otherwise. #[must_use] pub fn default_value(&self) -> Option<&ConstValue> { - self.default_value - .as_ref() - .map(|value| &value.node) - .or_else(|| { - if self.var_type.node.nullable { - Some(&ConstValue::Null) - } else { - None - } - }) + self.default_value.as_ref().map(|value| &value.node).or({ + if self.var_type.node.nullable { + Some(&ConstValue::Null) + } else { + None + } + }) } } diff --git a/src/error.rs b/src/error.rs index 8e295dbe..69beb10d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -110,6 +110,7 @@ impl ServerError { } #[doc(hidden)] + #[must_use] pub fn with_path(self, path: Vec) -> Self { Self { path, ..self } } diff --git a/src/look_ahead.rs b/src/look_ahead.rs index 440ed9e2..90844c54 100644 --- a/src/look_ahead.rs +++ b/src/look_ahead.rs @@ -29,6 +29,7 @@ impl<'a> Lookahead<'a> { /// /// For example, calling `.field("a")` on `{ a { b } }` will return a lookahead that /// represents `{ b }`. + #[must_use] pub fn field(&self, name: &str) -> Self { let mut fields = Vec::new(); for field in &self.fields { diff --git a/src/request.rs b/src/request.rs index 33fb8440..4999c6cd 100644 --- a/src/request.rs +++ b/src/request.rs @@ -59,6 +59,7 @@ impl Request { } /// Specify the operation name of the request. + #[must_use] pub fn operation_name>(self, name: T) -> Self { Self { operation_name: Some(name.into()), @@ -67,6 +68,7 @@ impl Request { } /// Specify the variables. + #[must_use] pub fn variables(self, variables: Variables) -> Self { Self { variables, ..self } } @@ -78,6 +80,7 @@ impl Request { } /// Disable introspection queries for this request. + #[must_use] pub fn disable_introspection(mut self) -> Self { self.disable_introspection = true; self