Skip to content

Commit a9d9025

Browse files
GuillaumeGomezsyphar
authored andcommitted
Move one day earlier for the detection of the new rustdoc style
1 parent 17de230 commit a9d9025

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn compile_sass() -> Result<(), Box<dyn Error>> {
7777

7878
// Compile rustdoc.scss -> rustdoc.css
7979
compile_sass_file("rustdoc", "rustdoc", &[])?;
80-
compile_sass_file("rustdoc-2021-12-06", "rustdoc-2021-12-06", &[])?;
80+
compile_sass_file("rustdoc-2021-12-05", "rustdoc-2021-12-05", &[])?;
8181

8282
// Compile vendored.scss -> vendored.css
8383
compile_sass_file(

src/utils/rustc_version.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ fn parse_rustc_date<S: AsRef<str>>(version: S) -> Result<Date<Utc>> {
4444
pub fn get_correct_docsrs_style_file(version: &str) -> Result<String> {
4545
let date = parse_rustc_date(version)?;
4646
// This is the date where https://github.com/rust-lang/rust/pull/91356 was merged.
47-
if Utc.ymd(2021, 12, 6) < date {
47+
if Utc.ymd(2021, 12, 5) < date {
4848
// If this is the new rustdoc layout, we need the newer docs.rs CSS file.
49-
Ok("rustdoc-2021-12-06.css".to_owned())
49+
Ok("rustdoc-2021-12-05.css".to_owned())
5050
} else {
5151
// By default, we return the old docs.rs CSS file.
5252
Ok("rustdoc.css".to_owned())
@@ -73,7 +73,7 @@ fn test_get_correct_docsrs_style_file() {
7373
);
7474
assert_eq!(
7575
get_correct_docsrs_style_file("docsrs 0.2.0 (ba9ae23 2022-05-26)").unwrap(),
76-
"rustdoc-2021-12-06.css"
76+
"rustdoc-2021-12-05.css"
7777
);
7878
assert!(get_correct_docsrs_style_file("docsrs 0.2.0").is_err(),);
7979
}

src/web/statics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use std::{ffi::OsStr, fs, path::Path};
1414
const VENDORED_CSS: &str = include_str!(concat!(env!("OUT_DIR"), "/vendored.css"));
1515
const STYLE_CSS: &str = include_str!(concat!(env!("OUT_DIR"), "/style.css"));
1616
const RUSTDOC_CSS: &str = include_str!(concat!(env!("OUT_DIR"), "/rustdoc.css"));
17-
const RUSTDOC_2021_12_06_CSS: &str =
18-
include_str!(concat!(env!("OUT_DIR"), "/rustdoc-2021-12-06.css"));
17+
const RUSTDOC_2021_12_05_CSS: &str =
18+
include_str!(concat!(env!("OUT_DIR"), "/rustdoc-2021-12-05.css"));
1919
const STATIC_SEARCH_PATHS: &[&str] = &["static", "vendor"];
2020

2121
pub(crate) fn static_handler(req: &mut Request) -> IronResult<Response> {
@@ -27,8 +27,8 @@ pub(crate) fn static_handler(req: &mut Request) -> IronResult<Response> {
2727
"vendored.css" => serve_resource(VENDORED_CSS, ContentType("text/css".parse().unwrap())),
2828
"style.css" => serve_resource(STYLE_CSS, ContentType("text/css".parse().unwrap())),
2929
"rustdoc.css" => serve_resource(RUSTDOC_CSS, ContentType("text/css".parse().unwrap())),
30-
"rustdoc-2021-12-06.css" => serve_resource(
31-
RUSTDOC_2021_12_06_CSS,
30+
"rustdoc-2021-12-05.css" => serve_resource(
31+
RUSTDOC_2021_12_05_CSS,
3232
ContentType("text/css".parse().unwrap()),
3333
),
3434
file => serve_file(file)?,

0 commit comments

Comments
 (0)