Skip to content

Commit 1f97744

Browse files
committed
Apply clippy suggestions
1 parent 00b8d42 commit 1f97744

15 files changed

+36
-36
lines changed

src/cli/self_update.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub(crate) struct InstallOpts<'a> {
9898
pub targets: &'a [&'a str],
9999
}
100100

101-
impl<'a> InstallOpts<'a> {
101+
impl InstallOpts<'_> {
102102
fn install(self, cfg: &mut Cfg<'_>) -> Result<Option<ToolchainDesc>> {
103103
let Self {
104104
default_host_triple,
@@ -508,9 +508,9 @@ pub(crate) async fn install(
508508
)
509509
})?;
510510

511-
if !process
511+
if process
512512
.var_os("RUSTUP_INIT_SKIP_EXISTENCE_CHECKS")
513-
.map_or(false, |s| s == "yes")
513+
.is_none_or(|s| s != "yes")
514514
{
515515
check_existence_of_rustc_or_cargo_in_path(no_prompt, process)?;
516516
check_existence_of_settings_file(process)?;

src/cli/self_update/unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(crate) fn do_anti_sudo_check(no_prompt: bool, process: &Process) -> Result<u
1818
// test runner should set this, nothing else
1919
if process
2020
.var_os("RUSTUP_INIT_SKIP_SUDO_CHECK")
21-
.map_or(false, |s| s == "yes")
21+
.is_some_and(|s| s == "yes")
2222
{
2323
return fallback();
2424
}

src/cli/self_update/windows.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ fn _apply_new_path(new_path: Option<HSTRING>) -> Result<()> {
490490
HWND_BROADCAST,
491491
WM_SETTINGCHANGE,
492492
0 as WPARAM,
493-
"Environment\0".as_ptr() as LPARAM,
493+
c"Environment".as_ptr() as LPARAM,
494494
SMTO_ABORTIFHUNG,
495495
5000,
496496
ptr::null_mut(),
@@ -774,7 +774,7 @@ pub struct RegistryGuard<'a> {
774774
}
775775

776776
#[cfg(any(test, feature = "test"))]
777-
impl<'a> RegistryGuard<'a> {
777+
impl RegistryGuard<'_> {
778778
pub fn new(id: &'static RegistryValueId) -> Result<Self> {
779779
Ok(Self {
780780
_locked: REGISTRY_LOCK.lock(),
@@ -785,7 +785,7 @@ impl<'a> RegistryGuard<'a> {
785785
}
786786

787787
#[cfg(any(test, feature = "test"))]
788-
impl<'a> Drop for RegistryGuard<'a> {
788+
impl Drop for RegistryGuard<'_> {
789789
fn drop(&mut self) {
790790
self.id.set(self.prev.as_ref()).unwrap();
791791
}

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ pub(crate) fn dist_root_server(process: &Process) -> Result<String> {
982982
})
983983
}
984984

985-
impl<'a> Debug for Cfg<'a> {
985+
impl Debug for Cfg<'_> {
986986
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
987987
let Self {
988988
profile_override,

src/diskio/threaded.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<'a> Threaded<'a> {
234234
}
235235
}
236236

237-
impl<'a> Executor for Threaded<'a> {
237+
impl Executor for Threaded<'_> {
238238
fn dispatch(&self, item: Item) -> Box<dyn Iterator<Item = CompletedIo> + '_> {
239239
// Yield any completed work before accepting new work - keep memory
240240
// pressure under control
@@ -351,7 +351,7 @@ impl<'a> Executor for Threaded<'a> {
351351
}
352352
}
353353

354-
impl<'a> Drop for Threaded<'a> {
354+
impl Drop for Threaded<'_> {
355355
fn drop(&mut self) {
356356
// We are not permitted to fail - consume but do not handle the items.
357357
self.join().for_each(drop);
@@ -363,7 +363,7 @@ struct JoinIterator<'a, 'b> {
363363
consume_sentinel: bool,
364364
}
365365

366-
impl<'a, 'b> JoinIterator<'a, 'b> {
366+
impl JoinIterator<'_, '_> {
367367
fn inner<T: Iterator<Item = Task>>(&self, mut iter: T) -> Option<CompletedIo> {
368368
loop {
369369
let task_o = iter.next();
@@ -387,7 +387,7 @@ impl<'a, 'b> JoinIterator<'a, 'b> {
387387
}
388388
}
389389

390-
impl<'a, 'b> Iterator for JoinIterator<'a, 'b> {
390+
impl Iterator for JoinIterator<'_, '_> {
391391
type Item = CompletedIo;
392392

393393
fn next(&mut self) -> Option<CompletedIo> {
@@ -404,7 +404,7 @@ struct SubmitIterator<'a, 'b> {
404404
item: Cell<Option<Item>>,
405405
}
406406

407-
impl<'a, 'b> Iterator for SubmitIterator<'a, 'b> {
407+
impl Iterator for SubmitIterator<'_, '_> {
408408
type Item = CompletedIo;
409409

410410
fn next(&mut self) -> Option<CompletedIo> {

src/dist/component/package.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ fn unpack_without_first_dir<R: Read>(
533533
Ok(())
534534
}
535535

536-
impl<'a> Package for TarPackage<'a> {
536+
impl Package for TarPackage<'_> {
537537
fn contains(&self, component: &str, short_name: Option<&str>) -> bool {
538538
self.0.contains(component, short_name)
539539
}
@@ -571,7 +571,7 @@ impl<'a> TarGzPackage<'a> {
571571
}
572572
}
573573

574-
impl<'a> Package for TarGzPackage<'a> {
574+
impl Package for TarGzPackage<'_> {
575575
fn contains(&self, component: &str, short_name: Option<&str>) -> bool {
576576
self.0.contains(component, short_name)
577577
}
@@ -609,7 +609,7 @@ impl<'a> TarXzPackage<'a> {
609609
}
610610
}
611611

612-
impl<'a> Package for TarXzPackage<'a> {
612+
impl Package for TarXzPackage<'_> {
613613
fn contains(&self, component: &str, short_name: Option<&str>) -> bool {
614614
self.0.contains(component, short_name)
615615
}
@@ -647,7 +647,7 @@ impl<'a> TarZStdPackage<'a> {
647647
}
648648
}
649649

650-
impl<'a> Package for TarZStdPackage<'a> {
650+
impl Package for TarZStdPackage<'_> {
651651
fn contains(&self, component: &str, short_name: Option<&str>) -> bool {
652652
self.0.contains(component, short_name)
653653
}

src/dist/component/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<'a> Transaction<'a> {
198198

199199
/// If a Transaction is dropped without being committed, the changes
200200
/// are automatically rolled back.
201-
impl<'a> Drop for Transaction<'a> {
201+
impl Drop for Transaction<'_> {
202202
fn drop(&mut self) {
203203
if !self.committed {
204204
(self.notify_handler)(Notification::RollingBack);

src/dist/manifestation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Manifestation {
9090
/// may be either a freshly-downloaded one, or the same one used
9191
/// for the previous install), as well as lists of extension
9292
/// components to add and remove.
93-
93+
///
9494
/// From that it schedules a list of components to install and
9595
/// to uninstall to bring the installation up to date. It
9696
/// downloads the components' packages. Then in a Transaction

src/dist/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl TargetTriple {
396396
let mut ret: libc::c_int = 0;
397397
let mut size = std::mem::size_of::<libc::c_int>() as libc::size_t;
398398
let err = libc::sysctlbyname(
399-
b"sysctl.proc_translated\0".as_ptr().cast(),
399+
c"sysctl.proc_translated".as_ptr().cast(),
400400
(&mut ret) as *mut _ as *mut libc::c_void,
401401
&mut size,
402402
std::ptr::null_mut(),

src/dist/notifications.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'a> From<temp::Notification<'a>> for Notification<'a> {
5050
}
5151
}
5252

53-
impl<'a> Notification<'a> {
53+
impl Notification<'_> {
5454
pub(crate) fn level(&self) -> NotificationLevel {
5555
use self::Notification::*;
5656
match self {
@@ -84,7 +84,7 @@ impl<'a> Notification<'a> {
8484
}
8585
}
8686

87-
impl<'a> Display for Notification<'a> {
87+
impl Display for Notification<'_> {
8888
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> {
8989
use self::Notification::*;
9090
match self {

src/dist/temp.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ pub(crate) struct Dir<'a> {
2525
path: PathBuf,
2626
}
2727

28-
impl<'a> ops::Deref for Dir<'a> {
28+
impl ops::Deref for Dir<'_> {
2929
type Target = Path;
3030

3131
fn deref(&self) -> &Path {
3232
self.path.as_path()
3333
}
3434
}
3535

36-
impl<'a> Drop for Dir<'a> {
36+
impl Drop for Dir<'_> {
3737
fn drop(&mut self) {
3838
if raw::is_directory(&self.path) {
3939
let n = Notification::DirectoryDeletion(
@@ -51,15 +51,15 @@ pub struct File<'a> {
5151
path: PathBuf,
5252
}
5353

54-
impl<'a> ops::Deref for File<'a> {
54+
impl ops::Deref for File<'_> {
5555
type Target = Path;
5656

5757
fn deref(&self) -> &Path {
5858
self.path.as_path()
5959
}
6060
}
6161

62-
impl<'a> Drop for File<'a> {
62+
impl Drop for File<'_> {
6363
fn drop(&mut self) {
6464
if raw::is_file(&self.path) {
6565
let n = Notification::FileDeletion(&self.path, fs::remove_file(&self.path));
@@ -77,7 +77,7 @@ pub enum Notification<'a> {
7777
DirectoryDeletion(&'a Path, io::Result<()>),
7878
}
7979

80-
impl<'a> Notification<'a> {
80+
impl Notification<'_> {
8181
pub(crate) fn level(&self) -> NotificationLevel {
8282
use self::Notification::*;
8383
match self {
@@ -93,7 +93,7 @@ impl<'a> Notification<'a> {
9393
}
9494
}
9595

96-
impl<'a> Display for Notification<'a> {
96+
impl Display for Notification<'_> {
9797
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> {
9898
use self::Notification::*;
9999
match self {

src/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub(crate) enum InstallMethod<'a> {
3535
Dist(DistOptions<'a>),
3636
}
3737

38-
impl<'a> InstallMethod<'a> {
38+
impl InstallMethod<'_> {
3939
// Install a toolchain
4040
#[tracing::instrument(level = "trace", err(level = "trace"), skip_all)]
4141
pub(crate) async fn install(&self) -> Result<UpdateStatus> {

src/notifications.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'a> From<temp::Notification<'a>> for Notification<'a> {
5555
}
5656
}
5757

58-
impl<'a> Notification<'a> {
58+
impl Notification<'_> {
5959
pub(crate) fn level(&self) -> NotificationLevel {
6060
use self::Notification::*;
6161
match self {
@@ -84,7 +84,7 @@ impl<'a> Notification<'a> {
8484
}
8585
}
8686

87-
impl<'a> Display for Notification<'a> {
87+
impl Display for Notification<'_> {
8888
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> {
8989
use self::Notification::*;
9090
match self {

src/utils/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@ async fn download_file_(
247247
// Keep the curl env var around for a bit
248248
let use_curl_backend = process
249249
.var_os("RUSTUP_USE_CURL")
250-
.map_or(false, |it| it != "0");
250+
.is_some_and(|it| it != "0");
251251
let use_rustls = process
252252
.var_os("RUSTUP_USE_RUSTLS")
253-
.map_or(true, |it| it != "0");
253+
.is_none_or(|it| it != "0");
254254
let (backend, notification) = if use_curl_backend {
255255
(Backend::Curl, Notification::UsingCurl)
256256
} else {
@@ -648,7 +648,7 @@ impl<'a> FileReaderWithProgress<'a> {
648648
}
649649
}
650650

651-
impl<'a> io::Read for FileReaderWithProgress<'a> {
651+
impl io::Read for FileReaderWithProgress<'_> {
652652
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
653653
match self.fh.read(buf) {
654654
Ok(nbytes) => {

src/utils/notifications.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub enum Notification<'a> {
4242
RenameInUse(&'a Path, &'a Path),
4343
}
4444

45-
impl<'a> Notification<'a> {
45+
impl Notification<'_> {
4646
pub(crate) fn level(&self) -> NotificationLevel {
4747
use self::Notification::*;
4848
match self {
@@ -67,7 +67,7 @@ impl<'a> Notification<'a> {
6767
}
6868
}
6969

70-
impl<'a> Display for Notification<'a> {
70+
impl Display for Notification<'_> {
7171
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> {
7272
use self::Notification::*;
7373
match self {

0 commit comments

Comments
 (0)