Skip to content

Commit fe82e17

Browse files
authored
Merge pull request #4 from Keats/housekeeping
editorconfig + clippy + PartialEq
2 parents 088eb93 + 9f8cf63 commit fe82e17

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[*.rs]
2+
end_of_line = lf
3+
charset = utf-8
4+
indent_style = space
5+
indent_size = 4

src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub(crate) struct Formatter<'a> {
1111
///
1212
/// Currently we only have indentation configured, other things might be
1313
/// added later (such as minification).
14-
#[derive(Debug)]
14+
#[derive(Debug, PartialEq)]
1515
pub struct Style {
1616
indent: u32,
1717
}

src/query_format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl Displayable for Value {
260260
Value::Object(ref items) => {
261261
f.write("{");
262262
let mut first = true;
263-
for (ref name, ref value) in items.iter() {
263+
for (name, value) in items.iter() {
264264
if first {
265265
first = false;
266266
} else {

src/query_grammar.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ pub fn value<'a>(input: &mut TokenStream<'a>)
235235
parser(plain_value)
236236
.or(punct("$").with(name()).map(Value::Variable))
237237
.or(punct("[").with(many(parser(value))).skip(punct("]"))
238-
.map(|lst| Value::List(lst)))
238+
.map(Value::List))
239239
.or(punct("{")
240240
.with(many(name().skip(punct(":")).and(parser(value))))
241241
.skip(punct("}"))
242-
.map(|lst| Value::Object(lst)))
242+
.map(Value::Object))
243243
.parse_stream(input)
244244
}
245245

@@ -248,11 +248,11 @@ pub fn default_value<'a>(input: &mut TokenStream<'a>)
248248
{
249249
parser(plain_value)
250250
.or(punct("[").with(many(parser(default_value))).skip(punct("]"))
251-
.map(|lst| Value::List(lst)))
251+
.map(Value::List))
252252
.or(punct("{")
253253
.with(many(name().skip(punct(":")).and(parser(default_value))))
254254
.skip(punct("}"))
255-
.map(|map| Value::Object(map)))
255+
.map(Value::Object))
256256
.parse_stream(input)
257257
}
258258

src/tokenizer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ pub struct Token<'a> {
2323
pub value: &'a str,
2424
}
2525

26-
#[derive(Debug)]
26+
#[derive(Debug, PartialEq)]
2727
pub struct TokenStream<'a> {
2828
buf: &'a str,
2929
position: Pos,
3030
off: usize,
3131
next_state: Option<(usize, Token<'a>, usize, Pos)>,
3232
}
3333

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

0 commit comments

Comments
 (0)