File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ version_check = "0.9.5"
4747module_name_repetitions = { level = " allow" , priority = 1 }
4848too_long_first_doc_paragraph = { level = " allow" , priority = 1 } # Temporary
4949pedantic = " deny"
50+ missing_const_for_fn = " deny"
5051# Do not activate until Clippy issue #13356 is fixed
5152# allow_attributes = "deny"
5253
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ impl Game {
7575 }
7676
7777 // Compute the Manhattan distance between the piece at idx and its correct position.
78- fn distance ( & self , idx : u8 ) -> u8 {
78+ const fn distance ( & self , idx : u8 ) -> u8 {
7979 let ( actual_x, actual_y) = ( Self :: x ( idx) , Self :: y ( idx) ) ;
8080 let ( correct_x, correct_y) = (
8181 Self :: x ( self . positions [ idx as usize ] ) ,
Original file line number Diff line number Diff line change @@ -124,13 +124,13 @@ impl Grid {
124124
125125 /// Enable diagonal mode. Diagonal edges will be created between
126126 /// adjacent vertices.
127- pub fn enable_diagonal_mode ( & mut self ) {
127+ pub const fn enable_diagonal_mode ( & mut self ) {
128128 self . diagonal_mode = true ;
129129 }
130130
131131 /// Disable diagonal mode. Only horizontal and vertical edges will
132132 /// be created between adjacent vertices.
133- pub fn disable_diagonal_mode ( & mut self ) {
133+ pub const fn disable_diagonal_mode ( & mut self ) {
134134 self . diagonal_mode = false ;
135135 }
136136
@@ -310,7 +310,7 @@ impl Grid {
310310 /// Remove every existing vertex, and add all absent vertices.
311311 /// If you see the grid as a black and white array, imagine that
312312 /// the color are exchanged.
313- pub fn invert ( & mut self ) {
313+ pub const fn invert ( & mut self ) {
314314 self . dense = !self . dense ;
315315 }
316316
You can’t perform that action at this time.
0 commit comments