Skip to content

Commit

Permalink
cleanup: remove static lifetimes from consts in libstd
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Dec 4, 2018
1 parent 91d5d56 commit 8c4129c
Show file tree
Hide file tree
Showing 16 changed files with 173 additions and 173 deletions.
42 changes: 21 additions & 21 deletions src/libstd/env.rs
Expand Up @@ -828,7 +828,7 @@ pub mod consts {
/// - s390x
/// - sparc64
#[stable(feature = "env", since = "1.0.0")]
pub const ARCH: &'static str = super::arch::ARCH;
pub const ARCH: &str = super::arch::ARCH;

/// The family of the operating system. Example value is `unix`.
///
Expand All @@ -837,7 +837,7 @@ pub mod consts {
/// - unix
/// - windows
#[stable(feature = "env", since = "1.0.0")]
pub const FAMILY: &'static str = os::FAMILY;
pub const FAMILY: &str = os::FAMILY;

/// A string describing the specific operating system in use.
/// Example value is `linux`.
Expand All @@ -856,7 +856,7 @@ pub mod consts {
/// - android
/// - windows
#[stable(feature = "env", since = "1.0.0")]
pub const OS: &'static str = os::OS;
pub const OS: &str = os::OS;

/// Specifies the filename prefix used for shared libraries on this
/// platform. Example value is `lib`.
Expand All @@ -866,7 +866,7 @@ pub mod consts {
/// - lib
/// - `""` (an empty string)
#[stable(feature = "env", since = "1.0.0")]
pub const DLL_PREFIX: &'static str = os::DLL_PREFIX;
pub const DLL_PREFIX: &str = os::DLL_PREFIX;

/// Specifies the filename suffix used for shared libraries on this
/// platform. Example value is `.so`.
Expand All @@ -877,7 +877,7 @@ pub mod consts {
/// - .dylib
/// - .dll
#[stable(feature = "env", since = "1.0.0")]
pub const DLL_SUFFIX: &'static str = os::DLL_SUFFIX;
pub const DLL_SUFFIX: &str = os::DLL_SUFFIX;

/// Specifies the file extension used for shared libraries on this
/// platform that goes after the dot. Example value is `so`.
Expand All @@ -888,7 +888,7 @@ pub mod consts {
/// - dylib
/// - dll
#[stable(feature = "env", since = "1.0.0")]
pub const DLL_EXTENSION: &'static str = os::DLL_EXTENSION;
pub const DLL_EXTENSION: &str = os::DLL_EXTENSION;

/// Specifies the filename suffix used for executable binaries on this
/// platform. Example value is `.exe`.
Expand All @@ -900,7 +900,7 @@ pub mod consts {
/// - .pexe
/// - `""` (an empty string)
#[stable(feature = "env", since = "1.0.0")]
pub const EXE_SUFFIX: &'static str = os::EXE_SUFFIX;
pub const EXE_SUFFIX: &str = os::EXE_SUFFIX;

/// Specifies the file extension, if any, used for executable binaries
/// on this platform. Example value is `exe`.
Expand All @@ -910,72 +910,72 @@ pub mod consts {
/// - exe
/// - `""` (an empty string)
#[stable(feature = "env", since = "1.0.0")]
pub const EXE_EXTENSION: &'static str = os::EXE_EXTENSION;
pub const EXE_EXTENSION: &str = os::EXE_EXTENSION;
}

#[cfg(target_arch = "x86")]
mod arch {
pub const ARCH: &'static str = "x86";
pub const ARCH: &str = "x86";
}

#[cfg(target_arch = "x86_64")]
mod arch {
pub const ARCH: &'static str = "x86_64";
pub const ARCH: &str = "x86_64";
}

#[cfg(target_arch = "arm")]
mod arch {
pub const ARCH: &'static str = "arm";
pub const ARCH: &str = "arm";
}

#[cfg(target_arch = "aarch64")]
mod arch {
pub const ARCH: &'static str = "aarch64";
pub const ARCH: &str = "aarch64";
}

#[cfg(target_arch = "mips")]
mod arch {
pub const ARCH: &'static str = "mips";
pub const ARCH: &str = "mips";
}

#[cfg(target_arch = "mips64")]
mod arch {
pub const ARCH: &'static str = "mips64";
pub const ARCH: &str = "mips64";
}

#[cfg(target_arch = "powerpc")]
mod arch {
pub const ARCH: &'static str = "powerpc";
pub const ARCH: &str = "powerpc";
}

#[cfg(target_arch = "powerpc64")]
mod arch {
pub const ARCH: &'static str = "powerpc64";
pub const ARCH: &str = "powerpc64";
}

#[cfg(target_arch = "s390x")]
mod arch {
pub const ARCH: &'static str = "s390x";
pub const ARCH: &str = "s390x";
}

#[cfg(target_arch = "sparc64")]
mod arch {
pub const ARCH: &'static str = "sparc64";
pub const ARCH: &str = "sparc64";
}

#[cfg(target_arch = "le32")]
mod arch {
pub const ARCH: &'static str = "le32";
pub const ARCH: &str = "le32";
}

#[cfg(target_arch = "asmjs")]
mod arch {
pub const ARCH: &'static str = "asmjs";
pub const ARCH: &str = "asmjs";
}

#[cfg(target_arch = "wasm32")]
mod arch {
pub const ARCH: &'static str = "wasm32";
pub const ARCH: &str = "wasm32";
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/ffi/c_str.rs
Expand Up @@ -671,7 +671,7 @@ impl fmt::Debug for CStr {
#[stable(feature = "cstr_default", since = "1.10.0")]
impl<'a> Default for &'a CStr {
fn default() -> &'a CStr {
const SLICE: &'static [c_char] = &[0];
const SLICE: &[c_char] = &[0];
unsafe { CStr::from_ptr(SLICE.as_ptr()) }
}
}
Expand Down Expand Up @@ -1475,7 +1475,7 @@ mod tests {

#[test]
fn cstr_const_constructor() {
const CSTR: &'static CStr = unsafe {
const CSTR: &CStr = unsafe {
CStr::from_bytes_with_nul_unchecked(b"Hello, world!\0")
};

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/keyword_docs.rs
Expand Up @@ -65,7 +65,7 @@ mod as_keyword { }
/// look like this:
///
/// ```rust
/// const WORDS: &'static str = "hello rust!";
/// const WORDS: &str = "hello rust!";
/// ```
///
/// Thanks to static lifetime elision, you usually don't have to explicitly use 'static:
Expand Down
14 changes: 7 additions & 7 deletions src/libstd/sys/cloudabi/shims/env.rs
Expand Up @@ -9,11 +9,11 @@
// except according to those terms.

pub mod os {
pub const FAMILY: &'static str = "cloudabi";
pub const OS: &'static str = "cloudabi";
pub const DLL_PREFIX: &'static str = "lib";
pub const DLL_SUFFIX: &'static str = ".so";
pub const DLL_EXTENSION: &'static str = "so";
pub const EXE_SUFFIX: &'static str = "";
pub const EXE_EXTENSION: &'static str = "";
pub const FAMILY: &str = "cloudabi";
pub const OS: &str = "cloudabi";
pub const DLL_PREFIX: &str = "lib";
pub const DLL_SUFFIX: &str = ".so";
pub const DLL_EXTENSION: &str = "so";
pub const EXE_SUFFIX: &str = "";
pub const EXE_EXTENSION: &str = "";
}
14 changes: 7 additions & 7 deletions src/libstd/sys/redox/env.rs
Expand Up @@ -9,11 +9,11 @@
// except according to those terms.

pub mod os {
pub const FAMILY: &'static str = "redox";
pub const OS: &'static str = "redox";
pub const DLL_PREFIX: &'static str = "lib";
pub const DLL_SUFFIX: &'static str = ".so";
pub const DLL_EXTENSION: &'static str = "so";
pub const EXE_SUFFIX: &'static str = "";
pub const EXE_EXTENSION: &'static str = "";
pub const FAMILY: &str = "redox";
pub const OS: &str = "redox";
pub const DLL_PREFIX: &str = "lib";
pub const DLL_SUFFIX: &str = ".so";
pub const DLL_EXTENSION: &str = "so";
pub const EXE_SUFFIX: &str = "";
pub const EXE_EXTENSION: &str = "";
}
2 changes: 1 addition & 1 deletion src/libstd/sys/redox/path.rs
Expand Up @@ -35,5 +35,5 @@ pub fn parse_prefix(path: &OsStr) -> Option<Prefix> {
}
}

pub const MAIN_SEP_STR: &'static str = "/";
pub const MAIN_SEP_STR: &str = "/";
pub const MAIN_SEP: char = '/';
2 changes: 1 addition & 1 deletion src/libstd/sys/redox/process.rs
Expand Up @@ -143,7 +143,7 @@ impl Command {

pub fn spawn(&mut self, default: Stdio, needs_stdin: bool)
-> io::Result<(Process, StdioPipes)> {
const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
const CLOEXEC_MSG_FOOTER: &[u8] = b"NOEX";

if self.saw_nul {
return Err(io::Error::new(ErrorKind::InvalidInput,
Expand Down

0 comments on commit 8c4129c

Please sign in to comment.