mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Merge pull request #1020 from danielrh/remove_formatting_undefined_behavior
revert undefined behavior introduction (recommended by clippy?)
This commit is contained in:
@@ -3,6 +3,9 @@ macro_rules! impl_raw_accessors(
|
||||
$(
|
||||
impl $t {
|
||||
#[inline]
|
||||
// can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub const unsafe fn raw(&self) -> $raw { self.raw }
|
||||
}
|
||||
)+
|
||||
|
||||
+7
-2
@@ -391,6 +391,9 @@ impl Rect {
|
||||
}
|
||||
|
||||
/// Returns the underlying C Rect.
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub fn raw(&self) -> *const sys::SDL_Rect {
|
||||
&self.raw
|
||||
}
|
||||
@@ -738,8 +741,10 @@ impl Point {
|
||||
pub fn raw_slice(slice: &[Point]) -> *const sys::SDL_Point {
|
||||
slice.as_ptr() as *const sys::SDL_Point
|
||||
}
|
||||
|
||||
pub fn raw(self) -> *const sys::SDL_Point {
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub fn raw(&self) -> *const sys::SDL_Point {
|
||||
&self.raw
|
||||
}
|
||||
|
||||
|
||||
@@ -219,6 +219,9 @@ impl<T> RendererContext<T> {
|
||||
}
|
||||
|
||||
/// Gets the raw pointer to the SDL_Renderer
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub fn raw(&self) -> *mut sys::SDL_Renderer {
|
||||
self.raw
|
||||
}
|
||||
@@ -784,6 +787,9 @@ fn ll_create_texture(context: *mut sys::SDL_Renderer,
|
||||
|
||||
/// Texture-creating methods for the renderer
|
||||
impl<T> TextureCreator<T> {
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub fn raw(&self) -> *mut sys::SDL_Renderer {
|
||||
self.context.raw()
|
||||
}
|
||||
@@ -922,6 +928,9 @@ impl<T> TextureCreator<T> {
|
||||
|
||||
/// Drawing methods
|
||||
impl<T: RenderTarget> Canvas<T> {
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub fn raw(&self) -> *mut sys::SDL_Renderer {
|
||||
self.context.raw()
|
||||
}
|
||||
@@ -2148,6 +2157,9 @@ impl<'r> Texture<'r> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub const fn raw(&self) -> *mut sys::SDL_Texture {
|
||||
self.raw
|
||||
}
|
||||
@@ -2328,6 +2340,9 @@ impl<> Texture<> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub const fn raw(&self) -> *mut sys::SDL_Texture {
|
||||
self.raw
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ pub struct RWops<'a> {
|
||||
}
|
||||
|
||||
impl<'a> RWops<'a> {
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub unsafe fn raw(&self) -> *mut sys::SDL_RWops { self.raw }
|
||||
|
||||
pub unsafe fn from_ll<'b>(raw: *mut sys::SDL_RWops) -> RWops<'b> {
|
||||
|
||||
@@ -281,6 +281,9 @@ impl SurfaceRef {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub fn raw(&self) -> *mut sys::SDL_Surface {
|
||||
self as *const SurfaceRef as *mut SurfaceRef as *mut () as *mut sys::SDL_Surface
|
||||
}
|
||||
|
||||
@@ -301,6 +301,9 @@ pub fn internal_load_font_at_index<'ttf,P: AsRef<Path>>(path: P, index: u32, pts
|
||||
|
||||
impl<'ttf,'r> Font<'ttf,'r> {
|
||||
/// Returns the underlying C font object.
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
unsafe fn raw(&self) -> *mut ttf::TTF_Font {
|
||||
self.raw
|
||||
}
|
||||
|
||||
@@ -1075,6 +1075,9 @@ impl From<Window> for CanvasBuilder {
|
||||
|
||||
impl Window {
|
||||
#[inline]
|
||||
// this can prevent introducing UB until
|
||||
// https://github.com/rust-lang/rust-clippy/issues/5953 is fixed
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||
pub fn raw(&self) -> *mut sys::SDL_Window { self.context.raw }
|
||||
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user