diff --git a/crates/core/src/document/djvu.rs b/crates/core/src/document/djvu.rs index 94c18e1..137afe7 100644 --- a/crates/core/src/document/djvu.rs +++ b/crates/core/src/document/djvu.rs @@ -266,7 +266,7 @@ impl Document for DjvuDocument { } impl DjvuDocument { - pub fn page(&self, index: usize) -> Option { + pub fn page(&self, index: usize) -> Option> { unsafe { let page = ddjvu_page_create_by_pageno(self.doc, index as libc::c_int); if page.is_null() { diff --git a/crates/core/src/document/djvulibre_sys.rs b/crates/core/src/document/djvulibre_sys.rs index d7cca2a..efbb00a 100644 --- a/crates/core/src/document/djvulibre_sys.rs +++ b/crates/core/src/document/djvulibre_sys.rs @@ -42,7 +42,7 @@ pub type RenderMode = libc::c_uint; pub type FormatStyle = libc::c_uint; #[link(name="djvulibre")] -extern { +extern "C" { pub fn ddjvu_context_create(name: *const libc::c_char) -> *mut ExoContext; pub fn ddjvu_context_release(ctx: *mut ExoContext); pub fn ddjvu_cache_set_size(ctx: *mut ExoContext, size: libc::c_ulong); diff --git a/crates/core/src/document/html/css.rs b/crates/core/src/document/html/css.rs index fe92878..142d5bf 100644 --- a/crates/core/src/document/html/css.rs +++ b/crates/core/src/document/html/css.rs @@ -120,7 +120,7 @@ pub struct CssParser<'a> { } impl<'a> CssParser<'a> { - pub fn new(input: &str) -> CssParser { + pub fn new(input: &str) -> CssParser<'_> { CssParser { input, offset: 0, diff --git a/crates/core/src/document/html/dom.rs b/crates/core/src/document/html/dom.rs index 191e958..2f677c5 100644 --- a/crates/core/src/document/html/dom.rs +++ b/crates/core/src/document/html/dom.rs @@ -151,19 +151,19 @@ impl XmlTree { unsafe { self.nodes.get_unchecked_mut(id.to_index()) } } - pub fn get(&self, id: NodeId) -> NodeRef { + pub fn get(&self, id: NodeId) -> NodeRef<'_> { NodeRef { id, node: self.node(id), tree: self } } - pub fn get_mut(&mut self, id: NodeId) -> NodeMut { + pub fn get_mut(&mut self, id: NodeId) -> NodeMut<'_> { NodeMut { id, tree: self } } - pub fn root(&self) -> NodeRef { + pub fn root(&self) -> NodeRef<'_> { self.get(NodeId::from_index(0)) } - pub fn root_mut(&mut self) -> NodeMut { + pub fn root_mut(&mut self) -> NodeMut<'_> { self.get_mut(NodeId::from_index(0)) } diff --git a/crates/core/src/document/html/xml.rs b/crates/core/src/document/html/xml.rs index a93e01c..a4164ba 100644 --- a/crates/core/src/document/html/xml.rs +++ b/crates/core/src/document/html/xml.rs @@ -9,7 +9,7 @@ pub struct XmlParser<'a> { } impl<'a> XmlParser<'a> { - pub fn new(input: &str) -> XmlParser { + pub fn new(input: &str) -> XmlParser<'_> { XmlParser { input, offset: 0, diff --git a/crates/core/src/document/mupdf_sys.rs b/crates/core/src/document/mupdf_sys.rs index a22e121..2f29640 100644 --- a/crates/core/src/document/mupdf_sys.rs +++ b/crates/core/src/document/mupdf_sys.rs @@ -62,7 +62,7 @@ pub enum FzImage {} #[link(name="mupdf")] #[link(name="mupdf_wrapper", kind="static")] -extern { +extern "C" { pub fn fz_new_context_imp(alloc_ctx: *const FzAllocContext, locks_ctx: *const FzLocksContext, cache_size: libc::size_t, version: *const libc::c_char) -> *mut FzContext; pub fn fz_drop_context(ctx: *mut FzContext); pub fn fz_register_document_handlers(ctx: *mut FzContext); diff --git a/crates/core/src/document/pdf.rs b/crates/core/src/document/pdf.rs index 6a68d90..c688874 100644 --- a/crates/core/src/document/pdf.rs +++ b/crates/core/src/document/pdf.rs @@ -106,7 +106,7 @@ unsafe impl Send for PdfDocument {} unsafe impl Sync for PdfDocument {} impl PdfDocument { - pub fn page(&self, index: usize) -> Option { + pub fn page(&self, index: usize) -> Option> { unsafe { let page = mp_load_page(self.ctx.0, self.doc, index as libc::c_int); if page.is_null() { diff --git a/crates/core/src/font/freetype_sys.rs b/crates/core/src/font/freetype_sys.rs index b1e3f25..8a92a96 100644 --- a/crates/core/src/font/freetype_sys.rs +++ b/crates/core/src/font/freetype_sys.rs @@ -23,7 +23,7 @@ pub type FtPos = libc::c_long; pub type FtFixed = libc::c_long; pub type FtGlyphFormat = libc::c_uint; pub type GlyphBBoxMode = libc::c_uint; -pub type FtGenericFinalizer = extern fn(*mut libc::c_void); +pub type FtGenericFinalizer = extern "C" fn(*mut libc::c_void); pub enum FtLibrary {} pub enum FtCharMap {} @@ -36,7 +36,7 @@ pub enum FtMemory {} pub enum FtStream {} #[link(name="freetype")] -extern { +extern "C" { pub fn FT_Init_FreeType(lib: *mut *mut FtLibrary) -> FtError; pub fn FT_Done_FreeType(lib: *mut FtLibrary) -> FtError; pub fn FT_New_Face(lib: *mut FtLibrary, path: *const libc::c_char, idx: libc::c_long, face: *mut *mut FtFace) -> FtError; diff --git a/crates/core/src/font/harfbuzz_sys.rs b/crates/core/src/font/harfbuzz_sys.rs index 52ed1e0..dda3e32 100644 --- a/crates/core/src/font/harfbuzz_sys.rs +++ b/crates/core/src/font/harfbuzz_sys.rs @@ -20,7 +20,7 @@ pub enum HbBuffer {} pub enum HbFont {} #[link(name="harfbuzz")] -extern { +extern "C" { pub fn hb_ft_font_create(face: *mut FtFace, destroy: *const libc::c_void) -> *mut HbFont; pub fn hb_ft_font_changed(font: *mut HbFont); pub fn hb_font_destroy(font: *mut HbFont); diff --git a/crates/core/src/font/mod.rs b/crates/core/src/font/mod.rs index b2f3633..211795f 100644 --- a/crates/core/src/font/mod.rs +++ b/crates/core/src/font/mod.rs @@ -100,7 +100,7 @@ pub const MD_SIZE: Style = Style { #[cfg(any(not(target_os = "linux"), target_arch = "arm"))] #[link(name="mupdf")] -extern { +extern "C" { // Based on the outputs of: // arm-linux-gnueabihf-readelf -Ws ./libs/libmupdf.so | grep '\b_binary_' | \ // grep -v '_size$' | awk '{print $8, strtonum($3)-1}' | sort -u @@ -267,7 +267,7 @@ extern { #[cfg(all(target_os = "linux", not(target_arch = "arm")))] #[link(name="mupdf")] -extern { +extern "C" { pub static _binary_resources_fonts_droid_DroidSansFallback_ttf_start: [libc::c_uchar; 3556308]; pub static _binary_resources_fonts_noto_NotoEmoji_Regular_ttf_start: [libc::c_uchar; 418804]; pub static _binary_resources_fonts_noto_NotoMusic_Regular_otf_start: [libc::c_uchar; 60812]; diff --git a/crates/core/src/helpers.rs b/crates/core/src/helpers.rs index 6fffe58..7feb927 100644 --- a/crates/core/src/helpers.rs +++ b/crates/core/src/helpers.rs @@ -26,7 +26,7 @@ lazy_static! { }; } -pub fn decode_entities(text: &str) -> Cow { +pub fn decode_entities(text: &str) -> Cow<'_, str> { if text.find('&').is_none() { return Cow::Borrowed(text); }