Skip to content

Commit

Permalink
fix: formatting code with rustfmt (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
iepsen authored Apr 29, 2024
1 parent 90f1ff6 commit d86b89a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/cache.rs
Original file line number Diff line number Diff line change
@@ -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<dyn std::error::Error>> {
let config = Config::new();
Expand Down
2 changes: 1 addition & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
@@ -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 {}

Expand Down
2 changes: 1 addition & 1 deletion src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn std::error::Error>> {
Expand Down
2 changes: 1 addition & 1 deletion src/releases.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
19 changes: 13 additions & 6 deletions src/versions.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -36,14 +36,18 @@ impl Version {
split_version.next().unwrap().parse::<i32>().unwrap(),
split_version.next().unwrap().parse::<i32>().unwrap(),
split_version.next().unwrap().parse::<i32>().unwrap(),
split_version.next().unwrap_or(&"").parse::<String>().unwrap(),
split_version
.next()
.unwrap_or(&"")
.parse::<String>()
.unwrap(),
);

version.major = Some(major);
version.minor = Some(minor);
version.patch = Some(patch);
version.rc = Some(rc.to_string());

Ok(version)
}

Expand Down Expand Up @@ -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]
});

Expand All @@ -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");
}

Expand All @@ -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]
});

Expand Down

0 comments on commit d86b89a

Please sign in to comment.