diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-04 23:14:46 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-04 23:14:46 +0100 |
commit | 5deb907b4321d8328978d3322b0826b781814452 (patch) | |
tree | 2baa3b75b1ef62c02617c37ba9b800c41a3dd102 /crates/ra_syntax/src | |
parent | 8bd0e844247dc28d6ceb24b00f3cc3396bd5bf03 (diff) | |
parent | aa30c4909ebb1e85f1591f465c9e2875aa4d394e (diff) |
Merge #1374
1374: Implement `cargo lint` and fix some clippy errors r=alanhdu a=alanhdu
This creates a `cargo lint` command that runs clippy with certain lints disabled. I've also gone ahead and fixed some of the lint errors, although there are many more still to go.
cc #848
Co-authored-by: Alan Du <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast/extensions.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/validation/unescape.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index e4c99784c..930b2d9fa 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -78,7 +78,7 @@ impl ast::Attr { | |||
78 | if attr.kind() == IDENT { | 78 | if attr.kind() == IDENT { |
79 | let key = attr.as_token()?.text().clone(); | 79 | let key = attr.as_token()?.text().clone(); |
80 | let val_node = tt_node.children_with_tokens().find(|t| t.kind() == STRING)?; | 80 | let val_node = tt_node.children_with_tokens().find(|t| t.kind() == STRING)?; |
81 | let val = val_node.as_token()?.text().trim_start_matches("\"").trim_end_matches("\""); | 81 | let val = val_node.as_token()?.text().trim_start_matches('"').trim_end_matches('"'); |
82 | Some((key, SmolStr::new(val))) | 82 | Some((key, SmolStr::new(val))) |
83 | } else { | 83 | } else { |
84 | None | 84 | None |
diff --git a/crates/ra_syntax/src/validation/unescape.rs b/crates/ra_syntax/src/validation/unescape.rs index 2086046b6..91dbcfae8 100644 --- a/crates/ra_syntax/src/validation/unescape.rs +++ b/crates/ra_syntax/src/validation/unescape.rs | |||
@@ -255,7 +255,7 @@ where | |||
255 | let first_non_space = str | 255 | let first_non_space = str |
256 | .bytes() | 256 | .bytes() |
257 | .position(|b| b != b' ' && b != b'\t' && b != b'\n' && b != b'\r') | 257 | .position(|b| b != b' ' && b != b'\t' && b != b'\n' && b != b'\r') |
258 | .unwrap_or(str.len()); | 258 | .unwrap_or_else(|| str.len()); |
259 | *chars = str[first_non_space..].chars() | 259 | *chars = str[first_non_space..].chars() |
260 | } | 260 | } |
261 | } | 261 | } |