forked from mirror/Riven
1
0
Fork 0

Add rustfmt.toml

v/2.x.x
Mingwei Samuel 2024-01-20 19:41:46 -08:00
parent 33ef298039
commit 8d810ccca8
25 changed files with 39 additions and 76 deletions

View File

@ -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.

View File

@ -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,

View File

@ -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 {

View File

@ -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;

View File

@ -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::*;

View File

@ -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 {

View File

@ -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.

View File

@ -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);
}

View File

@ -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.
///

View File

@ -3,11 +3,9 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::RU;

View File

@ -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;

View File

@ -3,11 +3,9 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::JP1;

View File

@ -3,11 +3,9 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: RegionalRoute = RegionalRoute::EUROPE;

View File

@ -3,11 +3,9 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::EUW1;

View File

@ -3,11 +3,9 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::EUW1;

View File

@ -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;

View File

@ -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 {}.", "");

View File

@ -3,11 +3,9 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::PH2;

View File

@ -3,11 +3,9 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::SG2;

View File

@ -3,11 +3,9 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::TH2;

View File

@ -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;

View File

@ -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;

View File

@ -3,11 +3,9 @@
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::VN2;

View File

@ -3,7 +3,6 @@
use std::future::Future;
use lazy_static::lazy_static;
use riven::consts::{PlatformRoute, QueueType, RegionalRoute};
use riven::{RiotApi, RiotApiConfig};

10
rustfmt.toml Normal file
View File

@ -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