comparison rust/hg-cpython/src/revlog.rs @ 51120:532e74ad3ff6

rust: run a clippy pass with the latest stable version Our current version of clippy is older than the latest stable. The newest version has new lints that are moslty good advice, so let's apply them ahead of time. This has the added benefit of reducing the noise for developpers like myself that use clippy as an IDE helper, as well as being more prepared for a future clippy upgrade.
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 06 Nov 2023 11:06:08 +0100
parents 4c5f6e95df84
children 8ade5e6cdb61
comparison
equal deleted inserted replaced
51119:d58e754f2db0 51120:532e74ad3ff6
346 fn get_nodetree<'a>( 346 fn get_nodetree<'a>(
347 &'a self, 347 &'a self,
348 py: Python<'a>, 348 py: Python<'a>,
349 ) -> PyResult<&'a RefCell<Option<NodeTree>>> { 349 ) -> PyResult<&'a RefCell<Option<NodeTree>>> {
350 if self.nt(py).borrow().is_none() { 350 if self.nt(py).borrow().is_none() {
351 let readonly = Box::new(Vec::new()); 351 let readonly = Box::<Vec<_>>::default();
352 let mut nt = NodeTree::load_bytes(readonly, 0); 352 let mut nt = NodeTree::load_bytes(readonly, 0);
353 self.fill_nodemap(py, &mut nt)?; 353 self.fill_nodemap(py, &mut nt)?;
354 self.nt(py).borrow_mut().replace(nt); 354 self.nt(py).borrow_mut().replace(nt);
355 } 355 }
356 Ok(self.nt(py)) 356 Ok(self.nt(py))
380 let (readonly, bytes) = nodemap.into_readonly_and_added_bytes(); 380 let (readonly, bytes) = nodemap.into_readonly_and_added_bytes();
381 381
382 // If there's anything readonly, we need to build the data again from 382 // If there's anything readonly, we need to build the data again from
383 // scratch 383 // scratch
384 let bytes = if readonly.len() > 0 { 384 let bytes = if readonly.len() > 0 {
385 let mut nt = NodeTree::load_bytes(Box::new(vec![]), 0); 385 let mut nt = NodeTree::load_bytes(Box::<Vec<_>>::default(), 0);
386 self.fill_nodemap(py, &mut nt)?; 386 self.fill_nodemap(py, &mut nt)?;
387 387
388 let (readonly, bytes) = nt.into_readonly_and_added_bytes(); 388 let (readonly, bytes) = nt.into_readonly_and_added_bytes();
389 assert_eq!(readonly.len(), 0); 389 assert_eq!(readonly.len(), 0);
390 390