Skip to content

Commit a0d0fa7

Browse files
committed
fix: Avoid unnecessary clone
1 parent 61333ed commit a0d0fa7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ impl FaupCompat {
255255
self.url.as_ref()?.fragment.as_deref()
256256
}
257257

258-
fn get_host(&self) -> Option<String> {
259-
Some(self.url.as_ref()?.host.clone())
258+
fn get_host(&self) -> Option<&str> {
259+
self.url.as_ref().map(|u| u.host.as_str())
260260
}
261261

262262
fn get_resource_path(&self) -> Option<&str> {
@@ -271,8 +271,8 @@ impl FaupCompat {
271271
self.url.as_ref()?.query.as_deref()
272272
}
273273

274-
fn get_scheme(&self) -> Option<String> {
275-
Some(self.url.as_ref()?.scheme.clone())
274+
fn get_scheme(&self) -> Option<&str> {
275+
self.url.as_ref().map(|u| u.scheme.as_str())
276276
}
277277

278278
fn get_port(&self) -> Option<u16> {

0 commit comments

Comments
 (0)