@@ -23,10 +23,8 @@ use syntax::ast;
2323use syntax:: ast_util;
2424
2525use clean;
26- use stability_summary:: ModuleSummary ;
2726use html:: item_type:: ItemType ;
2827use html:: render;
29- use html:: escape:: Escape ;
3028use html:: render:: { cache, CURRENT_LOCATION_KEY } ;
3129
3230/// Helper to render an optional visibility with a space after it (if the
@@ -45,10 +43,6 @@ pub struct MutableSpace(pub clean::Mutability);
4543/// Similar to VisSpace, but used for mutability
4644#[ derive( Copy , Clone ) ]
4745pub struct RawMutableSpace ( pub clean:: Mutability ) ;
48- /// Wrapper struct for properly emitting the stability level.
49- pub struct Stability < ' a > ( pub & ' a Option < clean:: Stability > ) ;
50- /// Wrapper struct for emitting the stability level concisely.
51- pub struct ConciseStability < ' a > ( pub & ' a Option < clean:: Stability > ) ;
5246/// Wrapper struct for emitting a where clause from Generics.
5347pub struct WhereClause < ' a > ( pub & ' a clean:: Generics ) ;
5448/// Wrapper struct for emitting type parameter bounds.
@@ -702,119 +696,3 @@ impl fmt::Display for AbiSpace {
702696 }
703697 }
704698}
705-
706- impl < ' a > fmt:: Display for Stability < ' a > {
707- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
708- let Stability ( stab) = * self ;
709- match * stab {
710- Some ( ref stability) => {
711- let lvl = if stability. deprecated_since . is_empty ( ) {
712- format ! ( "{}" , stability. level)
713- } else {
714- "Deprecated" . to_string ( )
715- } ;
716- write ! ( f, "<a class='stability {lvl}' title='{reason}'>{lvl}</a>" ,
717- lvl = Escape ( & * lvl) ,
718- reason = Escape ( & * stability. reason) )
719- }
720- None => Ok ( ( ) )
721- }
722- }
723- }
724-
725- impl < ' a > fmt:: Display for ConciseStability < ' a > {
726- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
727- let ConciseStability ( stab) = * self ;
728- match * stab {
729- Some ( ref stability) => {
730- let lvl = if stability. deprecated_since . is_empty ( ) {
731- format ! ( "{}" , stability. level)
732- } else {
733- "Deprecated" . to_string ( )
734- } ;
735- write ! ( f, "<a class='stability {lvl}' title='{lvl}{colon}{reason}'></a>" ,
736- lvl = Escape ( & * lvl) ,
737- colon = if !stability. reason. is_empty( ) { ": " } else { "" } ,
738- reason = Escape ( & * stability. reason) )
739- }
740- None => {
741- write ! ( f, "<a class='stability Unmarked' title='No stability level'></a>" )
742- }
743- }
744- }
745- }
746-
747- impl fmt:: Display for ModuleSummary {
748- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
749- fn fmt_inner < ' a > ( f : & mut fmt:: Formatter ,
750- context : & mut Vec < & ' a str > ,
751- m : & ' a ModuleSummary )
752- -> fmt:: Result {
753- let cnt = m. counts ;
754- let tot = cnt. total ( ) ;
755- if tot == 0 { return Ok ( ( ) ) }
756-
757- context. push ( & m. name ) ;
758- let path = context. connect ( "::" ) ;
759-
760- try!( write ! ( f, "<tr>" ) ) ;
761- try!( write ! ( f, "<td><a href='{}'>{}</a></td>" , {
762- let mut url = context[ 1 ..] . to_vec( ) ;
763- url. push( "index.html" ) ;
764- url. connect( "/" )
765- } ,
766- path) ) ;
767- try!( write ! ( f, "<td class='summary-column'>" ) ) ;
768- try!( write ! ( f, "<span class='summary Stable' \
769- style='width: {:.4}%; display: inline-block'> </span>",
770- ( 100 * cnt. stable) as f64 /tot as f64 ) ) ;
771- try!( write ! ( f, "<span class='summary Unstable' \
772- style='width: {:.4}%; display: inline-block'> </span>",
773- ( 100 * cnt. unstable) as f64 /tot as f64 ) ) ;
774- try!( write ! ( f, "<span class='summary Deprecated' \
775- style='width: {:.4}%; display: inline-block'> </span>",
776- ( 100 * cnt. deprecated) as f64 /tot as f64 ) ) ;
777- try!( write ! ( f, "<span class='summary Unmarked' \
778- style='width: {:.4}%; display: inline-block'> </span>",
779- ( 100 * cnt. unmarked) as f64 /tot as f64 ) ) ;
780- try!( write ! ( f, "</td></tr>" ) ) ;
781-
782- for submodule in & m. submodules {
783- try!( fmt_inner ( f, context, submodule) ) ;
784- }
785- context. pop ( ) ;
786- Ok ( ( ) )
787- }
788-
789- let mut context = Vec :: new ( ) ;
790-
791- let tot = self . counts . total ( ) ;
792- let ( stable, unstable, deprecated, unmarked) = if tot == 0 {
793- ( 0 , 0 , 0 , 0 )
794- } else {
795- ( ( 100 * self . counts . stable ) /tot,
796- ( 100 * self . counts . unstable ) /tot,
797- ( 100 * self . counts . deprecated ) /tot,
798- ( 100 * self . counts . unmarked ) /tot)
799- } ;
800-
801- try!( write ! ( f,
802- r"<h1 class='fqn'>Stability dashboard: crate <a class='mod' href='index.html'>{name}</a></h1>
803- This dashboard summarizes the stability levels for all of the public modules of
804- the crate, according to the total number of items at each level in the module and
805- its children (percentages total for {name}):
806- <blockquote>
807- <a class='stability Stable'></a> stable ({}%),<br/>
808- <a class='stability Unstable'></a> unstable ({}%),<br/>
809- <a class='stability Deprecated'></a> deprecated ({}%),<br/>
810- <a class='stability Unmarked'></a> unmarked ({}%)
811- </blockquote>
812- The counts do not include methods or trait
813- implementations that are visible only through a re-exported type." ,
814- stable, unstable, deprecated, unmarked,
815- name=self . name) ) ;
816- try!( write ! ( f, "<table>" ) ) ;
817- try!( fmt_inner ( f, & mut context, self ) ) ;
818- write ! ( f, "</table>" )
819- }
820- }
0 commit comments