woopsie format
// See the License for the specific language governing permissions and
// limitations under the License.
-
fn get_git_branch() -> String {
use std::process::Command;
@@ -23,7 +22,11 @@ fn get_git_branch() -> String {
.output();
if let Ok(branch_output) = branch {
let branch_string = String::from_utf8_lossy(&branch_output.stdout);
- return branch_string.lines().next().unwrap_or("unknown_branch").to_string();
+ return branch_string
+ .lines()
+ .next()
+ .unwrap_or("unknown_branch")
+ .to_string();
} else {
panic!("Can not get git branch: {}", branch.unwrap_err());
}
@@ -40,22 +43,18 @@ fn get_git_commit() -> String {
if let Ok(commit_output) = commit {
let commit_string = String::from_utf8_lossy(&commit_output.stdout);
- return commit_string.lines().next().unwrap_or("unknown_hash").to_string();
+ return commit_string
+ .lines()
+ .next()
+ .unwrap_or("unknown_hash")
+ .to_string();
} else {
panic!("Can not get git commit: {}", commit.unwrap_err());
}
}
fn main() {
- println!(
- "cargo:rerun-if-changed=.git"
- );
- println!(
- "cargo:rustc-env=VERSION_BRANCH={}",
- get_git_branch()
- );
- println!(
- "cargo:rustc-env=VERSION_HASH={}",
- get_git_commit()
- );
+ println!("cargo:rerun-if-changed=.git");
+ println!("cargo:rustc-env=VERSION_BRANCH={}", get_git_branch());
+ println!("cargo:rustc-env=VERSION_HASH={}", get_git_commit());
}
