Placate clippy

This commit is contained in:
SkyfallWasTaken 2024-07-29 18:47:52 +01:00
parent 7e8ecea10c
commit f41dac26eb
3 changed files with 5 additions and 10 deletions

View file

@ -85,10 +85,8 @@ pub async fn init() -> Result<()> {
let license: String = Input::with_theme(&ColorfulTheme::default()) let license: String = Input::with_theme(&ColorfulTheme::default())
.with_prompt("License") .with_prompt("License")
.validate_with(|input: &String| { .validate_with(|input: &String| {
spdx::Expression::parse(input).map_or_else( spdx::Expression::parse(input)
|err| Err(format!("license is invalid:\n{}", err.to_string())), .map_or_else(|err| Err(format!("license is invalid:\n{err}")), |_| Ok(()))
|_| Ok(()),
)
}) })
.default("MIT".into()) .default("MIT".into())
.interact_text()?; .interact_text()?;

View file

@ -23,13 +23,10 @@ pub enum Error {
} }
impl PackageInfo { impl PackageInfo {
pub async fn from_name( pub async fn from_name(package_name: &str, client: &reqwest::Client) -> Result<Self, Error> {
package_name: &str,
client: &reqwest::Client,
) -> Result<PackageInfo, Error> {
let url = format!("{NPM_REGISTRY_ROOT_URL}/{package_name}"); let url = format!("{NPM_REGISTRY_ROOT_URL}/{package_name}");
let response = client.get(&url).send().await?; let response = client.get(&url).send().await?;
let package_info = response.json::<PackageInfo>().await?; let package_info = response.json::<Self>().await?;
Ok(package_info) Ok(package_info)
} }
} }

View file

@ -43,7 +43,7 @@ fn is_false(value: &bool) -> bool {
} }
#[inline(always)] #[inline(always)]
fn default_as_false() -> bool { const fn default_as_false() -> bool {
false false
} }