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,
|
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() {
|
for page in ctx.settings.pages.iter() {
|
||||||
if page.secret == secret {
|
if page.secret == secret {
|
||||||
return Some(page);
|
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 struct DeploySecret {
|
||||||
pub secret: String,
|
pub secret: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
|
||||||
pub struct DeployInfo {
|
pub struct DeployInfo {
|
||||||
pub head: String,
|
pub head: String,
|
||||||
pub remote: 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/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use git2::{
|
use git2::{build::CheckoutBuilder, BranchType, Direction, Oid, Remote, Repository};
|
||||||
build::CheckoutBuilder, Branch, BranchType, Direction, ObjectType, Oid, Remote, Repository,
|
|
||||||
};
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use log::info;
|
use log::info;
|
||||||
use std::io::{self, Write};
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use std::println as info;
|
use std::println as info;
|
||||||
|
@ -29,12 +26,13 @@ use serde::Deserialize;
|
||||||
|
|
||||||
use crate::errors::*;
|
use crate::errors::*;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Deserialize)]
|
#[derive(Debug, Clone, Eq, PartialEq, Deserialize)]
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
pub secret: String,
|
pub secret: String,
|
||||||
pub repo: String,
|
pub repo: String,
|
||||||
pub path: String,
|
pub path: String,
|
||||||
pub branch: String,
|
pub branch: String,
|
||||||
|
pub domain: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Page {
|
impl Page {
|
||||||
|
@ -130,7 +128,7 @@ impl Page {
|
||||||
let head_commit = repo
|
let head_commit = repo
|
||||||
.reference_to_annotated_commit(&repo.head().unwrap())
|
.reference_to_annotated_commit(&repo.head().unwrap())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Self::normal_merge(&repo, &head_commit, &fetch_commit).unwrap();
|
Self::normal_merge(repo, &head_commit, &fetch_commit).unwrap();
|
||||||
} else {
|
} else {
|
||||||
log::info!("Nothing to do...");
|
log::info!("Nothing to do...");
|
||||||
}
|
}
|
||||||
|
@ -254,6 +252,7 @@ mod tests {
|
||||||
repo: "https://github.com/mcaptcha/website".to_owned(),
|
repo: "https://github.com/mcaptcha/website".to_owned(),
|
||||||
path: tmp_dir.to_str().unwrap().to_string(),
|
path: tmp_dir.to_str().unwrap().to_string(),
|
||||||
branch: "gh-pages".to_string(),
|
branch: "gh-pages".to_string(),
|
||||||
|
domain: "mcaptcha.org".into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
|
|
|
@ -39,6 +39,7 @@ pub async fn get_data() -> (Temp, Arc<Ctx>) {
|
||||||
secret: page.secret.clone(),
|
secret: page.secret.clone(),
|
||||||
branch: page.branch.clone(),
|
branch: page.branch.clone(),
|
||||||
repo: page.repo.clone(),
|
repo: page.repo.clone(),
|
||||||
|
domain: "mcaptcha.org".into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
pages.push(Arc::new(page));
|
pages.push(Arc::new(page));
|
||||||
|
@ -112,18 +113,18 @@ macro_rules! delete_request {
|
||||||
macro_rules! get_app {
|
macro_rules! get_app {
|
||||||
("APP") => {
|
("APP") => {
|
||||||
actix_web::App::new()
|
actix_web::App::new()
|
||||||
.app_data(crate::get_json_err())
|
.app_data($crate::get_json_err())
|
||||||
.wrap(actix_web::middleware::NormalizePath::new(
|
.wrap(actix_web::middleware::NormalizePath::new(
|
||||||
actix_web::middleware::TrailingSlash::Trim,
|
actix_web::middleware::TrailingSlash::Trim,
|
||||||
))
|
))
|
||||||
.configure(crate::routes::services)
|
.configure($crate::routes::services)
|
||||||
};
|
};
|
||||||
|
|
||||||
// ($settings:ident) => {
|
// ($settings:ident) => {
|
||||||
// test::init_service(get_app!("APP", $settings))
|
// test::init_service(get_app!("APP", $settings))
|
||||||
// };
|
// };
|
||||||
($ctx:expr) => {
|
($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…
Add table
Reference in a new issue