Update sync_wrapper to 1.0.0 from 0.1.1

... and fix CI.
This commit is contained in:
mikihiro 2024-03-24 03:46:20 +09:00 committed by GitHub
parent 2ec68d6c4d
commit c6fd852844
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 38 additions and 45 deletions

View file

@ -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"
@ -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"

View file

@ -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"]

View file

@ -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},

View file

@ -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]

View file

@ -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() {

View file

@ -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]

View file

@ -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() {

View file

@ -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 {

View file

@ -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;
@ -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 {

View file

@ -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() {

View file

@ -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() {

View file

@ -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;

View file

@ -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() {

View file

@ -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

View file

@ -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

View file

@ -4,7 +4,6 @@ use axum::{
http::StatusCode,
response::{IntoResponse, Response},
routing::get,
body::Body,
Extension, Router,
};

View file

@ -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)

View file

@ -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"

View file

@ -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>;
}

View file

@ -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]

View file

@ -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() {

View file

@ -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;

View file

@ -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;

View file

@ -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());
}

View file

@ -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,
};

View file

@ -4,7 +4,6 @@ use tower::ServiceExt;
mod for_handlers {
use super::*;
use http::HeaderMap;
#[crate::test]
async fn get_handles_head() {
@ -39,7 +38,6 @@ mod for_handlers {
mod for_services {
use super::*;
use crate::routing::get_service;
#[crate::test]
async fn get_handles_head() {

View file

@ -1,5 +1,5 @@
use super::*;
use std::future::{pending, ready};
use std::future::pending;
use tower::timeout::TimeoutLayer;
async fn unit() {}

View file

@ -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() {

View file

@ -1,5 +1,4 @@
use super::*;
use crate::extract::Extension;
use std::collections::HashMap;
use tower_http::services::ServeDir;

View file

@ -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,

View file

@ -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 _;

View file

@ -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`