aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkomuhangi <51232461+jahielkomu@users.noreply.github.com>2024-10-18 12:45:40 +0300
committerGitHub <noreply@github.com>2024-10-18 09:45:40 +0000
commitff374c1428bbcca76c9ba6f565e7e5ccdbf4fc10 (patch)
tree0011d6e17dc573aed26af26381350f1943a79d27
parent14cfcda3b3dc8a0421b9dcc5bca8b93a91734bad (diff)
downloadservo-ff374c1428bbcca76c9ba6f565e7e5ccdbf4fc10.tar.gz
servo-ff374c1428bbcca76c9ba6f565e7e5ccdbf4fc10.zip
clippy: Rename `RequestId::new()` to `RequestId::next()` and fix one more issue in `servo/lib.rs` (#33881)
* clippy: fix clippy warnings in components/ Signed-off-by: jahielkomu <ktumuhairwe24@gmail.com> * Addressed changes from the PR Signed-off-by: jahielkomu <ktumuhairwe24@gmail.com> --------- Signed-off-by: jahielkomu <ktumuhairwe24@gmail.com>
-rw-r--r--components/script/script_thread.rs4
-rw-r--r--components/servo/lib.rs1
-rw-r--r--components/shared/net/request.rs4
3 files changed, 5 insertions, 4 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 4424307269d..797108a0ee4 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -4185,7 +4185,7 @@ impl ScriptThread {
None => vec![],
};
- let dummy_request_id = RequestId::new();
+ let dummy_request_id = RequestId::next();
context.process_response(dummy_request_id, Ok(FetchMetadata::Unfiltered(meta)));
context.process_response_chunk(dummy_request_id, chunk);
context.process_response_eof(
@@ -4209,7 +4209,7 @@ impl ScriptThread {
let chunk = load_data.srcdoc.into_bytes();
- let dummy_request_id = RequestId::new();
+ let dummy_request_id = RequestId::next();
context.process_response(dummy_request_id, Ok(FetchMetadata::Unfiltered(meta)));
context.process_response_chunk(dummy_request_id, chunk);
context.process_response_eof(
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 9407f13f965..86c7d07dfe1 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -228,6 +228,7 @@ where
feature = "tracing",
tracing::instrument(skip(embedder, window), fields(servo_profiling = true))
)]
+ #[allow(clippy::new_ret_no_self)]
pub fn new(
mut embedder: Box<dyn EmbedderMethods>,
window: Rc<Window>,
diff --git a/components/shared/net/request.rs b/components/shared/net/request.rs
index 4fc1f874b7f..362054684c4 100644
--- a/components/shared/net/request.rs
+++ b/components/shared/net/request.rs
@@ -23,7 +23,7 @@ use crate::{ReferrerPolicy, ResourceTimingType};
pub struct RequestId(usize);
impl RequestId {
- pub fn new() -> Self {
+ pub fn next() -> Self {
static NEXT_REQUEST_ID: AtomicUsize = AtomicUsize::new(0);
Self(NEXT_REQUEST_ID.fetch_add(1, Ordering::Relaxed))
}
@@ -285,7 +285,7 @@ pub struct RequestBuilder {
impl RequestBuilder {
pub fn new(url: ServoUrl, referrer: Referrer) -> RequestBuilder {
RequestBuilder {
- id: RequestId::new(),
+ id: RequestId::next(),
method: Method::GET,
url,
headers: HeaderMap::new(),