Commit 0b0b2f0d authored by Konrad Borowski's avatar Konrad Borowski

Resolve too many parameters Clippy lint

parent 280212bc
Pipeline #102312592 passed with stages
in 18 minutes and 49 seconds
use crate::models::paste;
use crate::models::paste::ExtraPasteParameters;
use crate::schema::{implementation_wrappers, implementations, languages, pastes};
use crate::Connection;
use diesel::prelude::*;
......@@ -71,10 +72,7 @@ pub fn run(connection: &Connection) -> Result<(), Box<dyn Error>> {
None,
&languages_identifier,
hello_world,
"".into(),
None,
None,
None,
ExtraPasteParameters::default(),
)
.unwrap();
diesel::update(languages::table)
......
......@@ -52,15 +52,25 @@ struct InsertPaste {
exit_code: Option<i32>,
}
#[derive(Default)]
pub struct ExtraPasteParameters {
pub stdin: String,
pub stdout: Option<String>,
pub stderr: Option<String>,
pub exit_code: Option<i32>,
}
pub fn insert(
connection: &Connection,
delete_at: Option<DateTime<Utc>>,
language: &str,
paste: String,
stdin: String,
stdout: Option<String>,
stderr: Option<String>,
exit_code: Option<i32>,
ExtraPasteParameters {
stdin,
stdout,
stderr,
exit_code,
}: ExtraPasteParameters,
) -> Result<String, Rejection> {
let mut rng = rand::thread_rng();
let identifier: String = (0..10)
......
use crate::models::paste;
use crate::models::paste::{self, ExtraPasteParameters};
use crate::Connection;
use chrono::{Duration, Utc};
use futures::Future;
......@@ -69,10 +69,12 @@ pub fn insert_paste(
expiration.map(|expiration| Utc::now() + expiration.0),
&language,
code,
"".into(),
None,
None,
None,
ExtraPasteParameters {
stdin: "".into(),
stdout: None,
stderr: None,
exit_code: None,
},
)
})
.compat()
......
use crate::models::paste;
use crate::models::paste::ExtraPasteParameters;
use crate::Connection;
use chrono::{Duration, Utc};
use futures::Future;
......@@ -41,10 +42,12 @@ pub fn insert_paste(
delete_at,
&language,
code,
stdin,
stdout,
stderr,
status,
ExtraPasteParameters {
stdin,
stdout,
stderr,
exit_code: status,
},
)?;
Ok(reply::with_header(
StatusCode::SEE_OTHER,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment