style(modulo): fix formatting
This commit is contained in:
parent
e227fae326
commit
308d1848be
|
@ -192,7 +192,7 @@ fn build_native() {
|
||||||
"--without-liblzma",
|
"--without-liblzma",
|
||||||
"--with-libjpeg=builtin",
|
"--with-libjpeg=builtin",
|
||||||
"--with-libpng=builtin",
|
"--with-libpng=builtin",
|
||||||
"--enable-universal-binary=arm64,x86_64"
|
"--enable-universal-binary=arm64,x86_64",
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("failed to execute configure")
|
.expect("failed to execute configure")
|
||||||
|
|
|
@ -22,7 +22,7 @@ extern crate lazy_static;
|
||||||
|
|
||||||
pub mod form;
|
pub mod form;
|
||||||
pub mod search;
|
pub mod search;
|
||||||
|
mod sys;
|
||||||
pub mod troubleshooting;
|
pub mod troubleshooting;
|
||||||
pub mod welcome;
|
pub mod welcome;
|
||||||
pub mod wizard;
|
pub mod wizard;
|
||||||
mod sys;
|
|
|
@ -100,7 +100,8 @@ fn command_filter(
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|(_, item)| item.is_builtin)
|
.filter(|(_, item)| item.is_builtin)
|
||||||
.map(|(i, _)| i).collect::<HashSet<usize>>(),
|
.map(|(i, _)| i)
|
||||||
|
.collect::<HashSet<usize>>(),
|
||||||
query.trim_start_matches('>'),
|
query.trim_start_matches('>'),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -109,7 +110,8 @@ fn command_filter(
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|(_, item)| !item.is_builtin)
|
.filter(|(_, item)| !item.is_builtin)
|
||||||
.map(|(i, _)| i).collect::<HashSet<usize>>(),
|
.map(|(i, _)| i)
|
||||||
|
.collect::<HashSet<usize>>(),
|
||||||
query,
|
query,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
|
@ -156,7 +156,9 @@ mod interop {
|
||||||
|
|
||||||
impl From<types::Field> for OwnedField {
|
impl From<types::Field> for OwnedField {
|
||||||
fn from(field: types::Field) -> Self {
|
fn from(field: types::Field) -> Self {
|
||||||
let id = field.id.map(|id| CString::new(id).expect("unable to create cstring for field id"));
|
let id = field
|
||||||
|
.id
|
||||||
|
.map(|id| CString::new(id).expect("unable to create cstring for field id"));
|
||||||
|
|
||||||
let field_type = match field.field_type {
|
let field_type = match field.field_type {
|
||||||
types::FieldType::Row(_) => FieldType_ROW,
|
types::FieldType::Row(_) => FieldType_ROW,
|
||||||
|
@ -353,8 +355,7 @@ pub fn show(form: types::Form) -> HashMap<String, String> {
|
||||||
let mut value_map: HashMap<String, String> = HashMap::new();
|
let mut value_map: HashMap<String, String> = HashMap::new();
|
||||||
|
|
||||||
extern "C" fn callback(values: *const ValuePair, size: c_int, map: *mut c_void) {
|
extern "C" fn callback(values: *const ValuePair, size: c_int, map: *mut c_void) {
|
||||||
let values: &[ValuePair] =
|
let values: &[ValuePair] = unsafe { std::slice::from_raw_parts(values, size as usize) };
|
||||||
unsafe { std::slice::from_raw_parts(values, size as usize) };
|
|
||||||
let map = map as *mut HashMap<String, String>;
|
let map = map as *mut HashMap<String, String>;
|
||||||
let map = unsafe { &mut (*map) };
|
let map = unsafe { &mut (*map) };
|
||||||
for pair in values.iter() {
|
for pair in values.iter() {
|
||||||
|
|
|
@ -136,12 +136,12 @@ pub struct WizardMetadata {
|
||||||
pub accessibility_image_2_path: *const c_char,
|
pub accessibility_image_2_path: *const c_char,
|
||||||
pub detected_os: c_int,
|
pub detected_os: c_int,
|
||||||
|
|
||||||
pub is_legacy_version_running: extern fn() -> c_int,
|
pub is_legacy_version_running: extern "C" fn() -> c_int,
|
||||||
pub backup_and_migrate: extern fn() -> c_int,
|
pub backup_and_migrate: extern "C" fn() -> c_int,
|
||||||
pub add_to_path: extern fn() -> c_int,
|
pub add_to_path: extern "C" fn() -> c_int,
|
||||||
pub enable_accessibility: extern fn() -> c_int,
|
pub enable_accessibility: extern "C" fn() -> c_int,
|
||||||
pub is_accessibility_enabled: extern fn() -> c_int,
|
pub is_accessibility_enabled: extern "C" fn() -> c_int,
|
||||||
pub on_completed: extern fn(),
|
pub on_completed: extern "C" fn(),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -152,7 +152,7 @@ pub struct WelcomeMetadata {
|
||||||
|
|
||||||
pub already_running: c_int,
|
pub already_running: c_int,
|
||||||
|
|
||||||
pub dont_show_again_changed: extern fn(c_int),
|
pub dont_show_again_changed: extern "C" fn(c_int),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -164,8 +164,8 @@ pub struct TroubleshootingMetadata {
|
||||||
pub error_sets: *const ErrorSetMetadata,
|
pub error_sets: *const ErrorSetMetadata,
|
||||||
pub error_sets_count: c_int,
|
pub error_sets_count: c_int,
|
||||||
|
|
||||||
pub dont_show_again_changed: extern fn(c_int),
|
pub dont_show_again_changed: extern "C" fn(c_int),
|
||||||
pub open_file: extern fn(*const c_char),
|
pub open_file: extern "C" fn(*const c_char),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
pub mod form;
|
pub mod form;
|
||||||
pub mod search;
|
pub mod search;
|
||||||
pub mod troubleshooting;
|
pub mod troubleshooting;
|
||||||
pub mod wizard;
|
|
||||||
pub mod welcome;
|
pub mod welcome;
|
||||||
|
pub mod wizard;
|
||||||
|
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
|
@ -40,8 +40,8 @@ pub mod types {
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
mod interop {
|
mod interop {
|
||||||
use super::types;
|
|
||||||
use super::super::interop::*;
|
use super::super::interop::*;
|
||||||
|
use super::types;
|
||||||
use std::ffi::{c_void, CString};
|
use std::ffi::{c_void, CString};
|
||||||
|
|
||||||
pub(crate) struct OwnedSearch {
|
pub(crate) struct OwnedSearch {
|
||||||
|
@ -102,7 +102,14 @@ mod interop {
|
||||||
hintText: hint_ptr,
|
hintText: hint_ptr,
|
||||||
});
|
});
|
||||||
|
|
||||||
Self { title, icon_path, hint, items, interop_items, _interop }
|
Self {
|
||||||
|
title,
|
||||||
|
icon_path,
|
||||||
|
hint,
|
||||||
|
items,
|
||||||
|
interop_items,
|
||||||
|
_interop,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ use std::path::PathBuf;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use crate::sys::interop::{ErrorSetMetadata, TroubleshootingMetadata};
|
use crate::sys::interop::{ErrorSetMetadata, TroubleshootingMetadata};
|
||||||
use crate::sys::troubleshooting::interop::{OwnedErrorSet};
|
use crate::sys::troubleshooting::interop::OwnedErrorSet;
|
||||||
use crate::sys::util::convert_to_cstring_or_null;
|
use crate::sys::util::convert_to_cstring_or_null;
|
||||||
use crate::troubleshooting::{TroubleshootingHandlers, TroubleshootingOptions};
|
use crate::troubleshooting::{TroubleshootingHandlers, TroubleshootingOptions};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
@ -39,10 +39,7 @@ mod interop {
|
||||||
use super::interop::{ErrorMetadata, ErrorSetMetadata};
|
use super::interop::{ErrorMetadata, ErrorSetMetadata};
|
||||||
|
|
||||||
use super::super::interop::*;
|
use super::super::interop::*;
|
||||||
use std::{
|
use std::{ffi::CString, os::raw::c_int};
|
||||||
ffi::{CString},
|
|
||||||
os::raw::c_int,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub(crate) struct OwnedErrorSet {
|
pub(crate) struct OwnedErrorSet {
|
||||||
file_path: Option<CString>,
|
file_path: Option<CString>,
|
||||||
|
@ -68,8 +65,10 @@ mod interop {
|
||||||
|
|
||||||
impl From<&ErrorSet> for OwnedErrorSet {
|
impl From<&ErrorSet> for OwnedErrorSet {
|
||||||
fn from(error_set: &ErrorSet) -> Self {
|
fn from(error_set: &ErrorSet) -> Self {
|
||||||
let file_path = error_set.file.as_ref().map(|file_path| CString::new(file_path.to_string_lossy().to_string())
|
let file_path = error_set.file.as_ref().map(|file_path| {
|
||||||
.expect("unable to convert file_path to CString"));
|
CString::new(file_path.to_string_lossy().to_string())
|
||||||
|
.expect("unable to convert file_path to CString")
|
||||||
|
});
|
||||||
|
|
||||||
let errors: Vec<OwnedErrorMetadata> =
|
let errors: Vec<OwnedErrorMetadata> =
|
||||||
error_set.errors.iter().map(|item| item.into()).collect();
|
error_set.errors.iter().map(|item| item.into()).collect();
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
* along with espanso. If not, see <https://www.gnu.org/licenses/>.
|
* along with espanso. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::os::raw::{c_char};
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
use std::os::raw::c_char;
|
||||||
|
|
||||||
pub fn convert_to_cstring_or_null(str: Option<String>) -> (Option<CString>, *const c_char) {
|
pub fn convert_to_cstring_or_null(str: Option<String>) -> (Option<CString>, *const c_char) {
|
||||||
let c_string =
|
let c_string =
|
||||||
|
|
|
@ -17,11 +17,14 @@
|
||||||
* along with modulo. If not, see <https://www.gnu.org/licenses/>.
|
* along with modulo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::os::raw::{c_int};
|
use std::os::raw::c_int;
|
||||||
use std::{ sync::Mutex};
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use crate::sys::util::convert_to_cstring_or_null;
|
use crate::sys::util::convert_to_cstring_or_null;
|
||||||
use crate::{sys::interop::{WelcomeMetadata}, welcome::{WelcomeHandlers, WelcomeOptions}};
|
use crate::{
|
||||||
|
sys::interop::WelcomeMetadata,
|
||||||
|
welcome::{WelcomeHandlers, WelcomeOptions},
|
||||||
|
};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref HANDLERS: Mutex<Option<WelcomeHandlers>> = Mutex::new(None);
|
static ref HANDLERS: Mutex<Option<WelcomeHandlers>> = Mutex::new(None);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with modulo. If not, see <https://www.gnu.org/licenses/>.
|
* along with modulo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::os::raw::{c_int};
|
use std::os::raw::c_int;
|
||||||
use std::{ffi::CString, sync::Mutex};
|
use std::{ffi::CString, sync::Mutex};
|
||||||
|
|
||||||
use crate::sys::interop::{
|
use crate::sys::interop::{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user