mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Fix clippy lints
This commit is contained in:
parent
63995995ac
commit
f677ff1840
|
@ -1,6 +1,5 @@
|
||||||
use clap::{Arg, ArgAction, ArgMatches};
|
use clap::{Arg, ArgAction, ArgMatches};
|
||||||
use dependency_graph::DependencyGraph;
|
use dependency_graph::DependencyGraph;
|
||||||
use std::borrow::BorrowMut;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
@ -95,18 +94,6 @@ pub fn publish(matches: &ArgMatches) -> Result<(), Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_cargo_toml_version(folder: &Path) -> Result<String, Error> {
|
|
||||||
let cargo_toml = read_cargo_toml(folder)?;
|
|
||||||
|
|
||||||
let version_value = cargo_toml["package"]["version"]
|
|
||||||
.as_value()
|
|
||||||
.ok_or(Error::CrateVersion)?
|
|
||||||
.as_str()
|
|
||||||
.ok_or(Error::CrateVersion)?;
|
|
||||||
|
|
||||||
Ok(version_value.to_owned())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build_dependency_graph(root: &Path) -> Result<Vec<Package>, Error> {
|
fn build_dependency_graph(root: &Path) -> Result<Vec<Package>, Error> {
|
||||||
let dirs = fs::read_dir(root).map_err(|_| Error::ReadingDependencies)?;
|
let dirs = fs::read_dir(root).map_err(|_| Error::ReadingDependencies)?;
|
||||||
let mut packages = vec![];
|
let mut packages = vec![];
|
||||||
|
@ -172,34 +159,6 @@ mod test {
|
||||||
command().debug_assert();
|
command().debug_assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn url_to_poll_should_return_correct_url() {
|
|
||||||
let test_cases = [
|
|
||||||
["agb", "3/a/agb"],
|
|
||||||
["agb-image-converter", "ag/b_/agb_image_converter"],
|
|
||||||
["agb-fixnum", "ag/b_/agb_fixnum"],
|
|
||||||
];
|
|
||||||
|
|
||||||
for [name, result] in test_cases {
|
|
||||||
let url = get_url_to_poll(name);
|
|
||||||
assert_eq!(
|
|
||||||
url,
|
|
||||||
format!(
|
|
||||||
"https://raw.githubusercontent.com/rust-lang/crates.io-index/master/{result}",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn should_read_version() -> Result<(), Error> {
|
|
||||||
let root_directory = crate::utils::find_agb_root_directory().unwrap();
|
|
||||||
let my_version = read_cargo_toml_version(&root_directory.join("tools"))?;
|
|
||||||
|
|
||||||
assert_eq!(my_version, "0.1.0");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_detect_dependencies() -> Result<(), Error> {
|
fn should_detect_dependencies() -> Result<(), Error> {
|
||||||
let root_directory = crate::utils::find_agb_root_directory().unwrap();
|
let root_directory = crate::utils::find_agb_root_directory().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue