File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ impl FloatCoordinate {
180
180
-self . q - self . r
181
181
}
182
182
183
+ #[ allow( clippy:: many_single_char_names) ]
183
184
pub fn from_pixel ( layout : & Layout , p : Point ) -> Self {
184
185
let o = & layout. orientation ;
185
186
let x = ( p. 0 - layout. origin . 0 ) / layout. size . 0 ;
@@ -462,7 +463,7 @@ impl<'de> Deserialize<'de> for Direction {
462
463
where
463
464
E : de:: Error ,
464
465
{
465
- if value >= 0 && value <= 5 {
466
+ if ( 0 .. 6 ) . contains ( & value) {
466
467
Ok ( Direction :: from ( value as u8 ) )
467
468
} else {
468
469
Err ( E :: custom ( format ! ( "direction out of range: {}" , value) ) )
@@ -473,7 +474,7 @@ impl<'de> Deserialize<'de> for Direction {
473
474
where
474
475
E : de:: Error ,
475
476
{
476
- if value <= 5 {
477
+ if ( 0 .. 6 ) . contains ( & value) {
477
478
Ok ( Direction :: from ( value as u8 ) )
478
479
} else {
479
480
Err ( E :: custom ( format ! ( "direction out of range: {}" , value) ) )
Original file line number Diff line number Diff line change @@ -514,7 +514,7 @@ impl FromStr for Terrain {
514
514
type Err = ParseTerrainError ;
515
515
516
516
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
517
- let idx = s. find ( '-' ) . unwrap_or ( s. len ( ) ) ;
517
+ let idx = s. find ( '-' ) . unwrap_or_else ( || s. len ( ) ) ;
518
518
let surface = & s[ 0 ..idx] ;
519
519
520
520
let level = if let Some ( val) = s. get ( idx+1 ..) {
Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ impl ExportView {
234
234
// remove tile from todo list
235
235
self . images . retain ( |img| img. tile != * tile) ;
236
236
237
- if self . images . len ( ) == 0 {
237
+ if self . images . is_empty ( ) {
238
238
debug ! ( "export of all tile images is completed" ) ;
239
239
let url = check ! ( self . canvas. to_data_url_with_type( "image/png" ) . ok( ) ) ;
240
240
check ! ( self . anchor. set_attribute( "href" , & url) . ok( ) ) ;
You can’t perform that action at this time.
0 commit comments