Skip to content

Commit c5779b6

Browse files
committed
Make needless_borrow clippy happy
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
1 parent 207484a commit c5779b6

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/cli/rustup_mode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ fn output_completion_script(shell: Shell, command: CompletionCommand) -> Result<
16711671
}
16721672
CompletionCommand::Cargo => {
16731673
if let Shell::Zsh = shell {
1674-
writeln!(&mut term2::stdout(), "#compdef cargo")?;
1674+
writeln!(term2::stdout(), "#compdef cargo")?;
16751675
}
16761676

16771677
let script = match shell {
@@ -1687,7 +1687,7 @@ fn output_completion_script(shell: Shell, command: CompletionCommand) -> Result<
16871687
};
16881688

16891689
writeln!(
1690-
&mut term2::stdout(),
1690+
term2::stdout(),
16911691
"if command -v rustc >/dev/null 2>&1; then\n\
16921692
\tsource \"$(rustc --print sysroot)\"{}\n\
16931693
fi",

src/diskio/immediate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl IncrementalFileWriter {
204204
fn write(&mut self, chunk: Vec<u8>) -> std::result::Result<bool, io::Error> {
205205
let mut state = self.state.lock().unwrap();
206206
if let Some(ref mut state) = *state {
207-
if let Some(ref mut file) = (&mut self.file).as_mut() {
207+
if let Some(ref mut file) = self.file.as_mut() {
208208
// Length 0 vector is used for clean EOF signalling.
209209
if chunk.is_empty() {
210210
trace_scoped!("close", "name:": self.path_display);

src/utils/raw.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub(crate) fn filter_file<F: FnMut(&str) -> bool>(
7979
for result in io::BufRead::lines(&mut reader) {
8080
let line = result?;
8181
if filter(&line) {
82-
writeln!(&mut writer, "{}", &line)?;
82+
writeln!(writer, "{}", &line)?;
8383
} else {
8484
removed += 1;
8585
}
@@ -97,7 +97,7 @@ pub fn append_file(dest: &Path, line: &str) -> io::Result<()> {
9797
.create(true)
9898
.open(dest)?;
9999

100-
writeln!(&mut dest_file, "{}", line)?;
100+
writeln!(dest_file, "{}", line)?;
101101

102102
dest_file.sync_data()?;
103103

tests/dist_transactions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn add_file() {
2727
let mut tx = Transaction::new(prefix.clone(), &tmpcfg, &notify);
2828

2929
let mut file = tx.add_file("c", PathBuf::from("foo/bar")).unwrap();
30-
write!(&mut file, "test").unwrap();
30+
write!(file, "test").unwrap();
3131

3232
tx.commit();
3333
drop(file);
@@ -759,9 +759,9 @@ fn rollback_failure_keeps_going() {
759759
let notify = |_: Notification<'_>| ();
760760
let mut tx = Transaction::new(prefix.clone(), &tmpcfg, &notify);
761761

762-
write!(&mut tx.add_file("", PathBuf::from("foo")).unwrap(), "").unwrap();
763-
write!(&mut tx.add_file("", PathBuf::from("bar")).unwrap(), "").unwrap();
764-
write!(&mut tx.add_file("", PathBuf::from("baz")).unwrap(), "").unwrap();
762+
write!(tx.add_file("", PathBuf::from("foo")).unwrap(), "").unwrap();
763+
write!(tx.add_file("", PathBuf::from("bar")).unwrap(), "").unwrap();
764+
write!(tx.add_file("", PathBuf::from("baz")).unwrap(), "").unwrap();
765765

766766
fs::remove_file(prefix.path().join("bar")).unwrap();
767767

0 commit comments

Comments
 (0)