Closed as not planned
Description
VS Code
rustlang.rust v0.3.1051
The following code does not format (using the format command has no effect).
Removing the println
line completely seems to make the code format again.
Is this a bug within rustfmt?
use std::thread;
enum Switch1 {
Option1,
Option2,
}
enum MassiveSwitch {
Cmd1,
}
struct Worker {
id: i32,
}
impl Worker {
pub fn start(self) {
let switch: MassiveSwitch = MassiveSwitch::Cmd1;
let switch1 = Switch1::Option1;
let _ = thread::Builder::new()
.name(format!("Worker {}", self.id))
.spawn(move || {
if true {
match switch1 {
Switch1::Option1 => match switch {
MassiveSwitch::Cmd1 => {
// TODO: the white lines here should be deleted by rustfmt on save (or format command)
// TODO: removing this line causes rustfmt to work again. Commenting it out doesn't work, have to delete the line complete to get rust fmt to work
println!("Shard worker {}: received shutdown signal, exiting loop...", 5);
let test = "test";
}
},
Switch1::Option2 => todo!(),
}
}
})
.expect("Can't spawn");
}
}
fn main() {
let worker = Worker { id: 3 };
worker.start();
}