forked from mirror/Riven
Add rustfmt.toml
parent
33ef298039
commit
8d810ccca8
|
@ -4,14 +4,12 @@ use std::convert::Infallible;
|
|||
|
||||
use http::{Method, Request, Response, StatusCode};
|
||||
use hyper::header::HeaderValue;
|
||||
use hyper::http;
|
||||
use hyper::service::{make_service_fn, service_fn};
|
||||
use hyper::{Body, Server};
|
||||
use hyper::{http, Body, Server};
|
||||
use lazy_static::lazy_static;
|
||||
use tracing as log;
|
||||
|
||||
use riven::consts::Route;
|
||||
use riven::{RiotApi, RiotApiConfig};
|
||||
use tracing as log;
|
||||
|
||||
lazy_static! {
|
||||
/// Create lazy static RiotApi instance.
|
||||
|
|
|
@ -5,8 +5,6 @@ use reqwest::header::{HeaderMap, HeaderValue};
|
|||
use reqwest::ClientBuilder;
|
||||
|
||||
/// Configuration for instantiating RiotApi.
|
||||
///
|
||||
///
|
||||
#[derive(Debug)]
|
||||
pub struct RiotApiConfig {
|
||||
pub(crate) base_url: String,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
///
|
||||
/// Also implements `AsRef<str>`, `Display`, and `From<&str>`.
|
||||
macro_rules! serde_strum_unknown {
|
||||
( $name:ident ) => {
|
||||
($name:ident) => {
|
||||
impl AsRef<str> for $name {
|
||||
fn as_ref(&self) -> &str {
|
||||
match self {
|
||||
|
|
|
@ -47,11 +47,8 @@ pub use route_ext::*;
|
|||
#[rustfmt::skip]
|
||||
mod season;
|
||||
pub use season::*;
|
||||
|
||||
/// Trait allowing iteration of enum types, implemented by several enums in this module.
|
||||
/// Re-exported from strum.
|
||||
///
|
||||
///
|
||||
pub use strum::IntoEnumIterator;
|
||||
|
||||
mod team;
|
||||
|
|
|
@ -4,9 +4,9 @@ mod rate_limit;
|
|||
pub use rate_limit::*;
|
||||
|
||||
mod rate_limit_type;
|
||||
pub use rate_limit_type::*;
|
||||
use std::time::Instant;
|
||||
|
||||
use std::time::Instant; // Hack for token_bucket_test.rs.
|
||||
pub use rate_limit_type::*; // Hack for token_bucket_test.rs.
|
||||
mod token_bucket;
|
||||
pub use token_bucket::*;
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
use std::cmp;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing as log;
|
||||
|
||||
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
|
||||
use reqwest::{Response, StatusCode};
|
||||
use scan_fmt::scan_fmt;
|
||||
use tokio::sync::Notify;
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing as log;
|
||||
|
||||
use super::RateLimitType;
|
||||
use super::{TokenBucket, VectorTokenBucket};
|
||||
use super::{RateLimitType, TokenBucket, VectorTokenBucket};
|
||||
use crate::RiotApiConfig;
|
||||
|
||||
pub struct RateLimit {
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
use std::future::Future;
|
||||
use std::sync::Arc;
|
||||
|
||||
use reqwest::{RequestBuilder, StatusCode};
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing as log;
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing::Instrument;
|
||||
|
||||
use reqwest::{RequestBuilder, StatusCode};
|
||||
|
||||
use super::{RateLimit, RateLimitType};
|
||||
use crate::util::InsertOnlyCHashMap;
|
||||
use crate::ResponseInfo;
|
||||
use crate::Result;
|
||||
use crate::RiotApiConfig;
|
||||
use crate::RiotApiError;
|
||||
|
||||
use super::RateLimit;
|
||||
use super::RateLimitType;
|
||||
use crate::{ResponseInfo, Result, RiotApiConfig, RiotApiError};
|
||||
|
||||
pub struct RegionalRequester {
|
||||
/// The app rate limit.
|
||||
|
|
|
@ -7,9 +7,10 @@ mod token_bucket {
|
|||
include!("token_bucket.rs");
|
||||
|
||||
mod tests {
|
||||
use super::*;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use super::*;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref ZERO: Duration = Duration::new(0, 0);
|
||||
}
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
use std::future::Future;
|
||||
use std::sync::Arc;
|
||||
|
||||
use reqwest::{Client, Method, RequestBuilder};
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing as log;
|
||||
|
||||
use reqwest::{Client, Method, RequestBuilder};
|
||||
|
||||
use crate::req::RegionalRequester;
|
||||
use crate::util::InsertOnlyCHashMap;
|
||||
use crate::ResponseInfo;
|
||||
use crate::Result;
|
||||
use crate::RiotApiConfig;
|
||||
use crate::RiotApiError;
|
||||
use crate::{ResponseInfo, Result, RiotApiConfig, RiotApiError};
|
||||
|
||||
/// For retrieving data from the Riot Games API.
|
||||
///
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::RU;
|
||||
|
||||
|
|
|
@ -3,12 +3,10 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use riven::models::tournament_stub_v5::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: RegionalRoute = RegionalRoute::AMERICAS;
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::JP1;
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: RegionalRoute = RegionalRoute::EUROPE;
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::EUW1;
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::EUW1;
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::RIOT_API;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::RIOT_API;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::LA1;
|
||||
|
||||
|
|
|
@ -3,12 +3,10 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use riven::models::summoner_v4::*;
|
||||
use testutils::*;
|
||||
|
||||
fn validate_summoners(s1: Summoner, s2: Summoner) -> Result<(), String> {
|
||||
rassert_eq!(s1.name, s2.name, "Names didn't match {}.", "");
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::PH2;
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::SG2;
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::TH2;
|
||||
|
||||
|
|
|
@ -3,12 +3,10 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::RIOT_API;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use riven::models::summoner_v4::Summoner;
|
||||
use testutils::RIOT_API;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::TR1;
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::RIOT_API;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::RIOT_API;
|
||||
|
||||
const ROUTE: ValPlatformRoute = ValPlatformRoute::LATAM;
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::*;
|
||||
|
||||
use colored::*;
|
||||
|
||||
use riven::consts::*;
|
||||
use testutils::*;
|
||||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::VN2;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
use std::future::Future;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use riven::consts::{PlatformRoute, QueueType, RegionalRoute};
|
||||
use riven::{RiotApi, RiotApiConfig};
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
format_code_in_doc_comments = true
|
||||
format_macro_matchers = true
|
||||
group_imports = "StdExternalCrate"
|
||||
hex_literal_case = "Lower"
|
||||
imports_granularity = "Module"
|
||||
newline_style = "Unix"
|
||||
normalize_comments = true
|
||||
normalize_doc_attributes = true
|
||||
use_field_init_shorthand = true
|
||||
use_try_shorthand = true
|
Loading…
Reference in New Issue