Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ version_check = "0.9.5"
module_name_repetitions = { level = "allow", priority = 1 }
too_long_first_doc_paragraph = { level = "allow", priority = 1 } # Temporary
pedantic = "deny"
missing_const_for_fn = "deny"
# Do not activate until Clippy issue #13356 is fixed
#allow_attributes = "deny"

Expand Down
2 changes: 1 addition & 1 deletion examples/sliding-puzzle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Game {
}

// Compute the Manhattan distance between the piece at idx and its correct position.
fn distance(&self, idx: u8) -> u8 {
const fn distance(&self, idx: u8) -> u8 {
let (actual_x, actual_y) = (Self::x(idx), Self::y(idx));
let (correct_x, correct_y) = (
Self::x(self.positions[idx as usize]),
Expand Down
6 changes: 3 additions & 3 deletions src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ impl Grid {

/// Enable diagonal mode. Diagonal edges will be created between
/// adjacent vertices.
pub fn enable_diagonal_mode(&mut self) {
pub const fn enable_diagonal_mode(&mut self) {
self.diagonal_mode = true;
}

/// Disable diagonal mode. Only horizontal and vertical edges will
/// be created between adjacent vertices.
pub fn disable_diagonal_mode(&mut self) {
pub const fn disable_diagonal_mode(&mut self) {
self.diagonal_mode = false;
}

Expand Down Expand Up @@ -310,7 +310,7 @@ impl Grid {
/// Remove every existing vertex, and add all absent vertices.
/// If you see the grid as a black and white array, imagine that
/// the color are exchanged.
pub fn invert(&mut self) {
pub const fn invert(&mut self) {
self.dense = !self.dense;
}

Expand Down
Loading