]> git.lizzy.rs Git - rust.git/commitdiff
Color `in` as a control keyword
authorGeorge Fraser <george@fivetran.com>
Sun, 10 May 2020 18:08:32 +0000 (11:08 -0700)
committerGeorge Fraser <george@fivetran.com>
Sun, 10 May 2020 20:07:28 +0000 (13:07 -0700)
crates/ra_ide/src/snapshots/highlighting.html
crates/ra_ide/src/syntax_highlighting.rs
crates/ra_ide/src/syntax_highlighting/tests.rs

index 4c27aade40255f703f0f65da1510fd5a7bba04f6..c67df5c39afa5a70a984087be229f53d5fe5044c 100644 (file)
@@ -63,6 +63,10 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
         <span class="static mutable">STATIC_MUT</span> = <span class="numeric_literal">1</span>;
     }
 
+    <span class="keyword control">for</span> <span class="variable declaration">e</span> <span class="keyword control">in</span> <span class="variable mutable">vec</span> {
+        <span class="comment">// Do nothing</span>
+    }
+
     <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">x</span> = <span class="numeric_literal">42</span>;
     <span class="keyword">let</span> <span class="variable declaration mutable">y</span> = &<span class="keyword">mut</span> <span class="variable mutable">x</span>;
     <span class="keyword">let</span> <span class="variable declaration">z</span> = &<span class="variable mutable">y</span>;
index d53a39f57b526963ca12ecfc3340411920f3fb26..16123c5cb4738cd52dfb827d47a41f6be7e06772 100644 (file)
@@ -408,7 +408,8 @@ fn highlight_element(
                 | T![loop]
                 | T![match]
                 | T![return]
-                | T![while] => h | HighlightModifier::ControlFlow,
+                | T![while]
+                | T![in] => h | HighlightModifier::ControlFlow,
                 T![unsafe] => h | HighlightModifier::Unsafe,
                 _ => h,
             }
index 13894869c8bfe16c07c18649413230d4813637dd..7975755b29c58075c3f3b9edc3636429ab947a2f 100644 (file)
@@ -47,6 +47,10 @@ fn main() {
         STATIC_MUT = 1;
     }
 
+    for e in vec {
+        // Do nothing
+    }
+
     let mut x = 42;
     let y = &mut x;
     let z = &y;