Skip to content
Extraits de code Groupes Projets
Vérifiée Valider d0c2893d rédigé par Kubat's avatar Kubat
Parcourir les fichiers

RUST: Use forbit unsafe for where we can to enforce the use of unsafe code...

RUST: Use forbit unsafe for where we can to enforce the use of unsafe code only in the c compat crate
parent 01d16aaf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
#![forbid(unsafe_code)]
fn main() {} fn main() {}
#![forbid(unsafe_code)]
//! The base library used for lektor's clients. It is composed of elements to //! The base library used for lektor's clients. It is composed of elements to
//! communicate with the lektord server and elements to store and organise the //! communicate with the lektord server and elements to store and organise the
//! queried informations. //! queried informations.
......
#![forbid(unsafe_code)]
mod asserts; mod asserts;
mod error; mod error;
mod macros; mod macros;
......
#![forbid(unsafe_code)]
mod args; mod args;
mod config; mod config;
mod parsers; mod parsers;
...@@ -35,7 +37,7 @@ macro_rules! send { ...@@ -35,7 +37,7 @@ macro_rules! send {
($conn: expr => $query: expr ; $expect: pat_param => $action: block) => { ($conn: expr => $query: expr ; $expect: pat_param => $action: block) => {
match $conn.send($query).await.expect("failed to execute command") { match $conn.send($query).await.expect("failed to execute command") {
$expect => $action, $expect => $action,
_ => panic!("invalid response type for command"), _ => unreachable!("invalid response type for command"),
} }
}; };
...@@ -96,14 +98,12 @@ async fn handle_cmd_playlist( ...@@ -96,14 +98,12 @@ async fn handle_cmd_playlist(
send!(conn => LektorQuery::RemoveFromPlaylist(name, query); ok) send!(conn => LektorQuery::RemoveFromPlaylist(name, query); ok)
} }
LktPlaylistCommand::List => { LktPlaylistCommand::List => {
send!(conn => LektorQuery::ListAllPlaylists send!(conn => LektorQuery::ListAllPlaylists; LektorResponse::PlaylistSet(playlists) => {
; LektorResponse::PlaylistSet(playlists) => {
playlists.into_iter().for_each(|plt| println!("{plt}")) playlists.into_iter().for_each(|plt| println!("{plt}"))
}) })
} }
LktPlaylistCommand::ListContent { name } => { LktPlaylistCommand::ListContent { name } => {
send!(conn => LektorQuery::ListPlaylist(name) send!(conn => LektorQuery::ListPlaylist(name); LektorResponse::KaraSet(karas) => {
; LektorResponse::KaraSet(karas) => {
karas.into_iter().for_each(|kara| println!("{kara}")) karas.into_iter().for_each(|kara| println!("{kara}"))
}) })
} }
......
#![forbid(unsafe_code)]
pub mod v1; pub mod v1;
#![forbid(unsafe_code)]
//! Database implementation in rust for lektor. //! Database implementation in rust for lektor.
pub mod connexion; pub mod connexion;
......
#![forbid(unsafe_code)]
//! The crate responsible of downloading karas from kurisu. //! The crate responsible of downloading karas from kurisu.
use lektor_c_compat::rs::*; use lektor_c_compat::rs::*;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter