style: apply cargo fmt across workspace

This commit is contained in:
Karim Jerbi committed 2026-10-11 03:14:29 +01:00
1 parent 85710e5454
commit 9cf9ff2c5c
531 files changed
+57740 -33906

No files matched your search

+67 -67
View File
@@ -438,9 +438,7 @@ impl OpenCADStudio {
.document
.entities()
.filter_map(|entity| match entity {
codec::EntityType::Face3D(face) => {
Some((face.common.handle, face.clone()))
}
codec::EntityType::Face3D(face) => Some((face.common.handle, face.clone())),
_ => None,
})
.collect();
@@ -1030,9 +1028,8 @@ impl OpenCADStudio {
false,
true,
);
self.command_line.push_output(
format!("{} constraint bar(s) reset.", count).as_str(),
);
self.command_line
.push_output(format!("{} constraint bar(s) reset.", count).as_str());
}
}
@@ -1145,20 +1142,15 @@ impl OpenCADStudio {
self.tabs[i].active_cmd = Some(Box::new(sel));
} else {
let scope = self.tabs[i].current_parametric_scope();
let inferred = self.tabs[i]
.scene
.inferred_parametric_constraints(
scope,
&handles,
&self.auto_constrain_settings,
);
let inferred = self.tabs[i].scene.inferred_parametric_constraints(
scope,
&handles,
&self.auto_constrain_settings,
);
if inferred.is_empty() {
self.command_line.push_output(
format!(
"0 constraint(s) applied to {} object(s).",
handles.len()
)
.as_str(),
format!("0 constraint(s) applied to {} object(s).", handles.len())
.as_str(),
);
self.tabs[i].scene.deselect_all();
self.refresh_selected_grips();
@@ -1281,8 +1273,7 @@ impl OpenCADStudio {
use crate::scene::named_parameters::DrivingValue;
use crate::scene::parametric_constraints::{
dynamic_dimension_text, next_angular_parameter_name,
next_dimensional_parameter_name, next_radial_parameter_name,
ConstraintKind,
next_dimensional_parameter_name, next_radial_parameter_name, ConstraintKind,
};
let scope = self.tabs[i].current_parametric_scope();
@@ -1322,7 +1313,11 @@ impl OpenCADStudio {
};
if self.tabs[i]
.scene
.validate_parametric_constraint(kind, &refs, Some(&DrivingValue::Literal(measured)))
.validate_parametric_constraint(
kind,
&refs,
Some(&DrivingValue::Literal(measured)),
)
.is_err()
{
refused += 1;
@@ -1451,10 +1446,12 @@ impl OpenCADStudio {
self.tabs[i].scene.deselect_all();
self.tabs[i].dirty = true;
self.refresh_properties();
self.command_line
.push_output(crate::tf!("{converted} associative dimensions converted").as_ref());
self.command_line.push_output(
crate::tf!("{refused} associative dimension(s) could not be converted").as_ref(),
crate::tf!("{converted} associative dimensions converted").as_ref(),
);
self.command_line.push_output(
crate::tf!("{refused} associative dimension(s) could not be converted")
.as_ref(),
);
if let Some(pd) = pending {
self.commit_undo_delta(i, pd);
@@ -1472,7 +1469,11 @@ impl OpenCADStudio {
let (kind, axis, label) = if vertical {
(ConstraintKind::Vertical, "Vertical", "Vertical constraint")
} else {
(ConstraintKind::Horizontal, "Horizontal", "Horizontal constraint")
(
ConstraintKind::Horizontal,
"Horizontal",
"Horizontal constraint",
)
};
let new_command = || {
if vertical {
@@ -1491,13 +1492,14 @@ impl OpenCADStudio {
.push_error(&format!("{axis}: select exactly one compatible object."));
} else {
let handle = handles[0];
let reference = self.tabs[i]
.scene
.document
.get_entity(handle)
.and_then(|entity| {
HorizontalConstraintCommand::preselected_reference(entity, handle)
});
let reference =
self.tabs[i]
.scene
.document
.get_entity(handle)
.and_then(|entity| {
HorizontalConstraintCommand::preselected_reference(entity, handle)
});
if let Some(reference) = reference {
let plane = self.tabs[i].ucs_xform().working_plane();
let direction = if vertical { plane.y } else { plane.x };
@@ -1532,13 +1534,14 @@ impl OpenCADStudio {
// the reference's own point-or-object prompt.
let handles = self.tabs[i].scene.selected_handles_in_order();
if let [handle] = handles.as_slice() {
let reference = self.tabs[i]
.scene
.document
.get_entity(*handle)
.and_then(|entity| {
FixConstraintCommand::preselected_reference(entity, *handle)
});
let reference =
self.tabs[i]
.scene
.document
.get_entity(*handle)
.and_then(|entity| {
FixConstraintCommand::preselected_reference(entity, *handle)
});
if let Some(reference) = reference {
return Some(self.apply_cmd_result(CmdResult::AddParametricConstraint {
kind: ConstraintKind::Fixed,
@@ -1718,13 +1721,15 @@ impl OpenCADStudio {
})
.collect::<Vec<_>>();
if picks.len() == 2 && picks[0].reference != picks[1].reference {
return Some(self.apply_cmd_result(CmdResult::AddPerpendicularConstraint {
first: picks[0].reference,
second: picks[1].reference,
first_fixed: picks[0].fixed_reference,
second_start: picks[1].start_reference,
label: "Perpendicular constraint",
}));
return Some(self.apply_cmd_result(
CmdResult::AddPerpendicularConstraint {
first: picks[0].reference,
second: picks[1].reference,
first_fixed: picks[0].fixed_reference,
second_start: picks[1].start_reference,
label: "Perpendicular constraint",
},
));
}
self.tabs[i].scene.deselect_all();
self.command_line.push_error(
@@ -1860,21 +1865,21 @@ impl OpenCADStudio {
self.command_line.push_info(&command.prompt());
self.tabs[i].active_cmd = Some(Box::new(command));
} else {
use crate::command::{
CmdResult, SymmetricConstraintSelection,
};
use crate::command::{CmdResult, SymmetricConstraintSelection};
use crate::modules::parametric::SymmetricConstraintCommand;
let refs = (handles.len() == 3).then(|| {
let first = self.tabs[i].scene.document.get_entity(handles[0])?;
let second = self.tabs[i].scene.document.get_entity(handles[1])?;
let axis = self.tabs[i].scene.document.get_entity(handles[2])?;
SymmetricConstraintCommand::preselected_refs(
(first, handles[0]),
(second, handles[1]),
(axis, handles[2]),
)
}).flatten();
let refs = (handles.len() == 3)
.then(|| {
let first = self.tabs[i].scene.document.get_entity(handles[0])?;
let second = self.tabs[i].scene.document.get_entity(handles[1])?;
let axis = self.tabs[i].scene.document.get_entity(handles[2])?;
SymmetricConstraintCommand::preselected_refs(
(first, handles[0]),
(second, handles[1]),
(axis, handles[2]),
)
})
.flatten();
if let Some([first, second, axis]) = refs {
return Some(self.apply_cmd_result(CmdResult::AddSymmetricConstraint {
selection: SymmetricConstraintSelection::Objects(first, second),
@@ -1962,10 +1967,8 @@ impl OpenCADStudio {
// asked for this command.
// The reference asks for the circle itself, whatever is
// selected, so a pick-first set is left alone.
let name = next_radial_parameter_name(
self.tabs[i].scene.named_parameters(),
diameter,
);
let name =
next_radial_parameter_name(self.tabs[i].scene.named_parameters(), diameter);
let command = DimConstraintCommand::new(
if diameter {
DimConstraintAxis::Diameter
@@ -2537,10 +2540,7 @@ impl OpenCADStudio {
.filter(|handle| {
matches!(
scene.document.get_entity(*handle),
Some(
codec::EntityType::Solid3D(_)
| codec::EntityType::Surface(_)
)
Some(codec::EntityType::Solid3D(_) | codec::EntityType::Surface(_))
)
})
.collect::<Vec<_>>();