Skip to content

Separate the implementations of get_disjoint_mut#443

Merged
cuviper merged 1 commit intoindexmap-rs:mainfrom
cuviper:separate-disjoint
May 2, 2026
Merged

Separate the implementations of get_disjoint_mut#443
cuviper merged 1 commit intoindexmap-rs:mainfrom
cuviper:separate-disjoint

Conversation

@cuviper
Copy link
Copy Markdown
Member

@cuviper cuviper commented May 1, 2026

At first glance this may seem worse because it's roughly duplicating the unsafe code. However, these are now placed in a dedicated module where the parallels are apparent, and they should be more direct for their respective use-cases.

  • For disjoint key lookup in a map, we don't need to produce a Result that we're just going to turn into panics anyway.
  • For disjoint indices in a slice, we don't need to deal with Option, and we can drop our own unsafe implementation here in favor of the standard library once we update to MSRV 1.86.

At first glance this may seem worse because it's roughly duplicating the
`unsafe` code. However, these are now placed in a dedicated module where
the parallels are apparent, and they should be more direct for their
respective use-cases.

* For disjoint key lookup in a map, we don't need to produce a `Result`
  that we're just going to turn into panics anyway.
* For disjoint indices in a slice, we don't need to deal with `Option`,
  and we can drop our own unsafe implementation here in favor of the
  standard library once we update to MSRV 1.86.
@cuviper cuviper added this pull request to the merge queue May 2, 2026
Merged via the queue into indexmap-rs:main with commit 0a55350 May 2, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant