Skip to content

Commit

Permalink
Fix CI failure
Browse files Browse the repository at this point in the history
https://travis-ci.org/nix-rust/nix/jobs/557674308
error[E0433]: failed to resolve. Use of undeclared type or module `std`
  --> test/test_fcntl.rs:36:5
   |
36 |     std::fs::File::create(&old_path).unwrap();
   |     ^^^ Use of undeclared type or module `std`

This works locally (with Rust 1.36.0), and in hindsight I'm a little
confused why. I thought you needed the 2018 edition to not need ::
before std in this context. In any case, easy enough to fix.
  • Loading branch information
scottlamb committed Jul 12, 2019
1 parent c34f87c commit 582ed87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/test_fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use nix::fcntl::{openat, open, OFlag, readlink, readlinkat, rename, renameat};
use nix::sys::stat::Mode;
use nix::unistd::{close, read};
use tempfile::{self, NamedTempFile};
use std::fs::File;
use std::io::prelude::*;
use std::os::unix::fs;

Expand Down Expand Up @@ -33,7 +34,7 @@ fn test_openat() {
fn test_rename() {
let old_dir = tempfile::tempdir().unwrap();
let old_path = old_dir.path().join("old");
std::fs::File::create(&old_path).unwrap();
File::create(&old_path).unwrap();
let new_dir = tempfile::tempdir().unwrap();
let new_path = new_dir.path().join("new");
rename(&old_path, &new_path).unwrap();
Expand All @@ -44,7 +45,7 @@ fn test_rename() {
fn test_renameat() {
let old_dir = tempfile::tempdir().unwrap();
let old_dirfd = open(old_dir.path(), OFlag::empty(), Mode::empty()).unwrap();
std::fs::File::create(&old_dir.path().join("old")).unwrap();
File::create(&old_dir.path().join("old")).unwrap();
let new_dir = tempfile::tempdir().unwrap();
let new_dirfd = open(new_dir.path(), OFlag::empty(), Mode::empty()).unwrap();
renameat(old_dirfd, "old", new_dirfd, "new").unwrap();
Expand Down

0 comments on commit 582ed87

Please sign in to comment.