Skip to content

Commit

Permalink
fix(tauri): Webview::navigate unnecessarily borrows &mut self (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
WSH032 authored Jan 25, 2025
1 parent a2d36b8 commit 3dbcbe7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/webview-navigate-borrow-self.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'minor:bug'
---

`Webview::navigate` and `WebviewWindow::navigate` borrows `&self` instead of unnecessarily borrowing `&mut self`.
2 changes: 1 addition & 1 deletion crates/tauri/src/webview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/tauri/src/webview/webview_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ impl<R: Runtime> WebviewWindow<R> {
}

/// 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)
}

Expand Down

0 comments on commit 3dbcbe7

Please sign in to comment.