Skip to content

Commit 5f39b37

Browse files
committed
Fix warnings in juniper unit tests
1 parent 5fed670 commit 5f39b37

File tree

3 files changed

+16
-40
lines changed

3 files changed

+16
-40
lines changed

juniper/src/parser/tests/value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl Query {
5252
}
5353
}
5454

55-
fn scalar_meta<T>(name: &'static str) -> MetaType
55+
fn scalar_meta<T>(name: &'static str) -> MetaType<'static>
5656
where
5757
T: FromInputValue<DefaultScalarValue> + ParseScalarValue<DefaultScalarValue>,
5858
T::Error: IntoFieldError,

juniper/src/validation/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ pub use self::{
2020
};
2121

2222
#[cfg(test)]
23-
pub use self::test_harness::{
24-
expect_fails_fn, expect_fails_fn_with_schema, expect_fails_rule, expect_fails_rule_with_schema,
25-
expect_passes_fn, expect_passes_fn_with_schema, expect_passes_rule,
23+
pub(crate) use self::test_harness::{
24+
expect_fails_fn, expect_fails_rule, expect_fails_rule_with_schema, expect_passes_rule,
2625
expect_passes_rule_with_schema,
2726
};

juniper/src/validation/test_harness.rs

+13-36
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,13 @@ where
875875
}
876876
}
877877

878-
pub fn validate<'a, Q, M, Sub, F, S>(r: Q, m: M, s: Sub, q: &'a str, visit_fn: F) -> Vec<RuleError>
878+
pub(crate) fn validate<'a, Q, M, Sub, F, S>(
879+
r: Q,
880+
m: M,
881+
s: Sub,
882+
q: &'a str,
883+
visit_fn: F,
884+
) -> Vec<RuleError>
879885
where
880886
S: ScalarValue + 'a,
881887
Q: GraphQLType<S, TypeInfo = ()>,
@@ -931,7 +937,7 @@ where
931937
ctx.into_errors()
932938
}
933939

934-
pub fn expect_passes_rule<'a, V, F, S>(factory: F, q: &'a str)
940+
pub(crate) fn expect_passes_rule<'a, V, F, S>(factory: F, q: &'a str)
935941
where
936942
S: ScalarValue + 'a,
937943
V: Visitor<'a, S> + 'a,
@@ -940,15 +946,7 @@ where
940946
expect_passes_rule_with_schema(QueryRoot, MutationRoot, SubscriptionRoot, factory, q);
941947
}
942948

943-
pub fn expect_passes_fn<'a, F, S>(visit_fn: F, q: &'a str)
944-
where
945-
S: ScalarValue + 'a,
946-
F: FnOnce(&mut ValidatorContext<'a, S>, &'a Document<S>),
947-
{
948-
expect_passes_fn_with_schema(QueryRoot, MutationRoot, SubscriptionRoot, visit_fn, q);
949-
}
950-
951-
pub fn expect_passes_rule_with_schema<'a, Q, M, Sub, V, F, S>(
949+
pub(crate) fn expect_passes_rule_with_schema<'a, Q, M, Sub, V, F, S>(
952950
r: Q,
953951
m: M,
954952
s: Sub,
@@ -973,28 +971,7 @@ pub fn expect_passes_rule_with_schema<'a, Q, M, Sub, V, F, S>(
973971
}
974972
}
975973

976-
pub fn expect_passes_fn_with_schema<'a, Q, M, Sub, F, S>(
977-
r: Q,
978-
m: M,
979-
s: Sub,
980-
visit_fn: F,
981-
q: &'a str,
982-
) where
983-
S: ScalarValue + 'a,
984-
Q: GraphQLType<S, TypeInfo = ()>,
985-
M: GraphQLType<S, TypeInfo = ()>,
986-
Sub: GraphQLType<S, TypeInfo = ()>,
987-
F: FnOnce(&mut ValidatorContext<'a, S>, &'a Document<S>),
988-
{
989-
let errs = validate(r, m, s, q, visit_fn);
990-
991-
if !errs.is_empty() {
992-
print_errors(&errs);
993-
panic!("Expected `visit_fn` to pass, but errors found");
994-
}
995-
}
996-
997-
pub fn expect_fails_rule<'a, V, F, S>(factory: F, q: &'a str, expected_errors: &[RuleError])
974+
pub(crate) fn expect_fails_rule<'a, V, F, S>(factory: F, q: &'a str, expected_errors: &[RuleError])
998975
where
999976
S: ScalarValue + 'a,
1000977
V: Visitor<'a, S> + 'a,
@@ -1003,15 +980,15 @@ where
1003980
expect_fails_rule_with_schema(QueryRoot, MutationRoot, factory, q, expected_errors);
1004981
}
1005982

1006-
pub fn expect_fails_fn<'a, F, S>(visit_fn: F, q: &'a str, expected_errors: &[RuleError])
983+
pub(crate) fn expect_fails_fn<'a, F, S>(visit_fn: F, q: &'a str, expected_errors: &[RuleError])
1007984
where
1008985
S: ScalarValue + 'a,
1009986
F: FnOnce(&mut ValidatorContext<'a, S>, &'a Document<S>),
1010987
{
1011988
expect_fails_fn_with_schema(QueryRoot, MutationRoot, visit_fn, q, expected_errors);
1012989
}
1013990

1014-
pub fn expect_fails_rule_with_schema<'a, Q, M, V, F, S>(
991+
pub(crate) fn expect_fails_rule_with_schema<'a, Q, M, V, F, S>(
1015992
r: Q,
1016993
m: M,
1017994
factory: F,
@@ -1048,7 +1025,7 @@ pub fn expect_fails_rule_with_schema<'a, Q, M, V, F, S>(
10481025
}
10491026
}
10501027

1051-
pub fn expect_fails_fn_with_schema<'a, Q, M, F, S>(
1028+
pub(crate) fn expect_fails_fn_with_schema<'a, Q, M, F, S>(
10521029
r: Q,
10531030
m: M,
10541031
visit_fn: F,

0 commit comments

Comments
 (0)