Skip to content

Commit

Permalink
Address clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
elrnv committed Apr 21, 2020
1 parent 47463e4 commit d5dfd8c
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl<BO: ByteOrder> DataParser<BO> {
where
T: FromStr + Any + Clone + Zero + FromBinary + FromAscii + ::std::fmt::Debug,
{
Self::data_vec::<T>(input, n, ft).map(|vec: Vec<T>| IOBuffer::from(vec))
Self::data_vec::<T>(input, n, ft).map(IOBuffer::from)
}

/// Parse a set of typed numbers into a `Vec`.
Expand Down
7 changes: 2 additions & 5 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,15 @@ pub enum Attribute {
}

/// Point and cell attributes.
#[derive(Clone, PartialEq, Debug)]
#[derive(Clone, PartialEq, Debug, Default)]
pub struct Attributes {
pub point: Vec<(String, Attribute)>,
pub cell: Vec<(String, Attribute)>,
}

impl Attributes {
pub fn new() -> Self {
Attributes {
point: Vec::new(),
cell: Vec::new(),
}
Default::default()
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// TODO: migrating to a newer version of nom could reduce the detected "cognitive complexity"
// caused by macros.
#![allow(clippy::cognitive_complexity)]

use byteorder::{BigEndian, ByteOrder, LittleEndian, NativeEndian};
use nom::{self, eol, ErrorKind, IResult};
use num_traits::FromPrimitive;
Expand Down Expand Up @@ -67,7 +71,7 @@ named!(u32_b<&[u8], u32>, call!(integer) );
named!(u8_b<&[u8], u8>, call!(integer) );
named!(f32_b<&[u8], f32>, call!(real::<f32>) );

named!(name, take_till!(|x: u8| " \t\n\r".as_bytes().contains(&x)));
named!(name, take_till!(|x: u8| b" \t\n\r".contains(&x)));

enum Axis {
X,
Expand Down Expand Up @@ -177,7 +181,7 @@ impl<BO: ByteOrder> VtkParser<BO> {
lookup_table,
alt_complete!(
sp!( do_parse!( tag_no_case!("LOOKUP_TABLE") >> n: name >> (n) ) ) |
eof!() => { |_| "".as_bytes() } |
eof!() => { |_| &b""[..] } |
eol
)
);
Expand Down
Loading

0 comments on commit d5dfd8c

Please sign in to comment.