We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b01a800 commit 2488606Copy full SHA for 2488606
1 file changed
tools/rust_analyzer/bin/gen_rust_project.rs
@@ -1,6 +1,6 @@
1
use std::{
2
env,
3
- fs::File,
+ fs::OpenOptions,
4
io::{BufWriter, ErrorKind},
5
};
6
@@ -36,11 +36,14 @@ fn write_rust_project(
36
}
37
38
// Write the new rust-project.json file.
39
- let file = File::open(rust_project_path)
40
- .with_context(|| "could not open: {rust_project_path}")
+ let file = OpenOptions::new()
+ .write(true)
41
+ .create(true)
42
+ .open(rust_project_path)
43
+ .with_context(|| format!("could not open: {rust_project_path}"))
44
.map(BufWriter::new)?;
- serde_json::to_writer(file, &rust_project)?;
45
46
+ serde_json::to_writer(file, &rust_project)?;
47
Ok(())
48
49
0 commit comments