forked from 1b-agent/opencadstudio-upstream
style: apply cargo fmt across workspace
This commit is contained in:
1 parent
85710e5454
commit
9cf9ff2c5c
531 files changed
+57740
-33906
No files matched your search
+17
-24
@@ -89,7 +89,8 @@ pub fn set_fixed_text_heights(document: &codec::CadDocument) {
|
||||
let mut map = cell.borrow_mut();
|
||||
map.clear();
|
||||
for style in document.text_styles.iter() {
|
||||
let font = crate::entities::text_support::resolve_text_style(&style.name, document).font_name;
|
||||
let font =
|
||||
crate::entities::text_support::resolve_text_style(&style.name, document).font_name;
|
||||
map.insert(style.name.to_ascii_lowercase(), font);
|
||||
}
|
||||
});
|
||||
@@ -653,8 +654,8 @@ pub fn lineweight_options() -> Vec<String> {
|
||||
"Default".to_string(),
|
||||
];
|
||||
for value in [
|
||||
0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120,
|
||||
140, 158, 200, 211,
|
||||
0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120, 140, 158,
|
||||
200, 211,
|
||||
] {
|
||||
options.push(format!("{:.2} mm", value as f64 / 100.0));
|
||||
}
|
||||
@@ -694,11 +695,7 @@ pub fn num_prop(label: &str, field: &'static str, value: f64, editable: bool) ->
|
||||
|
||||
/// A ◀ / ▶ index navigator row (e.g. a polyline's Current Vertex). `display` is
|
||||
/// the label shown between the arrows (e.g. "2 / 7").
|
||||
pub fn stepper_prop(
|
||||
label: &str,
|
||||
field: &'static str,
|
||||
display: impl Into<String>,
|
||||
) -> Property {
|
||||
pub fn stepper_prop(label: &str, field: &'static str, display: impl Into<String>) -> Property {
|
||||
Property {
|
||||
label: label.into(),
|
||||
field,
|
||||
@@ -751,9 +748,7 @@ fn parse_angle_deg_unbounded(value: &str) -> Option<f64> {
|
||||
let i = rest.find(['°', 'd', 'D'])?;
|
||||
let d: f64 = rest[..i].trim().parse().ok()?;
|
||||
let mut total = d;
|
||||
let tail = rest[i..]
|
||||
.trim_start_matches(['°', 'd', 'D'])
|
||||
.trim();
|
||||
let tail = rest[i..].trim_start_matches(['°', 'd', 'D']).trim();
|
||||
if !tail.is_empty() {
|
||||
let (mpart, spart) = match tail.find('\'') {
|
||||
Some(j) => (&tail[..j], &tail[j + 1..]),
|
||||
@@ -1103,10 +1098,7 @@ pub(crate) fn extrude_wide_band_outline(
|
||||
point_segments.extend_from_slice(&base_segments);
|
||||
|
||||
let mut emitted = HashSet::new();
|
||||
for ((&point, &station), &segment) in base_points
|
||||
.iter()
|
||||
.zip(&base_stations)
|
||||
.zip(&base_segments)
|
||||
for ((&point, &station), &segment) in base_points.iter().zip(&base_stations).zip(&base_segments)
|
||||
{
|
||||
if !point[0].is_finite() {
|
||||
continue;
|
||||
@@ -1286,8 +1278,9 @@ mod length_format_tests {
|
||||
for lunits in [3, 4, 5] {
|
||||
for value in [0.995f64, 5.995, 11.999, 23.999, 66.5, 9.25] {
|
||||
let shown = with_units(lunits, if lunits == 3 { 4 } else { 4 }, value);
|
||||
let read = parse_length(&shown)
|
||||
.unwrap_or_else(|| panic!("lunits {lunits} wrote {shown:?}, which does not read back"));
|
||||
let read = parse_length(&shown).unwrap_or_else(|| {
|
||||
panic!("lunits {lunits} wrote {shown:?}, which does not read back")
|
||||
});
|
||||
assert!(
|
||||
(read - value).abs() < 0.02,
|
||||
"lunits {lunits}: {value} wrote {shown:?}, read back as {read}"
|
||||
@@ -1322,11 +1315,7 @@ mod length_format_tests {
|
||||
"format_angle produced {} chars",
|
||||
angle.len()
|
||||
);
|
||||
assert!(
|
||||
area.len() < 64,
|
||||
"format_area produced {} chars",
|
||||
area.len()
|
||||
);
|
||||
assert!(area.len() < 64, "format_area produced {} chars", area.len());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1360,7 +1349,9 @@ mod angle_format_tests {
|
||||
assert_eq!(shown(4, 0, 180.0), "W");
|
||||
assert_ne!(shown(4, 8, 0.0000000005), "E");
|
||||
for prec in [0, 2] {
|
||||
for deg in [0.99999f64, 45.9999, 89.99999, 179.99999, 269.99999, 359.99999] {
|
||||
for deg in [
|
||||
0.99999f64, 45.9999, 89.99999, 179.99999, 269.99999, 359.99999,
|
||||
] {
|
||||
let text = shown(4, prec, deg);
|
||||
assert!(
|
||||
!text.contains("90d"),
|
||||
@@ -1377,7 +1368,9 @@ mod angle_format_tests {
|
||||
for deg in [0.99999f64, 45.5, 45.9999, 89.99999, 200.25, 359.99999] {
|
||||
let text = shown(aunits, prec, deg);
|
||||
let read = parse_angle(&text).unwrap_or_else(|| {
|
||||
panic!("aunits {aunits} prec {prec} wrote {text:?}, which does not read back")
|
||||
panic!(
|
||||
"aunits {aunits} prec {prec} wrote {text:?}, which does not read back"
|
||||
)
|
||||
});
|
||||
let delta = (read.to_degrees().rem_euclid(360.0) - deg.rem_euclid(360.0))
|
||||
.rem_euclid(360.0);
|
||||
|
||||
Reference in new issue
Block a user