Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.

Commit b50d49d

Browse files
authored
bump nightly version used (#220)
* bump nightly version used * Attempt to fix tests * 2018 edition style fixes
1 parent 1b0500b commit b50d49d

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ matrix:
44

55
language: rust
66
rust:
7-
- nightly-2019-09-25
7+
- nightly-2020-07-12
88

99
branches:
1010
only:

build.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
use bindgen;
2-
use cc;
3-
use shlex;
4-
51
use std::io::{BufRead, BufReader};
62
use std::path::PathBuf;
73
use std::process::Command;
@@ -67,8 +63,8 @@ fn handle_kernel_version_cfg(bindings_path: &PathBuf) {
6763
for line in f.lines() {
6864
let line = line.unwrap();
6965
if let Some(type_and_value) = line.split("pub const LINUX_VERSION_CODE").nth(1) {
70-
if let Some(value) = type_and_value.split("=").nth(1) {
71-
let raw_version = value.split(";").next().unwrap();
66+
if let Some(value) = type_and_value.split('=').nth(1) {
67+
let raw_version = value.split(';').next().unwrap();
7268
version = Some(raw_version.trim().parse::<u64>().unwrap());
7369
break;
7470
}
@@ -174,7 +170,7 @@ fn main() {
174170
handle_kernel_symbols_cfg(&PathBuf::from(&kdir).join("Module.symvers"));
175171

176172
let mut builder = cc::Build::new();
177-
builder.compiler(env::var("CLANG").unwrap_or("clang".to_string()));
173+
builder.compiler(env::var("CLANG").unwrap_or_else(|_| "clang".to_string()));
178174
builder.target(&target);
179175
builder.warnings(false);
180176
builder.file("src/helpers.c");

src/filesystem.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ use alloc::boxed::Box;
22
use core::default::Default;
33
use core::marker;
44

5-
use bitflags;
6-
75
use crate::bindings;
86
use crate::c_types;
97
use crate::error;

src/types.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ impl Mode {
1818
pub struct CStr(str);
1919

2020
impl CStr {
21-
/// Creates a new CStr from a str without performing any additional checks. `data` _must_ end
22-
/// with a NUL byte, and should only have only a single NUL byte, or the string will be
23-
/// truncated.
21+
/// Creates a new CStr from a str without performing any additional checks.
22+
/// # Safety
23+
///
24+
/// `data` _must_ end with a NUL byte, and should only have only a single
25+
/// NUL byte, or the string will be truncated.
2426
pub const unsafe fn new_unchecked(data: &str) -> &CStr {
2527
&*(data as *const str as *const CStr)
2628
}

tests/chrdev/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#![no_std]
22

3+
extern crate alloc;
4+
35
use alloc::string::ToString;
46
use core::sync::atomic::{AtomicUsize, Ordering};
57

tests/random/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![no_std]
22

3-
use alloc::vec;
3+
extern crate alloc;
44

55
use linux_kernel_module::sysctl::{Sysctl, SysctlStorage};
66
use linux_kernel_module::{self, cstr, random, Mode};
@@ -16,7 +16,7 @@ impl SysctlStorage for EntropySource {
1616
&self,
1717
data: &mut linux_kernel_module::user_ptr::UserSlicePtrWriter,
1818
) -> (usize, linux_kernel_module::KernelResult<()>) {
19-
let mut storage = vec![0; data.len()];
19+
let mut storage = alloc::vec![0; data.len()];
2020
if let Err(e) = random::getrandom(&mut storage) {
2121
return (0, Err(e));
2222
}

0 commit comments

Comments
 (0)