Skip to content

Commit

Permalink
clippy fixes + comment out CORETEXT flag to make it compile on aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
asibahi committed Apr 12, 2024
1 parent f4d5417 commit 8019dd7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
14 changes: 7 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ fn main() {
let target = env::var("TARGET").unwrap();

println!("cargo:rerun-if-env-changed=HARFBUZZ_SYS_NO_PKG_CONFIG");
if target.contains("wasm32") || env::var_os("HARFBUZZ_SYS_NO_PKG_CONFIG").is_none() {
if pkg_config::probe_library("harfbuzz").is_ok() {
return;
}
if (target.contains("wasm32") || env::var_os("HARFBUZZ_SYS_NO_PKG_CONFIG").is_none())
&& pkg_config::probe_library("harfbuzz").is_ok()
{
return;
}

let mut cfg = cc::Build::new();
Expand All @@ -27,9 +27,9 @@ fn main() {
cfg.define("HAVE_PTHREAD", "1");
}

if target.contains("apple") {
cfg.define("HAVE_CORETEXT", "1");
}
// if target.contains("apple") {
// cfg.define("HAVE_CORETEXT", "1");
// }

if target.contains("windows-gnu") {
cfg.flag("-Wa,-mbig-obj");
Expand Down
3 changes: 1 addition & 2 deletions src/blob.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::os::raw::c_void;

use std;
use std::marker::PhantomData;

use std::fmt;
Expand Down Expand Up @@ -89,7 +88,7 @@ impl<'a> Blob<'a> {
let data = Box::into_raw(boxxed);

extern "C" fn destroy<U>(ptr: *mut c_void) {
unsafe { Box::from_raw(ptr as *mut U) };
_ = unsafe { Box::from_raw(ptr as *mut U) };
}

let hb_blob = unsafe {
Expand Down
9 changes: 2 additions & 7 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ impl GlyphInfo {
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash)]
pub enum ClusterLevel {
#[default]
MonotoneGraphemes,
MonotoneCharacters,
Characters,
Expand All @@ -185,12 +186,6 @@ impl ClusterLevel {
}
}

impl Default for ClusterLevel {
fn default() -> Self {
ClusterLevel::MonotoneGraphemes
}
}

#[derive(Debug)]
pub(crate) struct GenericBuffer {
raw: NonNull<hb_buffer_t>,
Expand Down
1 change: 0 additions & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ pub enum TagFromStrErr {
ZeroLengthString,
}

use std;
use std::str::FromStr;

impl FromStr for Tag {
Expand Down
5 changes: 2 additions & 3 deletions src/face.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std;
use std::os::raw::c_void;
use std::ptr::NonNull;

Expand Down Expand Up @@ -56,7 +55,7 @@ impl<'a> Face<'a> {

/// Create a face from the bytes of a given slice and an index specifying
/// which font to read from an OpenType font collection.
pub fn from_bytes<'b>(bytes: &'b [u8], index: u32) -> Owned<Face<'b>> {
pub fn from_bytes(bytes: &[u8], index: u32) -> Owned<Face<'_>> {
let blob = Blob::with_bytes(bytes);
Face::new(blob, index)
}
Expand All @@ -68,7 +67,7 @@ impl<'a> Face<'a> {
F: 'b + Send + Sync + FnMut(Tag) -> Option<Shared<Blob<'b>>>,
{
extern "C" fn destroy_box<U>(ptr: *mut c_void) {
unsafe { Box::from_raw(ptr as *mut U) };
_ = unsafe { Box::from_raw(ptr as *mut U) };
}
extern "C" fn table_func<'b, F>(
_: *mut hb_face_t,
Expand Down
3 changes: 1 addition & 2 deletions src/font.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std;
use std::ptr::NonNull;

use std::os::raw::c_void;
Expand Down Expand Up @@ -58,7 +57,7 @@ impl FontExtents {
pub type GlyphExtents = hb_glyph_extents_t;

pub(crate) extern "C" fn destroy_box<U>(ptr: *mut c_void) {
unsafe { Box::from_raw(ptr as *mut U) };
_ = unsafe { Box::from_raw(ptr as *mut U) };
}

/// A type representing a single font (i.e. a specific combination of typeface,
Expand Down

0 comments on commit 8019dd7

Please sign in to comment.