Skip to content

Commit a6106b1

Browse files
TheIronBornjasonwilliams
authored andcommitted
add opt-out trait impls (#287)
1 parent f48fc21 commit a6106b1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

RustEnhanced.sublime-syntax

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,13 @@ contexts:
710710
pop: true
711711

712712
impl-for:
713-
- match: '(?=\s*(?:::|{{identifier}}|\$|<)+(<.*?>)?\s+for\s+)'
713+
# `!?` here matches opt-out trait impls
714+
- match: '(?=\s*(?:::|!?{{identifier}}|\$|<)+(<.*?>)?\s+for\s+)'
714715
set:
715716
- meta_scope: meta.impl.rust
716717
- include: comments
718+
- match: '!?(?=\s*{{identifier}})'
719+
scope: keyword.operator.rust meta.impl.opt-out.rust
717720
- match: \bfor\b
718721
scope: keyword.other.rust
719722
set: impl-identifier

syntax_test_rust.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,10 @@ impl Point
693693
}
694694
}
695695

696+
impl !Send for Point {}
697+
//^^^^^^^^^^^^^^^^^^^^^ meta.impl.rust
698+
// ^ meta.impl.rust keyword.operator.rust meta.impl.opt-out.rust
699+
696700
pub fn pub_function() -> bool
697701
// <- storage.modifier
698702
// ^^ storage.type.function

0 commit comments

Comments
 (0)