我认为你应该手动更改它。实际上并不难。
我运行了这段代码:
$ cargo new smurf --bin
Created binary (application) `smurf` project
$ cd smurf/
smurf$ cargo build
....
smurf$ grep -rl smurf .
./target/debug/smurf.d
./target/debug/smurf
./target/debug/.fingerprint/smurf-35f069edf7faaa12/bin-smurf-35f069edf7faaa12.json
./target/debug/.fingerprint/smurf-35f069edf7faaa12/dep-bin-smurf-35f069edf7faaa12
./target/debug/deps/smurf-35f069edf7faaa12
./Cargo.lock
./Cargo.toml
从所有这些文件中,整个target
可能只需要删除。 .lock
文件也可以删除。至于Cargo.toml
...嗯,你可以进行编辑。
我尝试只更改Cargo.toml
,一切正常工作。但是在target
中会留下无用的文件,所以我建议无论如何都要删除它们。
在Linux系统中,这非常直接:
pi@raspberrypi:~/workspace/rust/hello_world $ cd ..
mv hello_world/ hello_rust/
以重命名文件夹。pi@raspberrypi:~/workspace/rust $ cd hello_rust/
pi@raspberrypi:~/workspace/rust/hello_rust $ geany Cargo.toml
name = "hello_world"
更改为 name = "hello_rust"
希望这能帮助未来有需要的人。