mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
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>
This commit is contained in:
commit
eb38dc704f
1 changed files with 3 additions and 1 deletions
|
@ -54,7 +54,9 @@ pub trait WithFixture: Default + SourceDatabaseExt + 'static {
|
||||||
let fixture = ChangeFixture::parse(ra_fixture);
|
let fixture = ChangeFixture::parse(ra_fixture);
|
||||||
let mut db = Self::default();
|
let mut db = Self::default();
|
||||||
fixture.change.apply(&mut db);
|
fixture.change.apply(&mut db);
|
||||||
let (file_id, range_or_offset) = fixture.file_position.unwrap();
|
let (file_id, range_or_offset) = fixture
|
||||||
|
.file_position
|
||||||
|
.expect("Could not find file position in fixture. Did you forget to add an `$0`?");
|
||||||
(db, file_id, range_or_offset)
|
(db, file_id, range_or_offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue