]> git.lizzy.rs Git - rust.git/blobdiff - src/rustdoc-json-types/lib.rs
Rollup merge of #83399 - camelid:rustdoc-priv-link-from-crate, r=jyn514
[rust.git] / src / rustdoc-json-types / lib.rs
index e898a01dfaf85420e18dfe97502291ea4bf9ab08..72a4d9a18301139ae16af1287c6a7a5772e31203 100644 (file)
@@ -64,7 +64,7 @@ pub struct Item {
     pub name: Option<String>,
     /// The source location of this item (absent if it came from a macro expansion or inline
     /// assembly).
-    pub source: Option<Span>,
+    pub span: Option<Span>,
     /// By default all documented items are public, but you can tell rustdoc to output private items
     /// so this field is needed to differentiate.
     pub visibility: Visibility,
@@ -461,7 +461,7 @@ pub struct Impl {
 #[serde(rename_all = "snake_case")]
 pub struct Import {
     /// The full path being imported.
-    pub span: String,
+    pub source: String,
     /// May be different from the last segment of `source` when renaming imports:
     /// `use source as name;`
     pub name: String,
@@ -510,45 +510,4 @@ pub struct Static {
 }
 
 #[cfg(test)]
-mod tests {
-    use super::*;
-
-    #[test]
-    fn test_struct_info_roundtrip() {
-        let s = ItemEnum::Struct(Struct {
-            struct_type: StructType::Plain,
-            generics: Generics {
-                params: vec![],
-                where_predicates: vec![]
-            },
-            fields_stripped: false,
-            fields: vec![],
-            impls: vec![],
-        });
-
-        let struct_json = serde_json::to_string(&s).unwrap();
-
-        let de_s = serde_json::from_str(&struct_json).unwrap();
-
-        assert_eq!(s, de_s);
-    }
-
-    #[test]
-    fn test_union_info_roundtrip() {
-        let u = ItemEnum::Union(Union {
-            generics: Generics {
-                params: vec![],
-                where_predicates: vec![]
-            },
-            fields_stripped: false,
-            fields: vec![],
-            impls: vec![],
-        });
-
-        let union_json = serde_json::to_string(&u).unwrap();
-
-        let de_u = serde_json::from_str(&union_json).unwrap();
-
-        assert_eq!(u, de_u);
-    }
-}
+mod tests;