NOBUG intellij misc lint

This commit is contained in:
Paul Masurel
2017-12-14 18:23:35 +09:00
parent 2589be3984
commit f24e5f405e
70 changed files with 259 additions and 264 deletions

View File

@@ -32,9 +32,9 @@ impl<'a, T: BinarySerializable> From<&'a [u8]> for Layer<'a, T> {
let mut cursor = data;
let next_id = u32::deserialize(&mut cursor).unwrap_or(u32::max_value());
Layer {
data: data,
cursor: cursor,
next_id: next_id,
data,
cursor,
next_id,
_phantom_: PhantomData,
}
}
@@ -123,8 +123,8 @@ impl<'a, T: BinarySerializable> From<&'a [u8]> for SkipList<'a, T> {
.map(|(start, stop)| Layer::from(&layers_data[start..stop]))
.collect();
SkipList {
skip_layers: skip_layers,
data_layer: data_layer,
skip_layers,
data_layer,
}
}
}

View File

@@ -24,7 +24,7 @@ impl<T: BinarySerializable> LayerBuilder<T> {
fn with_period(period: usize) -> LayerBuilder<T> {
LayerBuilder {
period: period,
period,
buffer: Vec::new(),
remaining: period,
len: 0,
@@ -58,7 +58,7 @@ pub struct SkipListBuilder<T: BinarySerializable> {
impl<T: BinarySerializable> SkipListBuilder<T> {
pub fn new(period: usize) -> SkipListBuilder<T> {
SkipListBuilder {
period: period,
period,
data_layer: LayerBuilder::with_period(period),
skip_layers: Vec::new(),
}
@@ -74,14 +74,14 @@ impl<T: BinarySerializable> SkipListBuilder<T> {
pub fn insert(&mut self, doc_id: DocId, dest: &T) -> io::Result<()> {
let mut layer_id = 0;
let mut skip_pointer = try!(self.data_layer.insert(doc_id, dest));
let mut skip_pointer = self.data_layer.insert(doc_id, dest)?;
loop {
skip_pointer = match skip_pointer {
Some((skip_doc_id, skip_offset)) => {
try!(self.get_skip_layer(layer_id).insert(
self.get_skip_layer(layer_id).insert(
skip_doc_id,
&skip_offset,
))
)?
}
None => {
return Ok(());

View File

@@ -26,7 +26,7 @@ pub struct ExpUnrolledLinkedList {
impl ExpUnrolledLinkedList {
pub fn iter<'a>(&self, addr: u32, heap: &'a Heap) -> ExpUnrolledLinkedListIterator<'a> {
ExpUnrolledLinkedListIterator {
heap: heap,
heap,
addr: addr + 2u32 * (mem::size_of::<u32>() as u32),
len: self.len,
consumed: 0,

View File

@@ -129,9 +129,9 @@ struct QuadraticProbing {
impl QuadraticProbing {
fn compute(hash: usize, mask: usize) -> QuadraticProbing {
QuadraticProbing {
hash: hash,
hash,
i: 0,
mask: mask,
mask,
}
}
@@ -149,7 +149,7 @@ impl<'a> HashMap<'a> {
let table: Vec<KeyValue> = iter::repeat(KeyValue::default()).take(table_size).collect();
HashMap {
table: table.into_boxed_slice(),
heap: heap,
heap,
mask: table_size - 1,
occupied: Vec::with_capacity(table_size / 2),
}
@@ -174,7 +174,7 @@ impl<'a> HashMap<'a> {
self.occupied.push(bucket);
self.table[bucket] = KeyValue {
key_value_addr: key_bytes_ref,
hash: hash,
hash,
};
}

View File

@@ -115,7 +115,7 @@ impl InnerHeap {
pub fn with_capacity(num_bytes: usize) -> InnerHeap {
let buffer: Vec<u8> = vec![0u8; num_bytes];
InnerHeap {
buffer: buffer,
buffer,
buffer_len: num_bytes as u32,
next_heap: None,
used: 0u32,