@@ -61,31 +61,35 @@ impl JsonLdHeader {
6161 let import_url = import_url. into ( ) ;
6262 match self . context . take ( ) {
6363 None => {
64- let mut obj = SimpleContext :: default ( ) ;
65- obj. import = Some ( import_url) ;
64+ let obj = SimpleContext {
65+ import : Some ( import_url) ,
66+ ..Default :: default ( )
67+ } ;
6668 self . context = Some ( JsonLdContext :: Object ( obj) ) ;
6769 }
6870 Some ( JsonLdContext :: Object ( mut obj) ) => {
6971 if obj. import . is_none ( ) {
7072 obj. import = Some ( import_url) ;
7173 self . context = Some ( JsonLdContext :: Object ( obj) ) ;
7274 } else {
73- let mut arr = Vec :: new ( ) ;
74- arr. push ( JsonLdContext :: Object ( obj) ) ;
75- arr. push ( JsonLdContext :: Object ( SimpleContext {
76- import : Some ( import_url) ,
77- ..Default :: default ( )
78- } ) ) ;
75+ let arr = vec ! [
76+ JsonLdContext :: Object ( obj) ,
77+ JsonLdContext :: Object ( SimpleContext {
78+ import: Some ( import_url) ,
79+ ..Default :: default ( )
80+ } ) ,
81+ ] ;
7982 self . context = Some ( JsonLdContext :: Array ( arr) ) ;
8083 }
8184 }
8285 Some ( JsonLdContext :: Iri ( iri) ) => {
83- let mut arr = Vec :: new ( ) ;
84- arr. push ( JsonLdContext :: Iri ( iri) ) ;
85- arr. push ( JsonLdContext :: Object ( SimpleContext {
86- import : Some ( import_url) ,
87- ..Default :: default ( )
88- } ) ) ;
86+ let arr = vec ! [
87+ JsonLdContext :: Iri ( iri) ,
88+ JsonLdContext :: Object ( SimpleContext {
89+ import: Some ( import_url) ,
90+ ..Default :: default ( )
91+ } ) ,
92+ ] ;
8993 self . context = Some ( JsonLdContext :: Array ( arr) ) ;
9094 }
9195 Some ( JsonLdContext :: Array ( mut arr) ) => {
@@ -117,6 +121,7 @@ pub enum TypeOrVec {
117121/// or combining several contexts in a single document.
118122#[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq ) ]
119123#[ serde( untagged) ]
124+ #[ allow( clippy:: large_enum_variant) ]
120125pub enum JsonLdContext {
121126 /// The context is a remote document specified by an IRI.
122127 Iri ( String ) ,
0 commit comments