]> git.lizzy.rs Git - rust.git/blobdiff - crates/ide/src/syntax_highlighting/html.rs
Better names
[rust.git] / crates / ide / src / syntax_highlighting / html.rs
index 44f611b25d1af383c01bf3156c368275c3aadc51..0ee7bc96e21c62f0aa69b22ebb83f3f26317d05a 100644 (file)
@@ -20,26 +20,26 @@ fn rainbowify(seed: u64) -> String {
         )
     }
 
-    let ranges = highlight(db, file_id, None, false);
+    let hl_ranges = highlight(db, file_id, None, false);
     let text = parse.tree().syntax().to_string();
     let mut buf = String::new();
     buf.push_str(&STYLE);
     buf.push_str("<pre><code>");
-    for range in &ranges {
-        let curr = &text[range.range];
-        if range.highlight.is_empty() {
-            format_to!(buf, "{}", html_escape(curr));
+    for r in &hl_ranges {
+        let chunk = html_escape(&text[r.range]);
+        if r.highlight.is_empty() {
+            format_to!(buf, "{}", chunk);
             continue;
         }
 
-        let class = range.highlight.to_string().replace('.', " ");
-        let color = match (rainbow, range.binding_hash) {
+        let class = r.highlight.to_string().replace('.', " ");
+        let color = match (rainbow, r.binding_hash) {
             (true, Some(hash)) => {
                 format!(" data-binding-hash=\"{}\" style=\"color: {};\"", hash, rainbowify(hash))
             }
             _ => "".into(),
         };
-        format_to!(buf, "<span class=\"{}\"{}>{}</span>", class, color, html_escape(curr));
+        format_to!(buf, "<span class=\"{}\"{}>{}</span>", class, color, chunk);
     }
     buf.push_str("</code></pre>");
     buf