From 9dfe5a4aaa473f186be270379c9f71052392b72d Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Thu, 7 Nov 2019 12:45:13 -0800 Subject: [PATCH] Update to work on stable 1.39 --- Cargo.toml | 5 ++++- src/consts/champion.rs | 2 +- src/consts/game_mode.rs | 2 +- src/consts/map.rs | 2 +- src/consts/queue.rs | 2 +- src/consts/queue_type.rs | 2 +- src/consts/season.rs | 2 +- src/lib.rs | 7 ++++--- src/req/regional_requester.rs | 3 ++- srcgen/consts/champion.rs.dt | 2 +- srcgen/consts/game_mode.rs.dt | 2 +- srcgen/consts/map.rs.dt | 2 +- srcgen/consts/queue.rs.dt | 2 +- srcgen/consts/season.rs.dt | 2 +- tests/readme.rs.ignored | 4 ++-- tests/tests_euw.rs | 4 ++-- tests/tests_jp.rs | 4 ++-- tests/tests_kr.rs.ignored | 4 ++-- tests/tests_na.rs | 4 ++-- tests/tests_tr.rs | 4 ++-- 20 files changed, 33 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b74163c..69eea51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,13 @@ travis-ci = { repository = "MingweiSamuel/Riven" } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +nightly = [ "parking_lot/nightly" ] + [dependencies] log = "0.4" num_enum = "0.4" -parking_lot = { version = "0.9", features = [ "nightly" ] } +parking_lot = "0.9" reqwest = { version = "0.10.0-alpha.1", features = [ "gzip", "json" ] } scan_fmt = { version = "0.2", default-features = false } serde = { version = "1.0", features = [ "derive" ] } diff --git a/src/consts/champion.rs b/src/consts/champion.rs index e16f471..6c92390 100644 --- a/src/consts/champion.rs +++ b/src/consts/champion.rs @@ -14,7 +14,7 @@ use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr }; /// /// The documentation of each variant specifies:
/// NAME (`IDENTIFIER`, ID). -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(IntoPrimitive, TryFromPrimitive)] #[derive(Serialize_repr, Deserialize_repr)] diff --git a/src/consts/game_mode.rs b/src/consts/game_mode.rs index 1b99744..320c68d 100644 --- a/src/consts/game_mode.rs +++ b/src/consts/game_mode.rs @@ -10,7 +10,7 @@ use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr }; /// League of Legends game mode, such as Classic, /// ARAM, URF, One For All, Ascension, etc. -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(Eq, PartialEq, Hash)] #[derive(EnumString, Display, AsRefStr, IntoStaticStr)] diff --git a/src/consts/map.rs b/src/consts/map.rs index 624c235..27da758 100644 --- a/src/consts/map.rs +++ b/src/consts/map.rs @@ -10,7 +10,7 @@ use serde_repr::{ Serialize_repr, Deserialize_repr }; use num_enum::{ IntoPrimitive, TryFromPrimitive }; /// League of Legends maps. -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(Eq, PartialEq, Hash, PartialOrd, Ord)] #[derive(Serialize_repr, Deserialize_repr)] diff --git a/src/consts/queue.rs b/src/consts/queue.rs index 78e3495..d05742c 100644 --- a/src/consts/queue.rs +++ b/src/consts/queue.rs @@ -10,7 +10,7 @@ use serde_repr::{ Serialize_repr, Deserialize_repr }; use num_enum::{ IntoPrimitive, TryFromPrimitive }; /// League of Legends matchmaking queue. -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(Eq, PartialEq)] #[derive(Serialize_repr, Deserialize_repr)] diff --git a/src/consts/queue_type.rs b/src/consts/queue_type.rs index c9e33bf..2fe4e1f 100644 --- a/src/consts/queue_type.rs +++ b/src/consts/queue_type.rs @@ -1,7 +1,7 @@ use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr }; /// LoL or TFT ranked queue types. -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(Eq, PartialEq, Hash)] #[derive(EnumString, Display, AsRefStr, IntoStaticStr)] diff --git a/src/consts/season.rs b/src/consts/season.rs index 086bd0f..2d32136 100644 --- a/src/consts/season.rs +++ b/src/consts/season.rs @@ -10,7 +10,7 @@ use serde_repr::{ Serialize_repr, Deserialize_repr }; use num_enum::{ IntoPrimitive, TryFromPrimitive }; /// League of Legends matchmaking seasons. -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(Eq, PartialEq, Hash, PartialOrd, Ord)] #[derive(Serialize_repr, Deserialize_repr)] diff --git a/src/lib.rs b/src/lib.rs index 2184547..4876c67 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,10 @@ -#![feature(non_exhaustive)] -#![feature(external_doc)] +#![cfg_attr(feature = "nightly", feature(non_exhaustive))] +#![cfg_attr(feature = "nightly", feature(external_doc))] #![forbid(unsafe_code)] -#![doc(include = "../README.md")] +#![cfg_attr(feature = "nightly", doc(include = "../README.md"))] +#![cfg_attr(not(feature = "nightly"), doc("See [README.md](https://github.com/MingweiSamuel/Riven#----riven--------------------)."))] mod config; pub use config::RiotApiConfig; diff --git a/src/req/regional_requester.rs b/src/req/regional_requester.rs index b8e5f95..e09b327 100644 --- a/src/req/regional_requester.rs +++ b/src/req/regional_requester.rs @@ -41,7 +41,8 @@ impl RegionalRequester { -> impl Future>> + 'a { async move { - let query = query.as_deref(); + #[cfg(feature = "nightly")] let query = query.as_deref(); + #[cfg(not(feature = "nightly"))] let query = query.as_ref().map(|s| s.as_ref()); let mut retries: u8 = 0; loop { diff --git a/srcgen/consts/champion.rs.dt b/srcgen/consts/champion.rs.dt index 70e6db4..49db74d 100644 --- a/srcgen/consts/champion.rs.dt +++ b/srcgen/consts/champion.rs.dt @@ -22,7 +22,7 @@ use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr }; /// /// The documentation of each variant specifies:
/// NAME (`IDENTIFIER`, ID). -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(IntoPrimitive, TryFromPrimitive)] #[derive(Serialize_repr, Deserialize_repr)] diff --git a/srcgen/consts/game_mode.rs.dt b/srcgen/consts/game_mode.rs.dt index 5f823bf..b8d110a 100644 --- a/srcgen/consts/game_mode.rs.dt +++ b/srcgen/consts/game_mode.rs.dt @@ -7,7 +7,7 @@ use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr }; /// League of Legends game mode, such as Classic, /// ARAM, URF, One For All, Ascension, etc. -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(Eq, PartialEq, Hash)] #[derive(EnumString, Display, AsRefStr, IntoStaticStr)] diff --git a/srcgen/consts/map.rs.dt b/srcgen/consts/map.rs.dt index f1d6a53..243c164 100644 --- a/srcgen/consts/map.rs.dt +++ b/srcgen/consts/map.rs.dt @@ -9,7 +9,7 @@ use serde_repr::{ Serialize_repr, Deserialize_repr }; use num_enum::{ IntoPrimitive, TryFromPrimitive }; /// League of Legends maps. -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(Eq, PartialEq, Hash, PartialOrd, Ord)] #[derive(Serialize_repr, Deserialize_repr)] diff --git a/srcgen/consts/queue.rs.dt b/srcgen/consts/queue.rs.dt index c152344..a497202 100644 --- a/srcgen/consts/queue.rs.dt +++ b/srcgen/consts/queue.rs.dt @@ -13,7 +13,7 @@ use serde_repr::{ Serialize_repr, Deserialize_repr }; use num_enum::{ IntoPrimitive, TryFromPrimitive }; /// League of Legends matchmaking queue. -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(Eq, PartialEq)] #[derive(Serialize_repr, Deserialize_repr)] diff --git a/srcgen/consts/season.rs.dt b/srcgen/consts/season.rs.dt index aca5137..fa8ac34 100644 --- a/srcgen/consts/season.rs.dt +++ b/srcgen/consts/season.rs.dt @@ -7,7 +7,7 @@ use serde_repr::{ Serialize_repr, Deserialize_repr }; use num_enum::{ IntoPrimitive, TryFromPrimitive }; /// League of Legends matchmaking seasons. -#[non_exhaustive] +#[cfg_attr(feature = "nightly", non_exhaustive)] #[derive(Debug, Copy, Clone)] #[derive(Eq, PartialEq, Hash, PartialOrd, Ord)] #[derive(Serialize_repr, Deserialize_repr)] diff --git a/tests/readme.rs.ignored b/tests/readme.rs.ignored index 191023b..9677fd8 100644 --- a/tests/readme.rs.ignored +++ b/tests/readme.rs.ignored @@ -1,5 +1,5 @@ -#![feature(custom_test_frameworks)] -#![test_runner(my_runner)] +#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))] +#![cfg_attr(feature = "nightly", test_runner(my_runner))] fn my_runner(_: &[()]) { main() } use riven::RiotApi; diff --git a/tests/tests_euw.rs b/tests/tests_euw.rs index 227ca99..8217329 100644 --- a/tests/tests_euw.rs +++ b/tests/tests_euw.rs @@ -1,5 +1,5 @@ -#![feature(custom_test_frameworks)] -#![test_runner(my_runner)] +#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))] +#![cfg_attr(feature = "nightly", test_runner(my_runner))] mod async_tests; mod testutils; diff --git a/tests/tests_jp.rs b/tests/tests_jp.rs index 367e03b..10ed8f1 100644 --- a/tests/tests_jp.rs +++ b/tests/tests_jp.rs @@ -1,5 +1,5 @@ -#![feature(custom_test_frameworks)] -#![test_runner(my_runner)] +#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))] +#![cfg_attr(feature = "nightly", test_runner(my_runner))] mod async_tests; mod testutils; diff --git a/tests/tests_kr.rs.ignored b/tests/tests_kr.rs.ignored index 0657cd3..93b6765 100644 --- a/tests/tests_kr.rs.ignored +++ b/tests/tests_kr.rs.ignored @@ -1,6 +1,6 @@ -#![feature(custom_test_frameworks)] +#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))] #![feature(async_closure)] -#![test_runner(my_runner)] +#![cfg_attr(feature = "nightly", test_runner(my_runner))] mod async_tests; mod testutils; diff --git a/tests/tests_na.rs b/tests/tests_na.rs index 1f7002a..91d90f7 100644 --- a/tests/tests_na.rs +++ b/tests/tests_na.rs @@ -1,5 +1,5 @@ -#![feature(custom_test_frameworks)] -#![test_runner(my_runner)] +#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))] +#![cfg_attr(feature = "nightly", test_runner(my_runner))] mod async_tests; mod testutils; diff --git a/tests/tests_tr.rs b/tests/tests_tr.rs index 27841cb..b2e7dc0 100644 --- a/tests/tests_tr.rs +++ b/tests/tests_tr.rs @@ -1,5 +1,5 @@ -#![feature(custom_test_frameworks)] -#![test_runner(my_runner)] +#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))] +#![cfg_attr(feature = "nightly", test_runner(my_runner))] mod async_tests; mod testutils;