Skip to content

Commit cc70cc3

Browse files
committed
chore: Derive Default instead of manual implementation
1 parent 617ba5a commit cc70cc3

2 files changed

Lines changed: 4 additions & 14 deletions

File tree

galileo/src/layer/vector_tile_layer/style.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ pub struct StyleRule {
7979
/// Symbol of an object in a vector tile.
8080
///
8181
/// An the object has incompatible type with the symbol, the object is not renderred.
82-
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
82+
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
8383
pub enum VectorTileSymbol {
8484
/// Do not render object.
85+
#[default]
8586
None,
8687
/// Symbol for a point object.
8788
#[serde(rename = "point")]
@@ -97,12 +98,6 @@ pub enum VectorTileSymbol {
9798
Label(VectorTileLabelSymbol),
9899
}
99100

100-
impl Default for VectorTileSymbol {
101-
fn default() -> Self {
102-
Self::None
103-
}
104-
}
105-
106101
impl VectorTileSymbol {
107102
pub(crate) fn line(&self) -> Option<&VectorTileLineSymbol> {
108103
match self {

galileo/src/render/text/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,22 +143,17 @@ impl Default for FontWeight {
143143
}
144144

145145
/// Font style.
146-
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
146+
#[derive(Default, Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
147147
pub enum FontStyle {
148148
/// Normal font.
149+
#[default]
149150
Normal,
150151
/// Italic font.
151152
Italic,
152153
/// Oblique font.
153154
Oblique,
154155
}
155156

156-
impl Default for FontStyle {
157-
fn default() -> Self {
158-
Self::Normal
159-
}
160-
}
161-
162157
/// Queryable properties of a font
163158
pub struct FontProperties {
164159
/// Font weight

0 commit comments

Comments
 (0)