chore: clippy lints
This commit is contained in:
parent
2dab5f1669
commit
b1ce2549bf
3 changed files with 12 additions and 12 deletions
|
@ -44,7 +44,7 @@ pub struct DeployEvent {
|
|||
pub branch: String,
|
||||
}
|
||||
|
||||
fn find_page<'a>(secret: &str, ctx: &'a AppCtx) -> Option<&'a Page> {
|
||||
pub fn find_page<'a>(secret: &str, ctx: &'a AppCtx) -> Option<&'a Page> {
|
||||
for page in ctx.settings.pages.iter() {
|
||||
if page.secret == secret {
|
||||
return Some(page);
|
||||
|
@ -70,12 +70,12 @@ async fn update(payload: web::Json<DeployEvent>, ctx: AppCtx) -> ServiceResult<i
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct DeploySecret {
|
||||
pub secret: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct DeployInfo {
|
||||
pub head: String,
|
||||
pub remote: String,
|
||||
|
|
11
src/page.rs
11
src/page.rs
|
@ -15,12 +15,9 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use git2::{
|
||||
build::CheckoutBuilder, Branch, BranchType, Direction, ObjectType, Oid, Remote, Repository,
|
||||
};
|
||||
use git2::{build::CheckoutBuilder, BranchType, Direction, Oid, Remote, Repository};
|
||||
#[cfg(not(test))]
|
||||
use log::info;
|
||||
use std::io::{self, Write};
|
||||
|
||||
#[cfg(test)]
|
||||
use std::println as info;
|
||||
|
@ -29,12 +26,13 @@ use serde::Deserialize;
|
|||
|
||||
use crate::errors::*;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Deserialize)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Deserialize)]
|
||||
pub struct Page {
|
||||
pub secret: String,
|
||||
pub repo: String,
|
||||
pub path: String,
|
||||
pub branch: String,
|
||||
pub domain: String,
|
||||
}
|
||||
|
||||
impl Page {
|
||||
|
@ -130,7 +128,7 @@ impl Page {
|
|||
let head_commit = repo
|
||||
.reference_to_annotated_commit(&repo.head().unwrap())
|
||||
.unwrap();
|
||||
Self::normal_merge(&repo, &head_commit, &fetch_commit).unwrap();
|
||||
Self::normal_merge(repo, &head_commit, &fetch_commit).unwrap();
|
||||
} else {
|
||||
log::info!("Nothing to do...");
|
||||
}
|
||||
|
@ -254,6 +252,7 @@ mod tests {
|
|||
repo: "https://github.com/mcaptcha/website".to_owned(),
|
||||
path: tmp_dir.to_str().unwrap().to_string(),
|
||||
branch: "gh-pages".to_string(),
|
||||
domain: "mcaptcha.org".into(),
|
||||
};
|
||||
|
||||
assert!(
|
||||
|
|
|
@ -39,6 +39,7 @@ pub async fn get_data() -> (Temp, Arc<Ctx>) {
|
|||
secret: page.secret.clone(),
|
||||
branch: page.branch.clone(),
|
||||
repo: page.repo.clone(),
|
||||
domain: "mcaptcha.org".into(),
|
||||
};
|
||||
|
||||
pages.push(Arc::new(page));
|
||||
|
@ -112,18 +113,18 @@ macro_rules! delete_request {
|
|||
macro_rules! get_app {
|
||||
("APP") => {
|
||||
actix_web::App::new()
|
||||
.app_data(crate::get_json_err())
|
||||
.app_data($crate::get_json_err())
|
||||
.wrap(actix_web::middleware::NormalizePath::new(
|
||||
actix_web::middleware::TrailingSlash::Trim,
|
||||
))
|
||||
.configure(crate::routes::services)
|
||||
.configure($crate::routes::services)
|
||||
};
|
||||
|
||||
// ($settings:ident) => {
|
||||
// test::init_service(get_app!("APP", $settings))
|
||||
// };
|
||||
($ctx:expr) => {
|
||||
test::init_service(get_app!("APP").app_data(crate::WebData::new($ctx.clone())))
|
||||
test::init_service(get_app!("APP").app_data($crate::WebData::new($ctx.clone())))
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue