1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-13 02:39:32 +00:00

Merge branch 'master' into asonix/fix-unused-struct-warning

This commit is contained in:
asonix 2024-05-08 17:44:55 -05:00 committed by GitHub
commit c7b332bd54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 15 additions and 18 deletions

View file

@ -45,7 +45,7 @@ jobs:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.version }}
- name: Install cargo-hack and cargo-ci-cache-clean - name: Install cargo-hack and cargo-ci-cache-clean
uses: taiki-e/install-action@v2.33.12 uses: taiki-e/install-action@v2.33.16
with: with:
tool: cargo-hack,cargo-ci-cache-clean tool: cargo-hack,cargo-ci-cache-clean
@ -88,7 +88,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- name: Install cargo-hack - name: Install cargo-hack
uses: taiki-e/install-action@v2.33.12 uses: taiki-e/install-action@v2.33.16
with: with:
tool: cargo-hack tool: cargo-hack
@ -109,7 +109,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- name: Install nextest - name: Install nextest
uses: taiki-e/install-action@v2.33.12 uses: taiki-e/install-action@v2.33.16
with: with:
tool: nextest tool: nextest

View file

@ -50,7 +50,7 @@ jobs:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.version }}
- name: Install cargo-hack and cargo-ci-cache-clean - name: Install cargo-hack and cargo-ci-cache-clean
uses: taiki-e/install-action@v2.33.12 uses: taiki-e/install-action@v2.33.16
with: with:
tool: cargo-hack,cargo-ci-cache-clean tool: cargo-hack,cargo-ci-cache-clean

View file

@ -23,7 +23,7 @@ jobs:
components: llvm-tools-preview components: llvm-tools-preview
- name: Install cargo-llvm-cov - name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2.33.12 uses: taiki-e/install-action@v2.33.16
with: with:
tool: cargo-llvm-cov tool: cargo-llvm-cov
@ -31,7 +31,7 @@ jobs:
run: cargo llvm-cov --workspace --all-features --codecov --output-path codecov.json run: cargo llvm-cov --workspace --all-features --codecov --output-path codecov.json
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.3.0 uses: codecov/codecov-action@v4.3.1
with: with:
files: codecov.json files: codecov.json
fail_ci_if_error: true fail_ci_if_error: true

View file

@ -82,7 +82,7 @@ jobs:
toolchain: nightly-2024-04-26 toolchain: nightly-2024-04-26
- name: Install cargo-public-api - name: Install cargo-public-api
uses: taiki-e/install-action@v2.33.12 uses: taiki-e/install-action@v2.33.16
with: with:
tool: cargo-public-api tool: cargo-public-api

View file

@ -706,7 +706,7 @@ where
req.head_mut().peer_addr = *this.peer_addr; req.head_mut().peer_addr = *this.peer_addr;
req.conn_data = this.conn_data.clone(); req.conn_data.clone_from(this.conn_data);
match this.codec.message_type() { match this.codec.message_type() {
// request has no payload // request has no payload

View file

@ -126,7 +126,7 @@ where
head.headers = parts.headers.into(); head.headers = parts.headers.into();
head.peer_addr = this.peer_addr; head.peer_addr = this.peer_addr;
req.conn_data = this.conn_data.clone(); req.conn_data.clone_from(&this.conn_data);
let fut = this.flow.service.call(req); let fut = this.flow.service.call(req);
let config = this.config.clone(); let config = this.config.clone();

View file

@ -313,7 +313,8 @@ where
let entry = field_limits let entry = field_limits
.entry(field.name().to_owned()) .entry(field.name().to_owned())
.or_insert_with(|| T::limit(field.name())); .or_insert_with(|| T::limit(field.name()));
limits.field_limit_remaining = entry.to_owned();
limits.field_limit_remaining.clone_from(entry);
T::handle_field(&req, field, &mut limits, &mut state).await?; T::handle_field(&req, field, &mut limits, &mut state).await?;

View file

@ -154,15 +154,11 @@ impl<T: ResourcePath> Path<T> {
None None
} }
/// Get matched parameter by name. /// Returns matched parameter by name.
/// ///
/// If keyed parameter is not available empty string is used as default value. /// If keyed parameter is not available empty string is used as default value.
pub fn query(&self, key: &str) -> &str { pub fn query(&self, key: &str) -> &str {
if let Some(s) = self.get(key) { self.get(key).unwrap_or_default()
s
} else {
""
}
} }
/// Return iterator to items in parameter container. /// Return iterator to items in parameter container.

View file

@ -148,7 +148,7 @@ impl AppConfig {
#[cfg(test)] #[cfg(test)]
pub(crate) fn set_host(&mut self, host: &str) { pub(crate) fn set_host(&mut self, host: &str) {
self.host = host.to_owned(); host.clone_into(&mut self.host);
} }
} }

View file

@ -771,7 +771,7 @@ mod tests {
data3: web::Data<f64>| { data3: web::Data<f64>| {
assert_eq!(**data1, 10); assert_eq!(**data1, 10);
assert_eq!(**data2, '*'); assert_eq!(**data2, '*');
let error = std::f64::EPSILON; let error = f64::EPSILON;
assert!((**data3 - 1.0).abs() < error); assert!((**data3 - 1.0).abs() < error);
HttpResponse::Ok() HttpResponse::Ok()
}, },