Skip to content

Commit 0edc9e8

Browse files
Small fixes on code blocks in rustdoc
1 parent 653da4f commit 0edc9e8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/librustdoc/html/static/main.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2262,17 +2262,17 @@
22622262
onEach(document.getElementsByClassName('rust-example-rendered'), function(e) {
22632263
if (hasClass(e, 'compile_fail')) {
22642264
e.addEventListener("mouseover", function(event) {
2265-
e.previousElementSibling.childNodes[0].style.color = '#f00';
2265+
this.parentElement.previousElementSibling.childNodes[0].style.color = '#f00';
22662266
});
22672267
e.addEventListener("mouseout", function(event) {
2268-
e.previousElementSibling.childNodes[0].style.color = '';
2268+
this.parentElement.previousElementSibling.childNodes[0].style.color = '';
22692269
});
22702270
} else if (hasClass(e, 'ignore')) {
22712271
e.addEventListener("mouseover", function(event) {
2272-
e.previousElementSibling.childNodes[0].style.color = '#ff9200';
2272+
this.parentElement.previousElementSibling.childNodes[0].style.color = '#ff9200';
22732273
});
22742274
e.addEventListener("mouseout", function(event) {
2275-
e.previousElementSibling.childNodes[0].style.color = '';
2275+
this.parentElement.previousElementSibling.childNodes[0].style.color = '';
22762276
});
22772277
}
22782278
lineNumbersFunc(e);

src/librustdoc/html/static/rustdoc.css

+5
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ nav.sub {
284284

285285
body:not(.source) .example-wrap {
286286
display: inline-flex;
287+
margin-bottom: 10px;
287288
}
288289

289290
.example-wrap {
@@ -303,6 +304,10 @@ body:not(.source) .example-wrap > pre.rust {
303304
width: 100%;
304305
}
305306

307+
body:not(.source) .example-wrap > pre {
308+
margin: 0;
309+
}
310+
306311
#search {
307312
margin-left: 230px;
308313
position: relative;

0 commit comments

Comments
 (0)