Skip to content

Commit bb5efb5

Browse files
committed
Use is_multiple_of(2) instead of modulo.
Found by clippy (nightly). Signed-off-by: Piotr Sikora <[email protected]>
1 parent c609755 commit bb5efb5

File tree

2 files changed

+2
-2
lines changed
  • examples

2 files changed

+2
-2
lines changed

examples/grpc_auth_random/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl HttpContext for GrpcAuthRandom {
6868

6969
impl Context for GrpcAuthRandom {
7070
fn on_grpc_call_response(&mut self, _: u32, status_code: u32, _: usize) {
71-
if status_code % 2 == 0 {
71+
if status_code.is_multiple_of(2) {
7272
info!("Access granted.");
7373
self.resume_http_request();
7474
} else {

examples/http_auth_random/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl HttpContext for HttpAuthRandom {
5050
impl Context for HttpAuthRandom {
5151
fn on_http_call_response(&mut self, _: u32, _: usize, body_size: usize, _: usize) {
5252
if let Some(body) = self.get_http_call_response_body(0, body_size) {
53-
if !body.is_empty() && body[0] % 2 == 0 {
53+
if !body.is_empty() && body[0].is_multiple_of(2) {
5454
info!("Access granted.");
5555
self.resume_http_request();
5656
return;

0 commit comments

Comments
 (0)