diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-11 14:32:00 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-11 19:08:14 +1000 |
| commit | 595c8f9c8cb230f31434d00b8ee87967bc040488 (patch) | |
| tree | 62b2be95025ab51835a79e76f75439b758a5f446 | |
| parent | 328b4fa9fe69d9d1ba5fb5329b33eee71e29329b (diff) | |
| download | rust-595c8f9c8cb230f31434d00b8ee87967bc040488.tar.gz rust-595c8f9c8cb230f31434d00b8ee87967bc040488.zip | |
Introduce `DefPathData::AnonAssocTy`.
PR #137977 changed `DefPathData::TypeNs` to contain `Option<Symbol>` to account for RPITIT assoc types being anonymous. This commit changes it back to `Symbol` and gives anonymous assoc types their own variant. It makes things a bit nicer overall.
| -rw-r--r-- | clippy_utils/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index bcb0f8349e2..1a6bdf5ca15 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -3502,7 +3502,7 @@ fn maybe_get_relative_path(from: &DefPath, to: &DefPath, max_super: usize) -> St // a::b::c ::d::sym refers to // e::f::sym:: :: // result should be super::super::super::super::e::f - if let DefPathData::TypeNs(Some(s)) = l { + if let DefPathData::TypeNs(s) = l { path.push(s.to_string()); } if let DefPathData::TypeNs(_) = r { @@ -3513,7 +3513,7 @@ fn maybe_get_relative_path(from: &DefPath, to: &DefPath, max_super: usize) -> St // a::b::sym:: :: refers to // c::d::e ::f::sym // when looking at `f` - Left(DefPathData::TypeNs(Some(sym))) => path.push(sym.to_string()), + Left(DefPathData::TypeNs(sym)) => path.push(sym.to_string()), // consider: // a::b::c ::d::sym refers to // e::f::sym:: :: @@ -3527,7 +3527,7 @@ fn maybe_get_relative_path(from: &DefPath, to: &DefPath, max_super: usize) -> St // `super` chain would be too long, just use the absolute path instead once(String::from("crate")) .chain(to.data.iter().filter_map(|el| { - if let DefPathData::TypeNs(Some(sym)) = el.data { + if let DefPathData::TypeNs(sym) = el.data { Some(sym.to_string()) } else { None |
