From 75ff8ed6d3a6e1caaaae6ca4f098971d111daf21 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 25 Nov 2024 16:12:16 +0100 Subject: [PATCH 1/4] Clean up trailing whitespace in rustup-init.sh --- rustup-init.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index 0f009b0af1..48b15fd76a 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -154,8 +154,8 @@ main() { ensure downloader "$_url" "$_file" "$_arch" ensure chmod u+x "$_file" if [ ! -x "$_file" ]; then - err "Cannot execute $_file (likely because of mounting /tmp as noexec)." - err "Please copy the file to a location where you can execute binaries and run ./rustup-init${_ext}." + err "Cannot execute $_file (likely because of mounting /tmp as noexec)." + err "Please copy the file to a location where you can execute binaries and run ./rustup-init${_ext}." exit 1 fi @@ -508,7 +508,7 @@ get_architecture() { err "This host is running an x32 userland, for which no native toolchain is provided." err "You will have to install multiarch compatibility with i686 or amd64." err "To do so, set the RUSTUP_CPUTYPE environment variable set to i686 or amd64 and re-run this script." - err "You will be able to add an x32 target after installation by running \`rustup target add x86_64-unknown-linux-gnux32\`." + err "You will be able to add an x32 target after installation by running \`rustup target add x86_64-unknown-linux-gnux32\`." exit 1 }; else _cputype=i686 @@ -588,7 +588,7 @@ check_cmd() { } assert_nz() { - if [ -z "$1" ]; then + if [ -z "$1" ]; then err "assert_nz $2" exit 1 fi From d856be5fac4b6fb398b8c23d508feba83fe4d27e Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 25 Nov 2024 16:12:36 +0100 Subject: [PATCH 2/4] Bump version, commit and date in rustup-init.sh --- rustup-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rustup-init.sh b/rustup-init.sh index 48b15fd76a..663f0c87e4 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -33,7 +33,7 @@ RUSTUP_QUIET=no # NOTICE: If you change anything here, please make the same changes in setup_mode.rs usage() { cat < Date: Mon, 25 Nov 2024 16:14:52 +0100 Subject: [PATCH 3/4] Append to 1.28.0 changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74548ac0ed..6bb78f473d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -177,6 +177,14 @@ members, so we're happy to have him on board to help address Windows-specific is * feat(cli/rustup-mode): support more books in `rustup doc` by @rami3l in https://github.com/rust-lang/rustup/pull/4071 * docs: update channel toolchain syntax by @kyle-leonhard in https://github.com/rust-lang/rustup/pull/4074 * fix(cli/rustup-mode): remove `.num_args()` when `.value_delimiter(',')` is present by @rami3l in https://github.com/rust-lang/rustup/pull/4076 +* Upgrade to rustls-platform-verifier 0.4 by @djc in https://github.com/rust-lang/rustup/pull/4087 +* Upgrade thiserror to 2 by @djc in https://github.com/rust-lang/rustup/pull/4088 +* fix: add missing close body tag by @Rustin170506 in https://github.com/rust-lang/rustup/pull/4090 +* Upgrade to opentelemetry 0.27 by @djc in https://github.com/rust-lang/rustup/pull/4089 +* feat: add nushell support by @LittleJianCH in https://github.com/rust-lang/rustup/pull/4078 +* Add aliases for remove/uninstall/unset commands by @joshtriplett in https://github.com/rust-lang/rustup/pull/4093 +* chore(deps): update remove-dir-all to 1.0 by @rbtcollins in https://github.com/rust-lang/rustup/pull/4095 +* Prepare 1.28.0 release by @djc in https://github.com/rust-lang/rustup/pull/4079 [pr#3985]: https://github.com/rust-lang/rustup/pull/3985 [pr#4028]: https://github.com/rust-lang/rustup/pull/4028 From 6601823bb3a8891f84d58092a3d6a205676b2fd0 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 2 Dec 2024 10:31:41 +0800 Subject: [PATCH 4/4] Apply clippy suggestions --- src/cli/self_update.rs | 6 +++--- src/cli/self_update/unix.rs | 2 +- src/cli/self_update/windows.rs | 6 +++--- src/config.rs | 2 +- src/diskio/threaded.rs | 10 +++++----- src/dist/component/package.rs | 8 ++++---- src/dist/component/transaction.rs | 2 +- src/dist/manifestation.rs | 2 +- src/dist/mod.rs | 2 +- src/dist/notifications.rs | 4 ++-- src/dist/temp.rs | 12 ++++++------ src/install.rs | 2 +- src/notifications.rs | 4 ++-- src/utils/mod.rs | 6 +++--- src/utils/notifications.rs | 4 ++-- 15 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index ab77d6d277..bf43ffb004 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -98,7 +98,7 @@ pub(crate) struct InstallOpts<'a> { pub targets: &'a [&'a str], } -impl<'a> InstallOpts<'a> { +impl InstallOpts<'_> { fn install(self, cfg: &mut Cfg<'_>) -> Result> { let Self { default_host_triple, @@ -508,9 +508,9 @@ pub(crate) async fn install( ) })?; - if !process + if process .var_os("RUSTUP_INIT_SKIP_EXISTENCE_CHECKS") - .map_or(false, |s| s == "yes") + .is_none_or(|s| s != "yes") { check_existence_of_rustc_or_cargo_in_path(no_prompt, process)?; check_existence_of_settings_file(process)?; diff --git a/src/cli/self_update/unix.rs b/src/cli/self_update/unix.rs index 4d29ded00e..7951d15fc2 100644 --- a/src/cli/self_update/unix.rs +++ b/src/cli/self_update/unix.rs @@ -18,7 +18,7 @@ pub(crate) fn do_anti_sudo_check(no_prompt: bool, process: &Process) -> Result) -> Result<()> { HWND_BROADCAST, WM_SETTINGCHANGE, 0 as WPARAM, - "Environment\0".as_ptr() as LPARAM, + c"Environment".as_ptr() as LPARAM, SMTO_ABORTIFHUNG, 5000, ptr::null_mut(), @@ -774,7 +774,7 @@ pub struct RegistryGuard<'a> { } #[cfg(any(test, feature = "test"))] -impl<'a> RegistryGuard<'a> { +impl RegistryGuard<'_> { pub fn new(id: &'static RegistryValueId) -> Result { Ok(Self { _locked: REGISTRY_LOCK.lock(), @@ -785,7 +785,7 @@ impl<'a> RegistryGuard<'a> { } #[cfg(any(test, feature = "test"))] -impl<'a> Drop for RegistryGuard<'a> { +impl Drop for RegistryGuard<'_> { fn drop(&mut self) { self.id.set(self.prev.as_ref()).unwrap(); } diff --git a/src/config.rs b/src/config.rs index 009fe136b6..b9ae7b6e7e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -982,7 +982,7 @@ pub(crate) fn dist_root_server(process: &Process) -> Result { }) } -impl<'a> Debug for Cfg<'a> { +impl Debug for Cfg<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let Self { profile_override, diff --git a/src/diskio/threaded.rs b/src/diskio/threaded.rs index 27ce9eca74..032e99eae3 100644 --- a/src/diskio/threaded.rs +++ b/src/diskio/threaded.rs @@ -234,7 +234,7 @@ impl<'a> Threaded<'a> { } } -impl<'a> Executor for Threaded<'a> { +impl Executor for Threaded<'_> { fn dispatch(&self, item: Item) -> Box + '_> { // Yield any completed work before accepting new work - keep memory // pressure under control @@ -351,7 +351,7 @@ impl<'a> Executor for Threaded<'a> { } } -impl<'a> Drop for Threaded<'a> { +impl Drop for Threaded<'_> { fn drop(&mut self) { // We are not permitted to fail - consume but do not handle the items. self.join().for_each(drop); @@ -363,7 +363,7 @@ struct JoinIterator<'a, 'b> { consume_sentinel: bool, } -impl<'a, 'b> JoinIterator<'a, 'b> { +impl JoinIterator<'_, '_> { fn inner>(&self, mut iter: T) -> Option { loop { let task_o = iter.next(); @@ -387,7 +387,7 @@ impl<'a, 'b> JoinIterator<'a, 'b> { } } -impl<'a, 'b> Iterator for JoinIterator<'a, 'b> { +impl Iterator for JoinIterator<'_, '_> { type Item = CompletedIo; fn next(&mut self) -> Option { @@ -404,7 +404,7 @@ struct SubmitIterator<'a, 'b> { item: Cell>, } -impl<'a, 'b> Iterator for SubmitIterator<'a, 'b> { +impl Iterator for SubmitIterator<'_, '_> { type Item = CompletedIo; fn next(&mut self) -> Option { diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs index 02646829ec..bfa981b00d 100644 --- a/src/dist/component/package.rs +++ b/src/dist/component/package.rs @@ -533,7 +533,7 @@ fn unpack_without_first_dir( Ok(()) } -impl<'a> Package for TarPackage<'a> { +impl Package for TarPackage<'_> { fn contains(&self, component: &str, short_name: Option<&str>) -> bool { self.0.contains(component, short_name) } @@ -571,7 +571,7 @@ impl<'a> TarGzPackage<'a> { } } -impl<'a> Package for TarGzPackage<'a> { +impl Package for TarGzPackage<'_> { fn contains(&self, component: &str, short_name: Option<&str>) -> bool { self.0.contains(component, short_name) } @@ -609,7 +609,7 @@ impl<'a> TarXzPackage<'a> { } } -impl<'a> Package for TarXzPackage<'a> { +impl Package for TarXzPackage<'_> { fn contains(&self, component: &str, short_name: Option<&str>) -> bool { self.0.contains(component, short_name) } @@ -647,7 +647,7 @@ impl<'a> TarZStdPackage<'a> { } } -impl<'a> Package for TarZStdPackage<'a> { +impl Package for TarZStdPackage<'_> { fn contains(&self, component: &str, short_name: Option<&str>) -> bool { self.0.contains(component, short_name) } diff --git a/src/dist/component/transaction.rs b/src/dist/component/transaction.rs index 4a1aaa1bc5..80e3de57b9 100644 --- a/src/dist/component/transaction.rs +++ b/src/dist/component/transaction.rs @@ -198,7 +198,7 @@ impl<'a> Transaction<'a> { /// If a Transaction is dropped without being committed, the changes /// are automatically rolled back. -impl<'a> Drop for Transaction<'a> { +impl Drop for Transaction<'_> { fn drop(&mut self) { if !self.committed { (self.notify_handler)(Notification::RollingBack); diff --git a/src/dist/manifestation.rs b/src/dist/manifestation.rs index cad1c36981..62e7a4b33a 100644 --- a/src/dist/manifestation.rs +++ b/src/dist/manifestation.rs @@ -90,7 +90,7 @@ impl Manifestation { /// may be either a freshly-downloaded one, or the same one used /// for the previous install), as well as lists of extension /// components to add and remove. - + /// /// From that it schedules a list of components to install and /// to uninstall to bring the installation up to date. It /// downloads the components' packages. Then in a Transaction diff --git a/src/dist/mod.rs b/src/dist/mod.rs index 3b8b6a5707..4f93ccddff 100644 --- a/src/dist/mod.rs +++ b/src/dist/mod.rs @@ -396,7 +396,7 @@ impl TargetTriple { let mut ret: libc::c_int = 0; let mut size = std::mem::size_of::() as libc::size_t; let err = libc::sysctlbyname( - b"sysctl.proc_translated\0".as_ptr().cast(), + c"sysctl.proc_translated".as_ptr().cast(), (&mut ret) as *mut _ as *mut libc::c_void, &mut size, std::ptr::null_mut(), diff --git a/src/dist/notifications.rs b/src/dist/notifications.rs index fa901bc1eb..bd7ec6e422 100644 --- a/src/dist/notifications.rs +++ b/src/dist/notifications.rs @@ -50,7 +50,7 @@ impl<'a> From> for Notification<'a> { } } -impl<'a> Notification<'a> { +impl Notification<'_> { pub(crate) fn level(&self) -> NotificationLevel { use self::Notification::*; match self { @@ -84,7 +84,7 @@ impl<'a> Notification<'a> { } } -impl<'a> Display for Notification<'a> { +impl Display for Notification<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> { use self::Notification::*; match self { diff --git a/src/dist/temp.rs b/src/dist/temp.rs index a87eeafb22..72b3677a42 100644 --- a/src/dist/temp.rs +++ b/src/dist/temp.rs @@ -25,7 +25,7 @@ pub(crate) struct Dir<'a> { path: PathBuf, } -impl<'a> ops::Deref for Dir<'a> { +impl ops::Deref for Dir<'_> { type Target = Path; fn deref(&self) -> &Path { @@ -33,7 +33,7 @@ impl<'a> ops::Deref for Dir<'a> { } } -impl<'a> Drop for Dir<'a> { +impl Drop for Dir<'_> { fn drop(&mut self) { if raw::is_directory(&self.path) { let n = Notification::DirectoryDeletion( @@ -51,7 +51,7 @@ pub struct File<'a> { path: PathBuf, } -impl<'a> ops::Deref for File<'a> { +impl ops::Deref for File<'_> { type Target = Path; fn deref(&self) -> &Path { @@ -59,7 +59,7 @@ impl<'a> ops::Deref for File<'a> { } } -impl<'a> Drop for File<'a> { +impl Drop for File<'_> { fn drop(&mut self) { if raw::is_file(&self.path) { let n = Notification::FileDeletion(&self.path, fs::remove_file(&self.path)); @@ -77,7 +77,7 @@ pub enum Notification<'a> { DirectoryDeletion(&'a Path, io::Result<()>), } -impl<'a> Notification<'a> { +impl Notification<'_> { pub(crate) fn level(&self) -> NotificationLevel { use self::Notification::*; match self { @@ -93,7 +93,7 @@ impl<'a> Notification<'a> { } } -impl<'a> Display for Notification<'a> { +impl Display for Notification<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> { use self::Notification::*; match self { diff --git a/src/install.rs b/src/install.rs index eb9c1c39c5..35f26dc5e1 100644 --- a/src/install.rs +++ b/src/install.rs @@ -35,7 +35,7 @@ pub(crate) enum InstallMethod<'a> { Dist(DistOptions<'a>), } -impl<'a> InstallMethod<'a> { +impl InstallMethod<'_> { // Install a toolchain #[tracing::instrument(level = "trace", err(level = "trace"), skip_all)] pub(crate) async fn install(&self) -> Result { diff --git a/src/notifications.rs b/src/notifications.rs index fe90f067fe..12db560660 100644 --- a/src/notifications.rs +++ b/src/notifications.rs @@ -55,7 +55,7 @@ impl<'a> From> for Notification<'a> { } } -impl<'a> Notification<'a> { +impl Notification<'_> { pub(crate) fn level(&self) -> NotificationLevel { use self::Notification::*; match self { @@ -84,7 +84,7 @@ impl<'a> Notification<'a> { } } -impl<'a> Display for Notification<'a> { +impl Display for Notification<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> { use self::Notification::*; match self { diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 9fb3db6b79..dae45d4b73 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -247,10 +247,10 @@ async fn download_file_( // Keep the curl env var around for a bit let use_curl_backend = process .var_os("RUSTUP_USE_CURL") - .map_or(false, |it| it != "0"); + .is_some_and(|it| it != "0"); let use_rustls = process .var_os("RUSTUP_USE_RUSTLS") - .map_or(true, |it| it != "0"); + .is_none_or(|it| it != "0"); let (backend, notification) = if use_curl_backend { (Backend::Curl, Notification::UsingCurl) } else { @@ -648,7 +648,7 @@ impl<'a> FileReaderWithProgress<'a> { } } -impl<'a> io::Read for FileReaderWithProgress<'a> { +impl io::Read for FileReaderWithProgress<'_> { fn read(&mut self, buf: &mut [u8]) -> io::Result { match self.fh.read(buf) { Ok(nbytes) => { diff --git a/src/utils/notifications.rs b/src/utils/notifications.rs index 1e74e11637..007bd39834 100644 --- a/src/utils/notifications.rs +++ b/src/utils/notifications.rs @@ -42,7 +42,7 @@ pub enum Notification<'a> { RenameInUse(&'a Path, &'a Path), } -impl<'a> Notification<'a> { +impl Notification<'_> { pub(crate) fn level(&self) -> NotificationLevel { use self::Notification::*; match self { @@ -67,7 +67,7 @@ impl<'a> Notification<'a> { } } -impl<'a> Display for Notification<'a> { +impl Display for Notification<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> { use self::Notification::*; match self {