From c7e1b68918eccc8e289f378c5178ea5852a7feda Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 25 Apr 2019 17:46:16 -0700 Subject: [PATCH] Don't allocate in `SourceId::is_default_registry` This gets called quite a lot and doesn't need to allocate in the first place! --- src/cargo/core/source/source_id.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cargo/core/source/source_id.rs b/src/cargo/core/source/source_id.rs index 16b329336c1..f0ac5f52087 100644 --- a/src/cargo/core/source/source_id.rs +++ b/src/cargo/core/source/source_id.rs @@ -337,7 +337,7 @@ impl SourceId { Kind::Registry => {} _ => return false, } - self.inner.url.to_string() == CRATES_IO_INDEX + self.inner.url.as_str() == CRATES_IO_INDEX } /// Hashes `self`.