Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8049c34

Browse files
authored
style: include match_same_arms (TheAlgorithms#868)
1 parent 798c73a commit 8049c34

File tree

4 files changed

+10
-20
lines changed

4 files changed

+10
-20
lines changed

‎Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ manual_let_else = { level = "allow", priority = 1 }
4646
manual_string_new = { level = "allow", priority = 1 }
4747
many_single_char_names = { level = "allow", priority = 1 }
4848
match_on_vec_items = { level = "allow", priority = 1 }
49-
match_same_arms = { level = "allow", priority = 1 }
5049
match_wildcard_for_single_variants = { level = "allow", priority = 1 }
5150
missing_errors_doc = { level = "allow", priority = 1 }
5251
missing_fields_in_debug = { level = "allow", priority = 1 }

‎src/geometry/closest_points.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ fn closest_points_aux(
8383
(dr, (r1, r2))
8484
}
8585
}
86-
(Some((a, b)), None) => (a.euclidean_distance(&b), (a, b)),
87-
(None, Some((a, b))) => (a.euclidean_distance(&b), (a, b)),
86+
(Some((a, b)), None) | (None, Some((a, b))) => (a.euclidean_distance(&b), (a, b)),
8887
(None, None) => unreachable!(),
8988
};
9089

‎src/graph/depth_first_search_tic_tac_toe.rs‎

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,10 @@ fn append_playaction(
280280
(Players::Blank, _, _) => panic!("Unreachable state."),
281281

282282
//Winning scores
283-
(Players::PlayerX, Players::PlayerX, Players::PlayerX) => {
283+
(Players::PlayerX, Players::PlayerX, Players::PlayerX)
284+
| (Players::PlayerO, Players::PlayerO, Players::PlayerO) => {
284285
play_actions.positions.push(appendee.position);
285286
}
286-
(Players::PlayerX, Players::PlayerX, _) => {}
287-
(Players::PlayerO, Players::PlayerO, Players::PlayerO) => {
288-
play_actions.positions.push(appendee.position);
289-
}
290-
(Players::PlayerO, Players::PlayerO, _) => {}
291287

292288
//Non-winning to Winning scores
293289
(Players::PlayerX, _, Players::PlayerX) => {
@@ -302,21 +298,18 @@ fn append_playaction(
302298
}
303299

304300
//Losing to Neutral scores
305-
(Players::PlayerX, Players::PlayerO, Players::Blank) => {
306-
play_actions.side = Players::Blank;
307-
play_actions.positions.clear();
308-
play_actions.positions.push(appendee.position);
309-
}
310-
311-
(Players::PlayerO, Players::PlayerX, Players::Blank) => {
301+
(Players::PlayerX, Players::PlayerO, Players::Blank)
302+
| (Players::PlayerO, Players::PlayerX, Players::Blank) => {
312303
play_actions.side = Players::Blank;
313304
play_actions.positions.clear();
314305
play_actions.positions.push(appendee.position);
315306
}
316307

317308
//Ignoring lower scored plays
318-
(Players::PlayerX, Players::Blank, Players::PlayerO) => {}
319-
(Players::PlayerO, Players::Blank, Players::PlayerX) => {}
309+
(Players::PlayerX, Players::PlayerX, _)
310+
| (Players::PlayerO, Players::PlayerO, _)
311+
| (Players::PlayerX, Players::Blank, Players::PlayerO)
312+
| (Players::PlayerO, Players::Blank, Players::PlayerX) => {}
320313

321314
//No change hence append only
322315
(_, _, _) => {

‎src/math/miller_rabin.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ pub fn miller_rabin(number: u64, bases: &[u64]) -> u64 {
4747
0 => {
4848
panic!("0 is invalid input for Miller-Rabin. 0 is not prime by definition, but has no witness");
4949
}
50-
2 => return 0,
51-
3 => return 0,
50+
2 | 3 => return 0,
5251
_ => return number,
5352
}
5453
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /