mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Simplify
This commit is contained in:
parent
4b7675fcc3
commit
7faa35cbbd
3 changed files with 45 additions and 156 deletions
|
@ -45,16 +45,14 @@ fn fixes(ctx: &DiagnosticsContext, file_id: FileId) -> Option<Vec<Assist>> {
|
|||
// - `$dir.rs` in the parent folder, where `$dir` is the directory containing `self.file_id`
|
||||
let parent = our_path.parent()?;
|
||||
let paths = {
|
||||
let temp;
|
||||
let parent = if module_name == "mod" {
|
||||
// for mod.rs we need to actually look up one higher
|
||||
// and take the parent as our to be module name
|
||||
let (name, _) = parent.name_and_extension()?;
|
||||
module_name = name;
|
||||
temp = parent.parent()?;
|
||||
&temp
|
||||
parent.parent()?
|
||||
} else {
|
||||
&parent
|
||||
parent
|
||||
};
|
||||
let mut paths =
|
||||
vec![parent.join("mod.rs")?, parent.join("lib.rs")?, parent.join("main.rs")?];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue