mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 06:35:27 +00:00
Remove almost unused ModuleSource::new
This commit is contained in:
parent
5c5f90ba57
commit
032eb3d68e
@ -238,7 +238,7 @@ impl Module {
|
||||
_ => {
|
||||
let src_parent = InFile {
|
||||
file_id: src.file_id,
|
||||
value: ModuleSource::new(db, Some(src.file_id.original_file(db)), None),
|
||||
value: ModuleSource::from_file_id(db, src.file_id.original_file(db)),
|
||||
};
|
||||
Module::from_definition(db, src_parent)
|
||||
}
|
||||
|
@ -356,6 +356,7 @@ impl ModuleData {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ModuleSource {
|
||||
SourceFile(ast::SourceFile),
|
||||
Module(ast::Module),
|
||||
@ -363,25 +364,6 @@ pub enum ModuleSource {
|
||||
}
|
||||
|
||||
impl ModuleSource {
|
||||
pub fn new(
|
||||
db: &impl DefDatabase,
|
||||
file_id: Option<FileId>,
|
||||
decl_id: Option<AstId<ast::Module>>,
|
||||
) -> ModuleSource {
|
||||
match (file_id, decl_id) {
|
||||
(Some(file_id), _) => {
|
||||
let source_file = db.parse(file_id).tree();
|
||||
ModuleSource::SourceFile(source_file)
|
||||
}
|
||||
(None, Some(item_id)) => {
|
||||
let module = item_id.to_node(db);
|
||||
assert!(module.item_list().is_some(), "expected inline module");
|
||||
ModuleSource::Module(module)
|
||||
}
|
||||
(None, None) => panic!(),
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: this methods do not belong here
|
||||
pub fn from_position(db: &impl DefDatabase, position: FilePosition) -> ModuleSource {
|
||||
let parse = db.parse(position.file_id);
|
||||
|
Loading…
Reference in New Issue
Block a user