From 4fba518b02e36a24ed278ca82412112684c52b26 Mon Sep 17 00:00:00 2001 From: Jake Heinz Date: Tue, 10 Aug 2021 07:31:30 +0000 Subject: [PATCH] [semantic-highlighting] functions that consume are marked as HlMod::Consuming --- crates/ide/src/syntax_highlighting/highlight.rs | 2 +- .../syntax_highlighting/test_data/highlighting.html | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 555f3c5d3c..5a7683c577 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -381,7 +381,7 @@ fn highlight_def(db: &RootDatabase, krate: Option, def: Definition) h |= HlMod::Reference; } hir::Access::Shared => h |= HlMod::Reference, - _ => {} + hir::Access::Owned => h |= HlMod::Consuming, }, None => h |= HlMod::Static, } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index 88a348115b..e43119aa3b 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -79,7 +79,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd } impl Foo { - fn baz(mut self, f: Foo) -> i32 { + fn baz(mut self, f: Foo) -> i32 { f.baz(self) } @@ -98,7 +98,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd } impl FooCopy { - fn baz(self, f: FooCopy) -> u32 { + fn baz(self, f: FooCopy) -> u32 { f.baz(self) } @@ -216,7 +216,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd copy.baz(copy); let a = |x| x; - let bar = Foo::baz; + let bar = Foo::baz; let baz = (-42,); let baz = -baz.0; @@ -236,7 +236,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd 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, @@ -274,7 +274,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd pub enum Bool { True, False } impl Bool { - pub const fn to_primitive(self) -> bool { + pub const fn to_primitive(self) -> bool { matches!(self, Self::True) } }