Fix some build warnings

- Mark some instances of unused fields and variables as as allowed,
  when they are used for memory management.
- Remove the use of some deprecated function.s

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2023-01-11 12:18:44 +01:00
parent 9a03911abf
commit c021df027a
5 changed files with 11 additions and 12 deletions

View file

@ -68,12 +68,15 @@ struct OS2Table {
}
#[derive(Debug)]
#[allow(unused)]
pub struct FontHandle {
// The font binary. This must stay valid for the lifetime of the font,
// if the font is created using FT_Memory_Face.
font_data: Arc<FontTemplateData>,
face: FT_Face,
handle: FontContextHandle,
// `context_handle` is unused, but here to ensure that the underlying
// FreeTypeLibraryHandle is not dropped.
context_handle: FontContextHandle,
can_do_fast_shaping: bool,
}
@ -144,7 +147,7 @@ impl FontHandleMethods for FontHandle {
let mut handle = FontHandle {
face: face,
font_data: template,
handle: fctx.clone(),
context_handle: fctx.clone(),
can_do_fast_shaping: false,
};
// TODO (#11310): Implement basic support for GPOS and GSUB.

View file

@ -75,6 +75,7 @@ pub struct FreeTypeLibraryHandle {
}
impl Drop for FreeTypeLibraryHandle {
#[allow(unused)]
fn drop(&mut self) {
assert!(!self.ctx.is_null());
unsafe {
@ -130,11 +131,7 @@ impl FontContextHandle {
FT_Add_Default_Modules(ctx);
FontContextHandle {
ctx: Rc::new(FreeTypeLibraryHandle {
ctx: ctx,
mem: mem,
user: user,
}),
ctx: Rc::new(FreeTypeLibraryHandle { ctx, mem, user }),
}
}
}

View file

@ -115,6 +115,7 @@ impl Deref for ServoJSPrincipalsRef<'_> {
}
}
#[allow(unused)]
pub unsafe extern "C" fn destroy_servo_jsprincipal(principals: *mut JSPrincipals) {
Box::from_raw(GetRustJSPrincipalsPrivate(principals) as *mut MutableOrigin);
DestroyRustJSPrincipals(principals);

View file

@ -38,7 +38,7 @@ use dom_struct::dom_struct;
use euclid::default::{Rect, Size2D};
use html5ever::{LocalName, Prefix};
use image::codecs::png::PngEncoder;
use image::ColorType;
use image::{ColorType, ImageEncoder};
use ipc_channel::ipc::{self as ipcchan, IpcSharedMemory};
use js::error::throw_type_error;
use js::rust::HandleValue;
@ -427,7 +427,7 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
// FIXME(nox): https://github.com/image-rs/image-png/issues/86
// FIXME(nox): https://github.com/image-rs/image-png/issues/87
PngEncoder::new(&mut png)
.encode(&file, self.Width(), self.Height(), ColorType::Rgba8)
.write_image(&file, self.Width(), self.Height(), ColorType::Rgba8)
.unwrap();
let mut url = "data:image/png;base64,".to_owned();
// FIXME(nox): Should this use base64::URL_SAFE?

View file

@ -51,9 +51,7 @@ impl ServoUrl {
}
pub fn into_string(self) -> String {
Arc::try_unwrap(self.0)
.unwrap_or_else(|s| (*s).clone())
.into_string()
String::from(Arc::try_unwrap(self.0).unwrap_or_else(|s| (*s).clone()))
}
pub fn into_url(self) -> Url {