Compare commits

...

7 Commits

Author SHA1 Message Date
Rob Ede 5cd3ea40a8
chore: fix changelog 2025-02-09 01:45:14 +00:00
Rob Ede a2a8edb3a5
chore: remove Option<()> impl 2025-02-09 01:44:34 +00:00
Rob Ede e1b204bb2a
Merge branch 'master' into implement-responder-for-unit 2025-02-09 01:41:15 +00:00
Rob Ede 33b487e854
chore: address clippy lints 2025-02-09 01:41:07 +00:00
dependabot[bot] 182055bcb5
build(deps): bump codecov/codecov-action from 5.1.2 to 5.3.1 (#3554)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.1.2 to 5.3.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v5.1.2...v5.3.1)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-03 18:59:22 +00:00
dependabot[bot] a36280466c
build(deps): bump taiki-e/cache-cargo-install-action from 2.0.1 to 2.1.0 (#3555)
Bumps [taiki-e/cache-cargo-install-action](https://github.com/taiki-e/cache-cargo-install-action) from 2.0.1 to 2.1.0.
- [Release notes](https://github.com/taiki-e/cache-cargo-install-action/releases)
- [Changelog](https://github.com/taiki-e/cache-cargo-install-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/cache-cargo-install-action/compare/v2.0.1...v2.1.0)

---
updated-dependencies:
- dependency-name: taiki-e/cache-cargo-install-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-03 18:59:09 +00:00
dependabot[bot] 8690f80a08
build(deps): bump taiki-e/install-action from 2.47.18 to 2.48.1 (#3563)
Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.47.18 to 2.48.1.
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/install-action/compare/v2.47.18...v2.48.1)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-03 16:57:05 +00:00
9 changed files with 21 additions and 24 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.47.18
uses: taiki-e/install-action@v2.48.1
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.47.18
uses: taiki-e/install-action@v2.48.1
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.47.18
uses: taiki-e/install-action@v2.48.1
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.47.18
uses: taiki-e/install-action@v2.48.1
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.47.18
uses: taiki-e/install-action@v2.48.1
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.1.2
uses: codecov/codecov-action@v5.3.1
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.47.18
uses: taiki-e/install-action@v2.48.1
with:
tool: just
- name: Install cargo-check-external-types
uses: taiki-e/cache-cargo-install-action@v2.0.1
uses: taiki-e/cache-cargo-install-action@v2.1.0
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,6 +1021,7 @@ 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
@ -1369,6 +1370,7 @@ 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,6 +145,7 @@ 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,17 +116,6 @@ 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,
@ -142,14 +131,19 @@ where
}
}
//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> {
// 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>,
{
type Body = BoxBody;
fn respond_to(self, _req: &HttpRequest) -> HttpResponse {
match self {
Ok(()) => HttpResponse::new(StatusCode::NO_CONTENT),
Err(e) => HttpResponse::from_error(e.into()),
Err(err) => HttpResponse::from_error(err.into()),
}
}
}