diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5391b74b57..6a5e1f0edd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,41 +91,41 @@ jobs: target key: ${{ runner.os }}-nightly-clippy-cargo-target-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ runner.os }}-nightly-cargo-target-${{ hashFiles('**/Cargo.lock') }} - - name: Run clippy --all-targets --no-default-features -- -D warnings + - name: Run clippy --all-targets --no-default-features uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets --no-default-features -- -D warnings - - name: Run clippy --all-targets --no-default-features --features "helix" -- -D warnings + args: --all-targets --no-default-features + - name: Run clippy --all-targets --no-default-features --features "helix" uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets --no-default-features --features "helix" -- -D warnings - - name: Run clippy --all-targets --no-default-features --features "tmi" -- -D warnings + args: --all-targets --no-default-features --features "helix" + - name: Run clippy --all-targets --no-default-features --features "tmi" uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets --no-default-features --features "tmi" -- -D warnings - - name: Run clippy --all-targets --no-default-features --features "pubsub" -- -D warnings + args: --all-targets --no-default-features --features "tmi" + - name: Run clippy --all-targets --no-default-features --features "pubsub" uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets --no-default-features --features "pubsub" -- -D warnings - - name: Run clippy --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }} trace_unknown_fields" -- -D warnings + args: --all-targets --no-default-features --features "pubsub" + - name: Run clippy --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }} trace_unknown_fields" uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }} trace_unknown_fields" -- -D warnings - - name: Run clippy --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }}" -- -D warnings + args: --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }} trace_unknown_fields" + - name: Run clippy --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }}" uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }}" -- -D warnings - - name: Run clippy --all-targets --all-features -- -D warnings + args: --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }}" + - name: Run clippy --all-targets --all-features uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --all-targets --all-features -- -D warnings + args: --all-targets --all-features docs: name: Docs runs-on: ubuntu-latest diff --git a/src/eventsub/channel/channel_points_custom_reward.rs b/src/eventsub/channel/channel_points_custom_reward/mod.rs similarity index 100% rename from src/eventsub/channel/channel_points_custom_reward.rs rename to src/eventsub/channel/channel_points_custom_reward/mod.rs diff --git a/src/eventsub/channel/channel_points_custom_reward_redemption.rs b/src/eventsub/channel/channel_points_custom_reward_redemption/mod.rs similarity index 100% rename from src/eventsub/channel/channel_points_custom_reward_redemption.rs rename to src/eventsub/channel/channel_points_custom_reward_redemption/mod.rs diff --git a/src/eventsub/channel/hypetrain.rs b/src/eventsub/channel/hypetrain/mod.rs similarity index 100% rename from src/eventsub/channel/hypetrain.rs rename to src/eventsub/channel/hypetrain/mod.rs diff --git a/src/eventsub/channel.rs b/src/eventsub/channel/mod.rs similarity index 100% rename from src/eventsub/channel.rs rename to src/eventsub/channel/mod.rs diff --git a/src/eventsub/channel/poll.rs b/src/eventsub/channel/poll/mod.rs similarity index 100% rename from src/eventsub/channel/poll.rs rename to src/eventsub/channel/poll/mod.rs diff --git a/src/eventsub/channel/prediction.rs b/src/eventsub/channel/prediction/mod.rs similarity index 100% rename from src/eventsub/channel/prediction.rs rename to src/eventsub/channel/prediction/mod.rs diff --git a/src/eventsub/channel/subscription.rs b/src/eventsub/channel/subscription/mod.rs similarity index 100% rename from src/eventsub/channel/subscription.rs rename to src/eventsub/channel/subscription/mod.rs diff --git a/src/eventsub/stream.rs b/src/eventsub/stream/mod.rs similarity index 100% rename from src/eventsub/stream.rs rename to src/eventsub/stream/mod.rs diff --git a/src/eventsub/user.rs b/src/eventsub/user/mod.rs similarity index 100% rename from src/eventsub/user.rs rename to src/eventsub/user/mod.rs diff --git a/src/helix/bits.rs b/src/helix/bits/mod.rs similarity index 100% rename from src/helix/bits.rs rename to src/helix/bits/mod.rs diff --git a/src/helix/channels.rs b/src/helix/channels/mod.rs similarity index 100% rename from src/helix/channels.rs rename to src/helix/channels/mod.rs diff --git a/src/helix/chat.rs b/src/helix/chat/mod.rs similarity index 100% rename from src/helix/chat.rs rename to src/helix/chat/mod.rs diff --git a/src/helix/clips.rs b/src/helix/clips/mod.rs similarity index 100% rename from src/helix/clips.rs rename to src/helix/clips/mod.rs diff --git a/src/helix/eventsub.rs b/src/helix/eventsub/mod.rs similarity index 100% rename from src/helix/eventsub.rs rename to src/helix/eventsub/mod.rs diff --git a/src/helix/games.rs b/src/helix/games/mod.rs similarity index 100% rename from src/helix/games.rs rename to src/helix/games/mod.rs diff --git a/src/helix/hypetrain.rs b/src/helix/hypetrain/mod.rs similarity index 100% rename from src/helix/hypetrain.rs rename to src/helix/hypetrain/mod.rs diff --git a/src/helix/mod.rs b/src/helix/mod.rs index bb3cec0e93..39413f4028 100644 --- a/src/helix/mod.rs +++ b/src/helix/mod.rs @@ -378,14 +378,14 @@ pub trait RequestPost: Request { where Self: Sized, { - let text = std::str::from_utf8(&response.body()).map_err(|e| { + let text = std::str::from_utf8(response.body()).map_err(|e| { HelixRequestPostError::Utf8Error(response.body().clone(), e, uri.clone()) })?; if let Ok(HelixRequestError { error, status, message, - }) = parse_json::(&text, false) + }) = parse_json::(text, false) { return Err(HelixRequestPostError::Error { error, @@ -408,7 +408,7 @@ pub trait RequestPost: Request { where Self: Sized, { - let response: InnerResponse<::Response> = parse_json(&response, true) + let response: InnerResponse<::Response> = parse_json(response, true) .map_err(|e| { HelixRequestPostError::DeserializeError( response.to_string(), @@ -471,14 +471,14 @@ pub trait RequestPatch: Request { where Self: Sized, { - let text = std::str::from_utf8(&response.body()).map_err(|e| { + let text = std::str::from_utf8(response.body()).map_err(|e| { HelixRequestPatchError::Utf8Error(response.body().clone(), e, uri.clone()) })?; if let Ok(HelixRequestError { error, status, message, - }) = parse_json::(&text, false) + }) = parse_json::(text, false) { return Err(HelixRequestPatchError::Error { error, @@ -540,14 +540,14 @@ pub trait RequestDelete: Request { where Self: Sized, { - let text = std::str::from_utf8(&response.body()).map_err(|e| { + let text = std::str::from_utf8(response.body()).map_err(|e| { HelixRequestDeleteError::Utf8Error(response.body().clone(), e, uri.clone()) })?; if let Ok(HelixRequestError { error, status, message, - }) = parse_json::(&text, false) + }) = parse_json::(text, false) { return Err(HelixRequestDeleteError::Error { error, @@ -616,14 +616,14 @@ pub trait RequestPut: Request { where Self: Sized, { - let text = std::str::from_utf8(&response.body()).map_err(|e| { + let text = std::str::from_utf8(response.body()).map_err(|e| { HelixRequestPutError::Utf8Error(response.body().clone(), e, uri.clone()) })?; if let Ok(HelixRequestError { error, status, message, - }) = parse_json::(&text, false) + }) = parse_json::(text, false) { return Err(HelixRequestPutError::Error { error, @@ -685,7 +685,7 @@ pub trait RequestGet: Request { where Self: Sized, { - let text = std::str::from_utf8(&response.body()).map_err(|e| { + let text = std::str::from_utf8(response.body()).map_err(|e| { HelixRequestGetError::Utf8Error(response.body().clone(), e, uri.clone()) })?; //eprintln!("\n\nmessage is ------------ {} ------------", text); @@ -693,7 +693,7 @@ pub trait RequestGet: Request { error, status, message, - }) = parse_json::(&text, false) + }) = parse_json::(text, false) { return Err(HelixRequestGetError::Error { error, diff --git a/src/helix/moderation/check_automod_status.rs b/src/helix/moderation/check_automod_status.rs index 54bfbda477..3cb4116aa7 100644 --- a/src/helix/moderation/check_automod_status.rs +++ b/src/helix/moderation/check_automod_status.rs @@ -105,7 +105,7 @@ impl helix::HelixRequestBody for Vec { data: &'a Vec, } - serde_json::to_vec(&InnerBody { data: &self }).map_err(Into::into) + serde_json::to_vec(&InnerBody { data: self }).map_err(Into::into) } } diff --git a/src/helix/moderation.rs b/src/helix/moderation/mod.rs similarity index 100% rename from src/helix/moderation.rs rename to src/helix/moderation/mod.rs diff --git a/src/helix/points/create_custom_rewards.rs b/src/helix/points/create_custom_rewards.rs index 873ff651b5..525112f9ad 100644 --- a/src/helix/points/create_custom_rewards.rs +++ b/src/helix/points/create_custom_rewards.rs @@ -143,7 +143,7 @@ impl RequestPost for CreateCustomRewardRequest { Self: Sized, { let response: helix::InnerResponse> = - helix::parse_json(&response_str, true).map_err(|e| { + helix::parse_json(response_str, true).map_err(|e| { helix::HelixRequestPostError::DeserializeError( response_str.to_string(), e, diff --git a/src/helix/points.rs b/src/helix/points/mod.rs similarity index 100% rename from src/helix/points.rs rename to src/helix/points/mod.rs diff --git a/src/helix/polls/create_poll.rs b/src/helix/polls/create_poll.rs index 1294c7b376..24d4222255 100644 --- a/src/helix/polls/create_poll.rs +++ b/src/helix/polls/create_poll.rs @@ -150,7 +150,7 @@ impl RequestPost for CreatePollRequest { Self: Sized, { let response: helix::InnerResponse> = - helix::parse_json(&response_str, true).map_err(|e| { + helix::parse_json(response_str, true).map_err(|e| { helix::HelixRequestPostError::DeserializeError( response_str.to_string(), e, diff --git a/src/helix/polls.rs b/src/helix/polls/mod.rs similarity index 100% rename from src/helix/polls.rs rename to src/helix/polls/mod.rs diff --git a/src/helix/predictions/create_prediction.rs b/src/helix/predictions/create_prediction.rs index e9b34c1497..0177545773 100644 --- a/src/helix/predictions/create_prediction.rs +++ b/src/helix/predictions/create_prediction.rs @@ -142,7 +142,7 @@ impl RequestPost for CreatePredictionRequest { Self: Sized, { let response: helix::InnerResponse> = - helix::parse_json(&response_str, true).map_err(|e| { + helix::parse_json(response_str, true).map_err(|e| { helix::HelixRequestPostError::DeserializeError( response_str.to_string(), e, diff --git a/src/helix/predictions.rs b/src/helix/predictions/mod.rs similarity index 100% rename from src/helix/predictions.rs rename to src/helix/predictions/mod.rs diff --git a/src/helix/search.rs b/src/helix/search/mod.rs similarity index 100% rename from src/helix/search.rs rename to src/helix/search/mod.rs diff --git a/src/helix/search/search_categories.rs b/src/helix/search/search_categories.rs index 1d87b1091c..38f7c94360 100644 --- a/src/helix/search/search_categories.rs +++ b/src/helix/search/search_categories.rs @@ -84,7 +84,7 @@ impl RequestGet for SearchCategoriesRequest { Self: Sized, { let response: helix::InnerResponse> = - helix::parse_json(&response, true).map_err(|e| { + helix::parse_json(response, true).map_err(|e| { helix::HelixRequestGetError::DeserializeError( response.to_string(), e, diff --git a/src/helix/ser.rs b/src/helix/ser.rs index 6bf0fa3c0e..86195e4a66 100644 --- a/src/helix/ser.rs +++ b/src/helix/ser.rs @@ -674,7 +674,7 @@ impl<'input, 'output> ser::Serializer for PairSerializer<'input, 'output> { _variant_index: u32, variant: &'static str, ) -> Result { - self.urlencoder.append_pair(self.key, &variant); + self.urlencoder.append_pair(self.key, variant); Ok(self.urlencoder) } diff --git a/src/helix/streams.rs b/src/helix/streams/mod.rs similarity index 100% rename from src/helix/streams.rs rename to src/helix/streams/mod.rs diff --git a/src/helix/subscriptions/check_user_subscription.rs b/src/helix/subscriptions/check_user_subscription.rs index 808166c803..28386fa3dc 100644 --- a/src/helix/subscriptions/check_user_subscription.rs +++ b/src/helix/subscriptions/check_user_subscription.rs @@ -95,7 +95,7 @@ impl RequestGet for CheckUserSubscriptionRequest { Self: Sized, { let inner_response: helix::InnerResponse> = - helix::parse_json(&text, true).map_err(|e| { + helix::parse_json(text, true).map_err(|e| { helix::HelixRequestGetError::DeserializeError( text.to_string(), e, diff --git a/src/helix/subscriptions.rs b/src/helix/subscriptions/mod.rs similarity index 100% rename from src/helix/subscriptions.rs rename to src/helix/subscriptions/mod.rs diff --git a/src/helix/tags.rs b/src/helix/tags/mod.rs similarity index 100% rename from src/helix/tags.rs rename to src/helix/tags/mod.rs diff --git a/src/helix/teams.rs b/src/helix/teams/mod.rs similarity index 100% rename from src/helix/teams.rs rename to src/helix/teams/mod.rs diff --git a/src/helix/users.rs b/src/helix/users/mod.rs similarity index 100% rename from src/helix/users.rs rename to src/helix/users/mod.rs diff --git a/src/helix/videos.rs b/src/helix/videos/mod.rs similarity index 100% rename from src/helix/videos.rs rename to src/helix/videos/mod.rs diff --git a/src/helix/webhooks/hub.rs b/src/helix/webhooks/hub.rs index 5715539c98..a3f71628ed 100644 --- a/src/helix/webhooks/hub.rs +++ b/src/helix/webhooks/hub.rs @@ -183,14 +183,14 @@ impl RequestPost for WebhookHubRequest { where Self: Sized, { - let text = std::str::from_utf8(&response.body()).map_err(|e| { + let text = std::str::from_utf8(response.body()).map_err(|e| { helix::HelixRequestPostError::Utf8Error(response.body().clone(), e, uri.clone()) })?; if let Ok(helix::HelixRequestError { error, status, message, - }) = helix::parse_json::(&text, false) + }) = helix::parse_json::(text, false) { return Err(helix::HelixRequestPostError::Error { error, diff --git a/src/helix/webhooks.rs b/src/helix/webhooks/mod.rs similarity index 100% rename from src/helix/webhooks.rs rename to src/helix/webhooks/mod.rs diff --git a/src/lib.rs b/src/lib.rs index 53753f2365..243611dbde 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,6 @@ #![cfg_attr(nightly, deny(rustdoc::broken_intra_doc_links))] #![cfg_attr(nightly, feature(doc_cfg))] #![doc(html_root_url = "https://docs.rs/twitch_api2/0.5.0")] -#![cfg_attr(all(nightly, doctest), feature(external_doc))] //! [![github]](https://github.com/emilgardis/twitch_api2) [![crates-io]](https://crates.io/crates/twitch_api2) [![docs-rs-big]](https://docs.rs/twitch_api2/0.5.0/twitch_api2) //! //! [github]: https://img.shields.io/badge/github-emilgardis/twitch__api2-8da0cb?style=for-the-badge&labelColor=555555&logo=github" @@ -90,8 +89,12 @@ //! | deny_unknown_fields | Adds `#[serde(deny_unknown_fields)]` on all applicable structs/enums. Please consider using this and filing an issue or PR when a new field has been added to the endpoint but not added to this library. | //! -#[doc(include = "../README.md")] -#[cfg(all(doctest, feature = "all"))] +// FIXME: This is a hack to prevent early pass failing on +// `arbitrary expressions in key-value attributes are unstable` on stable rust pre 1.54. +// Remove when MSRV 1.54 (or when hits stable) +// https://github.com/rust-lang/rust/issues/82768 +/// Doc test for README +#[cfg_attr(all(doctest, nightly, feature = "all"), cfg_attr(all(doctest, nightly, feature = "all"), doc = include_str!("../README.md")))] pub struct ReadmeDoctests; pub mod types;