mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 15:51:06 +01:00
apply imports_granularity fmt rule
This commit is contained in:
parent
339b81e843
commit
1561bda822
@ -1,4 +1,9 @@
|
||||
use std::{collections::HashSet, convert::TryFrom, convert::TryInto, fmt, rc::Rc};
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
convert::{TryFrom, TryInto},
|
||||
fmt,
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
use actix_web::{
|
||||
dev::RequestHead,
|
||||
|
@ -1,8 +1,7 @@
|
||||
use actix_cors::Cors;
|
||||
use actix_utils::future::ok;
|
||||
use actix_web::dev::fn_service;
|
||||
use actix_web::{
|
||||
dev::{ServiceRequest, Transform},
|
||||
dev::{fn_service, ServiceRequest, Transform},
|
||||
http::{
|
||||
header::{self, HeaderValue},
|
||||
Method, StatusCode,
|
||||
|
@ -95,6 +95,4 @@ mod identity;
|
||||
mod identity_ext;
|
||||
mod middleware;
|
||||
|
||||
pub use self::identity::Identity;
|
||||
pub use self::identity_ext::IdentityExt;
|
||||
pub use self::middleware::IdentityMiddleware;
|
||||
pub use self::{identity::Identity, identity_ext::IdentityExt, middleware::IdentityMiddleware};
|
||||
|
@ -60,10 +60,7 @@ mod errors;
|
||||
mod middleware;
|
||||
mod status;
|
||||
|
||||
pub use self::builder::Builder;
|
||||
pub use self::errors::Error;
|
||||
pub use self::middleware::RateLimiter;
|
||||
pub use self::status::Status;
|
||||
pub use self::{builder::Builder, errors::Error, middleware::RateLimiter, status::Status};
|
||||
|
||||
/// Default request limit.
|
||||
pub const DEFAULT_REQUEST_LIMIT: usize = 5000;
|
||||
|
@ -266,14 +266,14 @@ impl ProtoBufResponseBuilder for HttpResponseBuilder {
|
||||
value
|
||||
.encode(&mut body)
|
||||
.map_err(ProtoBufPayloadError::Serialize)?;
|
||||
|
||||
Ok(self.body(body))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use actix_web::http::header;
|
||||
use actix_web::test::TestRequest;
|
||||
use actix_web::{http::header, test::TestRequest};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
@ -146,9 +146,11 @@ mod session;
|
||||
mod session_ext;
|
||||
pub mod storage;
|
||||
|
||||
pub use self::middleware::SessionMiddleware;
|
||||
pub use self::session::{Session, SessionGetError, SessionInsertError, SessionStatus};
|
||||
pub use self::session_ext::SessionExt;
|
||||
pub use self::{
|
||||
middleware::SessionMiddleware,
|
||||
session::{Session, SessionGetError, SessionInsertError, SessionStatus},
|
||||
session_ext::SessionExt,
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod test_helpers {
|
||||
@ -207,9 +209,11 @@ pub mod test_helpers {
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::config::{CookieContentSecurity, PersistentSession, TtlExtensionPolicy};
|
||||
use crate::{
|
||||
storage::SessionStore, test_helpers::key, Session, SessionExt, SessionMiddleware,
|
||||
config::{CookieContentSecurity, PersistentSession, TtlExtensionPolicy},
|
||||
storage::SessionStore,
|
||||
test_helpers::key,
|
||||
Session, SessionExt, SessionMiddleware,
|
||||
};
|
||||
|
||||
pub(super) async fn basic_workflow<F, Store>(
|
||||
|
@ -3,8 +3,10 @@
|
||||
mod interface;
|
||||
mod session_key;
|
||||
|
||||
pub use self::interface::{LoadError, SaveError, SessionStore, UpdateError};
|
||||
pub use self::session_key::SessionKey;
|
||||
pub use self::{
|
||||
interface::{LoadError, SaveError, SessionStore, UpdateError},
|
||||
session_key::SessionKey,
|
||||
};
|
||||
|
||||
#[cfg(feature = "cookie-session")]
|
||||
mod cookie;
|
||||
|
@ -1,13 +1,14 @@
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryInto;
|
||||
use std::{collections::HashMap, convert::TryInto};
|
||||
|
||||
use actix_session::storage::{LoadError, SaveError, SessionKey, SessionStore, UpdateError};
|
||||
use actix_session::{Session, SessionMiddleware};
|
||||
use actix_web::body::MessageBody;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_session::{
|
||||
storage::{LoadError, SaveError, SessionKey, SessionStore, UpdateError},
|
||||
Session, SessionMiddleware,
|
||||
};
|
||||
use actix_web::{
|
||||
body::MessageBody,
|
||||
cookie::{time::Duration, Key},
|
||||
dev::Service,
|
||||
http::StatusCode,
|
||||
test, web, App, Responder,
|
||||
};
|
||||
use anyhow::Error;
|
||||
|
@ -89,11 +89,13 @@ mod error;
|
||||
mod parse;
|
||||
mod settings;
|
||||
|
||||
pub use self::error::Error;
|
||||
pub use self::parse::Parse;
|
||||
pub use self::settings::{
|
||||
pub use self::{
|
||||
error::Error,
|
||||
parse::Parse,
|
||||
settings::{
|
||||
ActixSettings, Address, Backlog, KeepAlive, MaxConnectionRate, MaxConnections, Mode,
|
||||
NumWorkers, Timeout, Tls,
|
||||
},
|
||||
};
|
||||
|
||||
/// Convenience type alias for `Result<T, AtError>`.
|
||||
|
@ -10,15 +10,11 @@ mod num_workers;
|
||||
mod timeout;
|
||||
mod tls;
|
||||
|
||||
pub use self::address::Address;
|
||||
pub use self::backlog::Backlog;
|
||||
pub use self::keep_alive::KeepAlive;
|
||||
pub use self::max_connection_rate::MaxConnectionRate;
|
||||
pub use self::max_connections::MaxConnections;
|
||||
pub use self::mode::Mode;
|
||||
pub use self::num_workers::NumWorkers;
|
||||
pub use self::timeout::Timeout;
|
||||
pub use self::tls::Tls;
|
||||
pub use self::{
|
||||
address::Address, backlog::Backlog, keep_alive::KeepAlive,
|
||||
max_connection_rate::MaxConnectionRate, max_connections::MaxConnections, mode::Mode,
|
||||
num_workers::NumWorkers, timeout::Timeout, tls::Tls,
|
||||
};
|
||||
|
||||
/// Settings types for Actix Web.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize)]
|
||||
|
@ -1,7 +1,5 @@
|
||||
use actix_web::dev::ServiceRequest;
|
||||
use actix_web::{middleware, web, App, Error, HttpServer};
|
||||
use actix_web_httpauth::extractors::basic::BasicAuth;
|
||||
use actix_web_httpauth::middleware::HttpAuthentication;
|
||||
use actix_web::{dev::ServiceRequest, middleware, web, App, Error, HttpServer};
|
||||
use actix_web_httpauth::{extractors::basic::BasicAuth, middleware::HttpAuthentication};
|
||||
|
||||
async fn validator(
|
||||
req: ServiceRequest,
|
||||
|
@ -5,5 +5,4 @@ pub mod bearer;
|
||||
mod config;
|
||||
mod errors;
|
||||
|
||||
pub use self::config::AuthExtractorConfig;
|
||||
pub use self::errors::AuthenticationError;
|
||||
pub use self::{config::AuthExtractorConfig, errors::AuthenticationError};
|
||||
|
@ -4,6 +4,8 @@ mod errors;
|
||||
mod header;
|
||||
mod scheme;
|
||||
|
||||
pub use self::errors::ParseError;
|
||||
pub use self::header::Authorization;
|
||||
pub use self::scheme::{basic::Basic, bearer::Bearer, Scheme};
|
||||
pub use self::{
|
||||
errors::ParseError,
|
||||
header::Authorization,
|
||||
scheme::{basic::Basic, bearer::Bearer, Scheme},
|
||||
};
|
||||
|
@ -5,8 +5,7 @@ use actix_web::{
|
||||
web::{BufMut, Bytes, BytesMut},
|
||||
};
|
||||
|
||||
use super::super::Challenge;
|
||||
use super::{BearerBuilder, Error};
|
||||
use super::{super::Challenge, BearerBuilder, Error};
|
||||
use crate::utils;
|
||||
|
||||
/// Challenge for [`WWW-Authenticate`] header with HTTP Bearer auth scheme, described in [RFC 6750].
|
||||
|
@ -4,9 +4,7 @@ mod builder;
|
||||
mod challenge;
|
||||
mod errors;
|
||||
|
||||
pub use self::builder::BearerBuilder;
|
||||
pub use self::challenge::Bearer;
|
||||
pub use self::errors::Error;
|
||||
pub use self::{builder::BearerBuilder, challenge::Bearer, errors::Error};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
@ -3,5 +3,7 @@
|
||||
mod challenge;
|
||||
mod header;
|
||||
|
||||
pub use self::challenge::{basic, bearer, Challenge};
|
||||
pub use self::header::WwwAuthenticate;
|
||||
pub use self::{
|
||||
challenge::{basic, bearer, Challenge},
|
||||
header::WwwAuthenticate,
|
||||
};
|
||||
|
@ -1,2 +1,3 @@
|
||||
reorder_imports = true
|
||||
group_imports = "StdExternalCrate"
|
||||
imports_granularity = "Crate"
|
||||
use_field_init_shorthand = true
|
||||
|
Loading…
Reference in New Issue
Block a user