Skip to content

Commit 7aefad9

Browse files
Merge #157
157: Rename named modules to `mod.rs` r=Emilgardis a=Emilgardis This also fixes some issues with clippy and nightly rust Co-authored-by: Emil Gardström <[email protected]>
2 parents 57bd7dc + 6fcf739 commit 7aefad9

File tree

39 files changed

+40
-37
lines changed

39 files changed

+40
-37
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,41 +91,41 @@ jobs:
9191
target
9292
key: ${{ runner.os }}-nightly-clippy-cargo-target-${{ hashFiles('**/Cargo.lock') }}
9393
restore-keys: ${{ runner.os }}-nightly-cargo-target-${{ hashFiles('**/Cargo.lock') }}
94-
- name: Run clippy --all-targets --no-default-features -- -D warnings
94+
- name: Run clippy --all-targets --no-default-features
9595
uses: actions-rs/clippy-check@v1
9696
with:
9797
token: ${{ secrets.GITHUB_TOKEN }}
98-
args: --all-targets --no-default-features -- -D warnings
99-
- name: Run clippy --all-targets --no-default-features --features "helix" -- -D warnings
98+
args: --all-targets --no-default-features
99+
- name: Run clippy --all-targets --no-default-features --features "helix"
100100
uses: actions-rs/clippy-check@v1
101101
with:
102102
token: ${{ secrets.GITHUB_TOKEN }}
103-
args: --all-targets --no-default-features --features "helix" -- -D warnings
104-
- name: Run clippy --all-targets --no-default-features --features "tmi" -- -D warnings
103+
args: --all-targets --no-default-features --features "helix"
104+
- name: Run clippy --all-targets --no-default-features --features "tmi"
105105
uses: actions-rs/clippy-check@v1
106106
with:
107107
token: ${{ secrets.GITHUB_TOKEN }}
108-
args: --all-targets --no-default-features --features "tmi" -- -D warnings
109-
- name: Run clippy --all-targets --no-default-features --features "pubsub" -- -D warnings
108+
args: --all-targets --no-default-features --features "tmi"
109+
- name: Run clippy --all-targets --no-default-features --features "pubsub"
110110
uses: actions-rs/clippy-check@v1
111111
with:
112112
token: ${{ secrets.GITHUB_TOKEN }}
113-
args: --all-targets --no-default-features --features "pubsub" -- -D warnings
114-
- name: Run clippy --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }} trace_unknown_fields" -- -D warnings
113+
args: --all-targets --no-default-features --features "pubsub"
114+
- name: Run clippy --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }} trace_unknown_fields"
115115
uses: actions-rs/clippy-check@v1
116116
with:
117117
token: ${{ secrets.GITHUB_TOKEN }}
118-
args: --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }} trace_unknown_fields" -- -D warnings
119-
- name: Run clippy --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }}" -- -D warnings
118+
args: --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }} trace_unknown_fields"
119+
- name: Run clippy --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }}"
120120
uses: actions-rs/clippy-check@v1
121121
with:
122122
token: ${{ secrets.GITHUB_TOKEN }}
123-
args: --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }}" -- -D warnings
124-
- name: Run clippy --all-targets --all-features -- -D warnings
123+
args: --all-targets --features "${{ env.CI_TWITCH_API2_FEATURES }}"
124+
- name: Run clippy --all-targets --all-features
125125
uses: actions-rs/clippy-check@v1
126126
with:
127127
token: ${{ secrets.GITHUB_TOKEN }}
128-
args: --all-targets --all-features -- -D warnings
128+
args: --all-targets --all-features
129129
docs:
130130
name: Docs
131131
runs-on: ubuntu-latest
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/helix/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,14 @@ pub trait RequestPost: Request {
378378
where
379379
Self: Sized,
380380
{
381-
let text = std::str::from_utf8(&response.body()).map_err(|e| {
381+
let text = std::str::from_utf8(response.body()).map_err(|e| {
382382
HelixRequestPostError::Utf8Error(response.body().clone(), e, uri.clone())
383383
})?;
384384
if let Ok(HelixRequestError {
385385
error,
386386
status,
387387
message,
388-
}) = parse_json::<HelixRequestError>(&text, false)
388+
}) = parse_json::<HelixRequestError>(text, false)
389389
{
390390
return Err(HelixRequestPostError::Error {
391391
error,
@@ -408,7 +408,7 @@ pub trait RequestPost: Request {
408408
where
409409
Self: Sized,
410410
{
411-
let response: InnerResponse<<Self as Request>::Response> = parse_json(&response, true)
411+
let response: InnerResponse<<Self as Request>::Response> = parse_json(response, true)
412412
.map_err(|e| {
413413
HelixRequestPostError::DeserializeError(
414414
response.to_string(),
@@ -471,14 +471,14 @@ pub trait RequestPatch: Request {
471471
where
472472
Self: Sized,
473473
{
474-
let text = std::str::from_utf8(&response.body()).map_err(|e| {
474+
let text = std::str::from_utf8(response.body()).map_err(|e| {
475475
HelixRequestPatchError::Utf8Error(response.body().clone(), e, uri.clone())
476476
})?;
477477
if let Ok(HelixRequestError {
478478
error,
479479
status,
480480
message,
481-
}) = parse_json::<HelixRequestError>(&text, false)
481+
}) = parse_json::<HelixRequestError>(text, false)
482482
{
483483
return Err(HelixRequestPatchError::Error {
484484
error,
@@ -540,14 +540,14 @@ pub trait RequestDelete: Request {
540540
where
541541
Self: Sized,
542542
{
543-
let text = std::str::from_utf8(&response.body()).map_err(|e| {
543+
let text = std::str::from_utf8(response.body()).map_err(|e| {
544544
HelixRequestDeleteError::Utf8Error(response.body().clone(), e, uri.clone())
545545
})?;
546546
if let Ok(HelixRequestError {
547547
error,
548548
status,
549549
message,
550-
}) = parse_json::<HelixRequestError>(&text, false)
550+
}) = parse_json::<HelixRequestError>(text, false)
551551
{
552552
return Err(HelixRequestDeleteError::Error {
553553
error,
@@ -616,14 +616,14 @@ pub trait RequestPut: Request {
616616
where
617617
Self: Sized,
618618
{
619-
let text = std::str::from_utf8(&response.body()).map_err(|e| {
619+
let text = std::str::from_utf8(response.body()).map_err(|e| {
620620
HelixRequestPutError::Utf8Error(response.body().clone(), e, uri.clone())
621621
})?;
622622
if let Ok(HelixRequestError {
623623
error,
624624
status,
625625
message,
626-
}) = parse_json::<HelixRequestError>(&text, false)
626+
}) = parse_json::<HelixRequestError>(text, false)
627627
{
628628
return Err(HelixRequestPutError::Error {
629629
error,
@@ -685,15 +685,15 @@ pub trait RequestGet: Request {
685685
where
686686
Self: Sized,
687687
{
688-
let text = std::str::from_utf8(&response.body()).map_err(|e| {
688+
let text = std::str::from_utf8(response.body()).map_err(|e| {
689689
HelixRequestGetError::Utf8Error(response.body().clone(), e, uri.clone())
690690
})?;
691691
//eprintln!("\n\nmessage is ------------ {} ------------", text);
692692
if let Ok(HelixRequestError {
693693
error,
694694
status,
695695
message,
696-
}) = parse_json::<HelixRequestError>(&text, false)
696+
}) = parse_json::<HelixRequestError>(text, false)
697697
{
698698
return Err(HelixRequestGetError::Error {
699699
error,

src/helix/moderation/check_automod_status.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl helix::HelixRequestBody for Vec<CheckAutoModStatusBody> {
105105
data: &'a Vec<CheckAutoModStatusBody>,
106106
}
107107

108-
serde_json::to_vec(&InnerBody { data: &self }).map_err(Into::into)
108+
serde_json::to_vec(&InnerBody { data: self }).map_err(Into::into)
109109
}
110110
}
111111

File renamed without changes.

src/helix/points/create_custom_rewards.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl RequestPost for CreateCustomRewardRequest {
143143
Self: Sized,
144144
{
145145
let response: helix::InnerResponse<Vec<Self::Response>> =
146-
helix::parse_json(&response_str, true).map_err(|e| {
146+
helix::parse_json(response_str, true).map_err(|e| {
147147
helix::HelixRequestPostError::DeserializeError(
148148
response_str.to_string(),
149149
e,
File renamed without changes.

src/helix/polls/create_poll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl RequestPost for CreatePollRequest {
150150
Self: Sized,
151151
{
152152
let response: helix::InnerResponse<Vec<Self::Response>> =
153-
helix::parse_json(&response_str, true).map_err(|e| {
153+
helix::parse_json(response_str, true).map_err(|e| {
154154
helix::HelixRequestPostError::DeserializeError(
155155
response_str.to_string(),
156156
e,
File renamed without changes.

src/helix/predictions/create_prediction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl RequestPost for CreatePredictionRequest {
142142
Self: Sized,
143143
{
144144
let response: helix::InnerResponse<Vec<Self::Response>> =
145-
helix::parse_json(&response_str, true).map_err(|e| {
145+
helix::parse_json(response_str, true).map_err(|e| {
146146
helix::HelixRequestPostError::DeserializeError(
147147
response_str.to_string(),
148148
e,
File renamed without changes.
File renamed without changes.

src/helix/search/search_categories.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl RequestGet for SearchCategoriesRequest {
8484
Self: Sized,
8585
{
8686
let response: helix::InnerResponse<Option<Self::Response>> =
87-
helix::parse_json(&response, true).map_err(|e| {
87+
helix::parse_json(response, true).map_err(|e| {
8888
helix::HelixRequestGetError::DeserializeError(
8989
response.to_string(),
9090
e,

src/helix/ser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ impl<'input, 'output> ser::Serializer for PairSerializer<'input, 'output> {
674674
_variant_index: u32,
675675
variant: &'static str,
676676
) -> Result<Self::Ok, Self::Error> {
677-
self.urlencoder.append_pair(self.key, &variant);
677+
self.urlencoder.append_pair(self.key, variant);
678678
Ok(self.urlencoder)
679679
}
680680

File renamed without changes.

src/helix/subscriptions/check_user_subscription.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl RequestGet for CheckUserSubscriptionRequest {
9595
Self: Sized,
9696
{
9797
let inner_response: helix::InnerResponse<Vec<_>> =
98-
helix::parse_json(&text, true).map_err(|e| {
98+
helix::parse_json(text, true).map_err(|e| {
9999
helix::HelixRequestGetError::DeserializeError(
100100
text.to_string(),
101101
e,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/helix/webhooks/hub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ impl<T: Topic> RequestPost for WebhookHubRequest<T> {
183183
where
184184
Self: Sized,
185185
{
186-
let text = std::str::from_utf8(&response.body()).map_err(|e| {
186+
let text = std::str::from_utf8(response.body()).map_err(|e| {
187187
helix::HelixRequestPostError::Utf8Error(response.body().clone(), e, uri.clone())
188188
})?;
189189
if let Ok(helix::HelixRequestError {
190190
error,
191191
status,
192192
message,
193-
}) = helix::parse_json::<helix::HelixRequestError>(&text, false)
193+
}) = helix::parse_json::<helix::HelixRequestError>(text, false)
194194
{
195195
return Err(helix::HelixRequestPostError::Error {
196196
error,
File renamed without changes.

src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![cfg_attr(nightly, deny(rustdoc::broken_intra_doc_links))]
44
#![cfg_attr(nightly, feature(doc_cfg))]
55
#![doc(html_root_url = "https://docs.rs/twitch_api2/0.5.0")]
6-
#![cfg_attr(all(nightly, doctest), feature(external_doc))]
76
//! [![github]](https://github.com/emilgardis/twitch_api2)&ensp;[![crates-io]](https://crates.io/crates/twitch_api2)&ensp;[![docs-rs-big]](https://docs.rs/twitch_api2/0.5.0/twitch_api2)
87
//!
98
//! [github]: https://img.shields.io/badge/github-emilgardis/twitch__api2-8da0cb?style=for-the-badge&labelColor=555555&logo=github"
@@ -90,8 +89,12 @@
9089
//! | <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-size: 80%; line-height: 1.2;"><code>deny_unknown_fields</code></span> | 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. |
9190
//!
9291
93-
#[doc(include = "../README.md")]
94-
#[cfg(all(doctest, feature = "all"))]
92+
// FIXME: This is a hack to prevent early pass failing on
93+
// `arbitrary expressions in key-value attributes are unstable` on stable rust pre 1.54.
94+
// Remove when MSRV 1.54 (or when hits stable)
95+
// https://github.com/rust-lang/rust/issues/82768
96+
/// Doc test for README
97+
#[cfg_attr(all(doctest, nightly, feature = "all"), cfg_attr(all(doctest, nightly, feature = "all"), doc = include_str!("../README.md")))]
9598
pub struct ReadmeDoctests;
9699

97100
pub mod types;

0 commit comments

Comments
 (0)