Skip to content

Commit

Permalink
Clippy updates (#207)
Browse files Browse the repository at this point in the history
* fixed latest clippy perf and doc lints

* fixed final used underscore items

* fix: updated macos ci from macos-12 to macos-13
  • Loading branch information
jessekrubin authored Dec 5, 2024
1 parent 4c7fda8 commit e37d9b8
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
strategy:
matrix:
platform:
- runner: macos-12
- runner: macos-13
target: x86_64
- runner: macos-14
target: aarch64
Expand Down
8 changes: 4 additions & 4 deletions crates/utiles-core/src/fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ enum TileEdgeInfo {
Middle,
}

fn _tile_edge_info(x: u32, y: u32, z: u8) -> TileEdgeInfo {
fn tile_edge_info(x: u32, y: u32, z: u8) -> TileEdgeInfo {
if x == 0 && y == 0 {
return TileEdgeInfo::TopLeft;
}
Expand All @@ -550,7 +550,7 @@ fn _tile_edge_info(x: u32, y: u32, z: u8) -> TileEdgeInfo {
}
}

fn _neighbors_middle_tile(x: u32, y: u32, z: u8) -> Vec<Tile> {
fn neighbors_middle_tile(x: u32, y: u32, z: u8) -> Vec<Tile> {
vec![
utile!(x + 1, y, z),
utile!(x, y + 1, z),
Expand All @@ -569,9 +569,9 @@ pub fn neighbors(x: u32, y: u32, z: u8) -> Vec<Tile> {
if z == 0 {
return Vec::new();
}
let edge_info = _tile_edge_info(x, y, z);
let edge_info = tile_edge_info(x, y, z);
match edge_info {
TileEdgeInfo::Middle => _neighbors_middle_tile(x, y, z),
TileEdgeInfo::Middle => neighbors_middle_tile(x, y, z),
TileEdgeInfo::TopLeft => vec![
utile!(x + 1, y, z),
utile!(x, y + 1, z),
Expand Down
1 change: 1 addition & 0 deletions crates/utiles-core/src/tile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ impl Tile {
/// # Errors
///
/// Returns an error if the conversion fails resulting in invalid tile
#[allow(clippy::used_underscore_items)]
#[allow(clippy::cast_possible_truncation)]
pub fn from_lnglat_zoom(
lng: f64,
Expand Down
15 changes: 8 additions & 7 deletions crates/utiles/src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ use crate::mbt::{MbtType, TilesFilter};
use crate::sqlite::InsertStrategy;
use crate::tile_strfmt::TileStringFormatter;

/// ██╗ ██╗████████╗██╗██╗ ███████╗███████╗
/// ██║ ██║╚══██╔══╝██║██║ ██╔════╝██╔════╝
/// ██║ ██║ ██║ ██║██║ █████╗ ███████╗
/// ██║ ██║ ██║ ██║██║ ██╔══╝ ╚════██║
/// ╚██████╔╝ ██║ ██║███████╗███████╗███████║
/// ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝
// ██╗ ██╗████████╗██╗██╗ ███████╗███████╗
// ██║ ██║╚══██╔══╝██║██║ ██╔════╝██╔════╝
// ██║ ██║ ██║ ██║██║ █████╗ ███████╗
// ██║ ██║ ██║ ██║██║ ██╔══╝ ╚════██║
// ╚██████╔╝ ██║ ██║███████╗███████╗███████║
// ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝

/// utiles cli (rust) ~ v{VERSION}
fn about() -> String {
let is_debug: bool = cfg!(debug_assertions);
if is_debug {
Expand Down
4 changes: 2 additions & 2 deletions crates/utiles/src/cli/commands/enumerate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use tracing::debug;
async fn enumerate_db(
fspath: &str,
tformatter: TileStringFormatter,
tfilter: &Option<TilesFilter>,
tfilter: Option<&TilesFilter>,
tx: tokio::sync::mpsc::Sender<String>,
) -> UtilesResult<()> {
let mbt = crate::mbt::MbtilesClientAsync::open_existing(fspath).await?;
Expand Down Expand Up @@ -96,7 +96,7 @@ pub async fn enumerate_main(args: &EnumerateArgs) -> UtilesResult<()> {
let fmt_str = format!("{fspath} {xyz_fmt_str}");
TileStringFormatter::new(&fmt_str)
};
enumerate_db(&fspath, formatter, &tf, tx.clone()).await?;
enumerate_db(&fspath, formatter, tf.as_ref(), tx.clone()).await?;
}
Ok(())
});
Expand Down
8 changes: 4 additions & 4 deletions crates/utiles/src/tests/edges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::edges::find_edges;
use std::collections::HashSet;
use utiles_core::{utile, Tile};

fn _test_data_input() -> Vec<Tile> {
fn test_data_input() -> Vec<Tile> {
vec![
utile!(4188, 3104, 13),
utile!(4192, 2977, 13),
Expand Down Expand Up @@ -109,7 +109,7 @@ fn _test_data_input() -> Vec<Tile> {
]
}

fn _test_expected() -> Vec<Tile> {
fn test_expected() -> Vec<Tile> {
vec![
utile!(4188, 3104, 13),
utile!(4192, 2737, 13),
Expand Down Expand Up @@ -200,14 +200,14 @@ fn _test_expected() -> Vec<Tile> {
}
#[test]
fn test_edges() {
let tdata = _test_data_input();
let tdata = test_data_input();

let mut edges = vec![];
for t in find_edges(&tdata).unwrap() {
edges.push(t);
}
// let edges = find_edges_vec(&tdata).unwrap();
let expected = _test_expected();
let expected = test_expected();
let expected_set = expected.into_iter().collect::<HashSet<Tile>>();
let edges_set = edges.into_iter().collect::<HashSet<Tile>>();

Expand Down
1 change: 1 addition & 0 deletions utiles-pyo3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![allow(clippy::too_many_lines)]
// road to clippy pedantic
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::used_underscore_items)]
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::float_cmp)]
#![allow(clippy::needless_pass_by_value)]
Expand Down

0 comments on commit e37d9b8

Please sign in to comment.