Skip to content

Commit d7e6bba

Browse files
style: fix Clippy warnings (#294)
1 parent 2a4d493 commit d7e6bba

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

src/ffi/expression.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ pub const ATC_ROUTER_EXPRESSION_VALIDATE_BUF_TOO_SMALL: i64 = 2;
143143
/// - `operators` must be a valid pointer to write `size_of::<u64>()` bytes and properly aligned.
144144
/// - `errbuf` must be valid for reading and writing `errbuf_len * size_of::<u8>()` bytes and properly aligned.
145145
/// - `errbuf_len` must be a valid pointer for reading and writing `size_of::<usize>()` bytes and properly aligned.
146-
147146
#[no_mangle]
148147
pub unsafe extern "C" fn expression_validate(
149148
atc: *const u8,
@@ -241,7 +240,7 @@ mod tests {
241240
let result = unsafe {
242241
expression_validate(
243242
atc.as_bytes().as_ptr(),
244-
&schema,
243+
schema,
245244
fields_buf.as_mut_ptr(),
246245
&mut fields_buf_len,
247246
&mut fields_total,

src/ffi/router.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ mod tests {
258258
errbuf.as_mut_ptr(),
259259
&mut errbuf_len,
260260
);
261-
assert_eq!(result, false);
261+
assert!(!result);
262262
assert_eq!(errbuf_len, ERR_BUF_MAX_LEN);
263263
}
264264
}
@@ -281,7 +281,7 @@ mod tests {
281281
errbuf.as_mut_ptr(),
282282
&mut errbuf_len,
283283
);
284-
assert_eq!(result, false);
284+
assert!(!result);
285285
assert!(errbuf_len < ERR_BUF_MAX_LEN);
286286
}
287287
}

src/interpreter.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ fn test_predicate() {
292292
op: BinaryOperator::Prefix,
293293
};
294294

295-
assert_eq!(p.execute(&mut ctx, &mut mat), false);
295+
assert!(!p.execute(&mut ctx, &mut mat));
296296

297297
// check if any value matches starts_with foo -- should be false
298298
let p = Predicate {
@@ -304,7 +304,7 @@ fn test_predicate() {
304304
op: BinaryOperator::Prefix,
305305
};
306306

307-
assert_eq!(p.execute(&mut ctx, &mut mat), false);
307+
assert!(!p.execute(&mut ctx, &mut mat));
308308

309309
// test any mode
310310
let lhs_values = vec![
@@ -328,7 +328,7 @@ fn test_predicate() {
328328
op: BinaryOperator::Prefix,
329329
};
330330

331-
assert_eq!(p.execute(&mut ctx, &mut mat), true);
331+
assert!(p.execute(&mut ctx, &mut mat));
332332

333333
// check if all values match ends_with foo -- should be false
334334
let p = Predicate {
@@ -340,7 +340,7 @@ fn test_predicate() {
340340
op: BinaryOperator::Postfix,
341341
};
342342

343-
assert_eq!(p.execute(&mut ctx, &mut mat), false);
343+
assert!(!p.execute(&mut ctx, &mut mat));
344344

345345
// check if any value matches ends_with foo -- should be true
346346
let p = Predicate {
@@ -352,7 +352,7 @@ fn test_predicate() {
352352
op: BinaryOperator::Postfix,
353353
};
354354

355-
assert_eq!(p.execute(&mut ctx, &mut mat), true);
355+
assert!(p.execute(&mut ctx, &mut mat));
356356

357357
// check if any value matches starts_with foo -- should be true
358358
let p = Predicate {
@@ -364,7 +364,7 @@ fn test_predicate() {
364364
op: BinaryOperator::Prefix,
365365
};
366366

367-
assert_eq!(p.execute(&mut ctx, &mut mat), true);
367+
assert!(p.execute(&mut ctx, &mut mat));
368368

369369
// check if any value matches ends_with nar -- should be false
370370
let p = Predicate {
@@ -376,7 +376,7 @@ fn test_predicate() {
376376
op: BinaryOperator::Postfix,
377377
};
378378

379-
assert_eq!(p.execute(&mut ctx, &mut mat), false);
379+
assert!(!p.execute(&mut ctx, &mut mat));
380380

381381
// check if any value matches ends_with empty string -- should be true
382382
let p = Predicate {
@@ -388,7 +388,7 @@ fn test_predicate() {
388388
op: BinaryOperator::Postfix,
389389
};
390390

391-
assert_eq!(p.execute(&mut ctx, &mut mat), true);
391+
assert!(p.execute(&mut ctx, &mut mat));
392392

393393
// check if any value matches starts_with empty string -- should be true
394394
let p = Predicate {
@@ -400,7 +400,7 @@ fn test_predicate() {
400400
op: BinaryOperator::Prefix,
401401
};
402402

403-
assert_eq!(p.execute(&mut ctx, &mut mat), true);
403+
assert!(p.execute(&mut ctx, &mut mat));
404404

405405
// check if any value matches contains `ob` -- should be true
406406
let p = Predicate {
@@ -412,7 +412,7 @@ fn test_predicate() {
412412
op: BinaryOperator::Contains,
413413
};
414414

415-
assert_eq!(p.execute(&mut ctx, &mut mat), true);
415+
assert!(p.execute(&mut ctx, &mut mat));
416416

417417
// check if any value matches contains `ok` -- should be false
418418
let p = Predicate {
@@ -424,5 +424,5 @@ fn test_predicate() {
424424
op: BinaryOperator::Contains,
425425
};
426426

427-
assert_eq!(p.execute(&mut ctx, &mut mat), false);
427+
assert!(!p.execute(&mut ctx, &mut mat));
428428
}

src/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use regex::Regex;
1414
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
1515

1616
type ParseResult<T> = Result<T, ParseError<Rule>>;
17+
1718
/// cbindgen:ignore
1819
// Bug: https://github.com/eqrion/cbindgen/issues/286
19-
2020
trait IntoParseResult<T> {
2121
#[allow(clippy::result_large_err)] // it's fine as parsing is not the hot path
2222
fn into_parse_result(self, pair: &Pair<Rule>) -> ParseResult<T>;
@@ -157,7 +157,7 @@ fn parse_str_esc(pair: Pair<Rule>) -> char {
157157
}
158158
}
159159
fn parse_str_char(pair: Pair<Rule>) -> char {
160-
return pair.as_str().chars().next().unwrap();
160+
pair.as_str().chars().next().unwrap()
161161
}
162162

163163
#[allow(clippy::result_large_err)] // it's fine as parsing is not the hot path

0 commit comments

Comments
 (0)