Reformat rust code using 1.40 rustfmt and fail build if rustfmt fails (#2339)

diff --git a/lib/rs/Makefile.am b/lib/rs/Makefile.am
index 6d74348..dd1c03b 100644
--- a/lib/rs/Makefile.am
+++ b/lib/rs/Makefile.am
@@ -31,9 +31,11 @@
 	@echo '##############################################################'
 
 check-local:
+	$(CARGO) fmt --all -- --check
 	$(CARGO) test
 
 all-local:
+	$(CARGO) fmt --all -- --check
 	$(CARGO) build
 
 clean-local: