1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-21 21:09:22 +00:00

Improve code readability

This commit is contained in:
Pierre HUBERT 2022-03-17 18:34:42 +01:00
parent bd272b2d36
commit 287937ac63

View File

@ -7,14 +7,15 @@ use crate::data::user::User;
#[derive(Serialize)] #[derive(Serialize)]
pub struct ResGetSecurityQuestions { pub struct ResGetSecurityQuestions {
questions: Vec<String> questions: Vec<String>,
} }
impl ResGetSecurityQuestions { impl ResGetSecurityQuestions {
pub fn new(user: &User) -> ResGetSecurityQuestions { pub fn new(user: &User) -> ResGetSecurityQuestions {
let mut questions = Vec::new(); let questions = vec![
questions.push(user.security_question_1.clone().unwrap_or(String::new())); user.security_question_1.clone().unwrap_or_default(),
questions.push(user.security_question_2.clone().unwrap_or(String::new())); user.security_question_2.clone().unwrap_or_default(),
];
ResGetSecurityQuestions { questions } ResGetSecurityQuestions { questions }
} }