Fix clippy lints

This commit is contained in:
Austen Adler 2023-04-18 13:34:32 -04:00
parent 98605cbab0
commit 030272f915
4 changed files with 6 additions and 9 deletions

View File

@ -4,8 +4,8 @@ use std::ops::RangeInclusive;
use s2::{cellid::CellID, latlng::LatLng};
use words::Word;
pub(crate) const TWELVE_BITS: u64 = 0b1111_1111_1111;
pub(crate) const THIRTEEN_BITS: u64 = 0b1_1111_1111_1111;
pub const TWELVE_BITS: u64 = 0b1111_1111_1111;
pub const THIRTEEN_BITS: u64 = 0b1_1111_1111_1111;
use crate::Error;

View File

@ -15,7 +15,7 @@ pub fn wrap_latlon(mut lat: f64, mut lon: f64) -> (f64, f64) {
}
1 => {
lat = pole - offset;
lon += 180_f64
lon += 180_f64;
}
2 => {
lat = -offset;

View File

@ -1,6 +1,7 @@
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
#![allow(clippy::cast_possible_truncation, clippy::multiple_crate_versions)]
#![allow(unused_imports)]
#![allow(clippy::module_name_repetitions)]
pub mod v0;
use conversions::lat_lon_to_cellid;
@ -167,10 +168,7 @@ impl Address<'_> {
let mut words = vec![];
for word in word_components {
match words::get_word(word) {
Some(w) => words.push(w),
None => errors.push(word.to_ascii_uppercase()),
}
words::get_word(word).map_or_else(|| errors.push(word.to_ascii_uppercase()), |w| words.push(w));
}
if !errors.is_empty() {
@ -181,7 +179,7 @@ impl Address<'_> {
// TODO: This will be handled by the call to get_words_multi later
{
let mut word_numbers: Vec<u16> = words.iter().map(|w| w.number).collect();
word_numbers.sort();
word_numbers.sort_unstable();
let prev_len = word_numbers.len();
word_numbers.dedup();
let cur_len = word_numbers.len();

View File

@ -2,7 +2,6 @@ use std::str::FromStr;
use spatial_coordinate_systems::{urls::CoordinateUrls, Coordinate, CoordinateType, LatLon};
use wasm_bindgen::prelude::*;
use xpin::Address;
#[wasm_bindgen(getter_with_clone)]
#[derive(Debug)]