Skip to content

Commit

Permalink
chore: remove unnecessary anonymous lifetimes (#1829)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ngo Iok Ui (Wu Yu Wei) authored May 14, 2021
1 parent 9a60c10 commit c1f8e11
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion core/tauri/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
/// }
///
Expand Down
2 changes: 1 addition & 1 deletion examples/commands/src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
4 changes: 2 additions & 2 deletions examples/splashscreen/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions examples/state/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit c1f8e11

Please sign in to comment.