Skip to content

Commit

Permalink
fix linter warnings;
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat committed May 27, 2020
1 parent 351e4f3 commit e044d67
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sigma-ser/src/peekable_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl<R: Read> PeekableReader<R> {

impl<R: Read> Read for PeekableReader<R> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error> {
if buf.len() == 0 {
if buf.is_empty() {
return Ok(0);
}

Expand Down
3 changes: 1 addition & 2 deletions sigma-ser/src/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use std::io::Cursor;
pub fn sigma_serialize_roundtrip<T: crate::serializer::SigmaSerializable>(v: &T) -> T {
let mut data = Vec::new();
v.sigma_serialize(&mut data).expect("serialization failed");
let mut bytes = data.clone();
let cursor = Cursor::new(&mut bytes[..]);
let cursor = Cursor::new(&mut data[..]);
let mut reader = PeekableReader::new(cursor);
T::sigma_parse(&mut reader).expect("parse failed")
}
12 changes: 6 additions & 6 deletions sigma-tree/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use crate::{ecpoint::EcPoint, serialization::op_code::OpCode};
#[derive(PartialEq, Eq, Debug)]
pub enum SigmaBoolean {
ProveDHTuple {
gv: EcPoint,
hv: EcPoint,
uv: EcPoint,
vv: EcPoint,
gv: Box<EcPoint>,
hv: Box<EcPoint>,
uv: Box<EcPoint>,
vv: Box<EcPoint>,
},
ProveDlog(EcPoint),
ProveDlog(Box<EcPoint>),
CAND(Vec<SigmaBoolean>),
}

Expand Down Expand Up @@ -49,7 +49,7 @@ mod tests {

fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
(any::<EcPoint>())
.prop_map(|ecp| SigmaBoolean::ProveDlog(ecp))
.prop_map(|ecp| SigmaBoolean::ProveDlog(Box::new(ecp)))
.boxed()
}
}
Expand Down
2 changes: 1 addition & 1 deletion sigma-tree/src/serialization/op_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl OpCode {
OpCode(b)
}

pub const fn value(&self) -> u8 {
pub const fn value(self) -> u8 {
self.0
}
}
Expand Down
2 changes: 1 addition & 1 deletion sigma-tree/src/serialization/sigmaboolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl SigmaSerializable for SigmaBoolean {
match op_code {
OpCode::PROVE_DLOG => {
let p = EcPoint::sigma_parse(r)?;
Ok(SigmaBoolean::ProveDlog(p))
Ok(SigmaBoolean::ProveDlog(Box::new(p)))
}
_ => todo!(),
}
Expand Down

0 comments on commit e044d67

Please sign in to comment.