mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Reformat
This commit is contained in:
parent
757e593b25
commit
27b362b059
3 changed files with 7 additions and 10 deletions
|
@ -262,12 +262,11 @@ impl Module {
|
||||||
|
|
||||||
let original_file = src.file_id.original_file(db);
|
let original_file = src.file_id.original_file(db);
|
||||||
|
|
||||||
let (krate, local_id) =
|
let (krate, local_id) = db.relevant_crates(original_file).iter().find_map(|&crate_id| {
|
||||||
db.relevant_crates(original_file).iter().find_map(|&crate_id| {
|
let crate_def_map = db.crate_def_map(crate_id);
|
||||||
let crate_def_map = db.crate_def_map(crate_id);
|
let local_id = crate_def_map.modules_for_file(original_file).next()?;
|
||||||
let local_id = crate_def_map.modules_for_file(original_file).next()?;
|
Some((crate_id, local_id))
|
||||||
Some((crate_id, local_id))
|
})?;
|
||||||
})?;
|
|
||||||
Some(Module { id: ModuleId { krate, local_id } })
|
Some(Module { id: ModuleId { krate, local_id } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -682,8 +682,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn define_def(&mut self, def: &raw::DefData) {
|
fn define_def(&mut self, def: &raw::DefData) {
|
||||||
let module =
|
let module = ModuleId { krate: self.def_collector.def_map.krate, local_id: self.module_id };
|
||||||
ModuleId { krate: self.def_collector.def_map.krate, local_id: self.module_id };
|
|
||||||
let ctx = LocationCtx::new(self.def_collector.db, module, self.file_id);
|
let ctx = LocationCtx::new(self.def_collector.db, module, self.file_id);
|
||||||
|
|
||||||
let name = def.name.clone();
|
let name = def.name.clone();
|
||||||
|
|
|
@ -332,8 +332,7 @@ fn bar() {
|
||||||
"#
|
"#
|
||||||
.trim(),
|
.trim(),
|
||||||
);
|
);
|
||||||
let dst_file =
|
let dst_file = project_dir().join("crates/ra_ide/src/snapshots/rainbow_highlighting.html");
|
||||||
project_dir().join("crates/ra_ide/src/snapshots/rainbow_highlighting.html");
|
|
||||||
let actual_html = &analysis.highlight_as_html(file_id, true).unwrap();
|
let actual_html = &analysis.highlight_as_html(file_id, true).unwrap();
|
||||||
let expected_html = &read_text(&dst_file);
|
let expected_html = &read_text(&dst_file);
|
||||||
std::fs::write(dst_file, &actual_html).unwrap();
|
std::fs::write(dst_file, &actual_html).unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue