# HG changeset patch # User Raphaël Gomès # Date 1567086556 -7200 # Node ID 6a551a2dc666262c1b8ed26aff199bde27596d0f # Parent 0cbe17335857cb2cffae295c550268f53d77012c rust: run cargo fmt diff -r 0cbe17335857 -r 6a551a2dc666 rust/hg-cpython/src/lib.rs --- a/rust/hg-cpython/src/lib.rs Wed Aug 28 17:36:53 2019 -0700 +++ b/rust/hg-cpython/src/lib.rs Thu Aug 29 15:49:16 2019 +0200 @@ -31,10 +31,10 @@ pub mod ref_sharing; pub mod dagops; pub mod dirstate; -pub mod parsers; pub mod discovery; pub mod exceptions; pub mod filepatterns; +pub mod parsers; py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| { m.add( diff -r 0cbe17335857 -r 6a551a2dc666 rust/hg-direct-ffi/src/ancestors.rs --- a/rust/hg-direct-ffi/src/ancestors.rs Wed Aug 28 17:36:53 2019 -0700 +++ b/rust/hg-direct-ffi/src/ancestors.rs Thu Aug 29 15:49:16 2019 +0200 @@ -36,9 +36,7 @@ impl Index { pub fn new(index: IndexPtr) -> Self { - Index { - index: index, - } + Index { index: index } } } @@ -46,8 +44,13 @@ /// wrap a call to the C extern parents function fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> { let mut res: [c_int; 2] = [0; 2]; - let code = - unsafe { HgRevlogIndex_GetParents(self.index, rev, &mut res as *mut [c_int; 2]) }; + let code = unsafe { + HgRevlogIndex_GetParents( + self.index, + rev, + &mut res as *mut [c_int; 2], + ) + }; match code { 0 => Ok(res), _ => Err(GraphError::ParentOutOfRange(rev)), @@ -98,22 +101,26 @@ let slice = slice::from_raw_parts(initrevs, initrevslen); - Box::into_raw(Box::new(match AncestorsIterator::new( - graph, - slice.into_iter().map(|&r| r as Revision), - stoprev as Revision, - inclb, - ) { - Ok(it) => it, - Err(_) => { - return null_mut(); - } - })) + Box::into_raw(Box::new( + match AncestorsIterator::new( + graph, + slice.into_iter().map(|&r| r as Revision), + stoprev as Revision, + inclb, + ) { + Ok(it) => it, + Err(_) => { + return null_mut(); + } + }, + )) } /// Deallocator to be called from C code #[no_mangle] -pub extern "C" fn rustlazyancestors_drop(raw_iter: *mut AncestorsIterator) { +pub extern "C" fn rustlazyancestors_drop( + raw_iter: *mut AncestorsIterator, +) { raw_drop(raw_iter); } @@ -131,7 +138,9 @@ /// it will be up to the C wrapper to convert that back into a Python end of /// iteration #[no_mangle] -pub extern "C" fn rustlazyancestors_next(raw: *mut AncestorsIterator) -> c_long { +pub extern "C" fn rustlazyancestors_next( + raw: *mut AncestorsIterator, +) -> c_long { raw_next(raw) } @@ -227,7 +236,9 @@ let mut initrevs: Vec = vec![11, 13]; let initrevs_len = initrevs.len(); let initrevs_ptr = initrevs.as_mut_ptr() as usize; - let handler = thread::spawn(move || stub_raw_init(initrevs_len, initrevs_ptr, 0, 1)); + let handler = thread::spawn(move || { + stub_raw_init(initrevs_len, initrevs_ptr, 0, 1) + }); let raw = handler.join().unwrap() as *mut AncestorsIterator; assert_eq!(raw_next(raw), 13);