mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Dont diagnose inline mods
This commit is contained in:
parent
4c1f17af7d
commit
b00a4d43ec
2 changed files with 19 additions and 0 deletions
|
@ -220,6 +220,12 @@ impl Link {
|
|||
}
|
||||
|
||||
fn resolve(&mut self, file_resolver: &FileResolver) {
|
||||
if !self.ast().has_semi() {
|
||||
self.problem = None;
|
||||
self.points_to = Vec::new();
|
||||
return;
|
||||
}
|
||||
|
||||
let mod_name = file_resolver.file_stem(self.owner.0);
|
||||
let is_dir_owner =
|
||||
mod_name == "mod" || mod_name == "lib" || mod_name == "main";
|
||||
|
|
|
@ -78,6 +78,19 @@ fn test_unresolved_module_diagnostic() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unresolved_module_diagnostic_no_diag_for_inline_mode() {
|
||||
let mut world = WorldState::new();
|
||||
world.change_file(FileId(1), Some("mod foo {}".to_string()));
|
||||
|
||||
let snap = world.snapshot(FileMap(&[(1, "/lib.rs")]));
|
||||
let diagnostics = snap.diagnostics(FileId(1)).unwrap();
|
||||
assert_eq_dbg(
|
||||
r#"[]"#,
|
||||
&diagnostics,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_resolve_parent_module() {
|
||||
let mut world = WorldState::new();
|
||||
|
|
Loading…
Reference in a new issue