11#![ deny( missing_debug_implementations, missing_copy_implementations) ]
2- #![ cfg_attr( feature = "cargo-clippy" , allow( renamed_and_removed_lints) ) ]
3- #![ cfg_attr( feature = "cargo-clippy" , warn( clippy) ) ]
4- // Clippy lints
5- #![ cfg_attr( feature = "cargo-clippy" , allow( type_complexity) ) ]
6- #![ cfg_attr(
7- feature = "cargo-clippy" ,
8- warn(
9- wrong_pub_self_convention,
10- used_underscore_binding,
11- use_self,
12- use_debug,
13- unseparated_literal_suffix,
14- unnecessary_unwrap,
15- unimplemented,
16- single_match_else,
17- shadow_unrelated,
18- option_map_unwrap_or_else,
19- option_map_unwrap_or,
20- needless_continue,
21- mutex_integer,
22- needless_borrow,
23- items_after_statements,
24- filter_map,
25- expl_impl_clone_on_copy,
26- else_if_without_else,
27- doc_markdown,
28- default_trait_access,
29- option_unwrap_used,
30- result_unwrap_used,
31- wrong_pub_self_convention,
32- mut_mut,
33- non_ascii_literal,
34- similar_names,
35- unicode_not_nfc,
36- enum_glob_use,
37- if_not_else,
38- items_after_statements,
39- used_underscore_binding
40- )
2+ #![ warn(
3+ clippy:: option_unwrap_used,
4+ clippy:: result_unwrap_used,
5+ clippy:: print_stdout,
6+ clippy:: wrong_pub_self_convention,
7+ clippy:: mut_mut,
8+ clippy:: non_ascii_literal,
9+ clippy:: similar_names,
10+ clippy:: unicode_not_nfc,
11+ clippy:: enum_glob_use,
12+ clippy:: if_not_else,
13+ clippy:: items_after_statements,
14+ clippy:: used_underscore_binding,
15+ clippy:: cargo_common_metadata,
16+ clippy:: dbg_macro,
17+ clippy:: doc_markdown,
18+ clippy:: filter_map,
19+ clippy:: map_flatten,
20+ clippy:: match_same_arms,
21+ clippy:: needless_borrow,
22+ clippy:: needless_pass_by_value,
23+ clippy:: option_map_unwrap_or,
24+ clippy:: option_map_unwrap_or_else,
25+ clippy:: redundant_clone,
26+ clippy:: result_map_unwrap_or_else,
27+ clippy:: unnecessary_unwrap,
28+ clippy:: unseparated_literal_suffix,
29+ clippy:: wildcard_dependencies
4130) ]
4231
43- extern crate actix;
44- extern crate actix_web;
45- extern crate diesel;
46- extern crate failure;
47- extern crate juniper;
48- extern crate structopt;
49- extern crate wundergraph;
32+ use actix;
33+
34+ use structopt;
35+
5036#[ macro_use]
5137extern crate serde;
52- extern crate chrono;
53- extern crate env_logger;
54- extern crate futures;
55- extern crate num_cpus;
56- extern crate serde_json;
57- extern crate wundergraph_bench;
38+
39+ use num_cpus;
40+ use serde_json;
41+ use wundergraph_bench;
5842
5943use std:: sync:: Arc ;
6044
@@ -81,11 +65,7 @@ use wundergraph::scalar::WundergraphScalarValue;
8165struct Opt {
8266 #[ structopt( short = "u" , long = "db-url" ) ]
8367 database_url : String ,
84- #[ structopt(
85- short = "s" ,
86- long = "socket" ,
87- default_value = "127.0.0.1:8000"
88- ) ]
68+ #[ structopt( short = "s" , long = "socket" , default_value = "127.0.0.1:8000" ) ]
8969 socket : String ,
9070}
9171
@@ -150,9 +130,11 @@ fn graphql((st, data): (State<AppState>, Json<GraphQLData>)) -> FutureResponse<H
150130 . content_type ( "application/json" )
151131 . body ( user) ) ,
152132 Err ( _) => Ok ( HttpResponse :: InternalServerError ( ) . into ( ) ) ,
153- } ) . responder ( )
133+ } )
134+ . responder ( )
154135}
155136
137+ #[ allow( clippy:: print_stdout) ]
156138fn main ( ) {
157139 let opt = Opt :: from_args ( ) ;
158140 let manager = ConnectionManager :: < PgConnection > :: new ( opt. database_url ) ;
@@ -162,8 +144,7 @@ fn main() {
162144 . expect ( "Failed to init pool" ) ;
163145
164146 let query = wundergraph_bench:: api:: Query :: default ( ) ;
165- let mutation =
166- wundergraph_bench:: api:: Mutation :: default ( ) ;
147+ let mutation = wundergraph_bench:: api:: Mutation :: default ( ) ;
167148 let schema = wundergraph_bench:: Schema :: new ( query, mutation) ;
168149
169150 let sys = actix:: System :: new ( "wundergraph-bench" ) ;
@@ -179,7 +160,8 @@ fn main() {
179160 server:: new ( move || {
180161 App :: with_state ( AppState {
181162 executor : addr. clone ( ) ,
182- } ) . resource ( "/graphql" , |r| r. method ( http:: Method :: POST ) . with ( graphql) )
163+ } )
164+ . resource ( "/graphql" , |r| r. method ( http:: Method :: POST ) . with ( graphql) )
183165 . resource ( "/graphql" , |r| r. method ( http:: Method :: GET ) . with ( graphql) )
184166 . resource ( "/graphiql" , |r| r. method ( http:: Method :: GET ) . h ( graphiql) )
185167 . default_resource ( |r| {
@@ -189,7 +171,8 @@ fn main() {
189171 . finish ( )
190172 } )
191173 } )
192- } ) . workers ( num_cpus:: get ( ) * 2 )
174+ } )
175+ . workers ( num_cpus:: get ( ) * 2 )
193176 . bind ( & url)
194177 . expect ( "Failed to start server" )
195178 . start ( ) ;
0 commit comments