Skip to content

Commit

Permalink
fix(btp/stream): clippy lints
Browse files Browse the repository at this point in the history
Signed-off-by: Niklas Long <niklas@equilibrium.co>
  • Loading branch information
niklaslong committed Oct 9, 2020
1 parent 252eda9 commit 85fcd11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
10 changes: 2 additions & 8 deletions crates/interledger-btp/src/oer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,7 @@ mod writer_ext {
assert_eq!(one, vec![0x01, 0xb0]);

let mut larger = vec![];
let mut larger_string: Vec<u8> = Vec::with_capacity(256 as usize);
for _ in 0..256 {
larger_string.push(0xb0);
}
let larger_string: Vec<u8> = vec![0xb0; 256];
larger.write_var_octet_string(&larger_string).unwrap();
let mut expected = vec![0x82, 0x01, 0x00];
expected.extend(larger_string);
Expand Down Expand Up @@ -178,10 +175,7 @@ mod reader_ext {
);

let mut larger = vec![0x82, 0x01, 0x00];
let mut larger_string: Vec<u8> = Vec::with_capacity(256 as usize);
for _ in 0..256 {
larger_string.push(0xb0);
}
let larger_string: Vec<u8> = vec![0xb0; 256];
larger.extend(&larger_string);
assert_eq!(
Cursor::new(larger).read_var_octet_string().unwrap(),
Expand Down
10 changes: 5 additions & 5 deletions crates/interledger-stream/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ impl StreamPayment {

// Apply F99, T00, T01 to fail-fast threshold.
// Other final/relative errors should immediately fail; T02-T99 may be resolved with time.
let apply_to_fail_fast = match reject.code() {
let apply_to_fail_fast = matches!(
reject.code(),
IlpErrorCode::T00_INTERNAL_ERROR
| IlpErrorCode::T01_PEER_UNREACHABLE
| IlpErrorCode::F99_APPLICATION_ERROR => true,
_ => false,
};
| IlpErrorCode::T01_PEER_UNREACHABLE
| IlpErrorCode::F99_APPLICATION_ERROR
);
if apply_to_fail_fast {
self.fail_fast_rejects += 1;
}
Expand Down

0 comments on commit 85fcd11

Please sign in to comment.