Skip to content

Commit

Permalink
Revert Request::params back to Option (serenity-rs#2695)
Browse files Browse the repository at this point in the history
Follow-up to serenity-rs#2694.

When `Request::params` was made into an ArrayVec, the `Option` around it
was removed in order to avoid having to add a turbofish on `None` to
specify the value of `MAX_PARAMS`. Also, `Request::new` also needed to
be changed so that the value of `MAX_PARAMS` could be inferred. Now that
the field is a slice again, we can wrap it in `Option` again (at no cost
to size, thanks to niche opts).

We ensure we never store the redundant `Some(&[])` by checking for an
empty slice and storing `None` instead. This way, we ensure we never
read an empty slice out of the `Some` variant.
  • Loading branch information
mkrasnitski authored and GnomedDev committed Oct 20, 2024
1 parent fb8d6bf commit 9ebf3ac
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 207 deletions.
Loading

0 comments on commit 9ebf3ac

Please sign in to comment.