Skip to content

Commit c4c7b17

Browse files
committed
clippy
1 parent 5ea814f commit c4c7b17

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ macro_rules! cfg_unstable {
2222

2323
/// Parse a weight of the form `q=0.123`.
2424
pub(crate) fn parse_weight(s: &str) -> crate::Result<f32> {
25-
let mut parts = s.split("=");
25+
let mut parts = s.split('=');
2626
if !matches!(parts.next(), Some("q")) {
2727
let mut err = Error::new_adhoc("invalid weight");
2828
err.set_status(StatusCode::BadRequest);
@@ -44,10 +44,10 @@ pub(crate) fn parse_weight(s: &str) -> crate::Result<f32> {
4444
/// Order proposals by weight. Try ordering by q value first. If equal or undefined,
4545
/// order by index, favoring the latest provided value.
4646
pub(crate) fn sort_by_weight<T: PartialOrd + Copy>(props: &mut Vec<T>) {
47-
let mut arr: Vec<(usize, T)> = props.iter().map(|t| *t).enumerate().collect();
47+
let mut arr: Vec<(usize, T)> = props.iter().copied().enumerate().collect();
4848
arr.sort_unstable_by(|a, b| match b.1.partial_cmp(&a.1) {
4949
None | Some(Ordering::Equal) => b.0.cmp(&a.0),
50-
Some(ord @ _) => ord,
50+
Some(ord) => ord,
5151
});
5252
*props = arr.into_iter().map(|(_, t)| t).collect::<Vec<T>>();
5353
}

0 commit comments

Comments
 (0)