Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Van Geffen committed Dec 17, 2024
1 parent ae6d028 commit aa8428f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/game/aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn fmt_floats(floats: &[f32], formatter: &mut std::fmt::Formatter<'_>) -> std::f
)
}

fn report_header(actions: &Vec<Action>) -> String {
fn report_header(actions: &[Action]) -> String {
format!(
"Flop,Turn,River,Frequency,IP Eq,IP EV,IP EQR,OOP Eq,OOP EV,OOP EQR,{}",
// Title for likelihood & EV per action
Expand Down Expand Up @@ -113,13 +113,14 @@ impl Display for AggRow {
formatter,
"{},",
flop_to_string(&self.flop)
.expect(format!("Row contains invalid flop cards: {:?}", &self.flop).as_str()),
.unwrap_or_else(|_| panic!("Row contains invalid flop cards: {:?}", &self.flop))
.as_str(),
)?;

// Write turn and river
let optional_card_to_string = |&opt| match opt {
Some(card) => {
card_to_string(card).expect(format!("Row contains invalid card: {card}").as_str())
card_to_string(card).unwrap_or_else(|_| panic!("Row contains invalid card: {card}"))
}
None => String::from(""),
};
Expand Down Expand Up @@ -186,7 +187,9 @@ fn generate_all_lines_rec(
return Ok(());
}

for action in action_tree.available_actions().to_owned() {
let all_actions = action_tree.available_actions().to_owned();

for action in all_actions {
action_tree.play(action)?;

generate_all_lines_rec(action_tree, lines)?;
Expand Down Expand Up @@ -257,7 +260,7 @@ impl AggActionTree {
fn init(prev_actions: Vec<Action>, available_actions: Vec<Action>) -> Self {
AggActionTree {
prev_actions,
available_actions: available_actions,
available_actions,
child_trees: HashMap::new(),
data: Vec::new(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ pub fn flop_to_string(flop: &[u8; 3]) -> Result<String, String> {
return Err("Cards must be unique".to_string());
}

let mut local_flop = flop.clone();
let mut local_flop = *flop;
local_flop.sort();

Ok(local_flop
Expand Down

0 comments on commit aa8428f

Please sign in to comment.