Skip to content

Commit

Permalink
Get clippy 1.84 to pass, bump MSRV to 1.80 (#1648)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik authored Jan 10, 2025
1 parent 666977e commit 10f56ba
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = ["martin", "martin-tile-utils", "mbtiles"]
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/maplibre/martin"
rust-version = "1.76"
rust-version = "1.80"
readme = "README.md"
homepage = "https://martin.maplibre.org/"

Expand Down
2 changes: 1 addition & 1 deletion martin/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl NullSource {

#[async_trait]
impl Source for NullSource {
fn get_id(&self) -> &str {
fn get_id(&self) -> &'static str {
"null"
}

Expand Down
4 changes: 2 additions & 2 deletions martin/src/file_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ pub enum FileError {
#[error(r"Unable to parse metadata in file {1}: {0}")]
InvalidUrlMetadata(String, Url),

#[error(r#"Unable to acquire connection to file: {0}"#)]
#[error(r"Unable to acquire connection to file: {0}")]
AcquireConnError(String),

#[cfg(feature = "pmtiles")]
#[error(r#"PMTiles error {0} processing {1}"#)]
#[error(r"PMTiles error {0} processing {1}")]
PmtError(pmtiles::PmtError, String),

#[cfg(feature = "cog")]
Expand Down
9 changes: 3 additions & 6 deletions martin/src/fonts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, HashMap};
use std::ffi::OsStr;
use std::fmt::Debug;
use std::path::PathBuf;
use std::sync::OnceLock;
use std::sync::LazyLock;

use bit_set::BitSet;
use itertools::Itertools as _;
Expand Down Expand Up @@ -278,7 +278,7 @@ fn parse_font(
fonts: &mut HashMap<String, FontSource>,
path: PathBuf,
) -> FontResult<()> {
static RE_SPACES: OnceLock<Regex> = OnceLock::new();
static RE_SPACES: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(\s|/|,)+").unwrap());

let mut face = lib.new_face(&path, 0)?;
let num_faces = face.num_faces() as isize;
Expand All @@ -296,10 +296,7 @@ fn parse_font(
name.push_str(style);
}
// Make sure font name has no slashes or commas, replacing them with spaces and de-duplicating spaces
name = RE_SPACES
.get_or_init(|| Regex::new(r"(\s|/|,)+").unwrap())
.replace_all(name.as_str(), " ")
.to_string();
name = RE_SPACES.replace_all(name.as_str(), " ").to_string();

match fonts.entry(name) {
Entry::Occupied(v) => {
Expand Down
2 changes: 1 addition & 1 deletion martin/src/pg/config_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl TableInfo {
match (&self.geometry_type, &cfg_inf.geometry_type) {
(Some(src), Some(cfg)) if src != cfg => {
warn!(
r#"Table {} has geometry type={src}, but source {new_id} has {cfg}"#,
r"Table {} has geometry type={src}, but source {new_id} has {cfg}",
self.format_id()
);
}
Expand Down
4 changes: 2 additions & 2 deletions martin/src/pg/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ pub enum PgError {
#[error("Error preparing a query for the tile '{1}' ({2}): {3} {0}")]
PrepareQueryError(#[source] TokioPgError, String, String, String),

#[error(r#"Unable to get tile {2:#} from {1}: {0}"#)]
#[error(r"Unable to get tile {2:#} from {1}: {0}")]
GetTileError(#[source] TokioPgError, String, TileCoord),

#[error(r#"Unable to get tile {2:#} with {json_query:?} params from {1}: {0}"#, json_query=query_to_json(.3.as_ref()))]
#[error(r"Unable to get tile {2:#} with {json_query:?} params from {1}: {0}", json_query=query_to_json(.3.as_ref()))]
GetTileWithQueryError(#[source] TokioPgError, String, TileCoord, Option<UrlQuery>),

#[error("Configuration error: {0}")]
Expand Down
8 changes: 4 additions & 4 deletions martin/src/pg/query_tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pub async fn table_to_query(
let layer_id = escape_literal(info.layer_id.as_ref().unwrap_or(&id));
let clip_geom = info.clip_geom.unwrap_or(DEFAULT_CLIP_GEOM);
let query = format!(
r#"
r"
SELECT
ST_AsMVT(tile, {layer_id}, {extent}, 'geom'{id_name})
FROM (
Expand All @@ -203,7 +203,7 @@ FROM (
{geometry_column} && ST_Transform({bbox_search}, {srid})
{limit_clause}
) AS tile;
"#
"
)
.trim()
.to_string();
Expand All @@ -222,7 +222,7 @@ async fn calc_bounds(
Ok(pool.get()
.await?
.query_one(&format!(
r#"
r"
WITH real_bounds AS (SELECT ST_SetSRID(ST_Extent({geometry_column}::geometry), {srid}) AS rb FROM {schema}.{table})
SELECT ST_Transform(
CASE
Expand All @@ -233,7 +233,7 @@ SELECT ST_Transform(
4326
) AS bounds
FROM {schema}.{table};
"#), &[])
"), &[])
.await
.map_err(|e| PostgresError(e, "querying table bounds"))?
.get::<_, Option<ewkb::Polygon>>("bounds")
Expand Down
2 changes: 1 addition & 1 deletion mbtiles/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ LIMIT 1;"
} else if let Ok(v) = row.try_get::<i32, _>(idx) {
res.push(format!("{v}"));
} else if let Ok(v) = row.try_get::<f64, _>(idx) {
res.push(format!(r#"{v} (REAL)"#));
res.push(format!(r"{v} (REAL)"));
} else {
res.push(format!("{:?}", raw.type_info()));
}
Expand Down

0 comments on commit 10f56ba

Please sign in to comment.