mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 15:51:06 +01:00
Consistent import formatting (#237)
This commit is contained in:
parent
aebf9ccf58
commit
8fd1772d5e
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -14,7 +14,7 @@ INSERT_PR_TYPE
|
|||||||
- [ ] Tests for the changes have been added / updated.
|
- [ ] Tests for the changes have been added / updated.
|
||||||
- [ ] Documentation comments have been added / updated.
|
- [ ] Documentation comments have been added / updated.
|
||||||
- [ ] A changelog entry has been made for the appropriate packages.
|
- [ ] A changelog entry has been made for the appropriate packages.
|
||||||
- [ ] Format code with the latest stable rustfmt.
|
- [ ] Format code with the nightly rustfmt (`cargo +nightly fmt`).
|
||||||
|
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: nightly
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
- name: Check with rustfmt
|
- name: Check with rustfmt
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use actix_web::{http::StatusCode, HttpResponse, ResponseError};
|
use actix_web::{http::StatusCode, HttpResponse, ResponseError};
|
||||||
|
|
||||||
use derive_more::{Display, Error};
|
use derive_more::{Display, Error};
|
||||||
|
|
||||||
/// Errors that can occur when processing CORS guarded requests.
|
/// Errors that can occur when processing CORS guarded requests.
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use actix_cors::Cors;
|
||||||
use actix_utils::future::ok;
|
use actix_utils::future::ok;
|
||||||
use actix_web::dev::fn_service;
|
use actix_web::dev::fn_service;
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
@ -11,8 +12,6 @@ use actix_web::{
|
|||||||
};
|
};
|
||||||
use regex::bytes::Regex;
|
use regex::bytes::Regex;
|
||||||
|
|
||||||
use actix_cors::Cors;
|
|
||||||
|
|
||||||
fn val_as_str(val: &HeaderValue) -> &str {
|
fn val_as_str(val: &HeaderValue) -> &str {
|
||||||
val.to_str().unwrap()
|
val.to_str().unwrap()
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
use std::{rc::Rc, time::SystemTime};
|
use std::{rc::Rc, time::SystemTime};
|
||||||
|
|
||||||
use actix_utils::future::{ready, Ready};
|
use actix_utils::future::{ready, Ready};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use time::Duration;
|
|
||||||
|
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
cookie::{Cookie, CookieJar, Key, SameSite},
|
cookie::{Cookie, CookieJar, Key, SameSite},
|
||||||
dev::{ServiceRequest, ServiceResponse},
|
dev::{ServiceRequest, ServiceResponse},
|
||||||
@ -11,6 +8,8 @@ use actix_web::{
|
|||||||
http::header::{self, HeaderValue},
|
http::header::{self, HeaderValue},
|
||||||
HttpMessage,
|
HttpMessage,
|
||||||
};
|
};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use time::Duration;
|
||||||
|
|
||||||
use crate::IdentityPolicy;
|
use crate::IdentityPolicy;
|
||||||
|
|
||||||
|
@ -268,10 +268,11 @@ impl ProtoBufResponseBuilder for HttpResponseBuilder {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use actix_web::http::header;
|
use actix_web::http::header;
|
||||||
use actix_web::test::TestRequest;
|
use actix_web::test::TestRequest;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
impl PartialEq for ProtoBufPayloadError {
|
impl PartialEq for ProtoBufPayloadError {
|
||||||
fn eq(&self, other: &ProtoBufPayloadError) -> bool {
|
fn eq(&self, other: &ProtoBufPayloadError) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -4,9 +4,8 @@
|
|||||||
#![warn(future_incompatible)]
|
#![warn(future_incompatible)]
|
||||||
|
|
||||||
mod redis;
|
mod redis;
|
||||||
pub use redis::{Command, RedisActor};
|
|
||||||
|
|
||||||
use derive_more::{Display, Error, From};
|
use derive_more::{Display, Error, From};
|
||||||
|
pub use redis::{Command, RedisActor};
|
||||||
|
|
||||||
/// General purpose `actix-redis` error.
|
/// General purpose `actix-redis` error.
|
||||||
#[derive(Debug, Display, Error, From)]
|
#[derive(Debug, Display, Error, From)]
|
||||||
|
@ -20,9 +20,7 @@ mod utils;
|
|||||||
|
|
||||||
#[cfg(feature = "cookie-session")]
|
#[cfg(feature = "cookie-session")]
|
||||||
pub use cookie::CookieSessionStore;
|
pub use cookie::CookieSessionStore;
|
||||||
|
|
||||||
#[cfg(feature = "redis-actor-session")]
|
#[cfg(feature = "redis-actor-session")]
|
||||||
pub use redis_actor::{RedisActorSessionStore, RedisActorSessionStoreBuilder};
|
pub use redis_actor::{RedisActorSessionStore, RedisActorSessionStoreBuilder};
|
||||||
|
|
||||||
#[cfg(feature = "redis-rs-session")]
|
#[cfg(feature = "redis-rs-session")]
|
||||||
pub use redis_rs::{RedisSessionStore, RedisSessionStoreBuilder};
|
pub use redis_rs::{RedisSessionStore, RedisSessionStoreBuilder};
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
use actix_session::storage::{LoadError, SaveError, SessionKey, SessionStore, UpdateError};
|
use actix_session::storage::{LoadError, SaveError, SessionKey, SessionStore, UpdateError};
|
||||||
use actix_session::{Session, SessionMiddleware};
|
use actix_session::{Session, SessionMiddleware};
|
||||||
use actix_web::body::MessageBody;
|
use actix_web::body::MessageBody;
|
||||||
@ -8,8 +11,6 @@ use actix_web::{
|
|||||||
test, web, App, Responder,
|
test, web, App, Responder,
|
||||||
};
|
};
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::convert::TryInto;
|
|
||||||
|
|
||||||
#[actix_web::test]
|
#[actix_web::test]
|
||||||
async fn errors_are_opaque() {
|
async fn errors_are_opaque() {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use actix_web::{middleware, web, App, HttpServer};
|
use actix_web::{middleware, web, App, HttpServer};
|
||||||
|
|
||||||
use actix_web_httpauth::middleware::HttpAuthentication;
|
use actix_web_httpauth::middleware::HttpAuthentication;
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use actix_web::dev::ServiceRequest;
|
use actix_web::dev::ServiceRequest;
|
||||||
use actix_web::{middleware, web, App, Error, HttpServer};
|
use actix_web::{middleware, web, App, Error, HttpServer};
|
||||||
|
|
||||||
use actix_web_httpauth::extractors::basic::BasicAuth;
|
use actix_web_httpauth::extractors::basic::BasicAuth;
|
||||||
use actix_web_httpauth::middleware::HttpAuthentication;
|
use actix_web_httpauth::middleware::HttpAuthentication;
|
||||||
|
|
||||||
|
@ -65,9 +65,10 @@ impl<C: 'static + Challenge> ResponseError for AuthenticationError<C> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use actix_web::Error;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::headers::www_authenticate::basic::Basic;
|
use crate::headers::www_authenticate::basic::Basic;
|
||||||
use actix_web::Error;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_status_code_is_preserved_across_error_conversions() {
|
fn test_status_code_is_preserved_across_error_conversions() {
|
||||||
|
@ -239,15 +239,16 @@ where
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use crate::extractors::basic::BasicAuth;
|
|
||||||
use crate::extractors::bearer::BearerAuth;
|
|
||||||
use actix_service::{into_service, Service};
|
use actix_service::{into_service, Service};
|
||||||
use actix_web::error::ErrorForbidden;
|
use actix_web::error::ErrorForbidden;
|
||||||
use actix_web::http::StatusCode;
|
use actix_web::http::StatusCode;
|
||||||
use actix_web::test::TestRequest;
|
use actix_web::test::TestRequest;
|
||||||
use actix_web::{error, web, App, HttpResponse};
|
use actix_web::{error, web, App, HttpResponse};
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
use crate::extractors::basic::BasicAuth;
|
||||||
|
use crate::extractors::bearer::BearerAuth;
|
||||||
|
|
||||||
/// This is a test for https://github.com/actix/actix-extras/issues/10
|
/// This is a test for https://github.com/actix/actix-extras/issues/10
|
||||||
#[actix_web::test]
|
#[actix_web::test]
|
||||||
async fn test_middleware_panic() {
|
async fn test_middleware_panic() {
|
||||||
|
@ -1 +1,2 @@
|
|||||||
reorder_imports = true
|
reorder_imports = true
|
||||||
|
group_imports = "StdExternalCrate"
|
||||||
|
Loading…
Reference in New Issue
Block a user