Skip to content

Commit ef0270d

Browse files
chore: add missing cfg feature gates (#1713)
These feature gates were accidentally forgotten. I noticed them during working on #1711 Unsure if there is a better way to find them rather than just noticing them --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 944313c commit ef0270d

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

martin/src/args/root.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ use crate::args::connections::Arguments;
77
use crate::args::environment::Env;
88
use crate::args::srv::SrvArgs;
99
use crate::config::Config;
10-
#[cfg(any(feature = "mbtiles", feature = "pmtiles", feature = "sprites"))]
10+
#[cfg(any(
11+
feature = "mbtiles",
12+
feature = "pmtiles",
13+
feature = "sprites",
14+
feature = "cog"
15+
))]
1116
use crate::file_config::FileConfigEnum;
1217
use crate::MartinError::ConfigAndConnectionsError;
13-
use crate::{MartinResult, OptOneMany};
18+
use crate::MartinResult;
19+
#[cfg(feature = "fonts")]
20+
use crate::OptOneMany;
1421

1522
#[derive(Parser, Debug, PartialEq, Default)]
1623
#[command(
@@ -58,9 +65,11 @@ pub struct MetaArgs {
5865
pub struct ExtraArgs {
5966
/// Export a directory with SVG files as a sprite source. Can be specified multiple times.
6067
#[arg(short, long)]
68+
#[cfg(feature = "sprites")]
6169
pub sprite: Vec<PathBuf>,
6270
/// Export a font file or a directory with font files as a font source (recursive). Can be specified multiple times.
6371
#[arg(short, long)]
72+
#[cfg(feature = "fonts")]
6473
pub font: Vec<PathBuf>,
6574
}
6675

@@ -117,6 +126,7 @@ impl Args {
117126
config.sprites = FileConfigEnum::new(self.extras.sprite);
118127
}
119128

129+
#[cfg(feature = "fonts")]
120130
if !self.extras.font.is_empty() {
121131
config.fonts = OptOneMany::new(self.extras.font);
122132
}

martin/src/config.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ use log::info;
1111
use serde::{Deserialize, Serialize};
1212
use subst::VariableMap;
1313

14-
#[cfg(any(feature = "mbtiles", feature = "pmtiles", feature = "sprites"))]
14+
#[cfg(any(
15+
feature = "mbtiles",
16+
feature = "pmtiles",
17+
feature = "sprites",
18+
feature = "cog"
19+
))]
1520
use crate::file_config::FileConfigEnum;
1621
#[cfg(feature = "fonts")]
1722
use crate::fonts::FontSources;
@@ -21,7 +26,9 @@ use crate::sprites::{SpriteConfig, SpriteSources};
2126
use crate::srv::{SrvConfig, RESERVED_KEYWORDS};
2227
use crate::utils::{init_aws_lc_tls, parse_base_path, CacheValue, MainCache, OptMainCache};
2328
use crate::MartinError::{ConfigLoadError, ConfigParseError, ConfigWriteError, NoSources};
24-
use crate::{IdResolver, MartinResult, OptOneMany};
29+
#[cfg(any(feature = "fonts", feature = "postgres"))]
30+
use crate::OptOneMany;
31+
use crate::{IdResolver, MartinResult};
2532

2633
pub type UnrecognizedValues = HashMap<String, serde_yaml::Value>;
2734

@@ -62,6 +69,7 @@ pub struct Config {
6269
#[serde(default, skip_serializing_if = "FileConfigEnum::is_none")]
6370
pub sprites: FileConfigEnum<SpriteConfig>,
6471

72+
#[cfg(feature = "fonts")]
6573
#[serde(default, skip_serializing_if = "OptOneMany::is_none")]
6674
pub fonts: OptOneMany<PathBuf>,
6775

0 commit comments

Comments
 (0)