From 07e22c3f95c775b9546f56000745e8b000217a7c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 11 Mar 2021 11:12:32 +0000 Subject: [PATCH] otterlib: Rename a variable `p` (was `pc`) Signed-off-by: Ian Jackson --- src/bin/otterlib.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/bin/otterlib.rs b/src/bin/otterlib.rs index aa34c5c6..3bfb664d 100644 --- a/src/bin/otterlib.rs +++ b/src/bin/otterlib.rs @@ -70,7 +70,7 @@ fn preview(items: Vec) { struct Prep { spec: ItemSpec, - pc: Box, + p: Box, uos: Vec, bbox: Vec>, size: Vec, @@ -83,7 +83,7 @@ fn preview(items: Vec) { self.size[0] < 20.0 } fn face_cols(&self) -> usize { - usize::from(self.pc.nfaces()) + usize::from(self.p.nfaces()) * if self.want_several() { SEVERAL } else { 1 } } } @@ -91,13 +91,13 @@ fn preview(items: Vec) { let mut pieces: Vec = items.into_iter().map(|it| { let spec = ItemSpec { lib: it.0, item: it.1.itemname }; (||{ - let pc = spec.clone().load().context("load")?; + let p = spec.clone().load().context("load")?; let mut uos = vec![]; - pc.add_ui_operations(&mut uos, &GPiece::dummy()).context("add uos")?; + p.add_ui_operations(&mut uos, &GPiece::dummy()).context("add uos")?; let uos = uos.into_iter().map(|uo| uo.opname).collect::>(); let spec = spec.clone(); - let bbox = pc + let bbox = p .bbox_approx()?; let mut bbox = bbox .iter() @@ -109,7 +109,7 @@ fn preview(items: Vec) { .map(|(min,max)| max-min) .collect::>(); - Ok::<_,AE>(Prep { spec, pc, uos, bbox, size }) + Ok::<_,AE>(Prep { spec, p, uos, bbox, size }) })().with_context(|| format!("{:?}", &spec)) }).collect::,_>>()?; @@ -122,14 +122,14 @@ fn preview(items: Vec) { println!("{}", &HTML_PRELUDE); println!(r#""#); for s in &pieces { - let Prep { spec, pc, uos, bbox, size } = s; + let Prep { spec, p, uos, bbox, size } = s; println!(r#""#); println!(r#""#, Html::from_txt(&spec.lib).0); println!(r#""#, Html::from_txt(&spec.item).0); println!(r#""#, - pc.describe_html(&GPiece::dummy())?.0); + p.describe_html(&GPiece::dummy())?.0); let only1 = s.face_cols() == 1; for facecol in 0..(if only1 { 1 } else { max_facecols }) { @@ -150,7 +150,7 @@ fn preview(items: Vec) { _ => panic!(), }); println!(r#">"#); - if face < (pc.nfaces() as usize) { + if face < (p.nfaces() as usize) { let viewport = [bbox[0].clone(), size.clone()] .iter().cloned() @@ -159,7 +159,7 @@ fn preview(items: Vec) { .join(" "); let wh = size.iter().map(|&s| s * SVG_SCALE) .collect::>(); - let surround = pc.surround_path()?; + let surround = p.surround_path()?; print!(r#""#, &viewport, wh[0], wh[1]); @@ -171,7 +171,7 @@ fn preview(items: Vec) { } let mut html = Html("".into()); let gpc = GPiece { face: face.into(), ..GPiece::dummy() }; - pc.svg_piece(&mut html, &gpc, default())?; + p.svg_piece(&mut html, &gpc, default())?; println!("{}", html.0); } println!(""); -- 2.30.2
{}{}{}