File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ macro_rules! cfg_unstable {
22
22
23
23
/// Parse a weight of the form `q=0.123`.
24
24
pub ( crate ) fn parse_weight ( s : & str ) -> crate :: Result < f32 > {
25
- let mut parts = s. split ( "=" ) ;
25
+ let mut parts = s. split ( '=' ) ;
26
26
if !matches ! ( parts. next( ) , Some ( "q" ) ) {
27
27
let mut err = Error :: new_adhoc ( "invalid weight" ) ;
28
28
err. set_status ( StatusCode :: BadRequest ) ;
@@ -44,10 +44,10 @@ pub(crate) fn parse_weight(s: &str) -> crate::Result<f32> {
44
44
/// Order proposals by weight. Try ordering by q value first. If equal or undefined,
45
45
/// order by index, favoring the latest provided value.
46
46
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 ( ) ;
48
48
arr. sort_unstable_by ( |a, b| match b. 1 . partial_cmp ( & a. 1 ) {
49
49
None | Some ( Ordering :: Equal ) => b. 0 . cmp ( & a. 0 ) ,
50
- Some ( ord @ _ ) => ord,
50
+ Some ( ord) => ord,
51
51
} ) ;
52
52
* props = arr. into_iter ( ) . map ( |( _, t) | t) . collect :: < Vec < T > > ( ) ;
53
53
}
You can’t perform that action at this time.
0 commit comments