diff --git a/src/conversions.rs b/src/conversions.rs index 4d1c1b0..af41826 100644 --- a/src/conversions.rs +++ b/src/conversions.rs @@ -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; diff --git a/src/conversions/wrap.rs b/src/conversions/wrap.rs index 68ddae5..c6bcd3f 100644 --- a/src/conversions/wrap.rs +++ b/src/conversions/wrap.rs @@ -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; diff --git a/src/lib.rs b/src/lib.rs index 039a84c..070e31b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 = 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(); diff --git a/xpin-wasm/src/lib.rs b/xpin-wasm/src/lib.rs index 2349b3f..43f1070 100644 --- a/xpin-wasm/src/lib.rs +++ b/xpin-wasm/src/lib.rs @@ -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)]