Collected all clippy warnings and fixed 2

https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string
https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants

Please change `allow` -> `deny` ub src/lib.rs to see other warnings. I feel some of them are important
This commit is contained in:
Olexiy Buyanskyy 2020-10-22 09:38:35 +03:00
parent e1be5d5537
commit bd966d5ba3
3 changed files with 36 additions and 2 deletions

View File

@ -201,7 +201,7 @@ impl<'a> QueryPathNode<'a> {
let mut res = Vec::new();
self.for_each(|s| {
res.push(match s {
QueryPathSegment::Name(name) => name.to_string(),
QueryPathSegment::Name(name) => (*name).to_string(),
QueryPathSegment::Index(idx) => idx.to_string(),
});
});

View File

@ -553,7 +553,7 @@ pub fn playground_source(config: GraphQLPlaygroundConfig) -> String {
</html>
"##.replace("GRAPHQL_PLAYGROUND_CONFIG", &match serde_json::to_string(&config) {
Ok(str) => str,
_ => "{}".to_string()
Err(_) => "{}".to_string()
})
}

View File

@ -113,6 +113,40 @@
//! Now a HTML report is available at `benchmark/target/criterion/report`.
//!
#![deny(clippy::all)]
// #![deny(clippy::pedantic)]
#![deny(clippy::inefficient_to_string)]
#![deny(clippy::match_wildcard_for_single_variants)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::similar_names)]
#![allow(clippy::if_not_else)]
#![allow(clippy::doc_markdown)]
#![allow(clippy::must_use_candidate)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::needless_pass_by_value)]
#![allow(clippy::redundant_closure_for_method_calls)]
#![allow(clippy::option_if_let_else)]
#![allow(clippy::match_same_arms)]
#![allow(clippy::filter_map)]
#![allow(clippy::default_trait_access)]
#![allow(clippy::map_flatten)]
#![allow(clippy::map_unwrap_or)]
#![allow(clippy::explicit_iter_loop)]
#![allow(clippy::too_many_lines)]
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::unused_self)]
#![allow(clippy::find_map)]
#![allow(clippy::cast_lossless)]
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::implicit_hasher)]
// #![deny(clippy::nursery)]
#![allow(clippy::use_self)]
#![allow(clippy::missing_const_for_fn)]
#![allow(clippy::needless_borrow)]
#![allow(clippy::future_not_send)]
#![allow(clippy::redundant_pub_crate)]
#![allow(clippy::cognitive_complexity)]
#![allow(clippy::useless_let_if_seq)]
#![warn(missing_docs)]
#![allow(clippy::trivially_copy_pass_by_ref)]
#![recursion_limit = "256"]