Clippy clean

This commit is contained in:
Sunli 2021-05-07 10:14:05 +08:00
parent e10ba3465a
commit deeedf11a6
4 changed files with 13 additions and 17 deletions

View File

@ -51,7 +51,7 @@ impl<T> Positioned<T> {
/// Create a new positioned node from the node and its position.
#[must_use]
pub const fn new(node: T, pos: Pos) -> Positioned<T> {
Positioned { node, pos }
Positioned { pos, node }
}
/// Get the inner node.

View File

@ -38,21 +38,19 @@ impl<'a> __Schema<'a> {
/// If this server supports mutation, the type that mutation operations will be rooted at.
#[inline]
async fn mutation_type(&self) -> Option<__Type<'a>> {
if let Some(ty) = &self.registry.mutation_type {
Some(__Type::new_simple(self.registry, &self.registry.types[ty]))
} else {
None
}
self.registry
.mutation_type
.as_ref()
.map(|ty| __Type::new_simple(self.registry, &self.registry.types[ty]))
}
/// If this server support subscription, the type that subscription operations will be rooted at.
#[inline]
async fn subscription_type(&self) -> Option<__Type<'a>> {
if let Some(ty) = &self.registry.subscription_type {
Some(__Type::new_simple(self.registry, &self.registry.types[ty]))
} else {
None
}
self.registry
.subscription_type
.as_ref()
.map(|ty| __Type::new_simple(self.registry, &self.registry.types[ty]))
}
/// A list of all directives supported by this server.

View File

@ -17,11 +17,9 @@ use crate::{model, Any, Context, Positioned, ServerResult, Type, Value, VisitorC
pub use cache_control::CacheControl;
fn strip_brackets(type_name: &str) -> Option<&str> {
if let Some(rest) = type_name.strip_prefix('[') {
Some(&rest[..rest.len() - 1])
} else {
None
}
type_name
.strip_prefix('[')
.map(|rest| &rest[..rest.len() - 1])
}
#[derive(Clone, Copy, PartialEq, Debug)]

View File

@ -23,8 +23,8 @@ impl<C, T, E> Edge<C, T, E> {
pub fn with_additional_fields(cursor: C, node: T, additional_fields: E) -> Self {
Self {
cursor,
additional_fields,
node,
additional_fields,
}
}
}