Skip to content

Commit dcfc133

Browse files
chore(deps): update criterion requirement from 0.5 to 0.6 (#99)
* chore(deps): update criterion requirement from 0.5 to 0.6 Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version. - [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md) - [Commits](bheisler/criterion.rs@0.5.0...0.6.0) --- updated-dependencies: - dependency-name: criterion dependency-version: 0.6.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * refactor(api): 更新依赖版本并简化错误处理 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Hubert Shelley <46239302+hubertshelley@users.noreply.github.com>
1 parent 73fbf5b commit dcfc133

File tree

11 files changed

+81
-80
lines changed

11 files changed

+81
-80
lines changed

Cargo.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ version = "2.5.1"
1414

1515
[workspace.dependencies]
1616
async-trait = "0.1.88"
17-
tokio = { version = "1.44.2", features = ["full"] }
18-
tonic = "0.13.0"
17+
tokio = { version = "1", features = ["full"] }
18+
tonic = "0.13"
1919
prost = "0.13"
20-
http = "1.3.1"
21-
hyper-util = "0.1.11"
22-
hyper = "1.6.0"
23-
tower = "0.5.2"
24-
tonic-build = "0.13.0"
20+
http = "1"
21+
hyper-util = "0.1"
22+
hyper = "1"
23+
tower = "0.5"
24+
tonic-build = "0.13"
2525
tokio_wasi = { version = "1", features = ["full"] }
26-
tokio-stream = { version = "0.1.17", features = ["net"] }
27-
futures-util = "0.3.31"
28-
once_cell = "1.21.3"
29-
tokio-tungstenite = "0.26.2"
26+
tokio-stream = { version = "0.1", features = ["net"] }
27+
futures-util = "0.3"
28+
once_cell = "1"
29+
tokio-tungstenite = "0.26"
3030
tracing-subscriber = "0.3"
31-
headers = "0.4.0"
32-
serde = { version = "1.0.219", features = ["derive"] }
33-
uuid = { version = "1.16.0", features = ["serde", "v4"] }
31+
headers = "0.4"
32+
serde = { version = "1", features = ["derive"] }
33+
uuid = { version = "1", features = ["serde", "v4"] }
3434
parking_lot = "0.12"
3535
chrono = "0.4"
3636
dlopen2 = { version = "0.7.0", features = ["derive"] }
37-
h2 = "0.4.9"
37+
h2 = "0.4"

benchmark/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ publish = false
88
silent = { path = "../silent" }
99

1010
[dev-dependencies]
11-
criterion = "0.5"
11+
criterion = "0.6"
1212

1313
[[bench]]
1414
name = "route_benchmark"

examples/grpc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ silent = { path = "../../silent", features = ["grpc"] }
2121
async-trait.workspace = true
2222

2323
[build-dependencies]
24-
tonic-build = { version = "0.13.0" }
24+
tonic-build = { version = "0.13" }

examples/grpc_streaming/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ tokio-stream.workspace = true
2323
h2.workspace = true
2424

2525
[build-dependencies]
26-
tonic-build = { version = "0.13.0" }
26+
tonic-build = { version = "0.13" }

examples/tls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ publish = false
1010
silent = { path = "../../silent", features = ["tls"] }
1111
tokio = { version = "1", features = ["full"] }
1212
tokio-rustls = { version = "0.26.2" }
13-
rustls = { version = "0.23.26" }
13+
rustls = { version = "0.23" }

silent/Cargo.toml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -35,61 +35,61 @@ tls = ["dep:tokio-rustls"]
3535

3636
[dependencies]
3737
# Basic dependencies
38-
thiserror = "2.0.12"
39-
hyper = { version = "1.6.0", features = ["full"] }
40-
hyper-util = { version = "0.1.11", features = ["server-auto", "tokio"] }
41-
tokio = { version = "1.44.2", optional = true }
42-
bytes = "1.10.1"
43-
http-body-util = "0.1.3"
44-
tracing = "0.1.41"
45-
tracing-subscriber = { version = "0.3.19", features = ["chrono"] }
46-
async-trait = "0.1.88"
47-
serde = { version = "1.0.219", features = ["derive"] }
48-
serde_json = "1.0.140"
49-
uuid = "1.16.0"
50-
url = "2.5.4"
51-
serde_html_form = "0.2.7"
52-
mime = "0.3.17"
53-
futures-util = "0.3.31"
54-
chrono = { version = "0.4.40", default-features = false, features = ["clock"] }
55-
tokio-tungstenite = { version = "0.26.2", optional = true }
56-
headers = "0.4.0"
57-
tokio-stream = { version = "0.1.17", features = ["net"], optional = true }
58-
pin-project = { version = "1.1", optional = true }
59-
pin-project-lite = { version = "0.2.16", optional = true }
60-
http = "1.3.1"
61-
http-body = "1.0.1"
62-
tokio-util = "0.7.14"
63-
anyhow = "1.0.98"
64-
urlencoding = { version = "2.1.3", optional = true }
38+
thiserror = "2"
39+
hyper = { version = "1", features = ["full"] }
40+
hyper-util = { version = "0.1", features = ["server-auto", "tokio"] }
41+
tokio = { version = "1", optional = true }
42+
bytes = "1"
43+
http-body-util = "0.1"
44+
tracing = "0.1"
45+
tracing-subscriber = { version = "0.3", features = ["chrono"] }
46+
async-trait = "0.1"
47+
serde = { version = "1", features = ["derive"] }
48+
serde_json = "1"
49+
uuid = "1.17"
50+
url = "2"
51+
serde_html_form = "0.2"
52+
mime = "0.3"
53+
futures-util = "0.3"
54+
chrono = { version = "0.4", default-features = false, features = ["clock"] }
55+
tokio-tungstenite = { version = "0.26", optional = true }
56+
headers = "0.4"
57+
tokio-stream = { version = "0.1", features = ["net"], optional = true }
58+
pin-project = { version = "1", optional = true }
59+
pin-project-lite = { version = "0.2", optional = true }
60+
http = "1"
61+
http-body = "1"
62+
tokio-util = "0.7"
63+
anyhow = "1"
64+
urlencoding = { version = "2", optional = true }
6565

6666
# Scheduler
67-
cron = { version = "0.15.0", optional = true }
67+
cron = { version = "0.15", optional = true }
6868

6969
# Multipart
70-
multer = { version = "3.1.0", optional = true }
71-
multimap = { version = "0.10.0", features = ["serde"], optional = true }
72-
tempfile = { version = "3.19.1", optional = true }
73-
textnonce = { version = "1.0.0", optional = true }
70+
multer = { version = "3", optional = true }
71+
multimap = { version = "0.10", features = ["serde"], optional = true }
72+
tempfile = { version = "3", optional = true }
73+
textnonce = { version = "1", optional = true }
7474

7575

7676
# Template
77-
tera = { version = "1.20.0", optional = true }
77+
tera = { version = "1", optional = true }
7878

7979
# Session
80-
async-session = { version = "3.0.0", optional = true }
81-
cookie = { version = "0.18.1", features = ["secure", "percent-encode"], optional = true }
80+
async-session = { version = "3", optional = true }
81+
cookie = { version = "0.18", features = ["secure", "percent-encode"], optional = true }
8282

8383
# Grpc
84-
tonic = { version = "0.13.0", optional = true }
84+
tonic = { version = "0.13", optional = true }
8585

8686
# Security
87-
argon2 = { version = "0.5.3", optional = true }
87+
argon2 = { version = "0.5", optional = true }
8888
pbkdf2 = { version = "0.12", features = ["simple"], optional = true }
89-
aes-gcm = { version = "0.10.3", optional = true }
89+
aes-gcm = { version = "0.10", optional = true }
9090
aes = { version = "0.8", optional = true }
91-
rsa = { version = "0.9.8", optional = true }
92-
mime_guess = "2.0.5"
91+
rsa = { version = "0.9", optional = true }
92+
mime_guess = "2"
9393

9494
# tls
9595
tokio-rustls = { version = "0.26", optional = true, default-features = false, features = ["logging", "tls12"] }

silent/src/core/adapt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub trait ResponseAdapt {
2222
fn tran_from_response(res: Response<Self::Body>) -> Self;
2323
}
2424

25+
#[allow(clippy::result_large_err)]
2526
#[cfg(feature = "cookie")]
2627
fn get_cookie(req: &HyperRequest<ReqBody>) -> Result<CookieJar, SilentError> {
2728
let mut jar = CookieJar::new();

silent/src/core/req_body.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::io::{Error as IoError, ErrorKind};
1+
use std::io::Error as IoError;
22
use std::pin::Pin;
33
use std::task::{Context, Poll};
44

@@ -41,9 +41,7 @@ impl Body for ReqBody {
4141
match &mut *self {
4242
ReqBody::Empty => Poll::Ready(None),
4343
ReqBody::Once(bytes) => Poll::Ready(Some(Ok(Frame::data(bytes.clone())))),
44-
ReqBody::Incoming(body) => Pin::new(body)
45-
.poll_frame(cx)
46-
.map_err(|e| IoError::new(ErrorKind::Other, e)),
44+
ReqBody::Incoming(body) => Pin::new(body).poll_frame(cx).map_err(IoError::other),
4745
}
4846
}
4947

@@ -70,7 +68,7 @@ impl Stream for ReqBody {
7068
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
7169
match Body::poll_frame(self, cx) {
7270
Poll::Ready(Some(Ok(frame))) => Poll::Ready(frame.into_data().map(Ok).ok()),
73-
Poll::Ready(Some(Err(e))) => Poll::Ready(Some(Err(IoError::new(ErrorKind::Other, e)))),
71+
Poll::Ready(Some(Err(e))) => Poll::Ready(Some(Err(IoError::other(e)))),
7472
Poll::Ready(None) => Poll::Ready(None),
7573
Poll::Pending => Poll::Pending,
7674
}

silent/src/error/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ pub enum SilentError {
1515
/// IO 错误
1616
#[error("io error")]
1717
IOError(#[from] io::Error),
18-
#[cfg(feature = "upgrade")]
19-
/// Websocket IO 错误
20-
#[error("io error")]
21-
TungsteniteError(#[from] tokio_tungstenite::tungstenite::Error),
2218
/// 反序列化 错误
2319
#[error("serde_json error `{0}`")]
2420
SerdeJsonError(#[from] serde_json::Error),

silent/src/scheduler/process_time.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::str::FromStr;
66
#[derive(Debug, Clone)]
77
pub enum ProcessTime {
88
Datetime(DateTime<Local>),
9-
Crontab(Schedule),
9+
Crontab(Box<Schedule>),
1010
}
1111

1212
impl Serialize for ProcessTime {
@@ -27,7 +27,7 @@ impl TryFrom<String> for ProcessTime {
2727
fn try_from(value: String) -> Result<Self, Self::Error> {
2828
match DateTime::<Local>::from_str(&value) {
2929
Ok(datetime) => Ok(ProcessTime::Datetime(datetime)),
30-
Err(_) => Ok(ProcessTime::Crontab(Schedule::from_str(&value)?)),
30+
Err(_) => Ok(ProcessTime::Crontab(Box::from(Schedule::from_str(&value)?))),
3131
}
3232
}
3333
}
@@ -38,7 +38,7 @@ impl TryFrom<&str> for ProcessTime {
3838
fn try_from(value: &str) -> Result<Self, Self::Error> {
3939
match DateTime::<Local>::from_str(value) {
4040
Ok(datetime) => Ok(ProcessTime::Datetime(datetime)),
41-
Err(_) => Ok(ProcessTime::Crontab(Schedule::from_str(value)?)),
41+
Err(_) => Ok(ProcessTime::Crontab(Box::from(Schedule::from_str(value)?))),
4242
}
4343
}
4444
}
@@ -82,9 +82,11 @@ mod tests {
8282
assert!(!process_time.is_active());
8383
let process_time = ProcessTime::try_from(datetime).unwrap();
8484
assert!(process_time.is_active());
85-
let process_time = ProcessTime::Crontab(Schedule::from_str("* * * * * *").unwrap());
85+
let process_time =
86+
ProcessTime::Crontab(Box::from(Schedule::from_str("* * * * * *").unwrap()));
8687
assert!(process_time.is_active());
87-
let process_time = ProcessTime::Crontab(Schedule::from_str("0 0 0 1 1 ? 2015").unwrap());
88+
let process_time =
89+
ProcessTime::Crontab(Box::from(Schedule::from_str("0 0 0 1 1 ? 2015").unwrap()));
8890
assert!(!process_time.is_active());
8991
assert!(ProcessTime::try_from("2023-01-01T00:00:00Z".to_string()).is_ok());
9092
assert!(ProcessTime::try_from("2023-01-01 00:00:00").is_err());

0 commit comments

Comments
 (0)