Apply strict linting to release builds #75

Merged
savanni merged 21 commits from clippy-linting into main 2023-10-05 17:01:49 +00:00
4 changed files with 8 additions and 10 deletions
Showing only changes of commit 5496e9ce10 - Show all commits

View File

@ -33,12 +33,12 @@ fn main() {
let filename = args
.next()
.map(|p| PathBuf::from(p))
.map(PathBuf::from)
.expect("A filename is required");
let size = args
.next()
.and_then(|s| s.parse::<usize>().ok())
.unwrap_or(3);
let map: hex_map::Map<MapVal> = hex_map::Map::new_hexagonal(size);
hex_map::write_file(filename, map);
hex_map::write_file(filename, map).expect("to write file");
}

View File

@ -10,10 +10,9 @@ Luminescent Dreams Tools is distributed in the hope that it will be useful, but
You should have received a copy of the GNU General Public License along with Lumeto. If not, see <https://www.gnu.org/licenses/>.
*/
/// Ĉi-tiu modulo enhavas la elementojn por kub-koordinato.
/// This module contains the elements of cube coordinates.
///
/// This code is based on https://www.redblobgames.com/grids/hexagons/
use crate::Error;
use std::collections::HashSet;
/// An address within the hex coordinate system
@ -62,7 +61,7 @@ impl AxialAddr {
pub fn is_adjacent(&self, dest: &AxialAddr) -> bool {
dest.adjacencies()
.collect::<Vec<AxialAddr>>()
.contains(&self)
.contains(self)
}
/// Measure the distance to a destination
@ -79,7 +78,7 @@ impl AxialAddr {
positions.push(item);
while positions.len() > 0 {
while !positions.is_empty() {
let elem = positions.remove(0);
for adj in elem.adjacencies() {
if self.distance(&adj) <= distance && !results.contains(&adj) {

View File

@ -14,7 +14,6 @@ use crate::{hex::AxialAddr, Error};
use nom::{
bytes::complete::tag,
character::complete::alphanumeric1,
error::ParseError,
multi::many1,
sequence::{delimited, separated_pair},
Finish, IResult, Parser,
@ -81,7 +80,7 @@ pub fn parse_data<'a, A: Default + From<String>>(
}
let cells = data
.map(|line| parse_line::<A>(&line).unwrap())
.map(|line| parse_line::<A>(line).unwrap())
.collect::<Vec<(AxialAddr, A)>>();
let cells = cells.into_iter().collect::<HashMap<AxialAddr, A>>();
Map { cells }

View File

@ -9,9 +9,9 @@ Lumeto is distributed in the hope that it will be useful, but WITHOUT ANY WARRAN
You should have received a copy of the GNU General Public License along with Lumeto. If not, see <https://www.gnu.org/licenses/>.
*/
use thiserror;
use thiserror::Error;
#[derive(Debug, thiserror::Error)]
#[derive(Debug, Error)]
pub enum Error {
#[error("IO error on reading or writing: {0}")]
IO(std::io::Error),