Skip to content

Commit f44b58b

Browse files
committed
More granular #[allow(dead_code)] in JSON models
1 parent d2dd6b8 commit f44b58b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

godot-codegen/src/models/json.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@
55
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
66
*/
77

8-
// TODO remove this warning once impl is complete
9-
// Several types have #[allow(dead_code)], can be subsequently removed.
10-
11-
// In #[derive(DeJson)].
8+
// In #[derive(DeJson)]: "this block may be rewritten with the `?` operator"
129
#![allow(clippy::question_mark)]
13-
//
10+
1411
// This file acts as deserialization check of the JSON file. Even if some fields are unused, having them declared makes sure they're
1512
// deserializable and conform to our expectations. It also doesn't add much value to annotate individual fields; it doesn't really
1613
// matter if some are unused because it's external input data.
17-
#![allow(dead_code)]
1814

1915
use nanoserde::DeJson;
2016

@@ -38,7 +34,9 @@ pub struct JsonHeader {
3834
pub version_major: u8,
3935
pub version_minor: u8,
4036
pub version_patch: u8,
37+
#[allow(dead_code)]
4138
pub version_status: String,
39+
#[allow(dead_code)]
4240
pub version_build: String,
4341
pub version_full_name: String,
4442
}
@@ -58,7 +56,9 @@ pub struct JsonBuiltinSizeForConfig {
5856
#[derive(DeJson)]
5957
pub struct JsonBuiltinClass {
6058
pub name: String,
59+
#[allow(dead_code)]
6160
pub indexing_return_type: Option<String>,
61+
#[allow(dead_code)]
6262
pub is_keyed: bool,
6363
// pub members: Option<Vec<Member>>,
6464
// pub constants: Option<Vec<BuiltinConstant>>,
@@ -156,11 +156,14 @@ pub struct JsonBuiltinConstant {
156156
#[derive(DeJson)]
157157
pub struct JsonOperator {
158158
pub name: String,
159+
#[allow(dead_code)]
159160
pub right_type: Option<String>, // null if unary
161+
#[allow(dead_code)]
160162
pub return_type: String,
161163
}
162164

163165
#[derive(DeJson)]
166+
#[allow(dead_code)]
164167
pub struct JsonMember {
165168
pub name: String,
166169
#[nserde(rename = "type")]
@@ -194,7 +197,8 @@ pub struct JsonConstructor {
194197
pub struct JsonUtilityFunction {
195198
pub name: String,
196199
pub return_type: Option<String>,
197-
/// `"general"` or `"math"`
200+
/// Category: `"general"` or `"math"`
201+
#[allow(dead_code)]
198202
pub category: String,
199203
pub is_vararg: bool,
200204
pub hash: i64,

godot-codegen/src/special_cases/special_cases.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ pub fn maybe_rename_virtual_method<'m>(class_name: &TyName, rust_method_name: &'
595595

596596
// TODO method-level extra docs, for:
597597
// - Node::rpc_config() -> link to RpcConfig.
598+
// - Node::process/physics_process -> mention `f32`/`f64` duality.
598599

599600
pub fn get_class_extra_docs(class_name: &TyName) -> Option<&'static str> {
600601
match class_name.godot_ty.as_str() {

0 commit comments

Comments
 (0)