1
1
#![ 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
41
30
) ]
42
31
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
+
50
36
#[ macro_use]
51
37
extern 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;
58
42
59
43
use std:: sync:: Arc ;
60
44
@@ -81,11 +65,7 @@ use wundergraph::scalar::WundergraphScalarValue;
81
65
struct Opt {
82
66
#[ structopt( short = "u" , long = "db-url" ) ]
83
67
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" ) ]
89
69
socket : String ,
90
70
}
91
71
@@ -150,9 +130,11 @@ fn graphql((st, data): (State<AppState>, Json<GraphQLData>)) -> FutureResponse<H
150
130
. content_type ( "application/json" )
151
131
. body ( user) ) ,
152
132
Err ( _) => Ok ( HttpResponse :: InternalServerError ( ) . into ( ) ) ,
153
- } ) . responder ( )
133
+ } )
134
+ . responder ( )
154
135
}
155
136
137
+ #[ allow( clippy:: print_stdout) ]
156
138
fn main ( ) {
157
139
let opt = Opt :: from_args ( ) ;
158
140
let manager = ConnectionManager :: < PgConnection > :: new ( opt. database_url ) ;
@@ -162,8 +144,7 @@ fn main() {
162
144
. expect ( "Failed to init pool" ) ;
163
145
164
146
let query = wundergraph_bench:: api:: Query :: default ( ) ;
165
- let mutation =
166
- wundergraph_bench:: api:: Mutation :: default ( ) ;
147
+ let mutation = wundergraph_bench:: api:: Mutation :: default ( ) ;
167
148
let schema = wundergraph_bench:: Schema :: new ( query, mutation) ;
168
149
169
150
let sys = actix:: System :: new ( "wundergraph-bench" ) ;
@@ -179,7 +160,8 @@ fn main() {
179
160
server:: new ( move || {
180
161
App :: with_state ( AppState {
181
162
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) )
183
165
. resource ( "/graphql" , |r| r. method ( http:: Method :: GET ) . with ( graphql) )
184
166
. resource ( "/graphiql" , |r| r. method ( http:: Method :: GET ) . h ( graphiql) )
185
167
. default_resource ( |r| {
@@ -189,7 +171,8 @@ fn main() {
189
171
. finish ( )
190
172
} )
191
173
} )
192
- } ) . workers ( num_cpus:: get ( ) * 2 )
174
+ } )
175
+ . workers ( num_cpus:: get ( ) * 2 )
193
176
. bind ( & url)
194
177
. expect ( "Failed to start server" )
195
178
. start ( ) ;
0 commit comments