Skip to content

Commit

Permalink
Merge branch 'actix:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
maartendeprez committed Aug 15, 2024
2 parents 4cf9189 + f61fcbe commit 7c95736
Show file tree
Hide file tree
Showing 52 changed files with 827 additions and 191 deletions.
7 changes: 7 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
disallowed-names = [
"e", # no single letter error bindings
]
disallowed-methods = [
"std::cell::RefCell::default()",
"std::rc::Rc::default()",
]
4 changes: 2 additions & 2 deletions .github/workflows/ci-post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
toolchain: ${{ matrix.version.version }}

- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
uses: taiki-e/install-action@v2.42.4
uses: taiki-e/install-action@v2.42.22
with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean

Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1.9.0

- name: Install just, cargo-hack
uses: taiki-e/install-action@v2.42.4
uses: taiki-e/install-action@v2.42.22
with:
tool: just,cargo-hack

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
toolchain: ${{ matrix.version.version }}

- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
uses: taiki-e/install-action@v2.42.4
uses: taiki-e/install-action@v2.42.22
with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean

Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
toolchain: nightly

- name: Install just
uses: taiki-e/install-action@v2.42.4
uses: taiki-e/install-action@v2.42.22
with:
tool: just

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
components: llvm-tools

- name: Install just, cargo-llvm-cov, cargo-nextest
uses: taiki-e/install-action@v2.42.4
uses: taiki-e/install-action@v2.42.22
with:
tool: just,cargo-llvm-cov,cargo-nextest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
toolchain: nightly-2024-05-01

- name: Install just
uses: taiki-e/install-action@v2.42.4
uses: taiki-e/install-action@v2.42.22
with:
tool: just

Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
toolchain: nightly-2024-06-07

- name: Install cargo-public-api
uses: taiki-e/install-action@v2.42.4
uses: taiki-e/install-action@v2.42.22
with:
tool: cargo-public-api

Expand Down
2 changes: 1 addition & 1 deletion actix-files/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl FilesService {

let (req, _) = req.into_parts();

(self.renderer)(&dir, &req).unwrap_or_else(|e| ServiceResponse::from_err(e, req))
(self.renderer)(&dir, &req).unwrap_or_else(|err| ServiceResponse::from_err(err, req))
}
}

