Skip to content

Commit

Permalink
Fix Clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Oct 30, 2020
1 parent 290265f commit 4aafd94
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub enum Lang {

/// A kind of item to which the C volatile qualifier could apply.
#[derive(Debug)]
#[allow(clippy::manual_non_exhaustive)] // FIXME: Use `#[non_exhaustive]` in the future.
pub enum VolatileItemKind {
/// A struct field (struct_name, field_name)
StructField(String, String),
Expand Down Expand Up @@ -1691,7 +1692,7 @@ impl<'a> Generator<'a> {
ty = rust_ty
));
} else if rust_ty.starts_with('[') && rust_ty.ends_with(']') {
let c_ptr_ty = c_ty.split(' ').nth(0).unwrap();
let c_ptr_ty = c_ty.split(' ').next().unwrap();
let mut lens = Vec::new();
for i in c_ty.split(' ').skip(1) {
lens.push(i);
Expand Down
2 changes: 1 addition & 1 deletion testcrate/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(0);
let profile = env::var("PROFILE").unwrap_or(String::new());
let profile = env::var("PROFILE").unwrap_or_default();
if profile == "release" || opt_level >= 2 {
println!("cargo:rustc-cfg=optimized");
}
Expand Down
3 changes: 2 additions & 1 deletion testcrate/src/t1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use libc::*;

pub type T1Foo = i32;
pub const T1S: &'static str = "foo";
pub const T1S: &str = "foo";

pub const T1N: i32 = 5;

Expand Down Expand Up @@ -69,6 +69,7 @@ extern "C" {
pub fn T1e(a: c_uint, b: *const T1Bar);

#[link_name = "T1f"]
#[allow(clippy::unused_unit)]
pub fn f() -> ();

pub fn T1g(a: *mut [i32; 4]);
Expand Down
2 changes: 1 addition & 1 deletion testcrate/src/t2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub union T2Union {
pub const T2C: i32 = 5;

i! {
pub const T2S: &'static str = "b";
pub const T2S: &str = "b";
}

extern "C" {
Expand Down

0 comments on commit 4aafd94

Please sign in to comment.