More clippy and warnings. (#568)

Also, remove `dbg!()`
This commit is contained in:
Christian Legnitto 2020-03-14 08:55:06 -07:00 committed by GitHub
parent f247dbee48
commit 27e00419b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 10 deletions

View file

@ -10,6 +10,7 @@ pub struct Query;
#[juniper::graphql_object]
impl Query {
fn r#type(r#fn: MyInputType) -> Vec<String> {
let _ = r#fn;
unimplemented!()
}
}

View file

@ -343,12 +343,12 @@ where
}
/// View the underlying int value, if present.
pub fn as_int_value<'a>(&'a self) -> Option<i32> {
pub fn as_int_value(&self) -> Option<i32> {
self.as_scalar_value().and_then(|s| s.as_int())
}
/// View the underlying float value, if present.
pub fn as_float_value<'a>(&'a self) -> Option<f64> {
pub fn as_float_value(&self) -> Option<f64> {
self.as_scalar_value().and_then(|s| s.as_float())
}

View file

@ -1085,7 +1085,7 @@ mod named_operations {
#[crate::graphql_object_internal]
impl Schema {
fn a(p: Option<String>) -> &str {
dbg!(p);
let _ = p;
"b"
}
}

View file

@ -1,3 +1,5 @@
#![deny(unused_variables)]
use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject;
use crate::{
@ -10,13 +12,13 @@ use crate::{
struct Root;
#[derive(GraphQLInputObject)]
#[derive(GraphQLInputObject, Debug)]
struct DefaultName {
field_one: String,
field_two: String,
}
#[derive(GraphQLInputObject)]
#[derive(GraphQLInputObject, Debug)]
struct NoTrailingComma {
field_one: String,
field_two: String,
@ -96,6 +98,17 @@ impl Root {
a10: NamedPublic,
a11: FieldWithDefaults,
) -> i32 {
let _ = a1;
let _ = a2;
let _ = a3;
let _ = a4;
let _ = a5;
let _ = a6;
let _ = a7;
let _ = a8;
let _ = a9;
let _ = a10;
let _ = a11;
0
}
}

View file

@ -134,8 +134,8 @@ impl Root {
),
)]
fn args_with_complex_default(arg1: String, arg2: Point) -> i32 {
dbg!(arg1);
dbg!(arg2);
let _ = arg1;
let _ = arg2;
0
}
}

View file

@ -4,7 +4,7 @@ use std::borrow::Cow;
///
/// Note: needs to be public because several macros use it.
#[doc(hidden)]
pub fn to_camel_case<'a>(s: &'a str) -> Cow<'_, str> {
pub fn to_camel_case(s: &'_ str) -> Cow<'_, str> {
let mut dest = Cow::Borrowed(s);
for (i, part) in s.split('_').enumerate() {

View file

@ -206,11 +206,13 @@ pub fn impl_input_object(ast: &syn::DeriveInput, is_internal: bool) -> TokenStre
e.to_tokens(&mut tokens);
Some(tokens)
}
Err(_) => {
Err(e) => {
let _ = e;
panic!("#graphql(default = ?) must be a valid Rust expression inside a string");
}
},
Err(_) => {
Err(e) => {
let _ = e;
panic!("#graphql(default = ?) must be a valid Rust expression inside a string");
}
},