1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

Minor lints and clippies (#557)

This commit is contained in:
Yuri Astrakhan
2022-06-07 22:53:28 -04:00
committed by GitHub
parent 7a957cee6e
commit 912de4aa46
8 changed files with 19 additions and 22 deletions

View File

@ -1,6 +1,3 @@
#[macro_use]
extern crate juniper;
use actix_cors::Cors;
use actix_web::{middleware::Logger, web::Data, App, HttpServer};

View File

@ -1,3 +1,4 @@
use juniper::GraphQLInputObject;
use mysql::{from_row, params, Error as DBError, Row};
use crate::schemas::root::Context;

View File

@ -1,4 +1,6 @@
use juniper::{EmptySubscription, FieldError, FieldResult, RootNode};
use juniper::{
graphql_object, graphql_value, EmptySubscription, FieldError, FieldResult, RootNode,
};
use mysql::{from_row, params, Error as DBError, Row};
use crate::db::Pool;
@ -14,7 +16,7 @@ impl juniper::Context for Context {}
pub struct QueryRoot;
#[juniper::graphql_object(Context = Context)]
#[graphql_object(Context = Context)]
impl QueryRoot {
#[graphql(description = "List of all users")]
fn users(context: &Context) -> FieldResult<Vec<User>> {
@ -99,7 +101,7 @@ impl QueryRoot {
pub struct MutationRoot;
#[juniper::graphql_object(Context = Context)]
#[graphql_object(Context = Context)]
impl MutationRoot {
fn create_user(context: &Context, user: UserInput) -> FieldResult<User> {
let mut conn = context.dbpool.get().unwrap();

View File

@ -1,3 +1,4 @@
use juniper::{graphql_object, GraphQLInputObject};
use mysql::{from_row, params};
use crate::schemas::product::Product;
@ -18,7 +19,7 @@ pub struct UserInput {
pub email: String,
}
#[juniper::graphql_object(Context = Context)]
#[graphql_object(Context = Context)]
impl User {
fn id(&self) -> &str {
&self.id