Skip to content

Commit 301a803

Browse files
authored
fixing boxed closure, fixes #144 (#173)
1 parent abf9204 commit 301a803

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

RustEnhanced.sublime-syntax

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,10 @@ contexts:
365365

366366
generic-angles:
367367
- meta_scope: meta.generic.rust
368+
# -> to cover https://doc.rust-lang.org/std/boxed/trait.FnBox.html
369+
- match: '->'
370+
scope: punctuation.separator.generic.rust
371+
push: generic-angles-contents
368372
- match: '>'
369373
scope: punctuation.definition.generic.end.rust
370374
pop: true

syntax_test_rust.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,19 @@ struct PrintableStruct(Box<i32>);
211211
// ^ punctuation.definition.generic.end
212212
// ^ punctuation.definition.group.end
213213

214+
215+
// fixes https://github.com/rust-lang/sublime-rust/issues/144
216+
fn factory() -> Box<Fn(i32) -> i32> {
217+
// <- storage.type.function
218+
// ^^^^^^^ entity.name.function
219+
// ^^^^^^^^^^^^^^ meta.generic
220+
// ^^ storage.type
221+
// ^^ storage.type
222+
// ^^ punctuation.separator.generic
223+
224+
Box::new(|x| x + 1)
225+
}
226+
214227
impl fmt::Display for PrintableStruct {
215228
// <- meta.impl
216229
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.impl

0 commit comments

Comments
 (0)