You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: module_tree.rs
    path of file: ./repos/mun/crates/mun_hir/src
    
    the code of the file until where you have to start completion: use std::sync::Arc;

use itertools::Itertools;
use mun_paths::RelativePath;
use rustc_hash::FxHashMap;

use crate::{
    arena::{Arena, Idx},
    ids::ModuleId,
    module_tree::diagnostics::ModuleTreeDiagnostic,
    visibility::RawVisibility,
    DefDatabase, FileId, Name, PackageId, SourceDatabase, Visibility,
};

/// Represents the tree of modules of a package.
///
/// The `ModuleTree` is built by looking at all the source files of the 
    
fn path_to_module_path(path: &RelativePath) -> Vec<String> {
    if path.extension().is_none() {
        path.components().map(|c| c.as_str().to_owned()).collect()
    } else if path
        .file_stem()
        .map(str::to_lowercase)
        .expect("the file has an extension so it must also have a file stem")
        == "mod"
    {
        // The parent directory is the module path
        path_to_module_path(
            path.parent()
                .expect("path has a filename so it must also have a parent"),
        )
    } else {
        // Simply strip the extension and use that as the module path
        path_to_module_path(&path.with_extension(""))
    }
}