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

MISC: Add VSCODE workspace files to hace something editable in vscode + apply clippy

parent 5cb6c377
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
{
"folders": [
{
"path": ".",
"name": "Root Folder"
},
{
"path": "inc",
"name": "Includes"
},
{
"path": "src",
"name": "Lektor Sources"
},
{
"path": "src/rust/liblektor-rs",
"name": "Lektor Rust Lib Sources"
},
{
"path": "src/rust/amadeus-rs",
"name": "Amadeus RS Sources"
},
],
"settings": {
"ltex.language": "en",
"languageTool.language": "en",
"editor.formatOnSave": true,
"json.format.enable": true,
"rust-analyzer.checkOnSave.command": "clippy",
"rust-analyzer.inlayHints.parameterHints.enable": false,
"rust-analyzer.procMacro.attributes.enable": true
}
}
\ No newline at end of file
......@@ -114,7 +114,7 @@ impl LktDatabaseConnection {
}
/// Add a kara with a request.
pub fn add_kara_from_request<'a>(&mut self, kara: NewKaraRequest<'a>) -> LktDatabaseResult<()> {
pub fn add_kara_from_request(&mut self, kara: NewKaraRequest) -> LktDatabaseResult<()> {
let (id, new_kara, lang, karamakers, tags) = kara;
self.ensure_language_exists(&lang)?;
self.sqlite.exclusive_transaction(|c| {
......
......@@ -33,15 +33,15 @@ impl_from_for_proprity!(i16);
impl_from_for_proprity!(i32);
impl_from_for_proprity!(i64);
impl Into<i32> for LktDatabasePriority {
fn into(self) -> i32 {
self.value as i32
impl From<LktDatabasePriority> for i32 {
fn from(val: LktDatabasePriority) -> Self {
val.value as i32
}
}
impl Into<usize> for LktDatabasePriority {
fn into(self) -> usize {
self.value as usize
impl From<LktDatabasePriority> for usize {
fn from(val: LktDatabasePriority) -> Self {
val.value as usize
}
}
......@@ -132,7 +132,7 @@ impl LktDatabaseQueue {
pub fn range(&self, range: Range<usize>) -> LktDatabaseQueueRangeIter {
let mut iter = self.iter();
let remaining = range.end.checked_sub(range.start).unwrap_or(0);
let remaining = range.end.saturating_sub(range.start);
if remaining >= 1 {
for _ in 0..range.start {
iter.next();
......
......@@ -34,7 +34,7 @@ pub unsafe extern "C" fn lkt_database_establish_connection(
/// undefined.
#[no_mangle]
pub unsafe extern "C" fn lkt_database_close_connection(db: *mut LktDatabaseConnection) {
if db == std::ptr::null_mut() {
if db.is_null() {
error!("can't clost a connexion to a null database!")
} else {
let db = Box::from_raw(db);
......
......@@ -16,13 +16,13 @@ extern "C" fn lkt_module_repo_rs_init(
queue: LktQueuePtr,
db: LktDbPtr,
) -> i32 {
let _repo: &mut LktModuleRepoRs = unsafe { std::mem::transmute(repo) };
let _repo: &mut LktModuleRepoRs = unsafe { &mut *repo };
1
}
#[no_mangle]
extern "C" fn lkt_module_repo_rs_free(repo: LktModuleRepoRsPtr) -> i32 {
let _repo: &mut LktModuleRepoRs = unsafe { std::mem::transmute(repo) };
let _repo: &mut LktModuleRepoRs = unsafe { &mut *repo };
1
}
......
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