mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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>
This commit is contained in:
parent
14cfcda3b3
commit
ff374c1428
3 changed files with 5 additions and 4 deletions
|
@ -4185,7 +4185,7 @@ impl ScriptThread {
|
||||||
None => vec![],
|
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(dummy_request_id, Ok(FetchMetadata::Unfiltered(meta)));
|
||||||
context.process_response_chunk(dummy_request_id, chunk);
|
context.process_response_chunk(dummy_request_id, chunk);
|
||||||
context.process_response_eof(
|
context.process_response_eof(
|
||||||
|
@ -4209,7 +4209,7 @@ impl ScriptThread {
|
||||||
|
|
||||||
let chunk = load_data.srcdoc.into_bytes();
|
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(dummy_request_id, Ok(FetchMetadata::Unfiltered(meta)));
|
||||||
context.process_response_chunk(dummy_request_id, chunk);
|
context.process_response_chunk(dummy_request_id, chunk);
|
||||||
context.process_response_eof(
|
context.process_response_eof(
|
||||||
|
|
|
@ -228,6 +228,7 @@ where
|
||||||
feature = "tracing",
|
feature = "tracing",
|
||||||
tracing::instrument(skip(embedder, window), fields(servo_profiling = true))
|
tracing::instrument(skip(embedder, window), fields(servo_profiling = true))
|
||||||
)]
|
)]
|
||||||
|
#[allow(clippy::new_ret_no_self)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
mut embedder: Box<dyn EmbedderMethods>,
|
mut embedder: Box<dyn EmbedderMethods>,
|
||||||
window: Rc<Window>,
|
window: Rc<Window>,
|
||||||
|
|
|
@ -23,7 +23,7 @@ use crate::{ReferrerPolicy, ResourceTimingType};
|
||||||
pub struct RequestId(usize);
|
pub struct RequestId(usize);
|
||||||
|
|
||||||
impl RequestId {
|
impl RequestId {
|
||||||
pub fn new() -> Self {
|
pub fn next() -> Self {
|
||||||
static NEXT_REQUEST_ID: AtomicUsize = AtomicUsize::new(0);
|
static NEXT_REQUEST_ID: AtomicUsize = AtomicUsize::new(0);
|
||||||
Self(NEXT_REQUEST_ID.fetch_add(1, Ordering::Relaxed))
|
Self(NEXT_REQUEST_ID.fetch_add(1, Ordering::Relaxed))
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ pub struct RequestBuilder {
|
||||||
impl RequestBuilder {
|
impl RequestBuilder {
|
||||||
pub fn new(url: ServoUrl, referrer: Referrer) -> RequestBuilder {
|
pub fn new(url: ServoUrl, referrer: Referrer) -> RequestBuilder {
|
||||||
RequestBuilder {
|
RequestBuilder {
|
||||||
id: RequestId::new(),
|
id: RequestId::next(),
|
||||||
method: Method::GET,
|
method: Method::GET,
|
||||||
url,
|
url,
|
||||||
headers: HeaderMap::new(),
|
headers: HeaderMap::new(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue