Compare commits

..

No commits in common. "5cd3ea40a8da8bc52ace953ce831ce59cb7eca65" and "13c4fb567e5c905daa33e38b1f27a1dcfd4059d9" have entirely different histories.

9 changed files with 24 additions and 21 deletions

View File

@ -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.48.1
uses: taiki-e/install-action@v2.47.18
with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
@ -83,7 +83,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
- name: Install just, cargo-hack
uses: taiki-e/install-action@v2.48.1
uses: taiki-e/install-action@v2.47.18
with:
tool: just,cargo-hack

View File

@ -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.48.1
uses: taiki-e/install-action@v2.47.18
with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
@ -113,7 +113,7 @@ jobs:
toolchain: nightly
- name: Install just
uses: taiki-e/install-action@v2.48.1
uses: taiki-e/install-action@v2.47.18
with:
tool: just

View File

@ -24,7 +24,7 @@ jobs:
components: llvm-tools
- name: Install just, cargo-llvm-cov, cargo-nextest
uses: taiki-e/install-action@v2.48.1
uses: taiki-e/install-action@v2.47.18
with:
tool: just,cargo-llvm-cov,cargo-nextest
@ -32,7 +32,7 @@ jobs:
run: just test-coverage-codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.3.1
uses: codecov/codecov-action@v5.1.2
with:
files: codecov.json
fail_ci_if_error: true

View File

@ -77,12 +77,12 @@ jobs:
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
- name: Install just
uses: taiki-e/install-action@v2.48.1
uses: taiki-e/install-action@v2.47.18
with:
tool: just
- name: Install cargo-check-external-types
uses: taiki-e/cache-cargo-install-action@v2.1.0
uses: taiki-e/cache-cargo-install-action@v2.0.1
with:
tool: cargo-check-external-types

View File

@ -105,7 +105,7 @@ fn hex_pair_to_char(d1: u8, d2: u8) -> Option<u8> {
let d_low = char::from(d2).to_digit(16)?;
// left shift high nibble by 4 bits
Some(((d_high as u8) << 4) | (d_low as u8))
Some((d_high as u8) << 4 | (d_low as u8))
}
#[derive(Debug, Default, Clone)]

View File

@ -1021,7 +1021,6 @@ impl ResourceDef {
panic!("prefix resource definitions should not have tail segments");
}
#[allow(clippy::literal_string_with_formatting_args)]
if unprocessed.ends_with('*') {
// unnamed tail segment
@ -1370,7 +1369,6 @@ mod tests {
assert_eq!(path.unprocessed(), "");
}
#[expect(clippy::literal_string_with_formatting_args)]
#[test]
fn newline_patterns_and_paths() {
let re = ResourceDef::new("/user/a\nb");

View File

@ -145,7 +145,6 @@ mod tests {
};
#[allow(clippy::cognitive_complexity)]
#[expect(clippy::literal_string_with_formatting_args)]
#[test]
fn test_recognizer_1() {
let mut router = Router::<usize>::build();

View File

@ -2,10 +2,10 @@
## Unreleased
- Implement `Responder` for `Result<(), E: Into<Error>>`. Returning `Ok(())` responds with HTTP 204 No Content.
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
- Update `brotli` dependency to `7`.
- Minimum supported Rust version (MSRV) is now 1.75.
- Implemented responder for `Option<()>` and `Result<(), E: Error> to respond with `204 No Content`
## 4.9.0

View File

@ -116,6 +116,17 @@ impl<R: Responder> Responder for Option<R> {
}
}
//Note see https://github.com/actix/actix-web/issues/1108 on why Responder is not implemented for ()
impl Responder for Option<()> {
type Body = BoxBody;
fn respond_to(self, _req: &HttpRequest) -> HttpResponse {
match self {
Some(()) => HttpResponse::NoContent().finish(),
None => HttpResponse::NotFound().finish(),
}
}
}
impl<R, E> Responder for Result<R, E>
where
R: Responder,
@ -131,19 +142,14 @@ where
}
}
// Note: see https://github.com/actix/actix-web/issues/1108 for reasoning why Responder is not
// implemented for `()`, and https://github.com/actix/actix-web/pull/3560 for discussion about this
// impl and the decision not to include a similar one for `Option<()>`.
impl<E> Responder for Result<(), E>
where
E: Into<Error>,
{
//Note see https://github.com/actix/actix-web/issues/1108 on why Responder is not implemented for ()
impl<E: Into<Error>> Responder for Result<(), E> {
type Body = BoxBody;
fn respond_to(self, _req: &HttpRequest) -> HttpResponse {
match self {
Ok(()) => HttpResponse::new(StatusCode::NO_CONTENT),
Err(err) => HttpResponse::from_error(err.into()),
Err(e) => HttpResponse::from_error(e.into()),
}
}
}