Commit 5e386484 authored by Emmanuel Raviart's avatar Emmanuel Raviart

Reformat source code.

parent 47b38656
Pipeline #99530 passed with stage
in 2 minutes and 15 seconds
......@@ -1943,11 +1943,7 @@ pub struct Promulgation {
#[serde(rename = "infoJO")]
pub info_jo: InfoJo,
/// Informations sur les rectifications au Journal officiel
#[serde(
default,
deserialize_with = "map_to_vec",
rename = "infoJORect"
)]
#[serde(default, deserialize_with = "map_to_vec", rename = "infoJORect")]
pub info_jo_rect: Vec<InfoJo>,
#[serde(rename = "libelleActe")]
pub libelle_acte: LibelleActe,
......@@ -2035,11 +2031,7 @@ graphql_object!(Promulgation: Context |&self| {
#[derive(Clone, Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct Rapporteurs {
#[serde(
default,
deserialize_with = "map_to_vec",
rename = "rapporteur"
)]
#[serde(default, deserialize_with = "map_to_vec", rename = "rapporteur")]
pub rapporteurs: Vec<Rapporteur>,
}
......@@ -2324,11 +2316,7 @@ pub struct TexteEuropeen {
#[derive(Clone, Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct TextesAssocies {
#[serde(
default,
deserialize_with = "map_to_vec",
rename = "texteAssocie"
)]
#[serde(default, deserialize_with = "map_to_vec", rename = "texteAssocie")]
pub textes_associes: Vec<TexteAssocie>,
}
......
......@@ -97,14 +97,14 @@ impl Acteur {
}
graphql_object!(Acteur: Context |&self| {
field etat_civil() -> &EtatCivil {
&self.etat_civil
}
field commission_permanente(&executor, date: String) -> Option<&OrganeParlementaire> {
self.commission_permanente(&executor.context(), &date)
}
field etat_civil() -> &EtatCivil {
&self.etat_civil
}
field groupe_politique(&executor, date: String) -> Option<&GroupePolitique> {
self.groupe_politique(&executor.context(), &date)
}
......
......@@ -93,10 +93,7 @@ pub struct Identifiants {
#[derive(Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct InfosReunionsInternationale {
#[serde(
deserialize_with = "str_to_bool",
rename = "estReunionInternationale"
)]
#[serde(deserialize_with = "str_to_bool", rename = "estReunionInternationale")]
pub est_reunion_internationale: bool,
#[serde(rename = "informationsComplementaires")]
pub informations_complementaires: Option<EmptyChoice>,
......@@ -184,10 +181,7 @@ pub struct Participants {
#[derive(Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct ParticipantsInternes {
#[serde(
deserialize_with = "map_to_vec",
rename = "participantInterne"
)]
#[serde(deserialize_with = "map_to_vec", rename = "participantInterne")]
pub participants_internes: Vec<ParticipantInterne>,
}
......@@ -211,10 +205,7 @@ pub struct PersonneAuditionnee {
#[derive(Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
pub struct PersonnesAuditionnees {
#[serde(
deserialize_with = "map_to_vec",
rename = "personneAuditionnee"
)]
#[serde(deserialize_with = "map_to_vec", rename = "personneAuditionnee")]
pub personnes_auditionnees: Vec<PersonneAuditionnee>,
}
......
use acteurs::{Acteur};
use acteurs::Acteur;
use commun::{EmptyChoice, XmlNamespace};
use contexts::Context;
use serde_utils::{map_to_vec, str_to_bool, str_to_option_bool, str_to_vec};
use textes_legislatifs::{Document};
use textes_legislatifs::Document;
#[derive(Debug, Deserialize, GraphQLObject)]
#[serde(deny_unknown_fields)]
......
......@@ -46,9 +46,7 @@ impl Context {
pub fn get_document_at_uid(&self, uid: &str) -> Option<&Document> {
self.document_by_uid
.get(&uid.to_string())
.map(|document| unsafe {
mem::transmute::<*const Document, &Document>(*document)
})
.map(|document| unsafe { mem::transmute::<*const Document, &Document>(*document) })
}
pub fn get_dossier_parlementaire_at_segment(
......@@ -106,9 +104,7 @@ impl Context {
pub fn get_texte_leg_at_uid(&self, uid: &str) -> Option<&TexteLeg> {
self.texte_leg_by_uid
.get(&uid.to_string())
.map(|texte_leg| unsafe {
mem::transmute::<*const TexteLeg, &TexteLeg>(*texte_leg)
})
.map(|texte_leg| unsafe { mem::transmute::<*const TexteLeg, &TexteLeg>(*texte_leg) })
}
}
......
......@@ -826,11 +826,7 @@ pub struct EtudePlf {
pub ordre_diqs: String, // TODO: Convert to u32.
#[serde(rename = "organeRef")]
pub organe_ref: String,
#[serde(
default,
deserialize_with = "map_to_vec",
rename = "rapporteur"
)]
#[serde(default, deserialize_with = "map_to_vec", rename = "rapporteur")]
pub rapporteurs: Vec<Rapporteur>,
#[serde(rename = "texteAssocie")]
pub texte_associe: Option<String>,
......
......@@ -279,8 +279,7 @@ pub fn load(
}
}
let mut document_by_uid: HashMap<String, *const Document> =
HashMap::new();
let mut document_by_uid: HashMap<String, *const Document> = HashMap::new();
let mut dossier_parlementaire_by_segment: HashMap<String, *const DossierParlementaire> =
HashMap::new();
let mut dossier_parlementaire_by_signet_senat: HashMap<String, *const DossierParlementaire> =
......@@ -293,10 +292,7 @@ pub fn load(
}
for wrapper in &dossiers_legislatifs_wrappers {
for document in &wrapper.export.textes_legislatifs.documents {
document_by_uid.insert(
document.uid().to_string(),
document,
);
document_by_uid.insert(document.uid().to_string(), document);
}
for dossier in &wrapper.export.dossiers_legislatifs.dossiers {
......
This diff is collapsed.
......@@ -20,7 +20,8 @@ use clap::{App, Arg};
use config::Verbosity;
use data::{
Acteur, Amendement, CodeTypeOrgane, Context, Document, DossierParlementaire, FonctionOrgane,
Mandat, Organe, Reunion, Scrutin, TexteLeg, TextesEtAmendements, ALL_DATASETS, FONCTIONS_ORGANES,
Mandat, Organe, Reunion, Scrutin, TexteLeg, TextesEtAmendements, ALL_DATASETS,
FONCTIONS_ORGANES,
};
use juniper::{EmptyMutation, FieldResult, RootNode};
use rocket::http::Method;
......
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