Correctly flag 'lifetime definitions as definitions

This commit is contained in:
Aleksey Kladov 2020-02-28 16:49:46 +01:00
parent 5ebfcb9cb7
commit 56ce34c6a7
6 changed files with 47 additions and 40 deletions

View file

@ -80,7 +80,7 @@ const STYLE: &str = "
body { margin: 0; }
pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; }
.lifetime { color: #DFAF8F; font-style: italic; }
.comment { color: #7F9F7F; }
.struct, .enum { color: #7CB8BB; }
.enum_variant { color: #BDE0F3; }

View file

@ -90,8 +90,12 @@ impl fmt::Display for HighlightTag {
}
impl HighlightModifier {
const ALL: &'static [HighlightModifier] =
&[HighlightModifier::Mutable, HighlightModifier::Unsafe, HighlightModifier::Control];
const ALL: &'static [HighlightModifier] = &[
HighlightModifier::Control,
HighlightModifier::Definition,
HighlightModifier::Mutable,
HighlightModifier::Unsafe,
];
fn as_str(self) -> &'static str {
match self {

View file

@ -17,9 +17,8 @@ struct Foo {
pub y: i32,
}
fn foo<T>() -> T {
unimplemented!();
foo::<i32>();
fn foo<'a, T>() -> T {
foo::<'a, i32>()
}
macro_rules! def_fn {
@ -59,7 +58,7 @@ use Option::*;
impl<T> Option<T> {
fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
match other {
None => todo!(),
None => unimplemented!(),
Nope => Nope,
}
}
@ -130,5 +129,5 @@ fn test_ranges() {
.highlight_range(FileRange { file_id, range: TextRange::offset_len(82.into(), 1.into()) })
.unwrap();
assert_eq!(&highlights[0].highlight.to_string(), "field");
assert_eq!(&highlights[0].highlight.to_string(), "field.declaration");
}