Skip to content

Commit

Permalink
Fix warnings in new rust version
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigodd committed Dec 24, 2024
1 parent aad6dd4 commit e6d5bc4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions libretro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fn core() -> &'static Core {
// to this function. CORE is never mutate after being initialized, so subsequent calls to this
// function will not invalidate previous returned references.
unsafe {
#[allow(static_mut_refs)]
let core = CORE.get_or_insert_with(Core::default);

// assert this is single-threaded
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ where
{
use serde::de;
struct ScreenSizeVisitor;
impl<'de> de::Visitor<'de> for ScreenSizeVisitor {
impl de::Visitor<'_> for ScreenSizeVisitor {
type Value = Option<(u32, u32)>;

fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// To minimize changes between platforms, we still use Arc-Mutex on Wasm.
#![allow(clippy::arc_with_non_send_sync)]
// My deserializer macro triggers this warning, need to fix it in the dependency later.
#![allow(non_local_definitions)]

#[cfg(target_arch = "wasm32")]
pub static RESIZE: parking_lot::Mutex<Option<(u32, u32)>> = parking_lot::const_mutex(None);
Expand Down
4 changes: 2 additions & 2 deletions src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod loaded_files {

use super::config;

impl<'a> StyleLoaderCallback for super::Loader<'a> {
impl StyleLoaderCallback for super::Loader<'_> {
fn load_texture(&mut self, mut name: String) -> (u32, u32, u32) {
if name == "icons.png" {
name = format!("icons{}x.png", self.scale_factor.to_float()).to_string();
Expand Down Expand Up @@ -185,7 +185,7 @@ mod static_files {
include_bytes!("../assets/icons4x.png"),
],
};
impl<'a> StyleLoaderCallback for super::Loader<'a> {
impl StyleLoaderCallback for super::Loader<'_> {
fn load_texture(&mut self, name: String) -> (u32, u32, u32) {
if let Some(texture) = self.textures.get(&name) {
return *texture;
Expand Down
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod rom_loading_ui;
pub use rom_loading_ui::{create_rom_loading_ui, RomEntries};

struct Render<'a>(&'a mut dyn SpriteRender);
impl<'a> GuiRenderer for Render<'a> {
impl GuiRenderer for Render<'_> {
fn update_font_texture(&mut self, font_texture: u32, rect: [u32; 4], data_tex: &[u8]) {
let mut data = Vec::with_capacity(data_tex.len() * 4);
for byte in data_tex.iter() {
Expand Down

0 comments on commit e6d5bc4

Please sign in to comment.