Run clippy --fix

This commit is contained in:
Austen Adler 2023-03-24 16:20:56 -04:00
parent bb33b76b5d
commit ce1a8c8c32
3 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@ pub fn wrap_latlon(mut lat: f64, mut lon: f64) -> (f64, f64) {
_ => {}
}
if lon > 180_f64 || lon < -180_f64 {
if !(-180_f64..=180_f64).contains(&lon) {
lon -= ((lon + 180_f64) / 360_f64).floor() * 360_f64;
}

View File

@ -8,7 +8,7 @@ use web_frontend::Asset;
#[get("/<file..>")]
pub(crate) fn dist(file: PathBuf) -> Option<(ContentType, Cow<'static, [u8]>)> {
if let Some(a) = Asset::get(&format!("{}", file.display().to_string())) {
if let Some(a) = Asset::get(&format!("{}", file.display())) {
let content_type = file
.extension()
.and_then(OsStr::to_str)
@ -19,12 +19,12 @@ pub(crate) fn dist(file: PathBuf) -> Option<(ContentType, Cow<'static, [u8]>)> {
}
[".html", "/index.html"].iter().find_map(|ext| {
Asset::get(&format!("{}{}", file.display().to_string(), ext))
Asset::get(&format!("{}{}", file.display(), ext))
.map(|a| (ContentType::HTML, a.data))
})
}
#[get("/")]
pub(crate) fn index() -> Option<(ContentType, Cow<'static, [u8]>)> {
Asset::get(&"index.html").map(|a| (ContentType::HTML, a.data))
Asset::get("index.html").map(|a| (ContentType::HTML, a.data))
}

View File

@ -15,9 +15,9 @@ pub enum CoordinateType {
Plus,
}
impl Into<spatial_coordinate_systems::CoordinateType> for CoordinateType {
fn into(self) -> spatial_coordinate_systems::CoordinateType {
match self {
impl From<CoordinateType> for spatial_coordinate_systems::CoordinateType {
fn from(val: CoordinateType) -> Self {
match val {
Self::DD => spatial_coordinate_systems::CoordinateType::DD,
Self::DMS => spatial_coordinate_systems::CoordinateType::DMS,
Self::DMM => spatial_coordinate_systems::CoordinateType::DMM,
@ -92,7 +92,7 @@ impl EncodedAddress {
// TODO: Remove the clone here
let latlon = LatLon::try_from(src_coords.clone())
.map_err(|_| format!("Could not convert coordinate back to latlon"))?;
.map_err(|_| "Could not convert coordinate back to latlon".to_string())?;
let mut ret = Self::try_from(
xpin::Address::from_lat_lon(latlon.lat, latlon.lon)