chore: fmt

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-08-01 15:02:05 +02:00
parent 8cd68d569b
commit 8b83b9c14d
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
7 changed files with 12 additions and 17 deletions

View File

@ -40,7 +40,7 @@ pub fn get_from_environment(vars: std::env::Vars) -> PleaseConfigBuilder {
} }
pub fn detect_environment(vars: &HashMap<String, String>) -> ExecutionEnvironment { pub fn detect_environment(vars: &HashMap<String, String>) -> ExecutionEnvironment {
if let Some(_) = vars.get("DRONE".into()) { if vars.get("DRONE").is_some() {
return ExecutionEnvironment::Drone; return ExecutionEnvironment::Drone;
} }

View File

@ -25,19 +25,19 @@ pub struct PleaseConfig {
} }
impl PleaseConfig { impl PleaseConfig {
pub fn get_owner<'a>(&'a self) -> &'a str { pub fn get_owner(&self) -> &str {
&self.project.owner &self.project.owner
} }
pub fn get_repository<'a>(&'a self) -> &'a str { pub fn get_repository(&self) -> &str {
&self.project.repository &self.project.repository
} }
pub fn get_source<'a>(&'a self) -> &'a PathBuf { pub fn get_source(&self) -> &PathBuf {
&self.project.source &self.project.source
} }
pub fn get_branch<'a>(&'a self) -> &'a str { pub fn get_branch(&self) -> &str {
&self.project.branch &self.project.branch
} }
pub fn get_api_url<'a>(&'a self) -> &'a str { pub fn get_api_url(&self) -> &str {
&self.settings.api_url &self.settings.api_url
} }
} }
@ -90,6 +90,6 @@ impl PleaseConfigBuilder {
a.merge(x).clone() a.merge(x).clone()
}); });
Ok(final_config.try_into()?) final_config.try_into()
} }
} }

View File

@ -1,4 +1,4 @@
use std::{default, path::PathBuf}; use std::path::PathBuf;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -35,7 +35,7 @@ impl PleaseConfigBuilder {
Some(settings) => settings, Some(settings) => settings,
}; };
if let Some(mut project) = config.project { if let Some(project) = config.project {
if let Some(owner) = project.owner { if let Some(owner) = project.owner {
fproject.owner = Some(owner); fproject.owner = Some(owner);
} }
@ -51,7 +51,7 @@ impl PleaseConfigBuilder {
self.project = Some(fproject); self.project = Some(fproject);
} }
if let Some(mut settings) = config.settings { if let Some(settings) = config.settings {
if let Some(api_url) = settings.api_url { if let Some(api_url) = settings.api_url {
fsettings.api_url = Some(api_url); fsettings.api_url = Some(api_url);
} }

View File

@ -8,7 +8,7 @@ use std::{
use ::semver::Version; use ::semver::Version;
use anyhow::Context; use anyhow::Context;
use clap::{Args, Parser, Subcommand}; use clap::{Args, Parser, Subcommand};
use cuddle_please_frontend::{gatheres::ConfigArgs, PleaseConfig, PleaseConfigBuilder}; use cuddle_please_frontend::{gatheres::ConfigArgs, PleaseConfigBuilder};
use crate::{ use crate::{
cliff::{self, changelog_parser}, cliff::{self, changelog_parser},

View File

@ -10,8 +10,7 @@ pub struct GiteaClient {
pub allow_insecure: bool, pub allow_insecure: bool,
} }
const APP_USER_AGENT: &str = const APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);
impl GiteaClient { impl GiteaClient {
pub fn new(url: impl Into<String>, token: Option<impl Into<String>>) -> Self { pub fn new(url: impl Into<String>, token: Option<impl Into<String>>) -> Self {

View File

@ -24,8 +24,6 @@ impl ConsoleUi {
} }
} }
impl From<ConsoleUi> for DynUi { impl From<ConsoleUi> for DynUi {
fn from(value: ConsoleUi) -> Self { fn from(value: ConsoleUi) -> Self {
Box::new(value) Box::new(value)

View File

@ -85,8 +85,6 @@ impl Ui for BufferUi {
} }
} }
impl Default for BufferUi { impl Default for BufferUi {
fn default() -> Self { fn default() -> Self {
Self { Self {