1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 09:12:57 +01:00

Consistent import formatting (#237)

This commit is contained in:
Luca Palmieri 2022-03-29 11:46:13 +01:00 committed by GitHub
parent aebf9ccf58
commit 8fd1772d5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 18 additions and 21 deletions

View File

@ -14,7 +14,7 @@ INSERT_PR_TYPE
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] 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

View File

@ -13,7 +13,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
components: rustfmt
- name: Check with rustfmt
uses: actions-rs/cargo@v1

View File

@ -1,5 +1,4 @@
use actix_web::{http::StatusCode, HttpResponse, ResponseError};
use derive_more::{Display, Error};
/// Errors that can occur when processing CORS guarded requests.

View File

@ -1,3 +1,4 @@
use actix_cors::Cors;
use actix_utils::future::ok;
use actix_web::dev::fn_service;
use actix_web::{
@ -11,8 +12,6 @@ use actix_web::{
};
use regex::bytes::Regex;
use actix_cors::Cors;
fn val_as_str(val: &HeaderValue) -> &str {
val.to_str().unwrap()
}

View File

@ -1,9 +1,6 @@
use std::{rc::Rc, time::SystemTime};
use actix_utils::future::{ready, Ready};
use serde::{Deserialize, Serialize};
use time::Duration;
use actix_web::{
cookie::{Cookie, CookieJar, Key, SameSite},
dev::{ServiceRequest, ServiceResponse},
@ -11,6 +8,8 @@ use actix_web::{
http::header::{self, HeaderValue},
HttpMessage,
};
use serde::{Deserialize, Serialize};
use time::Duration;
use crate::IdentityPolicy;

View File

@ -268,10 +268,11 @@ impl ProtoBufResponseBuilder for HttpResponseBuilder {
#[cfg(test)]
mod tests {
use super::*;
use actix_web::http::header;
use actix_web::test::TestRequest;
use super::*;
impl PartialEq for ProtoBufPayloadError {
fn eq(&self, other: &ProtoBufPayloadError) -> bool {
match *self {

View File

@ -4,9 +4,8 @@
#![warn(future_incompatible)]
mod redis;
pub use redis::{Command, RedisActor};
use derive_more::{Display, Error, From};
pub use redis::{Command, RedisActor};
/// General purpose `actix-redis` error.
#[derive(Debug, Display, Error, From)]

View File

@ -20,9 +20,7 @@ mod utils;
#[cfg(feature = "cookie-session")]
pub use cookie::CookieSessionStore;
#[cfg(feature = "redis-actor-session")]
pub use redis_actor::{RedisActorSessionStore, RedisActorSessionStoreBuilder};
#[cfg(feature = "redis-rs-session")]
pub use redis_rs::{RedisSessionStore, RedisSessionStoreBuilder};

View File

@ -1,3 +1,6 @@
use std::collections::HashMap;
use std::convert::TryInto;
use actix_session::storage::{LoadError, SaveError, SessionKey, SessionStore, UpdateError};
use actix_session::{Session, SessionMiddleware};
use actix_web::body::MessageBody;
@ -8,8 +11,6 @@ use actix_web::{
test, web, App, Responder,
};
use anyhow::Error;
use std::collections::HashMap;
use std::convert::TryInto;
#[actix_web::test]
async fn errors_are_opaque() {

View File

@ -1,5 +1,4 @@
use actix_web::{middleware, web, App, HttpServer};
use actix_web_httpauth::middleware::HttpAuthentication;
#[actix_web::main]

View File

@ -1,6 +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;

View File

@ -65,9 +65,10 @@ impl<C: 'static + Challenge> ResponseError for AuthenticationError<C> {
#[cfg(test)]
mod tests {
use actix_web::Error;
use super::*;
use crate::headers::www_authenticate::basic::Basic;
use actix_web::Error;
#[test]
fn test_status_code_is_preserved_across_error_conversions() {

View File

@ -239,15 +239,16 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::extractors::basic::BasicAuth;
use crate::extractors::bearer::BearerAuth;
use actix_service::{into_service, Service};
use actix_web::error::ErrorForbidden;
use actix_web::http::StatusCode;
use actix_web::test::TestRequest;
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
#[actix_web::test]
async fn test_middleware_panic() {

View File

@ -1 +1,2 @@
reorder_imports = true
group_imports = "StdExternalCrate"