Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/path.rs')
-rw-r--r--crates/hir-def/src/path.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/hir-def/src/path.rs b/crates/hir-def/src/path.rs
index e59c37104d..e6c2504d07 100644
--- a/crates/hir-def/src/path.rs
+++ b/crates/hir-def/src/path.rs
@@ -173,10 +173,7 @@ impl Path {
segments: path.mod_path().segments(),
generic_args: Some(path.generic_args()),
},
- Path::LangItem(_, seg) => PathSegments {
- segments: seg.as_ref().map_or(&[], |seg| std::slice::from_ref(seg)),
- generic_args: None,
- },
+ Path::LangItem(_, seg) => PathSegments { segments: seg.as_slice(), generic_args: None },
}
}
@@ -240,6 +237,11 @@ pub struct PathSegment<'a> {
pub args_and_bindings: Option<&'a GenericArgs>,
}
+impl PathSegment<'_> {
+ pub const MISSING: PathSegment<'static> =
+ PathSegment { name: &Name::missing(), args_and_bindings: None };
+}
+
#[derive(Debug, Clone, Copy)]
pub struct PathSegments<'a> {
segments: &'a [Name],