From eceaf94f1936436e33ae235ca65bf2a6d4f77da5 Mon Sep 17 00:00:00 2001
From: Kirill Bulatov <mail4score@gmail.com>
Date: Tue, 18 Feb 2020 15:32:19 +0200
Subject: More manual clippy fixes

---
 crates/ra_parser/src/grammar/items.rs | 2 +-
 crates/ra_parser/src/parser.rs        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'crates/ra_parser/src')

diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 54284c933..f8b43866c 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -21,7 +21,7 @@ use super::*;
 // struct S;
 pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) {
     attributes::inner_attributes(p);
-    while !p.at(EOF) && !(stop_on_r_curly && p.at(T!['}'])) {
+    while !(stop_on_r_curly && p.at(T!['}']) || p.at(EOF)) {
         item_or_macro(p, stop_on_r_curly, ItemFlavor::Mod)
     }
 }
diff --git a/crates/ra_parser/src/parser.rs b/crates/ra_parser/src/parser.rs
index 1071c46dc..76e2d4f7d 100644
--- a/crates/ra_parser/src/parser.rs
+++ b/crates/ra_parser/src/parser.rs
@@ -126,13 +126,13 @@ impl<'t> Parser<'t> {
     }
 
     fn at_composite2(&self, n: usize, k1: SyntaxKind, k2: SyntaxKind) -> bool {
-        let t1 = self.token_source.lookahead_nth(n + 0);
+        let t1 = self.token_source.lookahead_nth(n);
         let t2 = self.token_source.lookahead_nth(n + 1);
         t1.kind == k1 && t1.is_jointed_to_next && t2.kind == k2
     }
 
     fn at_composite3(&self, n: usize, k1: SyntaxKind, k2: SyntaxKind, k3: SyntaxKind) -> bool {
-        let t1 = self.token_source.lookahead_nth(n + 0);
+        let t1 = self.token_source.lookahead_nth(n);
         let t2 = self.token_source.lookahead_nth(n + 1);
         let t3 = self.token_source.lookahead_nth(n + 2);
         (t1.kind == k1 && t1.is_jointed_to_next)
-- 
cgit v1.2.3