Переглянути джерело

syn: Fix having access to `idl` module by default (#2650)

acheron 2 роки тому
батько
коміт
25b24a1fd3
3 змінених файлів з 14 додано та 13 видалено
  1. 2 3
      lang/syn/src/idl/mod.rs
  2. 1 2
      lang/syn/src/idl/types.rs
  3. 11 8
      lang/syn/src/lib.rs

+ 2 - 3
lang/syn/src/idl/mod.rs

@@ -1,8 +1,7 @@
+pub mod types;
+
 #[cfg(feature = "idl-build")]
 pub mod build;
 
 #[cfg(feature = "idl-parse")]
 pub mod parse;
-
-#[cfg(feature = "idl-types")]
-pub mod types;

+ 1 - 2
lang/syn/src/idl/types.rs

@@ -1,5 +1,4 @@
 use serde::{Deserialize, Serialize};
-use serde_json::Value as JsonValue;
 
 #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
 pub struct Idl {
@@ -19,7 +18,7 @@ pub struct Idl {
     #[serde(skip_serializing_if = "Option::is_none", default)]
     pub errors: Option<Vec<IdlErrorCode>>,
     #[serde(skip_serializing_if = "Option::is_none", default)]
-    pub metadata: Option<JsonValue>,
+    pub metadata: Option<serde_json::Value>,
 }
 
 #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]

+ 11 - 8
lang/syn/src/lib.rs

@@ -1,3 +1,14 @@
+pub mod codegen;
+pub mod parser;
+
+#[cfg(feature = "idl-types")]
+pub mod idl;
+
+#[cfg(feature = "hash")]
+pub mod hash;
+#[cfg(not(feature = "hash"))]
+pub(crate) mod hash;
+
 use crate::parser::tts_to_string;
 use codegen::accounts as accounts_codegen;
 use codegen::program as program_codegen;
@@ -18,14 +29,6 @@ use syn::{
     TypePath,
 };
 
-pub mod codegen;
-#[cfg(feature = "hash")]
-pub mod hash;
-#[cfg(not(feature = "hash"))]
-pub(crate) mod hash;
-pub mod idl;
-pub mod parser;
-
 #[derive(Debug)]
 pub struct Program {
     pub ixs: Vec<Ix>,