Skip to content

Commit 8c4129c

Browse files
committed
cleanup: remove static lifetimes from consts in libstd
1 parent 91d5d56 commit 8c4129c

File tree

16 files changed

+173
-173
lines changed

16 files changed

+173
-173
lines changed

Diff for: src/libstd/env.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ pub mod consts {
828828
/// - s390x
829829
/// - sparc64
830830
#[stable(feature = "env", since = "1.0.0")]
831-
pub const ARCH: &'static str = super::arch::ARCH;
831+
pub const ARCH: &str = super::arch::ARCH;
832832

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

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

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

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

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

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

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

916916
#[cfg(target_arch = "x86")]
917917
mod arch {
918-
pub const ARCH: &'static str = "x86";
918+
pub const ARCH: &str = "x86";
919919
}
920920

921921
#[cfg(target_arch = "x86_64")]
922922
mod arch {
923-
pub const ARCH: &'static str = "x86_64";
923+
pub const ARCH: &str = "x86_64";
924924
}
925925

926926
#[cfg(target_arch = "arm")]
927927
mod arch {
928-
pub const ARCH: &'static str = "arm";
928+
pub const ARCH: &str = "arm";
929929
}
930930

931931
#[cfg(target_arch = "aarch64")]
932932
mod arch {
933-
pub const ARCH: &'static str = "aarch64";
933+
pub const ARCH: &str = "aarch64";
934934
}
935935

936936
#[cfg(target_arch = "mips")]
937937
mod arch {
938-
pub const ARCH: &'static str = "mips";
938+
pub const ARCH: &str = "mips";
939939
}
940940

941941
#[cfg(target_arch = "mips64")]
942942
mod arch {
943-
pub const ARCH: &'static str = "mips64";
943+
pub const ARCH: &str = "mips64";
944944
}
945945

946946
#[cfg(target_arch = "powerpc")]
947947
mod arch {
948-
pub const ARCH: &'static str = "powerpc";
948+
pub const ARCH: &str = "powerpc";
949949
}
950950

951951
#[cfg(target_arch = "powerpc64")]
952952
mod arch {
953-
pub const ARCH: &'static str = "powerpc64";
953+
pub const ARCH: &str = "powerpc64";
954954
}
955955

956956
#[cfg(target_arch = "s390x")]
957957
mod arch {
958-
pub const ARCH: &'static str = "s390x";
958+
pub const ARCH: &str = "s390x";
959959
}
960960

961961
#[cfg(target_arch = "sparc64")]
962962
mod arch {
963-
pub const ARCH: &'static str = "sparc64";
963+
pub const ARCH: &str = "sparc64";
964964
}
965965

966966
#[cfg(target_arch = "le32")]
967967
mod arch {
968-
pub const ARCH: &'static str = "le32";
968+
pub const ARCH: &str = "le32";
969969
}
970970

971971
#[cfg(target_arch = "asmjs")]
972972
mod arch {
973-
pub const ARCH: &'static str = "asmjs";
973+
pub const ARCH: &str = "asmjs";
974974
}
975975

976976
#[cfg(target_arch = "wasm32")]
977977
mod arch {
978-
pub const ARCH: &'static str = "wasm32";
978+
pub const ARCH: &str = "wasm32";
979979
}
980980

981981
#[cfg(test)]

Diff for: src/libstd/ffi/c_str.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ impl fmt::Debug for CStr {
671671
#[stable(feature = "cstr_default", since = "1.10.0")]
672672
impl<'a> Default for &'a CStr {
673673
fn default() -> &'a CStr {
674-
const SLICE: &'static [c_char] = &[0];
674+
const SLICE: &[c_char] = &[0];
675675
unsafe { CStr::from_ptr(SLICE.as_ptr()) }
676676
}
677677
}
@@ -1475,7 +1475,7 @@ mod tests {
14751475

14761476
#[test]
14771477
fn cstr_const_constructor() {
1478-
const CSTR: &'static CStr = unsafe {
1478+
const CSTR: &CStr = unsafe {
14791479
CStr::from_bytes_with_nul_unchecked(b"Hello, world!\0")
14801480
};
14811481

Diff for: src/libstd/keyword_docs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ mod as_keyword { }
6565
/// look like this:
6666
///
6767
/// ```rust
68-
/// const WORDS: &'static str = "hello rust!";
68+
/// const WORDS: &str = "hello rust!";
6969
/// ```
7070
///
7171
/// Thanks to static lifetime elision, you usually don't have to explicitly use 'static:

Diff for: src/libstd/sys/cloudabi/shims/env.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
// except according to those terms.
1010

1111
pub mod os {
12-
pub const FAMILY: &'static str = "cloudabi";
13-
pub const OS: &'static str = "cloudabi";
14-
pub const DLL_PREFIX: &'static str = "lib";
15-
pub const DLL_SUFFIX: &'static str = ".so";
16-
pub const DLL_EXTENSION: &'static str = "so";
17-
pub const EXE_SUFFIX: &'static str = "";
18-
pub const EXE_EXTENSION: &'static str = "";
12+
pub const FAMILY: &str = "cloudabi";
13+
pub const OS: &str = "cloudabi";
14+
pub const DLL_PREFIX: &str = "lib";
15+
pub const DLL_SUFFIX: &str = ".so";
16+
pub const DLL_EXTENSION: &str = "so";
17+
pub const EXE_SUFFIX: &str = "";
18+
pub const EXE_EXTENSION: &str = "";
1919
}

Diff for: src/libstd/sys/redox/env.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
// except according to those terms.
1010

1111
pub mod os {
12-
pub const FAMILY: &'static str = "redox";
13-
pub const OS: &'static str = "redox";
14-
pub const DLL_PREFIX: &'static str = "lib";
15-
pub const DLL_SUFFIX: &'static str = ".so";
16-
pub const DLL_EXTENSION: &'static str = "so";
17-
pub const EXE_SUFFIX: &'static str = "";
18-
pub const EXE_EXTENSION: &'static str = "";
12+
pub const FAMILY: &str = "redox";
13+
pub const OS: &str = "redox";
14+
pub const DLL_PREFIX: &str = "lib";
15+
pub const DLL_SUFFIX: &str = ".so";
16+
pub const DLL_EXTENSION: &str = "so";
17+
pub const EXE_SUFFIX: &str = "";
18+
pub const EXE_EXTENSION: &str = "";
1919
}

Diff for: src/libstd/sys/redox/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ pub fn parse_prefix(path: &OsStr) -> Option<Prefix> {
3535
}
3636
}
3737

38-
pub const MAIN_SEP_STR: &'static str = "/";
38+
pub const MAIN_SEP_STR: &str = "/";
3939
pub const MAIN_SEP: char = '/';

Diff for: src/libstd/sys/redox/process.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl Command {
143143

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

148148
if self.saw_nul {
149149
return Err(io::Error::new(ErrorKind::InvalidInput,

0 commit comments

Comments
 (0)