Expand Down
2 changes: 1 addition & 1 deletion actix-http-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub async fn test_server_with_addr<F: ServerServiceFactory<TcpStream>>(
builder.set_verify(SslVerifyMode::NONE);
let _ = builder
.set_alpn_protos(b"\x02h2\x08http/1.1")
.map_err(|e| log::error!("Can not set alpn protocol: {:?}", e));
.map_err(|err| log::error!("Can not set ALPN protocol: {err}"));

Connector::new()
.conn_lifetime(Duration::from_secs(0))
Expand Down
2 changes: 2 additions & 0 deletions actix-http/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 3.9.0

### Added

- Implement `FromIterator<(HeaderName, HeaderValue)>` for `HeaderMap`.
Expand Down
2 changes: 1 addition & 1 deletion actix-http/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "actix-http"
version = "3.8.0"
version = "3.9.0"
authors = [
"Nikolay Kim <fafhrd91@gmail.com>",
"Rob Ede <robjtede@icloud.com>",
Expand Down
4 changes: 2 additions & 2 deletions actix-http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<!-- prettier-ignore-start -->

[![crates.io](https://img.shields.io/crates/v/actix-http?label=latest)](https://crates.io/crates/actix-http)
[![Documentation](https://docs.rs/actix-http/badge.svg?version=3.8.0)](https://docs.rs/actix-http/3.8.0)
[![Documentation](https://docs.rs/actix-http/badge.svg?version=3.9.0)](https://docs.rs/actix-http/3.9.0)
![Version](https://img.shields.io/badge/rustc-1.72+-ab6000.svg)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-http.svg)
<br />
[![dependency status](https://deps.rs/crate/actix-http/3.8.0/status.svg)](https://deps.rs/crate/actix-http/3.8.0)
[![dependency status](https://deps.rs/crate/actix-http/3.9.0/status.svg)](https://deps.rs/crate/actix-http/3.9.0)
[![Download](https://img.shields.io/crates/d/actix-http.svg)](https://crates.io/crates/actix-http)
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)

Expand Down
4 changes: 2 additions & 2 deletions actix-http/src/h1/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ impl MessageType for RequestHeadType {
_ => return Err(io::Error::new(io::ErrorKind::Other, "unsupported version")),
}
)
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
}
}

Expand Down Expand Up @@ -433,7 +433,7 @@ impl TransferEncoding {
buf.extend_from_slice(b"0\r\n\r\n");
} else {
writeln!(helpers::MutWriter(buf), "{:X}\r", msg.len())
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;

buf.reserve(msg.len() + 2);
buf.extend_from_slice(msg);
Expand Down
14 changes: 7 additions & 7 deletions actix-http/src/h1/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,23 +480,23 @@ where
let cfg = self.cfg.clone();

Box::pin(async move {
let expect = expect
.await
.map_err(|e| error!("Init http expect service error: {:?}", e))?;
let expect = expect.await.map_err(|err| {
tracing::error!("Initialization of HTTP expect service error: {err:?}");
})?;

let upgrade = match upgrade {
Some(upgrade) => {
let upgrade = upgrade
.await
.map_err(|e| error!("Init http upgrade service error: {:?}", e))?;
let upgrade = upgrade.await.map_err(|err| {
tracing::error!("Initialization of HTTP upgrade service error: {err:?}");
})?;
Some(upgrade)
}
None => None,
};

let service = service
.await
.map_err(|e| error!("Init http service error: {:?}", e))?;
.map_err(|err| error!("Initialization of HTTP service error: {err:?}"))?;

Ok(H1ServiceHandler::new(
cfg,
Expand Down
18 changes: 9 additions & 9 deletions actix-http/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,23 +775,23 @@ where
let cfg = self.cfg.clone();

Box::pin(async move {
let expect = expect
.await
.map_err(|e| error!("Init http expect service error: {:?}", e))?;
let expect = expect.await.map_err(|err| {
tracing::error!("Initialization of HTTP expect service error: {err:?}");
})?;

let upgrade = match upgrade {
Some(upgrade) => {
let upgrade = upgrade
.await
.map_err(|e| error!("Init http upgrade service error: {:?}", e))?;
let upgrade = upgrade.await.map_err(|err| {
tracing::error!("Initialization of HTTP upgrade service error: {err:?}");
})?;
Some(upgrade)
}
None => None,
};

let service = service
.await
.map_err(|e| error!("Init http service error: {:?}", e))?;
let service = service.await.map_err(|err| {
tracing::error!("Initialization of HTTP service error: {err:?}");
})?;

Ok(HttpServiceHandler::new(
cfg,
Expand Down
18 changes: 9 additions & 9 deletions actix-http/src/ws/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ mod inner {
{
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
DispatcherError::Service(ref e) => {
write!(fmt, "DispatcherError::Service({:?})", e)
DispatcherError::Service(ref err) => {
write!(fmt, "DispatcherError::Service({err:?})")
}
DispatcherError::Encoder(ref e) => {
write!(fmt, "DispatcherError::Encoder({:?})", e)
DispatcherError::Encoder(ref err) => {
write!(fmt, "DispatcherError::Encoder({err:?})")
}
DispatcherError::Decoder(ref e) => {
write!(fmt, "DispatcherError::Decoder({:?})", e)
DispatcherError::Decoder(ref err) => {
write!(fmt, "DispatcherError::Decoder({err:?})")
}
}
}
Expand All @@ -136,9 +136,9 @@ mod inner {
{
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
DispatcherError::Service(ref e) => write!(fmt, "{}", e),
DispatcherError::Encoder(ref e) => write!(fmt, "{:?}", e),
DispatcherError::Decoder(ref e) => write!(fmt, "{:?}", e),
DispatcherError::Service(ref err) => write!(fmt, "{err}"),
DispatcherError::Encoder(ref err) => write!(fmt, "{err:?}"),
DispatcherError::Decoder(ref err) => write!(fmt, "{err:?}"),
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions actix-multipart-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![allow(clippy::disallowed_names)] // false positives in some macro expansions

use std::collections::HashSet;

Expand Down Expand Up @@ -35,6 +36,7 @@ struct MultipartFormAttrs {
duplicate_field: DuplicateField,
}

#[allow(clippy::disallowed_names)] // false positive in macro expansion
#[derive(FromField, Default)]
#[darling(attributes(multipart), default)]
struct FieldAttrs {
Expand Down
5 changes: 0 additions & 5 deletions actix-router/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,6 @@ mod tests {
value: String,
}

#[derive(Deserialize)]
struct Id {
_id: String,
}

#[derive(Debug, Deserialize)]
struct Test1(String, u32);

Expand Down
16 changes: 9 additions & 7 deletions actix-router/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ impl<T: ResourcePath> Path<T> {
for (seg_name, val) in self.segments.iter() {
if name == seg_name {
return match val {
PathItem::Static(ref s) => Some(s),
PathItem::Segment(s, e) => {
Some(&self.path.path()[(*s as usize)..(*e as usize)])
PathItem::Static(ref seg) => Some(seg),
PathItem::Segment(start, end) => {
Some(&self.path.path()[(*start as usize)..(*end as usize)])
}
};
}
Expand Down Expand Up @@ -193,8 +193,10 @@ impl<'a, T: ResourcePath> Iterator for PathIter<'a, T> {
if self.idx < self.params.segment_count() {
let idx = self.idx;
let res = match self.params.segments[idx].1 {
PathItem::Static(ref s) => s,
PathItem::Segment(s, e) => &self.params.path.path()[(s as usize)..(e as usize)],
PathItem::Static(ref seg) => seg,
PathItem::Segment(start, end) => {
&self.params.path.path()[(start as usize)..(end as usize)]
}
};
self.idx += 1;
return Some((&self.params.segments[idx].0, res));
Expand All @@ -217,8 +219,8 @@ impl<T: ResourcePath> Index<usize> for Path<T> {

fn index(&self, idx: usize) -> &str {
match self.segments[idx].1 {
PathItem::Static(ref s) => s,
PathItem::Segment(s, e) => &self.path.path()[(s as usize)..(e as usize)],
PathItem::Static(ref seg) => seg,
PathItem::Segment(start, end) => &self.path.path()[(start as usize)..(end as usize)],
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion actix-web-actors/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

## Unreleased

- Take the encoded buffer when yielding bytes in the response stream rather than splitting the buffer, reducing memory use
## 4.3.1 <!-- v4.3.1+deprecated -->

- Reduce memory usage by `take`-ing (rather than `split`-ing) the encoded buffer when yielding bytes in the response stream.
- Mark crate as deprecated.
- Minimum supported Rust version (MSRV) is now 1.72.

## 4.3.0
Expand Down
11 changes: 6 additions & 5 deletions actix-web-actors/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[package]
name = "actix-web-actors"
version = "4.3.0"
version = "4.3.1+deprecated"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix actors support for Actix Web"
keywords = ["actix", "http", "web", "framework", "async"]
homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-web"
license = "MIT OR Apache-2.0"
edition = "2021"
homepage.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true

[package.metadata.cargo_check_external_types]
allowed_external_types = [
Expand Down
6 changes: 4 additions & 2 deletions actix-web-actors/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# `actix-web-actors`

> Actix actors support for Actix Web.
>
> This crate is deprecated. Migrate to [`actix-ws`](https://crates.io/crates/actix-ws).
<!-- prettier-ignore-start -->

[![crates.io](https://img.shields.io/crates/v/actix-web-actors?label=latest)](https://crates.io/crates/actix-web-actors)
[![Documentation](https://docs.rs/actix-web-actors/badge.svg?version=4.3.0)](https://docs.rs/actix-web-actors/4.3.0)
[![Documentation](https://docs.rs/actix-web-actors/badge.svg?version=4.3.1)](https://docs.rs/actix-web-actors/4.3.1)
![Version](https://img.shields.io/badge/rustc-1.72+-ab6000.svg)
![License](https://img.shields.io/crates/l/actix-web-actors.svg)
<br />
[![dependency status](https://deps.rs/crate/actix-web-actors/4.3.0/status.svg)](https://deps.rs/crate/actix-web-actors/4.3.0)
![maintenance-status](https://img.shields.io/badge/maintenance-deprecated-red.svg)
[![Download](https://img.shields.io/crates/d/actix-web-actors.svg)](https://crates.io/crates/actix-web-actors)
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)

Expand Down
2 changes: 2 additions & 0 deletions actix-web-actors/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Actix actors support for Actix Web.
//!
//! This crate is deprecated. Migrate to [`actix-ws`](https://crates.io/crates/actix-ws).
//!
//! # Examples
//!
//! ```no_run
Expand Down
7 changes: 2 additions & 5 deletions actix-web-actors/src/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,11 +796,8 @@ where
Some(frm) => {
let msg = match frm {
Frame::Text(data) => {
Message::Text(ByteString::try_from(data).map_err(|e| {
ProtocolError::Io(io::Error::new(
io::ErrorKind::Other,
format!("{}", e),
))
Message::Text(ByteString::try_from(data).map_err(|err| {
ProtocolError::Io(io::Error::new(io::ErrorKind::Other, err))
})?)
}
Frame::Binary(data) => Message::Binary(data),
Expand Down
7 changes: 7 additions & 0 deletions actix-web/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

## 4.9.0

### Added

- Add `middleware::from_fn()` helper.
- Add `web::ThinData` extractor.

## 4.8.0

### Added
Expand Down
Loading

0 comments on commit 7c95736

Please sign in to comment.