mirror of
https://github.com/nushell/nushell
synced 2024-12-26 13:03:07 +00: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
1 changed files with 6 additions and 1 deletions
|
@ -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 a new issue