Fix cargo fmt error

This commit is contained in:
Hui, Chunyang 2020-11-04 03:48:46 +00:00 committed by Tate, Hongliang Tian
parent 9504e8f681
commit 72ad448cf9
3 changed files with 11 additions and 3 deletions

@ -1 +0,0 @@
nightly-2020-04-07

@ -5,8 +5,12 @@ extern crate protobuf;
#[macro_use]
extern crate log;
// Skip formatting the two modules because they are generated by grpc framework.
#[rustfmt::skip]
pub mod occlum_exec;
#[rustfmt::skip]
pub mod occlum_exec_grpc;
pub mod server;
pub const DEFAULT_SERVER_FILE: &'static str = "occlum_exec_server";

@ -3,6 +3,8 @@ INCLUDE_MAKEFILE := $(lastword $(MAKEFILE_LIST))
CUR_DIR := $(shell dirname $(realpath $(MAIN_MAKEFILE)))
PROJECT_DIR := $(realpath $(CUR_DIR)/../../)
SHELL := /bin/bash
SGX_SDK ?= /opt/intel/sgxsdk
SGX_MODE ?= HW
SGX_ARCH ?= x64
@ -140,14 +142,17 @@ SGX_LFLAGS_T = $(SGX_COMMON_CFLAGS) -nostdlib -L$(SGX_LIBRARY_PATH) $(_Other_Lin
define format-rust
output=$$(cargo fmt -- --check 2>&1); retval=$$?; \
if [[ $$retval -eq 1 ]]; then \
$(ECHO) "$$output"; cargo fmt; $(ECHO) "$(GREEN)\nRust code format corrected.$(NO_COLOR)"; \
$(ECHO) "$$output"; \
cargo fmt; \
$(ECHO) "$(GREEN)\nRust code format corrected.$(NO_COLOR)"; \
fi
endef
define format-check-rust
output=$$(cargo fmt -- --check 2>&1); retval=$$?; \
if [[ $$retval -eq 1 ]]; then \
$(ECHO) "$(RED)\nSome format issues of Rust code are detected:$(NO_COLOR)"; $(ECHO) "\n$$output"; \
$(ECHO) "$(RED)\nSome format issues of Rust code are detected:$(NO_COLOR)"; \
$(ECHO) "\n$$output"; \
$(ECHO) "\nTo get rid of the format warnings above, run $(CYAN)"make format"$(NO_COLOR) to correct"; \
fi
endef