diff --git a/.changes/webview-navigate-borrow-self.md b/.changes/webview-navigate-borrow-self.md new file mode 100644 index 000000000000..f80cf726e34d --- /dev/null +++ b/.changes/webview-navigate-borrow-self.md @@ -0,0 +1,5 @@ +--- +'tauri': 'minor:bug' +--- + +`Webview::navigate` and `WebviewWindow::navigate` borrows `&self` instead of unnecessarily borrowing `&mut self`. diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs index 7e8b1f8d262d..5d1e8c875714 100644 --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -1284,7 +1284,7 @@ fn main() { } /// Navigates the webview to the defined url. - pub fn navigate(&mut self, url: Url) -> crate::Result<()> { + pub fn navigate(&self, url: Url) -> crate::Result<()> { self.webview.dispatcher.navigate(url).map_err(Into::into) } diff --git a/crates/tauri/src/webview/webview_window.rs b/crates/tauri/src/webview/webview_window.rs index 8a2dda4eaef1..22a1e0b74ca0 100644 --- a/crates/tauri/src/webview/webview_window.rs +++ b/crates/tauri/src/webview/webview_window.rs @@ -1883,7 +1883,7 @@ impl WebviewWindow { } /// Navigates the webview to the defined url. - pub fn navigate(&mut self, url: Url) -> crate::Result<()> { + pub fn navigate(&self, url: Url) -> crate::Result<()> { self.webview.navigate(url) }