From d86b89a354c01a8ec8600dc63136f0a61a3e3d13 Mon Sep 17 00:00:00 2001 From: Marcelo Iepsen Date: Mon, 29 Apr 2024 19:19:24 +0200 Subject: [PATCH] fix: formatting code with rustfmt (#47) --- src/cache.rs | 2 +- src/commands.rs | 2 +- src/package.rs | 2 +- src/releases.rs | 2 +- src/versions.rs | 19 +++++++++++++------ 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/cache.rs b/src/cache.rs index 22ba9d7..adec2f0 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -1,7 +1,7 @@ +use crate::Config; use std::fs; use std::io::Read; use std::path::{Path, PathBuf}; -use crate::Config; pub fn bootstrap() -> Result<(), Box> { let config = Config::new(); diff --git a/src/commands.rs b/src/commands.rs index 79bf982..cd85dd7 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -1,4 +1,4 @@ -use crate::{Config, package, platform::is_supported_platform, releases, versions::Version}; +use crate::{package, platform::is_supported_platform, releases, versions::Version, Config}; pub struct Commands {} diff --git a/src/package.rs b/src/package.rs index 8a123dd..6daf6af 100644 --- a/src/package.rs +++ b/src/package.rs @@ -2,9 +2,9 @@ use flate2::read::GzDecoder; use std::fs; use tar::Archive; extern crate fs_extra; -use crate::{Config, http}; use crate::versions::{Asset, Version}; use crate::{cache, platform}; +use crate::{http, Config}; use fs_extra::dir; pub fn get_cmake_release(version: &Version) -> Result<(), Box> { diff --git a/src/releases.rs b/src/releases.rs index 35e1325..64e4ad9 100644 --- a/src/releases.rs +++ b/src/releases.rs @@ -1,7 +1,7 @@ -use crate::{cache, Config}; use crate::constants::{BASE_URL, RELEASES_FILE_NAME}; use crate::http; use crate::versions::Version; +use crate::{cache, Config}; use serde_json::Value; use std::{fs, io::Write, thread}; diff --git a/src/versions.rs b/src/versions.rs index 21b26b0..6d4d1f1 100644 --- a/src/versions.rs +++ b/src/versions.rs @@ -1,5 +1,5 @@ use crate::constants::RELEASES_FILE_NAME; -use crate::{cache, Config, package, platform}; +use crate::{cache, package, platform, Config}; use serde::{Deserialize, Serialize}; use serde_json::Value; @@ -36,14 +36,18 @@ impl Version { split_version.next().unwrap().parse::().unwrap(), split_version.next().unwrap().parse::().unwrap(), split_version.next().unwrap().parse::().unwrap(), - split_version.next().unwrap_or(&"").parse::().unwrap(), + split_version + .next() + .unwrap_or(&"") + .parse::() + .unwrap(), ); version.major = Some(major); version.minor = Some(minor); version.patch = Some(patch); version.rc = Some(rc.to_string()); - + Ok(version) } @@ -175,7 +179,7 @@ mod test { "content_type": "application/gzip", }); let raw_version = json!({ - "tag_name": "v3.22.3", + "tag_name": "v3.22.3", "assets": [raw_asset] }); @@ -187,7 +191,10 @@ mod test { assert_eq!(version.assets.len(), 1); assert_eq!(assets.is_some(), true); assert_eq!(assets.unwrap().name, "cmake-3.22.3-linux-aarch64.tar.gz"); - assert_eq!(assets.unwrap().browser_download_url, "http://fake_browser_download_url"); + assert_eq!( + assets.unwrap().browser_download_url, + "http://fake_browser_download_url" + ); assert_eq!(assets.unwrap().content_type, "application/gzip"); } @@ -199,7 +206,7 @@ mod test { "content_type": "application/gzip", }); let raw_version = json!({ - "tag_name": "v3.22.3-rc5", + "tag_name": "v3.22.3-rc5", "assets": [raw_asset] });