Skip to content

Commit

Permalink
refactor: remove absolute imports (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephLenton authored Sep 4, 2024
1 parent b7f3ea3 commit 626f2f3
Show file tree
Hide file tree
Showing 41 changed files with 872 additions and 872 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Using this library, you can host your application and query against it with requ
Then decode the responses, and assert what is returned.

```rust
use ::axum::Router;
use ::axum::routing::get;
use axum::Router;
use axum::routing::get;

use ::axum_test::TestServer;
use axum_test::TestServer;

async fn get_ping() -> &'static str {
"pong!"
Expand Down
46 changes: 23 additions & 23 deletions examples/example-shuttle/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@
//! At the bottom of this file are a series of tests for these endpoints.
//!
use ::anyhow::anyhow;
use ::anyhow::Result;
use ::axum::extract::Json;
use ::axum::extract::State;
use ::axum::routing::get;
use ::axum::routing::post;
use ::axum::routing::put;
use ::axum::Router;
use ::axum_extra::extract::cookie::Cookie;
use ::axum_extra::extract::cookie::CookieJar;
use ::http::StatusCode;
use ::serde::Deserialize;
use ::serde::Serialize;
use ::serde_email::Email;
use ::std::collections::HashMap;
use ::std::result::Result as StdResult;
use ::std::sync::Arc;
use ::std::sync::RwLock;
use anyhow::anyhow;
use anyhow::Result;
use axum::extract::Json;
use axum::extract::State;
use axum::routing::get;
use axum::routing::post;
use axum::routing::put;
use axum::Router;
use axum_extra::extract::cookie::Cookie;
use axum_extra::extract::cookie::CookieJar;
use http::StatusCode;
use serde::Deserialize;
use serde::Serialize;
use serde_email::Email;
use std::collections::HashMap;
use std::result::Result as StdResult;
use std::sync::Arc;
use std::sync::RwLock;

#[cfg(test)]
use ::axum_test::TestServer;
use axum_test::TestServer;
#[cfg(test)]
use ::axum_test::TestServerConfig;
use axum_test::TestServerConfig;

/// Main to start Shuttle application
#[shuttle_runtime::main]
Expand Down Expand Up @@ -166,7 +166,7 @@ pub async fn route_get_user_todos(
mod test_post_login {
use super::*;

use ::serde_json::json;
use serde_json::json;

#[tokio::test]
async fn it_should_create_session_on_login() {
Expand Down Expand Up @@ -205,7 +205,7 @@ mod test_post_login {
mod test_route_put_user_todos {
use super::*;

use ::serde_json::json;
use serde_json::json;

#[tokio::test]
async fn it_should_not_store_todos_without_login() {
Expand Down Expand Up @@ -260,7 +260,7 @@ mod test_route_put_user_todos {
mod test_route_get_user_todos {
use super::*;

use ::serde_json::json;
use serde_json::json;

#[tokio::test]
async fn it_should_not_return_todos_if_logged_out() {
Expand Down
56 changes: 28 additions & 28 deletions examples/example-todo/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@
//! At the bottom of this file are a series of tests for these endpoints.
//!
use ::anyhow::anyhow;
use ::anyhow::Result;
use ::axum::extract::Json;
use ::axum::extract::State;
use ::axum::routing::get;
use ::axum::routing::post;
use ::axum::routing::put;
use ::axum::serve::serve;
use ::axum::Router;
use ::axum_extra::extract::cookie::Cookie;
use ::axum_extra::extract::cookie::CookieJar;
use ::http::StatusCode;
use ::serde::Deserialize;
use ::serde::Serialize;
use ::serde_email::Email;
use ::std::collections::HashMap;
use ::std::net::IpAddr;
use ::std::net::Ipv4Addr;
use ::std::net::SocketAddr;
use ::std::result::Result as StdResult;
use ::std::sync::Arc;
use ::std::sync::RwLock;
use ::tokio::net::TcpListener;
use anyhow::anyhow;
use anyhow::Result;
use axum::extract::Json;
use axum::extract::State;
use axum::routing::get;
use axum::routing::post;
use axum::routing::put;
use axum::serve::serve;
use axum::Router;
use axum_extra::extract::cookie::Cookie;
use axum_extra::extract::cookie::CookieJar;
use http::StatusCode;
use serde::Deserialize;
use serde::Serialize;
use serde_email::Email;
use std::collections::HashMap;
use std::net::IpAddr;
use std::net::Ipv4Addr;
use std::net::SocketAddr;
use std::result::Result as StdResult;
use std::sync::Arc;
use std::sync::RwLock;
use tokio::net::TcpListener;

#[cfg(test)]
use ::axum_test::TestServer;
use axum_test::TestServer;
#[cfg(test)]
use ::axum_test::TestServerConfig;
use axum_test::TestServerConfig;

const PORT: u16 = 8080;
const USER_ID_COOKIE_NAME: &'static str = &"example-todo-user-id";
Expand Down Expand Up @@ -182,7 +182,7 @@ fn new_test_app() -> TestServer {
mod test_post_login {
use super::*;

use ::serde_json::json;
use serde_json::json;

#[tokio::test]
async fn it_should_create_session_on_login() {
Expand Down Expand Up @@ -221,7 +221,7 @@ mod test_post_login {
mod test_route_put_user_todos {
use super::*;

use ::serde_json::json;
use serde_json::json;

#[tokio::test]
async fn it_should_not_store_todos_without_login() {
Expand Down Expand Up @@ -276,7 +276,7 @@ mod test_route_put_user_todos {
mod test_route_get_user_todos {
use super::*;

use ::serde_json::json;
use serde_json::json;

#[tokio::test]
async fn it_should_not_return_todos_if_logged_out() {
Expand Down
48 changes: 24 additions & 24 deletions examples/example-websocket-chat/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@
//! ```
//!
use ::anyhow::Result;
use ::axum::extract::ws::Message;
use ::axum::extract::ws::WebSocket;
use ::axum::extract::Path;
use ::axum::extract::State;
use ::axum::extract::WebSocketUpgrade;
use ::axum::response::Response;
use ::axum::routing::get;
use ::axum::serve::serve;
use ::axum::Router;
use ::futures_util::SinkExt;
use ::futures_util::StreamExt;
use ::serde::Deserialize;
use ::serde::Serialize;
use ::std::collections::HashMap;
use ::std::net::IpAddr;
use ::std::net::Ipv4Addr;
use ::std::net::SocketAddr;
use ::std::sync::Arc;
use ::std::time::Duration;
use ::tokio::net::TcpListener;
use ::tokio::sync::RwLock;
use anyhow::Result;
use axum::extract::ws::Message;
use axum::extract::ws::WebSocket;
use axum::extract::Path;
use axum::extract::State;
use axum::extract::WebSocketUpgrade;
use axum::response::Response;
use axum::routing::get;
use axum::serve::serve;
use axum::Router;
use futures_util::SinkExt;
use futures_util::StreamExt;
use serde::Deserialize;
use serde::Serialize;
use std::collections::HashMap;
use std::net::IpAddr;
use std::net::Ipv4Addr;
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;
use tokio::net::TcpListener;
use tokio::sync::RwLock;

#[cfg(test)]
use ::axum_test::TestServer;
use axum_test::TestServer;
#[cfg(test)]
use ::axum_test::TestServerConfig;
use axum_test::TestServerConfig;

const PORT: u16 = 8080;

Expand Down
28 changes: 14 additions & 14 deletions examples/example-websocket-ping-pong/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
//! ```
//!
use ::anyhow::Result;
use ::axum::extract::ws::WebSocket;
use ::axum::extract::WebSocketUpgrade;
use ::axum::response::Response;
use ::axum::routing::get;
use ::axum::serve::serve;
use ::axum::Router;
use ::std::net::IpAddr;
use ::std::net::Ipv4Addr;
use ::std::net::SocketAddr;
use ::tokio::net::TcpListener;
use anyhow::Result;
use axum::extract::ws::WebSocket;
use axum::extract::WebSocketUpgrade;
use axum::response::Response;
use axum::routing::get;
use axum::serve::serve;
use axum::Router;
use std::net::IpAddr;
use std::net::Ipv4Addr;
use std::net::SocketAddr;
use tokio::net::TcpListener;

#[cfg(test)]
use ::axum_test::TestServer;
use axum_test::TestServer;
#[cfg(test)]
use ::axum_test::TestServerConfig;
use axum_test::TestServerConfig;

const PORT: u16 = 8080;

Expand Down Expand Up @@ -86,7 +86,7 @@ fn new_test_app() -> TestServer {
mod test_websockets_ping_pong {
use super::*;

use ::serde_json::json;
use serde_json::json;

#[tokio::test]
async fn it_should_start_a_websocket_connection() {
Expand Down
12 changes: 6 additions & 6 deletions src/internals/query_params_store.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use ::anyhow::Result;
use ::serde::Serialize;
use ::smallvec::SmallVec;
use ::std::fmt::Display;
use ::std::fmt::Formatter;
use ::std::fmt::Result as FmtResult;
use anyhow::Result;
use serde::Serialize;
use smallvec::SmallVec;
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result as FmtResult;

#[derive(Clone, Debug, PartialEq)]
pub struct QueryParamsStore {
Expand Down
4 changes: 2 additions & 2 deletions src/internals/request_path_formatter.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ::http::Method;
use ::std::fmt;
use http::Method;
use std::fmt;

use crate::internals::QueryParamsStore;

Expand Down
20 changes: 10 additions & 10 deletions src/internals/starting_tcp_setup.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use ::anyhow::Context;
use ::anyhow::Result;
use ::reserve_port::ReservedPort;
use ::std::net::IpAddr;
use ::std::net::Ipv4Addr;
use ::std::net::SocketAddr;
use ::std::net::TcpListener as StdTcpListener;
use ::tokio::net::TcpListener as TokioTcpListener;
use anyhow::Context;
use anyhow::Result;
use reserve_port::ReservedPort;
use std::net::IpAddr;
use std::net::Ipv4Addr;
use std::net::SocketAddr;
use std::net::TcpListener as StdTcpListener;
use tokio::net::TcpListener as TokioTcpListener;

pub const DEFAULT_IP_ADDRESS: IpAddr = IpAddr::V4(Ipv4Addr::LOCALHOST);

Expand Down Expand Up @@ -56,8 +56,8 @@ impl StartingTcpSetup {
#[cfg(test)]
mod test_new {
use super::*;
use ::regex::Regex;
use ::std::net::Ipv4Addr;
use regex::Regex;
use std::net::Ipv4Addr;

#[tokio::test]
async fn it_should_create_default_ip_with_random_port_when_none() {
Expand Down
4 changes: 2 additions & 2 deletions src/internals/status_code_formatter.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ::http::StatusCode;
use ::std::fmt;
use http::StatusCode;
use std::fmt;

#[derive(Debug, Copy, Clone, PartialEq)]
pub struct StatusCodeFormatter(pub StatusCode);
Expand Down
18 changes: 9 additions & 9 deletions src/internals/transport_layer/http_transport_layer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use ::anyhow::Result;
use ::axum::body::Body;
use ::http::Request;
use ::http::Response;
use ::hyper_util::client::legacy::Client;
use ::reserve_port::ReservedPort;
use ::std::future::Future;
use ::std::pin::Pin;
use ::url::Url;
use anyhow::Result;
use axum::body::Body;
use http::Request;
use http::Response;
use hyper_util::client::legacy::Client;
use reserve_port::ReservedPort;
use std::future::Future;
use std::pin::Pin;
use url::Url;

use crate::transport_layer::TransportLayer;
use crate::transport_layer::TransportLayerType;
Expand Down
24 changes: 12 additions & 12 deletions src/internals/transport_layer/mock_transport_layer.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use ::anyhow::Error as AnyhowError;
use ::anyhow::Result;
use ::axum::body::Body;
use ::axum::response::Response as AxumResponse;
use ::bytes::Bytes;
use ::http::Request;
use ::http::Response;
use ::std::fmt::Debug;
use ::std::future::Future;
use ::std::pin::Pin;
use ::tower::util::ServiceExt;
use ::tower::Service;
use anyhow::Error as AnyhowError;
use anyhow::Result;
use axum::body::Body;
use axum::response::Response as AxumResponse;
use bytes::Bytes;
use http::Request;
use http::Response;
use std::fmt::Debug;
use std::future::Future;
use std::pin::Pin;
use tower::util::ServiceExt;
use tower::Service;

use crate::transport_layer::TransportLayer;
use crate::transport_layer::TransportLayerType;
Expand Down
2 changes: 1 addition & 1 deletion src/internals/websockets/test_response_websocket.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ::hyper::upgrade::OnUpgrade;
use hyper::upgrade::OnUpgrade;

use crate::transport_layer::TransportLayerType;

Expand Down
Loading

0 comments on commit 626f2f3

Please sign in to comment.