diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-17 15:51:42 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-17 15:51:42 +0100 |
commit | eb38dc704fc6ac14059e61485467ce9ddf32a08c (patch) | |
tree | 859f07bb1e1d35e4a74fea16a859ed5efd23f79c | |
parent | fb2d284f28f70426e39e1b92d95bdbb217a48109 (diff) | |
parent | 5518a65037f862fc45e72f1256aa4994a6b14a57 (diff) |
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 <[email protected]>
-rw-r--r-- | crates/base_db/src/fixture.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/base_db/src/fixture.rs b/crates/base_db/src/fixture.rs index 04e2be390..30f85bf3a 100644 --- a/crates/base_db/src/fixture.rs +++ b/crates/base_db/src/fixture.rs | |||
@@ -54,7 +54,9 @@ pub trait WithFixture: Default + SourceDatabaseExt + 'static { | |||
54 | let fixture = ChangeFixture::parse(ra_fixture); | 54 | let fixture = ChangeFixture::parse(ra_fixture); |
55 | let mut db = Self::default(); | 55 | let mut db = Self::default(); |
56 | fixture.change.apply(&mut db); | 56 | 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`?"); | ||
58 | (db, file_id, range_or_offset) | 60 | (db, file_id, range_or_offset) |
59 | } | 61 | } |
60 | 62 | ||