Skip to content

Commit

Permalink
Merge pull request #154 from Kuadrant/clippy-elide-lifetime
Browse files Browse the repository at this point in the history
clippy: elide needless lifetime
  • Loading branch information
adam-cattermole authored Dec 2, 2024
2 parents e249773 + 5f64ef5 commit 801911b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 132 deletions.
2 changes: 1 addition & 1 deletion src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<'de> Deserialize<'de> for Timeout {
}

struct TimeoutVisitor;
impl<'de> Visitor<'de> for TimeoutVisitor {
impl Visitor<'_> for TimeoutVisitor {
type Value = Timeout;

fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {
Expand Down
64 changes: 4 additions & 60 deletions tests/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,7 @@ fn it_auths() {
Some("envoy.service.auth.v3.Authorization"),
Some("Check"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58,
52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55,
46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8,
146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84,
26, 30, 10, 10, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98,
105, 95, 116, 101, 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5,
58, 112, 97, 116, 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101,
113, 117, 101, 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116,
104, 26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 34, 10,
47, 97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116,
111, 121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82,
8, 72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97,
117, 116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down Expand Up @@ -373,21 +359,7 @@ fn it_denies() {
Some("envoy.service.auth.v3.Authorization"),
Some("Check"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58,
52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55,
46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8,
146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84,
26, 30, 10, 10, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98,
105, 95, 116, 101, 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5,
58, 112, 97, 116, 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101,
113, 117, 101, 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116,
104, 26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 34, 10,
47, 97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116,
111, 121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82,
8, 72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97,
117, 116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down Expand Up @@ -588,21 +560,7 @@ fn it_does_not_fold_auth_actions() {
Some("envoy.service.auth.v3.Authorization"),
Some("Check"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 234, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58,
52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55,
46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8,
146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84,
26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 38, 10, 5,
58, 112, 97, 116, 104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101,
113, 117, 101, 115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116,
104, 26, 30, 10, 10, 58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97,
98, 105, 95, 116, 101, 115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 34, 10, 47,
97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111,
121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8,
72, 84, 84, 80, 47, 49, 46, 49, 82, 18, 10, 4, 104, 111, 115, 116, 18, 10, 97, 117,
116, 104, 45, 115, 99, 111, 112, 101, 90, 0,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down Expand Up @@ -700,21 +658,7 @@ fn it_does_not_fold_auth_actions() {
Some("envoy.service.auth.v3.Authorization"),
Some("Check"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 234, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58,
52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55,
46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8,
146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84,
26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 30, 10, 10,
58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, 105, 95, 116, 101,
115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, 58, 112, 97, 116,
104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, 113, 117, 101,
115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, 104, 34, 10, 47,
97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111,
121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8,
72, 84, 84, 80, 47, 49, 46, 49, 82, 18, 10, 4, 104, 111, 115, 116, 18, 10, 97, 117,
116, 104, 45, 115, 99, 111, 112, 101, 90, 0,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down
58 changes: 5 additions & 53 deletions tests/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,7 @@ fn it_performs_authenticated_rate_limiting() {
Some("envoy.service.auth.v3.Authorization"),
Some("Check"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58,
52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55,
46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8,
146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84,
26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 30, 10, 10,
58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, 105, 95, 116, 101,
115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, 58, 112, 97, 116,
104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, 113, 117, 101,
115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, 104, 34, 10, 47,
97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111,
121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8,
72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97, 117,
116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down Expand Up @@ -236,10 +222,7 @@ fn it_performs_authenticated_rate_limiting() {
Some("envoy.service.ratelimit.v3.RateLimitService"),
Some("ShouldRateLimit"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 97,
100, 109, 105, 110, 18, 1, 49, 24, 1,
]),
None,
Some(5000),
)
.returning(Some(43))
Expand Down Expand Up @@ -407,21 +390,7 @@ fn unauthenticated_does_not_ratelimit() {
Some("envoy.service.auth.v3.Authorization"),
Some("Check"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58,
52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55,
46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8,
146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84,
26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 30, 10, 10,
58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, 105, 95, 116, 101,
115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, 58, 112, 97, 116,
104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, 113, 117, 101,
115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, 104, 34, 10, 47,
97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111,
121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8,
72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97, 117,
116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down Expand Up @@ -681,21 +650,7 @@ fn authenticated_one_ratelimit_action_matches() {
Some("envoy.service.auth.v3.Authorization"),
Some("Check"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 236, 1, 10, 25, 10, 23, 10, 21, 18, 15, 49, 50, 55, 46, 48, 46, 48, 46, 49, 58,
52, 53, 48, 48, 48, 24, 200, 223, 2, 18, 23, 10, 21, 10, 19, 18, 14, 49, 50, 55,
46, 48, 46, 48, 46, 49, 58, 56, 48, 48, 48, 24, 192, 62, 34, 157, 1, 10, 12, 8,
146, 140, 179, 185, 6, 16, 240, 213, 233, 163, 3, 18, 140, 1, 18, 3, 71, 69, 84,
26, 14, 10, 7, 58, 109, 101, 116, 104, 111, 100, 18, 3, 71, 69, 84, 26, 30, 10, 10,
58, 97, 117, 116, 104, 111, 114, 105, 116, 121, 18, 16, 97, 98, 105, 95, 116, 101,
115, 116, 95, 104, 97, 114, 110, 101, 115, 115, 26, 38, 10, 5, 58, 112, 97, 116,
104, 18, 29, 47, 100, 101, 102, 97, 117, 108, 116, 47, 114, 101, 113, 117, 101,
115, 116, 47, 104, 101, 97, 100, 101, 114, 115, 47, 112, 97, 116, 104, 34, 10, 47,
97, 100, 109, 105, 110, 47, 116, 111, 121, 42, 17, 99, 97, 114, 115, 46, 116, 111,
121, 115, 116, 111, 114, 101, 46, 99, 111, 109, 50, 4, 104, 116, 116, 112, 82, 8,
72, 84, 84, 80, 47, 49, 46, 49, 82, 20, 10, 4, 104, 111, 115, 116, 18, 12, 97, 117,
116, 104, 99, 111, 110, 102, 105, 103, 45, 65, 90, 0,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down Expand Up @@ -737,10 +692,7 @@ fn authenticated_one_ratelimit_action_matches() {
Some("envoy.service.ratelimit.v3.RateLimitService"),
Some("ShouldRateLimit"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 111,
116, 104, 101, 114, 18, 1, 49, 24, 1,
]),
None,
Some(5000),
)
.returning(Some(43))
Expand Down
22 changes: 4 additions & 18 deletions tests/rate_limited.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ fn it_limits() {
Some("envoy.service.ratelimit.v3.RateLimitService"),
Some("ShouldRateLimit"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 97,
100, 109, 105, 110, 18, 1, 49, 24, 1,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down Expand Up @@ -326,10 +323,7 @@ fn it_passes_additional_headers() {
Some("envoy.service.ratelimit.v3.RateLimitService"),
Some("ShouldRateLimit"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 97,
100, 109, 105, 110, 18, 1, 49, 24, 1,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down Expand Up @@ -462,10 +456,7 @@ fn it_rate_limits_with_empty_predicates() {
Some("envoy.service.ratelimit.v3.RateLimitService"),
Some("ShouldRateLimit"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 12, 10, 10, 10, 5, 97,
100, 109, 105, 110, 18, 1, 49, 24, 1,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down Expand Up @@ -703,12 +694,7 @@ fn it_folds_subsequent_actions_to_limitador_into_a_single_one() {
Some("envoy.service.ratelimit.v3.RateLimitService"),
Some("ShouldRateLimit"),
Some(&[0, 0, 0, 0]),
Some(&[
10, 10, 82, 76, 83, 45, 100, 111, 109, 97, 105, 110, 18, 54, 10, 16, 10, 5, 107,
101, 121, 95, 49, 18, 7, 118, 97, 108, 117, 101, 95, 49, 10, 16, 10, 5, 107, 101,
121, 95, 50, 18, 7, 118, 97, 108, 117, 101, 95, 50, 10, 16, 10, 5, 107, 101, 121,
95, 51, 18, 7, 118, 97, 108, 117, 101, 95, 51, 24, 1,
]),
None,
Some(5000),
)
.returning(Some(42))
Expand Down

0 comments on commit 801911b

Please sign in to comment.