Rust Question: How to make ctrl-f5 run a release executable

I'm using VSCode to build and debug Rust code using Rust Analyzer and Code LLDB on Fedora Linux. Everything works great; specifically, hitting f5 starts a performs a debug build, and loads runs my project under the debugger.

But I'd like to have ctrl-f5 run a release build. At present it simply runs a debug build, just not in the debugger. One of my projects has some CPU heavy code which runs very fast in release, and very slow in debug, and it would be nice to be able to launch my code via ctrl-f5 instead of on the command line via cargo run --release

Posted Oct 15, 2022, 11:08 PM UTC

21
Hish15•

You can create a task running the run in release command. You can assign a shortcut to this task.

https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks

1