]> git.lizzy.rs Git - rust.git/commitdiff
Merge #8221
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Sat, 27 Mar 2021 22:43:34 +0000 (22:43 +0000)
committerGitHub <noreply@github.com>
Sat, 27 Mar 2021 22:43:34 +0000 (22:43 +0000)
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 <lukastw97@gmail.com>
crates/ide/src/diagnostics/unlinked_file.rs

index 019b0b440d34f793394157af759663411fb057f7..e174fb767fc6da438ab6d05e3424edf5d718c07a 100644 (file)
@@ -63,7 +63,7 @@ fn fix(&self, sema: &hir::Semantics<RootDatabase>) -> Option<Fix> {
         // - `$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) = (|| {