Skip to content

Commit eb38dc7

Browse files
Merge #8557
8557: Add an error message to fixture errors r=Veykril a=yoshuawuyts Improve the error message when folks forget to add an `$0` in one of the fixtures. Figuring this one out was 20 minutes down the drain for me, so figured I might as well make sure nobody else has to go through the same thing in the future. Thanks! Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2 parents fb2d284 + 5518a65 commit eb38dc7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/base_db/src/fixture.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ pub trait WithFixture: Default + SourceDatabaseExt + 'static {
5454
let fixture = ChangeFixture::parse(ra_fixture);
5555
let mut db = Self::default();
5656
fixture.change.apply(&mut db);
57-
let (file_id, range_or_offset) = fixture.file_position.unwrap();
57+
let (file_id, range_or_offset) = fixture
58+
.file_position
59+
.expect("Could not find file position in fixture. Did you forget to add an `$0`?");
5860
(db, file_id, range_or_offset)
5961
}
6062

0 commit comments

Comments
 (0)