Skip to content

Commit b8810a6

Browse files
committed
style: apply cargo fmt
1 parent 9c2a806 commit b8810a6

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

crates/fugue-evo-wasm/src/interactive.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,7 @@ impl WasmStepResult {
319319
/// Interactive evolution optimizer for human-in-the-loop optimization
320320
#[wasm_bindgen]
321321
pub struct InteractiveOptimizer {
322-
iga: InteractiveGA<
323-
RealVector,
324-
TournamentSelection,
325-
SbxCrossover,
326-
PolynomialMutation,
327-
>,
322+
iga: InteractiveGA<RealVector, TournamentSelection, SbxCrossover, PolynomialMutation>,
328323
rng: rand::rngs::StdRng,
329324
}
330325

@@ -456,8 +451,11 @@ impl InteractiveOptimizer {
456451
termination_reason: None,
457452
},
458453
StepResult::Complete(result) => {
459-
let best_candidates: Vec<WasmCandidate> =
460-
result.best_candidates.iter().map(WasmCandidate::from).collect();
454+
let best_candidates: Vec<WasmCandidate> = result
455+
.best_candidates
456+
.iter()
457+
.map(WasmCandidate::from)
458+
.collect();
461459
WasmStepResult {
462460
result_type: StepResultType::Complete,
463461
request: None,
@@ -477,7 +475,9 @@ impl InteractiveOptimizer {
477475
#[wasm_bindgen(js_name = provideRatings)]
478476
pub fn provide_ratings(&mut self, ratings: &[f64]) -> Result<(), JsValue> {
479477
if ratings.len() % 2 != 0 {
480-
return Err(JsValue::from_str("Ratings array must have even length (id, rating pairs)"));
478+
return Err(JsValue::from_str(
479+
"Ratings array must have even length (id, rating pairs)",
480+
));
481481
}
482482

483483
let ratings_vec: Vec<(CandidateId, f64)> = ratings
@@ -593,7 +593,10 @@ fn convert_request(request: &EvaluationRequest<RealVector>) -> WasmEvaluationReq
593593
..
594594
} => WasmEvaluationRequest {
595595
request_type: RequestType::Pairwise,
596-
candidates: vec![WasmCandidate::from(candidate_a), WasmCandidate::from(candidate_b)],
596+
candidates: vec![
597+
WasmCandidate::from(candidate_a),
598+
WasmCandidate::from(candidate_b),
599+
],
597600
select_count: 1,
598601
scale_min: 0.0,
599602
scale_max: 1.0,

crates/fugue-evo-wasm/src/optimizers.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,9 @@ fn call_js_multi_objective(
613613
// Evolution Strategy Optimizer
614614
// ============================================================================
615615

616-
use fugue_evo::algorithms::evolution_strategy::{ESBuilder, ESSelectionStrategy, RecombinationType};
616+
use fugue_evo::algorithms::evolution_strategy::{
617+
ESBuilder, ESSelectionStrategy, RecombinationType,
618+
};
617619

618620
/// Selection strategy for Evolution Strategy
619621
#[wasm_bindgen]

0 commit comments

Comments
 (0)