diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 9e3b4a2d819c..6aa7251b53b5 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -671,10 +671,6 @@ impl Function { db.function_data(self.id).params.clone() } - pub fn is_unsafe(self, db: &dyn HirDatabase) -> bool { - db.function_data(self.id).is_unsafe - } - pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { let _p = profile("Function::diagnostics"); let infer = db.infer(self.id.into()); diff --git a/crates/ra_ide/src/snapshots/highlight_injection.html b/crates/ra_ide/src/snapshots/highlight_injection.html index 3ac6c4ae57b7..748f07625316 100644 --- a/crates/ra_ide/src/snapshots/highlight_injection.html +++ b/crates/ra_ide/src/snapshots/highlight_injection.html @@ -13,7 +13,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .field { color: #94BFF3; } .function { color: #93E0E3; } .function.unsafe { color: #E28C14; } -.operator.unsafe { color: #BC8383; } +.operator.unsafe { color: #E28C14; } .parameter { color: #94BFF3; } .text { color: #DCDCCC; } .type { color: #7CB8BB; } diff --git a/crates/ra_ide/src/snapshots/highlight_strings.html b/crates/ra_ide/src/snapshots/highlight_strings.html index 8556eb850445..12a68ce625eb 100644 --- a/crates/ra_ide/src/snapshots/highlight_strings.html +++ b/crates/ra_ide/src/snapshots/highlight_strings.html @@ -13,7 +13,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .field { color: #94BFF3; } .function { color: #93E0E3; } .function.unsafe { color: #E28C14; } -.operator.unsafe { color: #BC8383; } +.operator.unsafe { color: #E28C14; } .parameter { color: #94BFF3; } .text { color: #DCDCCC; } .type { color: #7CB8BB; } diff --git a/crates/ra_ide/src/snapshots/highlight_unsafe.html b/crates/ra_ide/src/snapshots/highlight_unsafe.html deleted file mode 100644 index 692307280d73..000000000000 --- a/crates/ra_ide/src/snapshots/highlight_unsafe.html +++ /dev/null @@ -1,53 +0,0 @@ - - -
unsafe fn unsafe_fn() {}
-
-struct HasUnsafeFn;
-
-impl HasUnsafeFn {
- unsafe fn unsafe_method(&self) {}
-}
-
-fn main() {
- let x = &5 as *const usize;
- unsafe {
- unsafe_fn();
- HasUnsafeFn.unsafe_method();
- let y = *x;
- let z = -x;
- }
-}
\ No newline at end of file
diff --git a/crates/ra_ide/src/snapshots/highlighting.html b/crates/ra_ide/src/snapshots/highlighting.html
index 47403b367ebc..d093a6266132 100644
--- a/crates/ra_ide/src/snapshots/highlighting.html
+++ b/crates/ra_ide/src/snapshots/highlighting.html
@@ -13,7 +13,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
.field { color: #94BFF3; }
.function { color: #93E0E3; }
.function.unsafe { color: #E28C14; }
-.operator.unsafe { color: #BC8383; }
+.operator.unsafe { color: #E28C14; }
.parameter { color: #94BFF3; }
.text { color: #DCDCCC; }
.type { color: #7CB8BB; }
diff --git a/crates/ra_ide/src/snapshots/rainbow_highlighting.html b/crates/ra_ide/src/snapshots/rainbow_highlighting.html
index f5fb96f55231..192d564a6a47 100644
--- a/crates/ra_ide/src/snapshots/rainbow_highlighting.html
+++ b/crates/ra_ide/src/snapshots/rainbow_highlighting.html
@@ -13,7 +13,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
.field { color: #94BFF3; }
.function { color: #93E0E3; }
.function.unsafe { color: #E28C14; }
-.operator.unsafe { color: #BC8383; }
+.operator.unsafe { color: #E28C14; }
.parameter { color: #94BFF3; }
.text { color: #DCDCCC; }
.type { color: #7CB8BB; }
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index 028b559022cb..fb4f2ce388c0 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -605,13 +605,7 @@ fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight {
Definition::Field(_) => HighlightTag::Field,
Definition::ModuleDef(def) => match def {
hir::ModuleDef::Module(_) => HighlightTag::Module,
- hir::ModuleDef::Function(func) => {
- let mut h = HighlightTag::Function.into();
- if func.is_unsafe(db) {
- h |= HighlightModifier::Unsafe;
- }
- return h;
- }
+ hir::ModuleDef::Function(_) => HighlightTag::Function,
hir::ModuleDef::Adt(hir::Adt::Struct(_)) => HighlightTag::Struct,
hir::ModuleDef::Adt(hir::Adt::Enum(_)) => HighlightTag::Enum,
hir::ModuleDef::Adt(hir::Adt::Union(_)) => HighlightTag::Union,
diff --git a/crates/ra_ide/src/syntax_highlighting/html.rs b/crates/ra_ide/src/syntax_highlighting/html.rs
index ed007c382f35..3477610e57dd 100644
--- a/crates/ra_ide/src/syntax_highlighting/html.rs
+++ b/crates/ra_ide/src/syntax_highlighting/html.rs
@@ -72,7 +72,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
.field { color: #94BFF3; }
.function { color: #93E0E3; }
.function.unsafe { color: #E28C14; }
-.operator.unsafe { color: #BC8383; }
+.operator.unsafe { color: #E28C14; }
.parameter { color: #94BFF3; }
.text { color: #DCDCCC; }
.type { color: #7CB8BB; }
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs
index e8e251cfc000..b9bea4729402 100644
--- a/crates/ra_ide/src/syntax_highlighting/tags.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tags.rs
@@ -25,7 +25,6 @@ pub enum HighlightTag {
EnumVariant,
EscapeSequence,
Field,
- FormatSpecifier,
Function,
Generic,
Keyword,
@@ -33,7 +32,6 @@ pub enum HighlightTag {
Macro,
Module,
NumericLiteral,
- Operator,
SelfKeyword,
SelfType,
Static,
@@ -45,6 +43,8 @@ pub enum HighlightTag {
Union,
Local,
UnresolvedReference,
+ FormatSpecifier,
+ Operator,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
@@ -77,7 +77,6 @@ impl HighlightTag {
HighlightTag::EnumVariant => "enum_variant",
HighlightTag::EscapeSequence => "escape_sequence",
HighlightTag::Field => "field",
- HighlightTag::FormatSpecifier => "format_specifier",
HighlightTag::Function => "function",
HighlightTag::Generic => "generic",
HighlightTag::Keyword => "keyword",
@@ -85,7 +84,6 @@ impl HighlightTag {
HighlightTag::Macro => "macro",
HighlightTag::Module => "module",
HighlightTag::NumericLiteral => "numeric_literal",
- HighlightTag::Operator => "operator",
HighlightTag::SelfKeyword => "self_keyword",
HighlightTag::SelfType => "self_type",
HighlightTag::Static => "static",
@@ -97,6 +95,8 @@ impl HighlightTag {
HighlightTag::Union => "union",
HighlightTag::Local => "variable",
HighlightTag::UnresolvedReference => "unresolved_reference",
+ HighlightTag::FormatSpecifier => "format_specifier",
+ HighlightTag::Operator => "operator",
}
}
}
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs
index facdc42b7ad1..b7fad97197f5 100644
--- a/crates/ra_ide/src/syntax_highlighting/tests.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tests.rs
@@ -370,34 +370,3 @@ fn check_highlighting(ra_fixture: &str, snapshot: &str, rainbow: bool) {
fs::write(dst_file, &actual_html).unwrap();
assert_eq_text!(expected_html, actual_html);
}
-
-#[test]
-fn test_unsafe_highlighting() {
- let (analysis, file_id) = single_file(
- r#"
-unsafe fn unsafe_fn() {}
-
-struct HasUnsafeFn;
-
-impl HasUnsafeFn {
- unsafe fn unsafe_method(&self) {}
-}
-
-fn main() {
- let x = &5 as *const usize;
- unsafe {
- unsafe_fn();
- HasUnsafeFn.unsafe_method();
- let y = *x;
- let z = -x;
- }
-}
-"#
- .trim(),
- );
- let dst_file = project_dir().join("crates/ra_ide/src/snapshots/highlight_unsafe.html");
- let actual_html = &analysis.highlight_as_html(file_id, false).unwrap();
- let expected_html = &read_text(&dst_file);
- fs::write(dst_file, &actual_html).unwrap();
- assert_eq_text!(expected_html, actual_html);
-}