cloudflare / cloudflare/pingora

Trait methods should not take patterns like `mut IDENT` as arguments

Open
#354 1 comment 0 reactions 0 assignees View on GitHub
ergonomics Refactor
Dominant language
Rust
Stars
27.4k
Forks
1.7k
Avg merge
6h 22m
Merged PRs (30d)
3

Description

According to [E0642](https://doc.rust-lang.org/error_codes/E0642.html) and https://github.com/rust-lang/rust/issues/35203, trait methods should not take patterns as arguments, including patterns like `mut IDENT`. But Pingora is using it in several places.

https://github.com/cloudflare/pingora/blob/b0bd0fb0c9357e0edc6b7732116e268c934eabaf/pingora-core/src/services/background.rs#L34
https://github.com/cloudflare/pingora/blob/b0bd0fb0c9357e0edc6b7732116e268c934eabaf/pingora-core/src/apps/mod.rs#L48
https://github.com/cloudflare/pingora/blob/b0bd0fb0c9357e0edc6b7732116e268c934eabaf/pingora-core/src/apps/mod.rs#L74
https://github.com/cloudflare/pingora/blob/b0bd0fb0c9357e0edc6b7732116e268c934eabaf/pingora-core/src/services/mod.rs#L42

Without function body, `mut` seems ineffective. Is there a good reason to keep them?

## Pingora info

Please include the following information about your environment:

**Pingora version**: commit b0bd0fb0c9357e0edc6b7732116e268c934eabaf
**Rust version**: `cargo 1.80.1 (376290515 2024-07-16)`
**Operating system version**: N/A

Contributor guide

Open the contributing guide

Research direction

Read the trait method declarations in pingora-core/src/services/background.rs, pingora-core/src/apps/mod.rs, and pingora-core/src/services/mod.rs, then compare them with Rust error E0642 and issue #35203. Determine whether the mut patterns have any intended effect and whether they should be changed consistently; done means the affected declarations follow the documented rule and the crate still builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.