Skip to content

Commit 02d1dc7

Browse files
committed
Using rustfix to convert to edition 2018
1 parent 03eed30 commit 02d1dc7

15 files changed

+50
-47
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ homepage = "https://github.com/graphql-rust/graphql-parser"
1212
documentation = "https://docs.rs/graphql-parser"
1313
version = "0.2.3"
1414
authors = ["Paul Colomiets <[email protected]>"]
15+
edition = "2018"
1516

1617
[dependencies]
1718
combine = "3.2.0"

src/common.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use combine::easy::Error;
55
use combine::error::StreamError;
66
use combine::combinator::{many, many1, optional, position, choice};
77

8-
use tokenizer::{Kind as T, Token, TokenStream};
9-
use helpers::{punct, ident, kind, name};
10-
use position::Pos;
8+
use crate::tokenizer::{Kind as T, Token, TokenStream};
9+
use crate::helpers::{punct, ident, kind, name};
10+
use crate::position::Pos;
1111

1212
/// Text abstracts over types that hold a string value.
1313
/// It is used to make the AST generic over the string type.

src/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Formatting graphql
22
use std::default::Default;
33

4-
use common::Directive;
4+
use crate::common::Directive;
55

66

77
#[derive(Debug, PartialEq)]
@@ -131,7 +131,7 @@ impl<'a> Formatter<'a> {
131131
}
132132

