Skip to content

Commit eac092f

Browse files
authored
Rollup merge of rust-lang#137977 - nnethercote:less-kw-Empty-1, r=spastorino
Reduce `kw::Empty` usage, part 1 This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way. r? ```@spastorino```
2 parents c919de7 + cf07525 commit eac092f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clippy_utils/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3492,7 +3492,7 @@ fn maybe_get_relative_path(from: &DefPath, to: &DefPath, max_super: usize) -> St
34923492
// a::b::c ::d::sym refers to
34933493
// e::f::sym:: ::
34943494
// result should be super::super::super::super::e::f
3495-
if let DefPathData::TypeNs(s) = l {
3495+
if let DefPathData::TypeNs(Some(s)) = l {
34963496
path.push(s.to_string());
34973497
}
34983498
if let DefPathData::TypeNs(_) = r {
@@ -3503,7 +3503,7 @@ fn maybe_get_relative_path(from: &DefPath, to: &DefPath, max_super: usize) -> St
35033503
// a::b::sym:: :: refers to
35043504
// c::d::e ::f::sym
35053505
// when looking at `f`
3506-
Left(DefPathData::TypeNs(sym)) => path.push(sym.to_string()),
3506+
Left(DefPathData::TypeNs(Some(sym))) => path.push(sym.to_string()),
35073507
// consider:
35083508
// a::b::c ::d::sym refers to
35093509
// e::f::sym:: ::
@@ -3517,7 +3517,7 @@ fn maybe_get_relative_path(from: &DefPath, to: &DefPath, max_super: usize) -> St
35173517
// `super` chain would be too long, just use the absolute path instead
35183518
once(String::from("crate"))
35193519
.chain(to.data.iter().filter_map(|el| {
3520-
if let DefPathData::TypeNs(sym) = el.data {
3520+
if let DefPathData::TypeNs(Some(sym)) = el.data {
35213521
Some(sym.to_string())
35223522
} else {
35233523
None

0 commit comments

Comments
 (0)