Skip to content

Commit

Permalink
minor lints
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Dec 16, 2023
1 parent f26a9db commit d5594fd
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 26 deletions.
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ fmt-md:
fmt2:
cargo +nightly fmt -- --config imports_granularity=Module,group_imports=StdExternalCrate

# Run cargo check
check:
cargo check --workspace --all-targets --bins --tests --lib --benches

# Run cargo clippy
clippy:
cargo clippy --workspace --all-targets --bins --tests --lib --benches -- -D warnings
Expand Down
3 changes: 1 addition & 2 deletions martin/src/fonts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::PathBuf;
use std::sync::OnceLock;

use bit_set::BitSet;
use itertools::Itertools;
use itertools::Itertools as _;
use log::{debug, info, warn};
use pbf_font_tools::freetype::{Face, Library};
use pbf_font_tools::protobuf::Message;
Expand Down Expand Up @@ -335,7 +335,6 @@ fn parse_font(
} else {
format!("{s:02X}-{e:02X}")
})
.collect::<Vec<_>>()
.join(", "),
);

Expand Down
2 changes: 1 addition & 1 deletion martin/src/pg/configurator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::cmp::Ordering;
use std::collections::HashSet;

use futures::future::join_all;
use itertools::Itertools;
use itertools::Itertools as _;
use log::{debug, error, info, warn};

use crate::args::BoundsCalcType;
Expand Down
2 changes: 1 addition & 1 deletion martin/src/pg/function_source.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::fmt::Write;
use std::fmt::Write as _;
use std::iter::zip;

use log::{debug, warn};
Expand Down
3 changes: 2 additions & 1 deletion martin/src/pg/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::{BTreeMap, HashMap};

use deadpool_postgres::tokio_postgres::types::Json;
use itertools::Itertools as _;
use log::{error, info, warn};
use postgis::{ewkb, LineString, Point, Polygon};
use tilejson::{Bounds, TileJSON};
Expand Down Expand Up @@ -104,7 +105,7 @@ fn find_info_kv<'a, T>(
match find_kv_ignore_case(map, key) {
Ok(None) => {
warn!("Unable to configure source {id} because {info} '{key}' was not found. Possible values are: {}",
map.keys().map(String::as_str).collect::<Vec<_>>().join(", "));
map.keys().map(String::as_str).join(", "));
None
}
Ok(Some(result)) => {
Expand Down
2 changes: 1 addition & 1 deletion martin/src/utils/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::error::Error;
use std::fmt::Write;
use std::fmt::Write as _;
use std::io;
use std::path::PathBuf;

Expand Down
2 changes: 1 addition & 1 deletion martin/src/utils/id_resolver.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::hash_map::Entry;
use std::collections::{HashMap, HashSet};
use std::fmt::Write;
use std::fmt::Write as _;
use std::sync::{Arc, Mutex};

use log::warn;
Expand Down
4 changes: 2 additions & 2 deletions mbtiles/src/copier.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::fmt::Write;
use std::fmt::Write as _;
use std::path::PathBuf;

#[cfg(feature = "cli")]
use clap::{Args, ValueEnum};
use enum_display::EnumDisplay;
use itertools::Itertools;
use itertools::Itertools as _;
use log::{debug, info, trace};
use martin_tile_utils::{bbox_to_xyz, MAX_ZOOM};
use serde::{Deserialize, Serialize};
Expand Down
36 changes: 19 additions & 17 deletions mbtiles/tests/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::str::from_utf8;

use ctor::ctor;
use insta::{allow_duplicates, assert_display_snapshot};
use itertools::Itertools as _;
use log::info;
use martin_tile_utils::xyz_to_bbox;
use mbtiles::AggHashType::Verify;
Expand Down Expand Up @@ -263,10 +264,10 @@ async fn convert(

// Filter (0, 0, 2, 2) in mbtiles coordinates, which is (0, 2^5-1-2, 2, 2^5-1-0) = (0, 29, 2, 31) in XYZ coordinates, and slightly decrease it
let mut bbox = xyz_to_bbox(5, 0, invert_y_value(5, 2), 2, invert_y_value(5, 0));
bbox[0] += 180.0 / f64::from(1 << 5) * 0.1;
bbox[1] += 90.0 / f64::from(1 << 5) * 0.1;
bbox[2] -= 180.0 / f64::from(1 << 5) * 0.1;
bbox[3] -= 90.0 / f64::from(1 << 5) * 0.1;
bbox[0] += 180.0 * 0.1 / f64::from(1 << 5);
bbox[1] += 90.0 * 0.1 / f64::from(1 << 5);
bbox[2] -= 180.0 * 0.1 / f64::from(1 << 5);
bbox[3] -= 90.0 * 0.1 / f64::from(1 << 5);
opt.bbox.push(bbox.into());

let dmp = dump(&mut opt.run().await?).await?;
Expand Down Expand Up @@ -388,20 +389,22 @@ async fn patch_on_copy(
#[ignore]
async fn test_one() {
let db = Databases::default();

// Test convert
convert(Flat, Flat, &db).await.unwrap();

// let src_type = FlatWithHash;
// let dif_type = FlatWithHash;
// // let dst_type = Some(FlatWithHash);
// let dst_type = None;
// let db = databases();
//
// diff_and_patch(src_type, dif_type, dst_type, &db)
// .await
// .unwrap();
// patch_on_copy(src_type, dif_type, dst_type, &db)
// .await
// .unwrap();
// Test diff patch copy
let src_type = FlatWithHash;
let dif_type = FlatWithHash;
// let dst_type = Some(FlatWithHash);
let dst_type = None;

diff_and_patch(src_type, dif_type, dst_type, &db)
.await
.unwrap();
patch_on_copy(src_type, dif_type, dst_type, &db)
.await
.unwrap();
panic!("ALWAYS FAIL - this test is for debugging only, and should be disabled");
}

Expand Down Expand Up @@ -485,7 +488,6 @@ async fn dump(conn: &mut SqliteConnection) -> MbtResult<Vec<SqliteEntry>> {
})
.unwrap_or("NULL".to_string())
})
.collect::<Vec<_>>()
.join(", ");
format!("( {val} )")
})
Expand Down

0 comments on commit d5594fd

Please sign in to comment.