Check style using rustfmt and reformat

This commit is contained in:
gnzlbg 2019-02-07 11:13:38 +01:00
parent f9b96ee6a1
commit 0a5484ea72
6 changed files with 92 additions and 77 deletions

View File

@ -81,7 +81,11 @@ matrix:
- env: TARGET=wasm32-unknown-unknown
install: rustup target add $TARGET
script: cargo build --no-default-features --target $TARGET --release
- name: "Style"
install: rustup component add rustfmt-preview
script:
- rustc ci/style.rs && ./style src
- cargo fmt --all -- --check
- name: "Shellcheck"
install: true
script:
@ -102,7 +106,7 @@ script:
export CARGO_TARGET_DIR=`pwd`/target;
sh ci/run.sh $TARGET;
fi
- rustc ci/style.rs && ./style src
env:
global:
secure: "e2/3QjgRN9atOuSHp22TrYG7QVKcYUWY48Hi9b60w+r1+BhPkTseIJLte7WefRhdXtqpjjUJTooKDhnurFOeHaCT+nmBgiv+FPU893sBl4bhesY4m0vgUJVbNZcs6lTImYekWVb+aqjGdgV/XAgCw7c3kPmrZV0MzGDWL64Xaps="

View File

@ -7,13 +7,10 @@ use std::env;
#[cfg(unix)]
fn do_cc() {
cc::Build::new()
.file("src/cmsg.c")
.compile("cmsg");
cc::Build::new().file("src/cmsg.c").compile("cmsg");
}
#[cfg(not(unix))]
fn do_cc() {
}
fn do_cc() {}
fn do_ctest() {
let target = env::var("TARGET").unwrap();
@ -671,7 +668,11 @@ fn do_ctest() {
// MFD_HUGETLB is not available in some older libc versions on the CI builders. On the
// x86_64 and i686 builders it seems to be available for all targets, so at least test
// it there.
"MFD_HUGETLB" if !(x86_64 || i686) || musl || (x86_64 && android)=> true,
"MFD_HUGETLB"
if !(x86_64 || i686) || musl || (x86_64 && android) =>
{
true
}
"DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG"
| "DT_LNK" | "DT_SOCK"

View File

@ -9,10 +9,12 @@ mod t {
use libc::{self, c_uchar, c_uint, c_void, cmsghdr, msghdr};
use std::mem;
extern {
extern "C" {
pub fn cmsg_firsthdr(msgh: *const msghdr) -> *mut cmsghdr;
pub fn cmsg_nxthdr(mhdr: *const msghdr,
cmsg: *const cmsghdr) -> *mut cmsghdr;
pub fn cmsg_nxthdr(
mhdr: *const msghdr,
cmsg: *const cmsghdr,
) -> *mut cmsghdr;
pub fn cmsg_space(length: c_uint) -> usize;
pub fn cmsg_len(length: c_uint) -> usize;
pub fn cmsg_data(cmsg: *const cmsghdr) -> *mut c_uchar;

3
rustfmt.toml Normal file
View File

@ -0,0 +1,3 @@
max_width = 79
comment_width = 79
error_on_line_overflow = true

View File

@ -155,7 +155,10 @@
#![cfg_attr(feature = "rustc-dep-of-std", feature(no_core))]
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
#![cfg_attr(feature = "rustc-dep-of-std", allow(warnings))]
#![cfg_attr(not(any(feature = "use_std", feature = "rustc-dep-of-std")), no_std)]
#![cfg_attr(
not(any(feature = "use_std", feature = "rustc-dep-of-std")),
no_std
)]
// Enable lints
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]
#![deny(missing_copy_implementations)]

View File

@ -90,7 +90,9 @@ macro_rules! __item {
#[allow(unused_macros)]
macro_rules! align_const {
($($(#[$attr:meta])* pub const $name:ident : $t1:ty = $t2:ident { $($field:tt)* };)*) => ($(
($($(#[$attr:meta])*
pub const $name:ident : $t1:ty
= $t2:ident { $($field:tt)* };)*) => ($(
#[cfg(feature = "align")]
$(#[$attr])*
pub const $name : $t1 = $t2 {