Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings #1138

Merged
merged 4 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
rustup default stable
shell: bash
- uses: Swatinem/rust-cache@v2
- run: cargo clippy
- run: cargo clippy --no-deps

rustfmt:
name: Rustfmt
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
//! ```

#![doc(html_root_url = "https://docs.rs/cc/1.0")]
#![cfg_attr(test, deny(warnings))]
#![deny(warnings)]
#![deny(missing_docs)]
#![deny(clippy::disallowed_methods)]

Expand Down Expand Up @@ -3942,7 +3942,7 @@ impl Build {
}
}
fn is_wasi_target(target: &str) -> bool {
const TARGETS: [&'static str; 7] = [
const TARGETS: [&str; 7] = [
"wasm32-wasi",
"wasm32-wasip1",
"wasm32-wasip1-threads",
Expand All @@ -3951,7 +3951,7 @@ impl Build {
"wasm32-unknown-wasi",
"wasm32-unknown-unknown",
];
return TARGETS.contains(&target);
TARGETS.contains(&target)
}

fn cuda_file_count(&self) -> usize {
Expand Down
4 changes: 2 additions & 2 deletions src/windows/find_tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ mod impl_ {
///
/// The function returned cannot be used after the handle is dropped.
unsafe fn get_proc_address<F>(&self, name: &[u8]) -> Option<F> {
let symbol = unsafe { GetProcAddress(self.0, name.as_ptr() as _) };
symbol.map(|symbol| unsafe { mem::transmute_copy(&symbol) })
let symbol = GetProcAddress(self.0, name.as_ptr() as _);
symbol.map(|symbol| mem::transmute_copy(&symbol))
}
}

Expand Down
39 changes: 19 additions & 20 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,17 +573,16 @@ fn macos_cpp_minimums() {
#[cfg(target_os = "macos")]
#[test]
fn clang_apple_tvos() {
for target in &["aarch64-apple-tvos"] {
let test = Test::clang();
test.gcc()
.__set_env("TVOS_DEPLOYMENT_TARGET", "9.0")
.target(target)
.host(target)
.file("foo.c")
.compile("foo");
let target = "aarch64-apple-tvos";
let test = Test::clang();
test.gcc()
.__set_env("TVOS_DEPLOYMENT_TARGET", "9.0")
.target(target)
.host(target)
.file("foo.c")
.compile("foo");

test.cmd(0).must_have("-mappletvos-version-min=9.0");
}
test.cmd(0).must_have("-mappletvos-version-min=9.0");
}

#[cfg(target_os = "macos")]
Expand Down Expand Up @@ -626,17 +625,17 @@ fn clang_apple_mac_catalyst() {
#[cfg(target_os = "macos")]
#[test]
fn clang_apple_tvsimulator() {
for target in &["x86_64-apple-tvos"] {
let test = Test::clang();
test.gcc()
.__set_env("TVOS_DEPLOYMENT_TARGET", "9.0")
.target(target)
.host(target)
.file("foo.c")
.compile("foo");
let target = "x86_64-apple-tvos";

test.cmd(0).must_have("-mappletvsimulator-version-min=9.0");
}
let test = Test::clang();
test.gcc()
.__set_env("TVOS_DEPLOYMENT_TARGET", "9.0")
.target(target)
.host(target)
.file("foo.c")
.compile("foo");

test.cmd(0).must_have("-mappletvsimulator-version-min=9.0");
}

#[cfg(target_os = "macos")]
Expand Down