@@ -14,7 +14,6 @@ use std::path::Path;
14
14
use uucore:: display:: Quotable ;
15
15
use uucore:: error:: { ExitCode , UResult , USimpleError , UUsageError } ;
16
16
use uucore:: fs:: display_permissions_unix;
17
- use uucore:: fs:: is_symlink;
18
17
use uucore:: libc:: mode_t;
19
18
#[ cfg( not( windows) ) ]
20
19
use uucore:: mode;
@@ -63,7 +62,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
63
62
let verbose = matches. contains_id ( options:: VERBOSE ) ;
64
63
let preserve_root = matches. contains_id ( options:: PRESERVE_ROOT ) ;
65
64
let recursive = matches. contains_id ( options:: RECURSIVE ) ;
66
- let fmode = match matches. value_of ( options:: REFERENCE ) {
65
+ let fmode = match matches. get_one :: < String > ( options:: REFERENCE ) {
67
66
Some ( fref) => match fs:: metadata ( fref) {
68
67
Ok ( meta) => Some ( meta. mode ( ) ) ,
69
68
Err ( err) => {
@@ -75,7 +74,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
75
74
} ,
76
75
None => None ,
77
76
} ;
78
- let modes = matches. value_of ( options:: MODE ) . unwrap ( ) ; // should always be Some because required
77
+ let modes = matches. get_one :: < String > ( options:: MODE ) . unwrap ( ) ; // should always be Some because required
79
78
let cmode = if mode_had_minus_prefix {
80
79
// clap parsing is finished, now put prefix back
81
80
format ! ( "-{}" , modes)
@@ -195,7 +194,7 @@ impl Chmoder {
195
194
let filename = & filename[ ..] ;
196
195
let file = Path :: new ( filename) ;
197
196
if !file. exists ( ) {
198
- if is_symlink ( file ) {
197
+ if file . is_symlink ( ) {
199
198
println ! (
200
199
"failed to change mode of {} from 0000 (---------) to 0000 (---------)" ,
201
200
filename. quote( )
@@ -237,10 +236,10 @@ impl Chmoder {
237
236
238
237
fn walk_dir ( & self , file_path : & Path ) -> UResult < ( ) > {
239
238
let mut r = self . chmod_file ( file_path) ;
240
- if !is_symlink ( file_path ) && file_path. is_dir ( ) {
239
+ if !file_path . is_symlink ( ) && file_path. is_dir ( ) {
241
240
for dir_entry in file_path. read_dir ( ) ? {
242
241
let path = dir_entry?. path ( ) ;
243
- if !is_symlink ( & path ) {
242
+ if !path . is_symlink ( ) {
244
243
r = self . walk_dir ( path. as_path ( ) ) ;
245
244
}
246
245
}
@@ -262,7 +261,7 @@ impl Chmoder {
262
261
let fperm = match fs:: metadata ( file) {
263
262
Ok ( meta) => meta. mode ( ) & 0o7777 ,
264
263
Err ( err) => {
265
- if is_symlink ( file ) {
264
+ if file . is_symlink ( ) {
266
265
if self . verbose {
267
266
println ! (
268
267
"neither symbolic link {} nor referent has been changed" ,
0 commit comments