From f6dcaae1d743149cf6cc013a5e988f8e247b540c Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 19 Mar 2015 11:57:08 -0700 Subject: [PATCH] rust updates - no need to declare feature io/path anymore - change range(start,end) to (start..end) - deprecated warnings remain for FileType & PosixPath, used by rust-fuse --- src/inode.rs | 5 +++-- src/lib.rs | 2 -- src/main.rs | 1 - src/reference.rs | 7 ++++--- src/root.rs | 9 +++++---- src/tree.rs | 9 +++++---- tests/self.rs | 1 - 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/inode.rs b/src/inode.rs index dd4c629..216d895 100644 --- a/src/inode.rs +++ b/src/inode.rs @@ -11,6 +11,7 @@ use libc; use libc::consts::os::posix88; use std::collections::hash_map; use std::old_io::FileType; +use std::old_path::PosixPath; use blob; use tree; @@ -33,7 +34,7 @@ pub enum Id { /// A generic interface for different Git object types to implement. pub trait Inode: Send { /// Find a directory entry in this Inode by name. - fn lookup(&mut self, _repo: &git2::Repository, _name: &Path + fn lookup(&mut self, _repo: &git2::Repository, _name: &PosixPath ) -> Result { Err(posix88::ENOTDIR) } @@ -62,7 +63,7 @@ pub trait Inode: Send { /// Read directory entries from this Inode. fn readdir<'a>(&'a mut self, _repo: &git2::Repository, _offset: u64, - _add: Box bool + 'a> + _add: Box bool + 'a> ) -> Result<(), libc::c_int> { Err(posix88::ENOTDIR) } diff --git a/src/lib.rs b/src/lib.rs index 8cf37fb..55ee092 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,11 +10,9 @@ #![feature(asm)] #![feature(core)] -#![feature(io)] #![feature(libc)] #![feature(old_io)] #![feature(old_path)] -#![feature(path)] #![feature(std_misc)] #![deny(missing_docs)] diff --git a/src/main.rs b/src/main.rs index dd032e8..77a0a3f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,7 +16,6 @@ //! //! - MOUNTPOINT: The target to mount the filesystem. Defaults to GIT_DIR/fs. -#![feature(path)] #![feature(std_misc)] extern crate gitfs; diff --git a/src/reference.rs b/src/reference.rs index fbe0bbb..41d6188 100644 --- a/src/reference.rs +++ b/src/reference.rs @@ -12,6 +12,7 @@ use libc::consts::os::posix88; use std::collections::hash_map; use std::default::Default; use std::old_io::{FileType, USER_DIR}; +use std::old_path::PosixPath; use inode; @@ -19,7 +20,7 @@ use inode; /// Represents a virtual directory in reference paths /// (e.g. `refs/heads/master` needs intermediate `refs/` and `refs/heads/`) pub struct RefDir { - entries: hash_map::HashMap, + entries: hash_map::HashMap, } impl RefDir { @@ -31,7 +32,7 @@ impl RefDir { } impl inode::Inode for RefDir { - fn lookup(&mut self, _repo: &git2::Repository, name: &Path + fn lookup(&mut self, _repo: &git2::Repository, name: &PosixPath ) -> Result { self.entries.get(name).cloned().ok_or(posix88::ENOENT) } @@ -49,7 +50,7 @@ impl inode::Inode for RefDir { } fn readdir<'a>(&mut self, _repo: &git2::Repository, offset: u64, - mut add: Box bool + 'a> + mut add: Box bool + 'a> ) -> Result<(), libc::c_int> { if offset < self.entries.len() as u64 { for (path, &id) in self.entries.iter().skip(offset as usize) { diff --git a/src/root.rs b/src/root.rs index 5257089..b7cf501 100644 --- a/src/root.rs +++ b/src/root.rs @@ -10,6 +10,7 @@ use git2; use libc; use libc::consts::os::posix88; use std::old_io::{FileType, USER_DIR}; +use std::old_path::PosixPath; use inode; use inode::{FileAttr, Id, Inode}; @@ -30,7 +31,7 @@ impl Root { } impl Inode for Root { - fn lookup(&mut self, repo: &git2::Repository, name: &Path + fn lookup(&mut self, repo: &git2::Repository, name: &PosixPath ) -> Result { if name.as_vec() == b"HEAD" { repo.head().ok() @@ -56,13 +57,13 @@ impl Inode for Root { } fn readdir<'a>(&mut self, _repo: &git2::Repository, offset: u64, - mut add: Box bool + 'a> + mut add: Box bool + 'a> ) -> Result<(), libc::c_int> { if offset == 0 { - add(self.head, FileType::Unknown, &Path::new("HEAD")); + add(self.head, FileType::Unknown, &PosixPath::new("HEAD")); } if offset <= 1 { - add(self.refs, FileType::Unknown, &Path::new("refs")); + add(self.refs, FileType::Unknown, &PosixPath::new("refs")); } Ok(()) } diff --git a/src/tree.rs b/src/tree.rs index 35bf23a..685afdb 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -10,6 +10,7 @@ use git2; use libc; use libc::consts::os::posix88; use std::old_io::{FileType, USER_DIR}; +use std::old_path::PosixPath; use std::path::AsPath; use inode; @@ -36,7 +37,7 @@ impl Tree { } impl Inode for Tree { - fn lookup(&mut self, repo: &git2::Repository, name: &Path + fn lookup(&mut self, repo: &git2::Repository, name: &PosixPath ) -> Result { self.tree(repo).and_then(|tree| { match tree.get_path(name.as_path()) { @@ -58,11 +59,11 @@ impl Inode for Tree { } fn readdir<'a>(&'a mut self, repo: &git2::Repository, offset: u64, - mut add: Box bool + 'a> + mut add: Box bool + 'a> ) -> Result<(), libc::c_int> { let len = self.size; self.tree(repo).map(|tree| { - for i in range(offset, len) { + for i in (offset..len) { let e = match tree.get(i as usize) { Some(e) => e, None => continue, @@ -72,7 +73,7 @@ impl Inode for Tree { Some(git2::ObjectType::Blob) => FileType::RegularFile, _ => FileType::Unknown, }; - let path = Path::new(e.name_bytes()); + let path = PosixPath::new(e.name_bytes()); if add(Id::Oid(e.id()), kind, &path) { break; } diff --git a/tests/self.rs b/tests/self.rs index dab7cdb..1a97fac 100644 --- a/tests/self.rs +++ b/tests/self.rs @@ -1,6 +1,5 @@ //! Test that this very testfile is accessible in our own mount. -#![feature(path)] #![feature(path_ext)] extern crate gitfs;