[PATCH] rust-fmt: run cargo fmt

Raphaël Gomès raphael.gomes at octobus.net
Thu Aug 29 10:38:46 EDT 2019


# HG changeset patch
# User Raphaël Gomès <rgomes at octobus.net>
# Date 1567086556 -7200
#      Thu Aug 29 15:49:16 2019 +0200
# Node ID 6ccae60f6d85c186b530095102acbc7b3d5ed7ba
# Parent  383fdfa6bba9366abe3aceeddfa65dd4a0b3870d
# EXP-Topic rust-fmt
rust-fmt: run cargo fmt

diff -r 383fdfa6bba9 -r 6ccae60f6d85 rust/hg-cpython/src/lib.rs
--- a/rust/hg-cpython/src/lib.rs	Thu Aug 22 16:47:31 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 383fdfa6bba9 -r 6ccae60f6d85 rust/hg-direct-ffi/src/ancestors.rs
--- a/rust/hg-direct-ffi/src/ancestors.rs	Thu Aug 22 16:47:31 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<Index>) {
+pub extern "C" fn rustlazyancestors_drop(
+    raw_iter: *mut AncestorsIterator<Index>,
+) {
     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<Index>) -> c_long {
+pub extern "C" fn rustlazyancestors_next(
+    raw: *mut AncestorsIterator<Index>,
+) -> c_long {
     raw_next(raw)
 }
 
@@ -227,7 +236,9 @@
         let mut initrevs: Vec<c_long> = 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<Stub>;
 
         assert_eq!(raw_next(raw), 13);


More information about the Mercurial-devel mailing list