Skip to content

Commit a3daa42

Browse files
oluwatobisspull[bot]
authored andcommitted
clippy: Fix default_constructed_unit_structs warnings in components (servo#31827)
* clippy: Fix default constructed unit structs warnings * refactor: Allow default constructed unit structs to avoid gfx build error
1 parent 9244e26 commit a3daa42

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

components/gfx/font_cache_thread.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ impl FontCacheThread {
491491
// TODO: Allow users to specify these.
492492
let generic_fonts = populate_generic_fonts();
493493

494+
#[allow(clippy::default_constructed_unit_structs)]
494495
let mut cache = FontCache {
495496
port,
496497
channel_to_self,

components/gfx/font_context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pub struct FontContext<S: FontSource> {
6565

6666
impl<S: FontSource> FontContext<S> {
6767
pub fn new(font_source: S) -> FontContext<S> {
68+
#[allow(clippy::default_constructed_unit_structs)]
6869
let handle = FontContextHandle::default();
6970
FontContext {
7071
platform_handle: handle,

components/script/dom/bindings/buffer_source.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ where
7777
let heap_buffer_source = match init {
7878
HeapTypedArrayInit::Buffer(buffer_source) => HeapBufferSource {
7979
buffer_source,
80-
phantom: PhantomData::default(),
80+
phantom: PhantomData,
8181
},
8282
HeapTypedArrayInit::Info { len, cx } => {
8383
rooted!(in (*cx) let mut array = ptr::null_mut::<JSObject>());
@@ -125,7 +125,7 @@ where
125125
pub fn default() -> HeapBufferSource<T> {
126126
HeapBufferSource {
127127
buffer_source: BufferSource::Default(Box::new(Heap::default())),
128-
phantom: PhantomData::default(),
128+
phantom: PhantomData,
129129
}
130130
}
131131

@@ -436,7 +436,7 @@ where
436436

437437
HeapBufferSource {
438438
buffer_source: BufferSource::ArrayBuffer(Heap::boxed(*array_buffer)),
439-
phantom: PhantomData::default(),
439+
phantom: PhantomData,
440440
}
441441
}
442442
}

0 commit comments

Comments
 (0)