From a687420d1766b01583858ec2dee30fd57acead41 Mon Sep 17 00:00:00 2001 From: est31 Date: Sun, 18 Oct 2020 17:14:25 +0200 Subject: [PATCH 1/2] Remove redundant 'static from library crates --- library/core/benches/ascii.rs | 6 +++--- library/std/src/net/addr/tests.rs | 2 +- library/std/src/sys/sgx/env.rs | 14 +++++++------- library/std/src/sys/sgx/path.rs | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/library/core/benches/ascii.rs b/library/core/benches/ascii.rs index 05dd7adff1fbb..bc59c378609f0 100644 --- a/library/core/benches/ascii.rs +++ b/library/core/benches/ascii.rs @@ -253,9 +253,9 @@ macro_rules! repeat { }; } -const SHORT: &'static str = "Alice's"; -const MEDIUM: &'static str = "Alice's Adventures in Wonderland"; -const LONG: &'static str = repeat!( +const SHORT: &str = "Alice's"; +const MEDIUM: &str = "Alice's Adventures in Wonderland"; +const LONG: &str = repeat!( r#" La Guida di Bragia, a Ballad Opera for the Marionette Theatre (around 1850) Alice's Adventures in Wonderland (1865) diff --git a/library/std/src/net/addr/tests.rs b/library/std/src/net/addr/tests.rs index 43f965de25e65..40f5a84bcd520 100644 --- a/library/std/src/net/addr/tests.rs +++ b/library/std/src/net/addr/tests.rs @@ -68,7 +68,7 @@ fn bind_udp_socket_bad() { // returns its own address, it is still an error to bind a UDP socket to // a non-local address, and so we still get an error here in that case. - const INPUT_23076: &'static str = "1200::AB00:1234::2552:7777:1313:34300"; + const INPUT_23076: &str = "1200::AB00:1234::2552:7777:1313:34300"; assert!(crate::net::UdpSocket::bind(INPUT_23076).is_err()) } diff --git a/library/std/src/sys/sgx/env.rs b/library/std/src/sys/sgx/env.rs index 6fa0ed7bcf475..8043b7c5213a1 100644 --- a/library/std/src/sys/sgx/env.rs +++ b/library/std/src/sys/sgx/env.rs @@ -1,9 +1,9 @@ pub mod os { - pub const FAMILY: &'static str = ""; - pub const OS: &'static str = ""; - pub const DLL_PREFIX: &'static str = ""; - pub const DLL_SUFFIX: &'static str = ".sgxs"; - pub const DLL_EXTENSION: &'static str = "sgxs"; - pub const EXE_SUFFIX: &'static str = ".sgxs"; - pub const EXE_EXTENSION: &'static str = "sgxs"; + pub const FAMILY: &str = ""; + pub const OS: &str = ""; + pub const DLL_PREFIX: &str = ""; + pub const DLL_SUFFIX: &str = ".sgxs"; + pub const DLL_EXTENSION: &str = "sgxs"; + pub const EXE_SUFFIX: &str = ".sgxs"; + pub const EXE_EXTENSION: &str = "sgxs"; } diff --git a/library/std/src/sys/sgx/path.rs b/library/std/src/sys/sgx/path.rs index 06c9df3ff5427..840a7ae042625 100644 --- a/library/std/src/sys/sgx/path.rs +++ b/library/std/src/sys/sgx/path.rs @@ -15,5 +15,5 @@ pub fn parse_prefix(_: &OsStr) -> Option> { None } -pub const MAIN_SEP_STR: &'static str = "/"; +pub const MAIN_SEP_STR: &str = "/"; pub const MAIN_SEP: char = '/'; From b87e4f36e70862a9506109cc29528e490a5d22da Mon Sep 17 00:00:00 2001 From: est31 Date: Sun, 18 Oct 2020 17:28:00 +0200 Subject: [PATCH 2/2] Remove redundant 'static in the compiler --- compiler/rustc_feature/src/builtin_attrs.rs | 2 +- compiler/rustc_parse/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 527a49b05389a..83aa1f62106cb 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -598,7 +598,7 @@ pub fn is_builtin_attr_name(name: Symbol) -> bool { BUILTIN_ATTRIBUTE_MAP.get(&name).is_some() } -pub static BUILTIN_ATTRIBUTE_MAP: SyncLazy> = +pub static BUILTIN_ATTRIBUTE_MAP: SyncLazy> = SyncLazy::new(|| { let mut map = FxHashMap::default(); for attr in BUILTIN_ATTRIBUTES.iter() { diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 25deb46e14751..9a187c6285e4b 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -22,7 +22,7 @@ use std::str; use tracing::{debug, info}; -pub const MACRO_ARGUMENTS: Option<&'static str> = Some("macro arguments"); +pub const MACRO_ARGUMENTS: Option<&str> = Some("macro arguments"); #[macro_use] pub mod parser;