##// END OF EJS Templates
rust-clippy: apply some more trivial fixes...
Raphaël Gomès -
r52165:c4cbb515 default
parent child Browse files
Show More
@@ -320,7 +320,7 b' impl SnapshotsCache for FastHashMap<Base'
320 rev: BaseRevision,
320 rev: BaseRevision,
321 value: BaseRevision,
321 value: BaseRevision,
322 ) -> Result<(), RevlogError> {
322 ) -> Result<(), RevlogError> {
323 let all_values = self.entry(rev).or_insert_with(HashSet::new);
323 let all_values = self.entry(rev).or_default();
324 all_values.insert(value);
324 all_values.insert(value);
325 Ok(())
325 Ok(())
326 }
326 }
@@ -941,7 +941,7 b' impl Index {'
941 let last_entry = &self.get_entry(revs[revs.len() - 1]).unwrap();
941 let last_entry = &self.get_entry(revs[revs.len() - 1]).unwrap();
942 let end = last_entry.c_start() + last_entry.compressed_len() as u64;
942 let end = last_entry.c_start() + last_entry.compressed_len() as u64;
943 let first_rev = revs.iter().find(|r| r.0 != NULL_REVISION.0).unwrap();
943 let first_rev = revs.iter().find(|r| r.0 != NULL_REVISION.0).unwrap();
944 let start = if (*first_rev).0 == 0 {
944 let start = if first_rev.0 == 0 {
945 0
945 0
946 } else {
946 } else {
947 self.get_entry(*first_rev).unwrap().c_start()
947 self.get_entry(*first_rev).unwrap().c_start()
@@ -1822,28 +1822,28 b' mod tests {'
1822 pub fn build(&self) -> Vec<u8> {
1822 pub fn build(&self) -> Vec<u8> {
1823 let mut bytes = Vec::with_capacity(INDEX_ENTRY_SIZE);
1823 let mut bytes = Vec::with_capacity(INDEX_ENTRY_SIZE);
1824 if self.is_first {
1824 if self.is_first {
1825 bytes.extend(&match (self.is_general_delta, self.is_inline) {
1825 bytes.extend(match (self.is_general_delta, self.is_inline) {
1826 (false, false) => [0u8, 0],
1826 (false, false) => [0u8, 0],
1827 (false, true) => [0u8, 1],
1827 (false, true) => [0u8, 1],
1828 (true, false) => [0u8, 2],
1828 (true, false) => [0u8, 2],
1829 (true, true) => [0u8, 3],
1829 (true, true) => [0u8, 3],
1830 });
1830 });
1831 bytes.extend(&self.version.to_be_bytes());
1831 bytes.extend(self.version.to_be_bytes());
1832 // Remaining offset bytes.
1832 // Remaining offset bytes.
1833 bytes.extend(&[0u8; 2]);
1833 bytes.extend([0u8; 2]);
1834 } else {
1834 } else {
1835 // Offset stored on 48 bits (6 bytes)
1835 // Offset stored on 48 bits (6 bytes)
1836 bytes.extend(&(self.offset as u64).to_be_bytes()[2..]);
1836 bytes.extend(&(self.offset as u64).to_be_bytes()[2..]);
1837 }
1837 }
1838 bytes.extend(&[0u8; 2]); // Revision flags.
1838 bytes.extend([0u8; 2]); // Revision flags.
1839 bytes.extend(&(self.compressed_len as u32).to_be_bytes());
1839 bytes.extend((self.compressed_len as u32).to_be_bytes());
1840 bytes.extend(&(self.uncompressed_len as u32).to_be_bytes());
1840 bytes.extend((self.uncompressed_len as u32).to_be_bytes());
1841 bytes.extend(
1841 bytes.extend(
1842 &self.base_revision_or_base_of_delta_chain.0.to_be_bytes(),
1842 self.base_revision_or_base_of_delta_chain.0.to_be_bytes(),
1843 );
1843 );
1844 bytes.extend(&self.link_revision.0.to_be_bytes());
1844 bytes.extend(self.link_revision.0.to_be_bytes());
1845 bytes.extend(&self.p1.0.to_be_bytes());
1845 bytes.extend(self.p1.0.to_be_bytes());
1846 bytes.extend(&self.p2.0.to_be_bytes());
1846 bytes.extend(self.p2.0.to_be_bytes());
1847 bytes.extend(self.node.as_bytes());
1847 bytes.extend(self.node.as_bytes());
1848 bytes.extend(vec![0u8; 12]);
1848 bytes.extend(vec![0u8; 12]);
1849 bytes
1849 bytes
@@ -177,7 +177,7 b' py_class!(pub class LazyAncestors |py| {'
177 let inner: &RefCell<VCGLazyAncestors<PySharedIndex>> =
177 let inner: &RefCell<VCGLazyAncestors<PySharedIndex>> =
178 &*unsafe { leaked.try_borrow(py)? };
178 &*unsafe { leaked.try_borrow(py)? };
179 let inner_mut: &mut VCGLazyAncestors<PySharedIndex> =
179 let inner_mut: &mut VCGLazyAncestors<PySharedIndex> =
180 &mut *inner.borrow_mut();
180 &mut inner.borrow_mut();
181 inner_mut.contains(rev.0)
181 inner_mut.contains(rev.0)
182 .map_err(|e| GraphError::pynew_from_vcsgraph(py, e))
182 .map_err(|e| GraphError::pynew_from_vcsgraph(py, e))
183 }
183 }
@@ -335,7 +335,7 b' py_class!(pub class MissingAncestors |py'
335 self.index(py).clone_ref(py))?;
335 self.index(py).clone_ref(py))?;
336 // Safety: we don't leak the "faked" reference out of `UnsafePyLeaked`
336 // Safety: we don't leak the "faked" reference out of `UnsafePyLeaked`
337 let index = &*unsafe { leaked.try_borrow(py)? };
337 let index = &*unsafe { leaked.try_borrow(py)? };
338 rev_pyiter_collect(py, &revs, &*index)?
338 rev_pyiter_collect(py, &revs, index)?
339 };
339 };
340
340
341 let mut leaked = self.inner(py).borrow_mut();
341 let mut leaked = self.inner(py).borrow_mut();
General Comments 0
You need to be logged in to leave comments. Login now