mirror of
https://github.com/nushell/nushell.git
synced 2025-03-26 23:36:20 +01:00
Fix future lint by truncate(false)
in touch
(#11863)
The following clippy lint on nightly would complain: - https://rust-lang.github.io/rust-clippy/master/#/suspicious_open We don't want to alter the content in `touch` or truncate by not writing. While not fully applicable, may be good practice for platforms/filesystems we are not aware of.
This commit is contained in:
parent
96744e3155
commit
e09b4817e1
@ -136,7 +136,12 @@ impl Command for Touch {
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(err) = OpenOptions::new().write(true).create(true).open(&item) {
|
||||
if let Err(err) = OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(false)
|
||||
.open(&item)
|
||||
{
|
||||
return Err(ShellError::CreateNotPossible {
|
||||
msg: format!("Failed to create file: {err}"),
|
||||
span: call
|
||||
|
Loading…
Reference in New Issue
Block a user