Skip to content

Commit

Permalink
fix clippy lints for 1.49
Browse files Browse the repository at this point in the history
  • Loading branch information
KiriosK committed Feb 11, 2021
1 parent 0ff5888 commit c583efb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/channel_uri_string_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl ChannelUriStringBuilder {

#[inline]
pub fn mtu(&mut self, mtu: u32) -> Result<&mut Self, AeronError> {
if mtu < 32 || mtu > 65504 {
if !(32..=65504).contains(&mtu) {
return Err(AeronError::IllegalArgumentException(format!(
"MTU is not in range 32-65504: {}",
mtu
Expand Down
2 changes: 1 addition & 1 deletion src/concurrent/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ mod tests {
let reader = UnsafeBufferPosition::new(reader_buffer, counter_id);
let writer = UnsafeBufferPosition::new(writer_buffer, counter_id);

let expected_value = 0xFFFF_FFFFF;
let expected_value = 0x000F_FFFF_FFFF;

writer.set_ordered(expected_value);
assert_eq!(reader.get_volatile(), expected_value);
Expand Down
8 changes: 5 additions & 3 deletions src/concurrent/logbuffer/term_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ pub fn read(
header: &mut Header,
_exception_handler: impl Fn(AeronError),
) -> ReadOutcome {
let mut outcome = ReadOutcome::default();
outcome.fragments_read = 0;
outcome.offset = term_offset;
let mut outcome = ReadOutcome {
offset: term_offset,
..Default::default()
};

let capacity = term_buffer.capacity();

while outcome.fragments_read < fragments_limit && term_offset < capacity {
Expand Down
12 changes: 6 additions & 6 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl Image {
let position = self.subscriber_position.get();
let term_offset: Index = (position as Index) & self.term_length_mask;
let index = log_buffer_descriptor::index_by_position(position, self.position_bits_to_shift);
assert!(index >= 0 && index < log_buffer_descriptor::PARTITION_COUNT);
assert!((0..log_buffer_descriptor::PARTITION_COUNT).contains(&index));
let term_buffer = self.term_buffers[index as usize];

let read_outcome: ReadOutcome = term_reader::read(
Expand Down Expand Up @@ -366,7 +366,7 @@ impl Image {
let initial_position = self.subscriber_position.get();
let initial_offset = (initial_position & self.term_length_mask as i64) as i32;
let index = log_buffer_descriptor::index_by_position(initial_position, self.position_bits_to_shift);
assert!(index >= 0 && index < log_buffer_descriptor::PARTITION_COUNT);
assert!((0..log_buffer_descriptor::PARTITION_COUNT).contains(&index));

let term_buffer = self.term_buffers[index as usize];
let mut offset = initial_offset as i32;
Expand Down Expand Up @@ -436,7 +436,7 @@ impl Image {
let mut initial_offset: Index = (initial_position as i32) & self.term_length_mask;
let index = log_buffer_descriptor::index_by_position(initial_position, self.position_bits_to_shift);

assert!(index >= 0 && index < log_buffer_descriptor::PARTITION_COUNT);
assert!((0..log_buffer_descriptor::PARTITION_COUNT).contains(&index));

let term_buffer = self.term_buffers[index as usize];
let mut resulting_offset: Index = initial_offset;
Expand Down Expand Up @@ -524,7 +524,7 @@ impl Image {
let mut initial_position = self.subscriber_position.get();
let mut initial_offset: Index = initial_position as Index & self.term_length_mask;
let index = log_buffer_descriptor::index_by_position(initial_position, self.position_bits_to_shift);
assert!(index >= 0 && index < log_buffer_descriptor::PARTITION_COUNT);
assert!((0..log_buffer_descriptor::PARTITION_COUNT).contains(&index));
let term_buffer = self.term_buffers[index as usize];
let mut resulting_offset: Index = initial_offset;
let capacity = term_buffer.capacity() as i64;
Expand Down Expand Up @@ -612,7 +612,7 @@ impl Image {
let mut offset: Index = initial_offset;
let mut position: i64 = initial_position;
let index: Index = log_buffer_descriptor::index_by_position(initial_position, self.position_bits_to_shift);
assert!(index >= 0 && index < log_buffer_descriptor::PARTITION_COUNT);
assert!((0..log_buffer_descriptor::PARTITION_COUNT).contains(&index));
let termb_buffer = self.term_buffers[index as usize];
let capacity: Index = termb_buffer.capacity();

Expand Down Expand Up @@ -696,7 +696,7 @@ impl Image {
let position = self.subscriber_position.get();
let term_offset = position as Index & self.term_length_mask;
let index = log_buffer_descriptor::index_by_position(position, self.position_bits_to_shift);
assert!(index >= 0 && index < log_buffer_descriptor::PARTITION_COUNT);
assert!((0..log_buffer_descriptor::PARTITION_COUNT).contains(&index));
let term_buffer = self.term_buffers[index as usize];
let limit_offset: Index = min(term_offset + block_length_limit, term_buffer.capacity());
let resulting_offset: Index = scan(&term_buffer, term_offset, limit_offset);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/memory_mapped_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ mod tests {
.open(&file_path)
.unwrap();

let size = 10000 as Index;
let size = 10000;
tmp_file.set_len(size as u64).unwrap();

{
Expand Down

0 comments on commit c583efb

Please sign in to comment.