-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple modules from the same crate in fixtures #8302
Allow multiple modules from the same crate in fixtures #8302
Conversation
changelog internal bors r+ |
8302: Allow multiple modules from the same crate in fixtures r=SomeoneToIgnore a=SomeoneToIgnore A tiny step towards #6633 As discussed in [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Completion.20benchmarks), we would need to have a generated code for the completions benchmark. To better represent a real project, we'd better allow to specify multiple modules in a crate within a single fixture. Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Build failed: |
0364eac
to
7da4689
Compare
0a97f79
to
c6f856a
Compare
let dep = CrateName::normalize_dashes(&dep); | ||
crate_deps.push((crate_name.clone(), dep)) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, why do we need to change anything here at all? Just the following diff seem to work for me:
diff --git a/crates/ide_assists/src/handlers/auto_import.rs b/crates/ide_assists/src/handlers/auto_import.rs
index 5ccd7f7a2..e04711067 100644
--- a/crates/ide_assists/src/handlers/auto_import.rs
+++ b/crates/ide_assists/src/handlers/auto_import.rs
@@ -918,6 +918,9 @@ fn main() {
auto_import,
r"
//- /lib.rs crate:dep
+pub mod formatters;
+
+//- /formatters.rs
pub struct FMT;
pub struct fmt;
@@ -926,7 +929,7 @@ fn main() {
FMT$0;
}
",
- r"use dep::FMT;
+ r"use dep::formatters::FMT;
fn main() {
FMT;
I suspect that we just support multifie crates in fixtures without any any extra actions required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, so I've completely misunderstood the //-
fixture format.
Thanks for stopping me 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might make sense to clarify the docs then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and reread the updated version finally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The culprit was the fact that there are two places documenting fixtures in the code and the most elaborative description was not near Fixture
struct 😄
I've united them: #8382
8382: Make Fixture docs more accessible and fix small doc issues r=SomeoneToIgnore a=SomeoneToIgnore Follow up of #8302 (comment) Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
A tiny step towards #6633
As discussed in Zulip, we would need to have a generated code for the completions benchmark.
To better represent a real project, we'd better allow to specify multiple modules in a crate within a single fixture.