From: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Sat, 27 Mar 2021 22:43:34 +0000 (+0000) Subject: Merge #8221 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=ce6bb5ccca48b177f6cd12b42b4c52f3e1b44e0c;hp=84f1660a37fa28c4ca4e7e75db5715b12904061a;p=rust.git Merge #8221 8221: Prefer adding `mod` declaration to lib.rs over file.rs in UnlinkedFile fix r=Veykril a=Veykril When there is a `lib.rs` and `main.rs` in one crate, one usually wants the `lib.rs` file to declare the modules. bors r+ Co-authored-by: Lukas Wirth --- diff --git a/crates/ide/src/diagnostics/unlinked_file.rs b/crates/ide/src/diagnostics/unlinked_file.rs index 019b0b440d3..e174fb767fc 100644 --- a/crates/ide/src/diagnostics/unlinked_file.rs +++ b/crates/ide/src/diagnostics/unlinked_file.rs @@ -63,7 +63,7 @@ fn fix(&self, sema: &hir::Semantics) -> Option { // - `$dir.rs` in the parent folder, where `$dir` is the directory containing `self.file_id` let parent = our_path.parent()?; let mut paths = - vec![parent.join("mod.rs")?, parent.join("main.rs")?, parent.join("lib.rs")?]; + vec![parent.join("mod.rs")?, parent.join("lib.rs")?, parent.join("main.rs")?]; // `submod/bla.rs` -> `submod.rs` if let Some(newmod) = (|| {