scrap icon indicating copy to clipboard operation
scrap copied to clipboard

Eliminate build warnings

Open logiclrd opened this issue 1 month ago • 4 comments

This PR contains (hopefully) trivial changes to eliminate build warnings.

Before:

C:\code\scrap>cargo build 2>&1 | find "warning"
warning: no edition set: defaulting to the 2015 edition while the latest is 2024
warning: unexpected `cfg` condition name: `quartz`
warning: unexpected `cfg` condition name: `quartz`
warning: unexpected `cfg` condition name: `x11`
warning: unexpected `cfg` condition name: `dxgi`
warning: unexpected `cfg` condition name: `dxgi`
warning: unexpected `cfg` condition name: `quartz`
warning: unexpected `cfg` condition name: `x11`
warning: unexpected `cfg` condition name: `dxgi`
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: use of deprecated function `std::mem::uninitialized`: use `mem::MaybeUninit` instead
warning: type annotations needed
    = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
warning: taking a mutable reference to a `const` item
   = note: this warning originates in the macro `ENUM` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: the type `DXGI_OUTDUPL_DESC` does not permit being left uninitialized
warning: the type `DXGI_OUTDUPL_FRAME_INFO` does not permit being left uninitialized
warning: the type `DXGI_MAPPED_RECT` does not permit being left uninitialized
warning: the type `DXGI_MAPPED_RECT` does not permit being left uninitialized
warning: the type `D3D11_TEXTURE2D_DESC` does not permit being left uninitialized
warning: the type `DXGI_OUTPUT_DESC` does not permit being left uninitialized
warning: `scrap` (lib) generated 22 warnings

C:\code\scrap>

After:

C:\code\scrap>cargo build 2>&1 | find "warning"
warning: no edition set: defaulting to the 2015 edition while the latest is 2024

C:\code\scrap>

Please be gentle and check that I haven't made any mistakes. I have experience with lots of languages but Rust isn't one of them. 😛

logiclrd avatar Nov 01 '25 14:11 logiclrd

That final warning goes away with

edition = "2015"

...in Cargo.toml. I don't know enough about Rust to know if this is a safe change or not, though.

logiclrd avatar Nov 01 '25 14:11 logiclrd

I guess it must be because the code doesn't compile at all with any of the other possible values. 😁

logiclrd avatar Nov 01 '25 14:11 logiclrd

C:\code\scrap>cargo clean -p scrap
     Removed 67 files, 9.0MiB total

C:\code\scrap>cargo build
   Compiling scrap v0.5.0 (C:\code\scrap)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.68s

C:\code\scrap>

logiclrd avatar Nov 01 '25 14:11 logiclrd

Oh wow, I was working on another project that uses Scrap and didn't realize it was using its own embedded copy of the code with many modifications and extensions, and when I came here to the source repo, I didn't notice that this project hasn't been updated in 6 years. 😛

logiclrd avatar Nov 01 '25 15:11 logiclrd