Skip to content

editorconfig + clippy + PartialEq #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.rs]
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 4
2 changes: 1 addition & 1 deletion src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub(crate) struct Formatter<'a> {
///
/// Currently we only have indentation configured, other things might be
/// added later (such as minification).
#[derive(Debug)]
#[derive(Debug, PartialEq)]
pub struct Style {
indent: u32,
}
Expand Down
2 changes: 1 addition & 1 deletion src/query_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl Displayable for Value {
Value::Object(ref items) => {
f.write("{");
let mut first = true;
for (ref name, ref value) in items.iter() {
for (name, value) in items.iter() {
if first {
first = false;
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/query_grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ pub fn value<'a>(input: &mut TokenStream<'a>)
parser(plain_value)
.or(punct("$").with(name()).map(Value::Variable))
.or(punct("[").with(many(parser(value))).skip(punct("]"))
.map(|lst| Value::List(lst)))
.map(Value::List))
.or(punct("{")
.with(many(name().skip(punct(":")).and(parser(value))))
.skip(punct("}"))
.map(|lst| Value::Object(lst)))
.map(Value::Object))
.parse_stream(input)
}

Expand All @@ -248,11 +248,11 @@ pub fn default_value<'a>(input: &mut TokenStream<'a>)
{
parser(plain_value)
.or(punct("[").with(many(parser(default_value))).skip(punct("]"))
.map(|lst| Value::List(lst)))
.map(Value::List))
.or(punct("{")
.with(many(name().skip(punct(":")).and(parser(default_value))))
.skip(punct("}"))
.map(|map| Value::Object(map)))
.map(Value::Object))
.parse_stream(input)
}

Expand Down
6 changes: 3 additions & 3 deletions src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ pub struct Token<'a> {
pub value: &'a str,
}

#[derive(Debug)]
#[derive(Debug, PartialEq)]
pub struct TokenStream<'a> {
buf: &'a str,
position: Pos,
off: usize,
next_state: Option<(usize, Token<'a>, usize, Pos)>,
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct Checkpoint {
position: Pos,
off: usize,
Expand Down Expand Up @@ -85,7 +85,7 @@ impl<'a> Resetable for TokenStream<'a> {
// by tokenizer
fn check_int(value: &str) -> bool {
return value == "0" || value == "-0" ||
(!value.starts_with("0") && value != "-" && !value.starts_with("-0")
(!value.starts_with('0') && value != "-" && !value.starts_with("-0")
&& value[1..].chars().all(|x| x >= '0' && x <= '9'));
}

Expand Down