133133
pub(crate) fn format_directives<'a, T>(dirs: &[Directive<'a, T>], f: &mut Formatter)
134-
where T: ::common::Text<'a>,
134+
where T: crate::common::Text<'a>,
135135
{
136136
for dir in dirs {
137137
f.write(" ");

src/helpers.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use combine::{Parser, ConsumedResult, satisfy, StreamOnce};
44
use combine::error::{Tracked};
55
use combine::stream::easy::{Error, Errors, Info};
66

7-
use tokenizer::{TokenStream, Kind, Token};
8-
use position::Pos;
7+
use crate::tokenizer::{TokenStream, Kind, Token};
8+
use crate::position::Pos;
99

1010
use super::common::{Text};
1111

@@ -20,7 +20,7 @@ pub struct TokenMatch<'a> {
2020
pub struct NameMatch<'a, T>
2121
where T: Text<'a>
2222
{
23-
phantom: PhantomData<(&'a T)>,
23+
phantom: PhantomData<&'a T>,
2424
}
2525

2626
#[derive(Debug, Clone)]

src/lib.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
//!
9494
#![warn(missing_debug_implementations)]
9595

96-
extern crate combine;
9796
#[macro_use] extern crate failure;
9897
#[cfg(test)] #[macro_use] extern crate pretty_assertions;
9998

@@ -107,7 +106,7 @@ mod helpers;
107106
pub mod query;
108107
pub mod schema;
109108

110-
pub use query::parse_query;
111-
pub use schema::parse_schema;
112-
pub use position::Pos;
113-
pub use format::Style;
109+
pub use crate::query::parse_query;
110+
pub use crate::schema::parse_schema;
111+
pub use crate::position::Pos;
112+
pub use crate::format::Style;

src/query/ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
//!
66
//! [graphql grammar]: http://facebook.github.io/graphql/October2016/#sec-Appendix-Grammar-Summary
77
//!
8-
use position::Pos;
9-
pub use common::{Directive, Number, Value, Text, Type};
8+
use crate::position::Pos;
9+
pub use crate::common::{Directive, Number, Value, Text, Type};
1010

1111
/// Root of query data
1212
#[derive(Debug, Clone, PartialEq)]

src/query/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use combine::easy::Errors;
22

3-
use tokenizer::Token;
4-
use position::Pos;
3+
use crate::tokenizer::Token;
4+
use crate::position::Pos;
55

66
pub type InternalError<'a> = Errors<Token<'a>, Token<'a>, Pos>;
77

src/query/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::fmt;
22

3-
use ::format::{Displayable, Formatter, Style, format_directives};
3+
use crate::format::{Displayable, Formatter, Style, format_directives};
44

5-
use query::ast::*;
5+
use crate::query::ast::*;
66

77

88
impl<'a, T: Text<'a>> Document<'a, T>

src/query/grammar.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use combine::{parser, ParseResult, Parser};
22
use combine::combinator::{many1, eof, optional, position};
33

4-
use common::{Directive};
5-
use common::{directives, arguments, default_value, parse_type};
6-
use tokenizer::{TokenStream};
7-
use helpers::{punct, ident, name};
8-
use query::error::{ParseError};
9-
use query::ast::*;
4+
use crate::common::{Directive};
5+
use crate::common::{directives, arguments, default_value, parse_type};
6+
use crate::tokenizer::{TokenStream};
7+
use crate::helpers::{punct, ident, name};
8+
use crate::query::error::{ParseError};
9+
use crate::query::ast::*;
1010

1111
pub fn field<'a, S>(input: &mut TokenStream<'a>)
1212
-> ParseResult<Field<'a, S>, TokenStream<'a>>
@@ -208,8 +208,8 @@ pub fn parse_query<'a, S>(s: &'a str) -> Result<Document<'a, S>, ParseError>
208208

209209
#[cfg(test)]
210210
mod test {
211-
use position::Pos;
212-
use query::grammar::*;
211+
use crate::position::Pos;
212+
use crate::query::grammar::*;
213213
use super::parse_query;
214214

215215
fn ast(s: &str) -> Document<String> {

src/schema/ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::str::FromStr;
22

3-
pub use common::{Directive, Type, Value, Text};
4-
use position::Pos;
3+
pub use crate::common::{Directive, Type, Value, Text};
4+
use crate::position::Pos;
55

66
#[derive(Debug, Clone, Default, PartialEq)]
77
pub struct Document<'a, T: Text<'a>>

src/schema/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use combine::easy::Errors;
22

3-
use tokenizer::Token;
4-
use position::Pos;
3+
use crate::tokenizer::Token;
4+
use crate::position::Pos;
55

66
pub type InternalError<'a> = Errors<Token<'a>, Token<'a>, Pos>;
77

src/schema/format.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::fmt;
22

3-
use ::format::{Displayable, Formatter, Style, format_directives};
4-
use ::common::Text;
3+
use crate::format::{Displayable, Formatter, Style, format_directives};
4+
use crate::common::Text;
55

6-
use schema::ast::*;
6+
use crate::schema::ast::*;
77

88

99
impl<'a, T> Document<'a, T>

src/schema/grammar.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use combine::combinator::{many, many1, eof, optional, position, choice};
55
use combine::combinator::{sep_by1};
66
use failure::Fail;
77

8-
use tokenizer::{Kind as T, Token, TokenStream};
9-
use helpers::{punct, ident, kind, name};
10-
use common::{directives, string, default_value, parse_type, Text};
11-
use schema::error::{ParseError};
12-
use schema::ast::*;
8+
use crate::tokenizer::{Kind as T, Token, TokenStream};
9+
use crate::helpers::{punct, ident, kind, name};
10+
use crate::common::{directives, string, default_value, parse_type, Text};
11+
use crate::schema::error::{ParseError};
12+
use crate::schema::ast::*;
1313

1414

1515
pub fn schema<'a, S>(input: &mut TokenStream<'a>)
@@ -510,9 +510,9 @@ pub fn described_definition<'a, T>(input: &mut TokenStream<'a>)
510510
// that means parser will need to backtrace, and that in turn
511511
// means that error reporting is bad (along with performance)
512512
.map(|(descr, mut def)| {
513-
use schema::ast::TypeDefinition::*;
514-
use schema::ast::Definition::*;
515-
use schema::ast::Definition::{TypeDefinition as T};
513+
use crate::schema::ast::TypeDefinition::*;
514+
use crate::schema::ast::Definition::*;
515+
use crate::schema::ast::Definition::{TypeDefinition as T};
516516
match def {
517517
T(Scalar(ref mut s)) => s.description = descr,
518518
T(Object(ref mut o)) => o.description = descr,
@@ -574,8 +574,8 @@ pub fn parse_schema<'a, T>(s: &'a str) -> Result<Document<'a, T>, ParseError>
574574

575575
#[cfg(test)]
576576
mod test {
577-
use position::Pos;
578-
use schema::grammar::*;
577+
use crate::position::Pos;
578+
use crate::schema::grammar::*;
579579
use super::parse_schema;
580580

581581
fn ast(s: &str) -> Document<String> {

src/tokenizer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use combine::error::{StreamError};
55
use combine::stream::{Resetable};
66
use combine::easy::{Error, Errors};
77

8-
use position::Pos;
8+
use crate::position::Pos;
99

1010

1111
#[derive(Debug, PartialEq, Eq, Clone, Copy)]

vagga.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,19 @@ containers:
3434
- !Install [ca-certificates, git, build-essential, vim]
3535

3636
- !TarInstall
37-
url: "https://static.rust-lang.org/dist/rust-1.38.0-x86_64-unknown-linux-gnu.tar.gz"
37+
url: "https://static.rust-lang.org/dist/rust-1.42.0-x86_64-unknown-linux-gnu.tar.gz"
3838
script: "./install.sh --prefix=/usr \
3939
--components=rustc,rust-std-x86_64-unknown-linux-gnu,cargo"
4040
- !TarInstall
41-
url: "https://static.rust-lang.org/dist/rust-std-1.38.0-wasm32-unknown-unknown.tar.gz"
41+
url: "https://static.rust-lang.org/dist/rust-std-1.42.0-wasm32-unknown-unknown.tar.gz"
4242
script: "./install.sh --prefix=/usr --components=rust-std-wasm32-unknown-unknown"
4343
- &bulk !Tar
4444
url: "https://github.com/tailhook/bulk/releases/download/v0.4.10/bulk-v0.4.10.tar.gz"
4545
sha256: 481513f8a0306a9857d045497fb5b50b50a51e9ff748909ecf7d2bda1de275ab
4646
path: /
47+
- !Sh |
48+
cargo install cargo-fix --root=/usr
49+
4750
4851
environ:
4952
HOME: /work/target

0 commit comments

Comments
 (0)