Skip to content

Commit 09a715b

Browse files
committed
use const instead of static
also uses a constant instead of hardcoding the default target
1 parent 2207434 commit 09a715b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/docbuilder/rustwide_builder.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ use std::path::Path;
1515
use utils::{copy_doc_dir, parse_rustc_version, CargoMetadata};
1616
use Metadata;
1717

18-
static USER_AGENT: &str = "docs.rs builder (https://github.com/rust-lang/docs.rs)";
19-
static DEFAULT_RUSTWIDE_WORKSPACE: &str = ".rustwide";
18+
const USER_AGENT: &str = "docs.rs builder (https://github.com/rust-lang/docs.rs)";
19+
const DEFAULT_RUSTWIDE_WORKSPACE: &str = ".rustwide";
2020

21-
static TARGETS: &[&str] = &[
21+
const DEFAULT_TARGET: &str = "x86_64-unknown-linux-gnu";
22+
const TARGETS: &[&str] = &[
2223
"i686-apple-darwin",
2324
"i686-pc-windows-msvc",
2425
"i686-unknown-linux-gnu",
@@ -27,7 +28,7 @@ static TARGETS: &[&str] = &[
2728
"x86_64-unknown-linux-gnu",
2829
];
2930

30-
static ESSENTIAL_FILES_VERSIONED: &[&str] = &[
31+
const ESSENTIAL_FILES_VERSIONED: &[&str] = &[
3132
"brush.svg",
3233
"wheel.svg",
3334
"down-arrow.svg",
@@ -44,7 +45,7 @@ static ESSENTIAL_FILES_VERSIONED: &[&str] = &[
4445
"noscript.css",
4546
"rust-logo.png",
4647
];
47-
static ESSENTIAL_FILES_UNVERSIONED: &[&str] = &[
48+
const ESSENTIAL_FILES_UNVERSIONED: &[&str] = &[
4849
"FiraSans-Medium.woff",
4950
"FiraSans-Regular.woff",
5051
"SourceCodePro-Regular.woff",
@@ -54,8 +55,8 @@ static ESSENTIAL_FILES_UNVERSIONED: &[&str] = &[
5455
"SourceSerifPro-It.ttf.woff",
5556
];
5657

57-
static DUMMY_CRATE_NAME: &str = "acme-client";
58-
static DUMMY_CRATE_VERSION: &str = "0.0.0";
58+
const DUMMY_CRATE_NAME: &str = "acme-client";
59+
const DUMMY_CRATE_VERSION: &str = "0.0.0";
5960

6061
pub struct RustwideBuilder {
6162
workspace: Workspace,
@@ -444,7 +445,7 @@ impl RustwideBuilder {
444445
docsrs_version: format!("docsrs {}", ::BUILD_VERSION),
445446
successful,
446447
cargo_metadata,
447-
target: target.unwrap_or("x86_64-unknown-linux-gnu").to_string(),
448+
target: target.unwrap_or(DEFAULT_TARGET).to_string(),
448449
})
449450
}
450451

0 commit comments

Comments
 (0)