Skip to content

Commit a127559

Browse files
authored
Remove deprecated enum variants (#30)
1 parent 947486b commit a127559

File tree

2 files changed

+16
-40
lines changed

2 files changed

+16
-40
lines changed

derive/src/attribute_ops.rs

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl FieldExportOps {
4040
if self.color_no_alpha {
4141
result = Some((
4242
"color_no_alpha",
43-
quote!(#property_hints::PROPERTY_HINT_COLOR_NO_ALPHA),
43+
quote!(#property_hints::COLOR_NO_ALPHA),
4444
String::new(),
4545
));
4646
}
@@ -52,11 +52,7 @@ impl FieldExportOps {
5252
return Self::error(span, active_field, field);
5353
}
5454

55-
result = Some((
56-
field,
57-
quote!(#property_hints::PROPERTY_HINT_DIR),
58-
String::new(),
59-
));
55+
result = Some((field, quote!(#property_hints::DIR), String::new()));
6056
}
6157

6258
if let Some(exp_list) = self.exp_easing.as_ref() {
@@ -83,7 +79,7 @@ impl FieldExportOps {
8379

8480
result = Some((
8581
field,
86-
quote!(#property_hints::PROPERTY_HINT_EXP_EASING),
82+
quote!(#property_hints::EXP_EASING),
8783
serialized_params.join(","),
8884
));
8985
}
@@ -102,11 +98,7 @@ impl FieldExportOps {
10298
.collect::<Result<Vec<_>, _>>()
10399
.map_err(|err| err.write_errors())?;
104100

105-
result = Some((
106-
field,
107-
quote!(#property_hints::PROPERTY_HINT_FILE),
108-
filters.join(","),
109-
));
101+
result = Some((field, quote!(#property_hints::FILE), filters.join(",")));
110102
}
111103

112104
if self.flags.is_some() {
@@ -116,11 +108,7 @@ impl FieldExportOps {
116108
return Self::error(span, active_field, field);
117109
}
118110

119-
result = Some((
120-
field,
121-
quote!(#property_hints::PROPERTY_HINT_FLAGS),
122-
String::new(),
123-
));
111+
result = Some((field, quote!(#property_hints::FLAGS), String::new()));
124112
}
125113

126114
if self.global_dir {
@@ -130,11 +118,7 @@ impl FieldExportOps {
130118
return Self::error(span, active_field, field);
131119
}
132120

133-
result = Some((
134-
field,
135-
quote!(#property_hints::PROPERTY_HINT_GLOBAL_DIR),
136-
String::new(),
137-
));
121+
result = Some((field, quote!(#property_hints::GLOBAL_DIR), String::new()));
138122
}
139123

140124
if self.global_file {
@@ -144,11 +128,7 @@ impl FieldExportOps {
144128
return Self::error(span, active_field, field);
145129
}
146130

147-
result = Some((
148-
field,
149-
quote!(#property_hints::PROPERTY_HINT_GLOBAL_FILE),
150-
String::new(),
151-
));
131+
result = Some((field, quote!(#property_hints::GLOBAL_FILE), String::new()));
152132
}
153133

154134
if self.multiline {
@@ -158,11 +138,7 @@ impl FieldExportOps {
158138
return Self::error(span, active_field, field);
159139
}
160140

161-
result = Some((
162-
field,
163-
quote!(#property_hints::PROPERTY_HINT_MULTILINE),
164-
String::new(),
165-
));
141+
result = Some((field, quote!(#property_hints::MULTILINE), String::new()));
166142
}
167143

168144
if let Some(list) = self.node_path.as_ref() {
@@ -181,7 +157,7 @@ impl FieldExportOps {
181157

182158
result = Some((
183159
field,
184-
quote!(#property_hints::PROPERTY_HINT_NODE_PATH_VALID_TYPES),
160+
quote!(#property_hints::NODE_PATH_VALID_TYPES),
185161
types.join(","),
186162
));
187163
}
@@ -195,7 +171,7 @@ impl FieldExportOps {
195171

196172
result = Some((
197173
field,
198-
quote!(#property_hints::PROPERTY_HINT_PLACEHOLDER_TEXT),
174+
quote!(#property_hints::PLACEHOLDER_TEXT),
199175
text.to_owned(),
200176
));
201177
}
@@ -211,14 +187,14 @@ impl FieldExportOps {
211187

212188
result = Some((
213189
field,
214-
quote!(#property_hints::PROPERTY_HINT_RANGE),
190+
quote!(#property_hints::RANGE),
215191
format!("{},{},{}", ops.min, ops.max, step),
216192
));
217193
}
218194

219195
let result = result
220196
.map(|(_, tokens, hint_string)| (tokens, hint_string))
221-
.unwrap_or_else(|| (quote!(#property_hints::PROPERTY_HINT_NONE), String::new()));
197+
.unwrap_or_else(|| (quote!(#property_hints::NONE), String::new()));
222198

223199
Ok(result)
224200
}

derive/src/impl_attribute.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn godot_script_impl(
6363
name: stringify!(#arg_name),
6464
ty: #arg_type,
6565
exported: false,
66-
hint: #property_hints::PROPERTY_HINT_NONE,
66+
hint: #property_hints::NONE,
6767
hint_string: "",
6868
description: "",
6969
},
@@ -99,9 +99,9 @@ pub fn godot_script_impl(
9999
};
100100

101101
let method_flag = if is_static {
102-
quote!(#godot_types::engine::global::MethodFlags::METHOD_FLAG_STATIC)
102+
quote!(#godot_types::engine::global::MethodFlags::STATIC)
103103
} else {
104-
quote!(#godot_types::engine::global::MethodFlags::METHOD_FLAG_NORMAL)
104+
quote!(#godot_types::engine::global::MethodFlags::NORMAL)
105105
};
106106

107107
let description = fnc.attrs.iter()
@@ -122,7 +122,7 @@ pub fn godot_script_impl(
122122
name: #fn_name_str,
123123
ty: #fn_return_ty,
124124
exported: false,
125-
hint: #property_hints::PROPERTY_HINT_NONE,
125+
hint: #property_hints::NONE,
126126
hint_string: "",
127127
description: "",
128128
},

0 commit comments

Comments
 (0)