diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 606637d11b..2b1b6a4fdc 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -543,7 +543,10 @@ fn highlight_element( T![::] | T![->] | T![=>] | T![&] => HighlightTag::Operator.into(), T![@] => HighlightTag::Operator | HighlightModifier::ControlFlow, T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => { - Highlight::new(HighlightTag::Macro) + HighlightTag::Macro.into() + } + T![*] if element.parent().and_then(ast::PointerType::cast).is_some() => { + HighlightTag::Keyword.into() } T![*] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { let prefix_expr = element.parent().and_then(ast::PrefixExpr::cast)?; diff --git a/crates/ra_ide/test_data/highlight_doctest.html b/crates/ra_ide/test_data/highlight_doctest.html index 1cc17d6d01..e79e898075 100644 --- a/crates/ra_ide/test_data/highlight_doctest.html +++ b/crates/ra_ide/test_data/highlight_doctest.html @@ -51,9 +51,9 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// /// ``` /// # #![allow(unused_mut)] - /// let mut foo: Foo = Foo::new(); + /// let mut foo: Foo = Foo::new(); /// ``` - pub const fn new() -> Foo { + pub const fn new() -> Foo { Foo { bar: true } } @@ -62,14 +62,14 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// # Examples /// /// ``` - /// use x::y; + /// use x::y; /// - /// let foo = Foo::new(); + /// let foo = Foo::new(); /// /// // calls bar on foo /// assert!(foo.bar()); /// - /// let bar = foo.bar || Foo::bar; + /// let bar = foo.bar || Foo::bar; /// /// /* multi-line /// comment */ @@ -81,13 +81,13 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd /// ``` /// /// ```rust,no_run - /// let foobar = Foo::new().bar(); + /// let foobar = Foo::new().bar(); /// ``` /// /// ```sh /// echo 1 /// ``` - pub fn foo(&self) -> bool { + pub fn foo(&self) -> bool { true } } diff --git a/crates/ra_ide/test_data/highlight_injection.html b/crates/ra_ide/test_data/highlight_injection.html index 461cfc4377..18addd00d2 100644 --- a/crates/ra_ide/test_data/highlight_injection.html +++ b/crates/ra_ide/test_data/highlight_injection.html @@ -35,7 +35,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } -
fn fixture(ra_fixture: &str) {}
+
fn fixture(ra_fixture: &str) {}
 
 fn main() {
     fixture(r#"
diff --git a/crates/ra_ide/test_data/highlight_strings.html b/crates/ra_ide/test_data/highlight_strings.html
index 9f98e73e74..258bd404b2 100644
--- a/crates/ra_ide/test_data/highlight_strings.html
+++ b/crates/ra_ide/test_data/highlight_strings.html
@@ -36,14 +36,14 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 .unresolved_reference { color: #FC5555; text-decoration: wavy underline; }
 
 
macro_rules! println {
-    ($($arg:tt)*) => ({
-        $crate::io::_print($crate::format_args_nl!($($arg)*));
+    ($($arg:tt)*) => ({
+        $crate::io::_print($crate::format_args_nl!($($arg)*));
     })
 }
 #[rustc_builtin_macro]
 macro_rules! format_args_nl {
     ($fmt:expr) => {{ /* compiler built-in */ }};
-    ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
+    ($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
 }
 
 fn main() {
diff --git a/crates/ra_ide/test_data/highlight_unsafe.html b/crates/ra_ide/test_data/highlight_unsafe.html
index 88ac91f9a0..6c210bfa8b 100644
--- a/crates/ra_ide/test_data/highlight_unsafe.html
+++ b/crates/ra_ide/test_data/highlight_unsafe.html
@@ -40,15 +40,15 @@ pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
 struct HasUnsafeFn;
 
 impl HasUnsafeFn {
-    unsafe fn unsafe_method(&self) {}
+    unsafe fn unsafe_method(&self) {}
 }
 
 fn main() {
-    let x = &5 as *const usize;
+    let x = &5 as *const usize;
     unsafe {
         unsafe_fn();
         HasUnsafeFn.unsafe_method();
         let y = *(x);
-        let z = -x;
+        let z = -x;
     }
 }
\ No newline at end of file diff --git a/crates/ra_ide/test_data/highlighting.html b/crates/ra_ide/test_data/highlighting.html index 767e82f9d0..c49645b0d7 100644 --- a/crates/ra_ide/test_data/highlighting.html +++ b/crates/ra_ide/test_data/highlighting.html @@ -42,37 +42,37 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd } trait Bar { - fn bar(&self) -> i32; + fn bar(&self) -> i32; } impl Bar for Foo { - fn bar(&self) -> i32 { + fn bar(&self) -> i32 { self.x } } impl Foo { - fn baz(mut self) -> i32 { + fn baz(mut self) -> i32 { self.x } - fn qux(&mut self) { - self.x = 0; + fn qux(&mut self) { + self.x = 0; } } static mut STATIC_MUT: i32 = 0; -fn foo<'a, T>() -> T { - foo::<'a, i32>() +fn foo<'a, T>() -> T { + foo::<'a, i32>() } macro_rules! def_fn { - ($($tt:tt)*) => {$($tt)*} + ($($tt:tt)*) => {$($tt)*} } def_fn! { - fn bar() -> u32 { + fn bar() -> u32 { 100 } } @@ -87,14 +87,14 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd fn main() { println!("Hello, {}!", 92); - let mut vec = Vec::new(); + let mut vec = Vec::new(); if true { let x = 92; vec.push(Foo { x, y: 1 }); } unsafe { vec.set_len(0); - STATIC_MUT = 1; + STATIC_MUT = 1; } for e in vec { @@ -104,8 +104,8 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd noop!(noop!(1)); let mut x = 42; - let y = &mut x; - let z = &y; + let y = &mut x; + let z = &y; let Foo { x: z, y } = Foo { x: z, y }; @@ -116,13 +116,13 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd Some(T), None, } -use Option::*; +use Option::*; impl<T> Option<T> { - fn and<U>(self, other: Option<U>) -> Option<(T, U)> { + fn and<U>(self, other: Option<U>) -> Option<(T, U)> { match other { - None => unimplemented!(), - Nope => Nope, + None => unimplemented!(), + Nope => Nope, } } }
\ No newline at end of file