chore: remove unnecessary anonymous lifetimes (#1829)

This commit is contained in:
Ngo Iok Ui (Wu Yu Wei) 2021-05-14 21:29:54 +08:00 committed by GitHub
parent 9a60c1053f
commit c1f8e11342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -341,7 +341,7 @@ where
/// struct MyString(String);
///
/// #[tauri::command]
/// fn int_command(state: State<'_, MyInt>) -> String {
/// fn int_command(state: State<MyInt>) -> String {
/// format!("The stateful int is: {}", state.0)
/// }
///

View File

@ -22,6 +22,6 @@ pub fn simple_command(argument: String) {
}
#[command]
pub fn stateful_command(argument: Option<String>, state: State<'_, super::MyState>) {
pub fn stateful_command(argument: Option<String>, state: State<super::MyState>) {
println!("{:?} {:?}", argument, state.inner());
}

View File

@ -54,8 +54,8 @@ mod ui {
#[tauri::command]
fn close_splashscreen<P: Params>(
_: Window<P>, // force inference of P
splashscreen: State<'_, SplashscreenWindow<P>>,
main: State<'_, MainWindow<P>>,
splashscreen: State<SplashscreenWindow<P>>,
main: State<MainWindow<P>>,
) {
// Close splashscreen
splashscreen.0.lock().unwrap().close().unwrap();

View File

@ -23,17 +23,17 @@ struct Counter(AtomicUsize);
struct Database(Arc<Mutex<HashMap<String, String>>>);
#[tauri::command]
fn increment_counter(counter: State<'_, Counter>) -> usize {
fn increment_counter(counter: State<Counter>) -> usize {
counter.0.fetch_add(1, Ordering::Relaxed) + 1
}
#[tauri::command]
fn db_insert(key: String, value: String, db: State<'_, Database>) {
fn db_insert(key: String, value: String, db: State<Database>) {
db.0.lock().unwrap().insert(key, value);
}
#[tauri::command]
fn db_read(key: String, db: State<'_, Database>) -> Option<String> {
fn db_read(key: String, db: State<Database>) -> Option<String> {
db.0.lock().unwrap().get(&key).cloned()
}