Various fixes (#154)

* Cargo clippy

* Fix typo
This commit is contained in:
Jay Oster 2021-03-29 00:52:43 -07:00 committed by GitHub
parent 11c5961e4c
commit 9bfed17a7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 16 deletions

View file

@ -12,6 +12,6 @@
## Policy
The table above will be kept to up-to-date in lock-step with CI on the main branch in GitHub. It may contain information about unreleased and yanked versions. It is the user's responsibility to consult with the [`pixels` versions page](https://crates.io/crates/pixels/versions) on `crates.io` to verify version status.
The table above will be kept up-to-date in lock-step with CI on the main branch in GitHub. It may contain information about unreleased and yanked versions. It is the user's responsibility to consult with the [`pixels` versions page](https://crates.io/crates/pixels/versions) on `crates.io` to verify version status.
The MSRV will be chosen as the minimum version of `rustc` that can successfully pass CI, including documentation, lints, and all examples. For this reason, the minimum version _supported_ may be higher than the minimum version _required_ to compile the `pixels` crate itself.

View file

@ -287,12 +287,10 @@ impl World {
// Draw the invaders
for row in &self.invaders.grid {
for col in row {
if let Some(invader) = col {
for invader in row.iter().flatten() {
blit(screen, &invader.pos, &invader.sprite);
}
}
}
// Draw the shields
for shield in &self.shields {

View file

@ -1,8 +1,8 @@
#![deny(clippy::all)]
pub struct RWH;
pub struct Rwh;
unsafe impl raw_window_handle::HasRawWindowHandle for RWH {
unsafe impl raw_window_handle::HasRawWindowHandle for Rwh {
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
#[cfg(target_os = "macos")]
return raw_window_handle::RawWindowHandle::MacOS(

View file

@ -11,7 +11,7 @@ pub struct PixelsBuilder<'req, 'dev, 'win, W: HasRawWindowHandle> {
backend: wgpu::BackendBit,
width: u32,
height: u32,
pixel_aspect_ratio: f64,
_pixel_aspect_ratio: f64,
present_mode: wgpu::PresentMode,
surface_texture: SurfaceTexture<'win, W>,
texture_format: wgpu::TextureFormat,
@ -25,7 +25,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'dev, 'win, W>
///
/// ```no_run
/// # use pixels::PixelsBuilder;
/// # let window = pixels_mocks::RWH;
/// # let window = pixels_mocks::Rwh;
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
/// let mut pixels = PixelsBuilder::new(256, 240, surface_texture)
/// .request_adapter_options(wgpu::RequestAdapterOptions {
@ -54,7 +54,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'dev, 'win, W>
backend: wgpu::BackendBit::PRIMARY,
width,
height,
pixel_aspect_ratio: 1.0,
_pixel_aspect_ratio: 1.0,
present_mode: wgpu::PresentMode::Fifo,
surface_texture,
texture_format: wgpu::TextureFormat::Rgba8UnormSrgb,
@ -110,7 +110,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'dev, 'win, W>
) -> PixelsBuilder<'req, 'dev, 'win, W> {
assert!(pixel_aspect_ratio > 0.0);
self.pixel_aspect_ratio = pixel_aspect_ratio;
self._pixel_aspect_ratio = pixel_aspect_ratio;
self
}

View file

@ -170,7 +170,7 @@ impl Pixels {
///
/// ```no_run
/// # use pixels::Pixels;
/// # let window = pixels_mocks::RWH;
/// # let window = pixels_mocks::Rwh;
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
/// let mut pixels = Pixels::new(320, 240, surface_texture)?;
/// # Ok::<(), pixels::Error>(())
@ -272,7 +272,7 @@ impl Pixels {
///
/// ```no_run
/// # use pixels::Pixels;
/// # let window = pixels_mocks::RWH;
/// # let window = pixels_mocks::Rwh;
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
/// let mut pixels = Pixels::new(320, 240, surface_texture)?;
///
@ -310,7 +310,7 @@ impl Pixels {
///
/// ```no_run
/// # use pixels::Pixels;
/// # let window = pixels_mocks::RWH;
/// # let window = pixels_mocks::Rwh;
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
/// let mut pixels = Pixels::new(320, 240, surface_texture)?;
///
@ -411,7 +411,7 @@ impl Pixels {
///
/// ```no_run
/// # use pixels::Pixels;
/// # let window = pixels_mocks::RWH;
/// # let window = pixels_mocks::Rwh;
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
/// const WIDTH: u32 = 320;
/// const HEIGHT: u32 = 240;
@ -471,7 +471,7 @@ impl Pixels {
///
/// ```no_run
/// # use pixels::Pixels;
/// # let window = pixels_mocks::RWH;
/// # let window = pixels_mocks::Rwh;
/// # let surface_texture = pixels::SurfaceTexture::new(1024, 768, &window);
/// const WIDTH: u32 = 320;
/// const HEIGHT: u32 = 240;