Skip to content

Commit

Permalink
Update sync_wrapper to 1.0.0 from 0.1.1
Browse files Browse the repository at this point in the history
... and fix CI.
  • Loading branch information
Hmikihiro authored Mar 23, 2024
1 parent 2ec68d6 commit c6fd852
Show file tree
Hide file tree
Showing 32 changed files with 38 additions and 45 deletions.
4 changes: 2 additions & 2 deletions axum-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
categories = ["asynchronous", "network-programming", "web-programming"]
description = "Core types and traits for axum"
edition = "2021"
rust-version = "1.56"
rust-version = "1.57"
homepage = "https://github.com/tokio-rs/axum"
keywords = ["http", "web", "framework"]
license = "MIT"
Expand All @@ -26,7 +26,7 @@ http-body = "1.0.0"
http-body-util = "0.1.0"
mime = "0.3.16"
pin-project-lite = "0.2.7"
sync_wrapper = "0.1.1"
sync_wrapper = "1.0.0"
tower-layer = "0.3"
tower-service = "0.3"

Expand Down
2 changes: 0 additions & 2 deletions axum-core/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ mod composite_rejection_tests {

#[allow(dead_code, unreachable_pub)]
mod defs {
use crate::{__composite_rejection, __define_rejection};

__define_rejection! {
#[status = BAD_REQUEST]
#[body = "error message 1"]
Expand Down
3 changes: 1 addition & 2 deletions axum-extra/src/extract/cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ axum_core::__impl_deref!(Cached);
#[cfg(test)]
mod tests {
use super::*;
use axum::{extract::FromRequestParts, http::Request, routing::get, Router};
use http::request::Parts;
use axum::{http::Request, routing::get, Router};
use std::{
convert::Infallible,
sync::atomic::{AtomicU32, Ordering},
Expand Down
2 changes: 1 addition & 1 deletion axum-extra/src/extract/form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ mod tests {
use super::*;
use crate::test_helpers::*;
use axum::{routing::post, Router};
use http::{header::CONTENT_TYPE, StatusCode};
use http::header::CONTENT_TYPE;
use serde::Deserialize;

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion axum-extra/src/extract/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ impl std::error::Error for InvalidBoundary {}
mod tests {
use super::*;
use crate::test_helpers::*;
use axum::{extract::DefaultBodyLimit, response::IntoResponse, routing::post, Router};
use axum::{extract::DefaultBodyLimit, routing::post, Router};

#[tokio::test]
async fn content_type_with_encoding() {
Expand Down
2 changes: 1 addition & 1 deletion axum-extra/src/extract/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ mod tests {
use super::*;
use crate::test_helpers::*;
use axum::{routing::post, Router};
use http::{header::CONTENT_TYPE, StatusCode};
use http::header::CONTENT_TYPE;
use serde::Deserialize;

#[tokio::test]
Expand Down
5 changes: 1 addition & 4 deletions axum-extra/src/extract/with_rejection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,10 @@ where

#[cfg(test)]
mod tests {
use super::*;
use axum::body::Body;
use axum::extract::FromRequestParts;
use axum::http::Request;
use axum::response::Response;
use http::request::Parts;

use super::*;

#[tokio::test]
async fn extractor_rejection_is_transformed() {
Expand Down
2 changes: 1 addition & 1 deletion axum-extra/src/json_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ mod tests {
use futures_util::StreamExt;
use http::StatusCode;
use serde::Deserialize;
use std::{convert::Infallible, error::Error};
use std::error::Error;

#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
struct User {
Expand Down
6 changes: 2 additions & 4 deletions axum-extra/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ pub use typed_header::TypedHeader;
#[cfg(feature = "protobuf")]
pub mod protobuf;

/// _not_ public API
#[cfg(feature = "typed-routing")]
#[doc(hidden)]
pub mod __private {
//! _not_ public API

use percent_encoding::{AsciiSet, CONTROLS};

pub use percent_encoding::utf8_percent_encode;
Expand All @@ -116,9 +115,8 @@ pub mod __private {
use axum_macros::__private_axum_test as test;

#[cfg(test)]
#[allow(unused_imports)]
pub(crate) mod test_helpers {
#![allow(unused_imports)]

use axum::{extract::Request, response::Response, serve};

mod test_client {
Expand Down
1 change: 0 additions & 1 deletion axum-extra/src/protobuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ mod tests {
use super::*;
use crate::test_helpers::*;
use axum::{routing::post, Router};
use http::StatusCode;

#[tokio::test]
async fn decode_body() {
Expand Down
2 changes: 1 addition & 1 deletion axum-extra/src/routing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ mod sealed {
mod tests {
use super::*;
use crate::test_helpers::*;
use axum::{extract::Path, http::StatusCode, routing::get};
use axum::{extract::Path, routing::get};

#[tokio::test]
async fn test_tsr() {
Expand Down
2 changes: 1 addition & 1 deletion axum-extra/src/routing/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl<S> From<Resource<S>> for Router<S> {
mod tests {
#[allow(unused_imports)]
use super::*;
use axum::{body::Body, extract::Path, http::Method, Router};
use axum::{body::Body, extract::Path, http::Method};
use http::Request;
use http_body_util::BodyExt;
use tower::ServiceExt;
Expand Down
2 changes: 1 addition & 1 deletion axum-extra/src/typed_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl std::error::Error for TypedHeaderRejection {
mod tests {
use super::*;
use crate::test_helpers::*;
use axum::{response::IntoResponse, routing::get, Router};
use axum::{routing::get, Router};

#[tokio::test]
async fn typed_header() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ error[E0277]: the trait bound `NotIntoResponse: IntoResponse` is not satisfied
axum::extract::rejection::FailedToBufferBody
axum::extract::rejection::LengthLimitError
axum::extract::rejection::UnknownBodyError
bytes::bytes_mut::BytesMut
axum::extract::rejection::InvalidUtf8
and $N others
note: required by a bound in `__axum_macros_check_handler_into_response::{closure#0}::check`
--> tests/debug_handler/fail/single_wrong_return_tuple.rs:6:23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ error[E0277]: the trait bound `bool: IntoResponse` is not satisfied
axum::extract::rejection::FailedToBufferBody
axum::extract::rejection::LengthLimitError
axum::extract::rejection::UnknownBodyError
bytes::bytes_mut::BytesMut
axum::extract::rejection::InvalidUtf8
and $N others
note: required by a bound in `__axum_macros_check_handler_into_response::{closure#0}::check`
--> tests/debug_handler/fail/wrong_return_type.rs:4:23
Expand Down
1 change: 0 additions & 1 deletion axum-macros/tests/from_request/pass/override_rejection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use axum::{
http::StatusCode,
response::{IntoResponse, Response},
routing::get,
body::Body,
Extension, Router,
};

Expand Down
11 changes: 11 additions & 0 deletions axum-macros/tests/typed_path/fail/not_deserialize.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@ error[E0277]: the trait bound `MyPath: serde::de::DeserializeOwned` is not satis
= note: required for `MyPath` to implement `serde::de::DeserializeOwned`
= note: required for `axum::extract::Path<MyPath>` to implement `FromRequestParts<S>`
= note: this error originates in the derive macro `TypedPath` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `MyPath: serde::de::DeserializeOwned` is not satisfied
--> tests/typed_path/fail/not_deserialize.rs:3:10
|
3 | #[derive(TypedPath)]
| ^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `MyPath`, which is required by `axum::extract::Path<MyPath>: FromRequestParts<S>`
|
= help: the trait `FromRequestParts<S>` is implemented for `axum::extract::Path<T>`
= note: required for `MyPath` to implement `serde::de::DeserializeOwned`
= note: required for `axum::extract::Path<MyPath>` to implement `FromRequestParts<S>`
= note: this error originates in the attribute macro `::axum::async_trait` (in Nightly builds, run with -Z macro-backtrace for more info)
2 changes: 1 addition & 1 deletion axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mime = "0.3.16"
percent-encoding = "2.1"
pin-project-lite = "0.2.7"
serde = "1.0"
sync_wrapper = "0.1.1"
sync_wrapper = "1.0.0"
tower = { version = "0.4.13", default-features = false, features = ["util"] }
tower-layer = "0.3.2"
tower-service = "0.3"
Expand Down
1 change: 1 addition & 0 deletions axum/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub(crate) trait ErasedIntoRoute<S, E>: Send {

fn into_route(self: Box<Self>, state: S) -> Route<E>;

#[allow(dead_code)]
fn call_with_state(self: Box<Self>, request: Request, state: S) -> RouteFuture<E>;
}

Expand Down
1 change: 0 additions & 1 deletion axum/src/extract/connect_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ where
mod tests {
use super::*;
use crate::{routing::get, serve::IncomingStream, test_helpers::TestClient, Router};
use std::net::SocketAddr;
use tokio::net::TcpListener;

#[crate::test]
Expand Down
2 changes: 1 addition & 1 deletion axum/src/extract/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ mod tests {
use axum_core::extract::DefaultBodyLimit;

use super::*;
use crate::{response::IntoResponse, routing::post, test_helpers::*, Router};
use crate::{routing::post, test_helpers::*, Router};

#[crate::test]
async fn content_type_with_encoding() {
Expand Down
1 change: 0 additions & 1 deletion axum/src/extract/path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ impl IntoResponse for InvalidUtf8InPathParam {
mod tests {
use super::*;
use crate::{routing::get, test_helpers::*, Router};
use http::StatusCode;
use serde::Deserialize;
use std::collections::HashMap;

Expand Down
2 changes: 1 addition & 1 deletion axum/src/extract/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ mod tests {
use std::future::ready;

use super::*;
use crate::{body::Body, routing::get, test_helpers::spawn_service, Router};
use crate::{routing::get, test_helpers::spawn_service, Router};
use http::{Request, Version};
use tokio_tungstenite::tungstenite;
use tower::ServiceExt;
Expand Down
4 changes: 2 additions & 2 deletions axum/src/response/sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,13 +559,13 @@ mod tests {

let event_fields = parse_event(&stream.chunk_text().await.unwrap());
assert_eq!(event_fields.get("data").unwrap(), "{\"foo\":\"bar\"}");
assert!(event_fields.get("comment").is_none());
assert!(!event_fields.contains_key("comment"));

let event_fields = parse_event(&stream.chunk_text().await.unwrap());
assert_eq!(event_fields.get("event").unwrap(), "three");
assert_eq!(event_fields.get("retry").unwrap(), "30000");
assert_eq!(event_fields.get("id").unwrap(), "unique-id");
assert!(event_fields.get("comment").is_none());
assert!(!event_fields.contains_key("comment"));

assert!(stream.chunk_text().await.is_none());
}
Expand Down
5 changes: 2 additions & 3 deletions axum/src/routing/method_routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,12 +1247,11 @@ const _: () = {
#[cfg(test)]
mod tests {
use super::*;
use crate::{body::Body, extract::State, handler::HandlerWithoutStateExt};
use axum_core::response::IntoResponse;
use crate::{extract::State, handler::HandlerWithoutStateExt};
use http::{header::ALLOW, HeaderMap};
use http_body_util::BodyExt;
use std::time::Duration;
use tower::{Service, ServiceExt};
use tower::ServiceExt;
use tower_http::{
services::fs::ServeDir, timeout::TimeoutLayer, validate_request::ValidateRequestHeaderLayer,
};
Expand Down
2 changes: 0 additions & 2 deletions axum/src/routing/tests/get_to_head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use tower::ServiceExt;

mod for_handlers {
use super::*;
use http::HeaderMap;

#[crate::test]
async fn get_handles_head() {
Expand Down Expand Up @@ -39,7 +38,6 @@ mod for_handlers {

mod for_services {
use super::*;
use crate::routing::get_service;

#[crate::test]
async fn get_handles_head() {
Expand Down
2 changes: 1 addition & 1 deletion axum/src/routing/tests/handle_error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::*;
use std::future::{pending, ready};
use std::future::pending;
use tower::timeout::TimeoutLayer;

async fn unit() {}
Expand Down
3 changes: 1 addition & 2 deletions axum/src/routing/tests/merge.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use super::*;
use crate::{extract::OriginalUri, response::IntoResponse, Json};
use crate::extract::OriginalUri;
use serde_json::{json, Value};
use tower::limit::ConcurrencyLimitLayer;
use tower_http::timeout::TimeoutLayer;

#[crate::test]
async fn basic() {
Expand Down
1 change: 0 additions & 1 deletion axum/src/routing/tests/nest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::*;
use crate::extract::Extension;
use std::collections::HashMap;
use tower_http::services::ServeDir;

Expand Down
3 changes: 1 addition & 2 deletions axum/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ mod mutex {
}

#[cfg(test)]
#[allow(clippy::disallowed_types)]
mod mutex {
#![allow(clippy::disallowed_types)]

use std::sync::{
atomic::{AtomicUsize, Ordering},
LockResult, Mutex, MutexGuard,
Expand Down
2 changes: 1 addition & 1 deletion examples/sse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use axum::{
routing::get,
Router,
};
use axum_extra::{headers, TypedHeader};
use axum_extra::TypedHeader;
use futures::stream::{self, Stream};
use std::{convert::Infallible, path::PathBuf, time::Duration};
use tokio_stream::StreamExt as _;
Expand Down
1 change: 0 additions & 1 deletion examples/testing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ mod tests {
};
use http_body_util::BodyExt; // for `collect`
use serde_json::{json, Value};
use std::net::SocketAddr;
use tokio::net::TcpListener;
use tower::{Service, ServiceExt}; // for `call`, `oneshot`, and `ready`

Expand Down

0 comments on commit c6fd852

Please sign in to comment.