@@ -1849,6 +1849,7 @@ fn render_method(w: &mut fmt::Formatter, meth: &clean::Item) -> fmt::Result {
18491849fn item_struct ( w : & mut fmt:: Formatter , it : & clean:: Item ,
18501850 s : & clean:: Struct ) -> fmt:: Result {
18511851 try!( write ! ( w, "<pre class='rust struct'>" ) ) ;
1852+ try!( render_attributes ( w, it) ) ;
18521853 try!( render_struct ( w,
18531854 it,
18541855 Some ( & s. generics ) ,
@@ -1885,7 +1886,9 @@ fn item_struct(w: &mut fmt::Formatter, it: &clean::Item,
18851886
18861887fn item_enum ( w : & mut fmt:: Formatter , it : & clean:: Item ,
18871888 e : & clean:: Enum ) -> fmt:: Result {
1888- try!( write ! ( w, "<pre class='rust enum'>{}enum {}{}{}" ,
1889+ try!( write ! ( w, "<pre class='rust enum'>" ) ) ;
1890+ try!( render_attributes ( w, it) ) ;
1891+ try!( write ! ( w, "{}enum {}{}{}" ,
18891892 VisSpace ( it. visibility) ,
18901893 it. name. as_ref( ) . unwrap( ) ,
18911894 e. generics,
@@ -1982,6 +1985,21 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
19821985 Ok ( ( ) )
19831986}
19841987
1988+ fn render_attributes ( w : & mut fmt:: Formatter , it : & clean:: Item ) -> fmt:: Result {
1989+ for attr in & it. attrs {
1990+ match * attr {
1991+ clean:: Word ( ref s) if * s == "must_use" => {
1992+ try!( write ! ( w, "#[{}]\n " , s) ) ;
1993+ }
1994+ clean:: NameValue ( ref k, ref v) if * k == "must_use" => {
1995+ try!( write ! ( w, "#[{} = \" {}\" ]\n " , k, v) ) ;
1996+ }
1997+ _ => ( )
1998+ }
1999+ }
2000+ Ok ( ( ) )
2001+ }
2002+
19852003fn render_struct ( w : & mut fmt:: Formatter , it : & clean:: Item ,
19862004 g : Option < & clean:: Generics > ,
19872005 ty : doctree:: StructType ,
0 commit comments