Skip to content

Commit 84a0c51

Browse files
committed
Cargo fix + cargo clippy for wundergraph_bench
1 parent d054811 commit 84a0c51

File tree

3 files changed

+74
-106
lines changed

3 files changed

+74
-106
lines changed

wundergraph_bench/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ readme = "../README.md"
99
keywords = ["GraphQL", "ORM", "PostgreSQL", "SQLite"]
1010
categories = ["database", "web-programming"]
1111
description = "A GraphQL ORM build on top of diesel"
12+
edition = "2018"
1213

1314
[dependencies]
1415
wundergraph = {path = "../wundergraph", default-features = false, features = ["chrono"]}

wundergraph_bench/src/bin/main.rs

Lines changed: 45 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,44 @@
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]
5137
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;
5842

5943
use std::sync::Arc;
6044

@@ -81,11 +65,7 @@ use wundergraph::scalar::WundergraphScalarValue;
8165
struct 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)]
156138
fn 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();

wundergraph_bench/src/lib.rs

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,32 @@
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-
print_stdout,
32-
wrong_pub_self_convention,
33-
mut_mut,
34-
non_ascii_literal,
35-
similar_names,
36-
unicode_not_nfc,
37-
enum_glob_use,
38-
if_not_else,
39-
items_after_statements,
40-
used_underscore_binding
41-
)
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
4230
)]
4331

4432
#[macro_use]
@@ -47,10 +35,6 @@ extern crate diesel;
4735
extern crate juniper;
4836
#[macro_use]
4937
extern crate wundergraph;
50-
extern crate chrono;
51-
extern crate failure;
52-
extern crate serde;
53-
extern crate serde_json;
5438

5539
use diesel::r2d2::{ConnectionManager, PooledConnection};
5640

0 commit comments

Comments
 (0)