From: Ian Jackson Date: Sun, 6 Dec 2020 00:29:34 +0000 (+0000) Subject: formatting, some from rustfmt (manually picked) X-Git-Tag: otter-0.2.0~252 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=24517516e7e46b3f3955612ef81c37672eba9c5c;p=otter.git formatting, some from rustfmt (manually picked) Signed-off-by: Ian Jackson --- diff --git a/src/bin/otter.rs b/src/bin/otter.rs index f00f028d..9e0e41e7 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -1197,7 +1197,7 @@ mod library_add { let PosC([w,h]) = bbox[1] - bbox[0]; let mut did_newline = false; - let (ncbot, tlhs) = 'search : loop { + let (ncbot, tlhs) = 'search: loop { let ncbot = max(self.cbot, self.top + h); if ncbot > self.bot { None? } let mut any_clash_bot = None; @@ -1212,27 +1212,29 @@ mod library_add { let pv = p.visible.as_ref()?; let tl = pv.pos + pv.bbox[0]; let br = pv.pos + pv.bbox[1]; - if - tl.0[0] >= self.clhs || - tl.0[1] >= ncbot || - br.0[0] <= tlhs || - br.0[1] <= self.top + if tl.0[0] >= self.clhs + || tl.0[1] >= ncbot + || br.0[0] <= tlhs + || br.0[1] <= self.top { None } else { - if ma.verbose > 2 { eprintln!( - "at {:?} tlhs={} ncbot={} avoiding {} tl={:?} br={:?}", - &self, tlhs, ncbot, - &p.itemname, &tl, &br - )} + if ma.verbose > 2 { + eprintln!( + "at {:?} tlhs={} ncbot={} avoiding {} tl={:?} br={:?}", + &self, tlhs, ncbot, &p.itemname, &tl, &br + ) + } Some((br.0[0], br.0[1])) } - }).next() { - self.clhs = nclhs; - any_clash_bot = Some(clash_bot); - continue 'within_line; - } - + }) + .next() + { + self.clhs = nclhs; + any_clash_bot = Some(clash_bot); + continue 'within_line; + } + break 'search (ncbot, tlhs); } // line is full @@ -1277,7 +1279,7 @@ mod library_add { eprintln!("error: {}", &m); exit(exitcode); } - }, + } }; let spec = shapelib::ItemSpec { lib: args.tlg.pat.lib.clone(), diff --git a/src/bin/otterlib.rs b/src/bin/otterlib.rs index 3a873481..1886c0f9 100644 --- a/src/bin/otterlib.rs +++ b/src/bin/otterlib.rs @@ -1,7 +1,7 @@ pub use otter::imports::*; #[throws(anyhow::Error)] -fn main(){ +fn main() { let mut a = env::args(); a.next().unwrap(); let name = a.next().unwrap(); diff --git a/src/bin/slotmap-slot-idx-test.rs b/src/bin/slotmap-slot-idx-test.rs index 1ff8e837..cdd0b513 100644 --- a/src/bin/slotmap-slot-idx-test.rs +++ b/src/bin/slotmap-slot-idx-test.rs @@ -10,16 +10,17 @@ use otter::slotmap_slot_idx; -const BATCH : usize = 128; -const ITERS : usize = 10*1024*1024; +const BATCH: usize = 128; +const ITERS: usize = 10*1024*1024; fn main () { - let vol_i_buffer = [ 0x123456789abcdefu64; BATCH ]; - let mut vol_o_buffer = [ 0xdeadbeef; BATCH ]; +fn main() { + let vol_i_buffer = [0x123456789abcdefu64; BATCH]; + let mut vol_o_buffer = [0xdeadbeef; BATCH]; for _it in 0..ITERS { let input = unsafe { std::ptr::read_volatile(&vol_i_buffer) }; - let mut output = [ 0u32; BATCH ]; + let mut output = [0u32; BATCH]; for (&i,o) in input.iter().zip(output.iter_mut()) { let kd = slotmap::KeyData::from_ffi(i);