From 61f3a438d3a729a6be941bca1ff4c6a97a33f221 Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Mon, 15 Oct 2018 17:44:23 -0400 Subject: Cargo Format Run `cargo fmt` and ignore generated files --- crates/ra_syntax/src/lexer/mod.rs | 16 ++++++++++------ crates/ra_syntax/src/lexer/ptr.rs | 8 ++++---- crates/ra_syntax/src/lexer/strings.rs | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'crates/ra_syntax/src/lexer') diff --git a/crates/ra_syntax/src/lexer/mod.rs b/crates/ra_syntax/src/lexer/mod.rs index 9dc0b63d6..f388da273 100644 --- a/crates/ra_syntax/src/lexer/mod.rs +++ b/crates/ra_syntax/src/lexer/mod.rs @@ -58,12 +58,16 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind { } match c { - '#' => if scan_shebang(ptr) { - return SHEBANG; - }, - '/' => if let Some(kind) = scan_comment(ptr) { - return kind; - }, + '#' => { + if scan_shebang(ptr) { + return SHEBANG; + } + } + '/' => { + if let Some(kind) = scan_comment(ptr) { + return kind; + } + } _ => (), } diff --git a/crates/ra_syntax/src/lexer/ptr.rs b/crates/ra_syntax/src/lexer/ptr.rs index c4708cb1c..fa79d8862 100644 --- a/crates/ra_syntax/src/lexer/ptr.rs +++ b/crates/ra_syntax/src/lexer/ptr.rs @@ -134,10 +134,10 @@ mod tests { #[test] fn test_nth_is_p() { let ptr = Ptr::new("test"); - assert!(ptr.nth_is_p(0,|c| c == 't')); - assert!(!ptr.nth_is_p(1,|c| c == 't')); - assert!(ptr.nth_is_p(3,|c| c == 't')); - assert!(!ptr.nth_is_p(150,|c| c == 't')); + assert!(ptr.nth_is_p(0, |c| c == 't')); + assert!(!ptr.nth_is_p(1, |c| c == 't')); + assert!(ptr.nth_is_p(3, |c| c == 't')); + assert!(!ptr.nth_is_p(150, |c| c == 't')); } #[test] diff --git a/crates/ra_syntax/src/lexer/strings.rs b/crates/ra_syntax/src/lexer/strings.rs index bceacdcac..5090feae6 100644 --- a/crates/ra_syntax/src/lexer/strings.rs +++ b/crates/ra_syntax/src/lexer/strings.rs @@ -71,7 +71,7 @@ pub(crate) fn scan_string(ptr: &mut Ptr) { } _ => { ptr.bump(); - }, + } } } } @@ -90,7 +90,7 @@ pub(crate) fn scan_raw_string(ptr: &mut Ptr) { while let Some(c) = ptr.bump() { if c == '"' { let mut hashes_left = hashes; - while ptr.at('#') && hashes_left > 0{ + while ptr.at('#') && hashes_left > 0 { hashes_left -= 1; ptr.bump(); } -- cgit v1.2.3