clippy pass
This commit is contained in:
parent
69a4239f90
commit
48327efe20
3 changed files with 13 additions and 9 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -34,10 +34,7 @@ struct Args {
|
|||
fn interactive_play() -> anyhow::Result<()> {
|
||||
// TODO: Make a way to reset bank
|
||||
let term = Term::stdout();
|
||||
let mut bank: u32 = match load_bank()? {
|
||||
Some(b) => b,
|
||||
None => 1_000,
|
||||
};
|
||||
let mut bank: u32 = load_bank()?.unwrap_or(1_000);
|
||||
|
||||
let mut table = Table::new(6, bank).with_hit_on_soft_17();
|
||||
let mut last_bet: Option<u32> = None;
|
||||
|
|
@ -53,7 +50,7 @@ fn interactive_play() -> anyhow::Result<()> {
|
|||
print!("Your bet [{}]? ", last_bet);
|
||||
io::stdout().flush().unwrap();
|
||||
let input = term.read_line()?;
|
||||
if input == "" {
|
||||
if input.is_empty() {
|
||||
bet = last_bet;
|
||||
} else {
|
||||
match input.parse() {
|
||||
|
|
@ -121,7 +118,7 @@ fn interactive_play_turn(
|
|||
turn: &mut PlayerTurn,
|
||||
table: &mut Table,
|
||||
) -> anyhow::Result<Option<PlayerTurn>> {
|
||||
let mut initial_play = true && !turn.was_split;
|
||||
let mut initial_play = !turn.was_split;
|
||||
let mut other_turn = None;
|
||||
|
||||
let term = Term::stdout();
|
||||
|
|
@ -222,7 +219,7 @@ fn basic_strategy(
|
|||
// Got a pair, maybe should split
|
||||
// We check can_split right at the get-go, because if we can't we just follow the Hard
|
||||
// Total table.
|
||||
let aces = hand.cards()[0].value == String::from("A");
|
||||
let aces = hand.cards()[0].value == "A";
|
||||
match hand.value() {
|
||||
12 if aces => PlayerChoice::Split,
|
||||
20 => PlayerChoice::Stand,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue