Skip to content

Commit

Permalink
fix(tauri): Webview::navigate unnecessarily borrows &mut self
Browse files Browse the repository at this point in the history
  • Loading branch information
WSH032 committed Jan 21, 2025
1 parent b8eb288 commit 6464386
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': 'patch: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 @@ -1264,7 +1264,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 @@ -1864,7 +1864,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 6464386

Please sign in to comment.