Skip to content

Commit

Permalink
resolve clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
ericseppanen committed Sep 15, 2024
1 parent e2971c1 commit c0f34d5
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/cbor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
//! validate_cbor(&rule_def, &cbor_value, &ctx).unwrap();
//! ```
#![cfg(feature = "serde_cbor")]

use crate::context::{BasicContext, LookupContext};
use crate::flatten::flatten_from_str;
use crate::ivt::RuleDef;
Expand Down
4 changes: 2 additions & 2 deletions src/ivt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ impl Occur {
pub fn limits(&self) -> (usize, usize) {
match self.limit {
OccurLimit::Optional => (0, 1),
OccurLimit::ZeroOrMore => (0, std::usize::MAX),
OccurLimit::OneOrMore => (1, std::usize::MAX),
OccurLimit::ZeroOrMore => (0, usize::MAX),
OccurLimit::OneOrMore => (1, usize::MAX),
OccurLimit::Numbered(n, m) => (n, m),
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//! ```
//!
#![cfg(feature = "serde_json")]

use crate::context::{BasicContext, LookupContext};
use crate::flatten::flatten_from_str;
use crate::ivt::RuleDef;
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
//! ```
//! Supported prelude types:
//! - `any`, `uint`, `nint`, `int`, `bstr`, `bytes`, `tstr`, `text`
//! - `float`, `float16`, `float32`, `float64`, `float16-32`, `float32-64` \
//! - `float`, `float16`, `float32`, `float64`, `float16-32`, `float32-64`
//!
//! Note: float sizes are not validated.
//!
//! Supported CDDL features:
Expand Down
6 changes: 3 additions & 3 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ fn occur_star(input: &str) -> JResult<&str, Occur> {
};
let upper: usize = match tup.2 {
Some(n) => try_into_int(n, input)?,
None => std::usize::MAX,
None => usize::MAX,
};
Ok(Occur::Numbered(lower, upper))
}
Expand Down Expand Up @@ -1480,7 +1480,7 @@ mod tests {
assert!(is_unescaped_schar('A'));
assert!(is_unescaped_schar('の'));
assert!(is_unescaped_schar(std::char::from_u32(0x10FF0).unwrap()));
assert!(!is_unescaped_schar(0x7F as char));
assert!(!is_unescaped_schar(0x7Fu8 as char));

assert_eq!(unescaped_schar("Aの"), Ok(("", "Aの")));

Expand Down Expand Up @@ -1562,7 +1562,7 @@ mod tests {
assert_eq!(occur("+"), Ok(("", Occur::OneOrMore)));
assert_eq!(occur("*"), Ok(("", Occur::ZeroOrMore)));
assert_eq!(occur("*9"), Ok(("", Occur::Numbered(0, 9))));
assert_eq!(occur("7*"), Ok(("", Occur::Numbered(7, std::usize::MAX))));
assert_eq!(occur("7*"), Ok(("", Occur::Numbered(7, usize::MAX))));
assert_eq!(occur("7*9"), Ok(("", Occur::Numbered(7, 9))));
assert_eq!(occur("0b100*0x10"), Ok(("", Occur::Numbered(4, 16))));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cbor_ivt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn validate_literal_text() {

#[test]
fn validate_choice() {
let options = vec![1, 2, 3];
let options = [1, 2, 3];
let options = options.iter().map(|n| literal_int(*n)).collect();
let node = &Node::Choice(Choice { options });

Expand Down

0 comments on commit c0f34d5

Please sign in to comment.