Skip to content

Commit 381f414

Browse files
authored
style: Remove redundant bound (#83)
Remove `where` bound when the same bound is already specified. This solves clippy warnings like this: ``` warning: bound is defined in more than one place --> src/query/grammar.rs:169:21 | 169 | pub fn mutation<'a, T: Text<'a>>( | ^ ... 173 | T: Text<'a>, | ^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations ```
1 parent fbdfb6c commit 381f414

File tree

3 files changed

+0
-49
lines changed

3 files changed

+0
-49
lines changed

src/query/format.rs

-38
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ use crate::format::{format_directives, Displayable, Formatter, Style};
55
use crate::query::ast::*;
66

77
impl<'a, T: Text<'a>> Document<'a, T>
8-
where
9-
T: Text<'a>,
108
{
119
/// Format a document according to style
1210
pub fn format(&self, style: &Style) -> String {
@@ -24,8 +22,6 @@ fn to_string<T: Displayable>(v: &T) -> String {
2422
}
2523

2624
impl<'a, T: Text<'a>> Displayable for Document<'a, T>
27-
where
28-
T: Text<'a>,
2925
{
3026
fn display(&self, f: &mut Formatter) {
3127
for item in &self.definitions {
@@ -35,8 +31,6 @@ where
3531
}
3632

3733
impl<'a, T: Text<'a>> Displayable for Definition<'a, T>
38-
where
39-
T: Text<'a>,
4034
{
4135
fn display(&self, f: &mut Formatter) {
4236
match *self {
@@ -47,8 +41,6 @@ where
4741
}
4842

4943
impl<'a, T: Text<'a>> Displayable for OperationDefinition<'a, T>
50-
where
51-
T: Text<'a>,
5244
{
5345
fn display(&self, f: &mut Formatter) {
5446
match *self {
@@ -61,8 +53,6 @@ where
6153
}
6254

6355
impl<'a, T: Text<'a>> Displayable for FragmentDefinition<'a, T>
64-
where
65-
T: Text<'a>,
6656
{
6757
fn display(&self, f: &mut Formatter) {
6858
f.margin();
@@ -82,8 +72,6 @@ where
8272
}
8373

8474
impl<'a, T: Text<'a>> Displayable for SelectionSet<'a, T>
85-
where
86-
T: Text<'a>,
8775
{
8876
fn display(&self, f: &mut Formatter) {
8977
f.margin();
@@ -97,8 +85,6 @@ where
9785
}
9886

9987
impl<'a, T: Text<'a>> Displayable for Selection<'a, T>
100-
where
101-
T: Text<'a>,
10288
{
10389
fn display(&self, f: &mut Formatter) {
10490
match *self {
@@ -110,8 +96,6 @@ where
11096
}
11197

11298
fn format_arguments<'a, T: Text<'a>>(arguments: &[(T::Value, Value<'a, T>)], f: &mut Formatter)
113-
where
114-
T: Text<'a>,
11599
{
116100
if !arguments.is_empty() {
117101
f.start_argument_block('(');
@@ -131,8 +115,6 @@ where
131115
}
132116

133117
impl<'a, T: Text<'a>> Displayable for Field<'a, T>
134-
where
135-
T: Text<'a>,
136118
{
137119
fn display(&self, f: &mut Formatter) {
138120
f.indent();
@@ -157,8 +139,6 @@ where
157139
}
158140

159141
impl<'a, T: Text<'a>> Displayable for Query<'a, T>
160-
where
161-
T: Text<'a>,
162142
{
163143
fn display(&self, f: &mut Formatter) {
164144
f.margin();
@@ -188,8 +168,6 @@ where
188168
}
189169

190170
impl<'a, T: Text<'a>> Displayable for Mutation<'a, T>
191-
where
192-
T: Text<'a>,
193171
{
194172
fn display(&self, f: &mut Formatter) {
195173
f.margin();
@@ -219,8 +197,6 @@ where
219197
}
220198

221199
impl<'a, T: Text<'a>> Displayable for Subscription<'a, T>
222-
where
223-
T: Text<'a>,
224200
{
225201
fn display(&self, f: &mut Formatter) {
226202
f.margin();
@@ -248,8 +224,6 @@ where
248224
}
249225

250226
impl<'a, T: Text<'a>> Displayable for VariableDefinition<'a, T>
251-
where
252-
T: Text<'a>,
253227
{
254228
fn display(&self, f: &mut Formatter) {
255229
f.write("$");
@@ -264,8 +238,6 @@ where
264238
}
265239

266240
impl<'a, T: Text<'a>> Displayable for Type<'a, T>
267-
where
268-
T: Text<'a>,
269241
{
270242
fn display(&self, f: &mut Formatter) {
271243
match *self {
@@ -284,8 +256,6 @@ where
284256
}
285257

286258
impl<'a, T: Text<'a>> Displayable for Value<'a, T>
287-
where
288-
T: Text<'a>,
289259
{
290260
fn display(&self, f: &mut Formatter) {
291261
match *self {
@@ -334,8 +304,6 @@ where
334304
}
335305

336306
impl<'a, T: Text<'a>> Displayable for InlineFragment<'a, T>
337-
where
338-
T: Text<'a>,
339307
{
340308
fn display(&self, f: &mut Formatter) {
341309
f.indent();
@@ -355,8 +323,6 @@ where
355323
}
356324

357325
impl<'a, T: Text<'a>> Displayable for TypeCondition<'a, T>
358-
where
359-
T: Text<'a>,
360326
{
361327
fn display(&self, f: &mut Formatter) {
362328
match *self {
@@ -369,8 +335,6 @@ where
369335
}
370336

371337
impl<'a, T: Text<'a>> Displayable for FragmentSpread<'a, T>
372-
where
373-
T: Text<'a>,
374338
{
375339
fn display(&self, f: &mut Formatter) {
376340
f.indent();
@@ -382,8 +346,6 @@ where
382346
}
383347

384348
impl<'a, T: Text<'a>> Displayable for Directive<'a, T>
385-
where
386-
T: Text<'a>,
387349
{
388350
fn display(&self, f: &mut Formatter) {
389351
f.write("@");

src/query/grammar.rs

-10
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ where
101101
pub fn query<'a, T: Text<'a>>(
102102
input: &mut TokenStream<'a>,
103103
) -> StdParseResult<Query<'a, T>, TokenStream<'a>>
104-
where
105-
T: Text<'a>,
106104
{
107105
position()
108106
.skip(ident("query"))
@@ -132,8 +130,6 @@ type OperationCommon<'a, T: Text<'a>> = (
132130
pub fn operation_common<'a, T: Text<'a>>(
133131
input: &mut TokenStream<'a>,
134132
) -> StdParseResult<OperationCommon<'a, T>, TokenStream<'a>>
135-
where
136-
T: Text<'a>,
137133
{
138134
optional(name::<'a, T>())
139135
.and(
@@ -169,8 +165,6 @@ where
169165
pub fn mutation<'a, T: Text<'a>>(
170166
input: &mut TokenStream<'a>,
171167
) -> StdParseResult<Mutation<'a, T>, TokenStream<'a>>
172-
where
173-
T: Text<'a>,
174168
{
175169
position()
176170
.skip(ident("mutation"))
@@ -191,8 +185,6 @@ where
191185
pub fn subscription<'a, T: Text<'a>>(
192186
input: &mut TokenStream<'a>,
193187
) -> StdParseResult<Subscription<'a, T>, TokenStream<'a>>
194-
where
195-
T: Text<'a>,
196188
{
197189
position()
198190
.skip(ident("subscription"))
@@ -228,8 +220,6 @@ where
228220
pub fn fragment_definition<'a, T: Text<'a>>(
229221
input: &mut TokenStream<'a>,
230222
) -> StdParseResult<FragmentDefinition<'a, T>, TokenStream<'a>>
231-
where
232-
T: Text<'a>,
233223
{
234224
(
235225
position().skip(ident("fragment")),

src/schema/ast.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::position::Pos;
77

88
#[derive(Debug, Clone, Default, PartialEq)]
99
pub struct Document<'a, T: Text<'a>>
10-
where T: Text<'a>
1110
{
1211
pub definitions: Vec<Definition<'a, T>>,
1312
}

0 commit comments

Comments
 (0)