mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-26 07:55:55 +03:00
[PR #330] [MERGED] Avoid accepting references to Copy types #400
Labels
No labels
Stale
bug
discussion
enhancement
good first issue
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/rspotify#400
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ramsayleung/rspotify/pull/330
Author: @SabrinaJewson
Created: 6/15/2022
Status: ✅ Merged
Merged: 6/15/2022
Merged by: @marioortizmanero
Base:
master← Head:no-copy-ref📝 Commits (2)
d2e798bAvoid accepting references toCopytypes4a948dfUpdate changelog📊 Changes
4 files changed (+19 additions, -16 deletions)
View changed files
📝
CHANGELOG.md(+3 -0)📝
src/clients/base.rs(+3 -3)📝
src/clients/oauth.rs(+10 -10)📝
tests/test_with_oauth.rs(+3 -3)📄 Description
Description
searchacceptsOption<IncludeExternal>instead ofOption<&IncludeExternal>featured_playlistsacceptsOption<chrono::DateTime<chrono::Utc>>instead ofOption<&chrono::DateTime<chrono::Utc>>current_user_top_artists[_manual]andcurrent_user_top_tracks[_manual]acceptOption<TimeRange>instead ofOption<&TimeRange>I didn’t do the same for
Marketparameters because they’re notCopy(although they could be) — I’ll leave it to a separate PR.Motivation and Context
Accepting a reference to a
Copytype is usually counterproductive, since you can just take it by value. For most types this makes the size of the parameters smaller, for theOption<chrono::DateTime<chrono::Utc>>it increases it from 8 bytes to 16 bytes but I think that’s acceptable.Dependencies
None.
Type of change
Please delete options that are not relevant.
How has this been tested?
cargo test --features env-file🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.