Skip to content

Commit 04ebd86

Browse files
committed
clippy: fix warnings introduced by Rust 1.76
1 parent dd64bae commit 04ebd86

File tree

5 files changed

+17
-24
lines changed

5 files changed

+17
-24
lines changed

src/uu/nohup/src/nohup.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ fn find_stdout() -> UResult<File> {
148148
};
149149

150150
match OpenOptions::new()
151-
.write(true)
152151
.create(true)
153152
.append(true)
154153
.open(Path::new(NOHUP_OUT))
@@ -168,12 +167,7 @@ fn find_stdout() -> UResult<File> {
168167
let mut homeout = PathBuf::from(home);
169168
homeout.push(NOHUP_OUT);
170169
let homeout_str = homeout.to_str().unwrap();
171-
match OpenOptions::new()
172-
.write(true)
173-
.create(true)
174-
.append(true)
175-
.open(&homeout)
176-
{
170+
match OpenOptions::new().create(true).append(true).open(&homeout) {
177171
Ok(t) => {
178172
show_error!(
179173
"ignoring input and appending output to {}",

src/uu/od/src/mockstream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::io::{Cursor, Error, ErrorKind, Read, Result};
1010
///
1111
/// # Examples
1212
///
13-
/// ```
13+
/// ```no_run
1414
/// use std::io::{Cursor, Read};
1515
///
1616
/// struct CountIo {}

src/uu/pr/src/pr.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -577,18 +577,19 @@ fn build_options(
577577

578578
// +page option is less priority than --pages
579579
let page_plus_re = Regex::new(r"\s*\+(\d+:*\d*)\s*").unwrap();
580-
let start_page_in_plus_option = match page_plus_re.captures(free_args).map(|i| {
580+
let res = page_plus_re.captures(free_args).map(|i| {
581581
let unparsed_num = i.get(1).unwrap().as_str().trim();
582582
let x: Vec<_> = unparsed_num.split(':').collect();
583583
x[0].to_string().parse::<usize>().map_err(|_e| {
584584
PrError::EncounteredErrors(format!("invalid {} argument {}", "+", unparsed_num.quote()))
585585
})
586-
}) {
586+
});
587+
let start_page_in_plus_option = match res {
587588
Some(res) => res?,
588589
None => 1,
589590
};
590591

591-
let end_page_in_plus_option = match page_plus_re
592+
let res = page_plus_re
592593
.captures(free_args)
593594
.map(|i| i.get(1).unwrap().as_str().trim())
594595
.filter(|i| i.contains(':'))
@@ -601,7 +602,8 @@ fn build_options(
601602
unparsed_num.quote()
602603
))
603604
})
604-
}) {
605+
});
606+
let end_page_in_plus_option = match res {
605607
Some(res) => Some(res?),
606608
None => None,
607609
};
@@ -616,27 +618,27 @@ fn build_options(
616618
})
617619
};
618620

619-
let start_page = match matches
621+
let res = matches
620622
.get_one::<String>(options::PAGES)
621623
.map(|i| {
622624
let x: Vec<_> = i.split(':').collect();
623625
x[0].to_string()
624626
})
625-
.map(invalid_pages_map)
626-
{
627+
.map(invalid_pages_map);
628+
let start_page = match res {
627629
Some(res) => res?,
628630
None => start_page_in_plus_option,
629631
};
630632

631-
let end_page = match matches
633+
let res = matches
632634
.get_one::<String>(options::PAGES)
633635
.filter(|i| i.contains(':'))
634636
.map(|i| {
635637
let x: Vec<_> = i.split(':').collect();
636638
x[1].to_string()
637639
})
638-
.map(invalid_pages_map)
639-
{
640+
.map(invalid_pages_map);
641+
let end_page = match res {
640642
Some(res) => Some(res?),
641643
None => end_page_in_plus_option,
642644
};
@@ -707,12 +709,13 @@ fn build_options(
707709

708710
let re_col = Regex::new(r"\s*-(\d+)\s*").unwrap();
709711

710-
let start_column_option = match re_col.captures(free_args).map(|i| {
712+
let res = re_col.captures(free_args).map(|i| {
711713
let unparsed_num = i.get(1).unwrap().as_str().trim();
712714
unparsed_num.parse::<usize>().map_err(|_e| {
713715
PrError::EncounteredErrors(format!("invalid {} argument {}", "-", unparsed_num.quote()))
714716
})
715-
}) {
717+
});
718+
let start_column_option = match res {
716719
Some(res) => Some(res?),
717720
None => None,
718721
};

tests/by-util/test_cat.rs

-2
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,6 @@ fn test_write_to_self_empty() {
503503

504504
let file = OpenOptions::new()
505505
.create_new(true)
506-
.write(true)
507506
.append(true)
508507
.open(&file_path)
509508
.unwrap();
@@ -519,7 +518,6 @@ fn test_write_to_self() {
519518

520519
let file = OpenOptions::new()
521520
.create_new(true)
522-
.write(true)
523521
.append(true)
524522
.open(file_path)
525523
.unwrap();

tests/common/util.rs

-2
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,6 @@ impl AtPath {
864864
pub fn append(&self, name: &str, contents: &str) {
865865
log_info("write(append)", self.plus_as_string(name));
866866
let mut f = OpenOptions::new()
867-
.write(true)
868867
.append(true)
869868
.create(true)
870869
.open(self.plus(name))
@@ -876,7 +875,6 @@ impl AtPath {
876875
pub fn append_bytes(&self, name: &str, contents: &[u8]) {
877876
log_info("write(append)", self.plus_as_string(name));
878877
let mut f = OpenOptions::new()
879-
.write(true)
880878
.append(true)
881879
.create(true)
882880
.open(self.plus(name))

0 commit comments

Comments
 (0)