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 {
2222
2323/// Parse a weight of the form `q=0.123`.
2424pub ( 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.
4646pub ( 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}
You can’t perform that action at this time.
0 commit comments