@@ -34,7 +34,6 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
3434</ g></svg>');
3535 --button-left-margin : 4px ;
3636 --button-border-radius : 2px ;
37- --pre-line-height : 1.5rem ;
3837}
3938
4039/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -366,7 +365,7 @@ code, pre, .code-header {
366365}
367366pre {
368367 padding : 14px ;
369- line-height : var ( --pre-line-height ) ; /* https://github.com/rust-lang/rust/issues/105906 */
368+ line-height : 1.5 ; /* https://github.com/rust-lang/rust/issues/105906 */
370369}
371370pre .item-decl {
372371 overflow-x : auto;
@@ -379,7 +378,7 @@ pre.item-decl {
379378.src .content pre {
380379 padding : 20px ;
381380}
382- .rustdoc .src .example-wrap pre .src-line-numbers {
381+ .rustdoc .src .example-wrap .src-line-numbers {
383382 padding : 20px 0 20px 4px ;
384383}
385384
@@ -766,6 +765,10 @@ both the code example and the line numbers, so we need to remove the radius in t
766765 border-bottom-left-radius : 0 ;
767766}
768767
768+ .rustdoc .scraped-example {
769+ position : relative;
770+ }
771+
769772/* For the last child of a div, the margin will be taken care of
770773 by the margin-top of the next item. */
771774.rustdoc .example-wrap : last-child {
@@ -777,19 +780,18 @@ both the code example and the line numbers, so we need to remove the radius in t
777780 flex-grow : 1 ;
778781}
779782
780- .scraped-example : not (.expanded ) {
783+ .scraped-example : not (.expanded ) . example-wrap {
781784 /* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
782785 * of lines shown in the un-expanded example code viewer. This pre needs to have
783786 * a max-height equal to line-height * N. The line-height is currently 1.5em,
784787 * and we include additional 10px for padding. */
785788 max-height : calc (1.5em * 5 + 10px );
786789}
787790
788- .rustdoc : not (.src ) .scraped-example : not (.expanded ) pre .src-line-numbers ,
791+ .rustdoc : not (.src ) .scraped-example : not (.expanded ) .src-line-numbers ,
789792.rustdoc : not (.src ) .scraped-example : not (.expanded ) pre .rust {
790793 padding-bottom : 0 ;
791794 /* See above comment, should be the same max-height. */
792- max-height : calc (1.5em * 5 + 10px );
793795 overflow : auto hidden;
794796}
795797
@@ -798,7 +800,7 @@ both the code example and the line numbers, so we need to remove the radius in t
798800}
799801
800802.rustdoc .example-wrap pre .example-line-numbers ,
801- .rustdoc .example-wrap pre .src-line-numbers {
803+ .rustdoc .example-wrap .src-line-numbers {
802804 min-width : fit-content; /* prevent collapsing into nothing in truncated scraped examples */
803805 flex-grow : 0 ;
804806 text-align : right;
@@ -808,7 +810,7 @@ both the code example and the line numbers, so we need to remove the radius in t
808810 color : var (--src-line-numbers-span-color );
809811}
810812
811- .rustdoc .scraped-example pre .src-line-numbers {
813+ .rustdoc .scraped-example .src-line-numbers {
812814 padding : 14px 0 ;
813815}
814816.src-line-numbers a , .src-line-numbers span {
@@ -2268,24 +2270,6 @@ in src-script.js and main.js
22682270 margin : 0 ;
22692271 padding : var (--nav-sub-mobile-padding );
22702272 }
2271-
2272- .example-wrap .scraped-example {
2273- flex-wrap : wrap;
2274- }
2275- .example-wrap .scraped-example-title {
2276- width : 100% ;
2277- }
2278- .example-wrap .scraped-example .rust {
2279- /* Dirty hacky to force it to remain on the same line as the line numbers. */
2280- width : 10px ;
2281- }
2282- .example-wrap .scraped-example .button-holder {
2283- top : calc (var (--pre-line-height ) + 4px );
2284- }
2285- .scraped-example : not (.expanded )::before {
2286- /* The gradient effect needs to be moved under the title */
2287- top : var (--pre-line-height );
2288- }
22892273}
22902274
22912275
@@ -2310,12 +2294,6 @@ in src-script.js and main.js
23102294 .item-table > li > div {
23112295 overflow-wrap : anywhere;
23122296 }
2313-
2314- /* Starting this width, the "title" of scraped example will be in the code block so we can
2315- put the background gradient at the top. */
2316- .scraped-example : not (.expanded )::before {
2317- top : 0 ;
2318- }
23192297}
23202298
23212299@media print {
@@ -2397,20 +2375,21 @@ in src-script.js and main.js
23972375 color : var (--scrape-example-help-hover-color );
23982376}
23992377
2400- .scraped-example : not (.expanded )::before ,
2401- .scraped-example : not (.expanded )::after {
2378+ .scraped-example : not (.expanded ) . example-wrap ::before ,
2379+ .scraped-example : not (.expanded ) . example-wrap ::after {
24022380 content : " " ;
24032381 width : 100% ;
24042382 height : 5px ;
24052383 position : absolute;
24062384 z-index : 1 ;
24072385}
2408- .scraped-example : not (.expanded )::before {
2386+ .scraped-example : not (.expanded ) .example-wrap ::before {
2387+ top : 0 ;
24092388 background : linear-gradient (to bottom,
24102389 var (--scrape-example-code-wrapper-background-start ),
24112390 var (--scrape-example-code-wrapper-background-end ));
24122391}
2413- .scraped-example : not (.expanded )::after {
2392+ .scraped-example : not (.expanded ) . example-wrap ::after {
24142393 bottom : 0 ;
24152394 background : linear-gradient (to top,
24162395 var (--scrape-example-code-wrapper-background-start ),
0 commit comments