From 9729782637b6292b5918aee69bb024abe40134ac Mon Sep 17 00:00:00 2001 From: sylvestre Date: Fri, 4 Nov 2022 03:50:46 +0000 Subject: [PATCH] deploy: c249eba195809b51d95ea470b413d669888f9a27 --- dev/arch/all.html | 2 +- dev/arch/fn.main.html | 2 +- dev/arch/index.html | 2 +- dev/ayu.css | 2 +- dev/base32/all.html | 2 +- dev/base32/fn.main.html | 2 +- dev/base32/index.html | 2 +- dev/base64/all.html | 2 +- dev/base64/fn.main.html | 2 +- dev/base64/index.html | 2 +- dev/basename/all.html | 2 +- dev/basename/fn.main.html | 2 +- dev/basename/index.html | 2 +- dev/basenc/all.html | 2 +- dev/basenc/fn.main.html | 2 +- dev/basenc/index.html | 2 +- dev/cat/all.html | 2 +- dev/cat/fn.main.html | 2 +- dev/cat/index.html | 2 +- dev/chcon/all.html | 2 +- dev/chcon/fn.main.html | 2 +- dev/chcon/index.html | 2 +- dev/chgrp/all.html | 2 +- dev/chgrp/fn.main.html | 2 +- dev/chgrp/index.html | 2 +- dev/chmod/all.html | 2 +- dev/chmod/fn.main.html | 2 +- dev/chmod/index.html | 2 +- dev/chown/all.html | 2 +- dev/chown/fn.main.html | 2 +- dev/chown/index.html | 2 +- dev/chroot/all.html | 2 +- dev/chroot/fn.main.html | 2 +- dev/chroot/index.html | 2 +- dev/cksum/all.html | 2 +- dev/cksum/fn.main.html | 2 +- dev/cksum/index.html | 2 +- dev/comm/all.html | 2 +- dev/comm/fn.main.html | 2 +- dev/comm/index.html | 2 +- dev/coreutils/all.html | 2 +- dev/coreutils/constant.VERSION.html | 2 +- dev/coreutils/fn.binary_path.html | 2 +- dev/coreutils/fn.gen_completions.html | 4 +- dev/coreutils/fn.gen_coreutils_app.html | 2 +- dev/coreutils/fn.main.html | 2 +- dev/coreutils/fn.name.html | 2 +- dev/coreutils/fn.usage.html | 2 +- dev/coreutils/fn.util_map.html | 2 +- dev/coreutils/index.html | 3 +- dev/coreutils/type.UtilityMap.html | 2 +- dev/cp/all.html | 2 +- dev/cp/fn.main.html | 2 +- dev/cp/index.html | 2 +- dev/csplit/all.html | 2 +- dev/csplit/fn.main.html | 2 +- dev/csplit/index.html | 2 +- dev/cut/all.html | 2 +- dev/cut/fn.main.html | 2 +- dev/cut/index.html | 2 +- dev/dark.css | 2 +- dev/date/all.html | 2 +- dev/date/fn.main.html | 2 +- dev/date/index.html | 2 +- dev/dd/all.html | 2 +- dev/dd/fn.main.html | 2 +- dev/dd/index.html | 2 +- dev/df/all.html | 2 +- dev/df/fn.main.html | 2 +- dev/df/index.html | 2 +- dev/dir/all.html | 2 +- dev/dir/fn.main.html | 2 +- dev/dir/index.html | 2 +- dev/dircolors/all.html | 2 +- dev/dircolors/fn.main.html | 2 +- dev/dircolors/index.html | 2 +- dev/dirname/all.html | 2 +- dev/dirname/fn.main.html | 2 +- dev/dirname/index.html | 2 +- dev/down-arrow.svg | 2 +- dev/du/all.html | 2 +- dev/du/fn.main.html | 2 +- dev/du/index.html | 2 +- dev/echo/all.html | 2 +- dev/echo/fn.main.html | 2 +- dev/echo/index.html | 2 +- dev/env/all.html | 2 +- dev/env/fn.main.html | 2 +- dev/env/index.html | 2 +- dev/expand/all.html | 2 +- dev/expand/fn.main.html | 2 +- dev/expand/index.html | 2 +- dev/expr/all.html | 2 +- dev/expr/fn.main.html | 2 +- dev/expr/index.html | 2 +- dev/factor/all.html | 2 +- dev/factor/fn.main.html | 2 +- dev/factor/index.html | 2 +- dev/false/all.html | 2 +- dev/false/fn.main.html | 2 +- dev/false/index.html | 2 +- dev/fmt/all.html | 2 +- dev/fmt/fn.main.html | 2 +- dev/fmt/index.html | 2 +- dev/fold/all.html | 2 +- dev/fold/fn.main.html | 2 +- dev/fold/index.html | 2 +- dev/groups/all.html | 2 +- dev/groups/fn.main.html | 2 +- dev/groups/index.html | 2 +- dev/hashsum/all.html | 2 +- dev/hashsum/fn.main.html | 2 +- dev/hashsum/index.html | 2 +- dev/head/all.html | 2 +- dev/head/fn.main.html | 2 +- dev/head/index.html | 2 +- dev/hostid/all.html | 2 +- dev/hostid/fn.main.html | 2 +- dev/hostid/index.html | 2 +- dev/hostname/all.html | 2 +- dev/hostname/fn.main.html | 2 +- dev/hostname/index.html | 2 +- dev/id/all.html | 2 +- dev/id/fn.main.html | 2 +- dev/id/index.html | 2 +- dev/implementors/core/clone/trait.Clone.js | 26 +- dev/implementors/core/cmp/trait.Eq.js | 26 +- dev/implementors/core/cmp/trait.Ord.js | 8 +- dev/implementors/core/cmp/trait.PartialEq.js | 28 +- dev/implementors/core/cmp/trait.PartialOrd.js | 10 +- dev/implementors/core/convert/trait.From.js | 8 +- .../core/default/trait.Default.js | 12 +- dev/implementors/core/error/trait.Error.js | 5 + dev/implementors/core/fmt/trait.Debug.js | 26 +- dev/implementors/core/fmt/trait.Display.js | 12 +- dev/implementors/core/hash/trait.Hash.js | 6 +- .../iter/traits/iterator/trait.Iterator.js | 10 +- dev/implementors/core/marker/trait.Copy.js | 18 +- dev/implementors/core/marker/trait.Freeze.js | 42 +- dev/implementors/core/marker/trait.Send.js | 42 +- .../core/marker/trait.StructuralEq.js | 26 +- .../core/marker/trait.StructuralPartialEq.js | 28 +- dev/implementors/core/marker/trait.Sync.js | 42 +- dev/implementors/core/marker/trait.Unpin.js | 42 +- dev/implementors/core/ops/drop/trait.Drop.js | 6 +- .../panic/unwind_safe/trait.RefUnwindSafe.js | 42 +- .../panic/unwind_safe/trait.UnwindSafe.js | 42 +- .../core/str/traits/trait.FromStr.js | 10 +- .../os_display/native/trait.Quotable.js | 6 +- dev/implementors/std/error/trait.Error.js | 5 - .../uu_dircolors/trait.StrUtils.js | 6 +- dev/implementors/uu_pinky/trait.Capitalize.js | 6 +- dev/implementors/uu_stat/trait.ScanUtil.js | 6 +- .../uucore/features/entries/trait.Locate.js | 10 +- .../uucore/features/fsext/trait.BirthTime.js | 6 +- .../uucore/features/fsext/trait.FsMeta.js | 6 +- .../uucore/features/process/trait.ChildExt.js | 6 +- .../uucore/mods/error/trait.FromIo.js | 6 +- .../uucore/mods/error/trait.UClapError.js | 6 +- .../uucore/mods/error/trait.UError.js | 10 +- dev/implementors/uucore/trait.Args.js | 6 +- dev/install/all.html | 2 +- dev/install/fn.main.html | 2 +- dev/install/index.html | 2 +- dev/join/all.html | 2 +- dev/join/fn.main.html | 2 +- dev/join/index.html | 2 +- dev/kill/all.html | 2 +- dev/kill/fn.main.html | 2 +- dev/kill/index.html | 2 +- dev/libstdbuf/all.html | 2 +- dev/libstdbuf/fn.__stdbuf.html | 4 +- dev/libstdbuf/index.html | 3 +- dev/light.css | 2 +- dev/link/all.html | 2 +- dev/link/fn.main.html | 2 +- dev/link/index.html | 2 +- dev/ln/all.html | 2 +- dev/ln/fn.main.html | 2 +- dev/ln/index.html | 2 +- dev/logname/all.html | 2 +- dev/logname/fn.main.html | 2 +- dev/logname/index.html | 2 +- dev/ls/all.html | 2 +- dev/ls/fn.main.html | 2 +- dev/ls/index.html | 2 +- dev/main.js | 2 +- dev/mkdir/all.html | 2 +- dev/mkdir/fn.main.html | 2 +- dev/mkdir/index.html | 2 +- dev/mkfifo/all.html | 2 +- dev/mkfifo/fn.main.html | 2 +- dev/mkfifo/index.html | 2 +- dev/mknod/all.html | 2 +- dev/mknod/fn.main.html | 2 +- dev/mknod/index.html | 2 +- dev/mktemp/all.html | 2 +- dev/mktemp/fn.main.html | 2 +- dev/mktemp/index.html | 2 +- dev/more/all.html | 2 +- dev/more/fn.main.html | 2 +- dev/more/index.html | 2 +- dev/mv/all.html | 2 +- dev/mv/fn.main.html | 2 +- dev/mv/index.html | 2 +- dev/nice/all.html | 2 +- dev/nice/fn.main.html | 2 +- dev/nice/index.html | 2 +- dev/nl/all.html | 2 +- dev/nl/fn.main.html | 2 +- dev/nl/index.html | 2 +- dev/nohup/all.html | 2 +- dev/nohup/fn.main.html | 2 +- dev/nohup/index.html | 2 +- dev/nproc/all.html | 2 +- dev/nproc/fn.main.html | 2 +- dev/nproc/index.html | 2 +- dev/numfmt/all.html | 2 +- dev/numfmt/fn.main.html | 2 +- dev/numfmt/index.html | 2 +- dev/od/all.html | 2 +- dev/od/fn.main.html | 2 +- dev/od/index.html | 2 +- dev/paste/all.html | 2 +- dev/paste/fn.main.html | 2 +- dev/paste/index.html | 2 +- dev/pathchk/all.html | 2 +- dev/pathchk/fn.main.html | 2 +- dev/pathchk/index.html | 2 +- dev/pinky/all.html | 2 +- dev/pinky/fn.main.html | 2 +- dev/pinky/index.html | 2 +- dev/pr/all.html | 2 +- dev/pr/fn.main.html | 2 +- dev/pr/index.html | 2 +- dev/printenv/all.html | 2 +- dev/printenv/fn.main.html | 2 +- dev/printenv/index.html | 2 +- dev/printf/all.html | 2 +- dev/printf/fn.main.html | 2 +- dev/printf/index.html | 2 +- dev/ptx/all.html | 2 +- dev/ptx/fn.main.html | 2 +- dev/ptx/index.html | 2 +- dev/pwd/all.html | 2 +- dev/pwd/fn.main.html | 2 +- dev/pwd/index.html | 2 +- dev/readlink/all.html | 2 +- dev/readlink/fn.main.html | 2 +- dev/readlink/index.html | 2 +- dev/realpath/all.html | 2 +- dev/realpath/fn.main.html | 2 +- dev/realpath/index.html | 2 +- dev/relpath/all.html | 2 +- dev/relpath/fn.main.html | 2 +- dev/relpath/index.html | 2 +- dev/rm/all.html | 2 +- dev/rm/fn.main.html | 2 +- dev/rm/index.html | 2 +- dev/rmdir/all.html | 2 +- dev/rmdir/fn.main.html | 2 +- dev/rmdir/index.html | 2 +- dev/runcon/all.html | 2 +- dev/runcon/fn.main.html | 2 +- dev/runcon/index.html | 2 +- dev/rustdoc.css | 2 +- dev/search-index.js | 20 +- dev/search.js | 2 +- dev/seq/all.html | 2 +- dev/seq/fn.main.html | 2 +- dev/seq/index.html | 2 +- dev/settings.html | 2 +- dev/shred/all.html | 2 +- dev/shred/fn.main.html | 2 +- dev/shred/index.html | 2 +- dev/shuf/all.html | 2 +- dev/shuf/fn.main.html | 2 +- dev/shuf/index.html | 2 +- dev/sleep/all.html | 2 +- dev/sleep/fn.main.html | 2 +- dev/sleep/index.html | 2 +- dev/sort/all.html | 2 +- dev/sort/fn.main.html | 2 +- dev/sort/index.html | 2 +- dev/source-script.js | 2 +- dev/split/all.html | 2 +- dev/split/fn.main.html | 2 +- dev/split/index.html | 2 +- dev/src/arch/main.rs.html | 6 +- dev/src/base32/main.rs.html | 6 +- dev/src/base64/main.rs.html | 6 +- dev/src/basename/main.rs.html | 6 +- dev/src/basenc/main.rs.html | 6 +- dev/src/cat/main.rs.html | 6 +- dev/src/chcon/main.rs.html | 6 +- dev/src/chgrp/main.rs.html | 6 +- dev/src/chmod/main.rs.html | 6 +- dev/src/chown/main.rs.html | 6 +- dev/src/chroot/main.rs.html | 6 +- dev/src/cksum/main.rs.html | 6 +- dev/src/comm/main.rs.html | 6 +- dev/src/coreutils/coreutils.rs.html | 250 +- .../out/uutils_map.rs.html | 310 -- .../out/uutils_map.rs.html | 310 ++ dev/src/cp/main.rs.html | 6 +- dev/src/csplit/main.rs.html | 6 +- dev/src/cut/main.rs.html | 6 +- dev/src/date/main.rs.html | 6 +- dev/src/dd/main.rs.html | 8 +- dev/src/df/main.rs.html | 6 +- dev/src/dir/main.rs.html | 6 +- dev/src/dircolors/main.rs.html | 6 +- dev/src/dirname/main.rs.html | 6 +- dev/src/du/main.rs.html | 6 +- dev/src/echo/main.rs.html | 6 +- dev/src/env/main.rs.html | 6 +- dev/src/expand/main.rs.html | 6 +- dev/src/expr/main.rs.html | 6 +- dev/src/factor/main.rs.html | 6 +- dev/src/false/main.rs.html | 6 +- dev/src/fmt/main.rs.html | 6 +- dev/src/fold/main.rs.html | 6 +- dev/src/groups/main.rs.html | 6 +- dev/src/hashsum/main.rs.html | 6 +- dev/src/head/main.rs.html | 6 +- dev/src/hostid/main.rs.html | 6 +- dev/src/hostname/main.rs.html | 6 +- dev/src/id/main.rs.html | 6 +- dev/src/install/main.rs.html | 6 +- dev/src/join/main.rs.html | 6 +- dev/src/kill/main.rs.html | 6 +- dev/src/libstdbuf/libstdbuf.rs.html | 100 +- dev/src/link/main.rs.html | 6 +- dev/src/ln/main.rs.html | 6 +- dev/src/logname/main.rs.html | 6 +- dev/src/ls/main.rs.html | 6 +- dev/src/mkdir/main.rs.html | 6 +- dev/src/mkfifo/main.rs.html | 6 +- dev/src/mknod/main.rs.html | 6 +- dev/src/mktemp/main.rs.html | 6 +- dev/src/more/main.rs.html | 6 +- dev/src/mv/main.rs.html | 6 +- dev/src/nice/main.rs.html | 6 +- dev/src/nl/main.rs.html | 6 +- dev/src/nohup/main.rs.html | 6 +- dev/src/nproc/main.rs.html | 6 +- dev/src/numfmt/main.rs.html | 6 +- dev/src/od/main.rs.html | 6 +- dev/src/paste/main.rs.html | 6 +- dev/src/pathchk/main.rs.html | 6 +- dev/src/pinky/main.rs.html | 6 +- dev/src/pr/main.rs.html | 8 +- dev/src/printenv/main.rs.html | 6 +- dev/src/printf/main.rs.html | 6 +- dev/src/ptx/main.rs.html | 6 +- dev/src/pwd/main.rs.html | 6 +- dev/src/readlink/main.rs.html | 6 +- dev/src/realpath/main.rs.html | 6 +- dev/src/relpath/main.rs.html | 6 +- dev/src/rm/main.rs.html | 6 +- dev/src/rmdir/main.rs.html | 6 +- dev/src/runcon/main.rs.html | 6 +- dev/src/seq/main.rs.html | 6 +- dev/src/shred/main.rs.html | 6 +- dev/src/shuf/main.rs.html | 6 +- dev/src/sleep/main.rs.html | 6 +- dev/src/sort/main.rs.html | 6 +- dev/src/split/main.rs.html | 6 +- dev/src/stat/main.rs.html | 6 +- dev/src/stdbuf/main.rs.html | 6 +- dev/src/stty/main.rs.html | 6 +- dev/src/sum/main.rs.html | 6 +- dev/src/sync/main.rs.html | 6 +- dev/src/tac/main.rs.html | 6 +- dev/src/tail/main.rs.html | 6 +- dev/src/tee/main.rs.html | 6 +- dev/src/test/main.rs.html | 6 +- dev/src/timeout/main.rs.html | 6 +- dev/src/touch/main.rs.html | 6 +- dev/src/tr/main.rs.html | 6 +- dev/src/true/main.rs.html | 6 +- dev/src/truncate/main.rs.html | 6 +- dev/src/tsort/main.rs.html | 6 +- dev/src/tty/main.rs.html | 6 +- dev/src/uname/main.rs.html | 6 +- dev/src/unexpand/main.rs.html | 6 +- dev/src/uniq/main.rs.html | 6 +- dev/src/unlink/main.rs.html | 6 +- dev/src/uptime/main.rs.html | 6 +- dev/src/users/main.rs.html | 6 +- dev/src/uu_arch/arch.rs.html | 50 +- dev/src/uu_base32/base32.rs.html | 60 +- dev/src/uu_base32/base_common.rs.html | 272 +- dev/src/uu_base64/base64.rs.html | 58 +- dev/src/uu_basename/basename.rs.html | 266 +- dev/src/uu_basenc/basenc.rs.html | 120 +- dev/src/uu_cat/cat.rs.html | 972 ++-- dev/src/uu_cat/splice.rs.html | 100 +- dev/src/uu_chcon/chcon.rs.html | 1024 ++-- dev/src/uu_chcon/errors.rs.html | 106 +- dev/src/uu_chcon/fts.rs.html | 250 +- dev/src/uu_chgrp/chgrp.rs.html | 248 +- dev/src/uu_chmod/chmod.rs.html | 524 +- dev/src/uu_chown/chown.rs.html | 426 +- dev/src/uu_chroot/chroot.rs.html | 412 +- dev/src/uu_chroot/error.rs.html | 126 +- dev/src/uu_cksum/cksum.rs.html | 208 +- dev/src/uu_comm/comm.rs.html | 274 +- dev/src/uu_cp/copydir.rs.html | 606 +-- dev/src/uu_cp/cp.rs.html | 2320 ++++----- dev/src/uu_cp/platform/linux.rs.html | 166 +- dev/src/uu_cp/platform/mod.rs.html | 36 +- dev/src/uu_csplit/csplit.rs.html | 1216 ++--- dev/src/uu_csplit/csplit_error.rs.html | 80 +- dev/src/uu_csplit/patterns.rs.html | 486 +- dev/src/uu_csplit/split_name.rs.html | 558 +- dev/src/uu_cut/cut.rs.html | 714 +-- dev/src/uu_cut/searcher.rs.html | 146 +- dev/src/uu_date/date.rs.html | 626 +-- dev/src/uu_dd/blocks.rs.html | 504 +- dev/src/uu_dd/conversion_tables.rs.html | 46 +- dev/src/uu_dd/datastructures.rs.html | 162 +- dev/src/uu_dd/dd.rs.html | 1388 ++--- dev/src/uu_dd/parseargs.rs.html | 968 ++-- dev/src/uu_dd/progress.rs.html | 994 ++-- dev/src/uu_df/blocks.rs.html | 402 +- dev/src/uu_df/columns.rs.html | 350 +- dev/src/uu_df/df.rs.html | 1306 ++--- dev/src/uu_df/filesystem.rs.html | 352 +- dev/src/uu_df/table.rs.html | 1110 ++-- dev/src/uu_dir/dir.rs.html | 106 +- dev/src/uu_dircolors/colors.rs.html | 8 +- dev/src/uu_dircolors/dircolors.rs.html | 622 +-- dev/src/uu_dirname/dirname.rs.html | 136 +- dev/src/uu_du/du.rs.html | 1404 +++--- dev/src/uu_echo/echo.rs.html | 250 +- dev/src/uu_env/env.rs.html | 470 +- dev/src/uu_expand/expand.rs.html | 742 +-- dev/src/uu_expr/expr.rs.html | 130 +- dev/src/uu_expr/syntax_tree.rs.html | 692 +-- dev/src/uu_expr/tokens.rs.html | 200 +- dev/src/uu_factor/cli.rs.html | 124 +- dev/src/uu_factor/factor.rs.html | 380 +- .../out/prime_table.rs.html | 20 +- dev/src/uu_factor/miller_rabin.rs.html | 270 +- dev/src/uu_factor/numeric/gcd.rs.html | 182 +- dev/src/uu_factor/numeric/mod.rs.html | 30 +- .../uu_factor/numeric/modular_inverse.rs.html | 120 +- dev/src/uu_factor/numeric/montgomery.rs.html | 322 +- dev/src/uu_factor/numeric/traits.rs.html | 132 +- dev/src/uu_factor/rho.rs.html | 74 +- dev/src/uu_factor/table.rs.html | 130 +- dev/src/uu_false/false.rs.html | 100 +- dev/src/uu_fmt/fmt.rs.html | 488 +- dev/src/uu_fmt/linebreak.rs.html | 820 +-- dev/src/uu_fmt/parasplit.rs.html | 898 ++-- dev/src/uu_fold/fold.rs.html | 396 +- dev/src/uu_groups/groups.rs.html | 164 +- dev/src/uu_hashsum/digest.rs.html | 420 +- dev/src/uu_hashsum/hashsum.rs.html | 946 ++-- dev/src/uu_head/head.rs.html | 936 ++-- dev/src/uu_head/parse.rs.html | 278 +- dev/src/uu_head/take.rs.html | 260 +- dev/src/uu_hostid/hostid.rs.html | 72 +- dev/src/uu_hostname/hostname.rs.html | 252 +- dev/src/uu_id/id.rs.html | 950 ++-- dev/src/uu_install/install.rs.html | 1256 ++--- dev/src/uu_install/mode.rs.html | 64 +- dev/src/uu_join/join.rs.html | 1334 ++--- dev/src/uu_kill/kill.rs.html | 298 +- dev/src/uu_link/link.rs.html | 88 +- dev/src/uu_ln/ln.rs.html | 714 +-- dev/src/uu_logname/logname.rs.html | 78 +- dev/src/uu_ls/ls.rs.html | 4480 ++++++++--------- dev/src/uu_mkdir/mkdir.rs.html | 320 +- dev/src/uu_mkfifo/mkfifo.rs.html | 152 +- dev/src/uu_mknod/mknod.rs.html | 272 +- dev/src/uu_mktemp/mktemp.rs.html | 882 ++-- dev/src/uu_more/more.rs.html | 614 +-- dev/src/uu_mv/error.rs.html | 66 +- dev/src/uu_mv/mv.rs.html | 716 +-- dev/src/uu_nice/nice.rs.html | 166 +- dev/src/uu_nl/helper.rs.html | 202 +- dev/src/uu_nl/nl.rs.html | 642 +-- dev/src/uu_nohup/nohup.rs.html | 290 +- dev/src/uu_nproc/nproc.rs.html | 228 +- dev/src/uu_numfmt/errors.rs.html | 54 +- dev/src/uu_numfmt/format.rs.html | 664 +-- dev/src/uu_numfmt/numfmt.rs.html | 670 +-- dev/src/uu_numfmt/options.rs.html | 486 +- dev/src/uu_numfmt/units.rs.html | 78 +- dev/src/uu_od/byteorder_io.rs.html | 76 +- dev/src/uu_od/formatteriteminfo.rs.html | 82 +- dev/src/uu_od/inputdecoder.rs.html | 286 +- dev/src/uu_od/inputoffset.rs.html | 168 +- dev/src/uu_od/multifilereader.rs.html | 276 +- dev/src/uu_od/od.rs.html | 934 ++-- dev/src/uu_od/output_info.rs.html | 606 +-- dev/src/uu_od/parse_formats.rs.html | 730 +-- dev/src/uu_od/parse_inputs.rs.html | 482 +- dev/src/uu_od/parse_nrofbytes.rs.html | 144 +- dev/src/uu_od/partialreader.rs.html | 288 +- dev/src/uu_od/peekreader.rs.html | 312 +- dev/src/uu_od/prn_char.rs.html | 198 +- dev/src/uu_od/prn_float.rs.html | 348 +- dev/src/uu_od/prn_int.rs.html | 264 +- dev/src/uu_paste/paste.rs.html | 328 +- dev/src/uu_pathchk/pathchk.rs.html | 370 +- dev/src/uu_pinky/pinky.rs.html | 558 +- dev/src/uu_pr/pr.rs.html | 1736 +++---- dev/src/uu_printenv/printenv.rs.html | 114 +- dev/src/uu_printf/printf.rs.html | 96 +- dev/src/uu_ptx/ptx.rs.html | 1354 ++--- dev/src/uu_pwd/pwd.rs.html | 270 +- dev/src/uu_readlink/readlink.rs.html | 280 +- dev/src/uu_realpath/realpath.rs.html | 486 +- dev/src/uu_relpath/relpath.rs.html | 134 +- dev/src/uu_rm/rm.rs.html | 912 ++-- dev/src/uu_rmdir/rmdir.rs.html | 288 +- dev/src/uu_runcon/errors.rs.html | 156 +- dev/src/uu_runcon/runcon.rs.html | 596 +-- dev/src/uu_seq/error.rs.html | 102 +- dev/src/uu_seq/extendedbigdecimal.rs.html | 434 +- dev/src/uu_seq/extendedbigint.rs.html | 348 +- dev/src/uu_seq/number.rs.html | 180 +- dev/src/uu_seq/numberparse.rs.html | 914 ++-- dev/src/uu_seq/seq.rs.html | 594 +-- dev/src/uu_shred/shred.rs.html | 800 +-- dev/src/uu_shuf/rand_read_adapter.rs.html | 194 +- dev/src/uu_shuf/shuf.rs.html | 504 +- dev/src/uu_sleep/sleep.rs.html | 92 +- dev/src/uu_sort/check.rs.html | 204 +- dev/src/uu_sort/chunks.rs.html | 520 +- dev/src/uu_sort/custom_str_cmp.rs.html | 102 +- dev/src/uu_sort/ext_sort.rs.html | 448 +- dev/src/uu_sort/merge.rs.html | 816 +-- dev/src/uu_sort/numeric_str_cmp.rs.html | 728 +-- dev/src/uu_sort/sort.rs.html | 2934 +++++------ dev/src/uu_sort/tmp_dir.rs.html | 132 +- dev/src/uu_split/filenames.rs.html | 412 +- dev/src/uu_split/number.rs.html | 932 ++-- dev/src/uu_split/platform/mod.rs.html | 28 +- dev/src/uu_split/platform/unix.rs.html | 220 +- dev/src/uu_split/split.rs.html | 2224 ++++---- dev/src/uu_stat/stat.rs.html | 1536 +++--- dev/src/uu_stdbuf/stdbuf.rs.html | 318 +- dev/src/uu_stty/flags.rs.html | 608 +-- dev/src/uu_stty/stty.rs.html | 552 +- dev/src/uu_sum/sum.rs.html | 248 +- dev/src/uu_sync/sync.rs.html | 382 +- dev/src/uu_tac/error.rs.html | 90 +- dev/src/uu_tac/tac.rs.html | 492 +- dev/src/uu_tail/args.rs.html | 656 +-- dev/src/uu_tail/chunks.rs.html | 1102 ++-- dev/src/uu_tail/follow/files.rs.html | 288 +- dev/src/uu_tail/follow/mod.rs.html | 18 +- dev/src/uu_tail/follow/watch.rs.html | 726 +-- dev/src/uu_tail/parse.rs.html | 248 +- dev/src/uu_tail/paths.rs.html | 370 +- dev/src/uu_tail/platform/mod.rs.html | 32 +- dev/src/uu_tail/platform/unix.rs.html | 80 +- dev/src/uu_tail/tail.rs.html | 716 +-- dev/src/uu_tail/text.rs.html | 42 +- dev/src/uu_tee/tee.rs.html | 556 +- dev/src/uu_test/parser.rs.html | 626 +-- dev/src/uu_test/test.rs.html | 618 +-- dev/src/uu_timeout/status.rs.html | 82 +- dev/src/uu_timeout/timeout.rs.html | 566 +-- dev/src/uu_touch/touch.rs.html | 760 +-- dev/src/uu_tr/convert.rs.html | 60 +- dev/src/uu_tr/operation.rs.html | 842 ++-- dev/src/uu_tr/tr.rs.html | 254 +- dev/src/uu_tr/unicode_table.rs.html | 32 +- dev/src/uu_true/true.rs.html | 96 +- dev/src/uu_truncate/truncate.rs.html | 688 +-- dev/src/uu_tsort/tsort.rs.html | 230 +- dev/src/uu_tty/tty.rs.html | 106 +- dev/src/uu_uname/uname.rs.html | 330 +- dev/src/uu_unexpand/unexpand.rs.html | 632 +-- dev/src/uu_uniq/uniq.rs.html | 646 +-- dev/src/uu_unlink/unlink.rs.html | 68 +- dev/src/uu_uptime/uptime.rs.html | 248 +- dev/src/uu_users/users.rs.html | 106 +- dev/src/uu_vdir/vdir.rs.html | 106 +- dev/src/uu_wc/count_fast.rs.html | 256 +- dev/src/uu_wc/countable.rs.html | 56 +- dev/src/uu_wc/wc.rs.html | 900 ++-- dev/src/uu_wc/word_count.rs.html | 68 +- dev/src/uu_who/who.rs.html | 836 +-- dev/src/uu_whoami/platform/mod.rs.html | 24 +- dev/src/uu_whoami/platform/unix.rs.html | 22 +- dev/src/uu_whoami/whoami.rs.html | 52 +- dev/src/uu_yes/splice.rs.html | 98 +- dev/src/uu_yes/yes.rs.html | 146 +- dev/src/uucore/features.rs.html | 88 +- dev/src/uucore/features/encoding.rs.html | 268 +- dev/src/uucore/features/entries.rs.html | 626 +-- dev/src/uucore/features/fs.rs.html | 976 ++-- dev/src/uucore/features/fsext.rs.html | 1638 +++--- dev/src/uucore/features/lines.rs.html | 190 +- dev/src/uucore/features/memo.rs.html | 118 +- dev/src/uucore/features/mode.rs.html | 300 +- dev/src/uucore/features/perms.rs.html | 766 +-- dev/src/uucore/features/pipes.rs.html | 114 +- dev/src/uucore/features/process.rs.html | 190 +- dev/src/uucore/features/ringbuffer.rs.html | 234 +- dev/src/uucore/features/signals.rs.html | 106 +- dev/src/uucore/features/tokenize/mod.rs.html | 14 +- .../tokenize/num_format/format_field.rs.html | 80 +- .../tokenize/num_format/formatter.rs.html | 94 +- .../formatters/base_conv/mod.rs.html | 398 +- .../formatters/base_conv/tests.rs.html | 90 +- .../formatters/cninetyninehexfloatf.rs.html | 178 +- .../num_format/formatters/decf.rs.html | 280 +- .../formatters/float_common.rs.html | 542 +- .../num_format/formatters/floatf.rs.html | 64 +- .../num_format/formatters/intf.rs.html | 442 +- .../num_format/formatters/mod.rs.html | 20 +- .../num_format/formatters/scif.rs.html | 64 +- .../features/tokenize/num_format/mod.rs.html | 12 +- .../tokenize/num_format/num_format.rs.html | 400 +- dev/src/uucore/features/tokenize/sub.rs.html | 656 +-- .../uucore/features/tokenize/token.rs.html | 56 +- .../features/tokenize/unescaped_text.rs.html | 438 +- dev/src/uucore/features/utmpx.rs.html | 566 +-- dev/src/uucore/lib.rs.html | 354 +- dev/src/uucore/macros.rs.html | 420 +- dev/src/uucore/mods.rs.html | 24 +- dev/src/uucore/mods/backup_control.rs.html | 1038 ++-- dev/src/uucore/mods/display.rs.html | 120 +- dev/src/uucore/mods/error.rs.html | 1154 ++--- dev/src/uucore/mods/os.rs.html | 50 +- dev/src/uucore/mods/panic.rs.html | 74 +- dev/src/uucore/mods/quoting_style.rs.html | 642 +-- dev/src/uucore/mods/ranges.rs.html | 326 +- dev/src/uucore/mods/version_cmp.rs.html | 498 +- dev/src/uucore/parser.rs.html | 10 +- dev/src/uucore/parser/parse_glob.rs.html | 154 +- dev/src/uucore/parser/parse_size.rs.html | 510 +- dev/src/uucore/parser/parse_time.rs.html | 206 +- dev/src/uucore_procs/lib.rs.html | 332 +- .../out/uutils_map.rs.html | 310 -- .../out/uutils_map.rs.html | 310 ++ dev/src/uudoc/uudoc.rs.html | 402 +- dev/src/vdir/main.rs.html | 6 +- dev/src/wc/main.rs.html | 6 +- dev/src/who/main.rs.html | 6 +- dev/src/whoami/main.rs.html | 6 +- dev/src/yes/main.rs.html | 6 +- dev/stat/all.html | 2 +- dev/stat/fn.main.html | 2 +- dev/stat/index.html | 2 +- dev/stdbuf/all.html | 2 +- dev/stdbuf/fn.main.html | 2 +- dev/stdbuf/index.html | 2 +- dev/stty/all.html | 2 +- dev/stty/fn.main.html | 2 +- dev/stty/index.html | 2 +- dev/sum/all.html | 2 +- dev/sum/fn.main.html | 2 +- dev/sum/index.html | 2 +- dev/sync/all.html | 2 +- dev/sync/fn.main.html | 2 +- dev/sync/index.html | 2 +- dev/tac/all.html | 2 +- dev/tac/fn.main.html | 2 +- dev/tac/index.html | 2 +- dev/tail/all.html | 2 +- dev/tail/fn.main.html | 2 +- dev/tail/index.html | 2 +- dev/tee/all.html | 2 +- dev/tee/fn.main.html | 2 +- dev/tee/index.html | 2 +- dev/test/all.html | 2 +- dev/test/fn.main.html | 2 +- dev/test/index.html | 2 +- dev/timeout/all.html | 2 +- dev/timeout/fn.main.html | 2 +- dev/timeout/index.html | 2 +- dev/touch/all.html | 2 +- dev/touch/fn.main.html | 2 +- dev/touch/index.html | 2 +- dev/tr/all.html | 2 +- dev/tr/fn.main.html | 2 +- dev/tr/index.html | 2 +- dev/true/all.html | 2 +- dev/true/fn.main.html | 2 +- dev/true/index.html | 2 +- dev/truncate/all.html | 2 +- dev/truncate/fn.main.html | 2 +- dev/truncate/index.html | 2 +- dev/tsort/all.html | 2 +- dev/tsort/fn.main.html | 2 +- dev/tsort/index.html | 2 +- dev/tty/all.html | 2 +- dev/tty/fn.main.html | 2 +- dev/tty/index.html | 2 +- dev/uname/all.html | 2 +- dev/uname/fn.main.html | 2 +- dev/uname/index.html | 2 +- dev/unexpand/all.html | 2 +- dev/unexpand/fn.main.html | 2 +- dev/unexpand/index.html | 2 +- dev/uniq/all.html | 2 +- dev/uniq/fn.main.html | 2 +- dev/uniq/index.html | 2 +- dev/unlink/all.html | 2 +- dev/unlink/fn.main.html | 2 +- dev/unlink/index.html | 2 +- dev/uptime/all.html | 2 +- dev/uptime/fn.main.html | 2 +- dev/uptime/index.html | 2 +- dev/users/all.html | 2 +- dev/users/fn.main.html | 2 +- dev/users/index.html | 2 +- dev/uu_arch/all.html | 2 +- dev/uu_arch/fn.uu_app.html | 2 +- dev/uu_arch/fn.uumain.html | 2 +- dev/uu_arch/index.html | 2 +- dev/uu_base32/all.html | 2 +- dev/uu_base32/base_common/fn.base_app.html | 2 +- dev/uu_base32/base_common/fn.get_input.html | 2 +- .../base_common/fn.handle_input.html | 2 +- .../base_common/fn.parse_base_cmd_args.html | 2 +- dev/uu_base32/base_common/index.html | 2 +- dev/uu_base32/base_common/options/index.html | 2 +- .../base_common/options/static.DECODE.html | 2 +- .../base_common/options/static.FILE.html | 2 +- .../options/static.IGNORE_GARBAGE.html | 2 +- .../base_common/options/static.WRAP.html | 2 +- .../static.BASE_CMD_PARSE_ERROR.html | 2 +- dev/uu_base32/base_common/struct.Config.html | 25 +- dev/uu_base32/fn.uu_app.html | 2 +- dev/uu_base32/fn.uumain.html | 2 +- dev/uu_base32/index.html | 2 +- dev/uu_base64/all.html | 2 +- dev/uu_base64/fn.uu_app.html | 2 +- dev/uu_base64/fn.uumain.html | 2 +- dev/uu_base64/index.html | 2 +- dev/uu_basename/all.html | 2 +- dev/uu_basename/fn.uu_app.html | 2 +- dev/uu_basename/fn.uumain.html | 2 +- dev/uu_basename/index.html | 2 +- dev/uu_basename/options/index.html | 2 +- dev/uu_basename/options/static.MULTIPLE.html | 2 +- dev/uu_basename/options/static.NAME.html | 2 +- dev/uu_basename/options/static.SUFFIX.html | 2 +- dev/uu_basename/options/static.ZERO.html | 2 +- dev/uu_basenc/all.html | 2 +- dev/uu_basenc/fn.uu_app.html | 2 +- dev/uu_basenc/fn.uumain.html | 2 +- dev/uu_basenc/index.html | 2 +- dev/uu_cat/all.html | 2 +- dev/uu_cat/fn.uu_app.html | 2 +- dev/uu_cat/fn.uumain.html | 2 +- dev/uu_cat/index.html | 2 +- dev/uu_chcon/all.html | 2 +- dev/uu_chcon/fn.uu_app.html | 2 +- dev/uu_chcon/fn.uumain.html | 2 +- dev/uu_chcon/index.html | 2 +- dev/uu_chcon/options/dereference/index.html | 2 +- .../dereference/static.DEREFERENCE.html | 2 +- .../dereference/static.NO_DEREFERENCE.html | 2 +- dev/uu_chcon/options/index.html | 2 +- dev/uu_chcon/options/preserve_root/index.html | 2 +- .../static.NO_PRESERVE_ROOT.html | 2 +- .../preserve_root/static.PRESERVE_ROOT.html | 2 +- dev/uu_chcon/options/static.HELP.html | 2 +- dev/uu_chcon/options/static.RANGE.html | 2 +- dev/uu_chcon/options/static.RECURSIVE.html | 2 +- dev/uu_chcon/options/static.REFERENCE.html | 2 +- dev/uu_chcon/options/static.ROLE.html | 2 +- dev/uu_chcon/options/static.TYPE.html | 2 +- dev/uu_chcon/options/static.USER.html | 2 +- dev/uu_chcon/options/static.VERBOSE.html | 2 +- dev/uu_chcon/options/sym_links/index.html | 2 +- .../static.FOLLOW_ARG_DIR_SYM_LINK.html | 2 +- .../static.FOLLOW_DIR_SYM_LINKS.html | 2 +- .../sym_links/static.NO_FOLLOW_SYM_LINKS.html | 2 +- dev/uu_chgrp/all.html | 2 +- dev/uu_chgrp/entries/fn.get_groups.html | 4 +- dev/uu_chgrp/entries/fn.get_groups_gnu.html | 4 +- dev/uu_chgrp/entries/fn.gid2grp.html | 2 +- dev/uu_chgrp/entries/fn.grp2gid.html | 2 +- dev/uu_chgrp/entries/fn.uid2usr.html | 2 +- dev/uu_chgrp/entries/fn.usr2uid.html | 2 +- dev/uu_chgrp/entries/index.html | 41 +- dev/uu_chgrp/entries/struct.Group.html | 31 +- dev/uu_chgrp/entries/struct.Passwd.html | 53 +- dev/uu_chgrp/entries/trait.Locate.html | 6 +- dev/uu_chgrp/fn.uu_app.html | 2 +- dev/uu_chgrp/fn.uumain.html | 2 +- dev/uu_chgrp/index.html | 3 +- dev/uu_chmod/all.html | 2 +- dev/uu_chmod/fn.uu_app.html | 2 +- dev/uu_chmod/fn.uumain.html | 2 +- dev/uu_chmod/index.html | 2 +- dev/uu_chown/all.html | 2 +- dev/uu_chown/entries/fn.get_groups.html | 4 +- dev/uu_chown/entries/fn.get_groups_gnu.html | 4 +- dev/uu_chown/entries/fn.gid2grp.html | 2 +- dev/uu_chown/entries/fn.grp2gid.html | 2 +- dev/uu_chown/entries/fn.uid2usr.html | 2 +- dev/uu_chown/entries/fn.usr2uid.html | 2 +- dev/uu_chown/entries/index.html | 41 +- dev/uu_chown/entries/struct.Group.html | 31 +- dev/uu_chown/entries/struct.Passwd.html | 53 +- dev/uu_chown/entries/trait.Locate.html | 6 +- dev/uu_chown/fn.uu_app.html | 2 +- dev/uu_chown/fn.uumain.html | 2 +- dev/uu_chown/index.html | 4 +- dev/uu_chown/struct.Group.html | 31 +- dev/uu_chown/struct.Passwd.html | 53 +- dev/uu_chown/trait.Locate.html | 6 +- dev/uu_chroot/all.html | 2 +- dev/uu_chroot/fn.uu_app.html | 2 +- dev/uu_chroot/fn.uumain.html | 2 +- dev/uu_chroot/index.html | 2 +- dev/uu_cksum/all.html | 2 +- dev/uu_cksum/fn.uu_app.html | 2 +- dev/uu_cksum/fn.uumain.html | 2 +- dev/uu_cksum/index.html | 2 +- dev/uu_comm/all.html | 2 +- dev/uu_comm/fn.uu_app.html | 2 +- dev/uu_comm/fn.uumain.html | 2 +- dev/uu_comm/index.html | 2 +- dev/uu_cp/all.html | 2 +- dev/uu_cp/enum.Attribute.html | 43 +- dev/uu_cp/enum.ClobberMode.html | 27 +- dev/uu_cp/enum.CopyMode.html | 17 +- dev/uu_cp/enum.Error.html | 70 +- dev/uu_cp/enum.OverwriteMode.html | 29 +- dev/uu_cp/enum.ReflinkMode.html | 27 +- dev/uu_cp/enum.SparseMode.html | 27 +- dev/uu_cp/enum.TargetType.html | 17 +- dev/uu_cp/fn.localize_to_target.html | 14 +- dev/uu_cp/fn.uu_app.html | 2 +- dev/uu_cp/fn.uumain.html | 2 +- dev/uu_cp/fn.verify_target_type.html | 4 +- dev/uu_cp/index.html | 12 +- dev/uu_cp/struct.Options.html | 17 +- dev/uu_cp/type.CopyResult.html | 2 +- dev/uu_cp/type.Source.html | 2 +- dev/uu_cp/type.SourceSlice.html | 2 +- dev/uu_cp/type.Target.html | 2 +- dev/uu_cp/type.TargetSlice.html | 2 +- dev/uu_csplit/all.html | 2 +- dev/uu_csplit/fn.csplit.html | 6 +- dev/uu_csplit/fn.uu_app.html | 2 +- dev/uu_csplit/fn.uumain.html | 2 +- dev/uu_csplit/index.html | 4 +- dev/uu_csplit/struct.CsplitOptions.html | 17 +- dev/uu_cut/all.html | 2 +- dev/uu_cut/fn.uu_app.html | 2 +- dev/uu_cut/fn.uumain.html | 2 +- dev/uu_cut/index.html | 2 +- dev/uu_date/all.html | 2 +- dev/uu_date/fn.uu_app.html | 2 +- dev/uu_date/fn.uumain.html | 2 +- dev/uu_date/index.html | 2 +- dev/uu_dd/all.html | 2 +- dev/uu_dd/fn.uu_app.html | 2 +- dev/uu_dd/fn.uumain.html | 2 +- dev/uu_dd/index.html | 2 +- dev/uu_df/all.html | 2 +- dev/uu_df/fn.uu_app.html | 2 +- dev/uu_df/fn.uumain.html | 2 +- dev/uu_df/index.html | 2 +- dev/uu_dir/all.html | 2 +- dev/uu_dir/fn.uu_app.html | 2 +- dev/uu_dir/fn.uumain.html | 2 +- dev/uu_dir/index.html | 2 +- dev/uu_dircolors/all.html | 2 +- dev/uu_dircolors/enum.OutputFmt.html | 23 +- dev/uu_dircolors/fn.guess_syntax.html | 2 +- dev/uu_dircolors/fn.uu_app.html | 2 +- dev/uu_dircolors/fn.uumain.html | 2 +- dev/uu_dircolors/index.html | 2 +- dev/uu_dircolors/trait.StrUtils.html | 14 +- dev/uu_dirname/all.html | 2 +- dev/uu_dirname/fn.uu_app.html | 2 +- dev/uu_dirname/fn.uumain.html | 2 +- dev/uu_dirname/index.html | 2 +- dev/uu_du/all.html | 2 +- dev/uu_du/fn.uu_app.html | 2 +- dev/uu_du/fn.uumain.html | 2 +- dev/uu_du/index.html | 2 +- dev/uu_echo/all.html | 2 +- dev/uu_echo/fn.uu_app.html | 2 +- dev/uu_echo/fn.uumain.html | 2 +- dev/uu_echo/index.html | 2 +- dev/uu_env/all.html | 2 +- dev/uu_env/fn.uu_app.html | 2 +- dev/uu_env/fn.uumain.html | 2 +- dev/uu_env/index.html | 2 +- dev/uu_expand/all.html | 2 +- dev/uu_expand/fn.uu_app.html | 2 +- dev/uu_expand/fn.uumain.html | 2 +- dev/uu_expand/index.html | 2 +- dev/uu_expand/options/index.html | 2 +- dev/uu_expand/options/static.FILES.html | 2 +- dev/uu_expand/options/static.INITIAL.html | 2 +- dev/uu_expand/options/static.NO_UTF8.html | 2 +- dev/uu_expand/options/static.TABS.html | 2 +- dev/uu_expr/all.html | 2 +- dev/uu_expr/fn.uu_app.html | 2 +- dev/uu_expr/fn.uumain.html | 2 +- dev/uu_expr/index.html | 2 +- dev/uu_factor/all.html | 2 +- dev/uu_factor/fn.factor.html | 2 +- dev/uu_factor/fn.uu_app.html | 2 +- dev/uu_factor/fn.uumain.html | 2 +- dev/uu_factor/index.html | 2 +- dev/uu_factor/numeric/fn.gcd.html | 2 +- dev/uu_factor/numeric/index.html | 2 +- dev/uu_factor/struct.Factors.html | 28 +- dev/uu_factor/table/constant.CHUNK_SIZE.html | 2 +- dev/uu_factor/table/constant.NEXT_PRIME.html | 2 +- .../table/constant.PRIME_INVERSIONS_U64.html | 2 +- dev/uu_factor/table/fn.factor.html | 2 +- dev/uu_factor/table/fn.factor_chunk.html | 2 +- dev/uu_factor/table/index.html | 2 +- dev/uu_false/all.html | 2 +- dev/uu_false/fn.uu_app.html | 2 +- dev/uu_false/fn.uumain.html | 2 +- dev/uu_false/index.html | 2 +- dev/uu_fmt/all.html | 2 +- dev/uu_fmt/fn.uu_app.html | 2 +- dev/uu_fmt/fn.uumain.html | 2 +- dev/uu_fmt/index.html | 2 +- dev/uu_fmt/struct.FmtOptions.html | 15 +- dev/uu_fmt/type.FileOrStdReader.html | 2 +- dev/uu_fold/all.html | 2 +- dev/uu_fold/fn.uu_app.html | 2 +- dev/uu_fold/fn.uumain.html | 2 +- dev/uu_fold/index.html | 2 +- dev/uu_groups/all.html | 2 +- dev/uu_groups/fn.uu_app.html | 2 +- dev/uu_groups/fn.uumain.html | 2 +- dev/uu_groups/index.html | 2 +- dev/uu_hashsum/all.html | 2 +- dev/uu_hashsum/fn.uu_app_b3sum.html | 2 +- dev/uu_hashsum/fn.uu_app_bits.html | 2 +- dev/uu_hashsum/fn.uu_app_common.html | 2 +- dev/uu_hashsum/fn.uu_app_custom.html | 2 +- dev/uu_hashsum/fn.uumain.html | 2 +- dev/uu_hashsum/index.html | 2 +- dev/uu_head/all.html | 2 +- dev/uu_head/fn.uu_app.html | 2 +- dev/uu_head/fn.uumain.html | 2 +- dev/uu_head/index.html | 2 +- dev/uu_hostid/all.html | 2 +- dev/uu_hostid/fn.gethostid.html | 2 +- dev/uu_hostid/fn.uu_app.html | 2 +- dev/uu_hostid/fn.uumain.html | 2 +- dev/uu_hostid/index.html | 2 +- dev/uu_hostname/all.html | 2 +- dev/uu_hostname/fn.uu_app.html | 2 +- dev/uu_hostname/fn.uumain.html | 2 +- dev/uu_hostname/index.html | 2 +- dev/uu_id/all.html | 2 +- dev/uu_id/fn.uu_app.html | 2 +- dev/uu_id/fn.uumain.html | 2 +- dev/uu_id/index.html | 2 +- dev/uu_install/all.html | 2 +- dev/uu_install/enum.MainFunction.html | 27 +- dev/uu_install/fn.uu_app.html | 2 +- dev/uu_install/fn.uumain.html | 2 +- dev/uu_install/index.html | 2 +- dev/uu_install/struct.Behavior.html | 17 +- dev/uu_join/all.html | 2 +- dev/uu_join/fn.uu_app.html | 2 +- dev/uu_join/fn.uumain.html | 2 +- dev/uu_join/index.html | 2 +- dev/uu_kill/all.html | 2 +- dev/uu_kill/enum.Mode.html | 22 +- dev/uu_kill/fn.uu_app.html | 2 +- dev/uu_kill/fn.uumain.html | 2 +- dev/uu_kill/index.html | 2 +- dev/uu_kill/options/index.html | 2 +- dev/uu_kill/options/static.LIST.html | 2 +- .../options/static.PIDS_OR_SIGNALS.html | 2 +- dev/uu_kill/options/static.SIGNAL.html | 2 +- dev/uu_kill/options/static.TABLE.html | 2 +- dev/uu_link/all.html | 2 +- dev/uu_link/fn.uu_app.html | 2 +- dev/uu_link/fn.uumain.html | 2 +- dev/uu_link/index.html | 2 +- dev/uu_link/options/index.html | 2 +- dev/uu_link/options/static.FILES.html | 2 +- dev/uu_ln/all.html | 2 +- dev/uu_ln/enum.OverwriteMode.html | 28 +- dev/uu_ln/fn.uu_app.html | 2 +- dev/uu_ln/fn.uumain.html | 2 +- dev/uu_ln/index.html | 2 +- dev/uu_ln/struct.Settings.html | 15 +- dev/uu_logname/all.html | 2 +- dev/uu_logname/fn.getlogin.html | 2 +- dev/uu_logname/fn.uu_app.html | 2 +- dev/uu_logname/fn.uumain.html | 2 +- dev/uu_logname/index.html | 2 +- dev/uu_ls/all.html | 2 +- dev/uu_ls/enum.Format.html | 23 +- dev/uu_ls/fn.list.html | 2 +- dev/uu_ls/fn.uu_app.html | 2 +- dev/uu_ls/fn.uumain.html | 2 +- dev/uu_ls/index.html | 2 +- dev/uu_ls/options/dereference/index.html | 2 +- dev/uu_ls/options/dereference/static.ALL.html | 2 +- .../options/dereference/static.ARGS.html | 2 +- .../options/dereference/static.DIR_ARGS.html | 2 +- dev/uu_ls/options/files/index.html | 2 +- dev/uu_ls/options/files/static.ALL.html | 2 +- .../options/files/static.ALMOST_ALL.html | 2 +- dev/uu_ls/options/format/index.html | 2 +- dev/uu_ls/options/format/static.ACROSS.html | 2 +- dev/uu_ls/options/format/static.COLUMNS.html | 2 +- dev/uu_ls/options/format/static.COMMAS.html | 2 +- dev/uu_ls/options/format/static.LONG.html | 2 +- .../options/format/static.LONG_NO_GROUP.html | 2 +- .../options/format/static.LONG_NO_OWNER.html | 2 +- .../format/static.LONG_NUMERIC_UID_GID.html | 2 +- dev/uu_ls/options/format/static.ONE_LINE.html | 2 +- dev/uu_ls/options/format/static.TAB_SIZE.html | 2 +- dev/uu_ls/options/index.html | 2 +- dev/uu_ls/options/indicator_style/index.html | 2 +- .../indicator_style/static.CLASSIFY.html | 2 +- .../indicator_style/static.FILE_TYPE.html | 2 +- .../options/indicator_style/static.SLASH.html | 2 +- dev/uu_ls/options/quoting/index.html | 2 +- dev/uu_ls/options/quoting/static.C.html | 2 +- dev/uu_ls/options/quoting/static.ESCAPE.html | 2 +- dev/uu_ls/options/quoting/static.LITERAL.html | 2 +- dev/uu_ls/options/size/index.html | 2 +- .../options/size/static.ALLOCATION_SIZE.html | 2 +- dev/uu_ls/options/size/static.BLOCK_SIZE.html | 2 +- .../options/size/static.HUMAN_READABLE.html | 2 +- dev/uu_ls/options/size/static.KIBIBYTES.html | 2 +- dev/uu_ls/options/size/static.SI.html | 2 +- dev/uu_ls/options/sort/index.html | 2 +- dev/uu_ls/options/sort/static.EXTENSION.html | 2 +- dev/uu_ls/options/sort/static.NONE.html | 2 +- dev/uu_ls/options/sort/static.SIZE.html | 2 +- dev/uu_ls/options/sort/static.TIME.html | 2 +- dev/uu_ls/options/sort/static.VERSION.html | 2 +- dev/uu_ls/options/static.AUTHOR.html | 2 +- dev/uu_ls/options/static.COLOR.html | 2 +- dev/uu_ls/options/static.CONTEXT.html | 2 +- dev/uu_ls/options/static.DIRECTORY.html | 2 +- dev/uu_ls/options/static.DIRED.html | 2 +- dev/uu_ls/options/static.FORMAT.html | 2 +- dev/uu_ls/options/static.FULL_TIME.html | 2 +- .../static.GROUP_DIRECTORIES_FIRST.html | 2 +- dev/uu_ls/options/static.HELP.html | 2 +- dev/uu_ls/options/static.HIDE.html | 2 +- .../options/static.HIDE_CONTROL_CHARS.html | 2 +- dev/uu_ls/options/static.IGNORE.html | 2 +- dev/uu_ls/options/static.IGNORE_BACKUPS.html | 2 +- dev/uu_ls/options/static.INDICATOR_STYLE.html | 2 +- dev/uu_ls/options/static.INODE.html | 2 +- dev/uu_ls/options/static.NO_GROUP.html | 2 +- dev/uu_ls/options/static.PATHS.html | 2 +- dev/uu_ls/options/static.QUOTING_STYLE.html | 2 +- dev/uu_ls/options/static.RECURSIVE.html | 2 +- dev/uu_ls/options/static.REVERSE.html | 2 +- .../options/static.SHOW_CONTROL_CHARS.html | 2 +- dev/uu_ls/options/static.SORT.html | 2 +- dev/uu_ls/options/static.TIME.html | 2 +- dev/uu_ls/options/static.TIME_STYLE.html | 2 +- dev/uu_ls/options/static.WIDTH.html | 2 +- dev/uu_ls/options/static.ZERO.html | 2 +- dev/uu_ls/options/time/index.html | 2 +- dev/uu_ls/options/time/static.ACCESS.html | 2 +- dev/uu_ls/options/time/static.CHANGE.html | 2 +- dev/uu_ls/struct.Config.html | 19 +- dev/uu_mkdir/all.html | 2 +- dev/uu_mkdir/fn.uu_app.html | 2 +- dev/uu_mkdir/fn.uumain.html | 2 +- dev/uu_mkdir/index.html | 2 +- dev/uu_mkfifo/all.html | 2 +- dev/uu_mkfifo/fn.uu_app.html | 2 +- dev/uu_mkfifo/fn.uumain.html | 2 +- dev/uu_mkfifo/index.html | 2 +- dev/uu_mknod/all.html | 2 +- dev/uu_mknod/fn.uu_app.html | 2 +- dev/uu_mknod/fn.uumain.html | 2 +- dev/uu_mknod/index.html | 2 +- dev/uu_mktemp/all.html | 2 +- dev/uu_mktemp/fn.dry_exec.html | 2 +- dev/uu_mktemp/fn.uu_app.html | 2 +- dev/uu_mktemp/fn.uumain.html | 2 +- dev/uu_mktemp/index.html | 2 +- dev/uu_more/all.html | 2 +- dev/uu_more/fn.uu_app.html | 2 +- dev/uu_more/fn.uumain.html | 2 +- dev/uu_more/index.html | 2 +- dev/uu_more/options/constant.CLEAN_PRINT.html | 2 +- dev/uu_more/options/constant.FILES.html | 2 +- dev/uu_more/options/constant.FROM_LINE.html | 2 +- dev/uu_more/options/constant.LINES.html | 2 +- dev/uu_more/options/constant.LOGICAL.html | 2 +- dev/uu_more/options/constant.NO_PAUSE.html | 2 +- dev/uu_more/options/constant.NUMBER.html | 2 +- dev/uu_more/options/constant.PATTERN.html | 2 +- dev/uu_more/options/constant.PLAIN.html | 2 +- dev/uu_more/options/constant.PRINT_OVER.html | 2 +- dev/uu_more/options/constant.SILENT.html | 2 +- dev/uu_more/options/constant.SQUEEZE.html | 2 +- dev/uu_more/options/index.html | 2 +- dev/uu_mv/all.html | 2 +- dev/uu_mv/enum.OverwriteMode.html | 27 +- dev/uu_mv/fn.uu_app.html | 2 +- dev/uu_mv/fn.uumain.html | 2 +- dev/uu_mv/index.html | 2 +- dev/uu_mv/struct.Behavior.html | 15 +- dev/uu_nice/all.html | 2 +- dev/uu_nice/fn.uu_app.html | 2 +- dev/uu_nice/fn.uumain.html | 2 +- dev/uu_nice/index.html | 2 +- dev/uu_nice/options/index.html | 2 +- dev/uu_nice/options/static.ADJUSTMENT.html | 2 +- dev/uu_nice/options/static.COMMAND.html | 2 +- dev/uu_nl/all.html | 2 +- dev/uu_nl/fn.uu_app.html | 2 +- dev/uu_nl/fn.uumain.html | 2 +- dev/uu_nl/index.html | 2 +- .../options/constant.BODY_NUMBERING.html | 2 +- dev/uu_nl/options/constant.FILE.html | 2 +- .../options/constant.FOOTER_NUMBERING.html | 2 +- .../options/constant.HEADER_NUMBERING.html | 2 +- dev/uu_nl/options/constant.HELP.html | 2 +- .../options/constant.JOIN_BLANK_LINES.html | 2 +- .../options/constant.LINE_INCREMENT.html | 2 +- dev/uu_nl/options/constant.NO_RENUMBER.html | 2 +- dev/uu_nl/options/constant.NUMBER_FORMAT.html | 2 +- .../options/constant.NUMBER_SEPARATOR.html | 2 +- dev/uu_nl/options/constant.NUMBER_WIDTH.html | 2 +- .../options/constant.SECTION_DELIMITER.html | 2 +- .../constant.STARTING_LINE_NUMBER.html | 2 +- dev/uu_nl/options/index.html | 2 +- dev/uu_nl/struct.Settings.html | 15 +- dev/uu_nohup/all.html | 2 +- dev/uu_nohup/fn.uu_app.html | 2 +- dev/uu_nohup/fn.uumain.html | 2 +- dev/uu_nohup/index.html | 2 +- dev/uu_nproc/all.html | 2 +- .../constant._SC_NPROCESSORS_CONF.html | 2 +- dev/uu_nproc/fn.uu_app.html | 2 +- dev/uu_nproc/fn.uumain.html | 2 +- dev/uu_nproc/index.html | 2 +- dev/uu_numfmt/all.html | 2 +- dev/uu_numfmt/errors/enum.NumfmtError.html | 35 +- dev/uu_numfmt/errors/index.html | 2 +- dev/uu_numfmt/fn.uu_app.html | 2 +- dev/uu_numfmt/fn.uumain.html | 2 +- dev/uu_numfmt/format/fn.div_round.html | 34 +- dev/uu_numfmt/format/fn.format_and_print.html | 4 +- dev/uu_numfmt/format/index.html | 7 +- .../format/struct.WhitespaceSplitter.html | 461 +- dev/uu_numfmt/index.html | 2 +- dev/uu_numfmt/options/constant.DELIMITER.html | 2 +- dev/uu_numfmt/options/constant.FIELD.html | 2 +- .../options/constant.FIELD_DEFAULT.html | 2 +- dev/uu_numfmt/options/constant.FORMAT.html | 2 +- dev/uu_numfmt/options/constant.FROM.html | 2 +- .../options/constant.FROM_DEFAULT.html | 2 +- dev/uu_numfmt/options/constant.FROM_UNIT.html | 2 +- .../options/constant.FROM_UNIT_DEFAULT.html | 2 +- dev/uu_numfmt/options/constant.HEADER.html | 2 +- .../options/constant.HEADER_DEFAULT.html | 2 +- dev/uu_numfmt/options/constant.NUMBER.html | 2 +- dev/uu_numfmt/options/constant.PADDING.html | 2 +- dev/uu_numfmt/options/constant.ROUND.html | 2 +- dev/uu_numfmt/options/constant.SUFFIX.html | 2 +- dev/uu_numfmt/options/constant.TO.html | 2 +- .../options/constant.TO_DEFAULT.html | 2 +- dev/uu_numfmt/options/constant.TO_UNIT.html | 2 +- .../options/constant.TO_UNIT_DEFAULT.html | 2 +- dev/uu_numfmt/options/enum.RoundMethod.html | 22 +- dev/uu_numfmt/options/index.html | 2 +- .../options/struct.FormatOptions.html | 38 +- .../options/struct.NumfmtOptions.html | 27 +- .../options/struct.TransformOptions.html | 21 +- dev/uu_od/all.html | 2 +- dev/uu_od/fn.uu_app.html | 2 +- dev/uu_od/fn.uumain.html | 2 +- dev/uu_od/index.html | 2 +- dev/uu_paste/all.html | 2 +- dev/uu_paste/fn.uu_app.html | 2 +- dev/uu_paste/fn.uumain.html | 2 +- dev/uu_paste/index.html | 2 +- dev/uu_pathchk/all.html | 2 +- dev/uu_pathchk/fn.uu_app.html | 2 +- dev/uu_pathchk/fn.uumain.html | 2 +- dev/uu_pathchk/index.html | 2 +- dev/uu_pinky/all.html | 2 +- dev/uu_pinky/fn.uu_app.html | 2 +- dev/uu_pinky/fn.uumain.html | 2 +- dev/uu_pinky/index.html | 2 +- dev/uu_pinky/trait.Capitalize.html | 6 +- dev/uu_pr/all.html | 2 +- dev/uu_pr/fn.uu_app.html | 2 +- dev/uu_pr/fn.uumain.html | 2 +- dev/uu_pr/index.html | 2 +- dev/uu_printenv/all.html | 2 +- dev/uu_printenv/fn.uu_app.html | 2 +- dev/uu_printenv/fn.uumain.html | 2 +- dev/uu_printenv/index.html | 2 +- dev/uu_printf/all.html | 2 +- dev/uu_printf/fn.uu_app.html | 2 +- dev/uu_printf/fn.uumain.html | 2 +- dev/uu_printf/index.html | 2 +- dev/uu_ptx/all.html | 2 +- dev/uu_ptx/fn.uu_app.html | 2 +- dev/uu_ptx/fn.uumain.html | 2 +- dev/uu_ptx/index.html | 2 +- dev/uu_pwd/all.html | 2 +- dev/uu_pwd/fn.uu_app.html | 2 +- dev/uu_pwd/fn.uumain.html | 2 +- dev/uu_pwd/index.html | 2 +- dev/uu_readlink/all.html | 2 +- dev/uu_readlink/fn.uu_app.html | 2 +- dev/uu_readlink/fn.uumain.html | 2 +- dev/uu_readlink/index.html | 2 +- dev/uu_realpath/all.html | 2 +- dev/uu_realpath/fn.uu_app.html | 2 +- dev/uu_realpath/fn.uumain.html | 2 +- dev/uu_realpath/index.html | 2 +- dev/uu_relpath/all.html | 2 +- dev/uu_relpath/fn.uu_app.html | 2 +- dev/uu_relpath/fn.uumain.html | 2 +- dev/uu_relpath/index.html | 2 +- dev/uu_rm/all.html | 2 +- dev/uu_rm/fn.uu_app.html | 2 +- dev/uu_rm/fn.uumain.html | 2 +- dev/uu_rm/index.html | 2 +- dev/uu_rmdir/all.html | 2 +- dev/uu_rmdir/fn.uu_app.html | 2 +- dev/uu_rmdir/fn.uumain.html | 2 +- dev/uu_rmdir/index.html | 2 +- dev/uu_runcon/all.html | 2 +- dev/uu_runcon/fn.uu_app.html | 2 +- dev/uu_runcon/fn.uumain.html | 2 +- dev/uu_runcon/index.html | 2 +- dev/uu_runcon/options/constant.COMPUTE.html | 2 +- dev/uu_runcon/options/constant.RANGE.html | 2 +- dev/uu_runcon/options/constant.ROLE.html | 2 +- dev/uu_runcon/options/constant.TYPE.html | 2 +- dev/uu_runcon/options/constant.USER.html | 2 +- dev/uu_runcon/options/index.html | 2 +- dev/uu_seq/all.html | 2 +- dev/uu_seq/fn.uu_app.html | 2 +- dev/uu_seq/fn.uumain.html | 2 +- dev/uu_seq/index.html | 2 +- dev/uu_shred/all.html | 2 +- dev/uu_shred/fn.uu_app.html | 2 +- dev/uu_shred/fn.uumain.html | 2 +- dev/uu_shred/index.html | 2 +- dev/uu_shred/options/constant.EXACT.html | 2 +- dev/uu_shred/options/constant.FILE.html | 2 +- dev/uu_shred/options/constant.FORCE.html | 2 +- dev/uu_shred/options/constant.ITERATIONS.html | 2 +- dev/uu_shred/options/constant.REMOVE.html | 2 +- dev/uu_shred/options/constant.SIZE.html | 2 +- dev/uu_shred/options/constant.VERBOSE.html | 2 +- dev/uu_shred/options/constant.ZERO.html | 2 +- dev/uu_shred/options/index.html | 2 +- dev/uu_shuf/all.html | 2 +- dev/uu_shuf/fn.uu_app.html | 2 +- dev/uu_shuf/fn.uumain.html | 2 +- dev/uu_shuf/index.html | 2 +- dev/uu_sleep/all.html | 2 +- dev/uu_sleep/fn.uu_app.html | 2 +- dev/uu_sleep/fn.uumain.html | 2 +- dev/uu_sleep/index.html | 2 +- dev/uu_sort/all.html | 2 +- dev/uu_sort/enum.GeneralF64ParseResult.html | 45 +- dev/uu_sort/fn.uu_app.html | 2 +- dev/uu_sort/fn.uumain.html | 2 +- dev/uu_sort/index.html | 2 +- dev/uu_sort/struct.GlobalSettings.html | 27 +- dev/uu_sort/struct.Line.html | 27 +- dev/uu_sort/struct.Output.html | 21 +- dev/uu_split/all.html | 2 +- dev/uu_split/fn.uu_app.html | 2 +- dev/uu_split/fn.uumain.html | 2 +- dev/uu_split/index.html | 2 +- dev/uu_stat/all.html | 2 +- dev/uu_stat/constant.F_ALTER.html | 2 +- dev/uu_stat/constant.F_GROUP.html | 2 +- dev/uu_stat/constant.F_LEFT.html | 2 +- dev/uu_stat/constant.F_SIGN.html | 2 +- dev/uu_stat/constant.F_SPACE.html | 2 +- dev/uu_stat/constant.F_ZERO.html | 2 +- dev/uu_stat/enum.OutputType.html | 23 +- dev/uu_stat/enum.Token.html | 33 +- dev/uu_stat/fn.group_num.html | 2 +- dev/uu_stat/fn.uu_app.html | 2 +- dev/uu_stat/fn.uumain.html | 2 +- dev/uu_stat/index.html | 2 +- dev/uu_stat/options/index.html | 2 +- dev/uu_stat/options/static.DEREFERENCE.html | 2 +- dev/uu_stat/options/static.FILE_SYSTEM.html | 2 +- dev/uu_stat/options/static.FORMAT.html | 2 +- dev/uu_stat/options/static.PRINTF.html | 2 +- dev/uu_stat/options/static.TERSE.html | 2 +- dev/uu_stat/struct.Stater.html | 15 +- dev/uu_stat/trait.ScanUtil.html | 8 +- dev/uu_stdbuf/all.html | 2 +- dev/uu_stdbuf/fn.uu_app.html | 2 +- dev/uu_stdbuf/fn.uumain.html | 2 +- dev/uu_stdbuf/index.html | 2 +- dev/uu_stty/all.html | 2 +- dev/uu_stty/fn.tiocgwinsz.html | 4 +- dev/uu_stty/fn.tiocswinsz.html | 4 +- dev/uu_stty/fn.uu_app.html | 2 +- dev/uu_stty/fn.uumain.html | 2 +- dev/uu_stty/index.html | 4 +- dev/uu_stty/struct.Flag.html | 21 +- dev/uu_stty/struct.TermSize.html | 17 +- dev/uu_sum/all.html | 2 +- dev/uu_sum/fn.uu_app.html | 2 +- dev/uu_sum/fn.uumain.html | 2 +- dev/uu_sum/index.html | 2 +- dev/uu_sync/all.html | 2 +- dev/uu_sync/fn.uu_app.html | 2 +- dev/uu_sync/fn.uumain.html | 2 +- dev/uu_sync/index.html | 2 +- dev/uu_sync/options/index.html | 2 +- dev/uu_sync/options/static.DATA.html | 2 +- dev/uu_sync/options/static.FILE_SYSTEM.html | 2 +- dev/uu_tac/all.html | 2 +- dev/uu_tac/fn.uu_app.html | 2 +- dev/uu_tac/fn.uumain.html | 2 +- dev/uu_tac/index.html | 2 +- dev/uu_tail/all.html | 2 +- dev/uu_tail/args/enum.FilterMode.html | 28 +- dev/uu_tail/args/enum.FollowMode.html | 28 +- dev/uu_tail/args/enum.Signum.html | 32 +- dev/uu_tail/args/fn.arg_iterate.html | 2 +- dev/uu_tail/args/fn.parse_args.html | 2 +- .../args/fn.stdin_is_pipe_or_fifo.html | 2 +- dev/uu_tail/args/fn.uu_app.html | 2 +- dev/uu_tail/args/index.html | 2 +- dev/uu_tail/args/options/index.html | 2 +- .../args/options/static.ARG_FILES.html | 2 +- dev/uu_tail/args/options/static.BYTES.html | 2 +- .../options/static.DISABLE_INOTIFY_TERM.html | 2 +- dev/uu_tail/args/options/static.FOLLOW.html | 2 +- .../args/options/static.FOLLOW_RETRY.html | 2 +- dev/uu_tail/args/options/static.LINES.html | 2 +- .../options/static.MAX_UNCHANGED_STATS.html | 2 +- dev/uu_tail/args/options/static.PID.html | 2 +- .../options/static.PRESUME_INPUT_PIPE.html | 2 +- dev/uu_tail/args/options/static.RETRY.html | 2 +- .../args/options/static.SLEEP_INT.html | 2 +- .../args/options/static.USE_POLLING.html | 2 +- .../args/options/static.ZERO_TERM.html | 2 +- dev/uu_tail/args/options/verbosity/index.html | 2 +- .../args/options/verbosity/static.QUIET.html | 2 +- .../options/verbosity/static.VERBOSE.html | 2 +- dev/uu_tail/args/struct.Settings.html | 35 +- dev/uu_tail/chunks/constant.BLOCK_SIZE.html | 4 +- dev/uu_tail/chunks/constant.BUFFER_SIZE.html | 4 +- dev/uu_tail/chunks/index.html | 21 +- dev/uu_tail/chunks/struct.BytesChunk.html | 48 +- .../chunks/struct.BytesChunkBuffer.html | 59 +- dev/uu_tail/chunks/struct.LinesChunk.html | 52 +- .../chunks/struct.LinesChunkBuffer.html | 21 +- dev/uu_tail/chunks/struct.ReverseChunks.html | 441 +- dev/uu_tail/fn.uumain.html | 2 +- dev/uu_tail/index.html | 5 +- dev/uu_tail/text/index.html | 2 +- dev/uu_tail/text/static.BACKEND.html | 2 +- dev/uu_tail/text/static.BAD_FD.html | 2 +- .../text/static.BECOME_INACCESSIBLE.html | 2 +- dev/uu_tail/text/static.DASH.html | 2 +- dev/uu_tail/text/static.DEV_STDIN.html | 2 +- dev/uu_tail/text/static.FD0.html | 2 +- .../text/static.NO_FILES_REMAINING.html | 2 +- dev/uu_tail/text/static.NO_SUCH_FILE.html | 2 +- dev/uu_tail/text/static.STDIN_HEADER.html | 2 +- dev/uu_tee/all.html | 2 +- dev/uu_tee/fn.uu_app.html | 2 +- dev/uu_tee/fn.uumain.html | 2 +- dev/uu_tee/index.html | 2 +- dev/uu_test/all.html | 2 +- dev/uu_test/fn.uu_app.html | 2 +- dev/uu_test/fn.uumain.html | 2 +- dev/uu_test/index.html | 2 +- dev/uu_timeout/all.html | 2 +- dev/uu_timeout/fn.uu_app.html | 2 +- dev/uu_timeout/fn.uumain.html | 2 +- dev/uu_timeout/index.html | 2 +- dev/uu_timeout/options/index.html | 2 +- dev/uu_timeout/options/static.COMMAND.html | 2 +- dev/uu_timeout/options/static.DURATION.html | 2 +- dev/uu_timeout/options/static.FOREGROUND.html | 2 +- dev/uu_timeout/options/static.KILL_AFTER.html | 2 +- .../options/static.PRESERVE_STATUS.html | 2 +- dev/uu_timeout/options/static.SIGNAL.html | 2 +- dev/uu_timeout/options/static.VERBOSE.html | 2 +- dev/uu_touch/all.html | 2 +- dev/uu_touch/fn.uu_app.html | 2 +- dev/uu_touch/fn.uumain.html | 2 +- dev/uu_touch/index.html | 2 +- dev/uu_touch/options/index.html | 2 +- dev/uu_touch/options/sources/index.html | 2 +- .../options/sources/static.CURRENT.html | 2 +- dev/uu_touch/options/sources/static.DATE.html | 2 +- .../options/sources/static.REFERENCE.html | 2 +- dev/uu_touch/options/static.ACCESS.html | 2 +- dev/uu_touch/options/static.HELP.html | 2 +- dev/uu_touch/options/static.MODIFICATION.html | 2 +- dev/uu_touch/options/static.NO_CREATE.html | 2 +- dev/uu_touch/options/static.NO_DEREF.html | 2 +- dev/uu_touch/options/static.SOURCES.html | 2 +- dev/uu_touch/options/static.TIME.html | 2 +- dev/uu_tr/all.html | 2 +- dev/uu_tr/fn.uu_app.html | 2 +- dev/uu_tr/fn.uumain.html | 2 +- dev/uu_tr/index.html | 2 +- dev/uu_true/all.html | 2 +- dev/uu_true/fn.uu_app.html | 2 +- dev/uu_true/fn.uumain.html | 2 +- dev/uu_true/index.html | 2 +- dev/uu_truncate/all.html | 2 +- dev/uu_truncate/fn.uu_app.html | 2 +- dev/uu_truncate/fn.uumain.html | 2 +- dev/uu_truncate/index.html | 2 +- dev/uu_truncate/options/index.html | 2 +- dev/uu_truncate/options/static.ARG_FILES.html | 2 +- dev/uu_truncate/options/static.IO_BLOCKS.html | 2 +- dev/uu_truncate/options/static.NO_CREATE.html | 2 +- dev/uu_truncate/options/static.REFERENCE.html | 2 +- dev/uu_truncate/options/static.SIZE.html | 2 +- dev/uu_tsort/all.html | 2 +- dev/uu_tsort/fn.uu_app.html | 2 +- dev/uu_tsort/fn.uumain.html | 2 +- dev/uu_tsort/index.html | 2 +- dev/uu_tty/all.html | 2 +- dev/uu_tty/fn.uu_app.html | 2 +- dev/uu_tty/fn.uumain.html | 2 +- dev/uu_tty/index.html | 2 +- dev/uu_uname/all.html | 2 +- dev/uu_uname/fn.uu_app.html | 2 +- dev/uu_uname/fn.uumain.html | 2 +- dev/uu_uname/index.html | 2 +- dev/uu_uname/options/index.html | 2 +- dev/uu_uname/options/static.ALL.html | 2 +- dev/uu_uname/options/static.HWPLATFORM.html | 2 +- dev/uu_uname/options/static.KERNELNAME.html | 2 +- .../options/static.KERNELRELEASE.html | 2 +- .../options/static.KERNELVERSION.html | 2 +- dev/uu_uname/options/static.MACHINE.html | 2 +- dev/uu_uname/options/static.NODENAME.html | 2 +- dev/uu_uname/options/static.OS.html | 2 +- dev/uu_uname/options/static.PROCESSOR.html | 2 +- dev/uu_unexpand/all.html | 2 +- dev/uu_unexpand/fn.uu_app.html | 2 +- dev/uu_unexpand/fn.uumain.html | 2 +- dev/uu_unexpand/index.html | 2 +- dev/uu_uniq/all.html | 2 +- dev/uu_uniq/fn.uu_app.html | 2 +- dev/uu_uniq/fn.uumain.html | 2 +- dev/uu_uniq/index.html | 2 +- dev/uu_uniq/options/index.html | 2 +- dev/uu_uniq/options/static.ALL_REPEATED.html | 2 +- dev/uu_uniq/options/static.CHECK_CHARS.html | 2 +- dev/uu_uniq/options/static.COUNT.html | 2 +- dev/uu_uniq/options/static.GROUP.html | 2 +- dev/uu_uniq/options/static.IGNORE_CASE.html | 2 +- dev/uu_uniq/options/static.REPEATED.html | 2 +- dev/uu_uniq/options/static.SKIP_CHARS.html | 2 +- dev/uu_uniq/options/static.SKIP_FIELDS.html | 2 +- dev/uu_uniq/options/static.UNIQUE.html | 2 +- .../options/static.ZERO_TERMINATED.html | 2 +- dev/uu_unlink/all.html | 2 +- dev/uu_unlink/fn.uu_app.html | 2 +- dev/uu_unlink/fn.uumain.html | 2 +- dev/uu_unlink/index.html | 2 +- dev/uu_uptime/all.html | 2 +- dev/uu_uptime/fn.uu_app.html | 2 +- dev/uu_uptime/fn.uumain.html | 2 +- dev/uu_uptime/index.html | 2 +- dev/uu_uptime/options/index.html | 2 +- dev/uu_uptime/options/static.SINCE.html | 2 +- dev/uu_users/all.html | 2 +- dev/uu_users/fn.uu_app.html | 2 +- dev/uu_users/fn.uumain.html | 2 +- dev/uu_users/index.html | 2 +- dev/uu_vdir/all.html | 2 +- dev/uu_vdir/fn.uu_app.html | 2 +- dev/uu_vdir/fn.uumain.html | 2 +- dev/uu_vdir/index.html | 2 +- dev/uu_wc/all.html | 2 +- dev/uu_wc/fn.uu_app.html | 2 +- dev/uu_wc/fn.uumain.html | 2 +- dev/uu_wc/index.html | 2 +- dev/uu_wc/options/index.html | 2 +- dev/uu_wc/options/static.BYTES.html | 2 +- dev/uu_wc/options/static.CHAR.html | 2 +- dev/uu_wc/options/static.FILES0_FROM.html | 2 +- dev/uu_wc/options/static.LINES.html | 2 +- dev/uu_wc/options/static.MAX_LINE_LENGTH.html | 2 +- dev/uu_wc/options/static.WORDS.html | 2 +- dev/uu_who/all.html | 2 +- dev/uu_who/fn.uu_app.html | 2 +- dev/uu_who/fn.uumain.html | 2 +- dev/uu_who/index.html | 2 +- dev/uu_whoami/all.html | 2 +- dev/uu_whoami/fn.uu_app.html | 2 +- dev/uu_whoami/fn.uumain.html | 2 +- dev/uu_whoami/index.html | 2 +- dev/uu_yes/all.html | 2 +- dev/uu_yes/fn.exec.html | 2 +- dev/uu_yes/fn.uu_app.html | 2 +- dev/uu_yes/fn.uumain.html | 2 +- dev/uu_yes/index.html | 2 +- dev/uucore/all.html | 2 +- dev/uucore/attr.main.html | 2 +- .../backup_control/arguments/fn.backup.html | 4 +- .../arguments/fn.backup_no_args.html | 4 +- .../backup_control/arguments/fn.suffix.html | 4 +- .../backup_control/arguments/index.html | 7 +- .../arguments/static.OPT_BACKUP.html | 2 +- .../arguments/static.OPT_BACKUP_NO_ARG.html | 2 +- .../arguments/static.OPT_SUFFIX.html | 2 +- .../constant.BACKUP_CONTROL_LONG_HELP.html | 4 +- .../backup_control/enum.BackupError.html | 42 +- .../backup_control/enum.BackupMode.html | 28 +- .../fn.determine_backup_mode.html | 64 +- .../fn.determine_backup_suffix.html | 4 +- .../backup_control/fn.get_backup_path.html | 2 +- dev/uucore/backup_control/index.html | 69 +- .../static.BACKUP_CONTROL_VALUES.html | 2 +- dev/uucore/display/fn.print_verbatim.html | 4 +- dev/uucore/display/fn.println_verbatim.html | 4 +- dev/uucore/display/index.html | 8 +- dev/uucore/display/struct.Quoted.html | 34 +- dev/uucore/display/trait.Quotable.html | 30 +- dev/uucore/encoding/enum.DecodeError.html | 32 +- dev/uucore/encoding/enum.EncodeError.html | 17 +- dev/uucore/encoding/enum.Format.html | 22 +- dev/uucore/encoding/fn.decode.html | 2 +- dev/uucore/encoding/fn.encode.html | 2 +- dev/uucore/encoding/fn.wrap_print.html | 2 +- dev/uucore/encoding/fn.wrap_write.html | 2 +- dev/uucore/encoding/index.html | 2 +- dev/uucore/encoding/struct.Data.html | 15 +- dev/uucore/encoding/type.DecodeResult.html | 2 +- dev/uucore/entries/fn.get_groups.html | 4 +- dev/uucore/entries/fn.get_groups_gnu.html | 4 +- dev/uucore/entries/fn.gid2grp.html | 2 +- dev/uucore/entries/fn.grp2gid.html | 2 +- dev/uucore/entries/fn.uid2usr.html | 2 +- dev/uucore/entries/fn.usr2uid.html | 2 +- dev/uucore/entries/index.html | 41 +- dev/uucore/entries/struct.Group.html | 27 +- dev/uucore/entries/struct.Passwd.html | 45 +- dev/uucore/entries/trait.Locate.html | 6 +- dev/uucore/error/fn.get_exit_code.html | 4 +- dev/uucore/error/fn.set_exit_code.html | 20 +- dev/uucore/error/fn.strip_errno.html | 4 +- dev/uucore/error/index.html | 44 +- dev/uucore/error/macro.uio_error.html | 54 +- dev/uucore/error/struct.ClapErrorWrapper.html | 41 +- dev/uucore/error/struct.ExitCode.html | 41 +- dev/uucore/error/struct.UIoError.html | 58 +- dev/uucore/error/struct.USimpleError.html | 43 +- dev/uucore/error/struct.UUsageError.html | 33 +- dev/uucore/error/trait.FromIo.html | 8 +- dev/uucore/error/trait.UClapError.html | 6 +- dev/uucore/error/trait.UError.html | 182 +- dev/uucore/error/type.UResult.html | 4 +- dev/uucore/fn.args_os.html | 2 +- dev/uucore/fn.execution_phrase.html | 4 +- dev/uucore/fn.format_usage.html | 4 +- dev/uucore/fn.get_utility_is_second_arg.html | 2 +- dev/uucore/fn.set_utility_is_second_arg.html | 2 +- dev/uucore/fn.util_name.html | 4 +- dev/uucore/fs/enum.MissingHandling.html | 28 +- dev/uucore/fs/enum.ResolveMode.html | 28 +- dev/uucore/fs/fn.canonicalize.html | 8 +- .../fs/fn.dir_strip_dot_for_creation.html | 4 +- dev/uucore/fs/fn.display_permissions.html | 4 +- .../fs/fn.display_permissions_unix.html | 4 +- .../fs/fn.infos_refer_to_same_file.html | 4 +- dev/uucore/fs/fn.make_path_relative_to.html | 4 +- dev/uucore/fs/fn.normalize_path.html | 4 +- .../fs/fn.paths_refer_to_same_file.html | 4 +- dev/uucore/fs/fn.resolve_relative_path.html | 4 +- dev/uucore/fs/index.html | 26 +- dev/uucore/fs/macro.has.html | 6 +- dev/uucore/fs/struct.FileInformation.html | 28 +- dev/uucore/fsext/fn.StatFs.html | 2 +- dev/uucore/fsext/fn.pretty_filetype.html | 2 +- dev/uucore/fsext/fn.pretty_fstype.html | 2 +- dev/uucore/fsext/fn.pretty_time.html | 2 +- dev/uucore/fsext/fn.read_fs_list.html | 4 +- dev/uucore/fsext/fn.statfs.html | 2 +- dev/uucore/fsext/fn.statfs_fn.html | 2 +- dev/uucore/fsext/index.html | 5 +- dev/uucore/fsext/struct.FsUsage.html | 37 +- dev/uucore/fsext/struct.MountInfo.html | 39 +- dev/uucore/fsext/struct.StatFs.html | 48 +- dev/uucore/fsext/struct.statfs_fn.html | 48 +- dev/uucore/fsext/trait.BirthTime.html | 8 +- dev/uucore/fsext/trait.FsMeta.html | 24 +- dev/uucore/index.html | 31 +- dev/uucore/lines/fn.lines.html | 38 +- dev/uucore/lines/index.html | 12 +- dev/uucore/lines/struct.Lines.html | 439 +- dev/uucore/macro.bin.html | 6 +- dev/uucore/macro.crash.html | 16 +- dev/uucore/macro.crash_if_err.html | 20 +- dev/uucore/macro.has.html | 6 +- dev/uucore/macro.help_section.html | 6 +- dev/uucore/macro.help_usage.html | 4 +- dev/uucore/macro.show.html | 22 +- dev/uucore/macro.show_error.html | 8 +- dev/uucore/macro.show_if_err.html | 22 +- dev/uucore/macro.show_warning.html | 12 +- dev/uucore/macro.uio_error.html | 54 +- dev/uucore/memo/index.html | 4 +- dev/uucore/memo/struct.Memo.html | 15 +- dev/uucore/mode/fn.get_umask.html | 2 +- dev/uucore/mode/fn.parse_mode.html | 2 +- dev/uucore/mode/fn.parse_numeric.html | 2 +- dev/uucore/mode/fn.parse_symbolic.html | 2 +- dev/uucore/mode/fn.strip_minus_from_mode.html | 2 +- dev/uucore/mode/index.html | 4 +- dev/uucore/os/fn.is_wsl_1.html | 4 +- dev/uucore/os/fn.is_wsl_2.html | 2 +- dev/uucore/os/index.html | 3 +- dev/uucore/panic/fn.mute_sigpipe_panic.html | 4 +- dev/uucore/panic/index.html | 5 +- dev/uucore/parse_glob/fn.from_str.html | 12 +- dev/uucore/parse_glob/index.html | 5 +- .../parse_size/enum.ParseSizeError.html | 38 +- dev/uucore/parse_size/fn.parse_size.html | 12 +- dev/uucore/parse_size/index.html | 3 +- dev/uucore/parse_time/fn.from_str.html | 16 +- dev/uucore/parse_time/index.html | 7 +- dev/uucore/perms/entries/fn.get_groups.html | 4 +- .../perms/entries/fn.get_groups_gnu.html | 4 +- dev/uucore/perms/entries/fn.gid2grp.html | 2 +- dev/uucore/perms/entries/fn.grp2gid.html | 2 +- dev/uucore/perms/entries/fn.uid2usr.html | 2 +- dev/uucore/perms/entries/fn.usr2uid.html | 2 +- dev/uucore/perms/entries/index.html | 41 +- dev/uucore/perms/entries/struct.Group.html | 27 +- dev/uucore/perms/entries/struct.Passwd.html | 45 +- dev/uucore/perms/entries/trait.Locate.html | 6 +- dev/uucore/perms/enum.IfFrom.html | 23 +- dev/uucore/perms/enum.TraverseSymlinks.html | 22 +- dev/uucore/perms/enum.VerbosityLevel.html | 28 +- dev/uucore/perms/fn.chown_base.html | 4 +- dev/uucore/perms/fn.wrap_chown.html | 4 +- dev/uucore/perms/index.html | 10 +- .../perms/options/constant.ARG_FILES.html | 2 +- .../perms/options/constant.ARG_GROUP.html | 2 +- .../perms/options/constant.ARG_OWNER.html | 2 +- dev/uucore/perms/options/constant.FROM.html | 2 +- dev/uucore/perms/options/constant.HELP.html | 2 +- .../perms/options/constant.RECURSIVE.html | 2 +- .../perms/options/constant.REFERENCE.html | 2 +- .../dereference/constant.DEREFERENCE.html | 2 +- .../dereference/constant.NO_DEREFERENCE.html | 2 +- .../perms/options/dereference/index.html | 2 +- dev/uucore/perms/options/index.html | 2 +- .../preserve_root/constant.NO_PRESERVE.html | 2 +- .../preserve_root/constant.PRESERVE.html | 2 +- .../perms/options/preserve_root/index.html | 2 +- .../options/traverse/constant.EVERY.html | 2 +- .../traverse/constant.NO_TRAVERSE.html | 2 +- .../options/traverse/constant.TRAVERSE.html | 2 +- dev/uucore/perms/options/traverse/index.html | 2 +- .../options/verbosity/constant.CHANGES.html | 2 +- .../options/verbosity/constant.QUIET.html | 2 +- .../options/verbosity/constant.SILENT.html | 2 +- .../options/verbosity/constant.VERBOSE.html | 2 +- dev/uucore/perms/options/verbosity/index.html | 2 +- dev/uucore/perms/struct.ChownExecutor.html | 29 +- dev/uucore/perms/struct.Verbosity.html | 30 +- dev/uucore/pipes/fn.pipe.html | 4 +- dev/uucore/pipes/fn.splice.html | 4 +- dev/uucore/pipes/fn.splice_exact.html | 4 +- dev/uucore/pipes/fn.vmsplice.html | 4 +- dev/uucore/pipes/index.html | 8 +- dev/uucore/pipes/type.Error.html | 6 +- dev/uucore/pipes/type.Result.html | 4 +- dev/uucore/process/enum.ExitStatus.html | 34 +- dev/uucore/process/fn.getegid.html | 4 +- dev/uucore/process/fn.geteuid.html | 4 +- dev/uucore/process/fn.getgid.html | 4 +- dev/uucore/process/fn.getuid.html | 4 +- dev/uucore/process/index.html | 9 +- dev/uucore/process/trait.ChildExt.html | 12 +- dev/uucore/quoting_style/enum.Quotes.html | 22 +- .../quoting_style/enum.QuotingStyle.html | 25 +- dev/uucore/quoting_style/fn.escape_name.html | 2 +- dev/uucore/quoting_style/index.html | 2 +- dev/uucore/ranges/fn.complement.html | 2 +- dev/uucore/ranges/fn.contain.html | 24 +- dev/uucore/ranges/index.html | 3 +- dev/uucore/ranges/struct.Range.html | 65 +- dev/uucore/ringbuffer/index.html | 5 +- dev/uucore/ringbuffer/struct.RingBuffer.html | 61 +- dev/uucore/signals/fn.is_signal.html | 2 +- .../signals/fn.signal_by_name_or_value.html | 2 +- .../signals/fn.signal_name_by_value.html | 2 +- dev/uucore/signals/index.html | 2 +- dev/uucore/signals/static.ALL_SIGNALS.html | 2 +- dev/uucore/signals/static.DEFAULT_SIGNAL.html | 2 +- dev/uucore/trait.Args.html | 12 +- dev/uucore/utmpx/constant.ACCOUNTING.html | 2 +- dev/uucore/utmpx/constant.BOOT_TIME.html | 2 +- dev/uucore/utmpx/constant.DEAD_PROCESS.html | 2 +- dev/uucore/utmpx/constant.EMPTY.html | 2 +- dev/uucore/utmpx/constant.INIT_PROCESS.html | 2 +- dev/uucore/utmpx/constant.LOGIN_PROCESS.html | 2 +- dev/uucore/utmpx/constant.NEW_TIME.html | 2 +- dev/uucore/utmpx/constant.OLD_TIME.html | 2 +- dev/uucore/utmpx/constant.RUN_LVL.html | 2 +- dev/uucore/utmpx/constant.USER_PROCESS.html | 2 +- dev/uucore/utmpx/constant.UT_HOSTSIZE.html | 2 +- dev/uucore/utmpx/constant.UT_IDSIZE.html | 2 +- dev/uucore/utmpx/constant.UT_LINESIZE.html | 2 +- dev/uucore/utmpx/constant.UT_NAMESIZE.html | 2 +- dev/uucore/utmpx/fn.endutxent.html | 2 +- dev/uucore/utmpx/fn.getutxent.html | 2 +- dev/uucore/utmpx/fn.setutxent.html | 2 +- dev/uucore/utmpx/fn.utmpxname.html | 2 +- dev/uucore/utmpx/index.html | 21 +- dev/uucore/utmpx/static.DEFAULT_FILE.html | 2 +- dev/uucore/utmpx/struct.Utmpx.html | 39 +- dev/uucore/utmpx/struct.UtmpxIter.html | 440 +- dev/uucore/version_cmp/fn.version_cmp.html | 2 +- dev/uucore/version_cmp/index.html | 2 +- dev/uucore_procs/all.html | 2 +- dev/uucore_procs/attr.main.html | 2 +- dev/uucore_procs/index.html | 4 +- dev/uucore_procs/macro.help_section.html | 6 +- dev/uucore_procs/macro.help_usage.html | 4 +- dev/uudoc/all.html | 2 +- dev/uudoc/fn.get_zip_content.html | 2 +- dev/uudoc/fn.main.html | 2 +- dev/uudoc/fn.util_map.html | 2 +- dev/uudoc/index.html | 2 +- dev/uudoc/struct.MDWriter.html | 32 +- dev/uudoc/type.UtilityMap.html | 2 +- dev/vdir/all.html | 2 +- dev/vdir/fn.main.html | 2 +- dev/vdir/index.html | 2 +- dev/wc/all.html | 2 +- dev/wc/fn.main.html | 2 +- dev/wc/index.html | 2 +- dev/who/all.html | 2 +- dev/who/fn.main.html | 2 +- dev/who/index.html | 2 +- dev/whoami/all.html | 2 +- dev/whoami/fn.main.html | 2 +- dev/whoami/index.html | 2 +- dev/yes/all.html | 2 +- dev/yes/fn.main.html | 2 +- dev/yes/index.html | 2 +- 1767 files changed, 59663 insertions(+), 61637 deletions(-) create mode 100644 dev/implementors/core/error/trait.Error.js delete mode 100644 dev/implementors/std/error/trait.Error.js delete mode 100644 dev/src/coreutils/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-08c28f92bbf77c3a/out/uutils_map.rs.html create mode 100644 dev/src/coreutils/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-602414eb6d83e2f7/out/uutils_map.rs.html rename dev/src/uu_factor/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/{uu_factor-a22a187695a37cb5 => uu_factor-2ffad854a35da68f}/out/prime_table.rs.html (92%) delete mode 100644 dev/src/uudoc/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-08c28f92bbf77c3a/out/uutils_map.rs.html create mode 100644 dev/src/uudoc/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-602414eb6d83e2f7/out/uutils_map.rs.html diff --git a/dev/arch/all.html b/dev/arch/all.html index 89fa690be..9659cd088 100644 --- a/dev/arch/all.html +++ b/dev/arch/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/arch/fn.main.html b/dev/arch/fn.main.html index a2369ed60..12be573d5 100644 --- a/dev/arch/fn.main.html +++ b/dev/arch/fn.main.html @@ -1 +1 @@ -main in arch - Rust

Function arch::main

source · []
pub fn main()
\ No newline at end of file +main in arch - Rust

Function arch::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/arch/index.html b/dev/arch/index.html index dbf340712..9dd94bb64 100644 --- a/dev/arch/index.html +++ b/dev/arch/index.html @@ -1 +1 @@ -arch - Rust
\ No newline at end of file +arch - Rust
\ No newline at end of file diff --git a/dev/ayu.css b/dev/ayu.css index f98b3417c..336031ace 100644 --- a/dev/ayu.css +++ b/dev/ayu.css @@ -1 +1 @@ - :root{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;}.slider{background-color:#ccc;}.slider:before{background-color:white;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}h1,h2,h3,h4{color:white;}h1.fqn a{color:#fff;}h4{border:none;}.in-band{background-color:#0f1419;}.docblock code{color:#ffb454;}.code-header{color:#e6e1cf;}.docblock pre>code,pre>code{color:#e6e1cf;}span code{color:#e6e1cf;}.docblock a>code{color:#39AFD7 !important;}pre,.rustdoc.source .example-wrap{color:#e6e1cf;}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);}.sidebar .current,.sidebar a:hover{background-color:transparent;color:#ffb44c;}.sidebar-elems .location{color:#ff7733;}.line-numbers span{color:#5c6773;}.line-numbers .line-highlighted{color:#708090;background-color:rgba(255,236,164,0.06);padding-right:4px;border-right:1px solid #ffb44c;}.docblock table td,.docblock table th{border-color:#5c6773;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#000 !important;background-color:#c6afb3;}.search-results a{color:#0096cf;}.search-results a div.desc{color:#c5c5c5;}.content .item-info::before{color:#ccc;}.content span.foreigntype,.content a.foreigntype{color:#ffa0a5;}.content span.union,.content a.union{color:#ffa0a5;}.content span.constant,.content a.constant,.content span.static,.content a.static{color:#39AFD7;}.content span.primitive,.content a.primitive{color:#ffa0a5;}.content span.traitalias,.content a.traitalias{color:#39AFD7;}.content span.keyword,.content a.keyword{color:#39AFD7;}.content span.externcrate,.content span.mod,.content a.mod{color:#39AFD7;}.content span.struct,.content a.struct{color:#ffa0a5;}.content span.enum,.content a.enum{color:#ffa0a5;}.content span.trait,.content a.trait{color:#39AFD7;}.content span.type,.content a.type{color:#39AFD7;}.content span.type,.content a.type,.block a.current.type{color:#39AFD7;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#39AFD7;}.content span.fn,.content a.fn,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod,.content .fnname{color:#fdd687;}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:#a37acc;}.sidebar a{color:#53b1db;}.sidebar a.current.type{color:#53b1db;}.sidebar a.current.associatedtype{color:#53b1db;}pre.rust .comment{color:#788797;}pre.rust .doccomment{color:#a1ac88;}nav.main .current{border-top-color:#5c6773;border-bottom-color:#5c6773;}nav.main .separator{border:1px solid #5c6773;}a{color:#39AFD7;}.sidebar h2 a,.sidebar h3 a{color:white;}.search-results a{color:#0096cf;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before{color:#999;}details.rustdoc-toggle>summary::before{filter:invert(100%);}#crate-search,.search-input{background-color:#141920;border-color:#424c57;}#crate-search{border-color:#424c57 !important;}.search-input{color:#ffffff;}.module-item .stab,.import-item .stab{color:#000;}.stab.empty-impl{}.stab.must_implement{}.stab.unstable,.stab.deprecated,.stab.portability,.stab.empty-impl,.stab.must_implement{color:#c5c5c5;background:#314559 !important;border-style:none !important;border-radius:4px;padding:3px 6px 3px 6px;}.stab.portability>code{color:#e6e1cf;background:none;}.rightside,.out-of-band{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#788797;}.line-numbers :target{background-color:transparent;}pre.rust .number,pre.rust .string{color:#b8cc52;}pre.rust .kw,pre.rust .kw-2,pre.rust .prelude-ty,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .op,pre.rust .lifetime{color:#ff7733;}pre.rust .macro,pre.rust .macro-nonterminal{color:#a37acc;}pre.rust .question-mark{color:#ff9011;}pre.rust .self{color:#36a3d9;font-style:italic;}pre.rust .attribute{color:#e6e1cf;}pre.rust .attribute .ident,pre.rust .attribute .op{color:#e6e1cf;}.example-wrap>pre.line-number{color:#5c67736e;border:none;}a.test-arrow{font-size:100%;color:#788797;border-radius:4px;background-color:rgba(57,175,215,0.09);}a.test-arrow:hover{background-color:rgba(57,175,215,0.368);color:#c5c5c5;}.toggle-label,.code-attribute{color:#999;}:target{background:rgba(255,236,164,0.06);border-right:3px solid rgba(255,180,76,0.85);}pre.compile_fail{border-left:2px solid rgba(255,0,0,.4);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.4);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#39AFD7;}.tooltip::after{background-color:#314559;color:#c5c5c5;border:1px solid #5c6773;}.tooltip::before{border-color:transparent #314559 transparent transparent;}.notable-traits-tooltiptext{background-color:#314559;border-color:#5c6773;}.notable-traits-tooltiptext .notable{border-bottom-color:#5c6773;}#titles>button.selected{background-color:#141920 !important;border-bottom:1px solid #ffb44c !important;border-top:none;}#titles>button:not(.selected){background-color:transparent !important;border:none;}#titles>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#titles>button>div.count{color:#888;}.search-input:focus{}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{}.content span.struct,.content a.struct,.block a.current.struct{}#titles>button:hover,#titles>button.selected{}.content span.typedef,.content a.typedef,.block a.current.typedef{}.content span.union,.content a.union,.block a.current.union{}pre.rust .lifetime{}.stab.unstable{}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){}.content span.enum,.content a.enum,.block a.current.enum{}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{}.content span.keyword,.content a.keyword,.block a.current.keyword{}pre.rust .comment{}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{}pre.rust .kw{}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{}pre.rust .doccomment{}.stab.deprecated{}.content a.attr,.content a.derive,.content a.macro{}.stab.portability{}.content span.primitive,.content a.primitive,.block a.current.primitive{}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{}pre.rust .kw-2,pre.rust .prelude-ty{}.content span.trait,.content a.trait,.block a.current.trait{}.search-results a:focus span{}a.result-trait:focus{}a.result-traitalias:focus{}a.result-mod:focus,a.result-externcrate:focus{}a.result-mod:focus{}a.result-externcrate:focus{}a.result-enum:focus{}a.result-struct:focus{}a.result-union:focus{}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{}a.result-type:focus{}a.result-associatedtype:focus{}a.result-foreigntype:focus{}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{}a.result-constant:focus,a.result-static:focus{}a.result-primitive:focus{}a.result-keyword:focus{}.sidebar a.current.enum{}.sidebar a.current.struct{}.sidebar a.current.foreigntype{}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{}.sidebar a.current.union{}.sidebar a.current.constant .sidebar a.current.static{}.sidebar a.current.primitive{}.sidebar a.current.externcrate .sidebar a.current.mod{}.sidebar a.current.trait{}.sidebar a.current.traitalias{}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{}.sidebar a.current.keyword{}@media (max-width:700px){.sidebar-elems{border-right-color:#5c6773;}}kbd{color:#c5c5c5;background-color:#314559;border-color:#5c6773;border-bottom-color:#5c6773;box-shadow:inset 0 -1px 0 #5c6773;}#settings-menu>a,#help-button>button{border-color:#5c6773;background-color:#0f1419;color:#fff;}#settings-menu>a img{filter:invert(100);}.popover,.popover::before,#help-button span.top,#help-button span.bottom{border-color:#5c6773;}#copy-path{color:#fff;}#copy-path>img{filter:invert(70%);}#copy-path:hover>img{filter:invert(100%);}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>button:hover,#help-button>button:focus{border-color:#e0e0e0;}#theme-choices{border-color:#5c6773;background-color:#0f1419;}#theme-choices>button:not(:first-child){border-top-color:#5c6773;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:rgba(110,110,110,0.33);}.search-results .result-name span.alias{color:#c5c5c5;}.search-results .result-name span.grey{color:#999;}#source-sidebar>.title{color:#fff;border-bottom-color:#5c6773;}#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:#14191f;color:#ffb44c;}#source-sidebar div.files>a.selected{background-color:#14191f;color:#ffb44c;}.scraped-example-list .scrape-help{border-color:#aaa;color:#eee;}.scraped-example-list .scrape-help:hover{border-color:white;color:white;}.more-examples-toggle summary,.more-examples-toggle .hide-more{color:#999;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(15,20,25,1),rgba(15,20,25,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(15,20,25,1),rgba(15,20,25,0));}.toggle-line-inner{background:#999;}.toggle-line:hover .toggle-line-inner{background:#c5c5c5;} \ No newline at end of file + :root{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;--border-color:#5c6773;--button-background-color:#141920;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--search-input-focused-border-color:#5c6773;--copy-path-button-color:#fff;--copy-path-img-filter:invert(70%);--copy-path-img-hover-filter:invert(100%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--type-link-color:#ffa0a5;--trait-link-color:#39afd7;--assoc-item-link-color:#39afd7;--function-link-color:#fdd687;--macro-link-color:#a37acc;--keyword-link-color:#39afd7;--mod-link-color:#39afd7;--link-color:#39afd7;}.slider{background-color:#ccc;}.slider:before{background-color:white;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}h1,h2,h3,h4{color:white;}h1.fqn a{color:#fff;}h4{border:none;}.docblock code{color:#ffb454;}.code-header{color:#e6e1cf;}.docblock pre>code,pre>code{color:#e6e1cf;}.item-info code{color:#e6e1cf;}.docblock a>code{color:#39AFD7 !important;}pre,.rustdoc.source .example-wrap{color:#e6e1cf;}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);}.sidebar .current,.sidebar a:hover{background-color:transparent;color:#ffb44c;}.sidebar-elems .location{color:#ff7733;}.line-numbers span{color:#5c6773;}.line-numbers .line-highlighted{color:#708090;background-color:rgba(255,236,164,0.06);padding-right:4px;border-right:1px solid #ffb44c;}.search-results a:hover{color:#fff !important;background-color:#3c3c3c;}.search-results a:focus{color:#fff !important;background-color:#3c3c3c;}.search-results a{color:#0096cf;}.search-results a div.desc{color:#c5c5c5;}.content .item-info::before{color:#ccc;}.sidebar a{color:#53b1db;}.sidebar a.current.type{color:#53b1db;}pre.rust .comment{color:#788797;}pre.rust .doccomment{color:#a1ac88;}.sidebar h2 a,.sidebar h3 a{color:white;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary::before{filter:invert(100%);}#crate-search-div::after{filter:invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);}#crate-search:hover,#crate-search:focus{border-color:#e0e0e0 !important;}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%);}.search-input{color:#fff;}.module-item .stab,.import-item .stab{color:#000;}.stab{color:#c5c5c5;background:#314559 !important;}.stab.portability>code{color:#e6e1cf;background:none;}.result-name .primitive>i,.result-name .keyword>i{color:#788797;}.line-numbers :target{background-color:transparent;}pre.rust .number,pre.rust .string{color:#b8cc52;}pre.rust .kw,pre.rust .kw-2,pre.rust .prelude-ty,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .lifetime{color:#ff7733;}pre.rust .macro,pre.rust .macro-nonterminal{color:#a37acc;}pre.rust .question-mark{color:#ff9011;}pre.rust .self{color:#36a3d9;font-style:italic;}pre.rust .attribute{color:#e6e1cf;}.example-wrap>pre.line-number{color:#5c67736e;border:none;}a.test-arrow{font-size:100%;color:#788797;border-radius:4px;background-color:rgba(57,175,215,0.09);}a.test-arrow:hover{background-color:rgba(57,175,215,0.368);color:#c5c5c5;}:target{background:rgba(255,236,164,0.06);border-right:3px solid rgba(255,180,76,0.85);}.search-failed a{color:#39AFD7;}.tooltip::after{background-color:#314559;color:#c5c5c5;}.tooltip::before{border-color:transparent #314559 transparent transparent;}.notable-traits-tooltiptext{background-color:#314559;}#titles>button.selected{background-color:#141920 !important;border-bottom:1px solid #ffb44c !important;border-top:none;}#titles>button:not(.selected){background-color:transparent !important;border:none;}#titles>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#titles>button>div.count{color:#888;}pre.rust .lifetime{}pre.rust .kw{}#titles>button:hover,#titles>button.selected{}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute{}pre.rust .kw-2,pre.rust .prelude-ty{}.search-results a:focus span{}a.result-trait:focus{}a.result-traitalias:focus{}a.result-mod:focus,a.result-externcrate:focus{}a.result-mod:focus{}a.result-externcrate:focus{}a.result-enum:focus{}a.result-struct:focus{}a.result-union:focus{}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{}a.result-type:focus{}a.result-associatedtype:focus{}a.result-foreigntype:focus{}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{}a.result-constant:focus,a.result-static:focus{}a.result-primitive:focus{}a.result-keyword:focus{}.sidebar a.current.enum{}.sidebar a.current.struct{}.sidebar a.current.foreigntype{}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{}.sidebar a.current.union{}.sidebar a.current.constant .sidebar a.current.static{}.sidebar a.current.primitive{}.sidebar a.current.trait{}.sidebar a.current.traitalias{}.sidebar a.current.fn{}.sidebar a.current.keyword{}kbd{color:#c5c5c5;background-color:#314559;box-shadow:inset 0 -1px 0 #5c6773;}#settings-menu>a,#help-button>button{color:#fff;}#settings-menu>a img{filter:invert(100);}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>button:hover,#help-button>button:focus{border-color:#e0e0e0;}.search-results .result-name span.alias{color:#c5c5c5;}.search-results .result-name span.grey{color:#999;}#source-sidebar>.title{color:#fff;}#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:#14191f;color:#ffb44c;}#source-sidebar div.files>a.selected{background-color:#14191f;color:#ffb44c;}.scraped-example-list .scrape-help{border-color:#aaa;color:#eee;}.scraped-example-list .scrape-help:hover{border-color:white;color:white;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(15,20,25,1),rgba(15,20,25,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(15,20,25,1),rgba(15,20,25,0));}.toggle-line-inner{background:#999;}.toggle-line:hover .toggle-line-inner{background:#c5c5c5;} \ No newline at end of file diff --git a/dev/base32/all.html b/dev/base32/all.html index 15d5a2e85..7a27a93d5 100644 --- a/dev/base32/all.html +++ b/dev/base32/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/base32/fn.main.html b/dev/base32/fn.main.html index 44a8ff52f..6441b9cf7 100644 --- a/dev/base32/fn.main.html +++ b/dev/base32/fn.main.html @@ -1 +1 @@ -main in base32 - Rust

Function base32::main

source · []
pub fn main()
\ No newline at end of file +main in base32 - Rust

Function base32::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/base32/index.html b/dev/base32/index.html index 13f764c29..2266a216e 100644 --- a/dev/base32/index.html +++ b/dev/base32/index.html @@ -1 +1 @@ -base32 - Rust
\ No newline at end of file +base32 - Rust
\ No newline at end of file diff --git a/dev/base64/all.html b/dev/base64/all.html index 4cb77fdfd..32914fb78 100644 --- a/dev/base64/all.html +++ b/dev/base64/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/base64/fn.main.html b/dev/base64/fn.main.html index eda0c3774..dd9a22526 100644 --- a/dev/base64/fn.main.html +++ b/dev/base64/fn.main.html @@ -1 +1 @@ -main in base64 - Rust

Function base64::main

source · []
pub fn main()
\ No newline at end of file +main in base64 - Rust

Function base64::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/base64/index.html b/dev/base64/index.html index 17d116913..1647e6283 100644 --- a/dev/base64/index.html +++ b/dev/base64/index.html @@ -1 +1 @@ -base64 - Rust
\ No newline at end of file +base64 - Rust
\ No newline at end of file diff --git a/dev/basename/all.html b/dev/basename/all.html index 341f73b6d..f2064634b 100644 --- a/dev/basename/all.html +++ b/dev/basename/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/basename/fn.main.html b/dev/basename/fn.main.html index 84029dc7e..4327d6db3 100644 --- a/dev/basename/fn.main.html +++ b/dev/basename/fn.main.html @@ -1 +1 @@ -main in basename - Rust
pub fn main()
\ No newline at end of file +main in basename - Rust
pub fn main()
\ No newline at end of file diff --git a/dev/basename/index.html b/dev/basename/index.html index 984094148..1c70b353b 100644 --- a/dev/basename/index.html +++ b/dev/basename/index.html @@ -1 +1 @@ -basename - Rust
\ No newline at end of file +basename - Rust
\ No newline at end of file diff --git a/dev/basenc/all.html b/dev/basenc/all.html index 24c8a4a6b..12a3337bf 100644 --- a/dev/basenc/all.html +++ b/dev/basenc/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/basenc/fn.main.html b/dev/basenc/fn.main.html index df72029b0..bd936c143 100644 --- a/dev/basenc/fn.main.html +++ b/dev/basenc/fn.main.html @@ -1 +1 @@ -main in basenc - Rust

Function basenc::main

source · []
pub fn main()
\ No newline at end of file +main in basenc - Rust

Function basenc::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/basenc/index.html b/dev/basenc/index.html index 9f8d51ffa..102f1c6c2 100644 --- a/dev/basenc/index.html +++ b/dev/basenc/index.html @@ -1 +1 @@ -basenc - Rust
\ No newline at end of file +basenc - Rust
\ No newline at end of file diff --git a/dev/cat/all.html b/dev/cat/all.html index ee8799aeb..511e7dae4 100644 --- a/dev/cat/all.html +++ b/dev/cat/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/cat/fn.main.html b/dev/cat/fn.main.html index 63d66c416..42e46c9e9 100644 --- a/dev/cat/fn.main.html +++ b/dev/cat/fn.main.html @@ -1 +1 @@ -main in cat - Rust

Function cat::main

source · []
pub fn main()
\ No newline at end of file +main in cat - Rust

Function cat::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/cat/index.html b/dev/cat/index.html index 2319d743a..748c4f251 100644 --- a/dev/cat/index.html +++ b/dev/cat/index.html @@ -1 +1 @@ -cat - Rust
\ No newline at end of file +cat - Rust
\ No newline at end of file diff --git a/dev/chcon/all.html b/dev/chcon/all.html index 277876143..591f90fc1 100644 --- a/dev/chcon/all.html +++ b/dev/chcon/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/chcon/fn.main.html b/dev/chcon/fn.main.html index 1e8621ddd..9de0dffc2 100644 --- a/dev/chcon/fn.main.html +++ b/dev/chcon/fn.main.html @@ -1 +1 @@ -main in chcon - Rust

Function chcon::main

source · []
pub fn main()
\ No newline at end of file +main in chcon - Rust

Function chcon::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/chcon/index.html b/dev/chcon/index.html index 0974428eb..af1a3c3a2 100644 --- a/dev/chcon/index.html +++ b/dev/chcon/index.html @@ -1 +1 @@ -chcon - Rust
\ No newline at end of file +chcon - Rust
\ No newline at end of file diff --git a/dev/chgrp/all.html b/dev/chgrp/all.html index 55f92a7b9..3b8b38cdf 100644 --- a/dev/chgrp/all.html +++ b/dev/chgrp/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/chgrp/fn.main.html b/dev/chgrp/fn.main.html index d8628cbec..30b88326f 100644 --- a/dev/chgrp/fn.main.html +++ b/dev/chgrp/fn.main.html @@ -1 +1 @@ -main in chgrp - Rust

Function chgrp::main

source · []
pub fn main()
\ No newline at end of file +main in chgrp - Rust

Function chgrp::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/chgrp/index.html b/dev/chgrp/index.html index b59e3fdd0..bba12cc0a 100644 --- a/dev/chgrp/index.html +++ b/dev/chgrp/index.html @@ -1 +1 @@ -chgrp - Rust
\ No newline at end of file +chgrp - Rust
\ No newline at end of file diff --git a/dev/chmod/all.html b/dev/chmod/all.html index 118b41ab4..caec20bbf 100644 --- a/dev/chmod/all.html +++ b/dev/chmod/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/chmod/fn.main.html b/dev/chmod/fn.main.html index 4fb7e6e5f..2687794e6 100644 --- a/dev/chmod/fn.main.html +++ b/dev/chmod/fn.main.html @@ -1 +1 @@ -main in chmod - Rust

Function chmod::main

source · []
pub fn main()
\ No newline at end of file +main in chmod - Rust

Function chmod::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/chmod/index.html b/dev/chmod/index.html index caa02bbd4..7b9d5db3a 100644 --- a/dev/chmod/index.html +++ b/dev/chmod/index.html @@ -1 +1 @@ -chmod - Rust
\ No newline at end of file +chmod - Rust
\ No newline at end of file diff --git a/dev/chown/all.html b/dev/chown/all.html index 641c28608..681779443 100644 --- a/dev/chown/all.html +++ b/dev/chown/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/chown/fn.main.html b/dev/chown/fn.main.html index 19aec1661..36729e5be 100644 --- a/dev/chown/fn.main.html +++ b/dev/chown/fn.main.html @@ -1 +1 @@ -main in chown - Rust

Function chown::main

source · []
pub fn main()
\ No newline at end of file +main in chown - Rust

Function chown::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/chown/index.html b/dev/chown/index.html index dbe1e1d75..3834b25ea 100644 --- a/dev/chown/index.html +++ b/dev/chown/index.html @@ -1 +1 @@ -chown - Rust
\ No newline at end of file +chown - Rust
\ No newline at end of file diff --git a/dev/chroot/all.html b/dev/chroot/all.html index ee7ee6536..2ced62375 100644 --- a/dev/chroot/all.html +++ b/dev/chroot/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/chroot/fn.main.html b/dev/chroot/fn.main.html index a6dcc9adf..55c99c672 100644 --- a/dev/chroot/fn.main.html +++ b/dev/chroot/fn.main.html @@ -1 +1 @@ -main in chroot - Rust

Function chroot::main

source · []
pub fn main()
\ No newline at end of file +main in chroot - Rust

Function chroot::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/chroot/index.html b/dev/chroot/index.html index 684e72026..cc9563413 100644 --- a/dev/chroot/index.html +++ b/dev/chroot/index.html @@ -1 +1 @@ -chroot - Rust
\ No newline at end of file +chroot - Rust
\ No newline at end of file diff --git a/dev/cksum/all.html b/dev/cksum/all.html index cc3ef92fe..489255de7 100644 --- a/dev/cksum/all.html +++ b/dev/cksum/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/cksum/fn.main.html b/dev/cksum/fn.main.html index bb00f7788..8e5e6f6d9 100644 --- a/dev/cksum/fn.main.html +++ b/dev/cksum/fn.main.html @@ -1 +1 @@ -main in cksum - Rust

Function cksum::main

source · []
pub fn main()
\ No newline at end of file +main in cksum - Rust

Function cksum::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/cksum/index.html b/dev/cksum/index.html index d4ab2f3b5..46913a29b 100644 --- a/dev/cksum/index.html +++ b/dev/cksum/index.html @@ -1 +1 @@ -cksum - Rust
\ No newline at end of file +cksum - Rust
\ No newline at end of file diff --git a/dev/comm/all.html b/dev/comm/all.html index f20f7bd1e..6e974706d 100644 --- a/dev/comm/all.html +++ b/dev/comm/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/comm/fn.main.html b/dev/comm/fn.main.html index c258920ba..71a872fd7 100644 --- a/dev/comm/fn.main.html +++ b/dev/comm/fn.main.html @@ -1 +1 @@ -main in comm - Rust

Function comm::main

source · []
pub fn main()
\ No newline at end of file +main in comm - Rust

Function comm::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/comm/index.html b/dev/comm/index.html index 69592d395..39b7b7160 100644 --- a/dev/comm/index.html +++ b/dev/comm/index.html @@ -1 +1 @@ -comm - Rust
\ No newline at end of file +comm - Rust
\ No newline at end of file diff --git a/dev/coreutils/all.html b/dev/coreutils/all.html index e3d38f938..099b3100b 100644 --- a/dev/coreutils/all.html +++ b/dev/coreutils/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/coreutils/constant.VERSION.html b/dev/coreutils/constant.VERSION.html index 2ef2bf1e8..04393342f 100644 --- a/dev/coreutils/constant.VERSION.html +++ b/dev/coreutils/constant.VERSION.html @@ -1 +1 @@ -VERSION in coreutils - Rust
pub(crate) const VERSION: &'static str = _;
\ No newline at end of file +VERSION in coreutils - Rust
pub(crate) const VERSION: &'static str = _;
\ No newline at end of file diff --git a/dev/coreutils/fn.binary_path.html b/dev/coreutils/fn.binary_path.html index 59d0d6e44..eb2f9b443 100644 --- a/dev/coreutils/fn.binary_path.html +++ b/dev/coreutils/fn.binary_path.html @@ -1 +1 @@ -binary_path in coreutils - Rust
pub(crate) fn binary_path(args: &mut impl Iterator<Item = OsString>) -> PathBuf
\ No newline at end of file +binary_path in coreutils - Rust
pub(crate) fn binary_path(args: &mut impl Iterator<Item = OsString>) -> PathBuf
\ No newline at end of file diff --git a/dev/coreutils/fn.gen_completions.html b/dev/coreutils/fn.gen_completions.html index b6c195d35..2e5cda9b4 100644 --- a/dev/coreutils/fn.gen_completions.html +++ b/dev/coreutils/fn.gen_completions.html @@ -1,2 +1,2 @@ -gen_completions in coreutils - Rust
pub(crate) fn gen_completions<T: Args>(
    args: impl Iterator<Item = OsString>,
    util_map: &Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>
) -> !
Expand description

Prints completions for the utility in the first parameter for the shell in the second parameter to stdout

-
\ No newline at end of file +gen_completions in coreutils - Rust
pub(crate) fn gen_completions<T: Args>(
    args: impl Iterator<Item = OsString>,
    util_map: &Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>
) -> !
Expand description

Prints completions for the utility in the first parameter for the shell in the second parameter to stdout

+
\ No newline at end of file diff --git a/dev/coreutils/fn.gen_coreutils_app.html b/dev/coreutils/fn.gen_coreutils_app.html index 1fa8a77ee..95c6a56f6 100644 --- a/dev/coreutils/fn.gen_coreutils_app.html +++ b/dev/coreutils/fn.gen_coreutils_app.html @@ -1 +1 @@ -gen_coreutils_app in coreutils - Rust
pub(crate) fn gen_coreutils_app<T: Args>(
    util_map: &Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>
) -> Command
\ No newline at end of file +gen_coreutils_app in coreutils - Rust
pub(crate) fn gen_coreutils_app<T: Args>(
    util_map: &Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>
) -> Command
\ No newline at end of file diff --git a/dev/coreutils/fn.main.html b/dev/coreutils/fn.main.html index 971bb6be4..2b5803b81 100644 --- a/dev/coreutils/fn.main.html +++ b/dev/coreutils/fn.main.html @@ -1 +1 @@ -main in coreutils - Rust
pub(crate) fn main()
\ No newline at end of file +main in coreutils - Rust
pub(crate) fn main()
\ No newline at end of file diff --git a/dev/coreutils/fn.name.html b/dev/coreutils/fn.name.html index a69d4a157..2dfeacabb 100644 --- a/dev/coreutils/fn.name.html +++ b/dev/coreutils/fn.name.html @@ -1 +1 @@ -name in coreutils - Rust
pub(crate) fn name(binary_path: &Path) -> &str
\ No newline at end of file +name in coreutils - Rust
pub(crate) fn name(binary_path: &Path) -> &str
\ No newline at end of file diff --git a/dev/coreutils/fn.usage.html b/dev/coreutils/fn.usage.html index a48aa6b6c..c6158d606 100644 --- a/dev/coreutils/fn.usage.html +++ b/dev/coreutils/fn.usage.html @@ -1 +1 @@ -usage in coreutils - Rust
pub(crate) fn usage<T>(
    utils: &Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>,
    name: &str
)
\ No newline at end of file +usage in coreutils - Rust
pub(crate) fn usage<T>(
    utils: &Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>,
    name: &str
)
\ No newline at end of file diff --git a/dev/coreutils/fn.util_map.html b/dev/coreutils/fn.util_map.html index d334146ea..27d874474 100644 --- a/dev/coreutils/fn.util_map.html +++ b/dev/coreutils/fn.util_map.html @@ -1 +1 @@ -util_map in coreutils - Rust
pub(crate) fn util_map<T: Args>(
) -> Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>
\ No newline at end of file +util_map in coreutils - Rust
pub(crate) fn util_map<T: Args>(
) -> Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>
\ No newline at end of file diff --git a/dev/coreutils/index.html b/dev/coreutils/index.html index ad6e8866f..c6508de5f 100644 --- a/dev/coreutils/index.html +++ b/dev/coreutils/index.html @@ -1,2 +1 @@ -coreutils - Rust

Constants

VERSION 🔒

Functions

Prints completions for the utility in the first parameter for the shell in the second parameter to stdout

-
main 🔒
name 🔒
usage 🔒
util_map 🔒

Type Definitions

UtilityMap 🔒
\ No newline at end of file +coreutils - Rust

Constants

VERSION 🔒

Functions

Prints completions for the utility in the first parameter for the shell in the second parameter to stdout
main 🔒
name 🔒
usage 🔒
util_map 🔒

Type Definitions

UtilityMap 🔒
\ No newline at end of file diff --git a/dev/coreutils/type.UtilityMap.html b/dev/coreutils/type.UtilityMap.html index 5acaee581..5889d0861 100644 --- a/dev/coreutils/type.UtilityMap.html +++ b/dev/coreutils/type.UtilityMap.html @@ -1 +1 @@ -UtilityMap in coreutils - Rust

Type Definition coreutils::UtilityMap

source · []
pub(crate) type UtilityMap<T> = Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>;
\ No newline at end of file +UtilityMap in coreutils - Rust

Type Definition coreutils::UtilityMap

source · []
pub(crate) type UtilityMap<T> = Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>;
\ No newline at end of file diff --git a/dev/cp/all.html b/dev/cp/all.html index 99f956f0d..43003c7ec 100644 --- a/dev/cp/all.html +++ b/dev/cp/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/cp/fn.main.html b/dev/cp/fn.main.html index 8e994161e..3dc2a7251 100644 --- a/dev/cp/fn.main.html +++ b/dev/cp/fn.main.html @@ -1 +1 @@ -main in cp - Rust

Function cp::main

source · []
pub fn main()
\ No newline at end of file +main in cp - Rust

Function cp::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/cp/index.html b/dev/cp/index.html index 832f92102..c53d66a49 100644 --- a/dev/cp/index.html +++ b/dev/cp/index.html @@ -1 +1 @@ -cp - Rust
\ No newline at end of file +cp - Rust
\ No newline at end of file diff --git a/dev/csplit/all.html b/dev/csplit/all.html index 2337c5335..ebe4e74f1 100644 --- a/dev/csplit/all.html +++ b/dev/csplit/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/csplit/fn.main.html b/dev/csplit/fn.main.html index 4ba0e1303..95f979d8c 100644 --- a/dev/csplit/fn.main.html +++ b/dev/csplit/fn.main.html @@ -1 +1 @@ -main in csplit - Rust

Function csplit::main

source · []
pub fn main()
\ No newline at end of file +main in csplit - Rust

Function csplit::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/csplit/index.html b/dev/csplit/index.html index ad9696113..8525acdff 100644 --- a/dev/csplit/index.html +++ b/dev/csplit/index.html @@ -1 +1 @@ -csplit - Rust
\ No newline at end of file +csplit - Rust
\ No newline at end of file diff --git a/dev/cut/all.html b/dev/cut/all.html index e1e90566e..6afb5d707 100644 --- a/dev/cut/all.html +++ b/dev/cut/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/cut/fn.main.html b/dev/cut/fn.main.html index b84167786..795e85b84 100644 --- a/dev/cut/fn.main.html +++ b/dev/cut/fn.main.html @@ -1 +1 @@ -main in cut - Rust

Function cut::main

source · []
pub fn main()
\ No newline at end of file +main in cut - Rust

Function cut::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/cut/index.html b/dev/cut/index.html index c0561f033..38b0498db 100644 --- a/dev/cut/index.html +++ b/dev/cut/index.html @@ -1 +1 @@ -cut - Rust
\ No newline at end of file +cut - Rust
\ No newline at end of file diff --git a/dev/dark.css b/dev/dark.css index 242423d03..49b9b4fa1 100644 --- a/dev/dark.css +++ b/dev/dark.css @@ -1 +1 @@ -:root{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;}.slider{background-color:#ccc;}.slider:before{background-color:white;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}.in-band{background-color:#353535;}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff)}.sidebar .current,.sidebar a:hover{background:#444;}.line-numbers span{color:#3B91E2;}.line-numbers .line-highlighted{background-color:#0a042f !important;}.docblock table td,.docblock table th{border-color:#ddd;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#eee !important;background-color:#616161;}.search-results a:focus span{color:#eee !important;}a.result-trait:focus{background-color:#013191;}a.result-traitalias:focus{background-color:#013191;}a.result-mod:focus,a.result-externcrate:focus{background-color:#884719;}a.result-enum:focus{background-color:#194e9f;}a.result-struct:focus{background-color:#194e9f;}a.result-union:focus{background-color:#194e9f;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#4950ed;}a.result-type:focus{background-color:#194e9f;}a.result-associatedtype:focus{background-color:#884719;}a.result-foreigntype:focus{background-color:#194e9f;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#217d1c;}a.result-constant:focus,a.result-static:focus{background-color:#884719;}a.result-primitive:focus{background-color:#194e9f;}a.result-keyword:focus{background-color:#884719;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#2dbfb8;}.content span.struct,.content a.struct,.block a.current.struct{color:#2dbfb8;}.content span.type,.content a.type,.block a.current.type{color:#2dbfb8;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#D2991D;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#2dbfb8;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#09bd00;}.content span.union,.content a.union,.block a.current.union{color:#2dbfb8;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#D2991D;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#2dbfb8;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#D2991D;}.content span.trait,.content a.trait,.block a.current.trait{color:#b78cf2;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#b78cf2;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#2BAB63;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#D2991D;}.sidebar a{color:#fdbf35;}.sidebar a.current.enum{color:#12ece2;}.sidebar a.current.struct{color:#12ece2;}.sidebar a.current.type{color:#12ece2;}.sidebar a.current.associatedtype{color:#fdbf35;}.sidebar a.current.foreigntype{color:#12ece2;}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{color:#0be900;}.sidebar a.current.union{color:#12ece2;}.sidebar a.current.constant .sidebar a.current.static{color:#fdbf35;}.sidebar a.current.primitive{color:#12ece2;}.sidebar a.current.externcrate .sidebar a.current.mod{color:#fdbf35;}.sidebar a.current.trait{color:#cca7ff;}.sidebar a.current.traitalias{color:#cca7ff;}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{color:#32d479;}.sidebar a.current.keyword{color:#fdbf35;}pre.rust .comment{color:#8d8d8b;}pre.rust .doccomment{color:#8ca375;}nav.main .current{border-top-color:#eee;border-bottom-color:#eee;}nav.main .separator{border-color:#eee;}a{color:#D2991D;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before{color:#999;}details.rustdoc-toggle>summary::before{filter:invert(100%);}#crate-search,.search-input{color:#111;background-color:#f0f0f0;border-color:#f0f0f0;}#crate-search{border-color:#f0f0f0 !important;}.search-input{border-color:#e0e0e0;}.search-input:focus{border-color:#008dfd;}.stab.empty-impl{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;color:#2f2f2f;}.stab.must_implement{background:#F3DFFF;border-color:#b07bdb;color:#2f2f2f;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;color:#2f2f2f;}.stab.portability>code{background:none;}.rightside,.out-of-band{color:grey;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#ab8ac1;}pre.rust .kw-2,pre.rust .prelude-ty{color:#769acb;}pre.rust .number,pre.rust .string{color:#83a300;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#ee6868;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#d97f26;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#4a4949;}a.test-arrow{color:#dedede;background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target{background-color:#494a3d;border-right:3px solid #bb7410;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.8);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.8);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.8);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.8);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;border-color:#000;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#111;border-color:#777;}.notable-traits-tooltiptext .notable{border-bottom-color:#d2d2d2;}#titles>button:not(.selected){background-color:#252525;border-top-color:#252525;}#titles>button:hover,#titles>button.selected{border-top-color:#0089ff;background-color:#353535;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-elems{border-right-color:#000;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow:inset 0 -1px 0 #c6cbd1;}#settings-menu>a,#help-button>button{border-color:#e0e0e0;background:#f0f0f0;color:#000;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>button:hover,#help-button>button:focus{border-color:#ffb900;}.popover,.popover::before,#help-button span.top,#help-button span.bottom{border-color:#d2d2d2;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(65%);}#theme-choices{border-color:#e0e0e0;background-color:#353535;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#4e4e4e;}.search-results .result-name span.alias{color:#fff;}.search-results .result-name span.grey{color:#ccc;}#source-sidebar>.title{border-bottom-color:#ccc;}#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:#444;}#source-sidebar div.files>a.selected{background-color:#333;}.scraped-example-list .scrape-help{border-color:#aaa;color:#eee;}.scraped-example-list .scrape-help:hover{border-color:white;color:white;}.more-examples-toggle summary,.more-examples-toggle .hide-more{color:#999;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(53,53,53,1),rgba(53,53,53,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(53,53,53,1),rgba(53,53,53,0));}.toggle-line-inner{background:#999;}.toggle-line:hover .toggle-line-inner{background:#c5c5c5;} \ No newline at end of file +:root{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;}.slider{background-color:#ccc;}.slider:before{background-color:white;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff)}.sidebar .current,.sidebar a:hover{background:#444;}.line-numbers span{color:#3B91E2;}.line-numbers .line-highlighted{background-color:#0a042f !important;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#eee !important;background-color:#616161;}.search-results a:focus span{color:#eee !important;}a.result-trait:focus{background-color:#013191;}a.result-traitalias:focus{background-color:#013191;}a.result-mod:focus,a.result-externcrate:focus{background-color:#884719;}a.result-enum:focus{background-color:#194e9f;}a.result-struct:focus{background-color:#194e9f;}a.result-union:focus{background-color:#194e9f;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#4950ed;}a.result-type:focus{background-color:#194e9f;}a.result-associatedtype:focus{background-color:#884719;}a.result-foreigntype:focus{background-color:#194e9f;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#217d1c;}a.result-constant:focus,a.result-static:focus{background-color:#884719;}a.result-primitive:focus{background-color:#194e9f;}a.result-keyword:focus{background-color:#884719;}.content .item-info::before{color:#ccc;}.sidebar a{color:#fdbf35;}.sidebar a.current.enum{color:#12ece2;}.sidebar a.current.struct{color:#12ece2;}.sidebar a.current.type{color:#12ece2;}.sidebar a.current.foreigntype{color:#12ece2;}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{color:#0be900;}.sidebar a.current.union{color:#12ece2;}.sidebar a.current.constant .sidebar a.current.static{color:#fdbf35;}.sidebar a.current.primitive{color:#12ece2;}.sidebar a.current.trait{color:#cca7ff;}.sidebar a.current.traitalias{color:#cca7ff;}.sidebar a.current.fn{color:#32d479;}.sidebar a.current.keyword{color:#fdbf35;}pre.rust .comment{color:#8d8d8b;}pre.rust .doccomment{color:#8ca375;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary::before{filter:invert(100%);}.search-input{color:#111;}#crate-search-div::after{filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);}#crate-search:hover,#crate-search:focus{border-color:#2196f3 !important;}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);}.stab{background:#314559;}.stab.portability>code{color:#e6e1cf;background:none;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#ab8ac1;}pre.rust .kw-2,pre.rust .prelude-ty{color:#769acb;}pre.rust .number,pre.rust .string{color:#83a300;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute{color:#ee6868;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#d97f26;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#4a4949;}a.test-arrow{color:#dedede;background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}:target{background-color:#494a3d;border-right:3px solid #bb7410;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;border-color:#000;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#111;}#titles>button:not(.selected){background-color:#252525;border-top-color:#252525;}#titles>button:hover,#titles>button.selected{border-top-color:#0089ff;background-color:#353535;}#titles>button>div.count{color:#888;}kbd{color:#000;background-color:#fafbfc;box-shadow:inset 0 -1px 0 #c6cbd1;}#settings-menu>a,#help-button>button{color:#000;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>button:hover,#help-button>button:focus{border-color:#ffb900;}.search-results .result-name span.alias{color:#fff;}.search-results .result-name span.grey{color:#ccc;}#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:#444;}#source-sidebar div.files>a.selected{background-color:#333;}.scraped-example-list .scrape-help{border-color:#aaa;color:#eee;}.scraped-example-list .scrape-help:hover{border-color:white;color:white;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(53,53,53,1),rgba(53,53,53,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(53,53,53,1),rgba(53,53,53,0));}.toggle-line-inner{background:#999;}.toggle-line:hover .toggle-line-inner{background:#c5c5c5;} \ No newline at end of file diff --git a/dev/date/all.html b/dev/date/all.html index a017d2fd1..7384c7f18 100644 --- a/dev/date/all.html +++ b/dev/date/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/date/fn.main.html b/dev/date/fn.main.html index 26cc1cd3d..aee67fc02 100644 --- a/dev/date/fn.main.html +++ b/dev/date/fn.main.html @@ -1 +1 @@ -main in date - Rust

Function date::main

source · []
pub fn main()
\ No newline at end of file +main in date - Rust

Function date::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/date/index.html b/dev/date/index.html index 19e006600..9eb1a2200 100644 --- a/dev/date/index.html +++ b/dev/date/index.html @@ -1 +1 @@ -date - Rust
\ No newline at end of file +date - Rust
\ No newline at end of file diff --git a/dev/dd/all.html b/dev/dd/all.html index c07e4dee2..d4d015947 100644 --- a/dev/dd/all.html +++ b/dev/dd/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/dd/fn.main.html b/dev/dd/fn.main.html index 8dfb888ff..67c6ba036 100644 --- a/dev/dd/fn.main.html +++ b/dev/dd/fn.main.html @@ -1 +1 @@ -main in dd - Rust

Function dd::main

source · []
pub fn main()
\ No newline at end of file +main in dd - Rust

Function dd::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/dd/index.html b/dev/dd/index.html index 03bd92a50..4008d60b1 100644 --- a/dev/dd/index.html +++ b/dev/dd/index.html @@ -1 +1 @@ -dd - Rust
\ No newline at end of file +dd - Rust
\ No newline at end of file diff --git a/dev/df/all.html b/dev/df/all.html index c9fed8604..8f88423c0 100644 --- a/dev/df/all.html +++ b/dev/df/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/df/fn.main.html b/dev/df/fn.main.html index 41539cd7a..f80f06012 100644 --- a/dev/df/fn.main.html +++ b/dev/df/fn.main.html @@ -1 +1 @@ -main in df - Rust

Function df::main

source · []
pub fn main()
\ No newline at end of file +main in df - Rust

Function df::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/df/index.html b/dev/df/index.html index bdd297e33..c859daf78 100644 --- a/dev/df/index.html +++ b/dev/df/index.html @@ -1 +1 @@ -df - Rust
\ No newline at end of file +df - Rust
\ No newline at end of file diff --git a/dev/dir/all.html b/dev/dir/all.html index fc9c22988..b9d5365dc 100644 --- a/dev/dir/all.html +++ b/dev/dir/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/dir/fn.main.html b/dev/dir/fn.main.html index 0bccd1753..139047a98 100644 --- a/dev/dir/fn.main.html +++ b/dev/dir/fn.main.html @@ -1 +1 @@ -main in dir - Rust

Function dir::main

source · []
pub fn main()
\ No newline at end of file +main in dir - Rust

Function dir::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/dir/index.html b/dev/dir/index.html index 9e969b10c..39fd47886 100644 --- a/dev/dir/index.html +++ b/dev/dir/index.html @@ -1 +1 @@ -dir - Rust
\ No newline at end of file +dir - Rust
\ No newline at end of file diff --git a/dev/dircolors/all.html b/dev/dircolors/all.html index 5e72726d2..1dac5e5bd 100644 --- a/dev/dircolors/all.html +++ b/dev/dircolors/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/dircolors/fn.main.html b/dev/dircolors/fn.main.html index 91af06874..d09ad2a45 100644 --- a/dev/dircolors/fn.main.html +++ b/dev/dircolors/fn.main.html @@ -1 +1 @@ -main in dircolors - Rust
pub fn main()
\ No newline at end of file +main in dircolors - Rust
pub fn main()
\ No newline at end of file diff --git a/dev/dircolors/index.html b/dev/dircolors/index.html index 486b48816..759f4f113 100644 --- a/dev/dircolors/index.html +++ b/dev/dircolors/index.html @@ -1 +1 @@ -dircolors - Rust
\ No newline at end of file +dircolors - Rust
\ No newline at end of file diff --git a/dev/dirname/all.html b/dev/dirname/all.html index 519b65cf4..026760d92 100644 --- a/dev/dirname/all.html +++ b/dev/dirname/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/dirname/fn.main.html b/dev/dirname/fn.main.html index d8b95e06b..72403d452 100644 --- a/dev/dirname/fn.main.html +++ b/dev/dirname/fn.main.html @@ -1 +1 @@ -main in dirname - Rust

Function dirname::main

source · []
pub fn main()
\ No newline at end of file +main in dirname - Rust

Function dirname::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/dirname/index.html b/dev/dirname/index.html index 4710460f0..f84ec120f 100644 --- a/dev/dirname/index.html +++ b/dev/dirname/index.html @@ -1 +1 @@ -dirname - Rust
\ No newline at end of file +dirname - Rust
\ No newline at end of file diff --git a/dev/down-arrow.svg b/dev/down-arrow.svg index 35437e77a..5d76a64e9 100644 --- a/dev/down-arrow.svg +++ b/dev/down-arrow.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/dev/du/all.html b/dev/du/all.html index 950ae9b95..8a3cc4d24 100644 --- a/dev/du/all.html +++ b/dev/du/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/du/fn.main.html b/dev/du/fn.main.html index 33ccacef3..e7e83fc85 100644 --- a/dev/du/fn.main.html +++ b/dev/du/fn.main.html @@ -1 +1 @@ -main in du - Rust

Function du::main

source · []
pub fn main()
\ No newline at end of file +main in du - Rust

Function du::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/du/index.html b/dev/du/index.html index d97f1a892..b020befe0 100644 --- a/dev/du/index.html +++ b/dev/du/index.html @@ -1 +1 @@ -du - Rust
\ No newline at end of file +du - Rust
\ No newline at end of file diff --git a/dev/echo/all.html b/dev/echo/all.html index 0a8ee0f79..2c885921a 100644 --- a/dev/echo/all.html +++ b/dev/echo/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/echo/fn.main.html b/dev/echo/fn.main.html index 1da2be0bd..e46883ff3 100644 --- a/dev/echo/fn.main.html +++ b/dev/echo/fn.main.html @@ -1 +1 @@ -main in echo - Rust

Function echo::main

source · []
pub fn main()
\ No newline at end of file +main in echo - Rust

Function echo::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/echo/index.html b/dev/echo/index.html index c3117a56a..4edb79613 100644 --- a/dev/echo/index.html +++ b/dev/echo/index.html @@ -1 +1 @@ -echo - Rust
\ No newline at end of file +echo - Rust
\ No newline at end of file diff --git a/dev/env/all.html b/dev/env/all.html index 6b8f4fc3d..1c8cadbe0 100644 --- a/dev/env/all.html +++ b/dev/env/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/env/fn.main.html b/dev/env/fn.main.html index d36845aae..84c2b89dc 100644 --- a/dev/env/fn.main.html +++ b/dev/env/fn.main.html @@ -1 +1 @@ -main in env - Rust

Function env::main

source · []
pub fn main()
\ No newline at end of file +main in env - Rust

Function env::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/env/index.html b/dev/env/index.html index 94764d6bf..8dfedf369 100644 --- a/dev/env/index.html +++ b/dev/env/index.html @@ -1 +1 @@ -env - Rust
\ No newline at end of file +env - Rust
\ No newline at end of file diff --git a/dev/expand/all.html b/dev/expand/all.html index aa163b730..8455150ad 100644 --- a/dev/expand/all.html +++ b/dev/expand/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/expand/fn.main.html b/dev/expand/fn.main.html index 7f794cdaf..7b015ca20 100644 --- a/dev/expand/fn.main.html +++ b/dev/expand/fn.main.html @@ -1 +1 @@ -main in expand - Rust

Function expand::main

source · []
pub fn main()
\ No newline at end of file +main in expand - Rust

Function expand::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/expand/index.html b/dev/expand/index.html index b93354442..6470c7c02 100644 --- a/dev/expand/index.html +++ b/dev/expand/index.html @@ -1 +1 @@ -expand - Rust
\ No newline at end of file +expand - Rust
\ No newline at end of file diff --git a/dev/expr/all.html b/dev/expr/all.html index 842ba8090..1b2720eb2 100644 --- a/dev/expr/all.html +++ b/dev/expr/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/expr/fn.main.html b/dev/expr/fn.main.html index 7cd74d62e..56cd877ef 100644 --- a/dev/expr/fn.main.html +++ b/dev/expr/fn.main.html @@ -1 +1 @@ -main in expr - Rust

Function expr::main

source · []
pub fn main()
\ No newline at end of file +main in expr - Rust

Function expr::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/expr/index.html b/dev/expr/index.html index e5e277689..c31f7e1f0 100644 --- a/dev/expr/index.html +++ b/dev/expr/index.html @@ -1 +1 @@ -expr - Rust
\ No newline at end of file +expr - Rust
\ No newline at end of file diff --git a/dev/factor/all.html b/dev/factor/all.html index 9a0e80414..88691401c 100644 --- a/dev/factor/all.html +++ b/dev/factor/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/factor/fn.main.html b/dev/factor/fn.main.html index cfc15677f..c3d15c488 100644 --- a/dev/factor/fn.main.html +++ b/dev/factor/fn.main.html @@ -1 +1 @@ -main in factor - Rust

Function factor::main

source · []
pub fn main()
\ No newline at end of file +main in factor - Rust

Function factor::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/factor/index.html b/dev/factor/index.html index 0bbec475a..185d5f1f7 100644 --- a/dev/factor/index.html +++ b/dev/factor/index.html @@ -1 +1 @@ -factor - Rust
\ No newline at end of file +factor - Rust
\ No newline at end of file diff --git a/dev/false/all.html b/dev/false/all.html index 3d5c971b1..d9dd1f74d 100644 --- a/dev/false/all.html +++ b/dev/false/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/false/fn.main.html b/dev/false/fn.main.html index 172f1ee51..a60e38da5 100644 --- a/dev/false/fn.main.html +++ b/dev/false/fn.main.html @@ -1 +1 @@ -main in false - Rust

Function false::main

source · []
pub fn main()
\ No newline at end of file +main in false - Rust

Function false::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/false/index.html b/dev/false/index.html index d4ce502ea..42d83bd44 100644 --- a/dev/false/index.html +++ b/dev/false/index.html @@ -1 +1 @@ -false - Rust
\ No newline at end of file +false - Rust
\ No newline at end of file diff --git a/dev/fmt/all.html b/dev/fmt/all.html index 41d3d646e..fcaebc92d 100644 --- a/dev/fmt/all.html +++ b/dev/fmt/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/fmt/fn.main.html b/dev/fmt/fn.main.html index c988040d4..92938124b 100644 --- a/dev/fmt/fn.main.html +++ b/dev/fmt/fn.main.html @@ -1 +1 @@ -main in fmt - Rust

Function fmt::main

source · []
pub fn main()
\ No newline at end of file +main in fmt - Rust

Function fmt::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/fmt/index.html b/dev/fmt/index.html index 9b79e35aa..a59fbfcb6 100644 --- a/dev/fmt/index.html +++ b/dev/fmt/index.html @@ -1 +1 @@ -fmt - Rust
\ No newline at end of file +fmt - Rust
\ No newline at end of file diff --git a/dev/fold/all.html b/dev/fold/all.html index 63b53675a..9b1385831 100644 --- a/dev/fold/all.html +++ b/dev/fold/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/fold/fn.main.html b/dev/fold/fn.main.html index 77e613788..0c6eac91f 100644 --- a/dev/fold/fn.main.html +++ b/dev/fold/fn.main.html @@ -1 +1 @@ -main in fold - Rust

Function fold::main

source · []
pub fn main()
\ No newline at end of file +main in fold - Rust

Function fold::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/fold/index.html b/dev/fold/index.html index 78fddf3e0..bd5aeeb62 100644 --- a/dev/fold/index.html +++ b/dev/fold/index.html @@ -1 +1 @@ -fold - Rust
\ No newline at end of file +fold - Rust
\ No newline at end of file diff --git a/dev/groups/all.html b/dev/groups/all.html index 836766d20..68b82c129 100644 --- a/dev/groups/all.html +++ b/dev/groups/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/groups/fn.main.html b/dev/groups/fn.main.html index e648e0f46..02023e873 100644 --- a/dev/groups/fn.main.html +++ b/dev/groups/fn.main.html @@ -1 +1 @@ -main in groups - Rust

Function groups::main

source · []
pub fn main()
\ No newline at end of file +main in groups - Rust

Function groups::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/groups/index.html b/dev/groups/index.html index b271323c3..f5c046814 100644 --- a/dev/groups/index.html +++ b/dev/groups/index.html @@ -1 +1 @@ -groups - Rust
\ No newline at end of file +groups - Rust
\ No newline at end of file diff --git a/dev/hashsum/all.html b/dev/hashsum/all.html index f4e366771..678e9c307 100644 --- a/dev/hashsum/all.html +++ b/dev/hashsum/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/hashsum/fn.main.html b/dev/hashsum/fn.main.html index 3e19da187..307b1153b 100644 --- a/dev/hashsum/fn.main.html +++ b/dev/hashsum/fn.main.html @@ -1 +1 @@ -main in hashsum - Rust

Function hashsum::main

source · []
pub fn main()
\ No newline at end of file +main in hashsum - Rust

Function hashsum::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/hashsum/index.html b/dev/hashsum/index.html index 2ab921f34..287fce9ad 100644 --- a/dev/hashsum/index.html +++ b/dev/hashsum/index.html @@ -1 +1 @@ -hashsum - Rust
\ No newline at end of file +hashsum - Rust
\ No newline at end of file diff --git a/dev/head/all.html b/dev/head/all.html index 171ed2258..0e6291ef3 100644 --- a/dev/head/all.html +++ b/dev/head/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/head/fn.main.html b/dev/head/fn.main.html index 2389be3c4..a94a91cb2 100644 --- a/dev/head/fn.main.html +++ b/dev/head/fn.main.html @@ -1 +1 @@ -main in head - Rust

Function head::main

source · []
pub fn main()
\ No newline at end of file +main in head - Rust

Function head::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/head/index.html b/dev/head/index.html index 2441dafd8..b8556dc50 100644 --- a/dev/head/index.html +++ b/dev/head/index.html @@ -1 +1 @@ -head - Rust
\ No newline at end of file +head - Rust
\ No newline at end of file diff --git a/dev/hostid/all.html b/dev/hostid/all.html index ddfb0745f..51e513806 100644 --- a/dev/hostid/all.html +++ b/dev/hostid/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/hostid/fn.main.html b/dev/hostid/fn.main.html index 708dbd236..2efb58e32 100644 --- a/dev/hostid/fn.main.html +++ b/dev/hostid/fn.main.html @@ -1 +1 @@ -main in hostid - Rust

Function hostid::main

source · []
pub fn main()
\ No newline at end of file +main in hostid - Rust

Function hostid::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/hostid/index.html b/dev/hostid/index.html index 4be96d831..d45e370ae 100644 --- a/dev/hostid/index.html +++ b/dev/hostid/index.html @@ -1 +1 @@ -hostid - Rust
\ No newline at end of file +hostid - Rust
\ No newline at end of file diff --git a/dev/hostname/all.html b/dev/hostname/all.html index b2fe5ed87..4d2eac091 100644 --- a/dev/hostname/all.html +++ b/dev/hostname/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/hostname/fn.main.html b/dev/hostname/fn.main.html index 457d2a69f..d89b05e8c 100644 --- a/dev/hostname/fn.main.html +++ b/dev/hostname/fn.main.html @@ -1 +1 @@ -main in hostname - Rust
pub fn main()
\ No newline at end of file +main in hostname - Rust
pub fn main()
\ No newline at end of file diff --git a/dev/hostname/index.html b/dev/hostname/index.html index ba6b8bbee..81f630582 100644 --- a/dev/hostname/index.html +++ b/dev/hostname/index.html @@ -1 +1 @@ -hostname - Rust
\ No newline at end of file +hostname - Rust
\ No newline at end of file diff --git a/dev/id/all.html b/dev/id/all.html index 867f7f4c9..7f1ab381a 100644 --- a/dev/id/all.html +++ b/dev/id/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/id/fn.main.html b/dev/id/fn.main.html index 74919da60..c0a5cfc47 100644 --- a/dev/id/fn.main.html +++ b/dev/id/fn.main.html @@ -1 +1 @@ -main in id - Rust

Function id::main

source · []
pub fn main()
\ No newline at end of file +main in id - Rust

Function id::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/id/index.html b/dev/id/index.html index 0fafa6753..a2e65e5b8 100644 --- a/dev/id/index.html +++ b/dev/id/index.html @@ -1 +1 @@ -id - Rust
\ No newline at end of file +id - Rust
\ No newline at end of file diff --git a/dev/implementors/core/clone/trait.Clone.js b/dev/implementors/core/clone/trait.Clone.js index 9762109f3..51043ef64 100644 --- a/dev/implementors/core/clone/trait.Clone.js +++ b/dev/implementors/core/clone/trait.Clone.js @@ -1,13 +1,13 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl Clone for ClobberMode","synthetic":false,"types":["uu_cp::ClobberMode"]},{"text":"impl Clone for OverwriteMode","synthetic":false,"types":["uu_cp::OverwriteMode"]},{"text":"impl Clone for ReflinkMode","synthetic":false,"types":["uu_cp::ReflinkMode"]},{"text":"impl Clone for SparseMode","synthetic":false,"types":["uu_cp::SparseMode"]},{"text":"impl Clone for Attribute","synthetic":false,"types":["uu_cp::Attribute"]}]; -implementors["uu_factor"] = [{"text":"impl Clone for Factors","synthetic":false,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_install"] = [{"text":"impl Clone for MainFunction","synthetic":false,"types":["uu_install::MainFunction"]}]; -implementors["uu_kill"] = [{"text":"impl Clone for Mode","synthetic":false,"types":["uu_kill::Mode"]}]; -implementors["uu_ln"] = [{"text":"impl Clone for OverwriteMode","synthetic":false,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_mv"] = [{"text":"impl Clone for OverwriteMode","synthetic":false,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_numfmt"] = [{"text":"impl Clone for RoundMethod","synthetic":false,"types":["uu_numfmt::options::RoundMethod"]}]; -implementors["uu_sort"] = [{"text":"impl Clone for GlobalSettings","synthetic":false,"types":["uu_sort::GlobalSettings"]},{"text":"impl<'a> Clone for Line<'a>","synthetic":false,"types":["uu_sort::Line"]},{"text":"impl Clone for GeneralF64ParseResult","synthetic":false,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stty"] = [{"text":"impl<T: Clone> Clone for Flag<T>","synthetic":false,"types":["uu_stty::Flag"]}]; -implementors["uu_tail"] = [{"text":"impl Clone for Signum","synthetic":false,"types":["uu_tail::args::Signum"]},{"text":"impl Clone for FollowMode","synthetic":false,"types":["uu_tail::args::FollowMode"]},{"text":"impl Clone for BytesChunk","synthetic":false,"types":["uu_tail::chunks::BytesChunk"]}]; -implementors["uucore"] = [{"text":"impl Clone for Format","synthetic":false,"types":["uucore::features::encoding::Format"]},{"text":"impl Clone for MissingHandling","synthetic":false,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl Clone for ResolveMode","synthetic":false,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl Clone for MountInfo","synthetic":false,"types":["uucore::features::fsext::MountInfo"]},{"text":"impl Clone for FsUsage","synthetic":false,"types":["uucore::features::fsext::FsUsage"]},{"text":"impl Clone for Passwd","synthetic":false,"types":["uucore::features::entries::Passwd"]},{"text":"impl Clone for Group","synthetic":false,"types":["uucore::features::entries::Group"]},{"text":"impl Clone for VerbosityLevel","synthetic":false,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl Clone for Verbosity","synthetic":false,"types":["uucore::features::perms::Verbosity"]},{"text":"impl Clone for ExitStatus","synthetic":false,"types":["uucore::features::process::ExitStatus"]},{"text":"impl Clone for BackupMode","synthetic":false,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl Clone for Quotes","synthetic":false,"types":["uucore::mods::quoting_style::Quotes"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl Clone for ClobberMode"],["impl Clone for OverwriteMode"],["impl Clone for ReflinkMode"],["impl Clone for SparseMode"],["impl Clone for Attribute"]], +"uu_factor":[["impl Clone for Factors"]], +"uu_install":[["impl Clone for MainFunction"]], +"uu_kill":[["impl Clone for Mode"]], +"uu_ln":[["impl Clone for OverwriteMode"]], +"uu_mv":[["impl Clone for OverwriteMode"]], +"uu_numfmt":[["impl Clone for RoundMethod"]], +"uu_sort":[["impl Clone for GlobalSettings"],["impl<'a> Clone for Line<'a>"],["impl Clone for GeneralF64ParseResult"]], +"uu_stty":[["impl<T: Clone> Clone for Flag<T>"]], +"uu_tail":[["impl Clone for Signum"],["impl Clone for FollowMode"],["impl Clone for BytesChunk"]], +"uucore":[["impl Clone for Format"],["impl Clone for MissingHandling"],["impl Clone for ResolveMode"],["impl Clone for MountInfo"],["impl Clone for FsUsage"],["impl Clone for Passwd"],["impl Clone for Group"],["impl Clone for VerbosityLevel"],["impl Clone for Verbosity"],["impl Clone for ExitStatus"],["impl Clone for BackupMode"],["impl Clone for Quotes"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/cmp/trait.Eq.js b/dev/implementors/core/cmp/trait.Eq.js index c12c5ad26..64b71629a 100644 --- a/dev/implementors/core/cmp/trait.Eq.js +++ b/dev/implementors/core/cmp/trait.Eq.js @@ -1,13 +1,13 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl Eq for ClobberMode","synthetic":false,"types":["uu_cp::ClobberMode"]},{"text":"impl Eq for OverwriteMode","synthetic":false,"types":["uu_cp::OverwriteMode"]},{"text":"impl Eq for ReflinkMode","synthetic":false,"types":["uu_cp::ReflinkMode"]},{"text":"impl Eq for SparseMode","synthetic":false,"types":["uu_cp::SparseMode"]},{"text":"impl Eq for Attribute","synthetic":false,"types":["uu_cp::Attribute"]}]; -implementors["uu_dircolors"] = [{"text":"impl Eq for OutputFmt","synthetic":false,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl Eq for Factors","synthetic":false,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_install"] = [{"text":"impl Eq for MainFunction","synthetic":false,"types":["uu_install::MainFunction"]}]; -implementors["uu_ln"] = [{"text":"impl Eq for OverwriteMode","synthetic":false,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl Eq for Format","synthetic":false,"types":["uu_ls::Format"]}]; -implementors["uu_mv"] = [{"text":"impl Eq for OverwriteMode","synthetic":false,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_numfmt"] = [{"text":"impl Eq for FormatOptions","synthetic":false,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_stat"] = [{"text":"impl Eq for OutputType","synthetic":false,"types":["uu_stat::OutputType"]},{"text":"impl Eq for Token","synthetic":false,"types":["uu_stat::Token"]}]; -implementors["uu_tail"] = [{"text":"impl Eq for Signum","synthetic":false,"types":["uu_tail::args::Signum"]},{"text":"impl Eq for FilterMode","synthetic":false,"types":["uu_tail::args::FilterMode"]},{"text":"impl Eq for FollowMode","synthetic":false,"types":["uu_tail::args::FollowMode"]},{"text":"impl Eq for BytesChunk","synthetic":false,"types":["uu_tail::chunks::BytesChunk"]}]; -implementors["uucore"] = [{"text":"impl Eq for FileInformation","synthetic":false,"types":["uucore::features::fs::FileInformation"]},{"text":"impl Eq for MissingHandling","synthetic":false,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl Eq for ResolveMode","synthetic":false,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl Eq for VerbosityLevel","synthetic":false,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl Eq for Verbosity","synthetic":false,"types":["uucore::features::perms::Verbosity"]},{"text":"impl Eq for TraverseSymlinks","synthetic":false,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl Eq for ExitStatus","synthetic":false,"types":["uucore::features::process::ExitStatus"]},{"text":"impl Eq for BackupMode","synthetic":false,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl Eq for BackupError","synthetic":false,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl Eq for Range","synthetic":false,"types":["uucore::mods::ranges::Range"]},{"text":"impl Eq for ParseSizeError","synthetic":false,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl Eq for ClobberMode"],["impl Eq for OverwriteMode"],["impl Eq for ReflinkMode"],["impl Eq for SparseMode"],["impl Eq for Attribute"]], +"uu_dircolors":[["impl Eq for OutputFmt"]], +"uu_factor":[["impl Eq for Factors"]], +"uu_install":[["impl Eq for MainFunction"]], +"uu_ln":[["impl Eq for OverwriteMode"]], +"uu_ls":[["impl Eq for Format"]], +"uu_mv":[["impl Eq for OverwriteMode"]], +"uu_numfmt":[["impl Eq for FormatOptions"]], +"uu_stat":[["impl Eq for OutputType"],["impl Eq for Token"]], +"uu_tail":[["impl Eq for Signum"],["impl Eq for FilterMode"],["impl Eq for FollowMode"],["impl Eq for BytesChunk"]], +"uucore":[["impl Eq for FileInformation"],["impl Eq for MissingHandling"],["impl Eq for ResolveMode"],["impl Eq for VerbosityLevel"],["impl Eq for Verbosity"],["impl Eq for TraverseSymlinks"],["impl Eq for ExitStatus"],["impl Eq for BackupMode"],["impl Eq for BackupError"],["impl Eq for Range"],["impl Eq for ParseSizeError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/cmp/trait.Ord.js b/dev/implementors/core/cmp/trait.Ord.js index c5162b94d..ecbc45e26 100644 --- a/dev/implementors/core/cmp/trait.Ord.js +++ b/dev/implementors/core/cmp/trait.Ord.js @@ -1,4 +1,4 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl Ord for Attribute","synthetic":false,"types":["uu_cp::Attribute"]}]; -implementors["uucore"] = [{"text":"impl Ord for Range","synthetic":false,"types":["uucore::mods::ranges::Range"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl Ord for Attribute"]], +"uucore":[["impl Ord for Range"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/cmp/trait.PartialEq.js b/dev/implementors/core/cmp/trait.PartialEq.js index b548c2261..016428857 100644 --- a/dev/implementors/core/cmp/trait.PartialEq.js +++ b/dev/implementors/core/cmp/trait.PartialEq.js @@ -1,14 +1,14 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl PartialEq<ClobberMode> for ClobberMode","synthetic":false,"types":["uu_cp::ClobberMode"]},{"text":"impl PartialEq<OverwriteMode> for OverwriteMode","synthetic":false,"types":["uu_cp::OverwriteMode"]},{"text":"impl PartialEq<ReflinkMode> for ReflinkMode","synthetic":false,"types":["uu_cp::ReflinkMode"]},{"text":"impl PartialEq<SparseMode> for SparseMode","synthetic":false,"types":["uu_cp::SparseMode"]},{"text":"impl PartialEq<Attribute> for Attribute","synthetic":false,"types":["uu_cp::Attribute"]}]; -implementors["uu_dircolors"] = [{"text":"impl PartialEq<OutputFmt> for OutputFmt","synthetic":false,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl PartialEq<Factors> for Factors","synthetic":false,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_install"] = [{"text":"impl PartialEq<MainFunction> for MainFunction","synthetic":false,"types":["uu_install::MainFunction"]}]; -implementors["uu_ln"] = [{"text":"impl PartialEq<OverwriteMode> for OverwriteMode","synthetic":false,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl PartialEq<Format> for Format","synthetic":false,"types":["uu_ls::Format"]}]; -implementors["uu_mv"] = [{"text":"impl PartialEq<OverwriteMode> for OverwriteMode","synthetic":false,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_numfmt"] = [{"text":"impl PartialEq<FormatOptions> for FormatOptions","synthetic":false,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl PartialEq<GeneralF64ParseResult> for GeneralF64ParseResult","synthetic":false,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stat"] = [{"text":"impl PartialEq<OutputType> for OutputType","synthetic":false,"types":["uu_stat::OutputType"]},{"text":"impl PartialEq<Token> for Token","synthetic":false,"types":["uu_stat::Token"]}]; -implementors["uu_tail"] = [{"text":"impl PartialEq<Signum> for Signum","synthetic":false,"types":["uu_tail::args::Signum"]},{"text":"impl PartialEq<FilterMode> for FilterMode","synthetic":false,"types":["uu_tail::args::FilterMode"]},{"text":"impl PartialEq<FollowMode> for FollowMode","synthetic":false,"types":["uu_tail::args::FollowMode"]},{"text":"impl PartialEq<BytesChunk> for BytesChunk","synthetic":false,"types":["uu_tail::chunks::BytesChunk"]}]; -implementors["uucore"] = [{"text":"impl PartialEq<FileInformation> for FileInformation","synthetic":false,"types":["uucore::features::fs::FileInformation"]},{"text":"impl PartialEq<MissingHandling> for MissingHandling","synthetic":false,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl PartialEq<ResolveMode> for ResolveMode","synthetic":false,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl PartialEq<VerbosityLevel> for VerbosityLevel","synthetic":false,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl PartialEq<Verbosity> for Verbosity","synthetic":false,"types":["uucore::features::perms::Verbosity"]},{"text":"impl PartialEq<TraverseSymlinks> for TraverseSymlinks","synthetic":false,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl PartialEq<ExitStatus> for ExitStatus","synthetic":false,"types":["uucore::features::process::ExitStatus"]},{"text":"impl PartialEq<BackupMode> for BackupMode","synthetic":false,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl PartialEq<BackupError> for BackupError","synthetic":false,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl PartialEq<Range> for Range","synthetic":false,"types":["uucore::mods::ranges::Range"]},{"text":"impl PartialEq<ParseSizeError> for ParseSizeError","synthetic":false,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl PartialEq<ClobberMode> for ClobberMode"],["impl PartialEq<OverwriteMode> for OverwriteMode"],["impl PartialEq<ReflinkMode> for ReflinkMode"],["impl PartialEq<SparseMode> for SparseMode"],["impl PartialEq<Attribute> for Attribute"]], +"uu_dircolors":[["impl PartialEq<OutputFmt> for OutputFmt"]], +"uu_factor":[["impl PartialEq<Factors> for Factors"]], +"uu_install":[["impl PartialEq<MainFunction> for MainFunction"]], +"uu_ln":[["impl PartialEq<OverwriteMode> for OverwriteMode"]], +"uu_ls":[["impl PartialEq<Format> for Format"]], +"uu_mv":[["impl PartialEq<OverwriteMode> for OverwriteMode"]], +"uu_numfmt":[["impl PartialEq<FormatOptions> for FormatOptions"]], +"uu_sort":[["impl PartialEq<GeneralF64ParseResult> for GeneralF64ParseResult"]], +"uu_stat":[["impl PartialEq<OutputType> for OutputType"],["impl PartialEq<Token> for Token"]], +"uu_tail":[["impl PartialEq<Signum> for Signum"],["impl PartialEq<FilterMode> for FilterMode"],["impl PartialEq<FollowMode> for FollowMode"],["impl PartialEq<BytesChunk> for BytesChunk"]], +"uucore":[["impl PartialEq<FileInformation> for FileInformation"],["impl PartialEq<MissingHandling> for MissingHandling"],["impl PartialEq<ResolveMode> for ResolveMode"],["impl PartialEq<VerbosityLevel> for VerbosityLevel"],["impl PartialEq<Verbosity> for Verbosity"],["impl PartialEq<TraverseSymlinks> for TraverseSymlinks"],["impl PartialEq<ExitStatus> for ExitStatus"],["impl PartialEq<BackupMode> for BackupMode"],["impl PartialEq<BackupError> for BackupError"],["impl PartialEq<Range> for Range"],["impl PartialEq<ParseSizeError> for ParseSizeError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/cmp/trait.PartialOrd.js b/dev/implementors/core/cmp/trait.PartialOrd.js index 8dae8fc17..5aba25033 100644 --- a/dev/implementors/core/cmp/trait.PartialOrd.js +++ b/dev/implementors/core/cmp/trait.PartialOrd.js @@ -1,5 +1,5 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl PartialOrd<Attribute> for Attribute","synthetic":false,"types":["uu_cp::Attribute"]}]; -implementors["uu_sort"] = [{"text":"impl PartialOrd<GeneralF64ParseResult> for GeneralF64ParseResult","synthetic":false,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uucore"] = [{"text":"impl PartialOrd<Range> for Range","synthetic":false,"types":["uucore::mods::ranges::Range"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl PartialOrd<Attribute> for Attribute"]], +"uu_sort":[["impl PartialOrd<GeneralF64ParseResult> for GeneralF64ParseResult"]], +"uucore":[["impl PartialOrd<Range> for Range"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/convert/trait.From.js b/dev/implementors/core/convert/trait.From.js index 5cf6b526a..1db4c17c3 100644 --- a/dev/implementors/core/convert/trait.From.js +++ b/dev/implementors/core/convert/trait.From.js @@ -1,4 +1,4 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl From<Error> for Error","synthetic":false,"types":["uu_cp::Error"]},{"text":"impl From<String> for Error","synthetic":false,"types":["uu_cp::Error"]},{"text":"impl From<&'static str> for Error","synthetic":false,"types":["uu_cp::Error"]},{"text":"impl From<Error> for Error","synthetic":false,"types":["uu_cp::Error"]},{"text":"impl From<StripPrefixError> for Error","synthetic":false,"types":["uu_cp::Error"]},{"text":"impl<'a> From<Context<&'a str, Error>> for Error","synthetic":false,"types":["uu_cp::Error"]},{"text":"impl<'a> From<Context<String, Error>> for Error","synthetic":false,"types":["uu_cp::Error"]}]; -implementors["uucore"] = [{"text":"impl From<DecodeError> for DecodeError","synthetic":false,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl From<DecodeError> for DecodeError","synthetic":false,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl From<Error> for DecodeError","synthetic":false,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl<T> From<T> for Box<dyn UError> where
    T: UError + 'static, 
","synthetic":false,"types":["alloc::boxed::Box"]},{"text":"impl From<Error> for UIoError","synthetic":false,"types":["uucore::mods::error::UIoError"]},{"text":"impl From<Error> for Box<dyn UError>","synthetic":false,"types":["alloc::boxed::Box"]},{"text":"impl From<i32> for Box<dyn UError>","synthetic":false,"types":["alloc::boxed::Box"]},{"text":"impl From<Error<RichFormatter>> for Box<dyn UError>","synthetic":false,"types":["alloc::boxed::Box"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl From<Error> for Error"],["impl From<String> for Error"],["impl From<&'static str> for Error"],["impl From<Error> for Error"],["impl From<StripPrefixError> for Error"],["impl<'a> From<Context<&'a str, Error>> for Error"],["impl<'a> From<Context<String, Error>> for Error"]], +"uucore":[["impl From<DecodeError> for DecodeError"],["impl From<DecodeError> for DecodeError"],["impl From<Error> for DecodeError"],["impl<T> From<T> for Box<dyn UError>where
    T: UError + 'static,
"],["impl From<Error> for UIoError"],["impl From<Error> for Box<dyn UError>"],["impl From<i32> for Box<dyn UError>"],["impl From<Error<RichFormatter>> for Box<dyn UError>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/default/trait.Default.js b/dev/implementors/core/default/trait.Default.js index ff9fefd60..c19f70ad8 100644 --- a/dev/implementors/core/default/trait.Default.js +++ b/dev/implementors/core/default/trait.Default.js @@ -1,6 +1,6 @@ -(function() {var implementors = {}; -implementors["uu_numfmt"] = [{"text":"impl Default for FormatOptions","synthetic":false,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl Default for GlobalSettings","synthetic":false,"types":["uu_sort::GlobalSettings"]}]; -implementors["uu_stty"] = [{"text":"impl Default for TermSize","synthetic":false,"types":["uu_stty::TermSize"]}]; -implementors["uu_tail"] = [{"text":"impl Default for FilterMode","synthetic":false,"types":["uu_tail::args::FilterMode"]},{"text":"impl Default for Settings","synthetic":false,"types":["uu_tail::args::Settings"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_numfmt":[["impl Default for FormatOptions"]], +"uu_sort":[["impl Default for GlobalSettings"]], +"uu_stty":[["impl Default for TermSize"]], +"uu_tail":[["impl Default for FilterMode"],["impl Default for Settings"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/error/trait.Error.js b/dev/implementors/core/error/trait.Error.js new file mode 100644 index 000000000..9f6a52ce4 --- /dev/null +++ b/dev/implementors/core/error/trait.Error.js @@ -0,0 +1,5 @@ +(function() {var implementors = { +"uu_cp":[["impl Error for Error"]], +"uu_numfmt":[["impl Error for NumfmtError"]], +"uucore":[["impl Error for DecodeError"],["impl Error for BackupError"],["impl Error for USimpleError"],["impl Error for UUsageError"],["impl Error for UIoError"],["impl Error for ExitCode"],["impl Error for ClapErrorWrapper"],["impl Error for ParseSizeError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/fmt/trait.Debug.js b/dev/implementors/core/fmt/trait.Debug.js index a04d694c4..dfafb9538 100644 --- a/dev/implementors/core/fmt/trait.Debug.js +++ b/dev/implementors/core/fmt/trait.Debug.js @@ -1,13 +1,13 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl Debug for Error","synthetic":false,"types":["uu_cp::Error"]},{"text":"impl Debug for Attribute","synthetic":false,"types":["uu_cp::Attribute"]}]; -implementors["uu_dircolors"] = [{"text":"impl Debug for OutputFmt","synthetic":false,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl Debug for Factors","synthetic":false,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_ln"] = [{"text":"impl Debug for OverwriteMode","synthetic":false,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl Debug for Format","synthetic":false,"types":["uu_ls::Format"]}]; -implementors["uu_numfmt"] = [{"text":"impl Debug for NumfmtError","synthetic":false,"types":["uu_numfmt::errors::NumfmtError"]},{"text":"impl Debug for FormatOptions","synthetic":false,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl<'a> Debug for Line<'a>","synthetic":false,"types":["uu_sort::Line"]},{"text":"impl Debug for GeneralF64ParseResult","synthetic":false,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stat"] = [{"text":"impl Debug for OutputType","synthetic":false,"types":["uu_stat::OutputType"]},{"text":"impl Debug for Token","synthetic":false,"types":["uu_stat::Token"]}]; -implementors["uu_stty"] = [{"text":"impl<T: Debug> Debug for Flag<T>","synthetic":false,"types":["uu_stty::Flag"]},{"text":"impl Debug for TermSize","synthetic":false,"types":["uu_stty::TermSize"]}]; -implementors["uu_tail"] = [{"text":"impl Debug for Signum","synthetic":false,"types":["uu_tail::args::Signum"]},{"text":"impl Debug for FilterMode","synthetic":false,"types":["uu_tail::args::FilterMode"]},{"text":"impl Debug for FollowMode","synthetic":false,"types":["uu_tail::args::FollowMode"]},{"text":"impl Debug for Settings","synthetic":false,"types":["uu_tail::args::Settings"]},{"text":"impl Debug for BytesChunk","synthetic":false,"types":["uu_tail::chunks::BytesChunk"]},{"text":"impl Debug for LinesChunk","synthetic":false,"types":["uu_tail::chunks::LinesChunk"]}]; -implementors["uucore"] = [{"text":"impl Debug for DecodeError","synthetic":false,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl Debug for MissingHandling","synthetic":false,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl Debug for ResolveMode","synthetic":false,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl Debug for MountInfo","synthetic":false,"types":["uucore::features::fsext::MountInfo"]},{"text":"impl Debug for FsUsage","synthetic":false,"types":["uucore::features::fsext::FsUsage"]},{"text":"impl Debug for Passwd","synthetic":false,"types":["uucore::features::entries::Passwd"]},{"text":"impl Debug for Group","synthetic":false,"types":["uucore::features::entries::Group"]},{"text":"impl Debug for VerbosityLevel","synthetic":false,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl Debug for Verbosity","synthetic":false,"types":["uucore::features::perms::Verbosity"]},{"text":"impl Debug for ExitStatus","synthetic":false,"types":["uucore::features::process::ExitStatus"]},{"text":"impl Debug for BackupMode","synthetic":false,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl Debug for BackupError","synthetic":false,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl Debug for USimpleError","synthetic":false,"types":["uucore::mods::error::USimpleError"]},{"text":"impl Debug for UUsageError","synthetic":false,"types":["uucore::mods::error::UUsageError"]},{"text":"impl Debug for UIoError","synthetic":false,"types":["uucore::mods::error::UIoError"]},{"text":"impl Debug for ExitCode","synthetic":false,"types":["uucore::mods::error::ExitCode"]},{"text":"impl Debug for ClapErrorWrapper","synthetic":false,"types":["uucore::mods::error::ClapErrorWrapper"]},{"text":"impl Debug for Range","synthetic":false,"types":["uucore::mods::ranges::Range"]},{"text":"impl Debug for ParseSizeError","synthetic":false,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl Debug for Error"],["impl Debug for Attribute"]], +"uu_dircolors":[["impl Debug for OutputFmt"]], +"uu_factor":[["impl Debug for Factors"]], +"uu_ln":[["impl Debug for OverwriteMode"]], +"uu_ls":[["impl Debug for Format"]], +"uu_numfmt":[["impl Debug for NumfmtError"],["impl Debug for FormatOptions"]], +"uu_sort":[["impl<'a> Debug for Line<'a>"],["impl Debug for GeneralF64ParseResult"]], +"uu_stat":[["impl Debug for OutputType"],["impl Debug for Token"]], +"uu_stty":[["impl<T: Debug> Debug for Flag<T>"],["impl Debug for TermSize"]], +"uu_tail":[["impl Debug for Signum"],["impl Debug for FilterMode"],["impl Debug for FollowMode"],["impl Debug for Settings"],["impl Debug for BytesChunk"],["impl Debug for LinesChunk"]], +"uucore":[["impl Debug for DecodeError"],["impl Debug for MissingHandling"],["impl Debug for ResolveMode"],["impl Debug for MountInfo"],["impl Debug for FsUsage"],["impl Debug for Passwd"],["impl Debug for Group"],["impl Debug for VerbosityLevel"],["impl Debug for Verbosity"],["impl Debug for ExitStatus"],["impl Debug for BackupMode"],["impl Debug for BackupError"],["impl Debug for USimpleError"],["impl Debug for UUsageError"],["impl Debug for UIoError"],["impl Debug for ExitCode"],["impl Debug for ClapErrorWrapper"],["impl Debug for Range"],["impl Debug for ParseSizeError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/fmt/trait.Display.js b/dev/implementors/core/fmt/trait.Display.js index 6f48e18fb..4663ad436 100644 --- a/dev/implementors/core/fmt/trait.Display.js +++ b/dev/implementors/core/fmt/trait.Display.js @@ -1,6 +1,6 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl Display for Error","synthetic":false,"types":["uu_cp::Error"]}]; -implementors["uu_factor"] = [{"text":"impl Display for Factors","synthetic":false,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_numfmt"] = [{"text":"impl Display for NumfmtError","synthetic":false,"types":["uu_numfmt::errors::NumfmtError"]}]; -implementors["uucore"] = [{"text":"impl Display for DecodeError","synthetic":false,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl Display for ExitStatus","synthetic":false,"types":["uucore::features::process::ExitStatus"]},{"text":"impl Display for BackupError","synthetic":false,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl Display for USimpleError","synthetic":false,"types":["uucore::mods::error::USimpleError"]},{"text":"impl Display for UUsageError","synthetic":false,"types":["uucore::mods::error::UUsageError"]},{"text":"impl Display for UIoError","synthetic":false,"types":["uucore::mods::error::UIoError"]},{"text":"impl Display for ExitCode","synthetic":false,"types":["uucore::mods::error::ExitCode"]},{"text":"impl Display for ClapErrorWrapper","synthetic":false,"types":["uucore::mods::error::ClapErrorWrapper"]},{"text":"impl Display for ParseSizeError","synthetic":false,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl Display for Error"]], +"uu_factor":[["impl Display for Factors"]], +"uu_numfmt":[["impl Display for NumfmtError"]], +"uucore":[["impl Display for DecodeError"],["impl Display for ExitStatus"],["impl Display for BackupError"],["impl Display for USimpleError"],["impl Display for UUsageError"],["impl Display for UIoError"],["impl Display for ExitCode"],["impl Display for ClapErrorWrapper"],["impl Display for ParseSizeError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/hash/trait.Hash.js b/dev/implementors/core/hash/trait.Hash.js index 78ddb271c..2c254da61 100644 --- a/dev/implementors/core/hash/trait.Hash.js +++ b/dev/implementors/core/hash/trait.Hash.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uucore"] = [{"text":"impl Hash for FileInformation","synthetic":false,"types":["uucore::features::fs::FileInformation"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uucore":[["impl Hash for FileInformation"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/iter/traits/iterator/trait.Iterator.js b/dev/implementors/core/iter/traits/iterator/trait.Iterator.js index 2a4d41650..fd2fbbfa4 100644 --- a/dev/implementors/core/iter/traits/iterator/trait.Iterator.js +++ b/dev/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -1,5 +1,5 @@ -(function() {var implementors = {}; -implementors["uu_numfmt"] = [{"text":"impl<'a> Iterator for WhitespaceSplitter<'a>","synthetic":false,"types":["uu_numfmt::format::WhitespaceSplitter"]}]; -implementors["uu_tail"] = [{"text":"impl<'a> Iterator for ReverseChunks<'a>","synthetic":false,"types":["uu_tail::chunks::ReverseChunks"]}]; -implementors["uucore"] = [{"text":"impl<B: BufRead> Iterator for Lines<B>","synthetic":false,"types":["uucore::features::lines::Lines"]},{"text":"impl Iterator for UtmpxIter","synthetic":false,"types":["uucore::features::utmpx::UtmpxIter"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_numfmt":[["impl<'a> Iterator for WhitespaceSplitter<'a>"]], +"uu_tail":[["impl<'a> Iterator for ReverseChunks<'a>"]], +"uucore":[["impl<B: BufRead> Iterator for Lines<B>"],["impl Iterator for UtmpxIter"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/marker/trait.Copy.js b/dev/implementors/core/marker/trait.Copy.js index 5a1ba51f9..b4309d8cc 100644 --- a/dev/implementors/core/marker/trait.Copy.js +++ b/dev/implementors/core/marker/trait.Copy.js @@ -1,9 +1,9 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl Copy for ClobberMode","synthetic":false,"types":["uu_cp::ClobberMode"]},{"text":"impl Copy for OverwriteMode","synthetic":false,"types":["uu_cp::OverwriteMode"]},{"text":"impl Copy for ReflinkMode","synthetic":false,"types":["uu_cp::ReflinkMode"]},{"text":"impl Copy for SparseMode","synthetic":false,"types":["uu_cp::SparseMode"]}]; -implementors["uu_kill"] = [{"text":"impl Copy for Mode","synthetic":false,"types":["uu_kill::Mode"]}]; -implementors["uu_numfmt"] = [{"text":"impl Copy for RoundMethod","synthetic":false,"types":["uu_numfmt::options::RoundMethod"]}]; -implementors["uu_sort"] = [{"text":"impl Copy for GeneralF64ParseResult","synthetic":false,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stty"] = [{"text":"impl<T: Copy> Copy for Flag<T>","synthetic":false,"types":["uu_stty::Flag"]}]; -implementors["uu_tail"] = [{"text":"impl Copy for Signum","synthetic":false,"types":["uu_tail::args::Signum"]},{"text":"impl Copy for FollowMode","synthetic":false,"types":["uu_tail::args::FollowMode"]}]; -implementors["uucore"] = [{"text":"impl Copy for Format","synthetic":false,"types":["uucore::features::encoding::Format"]},{"text":"impl Copy for MissingHandling","synthetic":false,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl Copy for ResolveMode","synthetic":false,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl Copy for ExitStatus","synthetic":false,"types":["uucore::features::process::ExitStatus"]},{"text":"impl Copy for BackupMode","synthetic":false,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl Copy for Quotes","synthetic":false,"types":["uucore::mods::quoting_style::Quotes"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl Copy for ClobberMode"],["impl Copy for OverwriteMode"],["impl Copy for ReflinkMode"],["impl Copy for SparseMode"]], +"uu_kill":[["impl Copy for Mode"]], +"uu_numfmt":[["impl Copy for RoundMethod"]], +"uu_sort":[["impl Copy for GeneralF64ParseResult"]], +"uu_stty":[["impl<T: Copy> Copy for Flag<T>"]], +"uu_tail":[["impl Copy for Signum"],["impl Copy for FollowMode"]], +"uucore":[["impl Copy for Format"],["impl Copy for MissingHandling"],["impl Copy for ResolveMode"],["impl Copy for ExitStatus"],["impl Copy for BackupMode"],["impl Copy for Quotes"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/marker/trait.Freeze.js b/dev/implementors/core/marker/trait.Freeze.js index c6d87ab0f..1ab78bc47 100644 --- a/dev/implementors/core/marker/trait.Freeze.js +++ b/dev/implementors/core/marker/trait.Freeze.js @@ -1,21 +1,21 @@ -(function() {var implementors = {}; -implementors["uu_base32"] = [{"text":"impl Freeze for Config","synthetic":true,"types":["uu_base32::base_common::Config"]}]; -implementors["uu_cp"] = [{"text":"impl Freeze for Error","synthetic":true,"types":["uu_cp::Error"]},{"text":"impl Freeze for ClobberMode","synthetic":true,"types":["uu_cp::ClobberMode"]},{"text":"impl Freeze for OverwriteMode","synthetic":true,"types":["uu_cp::OverwriteMode"]},{"text":"impl Freeze for ReflinkMode","synthetic":true,"types":["uu_cp::ReflinkMode"]},{"text":"impl Freeze for SparseMode","synthetic":true,"types":["uu_cp::SparseMode"]},{"text":"impl Freeze for TargetType","synthetic":true,"types":["uu_cp::TargetType"]},{"text":"impl Freeze for CopyMode","synthetic":true,"types":["uu_cp::CopyMode"]},{"text":"impl Freeze for Attribute","synthetic":true,"types":["uu_cp::Attribute"]},{"text":"impl Freeze for Options","synthetic":true,"types":["uu_cp::Options"]}]; -implementors["uu_csplit"] = [{"text":"impl Freeze for CsplitOptions","synthetic":true,"types":["uu_csplit::CsplitOptions"]}]; -implementors["uu_dircolors"] = [{"text":"impl Freeze for OutputFmt","synthetic":true,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl !Freeze for Factors","synthetic":true,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_fmt"] = [{"text":"impl Freeze for FmtOptions","synthetic":true,"types":["uu_fmt::FmtOptions"]}]; -implementors["uu_install"] = [{"text":"impl Freeze for Behavior","synthetic":true,"types":["uu_install::Behavior"]},{"text":"impl Freeze for MainFunction","synthetic":true,"types":["uu_install::MainFunction"]}]; -implementors["uu_kill"] = [{"text":"impl Freeze for Mode","synthetic":true,"types":["uu_kill::Mode"]}]; -implementors["uu_ln"] = [{"text":"impl Freeze for Settings","synthetic":true,"types":["uu_ln::Settings"]},{"text":"impl Freeze for OverwriteMode","synthetic":true,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl Freeze for Format","synthetic":true,"types":["uu_ls::Format"]},{"text":"impl Freeze for Config","synthetic":true,"types":["uu_ls::Config"]}]; -implementors["uu_mv"] = [{"text":"impl Freeze for Behavior","synthetic":true,"types":["uu_mv::Behavior"]},{"text":"impl Freeze for OverwriteMode","synthetic":true,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_nl"] = [{"text":"impl Freeze for Settings","synthetic":true,"types":["uu_nl::Settings"]}]; -implementors["uu_numfmt"] = [{"text":"impl Freeze for NumfmtError","synthetic":true,"types":["uu_numfmt::errors::NumfmtError"]},{"text":"impl<'a> Freeze for WhitespaceSplitter<'a>","synthetic":true,"types":["uu_numfmt::format::WhitespaceSplitter"]},{"text":"impl Freeze for TransformOptions","synthetic":true,"types":["uu_numfmt::options::TransformOptions"]},{"text":"impl Freeze for NumfmtOptions","synthetic":true,"types":["uu_numfmt::options::NumfmtOptions"]},{"text":"impl Freeze for RoundMethod","synthetic":true,"types":["uu_numfmt::options::RoundMethod"]},{"text":"impl Freeze for FormatOptions","synthetic":true,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl Freeze for Output","synthetic":true,"types":["uu_sort::Output"]},{"text":"impl Freeze for GlobalSettings","synthetic":true,"types":["uu_sort::GlobalSettings"]},{"text":"impl<'a> Freeze for Line<'a>","synthetic":true,"types":["uu_sort::Line"]},{"text":"impl Freeze for GeneralF64ParseResult","synthetic":true,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stat"] = [{"text":"impl Freeze for OutputType","synthetic":true,"types":["uu_stat::OutputType"]},{"text":"impl Freeze for Token","synthetic":true,"types":["uu_stat::Token"]},{"text":"impl Freeze for Stater","synthetic":true,"types":["uu_stat::Stater"]}]; -implementors["uu_stty"] = [{"text":"impl<T> Freeze for Flag<T> where
    T: Freeze, 
","synthetic":true,"types":["uu_stty::Flag"]},{"text":"impl Freeze for TermSize","synthetic":true,"types":["uu_stty::TermSize"]}]; -implementors["uu_tail"] = [{"text":"impl Freeze for Signum","synthetic":true,"types":["uu_tail::args::Signum"]},{"text":"impl Freeze for FilterMode","synthetic":true,"types":["uu_tail::args::FilterMode"]},{"text":"impl Freeze for FollowMode","synthetic":true,"types":["uu_tail::args::FollowMode"]},{"text":"impl Freeze for Settings","synthetic":true,"types":["uu_tail::args::Settings"]},{"text":"impl<'a> Freeze for ReverseChunks<'a>","synthetic":true,"types":["uu_tail::chunks::ReverseChunks"]},{"text":"impl Freeze for BytesChunk","synthetic":true,"types":["uu_tail::chunks::BytesChunk"]},{"text":"impl Freeze for BytesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::BytesChunkBuffer"]},{"text":"impl Freeze for LinesChunk","synthetic":true,"types":["uu_tail::chunks::LinesChunk"]},{"text":"impl Freeze for LinesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::LinesChunkBuffer"]}]; -implementors["uucore"] = [{"text":"impl Freeze for DecodeError","synthetic":true,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl Freeze for EncodeError","synthetic":true,"types":["uucore::features::encoding::EncodeError"]},{"text":"impl Freeze for Format","synthetic":true,"types":["uucore::features::encoding::Format"]},{"text":"impl<R> Freeze for Data<R> where
    R: Freeze, 
","synthetic":true,"types":["uucore::features::encoding::Data"]},{"text":"impl Freeze for FileInformation","synthetic":true,"types":["uucore::features::fs::FileInformation"]},{"text":"impl Freeze for MissingHandling","synthetic":true,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl Freeze for ResolveMode","synthetic":true,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl Freeze for MountInfo","synthetic":true,"types":["uucore::features::fsext::MountInfo"]},{"text":"impl Freeze for FsUsage","synthetic":true,"types":["uucore::features::fsext::FsUsage"]},{"text":"impl<B> Freeze for Lines<B> where
    B: Freeze, 
","synthetic":true,"types":["uucore::features::lines::Lines"]},{"text":"impl Freeze for Memo","synthetic":true,"types":["uucore::features::memo::Memo"]},{"text":"impl<T> Freeze for RingBuffer<T>","synthetic":true,"types":["uucore::features::ringbuffer::RingBuffer"]},{"text":"impl Freeze for Passwd","synthetic":true,"types":["uucore::features::entries::Passwd"]},{"text":"impl Freeze for Group","synthetic":true,"types":["uucore::features::entries::Group"]},{"text":"impl Freeze for VerbosityLevel","synthetic":true,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl Freeze for Verbosity","synthetic":true,"types":["uucore::features::perms::Verbosity"]},{"text":"impl Freeze for IfFrom","synthetic":true,"types":["uucore::features::perms::IfFrom"]},{"text":"impl Freeze for TraverseSymlinks","synthetic":true,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl Freeze for ChownExecutor","synthetic":true,"types":["uucore::features::perms::ChownExecutor"]},{"text":"impl Freeze for ExitStatus","synthetic":true,"types":["uucore::features::process::ExitStatus"]},{"text":"impl Freeze for Utmpx","synthetic":true,"types":["uucore::features::utmpx::Utmpx"]},{"text":"impl Freeze for UtmpxIter","synthetic":true,"types":["uucore::features::utmpx::UtmpxIter"]},{"text":"impl Freeze for BackupMode","synthetic":true,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl Freeze for BackupError","synthetic":true,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl Freeze for USimpleError","synthetic":true,"types":["uucore::mods::error::USimpleError"]},{"text":"impl Freeze for UUsageError","synthetic":true,"types":["uucore::mods::error::UUsageError"]},{"text":"impl Freeze for UIoError","synthetic":true,"types":["uucore::mods::error::UIoError"]},{"text":"impl Freeze for ExitCode","synthetic":true,"types":["uucore::mods::error::ExitCode"]},{"text":"impl Freeze for ClapErrorWrapper","synthetic":true,"types":["uucore::mods::error::ClapErrorWrapper"]},{"text":"impl Freeze for Range","synthetic":true,"types":["uucore::mods::ranges::Range"]},{"text":"impl Freeze for QuotingStyle","synthetic":true,"types":["uucore::mods::quoting_style::QuotingStyle"]},{"text":"impl Freeze for Quotes","synthetic":true,"types":["uucore::mods::quoting_style::Quotes"]},{"text":"impl Freeze for ParseSizeError","synthetic":true,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -implementors["uudoc"] = [{"text":"impl<'a, 'b> Freeze for MDWriter<'a, 'b>","synthetic":true,"types":["uudoc::MDWriter"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_base32":[["impl Freeze for Config",1,["uu_base32::base_common::Config"]]], +"uu_cp":[["impl Freeze for Error",1,["uu_cp::Error"]],["impl Freeze for ClobberMode",1,["uu_cp::ClobberMode"]],["impl Freeze for OverwriteMode",1,["uu_cp::OverwriteMode"]],["impl Freeze for ReflinkMode",1,["uu_cp::ReflinkMode"]],["impl Freeze for SparseMode",1,["uu_cp::SparseMode"]],["impl Freeze for TargetType",1,["uu_cp::TargetType"]],["impl Freeze for CopyMode",1,["uu_cp::CopyMode"]],["impl Freeze for Attribute",1,["uu_cp::Attribute"]],["impl Freeze for Options",1,["uu_cp::Options"]]], +"uu_csplit":[["impl Freeze for CsplitOptions",1,["uu_csplit::CsplitOptions"]]], +"uu_dircolors":[["impl Freeze for OutputFmt",1,["uu_dircolors::OutputFmt"]]], +"uu_factor":[["impl !Freeze for Factors",1,["uu_factor::factor::Factors"]]], +"uu_fmt":[["impl Freeze for FmtOptions",1,["uu_fmt::FmtOptions"]]], +"uu_install":[["impl Freeze for Behavior",1,["uu_install::Behavior"]],["impl Freeze for MainFunction",1,["uu_install::MainFunction"]]], +"uu_kill":[["impl Freeze for Mode",1,["uu_kill::Mode"]]], +"uu_ln":[["impl Freeze for Settings",1,["uu_ln::Settings"]],["impl Freeze for OverwriteMode",1,["uu_ln::OverwriteMode"]]], +"uu_ls":[["impl Freeze for Format",1,["uu_ls::Format"]],["impl Freeze for Config",1,["uu_ls::Config"]]], +"uu_mv":[["impl Freeze for Behavior",1,["uu_mv::Behavior"]],["impl Freeze for OverwriteMode",1,["uu_mv::OverwriteMode"]]], +"uu_nl":[["impl Freeze for Settings",1,["uu_nl::Settings"]]], +"uu_numfmt":[["impl Freeze for NumfmtError",1,["uu_numfmt::errors::NumfmtError"]],["impl<'a> Freeze for WhitespaceSplitter<'a>",1,["uu_numfmt::format::WhitespaceSplitter"]],["impl Freeze for TransformOptions",1,["uu_numfmt::options::TransformOptions"]],["impl Freeze for NumfmtOptions",1,["uu_numfmt::options::NumfmtOptions"]],["impl Freeze for RoundMethod",1,["uu_numfmt::options::RoundMethod"]],["impl Freeze for FormatOptions",1,["uu_numfmt::options::FormatOptions"]]], +"uu_sort":[["impl Freeze for Output",1,["uu_sort::Output"]],["impl Freeze for GlobalSettings",1,["uu_sort::GlobalSettings"]],["impl<'a> Freeze for Line<'a>",1,["uu_sort::Line"]],["impl Freeze for GeneralF64ParseResult",1,["uu_sort::GeneralF64ParseResult"]]], +"uu_stat":[["impl Freeze for OutputType",1,["uu_stat::OutputType"]],["impl Freeze for Token",1,["uu_stat::Token"]],["impl Freeze for Stater",1,["uu_stat::Stater"]]], +"uu_stty":[["impl<T> Freeze for Flag<T>where
    T: Freeze,
",1,["uu_stty::Flag"]],["impl Freeze for TermSize",1,["uu_stty::TermSize"]]], +"uu_tail":[["impl Freeze for Signum",1,["uu_tail::args::Signum"]],["impl Freeze for FilterMode",1,["uu_tail::args::FilterMode"]],["impl Freeze for FollowMode",1,["uu_tail::args::FollowMode"]],["impl Freeze for Settings",1,["uu_tail::args::Settings"]],["impl<'a> Freeze for ReverseChunks<'a>",1,["uu_tail::chunks::ReverseChunks"]],["impl Freeze for BytesChunk",1,["uu_tail::chunks::BytesChunk"]],["impl Freeze for BytesChunkBuffer",1,["uu_tail::chunks::BytesChunkBuffer"]],["impl Freeze for LinesChunk",1,["uu_tail::chunks::LinesChunk"]],["impl Freeze for LinesChunkBuffer",1,["uu_tail::chunks::LinesChunkBuffer"]]], +"uucore":[["impl Freeze for DecodeError",1,["uucore::features::encoding::DecodeError"]],["impl Freeze for EncodeError",1,["uucore::features::encoding::EncodeError"]],["impl Freeze for Format",1,["uucore::features::encoding::Format"]],["impl<R> Freeze for Data<R>where
    R: Freeze,
",1,["uucore::features::encoding::Data"]],["impl Freeze for FileInformation",1,["uucore::features::fs::FileInformation"]],["impl Freeze for MissingHandling",1,["uucore::features::fs::MissingHandling"]],["impl Freeze for ResolveMode",1,["uucore::features::fs::ResolveMode"]],["impl Freeze for MountInfo",1,["uucore::features::fsext::MountInfo"]],["impl Freeze for FsUsage",1,["uucore::features::fsext::FsUsage"]],["impl<B> Freeze for Lines<B>where
    B: Freeze,
",1,["uucore::features::lines::Lines"]],["impl Freeze for Memo",1,["uucore::features::memo::Memo"]],["impl<T> Freeze for RingBuffer<T>",1,["uucore::features::ringbuffer::RingBuffer"]],["impl Freeze for Passwd",1,["uucore::features::entries::Passwd"]],["impl Freeze for Group",1,["uucore::features::entries::Group"]],["impl Freeze for VerbosityLevel",1,["uucore::features::perms::VerbosityLevel"]],["impl Freeze for Verbosity",1,["uucore::features::perms::Verbosity"]],["impl Freeze for IfFrom",1,["uucore::features::perms::IfFrom"]],["impl Freeze for TraverseSymlinks",1,["uucore::features::perms::TraverseSymlinks"]],["impl Freeze for ChownExecutor",1,["uucore::features::perms::ChownExecutor"]],["impl Freeze for ExitStatus",1,["uucore::features::process::ExitStatus"]],["impl Freeze for Utmpx",1,["uucore::features::utmpx::Utmpx"]],["impl Freeze for UtmpxIter",1,["uucore::features::utmpx::UtmpxIter"]],["impl Freeze for BackupMode",1,["uucore::mods::backup_control::BackupMode"]],["impl Freeze for BackupError",1,["uucore::mods::backup_control::BackupError"]],["impl Freeze for USimpleError",1,["uucore::mods::error::USimpleError"]],["impl Freeze for UUsageError",1,["uucore::mods::error::UUsageError"]],["impl Freeze for UIoError",1,["uucore::mods::error::UIoError"]],["impl Freeze for ExitCode",1,["uucore::mods::error::ExitCode"]],["impl Freeze for ClapErrorWrapper",1,["uucore::mods::error::ClapErrorWrapper"]],["impl Freeze for Range",1,["uucore::mods::ranges::Range"]],["impl Freeze for QuotingStyle",1,["uucore::mods::quoting_style::QuotingStyle"]],["impl Freeze for Quotes",1,["uucore::mods::quoting_style::Quotes"]],["impl Freeze for ParseSizeError",1,["uucore::parser::parse_size::ParseSizeError"]]], +"uudoc":[["impl<'a, 'b> Freeze for MDWriter<'a, 'b>",1,["uudoc::MDWriter"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/marker/trait.Send.js b/dev/implementors/core/marker/trait.Send.js index 7fa576f2c..484239795 100644 --- a/dev/implementors/core/marker/trait.Send.js +++ b/dev/implementors/core/marker/trait.Send.js @@ -1,21 +1,21 @@ -(function() {var implementors = {}; -implementors["uu_base32"] = [{"text":"impl Send for Config","synthetic":true,"types":["uu_base32::base_common::Config"]}]; -implementors["uu_cp"] = [{"text":"impl Send for Error","synthetic":true,"types":["uu_cp::Error"]},{"text":"impl Send for ClobberMode","synthetic":true,"types":["uu_cp::ClobberMode"]},{"text":"impl Send for OverwriteMode","synthetic":true,"types":["uu_cp::OverwriteMode"]},{"text":"impl Send for ReflinkMode","synthetic":true,"types":["uu_cp::ReflinkMode"]},{"text":"impl Send for SparseMode","synthetic":true,"types":["uu_cp::SparseMode"]},{"text":"impl Send for TargetType","synthetic":true,"types":["uu_cp::TargetType"]},{"text":"impl Send for CopyMode","synthetic":true,"types":["uu_cp::CopyMode"]},{"text":"impl Send for Attribute","synthetic":true,"types":["uu_cp::Attribute"]},{"text":"impl Send for Options","synthetic":true,"types":["uu_cp::Options"]}]; -implementors["uu_csplit"] = [{"text":"impl !Send for CsplitOptions","synthetic":true,"types":["uu_csplit::CsplitOptions"]}]; -implementors["uu_dircolors"] = [{"text":"impl Send for OutputFmt","synthetic":true,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl Send for Factors","synthetic":true,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_fmt"] = [{"text":"impl Send for FmtOptions","synthetic":true,"types":["uu_fmt::FmtOptions"]}]; -implementors["uu_install"] = [{"text":"impl Send for Behavior","synthetic":true,"types":["uu_install::Behavior"]},{"text":"impl Send for MainFunction","synthetic":true,"types":["uu_install::MainFunction"]}]; -implementors["uu_kill"] = [{"text":"impl Send for Mode","synthetic":true,"types":["uu_kill::Mode"]}]; -implementors["uu_ln"] = [{"text":"impl Send for Settings","synthetic":true,"types":["uu_ln::Settings"]},{"text":"impl Send for OverwriteMode","synthetic":true,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl Send for Format","synthetic":true,"types":["uu_ls::Format"]},{"text":"impl Send for Config","synthetic":true,"types":["uu_ls::Config"]}]; -implementors["uu_mv"] = [{"text":"impl Send for Behavior","synthetic":true,"types":["uu_mv::Behavior"]},{"text":"impl Send for OverwriteMode","synthetic":true,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_nl"] = [{"text":"impl Send for Settings","synthetic":true,"types":["uu_nl::Settings"]}]; -implementors["uu_numfmt"] = [{"text":"impl Send for NumfmtError","synthetic":true,"types":["uu_numfmt::errors::NumfmtError"]},{"text":"impl<'a> Send for WhitespaceSplitter<'a>","synthetic":true,"types":["uu_numfmt::format::WhitespaceSplitter"]},{"text":"impl Send for TransformOptions","synthetic":true,"types":["uu_numfmt::options::TransformOptions"]},{"text":"impl Send for NumfmtOptions","synthetic":true,"types":["uu_numfmt::options::NumfmtOptions"]},{"text":"impl Send for RoundMethod","synthetic":true,"types":["uu_numfmt::options::RoundMethod"]},{"text":"impl Send for FormatOptions","synthetic":true,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl Send for Output","synthetic":true,"types":["uu_sort::Output"]},{"text":"impl Send for GlobalSettings","synthetic":true,"types":["uu_sort::GlobalSettings"]},{"text":"impl<'a> Send for Line<'a>","synthetic":true,"types":["uu_sort::Line"]},{"text":"impl Send for GeneralF64ParseResult","synthetic":true,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stat"] = [{"text":"impl Send for OutputType","synthetic":true,"types":["uu_stat::OutputType"]},{"text":"impl Send for Token","synthetic":true,"types":["uu_stat::Token"]},{"text":"impl Send for Stater","synthetic":true,"types":["uu_stat::Stater"]}]; -implementors["uu_stty"] = [{"text":"impl<T> Send for Flag<T> where
    T: Send
","synthetic":true,"types":["uu_stty::Flag"]},{"text":"impl Send for TermSize","synthetic":true,"types":["uu_stty::TermSize"]}]; -implementors["uu_tail"] = [{"text":"impl Send for Signum","synthetic":true,"types":["uu_tail::args::Signum"]},{"text":"impl Send for FilterMode","synthetic":true,"types":["uu_tail::args::FilterMode"]},{"text":"impl Send for FollowMode","synthetic":true,"types":["uu_tail::args::FollowMode"]},{"text":"impl Send for Settings","synthetic":true,"types":["uu_tail::args::Settings"]},{"text":"impl<'a> Send for ReverseChunks<'a>","synthetic":true,"types":["uu_tail::chunks::ReverseChunks"]},{"text":"impl Send for BytesChunk","synthetic":true,"types":["uu_tail::chunks::BytesChunk"]},{"text":"impl Send for BytesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::BytesChunkBuffer"]},{"text":"impl Send for LinesChunk","synthetic":true,"types":["uu_tail::chunks::LinesChunk"]},{"text":"impl Send for LinesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::LinesChunkBuffer"]}]; -implementors["uucore"] = [{"text":"impl Send for DecodeError","synthetic":true,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl Send for EncodeError","synthetic":true,"types":["uucore::features::encoding::EncodeError"]},{"text":"impl Send for Format","synthetic":true,"types":["uucore::features::encoding::Format"]},{"text":"impl<R> Send for Data<R> where
    R: Send
","synthetic":true,"types":["uucore::features::encoding::Data"]},{"text":"impl Send for FileInformation","synthetic":true,"types":["uucore::features::fs::FileInformation"]},{"text":"impl Send for MissingHandling","synthetic":true,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl Send for ResolveMode","synthetic":true,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl Send for MountInfo","synthetic":true,"types":["uucore::features::fsext::MountInfo"]},{"text":"impl Send for FsUsage","synthetic":true,"types":["uucore::features::fsext::FsUsage"]},{"text":"impl<B> Send for Lines<B> where
    B: Send
","synthetic":true,"types":["uucore::features::lines::Lines"]},{"text":"impl !Send for Memo","synthetic":true,"types":["uucore::features::memo::Memo"]},{"text":"impl<T> Send for RingBuffer<T> where
    T: Send
","synthetic":true,"types":["uucore::features::ringbuffer::RingBuffer"]},{"text":"impl Send for Passwd","synthetic":true,"types":["uucore::features::entries::Passwd"]},{"text":"impl Send for Group","synthetic":true,"types":["uucore::features::entries::Group"]},{"text":"impl Send for VerbosityLevel","synthetic":true,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl Send for Verbosity","synthetic":true,"types":["uucore::features::perms::Verbosity"]},{"text":"impl Send for IfFrom","synthetic":true,"types":["uucore::features::perms::IfFrom"]},{"text":"impl Send for TraverseSymlinks","synthetic":true,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl Send for ChownExecutor","synthetic":true,"types":["uucore::features::perms::ChownExecutor"]},{"text":"impl Send for ExitStatus","synthetic":true,"types":["uucore::features::process::ExitStatus"]},{"text":"impl Send for Utmpx","synthetic":true,"types":["uucore::features::utmpx::Utmpx"]},{"text":"impl !Send for UtmpxIter","synthetic":true,"types":["uucore::features::utmpx::UtmpxIter"]},{"text":"impl Send for BackupMode","synthetic":true,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl Send for BackupError","synthetic":true,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl Send for USimpleError","synthetic":true,"types":["uucore::mods::error::USimpleError"]},{"text":"impl Send for UUsageError","synthetic":true,"types":["uucore::mods::error::UUsageError"]},{"text":"impl Send for UIoError","synthetic":true,"types":["uucore::mods::error::UIoError"]},{"text":"impl Send for ExitCode","synthetic":true,"types":["uucore::mods::error::ExitCode"]},{"text":"impl Send for ClapErrorWrapper","synthetic":true,"types":["uucore::mods::error::ClapErrorWrapper"]},{"text":"impl Send for Range","synthetic":true,"types":["uucore::mods::ranges::Range"]},{"text":"impl Send for QuotingStyle","synthetic":true,"types":["uucore::mods::quoting_style::QuotingStyle"]},{"text":"impl Send for Quotes","synthetic":true,"types":["uucore::mods::quoting_style::Quotes"]},{"text":"impl Send for ParseSizeError","synthetic":true,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -implementors["uudoc"] = [{"text":"impl<'a, 'b> !Send for MDWriter<'a, 'b>","synthetic":true,"types":["uudoc::MDWriter"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_base32":[["impl Send for Config",1,["uu_base32::base_common::Config"]]], +"uu_cp":[["impl Send for Error",1,["uu_cp::Error"]],["impl Send for ClobberMode",1,["uu_cp::ClobberMode"]],["impl Send for OverwriteMode",1,["uu_cp::OverwriteMode"]],["impl Send for ReflinkMode",1,["uu_cp::ReflinkMode"]],["impl Send for SparseMode",1,["uu_cp::SparseMode"]],["impl Send for TargetType",1,["uu_cp::TargetType"]],["impl Send for CopyMode",1,["uu_cp::CopyMode"]],["impl Send for Attribute",1,["uu_cp::Attribute"]],["impl Send for Options",1,["uu_cp::Options"]]], +"uu_csplit":[["impl !Send for CsplitOptions",1,["uu_csplit::CsplitOptions"]]], +"uu_dircolors":[["impl Send for OutputFmt",1,["uu_dircolors::OutputFmt"]]], +"uu_factor":[["impl Send for Factors",1,["uu_factor::factor::Factors"]]], +"uu_fmt":[["impl Send for FmtOptions",1,["uu_fmt::FmtOptions"]]], +"uu_install":[["impl Send for Behavior",1,["uu_install::Behavior"]],["impl Send for MainFunction",1,["uu_install::MainFunction"]]], +"uu_kill":[["impl Send for Mode",1,["uu_kill::Mode"]]], +"uu_ln":[["impl Send for Settings",1,["uu_ln::Settings"]],["impl Send for OverwriteMode",1,["uu_ln::OverwriteMode"]]], +"uu_ls":[["impl Send for Format",1,["uu_ls::Format"]],["impl Send for Config",1,["uu_ls::Config"]]], +"uu_mv":[["impl Send for Behavior",1,["uu_mv::Behavior"]],["impl Send for OverwriteMode",1,["uu_mv::OverwriteMode"]]], +"uu_nl":[["impl Send for Settings",1,["uu_nl::Settings"]]], +"uu_numfmt":[["impl Send for NumfmtError",1,["uu_numfmt::errors::NumfmtError"]],["impl<'a> Send for WhitespaceSplitter<'a>",1,["uu_numfmt::format::WhitespaceSplitter"]],["impl Send for TransformOptions",1,["uu_numfmt::options::TransformOptions"]],["impl Send for NumfmtOptions",1,["uu_numfmt::options::NumfmtOptions"]],["impl Send for RoundMethod",1,["uu_numfmt::options::RoundMethod"]],["impl Send for FormatOptions",1,["uu_numfmt::options::FormatOptions"]]], +"uu_sort":[["impl Send for Output",1,["uu_sort::Output"]],["impl Send for GlobalSettings",1,["uu_sort::GlobalSettings"]],["impl<'a> Send for Line<'a>",1,["uu_sort::Line"]],["impl Send for GeneralF64ParseResult",1,["uu_sort::GeneralF64ParseResult"]]], +"uu_stat":[["impl Send for OutputType",1,["uu_stat::OutputType"]],["impl Send for Token",1,["uu_stat::Token"]],["impl Send for Stater",1,["uu_stat::Stater"]]], +"uu_stty":[["impl<T> Send for Flag<T>where
    T: Send,
",1,["uu_stty::Flag"]],["impl Send for TermSize",1,["uu_stty::TermSize"]]], +"uu_tail":[["impl Send for Signum",1,["uu_tail::args::Signum"]],["impl Send for FilterMode",1,["uu_tail::args::FilterMode"]],["impl Send for FollowMode",1,["uu_tail::args::FollowMode"]],["impl Send for Settings",1,["uu_tail::args::Settings"]],["impl<'a> Send for ReverseChunks<'a>",1,["uu_tail::chunks::ReverseChunks"]],["impl Send for BytesChunk",1,["uu_tail::chunks::BytesChunk"]],["impl Send for BytesChunkBuffer",1,["uu_tail::chunks::BytesChunkBuffer"]],["impl Send for LinesChunk",1,["uu_tail::chunks::LinesChunk"]],["impl Send for LinesChunkBuffer",1,["uu_tail::chunks::LinesChunkBuffer"]]], +"uucore":[["impl Send for DecodeError",1,["uucore::features::encoding::DecodeError"]],["impl Send for EncodeError",1,["uucore::features::encoding::EncodeError"]],["impl Send for Format",1,["uucore::features::encoding::Format"]],["impl<R> Send for Data<R>where
    R: Send,
",1,["uucore::features::encoding::Data"]],["impl Send for FileInformation",1,["uucore::features::fs::FileInformation"]],["impl Send for MissingHandling",1,["uucore::features::fs::MissingHandling"]],["impl Send for ResolveMode",1,["uucore::features::fs::ResolveMode"]],["impl Send for MountInfo",1,["uucore::features::fsext::MountInfo"]],["impl Send for FsUsage",1,["uucore::features::fsext::FsUsage"]],["impl<B> Send for Lines<B>where
    B: Send,
",1,["uucore::features::lines::Lines"]],["impl !Send for Memo",1,["uucore::features::memo::Memo"]],["impl<T> Send for RingBuffer<T>where
    T: Send,
",1,["uucore::features::ringbuffer::RingBuffer"]],["impl Send for Passwd",1,["uucore::features::entries::Passwd"]],["impl Send for Group",1,["uucore::features::entries::Group"]],["impl Send for VerbosityLevel",1,["uucore::features::perms::VerbosityLevel"]],["impl Send for Verbosity",1,["uucore::features::perms::Verbosity"]],["impl Send for IfFrom",1,["uucore::features::perms::IfFrom"]],["impl Send for TraverseSymlinks",1,["uucore::features::perms::TraverseSymlinks"]],["impl Send for ChownExecutor",1,["uucore::features::perms::ChownExecutor"]],["impl Send for ExitStatus",1,["uucore::features::process::ExitStatus"]],["impl Send for Utmpx",1,["uucore::features::utmpx::Utmpx"]],["impl !Send for UtmpxIter",1,["uucore::features::utmpx::UtmpxIter"]],["impl Send for BackupMode",1,["uucore::mods::backup_control::BackupMode"]],["impl Send for BackupError",1,["uucore::mods::backup_control::BackupError"]],["impl Send for USimpleError",1,["uucore::mods::error::USimpleError"]],["impl Send for UUsageError",1,["uucore::mods::error::UUsageError"]],["impl Send for UIoError",1,["uucore::mods::error::UIoError"]],["impl Send for ExitCode",1,["uucore::mods::error::ExitCode"]],["impl Send for ClapErrorWrapper",1,["uucore::mods::error::ClapErrorWrapper"]],["impl Send for Range",1,["uucore::mods::ranges::Range"]],["impl Send for QuotingStyle",1,["uucore::mods::quoting_style::QuotingStyle"]],["impl Send for Quotes",1,["uucore::mods::quoting_style::Quotes"]],["impl Send for ParseSizeError",1,["uucore::parser::parse_size::ParseSizeError"]]], +"uudoc":[["impl<'a, 'b> !Send for MDWriter<'a, 'b>",1,["uudoc::MDWriter"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/marker/trait.StructuralEq.js b/dev/implementors/core/marker/trait.StructuralEq.js index 5e00508c1..fe3b22ef6 100644 --- a/dev/implementors/core/marker/trait.StructuralEq.js +++ b/dev/implementors/core/marker/trait.StructuralEq.js @@ -1,13 +1,13 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl StructuralEq for ClobberMode","synthetic":false,"types":["uu_cp::ClobberMode"]},{"text":"impl StructuralEq for OverwriteMode","synthetic":false,"types":["uu_cp::OverwriteMode"]},{"text":"impl StructuralEq for ReflinkMode","synthetic":false,"types":["uu_cp::ReflinkMode"]},{"text":"impl StructuralEq for SparseMode","synthetic":false,"types":["uu_cp::SparseMode"]},{"text":"impl StructuralEq for Attribute","synthetic":false,"types":["uu_cp::Attribute"]}]; -implementors["uu_dircolors"] = [{"text":"impl StructuralEq for OutputFmt","synthetic":false,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl StructuralEq for Factors","synthetic":false,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_install"] = [{"text":"impl StructuralEq for MainFunction","synthetic":false,"types":["uu_install::MainFunction"]}]; -implementors["uu_ln"] = [{"text":"impl StructuralEq for OverwriteMode","synthetic":false,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl StructuralEq for Format","synthetic":false,"types":["uu_ls::Format"]}]; -implementors["uu_mv"] = [{"text":"impl StructuralEq for OverwriteMode","synthetic":false,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_numfmt"] = [{"text":"impl StructuralEq for FormatOptions","synthetic":false,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_stat"] = [{"text":"impl StructuralEq for OutputType","synthetic":false,"types":["uu_stat::OutputType"]},{"text":"impl StructuralEq for Token","synthetic":false,"types":["uu_stat::Token"]}]; -implementors["uu_tail"] = [{"text":"impl StructuralEq for Signum","synthetic":false,"types":["uu_tail::args::Signum"]},{"text":"impl StructuralEq for FilterMode","synthetic":false,"types":["uu_tail::args::FilterMode"]},{"text":"impl StructuralEq for FollowMode","synthetic":false,"types":["uu_tail::args::FollowMode"]},{"text":"impl StructuralEq for BytesChunk","synthetic":false,"types":["uu_tail::chunks::BytesChunk"]}]; -implementors["uucore"] = [{"text":"impl StructuralEq for MissingHandling","synthetic":false,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl StructuralEq for ResolveMode","synthetic":false,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl StructuralEq for VerbosityLevel","synthetic":false,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl StructuralEq for Verbosity","synthetic":false,"types":["uucore::features::perms::Verbosity"]},{"text":"impl StructuralEq for TraverseSymlinks","synthetic":false,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl StructuralEq for ExitStatus","synthetic":false,"types":["uucore::features::process::ExitStatus"]},{"text":"impl StructuralEq for BackupMode","synthetic":false,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl StructuralEq for BackupError","synthetic":false,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl StructuralEq for Range","synthetic":false,"types":["uucore::mods::ranges::Range"]},{"text":"impl StructuralEq for ParseSizeError","synthetic":false,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl StructuralEq for ClobberMode"],["impl StructuralEq for OverwriteMode"],["impl StructuralEq for ReflinkMode"],["impl StructuralEq for SparseMode"],["impl StructuralEq for Attribute"]], +"uu_dircolors":[["impl StructuralEq for OutputFmt"]], +"uu_factor":[["impl StructuralEq for Factors"]], +"uu_install":[["impl StructuralEq for MainFunction"]], +"uu_ln":[["impl StructuralEq for OverwriteMode"]], +"uu_ls":[["impl StructuralEq for Format"]], +"uu_mv":[["impl StructuralEq for OverwriteMode"]], +"uu_numfmt":[["impl StructuralEq for FormatOptions"]], +"uu_stat":[["impl StructuralEq for OutputType"],["impl StructuralEq for Token"]], +"uu_tail":[["impl StructuralEq for Signum"],["impl StructuralEq for FilterMode"],["impl StructuralEq for FollowMode"],["impl StructuralEq for BytesChunk"]], +"uucore":[["impl StructuralEq for MissingHandling"],["impl StructuralEq for ResolveMode"],["impl StructuralEq for VerbosityLevel"],["impl StructuralEq for Verbosity"],["impl StructuralEq for TraverseSymlinks"],["impl StructuralEq for ExitStatus"],["impl StructuralEq for BackupMode"],["impl StructuralEq for BackupError"],["impl StructuralEq for Range"],["impl StructuralEq for ParseSizeError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/marker/trait.StructuralPartialEq.js b/dev/implementors/core/marker/trait.StructuralPartialEq.js index 1bb648500..48126af62 100644 --- a/dev/implementors/core/marker/trait.StructuralPartialEq.js +++ b/dev/implementors/core/marker/trait.StructuralPartialEq.js @@ -1,14 +1,14 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl StructuralPartialEq for ClobberMode","synthetic":false,"types":["uu_cp::ClobberMode"]},{"text":"impl StructuralPartialEq for OverwriteMode","synthetic":false,"types":["uu_cp::OverwriteMode"]},{"text":"impl StructuralPartialEq for ReflinkMode","synthetic":false,"types":["uu_cp::ReflinkMode"]},{"text":"impl StructuralPartialEq for SparseMode","synthetic":false,"types":["uu_cp::SparseMode"]},{"text":"impl StructuralPartialEq for Attribute","synthetic":false,"types":["uu_cp::Attribute"]}]; -implementors["uu_dircolors"] = [{"text":"impl StructuralPartialEq for OutputFmt","synthetic":false,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl StructuralPartialEq for Factors","synthetic":false,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_install"] = [{"text":"impl StructuralPartialEq for MainFunction","synthetic":false,"types":["uu_install::MainFunction"]}]; -implementors["uu_ln"] = [{"text":"impl StructuralPartialEq for OverwriteMode","synthetic":false,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl StructuralPartialEq for Format","synthetic":false,"types":["uu_ls::Format"]}]; -implementors["uu_mv"] = [{"text":"impl StructuralPartialEq for OverwriteMode","synthetic":false,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_numfmt"] = [{"text":"impl StructuralPartialEq for FormatOptions","synthetic":false,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl StructuralPartialEq for GeneralF64ParseResult","synthetic":false,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stat"] = [{"text":"impl StructuralPartialEq for OutputType","synthetic":false,"types":["uu_stat::OutputType"]},{"text":"impl StructuralPartialEq for Token","synthetic":false,"types":["uu_stat::Token"]}]; -implementors["uu_tail"] = [{"text":"impl StructuralPartialEq for Signum","synthetic":false,"types":["uu_tail::args::Signum"]},{"text":"impl StructuralPartialEq for FilterMode","synthetic":false,"types":["uu_tail::args::FilterMode"]},{"text":"impl StructuralPartialEq for FollowMode","synthetic":false,"types":["uu_tail::args::FollowMode"]},{"text":"impl StructuralPartialEq for BytesChunk","synthetic":false,"types":["uu_tail::chunks::BytesChunk"]}]; -implementors["uucore"] = [{"text":"impl StructuralPartialEq for MissingHandling","synthetic":false,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl StructuralPartialEq for ResolveMode","synthetic":false,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl StructuralPartialEq for VerbosityLevel","synthetic":false,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl StructuralPartialEq for Verbosity","synthetic":false,"types":["uucore::features::perms::Verbosity"]},{"text":"impl StructuralPartialEq for TraverseSymlinks","synthetic":false,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl StructuralPartialEq for ExitStatus","synthetic":false,"types":["uucore::features::process::ExitStatus"]},{"text":"impl StructuralPartialEq for BackupMode","synthetic":false,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl StructuralPartialEq for BackupError","synthetic":false,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl StructuralPartialEq for Range","synthetic":false,"types":["uucore::mods::ranges::Range"]},{"text":"impl StructuralPartialEq for ParseSizeError","synthetic":false,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl StructuralPartialEq for ClobberMode"],["impl StructuralPartialEq for OverwriteMode"],["impl StructuralPartialEq for ReflinkMode"],["impl StructuralPartialEq for SparseMode"],["impl StructuralPartialEq for Attribute"]], +"uu_dircolors":[["impl StructuralPartialEq for OutputFmt"]], +"uu_factor":[["impl StructuralPartialEq for Factors"]], +"uu_install":[["impl StructuralPartialEq for MainFunction"]], +"uu_ln":[["impl StructuralPartialEq for OverwriteMode"]], +"uu_ls":[["impl StructuralPartialEq for Format"]], +"uu_mv":[["impl StructuralPartialEq for OverwriteMode"]], +"uu_numfmt":[["impl StructuralPartialEq for FormatOptions"]], +"uu_sort":[["impl StructuralPartialEq for GeneralF64ParseResult"]], +"uu_stat":[["impl StructuralPartialEq for OutputType"],["impl StructuralPartialEq for Token"]], +"uu_tail":[["impl StructuralPartialEq for Signum"],["impl StructuralPartialEq for FilterMode"],["impl StructuralPartialEq for FollowMode"],["impl StructuralPartialEq for BytesChunk"]], +"uucore":[["impl StructuralPartialEq for MissingHandling"],["impl StructuralPartialEq for ResolveMode"],["impl StructuralPartialEq for VerbosityLevel"],["impl StructuralPartialEq for Verbosity"],["impl StructuralPartialEq for TraverseSymlinks"],["impl StructuralPartialEq for ExitStatus"],["impl StructuralPartialEq for BackupMode"],["impl StructuralPartialEq for BackupError"],["impl StructuralPartialEq for Range"],["impl StructuralPartialEq for ParseSizeError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/marker/trait.Sync.js b/dev/implementors/core/marker/trait.Sync.js index 4428c65b9..f3af5fa73 100644 --- a/dev/implementors/core/marker/trait.Sync.js +++ b/dev/implementors/core/marker/trait.Sync.js @@ -1,21 +1,21 @@ -(function() {var implementors = {}; -implementors["uu_base32"] = [{"text":"impl Sync for Config","synthetic":true,"types":["uu_base32::base_common::Config"]}]; -implementors["uu_cp"] = [{"text":"impl Sync for Error","synthetic":true,"types":["uu_cp::Error"]},{"text":"impl Sync for ClobberMode","synthetic":true,"types":["uu_cp::ClobberMode"]},{"text":"impl Sync for OverwriteMode","synthetic":true,"types":["uu_cp::OverwriteMode"]},{"text":"impl Sync for ReflinkMode","synthetic":true,"types":["uu_cp::ReflinkMode"]},{"text":"impl Sync for SparseMode","synthetic":true,"types":["uu_cp::SparseMode"]},{"text":"impl Sync for TargetType","synthetic":true,"types":["uu_cp::TargetType"]},{"text":"impl Sync for CopyMode","synthetic":true,"types":["uu_cp::CopyMode"]},{"text":"impl Sync for Attribute","synthetic":true,"types":["uu_cp::Attribute"]},{"text":"impl Sync for Options","synthetic":true,"types":["uu_cp::Options"]}]; -implementors["uu_csplit"] = [{"text":"impl !Sync for CsplitOptions","synthetic":true,"types":["uu_csplit::CsplitOptions"]}]; -implementors["uu_dircolors"] = [{"text":"impl Sync for OutputFmt","synthetic":true,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl !Sync for Factors","synthetic":true,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_fmt"] = [{"text":"impl Sync for FmtOptions","synthetic":true,"types":["uu_fmt::FmtOptions"]}]; -implementors["uu_install"] = [{"text":"impl Sync for Behavior","synthetic":true,"types":["uu_install::Behavior"]},{"text":"impl Sync for MainFunction","synthetic":true,"types":["uu_install::MainFunction"]}]; -implementors["uu_kill"] = [{"text":"impl Sync for Mode","synthetic":true,"types":["uu_kill::Mode"]}]; -implementors["uu_ln"] = [{"text":"impl Sync for Settings","synthetic":true,"types":["uu_ln::Settings"]},{"text":"impl Sync for OverwriteMode","synthetic":true,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl Sync for Format","synthetic":true,"types":["uu_ls::Format"]},{"text":"impl Sync for Config","synthetic":true,"types":["uu_ls::Config"]}]; -implementors["uu_mv"] = [{"text":"impl Sync for Behavior","synthetic":true,"types":["uu_mv::Behavior"]},{"text":"impl Sync for OverwriteMode","synthetic":true,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_nl"] = [{"text":"impl Sync for Settings","synthetic":true,"types":["uu_nl::Settings"]}]; -implementors["uu_numfmt"] = [{"text":"impl Sync for NumfmtError","synthetic":true,"types":["uu_numfmt::errors::NumfmtError"]},{"text":"impl<'a> Sync for WhitespaceSplitter<'a>","synthetic":true,"types":["uu_numfmt::format::WhitespaceSplitter"]},{"text":"impl Sync for TransformOptions","synthetic":true,"types":["uu_numfmt::options::TransformOptions"]},{"text":"impl Sync for NumfmtOptions","synthetic":true,"types":["uu_numfmt::options::NumfmtOptions"]},{"text":"impl Sync for RoundMethod","synthetic":true,"types":["uu_numfmt::options::RoundMethod"]},{"text":"impl Sync for FormatOptions","synthetic":true,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl Sync for Output","synthetic":true,"types":["uu_sort::Output"]},{"text":"impl Sync for GlobalSettings","synthetic":true,"types":["uu_sort::GlobalSettings"]},{"text":"impl<'a> Sync for Line<'a>","synthetic":true,"types":["uu_sort::Line"]},{"text":"impl Sync for GeneralF64ParseResult","synthetic":true,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stat"] = [{"text":"impl Sync for OutputType","synthetic":true,"types":["uu_stat::OutputType"]},{"text":"impl Sync for Token","synthetic":true,"types":["uu_stat::Token"]},{"text":"impl Sync for Stater","synthetic":true,"types":["uu_stat::Stater"]}]; -implementors["uu_stty"] = [{"text":"impl<T> Sync for Flag<T> where
    T: Sync
","synthetic":true,"types":["uu_stty::Flag"]},{"text":"impl Sync for TermSize","synthetic":true,"types":["uu_stty::TermSize"]}]; -implementors["uu_tail"] = [{"text":"impl Sync for Signum","synthetic":true,"types":["uu_tail::args::Signum"]},{"text":"impl Sync for FilterMode","synthetic":true,"types":["uu_tail::args::FilterMode"]},{"text":"impl Sync for FollowMode","synthetic":true,"types":["uu_tail::args::FollowMode"]},{"text":"impl Sync for Settings","synthetic":true,"types":["uu_tail::args::Settings"]},{"text":"impl<'a> Sync for ReverseChunks<'a>","synthetic":true,"types":["uu_tail::chunks::ReverseChunks"]},{"text":"impl Sync for BytesChunk","synthetic":true,"types":["uu_tail::chunks::BytesChunk"]},{"text":"impl Sync for BytesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::BytesChunkBuffer"]},{"text":"impl Sync for LinesChunk","synthetic":true,"types":["uu_tail::chunks::LinesChunk"]},{"text":"impl Sync for LinesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::LinesChunkBuffer"]}]; -implementors["uucore"] = [{"text":"impl Sync for DecodeError","synthetic":true,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl Sync for EncodeError","synthetic":true,"types":["uucore::features::encoding::EncodeError"]},{"text":"impl Sync for Format","synthetic":true,"types":["uucore::features::encoding::Format"]},{"text":"impl<R> Sync for Data<R> where
    R: Sync
","synthetic":true,"types":["uucore::features::encoding::Data"]},{"text":"impl Sync for FileInformation","synthetic":true,"types":["uucore::features::fs::FileInformation"]},{"text":"impl Sync for MissingHandling","synthetic":true,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl Sync for ResolveMode","synthetic":true,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl Sync for MountInfo","synthetic":true,"types":["uucore::features::fsext::MountInfo"]},{"text":"impl Sync for FsUsage","synthetic":true,"types":["uucore::features::fsext::FsUsage"]},{"text":"impl<B> Sync for Lines<B> where
    B: Sync
","synthetic":true,"types":["uucore::features::lines::Lines"]},{"text":"impl !Sync for Memo","synthetic":true,"types":["uucore::features::memo::Memo"]},{"text":"impl<T> Sync for RingBuffer<T> where
    T: Sync
","synthetic":true,"types":["uucore::features::ringbuffer::RingBuffer"]},{"text":"impl Sync for Passwd","synthetic":true,"types":["uucore::features::entries::Passwd"]},{"text":"impl Sync for Group","synthetic":true,"types":["uucore::features::entries::Group"]},{"text":"impl Sync for VerbosityLevel","synthetic":true,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl Sync for Verbosity","synthetic":true,"types":["uucore::features::perms::Verbosity"]},{"text":"impl Sync for IfFrom","synthetic":true,"types":["uucore::features::perms::IfFrom"]},{"text":"impl Sync for TraverseSymlinks","synthetic":true,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl Sync for ChownExecutor","synthetic":true,"types":["uucore::features::perms::ChownExecutor"]},{"text":"impl Sync for ExitStatus","synthetic":true,"types":["uucore::features::process::ExitStatus"]},{"text":"impl Sync for Utmpx","synthetic":true,"types":["uucore::features::utmpx::Utmpx"]},{"text":"impl !Sync for UtmpxIter","synthetic":true,"types":["uucore::features::utmpx::UtmpxIter"]},{"text":"impl Sync for BackupMode","synthetic":true,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl Sync for BackupError","synthetic":true,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl Sync for USimpleError","synthetic":true,"types":["uucore::mods::error::USimpleError"]},{"text":"impl Sync for UUsageError","synthetic":true,"types":["uucore::mods::error::UUsageError"]},{"text":"impl Sync for UIoError","synthetic":true,"types":["uucore::mods::error::UIoError"]},{"text":"impl Sync for ExitCode","synthetic":true,"types":["uucore::mods::error::ExitCode"]},{"text":"impl Sync for ClapErrorWrapper","synthetic":true,"types":["uucore::mods::error::ClapErrorWrapper"]},{"text":"impl Sync for Range","synthetic":true,"types":["uucore::mods::ranges::Range"]},{"text":"impl Sync for QuotingStyle","synthetic":true,"types":["uucore::mods::quoting_style::QuotingStyle"]},{"text":"impl Sync for Quotes","synthetic":true,"types":["uucore::mods::quoting_style::Quotes"]},{"text":"impl Sync for ParseSizeError","synthetic":true,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -implementors["uudoc"] = [{"text":"impl<'a, 'b> !Sync for MDWriter<'a, 'b>","synthetic":true,"types":["uudoc::MDWriter"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_base32":[["impl Sync for Config",1,["uu_base32::base_common::Config"]]], +"uu_cp":[["impl Sync for Error",1,["uu_cp::Error"]],["impl Sync for ClobberMode",1,["uu_cp::ClobberMode"]],["impl Sync for OverwriteMode",1,["uu_cp::OverwriteMode"]],["impl Sync for ReflinkMode",1,["uu_cp::ReflinkMode"]],["impl Sync for SparseMode",1,["uu_cp::SparseMode"]],["impl Sync for TargetType",1,["uu_cp::TargetType"]],["impl Sync for CopyMode",1,["uu_cp::CopyMode"]],["impl Sync for Attribute",1,["uu_cp::Attribute"]],["impl Sync for Options",1,["uu_cp::Options"]]], +"uu_csplit":[["impl !Sync for CsplitOptions",1,["uu_csplit::CsplitOptions"]]], +"uu_dircolors":[["impl Sync for OutputFmt",1,["uu_dircolors::OutputFmt"]]], +"uu_factor":[["impl !Sync for Factors",1,["uu_factor::factor::Factors"]]], +"uu_fmt":[["impl Sync for FmtOptions",1,["uu_fmt::FmtOptions"]]], +"uu_install":[["impl Sync for Behavior",1,["uu_install::Behavior"]],["impl Sync for MainFunction",1,["uu_install::MainFunction"]]], +"uu_kill":[["impl Sync for Mode",1,["uu_kill::Mode"]]], +"uu_ln":[["impl Sync for Settings",1,["uu_ln::Settings"]],["impl Sync for OverwriteMode",1,["uu_ln::OverwriteMode"]]], +"uu_ls":[["impl Sync for Format",1,["uu_ls::Format"]],["impl Sync for Config",1,["uu_ls::Config"]]], +"uu_mv":[["impl Sync for Behavior",1,["uu_mv::Behavior"]],["impl Sync for OverwriteMode",1,["uu_mv::OverwriteMode"]]], +"uu_nl":[["impl Sync for Settings",1,["uu_nl::Settings"]]], +"uu_numfmt":[["impl Sync for NumfmtError",1,["uu_numfmt::errors::NumfmtError"]],["impl<'a> Sync for WhitespaceSplitter<'a>",1,["uu_numfmt::format::WhitespaceSplitter"]],["impl Sync for TransformOptions",1,["uu_numfmt::options::TransformOptions"]],["impl Sync for NumfmtOptions",1,["uu_numfmt::options::NumfmtOptions"]],["impl Sync for RoundMethod",1,["uu_numfmt::options::RoundMethod"]],["impl Sync for FormatOptions",1,["uu_numfmt::options::FormatOptions"]]], +"uu_sort":[["impl Sync for Output",1,["uu_sort::Output"]],["impl Sync for GlobalSettings",1,["uu_sort::GlobalSettings"]],["impl<'a> Sync for Line<'a>",1,["uu_sort::Line"]],["impl Sync for GeneralF64ParseResult",1,["uu_sort::GeneralF64ParseResult"]]], +"uu_stat":[["impl Sync for OutputType",1,["uu_stat::OutputType"]],["impl Sync for Token",1,["uu_stat::Token"]],["impl Sync for Stater",1,["uu_stat::Stater"]]], +"uu_stty":[["impl<T> Sync for Flag<T>where
    T: Sync,
",1,["uu_stty::Flag"]],["impl Sync for TermSize",1,["uu_stty::TermSize"]]], +"uu_tail":[["impl Sync for Signum",1,["uu_tail::args::Signum"]],["impl Sync for FilterMode",1,["uu_tail::args::FilterMode"]],["impl Sync for FollowMode",1,["uu_tail::args::FollowMode"]],["impl Sync for Settings",1,["uu_tail::args::Settings"]],["impl<'a> Sync for ReverseChunks<'a>",1,["uu_tail::chunks::ReverseChunks"]],["impl Sync for BytesChunk",1,["uu_tail::chunks::BytesChunk"]],["impl Sync for BytesChunkBuffer",1,["uu_tail::chunks::BytesChunkBuffer"]],["impl Sync for LinesChunk",1,["uu_tail::chunks::LinesChunk"]],["impl Sync for LinesChunkBuffer",1,["uu_tail::chunks::LinesChunkBuffer"]]], +"uucore":[["impl Sync for DecodeError",1,["uucore::features::encoding::DecodeError"]],["impl Sync for EncodeError",1,["uucore::features::encoding::EncodeError"]],["impl Sync for Format",1,["uucore::features::encoding::Format"]],["impl<R> Sync for Data<R>where
    R: Sync,
",1,["uucore::features::encoding::Data"]],["impl Sync for FileInformation",1,["uucore::features::fs::FileInformation"]],["impl Sync for MissingHandling",1,["uucore::features::fs::MissingHandling"]],["impl Sync for ResolveMode",1,["uucore::features::fs::ResolveMode"]],["impl Sync for MountInfo",1,["uucore::features::fsext::MountInfo"]],["impl Sync for FsUsage",1,["uucore::features::fsext::FsUsage"]],["impl<B> Sync for Lines<B>where
    B: Sync,
",1,["uucore::features::lines::Lines"]],["impl !Sync for Memo",1,["uucore::features::memo::Memo"]],["impl<T> Sync for RingBuffer<T>where
    T: Sync,
",1,["uucore::features::ringbuffer::RingBuffer"]],["impl Sync for Passwd",1,["uucore::features::entries::Passwd"]],["impl Sync for Group",1,["uucore::features::entries::Group"]],["impl Sync for VerbosityLevel",1,["uucore::features::perms::VerbosityLevel"]],["impl Sync for Verbosity",1,["uucore::features::perms::Verbosity"]],["impl Sync for IfFrom",1,["uucore::features::perms::IfFrom"]],["impl Sync for TraverseSymlinks",1,["uucore::features::perms::TraverseSymlinks"]],["impl Sync for ChownExecutor",1,["uucore::features::perms::ChownExecutor"]],["impl Sync for ExitStatus",1,["uucore::features::process::ExitStatus"]],["impl Sync for Utmpx",1,["uucore::features::utmpx::Utmpx"]],["impl !Sync for UtmpxIter",1,["uucore::features::utmpx::UtmpxIter"]],["impl Sync for BackupMode",1,["uucore::mods::backup_control::BackupMode"]],["impl Sync for BackupError",1,["uucore::mods::backup_control::BackupError"]],["impl Sync for USimpleError",1,["uucore::mods::error::USimpleError"]],["impl Sync for UUsageError",1,["uucore::mods::error::UUsageError"]],["impl Sync for UIoError",1,["uucore::mods::error::UIoError"]],["impl Sync for ExitCode",1,["uucore::mods::error::ExitCode"]],["impl Sync for ClapErrorWrapper",1,["uucore::mods::error::ClapErrorWrapper"]],["impl Sync for Range",1,["uucore::mods::ranges::Range"]],["impl Sync for QuotingStyle",1,["uucore::mods::quoting_style::QuotingStyle"]],["impl Sync for Quotes",1,["uucore::mods::quoting_style::Quotes"]],["impl Sync for ParseSizeError",1,["uucore::parser::parse_size::ParseSizeError"]]], +"uudoc":[["impl<'a, 'b> !Sync for MDWriter<'a, 'b>",1,["uudoc::MDWriter"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/marker/trait.Unpin.js b/dev/implementors/core/marker/trait.Unpin.js index 23605f5ef..0a8d7178b 100644 --- a/dev/implementors/core/marker/trait.Unpin.js +++ b/dev/implementors/core/marker/trait.Unpin.js @@ -1,21 +1,21 @@ -(function() {var implementors = {}; -implementors["uu_base32"] = [{"text":"impl Unpin for Config","synthetic":true,"types":["uu_base32::base_common::Config"]}]; -implementors["uu_cp"] = [{"text":"impl Unpin for Error","synthetic":true,"types":["uu_cp::Error"]},{"text":"impl Unpin for ClobberMode","synthetic":true,"types":["uu_cp::ClobberMode"]},{"text":"impl Unpin for OverwriteMode","synthetic":true,"types":["uu_cp::OverwriteMode"]},{"text":"impl Unpin for ReflinkMode","synthetic":true,"types":["uu_cp::ReflinkMode"]},{"text":"impl Unpin for SparseMode","synthetic":true,"types":["uu_cp::SparseMode"]},{"text":"impl Unpin for TargetType","synthetic":true,"types":["uu_cp::TargetType"]},{"text":"impl Unpin for CopyMode","synthetic":true,"types":["uu_cp::CopyMode"]},{"text":"impl Unpin for Attribute","synthetic":true,"types":["uu_cp::Attribute"]},{"text":"impl Unpin for Options","synthetic":true,"types":["uu_cp::Options"]}]; -implementors["uu_csplit"] = [{"text":"impl Unpin for CsplitOptions","synthetic":true,"types":["uu_csplit::CsplitOptions"]}]; -implementors["uu_dircolors"] = [{"text":"impl Unpin for OutputFmt","synthetic":true,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl Unpin for Factors","synthetic":true,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_fmt"] = [{"text":"impl Unpin for FmtOptions","synthetic":true,"types":["uu_fmt::FmtOptions"]}]; -implementors["uu_install"] = [{"text":"impl Unpin for Behavior","synthetic":true,"types":["uu_install::Behavior"]},{"text":"impl Unpin for MainFunction","synthetic":true,"types":["uu_install::MainFunction"]}]; -implementors["uu_kill"] = [{"text":"impl Unpin for Mode","synthetic":true,"types":["uu_kill::Mode"]}]; -implementors["uu_ln"] = [{"text":"impl Unpin for Settings","synthetic":true,"types":["uu_ln::Settings"]},{"text":"impl Unpin for OverwriteMode","synthetic":true,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl Unpin for Format","synthetic":true,"types":["uu_ls::Format"]},{"text":"impl Unpin for Config","synthetic":true,"types":["uu_ls::Config"]}]; -implementors["uu_mv"] = [{"text":"impl Unpin for Behavior","synthetic":true,"types":["uu_mv::Behavior"]},{"text":"impl Unpin for OverwriteMode","synthetic":true,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_nl"] = [{"text":"impl Unpin for Settings","synthetic":true,"types":["uu_nl::Settings"]}]; -implementors["uu_numfmt"] = [{"text":"impl Unpin for NumfmtError","synthetic":true,"types":["uu_numfmt::errors::NumfmtError"]},{"text":"impl<'a> Unpin for WhitespaceSplitter<'a>","synthetic":true,"types":["uu_numfmt::format::WhitespaceSplitter"]},{"text":"impl Unpin for TransformOptions","synthetic":true,"types":["uu_numfmt::options::TransformOptions"]},{"text":"impl Unpin for NumfmtOptions","synthetic":true,"types":["uu_numfmt::options::NumfmtOptions"]},{"text":"impl Unpin for RoundMethod","synthetic":true,"types":["uu_numfmt::options::RoundMethod"]},{"text":"impl Unpin for FormatOptions","synthetic":true,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl Unpin for Output","synthetic":true,"types":["uu_sort::Output"]},{"text":"impl Unpin for GlobalSettings","synthetic":true,"types":["uu_sort::GlobalSettings"]},{"text":"impl<'a> Unpin for Line<'a>","synthetic":true,"types":["uu_sort::Line"]},{"text":"impl Unpin for GeneralF64ParseResult","synthetic":true,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stat"] = [{"text":"impl Unpin for OutputType","synthetic":true,"types":["uu_stat::OutputType"]},{"text":"impl Unpin for Token","synthetic":true,"types":["uu_stat::Token"]},{"text":"impl Unpin for Stater","synthetic":true,"types":["uu_stat::Stater"]}]; -implementors["uu_stty"] = [{"text":"impl<T> Unpin for Flag<T> where
    T: Unpin
","synthetic":true,"types":["uu_stty::Flag"]},{"text":"impl Unpin for TermSize","synthetic":true,"types":["uu_stty::TermSize"]}]; -implementors["uu_tail"] = [{"text":"impl Unpin for Signum","synthetic":true,"types":["uu_tail::args::Signum"]},{"text":"impl Unpin for FilterMode","synthetic":true,"types":["uu_tail::args::FilterMode"]},{"text":"impl Unpin for FollowMode","synthetic":true,"types":["uu_tail::args::FollowMode"]},{"text":"impl Unpin for Settings","synthetic":true,"types":["uu_tail::args::Settings"]},{"text":"impl<'a> Unpin for ReverseChunks<'a>","synthetic":true,"types":["uu_tail::chunks::ReverseChunks"]},{"text":"impl Unpin for BytesChunk","synthetic":true,"types":["uu_tail::chunks::BytesChunk"]},{"text":"impl Unpin for BytesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::BytesChunkBuffer"]},{"text":"impl Unpin for LinesChunk","synthetic":true,"types":["uu_tail::chunks::LinesChunk"]},{"text":"impl Unpin for LinesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::LinesChunkBuffer"]}]; -implementors["uucore"] = [{"text":"impl Unpin for DecodeError","synthetic":true,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl Unpin for EncodeError","synthetic":true,"types":["uucore::features::encoding::EncodeError"]},{"text":"impl Unpin for Format","synthetic":true,"types":["uucore::features::encoding::Format"]},{"text":"impl<R> Unpin for Data<R> where
    R: Unpin
","synthetic":true,"types":["uucore::features::encoding::Data"]},{"text":"impl Unpin for FileInformation","synthetic":true,"types":["uucore::features::fs::FileInformation"]},{"text":"impl Unpin for MissingHandling","synthetic":true,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl Unpin for ResolveMode","synthetic":true,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl Unpin for MountInfo","synthetic":true,"types":["uucore::features::fsext::MountInfo"]},{"text":"impl Unpin for FsUsage","synthetic":true,"types":["uucore::features::fsext::FsUsage"]},{"text":"impl<B> Unpin for Lines<B> where
    B: Unpin
","synthetic":true,"types":["uucore::features::lines::Lines"]},{"text":"impl Unpin for Memo","synthetic":true,"types":["uucore::features::memo::Memo"]},{"text":"impl<T> Unpin for RingBuffer<T> where
    T: Unpin
","synthetic":true,"types":["uucore::features::ringbuffer::RingBuffer"]},{"text":"impl Unpin for Passwd","synthetic":true,"types":["uucore::features::entries::Passwd"]},{"text":"impl Unpin for Group","synthetic":true,"types":["uucore::features::entries::Group"]},{"text":"impl Unpin for VerbosityLevel","synthetic":true,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl Unpin for Verbosity","synthetic":true,"types":["uucore::features::perms::Verbosity"]},{"text":"impl Unpin for IfFrom","synthetic":true,"types":["uucore::features::perms::IfFrom"]},{"text":"impl Unpin for TraverseSymlinks","synthetic":true,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl Unpin for ChownExecutor","synthetic":true,"types":["uucore::features::perms::ChownExecutor"]},{"text":"impl Unpin for ExitStatus","synthetic":true,"types":["uucore::features::process::ExitStatus"]},{"text":"impl Unpin for Utmpx","synthetic":true,"types":["uucore::features::utmpx::Utmpx"]},{"text":"impl Unpin for UtmpxIter","synthetic":true,"types":["uucore::features::utmpx::UtmpxIter"]},{"text":"impl Unpin for BackupMode","synthetic":true,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl Unpin for BackupError","synthetic":true,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl Unpin for USimpleError","synthetic":true,"types":["uucore::mods::error::USimpleError"]},{"text":"impl Unpin for UUsageError","synthetic":true,"types":["uucore::mods::error::UUsageError"]},{"text":"impl Unpin for UIoError","synthetic":true,"types":["uucore::mods::error::UIoError"]},{"text":"impl Unpin for ExitCode","synthetic":true,"types":["uucore::mods::error::ExitCode"]},{"text":"impl Unpin for ClapErrorWrapper","synthetic":true,"types":["uucore::mods::error::ClapErrorWrapper"]},{"text":"impl Unpin for Range","synthetic":true,"types":["uucore::mods::ranges::Range"]},{"text":"impl Unpin for QuotingStyle","synthetic":true,"types":["uucore::mods::quoting_style::QuotingStyle"]},{"text":"impl Unpin for Quotes","synthetic":true,"types":["uucore::mods::quoting_style::Quotes"]},{"text":"impl Unpin for ParseSizeError","synthetic":true,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -implementors["uudoc"] = [{"text":"impl<'a, 'b> Unpin for MDWriter<'a, 'b>","synthetic":true,"types":["uudoc::MDWriter"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_base32":[["impl Unpin for Config",1,["uu_base32::base_common::Config"]]], +"uu_cp":[["impl Unpin for Error",1,["uu_cp::Error"]],["impl Unpin for ClobberMode",1,["uu_cp::ClobberMode"]],["impl Unpin for OverwriteMode",1,["uu_cp::OverwriteMode"]],["impl Unpin for ReflinkMode",1,["uu_cp::ReflinkMode"]],["impl Unpin for SparseMode",1,["uu_cp::SparseMode"]],["impl Unpin for TargetType",1,["uu_cp::TargetType"]],["impl Unpin for CopyMode",1,["uu_cp::CopyMode"]],["impl Unpin for Attribute",1,["uu_cp::Attribute"]],["impl Unpin for Options",1,["uu_cp::Options"]]], +"uu_csplit":[["impl Unpin for CsplitOptions",1,["uu_csplit::CsplitOptions"]]], +"uu_dircolors":[["impl Unpin for OutputFmt",1,["uu_dircolors::OutputFmt"]]], +"uu_factor":[["impl Unpin for Factors",1,["uu_factor::factor::Factors"]]], +"uu_fmt":[["impl Unpin for FmtOptions",1,["uu_fmt::FmtOptions"]]], +"uu_install":[["impl Unpin for Behavior",1,["uu_install::Behavior"]],["impl Unpin for MainFunction",1,["uu_install::MainFunction"]]], +"uu_kill":[["impl Unpin for Mode",1,["uu_kill::Mode"]]], +"uu_ln":[["impl Unpin for Settings",1,["uu_ln::Settings"]],["impl Unpin for OverwriteMode",1,["uu_ln::OverwriteMode"]]], +"uu_ls":[["impl Unpin for Format",1,["uu_ls::Format"]],["impl Unpin for Config",1,["uu_ls::Config"]]], +"uu_mv":[["impl Unpin for Behavior",1,["uu_mv::Behavior"]],["impl Unpin for OverwriteMode",1,["uu_mv::OverwriteMode"]]], +"uu_nl":[["impl Unpin for Settings",1,["uu_nl::Settings"]]], +"uu_numfmt":[["impl Unpin for NumfmtError",1,["uu_numfmt::errors::NumfmtError"]],["impl<'a> Unpin for WhitespaceSplitter<'a>",1,["uu_numfmt::format::WhitespaceSplitter"]],["impl Unpin for TransformOptions",1,["uu_numfmt::options::TransformOptions"]],["impl Unpin for NumfmtOptions",1,["uu_numfmt::options::NumfmtOptions"]],["impl Unpin for RoundMethod",1,["uu_numfmt::options::RoundMethod"]],["impl Unpin for FormatOptions",1,["uu_numfmt::options::FormatOptions"]]], +"uu_sort":[["impl Unpin for Output",1,["uu_sort::Output"]],["impl Unpin for GlobalSettings",1,["uu_sort::GlobalSettings"]],["impl<'a> Unpin for Line<'a>",1,["uu_sort::Line"]],["impl Unpin for GeneralF64ParseResult",1,["uu_sort::GeneralF64ParseResult"]]], +"uu_stat":[["impl Unpin for OutputType",1,["uu_stat::OutputType"]],["impl Unpin for Token",1,["uu_stat::Token"]],["impl Unpin for Stater",1,["uu_stat::Stater"]]], +"uu_stty":[["impl<T> Unpin for Flag<T>where
    T: Unpin,
",1,["uu_stty::Flag"]],["impl Unpin for TermSize",1,["uu_stty::TermSize"]]], +"uu_tail":[["impl Unpin for Signum",1,["uu_tail::args::Signum"]],["impl Unpin for FilterMode",1,["uu_tail::args::FilterMode"]],["impl Unpin for FollowMode",1,["uu_tail::args::FollowMode"]],["impl Unpin for Settings",1,["uu_tail::args::Settings"]],["impl<'a> Unpin for ReverseChunks<'a>",1,["uu_tail::chunks::ReverseChunks"]],["impl Unpin for BytesChunk",1,["uu_tail::chunks::BytesChunk"]],["impl Unpin for BytesChunkBuffer",1,["uu_tail::chunks::BytesChunkBuffer"]],["impl Unpin for LinesChunk",1,["uu_tail::chunks::LinesChunk"]],["impl Unpin for LinesChunkBuffer",1,["uu_tail::chunks::LinesChunkBuffer"]]], +"uucore":[["impl Unpin for DecodeError",1,["uucore::features::encoding::DecodeError"]],["impl Unpin for EncodeError",1,["uucore::features::encoding::EncodeError"]],["impl Unpin for Format",1,["uucore::features::encoding::Format"]],["impl<R> Unpin for Data<R>where
    R: Unpin,
",1,["uucore::features::encoding::Data"]],["impl Unpin for FileInformation",1,["uucore::features::fs::FileInformation"]],["impl Unpin for MissingHandling",1,["uucore::features::fs::MissingHandling"]],["impl Unpin for ResolveMode",1,["uucore::features::fs::ResolveMode"]],["impl Unpin for MountInfo",1,["uucore::features::fsext::MountInfo"]],["impl Unpin for FsUsage",1,["uucore::features::fsext::FsUsage"]],["impl<B> Unpin for Lines<B>where
    B: Unpin,
",1,["uucore::features::lines::Lines"]],["impl Unpin for Memo",1,["uucore::features::memo::Memo"]],["impl<T> Unpin for RingBuffer<T>where
    T: Unpin,
",1,["uucore::features::ringbuffer::RingBuffer"]],["impl Unpin for Passwd",1,["uucore::features::entries::Passwd"]],["impl Unpin for Group",1,["uucore::features::entries::Group"]],["impl Unpin for VerbosityLevel",1,["uucore::features::perms::VerbosityLevel"]],["impl Unpin for Verbosity",1,["uucore::features::perms::Verbosity"]],["impl Unpin for IfFrom",1,["uucore::features::perms::IfFrom"]],["impl Unpin for TraverseSymlinks",1,["uucore::features::perms::TraverseSymlinks"]],["impl Unpin for ChownExecutor",1,["uucore::features::perms::ChownExecutor"]],["impl Unpin for ExitStatus",1,["uucore::features::process::ExitStatus"]],["impl Unpin for Utmpx",1,["uucore::features::utmpx::Utmpx"]],["impl Unpin for UtmpxIter",1,["uucore::features::utmpx::UtmpxIter"]],["impl Unpin for BackupMode",1,["uucore::mods::backup_control::BackupMode"]],["impl Unpin for BackupError",1,["uucore::mods::backup_control::BackupError"]],["impl Unpin for USimpleError",1,["uucore::mods::error::USimpleError"]],["impl Unpin for UUsageError",1,["uucore::mods::error::UUsageError"]],["impl Unpin for UIoError",1,["uucore::mods::error::UIoError"]],["impl Unpin for ExitCode",1,["uucore::mods::error::ExitCode"]],["impl Unpin for ClapErrorWrapper",1,["uucore::mods::error::ClapErrorWrapper"]],["impl Unpin for Range",1,["uucore::mods::ranges::Range"]],["impl Unpin for QuotingStyle",1,["uucore::mods::quoting_style::QuotingStyle"]],["impl Unpin for Quotes",1,["uucore::mods::quoting_style::Quotes"]],["impl Unpin for ParseSizeError",1,["uucore::parser::parse_size::ParseSizeError"]]], +"uudoc":[["impl<'a, 'b> Unpin for MDWriter<'a, 'b>",1,["uudoc::MDWriter"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/ops/drop/trait.Drop.js b/dev/implementors/core/ops/drop/trait.Drop.js index f9edb1633..f54e056a1 100644 --- a/dev/implementors/core/ops/drop/trait.Drop.js +++ b/dev/implementors/core/ops/drop/trait.Drop.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uucore"] = [{"text":"impl Drop for UtmpxIter","synthetic":false,"types":["uucore::features::utmpx::UtmpxIter"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uucore":[["impl Drop for UtmpxIter"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js b/dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js index 30ccf7ea5..d921aa5ab 100644 --- a/dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js +++ b/dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -1,21 +1,21 @@ -(function() {var implementors = {}; -implementors["uu_base32"] = [{"text":"impl RefUnwindSafe for Config","synthetic":true,"types":["uu_base32::base_common::Config"]}]; -implementors["uu_cp"] = [{"text":"impl !RefUnwindSafe for Error","synthetic":true,"types":["uu_cp::Error"]},{"text":"impl RefUnwindSafe for ClobberMode","synthetic":true,"types":["uu_cp::ClobberMode"]},{"text":"impl RefUnwindSafe for OverwriteMode","synthetic":true,"types":["uu_cp::OverwriteMode"]},{"text":"impl RefUnwindSafe for ReflinkMode","synthetic":true,"types":["uu_cp::ReflinkMode"]},{"text":"impl RefUnwindSafe for SparseMode","synthetic":true,"types":["uu_cp::SparseMode"]},{"text":"impl RefUnwindSafe for TargetType","synthetic":true,"types":["uu_cp::TargetType"]},{"text":"impl RefUnwindSafe for CopyMode","synthetic":true,"types":["uu_cp::CopyMode"]},{"text":"impl RefUnwindSafe for Attribute","synthetic":true,"types":["uu_cp::Attribute"]},{"text":"impl RefUnwindSafe for Options","synthetic":true,"types":["uu_cp::Options"]}]; -implementors["uu_csplit"] = [{"text":"impl !RefUnwindSafe for CsplitOptions","synthetic":true,"types":["uu_csplit::CsplitOptions"]}]; -implementors["uu_dircolors"] = [{"text":"impl RefUnwindSafe for OutputFmt","synthetic":true,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl !RefUnwindSafe for Factors","synthetic":true,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_fmt"] = [{"text":"impl RefUnwindSafe for FmtOptions","synthetic":true,"types":["uu_fmt::FmtOptions"]}]; -implementors["uu_install"] = [{"text":"impl RefUnwindSafe for Behavior","synthetic":true,"types":["uu_install::Behavior"]},{"text":"impl RefUnwindSafe for MainFunction","synthetic":true,"types":["uu_install::MainFunction"]}]; -implementors["uu_kill"] = [{"text":"impl RefUnwindSafe for Mode","synthetic":true,"types":["uu_kill::Mode"]}]; -implementors["uu_ln"] = [{"text":"impl RefUnwindSafe for Settings","synthetic":true,"types":["uu_ln::Settings"]},{"text":"impl RefUnwindSafe for OverwriteMode","synthetic":true,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl RefUnwindSafe for Format","synthetic":true,"types":["uu_ls::Format"]},{"text":"impl RefUnwindSafe for Config","synthetic":true,"types":["uu_ls::Config"]}]; -implementors["uu_mv"] = [{"text":"impl RefUnwindSafe for Behavior","synthetic":true,"types":["uu_mv::Behavior"]},{"text":"impl RefUnwindSafe for OverwriteMode","synthetic":true,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_nl"] = [{"text":"impl RefUnwindSafe for Settings","synthetic":true,"types":["uu_nl::Settings"]}]; -implementors["uu_numfmt"] = [{"text":"impl RefUnwindSafe for NumfmtError","synthetic":true,"types":["uu_numfmt::errors::NumfmtError"]},{"text":"impl<'a> RefUnwindSafe for WhitespaceSplitter<'a>","synthetic":true,"types":["uu_numfmt::format::WhitespaceSplitter"]},{"text":"impl RefUnwindSafe for TransformOptions","synthetic":true,"types":["uu_numfmt::options::TransformOptions"]},{"text":"impl RefUnwindSafe for NumfmtOptions","synthetic":true,"types":["uu_numfmt::options::NumfmtOptions"]},{"text":"impl RefUnwindSafe for RoundMethod","synthetic":true,"types":["uu_numfmt::options::RoundMethod"]},{"text":"impl RefUnwindSafe for FormatOptions","synthetic":true,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl RefUnwindSafe for Output","synthetic":true,"types":["uu_sort::Output"]},{"text":"impl RefUnwindSafe for GlobalSettings","synthetic":true,"types":["uu_sort::GlobalSettings"]},{"text":"impl<'a> RefUnwindSafe for Line<'a>","synthetic":true,"types":["uu_sort::Line"]},{"text":"impl RefUnwindSafe for GeneralF64ParseResult","synthetic":true,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stat"] = [{"text":"impl RefUnwindSafe for OutputType","synthetic":true,"types":["uu_stat::OutputType"]},{"text":"impl RefUnwindSafe for Token","synthetic":true,"types":["uu_stat::Token"]},{"text":"impl RefUnwindSafe for Stater","synthetic":true,"types":["uu_stat::Stater"]}]; -implementors["uu_stty"] = [{"text":"impl<T> RefUnwindSafe for Flag<T> where
    T: RefUnwindSafe
","synthetic":true,"types":["uu_stty::Flag"]},{"text":"impl RefUnwindSafe for TermSize","synthetic":true,"types":["uu_stty::TermSize"]}]; -implementors["uu_tail"] = [{"text":"impl RefUnwindSafe for Signum","synthetic":true,"types":["uu_tail::args::Signum"]},{"text":"impl RefUnwindSafe for FilterMode","synthetic":true,"types":["uu_tail::args::FilterMode"]},{"text":"impl RefUnwindSafe for FollowMode","synthetic":true,"types":["uu_tail::args::FollowMode"]},{"text":"impl RefUnwindSafe for Settings","synthetic":true,"types":["uu_tail::args::Settings"]},{"text":"impl<'a> RefUnwindSafe for ReverseChunks<'a>","synthetic":true,"types":["uu_tail::chunks::ReverseChunks"]},{"text":"impl RefUnwindSafe for BytesChunk","synthetic":true,"types":["uu_tail::chunks::BytesChunk"]},{"text":"impl RefUnwindSafe for BytesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::BytesChunkBuffer"]},{"text":"impl RefUnwindSafe for LinesChunk","synthetic":true,"types":["uu_tail::chunks::LinesChunk"]},{"text":"impl RefUnwindSafe for LinesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::LinesChunkBuffer"]}]; -implementors["uucore"] = [{"text":"impl !RefUnwindSafe for DecodeError","synthetic":true,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl RefUnwindSafe for EncodeError","synthetic":true,"types":["uucore::features::encoding::EncodeError"]},{"text":"impl RefUnwindSafe for Format","synthetic":true,"types":["uucore::features::encoding::Format"]},{"text":"impl<R> RefUnwindSafe for Data<R> where
    R: RefUnwindSafe
","synthetic":true,"types":["uucore::features::encoding::Data"]},{"text":"impl RefUnwindSafe for FileInformation","synthetic":true,"types":["uucore::features::fs::FileInformation"]},{"text":"impl RefUnwindSafe for MissingHandling","synthetic":true,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl RefUnwindSafe for ResolveMode","synthetic":true,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl RefUnwindSafe for MountInfo","synthetic":true,"types":["uucore::features::fsext::MountInfo"]},{"text":"impl RefUnwindSafe for FsUsage","synthetic":true,"types":["uucore::features::fsext::FsUsage"]},{"text":"impl<B> RefUnwindSafe for Lines<B> where
    B: RefUnwindSafe
","synthetic":true,"types":["uucore::features::lines::Lines"]},{"text":"impl !RefUnwindSafe for Memo","synthetic":true,"types":["uucore::features::memo::Memo"]},{"text":"impl<T> RefUnwindSafe for RingBuffer<T> where
    T: RefUnwindSafe
","synthetic":true,"types":["uucore::features::ringbuffer::RingBuffer"]},{"text":"impl RefUnwindSafe for Passwd","synthetic":true,"types":["uucore::features::entries::Passwd"]},{"text":"impl RefUnwindSafe for Group","synthetic":true,"types":["uucore::features::entries::Group"]},{"text":"impl RefUnwindSafe for VerbosityLevel","synthetic":true,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl RefUnwindSafe for Verbosity","synthetic":true,"types":["uucore::features::perms::Verbosity"]},{"text":"impl RefUnwindSafe for IfFrom","synthetic":true,"types":["uucore::features::perms::IfFrom"]},{"text":"impl RefUnwindSafe for TraverseSymlinks","synthetic":true,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl RefUnwindSafe for ChownExecutor","synthetic":true,"types":["uucore::features::perms::ChownExecutor"]},{"text":"impl RefUnwindSafe for ExitStatus","synthetic":true,"types":["uucore::features::process::ExitStatus"]},{"text":"impl RefUnwindSafe for Utmpx","synthetic":true,"types":["uucore::features::utmpx::Utmpx"]},{"text":"impl RefUnwindSafe for UtmpxIter","synthetic":true,"types":["uucore::features::utmpx::UtmpxIter"]},{"text":"impl RefUnwindSafe for BackupMode","synthetic":true,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl RefUnwindSafe for BackupError","synthetic":true,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl RefUnwindSafe for USimpleError","synthetic":true,"types":["uucore::mods::error::USimpleError"]},{"text":"impl RefUnwindSafe for UUsageError","synthetic":true,"types":["uucore::mods::error::UUsageError"]},{"text":"impl !RefUnwindSafe for UIoError","synthetic":true,"types":["uucore::mods::error::UIoError"]},{"text":"impl RefUnwindSafe for ExitCode","synthetic":true,"types":["uucore::mods::error::ExitCode"]},{"text":"impl !RefUnwindSafe for ClapErrorWrapper","synthetic":true,"types":["uucore::mods::error::ClapErrorWrapper"]},{"text":"impl RefUnwindSafe for Range","synthetic":true,"types":["uucore::mods::ranges::Range"]},{"text":"impl RefUnwindSafe for QuotingStyle","synthetic":true,"types":["uucore::mods::quoting_style::QuotingStyle"]},{"text":"impl RefUnwindSafe for Quotes","synthetic":true,"types":["uucore::mods::quoting_style::Quotes"]},{"text":"impl RefUnwindSafe for ParseSizeError","synthetic":true,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -implementors["uudoc"] = [{"text":"impl<'a, 'b> !RefUnwindSafe for MDWriter<'a, 'b>","synthetic":true,"types":["uudoc::MDWriter"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_base32":[["impl RefUnwindSafe for Config",1,["uu_base32::base_common::Config"]]], +"uu_cp":[["impl !RefUnwindSafe for Error",1,["uu_cp::Error"]],["impl RefUnwindSafe for ClobberMode",1,["uu_cp::ClobberMode"]],["impl RefUnwindSafe for OverwriteMode",1,["uu_cp::OverwriteMode"]],["impl RefUnwindSafe for ReflinkMode",1,["uu_cp::ReflinkMode"]],["impl RefUnwindSafe for SparseMode",1,["uu_cp::SparseMode"]],["impl RefUnwindSafe for TargetType",1,["uu_cp::TargetType"]],["impl RefUnwindSafe for CopyMode",1,["uu_cp::CopyMode"]],["impl RefUnwindSafe for Attribute",1,["uu_cp::Attribute"]],["impl RefUnwindSafe for Options",1,["uu_cp::Options"]]], +"uu_csplit":[["impl !RefUnwindSafe for CsplitOptions",1,["uu_csplit::CsplitOptions"]]], +"uu_dircolors":[["impl RefUnwindSafe for OutputFmt",1,["uu_dircolors::OutputFmt"]]], +"uu_factor":[["impl !RefUnwindSafe for Factors",1,["uu_factor::factor::Factors"]]], +"uu_fmt":[["impl RefUnwindSafe for FmtOptions",1,["uu_fmt::FmtOptions"]]], +"uu_install":[["impl RefUnwindSafe for Behavior",1,["uu_install::Behavior"]],["impl RefUnwindSafe for MainFunction",1,["uu_install::MainFunction"]]], +"uu_kill":[["impl RefUnwindSafe for Mode",1,["uu_kill::Mode"]]], +"uu_ln":[["impl RefUnwindSafe for Settings",1,["uu_ln::Settings"]],["impl RefUnwindSafe for OverwriteMode",1,["uu_ln::OverwriteMode"]]], +"uu_ls":[["impl RefUnwindSafe for Format",1,["uu_ls::Format"]],["impl RefUnwindSafe for Config",1,["uu_ls::Config"]]], +"uu_mv":[["impl RefUnwindSafe for Behavior",1,["uu_mv::Behavior"]],["impl RefUnwindSafe for OverwriteMode",1,["uu_mv::OverwriteMode"]]], +"uu_nl":[["impl RefUnwindSafe for Settings",1,["uu_nl::Settings"]]], +"uu_numfmt":[["impl RefUnwindSafe for NumfmtError",1,["uu_numfmt::errors::NumfmtError"]],["impl<'a> RefUnwindSafe for WhitespaceSplitter<'a>",1,["uu_numfmt::format::WhitespaceSplitter"]],["impl RefUnwindSafe for TransformOptions",1,["uu_numfmt::options::TransformOptions"]],["impl RefUnwindSafe for NumfmtOptions",1,["uu_numfmt::options::NumfmtOptions"]],["impl RefUnwindSafe for RoundMethod",1,["uu_numfmt::options::RoundMethod"]],["impl RefUnwindSafe for FormatOptions",1,["uu_numfmt::options::FormatOptions"]]], +"uu_sort":[["impl RefUnwindSafe for Output",1,["uu_sort::Output"]],["impl RefUnwindSafe for GlobalSettings",1,["uu_sort::GlobalSettings"]],["impl<'a> RefUnwindSafe for Line<'a>",1,["uu_sort::Line"]],["impl RefUnwindSafe for GeneralF64ParseResult",1,["uu_sort::GeneralF64ParseResult"]]], +"uu_stat":[["impl RefUnwindSafe for OutputType",1,["uu_stat::OutputType"]],["impl RefUnwindSafe for Token",1,["uu_stat::Token"]],["impl RefUnwindSafe for Stater",1,["uu_stat::Stater"]]], +"uu_stty":[["impl<T> RefUnwindSafe for Flag<T>where
    T: RefUnwindSafe,
",1,["uu_stty::Flag"]],["impl RefUnwindSafe for TermSize",1,["uu_stty::TermSize"]]], +"uu_tail":[["impl RefUnwindSafe for Signum",1,["uu_tail::args::Signum"]],["impl RefUnwindSafe for FilterMode",1,["uu_tail::args::FilterMode"]],["impl RefUnwindSafe for FollowMode",1,["uu_tail::args::FollowMode"]],["impl RefUnwindSafe for Settings",1,["uu_tail::args::Settings"]],["impl<'a> RefUnwindSafe for ReverseChunks<'a>",1,["uu_tail::chunks::ReverseChunks"]],["impl RefUnwindSafe for BytesChunk",1,["uu_tail::chunks::BytesChunk"]],["impl RefUnwindSafe for BytesChunkBuffer",1,["uu_tail::chunks::BytesChunkBuffer"]],["impl RefUnwindSafe for LinesChunk",1,["uu_tail::chunks::LinesChunk"]],["impl RefUnwindSafe for LinesChunkBuffer",1,["uu_tail::chunks::LinesChunkBuffer"]]], +"uucore":[["impl !RefUnwindSafe for DecodeError",1,["uucore::features::encoding::DecodeError"]],["impl RefUnwindSafe for EncodeError",1,["uucore::features::encoding::EncodeError"]],["impl RefUnwindSafe for Format",1,["uucore::features::encoding::Format"]],["impl<R> RefUnwindSafe for Data<R>where
    R: RefUnwindSafe,
",1,["uucore::features::encoding::Data"]],["impl RefUnwindSafe for FileInformation",1,["uucore::features::fs::FileInformation"]],["impl RefUnwindSafe for MissingHandling",1,["uucore::features::fs::MissingHandling"]],["impl RefUnwindSafe for ResolveMode",1,["uucore::features::fs::ResolveMode"]],["impl RefUnwindSafe for MountInfo",1,["uucore::features::fsext::MountInfo"]],["impl RefUnwindSafe for FsUsage",1,["uucore::features::fsext::FsUsage"]],["impl<B> RefUnwindSafe for Lines<B>where
    B: RefUnwindSafe,
",1,["uucore::features::lines::Lines"]],["impl !RefUnwindSafe for Memo",1,["uucore::features::memo::Memo"]],["impl<T> RefUnwindSafe for RingBuffer<T>where
    T: RefUnwindSafe,
",1,["uucore::features::ringbuffer::RingBuffer"]],["impl RefUnwindSafe for Passwd",1,["uucore::features::entries::Passwd"]],["impl RefUnwindSafe for Group",1,["uucore::features::entries::Group"]],["impl RefUnwindSafe for VerbosityLevel",1,["uucore::features::perms::VerbosityLevel"]],["impl RefUnwindSafe for Verbosity",1,["uucore::features::perms::Verbosity"]],["impl RefUnwindSafe for IfFrom",1,["uucore::features::perms::IfFrom"]],["impl RefUnwindSafe for TraverseSymlinks",1,["uucore::features::perms::TraverseSymlinks"]],["impl RefUnwindSafe for ChownExecutor",1,["uucore::features::perms::ChownExecutor"]],["impl RefUnwindSafe for ExitStatus",1,["uucore::features::process::ExitStatus"]],["impl RefUnwindSafe for Utmpx",1,["uucore::features::utmpx::Utmpx"]],["impl RefUnwindSafe for UtmpxIter",1,["uucore::features::utmpx::UtmpxIter"]],["impl RefUnwindSafe for BackupMode",1,["uucore::mods::backup_control::BackupMode"]],["impl RefUnwindSafe for BackupError",1,["uucore::mods::backup_control::BackupError"]],["impl RefUnwindSafe for USimpleError",1,["uucore::mods::error::USimpleError"]],["impl RefUnwindSafe for UUsageError",1,["uucore::mods::error::UUsageError"]],["impl !RefUnwindSafe for UIoError",1,["uucore::mods::error::UIoError"]],["impl RefUnwindSafe for ExitCode",1,["uucore::mods::error::ExitCode"]],["impl !RefUnwindSafe for ClapErrorWrapper",1,["uucore::mods::error::ClapErrorWrapper"]],["impl RefUnwindSafe for Range",1,["uucore::mods::ranges::Range"]],["impl RefUnwindSafe for QuotingStyle",1,["uucore::mods::quoting_style::QuotingStyle"]],["impl RefUnwindSafe for Quotes",1,["uucore::mods::quoting_style::Quotes"]],["impl RefUnwindSafe for ParseSizeError",1,["uucore::parser::parse_size::ParseSizeError"]]], +"uudoc":[["impl<'a, 'b> !RefUnwindSafe for MDWriter<'a, 'b>",1,["uudoc::MDWriter"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js b/dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js index 424be8017..2c5e44ab1 100644 --- a/dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js +++ b/dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -1,21 +1,21 @@ -(function() {var implementors = {}; -implementors["uu_base32"] = [{"text":"impl UnwindSafe for Config","synthetic":true,"types":["uu_base32::base_common::Config"]}]; -implementors["uu_cp"] = [{"text":"impl !UnwindSafe for Error","synthetic":true,"types":["uu_cp::Error"]},{"text":"impl UnwindSafe for ClobberMode","synthetic":true,"types":["uu_cp::ClobberMode"]},{"text":"impl UnwindSafe for OverwriteMode","synthetic":true,"types":["uu_cp::OverwriteMode"]},{"text":"impl UnwindSafe for ReflinkMode","synthetic":true,"types":["uu_cp::ReflinkMode"]},{"text":"impl UnwindSafe for SparseMode","synthetic":true,"types":["uu_cp::SparseMode"]},{"text":"impl UnwindSafe for TargetType","synthetic":true,"types":["uu_cp::TargetType"]},{"text":"impl UnwindSafe for CopyMode","synthetic":true,"types":["uu_cp::CopyMode"]},{"text":"impl UnwindSafe for Attribute","synthetic":true,"types":["uu_cp::Attribute"]},{"text":"impl UnwindSafe for Options","synthetic":true,"types":["uu_cp::Options"]}]; -implementors["uu_csplit"] = [{"text":"impl !UnwindSafe for CsplitOptions","synthetic":true,"types":["uu_csplit::CsplitOptions"]}]; -implementors["uu_dircolors"] = [{"text":"impl UnwindSafe for OutputFmt","synthetic":true,"types":["uu_dircolors::OutputFmt"]}]; -implementors["uu_factor"] = [{"text":"impl UnwindSafe for Factors","synthetic":true,"types":["uu_factor::factor::Factors"]}]; -implementors["uu_fmt"] = [{"text":"impl UnwindSafe for FmtOptions","synthetic":true,"types":["uu_fmt::FmtOptions"]}]; -implementors["uu_install"] = [{"text":"impl UnwindSafe for Behavior","synthetic":true,"types":["uu_install::Behavior"]},{"text":"impl UnwindSafe for MainFunction","synthetic":true,"types":["uu_install::MainFunction"]}]; -implementors["uu_kill"] = [{"text":"impl UnwindSafe for Mode","synthetic":true,"types":["uu_kill::Mode"]}]; -implementors["uu_ln"] = [{"text":"impl UnwindSafe for Settings","synthetic":true,"types":["uu_ln::Settings"]},{"text":"impl UnwindSafe for OverwriteMode","synthetic":true,"types":["uu_ln::OverwriteMode"]}]; -implementors["uu_ls"] = [{"text":"impl UnwindSafe for Format","synthetic":true,"types":["uu_ls::Format"]},{"text":"impl UnwindSafe for Config","synthetic":true,"types":["uu_ls::Config"]}]; -implementors["uu_mv"] = [{"text":"impl UnwindSafe for Behavior","synthetic":true,"types":["uu_mv::Behavior"]},{"text":"impl UnwindSafe for OverwriteMode","synthetic":true,"types":["uu_mv::OverwriteMode"]}]; -implementors["uu_nl"] = [{"text":"impl UnwindSafe for Settings","synthetic":true,"types":["uu_nl::Settings"]}]; -implementors["uu_numfmt"] = [{"text":"impl UnwindSafe for NumfmtError","synthetic":true,"types":["uu_numfmt::errors::NumfmtError"]},{"text":"impl<'a> UnwindSafe for WhitespaceSplitter<'a>","synthetic":true,"types":["uu_numfmt::format::WhitespaceSplitter"]},{"text":"impl UnwindSafe for TransformOptions","synthetic":true,"types":["uu_numfmt::options::TransformOptions"]},{"text":"impl UnwindSafe for NumfmtOptions","synthetic":true,"types":["uu_numfmt::options::NumfmtOptions"]},{"text":"impl UnwindSafe for RoundMethod","synthetic":true,"types":["uu_numfmt::options::RoundMethod"]},{"text":"impl UnwindSafe for FormatOptions","synthetic":true,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uu_sort"] = [{"text":"impl UnwindSafe for Output","synthetic":true,"types":["uu_sort::Output"]},{"text":"impl UnwindSafe for GlobalSettings","synthetic":true,"types":["uu_sort::GlobalSettings"]},{"text":"impl<'a> UnwindSafe for Line<'a>","synthetic":true,"types":["uu_sort::Line"]},{"text":"impl UnwindSafe for GeneralF64ParseResult","synthetic":true,"types":["uu_sort::GeneralF64ParseResult"]}]; -implementors["uu_stat"] = [{"text":"impl UnwindSafe for OutputType","synthetic":true,"types":["uu_stat::OutputType"]},{"text":"impl UnwindSafe for Token","synthetic":true,"types":["uu_stat::Token"]},{"text":"impl UnwindSafe for Stater","synthetic":true,"types":["uu_stat::Stater"]}]; -implementors["uu_stty"] = [{"text":"impl<T> UnwindSafe for Flag<T> where
    T: UnwindSafe
","synthetic":true,"types":["uu_stty::Flag"]},{"text":"impl UnwindSafe for TermSize","synthetic":true,"types":["uu_stty::TermSize"]}]; -implementors["uu_tail"] = [{"text":"impl UnwindSafe for Signum","synthetic":true,"types":["uu_tail::args::Signum"]},{"text":"impl UnwindSafe for FilterMode","synthetic":true,"types":["uu_tail::args::FilterMode"]},{"text":"impl UnwindSafe for FollowMode","synthetic":true,"types":["uu_tail::args::FollowMode"]},{"text":"impl UnwindSafe for Settings","synthetic":true,"types":["uu_tail::args::Settings"]},{"text":"impl<'a> UnwindSafe for ReverseChunks<'a>","synthetic":true,"types":["uu_tail::chunks::ReverseChunks"]},{"text":"impl UnwindSafe for BytesChunk","synthetic":true,"types":["uu_tail::chunks::BytesChunk"]},{"text":"impl UnwindSafe for BytesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::BytesChunkBuffer"]},{"text":"impl UnwindSafe for LinesChunk","synthetic":true,"types":["uu_tail::chunks::LinesChunk"]},{"text":"impl UnwindSafe for LinesChunkBuffer","synthetic":true,"types":["uu_tail::chunks::LinesChunkBuffer"]}]; -implementors["uucore"] = [{"text":"impl !UnwindSafe for DecodeError","synthetic":true,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl UnwindSafe for EncodeError","synthetic":true,"types":["uucore::features::encoding::EncodeError"]},{"text":"impl UnwindSafe for Format","synthetic":true,"types":["uucore::features::encoding::Format"]},{"text":"impl<R> UnwindSafe for Data<R> where
    R: UnwindSafe
","synthetic":true,"types":["uucore::features::encoding::Data"]},{"text":"impl UnwindSafe for FileInformation","synthetic":true,"types":["uucore::features::fs::FileInformation"]},{"text":"impl UnwindSafe for MissingHandling","synthetic":true,"types":["uucore::features::fs::MissingHandling"]},{"text":"impl UnwindSafe for ResolveMode","synthetic":true,"types":["uucore::features::fs::ResolveMode"]},{"text":"impl UnwindSafe for MountInfo","synthetic":true,"types":["uucore::features::fsext::MountInfo"]},{"text":"impl UnwindSafe for FsUsage","synthetic":true,"types":["uucore::features::fsext::FsUsage"]},{"text":"impl<B> UnwindSafe for Lines<B> where
    B: UnwindSafe
","synthetic":true,"types":["uucore::features::lines::Lines"]},{"text":"impl !UnwindSafe for Memo","synthetic":true,"types":["uucore::features::memo::Memo"]},{"text":"impl<T> UnwindSafe for RingBuffer<T> where
    T: UnwindSafe
","synthetic":true,"types":["uucore::features::ringbuffer::RingBuffer"]},{"text":"impl UnwindSafe for Passwd","synthetic":true,"types":["uucore::features::entries::Passwd"]},{"text":"impl UnwindSafe for Group","synthetic":true,"types":["uucore::features::entries::Group"]},{"text":"impl UnwindSafe for VerbosityLevel","synthetic":true,"types":["uucore::features::perms::VerbosityLevel"]},{"text":"impl UnwindSafe for Verbosity","synthetic":true,"types":["uucore::features::perms::Verbosity"]},{"text":"impl UnwindSafe for IfFrom","synthetic":true,"types":["uucore::features::perms::IfFrom"]},{"text":"impl UnwindSafe for TraverseSymlinks","synthetic":true,"types":["uucore::features::perms::TraverseSymlinks"]},{"text":"impl UnwindSafe for ChownExecutor","synthetic":true,"types":["uucore::features::perms::ChownExecutor"]},{"text":"impl UnwindSafe for ExitStatus","synthetic":true,"types":["uucore::features::process::ExitStatus"]},{"text":"impl UnwindSafe for Utmpx","synthetic":true,"types":["uucore::features::utmpx::Utmpx"]},{"text":"impl UnwindSafe for UtmpxIter","synthetic":true,"types":["uucore::features::utmpx::UtmpxIter"]},{"text":"impl UnwindSafe for BackupMode","synthetic":true,"types":["uucore::mods::backup_control::BackupMode"]},{"text":"impl UnwindSafe for BackupError","synthetic":true,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl UnwindSafe for USimpleError","synthetic":true,"types":["uucore::mods::error::USimpleError"]},{"text":"impl UnwindSafe for UUsageError","synthetic":true,"types":["uucore::mods::error::UUsageError"]},{"text":"impl !UnwindSafe for UIoError","synthetic":true,"types":["uucore::mods::error::UIoError"]},{"text":"impl UnwindSafe for ExitCode","synthetic":true,"types":["uucore::mods::error::ExitCode"]},{"text":"impl !UnwindSafe for ClapErrorWrapper","synthetic":true,"types":["uucore::mods::error::ClapErrorWrapper"]},{"text":"impl UnwindSafe for Range","synthetic":true,"types":["uucore::mods::ranges::Range"]},{"text":"impl UnwindSafe for QuotingStyle","synthetic":true,"types":["uucore::mods::quoting_style::QuotingStyle"]},{"text":"impl UnwindSafe for Quotes","synthetic":true,"types":["uucore::mods::quoting_style::Quotes"]},{"text":"impl UnwindSafe for ParseSizeError","synthetic":true,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -implementors["uudoc"] = [{"text":"impl<'a, 'b> !UnwindSafe for MDWriter<'a, 'b>","synthetic":true,"types":["uudoc::MDWriter"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_base32":[["impl UnwindSafe for Config",1,["uu_base32::base_common::Config"]]], +"uu_cp":[["impl !UnwindSafe for Error",1,["uu_cp::Error"]],["impl UnwindSafe for ClobberMode",1,["uu_cp::ClobberMode"]],["impl UnwindSafe for OverwriteMode",1,["uu_cp::OverwriteMode"]],["impl UnwindSafe for ReflinkMode",1,["uu_cp::ReflinkMode"]],["impl UnwindSafe for SparseMode",1,["uu_cp::SparseMode"]],["impl UnwindSafe for TargetType",1,["uu_cp::TargetType"]],["impl UnwindSafe for CopyMode",1,["uu_cp::CopyMode"]],["impl UnwindSafe for Attribute",1,["uu_cp::Attribute"]],["impl UnwindSafe for Options",1,["uu_cp::Options"]]], +"uu_csplit":[["impl !UnwindSafe for CsplitOptions",1,["uu_csplit::CsplitOptions"]]], +"uu_dircolors":[["impl UnwindSafe for OutputFmt",1,["uu_dircolors::OutputFmt"]]], +"uu_factor":[["impl UnwindSafe for Factors",1,["uu_factor::factor::Factors"]]], +"uu_fmt":[["impl UnwindSafe for FmtOptions",1,["uu_fmt::FmtOptions"]]], +"uu_install":[["impl UnwindSafe for Behavior",1,["uu_install::Behavior"]],["impl UnwindSafe for MainFunction",1,["uu_install::MainFunction"]]], +"uu_kill":[["impl UnwindSafe for Mode",1,["uu_kill::Mode"]]], +"uu_ln":[["impl UnwindSafe for Settings",1,["uu_ln::Settings"]],["impl UnwindSafe for OverwriteMode",1,["uu_ln::OverwriteMode"]]], +"uu_ls":[["impl UnwindSafe for Format",1,["uu_ls::Format"]],["impl UnwindSafe for Config",1,["uu_ls::Config"]]], +"uu_mv":[["impl UnwindSafe for Behavior",1,["uu_mv::Behavior"]],["impl UnwindSafe for OverwriteMode",1,["uu_mv::OverwriteMode"]]], +"uu_nl":[["impl UnwindSafe for Settings",1,["uu_nl::Settings"]]], +"uu_numfmt":[["impl UnwindSafe for NumfmtError",1,["uu_numfmt::errors::NumfmtError"]],["impl<'a> UnwindSafe for WhitespaceSplitter<'a>",1,["uu_numfmt::format::WhitespaceSplitter"]],["impl UnwindSafe for TransformOptions",1,["uu_numfmt::options::TransformOptions"]],["impl UnwindSafe for NumfmtOptions",1,["uu_numfmt::options::NumfmtOptions"]],["impl UnwindSafe for RoundMethod",1,["uu_numfmt::options::RoundMethod"]],["impl UnwindSafe for FormatOptions",1,["uu_numfmt::options::FormatOptions"]]], +"uu_sort":[["impl UnwindSafe for Output",1,["uu_sort::Output"]],["impl UnwindSafe for GlobalSettings",1,["uu_sort::GlobalSettings"]],["impl<'a> UnwindSafe for Line<'a>",1,["uu_sort::Line"]],["impl UnwindSafe for GeneralF64ParseResult",1,["uu_sort::GeneralF64ParseResult"]]], +"uu_stat":[["impl UnwindSafe for OutputType",1,["uu_stat::OutputType"]],["impl UnwindSafe for Token",1,["uu_stat::Token"]],["impl UnwindSafe for Stater",1,["uu_stat::Stater"]]], +"uu_stty":[["impl<T> UnwindSafe for Flag<T>where
    T: UnwindSafe,
",1,["uu_stty::Flag"]],["impl UnwindSafe for TermSize",1,["uu_stty::TermSize"]]], +"uu_tail":[["impl UnwindSafe for Signum",1,["uu_tail::args::Signum"]],["impl UnwindSafe for FilterMode",1,["uu_tail::args::FilterMode"]],["impl UnwindSafe for FollowMode",1,["uu_tail::args::FollowMode"]],["impl UnwindSafe for Settings",1,["uu_tail::args::Settings"]],["impl<'a> UnwindSafe for ReverseChunks<'a>",1,["uu_tail::chunks::ReverseChunks"]],["impl UnwindSafe for BytesChunk",1,["uu_tail::chunks::BytesChunk"]],["impl UnwindSafe for BytesChunkBuffer",1,["uu_tail::chunks::BytesChunkBuffer"]],["impl UnwindSafe for LinesChunk",1,["uu_tail::chunks::LinesChunk"]],["impl UnwindSafe for LinesChunkBuffer",1,["uu_tail::chunks::LinesChunkBuffer"]]], +"uucore":[["impl !UnwindSafe for DecodeError",1,["uucore::features::encoding::DecodeError"]],["impl UnwindSafe for EncodeError",1,["uucore::features::encoding::EncodeError"]],["impl UnwindSafe for Format",1,["uucore::features::encoding::Format"]],["impl<R> UnwindSafe for Data<R>where
    R: UnwindSafe,
",1,["uucore::features::encoding::Data"]],["impl UnwindSafe for FileInformation",1,["uucore::features::fs::FileInformation"]],["impl UnwindSafe for MissingHandling",1,["uucore::features::fs::MissingHandling"]],["impl UnwindSafe for ResolveMode",1,["uucore::features::fs::ResolveMode"]],["impl UnwindSafe for MountInfo",1,["uucore::features::fsext::MountInfo"]],["impl UnwindSafe for FsUsage",1,["uucore::features::fsext::FsUsage"]],["impl<B> UnwindSafe for Lines<B>where
    B: UnwindSafe,
",1,["uucore::features::lines::Lines"]],["impl !UnwindSafe for Memo",1,["uucore::features::memo::Memo"]],["impl<T> UnwindSafe for RingBuffer<T>where
    T: UnwindSafe,
",1,["uucore::features::ringbuffer::RingBuffer"]],["impl UnwindSafe for Passwd",1,["uucore::features::entries::Passwd"]],["impl UnwindSafe for Group",1,["uucore::features::entries::Group"]],["impl UnwindSafe for VerbosityLevel",1,["uucore::features::perms::VerbosityLevel"]],["impl UnwindSafe for Verbosity",1,["uucore::features::perms::Verbosity"]],["impl UnwindSafe for IfFrom",1,["uucore::features::perms::IfFrom"]],["impl UnwindSafe for TraverseSymlinks",1,["uucore::features::perms::TraverseSymlinks"]],["impl UnwindSafe for ChownExecutor",1,["uucore::features::perms::ChownExecutor"]],["impl UnwindSafe for ExitStatus",1,["uucore::features::process::ExitStatus"]],["impl UnwindSafe for Utmpx",1,["uucore::features::utmpx::Utmpx"]],["impl UnwindSafe for UtmpxIter",1,["uucore::features::utmpx::UtmpxIter"]],["impl UnwindSafe for BackupMode",1,["uucore::mods::backup_control::BackupMode"]],["impl UnwindSafe for BackupError",1,["uucore::mods::backup_control::BackupError"]],["impl UnwindSafe for USimpleError",1,["uucore::mods::error::USimpleError"]],["impl UnwindSafe for UUsageError",1,["uucore::mods::error::UUsageError"]],["impl !UnwindSafe for UIoError",1,["uucore::mods::error::UIoError"]],["impl UnwindSafe for ExitCode",1,["uucore::mods::error::ExitCode"]],["impl !UnwindSafe for ClapErrorWrapper",1,["uucore::mods::error::ClapErrorWrapper"]],["impl UnwindSafe for Range",1,["uucore::mods::ranges::Range"]],["impl UnwindSafe for QuotingStyle",1,["uucore::mods::quoting_style::QuotingStyle"]],["impl UnwindSafe for Quotes",1,["uucore::mods::quoting_style::Quotes"]],["impl UnwindSafe for ParseSizeError",1,["uucore::parser::parse_size::ParseSizeError"]]], +"uudoc":[["impl<'a, 'b> !UnwindSafe for MDWriter<'a, 'b>",1,["uudoc::MDWriter"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/core/str/traits/trait.FromStr.js b/dev/implementors/core/str/traits/trait.FromStr.js index c9fb8f722..a7bbb24a2 100644 --- a/dev/implementors/core/str/traits/trait.FromStr.js +++ b/dev/implementors/core/str/traits/trait.FromStr.js @@ -1,5 +1,5 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl FromStr for Attribute","synthetic":false,"types":["uu_cp::Attribute"]}]; -implementors["uu_numfmt"] = [{"text":"impl FromStr for FormatOptions","synthetic":false,"types":["uu_numfmt::options::FormatOptions"]}]; -implementors["uucore"] = [{"text":"impl FromStr for Range","synthetic":false,"types":["uucore::mods::ranges::Range"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl FromStr for Attribute"]], +"uu_numfmt":[["impl FromStr for FormatOptions"]], +"uucore":[["impl FromStr for Range"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/os_display/native/trait.Quotable.js b/dev/implementors/os_display/native/trait.Quotable.js index d853d3b38..8fd88546f 100644 --- a/dev/implementors/os_display/native/trait.Quotable.js +++ b/dev/implementors/os_display/native/trait.Quotable.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uucore"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uucore":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/std/error/trait.Error.js b/dev/implementors/std/error/trait.Error.js deleted file mode 100644 index eb40d0767..000000000 --- a/dev/implementors/std/error/trait.Error.js +++ /dev/null @@ -1,5 +0,0 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl Error for Error","synthetic":false,"types":["uu_cp::Error"]}]; -implementors["uu_numfmt"] = [{"text":"impl Error for NumfmtError","synthetic":false,"types":["uu_numfmt::errors::NumfmtError"]}]; -implementors["uucore"] = [{"text":"impl Error for DecodeError","synthetic":false,"types":["uucore::features::encoding::DecodeError"]},{"text":"impl Error for BackupError","synthetic":false,"types":["uucore::mods::backup_control::BackupError"]},{"text":"impl Error for USimpleError","synthetic":false,"types":["uucore::mods::error::USimpleError"]},{"text":"impl Error for UUsageError","synthetic":false,"types":["uucore::mods::error::UUsageError"]},{"text":"impl Error for UIoError","synthetic":false,"types":["uucore::mods::error::UIoError"]},{"text":"impl Error for ExitCode","synthetic":false,"types":["uucore::mods::error::ExitCode"]},{"text":"impl Error for ClapErrorWrapper","synthetic":false,"types":["uucore::mods::error::ClapErrorWrapper"]},{"text":"impl Error for ParseSizeError","synthetic":false,"types":["uucore::parser::parse_size::ParseSizeError"]}]; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uu_dircolors/trait.StrUtils.js b/dev/implementors/uu_dircolors/trait.StrUtils.js index 3212f81f6..a305abeab 100644 --- a/dev/implementors/uu_dircolors/trait.StrUtils.js +++ b/dev/implementors/uu_dircolors/trait.StrUtils.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uu_dircolors"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_dircolors":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uu_pinky/trait.Capitalize.js b/dev/implementors/uu_pinky/trait.Capitalize.js index 5716a7f4b..9ad85875d 100644 --- a/dev/implementors/uu_pinky/trait.Capitalize.js +++ b/dev/implementors/uu_pinky/trait.Capitalize.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uu_pinky"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_pinky":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uu_stat/trait.ScanUtil.js b/dev/implementors/uu_stat/trait.ScanUtil.js index ebdd4368b..aafcd8738 100644 --- a/dev/implementors/uu_stat/trait.ScanUtil.js +++ b/dev/implementors/uu_stat/trait.ScanUtil.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uu_stat"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_stat":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uucore/features/entries/trait.Locate.js b/dev/implementors/uucore/features/entries/trait.Locate.js index f18336bf9..bfafd3517 100644 --- a/dev/implementors/uucore/features/entries/trait.Locate.js +++ b/dev/implementors/uucore/features/entries/trait.Locate.js @@ -1,5 +1,5 @@ -(function() {var implementors = {}; -implementors["uu_chgrp"] = []; -implementors["uu_chown"] = []; -implementors["uucore"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_chgrp":[], +"uu_chown":[], +"uucore":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uucore/features/fsext/trait.BirthTime.js b/dev/implementors/uucore/features/fsext/trait.BirthTime.js index d853d3b38..8fd88546f 100644 --- a/dev/implementors/uucore/features/fsext/trait.BirthTime.js +++ b/dev/implementors/uucore/features/fsext/trait.BirthTime.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uucore"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uucore":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uucore/features/fsext/trait.FsMeta.js b/dev/implementors/uucore/features/fsext/trait.FsMeta.js index d853d3b38..8fd88546f 100644 --- a/dev/implementors/uucore/features/fsext/trait.FsMeta.js +++ b/dev/implementors/uucore/features/fsext/trait.FsMeta.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uucore"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uucore":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uucore/features/process/trait.ChildExt.js b/dev/implementors/uucore/features/process/trait.ChildExt.js index d853d3b38..8fd88546f 100644 --- a/dev/implementors/uucore/features/process/trait.ChildExt.js +++ b/dev/implementors/uucore/features/process/trait.ChildExt.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uucore"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uucore":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uucore/mods/error/trait.FromIo.js b/dev/implementors/uucore/mods/error/trait.FromIo.js index d853d3b38..8fd88546f 100644 --- a/dev/implementors/uucore/mods/error/trait.FromIo.js +++ b/dev/implementors/uucore/mods/error/trait.FromIo.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uucore"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uucore":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uucore/mods/error/trait.UClapError.js b/dev/implementors/uucore/mods/error/trait.UClapError.js index d853d3b38..8fd88546f 100644 --- a/dev/implementors/uucore/mods/error/trait.UClapError.js +++ b/dev/implementors/uucore/mods/error/trait.UClapError.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uucore"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uucore":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uucore/mods/error/trait.UError.js b/dev/implementors/uucore/mods/error/trait.UError.js index 04dc0b349..edbe7489a 100644 --- a/dev/implementors/uucore/mods/error/trait.UError.js +++ b/dev/implementors/uucore/mods/error/trait.UError.js @@ -1,5 +1,5 @@ -(function() {var implementors = {}; -implementors["uu_cp"] = [{"text":"impl UError for Error","synthetic":false,"types":["uu_cp::Error"]}]; -implementors["uu_numfmt"] = [{"text":"impl UError for NumfmtError","synthetic":false,"types":["uu_numfmt::errors::NumfmtError"]}]; -implementors["uucore"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uu_cp":[["impl UError for Error"]], +"uu_numfmt":[["impl UError for NumfmtError"]], +"uucore":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/implementors/uucore/trait.Args.js b/dev/implementors/uucore/trait.Args.js index d853d3b38..8fd88546f 100644 --- a/dev/implementors/uucore/trait.Args.js +++ b/dev/implementors/uucore/trait.Args.js @@ -1,3 +1,3 @@ -(function() {var implementors = {}; -implementors["uucore"] = []; -if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file +(function() {var implementors = { +"uucore":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/dev/install/all.html b/dev/install/all.html index 50fe12026..38bd9c81a 100644 --- a/dev/install/all.html +++ b/dev/install/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/install/fn.main.html b/dev/install/fn.main.html index ffb6d0734..bc89d8dd9 100644 --- a/dev/install/fn.main.html +++ b/dev/install/fn.main.html @@ -1 +1 @@ -main in install - Rust

Function install::main

source · []
pub fn main()
\ No newline at end of file +main in install - Rust

Function install::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/install/index.html b/dev/install/index.html index 5e2c25937..59f6086c8 100644 --- a/dev/install/index.html +++ b/dev/install/index.html @@ -1 +1 @@ -install - Rust
\ No newline at end of file +install - Rust
\ No newline at end of file diff --git a/dev/join/all.html b/dev/join/all.html index 92bf9a414..495b2c98b 100644 --- a/dev/join/all.html +++ b/dev/join/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/join/fn.main.html b/dev/join/fn.main.html index dde0cec61..1413f3b19 100644 --- a/dev/join/fn.main.html +++ b/dev/join/fn.main.html @@ -1 +1 @@ -main in join - Rust

Function join::main

source · []
pub fn main()
\ No newline at end of file +main in join - Rust

Function join::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/join/index.html b/dev/join/index.html index 2ee663d05..88c400834 100644 --- a/dev/join/index.html +++ b/dev/join/index.html @@ -1 +1 @@ -join - Rust
\ No newline at end of file +join - Rust
\ No newline at end of file diff --git a/dev/kill/all.html b/dev/kill/all.html index ba6d7f72b..f2ce06f31 100644 --- a/dev/kill/all.html +++ b/dev/kill/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/kill/fn.main.html b/dev/kill/fn.main.html index e297b84f9..96ed2e27c 100644 --- a/dev/kill/fn.main.html +++ b/dev/kill/fn.main.html @@ -1 +1 @@ -main in kill - Rust

Function kill::main

source · []
pub fn main()
\ No newline at end of file +main in kill - Rust

Function kill::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/kill/index.html b/dev/kill/index.html index 33a7f9fa9..b0747786f 100644 --- a/dev/kill/index.html +++ b/dev/kill/index.html @@ -1 +1 @@ -kill - Rust
\ No newline at end of file +kill - Rust
\ No newline at end of file diff --git a/dev/libstdbuf/all.html b/dev/libstdbuf/all.html index aa1be4055..fac156a7e 100644 --- a/dev/libstdbuf/all.html +++ b/dev/libstdbuf/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/libstdbuf/fn.__stdbuf.html b/dev/libstdbuf/fn.__stdbuf.html index bc7386f34..dd70247ff 100644 --- a/dev/libstdbuf/fn.__stdbuf.html +++ b/dev/libstdbuf/fn.__stdbuf.html @@ -1,4 +1,4 @@ -__stdbuf in libstdbuf - Rust
#[no_mangle]
+__stdbuf in libstdbuf - Rust
#[no_mangle]
 pub unsafe extern "C" fn __stdbuf()
Expand description

Safety

ToDO … (safety note)

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/libstdbuf/index.html b/dev/libstdbuf/index.html index c9f24c4fe..e2b58dd45 100644 --- a/dev/libstdbuf/index.html +++ b/dev/libstdbuf/index.html @@ -1,2 +1 @@ -libstdbuf - Rust
\ No newline at end of file +libstdbuf - Rust
\ No newline at end of file diff --git a/dev/light.css b/dev/light.css index a71085b0e..e5e394dde 100644 --- a/dev/light.css +++ b/dev/light.css @@ -1 +1 @@ -:root{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--sidebar-background-color:#F5F5F5;--sidebar-background-color-hover:#E0E0E0;--code-block-background-color:#F5F5F5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;}.slider{background-color:#ccc;}.slider:before{background-color:white;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}.in-band{background-color:white;}.rust-logo{}.sidebar .current,.sidebar a:hover{background-color:#fff;}.line-numbers span{color:#c67e2d;}.line-numbers .line-highlighted{background-color:#FDFFD3 !important;}.docblock table td,.docblock table th{border-color:#ddd;}.search-results a:hover{background-color:#ddd;}.search-results a:focus{color:#000 !important;background-color:#ccc;}.search-results a:focus span{color:#000 !important;}a.result-trait:focus{background-color:#c7b6ff;}a.result-traitalias:focus{background-color:#c7b6ff;}a.result-mod:focus,a.result-externcrate:focus{background-color:#afc6e4;}a.result-enum:focus{background-color:#e7b1a0;}a.result-struct:focus{background-color:#e7b1a0;}a.result-union:focus{background-color:#e7b1a0;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#c6afb3;}a.result-type:focus{background-color:#e7b1a0;}a.result-associatedtype:focus{background-color:#afc6e4;}a.result-foreigntype:focus{background-color:#e7b1a0;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#8ce488;}a.result-constant:focus,a.result-static:focus{background-color:#afc6e4;}a.result-primitive:focus{background-color:#e7b1a0;}a.result-keyword:focus{background-color:#afc6e4;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#AD378A;}.content span.struct,.content a.struct,.block a.current.struct{color:#AD378A;}.content span.type,.content a.type,.block a.current.type{color:#AD378A;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#3873AD;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#3873AD;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#068000;}.content span.union,.content a.union,.block a.current.union{color:#AD378A;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#3873AD;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#AD378A;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#3873AD;}.content span.trait,.content a.trait,.block a.current.trait{color:#6E4FC9;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#5137AD;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#AD7C37;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#3873AD;}.sidebar a{color:#356da4;}.sidebar a.current.enum{color:#a63283;}.sidebar a.current.struct{color:#a63283;}.sidebar a.current.type{color:#a63283;}.sidebar a.current.associatedtype{color:#356da4;}.sidebar a.current.foreigntype{color:#356da4;}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{color:#067901;}.sidebar a.current.union{color:#a63283;}.sidebar a.current.constant .sidebar a.current.static{color:#356da4;}.sidebar a.current.primitive{color:#a63283;}.sidebar a.current.externcrate .sidebar a.current.mod{color:#356da4;}.sidebar a.current.trait{color:#6849c3;}.sidebar a.current.traitalias{color:#4b349e;}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{color:#a67736;}.sidebar a.current.keyword{color:#356da4;}nav.main .current{border-top-color:#000;border-bottom-color:#000;}nav.main .separator{border:1px solid #000;}a{color:#3873AD;}body.source .example-wrap pre.rust a{background:#eee;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before{color:#999;}#crate-search,.search-input{background-color:white;border-color:#e0e0e0;}#crate-search{border-color:#e0e0e0 !important;}.search-input:focus{border-color:#66afe9;}.stab.empty-impl{background:#FFF5D6;border-color:#FFC600;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;}.stab.must_implement{background:#F3DFFF;border-color:#b07bdb;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;}.stab.portability>code{background:none;}.rightside,.out-of-band{color:grey;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#8959A8;}pre.rust .kw-2,pre.rust .prelude-ty{color:#4271AE;}pre.rust .number,pre.rust .string{color:#718C00;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#C82829;}pre.rust .comment{color:#8E908C;}pre.rust .doccomment{color:#4D4D4C;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#B76514;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#c7c7c7;}a.test-arrow{color:#f5f5f5;background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target{background:#FDFFD3;border-right:3px solid #AD7C37;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.5);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.5);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#3873AD;}.tooltip::after{background-color:#000;color:#fff;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#eee;border-color:#999;}.notable-traits-tooltiptext .notable{border-bottom-color:#DDDDDD;}#titles>button:not(.selected){background-color:#e6e6e6;border-top-color:#e6e6e6;}#titles>button:hover,#titles>button.selected{background-color:#ffffff;border-top-color:#0089ff;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-elems{border-right-color:#000;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow:inset 0 -1px 0 #c6cbd1;}#settings-menu>a,#help-button>button{border-color:#e0e0e0;background-color:#fff;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>button:hover,#help-button>button:focus{border-color:#717171;}.popover,.popover::before,#help-button span.top,#help-button span.bottom{border-color:#DDDDDD;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(35%);}#theme-choices{border-color:#ccc;background-color:#fff;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#eee;}.search-results .result-name span.alias{color:#000;}.search-results .result-name span.grey{color:#999;}#source-sidebar>.title{border-bottom-color:#ccc;}#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:#E0E0E0;}#source-sidebar div.files>a.selected{background-color:#fff;}.scraped-example-list .scrape-help{border-color:#555;color:#333;}.scraped-example-list .scrape-help:hover{border-color:black;color:black;}.more-examples-toggle summary,.more-examples-toggle .hide-more{color:#999;}.scraped-example .example-wrap .rust span.highlight{background:#fcffd6;}.scraped-example .example-wrap .rust span.highlight.focus{background:#f6fdb0;}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(255,255,255,1),rgba(255,255,255,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(255,255,255,1),rgba(255,255,255,0));}.toggle-line-inner{background:#ccc;}.toggle-line:hover .toggle-line-inner{background:#999;} \ No newline at end of file +:root{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--sidebar-background-color:#F5F5F5;--sidebar-background-color-hover:#E0E0E0;--code-block-background-color:#F5F5F5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;}.slider{background-color:#ccc;}.slider:before{background-color:white;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}.rust-logo{}.sidebar .current,.sidebar a:hover{background-color:#fff;}.line-numbers span{color:#c67e2d;}.line-numbers .line-highlighted{background-color:#FDFFD3 !important;}.search-results a:hover{background-color:#ddd;}.search-results a:focus{color:#000 !important;background-color:#ccc;}.search-results a:focus span{color:#000 !important;}a.result-trait:focus{background-color:#c7b6ff;}a.result-traitalias:focus{background-color:#c7b6ff;}a.result-mod:focus,a.result-externcrate:focus{background-color:#afc6e4;}a.result-enum:focus{background-color:#e7b1a0;}a.result-struct:focus{background-color:#e7b1a0;}a.result-union:focus{background-color:#e7b1a0;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#c6afb3;}a.result-type:focus{background-color:#e7b1a0;}a.result-associatedtype:focus{background-color:#afc6e4;}a.result-foreigntype:focus{background-color:#e7b1a0;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#8ce488;}a.result-constant:focus,a.result-static:focus{background-color:#afc6e4;}a.result-primitive:focus{background-color:#e7b1a0;}a.result-keyword:focus{background-color:#afc6e4;}.content .item-info::before{color:#ccc;}.sidebar a{color:#356da4;}.sidebar a.current.enum{color:#a63283;}.sidebar a.current.struct{color:#a63283;}.sidebar a.current.type{color:#a63283;}.sidebar a.current.foreigntype{color:#356da4;}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{color:#067901;}.sidebar a.current.union{color:#a63283;}.sidebar a.current.constant .sidebar a.current.static{color:#356da4;}.sidebar a.current.primitive{color:#a63283;}.sidebar a.current.trait{color:#6849c3;}.sidebar a.current.traitalias{color:#4b349e;}.sidebar a.current.fn{color:#a67736;}.sidebar a.current.keyword{color:#356da4;}body.source .example-wrap pre.rust a{background:#eee;}#crate-search-div::after{filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);}#crate-search:hover,#crate-search:focus{border-color:#717171 !important;}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);}.stab{background:#FFF5D6;border-color:#FFC600;}.stab.portability>code{background:none;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#8959A8;}pre.rust .kw-2,pre.rust .prelude-ty{color:#4271AE;}pre.rust .number,pre.rust .string{color:#718C00;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute{color:#C82829;}pre.rust .comment{color:#8E908C;}pre.rust .doccomment{color:#4D4D4C;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#B76514;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#c7c7c7;}a.test-arrow{color:#f5f5f5;background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}:target{background:#FDFFD3;border-right:3px solid #AD7C37;}.search-failed a{color:#3873AD;}.tooltip::after{background-color:#000;color:#fff;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#eee;}#titles>button:not(.selected){background-color:#e6e6e6;border-top-color:#e6e6e6;}#titles>button:hover,#titles>button.selected{background-color:#ffffff;border-top-color:#0089ff;}#titles>button>div.count{color:#888;}kbd{color:#000;background-color:#fafbfc;box-shadow:inset 0 -1px 0 #c6cbd1;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>button:hover,#help-button>button:focus{border-color:#717171;}.search-results .result-name span.alias{color:#000;}.search-results .result-name span.grey{color:#999;}#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:#E0E0E0;}#source-sidebar div.files>a.selected{background-color:#fff;}.scraped-example-list .scrape-help{border-color:#555;color:#333;}.scraped-example-list .scrape-help:hover{border-color:black;color:black;}.scraped-example .example-wrap .rust span.highlight{background:#fcffd6;}.scraped-example .example-wrap .rust span.highlight.focus{background:#f6fdb0;}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(255,255,255,1),rgba(255,255,255,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(255,255,255,1),rgba(255,255,255,0));}.toggle-line-inner{background:#ccc;}.toggle-line:hover .toggle-line-inner{background:#999;} \ No newline at end of file diff --git a/dev/link/all.html b/dev/link/all.html index 4dc090cad..c9a65abf7 100644 --- a/dev/link/all.html +++ b/dev/link/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/link/fn.main.html b/dev/link/fn.main.html index b34eccd1b..d48513333 100644 --- a/dev/link/fn.main.html +++ b/dev/link/fn.main.html @@ -1 +1 @@ -main in link - Rust

Function link::main

source · []
pub fn main()
\ No newline at end of file +main in link - Rust

Function link::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/link/index.html b/dev/link/index.html index 98b5420f1..3c0f9b5be 100644 --- a/dev/link/index.html +++ b/dev/link/index.html @@ -1 +1 @@ -link - Rust
\ No newline at end of file +link - Rust
\ No newline at end of file diff --git a/dev/ln/all.html b/dev/ln/all.html index eb531405d..4ec187fe6 100644 --- a/dev/ln/all.html +++ b/dev/ln/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/ln/fn.main.html b/dev/ln/fn.main.html index b578c3783..71099486f 100644 --- a/dev/ln/fn.main.html +++ b/dev/ln/fn.main.html @@ -1 +1 @@ -main in ln - Rust

Function ln::main

source · []
pub fn main()
\ No newline at end of file +main in ln - Rust

Function ln::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/ln/index.html b/dev/ln/index.html index 4d65e52bc..de4e64687 100644 --- a/dev/ln/index.html +++ b/dev/ln/index.html @@ -1 +1 @@ -ln - Rust
\ No newline at end of file +ln - Rust
\ No newline at end of file diff --git a/dev/logname/all.html b/dev/logname/all.html index 5750f7627..32e249f53 100644 --- a/dev/logname/all.html +++ b/dev/logname/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/logname/fn.main.html b/dev/logname/fn.main.html index e8f8fdf5f..ba4401f34 100644 --- a/dev/logname/fn.main.html +++ b/dev/logname/fn.main.html @@ -1 +1 @@ -main in logname - Rust

Function logname::main

source · []
pub fn main()
\ No newline at end of file +main in logname - Rust

Function logname::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/logname/index.html b/dev/logname/index.html index e451cc646..75f5b8452 100644 --- a/dev/logname/index.html +++ b/dev/logname/index.html @@ -1 +1 @@ -logname - Rust
\ No newline at end of file +logname - Rust
\ No newline at end of file diff --git a/dev/ls/all.html b/dev/ls/all.html index e96b6f75d..9ffa4b887 100644 --- a/dev/ls/all.html +++ b/dev/ls/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/ls/fn.main.html b/dev/ls/fn.main.html index 57bc57e95..5e3059006 100644 --- a/dev/ls/fn.main.html +++ b/dev/ls/fn.main.html @@ -1 +1 @@ -main in ls - Rust

Function ls::main

source · []
pub fn main()
\ No newline at end of file +main in ls - Rust

Function ls::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/ls/index.html b/dev/ls/index.html index e3e273380..d80c508ce 100644 --- a/dev/ls/index.html +++ b/dev/ls/index.html @@ -1 +1 @@ -ls - Rust
\ No newline at end of file +ls - Rust
\ No newline at end of file diff --git a/dev/main.js b/dev/main.js index c2141ac55..2981663db 100644 --- a/dev/main.js +++ b/dev/main.js @@ -1,4 +1,4 @@ -"use strict";function getVar(name){const el=document.getElementById("rustdoc-vars");if(el){return el.attributes["data-"+name].value}else{return null}}function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}function elemIsInParent(elem,parent){while(elem&&elem!==document.body){if(elem===parent){return true}elem=elem.parentElement}return false}function blurHandler(event,parentElem,hideCallback){if(!elemIsInParent(document.activeElement,parentElem)&&!elemIsInParent(event.relatedTarget,parentElem)){hideCallback()}}(function(){window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate")}());function setMobileTopbar(){const mobileLocationTitle=document.querySelector(".mobile-topbar h2.location");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileLocationTitle&&locationTitle){mobileLocationTitle.innerHTML=locationTitle.innerHTML}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function loadCss(cssFileName){const link=document.createElement("link");link.href=resourcePath(cssFileName,".css");link.type="text/css";link.rel="stylesheet";document.getElementsByTagName("head")[0].appendChild(link)}(function(){function loadScript(url){const script=document.createElement("script");script.src=url;document.head.append(script)}getSettingsButton().onclick=event=>{addClass(getSettingsButton(),"rotate");event.preventDefault();loadCss("settings");loadScript(resourcePath("settings",".js"))};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},hideResults:()=>{switchDisplayedElement(null);document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(resourcePath("search",".js"));loadScript(resourcePath("search-index",".js"))}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){const search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search);loadSearch()}},};function getPageId(){if(window.location.hash){const tmp=window.location.hash.replace(/^#/,"");if(tmp.length>0){return tmp}}return null}const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}expandSection(savedHash.slice(1))}}function onHashChange(ev){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown");handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function handleEscape(ev){searchState.clearInputTimeout();switchDisplayedElement(null);if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}ev.preventDefault();searchState.defocus();window.hidePopoverMenus()}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":ev.preventDefault();searchState.focus();break;case"+":case"-":ev.preventDefault();toggleAllDocs();break;case"?":showHelp();break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const div=document.createElement("div");div.className="block "+shortty;const h3=document.createElement("h3");h3.innerHTML=`${longty}`;div.appendChild(h3);const ul=document.createElement("ul");for(const item of filtered){const name=item[0];const desc=item[1];let klass=shortty;let path;if(shortty==="mod"){path=name+"/index.html"}else{path=shortty+"."+name+".html"}const current_page=document.location.href.split("/").pop();if(path===current_page){klass+=" current"}const link=document.createElement("a");link.href=path;link.title=desc;link.className=klass;link.textContent=name;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}div.appendChild(ul);sidebar.appendChild(div)}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("union","unions","Unions");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Definitions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("traitalias","trait-aliases","Trait Aliases")}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector("h1.fqn > .in-band > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const ignoreExternCrates=document.querySelector("script[data-ignore-extern-crates]").getAttribute("data-ignore-extern-crates");for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.indexOf(lib)!==-1){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct.synthetic?synthetic_implementors:implementors;if(struct.synthetic){for(const struct_type of struct.types){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct.text;addClass(code,"code-header");addClass(code,"in-band");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&href.indexOf("http")!==0){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const div=document.createElement("div");div.className="block crate";div.innerHTML="

Crates

";const ul=document.createElement("ul");div.appendChild(ul);for(const crate of window.ALL_CRATES){let klass="crate";if(window.rootPath!=="./"&&crate===window.currentCrate){klass+=" current"}const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";link.className=klass;link.textContent=crate;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(div)}function labelForToggleButton(sectionIsCollapsed){if(sectionIsCollapsed){return"+"}return"\u2212"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}let sectionIsCollapsed=false;if(hasClass(innerToggle,"will-expand")){removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("rustdoc-toggle"),e=>{if(!hasClass(e,"type-contents-toggle")){e.open=true}});innerToggle.title="collapse all docs"}else{addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("rustdoc-toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});sectionIsCollapsed=true;innerToggle.title="expand all docs"}innerToggle.children[0].innerText=labelForToggleButton(sectionIsCollapsed)}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("rustdoc-toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}});const pageId=getPageId();if(pageId!==null){expandSection(pageId)}}());(function(){let lineNumbersFunc=()=>{};if(getSettingValue("line-numbers")==="true"){lineNumbersFunc=x=>{const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{if(hasClass(e,"compile_fail")){e.addEventListener("mouseover",function(){this.parentElement.previousElementSibling.childNodes[0].style.color="#f00"});e.addEventListener("mouseout",function(){this.parentElement.previousElementSibling.childNodes[0].style.color=""})}else if(hasClass(e,"ignore")){e.addEventListener("mouseover",function(){this.parentElement.previousElementSibling.childNodes[0].style.color="#ff9200"});e.addEventListener("mouseout",function(){this.parentElement.previousElementSibling.childNodes[0].style.color=""})}lineNumbersFunc(e)})}());function hideSidebar(){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown")}function handleClick(id,f){const elem=document.getElementById(id);if(elem){elem.addEventListener("click",f)}}handleClick(MAIN_ID,()=>{hideSidebar()});onEachLazy(document.getElementsByTagName("a"),el=>{if(el.hash){el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})}});onEachLazy(document.querySelectorAll(".rustdoc-toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});onEachLazy(document.getElementsByClassName("notable-traits"),e=>{e.onclick=function(){this.getElementsByClassName("notable-traits-tooltiptext")[0].classList.toggle("force-tooltip")}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){addClass(sidebar,"shown")}else{removeClass(sidebar,"shown")}})}function helpBlurHandler(event){blurHandler(event,getHelpButton(),window.hidePopoverMenus)}function buildHelpMenu(){const book_info=document.createElement("span");book_info.className="top";book_info.innerHTML="You can find more information in \ +"use strict";function getVar(name){const el=document.getElementById("rustdoc-vars");if(el){return el.attributes["data-"+name].value}else{return null}}function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}function elemIsInParent(elem,parent){while(elem&&elem!==document.body){if(elem===parent){return true}elem=elem.parentElement}return false}function blurHandler(event,parentElem,hideCallback){if(!elemIsInParent(document.activeElement,parentElem)&&!elemIsInParent(event.relatedTarget,parentElem)){hideCallback()}}(function(){window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate")}());function setMobileTopbar(){const mobileLocationTitle=document.querySelector(".mobile-topbar h2.location");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileLocationTitle&&locationTitle){mobileLocationTitle.innerHTML=locationTitle.innerHTML}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function loadCss(cssFileName){const link=document.createElement("link");link.href=resourcePath(cssFileName,".css");link.type="text/css";link.rel="stylesheet";document.getElementsByTagName("head")[0].appendChild(link)}(function(){function loadScript(url){const script=document.createElement("script");script.src=url;document.head.append(script)}getSettingsButton().onclick=event=>{addClass(getSettingsButton(),"rotate");event.preventDefault();loadCss("settings");loadScript(resourcePath("settings",".js"))};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},hideResults:()=>{switchDisplayedElement(null);document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(resourcePath("search",".js"));loadScript(resourcePath("search-index",".js"))}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){const search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search);loadSearch()}},};function getPageId(){if(window.location.hash){const tmp=window.location.hash.replace(/^#/,"");if(tmp.length>0){return tmp}}return null}const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}expandSection(savedHash.slice(1))}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function handleEscape(ev){searchState.clearInputTimeout();switchDisplayedElement(null);if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}ev.preventDefault();searchState.defocus();window.hidePopoverMenus()}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":ev.preventDefault();searchState.focus();break;case"+":case"-":ev.preventDefault();toggleAllDocs();break;case"?":showHelp();break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const div=document.createElement("div");div.className="block "+shortty;const h3=document.createElement("h3");h3.innerHTML=`${longty}`;div.appendChild(h3);const ul=document.createElement("ul");for(const item of filtered){const name=item[0];const desc=item[1];let klass=shortty;let path;if(shortty==="mod"){path=name+"/index.html"}else{path=shortty+"."+name+".html"}const current_page=document.location.href.split("/").pop();if(path===current_page){klass+=" current"}const link=document.createElement("a");link.href=path;link.title=desc;link.className=klass;link.textContent=name;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}div.appendChild(ul);sidebar.appendChild(div)}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("union","unions","Unions");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Definitions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("traitalias","trait-aliases","Trait Aliases")}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();const TEXT_IDX=0;const SYNTHETIC_IDX=1;const TYPES_IDX=2;if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector("h1.fqn > .in-band > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const script=document.querySelector("script[data-ignore-extern-crates]");const ignoreExternCrates=script?script.getAttribute("data-ignore-extern-crates"):"";for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.indexOf(lib)!==-1){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct[SYNTHETIC_IDX]?synthetic_implementors:implementors;if(struct[SYNTHETIC_IDX]){for(const struct_type of struct[TYPES_IDX]){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct[TEXT_IDX];addClass(code,"code-header");addClass(code,"in-band");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&href.indexOf("http")!==0){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const div=document.createElement("div");div.className="block crate";div.innerHTML="

Crates

";const ul=document.createElement("ul");div.appendChild(ul);for(const crate of window.ALL_CRATES){let klass="crate";if(window.rootPath!=="./"&&crate===window.currentCrate){klass+=" current"}const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";link.className=klass;link.textContent=crate;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(div)}function labelForToggleButton(sectionIsCollapsed){if(sectionIsCollapsed){return"+"}return"\u2212"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}let sectionIsCollapsed=false;if(hasClass(innerToggle,"will-expand")){removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("rustdoc-toggle"),e=>{if(!hasClass(e,"type-contents-toggle")){e.open=true}});innerToggle.title="collapse all docs"}else{addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("rustdoc-toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});sectionIsCollapsed=true;innerToggle.title="expand all docs"}innerToggle.children[0].innerText=labelForToggleButton(sectionIsCollapsed)}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("rustdoc-toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}});const pageId=getPageId();if(pageId!==null){expandSection(pageId)}}());(function(){if(getSettingValue("line-numbers")==="true"){onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{if(window.innerWidth>=window.RUSTDOC_MOBILE_BREAKPOINT&&oldSidebarScrollPosition!==null){hideSidebar()}});function handleClick(id,f){const elem=document.getElementById(id);if(elem){elem.addEventListener("click",f)}}handleClick(MAIN_ID,()=>{hideSidebar()});onEachLazy(document.getElementsByTagName("a"),el=>{if(el.hash){el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})}});onEachLazy(document.querySelectorAll(".rustdoc-toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});onEachLazy(document.getElementsByClassName("notable-traits"),e=>{e.onclick=function(){this.getElementsByClassName("notable-traits-tooltiptext")[0].classList.toggle("force-tooltip")}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){showSidebar()}else{hideSidebar()}})}function helpBlurHandler(event){blurHandler(event,getHelpButton(),window.hidePopoverMenus)}function buildHelpMenu(){const book_info=document.createElement("span");book_info.className="top";book_info.innerHTML="You can find more information in \ the rustdoc book.";const shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
"+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
"+x[1]+"
").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";const infos=["Prefix searches with a type followed by a colon (e.g., fn:) to \ restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ enum, trait, type, macro, \ diff --git a/dev/mkdir/all.html b/dev/mkdir/all.html index dedb0790a..d61845f5f 100644 --- a/dev/mkdir/all.html +++ b/dev/mkdir/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/mkdir/fn.main.html b/dev/mkdir/fn.main.html index 28ccd78bb..e11fca36c 100644 --- a/dev/mkdir/fn.main.html +++ b/dev/mkdir/fn.main.html @@ -1 +1 @@ -main in mkdir - Rust

Function mkdir::main

source · []
pub fn main()
\ No newline at end of file +main in mkdir - Rust

Function mkdir::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/mkdir/index.html b/dev/mkdir/index.html index 5a3aec6f2..42acea904 100644 --- a/dev/mkdir/index.html +++ b/dev/mkdir/index.html @@ -1 +1 @@ -mkdir - Rust
\ No newline at end of file +mkdir - Rust
\ No newline at end of file diff --git a/dev/mkfifo/all.html b/dev/mkfifo/all.html index c51cb682f..32d5bd9a4 100644 --- a/dev/mkfifo/all.html +++ b/dev/mkfifo/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/mkfifo/fn.main.html b/dev/mkfifo/fn.main.html index 77d2828f8..0eb51b70b 100644 --- a/dev/mkfifo/fn.main.html +++ b/dev/mkfifo/fn.main.html @@ -1 +1 @@ -main in mkfifo - Rust

Function mkfifo::main

source · []
pub fn main()
\ No newline at end of file +main in mkfifo - Rust

Function mkfifo::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/mkfifo/index.html b/dev/mkfifo/index.html index 3c90c10ec..6ff0267a8 100644 --- a/dev/mkfifo/index.html +++ b/dev/mkfifo/index.html @@ -1 +1 @@ -mkfifo - Rust
\ No newline at end of file +mkfifo - Rust
\ No newline at end of file diff --git a/dev/mknod/all.html b/dev/mknod/all.html index 347192b61..3cb043e84 100644 --- a/dev/mknod/all.html +++ b/dev/mknod/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/mknod/fn.main.html b/dev/mknod/fn.main.html index e55460541..993bf468d 100644 --- a/dev/mknod/fn.main.html +++ b/dev/mknod/fn.main.html @@ -1 +1 @@ -main in mknod - Rust

Function mknod::main

source · []
pub fn main()
\ No newline at end of file +main in mknod - Rust

Function mknod::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/mknod/index.html b/dev/mknod/index.html index 7d3dde67c..92dc15d3d 100644 --- a/dev/mknod/index.html +++ b/dev/mknod/index.html @@ -1 +1 @@ -mknod - Rust
\ No newline at end of file +mknod - Rust
\ No newline at end of file diff --git a/dev/mktemp/all.html b/dev/mktemp/all.html index ef1073df3..1b57710d0 100644 --- a/dev/mktemp/all.html +++ b/dev/mktemp/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/mktemp/fn.main.html b/dev/mktemp/fn.main.html index 3dcfb19a2..ee400783d 100644 --- a/dev/mktemp/fn.main.html +++ b/dev/mktemp/fn.main.html @@ -1 +1 @@ -main in mktemp - Rust

Function mktemp::main

source · []
pub fn main()
\ No newline at end of file +main in mktemp - Rust

Function mktemp::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/mktemp/index.html b/dev/mktemp/index.html index c74f24106..efdc1a8c0 100644 --- a/dev/mktemp/index.html +++ b/dev/mktemp/index.html @@ -1 +1 @@ -mktemp - Rust
\ No newline at end of file +mktemp - Rust
\ No newline at end of file diff --git a/dev/more/all.html b/dev/more/all.html index fe172a96e..2aa9fc5dd 100644 --- a/dev/more/all.html +++ b/dev/more/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/more/fn.main.html b/dev/more/fn.main.html index 300345a61..24ade72d1 100644 --- a/dev/more/fn.main.html +++ b/dev/more/fn.main.html @@ -1 +1 @@ -main in more - Rust

Function more::main

source · []
pub fn main()
\ No newline at end of file +main in more - Rust

Function more::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/more/index.html b/dev/more/index.html index c22ee7db7..fd96851a2 100644 --- a/dev/more/index.html +++ b/dev/more/index.html @@ -1 +1 @@ -more - Rust
\ No newline at end of file +more - Rust
\ No newline at end of file diff --git a/dev/mv/all.html b/dev/mv/all.html index b528938aa..38d4a7c97 100644 --- a/dev/mv/all.html +++ b/dev/mv/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/mv/fn.main.html b/dev/mv/fn.main.html index ac950e9fb..c5f842d29 100644 --- a/dev/mv/fn.main.html +++ b/dev/mv/fn.main.html @@ -1 +1 @@ -main in mv - Rust

Function mv::main

source · []
pub fn main()
\ No newline at end of file +main in mv - Rust

Function mv::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/mv/index.html b/dev/mv/index.html index 27cee501a..418ecb5dd 100644 --- a/dev/mv/index.html +++ b/dev/mv/index.html @@ -1 +1 @@ -mv - Rust
\ No newline at end of file +mv - Rust
\ No newline at end of file diff --git a/dev/nice/all.html b/dev/nice/all.html index e405e0ac7..d51343b58 100644 --- a/dev/nice/all.html +++ b/dev/nice/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/nice/fn.main.html b/dev/nice/fn.main.html index ae0315e0a..e3ab6dfb1 100644 --- a/dev/nice/fn.main.html +++ b/dev/nice/fn.main.html @@ -1 +1 @@ -main in nice - Rust

Function nice::main

source · []
pub fn main()
\ No newline at end of file +main in nice - Rust

Function nice::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/nice/index.html b/dev/nice/index.html index b214b4bdd..cecde1ce7 100644 --- a/dev/nice/index.html +++ b/dev/nice/index.html @@ -1 +1 @@ -nice - Rust
\ No newline at end of file +nice - Rust
\ No newline at end of file diff --git a/dev/nl/all.html b/dev/nl/all.html index d9d4fbd41..877eabb14 100644 --- a/dev/nl/all.html +++ b/dev/nl/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/nl/fn.main.html b/dev/nl/fn.main.html index d95fab9ae..26de8401b 100644 --- a/dev/nl/fn.main.html +++ b/dev/nl/fn.main.html @@ -1 +1 @@ -main in nl - Rust

Function nl::main

source · []
pub fn main()
\ No newline at end of file +main in nl - Rust

Function nl::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/nl/index.html b/dev/nl/index.html index 526df2571..7ccf3c06b 100644 --- a/dev/nl/index.html +++ b/dev/nl/index.html @@ -1 +1 @@ -nl - Rust
\ No newline at end of file +nl - Rust
\ No newline at end of file diff --git a/dev/nohup/all.html b/dev/nohup/all.html index a43a8eb8a..2d8471ac3 100644 --- a/dev/nohup/all.html +++ b/dev/nohup/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/nohup/fn.main.html b/dev/nohup/fn.main.html index 66dc36ab7..8445120a5 100644 --- a/dev/nohup/fn.main.html +++ b/dev/nohup/fn.main.html @@ -1 +1 @@ -main in nohup - Rust

Function nohup::main

source · []
pub fn main()
\ No newline at end of file +main in nohup - Rust

Function nohup::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/nohup/index.html b/dev/nohup/index.html index 858498f9c..b97e22c52 100644 --- a/dev/nohup/index.html +++ b/dev/nohup/index.html @@ -1 +1 @@ -nohup - Rust
\ No newline at end of file +nohup - Rust
\ No newline at end of file diff --git a/dev/nproc/all.html b/dev/nproc/all.html index 40cefa8cf..75fe6c2fe 100644 --- a/dev/nproc/all.html +++ b/dev/nproc/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/nproc/fn.main.html b/dev/nproc/fn.main.html index 82d294ebd..8698730cc 100644 --- a/dev/nproc/fn.main.html +++ b/dev/nproc/fn.main.html @@ -1 +1 @@ -main in nproc - Rust

Function nproc::main

source · []
pub fn main()
\ No newline at end of file +main in nproc - Rust

Function nproc::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/nproc/index.html b/dev/nproc/index.html index b10a4037c..12506ba9f 100644 --- a/dev/nproc/index.html +++ b/dev/nproc/index.html @@ -1 +1 @@ -nproc - Rust
\ No newline at end of file +nproc - Rust
\ No newline at end of file diff --git a/dev/numfmt/all.html b/dev/numfmt/all.html index 84bb5a764..949e1d2bd 100644 --- a/dev/numfmt/all.html +++ b/dev/numfmt/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/numfmt/fn.main.html b/dev/numfmt/fn.main.html index f398a5ebc..f4fb06ec8 100644 --- a/dev/numfmt/fn.main.html +++ b/dev/numfmt/fn.main.html @@ -1 +1 @@ -main in numfmt - Rust

Function numfmt::main

source · []
pub fn main()
\ No newline at end of file +main in numfmt - Rust

Function numfmt::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/numfmt/index.html b/dev/numfmt/index.html index 15c751c5f..925647c4a 100644 --- a/dev/numfmt/index.html +++ b/dev/numfmt/index.html @@ -1 +1 @@ -numfmt - Rust
\ No newline at end of file +numfmt - Rust
\ No newline at end of file diff --git a/dev/od/all.html b/dev/od/all.html index f9bcc3567..f7cd265b9 100644 --- a/dev/od/all.html +++ b/dev/od/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/od/fn.main.html b/dev/od/fn.main.html index 00189ac34..af888e4d1 100644 --- a/dev/od/fn.main.html +++ b/dev/od/fn.main.html @@ -1 +1 @@ -main in od - Rust

Function od::main

source · []
pub fn main()
\ No newline at end of file +main in od - Rust

Function od::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/od/index.html b/dev/od/index.html index 2a7162294..26b95eadf 100644 --- a/dev/od/index.html +++ b/dev/od/index.html @@ -1 +1 @@ -od - Rust
\ No newline at end of file +od - Rust
\ No newline at end of file diff --git a/dev/paste/all.html b/dev/paste/all.html index 2277ad78d..85544d63c 100644 --- a/dev/paste/all.html +++ b/dev/paste/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/paste/fn.main.html b/dev/paste/fn.main.html index d6dd0bebd..1c3c638c6 100644 --- a/dev/paste/fn.main.html +++ b/dev/paste/fn.main.html @@ -1 +1 @@ -main in paste - Rust

Function paste::main

source · []
pub fn main()
\ No newline at end of file +main in paste - Rust

Function paste::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/paste/index.html b/dev/paste/index.html index 92f209009..78c326e44 100644 --- a/dev/paste/index.html +++ b/dev/paste/index.html @@ -1 +1 @@ -paste - Rust
\ No newline at end of file +paste - Rust
\ No newline at end of file diff --git a/dev/pathchk/all.html b/dev/pathchk/all.html index b6d688f4d..d338a33f8 100644 --- a/dev/pathchk/all.html +++ b/dev/pathchk/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/pathchk/fn.main.html b/dev/pathchk/fn.main.html index 5b13522f8..8f24801a9 100644 --- a/dev/pathchk/fn.main.html +++ b/dev/pathchk/fn.main.html @@ -1 +1 @@ -main in pathchk - Rust

Function pathchk::main

source · []
pub fn main()
\ No newline at end of file +main in pathchk - Rust

Function pathchk::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/pathchk/index.html b/dev/pathchk/index.html index 965deeac8..a9a6b54f4 100644 --- a/dev/pathchk/index.html +++ b/dev/pathchk/index.html @@ -1 +1 @@ -pathchk - Rust
\ No newline at end of file +pathchk - Rust
\ No newline at end of file diff --git a/dev/pinky/all.html b/dev/pinky/all.html index 92627ef76..cc5c1142d 100644 --- a/dev/pinky/all.html +++ b/dev/pinky/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/pinky/fn.main.html b/dev/pinky/fn.main.html index 2a375911a..fb89ead2e 100644 --- a/dev/pinky/fn.main.html +++ b/dev/pinky/fn.main.html @@ -1 +1 @@ -main in pinky - Rust

Function pinky::main

source · []
pub fn main()
\ No newline at end of file +main in pinky - Rust

Function pinky::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/pinky/index.html b/dev/pinky/index.html index 8387fcafb..564d768b1 100644 --- a/dev/pinky/index.html +++ b/dev/pinky/index.html @@ -1 +1 @@ -pinky - Rust
\ No newline at end of file +pinky - Rust
\ No newline at end of file diff --git a/dev/pr/all.html b/dev/pr/all.html index 2236e3287..a4596d9fc 100644 --- a/dev/pr/all.html +++ b/dev/pr/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/pr/fn.main.html b/dev/pr/fn.main.html index 787f80d19..573a7b800 100644 --- a/dev/pr/fn.main.html +++ b/dev/pr/fn.main.html @@ -1 +1 @@ -main in pr - Rust

Function pr::main

source · []
pub fn main()
\ No newline at end of file +main in pr - Rust

Function pr::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/pr/index.html b/dev/pr/index.html index e4a65b94a..c89ffe604 100644 --- a/dev/pr/index.html +++ b/dev/pr/index.html @@ -1 +1 @@ -pr - Rust
\ No newline at end of file +pr - Rust
\ No newline at end of file diff --git a/dev/printenv/all.html b/dev/printenv/all.html index 97ad46076..fb7bc4604 100644 --- a/dev/printenv/all.html +++ b/dev/printenv/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/printenv/fn.main.html b/dev/printenv/fn.main.html index a64241a9c..9f7003d99 100644 --- a/dev/printenv/fn.main.html +++ b/dev/printenv/fn.main.html @@ -1 +1 @@ -main in printenv - Rust
pub fn main()
\ No newline at end of file +main in printenv - Rust
pub fn main()
\ No newline at end of file diff --git a/dev/printenv/index.html b/dev/printenv/index.html index 29e2f3fa3..d074d52ec 100644 --- a/dev/printenv/index.html +++ b/dev/printenv/index.html @@ -1 +1 @@ -printenv - Rust
\ No newline at end of file +printenv - Rust
\ No newline at end of file diff --git a/dev/printf/all.html b/dev/printf/all.html index 9b7a87175..c2ecbd838 100644 --- a/dev/printf/all.html +++ b/dev/printf/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/printf/fn.main.html b/dev/printf/fn.main.html index 43c2629a0..bc8ad0c68 100644 --- a/dev/printf/fn.main.html +++ b/dev/printf/fn.main.html @@ -1 +1 @@ -main in printf - Rust

Function printf::main

source · []
pub fn main()
\ No newline at end of file +main in printf - Rust

Function printf::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/printf/index.html b/dev/printf/index.html index 557026816..dc012bb4b 100644 --- a/dev/printf/index.html +++ b/dev/printf/index.html @@ -1 +1 @@ -printf - Rust
\ No newline at end of file +printf - Rust
\ No newline at end of file diff --git a/dev/ptx/all.html b/dev/ptx/all.html index c00df5f55..42dc16116 100644 --- a/dev/ptx/all.html +++ b/dev/ptx/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/ptx/fn.main.html b/dev/ptx/fn.main.html index d0b2d08fb..91376a20b 100644 --- a/dev/ptx/fn.main.html +++ b/dev/ptx/fn.main.html @@ -1 +1 @@ -main in ptx - Rust

Function ptx::main

source · []
pub fn main()
\ No newline at end of file +main in ptx - Rust

Function ptx::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/ptx/index.html b/dev/ptx/index.html index 19cf962e5..f91b7b3c7 100644 --- a/dev/ptx/index.html +++ b/dev/ptx/index.html @@ -1 +1 @@ -ptx - Rust
\ No newline at end of file +ptx - Rust
\ No newline at end of file diff --git a/dev/pwd/all.html b/dev/pwd/all.html index ffa3f8306..b96cb9f5b 100644 --- a/dev/pwd/all.html +++ b/dev/pwd/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/pwd/fn.main.html b/dev/pwd/fn.main.html index 5f68a609b..6427f59fc 100644 --- a/dev/pwd/fn.main.html +++ b/dev/pwd/fn.main.html @@ -1 +1 @@ -main in pwd - Rust

Function pwd::main

source · []
pub fn main()
\ No newline at end of file +main in pwd - Rust

Function pwd::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/pwd/index.html b/dev/pwd/index.html index 8a9fb001b..93d0284e1 100644 --- a/dev/pwd/index.html +++ b/dev/pwd/index.html @@ -1 +1 @@ -pwd - Rust
\ No newline at end of file +pwd - Rust
\ No newline at end of file diff --git a/dev/readlink/all.html b/dev/readlink/all.html index 2aca2a8d7..489e72eaa 100644 --- a/dev/readlink/all.html +++ b/dev/readlink/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/readlink/fn.main.html b/dev/readlink/fn.main.html index 08c0015f2..8cc5536a5 100644 --- a/dev/readlink/fn.main.html +++ b/dev/readlink/fn.main.html @@ -1 +1 @@ -main in readlink - Rust
pub fn main()
\ No newline at end of file +main in readlink - Rust
pub fn main()
\ No newline at end of file diff --git a/dev/readlink/index.html b/dev/readlink/index.html index cc5b8e3f6..8e120d389 100644 --- a/dev/readlink/index.html +++ b/dev/readlink/index.html @@ -1 +1 @@ -readlink - Rust
\ No newline at end of file +readlink - Rust
\ No newline at end of file diff --git a/dev/realpath/all.html b/dev/realpath/all.html index 419b3492e..fda37885a 100644 --- a/dev/realpath/all.html +++ b/dev/realpath/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/realpath/fn.main.html b/dev/realpath/fn.main.html index 5131bb4a3..1fb9a50c4 100644 --- a/dev/realpath/fn.main.html +++ b/dev/realpath/fn.main.html @@ -1 +1 @@ -main in realpath - Rust
pub fn main()
\ No newline at end of file +main in realpath - Rust
pub fn main()
\ No newline at end of file diff --git a/dev/realpath/index.html b/dev/realpath/index.html index be349bd7c..6369aa651 100644 --- a/dev/realpath/index.html +++ b/dev/realpath/index.html @@ -1 +1 @@ -realpath - Rust
\ No newline at end of file +realpath - Rust
\ No newline at end of file diff --git a/dev/relpath/all.html b/dev/relpath/all.html index 1bed2fd26..463564edb 100644 --- a/dev/relpath/all.html +++ b/dev/relpath/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/relpath/fn.main.html b/dev/relpath/fn.main.html index af14ce0ee..f4b599bf4 100644 --- a/dev/relpath/fn.main.html +++ b/dev/relpath/fn.main.html @@ -1 +1 @@ -main in relpath - Rust

Function relpath::main

source · []
pub fn main()
\ No newline at end of file +main in relpath - Rust

Function relpath::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/relpath/index.html b/dev/relpath/index.html index cbd3eac84..d2f234ed2 100644 --- a/dev/relpath/index.html +++ b/dev/relpath/index.html @@ -1 +1 @@ -relpath - Rust
\ No newline at end of file +relpath - Rust
\ No newline at end of file diff --git a/dev/rm/all.html b/dev/rm/all.html index 5fd2ffe43..66b1b10ff 100644 --- a/dev/rm/all.html +++ b/dev/rm/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/rm/fn.main.html b/dev/rm/fn.main.html index 3452170bf..0edf2df8f 100644 --- a/dev/rm/fn.main.html +++ b/dev/rm/fn.main.html @@ -1 +1 @@ -main in rm - Rust

Function rm::main

source · []
pub fn main()
\ No newline at end of file +main in rm - Rust

Function rm::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/rm/index.html b/dev/rm/index.html index 0ff9b0330..9058e6123 100644 --- a/dev/rm/index.html +++ b/dev/rm/index.html @@ -1 +1 @@ -rm - Rust
\ No newline at end of file +rm - Rust
\ No newline at end of file diff --git a/dev/rmdir/all.html b/dev/rmdir/all.html index fecfb8476..487780ff0 100644 --- a/dev/rmdir/all.html +++ b/dev/rmdir/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/rmdir/fn.main.html b/dev/rmdir/fn.main.html index 2ef408f0a..025a12f93 100644 --- a/dev/rmdir/fn.main.html +++ b/dev/rmdir/fn.main.html @@ -1 +1 @@ -main in rmdir - Rust

Function rmdir::main

source · []
pub fn main()
\ No newline at end of file +main in rmdir - Rust

Function rmdir::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/rmdir/index.html b/dev/rmdir/index.html index d1ccb49de..976c3107c 100644 --- a/dev/rmdir/index.html +++ b/dev/rmdir/index.html @@ -1 +1 @@ -rmdir - Rust
\ No newline at end of file +rmdir - Rust
\ No newline at end of file diff --git a/dev/runcon/all.html b/dev/runcon/all.html index 410d1d2dc..91e45746d 100644 --- a/dev/runcon/all.html +++ b/dev/runcon/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/runcon/fn.main.html b/dev/runcon/fn.main.html index fa849fd3f..e220b63e0 100644 --- a/dev/runcon/fn.main.html +++ b/dev/runcon/fn.main.html @@ -1 +1 @@ -main in runcon - Rust

Function runcon::main

source · []
pub fn main()
\ No newline at end of file +main in runcon - Rust

Function runcon::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/runcon/index.html b/dev/runcon/index.html index 5a514581d..7f9ff1fdc 100644 --- a/dev/runcon/index.html +++ b/dev/runcon/index.html @@ -1 +1 @@ -runcon - Rust
\ No newline at end of file +runcon - Rust
\ No newline at end of file diff --git a/dev/rustdoc.css b/dev/rustdoc.css index 2e22b4cf1..6157c9ae2 100644 --- a/dev/rustdoc.css +++ b/dev/rustdoc.css @@ -1 +1 @@ - @font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html{content:"";}@media (prefers-color-scheme:light){html{content:"light";}}@media (prefers-color-scheme:dark){html{content:"dark";}}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;-webkit-font-feature-settings:"kern","liga";-moz-font-feature-settings:"kern","liga";font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:20px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}h1.fqn{margin:0;padding:0;border-bottom-color:var(--headings-border-bottom-color);}h2,h3,h4{border-bottom-color:var(--headings-border-bottom-color);}.main-heading{display:flex;flex-wrap:wrap;justify-content:space-between;padding-bottom:6px;margin-bottom:15px;}.main-heading a:hover{text-decoration:underline;}#toggle-all-docs{text-decoration:none;}h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;border-bottom-style:none;margin:0;padding:0;margin-top:0.6em;margin-bottom:0.4em;}.impl,.impl-items .method,.methods .method,.impl-items .type,.methods .type,.impl-items .associatedconstant,.methods .associatedconstant,.impl-items .associatedtype,.methods .associatedtype{flex-basis:100%;font-weight:600;position:relative;}div.impl-items>div{padding-left:0;}h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,a.source,.search-input,.search-results .result-name,.content table td:first-child>a,.item-left>a,.out-of-band,span.since,#source-sidebar,#sidebar-toggle,details.rustdoc-toggle>summary::before,div.impl-items>div:not(.docblock):not(.item-info),.content ul.crate a.crate,a.srclink,#main-content>.since,#help-button>button,details.rustdoc-toggle.top-doc>summary,details.rustdoc-toggle.top-doc>summary::before,details.rustdoc-toggle.non-exhaustive>summary,details.rustdoc-toggle.non-exhaustive>summary::before,.scraped-example-title,.more-examples-toggle summary,.more-examples-toggle .hide-more,.example-links a,#main-content>ul.docblock>li>a{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}h1,h2,h3,h4,a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a,.search-results a,.module-item .stab,.import-item .stab,.result-name .primitive>i,.result-name .keyword>i,.content .method .where,.content .fn .where,.content .where.fmt-newline{color:var(--main-color);}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p{margin:0 0 .75em 0;}summary{outline:none;}td,th{padding:0;}table{border-collapse:collapse;}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;}button{padding:1px 6px;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.source main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}.source .width-limiter{max-width:unset;}details:not(.rustdoc-toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;}.docblock.item-decl{margin-left:0;}.item-decl pre{overflow-x:auto;}.source .content pre{padding:20px;}img{max-width:100%;}li{position:relative;}.source .content{max-width:none;overflow:visible;margin-left:0px;}nav.sub{position:relative;font-size:1rem;}.sub-container{display:flex;flex-direction:row;flex-wrap:nowrap;}.sub-logo-container{display:none;margin-right:20px;}.source .sub-logo-container{display:block;}.source .sub-logo-container>img{height:60px;width:60px;object-fit:contain;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:var(--sidebar-background-color);}.sidebar{font-size:0.875rem;width:250px;min-width:200px;overflow-y:scroll;position:sticky;height:100vh;top:0;left:0;}.sidebar-elems,.sidebar>.location{padding-left:24px;}.sidebar .location{overflow-wrap:anywhere;}.rustdoc.source .sidebar{width:50px;min-width:0px;max-width:300px;flex-grow:0;flex-shrink:0;flex-basis:auto;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;}.rustdoc.source .sidebar .sidebar-logo{display:none;}.source .sidebar,#sidebar-toggle,#source-sidebar{background-color:var(--sidebar-background-color);}#sidebar-toggle>button:hover,#sidebar-toggle>button:focus{background-color:var(--sidebar-background-color-hover);}.source .sidebar>*:not(#sidebar-toggle){opacity:0;visibility:hidden;}.source-sidebar-expanded .source .sidebar{overflow-y:auto;}.source-sidebar-expanded .source .sidebar>*:not(#sidebar-toggle){opacity:1;visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.sidebar .logo-container{display:flex;margin-top:10px;margin-bottom:10px;justify-content:center;}.version{overflow-wrap:break-word;}.logo-container>img{height:100px;width:100px;}.location:empty{border:none;}.location a:first-of-type{font-weight:500;}.block{padding:0;}.block ul,.block li{padding:0;margin:0;list-style:none;}.block a,h2.location a{display:block;padding:0.25rem;margin-left:-0.25rem;text-overflow:ellipsis;overflow:hidden;}.sidebar h2{border-bottom:none;font-weight:500;padding:0;margin:0;margin-top:0.7rem;margin-bottom:0.7rem;}.sidebar h3{font-size:1.125rem;font-weight:500;padding:0;margin:0;}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;}.mobile-topbar{display:none;}.source .content pre.rust{white-space:pre;overflow:auto;padding-left:0;}.rustdoc .example-wrap{display:inline-flex;margin-bottom:10px;}.example-wrap{position:relative;width:100%;}.example-wrap>pre.line-number{overflow:initial;border:1px solid;padding:13px 8px;text-align:right;border-top-left-radius:5px;border-bottom-left-radius:5px;}.example-wrap>pre.rust a:hover{text-decoration:underline;}.line-numbers{text-align:right;}.rustdoc:not(.source) .example-wrap>pre:not(.line-number){width:100%;overflow-x:auto;}.rustdoc:not(.source) .example-wrap>pre.line-numbers{width:auto;overflow-x:visible;}.rustdoc .example-wrap>pre{margin:0;}#search{position:relative;}.search-loading{text-align:center;}#results>table{width:100%;table-layout:fixed;}.content>.example-wrap pre.line-numbers{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.line-numbers span{cursor:pointer;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock-short p{display:inline;}.docblock-short p{overflow:hidden;text-overflow:ellipsis;margin:0;}.docblock>:not(pre)>code,.docblock-short>:not(pre)>code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:var(--headings-border-bottom-color);}.docblock{margin-left:24px;position:relative;}.docblock>:not(.information):not(.more-examples-toggle){max-width:100%;overflow-x:auto;}.content .out-of-band{flex-grow:0;font-size:1.125rem;font-weight:normal;float:right;}.method>.code-header,.trait-impl>.code-header{max-width:calc(100% - 41px);display:block;}.content .in-band{flex-grow:1;margin:0px;padding:0px;overflow-wrap:break-word;overflow-wrap:anywhere;}.in-band>code,.in-band>.code-header{display:inline-block;}.docblock code,.docblock-short code,pre,.rustdoc.source .example-wrap{background-color:var(--code-block-background-color);}#main-content{position:relative;}#main-content>.since{top:inherit;}.content table:not(.table-display){border-spacing:0 5px;}.content td{vertical-align:top;}.content td:first-child{padding-right:20px;}.content td p:first-child{margin-top:0;}.content td h1,.content td h2{margin-left:0;font-size:1.125rem;}.content tr:first-child td{border-top:0;}.docblock table{margin:.5em 0;width:calc(100% - 2px);overflow-x:auto;display:block;}.docblock table td{padding:.5em;border:1px dashed;}.docblock table th{padding:.5em;text-align:left;border:1px solid;}.fields+table{margin-bottom:1em;}.content .item-list{list-style-type:none;padding:0;}.content .multi-column{-moz-column-count:5;-moz-column-gap:2.5em;-webkit-column-count:5;-webkit-column-gap:2.5em;column-count:5;column-gap:2.5em;}.content .multi-column li{width:100%;display:inline-block;}.content>.methods>.method{font-size:1rem;position:relative;}.content .method .where,.content .fn .where,.content .where.fmt-newline{display:block;font-size:0.875rem;}.content .methods>div:not(.notable-traits):not(.method){margin-left:40px;margin-bottom:15px;}.content .docblock>.impl-items{margin-left:20px;margin-top:-34px;}.content .docblock>.impl-items .table-display{margin:0;}.content .docblock>.impl-items table td{padding:0;}.content .docblock>.impl-items .table-display,.impl-items table td{border:none;}.item-info{display:block;}.content .item-info code{font-size:0.875rem;}.content .item-info{position:relative;margin-left:24px;}.sub-variant>div>.item-info{margin-top:initial;}.content .impl-items .docblock,.content .impl-items .item-info{margin-bottom:.6em;}.content .impl-items>.item-info{margin-left:40px;}.methods>.item-info,.content .impl-items>.item-info{margin-top:-8px;}.impl-items{flex-basis:100%;}#main-content>.item-info{margin-top:0;margin-left:0;}nav.sub{flex-grow:1;margin-bottom:25px;}.source nav.sub{margin-left:32px;}nav.main{padding:20px 0;text-align:center;}nav.main .current{border-top:1px solid;border-bottom:1px solid;}nav.main .separator{border:1px solid;display:inline-block;height:23px;margin:0 20px;}nav.sum{text-align:right;}nav.sub form{display:inline;}a{text-decoration:none;background:transparent;}.small-section-header{display:flex;justify-content:space-between;position:relative;}.small-section-header:hover>.anchor{display:initial;}.in-band:hover>.anchor,.impl:hover>.anchor,.method.trait-impl:hover>.anchor,.type.trait-impl:hover>.anchor,.associatedconstant.trait-impl:hover>.anchor,.associatedtype.trait-impl:hover>.anchor{display:inline-block;position:absolute;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.anchor::before{content:'§';}.docblock a:not(.srclink):not(.test-arrow):not(.scrape-help):hover,.docblock-short a:not(.srclink):not(.test-arrow):not(.scrape-help):hover,.item-info a{text-decoration:underline;}.block a.current.crate{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;}.item-row{display:table-row;}.item-left,.item-right{display:table-cell;}.item-left{padding-right:1.25rem;}.search-container{position:relative;display:flex;height:34px;}.search-container>*{height:100%;}.search-results-title{display:inline;}#search-settings{font-size:1.5rem;font-weight:500;margin-bottom:20px;}#crate-search{min-width:115px;margin-top:5px;padding-left:0.15em;padding-right:23px;border:1px solid;border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;background-repeat:no-repeat;background-color:transparent;background-size:20px;background-position:calc(100% - 1px) 56%;background-image:url("down-arrow.svg");max-width:100%;text-overflow:ellipsis;}.search-container{margin-top:4px;}.search-input{-webkit-appearance:none;-moz-box-sizing:border-box !important;box-sizing:border-box !important;outline:none;border:1px solid;border-radius:2px;padding:8px;font-size:1rem;width:100%;}.search-results{display:none;padding-bottom:2em;}.search-results.active{display:block;clear:both;}.search-results .desc>span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:block;}.search-results>a{display:block;width:100%;margin-left:2px;margin-right:2px;border-bottom:1px solid #aaa3;}.search-results>a>div{display:flex;flex-flow:row wrap;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:50%;}.search-results .result-name{padding-right:1em;}.search-results .result-name>span{display:inline-block;margin:0;font-weight:normal;}.popover{font-size:1rem;position:absolute;right:0;z-index:2;display:block;margin-top:7px;border-radius:3px;border:1px solid;font-size:1rem;}.popover::before{content:'';position:absolute;right:11px;border:solid;border-width:1px 1px 0 0;display:inline-block;padding:4px;transform:rotate(-45deg);top:-5px;}.popover,.popover::before{background-color:var(--main-background-color);color:var(--main-color);}#help-button .popover{max-width:600px;}#help-button .popover::before{right:48px;}#help-button dt{float:left;clear:left;display:block;margin-right:0.5rem;}#help-button span.top,#help-button span.bottom{text-align:center;display:block;font-size:1.125rem;}#help-button span.top{text-align:center;display:block;margin:10px 0;border-bottom:1px solid;padding-bottom:4px;margin-bottom:6px;}#help-button span.bottom{clear:both;border-top:1px solid;}.side-by-side{text-align:initial;}.side-by-side>div{width:50%;float:left;padding:0 20px 20px 17px;}.item-info .stab{width:fit-content;min-height:36px;display:flex;align-items:center;white-space:pre-wrap;}.stab{padding:3px;margin-bottom:5px;font-size:0.875rem;font-weight:normal;}.stab p{display:inline;margin:0;}.stab .emoji{font-size:1.25rem;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.module-item .stab,.import-item .stab{border-radius:3px;display:inline-block;font-size:0.875rem;line-height:1.2;margin-bottom:0;margin-left:0.3125em;padding:2px;vertical-align:text-bottom;}.module-item.unstable,.import-item.unstable{opacity:0.65;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;padding-right:2px;position:initial;}.impl-items .srclink,.impl .srclink,.methods .srclink{font-weight:normal;font-size:1rem;}.rightside{float:right;}.variants_table{width:100%;}.variants_table tbody tr td:first-child{width:1%;}td.summary-column{width:100%;}.summary{padding-right:0px;}pre.rust .question-mark{font-weight:bold;}a.test-arrow{display:inline-block;visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;}.example-wrap:hover .test-arrow{visibility:visible;}a.test-arrow:hover{text-decoration:none;}.code-attribute{font-weight:300;}.item-spacer{width:100%;height:12px;}.out-of-band>span.since{position:initial;font-size:1.25rem;}h3.variant{font-weight:600;font-size:1.125rem;margin-bottom:10px;border-bottom:none;}.sub-variant h4{font-size:1rem;font-weight:400;border-bottom:none;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}.toggle-label{display:inline-block;margin-left:4px;margin-top:3px;}:target>code,:target>.code-header{opacity:1;}:target{padding-right:3px;}.information{position:absolute;left:-25px;margin-top:7px;z-index:1;}.tooltip{position:relative;display:inline-block;cursor:pointer;}.tooltip::after{display:none;text-align:center;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;font-size:1rem;}.tooltip.ignore::after{content:"This example is not tested";}.tooltip.compile_fail::after{content:"This example deliberately fails to compile";}.tooltip.should_panic::after{content:"This example panics";}.tooltip.edition::after{content:"This code runs with edition " attr(data-edition);}.tooltip::before{content:" ";position:absolute;top:50%;left:16px;margin-top:-5px;border-width:5px;border-style:solid;display:none;}.tooltip:hover::before,.tooltip:hover::after{display:inline;}.tooltip.compile_fail,.tooltip.should_panic,.tooltip.ignore{font-weight:bold;font-size:1.25rem;}.notable-traits-tooltip{display:inline-block;cursor:pointer;}.notable-traits:hover .notable-traits-tooltiptext,.notable-traits .notable-traits-tooltiptext.force-tooltip{display:inline-block;}.notable-traits .notable-traits-tooltiptext{display:none;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;z-index:10;font-size:1rem;cursor:default;position:absolute;border:1px solid;}.notable-traits-tooltip::after{content:"\00a0\00a0\00a0";}.notable-traits .notable,.notable-traits .docblock{margin:0;}.notable-traits .notable{margin:0;margin-bottom:13px;font-size:1.1875rem;font-weight:600;display:block;}.notable-traits .docblock code.content{margin:0;padding:0;font-size:1.25rem;}pre.rust.rust-example-rendered{position:relative;}pre.rust{tab-size:4;-moz-tab-size:4;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#titles{height:35px;}#titles>button{float:left;width:33.3%;text-align:center;font-size:1.125rem;cursor:pointer;border:0;border-top:2px solid;}#titles>button:first-child:last-child{margin-right:1px;width:calc(100% - 1px);}#titles>button:not(:last-child){margin-right:1px;width:calc(33.3% - 1px);}#titles>button>div.count{display:inline-block;font-size:1rem;}.notable-traits{cursor:pointer;z-index:2;margin-left:5px;}#sidebar-toggle{position:sticky;top:0;left:0;font-weight:bold;font-size:1.25rem;border-bottom:1px solid;display:flex;height:40px;justify-content:center;align-items:center;z-index:10;}#source-sidebar{width:100%;z-index:1;overflow:auto;}#source-sidebar>.title{font-size:1.5rem;text-align:center;border-bottom:1px solid;margin-bottom:6px;}#sidebar-toggle>button{background:none;color:inherit;cursor:pointer;text-align:center;border:none;outline:none;position:absolute;top:0;bottom:0;left:0;right:0;width:100%;-webkit-appearance:none;opacity:1;}#settings-menu,#help-button{margin-left:4px;outline:none;}#copy-path{height:34px;}#settings-menu>a,#help-button>button,#copy-path{padding:5px;width:33px;border:1px solid;border-radius:2px;cursor:pointer;}#settings-menu{padding:0;}#settings-menu>a,#help-button>button{padding:5px;height:100%;display:block;}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}.setting-line .radio-line input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-line .radio-line input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-line .radio-line input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-line .radio-line input:hover{border-color:var(--settings-input-color) !important;}input:checked+.slider{background-color:var(--settings-input-color);}#help-button>button{text-align:center;font-size:20px;padding-top:2px;}#copy-path{background:initial;margin-left:10px;padding:0;padding-left:2px;border:0;}#theme-choices{display:none;position:absolute;left:0;top:28px;border:1px solid;border-radius:3px;z-index:1;cursor:pointer;}#theme-choices>button{border:none;width:100%;padding:4px 8px;text-align:center;background:rgba(0,0,0,0);overflow-wrap:normal;}#theme-choices>button:not(:first-child){border-top:1px solid;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px;border-radius:3px;cursor:default;}.hidden-by-impl-hider,.hidden-by-usual-hider{display:none !important;}#implementations-list>h3>span.in-band{width:100%;}.table-display{width:100%;border:0;border-collapse:collapse;border-spacing:0;font-size:1rem;}.table-display tr td:first-child{padding-right:0;}.table-display tr td:last-child{float:right;}.table-display .out-of-band{position:relative;font-size:1.125rem;display:block;}.table-display td:hover .anchor{display:block;top:2px;left:-5px;}#main-content>ul{padding-left:10px;}#main-content>ul>li{list-style:none;}.non-exhaustive{margin-bottom:1em;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 13px;list-style-position:outside;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.rustdoc-toggle>summary.hideme{cursor:pointer;}details.rustdoc-toggle>summary{list-style:none;}details.rustdoc-toggle>summary::-webkit-details-marker,details.rustdoc-toggle>summary::marker{display:none;}details.rustdoc-toggle>summary.hideme>span{margin-left:9px;}details.rustdoc-toggle>summary::before{content:"";cursor:pointer;width:16px;height:16px;background-repeat:no-repeat;background-position:top left;display:inline-block;vertical-align:middle;opacity:.5;}details.rustdoc-toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.rustdoc-toggle>summary.hideme::after{content:"";}details.rustdoc-toggle>summary:focus::before,details.rustdoc-toggle>summary:hover::before{opacity:1;}details.rustdoc-toggle.top-doc>summary,details.rustdoc-toggle.top-doc>summary::before,details.rustdoc-toggle.non-exhaustive>summary,details.rustdoc-toggle.non-exhaustive>summary::before{font-size:1rem;}details.non-exhaustive{margin-bottom:8px;}details.rustdoc-toggle>summary.hideme::before{position:relative;}details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.rustdoc-toggle[open] >summary.hideme{position:absolute;}details.rustdoc-toggle{position:relative;}details.rustdoc-toggle[open] >summary.hideme>span{display:none;}details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{background-image:url("toggle-minus.svg");}details.rustdoc-toggle>summary::before{background-image:url("toggle-plus.svg");}details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{width:16px;height:16px;background-repeat:no-repeat;background-position:top left;display:inline-block;content:"";}details.rustdoc-toggle[open] >summary::after,details.rustdoc-toggle[open] >summary.hideme::after{content:"Collapse";}.docblock summary>*{display:inline-block;}@media (min-width:701px){.docblock>.information:first-child>.tooltip{margin-top:16px;}.source-sidebar-expanded .source .sidebar+main .width-limiter .sub-logo-container.rust-logo{display:none;}.source-sidebar-expanded .source .sidebar{width:300px;}}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{padding-top:0px;display:block;}main{padding-left:15px;padding-top:0px;}.rustdoc,.main-heading{flex-direction:column;}.content .out-of-band{text-align:left;margin-left:initial;padding:initial;}.content .out-of-band .since::before{content:"Since ";}#copy-path{display:none;}.sidebar .sidebar-logo,.sidebar .location{display:none;}.sidebar-elems{margin-top:1em;}.sidebar{position:fixed;top:45px;left:-1000px;margin-left:0;margin:0;padding:0;z-index:11;height:calc(100vh - 45px);}.source main,.rustdoc.source .sidebar{top:0;padding:0;height:100vh;border:0;}.sidebar.shown,.source-sidebar-expanded .source .sidebar,.sidebar:focus-within{left:0;}.rustdoc.source>.sidebar{position:fixed;margin:0;z-index:11;width:0;}.mobile-topbar .location a{padding:0;margin:0;}.mobile-topbar .location{border:none;padding:0;margin:auto 0.5em auto auto;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:24px;}.mobile-topbar .logo-container{max-height:45px;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin-left:20px;margin-top:5px;margin-bottom:5px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.source .mobile-topbar{display:none;}.sidebar-menu-toggle{width:45px;font-size:32px;border:none;}.sidebar-elems{background-color:var(--sidebar-background-color);}.source nav:not(.sidebar).sub{margin-left:32px;}.content{margin-left:0px;}.source .content{margin-top:10px;}#search{margin-left:0;padding:0;}.anchor{display:none !important;}.notable-traits{position:absolute;left:-22px;top:24px;}#titles>button>div.count{float:left;width:100%;}#titles{height:50px;}#sidebar-filler{position:fixed;left:45px;width:calc(100% - 45px);top:0;height:45px;z-index:-1;border-bottom:1px solid;}#main-content>details.rustdoc-toggle>summary::before,#main-content>div>details.rustdoc-toggle>summary::before{left:-11px;}#sidebar-toggle{position:fixed;left:1px;top:100px;width:30px;font-size:1.5rem;text-align:center;padding:0;z-index:10;border-top-right-radius:3px;border-bottom-right-radius:3px;cursor:pointer;font-weight:bold;border:1px solid;border-left:0;}.source-sidebar-expanded #sidebar-toggle{left:unset;top:unset;width:unset;border-top-right-radius:unset;border-bottom-right-radius:unset;position:sticky;border:0;border-bottom:1px solid;}#source-sidebar{z-index:11;}#main-content>.line-numbers{margin-top:0;}.notable-traits .notable-traits-tooltiptext{left:0;top:100%;}#help-button{display:none;}.item-table{display:block;}.item-row{display:flex;flex-flow:column wrap;}.item-left,.item-right{width:100%;}.search-results>a{border-bottom:1px solid #aaa9;padding:5px 0px;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:100%;}.search-results div.desc,.search-results .result-description,.item-right{padding-left:2em;}.source-sidebar-expanded .source .sidebar{max-width:100vw;width:100vw;}details.rustdoc-toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before,#main-content>details.rustdoc-toggle:not(.top-doc)>summary::before,#main-content>div>details.rustdoc-toggle>summary::before{left:-11px;}}@media print{nav.sidebar,nav.sub,.content .out-of-band,a.srclink,#copy-path,details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle>summary::before,details.rustdoc-toggle.top-doc>summary{display:none;}.docblock{margin-left:0;}main{padding:10px;}}@media (max-width:464px){#titles,#titles>button{height:73px;}#main-content>table:not(.table-display) td{word-break:break-word;width:50%;}#crate-search{border-radius:4px;}.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}.sub-container{flex-direction:column;}.sub-logo-container{align-self:center;}.source .sub-logo-container>img{height:35px;width:35px;}#sidebar-toggle{top:10px;}.source-sidebar-expanded #sidebar-toggle{top:unset;}}.method-toggle summary,.implementors-toggle summary,.impl{margin-bottom:0.75em;}.method-toggle[open]{margin-bottom:2em;}.implementors-toggle[open]{margin-bottom:2em;}#trait-implementations-list .method-toggle,#synthetic-implementations-list .method-toggle,#blanket-implementations-list .method-toggle{margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;background:transparent;border-width:1px;border-style:solid;border-radius:50px;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:240px;}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;max-height:240px;padding-bottom:0;}.scraped-example:not(.expanded) .code-wrapper pre.line-numbers{overflow-x:hidden;}.scraped-example .code-wrapper .prev{position:absolute;top:0.25em;right:2.25em;z-index:100;cursor:pointer;}.scraped-example .code-wrapper .next{position:absolute;top:0.25em;right:1.25em;z-index:100;cursor:pointer;}.scraped-example .code-wrapper .expand{position:absolute;top:0.25em;right:0.25em;z-index:100;cursor:pointer;}.scraped-example:not(.expanded) .code-wrapper:before{content:" ";width:100%;height:5px;position:absolute;z-index:100;top:0;}.scraped-example:not(.expanded) .code-wrapper:after{content:" ";width:100%;height:5px;position:absolute;z-index:100;bottom:0;}.scraped-example .code-wrapper .line-numbers{margin:0;padding:14px 0;}.scraped-example .code-wrapper .line-numbers span{padding:0 14px;}.scraped-example .code-wrapper .example-wrap{flex:1;overflow-x:auto;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .code-wrapper .example-wrap pre.rust{overflow-x:inherit;width:inherit;overflow-y:hidden;}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;margin-bottom:5px;cursor:pointer;}.more-scraped-examples{margin-left:5px;display:flex;flex-direction:row;}.more-scraped-examples-inner{width:calc(100% - 20px);}.toggle-line{align-self:stretch;margin-right:10px;margin-top:5px;padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;}.more-scraped-examples .scraped-example{margin-bottom:20px;}.more-scraped-examples .scraped-example:last-child{margin-bottom:0;}.example-links a{margin-top:20px;}.example-links ul{margin-bottom:0;} \ No newline at end of file + @font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html{content:"";}@media (prefers-color-scheme:light){html{content:"light";}}@media (prefers-color-scheme:dark){html{content:"dark";}}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;-webkit-font-feature-settings:"kern","liga";-moz-font-feature-settings:"kern","liga";font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:20px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}h1.fqn{margin:0;padding:0;border-bottom-color:var(--headings-border-bottom-color);}h2,h3,h4{border-bottom-color:var(--headings-border-bottom-color);}.main-heading{display:flex;flex-wrap:wrap;justify-content:space-between;padding-bottom:6px;margin-bottom:15px;}.main-heading a:hover{text-decoration:underline;}#toggle-all-docs{text-decoration:none;}h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;border-bottom-style:none;margin:0;padding:0;margin-top:0.6em;margin-bottom:0.4em;}.impl,.impl-items .method,.methods .method,.impl-items .type,.methods .type,.impl-items .associatedconstant,.methods .associatedconstant,.impl-items .associatedtype,.methods .associatedtype{flex-basis:100%;font-weight:600;position:relative;}h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,a.source,.search-input,.search-results .result-name,.item-left>a,.out-of-band,span.since,details.rustdoc-toggle>summary::before,.content ul.crate a.crate,a.srclink,#help-button>button,details.rustdoc-toggle.top-doc>summary,details.rustdoc-toggle.top-doc>summary::before,details.rustdoc-toggle.non-exhaustive>summary,details.rustdoc-toggle.non-exhaustive>summary::before,.scraped-example-title,.more-examples-toggle summary,.more-examples-toggle .hide-more,.example-links a,#main-content>ul.docblock>li>a{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a,.search-results a,.module-item .stab,.import-item .stab,.result-name .primitive>i,.result-name .keyword>i,.content .method .where,.content .fn .where,.content .where.fmt-newline{color:var(--main-color);}.content span.enum,.content a.enum,.content span.struct,.content a.struct,.content span.union,.content a.union,.content span.primitive,.content a.primitive,.content span.type,.content a.type,.content span.foreigntype,.content a.foreigntype{color:var(--type-link-color);}.content span.trait,.content a.trait,.content span.traitalias,.content a.traitalias{color:var(--trait-link-color);}.content span.associatedtype,.content a.associatedtype,.content span.constant,.content a.constant,.content span.static,.content a.static{color:var(--assoc-item-link-color);}.content span.fn,.content a.fn,.content .fnname,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod{color:var(--function-link-color);}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:var(--macro-link-color);}.content span.mod,.content a.mod,.block a.current.mod{color:var(--mod-link-color);}.content span.keyword,.content a.keyword{color:var(--keyword-link-color);}a{color:var(--link-color);}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p{margin:0 0 .75em 0;}summary{outline:none;}td,th{padding:0;}table{border-collapse:collapse;}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;}button{padding:1px 6px;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.source main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}.source .width-limiter{max-width:unset;}details:not(.rustdoc-toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;}.docblock.item-decl{margin-left:0;}.item-decl pre{overflow-x:auto;}.source .content pre{padding:20px;}img{max-width:100%;}.source .content{overflow:visible;}.sub-container{display:flex;flex-direction:row;flex-wrap:nowrap;}.sub-logo-container{display:none;margin-right:20px;}.source .sub-logo-container{display:block;}.source .sub-logo-container>img{height:60px;width:60px;object-fit:contain;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:var(--sidebar-background-color);}.sidebar{font-size:0.875rem;width:250px;min-width:200px;overflow-y:scroll;position:sticky;height:100vh;top:0;left:0;}.sidebar-elems,.sidebar>.location{padding-left:24px;}.sidebar .location{overflow-wrap:anywhere;}.rustdoc.source .sidebar{width:50px;min-width:0px;max-width:300px;flex-grow:0;flex-shrink:0;flex-basis:auto;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;}.rustdoc.source .sidebar .sidebar-logo{display:none;}.source .sidebar,#sidebar-toggle,#source-sidebar{background-color:var(--sidebar-background-color);}#sidebar-toggle>button:hover,#sidebar-toggle>button:focus{background-color:var(--sidebar-background-color-hover);}.source .sidebar>*:not(#sidebar-toggle){opacity:0;visibility:hidden;}.source-sidebar-expanded .source .sidebar{overflow-y:auto;}.source-sidebar-expanded .source .sidebar>*:not(#sidebar-toggle){opacity:1;visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.sidebar .logo-container{display:flex;margin-top:10px;margin-bottom:10px;justify-content:center;}.version{overflow-wrap:break-word;}.logo-container>img{height:100px;width:100px;}.location:empty{border:none;}.location a:first-of-type{font-weight:500;}.block ul,.block li{padding:0;margin:0;list-style:none;}.block a,h2.location a{display:block;padding:0.25rem;margin-left:-0.25rem;text-overflow:ellipsis;overflow:hidden;}.sidebar h2{border-bottom:none;font-weight:500;padding:0;margin:0;margin-top:0.7rem;margin-bottom:0.7rem;}.sidebar h3{font-size:1.125rem;font-weight:500;padding:0;margin:0;}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;}.mobile-topbar{display:none;}.source .content pre.rust{white-space:pre;overflow:auto;padding-left:0;}.rustdoc .example-wrap{display:inline-flex;margin-bottom:10px;}.example-wrap{position:relative;width:100%;}.example-wrap>pre.line-number{overflow:initial;border:1px solid;padding:13px 8px;text-align:right;border-top-left-radius:5px;border-bottom-left-radius:5px;}.example-wrap>pre.rust a:hover{text-decoration:underline;}.line-numbers{text-align:right;}.rustdoc:not(.source) .example-wrap>pre:not(.line-number){width:100%;overflow-x:auto;}.rustdoc:not(.source) .example-wrap>pre.line-numbers{width:auto;overflow-x:visible;}.rustdoc .example-wrap>pre{margin:0;}.search-loading{text-align:center;}.content>.example-wrap pre.line-numbers{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.line-numbers span{cursor:pointer;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;overflow:hidden;text-overflow:ellipsis;}.docblock>:not(pre)>code,.docblock-short>code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:var(--headings-border-bottom-color);}.docblock{margin-left:24px;position:relative;}.docblock>:not(.more-examples-toggle):not(.example-wrap){max-width:100%;overflow-x:auto;}.content .out-of-band{flex-grow:0;font-size:1.125rem;font-weight:normal;float:right;}.method>.code-header,.trait-impl>.code-header{max-width:calc(100% - 41px);display:block;}.content .in-band{flex-grow:1;margin:0px;padding:0px;overflow-wrap:break-word;overflow-wrap:anywhere;background-color:var(--main-background-color);}.in-band>code,.in-band>.code-header{display:inline-block;}.docblock code,.docblock-short code,pre,.rustdoc.source .example-wrap{background-color:var(--code-block-background-color);}#main-content{position:relative;}.docblock table{margin:.5em 0;width:calc(100% - 2px);overflow-x:auto;display:block;}.docblock table td{padding:.5em;border:1px dashed var(--border-color);vertical-align:top;}.docblock table th{padding:.5em;text-align:left;border:1px solid var(--border-color);}.content .item-list{list-style-type:none;padding:0;}.content>.methods>.method{font-size:1rem;position:relative;}.content .method .where,.content .fn .where,.content .where.fmt-newline{display:block;font-size:0.875rem;}.item-info{display:block;}.content .item-info code{font-size:0.875rem;}.content .item-info{position:relative;margin-left:24px;}.content .impl-items .docblock,.content .impl-items .item-info{margin-bottom:.6em;}#main-content>.item-info{margin-top:0;margin-left:0;}nav.sub{position:relative;font-size:1rem;flex-grow:1;margin-bottom:25px;}.source nav.sub{margin-left:32px;}nav.sum{text-align:right;}nav.sub form{display:inline;}a{text-decoration:none;}.small-section-header{display:flex;justify-content:space-between;position:relative;}.small-section-header:hover>.anchor{display:initial;}.in-band:hover>.anchor,.impl:hover>.anchor,.method.trait-impl:hover>.anchor,.type.trait-impl:hover>.anchor,.associatedconstant.trait-impl:hover>.anchor,.associatedtype.trait-impl:hover>.anchor{display:inline-block;position:absolute;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.anchor::before{content:'§';}.docblock a:not(.srclink):not(.test-arrow):not(.scrape-help):hover,.docblock-short a:not(.srclink):not(.test-arrow):not(.scrape-help):hover,.item-info a{text-decoration:underline;}.block a.current.crate{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;}.item-row{display:table-row;}.item-left,.item-right{display:table-cell;}.item-left{padding-right:1.25rem;}.search-container{position:relative;display:flex;height:34px;margin-top:4px;}.search-container>*{height:100%;}.search-results-title{margin-top:0;white-space:nowrap;display:inline-flex;max-width:100%;align-items:baseline;}#crate-search-div{display:inline-block;position:relative;min-width:5em;}#crate-search{min-width:115px;padding:0;padding-left:4px;padding-right:23px;max-width:100%;text-overflow:ellipsis;border:1px solid var(--border-color);border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;background-color:var(--main-background-color);}@-moz-document url-prefix(){#crate-search{padding-left:0px;padding-right:19px;}}#crate-search-div::after{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;content:"";background-repeat:no-repeat;background-size:20px;background-position:calc(100% - 2px) 56%;background-image:url("down-arrow.svg");}#crate-search>option{font-size:1rem;}.search-input{-webkit-appearance:none;-moz-box-sizing:border-box !important;box-sizing:border-box !important;outline:none;border:1px solid var(--border-color);border-radius:2px;padding:8px;font-size:1rem;width:100%;background-color:var(--button-background-color);}.search-input:focus{border-color:var(--search-input-focused-border-color);}.search-results{display:none;padding-bottom:2em;}.search-results.active{display:block;clear:both;}.search-results .desc>span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:block;}.search-results>a{display:block;margin-left:2px;margin-right:2px;border-bottom:1px solid #aaa3;}.search-results>a>div{display:flex;flex-flow:row wrap;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:50%;}.search-results .result-name{padding-right:1em;}.popover{font-size:1rem;position:absolute;right:0;z-index:2;display:block;margin-top:7px;border-radius:3px;border:1px solid var(--border-color);font-size:1rem;}.popover::before{content:'';position:absolute;right:11px;border:solid var(--border-color);border-width:1px 1px 0 0;display:inline-block;padding:4px;transform:rotate(-45deg);top:-5px;}.popover,.popover::before{background-color:var(--main-background-color);color:var(--main-color);}#help-button .popover{max-width:600px;}#help-button .popover::before{right:48px;}#help-button dt{float:left;clear:left;display:block;margin-right:0.5rem;}#help-button span.top,#help-button span.bottom{text-align:center;display:block;font-size:1.125rem;}#help-button span.top{text-align:center;display:block;margin:10px 0;border-bottom:1px solid var(--border-color);padding-bottom:4px;margin-bottom:6px;}#help-button span.bottom{clear:both;border-top:1px solid var(--border-color);}.side-by-side{text-align:initial;}.side-by-side>div{width:50%;float:left;padding:0 20px 20px 17px;}.item-info .stab{width:fit-content;min-height:36px;display:flex;align-items:center;white-space:pre-wrap;}.stab{padding:3px;margin-bottom:5px;font-size:0.875rem;font-weight:normal;}.stab p{display:inline;margin:0;}.stab .emoji{font-size:1.25rem;margin-right:0.3rem;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.module-item .stab,.import-item .stab{border-radius:3px;display:inline-block;font-size:0.875rem;line-height:1.2;margin-bottom:0;margin-left:0.3125em;padding:2px;vertical-align:text-bottom;}.module-item.unstable,.import-item.unstable{opacity:0.65;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;padding-right:2px;position:initial;float:right;}.rightside:not(a),.out-of-band{color:var(--right-side-color);}.impl-items .srclink,.impl .srclink,.methods .srclink{font-weight:normal;font-size:1rem;}td.summary-column{width:100%;}.summary{padding-right:0px;}pre.rust .question-mark{font-weight:bold;}.example-wrap.compile_fail,.example-wrap.should_panic{border-left:2px solid var(--codeblock-error-color);}.ignore.example-wrap{border-left:2px solid var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover,.example-wrap.should_panic:hover{border-left:2px solid var(--codeblock-error-hover-color);}.example-wrap.ignore:hover{border-left:2px solid var(--codeblock-ignore-hover-color);}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip{color:var(--codeblock-error-color);}.example-wrap.ignore .tooltip{color:var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover .tooltip,.example-wrap.should_panic:hover .tooltip{color:var(--codeblock-error-hover-color);}.example-wrap.ignore:hover .tooltip{color:var(--codeblock-ignore-hover-color);}.example-wrap .tooltip{position:absolute;display:block;cursor:pointer;left:-25px;top:5px;}.example-wrap .tooltip::after{display:none;text-align:center;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;font-size:1rem;border:1px solid var(--border-color);position:absolute;width:max-content;top:-2px;z-index:1;}.example-wrap .tooltip::before{content:" ";position:absolute;top:50%;left:16px;margin-top:-5px;border-width:5px;border-style:solid;display:none;z-index:1;}.example-wrap.ignore .tooltip::after{content:"This example is not tested";}.example-wrap.compile_fail .tooltip::after{content:"This example deliberately fails to compile";}.example-wrap.should_panic .tooltip::after{content:"This example panics";}.example-wrap.edition .tooltip::after{content:"This code runs with edition " attr(data-edition);}.example-wrap .tooltip:hover::before,.example-wrap .tooltip:hover::after{display:inline;}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip,.example-wrap.ignore .tooltip{font-weight:bold;font-size:1.25rem;}a.test-arrow{display:inline-block;visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;}.example-wrap:hover .test-arrow{visibility:visible;}a.test-arrow:hover{text-decoration:none;}.code-attribute{font-weight:300;color:var(--code-attribute-color);}.item-spacer{width:100%;height:12px;}.out-of-band>span.since{font-size:1.25rem;}h3.variant{font-weight:600;font-size:1.125rem;margin-bottom:10px;border-bottom:none;}.sub-variant h4{font-size:1rem;font-weight:400;border-bottom:none;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}:target>code,:target>.code-header{opacity:1;}:target{padding-right:3px;}.notable-traits-tooltip{display:inline-block;cursor:pointer;}.notable-traits:hover .notable-traits-tooltiptext,.notable-traits .notable-traits-tooltiptext.force-tooltip{display:inline-block;}.notable-traits .notable-traits-tooltiptext{display:none;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;z-index:10;font-size:1rem;cursor:default;position:absolute;border:1px solid;}.notable-traits-tooltip::after{content:"\00a0\00a0\00a0";}.notable-traits .notable,.notable-traits .docblock{margin:0;}.notable-traits .notable{margin:0;margin-bottom:13px;font-size:1.1875rem;font-weight:600;display:block;}.notable-traits .docblock code.content{margin:0;padding:0;font-size:1.25rem;}pre.rust.rust-example-rendered{position:relative;}pre.rust{tab-size:4;-moz-tab-size:4;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#titles{display:flex;flex-direction:row;gap:1px;margin-bottom:4px;}#titles>button{text-align:center;font-size:1.125rem;cursor:pointer;border:0;border-top:2px solid;flex:1;}#titles>button>div.count{display:inline-block;font-size:1rem;}.notable-traits{cursor:pointer;z-index:2;margin-left:5px;}#sidebar-toggle{position:sticky;top:0;left:0;font-weight:bold;font-size:1.25rem;border-bottom:1px solid;display:flex;height:40px;justify-content:center;align-items:center;z-index:10;}#source-sidebar{width:100%;z-index:1;overflow:auto;}#source-sidebar>.title{font-size:1.5rem;text-align:center;border-bottom:1px solid var(--border-color);margin-bottom:6px;}#sidebar-toggle>button{background:none;color:inherit;cursor:pointer;text-align:center;border:none;outline:none;position:absolute;top:0;bottom:0;left:0;right:0;width:100%;-webkit-appearance:none;opacity:1;}#settings-menu,#help-button{margin-left:4px;outline:none;}#settings-menu>a,#help-button>button,#copy-path{padding:5px;width:33px;border:1px solid var(--border-color);border-radius:2px;cursor:pointer;}#settings-menu>a,#help-button>button{padding:5px;height:100%;display:block;background-color:var(--button-background-color);}#copy-path{color:var(--copy-path-button-color);}#copy-path>img{filter:var(--copy-path-img-filter);}#copy-path:hover>img{filter:var(--copy-path-img-hover-filter);}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}.setting-line .radio-line input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-line .radio-line input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-line .radio-line input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-line .radio-line input:hover{border-color:var(--settings-input-color) !important;}input:checked+.slider{background-color:var(--settings-input-color);}#help-button>button{text-align:center;font-size:20px;padding-top:2px;}#copy-path{height:34px;background-color:var(--main-background-color);margin-left:10px;padding:0;padding-left:2px;border:0;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px var(--border-color);border-radius:3px;cursor:default;}#main-content>ul{padding-left:10px;}#main-content>ul>li{list-style:none;}.non-exhaustive{margin-bottom:1em;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 13px;list-style-position:outside;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.rustdoc-toggle>summary.hideme{cursor:pointer;}details.rustdoc-toggle>summary{list-style:none;}details.rustdoc-toggle>summary::-webkit-details-marker,details.rustdoc-toggle>summary::marker{display:none;}details.rustdoc-toggle>summary.hideme>span{margin-left:9px;}details.rustdoc-toggle>summary::before{content:"";cursor:pointer;width:16px;height:16px;background-repeat:no-repeat;background-position:top left;display:inline-block;vertical-align:middle;opacity:.5;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,.more-examples-toggle summary,.more-examples-toggle .hide-more{color:var(--toggles-color);}details.rustdoc-toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.rustdoc-toggle>summary.hideme::after{content:"";}details.rustdoc-toggle>summary:focus::before,details.rustdoc-toggle>summary:hover::before{opacity:1;}details.rustdoc-toggle.top-doc>summary,details.rustdoc-toggle.top-doc>summary::before,details.rustdoc-toggle.non-exhaustive>summary,details.rustdoc-toggle.non-exhaustive>summary::before{font-size:1rem;}details.non-exhaustive{margin-bottom:8px;}details.rustdoc-toggle>summary.hideme::before{position:relative;}details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.rustdoc-toggle[open] >summary.hideme{position:absolute;}details.rustdoc-toggle{position:relative;}details.rustdoc-toggle[open] >summary.hideme>span{display:none;}details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{background-image:url("toggle-minus.svg");}details.rustdoc-toggle>summary::before{background-image:url("toggle-plus.svg");}details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{width:16px;height:16px;background-repeat:no-repeat;background-position:top left;display:inline-block;content:"";}details.rustdoc-toggle[open] >summary::after,details.rustdoc-toggle[open] >summary.hideme::after{content:"Collapse";}.docblock summary>*{display:inline-block;}@media (min-width:701px){.docblock>.example-wrap:first-child .tooltip{margin-top:16px;}.source-sidebar-expanded .source .sidebar+main .width-limiter .sub-logo-container.rust-logo{display:none;}.source-sidebar-expanded .source .sidebar{width:300px;}}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{padding-top:0px;display:block;}main{padding-left:15px;padding-top:0px;}.main-heading{flex-direction:column;}.content .out-of-band{text-align:left;margin-left:initial;padding:initial;}.content .out-of-band .since::before{content:"Since ";}#copy-path{display:none;}.sidebar .sidebar-logo,.sidebar .location{display:none;}.sidebar{position:fixed;top:45px;left:-1000px;margin-left:0;margin:0;padding:0;z-index:11;height:calc(100vh - 45px);}.source main,.rustdoc.source .sidebar{top:0;padding:0;height:100vh;border:0;}.sidebar.shown,.source-sidebar-expanded .source .sidebar,.sidebar:focus-within{left:0;}.rustdoc.source>.sidebar{position:fixed;margin:0;z-index:11;width:0;}.mobile-topbar .location a{padding:0;margin:0;}.mobile-topbar .location{border:none;padding:0;margin:auto 0.5em auto auto;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:24px;}.mobile-topbar .logo-container{max-height:45px;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin-left:20px;margin-top:5px;margin-bottom:5px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.source .mobile-topbar{display:none;}.sidebar-menu-toggle{width:45px;font-size:32px;border:none;}.sidebar-elems{margin-top:1em;background-color:var(--sidebar-background-color);}.content{margin-left:0px;}.source .content{margin-top:10px;}.anchor{display:none !important;}#titles>button>div.count{display:block;}#sidebar-filler{position:fixed;left:45px;width:calc(100% - 45px);top:0;height:45px;z-index:-1;border-bottom:1px solid;}#main-content>details.rustdoc-toggle>summary::before,#main-content>div>details.rustdoc-toggle>summary::before{left:-11px;}#sidebar-toggle{position:fixed;left:1px;top:100px;width:30px;font-size:1.5rem;text-align:center;padding:0;z-index:10;border-top-right-radius:3px;border-bottom-right-radius:3px;cursor:pointer;font-weight:bold;border:1px solid;border-left:0;}.source-sidebar-expanded #sidebar-toggle{left:unset;top:unset;width:unset;border-top-right-radius:unset;border-bottom-right-radius:unset;position:sticky;border:0;border-bottom:1px solid;}#source-sidebar{z-index:11;}#main-content>.line-numbers{margin-top:0;}.notable-traits .notable-traits-tooltiptext{left:0;top:100%;}#help-button{display:none;}.item-table{display:block;}.item-row{display:flex;flex-flow:column wrap;}.item-left,.item-right{width:100%;}.search-results>a{border-bottom:1px solid #aaa9;padding:5px 0px;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:100%;}.search-results div.desc,.search-results .result-description,.item-right{padding-left:2em;}.source-sidebar-expanded .source .sidebar{max-width:100vw;width:100vw;}details.rustdoc-toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before,#main-content>details.rustdoc-toggle:not(.top-doc)>summary::before,#main-content>div>details.rustdoc-toggle>summary::before{left:-11px;}.content .impl-items>.item-info{margin-left:34px;}}@media print{nav.sidebar,nav.sub,.content .out-of-band,a.srclink,#copy-path,details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle>summary::before,details.rustdoc-toggle.top-doc>summary{display:none;}.docblock{margin-left:0;}main{padding:10px;}}@media (max-width:464px){#crate-search{border-radius:4px;}.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}.sub-container{flex-direction:column;}.sub-logo-container{align-self:center;}.source .sub-logo-container>img{height:35px;width:35px;}#sidebar-toggle{top:10px;}.source-sidebar-expanded #sidebar-toggle{top:unset;}}.method-toggle summary,.implementors-toggle summary,.impl{margin-bottom:0.75em;}.method-toggle[open]{margin-bottom:2em;}.implementors-toggle[open]{margin-bottom:2em;}#trait-implementations-list .method-toggle,#synthetic-implementations-list .method-toggle,#blanket-implementations-list .method-toggle{margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;background:transparent;border-width:1px;border-style:solid;border-radius:50px;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:240px;}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;max-height:240px;padding-bottom:0;}.scraped-example:not(.expanded) .code-wrapper pre.line-numbers{overflow-x:hidden;}.scraped-example .code-wrapper .prev{position:absolute;top:0.25em;right:2.25em;z-index:100;cursor:pointer;}.scraped-example .code-wrapper .next{position:absolute;top:0.25em;right:1.25em;z-index:100;cursor:pointer;}.scraped-example .code-wrapper .expand{position:absolute;top:0.25em;right:0.25em;z-index:100;cursor:pointer;}.scraped-example:not(.expanded) .code-wrapper:before{content:" ";width:100%;height:5px;position:absolute;z-index:100;top:0;}.scraped-example:not(.expanded) .code-wrapper:after{content:" ";width:100%;height:5px;position:absolute;z-index:100;bottom:0;}.scraped-example .code-wrapper .line-numbers{margin:0;padding:14px 0;}.scraped-example .code-wrapper .line-numbers span{padding:0 14px;}.scraped-example .code-wrapper .example-wrap{flex:1;overflow-x:auto;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .code-wrapper .example-wrap pre.rust{overflow-x:inherit;width:inherit;overflow-y:hidden;}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;margin-bottom:5px;cursor:pointer;}.more-scraped-examples{margin-left:5px;display:flex;flex-direction:row;}.more-scraped-examples-inner{width:calc(100% - 20px);}.toggle-line{align-self:stretch;margin-right:10px;margin-top:5px;padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;}.more-scraped-examples .scraped-example{margin-bottom:20px;}.more-scraped-examples .scraped-example:last-child{margin-bottom:0;}.example-links a{margin-top:20px;}.example-links ul{margin-bottom:0;} \ No newline at end of file diff --git a/dev/search-index.js b/dev/search-index.js index a7cc099a7..90b751005 100644 --- a/dev/search-index.js +++ b/dev/search-index.js @@ -100,19 +100,19 @@ var searchIndex = JSON.parse('{\ "uptime":{"doc":"","t":[5],"n":["main"],"q":["uptime"],"d":[""],"i":[0],"f":[[[]]],"p":[]},\ "users":{"doc":"","t":[5],"n":["main"],"q":["users"],"d":[""],"i":[0],"f":[[[]]],"p":[]},\ "uu_arch":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_arch",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_base32":{"doc":"","t":[0,5,5,7,3,5,11,11,12,11,11,5,5,12,11,0,5,12,11,11,11,12,7,7,7,7],"n":["base_common","uu_app","uumain","BASE_CMD_PARSE_ERROR","Config","base_app","borrow","borrow_mut","decode","from","from","get_input","handle_input","ignore_garbage","into","options","parse_base_cmd_args","to_read","try_from","try_into","type_id","wrap_cols","DECODE","FILE","IGNORE_GARBAGE","WRAP"],"q":["uu_base32","","","uu_base32::base_common","","","","","","","","","","","","","","","","","","","uu_base32::base_common::options","","",""],"d":["","","","","","","","","","Returns the argument unchanged.","","","","","Calls U::from(self).","","","","","","","","","","",""],"i":[0,0,0,0,0,0,6,6,6,6,6,0,0,6,6,0,0,6,6,6,6,6,0,0,0,0],"f":[0,[[],1],[2,3],0,0,[[4,4],1],[[]],[[]],0,[[]],[5,[[7,[6]]]],[[6,8],[[7,[[10,[9]]]]]],[[11,[13,[12]],14,14],7],0,[[]],0,[[2,4,4],[[7,[6]]]],0,[[],15],[[],15],[[],16],0,0,0,0,0],"p":[[3,"Command"],[8,"Args"],[15,"i32"],[15,"str"],[3,"ArgMatches"],[3,"Config"],[6,"UResult"],[3,"Stdin"],[8,"Read"],[3,"Box"],[4,"Format"],[15,"usize"],[4,"Option"],[15,"bool"],[4,"Result"],[3,"TypeId"]]},\ +"uu_base32":{"doc":"","t":[0,5,5,7,3,5,11,11,12,11,11,5,5,12,11,0,5,12,11,11,11,12,7,7,7,7],"n":["base_common","uu_app","uumain","BASE_CMD_PARSE_ERROR","Config","base_app","borrow","borrow_mut","decode","from","from","get_input","handle_input","ignore_garbage","into","options","parse_base_cmd_args","to_read","try_from","try_into","type_id","wrap_cols","DECODE","FILE","IGNORE_GARBAGE","WRAP"],"q":["uu_base32","","","uu_base32::base_common","","","","","","","","","","","","","","","","","","","uu_base32::base_common::options","","",""],"d":["","","","","","","","","","","Returns the argument unchanged.","","","","Calls U::from(self).","","","","","","","","","","",""],"i":[0,0,0,0,0,0,6,6,6,6,6,0,0,6,6,0,0,6,6,6,6,6,0,0,0,0],"f":[0,[[],1],[2,3],0,0,[[4,4],1],[[]],[[]],0,[5,[[7,[6]]]],[[]],[[6,8],[[7,[[10,[9]]]]]],[[11,[13,[12]],14,14],7],0,[[]],0,[[2,4,4],[[7,[6]]]],0,[[],15],[[],15],[[],16],0,0,0,0,0],"p":[[3,"Command"],[8,"Args"],[15,"i32"],[15,"str"],[3,"ArgMatches"],[3,"Config"],[6,"UResult"],[3,"Stdin"],[8,"Read"],[3,"Box"],[4,"Format"],[15,"usize"],[4,"Option"],[15,"bool"],[4,"Result"],[3,"TypeId"]]},\ "uu_base64":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_base64",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_basename":{"doc":"","t":[0,5,5,7,7,7,7],"n":["options","uu_app","uumain","MULTIPLE","NAME","SUFFIX","ZERO"],"q":["uu_basename","","","uu_basename::options","","",""],"d":["","","","","","",""],"i":[0,0,0,0,0,0,0],"f":[0,[[],1],[2,3],0,0,0,0],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_basenc":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_basenc",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_cat":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_cat",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_chcon":{"doc":"","t":[0,5,5,7,7,7,7,7,7,7,7,0,0,0,7,7,7,7,7,7,7],"n":["options","uu_app","uumain","HELP","RANGE","RECURSIVE","REFERENCE","ROLE","TYPE","USER","VERBOSE","dereference","preserve_root","sym_links","DEREFERENCE","NO_DEREFERENCE","NO_PRESERVE_ROOT","PRESERVE_ROOT","FOLLOW_ARG_DIR_SYM_LINK","FOLLOW_DIR_SYM_LINKS","NO_FOLLOW_SYM_LINKS"],"q":["uu_chcon","","","uu_chcon::options","","","","","","","","","","","uu_chcon::options::dereference","","uu_chcon::options::preserve_root","","uu_chcon::options::sym_links","",""],"d":["","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"f":[0,[[],1],[2,3],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_chgrp":{"doc":"","t":[0,5,5,3,8,3,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,12,12,5,5,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,5,12,12,12,12,5],"n":["entries","uu_app","uumain","Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","fmt","fmt","from","from","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid"],"q":["uu_chgrp","","","uu_chgrp::entries","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Get password/group file entry","","","","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell",""],"i":[0,0,0,0,0,0,4,4,8,4,8,4,8,4,8,4,8,4,8,0,0,4,8,0,0,4,8,17,4,4,8,8,4,8,4,8,4,8,4,8,4,8,4,0,4,4,4,4,0],"f":[0,[[],1],[2,3],0,0,0,[4,[[7,[5,6]]]],[[]],[[]],[[]],[[]],[4,4],[8,8],[[]],[[]],[[4,9],[[11,[10]]]],[[8,9],[[11,[10]]]],[[]],[[]],[[],[[11,[[7,[5,6]],12]]]],[[[13,[5]]],[[11,[[7,[5,6]],12]]]],0,0,[5,[[11,[14,12]]]],[15,[[11,[5,12]]]],[[]],[[]],[[],[[11,[12]]]],[5,[[11,[4,12]]]],[15,[[11,[4,12]]]],[15,[[11,[8,12]]]],[5,[[11,[8,12]]]],0,0,[[]],[[]],[[],11],[[],11],[[],11],[[],11],[[],16],[[],16],0,[5,[[11,[14,12]]]],0,0,0,0,[15,[[11,[5,12]]]]],"p":[[3,"Command"],[8,"Args"],[15,"i32"],[3,"Passwd"],[15,"u32"],[3,"Global"],[3,"Vec"],[3,"Group"],[3,"Formatter"],[3,"Error"],[4,"Result"],[3,"Error"],[4,"Option"],[3,"String"],[15,"str"],[3,"TypeId"],[8,"Locate"]]},\ +"uu_chgrp":{"doc":"","t":[0,5,5,3,8,3,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,12,12,5,5,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,5,12,12,12,12,5],"n":["entries","uu_app","uumain","Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","fmt","fmt","from","from","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid"],"q":["uu_chgrp","","","uu_chgrp::entries","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Get password/group file entry","","","","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell",""],"i":[0,0,0,0,0,0,4,4,8,4,8,4,8,4,8,4,8,4,8,0,0,4,8,0,0,4,8,17,4,4,8,8,4,8,4,8,4,8,4,8,4,8,4,0,4,4,4,4,0],"f":[0,[[],1],[2,3],0,0,0,[4,[[7,[5,6]]]],[[]],[[]],[[]],[[]],[4,4],[8,8],[[]],[[]],[[4,9],[[11,[10]]]],[[8,9],[[11,[10]]]],[[]],[[]],[[],[[11,[[7,[5,6]],12]]]],[[[13,[5]]],[[11,[[7,[5,6]],12]]]],0,0,[5,[[11,[14,12]]]],[15,[[11,[5,12]]]],[[]],[[]],[[],[[11,[12]]]],[15,[[11,[4,12]]]],[5,[[11,[4,12]]]],[15,[[11,[8,12]]]],[5,[[11,[8,12]]]],0,0,[[]],[[]],[[],11],[[],11],[[],11],[[],11],[[],16],[[],16],0,[5,[[11,[14,12]]]],0,0,0,0,[15,[[11,[5,12]]]]],"p":[[3,"Command"],[8,"Args"],[15,"i32"],[3,"Passwd"],[15,"u32"],[3,"Global"],[3,"Vec"],[3,"Group"],[3,"Formatter"],[3,"Error"],[4,"Result"],[3,"Error"],[4,"Option"],[3,"String"],[15,"str"],[3,"TypeId"],[8,"Locate"]]},\ "uu_chmod":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_chmod",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_chown":{"doc":"","t":[3,8,3,11,11,11,11,11,11,11,11,11,0,11,11,11,11,12,12,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,12,12,12,12,5,5,3,8,3,5,5,12,12,5,5,10,12,12,12,5,12,12,12,12,5],"n":["Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","entries","fmt","fmt","from","from","gid","gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","user_dir","user_info","user_passwd","user_shell","uu_app","uumain","Group","Locate","Passwd","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","locate","name","name","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid"],"q":["uu_chown","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_chown::entries","","","","","","","","","","","","","","","","","",""],"d":["","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","Get password/group file entry","","","Returns the argument unchanged.","Returns the argument unchanged.","AKA passwd.pw_gid","AKA group.gr_gid","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell","","","","Fetch desired entry.","","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","","AKA passwd.pw_name","AKA group.gr_name","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell",""],"i":[0,0,0,1,1,5,1,5,1,5,1,5,0,1,5,1,5,1,5,1,5,17,1,1,5,5,1,5,1,5,1,5,1,5,1,5,1,1,1,1,1,0,0,0,0,0,0,0,1,5,0,0,17,1,5,1,0,1,1,1,1,0],"f":[0,0,0,[1,[[4,[2,3]]]],[[]],[[]],[[]],[[]],[1,1],[5,5],[[]],[[]],0,[[1,6],[[8,[7]]]],[[5,6],[[8,[7]]]],[[]],[[]],0,0,[[]],[[]],[[],[[8,[9]]]],[10,[[8,[1,9]]]],[2,[[8,[1,9]]]],[10,[[8,[5,9]]]],[2,[[8,[5,9]]]],0,0,[[]],[[]],[[],8],[[],8],[[],8],[[],8],[[],11],[[],11],0,0,0,0,0,[[],12],[13,14],0,0,0,[[],[[8,[[4,[2,3]],9]]]],[[[15,[2]]],[[8,[[4,[2,3]],9]]]],0,0,[2,[[8,[16,9]]]],[10,[[8,[2,9]]]],[[],[[8,[9]]]],0,0,0,[2,[[8,[16,9]]]],0,0,0,0,[10,[[8,[2,9]]]]],"p":[[3,"Passwd"],[15,"u32"],[3,"Global"],[3,"Vec"],[3,"Group"],[3,"Formatter"],[3,"Error"],[4,"Result"],[3,"Error"],[15,"str"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[4,"Option"],[3,"String"],[8,"Locate"]]},\ +"uu_chown":{"doc":"","t":[3,8,3,11,11,11,11,11,11,11,11,11,0,11,11,11,11,12,12,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,12,12,12,12,5,5,3,8,3,5,5,12,12,5,5,10,12,12,12,5,12,12,12,12,5],"n":["Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","entries","fmt","fmt","from","from","gid","gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","user_dir","user_info","user_passwd","user_shell","uu_app","uumain","Group","Locate","Passwd","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","locate","name","name","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid"],"q":["uu_chown","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_chown::entries","","","","","","","","","","","","","","","","","",""],"d":["","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","Get password/group file entry","","","Returns the argument unchanged.","Returns the argument unchanged.","AKA passwd.pw_gid","AKA group.gr_gid","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell","","","","Fetch desired entry.","","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","","AKA passwd.pw_name","AKA group.gr_name","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell",""],"i":[0,0,0,1,1,5,1,5,1,5,1,5,0,1,5,1,5,1,5,1,5,17,1,1,5,5,1,5,1,5,1,5,1,5,1,5,1,1,1,1,1,0,0,0,0,0,0,0,1,5,0,0,17,1,5,1,0,1,1,1,1,0],"f":[0,0,0,[1,[[4,[2,3]]]],[[]],[[]],[[]],[[]],[1,1],[5,5],[[]],[[]],0,[[1,6],[[8,[7]]]],[[5,6],[[8,[7]]]],[[]],[[]],0,0,[[]],[[]],[[],[[8,[9]]]],[2,[[8,[1,9]]]],[10,[[8,[1,9]]]],[10,[[8,[5,9]]]],[2,[[8,[5,9]]]],0,0,[[]],[[]],[[],8],[[],8],[[],8],[[],8],[[],11],[[],11],0,0,0,0,0,[[],12],[13,14],0,0,0,[[],[[8,[[4,[2,3]],9]]]],[[[15,[2]]],[[8,[[4,[2,3]],9]]]],0,0,[2,[[8,[16,9]]]],[10,[[8,[2,9]]]],[[],[[8,[9]]]],0,0,0,[2,[[8,[16,9]]]],0,0,0,0,[10,[[8,[2,9]]]]],"p":[[3,"Passwd"],[15,"u32"],[3,"Global"],[3,"Vec"],[3,"Group"],[3,"Formatter"],[3,"Error"],[4,"Result"],[3,"Error"],[15,"str"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[4,"Option"],[3,"String"],[8,"Locate"]]},\ "uu_chroot":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_chroot",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_cksum":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_cksum",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_comm":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_comm",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_cp":{"doc":"","t":[13,13,13,4,13,13,13,13,4,13,13,4,6,13,4,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,3,4,13,4,13,13,6,6,4,13,13,13,6,6,4,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,5,12,12,12,12,12,12,12,12,12,12,12,12,12],"n":["Always","Always","AttrOnly","Attribute","Auto","Auto","Backup","Clobber","ClobberMode","Context","Copy","CopyMode","CopyResult","Directory","Error","Error","File","Force","Interactive","InvalidArgument","IoErr","IoErrContext","Link","Links","Mode","Never","Never","NoClobber","NotADirectory","NotAllFilesCopied","NotImplemented","Options","OverwriteMode","Ownership","ReflinkMode","RemoveDestination","Skipped","Source","SourceSlice","SparseMode","Standard","StripPrefixError","SymLink","Target","TargetSlice","TargetType","Timestamps","Update","WalkDirErr","Xattr","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","code","eq","eq","eq","eq","eq","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_str","into","into","into","into","into","into","into","into","into","localize_to_target","ne","partial_cmp","source","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","uu_app","uumain","verify_target_type","0","0","0","0","0","0","0","0","0","0","1","0","0"],"q":["uu_cp","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_cp::Error","","","","","","","","","","","uu_cp::OverwriteMode",""],"d":["","","","","","","Invalid arguments to backup","Default Always overwrite existing files","Specifies whether when overwrite files","","","","","","","General copy error","","","Prompt before overwriting a file","Result of a skipped file","Simple io::Error wrapper","Wrapper for io::Error with path context","","","","","","Never overwrite a file","","Represents the state when a non-fatal error has occurred …","All standard options are included as an an implementation …","Re-usable, extensible copy options","Specifies whether when overwrite files","","Possible arguments for --reflink.","","Result of a skipped file","","","Possible arguments for --sparse.","","Simple std::path::StripPrefixError wrapper","","","","Specifies the expected file type of copy target","","","Simple walkdir::Error wrapper","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Remove the root prefix from source and prefix it with …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Generate an error message if target is not the correct …","","","","","","","","","","","","",""],"i":[3,4,28,0,3,4,7,2,0,5,28,0,0,27,0,7,27,1,2,7,7,7,28,5,5,3,4,2,7,7,7,0,0,5,0,1,7,0,0,0,1,7,28,0,0,0,5,28,7,5,27,28,29,7,1,2,3,4,5,27,28,29,7,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,5,7,1,2,3,4,5,7,7,5,27,28,29,7,7,7,7,7,7,7,7,1,2,3,4,5,5,27,28,29,7,1,2,3,4,5,0,2,5,7,1,2,3,4,5,7,27,28,29,7,1,2,3,4,5,27,28,29,7,1,2,3,4,5,27,28,29,7,1,2,3,4,5,0,0,0,30,31,32,33,34,35,36,37,38,39,31,40,41],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[1,1],[2,2],[3,3],[4,4],[5,5],[[]],[[]],[[]],[[]],[[]],[[5,5],6],[7,8],[[1,1],9],[[2,2],9],[[3,3],9],[[4,4],9],[[5,5],9],[[7,10],11],[[7,10],11],[[5,10],11],[[]],[[]],[[]],[[[14,[12,13]]],7],[[[14,[15,13]]],7],[16,7],[17,7],[15,7],[12,7],[13,7],[[]],[[]],[[]],[[]],[[]],[[]],[15,[[18,[5]]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[19,19,19],[[18,[20]]]],[[2,2],9],[[5,5],[[21,[6]]]],[7,[[21,[22]]]],[[]],[[]],[[]],[[]],[[]],[[],12],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],23],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],25],[26,8],[[19,27],18],0,0,0,0,0,0,0,0,0,0,0,0,0],"p":[[4,"ClobberMode"],[4,"OverwriteMode"],[4,"ReflinkMode"],[4,"SparseMode"],[4,"Attribute"],[4,"Ordering"],[4,"Error"],[15,"i32"],[15,"bool"],[3,"Formatter"],[6,"Result"],[3,"String"],[3,"Error"],[3,"Context"],[15,"str"],[3,"StripPrefixError"],[3,"Error"],[6,"CopyResult"],[3,"Path"],[3,"PathBuf"],[4,"Option"],[8,"Error"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[4,"TargetType"],[4,"CopyMode"],[3,"Options"],[13,"IoErr"],[13,"IoErrContext"],[13,"Error"],[13,"WalkDirErr"],[13,"StripPrefixError"],[13,"Skipped"],[13,"InvalidArgument"],[13,"NotImplemented"],[13,"Backup"],[13,"NotADirectory"],[13,"Clobber"],[13,"Interactive"]]},\ +"uu_cp":{"doc":"","t":[13,13,13,4,13,13,13,13,4,13,13,4,6,13,4,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,3,4,13,4,13,13,6,6,4,13,13,13,6,6,4,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,5,12,12,12,12,12,12,12,12,12,12,12,12,12],"n":["Always","Always","AttrOnly","Attribute","Auto","Auto","Backup","Clobber","ClobberMode","Context","Copy","CopyMode","CopyResult","Directory","Error","Error","File","Force","Interactive","InvalidArgument","IoErr","IoErrContext","Link","Links","Mode","Never","Never","NoClobber","NotADirectory","NotAllFilesCopied","NotImplemented","Options","OverwriteMode","Ownership","ReflinkMode","RemoveDestination","Skipped","Source","SourceSlice","SparseMode","Standard","StripPrefixError","SymLink","Target","TargetSlice","TargetType","Timestamps","Update","WalkDirErr","Xattr","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","code","eq","eq","eq","eq","eq","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_str","into","into","into","into","into","into","into","into","into","localize_to_target","partial_cmp","provide","source","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","uu_app","uumain","verify_target_type","0","0","0","0","0","0","0","0","0","0","1","0","0"],"q":["uu_cp","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_cp::Error","","","","","","","","","","","uu_cp::OverwriteMode",""],"d":["","","","","","","Invalid arguments to backup","Default Always overwrite existing files","Specifies whether when overwrite files","","","","","","","General copy error","","","Prompt before overwriting a file","Result of a skipped file","Simple io::Error wrapper","Wrapper for io::Error with path context","","","","","","Never overwrite a file","","Represents the state when a non-fatal error has occurred …","All standard options are included as an an implementation …","Re-usable, extensible copy options","Specifies whether when overwrite files","","Possible arguments for --reflink.","","Result of a skipped file","","","Possible arguments for --sparse.","","Simple std::path::StripPrefixError wrapper","","","","Specifies the expected file type of copy target","","","Simple walkdir::Error wrapper","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Remove the root prefix from source and prefix it with …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Generate an error message if target is not the correct …","","","","","","","","","","","","",""],"i":[3,4,29,0,3,4,7,2,0,5,29,0,0,28,0,7,28,1,2,7,7,7,29,5,5,3,4,2,7,7,7,0,0,5,0,1,7,0,0,0,1,7,29,0,0,0,5,29,7,5,28,29,30,7,1,2,3,4,5,28,29,30,7,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,5,7,1,2,3,4,5,7,7,5,28,29,30,7,7,7,7,7,7,7,7,1,2,3,4,5,5,28,29,30,7,1,2,3,4,5,0,5,7,7,1,2,3,4,5,7,28,29,30,7,1,2,3,4,5,28,29,30,7,1,2,3,4,5,28,29,30,7,1,2,3,4,5,0,0,0,31,32,33,34,35,36,37,38,39,40,32,41,42],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[1,1],[2,2],[3,3],[4,4],[5,5],[[]],[[]],[[]],[[]],[[]],[[5,5],6],[7,8],[[1,1],9],[[2,2],9],[[3,3],9],[[4,4],9],[[5,5],9],[[7,10],11],[[7,10],11],[[5,10],11],[[]],[[]],[[]],[12,7],[13,7],[[]],[[[14,[12,13]]],7],[15,7],[16,7],[17,7],[[[14,[15,13]]],7],[[]],[[]],[[]],[[]],[[]],[15,[[18,[5]]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[19,19,19],[[18,[20]]]],[[5,5],[[21,[6]]]],[22],[7,[[21,[23]]]],[[]],[[]],[[]],[[]],[[]],[[],12],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],24],[[],25],[[],25],[[],25],[[],25],[[],25],[[],25],[[],25],[[],25],[[],25],[[],26],[27,8],[[19,28],18],0,0,0,0,0,0,0,0,0,0,0,0,0],"p":[[4,"ClobberMode"],[4,"OverwriteMode"],[4,"ReflinkMode"],[4,"SparseMode"],[4,"Attribute"],[4,"Ordering"],[4,"Error"],[15,"i32"],[15,"bool"],[3,"Formatter"],[6,"Result"],[3,"String"],[3,"Error"],[3,"Context"],[15,"str"],[3,"Error"],[3,"StripPrefixError"],[6,"CopyResult"],[3,"Path"],[3,"PathBuf"],[4,"Option"],[3,"Demand"],[8,"Error"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[4,"TargetType"],[4,"CopyMode"],[3,"Options"],[13,"IoErr"],[13,"IoErrContext"],[13,"Error"],[13,"WalkDirErr"],[13,"StripPrefixError"],[13,"Skipped"],[13,"InvalidArgument"],[13,"NotImplemented"],[13,"Backup"],[13,"NotADirectory"],[13,"Clobber"],[13,"Interactive"]]},\ "uu_csplit":{"doc":"","t":[3,11,11,5,11,11,11,11,11,5,5],"n":["CsplitOptions","borrow","borrow_mut","csplit","from","into","try_from","try_into","type_id","uu_app","uumain"],"q":["uu_csplit","","","","","","","","","",""],"d":["Command line options for csplit.","","","Splits a file into severals according to the command line …","Returns the argument unchanged.","Calls U::from(self).","","","","",""],"i":[0,1,1,0,1,1,1,1,1,0,0],"f":[0,[[]],[[]],[[1,[2,[0]]],[[3,[0]]]],[[]],[[]],[[],3],[[],3],[[],4],[[],5],[6,7]],"p":[[3,"CsplitOptions"],[3,"Vec"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_cut":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_cut",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_date":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_date",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ @@ -126,7 +126,7 @@ var searchIndex = JSON.parse('{\ "uu_env":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_env",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_expand":{"doc":"","t":[0,5,5,7,7,7,7],"n":["options","uu_app","uumain","FILES","INITIAL","NO_UTF8","TABS"],"q":["uu_expand","","","uu_expand::options","","",""],"d":["","","","","","",""],"i":[0,0,0,0,0,0,0],"f":[0,[[],1],[2,3],0,0,0,0],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_expr":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_expr",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_factor":{"doc":"","t":[3,11,11,11,11,11,11,5,11,11,11,11,11,0,11,11,0,11,11,11,11,11,5,5,11,5,17,17,17,5,5],"n":["Factors","add","borrow","borrow_mut","clone","clone_into","eq","factor","fmt","fmt","from","into","ne","numeric","one","push","table","to_owned","to_string","try_from","try_into","type_id","uu_app","uumain","vzip","gcd","CHUNK_SIZE","NEXT_PRIME","PRIME_INVERSIONS_U64","factor","factor_chunk"],"q":["uu_factor","","","","","","","","","","","","","","","","","","","","","","","","","uu_factor::numeric","uu_factor::table","","","",""],"d":["","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","","","","","","","",""],"i":[0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0],"f":[0,[[1,2,3]],[[]],[[]],[1,1],[[]],[[1,1],4],[2,1],[[1,5],6],[[1,5],6],[[]],[[]],[[1,1],4],0,[[],1],[[1,2]],0,[[]],[[],7],[[],8],[[],8],[[],9],[[],10],[11,12],[[]],[[2,2],2],0,0,0,[[2,1]],[[]]],"p":[[3,"Factors"],[15,"u64"],[15,"u8"],[15,"bool"],[3,"Formatter"],[6,"Result"],[3,"String"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"]]},\ +"uu_factor":{"doc":"","t":[3,11,11,11,11,11,11,5,11,11,11,11,0,11,11,0,11,11,11,11,11,5,5,11,5,17,17,17,5,5],"n":["Factors","add","borrow","borrow_mut","clone","clone_into","eq","factor","fmt","fmt","from","into","numeric","one","push","table","to_owned","to_string","try_from","try_into","type_id","uu_app","uumain","vzip","gcd","CHUNK_SIZE","NEXT_PRIME","PRIME_INVERSIONS_U64","factor","factor_chunk"],"q":["uu_factor","","","","","","","","","","","","","","","","","","","","","","","","uu_factor::numeric","uu_factor::table","","","",""],"d":["","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","","","","","","",""],"i":[0,1,1,1,1,1,1,0,1,1,1,1,0,1,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0],"f":[0,[[1,2,3]],[[]],[[]],[1,1],[[]],[[1,1],4],[2,1],[[1,5],6],[[1,5],6],[[]],[[]],0,[[],1],[[1,2]],0,[[]],[[],7],[[],8],[[],8],[[],9],[[],10],[11,12],[[]],[[2,2],2],0,0,0,[[2,1]],[[]]],"p":[[3,"Factors"],[15,"u64"],[15,"u8"],[15,"bool"],[3,"Formatter"],[6,"Result"],[3,"String"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_false":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_false",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_fmt":{"doc":"","t":[6,3,11,11,11,11,11,11,11,5,5],"n":["FileOrStdReader","FmtOptions","borrow","borrow_mut","from","into","try_from","try_into","type_id","uu_app","uumain"],"q":["uu_fmt","","","","","","","","","",""],"d":["","","","","Returns the argument unchanged.","Calls U::from(self).","","","","",""],"i":[0,0,6,6,6,6,6,6,6,0,0],"f":[0,0,[[]],[[]],[[]],[[]],[[],1],[[],1],[[],2],[[],3],[4,5]],"p":[[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[3,"FmtOptions"]]},\ "uu_fold":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_fold",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ @@ -153,7 +153,7 @@ var searchIndex = JSON.parse('{\ "uu_nl":{"doc":"","t":[3,11,11,11,11,0,11,11,11,5,5,17,17,17,17,17,17,17,17,17,17,17,17,17],"n":["Settings","borrow","borrow_mut","from","into","options","try_from","try_into","type_id","uu_app","uumain","BODY_NUMBERING","FILE","FOOTER_NUMBERING","HEADER_NUMBERING","HELP","JOIN_BLANK_LINES","LINE_INCREMENT","NO_RENUMBER","NUMBER_FORMAT","NUMBER_SEPARATOR","NUMBER_WIDTH","SECTION_DELIMITER","STARTING_LINE_NUMBER"],"q":["uu_nl","","","","","","","","","","","uu_nl::options","","","","","","","","","","","",""],"d":["","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","","","","","","","",""],"i":[0,6,6,6,6,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"f":[0,[[]],[[]],[[]],[[]],0,[[],1],[[],1],[[],2],[[],3],[4,5],0,0,0,0,0,0,0,0,0,0,0,0,0],"p":[[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[3,"Settings"]]},\ "uu_nohup":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_nohup",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_nproc":{"doc":"","t":[17,5,5],"n":["_SC_NPROCESSORS_CONF","uu_app","uumain"],"q":["uu_nproc","",""],"d":["","",""],"i":[0,0,0],"f":[0,[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_numfmt":{"doc":"","t":[0,0,0,5,5,13,13,13,4,11,11,11,11,11,11,11,11,11,11,11,12,12,12,3,11,11,5,5,11,11,11,11,11,12,11,11,11,17,13,17,17,17,17,17,17,17,3,13,17,17,17,13,3,17,17,4,17,17,17,17,17,13,3,13,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,12,11,11,11,11,12,11,12,12,12,11,11,11,11,11,12,12,12,12,11,12,12,12,12,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,12],"n":["errors","format","options","uu_app","uumain","FormattingError","IllegalArgument","IoError","NumfmtError","borrow","borrow_mut","code","fmt","fmt","from","into","to_string","try_from","try_into","type_id","0","0","0","WhitespaceSplitter","borrow","borrow_mut","div_round","format_and_print","from","into","into_iter","multiunzip","next","s","try_from","try_into","type_id","DELIMITER","Down","FIELD","FIELD_DEFAULT","FORMAT","FROM","FROM_DEFAULT","FROM_UNIT","FROM_UNIT_DEFAULT","FormatOptions","FromZero","HEADER","HEADER_DEFAULT","NUMBER","Nearest","NumfmtOptions","PADDING","ROUND","RoundMethod","SUFFIX","TO","TO_DEFAULT","TO_UNIT","TO_UNIT_DEFAULT","TowardsZero","TransformOptions","Up","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","default","delimiter","eq","fields","fmt","format","from","from","from","from","from","from_str","from_unit","grouping","header","into","into","into","into","ne","padding","padding","precision","prefix","round","round","suffix","suffix","to","to_owned","to_unit","transform","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","zero_padding"],"q":["uu_numfmt","","","","","uu_numfmt::errors","","","","","","","","","","","","","","","uu_numfmt::errors::NumfmtError","","","uu_numfmt::format","","","","","","","","","","","","","","uu_numfmt::options","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","Iterate over a line’s fields, where each field is a …","","","Divide numerator by denominator, with rounding.","Format a line of text according to the selected options.","Returns the argument unchanged.","Calls U::from(self).","","","Yield the next field in the input string as a tuple …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,4,4,4,0,4,4,4,4,4,4,4,4,4,4,4,18,19,20,0,14,14,0,0,14,14,14,14,14,14,14,14,14,0,11,0,0,0,0,0,0,0,0,11,0,0,0,11,0,0,0,0,0,0,0,0,0,11,0,11,21,13,11,16,21,13,11,16,11,11,16,13,16,13,16,13,21,13,11,16,21,16,21,16,13,21,13,11,16,16,13,16,16,16,11,13,13,16,21,11,21,13,21,13,11,16,21,13,11,16,21,13,11,16,16],"f":[0,0,0,[[],1],[2,3],0,0,0,0,[[]],[[]],[4,3],[[4,5],6],[[4,5],6],[[]],[[]],[[],7],[[],8],[[],8],[[],9],0,0,0,0,[[]],[[]],[[10,10,11],10],[[12,13],[[8,[7]]]],[[]],[[]],[[]],[[]],[14,15],0,[[],8],[[],8],[[],9],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[11,11],[[]],[[],16],0,[[16,16],17],0,[[16,5],6],0,[[]],[[]],[[]],[[]],0,[12,[[8,[16]]]],0,0,0,[[]],[[]],[[]],[[]],[[16,16],17],0,0,0,0,[[11,10],10],0,0,0,0,[[]],0,0,[[],8],[[],8],[[],8],[[],8],[[],8],[[],8],[[],8],[[],8],[[],9],[[],9],[[],9],[[],9],0],"p":[[3,"Command"],[8,"Args"],[15,"i32"],[4,"NumfmtError"],[3,"Formatter"],[6,"Result"],[3,"String"],[4,"Result"],[3,"TypeId"],[15,"f64"],[4,"RoundMethod"],[15,"str"],[3,"NumfmtOptions"],[3,"WhitespaceSplitter"],[4,"Option"],[3,"FormatOptions"],[15,"bool"],[13,"IoError"],[13,"IllegalArgument"],[13,"FormattingError"],[3,"TransformOptions"]]},\ +"uu_numfmt":{"doc":"","t":[0,0,0,5,5,13,13,13,4,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,3,11,11,5,5,11,11,11,11,11,12,11,11,11,17,13,17,17,17,17,17,17,17,3,13,17,17,17,13,3,17,17,4,17,17,17,17,17,13,3,13,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,12,11,11,11,11,12,11,12,12,12,11,11,11,11,12,12,12,12,11,12,12,12,12,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,12],"n":["errors","format","options","uu_app","uumain","FormattingError","IllegalArgument","IoError","NumfmtError","borrow","borrow_mut","code","fmt","fmt","from","into","provide","to_string","try_from","try_into","type_id","0","0","0","WhitespaceSplitter","borrow","borrow_mut","div_round","format_and_print","from","into","into_iter","multiunzip","next","s","try_from","try_into","type_id","DELIMITER","Down","FIELD","FIELD_DEFAULT","FORMAT","FROM","FROM_DEFAULT","FROM_UNIT","FROM_UNIT_DEFAULT","FormatOptions","FromZero","HEADER","HEADER_DEFAULT","NUMBER","Nearest","NumfmtOptions","PADDING","ROUND","RoundMethod","SUFFIX","TO","TO_DEFAULT","TO_UNIT","TO_UNIT_DEFAULT","TowardsZero","TransformOptions","Up","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","default","delimiter","eq","fields","fmt","format","from","from","from","from","from","from_str","from_unit","grouping","header","into","into","into","into","padding","padding","precision","prefix","round","round","suffix","suffix","to","to_owned","to_unit","transform","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","zero_padding"],"q":["uu_numfmt","","","","","uu_numfmt::errors","","","","","","","","","","","","","","","","uu_numfmt::errors::NumfmtError","","","uu_numfmt::format","","","","","","","","","","","","","","uu_numfmt::options","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","Iterate over a line’s fields, where each field is a …","","","Divide numerator by denominator, with rounding.","Format a line of text according to the selected options.","Returns the argument unchanged.","Calls U::from(self).","","","Yield the next field in the input string as a tuple …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,4,4,4,0,4,4,4,4,4,4,4,4,4,4,4,4,19,20,21,0,15,15,0,0,15,15,15,15,15,15,15,15,15,0,12,0,0,0,0,0,0,0,0,12,0,0,0,12,0,0,0,0,0,0,0,0,0,12,0,12,22,14,12,17,22,14,12,17,12,12,17,14,17,14,17,14,22,14,12,17,22,17,22,17,14,22,14,12,17,14,17,17,17,12,14,14,17,22,12,22,14,22,14,12,17,22,14,12,17,22,14,12,17,17],"f":[0,0,0,[[],1],[2,3],0,0,0,0,[[]],[[]],[4,3],[[4,5],6],[[4,5],6],[[]],[[]],[7],[[],8],[[],9],[[],9],[[],10],0,0,0,0,[[]],[[]],[[11,11,12],11],[[13,14],[[9,[8]]]],[[]],[[]],[[]],[[]],[15,16],0,[[],9],[[],9],[[],10],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[12,12],[[]],[[],17],0,[[17,17],18],0,[[17,5],6],0,[[]],[[]],[[]],[[]],0,[13,[[9,[17]]]],0,0,0,[[]],[[]],[[]],[[]],0,0,0,0,[[12,11],11],0,0,0,0,[[]],0,0,[[],9],[[],9],[[],9],[[],9],[[],9],[[],9],[[],9],[[],9],[[],10],[[],10],[[],10],[[],10],0],"p":[[3,"Command"],[8,"Args"],[15,"i32"],[4,"NumfmtError"],[3,"Formatter"],[6,"Result"],[3,"Demand"],[3,"String"],[4,"Result"],[3,"TypeId"],[15,"f64"],[4,"RoundMethod"],[15,"str"],[3,"NumfmtOptions"],[3,"WhitespaceSplitter"],[4,"Option"],[3,"FormatOptions"],[15,"bool"],[13,"IoError"],[13,"IllegalArgument"],[13,"FormattingError"],[3,"TransformOptions"]]},\ "uu_od":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_od",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_paste":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_paste",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_pathchk":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_pathchk",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ @@ -173,15 +173,15 @@ var searchIndex = JSON.parse('{\ "uu_shred":{"doc":"","t":[0,5,5,17,17,17,17,17,17,17,17],"n":["options","uu_app","uumain","EXACT","FILE","FORCE","ITERATIONS","REMOVE","SIZE","VERBOSE","ZERO"],"q":["uu_shred","","","uu_shred::options","","","","","","",""],"d":["","","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0],"f":[0,[[],1],[2,3],0,0,0,0,0,0,0,0],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_shuf":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_shuf",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_sleep":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_sleep",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_sort":{"doc":"","t":[4,3,13,13,3,13,13,13,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,11,11,11,11,12],"n":["GeneralF64ParseResult","GlobalSettings","Infinity","Invalid","Line","NaN","NegInfinity","Number","Output","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone_into","clone_into","clone_into","default","deref","deref","deref","deref","deref_mut","deref_mut","deref_mut","deref_mut","drop","drop","drop","drop","eq","fmt","fmt","from","from","from","from","init","init","init","init","into","into","into","into","ne","partial_cmp","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","uu_app","uumain","vzip","vzip","vzip","vzip","0"],"q":["uu_sort","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_sort::GeneralF64ParseResult"],"d":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,3,3,0,3,3,3,0,15,1,2,3,15,1,2,3,1,2,3,1,2,3,1,15,1,2,3,15,1,2,3,15,1,2,3,3,2,3,15,1,2,3,15,1,2,3,15,1,2,3,3,3,1,2,3,15,1,2,3,15,1,2,3,15,1,2,3,0,0,15,1,2,3,16],"f":[0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[1,1],[2,2],[3,3],[[]],[[]],[[]],[[],1],[4],[4],[4],[4],[4],[4],[4],[4],[4],[4],[4],[4],[[3,3],5],[[2,6],7],[[3,6],7],[[]],[[]],[[]],[[]],[[],4],[[],4],[[],4],[[],4],[[]],[[]],[[]],[[]],[[3,3],5],[[3,3],[[9,[8]]]],[[]],[[]],[[]],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],11],[[],11],[[],11],[[],11],[[],12],[13,14],[[]],[[]],[[]],[[]],0],"p":[[3,"GlobalSettings"],[3,"Line"],[4,"GeneralF64ParseResult"],[15,"usize"],[15,"bool"],[3,"Formatter"],[6,"Result"],[4,"Ordering"],[4,"Option"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[3,"Output"],[13,"Number"]]},\ +"uu_sort":{"doc":"","t":[4,3,13,13,3,13,13,13,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,11,11,11,11,12],"n":["GeneralF64ParseResult","GlobalSettings","Infinity","Invalid","Line","NaN","NegInfinity","Number","Output","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone_into","clone_into","clone_into","default","deref","deref","deref","deref","deref_mut","deref_mut","deref_mut","deref_mut","drop","drop","drop","drop","eq","fmt","fmt","from","from","from","from","init","init","init","init","into","into","into","into","partial_cmp","to_owned","to_owned","to_owned","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","uu_app","uumain","vzip","vzip","vzip","vzip","0"],"q":["uu_sort","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_sort::GeneralF64ParseResult"],"d":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,3,3,0,3,3,3,0,15,1,2,3,15,1,2,3,1,2,3,1,2,3,1,15,1,2,3,15,1,2,3,15,1,2,3,3,2,3,15,1,2,3,15,1,2,3,15,1,2,3,3,1,2,3,15,1,2,3,15,1,2,3,15,1,2,3,0,0,15,1,2,3,16],"f":[0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[1,1],[2,2],[3,3],[[]],[[]],[[]],[[],1],[4],[4],[4],[4],[4],[4],[4],[4],[4],[4],[4],[4],[[3,3],5],[[2,6],7],[[3,6],7],[[]],[[]],[[]],[[]],[[],4],[[],4],[[],4],[[],4],[[]],[[]],[[]],[[]],[[3,3],[[9,[8]]]],[[]],[[]],[[]],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],11],[[],11],[[],11],[[],11],[[],12],[13,14],[[]],[[]],[[]],[[]],0],"p":[[3,"GlobalSettings"],[3,"Line"],[4,"GeneralF64ParseResult"],[15,"usize"],[15,"bool"],[3,"Formatter"],[6,"Result"],[4,"Ordering"],[4,"Option"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[3,"Output"],[13,"Number"]]},\ "uu_split":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_split",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_stat":{"doc":"","t":[13,13,17,17,17,17,17,17,13,4,8,3,13,4,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,0,10,10,11,11,11,11,11,11,11,11,11,5,5,12,12,12,12,12,7,7,7,7,7],"n":["Char","Directive","F_ALTER","F_GROUP","F_LEFT","F_SIGN","F_SPACE","F_ZERO","Integer","OutputType","ScanUtil","Stater","Str","Token","Unknown","Unsigned","UnsignedHex","UnsignedOct","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","eq","eq","fmt","fmt","from","from","from","generate_tokens","group_num","into","into","into","ne","options","scan_char","scan_num","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","uu_app","uumain","0","flag","format","precision","width","DEREFERENCE","FILE_SYSTEM","FORMAT","PRINTF","TERSE"],"q":["uu_stat","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_stat::Token","","","","","uu_stat::options","","","",""],"d":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[3,3,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,1,17,1,3,17,1,3,1,3,1,3,17,1,3,17,0,17,1,3,3,0,18,18,17,1,3,17,1,3,17,1,3,0,0,19,20,20,20,20,0,0,0,0,0],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[1,1],2],[[3,3],2],[[1,4],5],[[3,4],5],[[]],[[]],[[]],[[6,2],[[8,[[7,[3]]]]]],[6,[[9,[6]]]],[[]],[[]],[[]],[[3,3],2],0,[10,11],[[],11],[[],12],[[],12],[[],12],[[],12],[[],12],[[],12],[[],13],[[],13],[[],13],[[],14],[15,16],0,0,0,0,0,0,0,0,0,0],"p":[[4,"OutputType"],[15,"bool"],[4,"Token"],[3,"Formatter"],[6,"Result"],[15,"str"],[3,"Vec"],[6,"UResult"],[4,"Cow"],[15,"u32"],[4,"Option"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[3,"Stater"],[8,"ScanUtil"],[13,"Char"],[13,"Directive"]]},\ +"uu_stat":{"doc":"","t":[13,13,17,17,17,17,17,17,13,4,8,3,13,4,13,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,0,10,10,11,11,11,11,11,11,11,11,11,5,5,12,12,12,12,12,7,7,7,7,7],"n":["Char","Directive","F_ALTER","F_GROUP","F_LEFT","F_SIGN","F_SPACE","F_ZERO","Integer","OutputType","ScanUtil","Stater","Str","Token","Unknown","Unsigned","UnsignedHex","UnsignedOct","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","eq","eq","fmt","fmt","from","from","from","generate_tokens","group_num","into","into","into","options","scan_char","scan_num","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","uu_app","uumain","0","flag","format","precision","width","DEREFERENCE","FILE_SYSTEM","FORMAT","PRINTF","TERSE"],"q":["uu_stat","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_stat::Token","","","","","uu_stat::options","","","",""],"d":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[3,3,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,1,17,1,3,17,1,3,1,3,1,3,17,1,3,17,0,17,1,3,0,18,18,17,1,3,17,1,3,17,1,3,0,0,19,20,20,20,20,0,0,0,0,0],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[1,1],2],[[3,3],2],[[1,4],5],[[3,4],5],[[]],[[]],[[]],[[6,2],[[8,[[7,[3]]]]]],[6,[[9,[6]]]],[[]],[[]],[[]],0,[10,11],[[],11],[[],12],[[],12],[[],12],[[],12],[[],12],[[],12],[[],13],[[],13],[[],13],[[],14],[15,16],0,0,0,0,0,0,0,0,0,0],"p":[[4,"OutputType"],[15,"bool"],[4,"Token"],[3,"Formatter"],[6,"Result"],[15,"str"],[3,"Vec"],[6,"UResult"],[4,"Cow"],[15,"u32"],[4,"Option"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"],[3,"Stater"],[8,"ScanUtil"],[13,"Char"],[13,"Directive"]]},\ "uu_stdbuf":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_stdbuf",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_stty":{"doc":"","t":[3,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,11,11,11,11,11,11,11,5,5],"n":["Flag","TermSize","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","default","fmt","fmt","from","from","hidden","into","into","new","new_grouped","sane","tiocgwinsz","tiocswinsz","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uu_app","uumain"],"q":["uu_stty","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","","","","Get terminal window size","Set terminal window size","","","","","","","","",""],"i":[0,0,2,3,2,3,2,2,3,2,3,2,3,2,2,3,2,2,2,0,0,2,2,3,2,3,2,3,0,0],"f":[0,0,[[]],[[]],[[]],[[]],[[[2,[1]]],[[2,[1]]]],[[]],[[],3],[[[2,[4]],5],6],[[3,5],6],[[]],[[]],[2,2],[[]],[[]],[7,2],[7,2],[2,2],[[8,3],[[9,[8]]]],[[8,3],[[9,[8]]]],[[]],[[],10],[[],10],[[],10],[[],10],[[],11],[[],11],[[],12],[13,14]],"p":[[8,"Clone"],[3,"Flag"],[3,"TermSize"],[8,"Debug"],[3,"Formatter"],[6,"Result"],[15,"str"],[6,"c_int"],[6,"Result"],[4,"Result"],[3,"TypeId"],[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_sum":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_sum",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_sync":{"doc":"","t":[0,5,5,7,7],"n":["options","uu_app","uumain","DATA","FILE_SYSTEM"],"q":["uu_sync","","","uu_sync::options",""],"d":["","","","",""],"i":[0,0,0,0,0],"f":[0,[[],1],[2,3],0,0],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_tac":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_tac",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uu_tail":{"doc":"","t":[0,0,0,2,5,13,13,4,4,13,13,13,13,13,13,3,4,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,11,11,11,11,12,12,11,11,0,5,12,12,12,12,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,5,12,12,12,12,12,12,7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,17,17,3,3,3,3,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,7,7,7,7,7,7,7,7,7],"n":["args","chunks","text","uu_app","uumain","Bytes","Descriptor","FilterMode","FollowMode","Lines","MinusZero","Name","Negative","PlusZero","Positive","Settings","Signum","arg_iterate","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","default","default","eq","eq","eq","fmt","fmt","fmt","fmt","follow","from","from","from","from","from","inputs","into","into","into","into","max_unchanged_stats","mode","ne","ne","options","parse_args","pid","presume_input_pipe","retry","sleep_sec","stdin_is_pipe_or_fifo","to_owned","to_owned","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","use_polling","uu_app","verbose","0","0","1","0","0","ARG_FILES","BYTES","DISABLE_INOTIFY_TERM","FOLLOW","FOLLOW_RETRY","LINES","MAX_UNCHANGED_STATS","PID","PRESUME_INPUT_PIPE","RETRY","SLEEP_INT","USE_POLLING","ZERO_TERM","verbosity","QUIET","VERBOSE","BLOCK_SIZE","BUFFER_SIZE","BytesChunk","BytesChunkBuffer","LinesChunk","LinesChunkBuffer","ReverseChunks","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","eq","fill","fill","fill","fill","fmt","fmt","from","from","from","from","from","get_buffer","get_buffer","get_buffer_with","get_buffer_with","get_lines","has_data","has_data","has_data","into","into","into","into","into","into_iter","ne","new","new","new","new","new","next","print","print","print_bytes","print_lines","to_owned","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","BACKEND","BAD_FD","BECOME_INACCESSIBLE","DASH","DEV_STDIN","FD0","NO_FILES_REMAINING","NO_SUCH_FILE","STDIN_HEADER"],"q":["uu_tail","","","","","uu_tail::args","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_tail::args::FilterMode","","","uu_tail::args::Signum","","uu_tail::args::options","","","","","","","","","","","","","","uu_tail::args::options::verbosity","","uu_tail::chunks","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_tail::text","","","","","","","",""],"d":["","Iterating over a file by chunks, either starting at the …","","","","","","","","Mode for lines delimited by delimiter as u8","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","When reading files in reverse in bounded_tail, this is the …","The size of the backing buffer of a LinesChunk or …","A BytesChunk storing a fixed size number of bytes in a …","An abstraction layer on top of BytesChunk mainly to …","Works similar to a BytesChunk but also stores the number …","An abstraction layer on top of LinesChunk mainly to …","An iterator over a file in non-overlapping chunks from the …","","","","","","","","","","","","","","Fills this buffer with chunks and consumes the reader …","Fills this buffer with chunks and consumes the reader …","Fills self.buffer with maximal BUFFER_SIZE number of …","Fills self.buffer with maximal BUFFER_SIZE number of …","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Receive the internal buffer safely, so it returns a slice …","Returns this buffer safely. See BytesChunk::get_buffer","Like BytesChunk::get_buffer, but returning a slice from …","Returns this buffer safely with an offset applied. See …","Return the number of lines the buffer contains. self.lines …","","","Returns true if this buffer has stored any bytes.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","Creates a new BytesChunkBuffer.","Create a new LinesChunkBuffer","","","","","","Print the bytes contained in this buffer beginning from …","Print the bytes contained in this buffer calculated with …","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,8,7,0,0,8,6,7,6,6,6,0,0,0,6,8,7,9,6,8,7,9,6,7,6,7,8,9,6,8,7,6,8,7,9,9,6,8,7,9,9,9,6,8,7,9,9,9,6,8,0,0,9,9,9,9,0,6,7,6,8,7,9,6,8,7,9,6,8,7,9,9,0,9,28,29,29,30,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,18,19,17,22,24,18,19,17,22,17,17,17,18,19,17,22,17,22,24,18,19,17,22,17,22,17,22,22,18,17,22,24,18,19,17,22,24,17,24,18,19,17,22,24,18,19,22,22,17,24,18,19,17,22,24,18,19,17,22,24,18,19,17,22,0,0,0,0,0,0,0,0,0],"f":[0,0,0,0,[1,2],0,0,0,0,0,0,0,0,0,0,0,0,[1,[[5,[[4,[3]]]]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[6,6],[7,7],[[]],[[]],[[],8],[[],9],[[6,6],10],[[8,8],10],[[7,7],10],[[6,11],12],[[8,11],12],[[7,11],12],[[9,11],12],0,[[]],[[]],[[]],[13,[[5,[9]]]],[[]],0,[[]],[[]],[[]],[[]],0,0,[[6,6],10],[[8,8],10],0,[1,[[5,[9]]]],0,0,0,0,[[],10],[[]],[[]],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],15],[[],15],[[],15],[[],15],0,[[],16],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[17,17],[[]],[[17,17],10],[18,5],[19,5],[17,[[5,[[21,[20]]]]]],[22,[[5,[[21,[20]]]]]],[[17,11],12],[[22,11],12],[[]],[[]],[[]],[[]],[[]],[17],[22],[[17,20]],[[22,20]],[22,20],[18,10],[17,10],[22,10],[[]],[[]],[[]],[[]],[[]],[[]],[[17,17],10],[23,24],[25,18],[[26,25],19],[[],17],[26,22],[24,21],[[18,27],5],[[19,27],5],[[22,20],5],[[22,20],5],[[]],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],15],[[],15],[[],15],[[],15],[[],15],0,0,0,0,0,0,0,0,0],"p":[[8,"Args"],[15,"i32"],[8,"Iterator"],[3,"Box"],[6,"UResult"],[4,"Signum"],[4,"FollowMode"],[4,"FilterMode"],[3,"Settings"],[15,"bool"],[3,"Formatter"],[6,"Result"],[3,"ArgMatches"],[4,"Result"],[3,"TypeId"],[3,"Command"],[3,"BytesChunk"],[3,"BytesChunkBuffer"],[3,"LinesChunkBuffer"],[15,"usize"],[4,"Option"],[3,"LinesChunk"],[3,"File"],[3,"ReverseChunks"],[15,"u64"],[15,"u8"],[8,"Write"],[13,"Bytes"],[13,"Lines"],[13,"Negative"],[13,"Positive"]]},\ +"uu_tail":{"doc":"","t":[0,0,0,2,5,13,13,4,4,13,13,13,13,13,13,3,4,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,11,11,11,11,12,12,0,5,12,12,12,12,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,5,12,12,12,12,12,12,7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,17,17,3,3,3,3,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,7,7,7,7,7,7,7,7,7],"n":["args","chunks","text","uu_app","uumain","Bytes","Descriptor","FilterMode","FollowMode","Lines","MinusZero","Name","Negative","PlusZero","Positive","Settings","Signum","arg_iterate","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","default","default","eq","eq","eq","fmt","fmt","fmt","fmt","follow","from","from","from","from","from","inputs","into","into","into","into","max_unchanged_stats","mode","options","parse_args","pid","presume_input_pipe","retry","sleep_sec","stdin_is_pipe_or_fifo","to_owned","to_owned","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","use_polling","uu_app","verbose","0","0","1","0","0","ARG_FILES","BYTES","DISABLE_INOTIFY_TERM","FOLLOW","FOLLOW_RETRY","LINES","MAX_UNCHANGED_STATS","PID","PRESUME_INPUT_PIPE","RETRY","SLEEP_INT","USE_POLLING","ZERO_TERM","verbosity","QUIET","VERBOSE","BLOCK_SIZE","BUFFER_SIZE","BytesChunk","BytesChunkBuffer","LinesChunk","LinesChunkBuffer","ReverseChunks","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","eq","fill","fill","fill","fill","fmt","fmt","from","from","from","from","from","get_buffer","get_buffer","get_buffer_with","get_buffer_with","get_lines","has_data","has_data","has_data","into","into","into","into","into","into_iter","new","new","new","new","new","next","print","print","print_bytes","print_lines","to_owned","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","BACKEND","BAD_FD","BECOME_INACCESSIBLE","DASH","DEV_STDIN","FD0","NO_FILES_REMAINING","NO_SUCH_FILE","STDIN_HEADER"],"q":["uu_tail","","","","","uu_tail::args","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_tail::args::FilterMode","","","uu_tail::args::Signum","","uu_tail::args::options","","","","","","","","","","","","","","uu_tail::args::options::verbosity","","uu_tail::chunks","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uu_tail::text","","","","","","","",""],"d":["","Iterating over a file by chunks, either starting at the …","","","","","","","","Mode for lines delimited by delimiter as u8","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","When reading files in reverse in bounded_tail, this is the …","The size of the backing buffer of a LinesChunk or …","A BytesChunk storing a fixed size number of bytes in a …","An abstraction layer on top of BytesChunk mainly to …","Works similar to a BytesChunk but also stores the number …","An abstraction layer on top of LinesChunk mainly to …","An iterator over a file in non-overlapping chunks from the …","","","","","","","","","","","","","","Fills this buffer with chunks and consumes the reader …","Fills this buffer with chunks and consumes the reader …","Fills self.buffer with maximal BUFFER_SIZE number of …","Fills self.buffer with maximal BUFFER_SIZE number of …","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Receive the internal buffer safely, so it returns a slice …","Returns this buffer safely. See BytesChunk::get_buffer","Like BytesChunk::get_buffer, but returning a slice from …","Returns this buffer safely with an offset applied. See …","Return the number of lines the buffer contains. self.lines …","","","Returns true if this buffer has stored any bytes.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","Creates a new BytesChunkBuffer.","Create a new LinesChunkBuffer","","","","","","Print the bytes contained in this buffer beginning from …","Print the bytes contained in this buffer calculated with …","","","","","","","","","","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,8,7,0,0,8,6,7,6,6,6,0,0,0,6,8,7,9,6,8,7,9,6,7,6,7,8,9,6,8,7,6,8,7,9,9,6,8,7,9,9,9,6,8,7,9,9,9,0,0,9,9,9,9,0,6,7,6,8,7,9,6,8,7,9,6,8,7,9,9,0,9,28,29,29,30,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,18,19,17,22,24,18,19,17,22,17,17,17,18,19,17,22,17,22,24,18,19,17,22,17,22,17,22,22,18,17,22,24,18,19,17,22,24,24,18,19,17,22,24,18,19,22,22,17,24,18,19,17,22,24,18,19,17,22,24,18,19,17,22,0,0,0,0,0,0,0,0,0],"f":[0,0,0,0,[1,2],0,0,0,0,0,0,0,0,0,0,0,0,[1,[[5,[[4,[3]]]]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[6,6],[7,7],[[]],[[]],[[],8],[[],9],[[6,6],10],[[8,8],10],[[7,7],10],[[6,11],12],[[8,11],12],[[7,11],12],[[9,11],12],0,[[]],[[]],[[]],[[]],[13,[[5,[9]]]],0,[[]],[[]],[[]],[[]],0,0,0,[1,[[5,[9]]]],0,0,0,0,[[],10],[[]],[[]],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],15],[[],15],[[],15],[[],15],0,[[],16],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[17,17],[[]],[[17,17],10],[18,5],[19,5],[17,[[5,[[21,[20]]]]]],[22,[[5,[[21,[20]]]]]],[[17,11],12],[[22,11],12],[[]],[[]],[[]],[[]],[[]],[17],[22],[[17,20]],[[22,20]],[22,20],[18,10],[17,10],[22,10],[[]],[[]],[[]],[[]],[[]],[[]],[23,24],[25,18],[[26,25],19],[[],17],[26,22],[24,21],[[18,27],5],[[19,27],5],[[22,20],5],[[22,20],5],[[]],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],15],[[],15],[[],15],[[],15],[[],15],0,0,0,0,0,0,0,0,0],"p":[[8,"Args"],[15,"i32"],[8,"Iterator"],[3,"Box"],[6,"UResult"],[4,"Signum"],[4,"FollowMode"],[4,"FilterMode"],[3,"Settings"],[15,"bool"],[3,"Formatter"],[6,"Result"],[3,"ArgMatches"],[4,"Result"],[3,"TypeId"],[3,"Command"],[3,"BytesChunk"],[3,"BytesChunkBuffer"],[3,"LinesChunkBuffer"],[15,"usize"],[4,"Option"],[3,"LinesChunk"],[3,"File"],[3,"ReverseChunks"],[15,"u64"],[15,"u8"],[8,"Write"],[13,"Bytes"],[13,"Lines"],[13,"Negative"],[13,"Positive"]]},\ "uu_tee":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_tee",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_test":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_test",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_timeout":{"doc":"","t":[0,5,5,7,7,7,7,7,7,7],"n":["options","uu_app","uumain","COMMAND","DURATION","FOREGROUND","KILL_AFTER","PRESERVE_STATUS","SIGNAL","VERBOSE"],"q":["uu_timeout","","","uu_timeout::options","","","","","",""],"d":["","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0],"f":[0,[[],1],[2,3],0,0,0,0,0,0,0],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ @@ -202,7 +202,7 @@ var searchIndex = JSON.parse('{\ "uu_who":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_who",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_whoami":{"doc":"","t":[5,5],"n":["uu_app","uumain"],"q":["uu_whoami",""],"d":["",""],"i":[0,0],"f":[[[],1],[2,3]],"p":[[3,"Command"],[8,"Args"],[15,"i32"]]},\ "uu_yes":{"doc":"","t":[5,5,5],"n":["exec","uu_app","uumain"],"q":["uu_yes","",""],"d":["","",""],"i":[0,0,0],"f":[[[],1],[[],2],[3,4]],"p":[[6,"Result"],[3,"Command"],[8,"Args"],[15,"i32"]]},\ -"uucore":{"doc":"","t":[8,5,0,14,11,11,14,14,0,0,0,0,5,5,0,0,5,14,14,14,0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,5,14,14,14,14,0,14,5,0,0,13,17,7,4,13,4,13,13,13,13,13,0,11,11,11,11,11,11,11,5,5,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,7,7,7,5,5,5,8,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,10,11,11,11,11,11,13,13,13,13,13,13,13,3,13,4,6,13,4,4,13,13,13,11,11,11,11,11,11,11,11,11,11,5,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,12,12,12,3,8,3,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,12,12,5,5,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,5,12,12,12,12,5,12,3,3,8,8,8,3,6,3,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,10,12,12,11,11,11,11,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,11,11,11,10,13,3,13,13,4,13,13,13,4,11,11,11,11,11,11,5,11,11,11,11,5,5,5,11,11,11,11,11,11,11,11,11,11,11,14,11,5,11,11,11,11,5,5,11,5,5,11,11,11,11,11,11,11,11,11,11,11,8,8,3,3,3,5,10,11,12,12,12,10,10,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,10,11,10,11,11,11,11,10,11,12,10,11,11,11,11,11,10,11,12,12,12,10,11,11,11,10,5,5,5,5,12,5,3,5,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,3,11,11,11,11,11,5,11,11,11,11,3,11,11,11,11,11,11,11,11,11,11,5,5,5,5,5,5,5,5,5,13,13,4,13,11,11,11,11,11,11,11,11,11,5,11,11,11,11,12,12,12,5,13,13,13,3,13,13,4,13,13,13,4,13,13,13,3,4,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,12,12,12,0,11,11,11,11,12,12,11,11,11,11,11,11,11,12,11,11,11,11,11,12,11,0,12,12,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,5,12,12,12,12,3,8,3,5,5,12,12,5,5,10,12,12,12,5,12,12,12,12,5,17,17,17,17,17,17,17,0,0,0,0,17,17,17,17,17,17,17,17,17,17,17,6,6,5,5,5,5,8,13,4,13,11,11,11,11,11,11,11,11,11,5,5,5,5,11,11,10,11,11,11,11,11,11,11,10,12,12,13,13,13,13,4,4,13,13,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,3,11,11,11,5,5,11,11,11,11,11,12,11,12,11,11,11,11,11,3,11,11,12,11,11,11,11,11,11,11,11,7,7,5,5,5,17,17,17,7,17,17,17,17,17,17,17,17,17,17,17,3,3,11,11,11,11,11,11,5,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,5,5],"n":["Args","args_os","backup_control","bin","collect_ignore","collect_lossy","crash","crash_if_err","display","encoding","entries","error","execution_phrase","format_usage","fs","fsext","get_utility_is_second_arg","has","help_section","help_usage","lines","main","memo","mode","os","panic","parse_glob","parse_size","parse_time","perms","pipes","process","quoting_style","ranges","ringbuffer","set_utility_is_second_arg","show","show_error","show_if_err","show_warning","signals","uio_error","util_name","utmpx","version_cmp","AmbiguousArgument","BACKUP_CONTROL_LONG_HELP","BACKUP_CONTROL_VALUES","BackupError","BackupImpossible","BackupMode","ExistingBackup","InvalidArgument","NoBackup","NumberedBackup","SimpleBackup","arguments","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","code","determine_backup_mode","determine_backup_suffix","eq","eq","fmt","fmt","fmt","from","from","get_backup_path","into","into","ne","to_owned","to_string","try_from","try_from","try_into","try_into","type_id","type_id","usage","0","0","1","1","OPT_BACKUP","OPT_BACKUP_NO_ARG","OPT_SUFFIX","backup","backup_no_args","suffix","Quotable","Quoted","borrow","borrow_mut","clone","clone_into","external","fmt","fmt","force","from","from","into","maybe_quote","maybe_quote","native","native_raw","print_verbatim","println_verbatim","quote","to_owned","to_string","try_from","try_into","type_id","Base16","Base2Lsbf","Base2Msbf","Base32","Base32Hex","Base64","Base64Url","Data","Decode","DecodeError","DecodeResult","DecodeZ85","EncodeError","Format","Io","Z85","Z85InputLenNotMultipleOf4","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","decode","decode","encode","encode","fmt","fmt","from","from","from","from","from","from","from","ignore_garbage","into","into","into","into","line_wrap","new","source","to_owned","to_string","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","wrap_print","wrap_write","0","0","0","Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","fmt","fmt","from","from","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid","0","ClapErrorWrapper","ExitCode","FromIo","UClapError","UError","UIoError","UResult","USimpleError","UUsageError","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","code","code","code","code","code","code","code","code","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","get_exit_code","into","into","into","into","into","map_err_context","message","message","new","new","new","new","set_exit_code","strip_errno","to_string","to_string","to_string","to_string","to_string","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","uio_error","usage","usage","usage","with_exit_code","Existing","FileInformation","Logical","Missing","MissingHandling","None","Normal","Physical","ResolveMode","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","canonicalize","clone","clone","clone_into","clone_into","dir_strip_dot_for_creation","display_permissions","display_permissions_unix","eq","eq","eq","file_size","fmt","fmt","from","from","from","from_file","from_path","has","hash","infos_refer_to_same_file","inode","into","into","into","make_path_relative_to","normalize_path","number_of_links","paths_refer_to_same_file","resolve_relative_path","to_owned","to_owned","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","BirthTime","FsMeta","FsUsage","MountInfo","StatFs","StatFs","avail_blocks","avail_blocks","bavail","bavail_top_bit_set","bfree","birth","block_size","block_size","blocks","blocksize","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone_into","clone_into","clone_into","dev_id","dev_name","dummy","eq","f_bavail","f_bavail","f_bfree","f_bfree","f_blocks","f_blocks","f_bsize","f_bsize","f_ffree","f_ffree","f_files","f_files","f_frsize","f_frsize","f_fsid","f_fsid","f_namelen","f_namelen","f_type","f_type","ffree","files","fmt","fmt","fmt","free_blocks","free_blocks","free_file_nodes","free_file_nodes","from","from","from","fs_type","fs_type","fs_type","fsid","fsid","hash","into","into","into","io_size","io_size","mount_dir","mount_option","mount_root","namelen","namelen","ne","new","pretty_birth","pretty_filetype","pretty_fstype","pretty_time","read_fs_list","remote","statfs","statfs_fn","statfs_fn","to_owned","to_owned","to_owned","total_blocks","total_blocks","total_file_nodes","total_file_nodes","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","Lines","borrow","borrow_mut","from","into","into_iter","lines","next","try_from","try_into","type_id","Memo","apply","borrow","borrow_mut","from","into","new","run_all","try_from","try_into","type_id","get_umask","parse_mode","parse_numeric","parse_symbolic","strip_minus_from_mode","is_wsl_1","is_wsl_2","mute_sigpipe_panic","from_str","InvalidSuffix","ParseFailure","ParseSizeError","SizeTooBig","borrow","borrow_mut","description","eq","fmt","fmt","from","into","ne","parse_size","to_string","try_from","try_into","type_id","0","0","0","from_str","All","All","Changes","ChownExecutor","First","Group","IfFrom","None","Normal","Silent","TraverseSymlinks","User","UserGroup","Verbose","Verbosity","VerbosityLevel","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","chown_base","clone","clone","clone_into","clone_into","dereference","dest_gid","dest_uid","entries","eq","eq","eq","exec","files","filter","fmt","fmt","from","from","from","from","from","groups_only","into","into","into","into","into","level","ne","options","preserve_root","recursive","to_owned","to_owned","traverse_symlinks","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","verbosity","wrap_chown","0","0","0","1","Group","Locate","Passwd","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","locate","name","name","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid","ARG_FILES","ARG_GROUP","ARG_OWNER","FROM","HELP","RECURSIVE","REFERENCE","dereference","preserve_root","traverse","verbosity","DEREFERENCE","NO_DEREFERENCE","NO_PRESERVE","PRESERVE","EVERY","NO_TRAVERSE","TRAVERSE","CHANGES","QUIET","SILENT","VERBOSE","Error","Result","pipe","splice","splice_exact","vmsplice","ChildExt","Code","ExitStatus","Signal","borrow","borrow_mut","clone","clone_into","code","eq","fmt","fmt","from","getegid","geteuid","getgid","getuid","into","ne","send_signal","signal","success","to_owned","to_string","try_from","try_into","type_id","wait_or_timeout","0","0","C","Double","Literal","None","Quotes","QuotingStyle","Shell","Single","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","escape_name","from","from","into","into","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","always_quote","escape","quotes","show_control","show_control","Range","borrow","borrow_mut","cmp","complement","contain","eq","fmt","from","from_list","from_str","high","into","low","ne","partial_cmp","try_from","try_into","type_id","RingBuffer","borrow","borrow_mut","data","from","from_iter","into","new","push_back","try_from","try_into","type_id","ALL_SIGNALS","DEFAULT_SIGNAL","is_signal","signal_by_name_or_value","signal_name_by_value","ACCOUNTING","BOOT_TIME","DEAD_PROCESS","DEFAULT_FILE","EMPTY","INIT_PROCESS","LOGIN_PROCESS","NEW_TIME","OLD_TIME","RUN_LVL","USER_PROCESS","UT_HOSTSIZE","UT_IDSIZE","UT_LINESIZE","UT_NAMESIZE","Utmpx","UtmpxIter","borrow","borrow","borrow_mut","borrow_mut","canon_host","drop","endutxent","exit_status","from","from","getutxent","host","into","into","into_inner","into_iter","is_user_process","iter_all_records","iter_all_records_from","login_time","next","pid","record_type","setutxent","terminal_suffix","try_from","try_from","try_into","try_into","tty_device","type_id","type_id","user","utmpxname","version_cmp"],"q":["uucore","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::backup_control","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::backup_control::BackupError","","","","uucore::backup_control::arguments","","","","","","uucore::display","","","","","","","","","","","","","","","","","","","","","","","","","uucore::encoding","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::encoding::DecodeError","","","uucore::entries","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::error","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::fs","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::fsext","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::lines","","","","","","","","","","","uucore::memo","","","","","","","","","","","uucore::mode","","","","","uucore::os","","uucore::panic","uucore::parse_glob","uucore::parse_size","","","","","","","","","","","","","","","","","","uucore::parse_size::ParseSizeError","","","uucore::parse_time","uucore::perms","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::perms::IfFrom","","","","uucore::perms::entries","","","","","","","","","","","","","","","","","","","uucore::perms::options","","","","","","","","","","","uucore::perms::options::dereference","","uucore::perms::options::preserve_root","","uucore::perms::options::traverse","","","uucore::perms::options::verbosity","","","","uucore::pipes","","","","","","uucore::process","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::process::ExitStatus","","uucore::quoting_style","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::quoting_style::QuotingStyle","","","","","uucore::ranges","","","","","","","","","","","","","","","","","","","uucore::ringbuffer","","","","","","","","","","","","uucore::signals","","","","","uucore::utmpx","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::version_cmp"],"d":["","","Implement GNU-style backup functionality.","","Collects the iterator into a Vec<String>, removing any …","Collects the iterator into a Vec<String>, lossily …","Display an error and std::process::exit","Unwrap a std::result::Result, crashing instead of …","","","Get password/group file entry","All utils return exit with an exit code. Usually, the …","Derive the complete execution phrase for “usage”.","Generate the usage string for clap.","Set of functions to manage files and symlinks","Set of functions to manage file systems","","","Reads a section from a file of the util as a str literal.","Get the usage from the “Usage” section in the help …","Iterate over lines, including the line ending character(s).","","Memo runner of printf Takes a format string and arguments","Set of functions to parse modes","","Custom panic hooks that allow silencing certain types of …","Parsing a glob Pattern from a string.","","Parsing a duration from a string.","Common functions to manage permissions","","Set of functions to manage IDs","","","A fixed-size ring buffer.","","Display a crate::error::UError and set global exit code.","Show an error to stderr in a similar style to GNU …","Display an error and set global exit code in error case.","Print a warning message to stderr.","","Shorthand to construct UIoError-instances.","Derive the utility name.","Aims to provide platform-independent methods to obtain …","","An ambiguous argument (e.g. ‘n’) was given as backup …","","","Backup error types.","Currently unused","Available backup modes.","Argument ‘existing’, ‘nil’","An invalid argument (e.g. ‘foo’) was given as backup …","Argument ‘none’, ‘off’","Argument ‘numbered’, ‘t’","Argument ‘simple’, ‘never’","Arguments for backup-related functionality.","","","","","","","","Determine the “mode” for the backup operation to …","Obtain the suffix to use for a backup.","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","‘–backup’ argument","‘-b’ argument","‘-S, –suffix’ argument","An extension trait to apply quoting to strings.","A wrapper around string types for displaying with quoting …","","","","","When quoting for PowerShell, toggle whether to quote for …","","","Toggle forced quoting. If true, quotes are added even if …","","Returns the argument unchanged.","Calls U::from(self).","Like quote(), but don’t actually add quotes unless …","Like quote(), but don’t actually add quotes unless …","Quote a string with the default style for the platform.","Quote an OsStr with the default style for the platform.","Like println_verbatim, without the trailing newline.","Print a path (or OsStr-like object) directly to stdout, …","Returns an object that implements Display for printing …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell","","","A wrapper for clap::Error that implements UError","A special error type that does not print any message when …","Enables the conversion from std::io::Error to UError and …","Extension trait for clap::Error to adjust the exit code.","Custom errors defined by the utils and uucore.","Wrapper type around std::io::Error.","Result type that should be returned by all utils.","A simple error type with an exit code and a message that …","","","","","","","","","","","","Error code of a custom error.","Error code of a custom error.","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Get the last exit code set with set_exit_code. The default …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","Set the exit code for the program if uumain returns Ok(()).","Strip the trailing “ (os error XX)“ from io error …","","","","","","","","","","","","","","","","","","","","","Shorthand to construct UIoError-instances.","Print usage help to a custom error.","Print usage help to a custom error.","","","Resolve symbolic links, ignoring errors on the final …","Information to uniquely identify a file","Resolve ‘..’ elements before symlinks","Resolve symbolic links, ignoring errors on the non-final …","Controls how symbolic links should be handled when …","Do not resolve any symbolic links.","Return an error if any part of the path is missing.","Resolve symlinks as encountered when processing the path","Controls when symbolic links are resolved","","","","","","","Return the canonical, absolute form of a path.","","","","","For some programs like install or mkdir, dir/. can be …","Display the permissions of a file On non unix like system, …","Display the permissions of a file on a unix like system","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Get information from a currently open file","Get information for a given path.","","","Checks if p1 and p2 are the same file information. If …","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Converts absolute path to be relative to absolute to path.","Normalize a path by removing relative information For …","","Checks if p1 and p2 are the same file. If error happens …","resolve a relative path","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","Read file system list.","","","","","","","","","","","","","","","","","","","","","An iterator over the lines of an instance of BufRead.","","","Returns the argument unchanged.","Calls U::from(self).","","Returns an iterator over the lines, including line ending …","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","Test if the program is running under WSL","","Terminate without error on panics that occur due to broken …","Parse a glob Pattern from a string.","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","Parse a size string into a number of bytes.","","","","","","","","Parse a duration from a string.","","","","","","","","","","","","","","","","The various level of verbosity","","","","","","","","","","","Base implementation for chgrp and chown.","","","","","","","","Get password/group file entry","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","Perform the change of owner on a path with the various …","","","","","","Fetch desired entry.","","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","","AKA passwd.pw_name","AKA group.gr_name","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell","","","","","","","","","","","","","","","","","","","","","","","","Nix’s main error type.","Nix Result Type","A wrapper around nix::unistd::pipe that ensures the pipe …","Less noisy wrapper around nix::fcntl::splice.","Splice wrapper which fully finishes the write.","Copy data from bytes into target, which must be a pipe.","Missing methods for Child objects","","","","","","","","","","","","Returns the argument unchanged.","getegid() returns the effective group ID of the calling …","geteuid() returns the effective user ID of the calling …","getgid() returns the real group ID of the calling process.","getuid() returns the real user ID of the calling process.","Calls U::from(self).","","Send a signal to a Child process.","","","","","","","","Wait for a process to finish or return after the specified …","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","Test if at least one of the given Ranges contain the …","","","Returns the argument unchanged.","","Parse a string of the form a-b into a Range","","Calls U::from(self).","","","","","","","A fixed-size ring buffer backed by a VecDeque.","","","","Returns the argument unchanged.","","Calls U::from(self).","","Append a value to the end of the ring buffer.","","","","","","","","","","","","","","","","","","","","","","","","","Iterator of login records","","","","","Canonicalize host name using DNS","","","A.K.A. ut.ut_exit","Returns the argument unchanged.","Returns the argument unchanged.","","A.K.A. ut.ut_host","Calls U::from(self).","Calls U::from(self).","Consumes the Utmpx, returning the underlying C struct utmpx","","","Iterate through all the utmp records.","Iterate through all the utmp records from a specific file.","A.K.A. ut.ut_tv","","A.K.A. ut.ut_pid","A.K.A. ut.ut_type","","A.K.A. ut.ut_id","","","","","A.K.A. ut.ut_line","","","A.K.A. ut.ut_user","",""],"i":[0,0,0,0,73,73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,6,7,6,6,6,0,6,7,6,7,6,6,7,0,0,6,7,6,7,7,6,7,0,6,7,7,6,7,6,7,6,7,6,7,7,90,91,90,91,0,0,0,0,0,0,0,0,19,19,19,19,19,19,19,19,19,19,19,92,92,19,19,0,0,92,19,19,19,19,19,24,24,24,24,24,24,24,0,29,0,0,29,0,0,29,24,28,28,27,29,24,28,27,29,24,24,24,0,27,0,27,29,29,28,27,29,29,29,29,24,27,28,27,29,24,27,27,29,24,29,28,27,29,24,28,27,29,24,28,27,29,24,0,0,93,94,95,0,0,0,36,36,38,36,38,36,38,36,38,36,38,36,38,0,0,36,38,0,0,36,38,96,36,36,38,38,36,38,36,38,36,38,36,38,36,38,36,0,36,36,36,36,0,43,0,0,0,0,0,0,0,0,0,41,42,45,43,44,41,42,45,43,44,48,48,41,42,43,44,41,42,41,41,42,42,45,45,43,43,44,44,41,42,45,45,43,44,0,41,42,45,43,44,97,41,42,41,42,45,43,0,0,41,42,45,43,44,41,42,45,43,44,41,42,45,43,44,41,42,45,43,44,0,48,48,42,98,51,0,52,51,0,52,51,52,0,55,51,52,55,51,52,0,51,52,51,52,0,0,0,55,51,52,55,51,52,55,51,52,55,55,0,55,0,55,55,51,52,0,0,55,0,0,51,52,55,51,52,55,51,52,55,51,52,0,0,0,0,0,0,99,59,62,62,62,100,99,59,62,62,61,62,59,61,62,59,61,62,59,61,62,59,61,61,61,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,62,62,61,62,59,99,59,99,59,61,62,59,99,59,61,99,59,59,61,62,59,99,59,61,61,61,99,59,59,62,100,0,0,0,0,61,0,0,0,61,62,59,99,59,99,59,61,62,59,61,62,59,61,62,59,0,64,64,64,64,64,0,64,64,64,64,0,66,66,66,66,66,66,66,66,66,66,0,0,0,0,0,0,0,0,0,70,70,0,70,70,70,70,70,70,70,70,70,70,0,70,70,70,70,101,102,103,0,104,76,74,0,76,104,0,76,74,74,0,104,104,74,0,0,104,77,74,75,76,104,77,74,75,76,0,74,75,74,75,77,77,77,0,74,75,76,77,77,77,74,75,104,77,74,75,76,75,104,77,74,75,76,75,75,0,77,77,74,75,77,104,77,74,75,76,104,77,74,75,76,104,77,74,75,76,77,0,105,106,107,107,0,0,0,0,0,36,38,0,0,96,36,38,36,0,36,36,36,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,79,0,79,79,79,79,79,79,79,79,79,79,0,0,0,0,79,79,108,79,79,79,79,79,79,79,108,109,110,81,80,81,80,0,0,81,80,81,80,81,80,80,80,0,81,80,81,80,80,81,80,81,80,81,80,111,111,112,111,113,0,82,82,82,0,0,82,82,82,82,82,82,82,82,82,82,82,82,82,0,84,84,84,84,84,84,84,84,84,84,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,86,85,86,85,86,0,85,85,86,0,85,85,86,85,86,85,85,85,85,86,85,85,0,85,85,86,85,86,85,85,86,85,0,0],"f":[0,[[],1],0,0,[[],[[3,[2]]]],[[],[[3,[2]]]],0,0,0,0,0,0,[[],4],[4,2],0,0,[[],5],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],0,0,0,0,0,0,[[],4],0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[6,6],[[]],[7,8],[9,[[10,[6]]]],[9,2],[[6,6],5],[[7,7],5],[[6,11],12],[[7,11],12],[[7,11],12],[[]],[[]],[[6,13,4],[[15,[14]]]],[[]],[[]],[[7,7],5],[[]],[[],2],[[],16],[[],16],[[],16],[[],16],[[],17],[[],17],[7,5],0,0,0,0,0,0,0,[[],18],[[],18],[[],18],0,0,[[]],[[]],[19,19],[[]],[[19,5],19],[[19,11],[[16,[20]]]],[[19,11],[[16,[20]]]],[[19,5],19],[[],19],[[]],[[]],[[],19],[[],19],[4,19],[21,19],[[[22,[21]]],23],[[[22,[21]]],23],[[],19],[[]],[[],2],[[],16],[[],16],[[],17],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[24,24],[[]],[24,25],[[[27,[26]]],25],[24,[[16,[2,28]]]],[[[27,[26]]],[[16,[2,28]]]],[[29,11],12],[[29,11],12],[[]],[[]],[30,29],[31,29],[32,29],[[]],[[]],[[[27,[26]],5],[[27,[26]]]],[[]],[[]],[[]],[[]],[[[27,[26]],33],[[27,[26]]]],[[26,24],[[27,[26]]]],[29,[[15,[34]]]],[[]],[[],2],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],17],[[],17],[[],17],[[],17],[[27,4]],[[35,33,4],23],0,0,0,0,0,0,[36,[[3,[37]]]],[[]],[[]],[[]],[[]],[36,36],[38,38],[[]],[[]],[[36,11],12],[[38,11],12],[[]],[[]],[[],[[23,[[3,[37]]]]]],[[[15,[39]]],[[23,[[3,[37]]]]]],0,0,[37,[[23,[2]]]],[4,[[23,[37]]]],[[]],[[]],[[],23],[40,[[23,[36]]]],[4,[[23,[36]]]],[37,[[23,[38]]]],[4,[[23,[38]]]],0,0,[[]],[[]],[[],16],[[],16],[[],16],[[],16],[[],17],[[],17],0,[40,[[23,[2]]]],0,0,0,0,[4,[[23,[40]]]],0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],8],[[],8],[41,8],[42,8],[43,8],[44,8],0,0,[[41,11],12],[[41,11],[[16,[20]]]],[[42,11],[[16,[20]]]],[[42,11],12],[[45,11],[[16,[20]]]],[[45,11],12],[[43,11],[[16,[20]]]],[[43,11],12],[[44,11],12],[[44,11],[[16,[20]]]],[[]],[[]],[[]],[31,45],[[]],[[]],[[],8],[[]],[[]],[[]],[[]],[[]],[46],0,0,[[8,[47,[2]]],[[49,[48]]]],[[8,[47,[2]]],[[49,[48]]]],[[50,[47,[2]]],[[49,[48]]]],[8,[[49,[48]]]],[8],[31,2],[[],2],[[],2],[[],2],[[],2],[[],2],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],17],[[],17],[[],17],[[],17],[[],17],0,[[],5],[[],5],[42,5],[8],0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[[22,[13]],51,52],[[23,[14]]]],[51,51],[52,52],[[]],[[]],[13,14],[[53,5],2],[[54,5],2],[[55,55],5],[[51,51],5],[[52,52],5],[55,56],[[51,11],12],[[52,11],12],[[]],[[]],[[]],[[],[[23,[55]]]],[[[22,[13]],5],[[23,[55]]]],0,[55],[[[23,[55]],[23,[55]]],5],[55,56],[[]],[[]],[[]],[[[22,[13]],[22,[13]]],14],[13,14],[55,56],[[[22,[13]],[22,[13]],5],5],[13,[[57,[13]]]],[[]],[[]],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],17],[[],17],[[],17],0,0,0,0,0,[[58,59],8],[[],56],[59,56],0,0,0,[[],2],[[],60],[59,60],0,0,[[]],[[]],[[]],[[]],[[]],[[]],[61,61],[62,62],[59,59],[[]],[[]],[[]],0,0,0,[[59,59],5],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[61,11],12],[[62,11],12],[[59,11],[[16,[20]]]],[[],56],[59,56],[[],56],[59,56],[[]],[[]],[[]],[[],60],[59,60],0,[[],56],[59,56],[59],[[]],[[]],[[]],[[],56],[59,56],0,0,0,[[],56],[59,56],[[59,59],5],[59,62],[[],2],[[54,56],4],[60,[[57,[4]]]],[[60,60],2],[[],[[16,[[3,[61]],31]]]],0,[[],[[16,[59,2]]]],0,[[58,59],8],[[]],[[]],[[]],[[],56],[59,56],[[],56],[59,56],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],17],[[],17],[[],17],0,[[]],[[]],[[]],[[]],[[]],[63,64],[[[64,[65]]],[[15,[[23,[[3,[63]]]]]]]],[[],16],[[],16],[[],17],0,[[66,67]],[[]],[[]],[[]],[[]],[[4,67],[[10,[66]]]],[4,10],[[],16],[[],16],[[],17],[[],39],[4,[[16,[54,2]]]],[[39,4,5],[[16,[39,2]]]],[[39,4,39,5],[[16,[39,2]]]],[3,5],[[],5],[[],5],[[]],[4,[[16,[68,69]]]],0,0,0,0,[[]],[[]],[70,4],[[70,70],5],[[70,11],[[16,[20]]]],[[70,11],12],[[]],[[]],[[70,70],5],[4,[[16,[56,70]]]],[[],2],[[],16],[[],16],[[],17],0,0,0,[4,[[16,[71,2]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[72,73,4,5],10],[74,74],[75,75],[[]],[[]],0,0,0,0,[[74,74],5],[[75,75],5],[[76,76],5],[77,10],0,0,[[74,11],12],[[75,11],12],[[]],[[]],[[]],[[]],[[]],0,[[]],[[]],[[]],[[]],[[]],0,[[75,75],5],0,0,0,[[]],[[]],0,[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],16],[[],17],[[],17],[[],17],[[],17],[[],17],0,[[[22,[13]],53,[15,[39]],[15,[39]],5,75],[[16,[2,2]]]],0,0,0,0,0,0,0,[[],[[23,[[3,[37]]]]]],[[[15,[39]]],[[23,[[3,[37]]]]]],0,0,[37,[[23,[2]]]],[4,[[23,[37]]]],[[],23],0,0,0,[40,[[23,[2]]]],0,0,0,0,[4,[[23,[40]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[],78],[33,[[78,[33]]]],[33,78],[[],[[78,[33]]]],0,0,0,0,[[]],[[]],[79,79],[[]],[79,[[15,[8]]]],[[79,79],5],[[79,11],12],[[79,11],12],[[]],[[],37],[[],40],[[],37],[[],40],[[]],[[79,79],5],[33,23],[79,[[15,[8]]]],[79,5],[[]],[[],2],[[],16],[[],16],[[],17],[71,[[23,[[15,[79]]]]]],0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[80,80],[[]],[[21,81],2],[[]],[[]],[[]],[[]],[[]],[[],16],[[],16],[[],16],[[],16],[[],17],[[],17],0,0,0,0,0,0,[[]],[[]],[[82,82],83],[[],[[3,[82]]]],[33,5],[[82,82],5],[[82,11],12],[[]],[4,[[16,[[3,[82]],2]]]],[4,[[16,[82,4]]]],0,[[]],0,[[82,82],5],[[82,82],[[15,[83]]]],[[],16],[[],16],[[],17],0,[[]],[[]],0,[[]],[[1,33],84],[[]],[33,84],[84,15],[[],16],[[],16],[[],17],0,0,[33,5],[4,[[15,[33]]]],[33,[[15,[4]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[85,[[23,[2]]]],[86],[[]],[85],[[]],[[]],[[],87],[85,2],[[]],[[]],[85,87],[[]],[85,5],[[],86],[[[22,[13]]],86],[85,88],[86,15],[85,8],[85,89],[[]],[85,2],[[],16],[[],16],[[],16],[[],16],[85,2],[[],17],[[],17],[85,2],[58,8],[[4,4],83]],"p":[[8,"Iterator"],[3,"String"],[3,"Vec"],[15,"str"],[15,"bool"],[4,"BackupMode"],[4,"BackupError"],[15,"i32"],[3,"ArgMatches"],[6,"UResult"],[3,"Formatter"],[6,"Result"],[3,"Path"],[3,"PathBuf"],[4,"Option"],[4,"Result"],[3,"TypeId"],[3,"Arg"],[3,"Quoted"],[3,"Error"],[3,"OsStr"],[8,"AsRef"],[6,"Result"],[4,"Format"],[6,"DecodeResult"],[8,"Read"],[3,"Data"],[4,"EncodeError"],[4,"DecodeError"],[4,"DecodeError"],[3,"Error"],[3,"DecodeError"],[15,"usize"],[8,"Error"],[8,"Write"],[3,"Passwd"],[6,"gid_t"],[3,"Group"],[15,"u32"],[6,"uid_t"],[3,"USimpleError"],[3,"UUsageError"],[3,"ExitCode"],[3,"ClapErrorWrapper"],[3,"UIoError"],[8,"FnOnce"],[8,"Into"],[8,"UError"],[3,"Box"],[4,"ErrorKind"],[4,"MissingHandling"],[4,"ResolveMode"],[3,"Metadata"],[6,"mode_t"],[3,"FileInformation"],[15,"u64"],[4,"Cow"],[15,"i8"],[3,"statfs_fn"],[15,"i64"],[3,"MountInfo"],[3,"FsUsage"],[15,"u8"],[3,"Lines"],[8,"BufRead"],[3,"Memo"],[3,"Peekable"],[3,"Pattern"],[3,"PatternError"],[4,"ParseSizeError"],[3,"Duration"],[3,"Command"],[8,"Args"],[4,"VerbosityLevel"],[3,"Verbosity"],[4,"TraverseSymlinks"],[3,"ChownExecutor"],[6,"Result"],[4,"ExitStatus"],[4,"Quotes"],[4,"QuotingStyle"],[3,"Range"],[4,"Ordering"],[3,"RingBuffer"],[3,"Utmpx"],[3,"UtmpxIter"],[3,"utmpx"],[3,"OffsetDateTime"],[15,"i16"],[13,"InvalidArgument"],[13,"AmbiguousArgument"],[8,"Quotable"],[13,"Decode"],[13,"DecodeZ85"],[13,"Io"],[8,"Locate"],[8,"FromIo"],[8,"UClapError"],[8,"FsMeta"],[8,"BirthTime"],[13,"InvalidSuffix"],[13,"ParseFailure"],[13,"SizeTooBig"],[4,"IfFrom"],[13,"User"],[13,"Group"],[13,"UserGroup"],[8,"ChildExt"],[13,"Code"],[13,"Signal"],[13,"Shell"],[13,"C"],[13,"Literal"]]},\ +"uucore":{"doc":"","t":[8,5,0,14,11,11,14,14,0,0,0,0,5,5,0,0,5,14,14,14,0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,5,14,14,14,14,0,14,5,0,0,13,17,7,4,13,4,13,13,13,13,13,0,11,11,11,11,11,11,11,5,5,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,7,7,7,5,5,5,8,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,10,11,11,11,11,11,13,13,13,13,13,13,13,3,13,4,6,13,4,4,13,13,13,11,11,11,11,11,11,11,11,11,11,5,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,12,12,12,3,8,3,11,11,11,11,11,11,11,11,11,11,11,11,11,5,5,12,12,5,5,11,11,10,11,11,11,11,12,12,11,11,11,11,11,11,11,11,12,5,12,12,12,12,5,12,3,3,8,8,8,3,6,3,3,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,10,12,12,11,11,11,11,11,11,11,11,11,5,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,11,11,11,10,13,3,13,13,4,13,13,13,4,11,11,11,11,11,11,5,11,11,11,11,5,5,5,11,11,11,11,11,11,11,11,11,11,11,14,11,5,11,11,11,11,5,5,11,5,5,11,11,11,11,11,11,11,11,11,11,11,8,8,3,3,3,5,10,11,12,12,12,10,10,11,12,12,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,10,11,10,11,11,11,11,10,11,12,10,11,11,11,11,11,10,11,12,12,12,10,11,11,10,5,5,5,5,12,5,3,5,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,3,11,11,11,11,11,5,11,11,11,11,3,11,11,11,11,11,11,11,11,11,11,5,5,5,5,5,5,5,5,5,13,13,4,13,11,11,11,11,11,11,11,11,5,11,11,11,11,11,12,12,12,5,13,13,13,3,13,13,4,13,13,13,4,13,13,13,3,4,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,12,12,12,0,11,11,11,11,12,12,11,11,11,11,11,11,11,12,11,11,11,11,11,12,0,12,12,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,5,12,12,12,12,3,8,3,5,5,12,12,5,5,10,12,12,12,5,12,12,12,12,5,17,17,17,17,17,17,17,0,0,0,0,17,17,17,17,17,17,17,17,17,17,17,6,6,5,5,5,5,8,13,4,13,11,11,11,11,11,11,11,11,11,5,5,5,5,11,10,11,11,11,11,11,11,11,10,12,12,13,13,13,13,4,4,13,13,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,3,11,11,11,5,5,11,11,11,11,11,12,11,12,11,11,11,11,3,11,11,12,11,11,11,11,11,11,11,11,7,7,5,5,5,17,17,17,7,17,17,17,17,17,17,17,17,17,17,17,3,3,11,11,11,11,11,11,5,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,5,5],"n":["Args","args_os","backup_control","bin","collect_ignore","collect_lossy","crash","crash_if_err","display","encoding","entries","error","execution_phrase","format_usage","fs","fsext","get_utility_is_second_arg","has","help_section","help_usage","lines","main","memo","mode","os","panic","parse_glob","parse_size","parse_time","perms","pipes","process","quoting_style","ranges","ringbuffer","set_utility_is_second_arg","show","show_error","show_if_err","show_warning","signals","uio_error","util_name","utmpx","version_cmp","AmbiguousArgument","BACKUP_CONTROL_LONG_HELP","BACKUP_CONTROL_VALUES","BackupError","BackupImpossible","BackupMode","ExistingBackup","InvalidArgument","NoBackup","NumberedBackup","SimpleBackup","arguments","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","code","determine_backup_mode","determine_backup_suffix","eq","eq","fmt","fmt","fmt","from","from","get_backup_path","into","into","provide","to_owned","to_string","try_from","try_from","try_into","try_into","type_id","type_id","usage","0","0","1","1","OPT_BACKUP","OPT_BACKUP_NO_ARG","OPT_SUFFIX","backup","backup_no_args","suffix","Quotable","Quoted","borrow","borrow_mut","clone","clone_into","external","fmt","fmt","force","from","from","into","maybe_quote","maybe_quote","native","native_raw","print_verbatim","println_verbatim","quote","to_owned","to_string","try_from","try_into","type_id","Base16","Base2Lsbf","Base2Msbf","Base32","Base32Hex","Base64","Base64Url","Data","Decode","DecodeError","DecodeResult","DecodeZ85","EncodeError","Format","Io","Z85","Z85InputLenNotMultipleOf4","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","decode","decode","encode","encode","fmt","fmt","from","from","from","from","from","from","from","ignore_garbage","into","into","into","into","line_wrap","new","provide","source","to_owned","to_string","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","wrap_print","wrap_write","0","0","0","Group","Locate","Passwd","belongs_to","borrow","borrow","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","fmt","fmt","from","from","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","into","into","locate","locate","locate","locate","locate","name","name","to_owned","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid","0","ClapErrorWrapper","ExitCode","FromIo","UClapError","UError","UIoError","UResult","USimpleError","UUsageError","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","code","code","code","code","code","code","code","code","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","get_exit_code","into","into","into","into","into","map_err_context","message","message","new","new","new","new","provide","provide","provide","provide","provide","set_exit_code","strip_errno","to_string","to_string","to_string","to_string","to_string","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","uio_error","usage","usage","usage","with_exit_code","Existing","FileInformation","Logical","Missing","MissingHandling","None","Normal","Physical","ResolveMode","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","canonicalize","clone","clone","clone_into","clone_into","dir_strip_dot_for_creation","display_permissions","display_permissions_unix","eq","eq","eq","file_size","fmt","fmt","from","from","from","from_file","from_path","has","hash","infos_refer_to_same_file","inode","into","into","into","make_path_relative_to","normalize_path","number_of_links","paths_refer_to_same_file","resolve_relative_path","to_owned","to_owned","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","BirthTime","FsMeta","FsUsage","MountInfo","StatFs","StatFs","avail_blocks","avail_blocks","bavail","bavail_top_bit_set","bfree","birth","block_size","block_size","blocks","blocksize","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone_into","clone_into","clone_into","dev_id","dev_name","dummy","eq","f_bavail","f_bavail","f_bfree","f_bfree","f_blocks","f_blocks","f_bsize","f_bsize","f_ffree","f_ffree","f_files","f_files","f_frsize","f_frsize","f_fsid","f_fsid","f_namelen","f_namelen","f_type","f_type","ffree","files","fmt","fmt","fmt","free_blocks","free_blocks","free_file_nodes","free_file_nodes","from","from","from","fs_type","fs_type","fs_type","fsid","fsid","hash","into","into","into","io_size","io_size","mount_dir","mount_option","mount_root","namelen","namelen","new","pretty_birth","pretty_filetype","pretty_fstype","pretty_time","read_fs_list","remote","statfs","statfs_fn","statfs_fn","to_owned","to_owned","to_owned","total_blocks","total_blocks","total_file_nodes","total_file_nodes","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","Lines","borrow","borrow_mut","from","into","into_iter","lines","next","try_from","try_into","type_id","Memo","apply","borrow","borrow_mut","from","into","new","run_all","try_from","try_into","type_id","get_umask","parse_mode","parse_numeric","parse_symbolic","strip_minus_from_mode","is_wsl_1","is_wsl_2","mute_sigpipe_panic","from_str","InvalidSuffix","ParseFailure","ParseSizeError","SizeTooBig","borrow","borrow_mut","description","eq","fmt","fmt","from","into","parse_size","provide","to_string","try_from","try_into","type_id","0","0","0","from_str","All","All","Changes","ChownExecutor","First","Group","IfFrom","None","Normal","Silent","TraverseSymlinks","User","UserGroup","Verbose","Verbosity","VerbosityLevel","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","chown_base","clone","clone","clone_into","clone_into","dereference","dest_gid","dest_uid","entries","eq","eq","eq","exec","files","filter","fmt","fmt","from","from","from","from","from","groups_only","into","into","into","into","into","level","options","preserve_root","recursive","to_owned","to_owned","traverse_symlinks","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","verbosity","wrap_chown","0","0","0","1","Group","Locate","Passwd","get_groups","get_groups_gnu","gid","gid","gid2grp","grp2gid","locate","name","name","uid","uid2usr","user_dir","user_info","user_passwd","user_shell","usr2uid","ARG_FILES","ARG_GROUP","ARG_OWNER","FROM","HELP","RECURSIVE","REFERENCE","dereference","preserve_root","traverse","verbosity","DEREFERENCE","NO_DEREFERENCE","NO_PRESERVE","PRESERVE","EVERY","NO_TRAVERSE","TRAVERSE","CHANGES","QUIET","SILENT","VERBOSE","Error","Result","pipe","splice","splice_exact","vmsplice","ChildExt","Code","ExitStatus","Signal","borrow","borrow_mut","clone","clone_into","code","eq","fmt","fmt","from","getegid","geteuid","getgid","getuid","into","send_signal","signal","success","to_owned","to_string","try_from","try_into","type_id","wait_or_timeout","0","0","C","Double","Literal","None","Quotes","QuotingStyle","Shell","Single","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","escape_name","from","from","into","into","to_owned","try_from","try_from","try_into","try_into","type_id","type_id","always_quote","escape","quotes","show_control","show_control","Range","borrow","borrow_mut","cmp","complement","contain","eq","fmt","from","from_list","from_str","high","into","low","partial_cmp","try_from","try_into","type_id","RingBuffer","borrow","borrow_mut","data","from","from_iter","into","new","push_back","try_from","try_into","type_id","ALL_SIGNALS","DEFAULT_SIGNAL","is_signal","signal_by_name_or_value","signal_name_by_value","ACCOUNTING","BOOT_TIME","DEAD_PROCESS","DEFAULT_FILE","EMPTY","INIT_PROCESS","LOGIN_PROCESS","NEW_TIME","OLD_TIME","RUN_LVL","USER_PROCESS","UT_HOSTSIZE","UT_IDSIZE","UT_LINESIZE","UT_NAMESIZE","Utmpx","UtmpxIter","borrow","borrow","borrow_mut","borrow_mut","canon_host","drop","endutxent","exit_status","from","from","getutxent","host","into","into","into_inner","into_iter","is_user_process","iter_all_records","iter_all_records_from","login_time","next","pid","record_type","setutxent","terminal_suffix","try_from","try_from","try_into","try_into","tty_device","type_id","type_id","user","utmpxname","version_cmp"],"q":["uucore","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::backup_control","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::backup_control::BackupError","","","","uucore::backup_control::arguments","","","","","","uucore::display","","","","","","","","","","","","","","","","","","","","","","","","","uucore::encoding","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::encoding::DecodeError","","","uucore::entries","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::error","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::fs","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::fsext","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::lines","","","","","","","","","","","uucore::memo","","","","","","","","","","","uucore::mode","","","","","uucore::os","","uucore::panic","uucore::parse_glob","uucore::parse_size","","","","","","","","","","","","","","","","","","uucore::parse_size::ParseSizeError","","","uucore::parse_time","uucore::perms","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::perms::IfFrom","","","","uucore::perms::entries","","","","","","","","","","","","","","","","","","","uucore::perms::options","","","","","","","","","","","uucore::perms::options::dereference","","uucore::perms::options::preserve_root","","uucore::perms::options::traverse","","","uucore::perms::options::verbosity","","","","uucore::pipes","","","","","","uucore::process","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::process::ExitStatus","","uucore::quoting_style","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::quoting_style::QuotingStyle","","","","","uucore::ranges","","","","","","","","","","","","","","","","","","uucore::ringbuffer","","","","","","","","","","","","uucore::signals","","","","","uucore::utmpx","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","uucore::version_cmp"],"d":["","","Implement GNU-style backup functionality.","","Collects the iterator into a Vec<String>, removing any …","Collects the iterator into a Vec<String>, lossily …","Display an error and std::process::exit","Unwrap a std::result::Result, crashing instead of …","","","Get password/group file entry","All utils return exit with an exit code. Usually, the …","Derive the complete execution phrase for “usage”.","Generate the usage string for clap.","Set of functions to manage files and symlinks","Set of functions to manage file systems","","","Reads a section from a file of the util as a str literal.","Get the usage from the “Usage” section in the help …","Iterate over lines, including the line ending character(s).","","Memo runner of printf Takes a format string and arguments","Set of functions to parse modes","","Custom panic hooks that allow silencing certain types of …","Parsing a glob Pattern from a string.","","Parsing a duration from a string.","Common functions to manage permissions","","Set of functions to manage IDs","","","A fixed-size ring buffer.","","Display a crate::error::UError and set global exit code.","Show an error to stderr in a similar style to GNU …","Display an error and set global exit code in error case.","Print a warning message to stderr.","","Shorthand to construct UIoError-instances.","Derive the utility name.","Aims to provide platform-independent methods to obtain …","","An ambiguous argument (e.g. ‘n’) was given as backup …","","","Backup error types.","Currently unused","Available backup modes.","Argument ‘existing’, ‘nil’","An invalid argument (e.g. ‘foo’) was given as backup …","Argument ‘none’, ‘off’","Argument ‘numbered’, ‘t’","Argument ‘simple’, ‘never’","Arguments for backup-related functionality.","","","","","","","","Determine the “mode” for the backup operation to …","Obtain the suffix to use for a backup.","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","‘–backup’ argument","‘-b’ argument","‘-S, –suffix’ argument","An extension trait to apply quoting to strings.","A wrapper around string types for displaying with quoting …","","","","","When quoting for PowerShell, toggle whether to quote for …","","","Toggle forced quoting. If true, quotes are added even if …","Returns the argument unchanged.","","Calls U::from(self).","Like quote(), but don’t actually add quotes unless …","Like quote(), but don’t actually add quotes unless …","Quote a string with the default style for the platform.","Quote an OsStr with the default style for the platform.","Like println_verbatim, without the trailing newline.","Print a path (or OsStr-like object) directly to stdout, …","Returns an object that implements Display for printing …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","Fetch desired entry.","","This is a wrapper function for libc::getgrouplist.","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","Calls U::from(self).","Calls U::from(self).","","","","","","AKA passwd.pw_name","AKA group.gr_name","","","","","","","","","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell","","","A wrapper for clap::Error that implements UError","A special error type that does not print any message when …","Enables the conversion from std::io::Error to UError and …","Extension trait for clap::Error to adjust the exit code.","Custom errors defined by the utils and uucore.","Wrapper type around std::io::Error.","Result type that should be returned by all utils.","A simple error type with an exit code and a message that …","","","","","","","","","","","","Error code of a custom error.","Error code of a custom error.","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Get the last exit code set with set_exit_code. The default …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","Set the exit code for the program if uumain returns Ok(()).","Strip the trailing “ (os error XX)“ from io error …","","","","","","","","","","","","","","","","","","","","","Shorthand to construct UIoError-instances.","Print usage help to a custom error.","Print usage help to a custom error.","","","Resolve symbolic links, ignoring errors on the final …","Information to uniquely identify a file","Resolve ‘..’ elements before symlinks","Resolve symbolic links, ignoring errors on the non-final …","Controls how symbolic links should be handled when …","Do not resolve any symbolic links.","Return an error if any part of the path is missing.","Resolve symlinks as encountered when processing the path","Controls when symbolic links are resolved","","","","","","","Return the canonical, absolute form of a path.","","","","","For some programs like install or mkdir, dir/. can be …","Display the permissions of a file On non unix like system, …","Display the permissions of a file on a unix like system","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Get information from a currently open file","Get information for a given path.","","","Checks if p1 and p2 are the same file information. If …","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Converts absolute path to be relative to absolute to path.","Normalize a path by removing relative information For …","","Checks if p1 and p2 are the same file. If error happens …","resolve a relative path","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","Read file system list.","","","","","","","","","","","","","","","","","","","","","An iterator over the lines of an instance of BufRead.","","","Returns the argument unchanged.","Calls U::from(self).","","Returns an iterator over the lines, including line ending …","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","Test if the program is running under WSL","","Terminate without error on panics that occur due to broken …","Parse a glob Pattern from a string.","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","Parse a size string into a number of bytes.","","","","","","","","","Parse a duration from a string.","","","","","","","","","","","","","","","","The various level of verbosity","","","","","","","","","","","Base implementation for chgrp and chown.","","","","","","","","Get password/group file entry","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","Perform the change of owner on a path with the various …","","","","","","Fetch desired entry.","","From: …","The list of group IDs returned from GNU’s groups and GNU…","AKA passwd.pw_gid","AKA group.gr_gid","","","","AKA passwd.pw_name","AKA group.gr_name","AKA passwd.pw_uid","","AKA passwd.pw_dir","AKA passwd.pw_gecos","AKA passwd.pw_passwd","AKA passwd.pw_shell","","","","","","","","","","","","","","","","","","","","","","","","Nix’s main error type.","Nix Result Type","A wrapper around nix::unistd::pipe that ensures the pipe …","Less noisy wrapper around nix::fcntl::splice.","Splice wrapper which fully finishes the write.","Copy data from bytes into target, which must be a pipe.","Missing methods for Child objects","","","","","","","","","","","","Returns the argument unchanged.","getegid() returns the effective group ID of the calling …","geteuid() returns the effective user ID of the calling …","getgid() returns the real group ID of the calling process.","getuid() returns the real user ID of the calling process.","Calls U::from(self).","Send a signal to a Child process.","","","","","","","","Wait for a process to finish or return after the specified …","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","Test if at least one of the given Ranges contain the …","","","Returns the argument unchanged.","","Parse a string of the form a-b into a Range","","Calls U::from(self).","","","","","","A fixed-size ring buffer backed by a VecDeque.","","","","Returns the argument unchanged.","","Calls U::from(self).","","Append a value to the end of the ring buffer.","","","","","","","","","","","","","","","","","","","","","","","","","Iterator of login records","","","","","Canonicalize host name using DNS","","","A.K.A. ut.ut_exit","Returns the argument unchanged.","Returns the argument unchanged.","","A.K.A. ut.ut_host","Calls U::from(self).","Calls U::from(self).","Consumes the Utmpx, returning the underlying C struct utmpx","","","Iterate through all the utmp records.","Iterate through all the utmp records from a specific file.","A.K.A. ut.ut_tv","","A.K.A. ut.ut_pid","A.K.A. ut.ut_type","","A.K.A. ut.ut_id","","","","","A.K.A. ut.ut_line","","","A.K.A. ut.ut_user","",""],"i":[0,0,0,0,74,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,7,0,6,7,6,6,6,0,6,7,6,7,6,6,7,0,0,6,7,6,7,7,6,7,0,6,7,7,6,7,6,7,6,7,6,7,7,91,92,91,92,0,0,0,0,0,0,0,0,20,20,20,20,20,20,20,20,20,20,20,93,93,20,20,0,0,93,20,20,20,20,20,25,25,25,25,25,25,25,0,30,0,0,30,0,0,30,25,29,29,28,30,25,29,28,30,25,25,25,0,28,0,28,30,30,29,28,30,30,30,30,25,28,29,28,30,25,28,28,30,30,25,30,29,28,30,25,29,28,30,25,29,28,30,25,0,0,94,95,96,0,0,0,37,37,39,37,39,37,39,37,39,37,39,37,39,0,0,37,39,0,0,37,39,97,37,37,39,39,37,39,37,39,37,39,37,39,37,39,37,0,37,37,37,37,0,44,0,0,0,0,0,0,0,0,0,42,43,46,44,45,42,43,46,44,45,49,49,42,43,44,45,42,43,42,42,43,43,46,46,44,44,45,45,42,43,46,46,44,45,0,42,43,46,44,45,98,42,43,42,43,46,44,42,43,46,44,45,0,0,42,43,46,44,45,42,43,46,44,45,42,43,46,44,45,42,43,46,44,45,0,49,49,43,99,52,0,53,52,0,53,52,53,0,56,52,53,56,52,53,0,52,53,52,53,0,0,0,56,52,53,56,52,53,56,52,53,56,56,0,56,0,56,56,52,53,0,0,56,0,0,52,53,56,52,53,56,52,53,56,52,53,0,0,0,0,0,0,100,60,63,63,63,101,100,60,63,63,62,63,60,62,63,60,62,63,60,62,63,60,62,62,62,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,63,63,62,63,60,100,60,100,60,62,63,60,100,60,62,100,60,60,62,63,60,100,60,62,62,62,100,60,63,101,0,0,0,0,62,0,0,0,62,63,60,100,60,100,60,62,63,60,62,63,60,62,63,60,0,65,65,65,65,65,0,65,65,65,65,0,67,67,67,67,67,67,67,67,67,67,0,0,0,0,0,0,0,0,0,71,71,0,71,71,71,71,71,71,71,71,71,0,71,71,71,71,71,102,103,104,0,105,77,75,0,77,105,0,77,75,75,0,105,105,75,0,0,105,78,75,76,77,105,78,75,76,77,0,75,76,75,76,78,78,78,0,75,76,77,78,78,78,75,76,105,78,75,76,77,76,105,78,75,76,77,76,0,78,78,75,76,78,105,78,75,76,77,105,78,75,76,77,105,78,75,76,77,78,0,106,107,108,108,0,0,0,0,0,37,39,0,0,97,37,39,37,0,37,37,37,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,0,80,80,80,80,80,80,80,80,80,80,0,0,0,0,80,109,80,80,80,80,80,80,80,109,110,111,82,81,82,81,0,0,82,81,82,81,82,81,81,81,0,82,81,82,81,81,82,81,82,81,82,81,112,112,113,112,114,0,83,83,83,0,0,83,83,83,83,83,83,83,83,83,83,83,83,0,85,85,85,85,85,85,85,85,85,85,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,86,87,86,87,86,87,0,86,86,87,0,86,86,87,86,87,86,86,86,86,87,86,86,0,86,86,87,86,87,86,86,87,86,0,0],"f":[0,[[],1],0,0,[[],[[3,[2]]]],[[],[[3,[2]]]],0,0,0,0,0,0,[[],4],[4,2],0,0,[[],5],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],0,0,0,0,0,0,[[],4],0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[6,6],[[]],[7,8],[9,[[10,[6]]]],[9,2],[[6,6],5],[[7,7],5],[[6,11],12],[[7,11],12],[[7,11],12],[[]],[[]],[[6,13,4],[[15,[14]]]],[[]],[[]],[16],[[]],[[],2],[[],17],[[],17],[[],17],[[],17],[[],18],[[],18],[7,5],0,0,0,0,0,0,0,[[],19],[[],19],[[],19],0,0,[[]],[[]],[20,20],[[]],[[20,5],20],[[20,11],[[17,[21]]]],[[20,11],[[17,[21]]]],[[20,5],20],[[]],[[],20],[[]],[[],20],[[],20],[4,20],[22,20],[[[23,[22]]],24],[[[23,[22]]],24],[[],20],[[]],[[],2],[[],17],[[],17],[[],18],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[25,25],[[]],[25,26],[[[28,[27]]],26],[25,[[17,[2,29]]]],[[[28,[27]]],[[17,[2,29]]]],[[30,11],12],[[30,11],12],[[]],[[]],[31,30],[32,30],[[]],[33,30],[[]],[[[28,[27]],5],[[28,[27]]]],[[]],[[]],[[]],[[]],[[[28,[27]],34],[[28,[27]]]],[[27,25],[[28,[27]]]],[16],[30,[[15,[35]]]],[[]],[[],2],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],18],[[],18],[[],18],[[],18],[[28,4]],[[36,34,4],24],0,0,0,0,0,0,[37,[[3,[38]]]],[[]],[[]],[[]],[[]],[37,37],[39,39],[[]],[[]],[[37,11],12],[[39,11],12],[[]],[[]],[[],[[24,[[3,[38]]]]]],[[[15,[40]]],[[24,[[3,[38]]]]]],0,0,[38,[[24,[2]]]],[4,[[24,[38]]]],[[]],[[]],[[],24],[4,[[24,[37]]]],[41,[[24,[37]]]],[4,[[24,[39]]]],[38,[[24,[39]]]],0,0,[[]],[[]],[[],17],[[],17],[[],17],[[],17],[[],18],[[],18],0,[41,[[24,[2]]]],0,0,0,0,[4,[[24,[41]]]],0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],8],[[],8],[42,8],[43,8],[44,8],[45,8],0,0,[[42,11],12],[[42,11],[[17,[21]]]],[[43,11],[[17,[21]]]],[[43,11],12],[[46,11],[[17,[21]]]],[[46,11],12],[[44,11],[[17,[21]]]],[[44,11],12],[[45,11],[[17,[21]]]],[[45,11],12],[[]],[[]],[[]],[31,46],[[]],[[]],[[],8],[[]],[[]],[[]],[[]],[[]],[47],0,0,[[8,[48,[2]]],[[50,[49]]]],[[8,[48,[2]]],[[50,[49]]]],[[51,[48,[2]]],[[50,[49]]]],[8,[[50,[49]]]],[16],[16],[16],[16],[16],[8],[31,2],[[],2],[[],2],[[],2],[[],2],[[],2],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],18],[[],18],[[],18],[[],18],[[],18],0,[[],5],[[],5],[43,5],[8],0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[[23,[13]],52,53],[[24,[14]]]],[52,52],[53,53],[[]],[[]],[13,14],[[54,5],2],[[55,5],2],[[56,56],5],[[52,52],5],[[53,53],5],[56,57],[[52,11],12],[[53,11],12],[[]],[[]],[[]],[[],[[24,[56]]]],[[[23,[13]],5],[[24,[56]]]],0,[56],[[[24,[56]],[24,[56]]],5],[56,57],[[]],[[]],[[]],[[[23,[13]],[23,[13]]],14],[13,14],[56,57],[[[23,[13]],[23,[13]],5],5],[13,[[58,[13]]]],[[]],[[]],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],18],[[],18],[[],18],0,0,0,0,0,[[59,60],8],[[],57],[60,57],0,0,0,[[],2],[[],61],[60,61],0,0,[[]],[[]],[[]],[[]],[[]],[[]],[62,62],[63,63],[60,60],[[]],[[]],[[]],0,0,0,[[60,60],5],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[62,11],12],[[63,11],12],[[60,11],[[17,[21]]]],[[],57],[60,57],[[],57],[60,57],[[]],[[]],[[]],[[],61],[60,61],0,[[],57],[60,57],[60],[[]],[[]],[[]],[[],57],[60,57],0,0,0,[[],57],[60,57],[60,63],[[],2],[[55,57],4],[61,[[58,[4]]]],[[61,61],2],[[],[[17,[[3,[62]],31]]]],0,[[],[[17,[60,2]]]],0,[[59,60],8],[[]],[[]],[[]],[[],57],[60,57],[[],57],[60,57],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],18],[[],18],[[],18],0,[[]],[[]],[[]],[[]],[[]],[64,65],[[[65,[66]]],[[15,[[24,[[3,[64]]]]]]]],[[],17],[[],17],[[],18],0,[[67,68]],[[]],[[]],[[]],[[]],[[4,68],[[10,[67]]]],[4,10],[[],17],[[],17],[[],18],[[],40],[4,[[17,[55,2]]]],[[40,4,5],[[17,[40,2]]]],[[40,4,40,5],[[17,[40,2]]]],[3,5],[[],5],[[],5],[[]],[4,[[17,[69,70]]]],0,0,0,0,[[]],[[]],[71,4],[[71,71],5],[[71,11],[[17,[21]]]],[[71,11],12],[[]],[[]],[4,[[17,[57,71]]]],[16],[[],2],[[],17],[[],17],[[],18],0,0,0,[4,[[17,[72,2]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[73,74,4,5],10],[75,75],[76,76],[[]],[[]],0,0,0,0,[[75,75],5],[[76,76],5],[[77,77],5],[78,10],0,0,[[75,11],12],[[76,11],12],[[]],[[]],[[]],[[]],[[]],0,[[]],[[]],[[]],[[]],[[]],0,0,0,0,[[]],[[]],0,[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],18],[[],18],[[],18],[[],18],[[],18],0,[[[23,[13]],54,[15,[40]],[15,[40]],5,76],[[17,[2,2]]]],0,0,0,0,0,0,0,[[],[[24,[[3,[38]]]]]],[[[15,[40]]],[[24,[[3,[38]]]]]],0,0,[38,[[24,[2]]]],[4,[[24,[38]]]],[[],24],0,0,0,[41,[[24,[2]]]],0,0,0,0,[4,[[24,[41]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[],79],[34,[[79,[34]]]],[34,79],[[],[[79,[34]]]],0,0,0,0,[[]],[[]],[80,80],[[]],[80,[[15,[8]]]],[[80,80],5],[[80,11],12],[[80,11],12],[[]],[[],38],[[],41],[[],38],[[],41],[[]],[34,24],[80,[[15,[8]]]],[80,5],[[]],[[],2],[[],17],[[],17],[[],18],[72,[[24,[[15,[80]]]]]],0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[81,81],[[]],[[22,82],2],[[]],[[]],[[]],[[]],[[]],[[],17],[[],17],[[],17],[[],17],[[],18],[[],18],0,0,0,0,0,0,[[]],[[]],[[83,83],84],[[],[[3,[83]]]],[34,5],[[83,83],5],[[83,11],12],[[]],[4,[[17,[[3,[83]],2]]]],[4,[[17,[83,4]]]],0,[[]],0,[[83,83],[[15,[84]]]],[[],17],[[],17],[[],18],0,[[]],[[]],0,[[]],[[1,34],85],[[]],[34,85],[85,15],[[],17],[[],17],[[],18],0,0,[34,5],[4,[[15,[34]]]],[34,[[15,[4]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[]],[[]],[[]],[[]],[86,[[24,[2]]]],[87],[[]],[86],[[]],[[]],[[],88],[86,2],[[]],[[]],[86,88],[[]],[86,5],[[],87],[[[23,[13]]],87],[86,89],[87,15],[86,8],[86,90],[[]],[86,2],[[],17],[[],17],[[],17],[[],17],[86,2],[[],18],[[],18],[86,2],[59,8],[[4,4],84]],"p":[[8,"Iterator"],[3,"String"],[3,"Vec"],[15,"str"],[15,"bool"],[4,"BackupMode"],[4,"BackupError"],[15,"i32"],[3,"ArgMatches"],[6,"UResult"],[3,"Formatter"],[6,"Result"],[3,"Path"],[3,"PathBuf"],[4,"Option"],[3,"Demand"],[4,"Result"],[3,"TypeId"],[3,"Arg"],[3,"Quoted"],[3,"Error"],[3,"OsStr"],[8,"AsRef"],[6,"Result"],[4,"Format"],[6,"DecodeResult"],[8,"Read"],[3,"Data"],[4,"EncodeError"],[4,"DecodeError"],[3,"Error"],[4,"DecodeError"],[3,"DecodeError"],[15,"usize"],[8,"Error"],[8,"Write"],[3,"Passwd"],[6,"gid_t"],[3,"Group"],[15,"u32"],[6,"uid_t"],[3,"USimpleError"],[3,"UUsageError"],[3,"ExitCode"],[3,"ClapErrorWrapper"],[3,"UIoError"],[8,"FnOnce"],[8,"Into"],[8,"UError"],[3,"Box"],[4,"ErrorKind"],[4,"MissingHandling"],[4,"ResolveMode"],[3,"Metadata"],[6,"mode_t"],[3,"FileInformation"],[15,"u64"],[4,"Cow"],[15,"i8"],[3,"statfs_fn"],[15,"i64"],[3,"MountInfo"],[3,"FsUsage"],[15,"u8"],[3,"Lines"],[8,"BufRead"],[3,"Memo"],[3,"Peekable"],[3,"Pattern"],[3,"PatternError"],[4,"ParseSizeError"],[3,"Duration"],[3,"Command"],[8,"Args"],[4,"VerbosityLevel"],[3,"Verbosity"],[4,"TraverseSymlinks"],[3,"ChownExecutor"],[6,"Result"],[4,"ExitStatus"],[4,"Quotes"],[4,"QuotingStyle"],[3,"Range"],[4,"Ordering"],[3,"RingBuffer"],[3,"Utmpx"],[3,"UtmpxIter"],[3,"utmpx"],[3,"OffsetDateTime"],[15,"i16"],[13,"InvalidArgument"],[13,"AmbiguousArgument"],[8,"Quotable"],[13,"Decode"],[13,"DecodeZ85"],[13,"Io"],[8,"Locate"],[8,"FromIo"],[8,"UClapError"],[8,"FsMeta"],[8,"BirthTime"],[13,"InvalidSuffix"],[13,"ParseFailure"],[13,"SizeTooBig"],[4,"IfFrom"],[13,"User"],[13,"Group"],[13,"UserGroup"],[8,"ChildExt"],[13,"Code"],[13,"Signal"],[13,"Shell"],[13,"C"],[13,"Literal"]]},\ "uucore_procs":{"doc":"","t":[14,14,23],"n":["help_section","help_usage","main"],"q":["uucore_procs","",""],"d":["Reads a section from a file of the util as a str literal.","Get the usage from the “Usage” section in the help …",""],"i":[0,0,0],"f":[0,0,0],"p":[]},\ "uudoc":{"doc":"","t":[3,6,11,11,11,12,11,11,11,11,11,11,5,11,11,5,11,12,11,11,12,11,11,11,11,5,12,11,11,12],"n":["MDWriter","UtilityMap","additional","borrow","borrow_mut","command","deref","deref_mut","description","drop","examples","from","get_zip_content","init","into","main","markdown","name","options","platforms","tldr_zip","try_from","try_into","type_id","usage","util_map","utils_per_platform","version","vzip","w"],"q":["uudoc","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["","","","","","","","","","","","Returns the argument unchanged.","","","Calls U::from(self).","","","","","","","","","","","","","","",""],"i":[0,0,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1],"f":[0,0,[1,2],[[]],[[]],0,[3],[3],[1,2],[3],[1,2],[[]],[[4,5],[[7,[6]]]],[[],3],[[]],[[],2],[1,2],0,[1,2],[1,2],0,[[],8],[[],8],[[],9],[1,2],[[],[[10,[5]]]],0,[1,2],[[]],0],"p":[[3,"MDWriter"],[6,"Result"],[15,"usize"],[3,"ZipArchive"],[15,"str"],[3,"String"],[4,"Option"],[4,"Result"],[3,"TypeId"],[3,"Map"]]},\ "vdir":{"doc":"","t":[5],"n":["main"],"q":["vdir"],"d":[""],"i":[0],"f":[[[]]],"p":[]},\ diff --git a/dev/search.js b/dev/search.js index d35a7db81..f0ccdfb1b 100644 --- a/dev/search.js +++ b/dev/search.js @@ -1 +1 @@ -"use strict";(function(){const itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias",];const TY_PRIMITIVE=itemTypes.indexOf("primitive");const TY_KEYWORD=itemTypes.indexOf("keyword");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";function hasOwnPropertyRustdoc(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("titles").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb}else if(nb!==0){printTab(0)}}const levenshtein_row2=[];function levenshtein(s1,s2){if(s1===s2){return 0}const s1_len=s1.length,s2_len=s2.length;if(s1_len&&s2_len){let i1=0,i2=0,a,b,c,c2;const row=levenshtein_row2;while(i1-".indexOf(c)!==-1}function isStopCharacter(c){return isWhitespace(c)||isEndCharacter(c)}function isErrorCharacter(c){return"()".indexOf(c)!==-1}function itemTypeFromName(typename){for(let i=0,len=itemTypes.length;i0){throw new Error("Cannot use literal search when there is more than one element")}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw new Error("Unclosed `\"`")}else if(parserState.userQuery[end]!=="\""){throw new Error(`Unexpected \`${parserState.userQuery[end]}\` in a string element`)}else if(start===end){throw new Error("Cannot have empty string element")}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function isIdentCharacter(c){return(c==="_"||(c>="0"&&c<="9")||(c>="a"&&c<="z")||(c>="A"&&c<="Z"))}function isSeparatorCharacter(c){return c===","||isWhitespaceCharacter(c)}function isWhitespaceCharacter(c){return c===" "||c==="\t"}function createQueryElement(query,parserState,name,generics,isInGenerics){if(name==="*"||(name.length===0&&generics.length===0)){return}if(query.literalSearch&&parserState.totalElems-parserState.genericsElems>0){throw new Error("You cannot have more than one element if you use quotes")}const pathSegments=name.split("::");if(pathSegments.length>1){for(let i=0,len=pathSegments.length;i=end){throw new Error("Found generics without a path")}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}if(start>=end&&generics.length===0){return}elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics))}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;while(parserState.pos"){extra="`<`"}else if(endChar===""){extra="`->`"}throw new Error("Unexpected `"+c+"` after "+extra)}if(!foundStopChar){if(endChar!==""){throw new Error(`Expected \`,\`, \` \` or \`${endChar}\`, found \`${c}\``)}throw new Error(`Expected \`,\` or \` \`, found \`${c}\``)}const posBefore=parserState.pos;getNextElem(query,parserState,elems,endChar===">");if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}parserState.pos+=1}function checkExtraTypeFilterCharacters(parserState){const query=parserState.userQuery;for(let pos=0;pos"){if(isReturnArrow(parserState)){break}throw new Error(`Unexpected \`${c}\` (did you mean \`->\`?)`)}throw new Error(`Unexpected \`${c}\``)}else if(c===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw new Error("Unexpected `:`")}if(query.elems.length===0){throw new Error("Expected type filter before `:`")}else if(query.elems.length!==1||parserState.totalElems!==1){throw new Error("Unexpected `:`")}else if(query.literalSearch){throw new Error("You cannot use quotes on type filter")}checkExtraTypeFilterCharacters(parserState);parserState.typeFilter=query.elems.pop().name;parserState.pos+=1;parserState.totalElems=0;query.literalSearch=false;foundStopChar=true;continue}if(!foundStopChar){if(parserState.typeFilter!==null){throw new Error(`Expected \`,\`, \` \` or \`->\`, found \`${c}\``)}throw new Error(`Expected \`,\`, \` \`, \`:\` or \`->\`, found \`${c}\``)}before=query.elems.length;getNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}while(parserState.pos`")}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),typeFilter:NO_TYPE_FILTER,elems:[],returned:[],foundElems:0,literalSearch:false,error:null,}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="All crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return null}function parseQuery(userQuery){userQuery=userQuery.trim();const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);if(parserState.typeFilter!==null){let typeFilter=parserState.typeFilter;if(typeFilter==="const"){typeFilter="constant"}query.typeFilter=itemTypeFromName(typeFilter)}}catch(err){query=newParsedQuery(userQuery);query.error=err.message;query.typeFilter=-1;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}function execQuery(parsedQuery,searchWords,filterCrates,currentCrate){const results_others={},results_in_args={},results_returned={};function transformResults(results){const duplicates={};const out=[];for(const result of results){if(result.id>-1){const obj=searchIndex[result.id];obj.lev=result.lev;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates[obj.fullPath]){continue}duplicates[obj.fullPath]=true;obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType,preferredCrate){const userQuery=parsedQuery.userQuery;const ar=[];for(const entry in results){if(hasOwnPropertyRustdoc(results,entry)){const result=results[entry];result.word=searchWords[result.id];result.item=searchIndex[result.id]||{};ar.push(result)}}results=ar;if(results.length===0){return[]}results.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.lev);b=(bbb.lev);if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});let nameSplit=null;if(parsedQuery.elems.length===1){const hasPath=typeof parsedQuery.elems[0].path==="undefined";nameSplit=hasPath?null:parsedQuery.elems[0].path}for(const result of results){if(result.dontValidate){continue}const name=result.item.name.toLowerCase(),path=result.item.path.toLowerCase(),parent=result.item.parent;if(!isType&&!validateResult(name,path,nameSplit,parent)){result.id=-1}}return transformResults(results)}function checkGenerics(row,elem,defaultLev){if(row.generics.length===0){return elem.generics.length===0?defaultLev:MAX_LEV_DISTANCE+1}else if(row.generics.length>0&&row.generics[0].name===null){return checkGenerics(row.generics[0],elem,defaultLev)}let elem_name;if(elem.generics.length>0&&row.generics.length>=elem.generics.length){const elems=Object.create(null);for(const entry of row.generics){elem_name=entry.name;if(elem_name===""){if(checkGenerics(entry,elem,MAX_LEV_DISTANCE+1)!==0){return MAX_LEV_DISTANCE+1}continue}if(elems[elem_name]===undefined){elems[elem_name]=0}elems[elem_name]+=1}for(const generic of elem.generics){let match=null;if(elems[generic.name]){match=generic.name}else{for(elem_name in elems){if(!hasOwnPropertyRustdoc(elems,elem_name)){continue}if(elem_name===generic){match=elem_name;break}}}if(match===null){return MAX_LEV_DISTANCE+1}elems[match]-=1;if(elems[match]===0){delete elems[match]}}return 0}return MAX_LEV_DISTANCE+1}function checkIfInGenerics(row,elem){let lev=MAX_LEV_DISTANCE+1;for(const entry of row.generics){lev=Math.min(checkType(entry,elem,true),lev);if(lev===0){break}}return lev}function checkType(row,elem,literalSearch){if(row.name===null){if(row.generics.length>0){return checkIfInGenerics(row,elem)}return MAX_LEV_DISTANCE+1}let lev=levenshtein(row.name,elem.name);if(literalSearch){if(lev!==0){if(elem.generics.length===0){const checkGeneric=row.generics.length>0;if(checkGeneric&&row.generics.findIndex(tmp_elem=>tmp_elem.name===elem.name)!==-1){return 0}}return MAX_LEV_DISTANCE+1}else if(elem.generics.length>0){return checkGenerics(row,elem,MAX_LEV_DISTANCE+1)}return 0}else if(row.generics.length>0){if(elem.generics.length===0){if(lev===0){return 0}lev=checkIfInGenerics(row,elem);return lev+0.5}else if(lev>MAX_LEV_DISTANCE){return checkIfInGenerics(row,elem)}else{const tmp_lev=checkGenerics(row,elem,lev);if(tmp_lev>MAX_LEV_DISTANCE){return MAX_LEV_DISTANCE+1}return(tmp_lev+lev)/2}}else if(elem.generics.length>0){return MAX_LEV_DISTANCE+1}return lev}function findArg(row,elem,typeFilter){let lev=MAX_LEV_DISTANCE+1;if(row&&row.type&&row.type.inputs&&row.type.inputs.length>0){for(const input of row.type.inputs){if(!typePassesFilter(typeFilter,input.ty)){continue}lev=Math.min(lev,checkType(input,elem,parsedQuery.literalSearch));if(lev===0){return 0}}}return parsedQuery.literalSearch?MAX_LEV_DISTANCE+1:lev}function checkReturned(row,elem,typeFilter){let lev=MAX_LEV_DISTANCE+1;if(row&&row.type&&row.type.output.length>0){const ret=row.type.output;for(const ret_ty of ret){if(!typePassesFilter(typeFilter,ret_ty.ty)){continue}lev=Math.min(lev,checkType(ret_ty,elem,parsedQuery.literalSearch));if(lev===0){return 0}}}return parsedQuery.literalSearch?MAX_LEV_DISTANCE+1:lev}function checkPath(contains,ty){if(contains.length===0){return 0}let ret_lev=MAX_LEV_DISTANCE+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;if(clength>length){return MAX_LEV_DISTANCE+1}for(let i=0;ilength){break}let lev_total=0;let aborted=false;for(let x=0;xMAX_LEV_DISTANCE){aborted=true;break}lev_total+=lev}if(!aborted){ret_lev=Math.min(ret_lev,Math.round(lev_total/clength))}}return ret_lev}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,}}function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES[filterCrates]&&ALIASES[filterCrates][lowerQuery]){const query_aliases=ALIASES[filterCrates][lowerQuery];for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{Object.keys(ALIASES).forEach(crate=>{if(ALIASES[crate][lowerQuery]){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=ALIASES[crate][lowerQuery];for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}})}const sortFunc=(aaa,bbb)=>{if(aaa.path{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,lev){if(lev===0||(!parsedQuery.literalSearch&&lev<=MAX_LEV_DISTANCE)){if(results[fullId]!==undefined){const result=results[fullId];if(result.dontValidate||result.lev<=lev){return}}results[fullId]={id:id,index:index,dontValidate:parsedQuery.literalSearch,lev:lev,}}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let lev,lev_add=0,index=-1;const fullId=row.id;const in_args=findArg(row,elem,parsedQuery.typeFilter);const returned=checkReturned(row,elem,parsedQuery.typeFilter);addIntoResults(results_in_args,fullId,pos,index,in_args);addIntoResults(results_returned,fullId,pos,index,returned);if(!typePassesFilter(parsedQuery.typeFilter,row.ty)){return}const searchWord=searchWords[pos];if(parsedQuery.literalSearch){if(searchWord===elem.name){addIntoResults(results_others,fullId,pos,-1,0)}return}if(elem.name.length===0){if(row.type!==null){lev=checkGenerics(row.type,elem,MAX_LEV_DISTANCE+1);addIntoResults(results_others,fullId,pos,index,lev)}return}if(elem.fullPath.length>1){lev=checkPath(elem.pathWithoutLast,row);if(lev>MAX_LEV_DISTANCE||(parsedQuery.literalSearch&&lev!==0)){return}else if(lev>0){lev_add=lev/10}}if(searchWord.indexOf(elem.pathLast)>-1||row.normalizedName.indexOf(elem.pathLast)>-1){index=row.normalizedName.indexOf(elem.pathLast)}lev=levenshtein(searchWord,elem.pathLast);if(lev>0&&elem.pathLast.length>2&&searchWord.indexOf(elem.pathLast)>-1){if(elem.pathLast.length<6){lev=1}else{lev=0}}lev+=lev_add;if(lev>MAX_LEV_DISTANCE){return}else if(index!==-1&&elem.fullPath.length<2){lev-=1}if(lev<0){lev=0}addIntoResults(results_others,fullId,pos,index,lev)}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let totalLev=0;let nbLev=0;function checkArgs(elems,callback){for(const elem of elems){const lev=callback(row,elem,NO_TYPE_FILTER);if(lev<=1){nbLev+=1;totalLev+=lev}else{return false}}return true}if(!checkArgs(parsedQuery.elems,findArg)){return}if(!checkArgs(parsedQuery.returned,checkReturned)){return}if(nbLev===0){return}const lev=Math.round(totalLev/nbLev);addIntoResults(results,row.id,pos,0,lev)}function innerRunQuery(){let elem,i,nSearchWords,in_returned,row;if(parsedQuery.foundElems===1){if(parsedQuery.elems.length===1){elem=parsedQuery.elems[0];for(i=0,nSearchWords=searchWords.length;i0){for(i=0,nSearchWords=searchWords.length;i-1||path.indexOf(key)>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(key)>-1)||levenshtein(name,key)<=MAX_LEV_DISTANCE)){return false}}return true}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#titles > button").item(searchState.currentTab);if(target){target.focus()}}function buildHrefAndPath(item){let displayPath;let href;const type=itemTypes[item.ty];const name=item.name;let path=item.path;if(type==="mod"){displayPath=path+"::";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="import"){displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/index.html#reexport."+name}else if(type==="primitive"||type==="keyword"){displayPath="";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=ROOT_PATH+name+"/index.html"}else if(item.parent!==undefined){const myparent=item.parent;let anchor="#"+type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=ROOT_PATH+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function escape(content){const h1=document.createElement("h1");h1.textContent=content;return h1.innerHTML}function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){let extraClass="";if(display===true){extraClass=" active"}const output=document.createElement("div");let length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(item=>{const name=item.name;const type=itemTypes[item.ty];length+=1;let extra="";if(type==="primitive"){extra=" (primitive type)"}else if(type==="keyword"){extra=" (keyword)"}const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const wrapper=document.createElement("div");const resultName=document.createElement("div");resultName.className="result-name";if(item.is_alias){const alias=document.createElement("span");alias.className="alias";const bold=document.createElement("b");bold.innerText=item.alias;alias.appendChild(bold);alias.insertAdjacentHTML("beforeend"," - see ");resultName.appendChild(alias)}resultName.insertAdjacentHTML("beforeend",item.displayPath+""+name+extra+"");wrapper.appendChild(resultName);const description=document.createElement("div");description.className="desc";const spanDesc=document.createElement("span");spanDesc.insertAdjacentHTML("beforeend",item.desc);description.appendChild(spanDesc);wrapper.appendChild(description);link.appendChild(wrapper);output.appendChild(link)})}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true"&&(!search.firstChild||search.firstChild.innerText!==searchState.loadingText))){const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const ret_others=addTab(results.others,results.query,true);const ret_in_args=addTab(results.in_args,results.query,false);const ret_returned=addTab(results.returned,results.query,false);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";const crates_list=Object.keys(rawSearchIndex);if(crates_list.length>1){crates=" in "}let typeFilter="";if(results.query.typeFilter!==NO_TYPE_FILTER){typeFilter=" (type: "+escape(itemTypes[results.query.typeFilter])+")"}let output="
"+`

Results for ${escape(results.query.userQuery)}`+`${typeFilter}

${crates}
`;if(results.query.error!==null){output+=`

Query parser error: "${results.query.error}".

`;output+="
"+makeTabHeader(0,"In Names",ret_others[1])+"
";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
";currentTab=0}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("titles").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function search(e,forced){const params=searchState.getQueryStringParams();const query=parseQuery(searchState.input.value.trim());if(e){e.preventDefault()}if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}let filterCrates=getFilterCrates();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.original+" - Rust";if(browserSupportsHistoryApi()){const newURL=buildUrl(query.original,filterCrates);if(!history.state&&!params.search){history.pushState(null,"",newURL)}else{history.replaceState(null,"",newURL)}}showResults(execQuery(query,searchWords,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildItemSearchTypeAll(types,lowercasePaths){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;return types.map(type=>{let pathIndex,generics;if(typeof type==="number"){pathIndex=type;generics=[]}else{pathIndex=type[PATH_INDEX_DATA];generics=buildItemSearchTypeAll(type[GENERICS_DATA],lowercasePaths)}return{name:pathIndex===0?null:lowercasePaths[pathIndex-1].name,ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:generics,}})}function buildFunctionSearchType(functionSearchType,lowercasePaths){const INPUTS_DATA=0;const OUTPUT_DATA=1;if(functionSearchType===0){return null}let inputs,output;if(typeof functionSearchType[INPUTS_DATA]==="number"){const pathIndex=functionSearchType[INPUTS_DATA];inputs=[{name:pathIndex===0?null:lowercasePaths[pathIndex-1].name,ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:[],}]}else{inputs=buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],lowercasePaths)}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){const pathIndex=functionSearchType[OUTPUT_DATA];output=[{name:pathIndex===0?null:lowercasePaths[pathIndex-1].name,ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:[],}]}else{output=buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],lowercasePaths)}}else{output=[]}return{inputs,output,}}function buildIndex(rawSearchIndex){searchIndex=[];const searchWords=[];let i,word;let currentIndex=0;let id=0;for(const crate in rawSearchIndex){if(!hasOwnPropertyRustdoc(rawSearchIndex,crate)){continue}let crateSize=0;const crateCorpus=rawSearchIndex[crate];searchWords.push(crate);const crateRow={crate:crate,ty:1,name:crate,path:"",desc:crateCorpus.doc,parent:undefined,type:null,id:id,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),};id+=1;searchIndex.push(crateRow);currentIndex+=1;const itemTypes=crateCorpus.t;const itemNames=crateCorpus.n;const itemPaths=crateCorpus.q;const itemDescs=crateCorpus.d;const itemParentIdxs=crateCorpus.i;const itemFunctionSearchTypes=crateCorpus.f;const paths=crateCorpus.p;const aliases=crateCorpus.a;const lowercasePaths=[];let len=paths.length;for(i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:buildFunctionSearchType(itemFunctionSearchTypes[i],lowercasePaths),id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){ALIASES[crate]=Object.create(null);for(const alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}if(!hasOwnPropertyRustdoc(ALIASES[crate],alias_name)){ALIASES[crate][alias_name]=[]}for(const local_alias of aliases[alias_name]){ALIASES[crate][alias_name].push(local_alias+currentIndex)}}}currentIndex+=crateSize}return searchWords}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="All crates"){const params=searchState.getQueryStringParams();const query=searchState.input.value.trim();if(!history.state&&!params.search){history.pushState(null,"",buildUrl(query,null))}else{history.replaceState(null,"",buildUrl(query,null))}}currentResults=null;search(undefined,true)}const searchWords=buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}return searchWords}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch({})}})() \ No newline at end of file +"use strict";(function(){const itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias",];const TY_PRIMITIVE=itemTypes.indexOf("primitive");const TY_KEYWORD=itemTypes.indexOf("keyword");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";function hasOwnPropertyRustdoc(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("titles").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb}else if(nb!==0){printTab(0)}}const levenshtein_row2=[];function levenshtein(s1,s2){if(s1===s2){return 0}const s1_len=s1.length,s2_len=s2.length;if(s1_len&&s2_len){let i1=0,i2=0,a,b,c,c2;const row=levenshtein_row2;while(i1-".indexOf(c)!==-1}function isStopCharacter(c){return isWhitespace(c)||isEndCharacter(c)}function isErrorCharacter(c){return"()".indexOf(c)!==-1}function itemTypeFromName(typename){for(let i=0,len=itemTypes.length;i0){throw new Error("Cannot use literal search when there is more than one element")}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw new Error("Unclosed `\"`")}else if(parserState.userQuery[end]!=="\""){throw new Error(`Unexpected \`${parserState.userQuery[end]}\` in a string element`)}else if(start===end){throw new Error("Cannot have empty string element")}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function isIdentCharacter(c){return(c==="_"||(c>="0"&&c<="9")||(c>="a"&&c<="z")||(c>="A"&&c<="Z"))}function isSeparatorCharacter(c){return c===","||isWhitespaceCharacter(c)}function isWhitespaceCharacter(c){return c===" "||c==="\t"}function createQueryElement(query,parserState,name,generics,isInGenerics){if(name==="*"||(name.length===0&&generics.length===0)){return}if(query.literalSearch&&parserState.totalElems-parserState.genericsElems>0){throw new Error("You cannot have more than one element if you use quotes")}const pathSegments=name.split("::");if(pathSegments.length>1){for(let i=0,len=pathSegments.length;i=end){throw new Error("Found generics without a path")}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}if(start>=end&&generics.length===0){return}elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics))}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;while(parserState.pos"){extra="`<`"}else if(endChar===""){extra="`->`"}throw new Error("Unexpected `"+c+"` after "+extra)}if(!foundStopChar){if(endChar!==""){throw new Error(`Expected \`,\`, \` \` or \`${endChar}\`, found \`${c}\``)}throw new Error(`Expected \`,\` or \` \`, found \`${c}\``)}const posBefore=parserState.pos;getNextElem(query,parserState,elems,endChar===">");if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}parserState.pos+=1}function checkExtraTypeFilterCharacters(parserState){const query=parserState.userQuery;for(let pos=0;pos"){if(isReturnArrow(parserState)){break}throw new Error(`Unexpected \`${c}\` (did you mean \`->\`?)`)}throw new Error(`Unexpected \`${c}\``)}else if(c===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw new Error("Unexpected `:`")}if(query.elems.length===0){throw new Error("Expected type filter before `:`")}else if(query.elems.length!==1||parserState.totalElems!==1){throw new Error("Unexpected `:`")}else if(query.literalSearch){throw new Error("You cannot use quotes on type filter")}checkExtraTypeFilterCharacters(parserState);parserState.typeFilter=query.elems.pop().name;parserState.pos+=1;parserState.totalElems=0;query.literalSearch=false;foundStopChar=true;continue}if(!foundStopChar){if(parserState.typeFilter!==null){throw new Error(`Expected \`,\`, \` \` or \`->\`, found \`${c}\``)}throw new Error(`Expected \`,\`, \` \`, \`:\` or \`->\`, found \`${c}\``)}before=query.elems.length;getNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}while(parserState.pos`")}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),typeFilter:NO_TYPE_FILTER,elems:[],returned:[],foundElems:0,literalSearch:false,error:null,}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="all crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return null}function parseQuery(userQuery){userQuery=userQuery.trim();const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);if(parserState.typeFilter!==null){let typeFilter=parserState.typeFilter;if(typeFilter==="const"){typeFilter="constant"}query.typeFilter=itemTypeFromName(typeFilter)}}catch(err){query=newParsedQuery(userQuery);query.error=err.message;query.typeFilter=-1;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}function execQuery(parsedQuery,searchWords,filterCrates,currentCrate){const results_others={},results_in_args={},results_returned={};function transformResults(results){const duplicates={};const out=[];for(const result of results){if(result.id>-1){const obj=searchIndex[result.id];obj.lev=result.lev;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates[obj.fullPath]){continue}duplicates[obj.fullPath]=true;obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType,preferredCrate){const userQuery=parsedQuery.userQuery;const ar=[];for(const entry in results){if(hasOwnPropertyRustdoc(results,entry)){const result=results[entry];result.word=searchWords[result.id];result.item=searchIndex[result.id]||{};ar.push(result)}}results=ar;if(results.length===0){return[]}results.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.lev);b=(bbb.lev);if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});let nameSplit=null;if(parsedQuery.elems.length===1){const hasPath=typeof parsedQuery.elems[0].path==="undefined";nameSplit=hasPath?null:parsedQuery.elems[0].path}for(const result of results){if(result.dontValidate){continue}const name=result.item.name.toLowerCase(),path=result.item.path.toLowerCase(),parent=result.item.parent;if(!isType&&!validateResult(name,path,nameSplit,parent)){result.id=-1}}return transformResults(results)}function checkGenerics(row,elem,defaultLev){if(row.generics.length===0){return elem.generics.length===0?defaultLev:MAX_LEV_DISTANCE+1}else if(row.generics.length>0&&row.generics[0].name===null){return checkGenerics(row.generics[0],elem,defaultLev)}let elem_name;if(elem.generics.length>0&&row.generics.length>=elem.generics.length){const elems=Object.create(null);for(const entry of row.generics){elem_name=entry.name;if(elem_name===""){if(checkGenerics(entry,elem,MAX_LEV_DISTANCE+1)!==0){return MAX_LEV_DISTANCE+1}continue}if(elems[elem_name]===undefined){elems[elem_name]=0}elems[elem_name]+=1}for(const generic of elem.generics){let match=null;if(elems[generic.name]){match=generic.name}else{for(elem_name in elems){if(!hasOwnPropertyRustdoc(elems,elem_name)){continue}if(elem_name===generic){match=elem_name;break}}}if(match===null){return MAX_LEV_DISTANCE+1}elems[match]-=1;if(elems[match]===0){delete elems[match]}}return 0}return MAX_LEV_DISTANCE+1}function checkIfInGenerics(row,elem){let lev=MAX_LEV_DISTANCE+1;for(const entry of row.generics){lev=Math.min(checkType(entry,elem,true),lev);if(lev===0){break}}return lev}function checkType(row,elem,literalSearch){if(row.name===null){if(row.generics.length>0){return checkIfInGenerics(row,elem)}return MAX_LEV_DISTANCE+1}let lev=levenshtein(row.name,elem.name);if(literalSearch){if(lev!==0){if(elem.generics.length===0){const checkGeneric=row.generics.length>0;if(checkGeneric&&row.generics.findIndex(tmp_elem=>tmp_elem.name===elem.name)!==-1){return 0}}return MAX_LEV_DISTANCE+1}else if(elem.generics.length>0){return checkGenerics(row,elem,MAX_LEV_DISTANCE+1)}return 0}else if(row.generics.length>0){if(elem.generics.length===0){if(lev===0){return 0}lev=checkIfInGenerics(row,elem);return lev+0.5}else if(lev>MAX_LEV_DISTANCE){return checkIfInGenerics(row,elem)}else{const tmp_lev=checkGenerics(row,elem,lev);if(tmp_lev>MAX_LEV_DISTANCE){return MAX_LEV_DISTANCE+1}return(tmp_lev+lev)/2}}else if(elem.generics.length>0){return MAX_LEV_DISTANCE+1}return lev}function findArg(row,elem,typeFilter){let lev=MAX_LEV_DISTANCE+1;if(row&&row.type&&row.type.inputs&&row.type.inputs.length>0){for(const input of row.type.inputs){if(!typePassesFilter(typeFilter,input.ty)){continue}lev=Math.min(lev,checkType(input,elem,parsedQuery.literalSearch));if(lev===0){return 0}}}return parsedQuery.literalSearch?MAX_LEV_DISTANCE+1:lev}function checkReturned(row,elem,typeFilter){let lev=MAX_LEV_DISTANCE+1;if(row&&row.type&&row.type.output.length>0){const ret=row.type.output;for(const ret_ty of ret){if(!typePassesFilter(typeFilter,ret_ty.ty)){continue}lev=Math.min(lev,checkType(ret_ty,elem,parsedQuery.literalSearch));if(lev===0){return 0}}}return parsedQuery.literalSearch?MAX_LEV_DISTANCE+1:lev}function checkPath(contains,ty){if(contains.length===0){return 0}let ret_lev=MAX_LEV_DISTANCE+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;if(clength>length){return MAX_LEV_DISTANCE+1}for(let i=0;ilength){break}let lev_total=0;let aborted=false;for(let x=0;xMAX_LEV_DISTANCE){aborted=true;break}lev_total+=lev}if(!aborted){ret_lev=Math.min(ret_lev,Math.round(lev_total/clength))}}return ret_lev}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,}}function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES[filterCrates]&&ALIASES[filterCrates][lowerQuery]){const query_aliases=ALIASES[filterCrates][lowerQuery];for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{Object.keys(ALIASES).forEach(crate=>{if(ALIASES[crate][lowerQuery]){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=ALIASES[crate][lowerQuery];for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}})}const sortFunc=(aaa,bbb)=>{if(aaa.path{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,lev){if(lev===0||(!parsedQuery.literalSearch&&lev<=MAX_LEV_DISTANCE)){if(results[fullId]!==undefined){const result=results[fullId];if(result.dontValidate||result.lev<=lev){return}}results[fullId]={id:id,index:index,dontValidate:parsedQuery.literalSearch,lev:lev,}}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let lev,lev_add=0,index=-1;const fullId=row.id;const in_args=findArg(row,elem,parsedQuery.typeFilter);const returned=checkReturned(row,elem,parsedQuery.typeFilter);addIntoResults(results_in_args,fullId,pos,index,in_args);addIntoResults(results_returned,fullId,pos,index,returned);if(!typePassesFilter(parsedQuery.typeFilter,row.ty)){return}const searchWord=searchWords[pos];if(parsedQuery.literalSearch){if(searchWord===elem.name){addIntoResults(results_others,fullId,pos,-1,0)}return}if(elem.name.length===0){if(row.type!==null){lev=checkGenerics(row.type,elem,MAX_LEV_DISTANCE+1);addIntoResults(results_others,fullId,pos,index,lev)}return}if(elem.fullPath.length>1){lev=checkPath(elem.pathWithoutLast,row);if(lev>MAX_LEV_DISTANCE||(parsedQuery.literalSearch&&lev!==0)){return}else if(lev>0){lev_add=lev/10}}if(searchWord.indexOf(elem.pathLast)>-1||row.normalizedName.indexOf(elem.pathLast)>-1){index=row.normalizedName.indexOf(elem.pathLast)}lev=levenshtein(searchWord,elem.pathLast);if(lev>0&&elem.pathLast.length>2&&searchWord.indexOf(elem.pathLast)>-1){if(elem.pathLast.length<6){lev=1}else{lev=0}}lev+=lev_add;if(lev>MAX_LEV_DISTANCE){return}else if(index!==-1&&elem.fullPath.length<2){lev-=1}if(lev<0){lev=0}addIntoResults(results_others,fullId,pos,index,lev)}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let totalLev=0;let nbLev=0;function checkArgs(elems,callback){for(const elem of elems){const lev=callback(row,elem,NO_TYPE_FILTER);if(lev<=1){nbLev+=1;totalLev+=lev}else{return false}}return true}if(!checkArgs(parsedQuery.elems,findArg)){return}if(!checkArgs(parsedQuery.returned,checkReturned)){return}if(nbLev===0){return}const lev=Math.round(totalLev/nbLev);addIntoResults(results,row.id,pos,0,lev)}function innerRunQuery(){let elem,i,nSearchWords,in_returned,row;if(parsedQuery.foundElems===1){if(parsedQuery.elems.length===1){elem=parsedQuery.elems[0];for(i=0,nSearchWords=searchWords.length;i0){for(i=0,nSearchWords=searchWords.length;i-1||path.indexOf(key)>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(key)>-1)||levenshtein(name,key)<=MAX_LEV_DISTANCE)){return false}}return true}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#titles > button").item(searchState.currentTab);if(target){target.focus()}}function buildHrefAndPath(item){let displayPath;let href;const type=itemTypes[item.ty];const name=item.name;let path=item.path;if(type==="mod"){displayPath=path+"::";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="import"){displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/index.html#reexport."+name}else if(type==="primitive"||type==="keyword"){displayPath="";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=ROOT_PATH+name+"/index.html"}else if(item.parent!==undefined){const myparent=item.parent;let anchor="#"+type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=ROOT_PATH+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){let extraClass="";if(display===true){extraClass=" active"}const output=document.createElement("div");let length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(item=>{const name=item.name;const type=itemTypes[item.ty];length+=1;let extra="";if(type==="primitive"){extra=" (primitive type)"}else if(type==="keyword"){extra=" (keyword)"}const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const wrapper=document.createElement("div");const resultName=document.createElement("div");resultName.className="result-name";if(item.is_alias){const alias=document.createElement("span");alias.className="alias";const bold=document.createElement("b");bold.innerText=item.alias;alias.appendChild(bold);alias.insertAdjacentHTML("beforeend"," - see ");resultName.appendChild(alias)}resultName.insertAdjacentHTML("beforeend",item.displayPath+""+name+extra+"");wrapper.appendChild(resultName);const description=document.createElement("div");description.className="desc";const spanDesc=document.createElement("span");spanDesc.insertAdjacentHTML("beforeend",item.desc);description.appendChild(spanDesc);wrapper.appendChild(description);link.appendChild(wrapper);output.appendChild(link)})}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true"&&(!search.firstChild||search.firstChild.innerText!==searchState.loadingText))){const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const ret_others=addTab(results.others,results.query,true);const ret_in_args=addTab(results.in_args,results.query,false);const ret_returned=addTab(results.returned,results.query,false);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";const crates_list=Object.keys(rawSearchIndex);if(crates_list.length>1){crates=" in 
"}let output=`

Results${crates}

`;if(results.query.error!==null){output+=`

Query parser error: "${results.query.error}".

`;output+="
"+makeTabHeader(0,"In Names",ret_others[1])+"
";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
";currentTab=0}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("titles").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function search(e,forced){const params=searchState.getQueryStringParams();const query=parseQuery(searchState.input.value.trim());if(e){e.preventDefault()}if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}let filterCrates=getFilterCrates();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.original+" - Rust";if(browserSupportsHistoryApi()){const newURL=buildUrl(query.original,filterCrates);if(!history.state&&!params.search){history.pushState(null,"",newURL)}else{history.replaceState(null,"",newURL)}}showResults(execQuery(query,searchWords,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildItemSearchTypeAll(types,lowercasePaths){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;return types.map(type=>{let pathIndex,generics;if(typeof type==="number"){pathIndex=type;generics=[]}else{pathIndex=type[PATH_INDEX_DATA];generics=buildItemSearchTypeAll(type[GENERICS_DATA],lowercasePaths)}return{name:pathIndex===0?null:lowercasePaths[pathIndex-1].name,ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:generics,}})}function buildFunctionSearchType(functionSearchType,lowercasePaths){const INPUTS_DATA=0;const OUTPUT_DATA=1;if(functionSearchType===0){return null}let inputs,output;if(typeof functionSearchType[INPUTS_DATA]==="number"){const pathIndex=functionSearchType[INPUTS_DATA];inputs=[{name:pathIndex===0?null:lowercasePaths[pathIndex-1].name,ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:[],}]}else{inputs=buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],lowercasePaths)}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){const pathIndex=functionSearchType[OUTPUT_DATA];output=[{name:pathIndex===0?null:lowercasePaths[pathIndex-1].name,ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:[],}]}else{output=buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],lowercasePaths)}}else{output=[]}return{inputs,output,}}function buildIndex(rawSearchIndex){searchIndex=[];const searchWords=[];let i,word;let currentIndex=0;let id=0;for(const crate in rawSearchIndex){if(!hasOwnPropertyRustdoc(rawSearchIndex,crate)){continue}let crateSize=0;const crateCorpus=rawSearchIndex[crate];searchWords.push(crate);const crateRow={crate:crate,ty:1,name:crate,path:"",desc:crateCorpus.doc,parent:undefined,type:null,id:id,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),};id+=1;searchIndex.push(crateRow);currentIndex+=1;const itemTypes=crateCorpus.t;const itemNames=crateCorpus.n;const itemPaths=crateCorpus.q;const itemDescs=crateCorpus.d;const itemParentIdxs=crateCorpus.i;const itemFunctionSearchTypes=crateCorpus.f;const paths=crateCorpus.p;const aliases=crateCorpus.a;const lowercasePaths=[];let len=paths.length;for(i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:buildFunctionSearchType(itemFunctionSearchTypes[i],lowercasePaths),id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){ALIASES[crate]=Object.create(null);for(const alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}if(!hasOwnPropertyRustdoc(ALIASES[crate],alias_name)){ALIASES[crate][alias_name]=[]}for(const local_alias of aliases[alias_name]){ALIASES[crate][alias_name].push(local_alias+currentIndex)}}}currentIndex+=crateSize}return searchWords}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="all crates"){const params=searchState.getQueryStringParams();const query=searchState.input.value.trim();if(!history.state&&!params.search){history.pushState(null,"",buildUrl(query,null))}else{history.replaceState(null,"",buildUrl(query,null))}}currentResults=null;search(undefined,true)}const searchWords=buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}return searchWords}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch({})}})() \ No newline at end of file diff --git a/dev/seq/all.html b/dev/seq/all.html index 9de430d42..297dceb8b 100644 --- a/dev/seq/all.html +++ b/dev/seq/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/seq/fn.main.html b/dev/seq/fn.main.html index a275575b5..bce6f5a45 100644 --- a/dev/seq/fn.main.html +++ b/dev/seq/fn.main.html @@ -1 +1 @@ -main in seq - Rust

Function seq::main

source · []
pub fn main()
\ No newline at end of file +main in seq - Rust

Function seq::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/seq/index.html b/dev/seq/index.html index d82579724..5248fc61e 100644 --- a/dev/seq/index.html +++ b/dev/seq/index.html @@ -1 +1 @@ -seq - Rust
\ No newline at end of file +seq - Rust
\ No newline at end of file diff --git a/dev/settings.html b/dev/settings.html index a87d37c6b..40113d1fe 100644 --- a/dev/settings.html +++ b/dev/settings.html @@ -1 +1 @@ -Rustdoc settings

Rustdoc settings

Back
\ No newline at end of file +Rustdoc settings

Rustdoc settings

Back
\ No newline at end of file diff --git a/dev/shred/all.html b/dev/shred/all.html index b692fa979..90fe71762 100644 --- a/dev/shred/all.html +++ b/dev/shred/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/shred/fn.main.html b/dev/shred/fn.main.html index ea425219a..bc72fc8a8 100644 --- a/dev/shred/fn.main.html +++ b/dev/shred/fn.main.html @@ -1 +1 @@ -main in shred - Rust

Function shred::main

source · []
pub fn main()
\ No newline at end of file +main in shred - Rust

Function shred::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/shred/index.html b/dev/shred/index.html index 3d0b58d23..76e69a319 100644 --- a/dev/shred/index.html +++ b/dev/shred/index.html @@ -1 +1 @@ -shred - Rust
\ No newline at end of file +shred - Rust
\ No newline at end of file diff --git a/dev/shuf/all.html b/dev/shuf/all.html index 4ec605c68..8c413826b 100644 --- a/dev/shuf/all.html +++ b/dev/shuf/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/shuf/fn.main.html b/dev/shuf/fn.main.html index 1812b62fe..1f3334482 100644 --- a/dev/shuf/fn.main.html +++ b/dev/shuf/fn.main.html @@ -1 +1 @@ -main in shuf - Rust

Function shuf::main

source · []
pub fn main()
\ No newline at end of file +main in shuf - Rust

Function shuf::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/shuf/index.html b/dev/shuf/index.html index b3b38e7ba..1f4e404f8 100644 --- a/dev/shuf/index.html +++ b/dev/shuf/index.html @@ -1 +1 @@ -shuf - Rust
\ No newline at end of file +shuf - Rust
\ No newline at end of file diff --git a/dev/sleep/all.html b/dev/sleep/all.html index cb96bc09d..aa28156bf 100644 --- a/dev/sleep/all.html +++ b/dev/sleep/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/sleep/fn.main.html b/dev/sleep/fn.main.html index 8eced1e76..8947a6cd0 100644 --- a/dev/sleep/fn.main.html +++ b/dev/sleep/fn.main.html @@ -1 +1 @@ -main in sleep - Rust

Function sleep::main

source · []
pub fn main()
\ No newline at end of file +main in sleep - Rust

Function sleep::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/sleep/index.html b/dev/sleep/index.html index 06876c63e..45ccee6ab 100644 --- a/dev/sleep/index.html +++ b/dev/sleep/index.html @@ -1 +1 @@ -sleep - Rust
\ No newline at end of file +sleep - Rust
\ No newline at end of file diff --git a/dev/sort/all.html b/dev/sort/all.html index 6e47fa606..c93d52d9d 100644 --- a/dev/sort/all.html +++ b/dev/sort/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/sort/fn.main.html b/dev/sort/fn.main.html index 0c3bb386f..866d12adb 100644 --- a/dev/sort/fn.main.html +++ b/dev/sort/fn.main.html @@ -1 +1 @@ -main in sort - Rust

Function sort::main

source · []
pub fn main()
\ No newline at end of file +main in sort - Rust

Function sort::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/sort/index.html b/dev/sort/index.html index 59b0999a0..910740342 100644 --- a/dev/sort/index.html +++ b/dev/sort/index.html @@ -1 +1 @@ -sort - Rust
\ No newline at end of file +sort - Rust
\ No newline at end of file diff --git a/dev/source-script.js b/dev/source-script.js index e0fac0739..3866dfd27 100644 --- a/dev/source-script.js +++ b/dev/source-script.js @@ -1 +1 @@ -"use strict";(function(){const rootPath=document.getElementById("rustdoc-vars").attributes["data-root-path"].value;let oldScrollPosition=0;const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;function closeSidebarIfMobile(){if(window.innerWidth"){if(window.innerWidth";updateLocalStorage("source-sidebar-show","false")}}function createSidebarToggle(){const sidebarToggle=document.createElement("div");sidebarToggle.id="sidebar-toggle";const inner=document.createElement("button");if(getCurrentValue("source-sidebar-show")==="true"){inner.innerText="<"}else{inner.innerText=">"}inner.onclick=toggleSidebar;sidebarToggle.appendChild(inner);return sidebarToggle}function createSourceSidebar(){const container=document.querySelector("nav.sidebar");const sidebarToggle=createSidebarToggle();container.insertBefore(sidebarToggle,container.firstChild);const sidebar=document.createElement("div");sidebar.id="source-sidebar";let hasFoundFile=false;const title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(key=>{sourcesIndex[key][NAME_OFFSET]=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",hasFoundFile)});container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}const lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSourceLines(match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("span"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSourceHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSourceLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",()=>{const match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSourceLines(match)}});onEachLazy(document.getElementsByClassName("line-numbers"),el=>{el.addEventListener("click",handleSourceHighlight)});highlightSourceLines();window.createSourceSidebar=createSourceSidebar})() \ No newline at end of file +"use strict";(function(){const rootPath=document.getElementById("rustdoc-vars").attributes["data-root-path"].value;let oldScrollPosition=null;const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;function closeSidebarIfMobile(){if(window.innerWidth"){if(window.innerWidth";updateLocalStorage("source-sidebar-show","false")}}window.addEventListener("resize",()=>{if(window.innerWidth>=window.RUSTDOC_MOBILE_BREAKPOINT&&oldScrollPosition!==null){document.body.style.position="";document.body.style.top="";window.scrollTo(0,oldScrollPosition);oldScrollPosition=null}});function createSidebarToggle(){const sidebarToggle=document.createElement("div");sidebarToggle.id="sidebar-toggle";const inner=document.createElement("button");if(getCurrentValue("source-sidebar-show")==="true"){inner.innerText="<"}else{inner.innerText=">"}inner.onclick=toggleSidebar;sidebarToggle.appendChild(inner);return sidebarToggle}function createSourceSidebar(){const container=document.querySelector("nav.sidebar");const sidebarToggle=createSidebarToggle();container.insertBefore(sidebarToggle,container.firstChild);const sidebar=document.createElement("div");sidebar.id="source-sidebar";let hasFoundFile=false;const title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(key=>{sourcesIndex[key][NAME_OFFSET]=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",hasFoundFile)});container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}const lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSourceLines(match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("span"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSourceHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSourceLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",()=>{const match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSourceLines(match)}});onEachLazy(document.getElementsByClassName("line-numbers"),el=>{el.addEventListener("click",handleSourceHighlight)});highlightSourceLines();window.createSourceSidebar=createSourceSidebar})() \ No newline at end of file diff --git a/dev/split/all.html b/dev/split/all.html index 86b6322f2..fb4b310c8 100644 --- a/dev/split/all.html +++ b/dev/split/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/split/fn.main.html b/dev/split/fn.main.html index d84c7c019..3f3e793c2 100644 --- a/dev/split/fn.main.html +++ b/dev/split/fn.main.html @@ -1 +1 @@ -main in split - Rust

Function split::main

source · []
pub fn main()
\ No newline at end of file +main in split - Rust

Function split::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/split/index.html b/dev/split/index.html index acc73ba71..8c37e65c7 100644 --- a/dev/split/index.html +++ b/dev/split/index.html @@ -1 +1 @@ -split - Rust
\ No newline at end of file +split - Rust
\ No newline at end of file diff --git a/dev/src/arch/main.rs.html b/dev/src/arch/main.rs.html index 33e78abeb..7839601f6 100644 --- a/dev/src/arch/main.rs.html +++ b/dev/src/arch/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_arch);
+main.rs - source
1
+
uucore::bin!(uu_arch);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/base32/main.rs.html b/dev/src/base32/main.rs.html index 70e9564d7..5a7308219 100644 --- a/dev/src/base32/main.rs.html +++ b/dev/src/base32/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_base32);
+main.rs - source
1
+
uucore::bin!(uu_base32);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/base64/main.rs.html b/dev/src/base64/main.rs.html index a9f2115b3..f243f756a 100644 --- a/dev/src/base64/main.rs.html +++ b/dev/src/base64/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_base64);
+main.rs - source
1
+
uucore::bin!(uu_base64);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/basename/main.rs.html b/dev/src/basename/main.rs.html index 3d506826d..645a6d58b 100644 --- a/dev/src/basename/main.rs.html +++ b/dev/src/basename/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_basename);
+main.rs - source
1
+
uucore::bin!(uu_basename);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/basenc/main.rs.html b/dev/src/basenc/main.rs.html index b2e54bab6..270143943 100644 --- a/dev/src/basenc/main.rs.html +++ b/dev/src/basenc/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_basenc);
+main.rs - source
1
+
uucore::bin!(uu_basenc);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/cat/main.rs.html b/dev/src/cat/main.rs.html index 21626bf99..27cf78269 100644 --- a/dev/src/cat/main.rs.html +++ b/dev/src/cat/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_cat);
+main.rs - source
1
+
uucore::bin!(uu_cat);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/chcon/main.rs.html b/dev/src/chcon/main.rs.html index 823f548f2..66568e408 100644 --- a/dev/src/chcon/main.rs.html +++ b/dev/src/chcon/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_chcon);
+main.rs - source
1
+
uucore::bin!(uu_chcon);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/chgrp/main.rs.html b/dev/src/chgrp/main.rs.html index 877ae3ced..95ea34f85 100644 --- a/dev/src/chgrp/main.rs.html +++ b/dev/src/chgrp/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_chgrp);
+main.rs - source
1
+
uucore::bin!(uu_chgrp);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/chmod/main.rs.html b/dev/src/chmod/main.rs.html index 01295d420..fcc3a78eb 100644 --- a/dev/src/chmod/main.rs.html +++ b/dev/src/chmod/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_chmod);
+main.rs - source
1
+
uucore::bin!(uu_chmod);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/chown/main.rs.html b/dev/src/chown/main.rs.html index ec9fe4a1f..bba1a7e97 100644 --- a/dev/src/chown/main.rs.html +++ b/dev/src/chown/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_chown);
+main.rs - source
1
+
uucore::bin!(uu_chown);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/chroot/main.rs.html b/dev/src/chroot/main.rs.html index 27c5a5b3f..f2c54d81d 100644 --- a/dev/src/chroot/main.rs.html +++ b/dev/src/chroot/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_chroot);
+main.rs - source
1
+
uucore::bin!(uu_chroot);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/cksum/main.rs.html b/dev/src/cksum/main.rs.html index eb90b815f..dfa76b5cc 100644 --- a/dev/src/cksum/main.rs.html +++ b/dev/src/cksum/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_cksum);
+main.rs - source
1
+
uucore::bin!(uu_cksum);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/comm/main.rs.html b/dev/src/comm/main.rs.html index 0bac176a2..8918bdb46 100644 --- a/dev/src/comm/main.rs.html +++ b/dev/src/comm/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_comm);
+main.rs - source
1
+
uucore::bin!(uu_comm);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/coreutils/coreutils.rs.html b/dev/src/coreutils/coreutils.rs.html index c74356b18..5842d0d25 100644 --- a/dev/src/coreutils/coreutils.rs.html +++ b/dev/src/coreutils/coreutils.rs.html @@ -1,4 +1,4 @@ -coreutils.rs - source
1
+coreutils.rs - source
1
 2
 3
 4
@@ -174,181 +174,181 @@
 174
 175
 176
-
// This file is part of the uutils coreutils package.
-//
-// (c) Michael Gehring <mg@ebfe.org>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Michael Gehring <mg@ebfe.org>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-use clap::{Arg, Command};
-use clap_complete::Shell;
-use std::cmp;
-use std::ffi::OsStr;
-use std::ffi::OsString;
-use std::io::{self, Write};
-use std::path::{Path, PathBuf};
-use std::process;
-use uucore::display::Quotable;
+use clap::{Arg, Command};
+use clap_complete::Shell;
+use std::cmp;
+use std::ffi::OsStr;
+use std::ffi::OsString;
+use std::io::{self, Write};
+use std::path::{Path, PathBuf};
+use std::process;
+use uucore::display::Quotable;
 
-const VERSION: &str = env!("CARGO_PKG_VERSION");
+const VERSION: &str = env!("CARGO_PKG_VERSION");
 
 include!(concat!(env!("OUT_DIR"), "/uutils_map.rs"));
 
-fn usage<T>(utils: &UtilityMap<T>, name: &str) {
-    println!("{} {} (multi-call binary)\n", name, VERSION);
-    println!("Usage: {} [function [arguments...]]\n", name);
+fn usage<T>(utils: &UtilityMap<T>, name: &str) {
+    println!("{} {} (multi-call binary)\n", name, VERSION);
+    println!("Usage: {} [function [arguments...]]\n", name);
     println!("Currently defined functions:\n");
-    #[allow(clippy::map_clone)]
-    let mut utils: Vec<&str> = utils.keys().map(|&s| s).collect();
-    utils.sort_unstable();
-    let display_list = utils.join(", ");
-    let width = cmp::min(textwrap::termwidth(), 100) - 4 * 2; // (opinion/heuristic) max 100 chars wide with 4 character side indentions
-    println!(
+    #[allow(clippy::map_clone)]
+    let mut utils: Vec<&str> = utils.keys().map(|&s| s).collect();
+    utils.sort_unstable();
+    let display_list = utils.join(", ");
+    let width = cmp::min(textwrap::termwidth(), 100) - 4 * 2; // (opinion/heuristic) max 100 chars wide with 4 character side indentions
+    println!(
         "{}",
-        textwrap::indent(&textwrap::fill(&display_list, width), "    ")
+        textwrap::indent(&textwrap::fill(&display_list, width), "    ")
     );
 }
 
-fn binary_path(args: &mut impl Iterator<Item = OsString>) -> PathBuf {
-    match args.next() {
-        Some(ref s) if !s.is_empty() => PathBuf::from(s),
-        _ => std::env::current_exe().unwrap(),
+fn binary_path(args: &mut impl Iterator<Item = OsString>) -> PathBuf {
+    match args.next() {
+        Some(ref s) if !s.is_empty() => PathBuf::from(s),
+        _ => std::env::current_exe().unwrap(),
     }
 }
 
-fn name(binary_path: &Path) -> &str {
-    binary_path.file_stem().unwrap().to_str().unwrap()
+fn name(binary_path: &Path) -> &str {
+    binary_path.file_stem().unwrap().to_str().unwrap()
 }
 
-fn main() {
-    uucore::panic::mute_sigpipe_panic();
+fn main() {
+    uucore::panic::mute_sigpipe_panic();
 
-    let utils = util_map();
-    let mut args = uucore::args_os();
+    let utils = util_map();
+    let mut args = uucore::args_os();
 
-    let binary = binary_path(&mut args);
-    let binary_as_util = name(&binary);
+    let binary = binary_path(&mut args);
+    let binary_as_util = name(&binary);
 
-    // binary name equals util name?
-    if let Some(&(uumain, _)) = utils.get(binary_as_util) {
-        process::exit(uumain((vec![binary.into()].into_iter()).chain(args)));
+    // binary name equals util name?
+    if let Some(&(uumain, _)) = utils.get(binary_as_util) {
+        process::exit(uumain((vec![binary.into()].into_iter()).chain(args)));
     }
 
-    // binary name equals prefixed util name?
-    // * prefix/stem may be any string ending in a non-alphanumeric character
-    let util_name = if let Some(util) = utils.keys().find(|util| {
-        binary_as_util.ends_with(*util)
-            && !binary_as_util[..binary_as_util.len() - (*util).len()]
-                .ends_with(char::is_alphanumeric)
+    // binary name equals prefixed util name?
+    // * prefix/stem may be any string ending in a non-alphanumeric character
+    let util_name = if let Some(util) = utils.keys().find(|util| {
+        binary_as_util.ends_with(*util)
+            && !binary_as_util[..binary_as_util.len() - (*util).len()]
+                .ends_with(char::is_alphanumeric)
     }) {
-        // prefixed util => replace 0th (aka, executable name) argument
-        Some(OsString::from(*util))
-    } else {
-        // unmatched binary name => regard as multi-binary container and advance argument list
-        uucore::set_utility_is_second_arg();
-        args.next()
+        // prefixed util => replace 0th (aka, executable name) argument
+        Some(OsString::from(*util))
+    } else {
+        // unmatched binary name => regard as multi-binary container and advance argument list
+        uucore::set_utility_is_second_arg();
+        args.next()
     };
 
-    // 0th argument equals util name?
-    if let Some(util_os) = util_name {
-        fn not_found(util: &OsStr) -> ! {
-            println!("{}: function/utility not found", util.maybe_quote());
-            process::exit(1);
+    // 0th argument equals util name?
+    if let Some(util_os) = util_name {
+        fn not_found(util: &OsStr) -> ! {
+            println!("{}: function/utility not found", util.maybe_quote());
+            process::exit(1);
         }
 
-        let util = match util_os.to_str() {
-            Some(util) => util,
-            None => not_found(&util_os),
+        let util = match util_os.to_str() {
+            Some(util) => util,
+            None => not_found(&util_os),
         };
 
-        if util == "completion" {
-            gen_completions(args, &utils);
+        if util == "completion" {
+            gen_completions(args, &utils);
         }
 
-        match utils.get(util) {
-            Some(&(uumain, _)) => {
-                process::exit(uumain((vec![util_os].into_iter()).chain(args)));
+        match utils.get(util) {
+            Some(&(uumain, _)) => {
+                process::exit(uumain((vec![util_os].into_iter()).chain(args)));
             }
-            None => {
-                if util == "--help" || util == "-h" {
-                    // see if they want help on a specific util
-                    if let Some(util_os) = args.next() {
-                        let util = match util_os.to_str() {
-                            Some(util) => util,
-                            None => not_found(&util_os),
+            None => {
+                if util == "--help" || util == "-h" {
+                    // see if they want help on a specific util
+                    if let Some(util_os) = args.next() {
+                        let util = match util_os.to_str() {
+                            Some(util) => util,
+                            None => not_found(&util_os),
                         };
 
-                        match utils.get(util) {
-                            Some(&(uumain, _)) => {
-                                let code = uumain(
-                                    (vec![util_os, OsString::from("--help")].into_iter())
-                                        .chain(args),
+                        match utils.get(util) {
+                            Some(&(uumain, _)) => {
+                                let code = uumain(
+                                    (vec![util_os, OsString::from("--help")].into_iter())
+                                        .chain(args),
                                 );
-                                io::stdout().flush().expect("could not flush stdout");
-                                process::exit(code);
+                                io::stdout().flush().expect("could not flush stdout");
+                                process::exit(code);
                             }
-                            None => not_found(&util_os),
+                            None => not_found(&util_os),
                         }
                     }
-                    usage(&utils, binary_as_util);
-                    process::exit(0);
-                } else {
-                    not_found(&util_os);
+                    usage(&utils, binary_as_util);
+                    process::exit(0);
+                } else {
+                    not_found(&util_os);
                 }
             }
         }
-    } else {
-        // no arguments provided
-        usage(&utils, binary_as_util);
-        process::exit(0);
+    } else {
+        // no arguments provided
+        usage(&utils, binary_as_util);
+        process::exit(0);
     }
 }
 
-/// Prints completions for the utility in the first parameter for the shell in the second parameter to stdout
-fn gen_completions<T: uucore::Args>(
-    args: impl Iterator<Item = OsString>,
-    util_map: &UtilityMap<T>,
-) -> ! {
-    let all_utilities: Vec<_> = std::iter::once("coreutils")
-        .chain(util_map.keys().copied())
-        .collect();
+/// Prints completions for the utility in the first parameter for the shell in the second parameter to stdout
+fn gen_completions<T: uucore::Args>(
+    args: impl Iterator<Item = OsString>,
+    util_map: &UtilityMap<T>,
+) -> ! {
+    let all_utilities: Vec<_> = std::iter::once("coreutils")
+        .chain(util_map.keys().copied())
+        .collect();
 
-    let matches = Command::new("completion")
-        .about("Prints completions to stdout")
-        .arg(
-            Arg::new("utility")
-                .value_parser(clap::builder::PossibleValuesParser::new(all_utilities))
-                .required(true),
+    let matches = Command::new("completion")
+        .about("Prints completions to stdout")
+        .arg(
+            Arg::new("utility")
+                .value_parser(clap::builder::PossibleValuesParser::new(all_utilities))
+                .required(true),
         )
-        .arg(
-            Arg::new("shell")
-                .value_parser(clap::builder::EnumValueParser::<Shell>::new())
-                .required(true),
+        .arg(
+            Arg::new("shell")
+                .value_parser(clap::builder::EnumValueParser::<Shell>::new())
+                .required(true),
         )
-        .get_matches_from(std::iter::once(OsString::from("completion")).chain(args));
+        .get_matches_from(std::iter::once(OsString::from("completion")).chain(args));
 
-    let utility = matches.get_one::<String>("utility").unwrap();
-    let shell = matches.get_one::<Shell>("shell").unwrap().to_owned();
+    let utility = matches.get_one::<String>("utility").unwrap();
+    let shell = matches.get_one::<Shell>("shell").unwrap().to_owned();
 
-    let mut command = if utility == "coreutils" {
-        gen_coreutils_app(util_map)
-    } else {
-        util_map.get(utility).unwrap().1()
+    let mut command = if utility == "coreutils" {
+        gen_coreutils_app(util_map)
+    } else {
+        util_map.get(utility).unwrap().1()
     };
-    let bin_name = std::env::var("PROG_PREFIX").unwrap_or_default() + utility;
+    let bin_name = std::env::var("PROG_PREFIX").unwrap_or_default() + utility;
 
-    clap_complete::generate(shell, &mut command, bin_name, &mut io::stdout());
-    io::stdout().flush().unwrap();
-    process::exit(0);
+    clap_complete::generate(shell, &mut command, bin_name, &mut io::stdout());
+    io::stdout().flush().unwrap();
+    process::exit(0);
 }
 
-fn gen_coreutils_app<T: uucore::Args>(util_map: &UtilityMap<T>) -> Command {
-    let mut command = Command::new("coreutils");
-    for (_, (_, sub_app)) in util_map {
-        command = command.subcommand(sub_app());
+fn gen_coreutils_app<T: uucore::Args>(util_map: &UtilityMap<T>) -> Command {
+    let mut command = Command::new("coreutils");
+    for (_, (_, sub_app)) in util_map {
+        command = command.subcommand(sub_app());
     }
-    command
+    command
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/coreutils/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-08c28f92bbf77c3a/out/uutils_map.rs.html b/dev/src/coreutils/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-08c28f92bbf77c3a/out/uutils_map.rs.html deleted file mode 100644 index edb06dab2..000000000 --- a/dev/src/coreutils/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-08c28f92bbf77c3a/out/uutils_map.rs.html +++ /dev/null @@ -1,310 +0,0 @@ -uutils_map.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-
type UtilityMap<T> = phf::Map<&'static str, (fn(T) -> i32, fn() -> Command)>;
-
-fn util_map<T: uucore::Args>() -> UtilityMap<T> {
-::phf::Map {
-    key: 12913932095322966823,
-    disps: &[
-        (0, 115),
-        (0, 9),
-        (1, 0),
-        (0, 16),
-        (0, 23),
-        (11, 18),
-        (0, 3),
-        (7, 37),
-        (0, 114),
-        (0, 81),
-        (1, 35),
-        (0, 46),
-        (0, 61),
-        (1, 54),
-        (0, 2),
-        (3, 41),
-        (0, 2),
-        (1, 97),
-        (4, 50),
-        (2, 7),
-        (4, 12),
-        (2, 55),
-        (0, 100),
-        (27, 53),
-    ],
-    entries: &[
-        ("printenv", (printenv::uumain, printenv::uu_app)),
-        ("expand", (expand::uumain, expand::uu_app)),
-        ("yes", (yes::uumain, yes::uu_app)),
-        ("rmdir", (rmdir::uumain, rmdir::uu_app)),
-        ("mknod", (mknod::uumain, mknod::uu_app)),
-        ("truncate", (truncate::uumain, truncate::uu_app)),
-        ("pinky", (pinky::uumain, pinky::uu_app)),
-        ("pr", (pr::uumain, pr::uu_app)),
-        ("uptime", (uptime::uumain, uptime::uu_app)),
-        ("nohup", (nohup::uumain, nohup::uu_app)),
-        ("base32", (base32::uumain, base32::uu_app)),
-        ("stdbuf", (stdbuf::uumain, stdbuf::uu_app)),
-        ("chgrp", (chgrp::uumain, chgrp::uu_app)),
-        ("stat", (stat::uumain, stat::uu_app)),
-        ("hostid", (hostid::uumain, hostid::uu_app)),
-        ("nice", (nice::uumain, nice::uu_app)),
-        ("mv", (mv::uumain, mv::uu_app)),
-        ("cat", (cat::uumain, cat::uu_app)),
-        ("fmt", (fmt::uumain, fmt::uu_app)),
-        ("sha1sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("cp", (cp::uumain, cp::uu_app)),
-        ("unlink", (unlink::uumain, unlink::uu_app)),
-        ("more", (more::uumain, more::uu_app)),
-        ("rm", (rm::uumain, rm::uu_app)),
-        ("sha256sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("dd", (dd::uumain, dd::uu_app)),
-        ("tr", (tr::uumain, tr::uu_app)),
-        ("false", (r#false::uumain, r#false::uu_app)),
-        ("od", (od::uumain, od::uu_app)),
-        ("factor", (factor::uumain, factor::uu_app)),
-        ("link", (link::uumain, link::uu_app)),
-        ("fold", (fold::uumain, fold::uu_app)),
-        ("touch", (touch::uumain, touch::uu_app)),
-        ("hashsum", (hashsum::uumain, hashsum::uu_app_custom)),
-        ("logname", (logname::uumain, logname::uu_app)),
-        ("ls", (ls::uumain, ls::uu_app)),
-        ("who", (who::uumain, who::uu_app)),
-        ("dir", (dir::uumain, dir::uu_app)),
-        ("cksum", (cksum::uumain, cksum::uu_app)),
-        ("base64", (base64::uumain, base64::uu_app)),
-        ("uname", (uname::uumain, uname::uu_app)),
-        ("vdir", (vdir::uumain, vdir::uu_app)),
-        ("split", (split::uumain, split::uu_app)),
-        ("sha3sum", (hashsum::uumain, hashsum::uu_app_bits)),
-        ("seq", (seq::uumain, seq::uu_app)),
-        ("realpath", (realpath::uumain, realpath::uu_app)),
-        ("kill", (kill::uumain, kill::uu_app)),
-        ("chroot", (chroot::uumain, chroot::uu_app)),
-        ("unexpand", (unexpand::uumain, unexpand::uu_app)),
-        ("sha512sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("chown", (chown::uumain, chown::uu_app)),
-        ("env", (env::uumain, env::uu_app)),
-        ("relpath", (relpath::uumain, relpath::uu_app)),
-        ("groups", (groups::uumain, groups::uu_app)),
-        ("sha224sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("shake256sum", (hashsum::uumain, hashsum::uu_app_bits)),
-        ("users", (users::uumain, users::uu_app)),
-        ("ln", (ln::uumain, ln::uu_app)),
-        ("whoami", (whoami::uumain, whoami::uu_app)),
-        ("timeout", (timeout::uumain, timeout::uu_app)),
-        ("runcon", (runcon::uumain, runcon::uu_app)),
-        ("du", (du::uumain, du::uu_app)),
-        ("id", (id::uumain, id::uu_app)),
-        ("wc", (wc::uumain, wc::uu_app)),
-        ("stty", (stty::uumain, stty::uu_app)),
-        ("basenc", (basenc::uumain, basenc::uu_app)),
-        ("sum", (sum::uumain, sum::uu_app)),
-        ("md5sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("sha3-512sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("head", (head::uumain, head::uu_app)),
-        ("cut", (cut::uumain, cut::uu_app)),
-        ("comm", (comm::uumain, comm::uu_app)),
-        ("readlink", (readlink::uumain, readlink::uu_app)),
-        ("arch", (arch::uumain, arch::uu_app)),
-        ("ptx", (ptx::uumain, ptx::uu_app)),
-        ("tee", (tee::uumain, tee::uu_app)),
-        ("hostname", (hostname::uumain, hostname::uu_app)),
-        ("true", (r#true::uumain, r#true::uu_app)),
-        ("pwd", (pwd::uumain, pwd::uu_app)),
-        ("nproc", (nproc::uumain, nproc::uu_app)),
-        ("tail", (tail::uumain, tail::uu_app)),
-        ("[", (uu_test::uumain, uu_test::uu_app)),
-        ("chcon", (chcon::uumain, chcon::uu_app)),
-        ("dirname", (dirname::uumain, dirname::uu_app)),
-        ("dircolors", (dircolors::uumain, dircolors::uu_app)),
-        ("printf", (printf::uumain, printf::uu_app)),
-        ("shred", (shred::uumain, shred::uu_app)),
-        ("sha3-256sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("shuf", (shuf::uumain, shuf::uu_app)),
-        ("tty", (tty::uumain, tty::uu_app)),
-        ("expr", (expr::uumain, expr::uu_app)),
-        ("pathchk", (pathchk::uumain, pathchk::uu_app)),
-        ("basename", (basename::uumain, basename::uu_app)),
-        ("numfmt", (numfmt::uumain, numfmt::uu_app)),
-        ("df", (df::uumain, df::uu_app)),
-        ("join", (join::uumain, join::uu_app)),
-        ("nl", (nl::uumain, nl::uu_app)),
-        ("sha3-224sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("mkfifo", (mkfifo::uumain, mkfifo::uu_app)),
-        ("shake128sum", (hashsum::uumain, hashsum::uu_app_bits)),
-        ("b2sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("install", (install::uumain, install::uu_app)),
-        ("chmod", (chmod::uumain, chmod::uu_app)),
-        ("sleep", (sleep::uumain, sleep::uu_app)),
-        ("date", (date::uumain, date::uu_app)),
-        ("csplit", (csplit::uumain, csplit::uu_app)),
-        ("mkdir", (mkdir::uumain, mkdir::uu_app)),
-        ("sync", (sync::uumain, sync::uu_app)),
-        ("b3sum", (hashsum::uumain, hashsum::uu_app_b3sum)),
-        ("mktemp", (mktemp::uumain, mktemp::uu_app)),
-        ("tsort", (tsort::uumain, tsort::uu_app)),
-        ("tac", (tac::uumain, tac::uu_app)),
-        ("test", (uu_test::uumain, uu_test::uu_app)),
-        ("paste", (paste::uumain, paste::uu_app)),
-        ("sort", (sort::uumain, sort::uu_app)),
-        ("echo", (echo::uumain, echo::uu_app)),
-        ("sha384sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("uniq", (uniq::uumain, uniq::uu_app)),
-        ("sha3-384sum", (hashsum::uumain, hashsum::uu_app_common)),
-    ],
-}
-}
-
-
\ No newline at end of file diff --git a/dev/src/coreutils/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-602414eb6d83e2f7/out/uutils_map.rs.html b/dev/src/coreutils/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-602414eb6d83e2f7/out/uutils_map.rs.html new file mode 100644 index 000000000..8950c2d6a --- /dev/null +++ b/dev/src/coreutils/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-602414eb6d83e2f7/out/uutils_map.rs.html @@ -0,0 +1,310 @@ +uutils_map.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+
type UtilityMap<T> = phf::Map<&'static str, (fn(T) -> i32, fn() -> Command)>;
+
+fn util_map<T: uucore::Args>() -> UtilityMap<T> {
+::phf::Map {
+    key: 12913932095322966823,
+    disps: &[
+        (0, 115),
+        (0, 9),
+        (1, 0),
+        (0, 16),
+        (0, 23),
+        (11, 18),
+        (0, 3),
+        (7, 37),
+        (0, 114),
+        (0, 81),
+        (1, 35),
+        (0, 46),
+        (0, 61),
+        (1, 54),
+        (0, 2),
+        (3, 41),
+        (0, 2),
+        (1, 97),
+        (4, 50),
+        (2, 7),
+        (4, 12),
+        (2, 55),
+        (0, 100),
+        (27, 53),
+    ],
+    entries: &[
+        ("printenv", (printenv::uumain, printenv::uu_app)),
+        ("expand", (expand::uumain, expand::uu_app)),
+        ("yes", (yes::uumain, yes::uu_app)),
+        ("rmdir", (rmdir::uumain, rmdir::uu_app)),
+        ("mknod", (mknod::uumain, mknod::uu_app)),
+        ("truncate", (truncate::uumain, truncate::uu_app)),
+        ("pinky", (pinky::uumain, pinky::uu_app)),
+        ("pr", (pr::uumain, pr::uu_app)),
+        ("uptime", (uptime::uumain, uptime::uu_app)),
+        ("nohup", (nohup::uumain, nohup::uu_app)),
+        ("base32", (base32::uumain, base32::uu_app)),
+        ("stdbuf", (stdbuf::uumain, stdbuf::uu_app)),
+        ("chgrp", (chgrp::uumain, chgrp::uu_app)),
+        ("stat", (stat::uumain, stat::uu_app)),
+        ("hostid", (hostid::uumain, hostid::uu_app)),
+        ("nice", (nice::uumain, nice::uu_app)),
+        ("mv", (mv::uumain, mv::uu_app)),
+        ("cat", (cat::uumain, cat::uu_app)),
+        ("fmt", (fmt::uumain, fmt::uu_app)),
+        ("sha1sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("cp", (cp::uumain, cp::uu_app)),
+        ("unlink", (unlink::uumain, unlink::uu_app)),
+        ("more", (more::uumain, more::uu_app)),
+        ("rm", (rm::uumain, rm::uu_app)),
+        ("sha256sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("dd", (dd::uumain, dd::uu_app)),
+        ("tr", (tr::uumain, tr::uu_app)),
+        ("false", (r#false::uumain, r#false::uu_app)),
+        ("od", (od::uumain, od::uu_app)),
+        ("factor", (factor::uumain, factor::uu_app)),
+        ("link", (link::uumain, link::uu_app)),
+        ("fold", (fold::uumain, fold::uu_app)),
+        ("touch", (touch::uumain, touch::uu_app)),
+        ("hashsum", (hashsum::uumain, hashsum::uu_app_custom)),
+        ("logname", (logname::uumain, logname::uu_app)),
+        ("ls", (ls::uumain, ls::uu_app)),
+        ("who", (who::uumain, who::uu_app)),
+        ("dir", (dir::uumain, dir::uu_app)),
+        ("cksum", (cksum::uumain, cksum::uu_app)),
+        ("base64", (base64::uumain, base64::uu_app)),
+        ("uname", (uname::uumain, uname::uu_app)),
+        ("vdir", (vdir::uumain, vdir::uu_app)),
+        ("split", (split::uumain, split::uu_app)),
+        ("sha3sum", (hashsum::uumain, hashsum::uu_app_bits)),
+        ("seq", (seq::uumain, seq::uu_app)),
+        ("realpath", (realpath::uumain, realpath::uu_app)),
+        ("kill", (kill::uumain, kill::uu_app)),
+        ("chroot", (chroot::uumain, chroot::uu_app)),
+        ("unexpand", (unexpand::uumain, unexpand::uu_app)),
+        ("sha512sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("chown", (chown::uumain, chown::uu_app)),
+        ("env", (env::uumain, env::uu_app)),
+        ("relpath", (relpath::uumain, relpath::uu_app)),
+        ("groups", (groups::uumain, groups::uu_app)),
+        ("sha224sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("shake256sum", (hashsum::uumain, hashsum::uu_app_bits)),
+        ("users", (users::uumain, users::uu_app)),
+        ("ln", (ln::uumain, ln::uu_app)),
+        ("whoami", (whoami::uumain, whoami::uu_app)),
+        ("timeout", (timeout::uumain, timeout::uu_app)),
+        ("runcon", (runcon::uumain, runcon::uu_app)),
+        ("du", (du::uumain, du::uu_app)),
+        ("id", (id::uumain, id::uu_app)),
+        ("wc", (wc::uumain, wc::uu_app)),
+        ("stty", (stty::uumain, stty::uu_app)),
+        ("basenc", (basenc::uumain, basenc::uu_app)),
+        ("sum", (sum::uumain, sum::uu_app)),
+        ("md5sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("sha3-512sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("head", (head::uumain, head::uu_app)),
+        ("cut", (cut::uumain, cut::uu_app)),
+        ("comm", (comm::uumain, comm::uu_app)),
+        ("readlink", (readlink::uumain, readlink::uu_app)),
+        ("arch", (arch::uumain, arch::uu_app)),
+        ("ptx", (ptx::uumain, ptx::uu_app)),
+        ("tee", (tee::uumain, tee::uu_app)),
+        ("hostname", (hostname::uumain, hostname::uu_app)),
+        ("true", (r#true::uumain, r#true::uu_app)),
+        ("pwd", (pwd::uumain, pwd::uu_app)),
+        ("nproc", (nproc::uumain, nproc::uu_app)),
+        ("tail", (tail::uumain, tail::uu_app)),
+        ("[", (uu_test::uumain, uu_test::uu_app)),
+        ("chcon", (chcon::uumain, chcon::uu_app)),
+        ("dirname", (dirname::uumain, dirname::uu_app)),
+        ("dircolors", (dircolors::uumain, dircolors::uu_app)),
+        ("printf", (printf::uumain, printf::uu_app)),
+        ("shred", (shred::uumain, shred::uu_app)),
+        ("sha3-256sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("shuf", (shuf::uumain, shuf::uu_app)),
+        ("tty", (tty::uumain, tty::uu_app)),
+        ("expr", (expr::uumain, expr::uu_app)),
+        ("pathchk", (pathchk::uumain, pathchk::uu_app)),
+        ("basename", (basename::uumain, basename::uu_app)),
+        ("numfmt", (numfmt::uumain, numfmt::uu_app)),
+        ("df", (df::uumain, df::uu_app)),
+        ("join", (join::uumain, join::uu_app)),
+        ("nl", (nl::uumain, nl::uu_app)),
+        ("sha3-224sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("mkfifo", (mkfifo::uumain, mkfifo::uu_app)),
+        ("shake128sum", (hashsum::uumain, hashsum::uu_app_bits)),
+        ("b2sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("install", (install::uumain, install::uu_app)),
+        ("chmod", (chmod::uumain, chmod::uu_app)),
+        ("sleep", (sleep::uumain, sleep::uu_app)),
+        ("date", (date::uumain, date::uu_app)),
+        ("csplit", (csplit::uumain, csplit::uu_app)),
+        ("mkdir", (mkdir::uumain, mkdir::uu_app)),
+        ("sync", (sync::uumain, sync::uu_app)),
+        ("b3sum", (hashsum::uumain, hashsum::uu_app_b3sum)),
+        ("mktemp", (mktemp::uumain, mktemp::uu_app)),
+        ("tsort", (tsort::uumain, tsort::uu_app)),
+        ("tac", (tac::uumain, tac::uu_app)),
+        ("test", (uu_test::uumain, uu_test::uu_app)),
+        ("paste", (paste::uumain, paste::uu_app)),
+        ("sort", (sort::uumain, sort::uu_app)),
+        ("echo", (echo::uumain, echo::uu_app)),
+        ("sha384sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("uniq", (uniq::uumain, uniq::uu_app)),
+        ("sha3-384sum", (hashsum::uumain, hashsum::uu_app_common)),
+    ],
+}
+}
+
+
\ No newline at end of file diff --git a/dev/src/cp/main.rs.html b/dev/src/cp/main.rs.html index 52231ac6c..a86af6eb2 100644 --- a/dev/src/cp/main.rs.html +++ b/dev/src/cp/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_cp);
+main.rs - source
1
+
uucore::bin!(uu_cp);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/csplit/main.rs.html b/dev/src/csplit/main.rs.html index 4ae1e921c..deb0ee993 100644 --- a/dev/src/csplit/main.rs.html +++ b/dev/src/csplit/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_csplit);
+main.rs - source
1
+
uucore::bin!(uu_csplit);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/cut/main.rs.html b/dev/src/cut/main.rs.html index 3cebff193..2eaa73b21 100644 --- a/dev/src/cut/main.rs.html +++ b/dev/src/cut/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_cut);
+main.rs - source
1
+
uucore::bin!(uu_cut);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/date/main.rs.html b/dev/src/date/main.rs.html index 523287930..64b7dd4d9 100644 --- a/dev/src/date/main.rs.html +++ b/dev/src/date/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_date);
+main.rs - source
1
+
uucore::bin!(uu_date);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/dd/main.rs.html b/dev/src/dd/main.rs.html index 793d7ccce..6ca69ece6 100644 --- a/dev/src/dd/main.rs.html +++ b/dev/src/dd/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_dd); // spell-checker:ignore procs uucore
-
-
\ No newline at end of file +main.rs - source
1
+
uucore::bin!(uu_dd); // spell-checker:ignore procs uucore
+
+
\ No newline at end of file diff --git a/dev/src/df/main.rs.html b/dev/src/df/main.rs.html index e8fce40cf..5d93a1389 100644 --- a/dev/src/df/main.rs.html +++ b/dev/src/df/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_df);
+main.rs - source
1
+
uucore::bin!(uu_df);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/dir/main.rs.html b/dev/src/dir/main.rs.html index b6dd5daab..7aecec514 100644 --- a/dev/src/dir/main.rs.html +++ b/dev/src/dir/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_dir);
+main.rs - source
1
+
uucore::bin!(uu_dir);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/dircolors/main.rs.html b/dev/src/dircolors/main.rs.html index 37be27404..9dbb6cb8b 100644 --- a/dev/src/dircolors/main.rs.html +++ b/dev/src/dircolors/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_dircolors);
+main.rs - source
1
+
uucore::bin!(uu_dircolors);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/dirname/main.rs.html b/dev/src/dirname/main.rs.html index 85055eee9..64b277b0c 100644 --- a/dev/src/dirname/main.rs.html +++ b/dev/src/dirname/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_dirname);
+main.rs - source
1
+
uucore::bin!(uu_dirname);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/du/main.rs.html b/dev/src/du/main.rs.html index 74c96fd19..8c6507b30 100644 --- a/dev/src/du/main.rs.html +++ b/dev/src/du/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_du);
+main.rs - source
1
+
uucore::bin!(uu_du);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/echo/main.rs.html b/dev/src/echo/main.rs.html index 768d093ce..a91a3de11 100644 --- a/dev/src/echo/main.rs.html +++ b/dev/src/echo/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_echo);
+main.rs - source
1
+
uucore::bin!(uu_echo);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/env/main.rs.html b/dev/src/env/main.rs.html index 8510fb190..9f3dc522a 100644 --- a/dev/src/env/main.rs.html +++ b/dev/src/env/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_env);
+main.rs - source
1
+
uucore::bin!(uu_env);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/expand/main.rs.html b/dev/src/expand/main.rs.html index d4c1e0672..768ce54d7 100644 --- a/dev/src/expand/main.rs.html +++ b/dev/src/expand/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_expand);
+main.rs - source
1
+
uucore::bin!(uu_expand);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/expr/main.rs.html b/dev/src/expr/main.rs.html index 68ec1426d..b617c440f 100644 --- a/dev/src/expr/main.rs.html +++ b/dev/src/expr/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_expr);
+main.rs - source
1
+
uucore::bin!(uu_expr);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/factor/main.rs.html b/dev/src/factor/main.rs.html index efa0f2290..338937e76 100644 --- a/dev/src/factor/main.rs.html +++ b/dev/src/factor/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_factor);
+main.rs - source
1
+
uucore::bin!(uu_factor);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/false/main.rs.html b/dev/src/false/main.rs.html index ae3df9dba..2416cdc02 100644 --- a/dev/src/false/main.rs.html +++ b/dev/src/false/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_false);
+main.rs - source
1
+
uucore::bin!(uu_false);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/fmt/main.rs.html b/dev/src/fmt/main.rs.html index b2c851b18..73699c0e9 100644 --- a/dev/src/fmt/main.rs.html +++ b/dev/src/fmt/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_fmt);
+main.rs - source
1
+
uucore::bin!(uu_fmt);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/fold/main.rs.html b/dev/src/fold/main.rs.html index bf143e0e3..ef05e7d19 100644 --- a/dev/src/fold/main.rs.html +++ b/dev/src/fold/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_fold);
+main.rs - source
1
+
uucore::bin!(uu_fold);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/groups/main.rs.html b/dev/src/groups/main.rs.html index ef1c71f0c..5140720b0 100644 --- a/dev/src/groups/main.rs.html +++ b/dev/src/groups/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_groups);
+main.rs - source
1
+
uucore::bin!(uu_groups);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/hashsum/main.rs.html b/dev/src/hashsum/main.rs.html index bb1976818..048ec1fa9 100644 --- a/dev/src/hashsum/main.rs.html +++ b/dev/src/hashsum/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_hashsum);
+main.rs - source
1
+
uucore::bin!(uu_hashsum);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/head/main.rs.html b/dev/src/head/main.rs.html index b3ab104f5..b23df27ee 100644 --- a/dev/src/head/main.rs.html +++ b/dev/src/head/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_head);
+main.rs - source
1
+
uucore::bin!(uu_head);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/hostid/main.rs.html b/dev/src/hostid/main.rs.html index 27384d3d6..a516503f7 100644 --- a/dev/src/hostid/main.rs.html +++ b/dev/src/hostid/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_hostid);
+main.rs - source
1
+
uucore::bin!(uu_hostid);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/hostname/main.rs.html b/dev/src/hostname/main.rs.html index edad79f89..27a7a7766 100644 --- a/dev/src/hostname/main.rs.html +++ b/dev/src/hostname/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_hostname);
+main.rs - source
1
+
uucore::bin!(uu_hostname);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/id/main.rs.html b/dev/src/id/main.rs.html index bcfa91048..11eed944b 100644 --- a/dev/src/id/main.rs.html +++ b/dev/src/id/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_id);
+main.rs - source
1
+
uucore::bin!(uu_id);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/install/main.rs.html b/dev/src/install/main.rs.html index 27bd22073..6dba2f032 100644 --- a/dev/src/install/main.rs.html +++ b/dev/src/install/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_install);
+main.rs - source
1
+
uucore::bin!(uu_install);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/join/main.rs.html b/dev/src/join/main.rs.html index 98029bcd5..53772b541 100644 --- a/dev/src/join/main.rs.html +++ b/dev/src/join/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_join);
+main.rs - source
1
+
uucore::bin!(uu_join);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/kill/main.rs.html b/dev/src/kill/main.rs.html index 61519e806..0d43a9e88 100644 --- a/dev/src/kill/main.rs.html +++ b/dev/src/kill/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_kill);
+main.rs - source
1
+
uucore::bin!(uu_kill);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/libstdbuf/libstdbuf.rs.html b/dev/src/libstdbuf/libstdbuf.rs.html index eb4944183..0163d7a6c 100644 --- a/dev/src/libstdbuf/libstdbuf.rs.html +++ b/dev/src/libstdbuf/libstdbuf.rs.html @@ -1,4 +1,4 @@ -libstdbuf.rs - source
1
+libstdbuf.rs - source
1
 2
 3
 4
@@ -70,77 +70,77 @@
 70
 71
 72
-
// spell-checker:ignore (ToDO) IOFBF IOLBF IONBF cstdio setvbuf
+
// spell-checker:ignore (ToDO) IOFBF IOLBF IONBF cstdio setvbuf
 
-#[macro_use]
-extern crate cpp;
+#[macro_use]
+extern crate cpp;
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use libc::{c_char, c_int, size_t, FILE, _IOFBF, _IOLBF, _IONBF};
-use std::env;
-use std::ptr;
+use libc::{c_char, c_int, size_t, FILE, _IOFBF, _IOLBF, _IONBF};
+use std::env;
+use std::ptr;
 
-cpp! {{
-    #include <cstdio>
+cpp! {{
+    #include <cstdio>
 
-    extern "C" {
-        void __stdbuf(void);
+    extern "C" {
+        void __stdbuf(void);
 
-        void __attribute((constructor))
-        __stdbuf_init(void) {
-            __stdbuf();
+        void __attribute((constructor))
+        __stdbuf_init(void) {
+            __stdbuf();
         }
 
-        FILE *__stdbuf_get_stdin() { return stdin; }
-        FILE *__stdbuf_get_stdout() { return stdout; }
-        FILE *__stdbuf_get_stderr() { return stderr; }
+        FILE *__stdbuf_get_stdin() { return stdin; }
+        FILE *__stdbuf_get_stdout() { return stdout; }
+        FILE *__stdbuf_get_stderr() { return stderr; }
     }
 }}
 
-extern "C" {
-    fn __stdbuf_get_stdin() -> *mut FILE;
-    fn __stdbuf_get_stdout() -> *mut FILE;
-    fn __stdbuf_get_stderr() -> *mut FILE;
+extern "C" {
+    fn __stdbuf_get_stdin() -> *mut FILE;
+    fn __stdbuf_get_stdout() -> *mut FILE;
+    fn __stdbuf_get_stderr() -> *mut FILE;
 }
 
-fn set_buffer(stream: *mut FILE, value: &str) {
-    let (mode, size): (c_int, size_t) = match value {
-        "0" => (_IONBF, 0_usize),
-        "L" => (_IOLBF, 0_usize),
-        input => {
-            let buff_size: usize = match input.parse() {
-                Ok(num) => num,
-                Err(e) => crash!(1, "incorrect size of buffer!: {}", e),
+fn set_buffer(stream: *mut FILE, value: &str) {
+    let (mode, size): (c_int, size_t) = match value {
+        "0" => (_IONBF, 0_usize),
+        "L" => (_IOLBF, 0_usize),
+        input => {
+            let buff_size: usize = match input.parse() {
+                Ok(num) => num,
+                Err(e) => crash!(1, "incorrect size of buffer!: {}", e),
             };
-            (_IOFBF, buff_size as size_t)
+            (_IOFBF, buff_size as size_t)
         }
     };
-    let res: c_int;
-    unsafe {
-        let buffer: *mut c_char = ptr::null_mut();
-        assert!(buffer.is_null());
-        res = libc::setvbuf(stream, buffer, mode, size);
+    let res: c_int;
+    unsafe {
+        let buffer: *mut c_char = ptr::null_mut();
+        assert!(buffer.is_null());
+        res = libc::setvbuf(stream, buffer, mode, size);
     }
-    if res != 0 {
-        crash!(res, "error while calling setvbuf!");
+    if res != 0 {
+        crash!(res, "error while calling setvbuf!");
     }
 }
 
-/// # Safety
-/// ToDO ... (safety note)
-#[no_mangle]
-pub unsafe extern "C" fn __stdbuf() {
-    if let Ok(val) = env::var("_STDBUF_E") {
-        set_buffer(__stdbuf_get_stderr(), &val);
+/// # Safety
+/// ToDO ... (safety note)
+#[no_mangle]
+pub unsafe extern "C" fn __stdbuf() {
+    if let Ok(val) = env::var("_STDBUF_E") {
+        set_buffer(__stdbuf_get_stderr(), &val);
     }
-    if let Ok(val) = env::var("_STDBUF_I") {
-        set_buffer(__stdbuf_get_stdin(), &val);
+    if let Ok(val) = env::var("_STDBUF_I") {
+        set_buffer(__stdbuf_get_stdin(), &val);
     }
-    if let Ok(val) = env::var("_STDBUF_O") {
-        set_buffer(__stdbuf_get_stdout(), &val);
+    if let Ok(val) = env::var("_STDBUF_O") {
+        set_buffer(__stdbuf_get_stdout(), &val);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/link/main.rs.html b/dev/src/link/main.rs.html index 5009b76bd..8010f1686 100644 --- a/dev/src/link/main.rs.html +++ b/dev/src/link/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_link);
+main.rs - source
1
+
uucore::bin!(uu_link);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/ln/main.rs.html b/dev/src/ln/main.rs.html index 3d1be44e7..dea0fc0fe 100644 --- a/dev/src/ln/main.rs.html +++ b/dev/src/ln/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_ln);
+main.rs - source
1
+
uucore::bin!(uu_ln);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/logname/main.rs.html b/dev/src/logname/main.rs.html index d2935b84f..6b434163b 100644 --- a/dev/src/logname/main.rs.html +++ b/dev/src/logname/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_logname);
+main.rs - source
1
+
uucore::bin!(uu_logname);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/ls/main.rs.html b/dev/src/ls/main.rs.html index 7c92ad302..5d6d8e2cb 100644 --- a/dev/src/ls/main.rs.html +++ b/dev/src/ls/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_ls);
+main.rs - source
1
+
uucore::bin!(uu_ls);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/mkdir/main.rs.html b/dev/src/mkdir/main.rs.html index 9463a048c..366e797dc 100644 --- a/dev/src/mkdir/main.rs.html +++ b/dev/src/mkdir/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_mkdir);
+main.rs - source
1
+
uucore::bin!(uu_mkdir);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/mkfifo/main.rs.html b/dev/src/mkfifo/main.rs.html index b0b44cb84..a3ba68a0d 100644 --- a/dev/src/mkfifo/main.rs.html +++ b/dev/src/mkfifo/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_mkfifo);
+main.rs - source
1
+
uucore::bin!(uu_mkfifo);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/mknod/main.rs.html b/dev/src/mknod/main.rs.html index 6e779e1e0..a5febe433 100644 --- a/dev/src/mknod/main.rs.html +++ b/dev/src/mknod/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_mknod);
+main.rs - source
1
+
uucore::bin!(uu_mknod);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/mktemp/main.rs.html b/dev/src/mktemp/main.rs.html index 8dc45dd5f..34d72388a 100644 --- a/dev/src/mktemp/main.rs.html +++ b/dev/src/mktemp/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_mktemp);
+main.rs - source
1
+
uucore::bin!(uu_mktemp);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/more/main.rs.html b/dev/src/more/main.rs.html index e82252858..d0b8ee757 100644 --- a/dev/src/more/main.rs.html +++ b/dev/src/more/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_more);
+main.rs - source
1
+
uucore::bin!(uu_more);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/mv/main.rs.html b/dev/src/mv/main.rs.html index 2cd194fb7..dda3c8e24 100644 --- a/dev/src/mv/main.rs.html +++ b/dev/src/mv/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_mv);
+main.rs - source
1
+
uucore::bin!(uu_mv);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/nice/main.rs.html b/dev/src/nice/main.rs.html index e9535ca03..77e133edf 100644 --- a/dev/src/nice/main.rs.html +++ b/dev/src/nice/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_nice);
+main.rs - source
1
+
uucore::bin!(uu_nice);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/nl/main.rs.html b/dev/src/nl/main.rs.html index a94c50b1f..c2be85212 100644 --- a/dev/src/nl/main.rs.html +++ b/dev/src/nl/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_nl);
+main.rs - source
1
+
uucore::bin!(uu_nl);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/nohup/main.rs.html b/dev/src/nohup/main.rs.html index 8cc94d29a..397cac6d8 100644 --- a/dev/src/nohup/main.rs.html +++ b/dev/src/nohup/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_nohup);
+main.rs - source
1
+
uucore::bin!(uu_nohup);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/nproc/main.rs.html b/dev/src/nproc/main.rs.html index 0ea1c8498..03c273eeb 100644 --- a/dev/src/nproc/main.rs.html +++ b/dev/src/nproc/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_nproc);
+main.rs - source
1
+
uucore::bin!(uu_nproc);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/numfmt/main.rs.html b/dev/src/numfmt/main.rs.html index d8ed44794..dfad1ffaf 100644 --- a/dev/src/numfmt/main.rs.html +++ b/dev/src/numfmt/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_numfmt);
+main.rs - source
1
+
uucore::bin!(uu_numfmt);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/od/main.rs.html b/dev/src/od/main.rs.html index c407184ad..d854cd7ca 100644 --- a/dev/src/od/main.rs.html +++ b/dev/src/od/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_od);
+main.rs - source
1
+
uucore::bin!(uu_od);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/paste/main.rs.html b/dev/src/paste/main.rs.html index 080a5ac5a..d0dc3a601 100644 --- a/dev/src/paste/main.rs.html +++ b/dev/src/paste/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_paste);
+main.rs - source
1
+
uucore::bin!(uu_paste);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/pathchk/main.rs.html b/dev/src/pathchk/main.rs.html index 9aa9291cf..0c625b260 100644 --- a/dev/src/pathchk/main.rs.html +++ b/dev/src/pathchk/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_pathchk);
+main.rs - source
1
+
uucore::bin!(uu_pathchk);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/pinky/main.rs.html b/dev/src/pinky/main.rs.html index 25f25e468..242788f9f 100644 --- a/dev/src/pinky/main.rs.html +++ b/dev/src/pinky/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_pinky);
+main.rs - source
1
+
uucore::bin!(uu_pinky);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/pr/main.rs.html b/dev/src/pr/main.rs.html index 54ac9c6ef..8b74c3579 100644 --- a/dev/src/pr/main.rs.html +++ b/dev/src/pr/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_pr); // spell-checker:ignore procs uucore
-
-
\ No newline at end of file +main.rs - source
1
+
uucore::bin!(uu_pr); // spell-checker:ignore procs uucore
+
+
\ No newline at end of file diff --git a/dev/src/printenv/main.rs.html b/dev/src/printenv/main.rs.html index d49175cd0..5dfa689d7 100644 --- a/dev/src/printenv/main.rs.html +++ b/dev/src/printenv/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_printenv);
+main.rs - source
1
+
uucore::bin!(uu_printenv);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/printf/main.rs.html b/dev/src/printf/main.rs.html index 3d6d7c01d..3596bf510 100644 --- a/dev/src/printf/main.rs.html +++ b/dev/src/printf/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_printf);
+main.rs - source
1
+
uucore::bin!(uu_printf);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/ptx/main.rs.html b/dev/src/ptx/main.rs.html index 98e5eb096..82d8359d2 100644 --- a/dev/src/ptx/main.rs.html +++ b/dev/src/ptx/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_ptx);
+main.rs - source
1
+
uucore::bin!(uu_ptx);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/pwd/main.rs.html b/dev/src/pwd/main.rs.html index cd9e8537f..560e1c2b4 100644 --- a/dev/src/pwd/main.rs.html +++ b/dev/src/pwd/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_pwd);
+main.rs - source
1
+
uucore::bin!(uu_pwd);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/readlink/main.rs.html b/dev/src/readlink/main.rs.html index 78feb78b2..38abca727 100644 --- a/dev/src/readlink/main.rs.html +++ b/dev/src/readlink/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_readlink);
+main.rs - source
1
+
uucore::bin!(uu_readlink);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/realpath/main.rs.html b/dev/src/realpath/main.rs.html index 097e23237..7b50dd574 100644 --- a/dev/src/realpath/main.rs.html +++ b/dev/src/realpath/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_realpath);
+main.rs - source
1
+
uucore::bin!(uu_realpath);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/relpath/main.rs.html b/dev/src/relpath/main.rs.html index 4effb8638..ebc36506a 100644 --- a/dev/src/relpath/main.rs.html +++ b/dev/src/relpath/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_relpath);
+main.rs - source
1
+
uucore::bin!(uu_relpath);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/rm/main.rs.html b/dev/src/rm/main.rs.html index 284fe77eb..a0488d8e6 100644 --- a/dev/src/rm/main.rs.html +++ b/dev/src/rm/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_rm);
+main.rs - source
1
+
uucore::bin!(uu_rm);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/rmdir/main.rs.html b/dev/src/rmdir/main.rs.html index 5ccb8a189..657f60c74 100644 --- a/dev/src/rmdir/main.rs.html +++ b/dev/src/rmdir/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_rmdir);
+main.rs - source
1
+
uucore::bin!(uu_rmdir);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/runcon/main.rs.html b/dev/src/runcon/main.rs.html index 04423f33e..2af26660c 100644 --- a/dev/src/runcon/main.rs.html +++ b/dev/src/runcon/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_runcon);
+main.rs - source
1
+
uucore::bin!(uu_runcon);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/seq/main.rs.html b/dev/src/seq/main.rs.html index d0c26c94f..f38d233b0 100644 --- a/dev/src/seq/main.rs.html +++ b/dev/src/seq/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_seq);
+main.rs - source
1
+
uucore::bin!(uu_seq);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/shred/main.rs.html b/dev/src/shred/main.rs.html index 0dea50538..0667b42de 100644 --- a/dev/src/shred/main.rs.html +++ b/dev/src/shred/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_shred);
+main.rs - source
1
+
uucore::bin!(uu_shred);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/shuf/main.rs.html b/dev/src/shuf/main.rs.html index 1c30aa94e..31b09b357 100644 --- a/dev/src/shuf/main.rs.html +++ b/dev/src/shuf/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_shuf);
+main.rs - source
1
+
uucore::bin!(uu_shuf);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/sleep/main.rs.html b/dev/src/sleep/main.rs.html index 39998570d..4912dcc56 100644 --- a/dev/src/sleep/main.rs.html +++ b/dev/src/sleep/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_sleep);
+main.rs - source
1
+
uucore::bin!(uu_sleep);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/sort/main.rs.html b/dev/src/sort/main.rs.html index caa13e038..deeeb2098 100644 --- a/dev/src/sort/main.rs.html +++ b/dev/src/sort/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_sort);
+main.rs - source
1
+
uucore::bin!(uu_sort);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/split/main.rs.html b/dev/src/split/main.rs.html index b2273d100..5728a7a78 100644 --- a/dev/src/split/main.rs.html +++ b/dev/src/split/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_split);
+main.rs - source
1
+
uucore::bin!(uu_split);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/stat/main.rs.html b/dev/src/stat/main.rs.html index 75c811d0e..e2e951fb5 100644 --- a/dev/src/stat/main.rs.html +++ b/dev/src/stat/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_stat);
+main.rs - source
1
+
uucore::bin!(uu_stat);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/stdbuf/main.rs.html b/dev/src/stdbuf/main.rs.html index 1de50c3a3..ba790e6cc 100644 --- a/dev/src/stdbuf/main.rs.html +++ b/dev/src/stdbuf/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_stdbuf);
+main.rs - source
1
+
uucore::bin!(uu_stdbuf);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/stty/main.rs.html b/dev/src/stty/main.rs.html index a0884470c..3d47ab5e1 100644 --- a/dev/src/stty/main.rs.html +++ b/dev/src/stty/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_stty);
+main.rs - source
1
+
uucore::bin!(uu_stty);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/sum/main.rs.html b/dev/src/sum/main.rs.html index 7ee6ca5c3..b9404c302 100644 --- a/dev/src/sum/main.rs.html +++ b/dev/src/sum/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_sum);
+main.rs - source
1
+
uucore::bin!(uu_sum);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/sync/main.rs.html b/dev/src/sync/main.rs.html index 25c6939ae..7d626a858 100644 --- a/dev/src/sync/main.rs.html +++ b/dev/src/sync/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_sync);
+main.rs - source
1
+
uucore::bin!(uu_sync);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/tac/main.rs.html b/dev/src/tac/main.rs.html index c0ecd7077..9c7f74145 100644 --- a/dev/src/tac/main.rs.html +++ b/dev/src/tac/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_tac);
+main.rs - source
1
+
uucore::bin!(uu_tac);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/tail/main.rs.html b/dev/src/tail/main.rs.html index 09987a945..0d27458d1 100644 --- a/dev/src/tail/main.rs.html +++ b/dev/src/tail/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_tail);
+main.rs - source
1
+
uucore::bin!(uu_tail);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/tee/main.rs.html b/dev/src/tee/main.rs.html index cc6604a5e..33ca6fc94 100644 --- a/dev/src/tee/main.rs.html +++ b/dev/src/tee/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_tee);
+main.rs - source
1
+
uucore::bin!(uu_tee);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/test/main.rs.html b/dev/src/test/main.rs.html index c54d8913f..d6b9b8449 100644 --- a/dev/src/test/main.rs.html +++ b/dev/src/test/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_test);
+main.rs - source
1
+
uucore::bin!(uu_test);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/timeout/main.rs.html b/dev/src/timeout/main.rs.html index 5bebb5cb9..559d2beb7 100644 --- a/dev/src/timeout/main.rs.html +++ b/dev/src/timeout/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_timeout);
+main.rs - source
1
+
uucore::bin!(uu_timeout);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/touch/main.rs.html b/dev/src/touch/main.rs.html index cef9dca44..fbf14c746 100644 --- a/dev/src/touch/main.rs.html +++ b/dev/src/touch/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_touch);
+main.rs - source
1
+
uucore::bin!(uu_touch);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/tr/main.rs.html b/dev/src/tr/main.rs.html index 996c66c18..b58b3ceaa 100644 --- a/dev/src/tr/main.rs.html +++ b/dev/src/tr/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_tr);
+main.rs - source
1
+
uucore::bin!(uu_tr);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/true/main.rs.html b/dev/src/true/main.rs.html index 11a0d8fce..26a3f4bee 100644 --- a/dev/src/true/main.rs.html +++ b/dev/src/true/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_true);
+main.rs - source
1
+
uucore::bin!(uu_true);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/truncate/main.rs.html b/dev/src/truncate/main.rs.html index 9da2669cf..ae2feb416 100644 --- a/dev/src/truncate/main.rs.html +++ b/dev/src/truncate/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_truncate);
+main.rs - source
1
+
uucore::bin!(uu_truncate);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/tsort/main.rs.html b/dev/src/tsort/main.rs.html index c8a6de799..b19544f56 100644 --- a/dev/src/tsort/main.rs.html +++ b/dev/src/tsort/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_tsort);
+main.rs - source
1
+
uucore::bin!(uu_tsort);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/tty/main.rs.html b/dev/src/tty/main.rs.html index d0cb16240..0babe2e16 100644 --- a/dev/src/tty/main.rs.html +++ b/dev/src/tty/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_tty);
+main.rs - source
1
+
uucore::bin!(uu_tty);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uname/main.rs.html b/dev/src/uname/main.rs.html index f0ae50526..5bdb3c647 100644 --- a/dev/src/uname/main.rs.html +++ b/dev/src/uname/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_uname);
+main.rs - source
1
+
uucore::bin!(uu_uname);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/unexpand/main.rs.html b/dev/src/unexpand/main.rs.html index c425893c2..635bbf0f1 100644 --- a/dev/src/unexpand/main.rs.html +++ b/dev/src/unexpand/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_unexpand);
+main.rs - source
1
+
uucore::bin!(uu_unexpand);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uniq/main.rs.html b/dev/src/uniq/main.rs.html index 508e941aa..0d324bacf 100644 --- a/dev/src/uniq/main.rs.html +++ b/dev/src/uniq/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_uniq);
+main.rs - source
1
+
uucore::bin!(uu_uniq);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/unlink/main.rs.html b/dev/src/unlink/main.rs.html index 48c2347ff..0a56790ee 100644 --- a/dev/src/unlink/main.rs.html +++ b/dev/src/unlink/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_unlink);
+main.rs - source
1
+
uucore::bin!(uu_unlink);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uptime/main.rs.html b/dev/src/uptime/main.rs.html index f8b238f62..1fa222050 100644 --- a/dev/src/uptime/main.rs.html +++ b/dev/src/uptime/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_uptime);
+main.rs - source
1
+
uucore::bin!(uu_uptime);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/users/main.rs.html b/dev/src/users/main.rs.html index 91f504d95..f1b8f2be3 100644 --- a/dev/src/users/main.rs.html +++ b/dev/src/users/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_users);
+main.rs - source
1
+
uucore::bin!(uu_users);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_arch/arch.rs.html b/dev/src/uu_arch/arch.rs.html index d74875f5f..54e381239 100644 --- a/dev/src/uu_arch/arch.rs.html +++ b/dev/src/uu_arch/arch.rs.html @@ -1,4 +1,4 @@ -arch.rs - source
1
+arch.rs - source
1
 2
 3
 4
@@ -30,37 +30,37 @@
 30
 31
 32
-
// This file is part of the uutils coreutils package.
-//
-// (c) Smigle00 <smigle00@gmail.com>
-// (c) Jian Zeng <anonymousknight96 AT gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Smigle00 <smigle00@gmail.com>
+// (c) Jian Zeng <anonymousknight96 AT gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-use platform_info::*;
+use platform_info::*;
 
-use clap::{crate_version, Command};
-use uucore::error::{FromIo, UResult};
+use clap::{crate_version, Command};
+use uucore::error::{FromIo, UResult};
 
-static ABOUT: &str = "Display machine architecture";
-static SUMMARY: &str = "Determine architecture name for current machine.";
+static ABOUT: &str = "Display machine architecture";
+static SUMMARY: &str = "Determine architecture name for current machine.";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    uu_app().try_get_matches_from(args)?;
 
-    let uts = PlatformInfo::new().map_err_context(|| "cannot get system name".to_string())?;
-    println!("{}", uts.machine().trim());
+    let uts = PlatformInfo::new().map_err_context(|| "cannot get system name".to_string())?;
+    println!("{}", uts.machine().trim());
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(SUMMARY)
-        .infer_long_args(true)
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(SUMMARY)
+        .infer_long_args(true)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_base32/base32.rs.html b/dev/src/uu_base32/base32.rs.html index e435dff3f..4780ed4f7 100644 --- a/dev/src/uu_base32/base32.rs.html +++ b/dev/src/uu_base32/base32.rs.html @@ -1,4 +1,4 @@ -base32.rs - source
1
+base32.rs - source
1
 2
 3
 4
@@ -38,45 +38,45 @@
 38
 39
 40
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-use std::io::{stdin, Read};
+use std::io::{stdin, Read};
 
-use clap::Command;
-use uucore::{encoding::Format, error::UResult, help_section, help_usage};
+use clap::Command;
+use uucore::{encoding::Format, error::UResult, help_section, help_usage};
 
-pub mod base_common;
+pub mod base_common;
 
-const ABOUT: &str = help_section!("about", "base32.md");
-const USAGE: &str = help_usage!("base32.md");
+const ABOUT: &str = help_section!("about", "base32.md");
+const USAGE: &str = help_usage!("base32.md");
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let format = Format::Base32;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let format = Format::Base32;
 
-    let config: base_common::Config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?;
+    let config: base_common::Config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?;
 
-    // Create a reference to stdin so we can return a locked stdin from
-    // parse_base_cmd_args
-    let stdin_raw = stdin();
-    let mut input: Box<dyn Read> = base_common::get_input(&config, &stdin_raw)?;
+    // Create a reference to stdin so we can return a locked stdin from
+    // parse_base_cmd_args
+    let stdin_raw = stdin();
+    let mut input: Box<dyn Read> = base_common::get_input(&config, &stdin_raw)?;
 
-    base_common::handle_input(
-        &mut input,
-        format,
-        config.wrap_cols,
-        config.ignore_garbage,
-        config.decode,
+    base_common::handle_input(
+        &mut input,
+        format,
+        config.wrap_cols,
+        config.ignore_garbage,
+        config.decode,
     )
 }
 
-pub fn uu_app() -> Command {
-    base_common::base_app(ABOUT, USAGE)
+pub fn uu_app() -> Command {
+    base_common::base_app(ABOUT, USAGE)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_base32/base_common.rs.html b/dev/src/uu_base32/base_common.rs.html index 53aa5dcd9..1025ad931 100644 --- a/dev/src/uu_base32/base_common.rs.html +++ b/dev/src/uu_base32/base_common.rs.html @@ -1,4 +1,4 @@ -base_common.rs - source
1
+base_common.rs - source
1
 2
 3
 4
@@ -186,193 +186,193 @@
 186
 187
 188
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jordy Dickinson <jordy.dickinson@gmail.com>
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-// (c) Alex Lyon <arcterus@mail.com>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jordy Dickinson <jordy.dickinson@gmail.com>
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+// (c) Alex Lyon <arcterus@mail.com>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-use std::io::{stdout, Read, Write};
+use std::io::{stdout, Read, Write};
 
-use uucore::display::Quotable;
-use uucore::encoding::{wrap_print, Data, Format};
-use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
+use uucore::display::Quotable;
+use uucore::encoding::{wrap_print, Data, Format};
+use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
 
-use std::fs::File;
-use std::io::{BufReader, Stdin};
-use std::path::Path;
+use std::fs::File;
+use std::io::{BufReader, Stdin};
+use std::path::Path;
 
-use clap::{crate_version, Arg, ArgAction, Command};
+use clap::{crate_version, Arg, ArgAction, Command};
 
-pub static BASE_CMD_PARSE_ERROR: i32 = 1;
+pub static BASE_CMD_PARSE_ERROR: i32 = 1;
 
-// Config.
-pub struct Config {
-    pub decode: bool,
-    pub ignore_garbage: bool,
-    pub wrap_cols: Option<usize>,
-    pub to_read: Option<String>,
+// Config.
+pub struct Config {
+    pub decode: bool,
+    pub ignore_garbage: bool,
+    pub wrap_cols: Option<usize>,
+    pub to_read: Option<String>,
 }
 
-pub mod options {
-    pub static DECODE: &str = "decode";
-    pub static WRAP: &str = "wrap";
-    pub static IGNORE_GARBAGE: &str = "ignore-garbage";
-    pub static FILE: &str = "file";
+pub mod options {
+    pub static DECODE: &str = "decode";
+    pub static WRAP: &str = "wrap";
+    pub static IGNORE_GARBAGE: &str = "ignore-garbage";
+    pub static FILE: &str = "file";
 }
 
-impl Config {
-    pub fn from(options: &clap::ArgMatches) -> UResult<Self> {
-        let file: Option<String> = match options.get_many::<String>(options::FILE) {
-            Some(mut values) => {
-                let name = values.next().unwrap();
-                if let Some(extra_op) = values.next() {
-                    return Err(UUsageError::new(
-                        BASE_CMD_PARSE_ERROR,
-                        format!("extra operand {}", extra_op.quote(),),
+impl Config {
+    pub fn from(options: &clap::ArgMatches) -> UResult<Self> {
+        let file: Option<String> = match options.get_many::<String>(options::FILE) {
+            Some(mut values) => {
+                let name = values.next().unwrap();
+                if let Some(extra_op) = values.next() {
+                    return Err(UUsageError::new(
+                        BASE_CMD_PARSE_ERROR,
+                        format!("extra operand {}", extra_op.quote(),),
                     ));
                 }
 
-                if name == "-" {
-                    None
-                } else {
-                    if !Path::exists(Path::new(name)) {
-                        return Err(USimpleError::new(
-                            BASE_CMD_PARSE_ERROR,
-                            format!("{}: No such file or directory", name.maybe_quote()),
+                if name == "-" {
+                    None
+                } else {
+                    if !Path::exists(Path::new(name)) {
+                        return Err(USimpleError::new(
+                            BASE_CMD_PARSE_ERROR,
+                            format!("{}: No such file or directory", name.maybe_quote()),
                         ));
                     }
-                    Some(name.to_owned())
+                    Some(name.to_owned())
                 }
             }
-            None => None,
+            None => None,
         };
 
-        let cols = options
-            .get_one::<String>(options::WRAP)
-            .map(|num| {
-                num.parse::<usize>().map_err(|_| {
-                    USimpleError::new(
-                        BASE_CMD_PARSE_ERROR,
-                        format!("invalid wrap size: {}", num.quote()),
+        let cols = options
+            .get_one::<String>(options::WRAP)
+            .map(|num| {
+                num.parse::<usize>().map_err(|_| {
+                    USimpleError::new(
+                        BASE_CMD_PARSE_ERROR,
+                        format!("invalid wrap size: {}", num.quote()),
                     )
                 })
             })
-            .transpose()?;
+            .transpose()?;
 
-        Ok(Self {
-            decode: options.get_flag(options::DECODE),
-            ignore_garbage: options.get_flag(options::IGNORE_GARBAGE),
-            wrap_cols: cols,
-            to_read: file,
+        Ok(Self {
+            decode: options.get_flag(options::DECODE),
+            ignore_garbage: options.get_flag(options::IGNORE_GARBAGE),
+            wrap_cols: cols,
+            to_read: file,
         })
     }
 }
 
-pub fn parse_base_cmd_args(
-    args: impl uucore::Args,
-    about: &'static str,
-    usage: &str,
-) -> UResult<Config> {
-    let command = base_app(about, usage);
-    let arg_list = args.collect_lossy();
-    Config::from(&command.try_get_matches_from(arg_list)?)
+pub fn parse_base_cmd_args(
+    args: impl uucore::Args,
+    about: &'static str,
+    usage: &str,
+) -> UResult<Config> {
+    let command = base_app(about, usage);
+    let arg_list = args.collect_lossy();
+    Config::from(&command.try_get_matches_from(arg_list)?)
 }
 
-pub fn base_app(about: &'static str, usage: &str) -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(about)
-        .override_usage(format_usage(usage))
-        .infer_long_args(true)
-        // Format arguments.
-        .arg(
-            Arg::new(options::DECODE)
-                .short('d')
-                .long(options::DECODE)
-                .help("decode data")
-                .action(ArgAction::SetTrue),
+pub fn base_app(about: &'static str, usage: &str) -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(about)
+        .override_usage(format_usage(usage))
+        .infer_long_args(true)
+        // Format arguments.
+        .arg(
+            Arg::new(options::DECODE)
+                .short('d')
+                .long(options::DECODE)
+                .help("decode data")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::IGNORE_GARBAGE)
-                .short('i')
-                .long(options::IGNORE_GARBAGE)
-                .help("when decoding, ignore non-alphabetic characters")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::IGNORE_GARBAGE)
+                .short('i')
+                .long(options::IGNORE_GARBAGE)
+                .help("when decoding, ignore non-alphabetic characters")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::WRAP)
-                .short('w')
-                .long(options::WRAP)
-                .value_name("COLS")
-                .help(
+        .arg(
+            Arg::new(options::WRAP)
+                .short('w')
+                .long(options::WRAP)
+                .value_name("COLS")
+                .help(
                     "wrap encoded lines after COLS character (default 76, 0 to disable wrapping)",
                 ),
         )
-        // "multiple" arguments are used to check whether there is more than one
-        // file passed in.
-        .arg(
-            Arg::new(options::FILE)
-                .index(1)
-                .action(clap::ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        // "multiple" arguments are used to check whether there is more than one
+        // file passed in.
+        .arg(
+            Arg::new(options::FILE)
+                .index(1)
+                .action(clap::ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-pub fn get_input<'a>(config: &Config, stdin_ref: &'a Stdin) -> UResult<Box<dyn Read + 'a>> {
-    match &config.to_read {
-        Some(name) => {
-            let file_buf =
-                File::open(Path::new(name)).map_err_context(|| name.maybe_quote().to_string())?;
-            Ok(Box::new(BufReader::new(file_buf))) // as Box<dyn Read>
-        }
-        None => {
-            Ok(Box::new(stdin_ref.lock())) // as Box<dyn Read>
-        }
+pub fn get_input<'a>(config: &Config, stdin_ref: &'a Stdin) -> UResult<Box<dyn Read + 'a>> {
+    match &config.to_read {
+        Some(name) => {
+            let file_buf =
+                File::open(Path::new(name)).map_err_context(|| name.maybe_quote().to_string())?;
+            Ok(Box::new(BufReader::new(file_buf))) // as Box<dyn Read>
+        }
+        None => {
+            Ok(Box::new(stdin_ref.lock())) // as Box<dyn Read>
+        }
     }
 }
 
-pub fn handle_input<R: Read>(
-    input: &mut R,
-    format: Format,
-    line_wrap: Option<usize>,
-    ignore_garbage: bool,
-    decode: bool,
-) -> UResult<()> {
-    let mut data = Data::new(input, format).ignore_garbage(ignore_garbage);
-    if let Some(wrap) = line_wrap {
-        data = data.line_wrap(wrap);
+pub fn handle_input<R: Read>(
+    input: &mut R,
+    format: Format,
+    line_wrap: Option<usize>,
+    ignore_garbage: bool,
+    decode: bool,
+) -> UResult<()> {
+    let mut data = Data::new(input, format).ignore_garbage(ignore_garbage);
+    if let Some(wrap) = line_wrap {
+        data = data.line_wrap(wrap);
     }
 
-    if !decode {
-        match data.encode() {
-            Ok(s) => {
-                wrap_print(&data, &s);
+    if !decode {
+        match data.encode() {
+            Ok(s) => {
+                wrap_print(&data, &s);
                 Ok(())
             }
-            Err(_) => Err(USimpleError::new(
+            Err(_) => Err(USimpleError::new(
                 1,
                 "error: invalid input (length must be multiple of 4 characters)",
             )),
         }
-    } else {
-        match data.decode() {
-            Ok(s) => {
-                // Silent the warning as we want to the error message
-                #[allow(clippy::question_mark)]
-                if stdout().write_all(&s).is_err() {
-                    // on windows console, writing invalid utf8 returns an error
-                    return Err(USimpleError::new(1, "error: cannot write non-utf8 data"));
+    } else {
+        match data.decode() {
+            Ok(s) => {
+                // Silent the warning as we want to the error message
+                #[allow(clippy::question_mark)]
+                if stdout().write_all(&s).is_err() {
+                    // on windows console, writing invalid utf8 returns an error
+                    return Err(USimpleError::new(1, "error: cannot write non-utf8 data"));
                 }
                 Ok(())
             }
-            Err(_) => Err(USimpleError::new(1, "error: invalid input")),
+            Err(_) => Err(USimpleError::new(1, "error: invalid input")),
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_base64/base64.rs.html b/dev/src/uu_base64/base64.rs.html index a5601b5e9..6aa8f8efb 100644 --- a/dev/src/uu_base64/base64.rs.html +++ b/dev/src/uu_base64/base64.rs.html @@ -1,4 +1,4 @@ -base64.rs - source
1
+base64.rs - source
1
 2
 3
 4
@@ -35,42 +35,42 @@
 35
 36
 37
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jordy Dickinson <jordy.dickinson@gmail.com>
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jordy Dickinson <jordy.dickinson@gmail.com>
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-use uu_base32::base_common;
-pub use uu_base32::uu_app;
+use uu_base32::base_common;
+pub use uu_base32::uu_app;
 
-use uucore::{encoding::Format, error::UResult, help_section, help_usage};
+use uucore::{encoding::Format, error::UResult, help_section, help_usage};
 
-use std::io::{stdin, Read};
+use std::io::{stdin, Read};
 
-const ABOUT: &str = help_section!("about", "base64.md");
-const USAGE: &str = help_usage!("base64.md");
+const ABOUT: &str = help_section!("about", "base64.md");
+const USAGE: &str = help_usage!("base64.md");
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let format = Format::Base64;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let format = Format::Base64;
 
-    let config: base_common::Config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?;
+    let config: base_common::Config = base_common::parse_base_cmd_args(args, ABOUT, USAGE)?;
 
-    // Create a reference to stdin so we can return a locked stdin from
-    // parse_base_cmd_args
-    let stdin_raw = stdin();
-    let mut input: Box<dyn Read> = base_common::get_input(&config, &stdin_raw)?;
+    // Create a reference to stdin so we can return a locked stdin from
+    // parse_base_cmd_args
+    let stdin_raw = stdin();
+    let mut input: Box<dyn Read> = base_common::get_input(&config, &stdin_raw)?;
 
-    base_common::handle_input(
-        &mut input,
-        format,
-        config.wrap_cols,
-        config.ignore_garbage,
-        config.decode,
+    base_common::handle_input(
+        &mut input,
+        format,
+        config.wrap_cols,
+        config.ignore_garbage,
+        config.decode,
     )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_basename/basename.rs.html b/dev/src/uu_basename/basename.rs.html index 527735295..298a3a602 100644 --- a/dev/src/uu_basename/basename.rs.html +++ b/dev/src/uu_basename/basename.rs.html @@ -1,4 +1,4 @@ -basename.rs - source
1
+basename.rs - source
1
 2
 3
 4
@@ -175,182 +175,182 @@
 175
 176
 177
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jimmy Lu <jimmy.lu.2011@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jimmy Lu <jimmy.lu.2011@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) fullname
+// spell-checker:ignore (ToDO) fullname
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::path::{is_separator, PathBuf};
-use uucore::display::Quotable;
-use uucore::error::{UResult, UUsageError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::path::{is_separator, PathBuf};
+use uucore::display::Quotable;
+use uucore::error::{UResult, UUsageError};
+use uucore::format_usage;
 
-static ABOUT: &str = r#"Print NAME with any leading directory components removed
+static ABOUT: &str = r#"Print NAME with any leading directory components removed
 If specified, also remove a trailing SUFFIX"#;
 
-const USAGE: &str = "{} NAME [SUFFIX]
+const USAGE: &str = "{} NAME [SUFFIX]
     {} OPTION... NAME...";
 
-pub mod options {
-    pub static MULTIPLE: &str = "multiple";
-    pub static NAME: &str = "name";
-    pub static SUFFIX: &str = "suffix";
-    pub static ZERO: &str = "zero";
+pub mod options {
+    pub static MULTIPLE: &str = "multiple";
+    pub static NAME: &str = "name";
+    pub static SUFFIX: &str = "suffix";
+    pub static ZERO: &str = "zero";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    // Since options have to go before names,
-    // if the first argument is not an option, then there is no option,
-    // and that implies there is exactly one name (no option => no -a option),
-    // so simple format is used
-    if args.len() > 1 && !args[1].starts_with('-') {
-        if args.len() > 3 {
-            return Err(UUsageError::new(
+    // Since options have to go before names,
+    // if the first argument is not an option, then there is no option,
+    // and that implies there is exactly one name (no option => no -a option),
+    // so simple format is used
+    if args.len() > 1 && !args[1].starts_with('-') {
+        if args.len() > 3 {
+            return Err(UUsageError::new(
                 1,
-                format!("extra operand {}", args[3].to_string().quote()),
+                format!("extra operand {}", args[3].to_string().quote()),
             ));
         }
-        let suffix = if args.len() > 2 { args[2].as_ref() } else { "" };
-        println!("{}", basename(&args[1], suffix));
-        return Ok(());
+        let suffix = if args.len() > 2 { args[2].as_ref() } else { "" };
+        println!("{}", basename(&args[1], suffix));
+        return Ok(());
     }
 
-    //
-    // Argument parsing
-    //
-    let matches = uu_app().try_get_matches_from(args)?;
+    //
+    // Argument parsing
+    //
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    // too few arguments
-    if !matches.contains_id(options::NAME) {
-        return Err(UUsageError::new(1, "missing operand".to_string()));
+    // too few arguments
+    if !matches.contains_id(options::NAME) {
+        return Err(UUsageError::new(1, "missing operand".to_string()));
     }
 
-    let opt_suffix = matches.get_one::<String>(options::SUFFIX).is_some();
-    let opt_multiple = matches.get_flag(options::MULTIPLE);
-    let opt_zero = matches.get_flag(options::ZERO);
-    let multiple_paths = opt_suffix || opt_multiple;
-    let name_args_count = matches
-        .get_many::<String>(options::NAME)
-        .map(|n| n.len())
-        .unwrap_or(0);
+    let opt_suffix = matches.get_one::<String>(options::SUFFIX).is_some();
+    let opt_multiple = matches.get_flag(options::MULTIPLE);
+    let opt_zero = matches.get_flag(options::ZERO);
+    let multiple_paths = opt_suffix || opt_multiple;
+    let name_args_count = matches
+        .get_many::<String>(options::NAME)
+        .map(|n| n.len())
+        .unwrap_or(0);
 
-    // too many arguments
-    if !multiple_paths && name_args_count > 2 {
-        return Err(UUsageError::new(
+    // too many arguments
+    if !multiple_paths && name_args_count > 2 {
+        return Err(UUsageError::new(
             1,
             format!(
                 "extra operand {}",
-                matches
-                    .get_many::<String>(options::NAME)
-                    .unwrap()
-                    .nth(2)
-                    .unwrap()
-                    .quote()
+                matches
+                    .get_many::<String>(options::NAME)
+                    .unwrap()
+                    .nth(2)
+                    .unwrap()
+                    .quote()
             ),
         ));
     }
 
-    let suffix = if opt_suffix {
-        matches.get_one::<String>(options::SUFFIX).unwrap()
-    } else if !opt_multiple && name_args_count > 1 {
-        matches
-            .get_many::<String>(options::NAME)
-            .unwrap()
-            .nth(1)
-            .unwrap()
-    } else {
-        ""
+    let suffix = if opt_suffix {
+        matches.get_one::<String>(options::SUFFIX).unwrap()
+    } else if !opt_multiple && name_args_count > 1 {
+        matches
+            .get_many::<String>(options::NAME)
+            .unwrap()
+            .nth(1)
+            .unwrap()
+    } else {
+        ""
+    };
+
+    //
+    // Main Program Processing
+    //
+
+    let paths: Vec<_> = if multiple_paths {
+        matches.get_many::<String>(options::NAME).unwrap().collect()
+    } else {
+        matches
+            .get_many::<String>(options::NAME)
+            .unwrap()
+            .take(1)
+            .collect()
     };
 
-    //
-    // Main Program Processing
-    //
-
-    let paths: Vec<_> = if multiple_paths {
-        matches.get_many::<String>(options::NAME).unwrap().collect()
-    } else {
-        matches
-            .get_many::<String>(options::NAME)
-            .unwrap()
-            .take(1)
-            .collect()
-    };
-
-    let line_ending = if opt_zero { "\0" } else { "\n" };
-    for path in paths {
-        print!("{}{}", basename(path, suffix), line_ending);
+    let line_ending = if opt_zero { "\0" } else { "\n" };
+    for path in paths {
+        print!("{}{}", basename(path, suffix), line_ending);
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::MULTIPLE)
-                .short('a')
-                .long(options::MULTIPLE)
-                .help("support multiple arguments and treat each as a NAME")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::MULTIPLE)
+                .short('a')
+                .long(options::MULTIPLE)
+                .help("support multiple arguments and treat each as a NAME")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NAME)
-                .action(clap::ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath)
-                .hide(true),
+        .arg(
+            Arg::new(options::NAME)
+                .action(clap::ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath)
+                .hide(true),
         )
-        .arg(
-            Arg::new(options::SUFFIX)
-                .short('s')
-                .long(options::SUFFIX)
-                .value_name("SUFFIX")
-                .help("remove a trailing SUFFIX; implies -a"),
+        .arg(
+            Arg::new(options::SUFFIX)
+                .short('s')
+                .long(options::SUFFIX)
+                .value_name("SUFFIX")
+                .help("remove a trailing SUFFIX; implies -a"),
         )
-        .arg(
-            Arg::new(options::ZERO)
-                .short('z')
-                .long(options::ZERO)
-                .help("end each output line with NUL, not newline")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO)
+                .short('z')
+                .long(options::ZERO)
+                .help("end each output line with NUL, not newline")
+                .action(ArgAction::SetTrue),
         )
 }
 
-fn basename(fullname: &str, suffix: &str) -> String {
-    // Remove all platform-specific path separators from the end.
-    let path = fullname.trim_end_matches(is_separator);
+fn basename(fullname: &str, suffix: &str) -> String {
+    // Remove all platform-specific path separators from the end.
+    let path = fullname.trim_end_matches(is_separator);
 
-    // If the path contained *only* suffix characters (for example, if
-    // `fullname` were "///" and `suffix` were "/"), then `path` would
-    // be left with the empty string. In that case, we set `path` to be
-    // the original `fullname` to avoid returning the empty path.
-    let path = if path.is_empty() { fullname } else { path };
+    // If the path contained *only* suffix characters (for example, if
+    // `fullname` were "///" and `suffix` were "/"), then `path` would
+    // be left with the empty string. In that case, we set `path` to be
+    // the original `fullname` to avoid returning the empty path.
+    let path = if path.is_empty() { fullname } else { path };
 
-    // Convert to path buffer and get last path component
-    let pb = PathBuf::from(path);
-    match pb.components().last() {
-        Some(c) => {
-            let name = c.as_os_str().to_str().unwrap();
-            if name == suffix {
-                name.to_string()
-            } else {
-                name.strip_suffix(suffix).unwrap_or(name).to_string()
+    // Convert to path buffer and get last path component
+    let pb = PathBuf::from(path);
+    match pb.components().last() {
+        Some(c) => {
+            let name = c.as_os_str().to_str().unwrap();
+            if name == suffix {
+                name.to_string()
+            } else {
+                name.strip_suffix(suffix).unwrap_or(name).to_string()
             }
         }
 
-        None => "".to_owned(),
+        None => "".to_owned(),
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_basenc/basenc.rs.html b/dev/src/uu_basenc/basenc.rs.html index 7a6d37350..a21d26103 100644 --- a/dev/src/uu_basenc/basenc.rs.html +++ b/dev/src/uu_basenc/basenc.rs.html @@ -1,4 +1,4 @@ -basenc.rs - source
1
+basenc.rs - source
1
 2
 3
 4
@@ -82,28 +82,28 @@
 82
 83
 84
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jordy Dickinson <jordy.dickinson@gmail.com>
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jordy Dickinson <jordy.dickinson@gmail.com>
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-//spell-checker:ignore (args) lsbf msbf
+//spell-checker:ignore (args) lsbf msbf
 
-use clap::{Arg, ArgAction, Command};
-use uu_base32::base_common::{self, Config, BASE_CMD_PARSE_ERROR};
+use clap::{Arg, ArgAction, Command};
+use uu_base32::base_common::{self, Config, BASE_CMD_PARSE_ERROR};
 
-use uucore::{
-    encoding::Format,
-    error::{UResult, UUsageError},
+use uucore::{
+    encoding::Format,
+    error::{UResult, UUsageError},
 };
 
-use std::io::{stdin, Read};
-use uucore::error::UClapError;
+use std::io::{stdin, Read};
+use uucore::error::UClapError;
 
-static ABOUT: &str = "\
+static ABOUT: &str = "\
 encode/decode data and print to standard output
 With no FILE, or when FILE is -, read standard input.
 
@@ -112,59 +112,59 @@ the formal alphabet. Use --ignore-garbage to attempt to recover
 from any other non-alphabet bytes in the encoded stream.
 ";
 
-const ENCODINGS: &[(&str, Format)] = &[
-    ("base64", Format::Base64),
-    ("base64url", Format::Base64Url),
-    ("base32", Format::Base32),
-    ("base32hex", Format::Base32Hex),
-    ("base16", Format::Base16),
-    ("base2lsbf", Format::Base2Lsbf),
-    ("base2msbf", Format::Base2Msbf),
-    ("z85", Format::Z85),
+const ENCODINGS: &[(&str, Format)] = &[
+    ("base64", Format::Base64),
+    ("base64url", Format::Base64Url),
+    ("base32", Format::Base32),
+    ("base32hex", Format::Base32Hex),
+    ("base16", Format::Base16),
+    ("base2lsbf", Format::Base2Lsbf),
+    ("base2msbf", Format::Base2Msbf),
+    ("z85", Format::Z85),
 ];
 
-const USAGE: &str = "{} [OPTION]... [FILE]";
+const USAGE: &str = "{} [OPTION]... [FILE]";
 
-pub fn uu_app() -> Command {
-    let mut command = base_common::base_app(ABOUT, USAGE);
-    for encoding in ENCODINGS {
-        command = command.arg(
-            Arg::new(encoding.0)
-                .long(encoding.0)
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    let mut command = base_common::base_app(ABOUT, USAGE);
+    for encoding in ENCODINGS {
+        command = command.arg(
+            Arg::new(encoding.0)
+                .long(encoding.0)
+                .action(ArgAction::SetTrue),
         );
     }
-    command
+    command
 }
 
-fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> {
-    let matches = uu_app()
-        .try_get_matches_from(args.collect_lossy())
-        .with_exit_code(1)?;
-    let format = ENCODINGS
-        .iter()
-        .find(|encoding| matches.get_flag(encoding.0))
-        .ok_or_else(|| UUsageError::new(BASE_CMD_PARSE_ERROR, "missing encoding type"))?
-        .1;
-    let config = Config::from(&matches)?;
-    Ok((config, format))
+fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> {
+    let matches = uu_app()
+        .try_get_matches_from(args.collect_lossy())
+        .with_exit_code(1)?;
+    let format = ENCODINGS
+        .iter()
+        .find(|encoding| matches.get_flag(encoding.0))
+        .ok_or_else(|| UUsageError::new(BASE_CMD_PARSE_ERROR, "missing encoding type"))?
+        .1;
+    let config = Config::from(&matches)?;
+    Ok((config, format))
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let (config, format) = parse_cmd_args(args)?;
-    // Create a reference to stdin so we can return a locked stdin from
-    // parse_base_cmd_args
-    let stdin_raw = stdin();
-    let mut input: Box<dyn Read> = base_common::get_input(&config, &stdin_raw)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let (config, format) = parse_cmd_args(args)?;
+    // Create a reference to stdin so we can return a locked stdin from
+    // parse_base_cmd_args
+    let stdin_raw = stdin();
+    let mut input: Box<dyn Read> = base_common::get_input(&config, &stdin_raw)?;
 
-    base_common::handle_input(
-        &mut input,
-        format,
-        config.wrap_cols,
-        config.ignore_garbage,
-        config.decode,
+    base_common::handle_input(
+        &mut input,
+        format,
+        config.wrap_cols,
+        config.ignore_garbage,
+        config.decode,
     )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_cat/cat.rs.html b/dev/src/uu_cat/cat.rs.html index a8e42b1d7..563f8cad8 100644 --- a/dev/src/uu_cat/cat.rs.html +++ b/dev/src/uu_cat/cat.rs.html @@ -1,4 +1,4 @@ -cat.rs - source
1
+cat.rs - source
1
 2
 3
 4
@@ -648,655 +648,655 @@
 648
 649
 650
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jordi Boggiano <j.boggiano@seld.be>
-// (c) Evgeniy Klyuchikov <evgeniy.klyuchikov@gmail.com>
-// (c) Joshua S. Miller <jsmiller@uchicago.edu>
-// (c) Árni Dagur <arni@dagur.eu>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jordi Boggiano <j.boggiano@seld.be>
+// (c) Evgeniy Klyuchikov <evgeniy.klyuchikov@gmail.com>
+// (c) Joshua S. Miller <jsmiller@uchicago.edu>
+// (c) Árni Dagur <arni@dagur.eu>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) nonprint nonblank nonprinting
+// spell-checker:ignore (ToDO) nonprint nonblank nonprinting
 
-// last synced with: cat (GNU coreutils) 8.13
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fs::{metadata, File};
-use std::io::{self, Read, Write};
-use thiserror::Error;
-use uucore::display::Quotable;
-use uucore::error::UResult;
-use uucore::fs::FileInformation;
+// last synced with: cat (GNU coreutils) 8.13
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fs::{metadata, File};
+use std::io::{self, Read, Write};
+use thiserror::Error;
+use uucore::display::Quotable;
+use uucore::error::UResult;
+use uucore::fs::FileInformation;
 
-#[cfg(unix)]
-use std::os::unix::io::AsRawFd;
+#[cfg(unix)]
+use std::os::unix::io::AsRawFd;
 
-/// Linux splice support
-#[cfg(any(target_os = "linux", target_os = "android"))]
-mod splice;
+/// Linux splice support
+#[cfg(any(target_os = "linux", target_os = "android"))]
+mod splice;
 
-/// Unix domain socket support
-#[cfg(unix)]
-use std::net::Shutdown;
-#[cfg(unix)]
-use std::os::unix::fs::FileTypeExt;
-#[cfg(unix)]
-use std::os::unix::net::UnixStream;
-use uucore::format_usage;
+/// Unix domain socket support
+#[cfg(unix)]
+use std::net::Shutdown;
+#[cfg(unix)]
+use std::os::unix::fs::FileTypeExt;
+#[cfg(unix)]
+use std::os::unix::net::UnixStream;
+use uucore::format_usage;
 
-static NAME: &str = "cat";
-static USAGE: &str = "{} [OPTION]... [FILE]...";
-static ABOUT: &str = "Concatenate FILE(s), or standard input, to standard output
+static NAME: &str = "cat";
+static USAGE: &str = "{} [OPTION]... [FILE]...";
+static ABOUT: &str = "Concatenate FILE(s), or standard input, to standard output
 With no FILE, or when FILE is -, read standard input.";
 
-#[derive(Error, Debug)]
-enum CatError {
-    /// Wrapper around `io::Error`
-    #[error("{0}")]
-    Io(#[from] io::Error),
-    /// Wrapper around `nix::Error`
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    #[error("{0}")]
-    Nix(#[from] nix::Error),
-    /// Unknown file type; it's not a regular file, socket, etc.
-    #[error("unknown filetype: {}", ft_debug)]
-    UnknownFiletype {
-        /// A debug print of the file type
-        ft_debug: String,
+#[derive(Error, Debug)]
+enum CatError {
+    /// Wrapper around `io::Error`
+    #[error("{0}")]
+    Io(#[from] io::Error),
+    /// Wrapper around `nix::Error`
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    #[error("{0}")]
+    Nix(#[from] nix::Error),
+    /// Unknown file type; it's not a regular file, socket, etc.
+    #[error("unknown filetype: {}", ft_debug)]
+    UnknownFiletype {
+        /// A debug print of the file type
+        ft_debug: String,
     },
-    #[error("Is a directory")]
-    IsDirectory,
-    #[error("input file is output file")]
-    OutputIsInput,
+    #[error("Is a directory")]
+    IsDirectory,
+    #[error("input file is output file")]
+    OutputIsInput,
 }
 
-type CatResult<T> = Result<T, CatError>;
+type CatResult<T> = Result<T, CatError>;
 
-#[derive(PartialEq)]
-enum NumberingMode {
+#[derive(PartialEq)]
+enum NumberingMode {
     None,
-    NonEmpty,
-    All,
+    NonEmpty,
+    All,
 }
 
-struct OutputOptions {
-    /// Line numbering mode
-    number: NumberingMode,
+struct OutputOptions {
+    /// Line numbering mode
+    number: NumberingMode,
 
-    /// Suppress repeated empty output lines
-    squeeze_blank: bool,
+    /// Suppress repeated empty output lines
+    squeeze_blank: bool,
 
-    /// display TAB characters as `tab`
-    show_tabs: bool,
+    /// display TAB characters as `tab`
+    show_tabs: bool,
 
-    /// Show end of lines
-    show_ends: bool,
+    /// Show end of lines
+    show_ends: bool,
 
-    /// use ^ and M- notation, except for LF (\\n) and TAB (\\t)
-    show_nonprint: bool,
+    /// use ^ and M- notation, except for LF (\\n) and TAB (\\t)
+    show_nonprint: bool,
 }
 
-impl OutputOptions {
-    fn tab(&self) -> &'static str {
-        if self.show_tabs {
-            "^I"
-        } else {
-            "\t"
-        }
+impl OutputOptions {
+    fn tab(&self) -> &'static str {
+        if self.show_tabs {
+            "^I"
+        } else {
+            "\t"
+        }
     }
 
-    fn end_of_line(&self) -> &'static str {
-        if self.show_ends {
-            "$\n"
-        } else {
-            "\n"
-        }
+    fn end_of_line(&self) -> &'static str {
+        if self.show_ends {
+            "$\n"
+        } else {
+            "\n"
+        }
     }
 
-    /// We can write fast if we can simply copy the contents of the file to
-    /// stdout, without augmenting the output with e.g. line numbers.
-    fn can_write_fast(&self) -> bool {
-        !(self.show_tabs
-            || self.show_nonprint
-            || self.show_ends
-            || self.squeeze_blank
-            || self.number != NumberingMode::None)
+    /// We can write fast if we can simply copy the contents of the file to
+    /// stdout, without augmenting the output with e.g. line numbers.
+    fn can_write_fast(&self) -> bool {
+        !(self.show_tabs
+            || self.show_nonprint
+            || self.show_ends
+            || self.squeeze_blank
+            || self.number != NumberingMode::None)
     }
 }
 
-/// State that persists between output of each file. This struct is only used
-/// when we can't write fast.
-struct OutputState {
-    /// The current line number
-    line_number: usize,
+/// State that persists between output of each file. This struct is only used
+/// when we can't write fast.
+struct OutputState {
+    /// The current line number
+    line_number: usize,
 
-    /// Whether the output cursor is at the beginning of a new line
-    at_line_start: bool,
+    /// Whether the output cursor is at the beginning of a new line
+    at_line_start: bool,
 
-    /// Whether we skipped a \r, which still needs to be printed
-    skipped_carriage_return: bool,
+    /// Whether we skipped a \r, which still needs to be printed
+    skipped_carriage_return: bool,
 
-    /// Whether we have already printed a blank line
-    one_blank_kept: bool,
+    /// Whether we have already printed a blank line
+    one_blank_kept: bool,
 }
 
-#[cfg(unix)]
-trait FdReadable: Read + AsRawFd {}
-#[cfg(not(unix))]
-trait FdReadable: Read {}
+#[cfg(unix)]
+trait FdReadable: Read + AsRawFd {}
+#[cfg(not(unix))]
+trait FdReadable: Read {}
 
-#[cfg(unix)]
-impl<T> FdReadable for T where T: Read + AsRawFd {}
-#[cfg(not(unix))]
-impl<T> FdReadable for T where T: Read {}
+#[cfg(unix)]
+impl<T> FdReadable for T where T: Read + AsRawFd {}
+#[cfg(not(unix))]
+impl<T> FdReadable for T where T: Read {}
 
-/// Represents an open file handle, stream, or other device
-struct InputHandle<R: FdReadable> {
-    reader: R,
-    is_interactive: bool,
+/// Represents an open file handle, stream, or other device
+struct InputHandle<R: FdReadable> {
+    reader: R,
+    is_interactive: bool,
 }
 
-/// Concrete enum of recognized file types.
-///
-/// *Note*: `cat`-ing a directory should result in an
-/// CatError::IsDirectory
-enum InputType {
-    Directory,
-    File,
-    StdIn,
-    SymLink,
-    #[cfg(unix)]
-    BlockDevice,
-    #[cfg(unix)]
-    CharacterDevice,
-    #[cfg(unix)]
-    Fifo,
-    #[cfg(unix)]
-    Socket,
+/// Concrete enum of recognized file types.
+///
+/// *Note*: `cat`-ing a directory should result in an
+/// CatError::IsDirectory
+enum InputType {
+    Directory,
+    File,
+    StdIn,
+    SymLink,
+    #[cfg(unix)]
+    BlockDevice,
+    #[cfg(unix)]
+    CharacterDevice,
+    #[cfg(unix)]
+    Fifo,
+    #[cfg(unix)]
+    Socket,
 }
 
-mod options {
-    pub static FILE: &str = "file";
-    pub static SHOW_ALL: &str = "show-all";
-    pub static NUMBER_NONBLANK: &str = "number-nonblank";
-    pub static SHOW_NONPRINTING_ENDS: &str = "e";
-    pub static SHOW_ENDS: &str = "show-ends";
-    pub static NUMBER: &str = "number";
-    pub static SQUEEZE_BLANK: &str = "squeeze-blank";
-    pub static SHOW_NONPRINTING_TABS: &str = "t";
-    pub static SHOW_TABS: &str = "show-tabs";
-    pub static SHOW_NONPRINTING: &str = "show-nonprinting";
+mod options {
+    pub static FILE: &str = "file";
+    pub static SHOW_ALL: &str = "show-all";
+    pub static NUMBER_NONBLANK: &str = "number-nonblank";
+    pub static SHOW_NONPRINTING_ENDS: &str = "e";
+    pub static SHOW_ENDS: &str = "show-ends";
+    pub static NUMBER: &str = "number";
+    pub static SQUEEZE_BLANK: &str = "squeeze-blank";
+    pub static SHOW_NONPRINTING_TABS: &str = "t";
+    pub static SHOW_TABS: &str = "show-tabs";
+    pub static SHOW_NONPRINTING: &str = "show-nonprinting";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let number_mode = if matches.get_flag(options::NUMBER_NONBLANK) {
-        NumberingMode::NonEmpty
-    } else if matches.get_flag(options::NUMBER) {
-        NumberingMode::All
-    } else {
-        NumberingMode::None
+    let number_mode = if matches.get_flag(options::NUMBER_NONBLANK) {
+        NumberingMode::NonEmpty
+    } else if matches.get_flag(options::NUMBER) {
+        NumberingMode::All
+    } else {
+        NumberingMode::None
     };
 
-    let show_nonprint = vec![
-        options::SHOW_ALL.to_owned(),
-        options::SHOW_NONPRINTING_ENDS.to_owned(),
-        options::SHOW_NONPRINTING_TABS.to_owned(),
-        options::SHOW_NONPRINTING.to_owned(),
+    let show_nonprint = vec![
+        options::SHOW_ALL.to_owned(),
+        options::SHOW_NONPRINTING_ENDS.to_owned(),
+        options::SHOW_NONPRINTING_TABS.to_owned(),
+        options::SHOW_NONPRINTING.to_owned(),
     ]
-    .iter()
-    .any(|v| matches.get_flag(v));
+    .iter()
+    .any(|v| matches.get_flag(v));
 
-    let show_ends = vec![
-        options::SHOW_ENDS.to_owned(),
-        options::SHOW_ALL.to_owned(),
-        options::SHOW_NONPRINTING_ENDS.to_owned(),
+    let show_ends = vec![
+        options::SHOW_ENDS.to_owned(),
+        options::SHOW_ALL.to_owned(),
+        options::SHOW_NONPRINTING_ENDS.to_owned(),
     ]
-    .iter()
-    .any(|v| matches.get_flag(v));
+    .iter()
+    .any(|v| matches.get_flag(v));
 
-    let show_tabs = vec![
-        options::SHOW_ALL.to_owned(),
-        options::SHOW_TABS.to_owned(),
-        options::SHOW_NONPRINTING_TABS.to_owned(),
+    let show_tabs = vec![
+        options::SHOW_ALL.to_owned(),
+        options::SHOW_TABS.to_owned(),
+        options::SHOW_NONPRINTING_TABS.to_owned(),
     ]
-    .iter()
-    .any(|v| matches.get_flag(v));
+    .iter()
+    .any(|v| matches.get_flag(v));
 
-    let squeeze_blank = matches.get_flag(options::SQUEEZE_BLANK);
-    let files: Vec<String> = match matches.get_many::<String>(options::FILE) {
-        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
-        None => vec!["-".to_owned()],
+    let squeeze_blank = matches.get_flag(options::SQUEEZE_BLANK);
+    let files: Vec<String> = match matches.get_many::<String>(options::FILE) {
+        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
+        None => vec!["-".to_owned()],
     };
 
-    let options = OutputOptions {
-        show_ends,
-        number: number_mode,
-        show_nonprint,
-        show_tabs,
-        squeeze_blank,
+    let options = OutputOptions {
+        show_ends,
+        number: number_mode,
+        show_nonprint,
+        show_tabs,
+        squeeze_blank,
     };
-    cat_files(&files, &options)
+    cat_files(&files, &options)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .action(clap::ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .action(clap::ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::SHOW_ALL)
-                .short('A')
-                .long(options::SHOW_ALL)
-                .help("equivalent to -vET")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SHOW_ALL)
+                .short('A')
+                .long(options::SHOW_ALL)
+                .help("equivalent to -vET")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NUMBER_NONBLANK)
-                .short('b')
-                .long(options::NUMBER_NONBLANK)
-                .help("number nonempty output lines, overrides -n")
-                .overrides_with(options::NUMBER)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NUMBER_NONBLANK)
+                .short('b')
+                .long(options::NUMBER_NONBLANK)
+                .help("number nonempty output lines, overrides -n")
+                .overrides_with(options::NUMBER)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SHOW_NONPRINTING_ENDS)
-                .short('e')
-                .help("equivalent to -vE")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SHOW_NONPRINTING_ENDS)
+                .short('e')
+                .help("equivalent to -vE")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SHOW_ENDS)
-                .short('E')
-                .long(options::SHOW_ENDS)
-                .help("display $ at end of each line")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SHOW_ENDS)
+                .short('E')
+                .long(options::SHOW_ENDS)
+                .help("display $ at end of each line")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NUMBER)
-                .short('n')
-                .long(options::NUMBER)
-                .help("number all output lines")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NUMBER)
+                .short('n')
+                .long(options::NUMBER)
+                .help("number all output lines")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SQUEEZE_BLANK)
-                .short('s')
-                .long(options::SQUEEZE_BLANK)
-                .help("suppress repeated empty output lines")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SQUEEZE_BLANK)
+                .short('s')
+                .long(options::SQUEEZE_BLANK)
+                .help("suppress repeated empty output lines")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SHOW_NONPRINTING_TABS)
-                .short('t')
-                .long(options::SHOW_NONPRINTING_TABS)
-                .help("equivalent to -vT")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SHOW_NONPRINTING_TABS)
+                .short('t')
+                .long(options::SHOW_NONPRINTING_TABS)
+                .help("equivalent to -vT")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SHOW_TABS)
-                .short('T')
-                .long(options::SHOW_TABS)
-                .help("display TAB characters at ^I")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SHOW_TABS)
+                .short('T')
+                .long(options::SHOW_TABS)
+                .help("display TAB characters at ^I")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SHOW_NONPRINTING)
-                .short('v')
-                .long(options::SHOW_NONPRINTING)
-                .help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SHOW_NONPRINTING)
+                .short('v')
+                .long(options::SHOW_NONPRINTING)
+                .help("use ^ and M- notation, except for LF (\\n) and TAB (\\t)")
+                .action(ArgAction::SetTrue),
         )
 }
 
-fn cat_handle<R: FdReadable>(
-    handle: &mut InputHandle<R>,
-    options: &OutputOptions,
-    state: &mut OutputState,
-) -> CatResult<()> {
-    if options.can_write_fast() {
-        write_fast(handle)
-    } else {
-        write_lines(handle, options, state)
+fn cat_handle<R: FdReadable>(
+    handle: &mut InputHandle<R>,
+    options: &OutputOptions,
+    state: &mut OutputState,
+) -> CatResult<()> {
+    if options.can_write_fast() {
+        write_fast(handle)
+    } else {
+        write_lines(handle, options, state)
     }
 }
 
-fn cat_path(
-    path: &str,
-    options: &OutputOptions,
-    state: &mut OutputState,
-    out_info: Option<&FileInformation>,
-) -> CatResult<()> {
-    match get_input_type(path)? {
-        InputType::StdIn => {
-            let stdin = io::stdin();
-            let mut handle = InputHandle {
-                reader: stdin,
-                is_interactive: atty::is(atty::Stream::Stdin),
+fn cat_path(
+    path: &str,
+    options: &OutputOptions,
+    state: &mut OutputState,
+    out_info: Option<&FileInformation>,
+) -> CatResult<()> {
+    match get_input_type(path)? {
+        InputType::StdIn => {
+            let stdin = io::stdin();
+            let mut handle = InputHandle {
+                reader: stdin,
+                is_interactive: atty::is(atty::Stream::Stdin),
             };
-            cat_handle(&mut handle, options, state)
+            cat_handle(&mut handle, options, state)
         }
-        InputType::Directory => Err(CatError::IsDirectory),
-        #[cfg(unix)]
-        InputType::Socket => {
-            let socket = UnixStream::connect(path)?;
-            socket.shutdown(Shutdown::Write)?;
-            let mut handle = InputHandle {
-                reader: socket,
-                is_interactive: false,
+        InputType::Directory => Err(CatError::IsDirectory),
+        #[cfg(unix)]
+        InputType::Socket => {
+            let socket = UnixStream::connect(path)?;
+            socket.shutdown(Shutdown::Write)?;
+            let mut handle = InputHandle {
+                reader: socket,
+                is_interactive: false,
             };
-            cat_handle(&mut handle, options, state)
+            cat_handle(&mut handle, options, state)
         }
-        _ => {
-            let file = File::open(path)?;
+        _ => {
+            let file = File::open(path)?;
 
-            if let Some(out_info) = out_info {
-                if out_info.file_size() != 0
-                    && FileInformation::from_file(&file).ok().as_ref() == Some(out_info)
+            if let Some(out_info) = out_info {
+                if out_info.file_size() != 0
+                    && FileInformation::from_file(&file).ok().as_ref() == Some(out_info)
                 {
-                    return Err(CatError::OutputIsInput);
+                    return Err(CatError::OutputIsInput);
                 }
             }
 
-            let mut handle = InputHandle {
-                reader: file,
-                is_interactive: false,
+            let mut handle = InputHandle {
+                reader: file,
+                is_interactive: false,
             };
-            cat_handle(&mut handle, options, state)
+            cat_handle(&mut handle, options, state)
         }
     }
 }
 
-fn cat_files(files: &[String], options: &OutputOptions) -> UResult<()> {
-    let out_info = FileInformation::from_file(&std::io::stdout()).ok();
+fn cat_files(files: &[String], options: &OutputOptions) -> UResult<()> {
+    let out_info = FileInformation::from_file(&std::io::stdout()).ok();
 
-    let mut state = OutputState {
-        line_number: 1,
-        at_line_start: true,
-        skipped_carriage_return: false,
-        one_blank_kept: false,
+    let mut state = OutputState {
+        line_number: 1,
+        at_line_start: true,
+        skipped_carriage_return: false,
+        one_blank_kept: false,
     };
-    let mut error_messages: Vec<String> = Vec::new();
+    let mut error_messages: Vec<String> = Vec::new();
 
-    for path in files {
-        if let Err(err) = cat_path(path, options, &mut state, out_info.as_ref()) {
-            error_messages.push(format!("{}: {}", path.maybe_quote(), err));
+    for path in files {
+        if let Err(err) = cat_path(path, options, &mut state, out_info.as_ref()) {
+            error_messages.push(format!("{}: {}", path.maybe_quote(), err));
         }
     }
-    if state.skipped_carriage_return {
+    if state.skipped_carriage_return {
         print!("\r");
     }
-    if error_messages.is_empty() {
+    if error_messages.is_empty() {
         Ok(())
-    } else {
-        // each next line is expected to display "cat: …"
-        let line_joiner = format!("\n{}: ", uucore::util_name());
+    } else {
+        // each next line is expected to display "cat: …"
+        let line_joiner = format!("\n{}: ", uucore::util_name());
 
-        Err(uucore::error::USimpleError::new(
-            error_messages.len() as i32,
-            error_messages.join(&line_joiner),
+        Err(uucore::error::USimpleError::new(
+            error_messages.len() as i32,
+            error_messages.join(&line_joiner),
         ))
     }
 }
 
-/// Classifies the `InputType` of file at `path` if possible
-///
-/// # Arguments
-///
-/// * `path` - Path on a file system to classify metadata
-fn get_input_type(path: &str) -> CatResult<InputType> {
-    if path == "-" {
-        return Ok(InputType::StdIn);
+/// Classifies the `InputType` of file at `path` if possible
+///
+/// # Arguments
+///
+/// * `path` - Path on a file system to classify metadata
+fn get_input_type(path: &str) -> CatResult<InputType> {
+    if path == "-" {
+        return Ok(InputType::StdIn);
     }
 
-    let ft = metadata(path)?.file_type();
-    match ft {
-        #[cfg(unix)]
-        ft if ft.is_block_device() => Ok(InputType::BlockDevice),
-        #[cfg(unix)]
-        ft if ft.is_char_device() => Ok(InputType::CharacterDevice),
-        #[cfg(unix)]
-        ft if ft.is_fifo() => Ok(InputType::Fifo),
-        #[cfg(unix)]
-        ft if ft.is_socket() => Ok(InputType::Socket),
-        ft if ft.is_dir() => Ok(InputType::Directory),
-        ft if ft.is_file() => Ok(InputType::File),
-        ft if ft.is_symlink() => Ok(InputType::SymLink),
-        _ => Err(CatError::UnknownFiletype {
-            ft_debug: format!("{:?}", ft),
+    let ft = metadata(path)?.file_type();
+    match ft {
+        #[cfg(unix)]
+        ft if ft.is_block_device() => Ok(InputType::BlockDevice),
+        #[cfg(unix)]
+        ft if ft.is_char_device() => Ok(InputType::CharacterDevice),
+        #[cfg(unix)]
+        ft if ft.is_fifo() => Ok(InputType::Fifo),
+        #[cfg(unix)]
+        ft if ft.is_socket() => Ok(InputType::Socket),
+        ft if ft.is_dir() => Ok(InputType::Directory),
+        ft if ft.is_file() => Ok(InputType::File),
+        ft if ft.is_symlink() => Ok(InputType::SymLink),
+        _ => Err(CatError::UnknownFiletype {
+            ft_debug: format!("{:?}", ft),
         }),
     }
 }
 
-/// Writes handle to stdout with no configuration. This allows a
-/// simple memory copy.
-fn write_fast<R: FdReadable>(handle: &mut InputHandle<R>) -> CatResult<()> {
-    let stdout = io::stdout();
-    let mut stdout_lock = stdout.lock();
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    {
-        // If we're on Linux or Android, try to use the splice() system call
-        // for faster writing. If it works, we're done.
-        if !splice::write_fast_using_splice(handle, &stdout_lock)? {
-            return Ok(());
+/// Writes handle to stdout with no configuration. This allows a
+/// simple memory copy.
+fn write_fast<R: FdReadable>(handle: &mut InputHandle<R>) -> CatResult<()> {
+    let stdout = io::stdout();
+    let mut stdout_lock = stdout.lock();
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    {
+        // If we're on Linux or Android, try to use the splice() system call
+        // for faster writing. If it works, we're done.
+        if !splice::write_fast_using_splice(handle, &stdout_lock)? {
+            return Ok(());
         }
     }
-    // If we're not on Linux or Android, or the splice() call failed,
-    // fall back on slower writing.
-    let mut buf = [0; 1024 * 64];
-    while let Ok(n) = handle.reader.read(&mut buf) {
-        if n == 0 {
+    // If we're not on Linux or Android, or the splice() call failed,
+    // fall back on slower writing.
+    let mut buf = [0; 1024 * 64];
+    while let Ok(n) = handle.reader.read(&mut buf) {
+        if n == 0 {
             break;
         }
-        stdout_lock.write_all(&buf[..n])?;
+        stdout_lock.write_all(&buf[..n])?;
     }
     Ok(())
 }
 
-/// Outputs file contents to stdout in a line-by-line fashion,
-/// propagating any errors that might occur.
-fn write_lines<R: FdReadable>(
-    handle: &mut InputHandle<R>,
-    options: &OutputOptions,
-    state: &mut OutputState,
-) -> CatResult<()> {
-    let mut in_buf = [0; 1024 * 31];
-    let stdout = io::stdout();
-    let mut writer = stdout.lock();
+/// Outputs file contents to stdout in a line-by-line fashion,
+/// propagating any errors that might occur.
+fn write_lines<R: FdReadable>(
+    handle: &mut InputHandle<R>,
+    options: &OutputOptions,
+    state: &mut OutputState,
+) -> CatResult<()> {
+    let mut in_buf = [0; 1024 * 31];
+    let stdout = io::stdout();
+    let mut writer = stdout.lock();
 
-    while let Ok(n) = handle.reader.read(&mut in_buf) {
-        if n == 0 {
+    while let Ok(n) = handle.reader.read(&mut in_buf) {
+        if n == 0 {
             break;
         }
-        let in_buf = &in_buf[..n];
-        let mut pos = 0;
-        while pos < n {
-            // skip empty line_number enumerating them if needed
-            if in_buf[pos] == b'\n' {
-                // \r followed by \n is printed as ^M when show_ends is enabled, so that \r\n prints as ^M$
-                if state.skipped_carriage_return && options.show_ends {
-                    writer.write_all(b"^M")?;
-                    state.skipped_carriage_return = false;
+        let in_buf = &in_buf[..n];
+        let mut pos = 0;
+        while pos < n {
+            // skip empty line_number enumerating them if needed
+            if in_buf[pos] == b'\n' {
+                // \r followed by \n is printed as ^M when show_ends is enabled, so that \r\n prints as ^M$
+                if state.skipped_carriage_return && options.show_ends {
+                    writer.write_all(b"^M")?;
+                    state.skipped_carriage_return = false;
                 }
-                if !state.at_line_start || !options.squeeze_blank || !state.one_blank_kept {
-                    state.one_blank_kept = true;
-                    if state.at_line_start && options.number == NumberingMode::All {
-                        write!(writer, "{0:6}\t", state.line_number)?;
-                        state.line_number += 1;
+                if !state.at_line_start || !options.squeeze_blank || !state.one_blank_kept {
+                    state.one_blank_kept = true;
+                    if state.at_line_start && options.number == NumberingMode::All {
+                        write!(writer, "{0:6}\t", state.line_number)?;
+                        state.line_number += 1;
                     }
-                    writer.write_all(options.end_of_line().as_bytes())?;
-                    if handle.is_interactive {
-                        writer.flush()?;
+                    writer.write_all(options.end_of_line().as_bytes())?;
+                    if handle.is_interactive {
+                        writer.flush()?;
                     }
                 }
-                state.at_line_start = true;
-                pos += 1;
+                state.at_line_start = true;
+                pos += 1;
                 continue;
             }
-            if state.skipped_carriage_return {
-                writer.write_all(b"\r")?;
-                state.skipped_carriage_return = false;
-                state.at_line_start = false;
+            if state.skipped_carriage_return {
+                writer.write_all(b"\r")?;
+                state.skipped_carriage_return = false;
+                state.at_line_start = false;
             }
-            state.one_blank_kept = false;
-            if state.at_line_start && options.number != NumberingMode::None {
-                write!(writer, "{0:6}\t", state.line_number)?;
-                state.line_number += 1;
+            state.one_blank_kept = false;
+            if state.at_line_start && options.number != NumberingMode::None {
+                write!(writer, "{0:6}\t", state.line_number)?;
+                state.line_number += 1;
             }
 
-            // print to end of line or end of buffer
-            let offset = if options.show_nonprint {
-                write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab().as_bytes())
-            } else if options.show_tabs {
-                write_tab_to_end(&in_buf[pos..], &mut writer)
-            } else {
-                write_to_end(&in_buf[pos..], &mut writer)
+            // print to end of line or end of buffer
+            let offset = if options.show_nonprint {
+                write_nonprint_to_end(&in_buf[pos..], &mut writer, options.tab().as_bytes())
+            } else if options.show_tabs {
+                write_tab_to_end(&in_buf[pos..], &mut writer)
+            } else {
+                write_to_end(&in_buf[pos..], &mut writer)
             };
-            // end of buffer?
-            if offset + pos == in_buf.len() {
-                state.at_line_start = false;
+            // end of buffer?
+            if offset + pos == in_buf.len() {
+                state.at_line_start = false;
                 break;
             }
-            if in_buf[pos + offset] == b'\r' {
-                state.skipped_carriage_return = true;
-            } else {
-                assert_eq!(in_buf[pos + offset], b'\n');
-                // print suitable end of line
-                writer.write_all(options.end_of_line().as_bytes())?;
-                if handle.is_interactive {
-                    writer.flush()?;
+            if in_buf[pos + offset] == b'\r' {
+                state.skipped_carriage_return = true;
+            } else {
+                assert_eq!(in_buf[pos + offset], b'\n');
+                // print suitable end of line
+                writer.write_all(options.end_of_line().as_bytes())?;
+                if handle.is_interactive {
+                    writer.flush()?;
                 }
-                state.at_line_start = true;
+                state.at_line_start = true;
             }
-            pos += offset + 1;
+            pos += offset + 1;
         }
     }
 
     Ok(())
 }
 
-// write***_to_end methods
-// Write all symbols till \n or \r or end of buffer is reached
-// We need to stop at \r because it may be written as ^M depending on the byte after and settings;
-// however, write_nonprint_to_end doesn't need to stop at \r because it will always write \r as ^M.
-// Return the number of written symbols
-fn write_to_end<W: Write>(in_buf: &[u8], writer: &mut W) -> usize {
-    match in_buf.iter().position(|c| *c == b'\n' || *c == b'\r') {
-        Some(p) => {
-            writer.write_all(&in_buf[..p]).unwrap();
-            p
+// write***_to_end methods
+// Write all symbols till \n or \r or end of buffer is reached
+// We need to stop at \r because it may be written as ^M depending on the byte after and settings;
+// however, write_nonprint_to_end doesn't need to stop at \r because it will always write \r as ^M.
+// Return the number of written symbols
+fn write_to_end<W: Write>(in_buf: &[u8], writer: &mut W) -> usize {
+    match in_buf.iter().position(|c| *c == b'\n' || *c == b'\r') {
+        Some(p) => {
+            writer.write_all(&in_buf[..p]).unwrap();
+            p
         }
-        None => {
-            writer.write_all(in_buf).unwrap();
-            in_buf.len()
+        None => {
+            writer.write_all(in_buf).unwrap();
+            in_buf.len()
         }
     }
 }
 
-fn write_tab_to_end<W: Write>(mut in_buf: &[u8], writer: &mut W) -> usize {
-    let mut count = 0;
-    loop {
-        match in_buf
-            .iter()
-            .position(|c| *c == b'\n' || *c == b'\t' || *c == b'\r')
+fn write_tab_to_end<W: Write>(mut in_buf: &[u8], writer: &mut W) -> usize {
+    let mut count = 0;
+    loop {
+        match in_buf
+            .iter()
+            .position(|c| *c == b'\n' || *c == b'\t' || *c == b'\r')
         {
-            Some(p) => {
-                writer.write_all(&in_buf[..p]).unwrap();
-                if in_buf[p] == b'\t' {
-                    writer.write_all(b"^I").unwrap();
-                    in_buf = &in_buf[p + 1..];
-                    count += p + 1;
-                } else {
-                    // b'\n' or b'\r'
-                    return count + p;
+            Some(p) => {
+                writer.write_all(&in_buf[..p]).unwrap();
+                if in_buf[p] == b'\t' {
+                    writer.write_all(b"^I").unwrap();
+                    in_buf = &in_buf[p + 1..];
+                    count += p + 1;
+                } else {
+                    // b'\n' or b'\r'
+                    return count + p;
                 }
             }
-            None => {
-                writer.write_all(in_buf).unwrap();
-                return in_buf.len();
+            None => {
+                writer.write_all(in_buf).unwrap();
+                return in_buf.len();
             }
         };
     }
 }
 
-fn write_nonprint_to_end<W: Write>(in_buf: &[u8], writer: &mut W, tab: &[u8]) -> usize {
-    let mut count = 0;
+fn write_nonprint_to_end<W: Write>(in_buf: &[u8], writer: &mut W, tab: &[u8]) -> usize {
+    let mut count = 0;
 
-    for byte in in_buf.iter().copied() {
-        if byte == b'\n' {
+    for byte in in_buf.iter().copied() {
+        if byte == b'\n' {
             break;
         }
-        match byte {
-            9 => writer.write_all(tab),
-            0..=8 | 10..=31 => writer.write_all(&[b'^', byte + 64]),
-            32..=126 => writer.write_all(&[byte]),
-            127 => writer.write_all(&[b'^', b'?']),
-            128..=159 => writer.write_all(&[b'M', b'-', b'^', byte - 64]),
-            160..=254 => writer.write_all(&[b'M', b'-', byte - 128]),
-            _ => writer.write_all(&[b'M', b'-', b'^', b'?']),
+        match byte {
+            9 => writer.write_all(tab),
+            0..=8 | 10..=31 => writer.write_all(&[b'^', byte + 64]),
+            32..=126 => writer.write_all(&[byte]),
+            127 => writer.write_all(&[b'^', b'?']),
+            128..=159 => writer.write_all(&[b'M', b'-', b'^', byte - 64]),
+            160..=254 => writer.write_all(&[b'M', b'-', byte - 128]),
+            _ => writer.write_all(&[b'M', b'-', b'^', b'?']),
         }
-        .unwrap();
-        count += 1;
+        .unwrap();
+        count += 1;
     }
-    count
+    count
 }
 
-#[cfg(test)]
-mod tests {
-    use std::io::{stdout, BufWriter};
+#[cfg(test)]
+mod tests {
+    use std::io::{stdout, BufWriter};
 
-    #[test]
-    fn test_write_nonprint_to_end_new_line() {
-        let mut writer = BufWriter::with_capacity(1024 * 64, stdout());
-        let in_buf = b"\n";
-        let tab = b"";
-        super::write_nonprint_to_end(in_buf, &mut writer, tab);
-        assert_eq!(writer.buffer().len(), 0);
+    #[test]
+    fn test_write_nonprint_to_end_new_line() {
+        let mut writer = BufWriter::with_capacity(1024 * 64, stdout());
+        let in_buf = b"\n";
+        let tab = b"";
+        super::write_nonprint_to_end(in_buf, &mut writer, tab);
+        assert_eq!(writer.buffer().len(), 0);
     }
 
-    #[test]
-    fn test_write_nonprint_to_end_9() {
-        let mut writer = BufWriter::with_capacity(1024 * 64, stdout());
-        let in_buf = &[9u8];
-        let tab = b"tab";
-        super::write_nonprint_to_end(in_buf, &mut writer, tab);
-        assert_eq!(writer.buffer(), tab);
+    #[test]
+    fn test_write_nonprint_to_end_9() {
+        let mut writer = BufWriter::with_capacity(1024 * 64, stdout());
+        let in_buf = &[9u8];
+        let tab = b"tab";
+        super::write_nonprint_to_end(in_buf, &mut writer, tab);
+        assert_eq!(writer.buffer(), tab);
     }
 
-    #[test]
-    fn test_write_nonprint_to_end_0_to_8() {
-        for byte in 0u8..=8u8 {
-            let mut writer = BufWriter::with_capacity(1024 * 64, stdout());
-            let in_buf = &[byte];
-            let tab = b"";
-            super::write_nonprint_to_end(in_buf, &mut writer, tab);
-            assert_eq!(writer.buffer(), [b'^', byte + 64]);
+    #[test]
+    fn test_write_nonprint_to_end_0_to_8() {
+        for byte in 0u8..=8u8 {
+            let mut writer = BufWriter::with_capacity(1024 * 64, stdout());
+            let in_buf = &[byte];
+            let tab = b"";
+            super::write_nonprint_to_end(in_buf, &mut writer, tab);
+            assert_eq!(writer.buffer(), [b'^', byte + 64]);
         }
     }
 
-    #[test]
-    fn test_write_nonprint_to_end_10_to_31() {
-        for byte in 11u8..=31u8 {
-            let mut writer = BufWriter::with_capacity(1024 * 64, stdout());
-            let in_buf = &[byte];
-            let tab = b"";
-            super::write_nonprint_to_end(in_buf, &mut writer, tab);
-            assert_eq!(writer.buffer(), [b'^', byte + 64]);
+    #[test]
+    fn test_write_nonprint_to_end_10_to_31() {
+        for byte in 11u8..=31u8 {
+            let mut writer = BufWriter::with_capacity(1024 * 64, stdout());
+            let in_buf = &[byte];
+            let tab = b"";
+            super::write_nonprint_to_end(in_buf, &mut writer, tab);
+            assert_eq!(writer.buffer(), [b'^', byte + 64]);
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_cat/splice.rs.html b/dev/src/uu_cat/splice.rs.html index fe589e5f3..3349f4ee8 100644 --- a/dev/src/uu_cat/splice.rs.html +++ b/dev/src/uu_cat/splice.rs.html @@ -1,4 +1,4 @@ -splice.rs - source
1
+splice.rs - source
1
 2
 3
 4
@@ -65,72 +65,72 @@
 65
 66
 67
-
use super::{CatResult, FdReadable, InputHandle};
+
use super::{CatResult, FdReadable, InputHandle};
 
-use nix::unistd;
-use std::os::unix::io::{AsRawFd, RawFd};
+use nix::unistd;
+use std::os::unix::io::{AsRawFd, RawFd};
 
-use uucore::pipes::{pipe, splice, splice_exact};
+use uucore::pipes::{pipe, splice, splice_exact};
 
-const SPLICE_SIZE: usize = 1024 * 128;
-const BUF_SIZE: usize = 1024 * 16;
+const SPLICE_SIZE: usize = 1024 * 128;
+const BUF_SIZE: usize = 1024 * 16;
 
-/// This function is called from `write_fast()` on Linux and Android. The
-/// function `splice()` is used to move data between two file descriptors
-/// without copying between kernel and user spaces. This results in a large
-/// speedup.
-///
-/// The `bool` in the result value indicates if we need to fall back to normal
-/// copying or not. False means we don't have to.
-#[inline]
-pub(super) fn write_fast_using_splice<R: FdReadable>(
-    handle: &mut InputHandle<R>,
-    write_fd: &impl AsRawFd,
-) -> CatResult<bool> {
-    let (pipe_rd, pipe_wr) = pipe()?;
+/// This function is called from `write_fast()` on Linux and Android. The
+/// function `splice()` is used to move data between two file descriptors
+/// without copying between kernel and user spaces. This results in a large
+/// speedup.
+///
+/// The `bool` in the result value indicates if we need to fall back to normal
+/// copying or not. False means we don't have to.
+#[inline]
+pub(super) fn write_fast_using_splice<R: FdReadable>(
+    handle: &mut InputHandle<R>,
+    write_fd: &impl AsRawFd,
+) -> CatResult<bool> {
+    let (pipe_rd, pipe_wr) = pipe()?;
 
-    loop {
-        match splice(&handle.reader, &pipe_wr, SPLICE_SIZE) {
-            Ok(n) => {
-                if n == 0 {
-                    return Ok(false);
+    loop {
+        match splice(&handle.reader, &pipe_wr, SPLICE_SIZE) {
+            Ok(n) => {
+                if n == 0 {
+                    return Ok(false);
                 }
-                if splice_exact(&pipe_rd, write_fd, n).is_err() {
-                    // If the first splice manages to copy to the intermediate
-                    // pipe, but the second splice to stdout fails for some reason
-                    // we can recover by copying the data that we have from the
-                    // intermediate pipe to stdout using normal read/write. Then
-                    // we tell the caller to fall back.
-                    copy_exact(pipe_rd.as_raw_fd(), write_fd.as_raw_fd(), n)?;
-                    return Ok(true);
+                if splice_exact(&pipe_rd, write_fd, n).is_err() {
+                    // If the first splice manages to copy to the intermediate
+                    // pipe, but the second splice to stdout fails for some reason
+                    // we can recover by copying the data that we have from the
+                    // intermediate pipe to stdout using normal read/write. Then
+                    // we tell the caller to fall back.
+                    copy_exact(pipe_rd.as_raw_fd(), write_fd.as_raw_fd(), n)?;
+                    return Ok(true);
                 }
             }
             Err(_) => {
-                return Ok(true);
+                return Ok(true);
             }
         }
     }
 }
 
-/// Move exactly `num_bytes` bytes from `read_fd` to `write_fd`.
-///
-/// Panics if not enough bytes can be read.
-fn copy_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<()> {
-    let mut left = num_bytes;
-    let mut buf = [0; BUF_SIZE];
-    while left > 0 {
-        let read = unistd::read(read_fd, &mut buf)?;
-        assert_ne!(read, 0, "unexpected end of pipe");
-        let mut written = 0;
-        while written < read {
-            match unistd::write(write_fd, &buf[written..read])? {
-                0 => panic!(),
-                n => written += n,
+/// Move exactly `num_bytes` bytes from `read_fd` to `write_fd`.
+///
+/// Panics if not enough bytes can be read.
+fn copy_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<()> {
+    let mut left = num_bytes;
+    let mut buf = [0; BUF_SIZE];
+    while left > 0 {
+        let read = unistd::read(read_fd, &mut buf)?;
+        assert_ne!(read, 0, "unexpected end of pipe");
+        let mut written = 0;
+        while written < read {
+            match unistd::write(write_fd, &buf[written..read])? {
+                0 => panic!(),
+                n => written += n,
             }
         }
-        left -= read;
+        left -= read;
     }
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_chcon/chcon.rs.html b/dev/src/uu_chcon/chcon.rs.html index 1ba7f02f3..2325f4239 100644 --- a/dev/src/uu_chcon/chcon.rs.html +++ b/dev/src/uu_chcon/chcon.rs.html @@ -1,4 +1,4 @@ -chcon.rs - source
1
+chcon.rs - source
1
 2
 3
 4
@@ -790,797 +790,797 @@
 790
 791
 792
-
// spell-checker:ignore (vars) RFILE
+
// spell-checker:ignore (vars) RFILE
 
-#![allow(clippy::upper_case_acronyms)]
+#![allow(clippy::upper_case_acronyms)]
 
-use clap::builder::ValueParser;
-use uucore::error::{UResult, USimpleError, UUsageError};
-use uucore::format_usage;
-use uucore::{display::Quotable, show_error, show_warning};
+use clap::builder::ValueParser;
+use uucore::error::{UResult, USimpleError, UUsageError};
+use uucore::format_usage;
+use uucore::{display::Quotable, show_error, show_warning};
 
-use clap::{Arg, ArgAction, Command};
-use selinux::{OpaqueSecurityContext, SecurityContext};
+use clap::{Arg, ArgAction, Command};
+use selinux::{OpaqueSecurityContext, SecurityContext};
 
-use std::borrow::Cow;
-use std::ffi::{CStr, CString, OsStr, OsString};
-use std::os::raw::c_int;
-use std::path::{Path, PathBuf};
-use std::{fs, io};
+use std::borrow::Cow;
+use std::ffi::{CStr, CString, OsStr, OsString};
+use std::os::raw::c_int;
+use std::path::{Path, PathBuf};
+use std::{fs, io};
 
-mod errors;
-mod fts;
+mod errors;
+mod fts;
 
-use errors::*;
+use errors::*;
 
-static VERSION: &str = env!("CARGO_PKG_VERSION");
-static ABOUT: &str = "Change the SELinux security context of each FILE to CONTEXT. \n\
+static VERSION: &str = env!("CARGO_PKG_VERSION");
+static ABOUT: &str = "Change the SELinux security context of each FILE to CONTEXT. \n\
                       With --reference, change the security context of each FILE to that of RFILE.";
-const USAGE: &str = "\
+const USAGE: &str = "\
     {} [OPTION]... CONTEXT FILE... \n    \
     {} [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE... \n    \
     {} [OPTION]... --reference=RFILE FILE...";
 
-pub mod options {
-    pub static HELP: &str = "help";
-    pub static VERBOSE: &str = "verbose";
+pub mod options {
+    pub static HELP: &str = "help";
+    pub static VERBOSE: &str = "verbose";
 
-    pub static REFERENCE: &str = "reference";
+    pub static REFERENCE: &str = "reference";
 
-    pub static USER: &str = "user";
-    pub static ROLE: &str = "role";
-    pub static TYPE: &str = "type";
-    pub static RANGE: &str = "range";
+    pub static USER: &str = "user";
+    pub static ROLE: &str = "role";
+    pub static TYPE: &str = "type";
+    pub static RANGE: &str = "range";
 
-    pub static RECURSIVE: &str = "recursive";
+    pub static RECURSIVE: &str = "recursive";
 
-    pub mod sym_links {
-        pub static FOLLOW_ARG_DIR_SYM_LINK: &str = "follow-arg-dir-sym-link";
-        pub static FOLLOW_DIR_SYM_LINKS: &str = "follow-dir-sym-links";
-        pub static NO_FOLLOW_SYM_LINKS: &str = "no-follow-sym-links";
+    pub mod sym_links {
+        pub static FOLLOW_ARG_DIR_SYM_LINK: &str = "follow-arg-dir-sym-link";
+        pub static FOLLOW_DIR_SYM_LINKS: &str = "follow-dir-sym-links";
+        pub static NO_FOLLOW_SYM_LINKS: &str = "no-follow-sym-links";
     }
 
-    pub mod dereference {
-        pub static DEREFERENCE: &str = "dereference";
-        pub static NO_DEREFERENCE: &str = "no-dereference";
+    pub mod dereference {
+        pub static DEREFERENCE: &str = "dereference";
+        pub static NO_DEREFERENCE: &str = "no-dereference";
     }
 
-    pub mod preserve_root {
-        pub static PRESERVE_ROOT: &str = "preserve-root";
-        pub static NO_PRESERVE_ROOT: &str = "no-preserve-root";
+    pub mod preserve_root {
+        pub static PRESERVE_ROOT: &str = "preserve-root";
+        pub static NO_PRESERVE_ROOT: &str = "no-preserve-root";
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let config = uu_app();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let config = uu_app();
 
-    let options = match parse_command_line(config, args) {
-        Ok(r) => r,
-        Err(r) => {
-            if let Error::CommandLine(r) = r {
-                return Err(r.into());
+    let options = match parse_command_line(config, args) {
+        Ok(r) => r,
+        Err(r) => {
+            if let Error::CommandLine(r) = r {
+                return Err(r.into());
             }
 
-            return Err(UUsageError::new(libc::EXIT_FAILURE, format!("{}.\n", r)));
+            return Err(UUsageError::new(libc::EXIT_FAILURE, format!("{}.\n", r)));
         }
     };
 
-    let context = match &options.mode {
-        CommandLineMode::ReferenceBased { reference } => {
-            let result = match SecurityContext::of_path(reference, true, false) {
-                Ok(Some(context)) => Ok(context),
+    let context = match &options.mode {
+        CommandLineMode::ReferenceBased { reference } => {
+            let result = match SecurityContext::of_path(reference, true, false) {
+                Ok(Some(context)) => Ok(context),
 
                 Ok(None) => {
-                    let err = io::Error::from_raw_os_error(libc::ENODATA);
-                    Err(Error::from_io1("Getting security context", reference, err))
+                    let err = io::Error::from_raw_os_error(libc::ENODATA);
+                    Err(Error::from_io1("Getting security context", reference, err))
                 }
 
-                Err(r) => Err(Error::from_selinux("Getting security context", r)),
+                Err(r) => Err(Error::from_selinux("Getting security context", r)),
             };
 
-            match result {
-                Err(r) => {
-                    return Err(USimpleError::new(
-                        libc::EXIT_FAILURE,
-                        format!("{}.", report_full_error(&r)),
+            match result {
+                Err(r) => {
+                    return Err(USimpleError::new(
+                        libc::EXIT_FAILURE,
+                        format!("{}.", report_full_error(&r)),
                     ));
                 }
 
-                Ok(file_context) => SELinuxSecurityContext::File(file_context),
+                Ok(file_context) => SELinuxSecurityContext::File(file_context),
             }
         }
 
-        CommandLineMode::ContextBased { context } => {
-            let c_context = match os_str_to_c_string(context) {
-                Ok(context) => context,
+        CommandLineMode::ContextBased { context } => {
+            let c_context = match os_str_to_c_string(context) {
+                Ok(context) => context,
 
-                Err(_r) => {
-                    return Err(USimpleError::new(
-                        libc::EXIT_FAILURE,
-                        format!("Invalid security context {}.", context.quote()),
+                Err(_r) => {
+                    return Err(USimpleError::new(
+                        libc::EXIT_FAILURE,
+                        format!("Invalid security context {}.", context.quote()),
                     ));
                 }
             };
 
-            if SecurityContext::from_c_str(&c_context, false).check() == Some(false) {
-                return Err(USimpleError::new(
-                    libc::EXIT_FAILURE,
-                    format!("Invalid security context {}.", context.quote()),
+            if SecurityContext::from_c_str(&c_context, false).check() == Some(false) {
+                return Err(USimpleError::new(
+                    libc::EXIT_FAILURE,
+                    format!("Invalid security context {}.", context.quote()),
                 ));
             }
 
-            SELinuxSecurityContext::String(Some(c_context))
+            SELinuxSecurityContext::String(Some(c_context))
         }
 
-        CommandLineMode::Custom { .. } => SELinuxSecurityContext::String(None),
+        CommandLineMode::Custom { .. } => SELinuxSecurityContext::String(None),
     };
 
-    let root_dev_ino = if options.preserve_root && options.recursive_mode.is_recursive() {
-        match get_root_dev_ino() {
-            Ok(r) => Some(r),
+    let root_dev_ino = if options.preserve_root && options.recursive_mode.is_recursive() {
+        match get_root_dev_ino() {
+            Ok(r) => Some(r),
 
-            Err(r) => {
-                return Err(USimpleError::new(
-                    libc::EXIT_FAILURE,
-                    format!("{}.", report_full_error(&r)),
+            Err(r) => {
+                return Err(USimpleError::new(
+                    libc::EXIT_FAILURE,
+                    format!("{}.", report_full_error(&r)),
                 ));
             }
         }
-    } else {
-        None
-    };
+    } else {
+        None
+    };
 
-    let results = process_files(&options, &context, root_dev_ino);
-    if results.is_empty() {
-        return Ok(());
+    let results = process_files(&options, &context, root_dev_ino);
+    if results.is_empty() {
+        return Ok(());
     }
 
-    for result in &results {
-        show_error!("{}.", report_full_error(result));
+    for result in &results {
+        show_error!("{}.", report_full_error(result));
     }
-    Err(libc::EXIT_FAILURE.into())
+    Err(libc::EXIT_FAILURE.into())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(VERSION)
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(VERSION)
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new(options::dereference::DEREFERENCE)
-                .long(options::dereference::DEREFERENCE)
-                .conflicts_with(options::dereference::NO_DEREFERENCE)
-                .help(
+        .arg(
+            Arg::new(options::dereference::DEREFERENCE)
+                .long(options::dereference::DEREFERENCE)
+                .conflicts_with(options::dereference::NO_DEREFERENCE)
+                .help(
                     "Affect the referent of each symbolic link (this is the default), \
                      rather than the symbolic link itself.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::dereference::NO_DEREFERENCE)
-                .short('h')
-                .long(options::dereference::NO_DEREFERENCE)
-                .help("Affect symbolic links instead of any referenced file.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::dereference::NO_DEREFERENCE)
+                .short('h')
+                .long(options::dereference::NO_DEREFERENCE)
+                .help("Affect symbolic links instead of any referenced file.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::preserve_root::PRESERVE_ROOT)
-                .long(options::preserve_root::PRESERVE_ROOT)
-                .conflicts_with(options::preserve_root::NO_PRESERVE_ROOT)
-                .help("Fail to operate recursively on '/'.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::preserve_root::PRESERVE_ROOT)
+                .long(options::preserve_root::PRESERVE_ROOT)
+                .conflicts_with(options::preserve_root::NO_PRESERVE_ROOT)
+                .help("Fail to operate recursively on '/'.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::preserve_root::NO_PRESERVE_ROOT)
-                .long(options::preserve_root::NO_PRESERVE_ROOT)
-                .help("Do not treat '/' specially (the default).")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::preserve_root::NO_PRESERVE_ROOT)
+                .long(options::preserve_root::NO_PRESERVE_ROOT)
+                .help("Do not treat '/' specially (the default).")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REFERENCE)
-                .long(options::REFERENCE)
-                .value_name("RFILE")
-                .value_hint(clap::ValueHint::FilePath)
-                .conflicts_with_all([options::USER, options::ROLE, options::TYPE, options::RANGE])
-                .help(
+        .arg(
+            Arg::new(options::REFERENCE)
+                .long(options::REFERENCE)
+                .value_name("RFILE")
+                .value_hint(clap::ValueHint::FilePath)
+                .conflicts_with_all([options::USER, options::ROLE, options::TYPE, options::RANGE])
+                .help(
                     "Use security context of RFILE, rather than specifying \
                      a CONTEXT value.",
                 )
-                .value_parser(ValueParser::os_string()),
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(options::USER)
-                .short('u')
-                .long(options::USER)
-                .value_name("USER")
-                .value_hint(clap::ValueHint::Username)
-                .help("Set user USER in the target security context.")
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new(options::USER)
+                .short('u')
+                .long(options::USER)
+                .value_name("USER")
+                .value_hint(clap::ValueHint::Username)
+                .help("Set user USER in the target security context.")
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(options::ROLE)
-                .short('r')
-                .long(options::ROLE)
-                .value_name("ROLE")
-                .help("Set role ROLE in the target security context.")
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new(options::ROLE)
+                .short('r')
+                .long(options::ROLE)
+                .value_name("ROLE")
+                .help("Set role ROLE in the target security context.")
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(options::TYPE)
-                .short('t')
-                .long(options::TYPE)
-                .value_name("TYPE")
-                .help("Set type TYPE in the target security context.")
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new(options::TYPE)
+                .short('t')
+                .long(options::TYPE)
+                .value_name("TYPE")
+                .help("Set type TYPE in the target security context.")
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(options::RANGE)
-                .short('l')
-                .long(options::RANGE)
-                .value_name("RANGE")
-                .help("Set range RANGE in the target security context.")
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new(options::RANGE)
+                .short('l')
+                .long(options::RANGE)
+                .value_name("RANGE")
+                .help("Set range RANGE in the target security context.")
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(options::RECURSIVE)
-                .short('R')
-                .long(options::RECURSIVE)
-                .help("Operate on files and directories recursively.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RECURSIVE)
+                .short('R')
+                .long(options::RECURSIVE)
+                .help("Operate on files and directories recursively.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::sym_links::FOLLOW_ARG_DIR_SYM_LINK)
-                .short('H')
-                .requires(options::RECURSIVE)
-                .overrides_with_all([
-                    options::sym_links::FOLLOW_DIR_SYM_LINKS,
-                    options::sym_links::NO_FOLLOW_SYM_LINKS,
+        .arg(
+            Arg::new(options::sym_links::FOLLOW_ARG_DIR_SYM_LINK)
+                .short('H')
+                .requires(options::RECURSIVE)
+                .overrides_with_all([
+                    options::sym_links::FOLLOW_DIR_SYM_LINKS,
+                    options::sym_links::NO_FOLLOW_SYM_LINKS,
                 ])
-                .help(
+                .help(
                     "If a command line argument is a symbolic link to a directory, \
                      traverse it. Only valid when -R is specified.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::sym_links::FOLLOW_DIR_SYM_LINKS)
-                .short('L')
-                .requires(options::RECURSIVE)
-                .overrides_with_all([
-                    options::sym_links::FOLLOW_ARG_DIR_SYM_LINK,
-                    options::sym_links::NO_FOLLOW_SYM_LINKS,
+        .arg(
+            Arg::new(options::sym_links::FOLLOW_DIR_SYM_LINKS)
+                .short('L')
+                .requires(options::RECURSIVE)
+                .overrides_with_all([
+                    options::sym_links::FOLLOW_ARG_DIR_SYM_LINK,
+                    options::sym_links::NO_FOLLOW_SYM_LINKS,
                 ])
-                .help(
+                .help(
                     "Traverse every symbolic link to a directory encountered. \
                      Only valid when -R is specified.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::sym_links::NO_FOLLOW_SYM_LINKS)
-                .short('P')
-                .requires(options::RECURSIVE)
-                .overrides_with_all([
-                    options::sym_links::FOLLOW_ARG_DIR_SYM_LINK,
-                    options::sym_links::FOLLOW_DIR_SYM_LINKS,
+        .arg(
+            Arg::new(options::sym_links::NO_FOLLOW_SYM_LINKS)
+                .short('P')
+                .requires(options::RECURSIVE)
+                .overrides_with_all([
+                    options::sym_links::FOLLOW_ARG_DIR_SYM_LINK,
+                    options::sym_links::FOLLOW_DIR_SYM_LINKS,
                 ])
-                .help(
+                .help(
                     "Do not traverse any symbolic links (default). \
                      Only valid when -R is specified.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::VERBOSE)
-                .short('v')
-                .long(options::VERBOSE)
-                .help("Output a diagnostic for every file processed.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::VERBOSE)
+                .short('v')
+                .long(options::VERBOSE)
+                .help("Output a diagnostic for every file processed.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("FILE")
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath)
-                .num_args(1..)
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new("FILE")
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath)
+                .num_args(1..)
+                .value_parser(ValueParser::os_string()),
         )
 }
 
-#[derive(Debug)]
-struct Options {
-    verbose: bool,
-    preserve_root: bool,
-    recursive_mode: RecursiveMode,
-    affect_symlink_referent: bool,
-    mode: CommandLineMode,
-    files: Vec<PathBuf>,
+#[derive(Debug)]
+struct Options {
+    verbose: bool,
+    preserve_root: bool,
+    recursive_mode: RecursiveMode,
+    affect_symlink_referent: bool,
+    mode: CommandLineMode,
+    files: Vec<PathBuf>,
 }
 
-fn parse_command_line(config: clap::Command, args: impl uucore::Args) -> Result<Options> {
-    let matches = config.try_get_matches_from(args)?;
+fn parse_command_line(config: clap::Command, args: impl uucore::Args) -> Result<Options> {
+    let matches = config.try_get_matches_from(args)?;
 
-    let verbose = matches.get_flag(options::VERBOSE);
+    let verbose = matches.get_flag(options::VERBOSE);
 
-    let (recursive_mode, affect_symlink_referent) = if matches.get_flag(options::RECURSIVE) {
-        if matches.get_flag(options::sym_links::FOLLOW_DIR_SYM_LINKS) {
-            if matches.get_flag(options::dereference::NO_DEREFERENCE) {
-                return Err(Error::ArgumentsMismatch(format!(
+    let (recursive_mode, affect_symlink_referent) = if matches.get_flag(options::RECURSIVE) {
+        if matches.get_flag(options::sym_links::FOLLOW_DIR_SYM_LINKS) {
+            if matches.get_flag(options::dereference::NO_DEREFERENCE) {
+                return Err(Error::ArgumentsMismatch(format!(
                     "'--{}' with '--{}' require '-P'",
-                    options::RECURSIVE,
-                    options::dereference::NO_DEREFERENCE
+                    options::RECURSIVE,
+                    options::dereference::NO_DEREFERENCE
                 )));
             }
 
-            (RecursiveMode::RecursiveAndFollowAllDirSymLinks, true)
-        } else if matches.get_flag(options::sym_links::FOLLOW_ARG_DIR_SYM_LINK) {
-            if matches.get_flag(options::dereference::NO_DEREFERENCE) {
-                return Err(Error::ArgumentsMismatch(format!(
+            (RecursiveMode::RecursiveAndFollowAllDirSymLinks, true)
+        } else if matches.get_flag(options::sym_links::FOLLOW_ARG_DIR_SYM_LINK) {
+            if matches.get_flag(options::dereference::NO_DEREFERENCE) {
+                return Err(Error::ArgumentsMismatch(format!(
                     "'--{}' with '--{}' require '-P'",
-                    options::RECURSIVE,
-                    options::dereference::NO_DEREFERENCE
+                    options::RECURSIVE,
+                    options::dereference::NO_DEREFERENCE
                 )));
             }
 
-            (RecursiveMode::RecursiveAndFollowArgDirSymLinks, true)
-        } else {
-            if matches.get_flag(options::dereference::DEREFERENCE) {
-                return Err(Error::ArgumentsMismatch(format!(
+            (RecursiveMode::RecursiveAndFollowArgDirSymLinks, true)
+        } else {
+            if matches.get_flag(options::dereference::DEREFERENCE) {
+                return Err(Error::ArgumentsMismatch(format!(
                     "'--{}' with '--{}' require either '-H' or '-L'",
-                    options::RECURSIVE,
-                    options::dereference::DEREFERENCE
+                    options::RECURSIVE,
+                    options::dereference::DEREFERENCE
                 )));
             }
 
-            (RecursiveMode::RecursiveButDoNotFollowSymLinks, false)
+            (RecursiveMode::RecursiveButDoNotFollowSymLinks, false)
         }
-    } else {
-        let no_dereference = matches.get_flag(options::dereference::NO_DEREFERENCE);
-        (RecursiveMode::NotRecursive, !no_dereference)
+    } else {
+        let no_dereference = matches.get_flag(options::dereference::NO_DEREFERENCE);
+        (RecursiveMode::NotRecursive, !no_dereference)
     };
 
-    // By default, do not preserve root.
-    let preserve_root = matches.get_flag(options::preserve_root::PRESERVE_ROOT);
+    // By default, do not preserve root.
+    let preserve_root = matches.get_flag(options::preserve_root::PRESERVE_ROOT);
 
-    let mut files = matches.get_many::<OsString>("FILE").unwrap_or_default();
+    let mut files = matches.get_many::<OsString>("FILE").unwrap_or_default();
 
-    let mode = if let Some(path) = matches.get_one::<OsString>(options::REFERENCE) {
-        CommandLineMode::ReferenceBased {
-            reference: PathBuf::from(path),
+    let mode = if let Some(path) = matches.get_one::<OsString>(options::REFERENCE) {
+        CommandLineMode::ReferenceBased {
+            reference: PathBuf::from(path),
         }
-    } else if matches.contains_id(options::USER)
-        || matches.contains_id(options::ROLE)
-        || matches.contains_id(options::TYPE)
-        || matches.contains_id(options::RANGE)
+    } else if matches.contains_id(options::USER)
+        || matches.contains_id(options::ROLE)
+        || matches.contains_id(options::TYPE)
+        || matches.contains_id(options::RANGE)
     {
-        CommandLineMode::Custom {
-            user: matches.get_one::<OsString>(options::USER).map(Into::into),
-            role: matches.get_one::<OsString>(options::ROLE).map(Into::into),
-            the_type: matches.get_one::<OsString>(options::TYPE).map(Into::into),
-            range: matches.get_one::<OsString>(options::RANGE).map(Into::into),
+        CommandLineMode::Custom {
+            user: matches.get_one::<OsString>(options::USER).map(Into::into),
+            role: matches.get_one::<OsString>(options::ROLE).map(Into::into),
+            the_type: matches.get_one::<OsString>(options::TYPE).map(Into::into),
+            range: matches.get_one::<OsString>(options::RANGE).map(Into::into),
         }
-    } else if let Some(context) = files.next() {
-        CommandLineMode::ContextBased {
-            context: context.into(),
+    } else if let Some(context) = files.next() {
+        CommandLineMode::ContextBased {
+            context: context.into(),
         }
-    } else {
-        return Err(Error::MissingContext);
+    } else {
+        return Err(Error::MissingContext);
     };
 
-    let files: Vec<_> = files.map(PathBuf::from).collect();
-    if files.is_empty() {
-        return Err(Error::MissingFiles);
+    let files: Vec<_> = files.map(PathBuf::from).collect();
+    if files.is_empty() {
+        return Err(Error::MissingFiles);
     }
 
-    Ok(Options {
-        verbose,
-        preserve_root,
-        recursive_mode,
-        affect_symlink_referent,
-        mode,
-        files,
+    Ok(Options {
+        verbose,
+        preserve_root,
+        recursive_mode,
+        affect_symlink_referent,
+        mode,
+        files,
     })
 }
 
-#[derive(Debug, Copy, Clone)]
-enum RecursiveMode {
-    NotRecursive,
-    /// Do not traverse any symbolic links.
-    RecursiveButDoNotFollowSymLinks,
-    /// Traverse every symbolic link to a directory encountered.
-    RecursiveAndFollowAllDirSymLinks,
-    /// If a command line argument is a symbolic link to a directory, traverse it.
-    RecursiveAndFollowArgDirSymLinks,
+#[derive(Debug, Copy, Clone)]
+enum RecursiveMode {
+    NotRecursive,
+    /// Do not traverse any symbolic links.
+    RecursiveButDoNotFollowSymLinks,
+    /// Traverse every symbolic link to a directory encountered.
+    RecursiveAndFollowAllDirSymLinks,
+    /// If a command line argument is a symbolic link to a directory, traverse it.
+    RecursiveAndFollowArgDirSymLinks,
 }
 
-impl RecursiveMode {
-    fn is_recursive(self) -> bool {
-        match self {
-            Self::NotRecursive => false,
+impl RecursiveMode {
+    fn is_recursive(self) -> bool {
+        match self {
+            Self::NotRecursive => false,
 
-            Self::RecursiveButDoNotFollowSymLinks
-            | Self::RecursiveAndFollowAllDirSymLinks
-            | Self::RecursiveAndFollowArgDirSymLinks => true,
+            Self::RecursiveButDoNotFollowSymLinks
+            | Self::RecursiveAndFollowAllDirSymLinks
+            | Self::RecursiveAndFollowArgDirSymLinks => true,
         }
     }
 
-    fn fts_open_options(self) -> c_int {
-        match self {
-            Self::NotRecursive | Self::RecursiveButDoNotFollowSymLinks => fts_sys::FTS_PHYSICAL,
+    fn fts_open_options(self) -> c_int {
+        match self {
+            Self::NotRecursive | Self::RecursiveButDoNotFollowSymLinks => fts_sys::FTS_PHYSICAL,
 
-            Self::RecursiveAndFollowAllDirSymLinks => fts_sys::FTS_LOGICAL,
+            Self::RecursiveAndFollowAllDirSymLinks => fts_sys::FTS_LOGICAL,
 
-            Self::RecursiveAndFollowArgDirSymLinks => {
-                fts_sys::FTS_PHYSICAL | fts_sys::FTS_COMFOLLOW
+            Self::RecursiveAndFollowArgDirSymLinks => {
+                fts_sys::FTS_PHYSICAL | fts_sys::FTS_COMFOLLOW
             }
         }
     }
 }
 
-#[derive(Debug)]
-enum CommandLineMode {
-    ReferenceBased {
-        reference: PathBuf,
+#[derive(Debug)]
+enum CommandLineMode {
+    ReferenceBased {
+        reference: PathBuf,
     },
-    ContextBased {
-        context: OsString,
+    ContextBased {
+        context: OsString,
     },
-    Custom {
-        user: Option<OsString>,
-        role: Option<OsString>,
-        the_type: Option<OsString>,
-        range: Option<OsString>,
+    Custom {
+        user: Option<OsString>,
+        role: Option<OsString>,
+        the_type: Option<OsString>,
+        range: Option<OsString>,
     },
 }
 
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-struct DeviceAndINode {
-    device_id: u64,
-    inode: u64,
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+struct DeviceAndINode {
+    device_id: u64,
+    inode: u64,
 }
 
-#[cfg(unix)]
-impl From<fs::Metadata> for DeviceAndINode {
-    fn from(md: fs::Metadata) -> Self {
-        use std::os::unix::fs::MetadataExt;
+#[cfg(unix)]
+impl From<fs::Metadata> for DeviceAndINode {
+    fn from(md: fs::Metadata) -> Self {
+        use std::os::unix::fs::MetadataExt;
 
-        Self {
-            device_id: md.dev(),
-            inode: md.ino(),
+        Self {
+            device_id: md.dev(),
+            inode: md.ino(),
         }
     }
 }
 
-impl TryFrom<&libc::stat> for DeviceAndINode {
-    type Error = Error;
+impl TryFrom<&libc::stat> for DeviceAndINode {
+    type Error = Error;
 
-    #[allow(clippy::useless_conversion)]
-    fn try_from(st: &libc::stat) -> Result<Self> {
-        let device_id = u64::try_from(st.st_dev).map_err(|_r| Error::OutOfRange)?;
-        let inode = u64::try_from(st.st_ino).map_err(|_r| Error::OutOfRange)?;
-        Ok(Self { device_id, inode })
+    #[allow(clippy::useless_conversion)]
+    fn try_from(st: &libc::stat) -> Result<Self> {
+        let device_id = u64::try_from(st.st_dev).map_err(|_r| Error::OutOfRange)?;
+        let inode = u64::try_from(st.st_ino).map_err(|_r| Error::OutOfRange)?;
+        Ok(Self { device_id, inode })
     }
 }
 
-fn process_files(
-    options: &Options,
-    context: &SELinuxSecurityContext,
-    root_dev_ino: Option<DeviceAndINode>,
-) -> Vec<Error> {
-    let fts_options = options.recursive_mode.fts_open_options();
-    let mut fts = match fts::FTS::new(options.files.iter(), fts_options) {
-        Ok(fts) => fts,
-        Err(err) => return vec![err],
+fn process_files(
+    options: &Options,
+    context: &SELinuxSecurityContext,
+    root_dev_ino: Option<DeviceAndINode>,
+) -> Vec<Error> {
+    let fts_options = options.recursive_mode.fts_open_options();
+    let mut fts = match fts::FTS::new(options.files.iter(), fts_options) {
+        Ok(fts) => fts,
+        Err(err) => return vec![err],
     };
 
-    let mut errors = Vec::default();
-    loop {
-        match fts.read_next_entry() {
+    let mut errors = Vec::default();
+    loop {
+        match fts.read_next_entry() {
             Ok(true) => {
-                if let Err(err) = process_file(options, context, &mut fts, root_dev_ino) {
-                    errors.push(err);
+                if let Err(err) = process_file(options, context, &mut fts, root_dev_ino) {
+                    errors.push(err);
                 }
             }
 
             Ok(false) => break,
 
-            Err(err) => {
-                errors.push(err);
+            Err(err) => {
+                errors.push(err);
                 break;
             }
         }
     }
-    errors
+    errors
 }
 
-fn process_file(
-    options: &Options,
-    context: &SELinuxSecurityContext,
-    fts: &mut fts::FTS,
-    root_dev_ino: Option<DeviceAndINode>,
-) -> Result<()> {
-    let mut entry = fts.last_entry_ref().unwrap();
+fn process_file(
+    options: &Options,
+    context: &SELinuxSecurityContext,
+    fts: &mut fts::FTS,
+    root_dev_ino: Option<DeviceAndINode>,
+) -> Result<()> {
+    let mut entry = fts.last_entry_ref().unwrap();
 
-    let file_full_name = entry.path().map(PathBuf::from).ok_or_else(|| {
-        Error::from_io("File name validation", io::ErrorKind::InvalidInput.into())
+    let file_full_name = entry.path().map(PathBuf::from).ok_or_else(|| {
+        Error::from_io("File name validation", io::ErrorKind::InvalidInput.into())
     })?;
 
-    let fts_access_path = entry.access_path().ok_or_else(|| {
-        let err = io::ErrorKind::InvalidInput.into();
-        Error::from_io1("File name validation", &file_full_name, err)
+    let fts_access_path = entry.access_path().ok_or_else(|| {
+        let err = io::ErrorKind::InvalidInput.into();
+        Error::from_io1("File name validation", &file_full_name, err)
     })?;
 
-    let err = |s, k: io::ErrorKind| Error::from_io1(s, &file_full_name, k.into());
+    let err = |s, k: io::ErrorKind| Error::from_io1(s, &file_full_name, k.into());
 
-    let fts_err = |s| {
-        let r = io::Error::from_raw_os_error(entry.errno());
-        Err(Error::from_io1(s, &file_full_name, r))
+    let fts_err = |s| {
+        let r = io::Error::from_raw_os_error(entry.errno());
+        Err(Error::from_io1(s, &file_full_name, r))
     };
 
-    // SAFETY: If `entry.fts_statp` is not null, then is is assumed to be valid.
-    let file_dev_ino: DeviceAndINode = if let Some(st) = entry.stat() {
-        st.try_into()?
-    } else {
-        return Err(err("Getting meta data", io::ErrorKind::InvalidInput));
+    // SAFETY: If `entry.fts_statp` is not null, then is is assumed to be valid.
+    let file_dev_ino: DeviceAndINode = if let Some(st) = entry.stat() {
+        st.try_into()?
+    } else {
+        return Err(err("Getting meta data", io::ErrorKind::InvalidInput));
     };
 
-    let mut result = Ok(());
+    let mut result = Ok(());
 
-    match entry.flags() {
-        fts_sys::FTS_D => {
-            if options.recursive_mode.is_recursive() {
-                if root_dev_ino_check(root_dev_ino, file_dev_ino) {
-                    // This happens e.g., with "chcon -R --preserve-root ... /"
-                    // and with "chcon -RH --preserve-root ... symlink-to-root".
-                    root_dev_ino_warn(&file_full_name);
+    match entry.flags() {
+        fts_sys::FTS_D => {
+            if options.recursive_mode.is_recursive() {
+                if root_dev_ino_check(root_dev_ino, file_dev_ino) {
+                    // This happens e.g., with "chcon -R --preserve-root ... /"
+                    // and with "chcon -RH --preserve-root ... symlink-to-root".
+                    root_dev_ino_warn(&file_full_name);
 
-                    // Tell fts not to traverse into this hierarchy.
-                    let _ignored = fts.set(fts_sys::FTS_SKIP);
+                    // Tell fts not to traverse into this hierarchy.
+                    let _ignored = fts.set(fts_sys::FTS_SKIP);
 
-                    // Ensure that we do not process "/" on the second visit.
-                    let _ignored = fts.read_next_entry();
+                    // Ensure that we do not process "/" on the second visit.
+                    let _ignored = fts.read_next_entry();
 
-                    return Err(err("Modifying root path", io::ErrorKind::PermissionDenied));
+                    return Err(err("Modifying root path", io::ErrorKind::PermissionDenied));
                 }
 
-                return Ok(());
+                return Ok(());
             }
         }
 
-        fts_sys::FTS_DP => {
-            if !options.recursive_mode.is_recursive() {
-                return Ok(());
+        fts_sys::FTS_DP => {
+            if !options.recursive_mode.is_recursive() {
+                return Ok(());
             }
         }
 
-        fts_sys::FTS_NS => {
-            // For a top-level file or directory, this FTS_NS (stat failed) indicator is determined
-            // at the time of the initial fts_open call. With programs like chmod, chown, and chgrp,
-            // that modify permissions, it is possible that the file in question is accessible when
-            // control reaches this point. So, if this is the first time we've seen the FTS_NS for
-            // this file, tell fts_read to stat it "again".
-            if entry.level() == 0 && entry.number() == 0 {
-                entry.set_number(1);
-                let _ignored = fts.set(fts_sys::FTS_AGAIN);
-                return Ok(());
+        fts_sys::FTS_NS => {
+            // For a top-level file or directory, this FTS_NS (stat failed) indicator is determined
+            // at the time of the initial fts_open call. With programs like chmod, chown, and chgrp,
+            // that modify permissions, it is possible that the file in question is accessible when
+            // control reaches this point. So, if this is the first time we've seen the FTS_NS for
+            // this file, tell fts_read to stat it "again".
+            if entry.level() == 0 && entry.number() == 0 {
+                entry.set_number(1);
+                let _ignored = fts.set(fts_sys::FTS_AGAIN);
+                return Ok(());
             }
 
-            result = fts_err("Accessing");
+            result = fts_err("Accessing");
         }
 
-        fts_sys::FTS_ERR => result = fts_err("Accessing"),
+        fts_sys::FTS_ERR => result = fts_err("Accessing"),
 
-        fts_sys::FTS_DNR => result = fts_err("Reading directory"),
+        fts_sys::FTS_DNR => result = fts_err("Reading directory"),
 
-        fts_sys::FTS_DC => {
-            if cycle_warning_required(options.recursive_mode.fts_open_options(), &entry) {
-                emit_cycle_warning(&file_full_name);
-                return Err(err("Reading cyclic directory", io::ErrorKind::InvalidData));
+        fts_sys::FTS_DC => {
+            if cycle_warning_required(options.recursive_mode.fts_open_options(), &entry) {
+                emit_cycle_warning(&file_full_name);
+                return Err(err("Reading cyclic directory", io::ErrorKind::InvalidData));
             }
         }
 
-        _ => {}
+        _ => {}
     }
 
-    if entry.flags() == fts_sys::FTS_DP
-        && result.is_ok()
-        && root_dev_ino_check(root_dev_ino, file_dev_ino)
+    if entry.flags() == fts_sys::FTS_DP
+        && result.is_ok()
+        && root_dev_ino_check(root_dev_ino, file_dev_ino)
     {
-        root_dev_ino_warn(&file_full_name);
-        result = Err(err("Modifying root path", io::ErrorKind::PermissionDenied));
+        root_dev_ino_warn(&file_full_name);
+        result = Err(err("Modifying root path", io::ErrorKind::PermissionDenied));
     }
 
-    if result.is_ok() {
-        if options.verbose {
+    if result.is_ok() {
+        if options.verbose {
             println!(
                 "{}: Changing security context of: {}",
-                uucore::util_name(),
-                file_full_name.quote()
+                uucore::util_name(),
+                file_full_name.quote()
             );
         }
 
-        result = change_file_context(options, context, fts_access_path);
+        result = change_file_context(options, context, fts_access_path);
     }
 
-    if !options.recursive_mode.is_recursive() {
-        let _ignored = fts.set(fts_sys::FTS_SKIP);
+    if !options.recursive_mode.is_recursive() {
+        let _ignored = fts.set(fts_sys::FTS_SKIP);
     }
-    result
+    result
 }
 
-fn change_file_context(
-    options: &Options,
-    context: &SELinuxSecurityContext,
-    path: &Path,
-) -> Result<()> {
-    match &options.mode {
-        CommandLineMode::Custom {
-            user,
-            role,
-            the_type,
-            range,
+fn change_file_context(
+    options: &Options,
+    context: &SELinuxSecurityContext,
+    path: &Path,
+) -> Result<()> {
+    match &options.mode {
+        CommandLineMode::Custom {
+            user,
+            role,
+            the_type,
+            range,
         } => {
-            let err0 = || -> Result<()> {
-                // If the file doesn't have a context, and we're not setting all of the context
-                // components, there isn't really an obvious default. Thus, we just give up.
-                let op = "Applying partial security context to unlabeled file";
-                let err = io::ErrorKind::InvalidInput.into();
-                Err(Error::from_io1(op, path, err))
+            let err0 = || -> Result<()> {
+                // If the file doesn't have a context, and we're not setting all of the context
+                // components, there isn't really an obvious default. Thus, we just give up.
+                let op = "Applying partial security context to unlabeled file";
+                let err = io::ErrorKind::InvalidInput.into();
+                Err(Error::from_io1(op, path, err))
             };
 
-            let file_context =
-                match SecurityContext::of_path(path, options.affect_symlink_referent, false) {
-                    Ok(Some(context)) => context,
+            let file_context =
+                match SecurityContext::of_path(path, options.affect_symlink_referent, false) {
+                    Ok(Some(context)) => context,
 
-                    Ok(None) => return err0(),
-                    Err(r) => return Err(Error::from_selinux("Getting security context", r)),
+                    Ok(None) => return err0(),
+                    Err(r) => return Err(Error::from_selinux("Getting security context", r)),
                 };
 
-            let c_file_context = match file_context.to_c_string() {
-                Ok(Some(context)) => context,
+            let c_file_context = match file_context.to_c_string() {
+                Ok(Some(context)) => context,
 
-                Ok(None) => return err0(),
-                Err(r) => return Err(Error::from_selinux("Getting security context", r)),
+                Ok(None) => return err0(),
+                Err(r) => return Err(Error::from_selinux("Getting security context", r)),
             };
 
-            let se_context =
-                OpaqueSecurityContext::from_c_str(c_file_context.as_ref()).map_err(|_r| {
-                    let err = io::ErrorKind::InvalidInput.into();
-                    Error::from_io1("Creating security context", path, err)
+            let se_context =
+                OpaqueSecurityContext::from_c_str(c_file_context.as_ref()).map_err(|_r| {
+                    let err = io::ErrorKind::InvalidInput.into();
+                    Error::from_io1("Creating security context", path, err)
                 })?;
 
-            type SetValueProc = fn(&OpaqueSecurityContext, &CStr) -> selinux::errors::Result<()>;
+            type SetValueProc = fn(&OpaqueSecurityContext, &CStr) -> selinux::errors::Result<()>;
 
-            let list: &[(&Option<OsString>, SetValueProc)] = &[
-                (user, OpaqueSecurityContext::set_user),
-                (role, OpaqueSecurityContext::set_role),
-                (the_type, OpaqueSecurityContext::set_type),
-                (range, OpaqueSecurityContext::set_range),
+            let list: &[(&Option<OsString>, SetValueProc)] = &[
+                (user, OpaqueSecurityContext::set_user),
+                (role, OpaqueSecurityContext::set_role),
+                (the_type, OpaqueSecurityContext::set_type),
+                (range, OpaqueSecurityContext::set_range),
             ];
 
-            for (new_value, set_value_proc) in list {
-                if let Some(new_value) = new_value {
-                    let c_new_value = os_str_to_c_string(new_value).map_err(|_r| {
-                        let err = io::ErrorKind::InvalidInput.into();
-                        Error::from_io1("Creating security context", path, err)
+            for (new_value, set_value_proc) in list {
+                if let Some(new_value) = new_value {
+                    let c_new_value = os_str_to_c_string(new_value).map_err(|_r| {
+                        let err = io::ErrorKind::InvalidInput.into();
+                        Error::from_io1("Creating security context", path, err)
                     })?;
 
-                    set_value_proc(&se_context, &c_new_value)
-                        .map_err(|r| Error::from_selinux("Setting security context user", r))?;
+                    set_value_proc(&se_context, &c_new_value)
+                        .map_err(|r| Error::from_selinux("Setting security context user", r))?;
                 }
             }
 
-            let context_string = se_context
-                .to_c_string()
-                .map_err(|r| Error::from_selinux("Getting security context", r))?;
+            let context_string = se_context
+                .to_c_string()
+                .map_err(|r| Error::from_selinux("Getting security context", r))?;
 
-            if c_file_context.as_ref().to_bytes() == context_string.as_ref().to_bytes() {
-                Ok(()) // Nothing to change.
-            } else {
-                SecurityContext::from_c_str(&context_string, false)
-                    .set_for_path(path, options.affect_symlink_referent, false)
-                    .map_err(|r| Error::from_selinux("Setting security context", r))
+            if c_file_context.as_ref().to_bytes() == context_string.as_ref().to_bytes() {
+                Ok(()) // Nothing to change.
+            } else {
+                SecurityContext::from_c_str(&context_string, false)
+                    .set_for_path(path, options.affect_symlink_referent, false)
+                    .map_err(|r| Error::from_selinux("Setting security context", r))
             }
         }
 
-        CommandLineMode::ReferenceBased { .. } | CommandLineMode::ContextBased { .. } => {
-            if let Some(c_context) = context.to_c_string()? {
-                SecurityContext::from_c_str(c_context.as_ref(), false)
-                    .set_for_path(path, options.affect_symlink_referent, false)
-                    .map_err(|r| Error::from_selinux("Setting security context", r))
-            } else {
-                let err = io::ErrorKind::InvalidInput.into();
-                Err(Error::from_io1("Setting security context", path, err))
+        CommandLineMode::ReferenceBased { .. } | CommandLineMode::ContextBased { .. } => {
+            if let Some(c_context) = context.to_c_string()? {
+                SecurityContext::from_c_str(c_context.as_ref(), false)
+                    .set_for_path(path, options.affect_symlink_referent, false)
+                    .map_err(|r| Error::from_selinux("Setting security context", r))
+            } else {
+                let err = io::ErrorKind::InvalidInput.into();
+                Err(Error::from_io1("Setting security context", path, err))
             }
         }
     }
 }
 
-#[cfg(unix)]
-pub(crate) fn os_str_to_c_string(s: &OsStr) -> Result<CString> {
-    use std::os::unix::ffi::OsStrExt;
+#[cfg(unix)]
+pub(crate) fn os_str_to_c_string(s: &OsStr) -> Result<CString> {
+    use std::os::unix::ffi::OsStrExt;
 
-    CString::new(s.as_bytes())
-        .map_err(|_r| Error::from_io("CString::new()", io::ErrorKind::InvalidInput.into()))
+    CString::new(s.as_bytes())
+        .map_err(|_r| Error::from_io("CString::new()", io::ErrorKind::InvalidInput.into()))
 }
 
-/// Call `lstat()` to get the device and inode numbers for `/`.
-#[cfg(unix)]
-fn get_root_dev_ino() -> Result<DeviceAndINode> {
-    fs::symlink_metadata("/")
-        .map(DeviceAndINode::from)
-        .map_err(|r| Error::from_io1("std::fs::symlink_metadata", "/", r))
+/// Call `lstat()` to get the device and inode numbers for `/`.
+#[cfg(unix)]
+fn get_root_dev_ino() -> Result<DeviceAndINode> {
+    fs::symlink_metadata("/")
+        .map(DeviceAndINode::from)
+        .map_err(|r| Error::from_io1("std::fs::symlink_metadata", "/", r))
 }
 
-fn root_dev_ino_check(root_dev_ino: Option<DeviceAndINode>, dir_dev_ino: DeviceAndINode) -> bool {
-    root_dev_ino.map_or(false, |root_dev_ino| root_dev_ino == dir_dev_ino)
+fn root_dev_ino_check(root_dev_ino: Option<DeviceAndINode>, dir_dev_ino: DeviceAndINode) -> bool {
+    root_dev_ino.map_or(false, |root_dev_ino| root_dev_ino == dir_dev_ino)
 }
 
-fn root_dev_ino_warn(dir_name: &Path) {
-    if dir_name.as_os_str() == "/" {
+fn root_dev_ino_warn(dir_name: &Path) {
+    if dir_name.as_os_str() == "/" {
         show_warning!(
             "It is dangerous to operate recursively on '/'. \
              Use --{} to override this failsafe.",
-            options::preserve_root::NO_PRESERVE_ROOT,
+            options::preserve_root::NO_PRESERVE_ROOT,
         );
-    } else {
+    } else {
         show_warning!(
             "It is dangerous to operate recursively on {} (same as '/'). \
              Use --{} to override this failsafe.",
-            dir_name.quote(),
-            options::preserve_root::NO_PRESERVE_ROOT,
+            dir_name.quote(),
+            options::preserve_root::NO_PRESERVE_ROOT,
         );
     }
 }
 
-// When fts_read returns FTS_DC to indicate a directory cycle, it may or may not indicate
-// a real problem.
-// When a program like chgrp performs a recursive traversal that requires traversing symbolic links,
-// it is *not* a problem.
-// However, when invoked with "-P -R", it deserves a warning.
-// The fts_options parameter records the options that control this aspect of fts behavior,
-// so test that.
-fn cycle_warning_required(fts_options: c_int, entry: &fts::EntryRef) -> bool {
-    // When dereferencing no symlinks, or when dereferencing only those listed on the command line
-    // and we're not processing a command-line argument, then a cycle is a serious problem.
-    ((fts_options & fts_sys::FTS_PHYSICAL) != 0)
-        && (((fts_options & fts_sys::FTS_COMFOLLOW) == 0) || entry.level() != 0)
+// When fts_read returns FTS_DC to indicate a directory cycle, it may or may not indicate
+// a real problem.
+// When a program like chgrp performs a recursive traversal that requires traversing symbolic links,
+// it is *not* a problem.
+// However, when invoked with "-P -R", it deserves a warning.
+// The fts_options parameter records the options that control this aspect of fts behavior,
+// so test that.
+fn cycle_warning_required(fts_options: c_int, entry: &fts::EntryRef) -> bool {
+    // When dereferencing no symlinks, or when dereferencing only those listed on the command line
+    // and we're not processing a command-line argument, then a cycle is a serious problem.
+    ((fts_options & fts_sys::FTS_PHYSICAL) != 0)
+        && (((fts_options & fts_sys::FTS_COMFOLLOW) == 0) || entry.level() != 0)
 }
 
-fn emit_cycle_warning(file_name: &Path) {
+fn emit_cycle_warning(file_name: &Path) {
     show_warning!(
         "Circular directory structure.\n\
 This almost certainly means that you have a corrupted file system.\n\
 NOTIFY YOUR SYSTEM MANAGER.\n\
 The following directory is part of the cycle {}.",
-        file_name.quote()
+        file_name.quote()
     );
 }
 
-#[derive(Debug)]
-enum SELinuxSecurityContext<'t> {
-    File(SecurityContext<'t>),
-    String(Option<CString>),
+#[derive(Debug)]
+enum SELinuxSecurityContext<'t> {
+    File(SecurityContext<'t>),
+    String(Option<CString>),
 }
 
-impl<'t> SELinuxSecurityContext<'t> {
-    fn to_c_string(&self) -> Result<Option<Cow<CStr>>> {
-        match self {
-            Self::File(context) => context
-                .to_c_string()
-                .map_err(|r| Error::from_selinux("SELinuxSecurityContext::to_c_string()", r)),
+impl<'t> SELinuxSecurityContext<'t> {
+    fn to_c_string(&self) -> Result<Option<Cow<CStr>>> {
+        match self {
+            Self::File(context) => context
+                .to_c_string()
+                .map_err(|r| Error::from_selinux("SELinuxSecurityContext::to_c_string()", r)),
 
-            Self::String(context) => Ok(context.as_deref().map(Cow::Borrowed)),
+            Self::String(context) => Ok(context.as_deref().map(Cow::Borrowed)),
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_chcon/errors.rs.html b/dev/src/uu_chcon/errors.rs.html index 92df8ac28..72140cef0 100644 --- a/dev/src/uu_chcon/errors.rs.html +++ b/dev/src/uu_chcon/errors.rs.html @@ -1,4 +1,4 @@ -errors.rs - source
1
+errors.rs - source
1
 2
 3
 4
@@ -74,81 +74,81 @@
 74
 75
 76
-
use std::ffi::OsString;
-use std::fmt::Write;
-use std::io;
+
use std::ffi::OsString;
+use std::fmt::Write;
+use std::io;
 
-use uucore::display::Quotable;
+use uucore::display::Quotable;
 
-pub(crate) type Result<T> = std::result::Result<T, Error>;
+pub(crate) type Result<T> = std::result::Result<T, Error>;
 
-#[derive(thiserror::Error, Debug)]
-pub(crate) enum Error {
-    #[error("No context is specified")]
-    MissingContext,
+#[derive(thiserror::Error, Debug)]
+pub(crate) enum Error {
+    #[error("No context is specified")]
+    MissingContext,
 
-    #[error("No files are specified")]
-    MissingFiles,
+    #[error("No files are specified")]
+    MissingFiles,
 
-    #[error("Data is out of range")]
-    OutOfRange,
+    #[error("Data is out of range")]
+    OutOfRange,
 
-    #[error("{0}")]
-    ArgumentsMismatch(String),
+    #[error("{0}")]
+    ArgumentsMismatch(String),
 
-    #[error(transparent)]
-    CommandLine(#[from] clap::Error),
+    #[error(transparent)]
+    CommandLine(#[from] clap::Error),
 
-    #[error("{operation} failed")]
-    SELinux {
-        operation: &'static str,
-        source: selinux::errors::Error,
+    #[error("{operation} failed")]
+    SELinux {
+        operation: &'static str,
+        source: selinux::errors::Error,
     },
 
-    #[error("{operation} failed")]
-    Io {
-        operation: &'static str,
-        source: io::Error,
+    #[error("{operation} failed")]
+    Io {
+        operation: &'static str,
+        source: io::Error,
     },
 
-    #[error("{operation} failed on {}", .operand1.quote())]
-    Io1 {
-        operation: &'static str,
-        operand1: OsString,
-        source: io::Error,
+    #[error("{operation} failed on {}", .operand1.quote())]
+    Io1 {
+        operation: &'static str,
+        operand1: OsString,
+        source: io::Error,
     },
 }
 
-impl Error {
-    pub(crate) fn from_io(operation: &'static str, source: io::Error) -> Self {
-        Self::Io { operation, source }
+impl Error {
+    pub(crate) fn from_io(operation: &'static str, source: io::Error) -> Self {
+        Self::Io { operation, source }
     }
 
-    pub(crate) fn from_io1(
-        operation: &'static str,
-        operand1: impl Into<OsString>,
-        source: io::Error,
-    ) -> Self {
-        Self::Io1 {
-            operation,
-            operand1: operand1.into(),
-            source,
+    pub(crate) fn from_io1(
+        operation: &'static str,
+        operand1: impl Into<OsString>,
+        source: io::Error,
+    ) -> Self {
+        Self::Io1 {
+            operation,
+            operand1: operand1.into(),
+            source,
         }
     }
 
-    pub(crate) fn from_selinux(operation: &'static str, source: selinux::errors::Error) -> Self {
-        Self::SELinux { operation, source }
+    pub(crate) fn from_selinux(operation: &'static str, source: selinux::errors::Error) -> Self {
+        Self::SELinux { operation, source }
     }
 }
 
-pub(crate) fn report_full_error(mut err: &dyn std::error::Error) -> String {
-    let mut desc = String::with_capacity(256);
-    write!(desc, "{}", err).unwrap();
-    while let Some(source) = err.source() {
-        err = source;
-        write!(desc, ". {}", err).unwrap();
+pub(crate) fn report_full_error(mut err: &dyn std::error::Error) -> String {
+    let mut desc = String::with_capacity(256);
+    write!(desc, "{}", err).unwrap();
+    while let Some(source) = err.source() {
+        err = source;
+        write!(desc, ". {}", err).unwrap();
     }
-    desc
+    desc
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_chcon/fts.rs.html b/dev/src/uu_chcon/fts.rs.html index 6de7fe47a..e5d5349c5 100644 --- a/dev/src/uu_chcon/fts.rs.html +++ b/dev/src/uu_chcon/fts.rs.html @@ -1,4 +1,4 @@ -fts.rs - source
1
+fts.rs - source
1
 2
 3
 4
@@ -191,198 +191,198 @@
 191
 192
 193
-
use std::ffi::{CStr, CString, OsStr};
-use std::marker::PhantomData;
-use std::os::raw::{c_int, c_long, c_short};
-use std::path::Path;
-use std::ptr::NonNull;
-use std::{io, iter, ptr, slice};
+
use std::ffi::{CStr, CString, OsStr};
+use std::marker::PhantomData;
+use std::os::raw::{c_int, c_long, c_short};
+use std::path::Path;
+use std::ptr::NonNull;
+use std::{io, iter, ptr, slice};
 
-use crate::errors::{Error, Result};
-use crate::os_str_to_c_string;
+use crate::errors::{Error, Result};
+use crate::os_str_to_c_string;
 
-#[derive(Debug)]
-pub(crate) struct FTS {
-    fts: ptr::NonNull<fts_sys::FTS>,
+#[derive(Debug)]
+pub(crate) struct FTS {
+    fts: ptr::NonNull<fts_sys::FTS>,
 
-    entry: Option<ptr::NonNull<fts_sys::FTSENT>>,
-    _phantom_data: PhantomData<fts_sys::FTSENT>,
+    entry: Option<ptr::NonNull<fts_sys::FTSENT>>,
+    _phantom_data: PhantomData<fts_sys::FTSENT>,
 }
 
-impl FTS {
-    pub(crate) fn new<I>(paths: I, options: c_int) -> Result<Self>
-    where
-        I: IntoIterator,
-        I::Item: AsRef<OsStr>,
+impl FTS {
+    pub(crate) fn new<I>(paths: I, options: c_int) -> Result<Self>
+    where
+        I: IntoIterator,
+        I::Item: AsRef<OsStr>,
     {
-        let files_paths: Vec<CString> = paths
-            .into_iter()
-            .map(|s| os_str_to_c_string(s.as_ref()))
-            .collect::<Result<_>>()?;
+        let files_paths: Vec<CString> = paths
+            .into_iter()
+            .map(|s| os_str_to_c_string(s.as_ref()))
+            .collect::<Result<_>>()?;
 
-        if files_paths.is_empty() {
-            return Err(Error::from_io(
+        if files_paths.is_empty() {
+            return Err(Error::from_io(
                 "FTS::new()",
-                io::ErrorKind::InvalidInput.into(),
+                io::ErrorKind::InvalidInput.into(),
             ));
         }
 
-        let path_argv: Vec<_> = files_paths
-            .iter()
-            .map(CString::as_ref)
-            .map(CStr::as_ptr)
-            .chain(iter::once(ptr::null()))
-            .collect();
+        let path_argv: Vec<_> = files_paths
+            .iter()
+            .map(CString::as_ref)
+            .map(CStr::as_ptr)
+            .chain(iter::once(ptr::null()))
+            .collect();
 
-        // SAFETY: We assume calling fts_open() is safe:
-        // - `path_argv` is an array holding at least one path, and null-terminated.
-        // - `compar` is None.
-        let fts = unsafe { fts_sys::fts_open(path_argv.as_ptr().cast(), options, None) };
+        // SAFETY: We assume calling fts_open() is safe:
+        // - `path_argv` is an array holding at least one path, and null-terminated.
+        // - `compar` is None.
+        let fts = unsafe { fts_sys::fts_open(path_argv.as_ptr().cast(), options, None) };
 
-        let fts = ptr::NonNull::new(fts)
-            .ok_or_else(|| Error::from_io("fts_open()", io::Error::last_os_error()))?;
+        let fts = ptr::NonNull::new(fts)
+            .ok_or_else(|| Error::from_io("fts_open()", io::Error::last_os_error()))?;
 
-        Ok(Self {
-            fts,
-            entry: None,
-            _phantom_data: PhantomData,
+        Ok(Self {
+            fts,
+            entry: None,
+            _phantom_data: PhantomData,
         })
     }
 
-    pub(crate) fn last_entry_ref(&mut self) -> Option<EntryRef> {
-        self.entry.map(move |entry| EntryRef::new(self, entry))
+    pub(crate) fn last_entry_ref(&mut self) -> Option<EntryRef> {
+        self.entry.map(move |entry| EntryRef::new(self, entry))
     }
 
-    pub(crate) fn read_next_entry(&mut self) -> Result<bool> {
-        // SAFETY: We assume calling fts_read() is safe with a non-null `fts`
-        // pointer assumed to be valid.
-        let new_entry = unsafe { fts_sys::fts_read(self.fts.as_ptr()) };
+    pub(crate) fn read_next_entry(&mut self) -> Result<bool> {
+        // SAFETY: We assume calling fts_read() is safe with a non-null `fts`
+        // pointer assumed to be valid.
+        let new_entry = unsafe { fts_sys::fts_read(self.fts.as_ptr()) };
 
-        self.entry = NonNull::new(new_entry);
-        if self.entry.is_none() {
-            let r = io::Error::last_os_error();
-            if let Some(0) = r.raw_os_error() {
+        self.entry = NonNull::new(new_entry);
+        if self.entry.is_none() {
+            let r = io::Error::last_os_error();
+            if let Some(0) = r.raw_os_error() {
                 Ok(false)
-            } else {
-                Err(Error::from_io("fts_read()", r))
+            } else {
+                Err(Error::from_io("fts_read()", r))
             }
-        } else {
+        } else {
             Ok(true)
         }
     }
 
-    pub(crate) fn set(&mut self, instr: c_int) -> Result<()> {
-        let fts = self.fts.as_ptr();
-        let entry = self
-            .entry
-            .ok_or_else(|| Error::from_io("FTS::set()", io::ErrorKind::UnexpectedEof.into()))?;
+    pub(crate) fn set(&mut self, instr: c_int) -> Result<()> {
+        let fts = self.fts.as_ptr();
+        let entry = self
+            .entry
+            .ok_or_else(|| Error::from_io("FTS::set()", io::ErrorKind::UnexpectedEof.into()))?;
 
-        // SAFETY: We assume calling fts_set() is safe with non-null `fts`
-        // and `entry` pointers assumed to be valid.
-        if unsafe { fts_sys::fts_set(fts, entry.as_ptr(), instr) } == -1 {
-            Err(Error::from_io("fts_set()", io::Error::last_os_error()))
-        } else {
+        // SAFETY: We assume calling fts_set() is safe with non-null `fts`
+        // and `entry` pointers assumed to be valid.
+        if unsafe { fts_sys::fts_set(fts, entry.as_ptr(), instr) } == -1 {
+            Err(Error::from_io("fts_set()", io::Error::last_os_error()))
+        } else {
             Ok(())
         }
     }
 }
 
-impl Drop for FTS {
-    fn drop(&mut self) {
-        // SAFETY: We assume calling fts_close() is safe with a non-null `fts`
-        // pointer assumed to be valid.
-        unsafe { fts_sys::fts_close(self.fts.as_ptr()) };
+impl Drop for FTS {
+    fn drop(&mut self) {
+        // SAFETY: We assume calling fts_close() is safe with a non-null `fts`
+        // pointer assumed to be valid.
+        unsafe { fts_sys::fts_close(self.fts.as_ptr()) };
     }
 }
 
-#[derive(Debug)]
-pub(crate) struct EntryRef<'fts> {
-    pub(crate) pointer: ptr::NonNull<fts_sys::FTSENT>,
+#[derive(Debug)]
+pub(crate) struct EntryRef<'fts> {
+    pub(crate) pointer: ptr::NonNull<fts_sys::FTSENT>,
 
-    _fts: PhantomData<&'fts FTS>,
-    _phantom_data: PhantomData<fts_sys::FTSENT>,
+    _fts: PhantomData<&'fts FTS>,
+    _phantom_data: PhantomData<fts_sys::FTSENT>,
 }
 
-impl<'fts> EntryRef<'fts> {
-    fn new(_fts: &'fts FTS, entry: ptr::NonNull<fts_sys::FTSENT>) -> Self {
-        Self {
-            pointer: entry,
-            _fts: PhantomData,
-            _phantom_data: PhantomData,
+impl<'fts> EntryRef<'fts> {
+    fn new(_fts: &'fts FTS, entry: ptr::NonNull<fts_sys::FTSENT>) -> Self {
+        Self {
+            pointer: entry,
+            _fts: PhantomData,
+            _phantom_data: PhantomData,
         }
     }
 
-    fn as_ref(&self) -> &fts_sys::FTSENT {
-        // SAFETY: `self.pointer` is a non-null pointer that is assumed to be valid.
-        unsafe { self.pointer.as_ref() }
+    fn as_ref(&self) -> &fts_sys::FTSENT {
+        // SAFETY: `self.pointer` is a non-null pointer that is assumed to be valid.
+        unsafe { self.pointer.as_ref() }
     }
 
-    fn as_mut(&mut self) -> &mut fts_sys::FTSENT {
-        // SAFETY: `self.pointer` is a non-null pointer that is assumed to be valid.
-        unsafe { self.pointer.as_mut() }
+    fn as_mut(&mut self) -> &mut fts_sys::FTSENT {
+        // SAFETY: `self.pointer` is a non-null pointer that is assumed to be valid.
+        unsafe { self.pointer.as_mut() }
     }
 
-    pub(crate) fn flags(&self) -> c_int {
-        c_int::from(self.as_ref().fts_info)
+    pub(crate) fn flags(&self) -> c_int {
+        c_int::from(self.as_ref().fts_info)
     }
 
-    pub(crate) fn errno(&self) -> c_int {
-        self.as_ref().fts_errno
+    pub(crate) fn errno(&self) -> c_int {
+        self.as_ref().fts_errno
     }
 
-    pub(crate) fn level(&self) -> c_short {
-        self.as_ref().fts_level
+    pub(crate) fn level(&self) -> c_short {
+        self.as_ref().fts_level
     }
 
-    pub(crate) fn number(&self) -> c_long {
-        self.as_ref().fts_number
+    pub(crate) fn number(&self) -> c_long {
+        self.as_ref().fts_number
     }
 
-    pub(crate) fn set_number(&mut self, new_number: c_long) {
-        self.as_mut().fts_number = new_number;
+    pub(crate) fn set_number(&mut self, new_number: c_long) {
+        self.as_mut().fts_number = new_number;
     }
 
-    pub(crate) fn path(&self) -> Option<&Path> {
-        let entry = self.as_ref();
-        if entry.fts_pathlen == 0 {
-            return None;
+    pub(crate) fn path(&self) -> Option<&Path> {
+        let entry = self.as_ref();
+        if entry.fts_pathlen == 0 {
+            return None;
         }
 
-        NonNull::new(entry.fts_path)
-            .map(|path_ptr| {
-                let path_size = usize::from(entry.fts_pathlen).saturating_add(1);
+        NonNull::new(entry.fts_path)
+            .map(|path_ptr| {
+                let path_size = usize::from(entry.fts_pathlen).saturating_add(1);
 
-                // SAFETY: `entry.fts_path` is a non-null pointer that is assumed to be valid.
-                unsafe { slice::from_raw_parts(path_ptr.as_ptr().cast(), path_size) }
+                // SAFETY: `entry.fts_path` is a non-null pointer that is assumed to be valid.
+                unsafe { slice::from_raw_parts(path_ptr.as_ptr().cast(), path_size) }
             })
-            .and_then(|bytes| CStr::from_bytes_with_nul(bytes).ok())
-            .map(c_str_to_os_str)
-            .map(Path::new)
+            .and_then(|bytes| CStr::from_bytes_with_nul(bytes).ok())
+            .map(c_str_to_os_str)
+            .map(Path::new)
     }
 
-    pub(crate) fn access_path(&self) -> Option<&Path> {
-        ptr::NonNull::new(self.as_ref().fts_accpath)
-            .map(|path_ptr| {
-                // SAFETY: `entry.fts_accpath` is a non-null pointer that is assumed to be valid.
-                unsafe { CStr::from_ptr(path_ptr.as_ptr()) }
+    pub(crate) fn access_path(&self) -> Option<&Path> {
+        ptr::NonNull::new(self.as_ref().fts_accpath)
+            .map(|path_ptr| {
+                // SAFETY: `entry.fts_accpath` is a non-null pointer that is assumed to be valid.
+                unsafe { CStr::from_ptr(path_ptr.as_ptr()) }
             })
-            .map(c_str_to_os_str)
-            .map(Path::new)
+            .map(c_str_to_os_str)
+            .map(Path::new)
     }
 
-    pub(crate) fn stat(&self) -> Option<&libc::stat> {
-        ptr::NonNull::new(self.as_ref().fts_statp).map(|stat_ptr| {
-            // SAFETY: `entry.fts_statp` is a non-null pointer that is assumed to be valid.
-            unsafe { stat_ptr.as_ref() }
+    pub(crate) fn stat(&self) -> Option<&libc::stat> {
+        ptr::NonNull::new(self.as_ref().fts_statp).map(|stat_ptr| {
+            // SAFETY: `entry.fts_statp` is a non-null pointer that is assumed to be valid.
+            unsafe { stat_ptr.as_ref() }
         })
     }
 }
 
-#[cfg(unix)]
-fn c_str_to_os_str(s: &CStr) -> &OsStr {
-    use std::os::unix::ffi::OsStrExt;
+#[cfg(unix)]
+fn c_str_to_os_str(s: &CStr) -> &OsStr {
+    use std::os::unix::ffi::OsStrExt;
 
-    OsStr::from_bytes(s.to_bytes())
+    OsStr::from_bytes(s.to_bytes())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_chgrp/chgrp.rs.html b/dev/src/uu_chgrp/chgrp.rs.html index 9c62ad275..f3c3bf8a3 100644 --- a/dev/src/uu_chgrp/chgrp.rs.html +++ b/dev/src/uu_chgrp/chgrp.rs.html @@ -1,4 +1,4 @@ -chgrp.rs - source
1
+chgrp.rs - source
1
 2
 3
 4
@@ -156,163 +156,163 @@
 156
 157
 158
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) COMFOLLOW Chowner RFILE RFILE's derefer dgid nonblank nonprint nonprinting
+// spell-checker:ignore (ToDO) COMFOLLOW Chowner RFILE RFILE's derefer dgid nonblank nonprint nonprinting
 
-use uucore::display::Quotable;
-pub use uucore::entries;
-use uucore::error::{FromIo, UResult, USimpleError};
-use uucore::format_usage;
-use uucore::perms::{chown_base, options, IfFrom};
+use uucore::display::Quotable;
+pub use uucore::entries;
+use uucore::error::{FromIo, UResult, USimpleError};
+use uucore::format_usage;
+use uucore::perms::{chown_base, options, IfFrom};
 
-use clap::{Arg, ArgAction, ArgMatches, Command};
+use clap::{Arg, ArgAction, ArgMatches, Command};
 
-use std::fs;
-use std::os::unix::fs::MetadataExt;
+use std::fs;
+use std::os::unix::fs::MetadataExt;
 
-static ABOUT: &str = "Change the group of each FILE to GROUP.";
-static VERSION: &str = env!("CARGO_PKG_VERSION");
+static ABOUT: &str = "Change the group of each FILE to GROUP.";
+static VERSION: &str = env!("CARGO_PKG_VERSION");
 
-const USAGE: &str = "\
+const USAGE: &str = "\
     {} [OPTION]... GROUP FILE...\n    \
     {} [OPTION]... --reference=RFILE FILE...";
 
-fn parse_gid_and_uid(matches: &ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)> {
-    let dest_gid = if let Some(file) = matches.get_one::<String>(options::REFERENCE) {
-        fs::metadata(file)
-            .map(|meta| Some(meta.gid()))
-            .map_err_context(|| format!("failed to get attributes of {}", file.quote()))?
-    } else {
-        let group = matches
-            .get_one::<String>(options::ARG_GROUP)
-            .map(|s| s.as_str())
-            .unwrap_or_default();
-        if group.is_empty() {
-            None
-        } else {
-            match entries::grp2gid(group) {
-                Ok(g) => Some(g),
-                _ => {
-                    return Err(USimpleError::new(
+fn parse_gid_and_uid(matches: &ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)> {
+    let dest_gid = if let Some(file) = matches.get_one::<String>(options::REFERENCE) {
+        fs::metadata(file)
+            .map(|meta| Some(meta.gid()))
+            .map_err_context(|| format!("failed to get attributes of {}", file.quote()))?
+    } else {
+        let group = matches
+            .get_one::<String>(options::ARG_GROUP)
+            .map(|s| s.as_str())
+            .unwrap_or_default();
+        if group.is_empty() {
+            None
+        } else {
+            match entries::grp2gid(group) {
+                Ok(g) => Some(g),
+                _ => {
+                    return Err(USimpleError::new(
                         1,
-                        format!("invalid group: {}", group.quote()),
+                        format!("invalid group: {}", group.quote()),
                     ))
                 }
             }
         }
     };
-    Ok((dest_gid, None, IfFrom::All))
+    Ok((dest_gid, None, IfFrom::All))
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    chown_base(uu_app(), args, options::ARG_GROUP, parse_gid_and_uid, true)
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    chown_base(uu_app(), args, options::ARG_GROUP, parse_gid_and_uid, true)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(VERSION)
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help)
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(VERSION)
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help)
         )
-        .arg(
-            Arg::new(options::verbosity::CHANGES)
-                .short('c')
-                .long(options::verbosity::CHANGES)
-                .help("like verbose but report only when a change is made")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::CHANGES)
+                .short('c')
+                .long(options::verbosity::CHANGES)
+                .help("like verbose but report only when a change is made")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::verbosity::SILENT)
-                .short('f')
-                .long(options::verbosity::SILENT)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::SILENT)
+                .short('f')
+                .long(options::verbosity::SILENT)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::verbosity::QUIET)
-                .long(options::verbosity::QUIET)
-                .help("suppress most error messages")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::QUIET)
+                .long(options::verbosity::QUIET)
+                .help("suppress most error messages")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::verbosity::VERBOSE)
-                .short('v')
-                .long(options::verbosity::VERBOSE)
-                .help("output a diagnostic for every file processed")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::VERBOSE)
+                .short('v')
+                .long(options::verbosity::VERBOSE)
+                .help("output a diagnostic for every file processed")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::dereference::DEREFERENCE)
-                .long(options::dereference::DEREFERENCE)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::dereference::DEREFERENCE)
+                .long(options::dereference::DEREFERENCE)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-           Arg::new(options::dereference::NO_DEREFERENCE)
-               .short('h')
-               .long(options::dereference::NO_DEREFERENCE)
-               .help(
+        .arg(
+           Arg::new(options::dereference::NO_DEREFERENCE)
+               .short('h')
+               .long(options::dereference::NO_DEREFERENCE)
+               .help(
                    "affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink)",
                )
-               .action(ArgAction::SetTrue),
+               .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::preserve_root::PRESERVE)
-                .long(options::preserve_root::PRESERVE)
-                .help("fail to operate recursively on '/'")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::preserve_root::PRESERVE)
+                .long(options::preserve_root::PRESERVE)
+                .help("fail to operate recursively on '/'")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::preserve_root::NO_PRESERVE)
-                .long(options::preserve_root::NO_PRESERVE)
-                .help("do not treat '/' specially (the default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::preserve_root::NO_PRESERVE)
+                .long(options::preserve_root::NO_PRESERVE)
+                .help("do not treat '/' specially (the default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REFERENCE)
-                .long(options::REFERENCE)
-                .value_name("RFILE")
-                .value_hint(clap::ValueHint::FilePath)
-                .help("use RFILE's group rather than specifying GROUP values"),
+        .arg(
+            Arg::new(options::REFERENCE)
+                .long(options::REFERENCE)
+                .value_name("RFILE")
+                .value_hint(clap::ValueHint::FilePath)
+                .help("use RFILE's group rather than specifying GROUP values"),
         )
-        .arg(
-            Arg::new(options::RECURSIVE)
-                .short('R')
-                .long(options::RECURSIVE)
-                .help("operate on files and directories recursively")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RECURSIVE)
+                .short('R')
+                .long(options::RECURSIVE)
+                .help("operate on files and directories recursively")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::traverse::TRAVERSE)
-                .short(options::traverse::TRAVERSE.chars().next().unwrap())
-                .help("if a command line argument is a symbolic link to a directory, traverse it")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::traverse::TRAVERSE)
+                .short(options::traverse::TRAVERSE.chars().next().unwrap())
+                .help("if a command line argument is a symbolic link to a directory, traverse it")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::traverse::NO_TRAVERSE)
-                .short(options::traverse::NO_TRAVERSE.chars().next().unwrap())
-                .help("do not traverse any symbolic links (default)")
-                .overrides_with_all([options::traverse::TRAVERSE, options::traverse::EVERY])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::traverse::NO_TRAVERSE)
+                .short(options::traverse::NO_TRAVERSE.chars().next().unwrap())
+                .help("do not traverse any symbolic links (default)")
+                .overrides_with_all([options::traverse::TRAVERSE, options::traverse::EVERY])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::traverse::EVERY)
-                .short(options::traverse::EVERY.chars().next().unwrap())
-                .help("traverse every symbolic link to a directory encountered")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::traverse::EVERY)
+                .short(options::traverse::EVERY.chars().next().unwrap())
+                .help("traverse every symbolic link to a directory encountered")
+                .action(ArgAction::SetTrue),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_chmod/chmod.rs.html b/dev/src/uu_chmod/chmod.rs.html index fd49d3c2d..b4e14b97e 100644 --- a/dev/src/uu_chmod/chmod.rs.html +++ b/dev/src/uu_chmod/chmod.rs.html @@ -1,4 +1,4 @@ -chmod.rs - source
1
+chmod.rs - source
1
 2
 3
 4
@@ -380,337 +380,337 @@
 380
 381
 382
-
// This file is part of the uutils coreutils package.
-//
-// (c) Alex Lyon <arcterus@mail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Alex Lyon <arcterus@mail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) Chmoder cmode fmode fperm fref ugoa RFILE RFILE's
+// spell-checker:ignore (ToDO) Chmoder cmode fmode fperm fref ugoa RFILE RFILE's
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fs;
-use std::os::unix::fs::{MetadataExt, PermissionsExt};
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{ExitCode, UResult, USimpleError, UUsageError};
-use uucore::fs::display_permissions_unix;
-use uucore::libc::mode_t;
-#[cfg(not(windows))]
-use uucore::mode;
-use uucore::{format_usage, show_error};
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fs;
+use std::os::unix::fs::{MetadataExt, PermissionsExt};
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{ExitCode, UResult, USimpleError, UUsageError};
+use uucore::fs::display_permissions_unix;
+use uucore::libc::mode_t;
+#[cfg(not(windows))]
+use uucore::mode;
+use uucore::{format_usage, show_error};
 
-static ABOUT: &str = "Change the mode of each FILE to MODE.
+static ABOUT: &str = "Change the mode of each FILE to MODE.
  With --reference, change the mode of each FILE to that of RFILE.";
 
-mod options {
-    pub const CHANGES: &str = "changes";
-    pub const QUIET: &str = "quiet"; // visible_alias("silent")
-    pub const VERBOSE: &str = "verbose";
-    pub const NO_PRESERVE_ROOT: &str = "no-preserve-root";
-    pub const PRESERVE_ROOT: &str = "preserve-root";
-    pub const REFERENCE: &str = "RFILE";
-    pub const RECURSIVE: &str = "recursive";
-    pub const MODE: &str = "MODE";
-    pub const FILE: &str = "FILE";
+mod options {
+    pub const CHANGES: &str = "changes";
+    pub const QUIET: &str = "quiet"; // visible_alias("silent")
+    pub const VERBOSE: &str = "verbose";
+    pub const NO_PRESERVE_ROOT: &str = "no-preserve-root";
+    pub const PRESERVE_ROOT: &str = "preserve-root";
+    pub const REFERENCE: &str = "RFILE";
+    pub const RECURSIVE: &str = "recursive";
+    pub const MODE: &str = "MODE";
+    pub const FILE: &str = "FILE";
 }
 
-const USAGE: &str = "\
+const USAGE: &str = "\
     {} [OPTION]... MODE[,MODE]... FILE...
     {} [OPTION]... OCTAL-MODE FILE...
     {} [OPTION]... --reference=RFILE FILE...";
 
-fn get_long_usage() -> &'static str {
-    "Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'."
-}
+fn get_long_usage() -> &'static str {
+    "Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'."
+}
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let mut args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let mut args = args.collect_lossy();
 
-    // Before we can parse 'args' with clap (and previously getopts),
-    // a possible MODE prefix '-' needs to be removed (e.g. "chmod -x FILE").
-    let mode_had_minus_prefix = mode::strip_minus_from_mode(&mut args);
+    // Before we can parse 'args' with clap (and previously getopts),
+    // a possible MODE prefix '-' needs to be removed (e.g. "chmod -x FILE").
+    let mode_had_minus_prefix = mode::strip_minus_from_mode(&mut args);
 
-    let after_help = get_long_usage();
+    let after_help = get_long_usage();
 
-    let matches = uu_app().after_help(after_help).try_get_matches_from(args)?;
+    let matches = uu_app().after_help(after_help).try_get_matches_from(args)?;
 
-    let changes = matches.get_flag(options::CHANGES);
-    let quiet = matches.get_flag(options::QUIET);
-    let verbose = matches.get_flag(options::VERBOSE);
-    let preserve_root = matches.get_flag(options::PRESERVE_ROOT);
-    let recursive = matches.get_flag(options::RECURSIVE);
-    let fmode = match matches.get_one::<String>(options::REFERENCE) {
-        Some(fref) => match fs::metadata(fref) {
-            Ok(meta) => Some(meta.mode()),
-            Err(err) => {
-                return Err(USimpleError::new(
+    let changes = matches.get_flag(options::CHANGES);
+    let quiet = matches.get_flag(options::QUIET);
+    let verbose = matches.get_flag(options::VERBOSE);
+    let preserve_root = matches.get_flag(options::PRESERVE_ROOT);
+    let recursive = matches.get_flag(options::RECURSIVE);
+    let fmode = match matches.get_one::<String>(options::REFERENCE) {
+        Some(fref) => match fs::metadata(fref) {
+            Ok(meta) => Some(meta.mode()),
+            Err(err) => {
+                return Err(USimpleError::new(
                     1,
-                    format!("cannot stat attributes of {}: {}", fref.quote(), err),
+                    format!("cannot stat attributes of {}: {}", fref.quote(), err),
                 ))
             }
         },
-        None => None,
+        None => None,
     };
-    let modes = matches.get_one::<String>(options::MODE).unwrap(); // should always be Some because required
-    let cmode = if mode_had_minus_prefix {
-        // clap parsing is finished, now put prefix back
-        format!("-{}", modes)
-    } else {
-        modes.to_string()
+    let modes = matches.get_one::<String>(options::MODE).unwrap(); // should always be Some because required
+    let cmode = if mode_had_minus_prefix {
+        // clap parsing is finished, now put prefix back
+        format!("-{}", modes)
+    } else {
+        modes.to_string()
     };
-    let mut files: Vec<String> = matches
-        .get_many::<String>(options::FILE)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
-    let cmode = if fmode.is_some() {
-        // "--reference" and MODE are mutually exclusive
-        // if "--reference" was used MODE needs to be interpreted as another FILE
-        // it wasn't possible to implement this behavior directly with clap
-        files.push(cmode);
-        None
-    } else {
-        Some(cmode)
+    let mut files: Vec<String> = matches
+        .get_many::<String>(options::FILE)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
+    let cmode = if fmode.is_some() {
+        // "--reference" and MODE are mutually exclusive
+        // if "--reference" was used MODE needs to be interpreted as another FILE
+        // it wasn't possible to implement this behavior directly with clap
+        files.push(cmode);
+        None
+    } else {
+        Some(cmode)
     };
 
-    if files.is_empty() {
-        return Err(UUsageError::new(1, "missing operand".to_string()));
+    if files.is_empty() {
+        return Err(UUsageError::new(1, "missing operand".to_string()));
     }
 
-    let chmoder = Chmoder {
-        changes,
-        quiet,
-        verbose,
-        preserve_root,
-        recursive,
-        fmode,
-        cmode,
+    let chmoder = Chmoder {
+        changes,
+        quiet,
+        verbose,
+        preserve_root,
+        recursive,
+        fmode,
+        cmode,
     };
 
-    chmoder.chmod(&files)
+    chmoder.chmod(&files)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::CHANGES)
-                .long(options::CHANGES)
-                .short('c')
-                .help("like verbose but report only when a change is made")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::CHANGES)
+                .long(options::CHANGES)
+                .short('c')
+                .help("like verbose but report only when a change is made")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::QUIET)
-                .long(options::QUIET)
-                .visible_alias("silent")
-                .short('f')
-                .help("suppress most error messages")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::QUIET)
+                .long(options::QUIET)
+                .visible_alias("silent")
+                .short('f')
+                .help("suppress most error messages")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::VERBOSE)
-                .long(options::VERBOSE)
-                .short('v')
-                .help("output a diagnostic for every file processed")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::VERBOSE)
+                .long(options::VERBOSE)
+                .short('v')
+                .help("output a diagnostic for every file processed")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NO_PRESERVE_ROOT)
-                .long(options::NO_PRESERVE_ROOT)
-                .help("do not treat '/' specially (the default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_PRESERVE_ROOT)
+                .long(options::NO_PRESERVE_ROOT)
+                .help("do not treat '/' specially (the default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PRESERVE_ROOT)
-                .long(options::PRESERVE_ROOT)
-                .help("fail to operate recursively on '/'")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PRESERVE_ROOT)
+                .long(options::PRESERVE_ROOT)
+                .help("fail to operate recursively on '/'")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::RECURSIVE)
-                .long(options::RECURSIVE)
-                .short('R')
-                .help("change files and directories recursively")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RECURSIVE)
+                .long(options::RECURSIVE)
+                .short('R')
+                .help("change files and directories recursively")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REFERENCE)
-                .long("reference")
-                .value_hint(clap::ValueHint::FilePath)
-                .help("use RFILE's mode instead of MODE values"),
+        .arg(
+            Arg::new(options::REFERENCE)
+                .long("reference")
+                .value_hint(clap::ValueHint::FilePath)
+                .help("use RFILE's mode instead of MODE values"),
         )
-        .arg(
-            Arg::new(options::MODE).required_unless_present(options::REFERENCE), // It would be nice if clap could parse with delimiter, e.g. "g-x,u+x",
-                                                                                 // however .multiple_occurrences(true) cannot be used here because FILE already needs that.
-                                                                                 // Only one positional argument with .multiple_occurrences(true) set is allowed per command
-        )
-        .arg(
-            Arg::new(options::FILE)
-                .required_unless_present(options::MODE)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(options::MODE).required_unless_present(options::REFERENCE), // It would be nice if clap could parse with delimiter, e.g. "g-x,u+x",
+                                                                                 // however .multiple_occurrences(true) cannot be used here because FILE already needs that.
+                                                                                 // Only one positional argument with .multiple_occurrences(true) set is allowed per command
+        )
+        .arg(
+            Arg::new(options::FILE)
+                .required_unless_present(options::MODE)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-struct Chmoder {
-    changes: bool,
-    quiet: bool,
-    verbose: bool,
-    preserve_root: bool,
-    recursive: bool,
-    fmode: Option<u32>,
-    cmode: Option<String>,
+struct Chmoder {
+    changes: bool,
+    quiet: bool,
+    verbose: bool,
+    preserve_root: bool,
+    recursive: bool,
+    fmode: Option<u32>,
+    cmode: Option<String>,
 }
 
-impl Chmoder {
-    fn chmod(&self, files: &[String]) -> UResult<()> {
-        let mut r = Ok(());
+impl Chmoder {
+    fn chmod(&self, files: &[String]) -> UResult<()> {
+        let mut r = Ok(());
 
-        for filename in files {
-            let filename = &filename[..];
-            let file = Path::new(filename);
-            if !file.exists() {
-                if file.is_symlink() {
+        for filename in files {
+            let filename = &filename[..];
+            let file = Path::new(filename);
+            if !file.exists() {
+                if file.is_symlink() {
                     println!(
                         "failed to change mode of {} from 0000 (---------) to 0000 (---------)",
-                        filename.quote()
+                        filename.quote()
                     );
-                    if !self.quiet {
-                        return Err(USimpleError::new(
+                    if !self.quiet {
+                        return Err(USimpleError::new(
                             1,
-                            format!("cannot operate on dangling symlink {}", filename.quote()),
+                            format!("cannot operate on dangling symlink {}", filename.quote()),
                         ));
                     }
-                } else if !self.quiet {
-                    return Err(USimpleError::new(
+                } else if !self.quiet {
+                    return Err(USimpleError::new(
                         1,
                         format!(
                             "cannot access {}: No such file or directory",
-                            filename.quote()
+                            filename.quote()
                         ),
                     ));
                 }
-                return Err(ExitCode::new(1));
+                return Err(ExitCode::new(1));
             }
-            if self.recursive && self.preserve_root && filename == "/" {
-                return Err(USimpleError::new(
+            if self.recursive && self.preserve_root && filename == "/" {
+                return Err(USimpleError::new(
                     1,
                     format!(
                         "it is dangerous to operate recursively on {}\nuse --no-preserve-root to override this failsafe",
-                        filename.quote()
+                        filename.quote()
                     )
                 ));
             }
-            if !self.recursive {
-                r = self.chmod_file(file).and(r);
-            } else {
-                r = self.walk_dir(file);
+            if !self.recursive {
+                r = self.chmod_file(file).and(r);
+            } else {
+                r = self.walk_dir(file);
             }
         }
-        r
+        r
     }
 
-    fn walk_dir(&self, file_path: &Path) -> UResult<()> {
-        let mut r = self.chmod_file(file_path);
-        if !file_path.is_symlink() && file_path.is_dir() {
-            for dir_entry in file_path.read_dir()? {
-                let path = dir_entry?.path();
-                if !path.is_symlink() {
-                    r = self.walk_dir(path.as_path());
+    fn walk_dir(&self, file_path: &Path) -> UResult<()> {
+        let mut r = self.chmod_file(file_path);
+        if !file_path.is_symlink() && file_path.is_dir() {
+            for dir_entry in file_path.read_dir()? {
+                let path = dir_entry?.path();
+                if !path.is_symlink() {
+                    r = self.walk_dir(path.as_path());
                 }
             }
         }
-        r
+        r
     }
 
-    #[cfg(windows)]
-    fn chmod_file(&self, file: &Path) -> UResult<()> {
-        // chmod is useless on Windows
-        // it doesn't set any permissions at all
-        // instead it just sets the readonly attribute on the file
-        Ok(())
+    #[cfg(windows)]
+    fn chmod_file(&self, file: &Path) -> UResult<()> {
+        // chmod is useless on Windows
+        // it doesn't set any permissions at all
+        // instead it just sets the readonly attribute on the file
+        Ok(())
     }
-    #[cfg(unix)]
-    fn chmod_file(&self, file: &Path) -> UResult<()> {
-        use uucore::mode::get_umask;
+    #[cfg(unix)]
+    fn chmod_file(&self, file: &Path) -> UResult<()> {
+        use uucore::mode::get_umask;
 
-        let fperm = match fs::metadata(file) {
-            Ok(meta) => meta.mode() & 0o7777,
-            Err(err) => {
-                if file.is_symlink() {
-                    if self.verbose {
+        let fperm = match fs::metadata(file) {
+            Ok(meta) => meta.mode() & 0o7777,
+            Err(err) => {
+                if file.is_symlink() {
+                    if self.verbose {
                         println!(
                             "neither symbolic link {} nor referent has been changed",
-                            file.quote()
+                            file.quote()
                         );
                     }
-                    return Ok(());
-                } else if err.kind() == std::io::ErrorKind::PermissionDenied {
-                    // These two filenames would normally be conditionally
-                    // quoted, but GNU's tests expect them to always be quoted
-                    return Err(USimpleError::new(
+                    return Ok(());
+                } else if err.kind() == std::io::ErrorKind::PermissionDenied {
+                    // These two filenames would normally be conditionally
+                    // quoted, but GNU's tests expect them to always be quoted
+                    return Err(USimpleError::new(
                         1,
-                        format!("{}: Permission denied", file.quote()),
+                        format!("{}: Permission denied", file.quote()),
                     ));
-                } else {
-                    return Err(USimpleError::new(1, format!("{}: {}", file.quote(), err)));
+                } else {
+                    return Err(USimpleError::new(1, format!("{}: {}", file.quote(), err)));
                 }
             }
         };
-        match self.fmode {
-            Some(mode) => self.change_file(fperm, mode, file)?,
-            None => {
-                let cmode_unwrapped = self.cmode.clone().unwrap();
-                let mut new_mode = fperm;
-                let mut naively_expected_new_mode = new_mode;
-                for mode in cmode_unwrapped.split(',') {
-                    // cmode is guaranteed to be Some in this case
-                    let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
-                    let result = if mode.contains(arr) {
-                        mode::parse_numeric(new_mode, mode, file.is_dir()).map(|v| (v, v))
-                    } else {
-                        mode::parse_symbolic(new_mode, mode, get_umask(), file.is_dir()).map(|m| {
-                            // calculate the new mode as if umask was 0
-                            let naive_mode = mode::parse_symbolic(
-                                naively_expected_new_mode,
-                                mode,
+        match self.fmode {
+            Some(mode) => self.change_file(fperm, mode, file)?,
+            None => {
+                let cmode_unwrapped = self.cmode.clone().unwrap();
+                let mut new_mode = fperm;
+                let mut naively_expected_new_mode = new_mode;
+                for mode in cmode_unwrapped.split(',') {
+                    // cmode is guaranteed to be Some in this case
+                    let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
+                    let result = if mode.contains(arr) {
+                        mode::parse_numeric(new_mode, mode, file.is_dir()).map(|v| (v, v))
+                    } else {
+                        mode::parse_symbolic(new_mode, mode, get_umask(), file.is_dir()).map(|m| {
+                            // calculate the new mode as if umask was 0
+                            let naive_mode = mode::parse_symbolic(
+                                naively_expected_new_mode,
+                                mode,
                                 0,
-                                file.is_dir(),
+                                file.is_dir(),
                             )
-                            .unwrap(); // we know that mode must be valid, so this cannot fail
-                            (m, naive_mode)
+                            .unwrap(); // we know that mode must be valid, so this cannot fail
+                            (m, naive_mode)
                         })
                     };
-                    match result {
-                        Ok((mode, naive_mode)) => {
-                            new_mode = mode;
-                            naively_expected_new_mode = naive_mode;
+                    match result {
+                        Ok((mode, naive_mode)) => {
+                            new_mode = mode;
+                            naively_expected_new_mode = naive_mode;
                         }
-                        Err(f) => {
-                            if !self.quiet {
-                                return Err(USimpleError::new(1, f));
-                            } else {
-                                return Err(ExitCode::new(1));
+                        Err(f) => {
+                            if !self.quiet {
+                                return Err(USimpleError::new(1, f));
+                            } else {
+                                return Err(ExitCode::new(1));
                             }
                         }
                     }
                 }
-                self.change_file(fperm, new_mode, file)?;
-                // if a permission would have been removed if umask was 0, but it wasn't because umask was not 0, print an error and fail
-                if (new_mode & !naively_expected_new_mode) != 0 {
-                    return Err(USimpleError::new(
+                self.change_file(fperm, new_mode, file)?;
+                // if a permission would have been removed if umask was 0, but it wasn't because umask was not 0, print an error and fail
+                if (new_mode & !naively_expected_new_mode) != 0 {
+                    return Err(USimpleError::new(
                         1,
                         format!(
                             "{}: new permissions are {}, not {}",
-                            file.maybe_quote(),
-                            display_permissions_unix(new_mode as mode_t, false),
-                            display_permissions_unix(naively_expected_new_mode as mode_t, false)
+                            file.maybe_quote(),
+                            display_permissions_unix(new_mode as mode_t, false),
+                            display_permissions_unix(naively_expected_new_mode as mode_t, false)
                         ),
                     ));
                 }
@@ -720,42 +720,42 @@
         Ok(())
     }
 
-    #[cfg(unix)]
-    fn change_file(&self, fperm: u32, mode: u32, file: &Path) -> Result<(), i32> {
-        if fperm == mode {
-            if self.verbose && !self.changes {
+    #[cfg(unix)]
+    fn change_file(&self, fperm: u32, mode: u32, file: &Path) -> Result<(), i32> {
+        if fperm == mode {
+            if self.verbose && !self.changes {
                 println!(
                     "mode of {} retained as {:04o} ({})",
-                    file.quote(),
-                    fperm,
-                    display_permissions_unix(fperm as mode_t, false),
+                    file.quote(),
+                    fperm,
+                    display_permissions_unix(fperm as mode_t, false),
                 );
             }
             Ok(())
-        } else if let Err(err) = fs::set_permissions(file, fs::Permissions::from_mode(mode)) {
-            if !self.quiet {
-                show_error!("{}", err);
+        } else if let Err(err) = fs::set_permissions(file, fs::Permissions::from_mode(mode)) {
+            if !self.quiet {
+                show_error!("{}", err);
             }
-            if self.verbose {
+            if self.verbose {
                 println!(
                     "failed to change mode of file {} from {:04o} ({}) to {:04o} ({})",
-                    file.quote(),
-                    fperm,
-                    display_permissions_unix(fperm as mode_t, false),
-                    mode,
-                    display_permissions_unix(mode as mode_t, false)
+                    file.quote(),
+                    fperm,
+                    display_permissions_unix(fperm as mode_t, false),
+                    mode,
+                    display_permissions_unix(mode as mode_t, false)
                 );
             }
             Err(1)
-        } else {
-            if self.verbose || self.changes {
+        } else {
+            if self.verbose || self.changes {
                 println!(
                     "mode of {} changed from {:04o} ({}) to {:04o} ({})",
-                    file.quote(),
-                    fperm,
-                    display_permissions_unix(fperm as mode_t, false),
-                    mode,
-                    display_permissions_unix(mode as mode_t, false)
+                    file.quote(),
+                    fperm,
+                    display_permissions_unix(fperm as mode_t, false),
+                    mode,
+                    display_permissions_unix(mode as mode_t, false)
                 );
             }
             Ok(())
@@ -763,4 +763,4 @@
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_chown/chown.rs.html b/dev/src/uu_chown/chown.rs.html index e9f74b417..eb944a644 100644 --- a/dev/src/uu_chown/chown.rs.html +++ b/dev/src/uu_chown/chown.rs.html @@ -1,4 +1,4 @@ -chown.rs - source
1
+chown.rs - source
1
 2
 3
 4
@@ -288,295 +288,295 @@
 288
 289
 290
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) COMFOLLOW Passwd RFILE RFILE's derefer dgid duid groupname
+// spell-checker:ignore (ToDO) COMFOLLOW Passwd RFILE RFILE's derefer dgid duid groupname
 
-use uucore::display::Quotable;
-pub use uucore::entries::{self, Group, Locate, Passwd};
-use uucore::format_usage;
-use uucore::perms::{chown_base, options, IfFrom};
+use uucore::display::Quotable;
+pub use uucore::entries::{self, Group, Locate, Passwd};
+use uucore::format_usage;
+use uucore::perms::{chown_base, options, IfFrom};
 
-use uucore::error::{FromIo, UResult, USimpleError};
+use uucore::error::{FromIo, UResult, USimpleError};
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
 
-use std::fs;
-use std::os::unix::fs::MetadataExt;
+use std::fs;
+use std::os::unix::fs::MetadataExt;
 
-static ABOUT: &str = "change file owner and group";
+static ABOUT: &str = "change file owner and group";
 
-const USAGE: &str = "\
+const USAGE: &str = "\
     {} [OPTION]... [OWNER][:[GROUP]] FILE...
     {} [OPTION]... --reference=RFILE FILE...";
 
-fn parse_gid_uid_and_filter(matches: &ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)> {
-    let filter = if let Some(spec) = matches.get_one::<String>(options::FROM) {
-        match parse_spec(spec, ':')? {
-            (Some(uid), None) => IfFrom::User(uid),
-            (None, Some(gid)) => IfFrom::Group(gid),
-            (Some(uid), Some(gid)) => IfFrom::UserGroup(uid, gid),
-            (None, None) => IfFrom::All,
+fn parse_gid_uid_and_filter(matches: &ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)> {
+    let filter = if let Some(spec) = matches.get_one::<String>(options::FROM) {
+        match parse_spec(spec, ':')? {
+            (Some(uid), None) => IfFrom::User(uid),
+            (None, Some(gid)) => IfFrom::Group(gid),
+            (Some(uid), Some(gid)) => IfFrom::UserGroup(uid, gid),
+            (None, None) => IfFrom::All,
         }
-    } else {
-        IfFrom::All
+    } else {
+        IfFrom::All
     };
 
-    let dest_uid: Option<u32>;
-    let dest_gid: Option<u32>;
-    if let Some(file) = matches.get_one::<String>(options::REFERENCE) {
-        let meta = fs::metadata(file)
-            .map_err_context(|| format!("failed to get attributes of {}", file.quote()))?;
-        dest_gid = Some(meta.gid());
-        dest_uid = Some(meta.uid());
-    } else {
-        let (u, g) = parse_spec(matches.get_one::<String>(options::ARG_OWNER).unwrap(), ':')?;
-        dest_uid = u;
-        dest_gid = g;
+    let dest_uid: Option<u32>;
+    let dest_gid: Option<u32>;
+    if let Some(file) = matches.get_one::<String>(options::REFERENCE) {
+        let meta = fs::metadata(file)
+            .map_err_context(|| format!("failed to get attributes of {}", file.quote()))?;
+        dest_gid = Some(meta.gid());
+        dest_uid = Some(meta.uid());
+    } else {
+        let (u, g) = parse_spec(matches.get_one::<String>(options::ARG_OWNER).unwrap(), ':')?;
+        dest_uid = u;
+        dest_gid = g;
     }
-    Ok((dest_gid, dest_uid, filter))
+    Ok((dest_gid, dest_uid, filter))
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    chown_base(
-        uu_app(),
-        args,
-        options::ARG_OWNER,
-        parse_gid_uid_and_filter,
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    chown_base(
+        uu_app(),
+        args,
+        options::ARG_OWNER,
+        parse_gid_uid_and_filter,
         false,
     )
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new(options::verbosity::CHANGES)
-                .short('c')
-                .long(options::verbosity::CHANGES)
-                .help("like verbose but report only when a change is made")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::CHANGES)
+                .short('c')
+                .long(options::verbosity::CHANGES)
+                .help("like verbose but report only when a change is made")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::dereference::DEREFERENCE)
-                .long(options::dereference::DEREFERENCE)
-                .help(
+        .arg(
+            Arg::new(options::dereference::DEREFERENCE)
+                .long(options::dereference::DEREFERENCE)
+                .help(
                     "affect the referent of each symbolic link (this is the default), \
                     rather than the symbolic link itself",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::dereference::NO_DEREFERENCE)
-                .short('h')
-                .long(options::dereference::NO_DEREFERENCE)
-                .help(
+        .arg(
+            Arg::new(options::dereference::NO_DEREFERENCE)
+                .short('h')
+                .long(options::dereference::NO_DEREFERENCE)
+                .help(
                     "affect symbolic links instead of any referenced file \
                     (useful only on systems that can change the ownership of a symlink)",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FROM)
-                .long(options::FROM)
-                .help(
+        .arg(
+            Arg::new(options::FROM)
+                .long(options::FROM)
+                .help(
                     "change the owner and/or group of each file only if its \
                     current owner and/or group match those specified here. \
                     Either may be omitted, in which case a match is not required \
                     for the omitted attribute",
                 )
-                .value_name("CURRENT_OWNER:CURRENT_GROUP"),
+                .value_name("CURRENT_OWNER:CURRENT_GROUP"),
         )
-        .arg(
-            Arg::new(options::preserve_root::PRESERVE)
-                .long(options::preserve_root::PRESERVE)
-                .help("fail to operate recursively on '/'")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::preserve_root::PRESERVE)
+                .long(options::preserve_root::PRESERVE)
+                .help("fail to operate recursively on '/'")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::preserve_root::NO_PRESERVE)
-                .long(options::preserve_root::NO_PRESERVE)
-                .help("do not treat '/' specially (the default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::preserve_root::NO_PRESERVE)
+                .long(options::preserve_root::NO_PRESERVE)
+                .help("do not treat '/' specially (the default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::verbosity::QUIET)
-                .long(options::verbosity::QUIET)
-                .help("suppress most error messages")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::QUIET)
+                .long(options::verbosity::QUIET)
+                .help("suppress most error messages")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::RECURSIVE)
-                .short('R')
-                .long(options::RECURSIVE)
-                .help("operate on files and directories recursively")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RECURSIVE)
+                .short('R')
+                .long(options::RECURSIVE)
+                .help("operate on files and directories recursively")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REFERENCE)
-                .long(options::REFERENCE)
-                .help("use RFILE's owner and group rather than specifying OWNER:GROUP values")
-                .value_name("RFILE")
-                .value_hint(clap::ValueHint::FilePath)
-                .num_args(1..),
+        .arg(
+            Arg::new(options::REFERENCE)
+                .long(options::REFERENCE)
+                .help("use RFILE's owner and group rather than specifying OWNER:GROUP values")
+                .value_name("RFILE")
+                .value_hint(clap::ValueHint::FilePath)
+                .num_args(1..),
         )
-        .arg(
-            Arg::new(options::verbosity::SILENT)
-                .short('f')
-                .long(options::verbosity::SILENT)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::SILENT)
+                .short('f')
+                .long(options::verbosity::SILENT)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::traverse::TRAVERSE)
-                .short(options::traverse::TRAVERSE.chars().next().unwrap())
-                .help("if a command line argument is a symbolic link to a directory, traverse it")
-                .overrides_with_all([options::traverse::EVERY, options::traverse::NO_TRAVERSE])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::traverse::TRAVERSE)
+                .short(options::traverse::TRAVERSE.chars().next().unwrap())
+                .help("if a command line argument is a symbolic link to a directory, traverse it")
+                .overrides_with_all([options::traverse::EVERY, options::traverse::NO_TRAVERSE])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::traverse::EVERY)
-                .short(options::traverse::EVERY.chars().next().unwrap())
-                .help("traverse every symbolic link to a directory encountered")
-                .overrides_with_all([options::traverse::TRAVERSE, options::traverse::NO_TRAVERSE])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::traverse::EVERY)
+                .short(options::traverse::EVERY.chars().next().unwrap())
+                .help("traverse every symbolic link to a directory encountered")
+                .overrides_with_all([options::traverse::TRAVERSE, options::traverse::NO_TRAVERSE])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::traverse::NO_TRAVERSE)
-                .short(options::traverse::NO_TRAVERSE.chars().next().unwrap())
-                .help("do not traverse any symbolic links (default)")
-                .overrides_with_all([options::traverse::TRAVERSE, options::traverse::EVERY])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::traverse::NO_TRAVERSE)
+                .short(options::traverse::NO_TRAVERSE.chars().next().unwrap())
+                .help("do not traverse any symbolic links (default)")
+                .overrides_with_all([options::traverse::TRAVERSE, options::traverse::EVERY])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::verbosity::VERBOSE)
-                .long(options::verbosity::VERBOSE)
-                .short('v')
-                .help("output a diagnostic for every file processed")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::VERBOSE)
+                .long(options::verbosity::VERBOSE)
+                .short('v')
+                .help("output a diagnostic for every file processed")
+                .action(ArgAction::SetTrue),
         )
 }
 
-/// Parse the owner/group specifier string into a user ID and a group ID.
-///
-/// The `spec` can be of the form:
-///
-/// * `"owner:group"`,
-/// * `"owner"`,
-/// * `":group"`,
-///
-/// and the owner or group can be specified either as an ID or a
-/// name. The `sep` argument specifies which character to use as a
-/// separator between the owner and group; calling code should set
-/// this to `':'`.
-fn parse_spec(spec: &str, sep: char) -> UResult<(Option<u32>, Option<u32>)> {
-    assert!(['.', ':'].contains(&sep));
-    let mut args = spec.splitn(2, sep);
-    let user = args.next().unwrap_or("");
-    let group = args.next().unwrap_or("");
+/// Parse the owner/group specifier string into a user ID and a group ID.
+///
+/// The `spec` can be of the form:
+///
+/// * `"owner:group"`,
+/// * `"owner"`,
+/// * `":group"`,
+///
+/// and the owner or group can be specified either as an ID or a
+/// name. The `sep` argument specifies which character to use as a
+/// separator between the owner and group; calling code should set
+/// this to `':'`.
+fn parse_spec(spec: &str, sep: char) -> UResult<(Option<u32>, Option<u32>)> {
+    assert!(['.', ':'].contains(&sep));
+    let mut args = spec.splitn(2, sep);
+    let user = args.next().unwrap_or("");
+    let group = args.next().unwrap_or("");
 
-    let uid = if !user.is_empty() {
-        Some(match Passwd::locate(user) {
-            Ok(u) => u.uid, // We have been able to get the uid
-            Err(_) =>
-            // we have NOT been able to find the uid
-            // but we could be in the case where we have user.group
-            {
-                if spec.contains('.') && !spec.contains(':') && sep == ':' {
-                    // but the input contains a '.' but not a ':'
-                    // we might have something like username.groupname
-                    // So, try to parse it this way
-                    return parse_spec(spec, '.');
-                } else {
-                    // It's possible that the `user` string contains a
-                    // numeric user ID, in which case, we respect that.
-                    match user.parse() {
-                        Ok(uid) => uid,
+    let uid = if !user.is_empty() {
+        Some(match Passwd::locate(user) {
+            Ok(u) => u.uid, // We have been able to get the uid
+            Err(_) =>
+            // we have NOT been able to find the uid
+            // but we could be in the case where we have user.group
+            {
+                if spec.contains('.') && !spec.contains(':') && sep == ':' {
+                    // but the input contains a '.' but not a ':'
+                    // we might have something like username.groupname
+                    // So, try to parse it this way
+                    return parse_spec(spec, '.');
+                } else {
+                    // It's possible that the `user` string contains a
+                    // numeric user ID, in which case, we respect that.
+                    match user.parse() {
+                        Ok(uid) => uid,
                         Err(_) => {
-                            return Err(USimpleError::new(
+                            return Err(USimpleError::new(
                                 1,
-                                format!("invalid user: {}", spec.quote()),
+                                format!("invalid user: {}", spec.quote()),
                             ))
                         }
                     }
                 }
             }
         })
-    } else {
-        None
-    };
-    let gid = if !group.is_empty() {
-        Some(match Group::locate(group) {
-            Ok(g) => g.gid,
-            Err(_) => match group.parse() {
-                Ok(gid) => gid,
+    } else {
+        None
+    };
+    let gid = if !group.is_empty() {
+        Some(match Group::locate(group) {
+            Ok(g) => g.gid,
+            Err(_) => match group.parse() {
+                Ok(gid) => gid,
                 Err(_) => {
-                    return Err(USimpleError::new(
+                    return Err(USimpleError::new(
                         1,
-                        format!("invalid group: {}", spec.quote()),
+                        format!("invalid group: {}", spec.quote()),
                     ));
                 }
             },
         })
-    } else {
-        None
-    };
+    } else {
+        None
+    };
 
-    if user.chars().next().map(char::is_numeric).unwrap_or(false)
-        && group.is_empty()
-        && spec != user
+    if user.chars().next().map(char::is_numeric).unwrap_or(false)
+        && group.is_empty()
+        && spec != user
     {
-        // if the arg starts with an id numeric value, the group isn't set but the separator is provided,
-        // we should fail with an error
-        return Err(USimpleError::new(
+        // if the arg starts with an id numeric value, the group isn't set but the separator is provided,
+        // we should fail with an error
+        return Err(USimpleError::new(
             1,
-            format!("invalid spec: {}", spec.quote()),
+            format!("invalid spec: {}", spec.quote()),
         ));
     }
 
-    Ok((uid, gid))
+    Ok((uid, gid))
 }
 
-#[cfg(test)]
-mod test {
-    use super::*;
+#[cfg(test)]
+mod test {
+    use super::*;
 
-    #[test]
-    fn test_parse_spec() {
-        assert!(matches!(parse_spec(":", ':'), Ok((None, None))));
-        assert!(matches!(parse_spec(".", ':'), Ok((None, None))));
-        assert!(matches!(parse_spec(".", '.'), Ok((None, None))));
-        assert!(format!("{}", parse_spec("::", ':').err().unwrap()).starts_with("invalid group: "));
-        assert!(format!("{}", parse_spec("..", ':').err().unwrap()).starts_with("invalid group: "));
+    #[test]
+    fn test_parse_spec() {
+        assert!(matches!(parse_spec(":", ':'), Ok((None, None))));
+        assert!(matches!(parse_spec(".", ':'), Ok((None, None))));
+        assert!(matches!(parse_spec(".", '.'), Ok((None, None))));
+        assert!(format!("{}", parse_spec("::", ':').err().unwrap()).starts_with("invalid group: "));
+        assert!(format!("{}", parse_spec("..", ':').err().unwrap()).starts_with("invalid group: "));
     }
 
-    /// Test for parsing IDs that don't correspond to a named user or group.
-    #[test]
-    fn test_parse_spec_nameless_ids() {
-        // This assumes that there is no named user with ID 12345.
-        assert!(matches!(parse_spec("12345", ':'), Ok((Some(12345), None))));
-        // This assumes that there is no named group with ID 54321.
-        assert!(matches!(parse_spec(":54321", ':'), Ok((None, Some(54321)))));
+    /// Test for parsing IDs that don't correspond to a named user or group.
+    #[test]
+    fn test_parse_spec_nameless_ids() {
+        // This assumes that there is no named user with ID 12345.
+        assert!(matches!(parse_spec("12345", ':'), Ok((Some(12345), None))));
+        // This assumes that there is no named group with ID 54321.
+        assert!(matches!(parse_spec(":54321", ':'), Ok((None, Some(54321)))));
         assert!(matches!(
-            parse_spec("12345:54321", ':'),
+            parse_spec("12345:54321", ':'),
             Ok((Some(12345), Some(54321)))
         ));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_chroot/chroot.rs.html b/dev/src/uu_chroot/chroot.rs.html index 629c87c3b..f9c374404 100644 --- a/dev/src/uu_chroot/chroot.rs.html +++ b/dev/src/uu_chroot/chroot.rs.html @@ -1,4 +1,4 @@ -chroot.rs - source
1
+chroot.rs - source
1
 2
 3
 4
@@ -296,303 +296,303 @@
 296
 297
 298
-
// This file is part of the uutils coreutils package.
-//
-// (c) Vsevolod Velichko <torkvemada@sorokdva.net>
-// (c) Jian Zeng <anonymousknight96 AT gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Vsevolod Velichko <torkvemada@sorokdva.net>
+// (c) Jian Zeng <anonymousknight96 AT gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) NEWROOT Userspec pstatus chdir
-mod error;
+// spell-checker:ignore (ToDO) NEWROOT Userspec pstatus chdir
+mod error;
 
-use crate::error::ChrootError;
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::ffi::CString;
-use std::io::Error;
-use std::os::unix::prelude::OsStrExt;
-use std::path::Path;
-use std::process;
-use uucore::error::{set_exit_code, UClapError, UResult, UUsageError};
-use uucore::fs::{canonicalize, MissingHandling, ResolveMode};
-use uucore::libc::{self, chroot, setgid, setgroups, setuid};
-use uucore::{entries, format_usage};
+use crate::error::ChrootError;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::ffi::CString;
+use std::io::Error;
+use std::os::unix::prelude::OsStrExt;
+use std::path::Path;
+use std::process;
+use uucore::error::{set_exit_code, UClapError, UResult, UUsageError};
+use uucore::fs::{canonicalize, MissingHandling, ResolveMode};
+use uucore::libc::{self, chroot, setgid, setgroups, setuid};
+use uucore::{entries, format_usage};
 
-static ABOUT: &str = "Run COMMAND with root directory set to NEWROOT.";
-static USAGE: &str = "{} [OPTION]... NEWROOT [COMMAND [ARG]...]";
+static ABOUT: &str = "Run COMMAND with root directory set to NEWROOT.";
+static USAGE: &str = "{} [OPTION]... NEWROOT [COMMAND [ARG]...]";
 
-mod options {
-    pub const NEWROOT: &str = "newroot";
-    pub const USER: &str = "user";
-    pub const GROUP: &str = "group";
-    pub const GROUPS: &str = "groups";
-    pub const USERSPEC: &str = "userspec";
-    pub const COMMAND: &str = "command";
-    pub const SKIP_CHDIR: &str = "skip-chdir";
+mod options {
+    pub const NEWROOT: &str = "newroot";
+    pub const USER: &str = "user";
+    pub const GROUP: &str = "group";
+    pub const GROUPS: &str = "groups";
+    pub const USERSPEC: &str = "userspec";
+    pub const COMMAND: &str = "command";
+    pub const SKIP_CHDIR: &str = "skip-chdir";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
+    let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
 
-    let default_shell: &'static str = "/bin/sh";
-    let default_option: &'static str = "-i";
-    let user_shell = std::env::var("SHELL");
+    let default_shell: &'static str = "/bin/sh";
+    let default_option: &'static str = "-i";
+    let user_shell = std::env::var("SHELL");
 
-    let newroot: &Path = match matches.get_one::<String>(options::NEWROOT) {
-        Some(v) => Path::new(v),
-        None => return Err(ChrootError::MissingNewRoot.into()),
+    let newroot: &Path = match matches.get_one::<String>(options::NEWROOT) {
+        Some(v) => Path::new(v),
+        None => return Err(ChrootError::MissingNewRoot.into()),
     };
 
-    let skip_chdir = matches.get_flag(options::SKIP_CHDIR);
-    // We are resolving the path in case it is a symlink or /. or /../
-    if skip_chdir
-        && canonicalize(newroot, MissingHandling::Normal, ResolveMode::Logical)
-            .unwrap()
-            .to_str()
-            != Some("/")
+    let skip_chdir = matches.get_flag(options::SKIP_CHDIR);
+    // We are resolving the path in case it is a symlink or /. or /../
+    if skip_chdir
+        && canonicalize(newroot, MissingHandling::Normal, ResolveMode::Logical)
+            .unwrap()
+            .to_str()
+            != Some("/")
     {
-        return Err(UUsageError::new(
+        return Err(UUsageError::new(
             125,
             "option --skip-chdir only permitted if NEWROOT is old '/'",
         ));
     }
 
-    if !newroot.is_dir() {
-        return Err(ChrootError::NoSuchDirectory(format!("{}", newroot.display())).into());
+    if !newroot.is_dir() {
+        return Err(ChrootError::NoSuchDirectory(format!("{}", newroot.display())).into());
     }
 
-    let commands = match matches.get_many::<String>(options::COMMAND) {
-        Some(v) => v.map(|s| s.as_str()).collect(),
-        None => vec![],
+    let commands = match matches.get_many::<String>(options::COMMAND) {
+        Some(v) => v.map(|s| s.as_str()).collect(),
+        None => vec![],
     };
 
-    // TODO: refactor the args and command matching
-    // See: https://github.com/uutils/coreutils/pull/2365#discussion_r647849967
-    let command: Vec<&str> = match commands.len() {
-        0 => {
-            let shell: &str = match user_shell {
-                Err(_) => default_shell,
-                Ok(ref s) => s.as_ref(),
+    // TODO: refactor the args and command matching
+    // See: https://github.com/uutils/coreutils/pull/2365#discussion_r647849967
+    let command: Vec<&str> = match commands.len() {
+        0 => {
+            let shell: &str = match user_shell {
+                Err(_) => default_shell,
+                Ok(ref s) => s.as_ref(),
             };
-            vec![shell, default_option]
+            vec![shell, default_option]
         }
-        _ => commands,
+        _ => commands,
     };
 
-    assert!(!command.is_empty());
-    let chroot_command = command[0];
-    let chroot_args = &command[1..];
+    assert!(!command.is_empty());
+    let chroot_command = command[0];
+    let chroot_args = &command[1..];
 
-    // NOTE: Tests can only trigger code beyond this point if they're invoked with root permissions
-    set_context(newroot, &matches)?;
+    // NOTE: Tests can only trigger code beyond this point if they're invoked with root permissions
+    set_context(newroot, &matches)?;
 
-    let pstatus = match process::Command::new(chroot_command)
-        .args(chroot_args)
-        .status()
+    let pstatus = match process::Command::new(chroot_command)
+        .args(chroot_args)
+        .status()
     {
-        Ok(status) => status,
-        Err(e) => {
-            return Err(if e.kind() == std::io::ErrorKind::NotFound {
-                ChrootError::CommandNotFound(command[0].to_string(), e)
-            } else {
-                ChrootError::CommandFailed(command[0].to_string(), e)
+        Ok(status) => status,
+        Err(e) => {
+            return Err(if e.kind() == std::io::ErrorKind::NotFound {
+                ChrootError::CommandNotFound(command[0].to_string(), e)
+            } else {
+                ChrootError::CommandFailed(command[0].to_string(), e)
             }
-            .into())
+            .into())
         }
     };
 
-    let code = if pstatus.success() {
-        0
-    } else {
-        pstatus.code().unwrap_or(-1)
+    let code = if pstatus.success() {
+        0
+    } else {
+        pstatus.code().unwrap_or(-1)
     };
-    set_exit_code(code);
+    set_exit_code(code);
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .trailing_var_arg(true)
-        .arg(
-            Arg::new(options::NEWROOT)
-                .value_hint(clap::ValueHint::DirPath)
-                .hide(true)
-                .required(true)
-                .index(1),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .trailing_var_arg(true)
+        .arg(
+            Arg::new(options::NEWROOT)
+                .value_hint(clap::ValueHint::DirPath)
+                .hide(true)
+                .required(true)
+                .index(1),
         )
-        .arg(
-            Arg::new(options::USER)
-                .short('u')
-                .long(options::USER)
-                .help("User (ID or name) to switch before running the program")
-                .value_name("USER"),
+        .arg(
+            Arg::new(options::USER)
+                .short('u')
+                .long(options::USER)
+                .help("User (ID or name) to switch before running the program")
+                .value_name("USER"),
         )
-        .arg(
-            Arg::new(options::GROUP)
-                .short('g')
-                .long(options::GROUP)
-                .help("Group (ID or name) to switch to")
-                .value_name("GROUP"),
+        .arg(
+            Arg::new(options::GROUP)
+                .short('g')
+                .long(options::GROUP)
+                .help("Group (ID or name) to switch to")
+                .value_name("GROUP"),
         )
-        .arg(
-            Arg::new(options::GROUPS)
-                .short('G')
-                .long(options::GROUPS)
-                .help("Comma-separated list of groups to switch to")
-                .value_name("GROUP1,GROUP2..."),
+        .arg(
+            Arg::new(options::GROUPS)
+                .short('G')
+                .long(options::GROUPS)
+                .help("Comma-separated list of groups to switch to")
+                .value_name("GROUP1,GROUP2..."),
         )
-        .arg(
-            Arg::new(options::USERSPEC)
-                .long(options::USERSPEC)
-                .help(
+        .arg(
+            Arg::new(options::USERSPEC)
+                .long(options::USERSPEC)
+                .help(
                     "Colon-separated user and group to switch to. \
                      Same as -u USER -g GROUP. \
                      Userspec has higher preference than -u and/or -g",
                 )
-                .value_name("USER:GROUP"),
+                .value_name("USER:GROUP"),
         )
-        .arg(
-            Arg::new(options::SKIP_CHDIR)
-                .long(options::SKIP_CHDIR)
-                .help(
+        .arg(
+            Arg::new(options::SKIP_CHDIR)
+                .long(options::SKIP_CHDIR)
+                .help(
                     "Use this option to not change the working directory \
                     to / after changing the root directory to newroot, \
                     i.e., inside the chroot.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::COMMAND)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::CommandName)
-                .hide(true)
-                .index(2),
+        .arg(
+            Arg::new(options::COMMAND)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::CommandName)
+                .hide(true)
+                .index(2),
         )
 }
 
-fn set_context(root: &Path, options: &clap::ArgMatches) -> UResult<()> {
-    let userspec_str = options.get_one::<String>(options::USERSPEC);
-    let user_str = options
-        .get_one::<String>(options::USER)
-        .map(|s| s.as_str())
-        .unwrap_or_default();
-    let group_str = options
-        .get_one::<String>(options::GROUP)
-        .map(|s| s.as_str())
-        .unwrap_or_default();
-    let groups_str = options
-        .get_one::<String>(options::GROUPS)
-        .map(|s| s.as_str())
-        .unwrap_or_default();
-    let skip_chdir = options.contains_id(options::SKIP_CHDIR);
-    let userspec = match userspec_str {
-        Some(u) => {
-            let s: Vec<&str> = u.split(':').collect();
-            if s.len() != 2 || s.iter().any(|&spec| spec.is_empty()) {
-                return Err(ChrootError::InvalidUserspec(u.to_string()).into());
+fn set_context(root: &Path, options: &clap::ArgMatches) -> UResult<()> {
+    let userspec_str = options.get_one::<String>(options::USERSPEC);
+    let user_str = options
+        .get_one::<String>(options::USER)
+        .map(|s| s.as_str())
+        .unwrap_or_default();
+    let group_str = options
+        .get_one::<String>(options::GROUP)
+        .map(|s| s.as_str())
+        .unwrap_or_default();
+    let groups_str = options
+        .get_one::<String>(options::GROUPS)
+        .map(|s| s.as_str())
+        .unwrap_or_default();
+    let skip_chdir = options.contains_id(options::SKIP_CHDIR);
+    let userspec = match userspec_str {
+        Some(u) => {
+            let s: Vec<&str> = u.split(':').collect();
+            if s.len() != 2 || s.iter().any(|&spec| spec.is_empty()) {
+                return Err(ChrootError::InvalidUserspec(u.to_string()).into());
             };
-            s
+            s
         }
-        None => Vec::new(),
+        None => Vec::new(),
     };
 
-    let (user, group) = if userspec.is_empty() {
-        (user_str, group_str)
-    } else {
-        (userspec[0], userspec[1])
+    let (user, group) = if userspec.is_empty() {
+        (user_str, group_str)
+    } else {
+        (userspec[0], userspec[1])
     };
 
-    enter_chroot(root, skip_chdir)?;
+    enter_chroot(root, skip_chdir)?;
 
-    set_groups_from_str(groups_str)?;
-    set_main_group(group)?;
-    set_user(user)?;
+    set_groups_from_str(groups_str)?;
+    set_main_group(group)?;
+    set_user(user)?;
     Ok(())
 }
 
-fn enter_chroot(root: &Path, skip_chdir: bool) -> UResult<()> {
-    let err = unsafe {
-        chroot(
-            CString::new(root.as_os_str().as_bytes().to_vec())
-                .unwrap()
-                .as_bytes_with_nul()
-                .as_ptr() as *const libc::c_char,
+fn enter_chroot(root: &Path, skip_chdir: bool) -> UResult<()> {
+    let err = unsafe {
+        chroot(
+            CString::new(root.as_os_str().as_bytes().to_vec())
+                .unwrap()
+                .as_bytes_with_nul()
+                .as_ptr() as *const libc::c_char,
         )
     };
 
-    if err == 0 {
-        if !skip_chdir {
-            std::env::set_current_dir(root).unwrap();
+    if err == 0 {
+        if !skip_chdir {
+            std::env::set_current_dir(root).unwrap();
         }
         Ok(())
-    } else {
-        Err(ChrootError::CannotEnter(format!("{}", root.display()), Error::last_os_error()).into())
+    } else {
+        Err(ChrootError::CannotEnter(format!("{}", root.display()), Error::last_os_error()).into())
     }
 }
 
-fn set_main_group(group: &str) -> UResult<()> {
-    if !group.is_empty() {
-        let group_id = match entries::grp2gid(group) {
-            Ok(g) => g,
-            _ => return Err(ChrootError::NoSuchGroup(group.to_string()).into()),
+fn set_main_group(group: &str) -> UResult<()> {
+    if !group.is_empty() {
+        let group_id = match entries::grp2gid(group) {
+            Ok(g) => g,
+            _ => return Err(ChrootError::NoSuchGroup(group.to_string()).into()),
         };
-        let err = unsafe { setgid(group_id) };
-        if err != 0 {
-            return Err(
-                ChrootError::SetGidFailed(group_id.to_string(), Error::last_os_error()).into(),
+        let err = unsafe { setgid(group_id) };
+        if err != 0 {
+            return Err(
+                ChrootError::SetGidFailed(group_id.to_string(), Error::last_os_error()).into(),
             );
         }
     }
     Ok(())
 }
 
-#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
-fn set_groups(groups: &[libc::gid_t]) -> libc::c_int {
-    unsafe { setgroups(groups.len() as libc::c_int, groups.as_ptr()) }
+#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
+fn set_groups(groups: &[libc::gid_t]) -> libc::c_int {
+    unsafe { setgroups(groups.len() as libc::c_int, groups.as_ptr()) }
 }
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-fn set_groups(groups: &[libc::gid_t]) -> libc::c_int {
-    unsafe { setgroups(groups.len() as libc::size_t, groups.as_ptr()) }
+#[cfg(any(target_os = "linux", target_os = "android"))]
+fn set_groups(groups: &[libc::gid_t]) -> libc::c_int {
+    unsafe { setgroups(groups.len() as libc::size_t, groups.as_ptr()) }
 }
 
-fn set_groups_from_str(groups: &str) -> UResult<()> {
-    if !groups.is_empty() {
-        let mut groups_vec = vec![];
-        for group in groups.split(',') {
-            let gid = match entries::grp2gid(group) {
-                Ok(g) => g,
-                Err(_) => return Err(ChrootError::NoSuchGroup(group.to_string()).into()),
+fn set_groups_from_str(groups: &str) -> UResult<()> {
+    if !groups.is_empty() {
+        let mut groups_vec = vec![];
+        for group in groups.split(',') {
+            let gid = match entries::grp2gid(group) {
+                Ok(g) => g,
+                Err(_) => return Err(ChrootError::NoSuchGroup(group.to_string()).into()),
             };
-            groups_vec.push(gid);
+            groups_vec.push(gid);
         }
-        let err = set_groups(&groups_vec);
-        if err != 0 {
-            return Err(ChrootError::SetGroupsFailed(Error::last_os_error()).into());
+        let err = set_groups(&groups_vec);
+        if err != 0 {
+            return Err(ChrootError::SetGroupsFailed(Error::last_os_error()).into());
         }
     }
     Ok(())
 }
 
-fn set_user(user: &str) -> UResult<()> {
-    if !user.is_empty() {
-        let user_id = entries::usr2uid(user).unwrap();
-        let err = unsafe { setuid(user_id as libc::uid_t) };
-        if err != 0 {
-            return Err(
-                ChrootError::SetUserFailed(user.to_string(), Error::last_os_error()).into(),
+fn set_user(user: &str) -> UResult<()> {
+    if !user.is_empty() {
+        let user_id = entries::usr2uid(user).unwrap();
+        let err = unsafe { setuid(user_id as libc::uid_t) };
+        if err != 0 {
+            return Err(
+                ChrootError::SetUserFailed(user.to_string(), Error::last_os_error()).into(),
             );
         }
     }
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_chroot/error.rs.html b/dev/src/uu_chroot/error.rs.html index 5b19969a6..cb9a9dca8 100644 --- a/dev/src/uu_chroot/error.rs.html +++ b/dev/src/uu_chroot/error.rs.html @@ -1,4 +1,4 @@ -error.rs - source
1
+error.rs - source
1
 2
 3
 4
@@ -85,92 +85,92 @@
 85
 86
 87
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore NEWROOT Userspec userspec
-//! Errors returned by chroot.
-use std::fmt::Display;
-use std::io::Error;
-use uucore::display::Quotable;
-use uucore::error::UError;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore NEWROOT Userspec userspec
+//! Errors returned by chroot.
+use std::fmt::Display;
+use std::io::Error;
+use uucore::display::Quotable;
+use uucore::error::UError;
 
-/// Errors that can happen while executing chroot.
-#[derive(Debug)]
-pub enum ChrootError {
-    /// Failed to enter the specified directory.
-    CannotEnter(String, Error),
+/// Errors that can happen while executing chroot.
+#[derive(Debug)]
+pub enum ChrootError {
+    /// Failed to enter the specified directory.
+    CannotEnter(String, Error),
 
-    /// Failed to execute the specified command.
-    CommandFailed(String, Error),
+    /// Failed to execute the specified command.
+    CommandFailed(String, Error),
 
-    /// Failed to find the specified command.
-    CommandNotFound(String, Error),
+    /// Failed to find the specified command.
+    CommandNotFound(String, Error),
 
-    /// The given user and group specification was invalid.
-    InvalidUserspec(String),
+    /// The given user and group specification was invalid.
+    InvalidUserspec(String),
 
-    /// The new root directory was not given.
-    MissingNewRoot,
+    /// The new root directory was not given.
+    MissingNewRoot,
 
-    /// Failed to find the specified group.
-    NoSuchGroup(String),
+    /// Failed to find the specified group.
+    NoSuchGroup(String),
 
-    /// The given directory does not exist.
-    NoSuchDirectory(String),
+    /// The given directory does not exist.
+    NoSuchDirectory(String),
 
-    /// The call to `setgid()` failed.
-    SetGidFailed(String, Error),
+    /// The call to `setgid()` failed.
+    SetGidFailed(String, Error),
 
-    /// The call to `setgroups()` failed.
-    SetGroupsFailed(Error),
+    /// The call to `setgroups()` failed.
+    SetGroupsFailed(Error),
 
-    /// The call to `setuid()` failed.
-    SetUserFailed(String, Error),
+    /// The call to `setuid()` failed.
+    SetUserFailed(String, Error),
 }
 
-impl std::error::Error for ChrootError {}
+impl std::error::Error for ChrootError {}
 
-impl UError for ChrootError {
-    // 125 if chroot itself fails
-    // 126 if command is found but cannot be invoked
-    // 127 if command cannot be found
-    fn code(&self) -> i32 {
-        match self {
-            Self::CommandFailed(_, _) => 126,
-            Self::CommandNotFound(_, _) => 127,
-            _ => 125,
+impl UError for ChrootError {
+    // 125 if chroot itself fails
+    // 126 if command is found but cannot be invoked
+    // 127 if command cannot be found
+    fn code(&self) -> i32 {
+        match self {
+            Self::CommandFailed(_, _) => 126,
+            Self::CommandNotFound(_, _) => 127,
+            _ => 125,
         }
     }
 }
 
-impl Display for ChrootError {
-    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
-        match self {
-            Self::CannotEnter(s, e) => write!(f, "cannot chroot to {}: {}", s.quote(), e,),
-            Self::CommandFailed(s, e) | Self::CommandNotFound(s, e) => {
-                write!(f, "failed to run command {}: {}", s.to_string().quote(), e,)
+impl Display for ChrootError {
+    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+        match self {
+            Self::CannotEnter(s, e) => write!(f, "cannot chroot to {}: {}", s.quote(), e,),
+            Self::CommandFailed(s, e) | Self::CommandNotFound(s, e) => {
+                write!(f, "failed to run command {}: {}", s.to_string().quote(), e,)
             }
-            Self::InvalidUserspec(s) => write!(f, "invalid userspec: {}", s.quote(),),
-            Self::MissingNewRoot => write!(
-                f,
+            Self::InvalidUserspec(s) => write!(f, "invalid userspec: {}", s.quote(),),
+            Self::MissingNewRoot => write!(
+                f,
                 "Missing operand: NEWROOT\nTry '{} --help' for more information.",
-                uucore::execution_phrase(),
+                uucore::execution_phrase(),
             ),
-            Self::NoSuchGroup(s) => write!(f, "no such group: {}", s.maybe_quote(),),
-            Self::NoSuchDirectory(s) => write!(
-                f,
+            Self::NoSuchGroup(s) => write!(f, "no such group: {}", s.maybe_quote(),),
+            Self::NoSuchDirectory(s) => write!(
+                f,
                 "cannot change root directory to {}: no such directory",
-                s.quote(),
+                s.quote(),
             ),
-            Self::SetGidFailed(s, e) => write!(f, "cannot set gid to {}: {}", s, e),
-            Self::SetGroupsFailed(e) => write!(f, "cannot set groups: {}", e),
-            Self::SetUserFailed(s, e) => {
-                write!(f, "cannot set user to {}: {}", s.maybe_quote(), e)
+            Self::SetGidFailed(s, e) => write!(f, "cannot set gid to {}: {}", s, e),
+            Self::SetGroupsFailed(e) => write!(f, "cannot set groups: {}", e),
+            Self::SetUserFailed(s, e) => {
+                write!(f, "cannot set user to {}: {}", s.maybe_quote(), e)
             }
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_cksum/cksum.rs.html b/dev/src/uu_cksum/cksum.rs.html index c16734f28..4092941dc 100644 --- a/dev/src/uu_cksum/cksum.rs.html +++ b/dev/src/uu_cksum/cksum.rs.html @@ -1,4 +1,4 @@ -cksum.rs - source
1
+cksum.rs - source
1
 2
 3
 4
@@ -151,158 +151,158 @@
 151
 152
 153
-
// This file is part of the uutils coreutils package.
-//
-// (c) Michael Gehring <mg@ebfe.org>
-//
-//  For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Michael Gehring <mg@ebfe.org>
+//
+//  For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) fname
-use clap::{crate_version, Arg, Command};
-use std::fs::File;
-use std::io::{self, stdin, BufReader, Read};
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult};
-use uucore::{format_usage, show};
+// spell-checker:ignore (ToDO) fname
+use clap::{crate_version, Arg, Command};
+use std::fs::File;
+use std::io::{self, stdin, BufReader, Read};
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult};
+use uucore::{format_usage, show};
 
-// NOTE: CRC_TABLE_LEN *must* be <= 256 as we cast 0..CRC_TABLE_LEN to u8
-const CRC_TABLE_LEN: usize = 256;
-const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table();
+// NOTE: CRC_TABLE_LEN *must* be <= 256 as we cast 0..CRC_TABLE_LEN to u8
+const CRC_TABLE_LEN: usize = 256;
+const CRC_TABLE: [u32; CRC_TABLE_LEN] = generate_crc_table();
 
-const NAME: &str = "cksum";
-const USAGE: &str = "{} [OPTIONS] [FILE]...";
-const ABOUT: &str = "Print CRC and size for each file";
+const NAME: &str = "cksum";
+const USAGE: &str = "{} [OPTIONS] [FILE]...";
+const ABOUT: &str = "Print CRC and size for each file";
 
-const fn generate_crc_table() -> [u32; CRC_TABLE_LEN] {
-    let mut table = [0; CRC_TABLE_LEN];
+const fn generate_crc_table() -> [u32; CRC_TABLE_LEN] {
+    let mut table = [0; CRC_TABLE_LEN];
 
-    let mut i = 0;
-    while i < CRC_TABLE_LEN {
-        table[i] = crc_entry(i as u8) as u32;
+    let mut i = 0;
+    while i < CRC_TABLE_LEN {
+        table[i] = crc_entry(i as u8) as u32;
 
-        i += 1;
+        i += 1;
     }
 
-    table
+    table
 }
 
-const fn crc_entry(input: u8) -> u32 {
-    let mut crc = (input as u32) << 24;
+const fn crc_entry(input: u8) -> u32 {
+    let mut crc = (input as u32) << 24;
 
-    let mut i = 0;
-    while i < 8 {
-        let if_condition = crc & 0x8000_0000;
-        let if_body = (crc << 1) ^ 0x04c1_1db7;
-        let else_body = crc << 1;
+    let mut i = 0;
+    while i < 8 {
+        let if_condition = crc & 0x8000_0000;
+        let if_body = (crc << 1) ^ 0x04c1_1db7;
+        let else_body = crc << 1;
 
-        // NOTE: i feel like this is easier to understand than emulating an if statement in bitwise
-        //       ops
-        let condition_table = [else_body, if_body];
+        // NOTE: i feel like this is easier to understand than emulating an if statement in bitwise
+        //       ops
+        let condition_table = [else_body, if_body];
 
-        crc = condition_table[(if_condition != 0) as usize];
-        i += 1;
+        crc = condition_table[(if_condition != 0) as usize];
+        i += 1;
     }
 
-    crc
+    crc
 }
 
-#[inline]
-fn crc_update(crc: u32, input: u8) -> u32 {
-    (crc << 8) ^ CRC_TABLE[((crc >> 24) as usize ^ input as usize) & 0xFF]
+#[inline]
+fn crc_update(crc: u32, input: u8) -> u32 {
+    (crc << 8) ^ CRC_TABLE[((crc >> 24) as usize ^ input as usize) & 0xFF]
 }
 
-#[inline]
-fn crc_final(mut crc: u32, mut length: usize) -> u32 {
-    while length != 0 {
-        crc = crc_update(crc, length as u8);
-        length >>= 8;
+#[inline]
+fn crc_final(mut crc: u32, mut length: usize) -> u32 {
+    while length != 0 {
+        crc = crc_update(crc, length as u8);
+        length >>= 8;
     }
 
-    !crc
+    !crc
 }
 
-fn init_byte_array() -> Vec<u8> {
-    vec![0; 1024 * 1024]
+fn init_byte_array() -> Vec<u8> {
+    vec![0; 1024 * 1024]
 }
 
-#[inline]
-fn cksum(fname: &str) -> io::Result<(u32, usize)> {
-    let mut crc = 0u32;
-    let mut size = 0usize;
+#[inline]
+fn cksum(fname: &str) -> io::Result<(u32, usize)> {
+    let mut crc = 0u32;
+    let mut size = 0usize;
 
-    let mut rd: Box<dyn Read> = match fname {
-        "-" => Box::new(stdin()),
-        _ => {
-            let p = Path::new(fname);
+    let mut rd: Box<dyn Read> = match fname {
+        "-" => Box::new(stdin()),
+        _ => {
+            let p = Path::new(fname);
 
-            // Directories should not give an error, but should be interpreted
-            // as empty files to match GNU semantics.
-            if p.is_dir() {
-                Box::new(BufReader::new(io::empty())) as Box<dyn Read>
-            } else {
-                Box::new(BufReader::new(File::open(p)?)) as Box<dyn Read>
+            // Directories should not give an error, but should be interpreted
+            // as empty files to match GNU semantics.
+            if p.is_dir() {
+                Box::new(BufReader::new(io::empty())) as Box<dyn Read>
+            } else {
+                Box::new(BufReader::new(File::open(p)?)) as Box<dyn Read>
             }
         }
     };
 
-    let mut bytes = init_byte_array();
-    loop {
-        let num_bytes = rd.read(&mut bytes)?;
-        if num_bytes == 0 {
-            return Ok((crc_final(crc, size), size));
+    let mut bytes = init_byte_array();
+    loop {
+        let num_bytes = rd.read(&mut bytes)?;
+        if num_bytes == 0 {
+            return Ok((crc_final(crc, size), size));
         }
-        for &b in bytes[..num_bytes].iter() {
-            crc = crc_update(crc, b);
+        for &b in bytes[..num_bytes].iter() {
+            crc = crc_update(crc, b);
         }
-        size += num_bytes;
+        size += num_bytes;
     }
 }
 
-mod options {
-    pub static FILE: &str = "file";
+mod options {
+    pub static FILE: &str = "file";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let files: Vec<String> = match matches.get_many::<String>(options::FILE) {
-        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
-        None => vec![],
+    let files: Vec<String> = match matches.get_many::<String>(options::FILE) {
+        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
+        None => vec![],
     };
 
-    if files.is_empty() {
-        let (crc, size) = cksum("-")?;
-        println!("{} {}", crc, size);
-        return Ok(());
+    if files.is_empty() {
+        let (crc, size) = cksum("-")?;
+        println!("{} {}", crc, size);
+        return Ok(());
     }
 
-    for fname in &files {
-        match cksum(fname.as_ref()).map_err_context(|| format!("{}", fname.maybe_quote())) {
-            Ok((crc, size)) => println!("{} {} {}", crc, size, fname),
-            Err(err) => show!(err),
+    for fname in &files {
+        match cksum(fname.as_ref()).map_err_context(|| format!("{}", fname.maybe_quote())) {
+            Ok((crc, size)) => println!("{} {} {}", crc, size, fname),
+            Err(err) => show!(err),
         };
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .action(clap::ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .action(clap::ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_comm/comm.rs.html b/dev/src/uu_comm/comm.rs.html index 6270ba718..24778a7ef 100644 --- a/dev/src/uu_comm/comm.rs.html +++ b/dev/src/uu_comm/comm.rs.html @@ -1,4 +1,4 @@ -comm.rs - source
1
+comm.rs - source
1
 2
 3
 4
@@ -188,195 +188,195 @@
 188
 189
 190
-
// This file is part of the uutils coreutils package.
-//
-// (c) Michael Gehring <mg@ebfe.org>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Michael Gehring <mg@ebfe.org>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) delim mkdelim
+// spell-checker:ignore (ToDO) delim mkdelim
 
-use std::cmp::Ordering;
-use std::fs::File;
-use std::io::{self, stdin, BufRead, BufReader, Stdin};
-use std::path::Path;
-use uucore::error::FromIo;
-use uucore::error::UResult;
-use uucore::format_usage;
+use std::cmp::Ordering;
+use std::fs::File;
+use std::io::{self, stdin, BufRead, BufReader, Stdin};
+use std::path::Path;
+use uucore::error::FromIo;
+use uucore::error::UResult;
+use uucore::format_usage;
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
 
-static ABOUT: &str = "compare two sorted files line by line";
-static LONG_HELP: &str = "";
-const USAGE: &str = "{} [OPTION]... FILE1 FILE2";
+static ABOUT: &str = "compare two sorted files line by line";
+static LONG_HELP: &str = "";
+const USAGE: &str = "{} [OPTION]... FILE1 FILE2";
 
-mod options {
-    pub const COLUMN_1: &str = "1";
-    pub const COLUMN_2: &str = "2";
-    pub const COLUMN_3: &str = "3";
-    pub const DELIMITER: &str = "output-delimiter";
-    pub const DELIMITER_DEFAULT: &str = "\t";
-    pub const FILE_1: &str = "FILE1";
-    pub const FILE_2: &str = "FILE2";
+mod options {
+    pub const COLUMN_1: &str = "1";
+    pub const COLUMN_2: &str = "2";
+    pub const COLUMN_3: &str = "3";
+    pub const DELIMITER: &str = "output-delimiter";
+    pub const DELIMITER_DEFAULT: &str = "\t";
+    pub const FILE_1: &str = "FILE1";
+    pub const FILE_2: &str = "FILE2";
 }
 
-fn mkdelim(col: usize, opts: &ArgMatches) -> String {
-    let mut s = String::new();
-    let delim = match opts.get_one::<String>(options::DELIMITER).unwrap().as_str() {
-        "" => "\0",
-        delim => delim,
+fn mkdelim(col: usize, opts: &ArgMatches) -> String {
+    let mut s = String::new();
+    let delim = match opts.get_one::<String>(options::DELIMITER).unwrap().as_str() {
+        "" => "\0",
+        delim => delim,
     };
 
-    if col > 1 && !opts.get_flag(options::COLUMN_1) {
-        s.push_str(delim.as_ref());
+    if col > 1 && !opts.get_flag(options::COLUMN_1) {
+        s.push_str(delim.as_ref());
     }
-    if col > 2 && !opts.get_flag(options::COLUMN_2) {
-        s.push_str(delim.as_ref());
+    if col > 2 && !opts.get_flag(options::COLUMN_2) {
+        s.push_str(delim.as_ref());
     }
 
-    s
+    s
 }
 
-fn ensure_nl(line: &mut String) {
-    if !line.ends_with('\n') {
-        line.push('\n');
+fn ensure_nl(line: &mut String) {
+    if !line.ends_with('\n') {
+        line.push('\n');
     }
 }
 
-enum LineReader {
-    Stdin(Stdin),
-    FileIn(BufReader<File>),
+enum LineReader {
+    Stdin(Stdin),
+    FileIn(BufReader<File>),
 }
 
-impl LineReader {
-    fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
-        match *self {
-            Self::Stdin(ref mut r) => r.read_line(buf),
-            Self::FileIn(ref mut r) => r.read_line(buf),
+impl LineReader {
+    fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
+        match *self {
+            Self::Stdin(ref mut r) => r.read_line(buf),
+            Self::FileIn(ref mut r) => r.read_line(buf),
         }
     }
 }
 
-fn comm(a: &mut LineReader, b: &mut LineReader, opts: &ArgMatches) {
-    let delim: Vec<String> = (0..4).map(|col| mkdelim(col, opts)).collect();
+fn comm(a: &mut LineReader, b: &mut LineReader, opts: &ArgMatches) {
+    let delim: Vec<String> = (0..4).map(|col| mkdelim(col, opts)).collect();
 
-    let ra = &mut String::new();
-    let mut na = a.read_line(ra);
-    let rb = &mut String::new();
-    let mut nb = b.read_line(rb);
+    let ra = &mut String::new();
+    let mut na = a.read_line(ra);
+    let rb = &mut String::new();
+    let mut nb = b.read_line(rb);
 
-    while na.is_ok() || nb.is_ok() {
-        let ord = match (na.is_ok(), nb.is_ok()) {
-            (false, true) => Ordering::Greater,
-            (true, false) => Ordering::Less,
-            (true, true) => match (&na, &nb) {
+    while na.is_ok() || nb.is_ok() {
+        let ord = match (na.is_ok(), nb.is_ok()) {
+            (false, true) => Ordering::Greater,
+            (true, false) => Ordering::Less,
+            (true, true) => match (&na, &nb) {
                 (&Ok(0), &Ok(0)) => break,
-                (&Ok(0), _) => Ordering::Greater,
-                (_, &Ok(0)) => Ordering::Less,
-                _ => ra.cmp(&rb),
+                (&Ok(0), _) => Ordering::Greater,
+                (_, &Ok(0)) => Ordering::Less,
+                _ => ra.cmp(&rb),
             },
-            _ => unreachable!(),
+            _ => unreachable!(),
         };
 
-        match ord {
-            Ordering::Less => {
-                if !opts.get_flag(options::COLUMN_1) {
-                    ensure_nl(ra);
-                    print!("{}{}", delim[1], ra);
+        match ord {
+            Ordering::Less => {
+                if !opts.get_flag(options::COLUMN_1) {
+                    ensure_nl(ra);
+                    print!("{}{}", delim[1], ra);
                 }
-                ra.clear();
-                na = a.read_line(ra);
+                ra.clear();
+                na = a.read_line(ra);
             }
-            Ordering::Greater => {
-                if !opts.get_flag(options::COLUMN_2) {
-                    ensure_nl(rb);
-                    print!("{}{}", delim[2], rb);
+            Ordering::Greater => {
+                if !opts.get_flag(options::COLUMN_2) {
+                    ensure_nl(rb);
+                    print!("{}{}", delim[2], rb);
                 }
-                rb.clear();
-                nb = b.read_line(rb);
+                rb.clear();
+                nb = b.read_line(rb);
             }
-            Ordering::Equal => {
-                if !opts.get_flag(options::COLUMN_3) {
-                    ensure_nl(ra);
-                    print!("{}{}", delim[3], ra);
+            Ordering::Equal => {
+                if !opts.get_flag(options::COLUMN_3) {
+                    ensure_nl(ra);
+                    print!("{}{}", delim[3], ra);
                 }
-                ra.clear();
-                rb.clear();
-                na = a.read_line(ra);
-                nb = b.read_line(rb);
+                ra.clear();
+                rb.clear();
+                na = a.read_line(ra);
+                nb = b.read_line(rb);
             }
         }
     }
 }
 
-fn open_file(name: &str) -> io::Result<LineReader> {
-    match name {
-        "-" => Ok(LineReader::Stdin(stdin())),
-        _ => {
-            let f = File::open(Path::new(name))?;
-            Ok(LineReader::FileIn(BufReader::new(f)))
+fn open_file(name: &str) -> io::Result<LineReader> {
+    match name {
+        "-" => Ok(LineReader::Stdin(stdin())),
+        _ => {
+            let f = File::open(Path::new(name))?;
+            Ok(LineReader::FileIn(BufReader::new(f)))
         }
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args)?;
-    let filename1 = matches.get_one::<String>(options::FILE_1).unwrap();
-    let filename2 = matches.get_one::<String>(options::FILE_2).unwrap();
-    let mut f1 = open_file(filename1).map_err_context(|| filename1.to_string())?;
-    let mut f2 = open_file(filename2).map_err_context(|| filename2.to_string())?;
+    let matches = uu_app().try_get_matches_from(args)?;
+    let filename1 = matches.get_one::<String>(options::FILE_1).unwrap();
+    let filename2 = matches.get_one::<String>(options::FILE_2).unwrap();
+    let mut f1 = open_file(filename1).map_err_context(|| filename1.to_string())?;
+    let mut f2 = open_file(filename2).map_err_context(|| filename2.to_string())?;
 
-    comm(&mut f1, &mut f2, &matches);
+    comm(&mut f1, &mut f2, &matches);
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(LONG_HELP)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::COLUMN_1)
-                .short('1')
-                .help("suppress column 1 (lines unique to FILE1)")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(LONG_HELP)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::COLUMN_1)
+                .short('1')
+                .help("suppress column 1 (lines unique to FILE1)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::COLUMN_2)
-                .short('2')
-                .help("suppress column 2 (lines unique to FILE2)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::COLUMN_2)
+                .short('2')
+                .help("suppress column 2 (lines unique to FILE2)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::COLUMN_3)
-                .short('3')
-                .help("suppress column 3 (lines that appear in both files)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::COLUMN_3)
+                .short('3')
+                .help("suppress column 3 (lines that appear in both files)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DELIMITER)
-                .long(options::DELIMITER)
-                .help("separate columns with STR")
-                .value_name("STR")
-                .default_value(options::DELIMITER_DEFAULT)
-                .hide_default_value(true),
+        .arg(
+            Arg::new(options::DELIMITER)
+                .long(options::DELIMITER)
+                .help("separate columns with STR")
+                .value_name("STR")
+                .default_value(options::DELIMITER_DEFAULT)
+                .hide_default_value(true),
         )
-        .arg(
-            Arg::new(options::FILE_1)
-                .required(true)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILE_1)
+                .required(true)
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::FILE_2)
-                .required(true)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILE_2)
+                .required(true)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_cp/copydir.rs.html b/dev/src/uu_cp/copydir.rs.html index b3e756a69..4fab8082f 100644 --- a/dev/src/uu_cp/copydir.rs.html +++ b/dev/src/uu_cp/copydir.rs.html @@ -1,4 +1,4 @@ -copydir.rs - source
1
+copydir.rs - source
1
 2
 3
 4
@@ -383,390 +383,390 @@
 383
 384
 385
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore TODO canonicalizes direntry pathbuf symlinked
-//! Recursively copy the contents of a directory.
-//!
-//! See the [`copy_directory`] function for more information.
-#[cfg(windows)]
-use std::borrow::Cow;
-use std::collections::HashSet;
-use std::env;
-use std::fs;
-use std::io;
-use std::path::{Path, PathBuf, StripPrefixError};
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore TODO canonicalizes direntry pathbuf symlinked
+//! Recursively copy the contents of a directory.
+//!
+//! See the [`copy_directory`] function for more information.
+#[cfg(windows)]
+use std::borrow::Cow;
+use std::collections::HashSet;
+use std::env;
+use std::fs;
+use std::io;
+use std::path::{Path, PathBuf, StripPrefixError};
 
-use uucore::display::Quotable;
-use uucore::error::UIoError;
-use uucore::fs::{canonicalize, FileInformation, MissingHandling, ResolveMode};
-use walkdir::{DirEntry, WalkDir};
+use uucore::display::Quotable;
+use uucore::error::UIoError;
+use uucore::fs::{canonicalize, FileInformation, MissingHandling, ResolveMode};
+use walkdir::{DirEntry, WalkDir};
 
-use crate::{
-    copy_attributes, copy_file, copy_link, preserve_hardlinks, CopyResult, Error, Options,
-    TargetSlice,
+use crate::{
+    copy_attributes, copy_file, copy_link, preserve_hardlinks, CopyResult, Error, Options,
+    TargetSlice,
 };
 
-/// Ensure a Windows path starts with a `\\?`.
-#[cfg(target_os = "windows")]
-fn adjust_canonicalization(p: &Path) -> Cow<Path> {
-    // In some cases, \\? can be missing on some Windows paths.  Add it at the
-    // beginning unless the path is prefixed with a device namespace.
-    const VERBATIM_PREFIX: &str = r#"\\?"#;
-    const DEVICE_NS_PREFIX: &str = r#"\\."#;
+/// Ensure a Windows path starts with a `\\?`.
+#[cfg(target_os = "windows")]
+fn adjust_canonicalization(p: &Path) -> Cow<Path> {
+    // In some cases, \\? can be missing on some Windows paths.  Add it at the
+    // beginning unless the path is prefixed with a device namespace.
+    const VERBATIM_PREFIX: &str = r#"\\?"#;
+    const DEVICE_NS_PREFIX: &str = r#"\\."#;
 
-    let has_prefix = p
-        .components()
-        .next()
-        .and_then(|comp| comp.as_os_str().to_str())
-        .map(|p_str| p_str.starts_with(VERBATIM_PREFIX) || p_str.starts_with(DEVICE_NS_PREFIX))
-        .unwrap_or_default();
+    let has_prefix = p
+        .components()
+        .next()
+        .and_then(|comp| comp.as_os_str().to_str())
+        .map(|p_str| p_str.starts_with(VERBATIM_PREFIX) || p_str.starts_with(DEVICE_NS_PREFIX))
+        .unwrap_or_default();
 
-    if has_prefix {
-        p.into()
-    } else {
-        Path::new(VERBATIM_PREFIX).join(p).into()
+    if has_prefix {
+        p.into()
+    } else {
+        Path::new(VERBATIM_PREFIX).join(p).into()
     }
 }
 
-/// Get a descendant path relative to the given parent directory.
-///
-/// If `root_parent` is `None`, then this just returns the `path`
-/// itself. Otherwise, this function strips the parent prefix from the
-/// given `path`, leaving only the portion of the path relative to the
-/// parent.
-fn get_local_to_root_parent(
-    path: &Path,
-    root_parent: Option<&Path>,
-) -> Result<PathBuf, StripPrefixError> {
-    match root_parent {
-        Some(parent) => {
-            // On Windows, some paths are starting with \\?
-            // but not always, so, make sure that we are consistent for strip_prefix
-            // See https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file for more info
-            #[cfg(windows)]
-            let (path, parent) = (
-                adjust_canonicalization(path),
-                adjust_canonicalization(parent),
+/// Get a descendant path relative to the given parent directory.
+///
+/// If `root_parent` is `None`, then this just returns the `path`
+/// itself. Otherwise, this function strips the parent prefix from the
+/// given `path`, leaving only the portion of the path relative to the
+/// parent.
+fn get_local_to_root_parent(
+    path: &Path,
+    root_parent: Option<&Path>,
+) -> Result<PathBuf, StripPrefixError> {
+    match root_parent {
+        Some(parent) => {
+            // On Windows, some paths are starting with \\?
+            // but not always, so, make sure that we are consistent for strip_prefix
+            // See https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file for more info
+            #[cfg(windows)]
+            let (path, parent) = (
+                adjust_canonicalization(path),
+                adjust_canonicalization(parent),
             );
-            let path = path.strip_prefix(parent)?;
-            Ok(path.to_path_buf())
+            let path = path.strip_prefix(parent)?;
+            Ok(path.to_path_buf())
         }
-        None => Ok(path.to_path_buf()),
+        None => Ok(path.to_path_buf()),
     }
 }
 
-/// Paths that are invariant throughout the traversal when copying a directory.
-struct Context<'a> {
-    /// The current working directory at the time of starting the traversal.
-    current_dir: PathBuf,
+/// Paths that are invariant throughout the traversal when copying a directory.
+struct Context<'a> {
+    /// The current working directory at the time of starting the traversal.
+    current_dir: PathBuf,
 
-    /// The path to the parent of the source directory, if any.
-    root_parent: Option<PathBuf>,
+    /// The path to the parent of the source directory, if any.
+    root_parent: Option<PathBuf>,
 
-    /// The target path to which the directory will be copied.
-    target: &'a Path,
+    /// The target path to which the directory will be copied.
+    target: &'a Path,
 }
 
-impl<'a> Context<'a> {
-    fn new(root: &'a Path, target: &'a Path) -> std::io::Result<Self> {
-        let current_dir = env::current_dir()?;
-        let root_path = current_dir.join(root);
-        let root_parent = if target.exists() {
-            root_path.parent().map(|p| p.to_path_buf())
-        } else {
-            Some(root_path)
+impl<'a> Context<'a> {
+    fn new(root: &'a Path, target: &'a Path) -> std::io::Result<Self> {
+        let current_dir = env::current_dir()?;
+        let root_path = current_dir.join(root);
+        let root_parent = if target.exists() {
+            root_path.parent().map(|p| p.to_path_buf())
+        } else {
+            Some(root_path)
         };
-        Ok(Self {
-            current_dir,
-            root_parent,
-            target,
+        Ok(Self {
+            current_dir,
+            root_parent,
+            target,
         })
     }
 }
 
-/// Data needed to perform a single copy operation while traversing a directory.
-///
-/// For convenience while traversing a directory, the [`Entry::new`]
-/// function allows creating an entry from a [`Context`] and a
-/// [`walkdir::DirEntry`].
-///
-/// # Examples
-///
-/// For example, if the source directory structure is `a/b/c`, the
-/// target is `d/`, a directory that already exists, and the copy
-/// command is `cp -r a/b/c d`, then the overall set of copy
-/// operations could be represented as three entries,
-///
-/// ```rust,ignore
-/// let operations = [
-///     Entry {
-///         source_absolute: "/tmp/a".into(),
-///         source_relative: "a".into(),
-///         local_to_target: "d/a".into(),
-///         target_is_file: false,
-///     }
-///     Entry {
-///         source_absolute: "/tmp/a/b".into(),
-///         source_relative: "a/b".into(),
-///         local_to_target: "d/a/b".into(),
-///         target_is_file: false,
-///     }
-///     Entry {
-///         source_absolute: "/tmp/a/b/c".into(),
-///         source_relative: "a/b/c".into(),
-///         local_to_target: "d/a/b/c".into(),
-///         target_is_file: false,
-///     }
-/// ];
-/// ```
-struct Entry {
-    /// The absolute path to file or directory to copy.
-    source_absolute: PathBuf,
+/// Data needed to perform a single copy operation while traversing a directory.
+///
+/// For convenience while traversing a directory, the [`Entry::new`]
+/// function allows creating an entry from a [`Context`] and a
+/// [`walkdir::DirEntry`].
+///
+/// # Examples
+///
+/// For example, if the source directory structure is `a/b/c`, the
+/// target is `d/`, a directory that already exists, and the copy
+/// command is `cp -r a/b/c d`, then the overall set of copy
+/// operations could be represented as three entries,
+///
+/// ```rust,ignore
+/// let operations = [
+///     Entry {
+///         source_absolute: "/tmp/a".into(),
+///         source_relative: "a".into(),
+///         local_to_target: "d/a".into(),
+///         target_is_file: false,
+///     }
+///     Entry {
+///         source_absolute: "/tmp/a/b".into(),
+///         source_relative: "a/b".into(),
+///         local_to_target: "d/a/b".into(),
+///         target_is_file: false,
+///     }
+///     Entry {
+///         source_absolute: "/tmp/a/b/c".into(),
+///         source_relative: "a/b/c".into(),
+///         local_to_target: "d/a/b/c".into(),
+///         target_is_file: false,
+///     }
+/// ];
+/// ```
+struct Entry {
+    /// The absolute path to file or directory to copy.
+    source_absolute: PathBuf,
 
-    /// The relative path to file or directory to copy.
-    source_relative: PathBuf,
+    /// The relative path to file or directory to copy.
+    source_relative: PathBuf,
 
-    /// The path to the destination, relative to the target.
-    local_to_target: PathBuf,
+    /// The path to the destination, relative to the target.
+    local_to_target: PathBuf,
 
-    /// Whether the destination is a file.
-    target_is_file: bool,
+    /// Whether the destination is a file.
+    target_is_file: bool,
 }
 
-impl Entry {
-    fn new(context: &Context, direntry: &DirEntry) -> Result<Self, StripPrefixError> {
-        let source_relative = direntry.path().to_path_buf();
-        let source_absolute = context.current_dir.join(&source_relative);
-        let descendant =
-            get_local_to_root_parent(&source_absolute, context.root_parent.as_deref())?;
-        let local_to_target = context.target.join(descendant);
-        let target_is_file = context.target.is_file();
-        Ok(Self {
-            source_absolute,
-            source_relative,
-            local_to_target,
-            target_is_file,
+impl Entry {
+    fn new(context: &Context, direntry: &DirEntry) -> Result<Self, StripPrefixError> {
+        let source_relative = direntry.path().to_path_buf();
+        let source_absolute = context.current_dir.join(&source_relative);
+        let descendant =
+            get_local_to_root_parent(&source_absolute, context.root_parent.as_deref())?;
+        let local_to_target = context.target.join(descendant);
+        let target_is_file = context.target.is_file();
+        Ok(Self {
+            source_absolute,
+            source_relative,
+            local_to_target,
+            target_is_file,
         })
     }
 }
 
-/// Copy a single entry during a directory traversal.
-fn copy_direntry(
-    entry: Entry,
-    options: &Options,
-    symlinked_files: &mut HashSet<FileInformation>,
-    preserve_hard_links: bool,
-    hard_links: &mut Vec<(String, u64)>,
-) -> CopyResult<()> {
-    let Entry {
-        source_absolute,
-        source_relative,
-        local_to_target,
-        target_is_file,
-    } = entry;
+/// Copy a single entry during a directory traversal.
+fn copy_direntry(
+    entry: Entry,
+    options: &Options,
+    symlinked_files: &mut HashSet<FileInformation>,
+    preserve_hard_links: bool,
+    hard_links: &mut Vec<(String, u64)>,
+) -> CopyResult<()> {
+    let Entry {
+        source_absolute,
+        source_relative,
+        local_to_target,
+        target_is_file,
+    } = entry;
 
-    // If the source is a symbolic link and the options tell us not to
-    // dereference the link, then copy the link object itself.
-    if source_absolute.is_symlink() && !options.dereference {
-        return copy_link(&source_absolute, &local_to_target, symlinked_files);
+    // If the source is a symbolic link and the options tell us not to
+    // dereference the link, then copy the link object itself.
+    if source_absolute.is_symlink() && !options.dereference {
+        return copy_link(&source_absolute, &local_to_target, symlinked_files);
     }
 
-    // If the source is a directory and the destination does not
-    // exist, ...
-    if source_absolute.is_dir() && !local_to_target.exists() {
-        if target_is_file {
-            return Err("cannot overwrite non-directory with directory".into());
-        } else {
-            // TODO Since the calling code is traversing from the root
-            // of the directory structure, I don't think
-            // `create_dir_all()` will have any benefit over
-            // `create_dir()`, since all the ancestor directories
-            // should have already been created.
-            fs::create_dir_all(local_to_target)?;
-            return Ok(());
+    // If the source is a directory and the destination does not
+    // exist, ...
+    if source_absolute.is_dir() && !local_to_target.exists() {
+        if target_is_file {
+            return Err("cannot overwrite non-directory with directory".into());
+        } else {
+            // TODO Since the calling code is traversing from the root
+            // of the directory structure, I don't think
+            // `create_dir_all()` will have any benefit over
+            // `create_dir()`, since all the ancestor directories
+            // should have already been created.
+            fs::create_dir_all(local_to_target)?;
+            return Ok(());
         }
     }
 
-    // If the source is not a directory, then we need to copy the file.
-    if !source_absolute.is_dir() {
-        if preserve_hard_links {
-            let mut found_hard_link = false;
-            let dest = local_to_target.as_path().to_path_buf();
-            preserve_hardlinks(hard_links, &source_absolute, &dest, &mut found_hard_link)?;
-            if !found_hard_link {
-                match copy_file(
-                    &source_absolute,
-                    local_to_target.as_path(),
-                    options,
-                    symlinked_files,
+    // If the source is not a directory, then we need to copy the file.
+    if !source_absolute.is_dir() {
+        if preserve_hard_links {
+            let mut found_hard_link = false;
+            let dest = local_to_target.as_path().to_path_buf();
+            preserve_hardlinks(hard_links, &source_absolute, &dest, &mut found_hard_link)?;
+            if !found_hard_link {
+                match copy_file(
+                    &source_absolute,
+                    local_to_target.as_path(),
+                    options,
+                    symlinked_files,
                     false,
                 ) {
                     Ok(_) => Ok(()),
-                    Err(err) => {
-                        if source_absolute.is_symlink() {
-                            // silent the error with a symlink
-                            // In case we do --archive, we might copy the symlink
-                            // before the file itself
-                            Ok(())
-                        } else {
-                            Err(err)
+                    Err(err) => {
+                        if source_absolute.is_symlink() {
+                            // silent the error with a symlink
+                            // In case we do --archive, we might copy the symlink
+                            // before the file itself
+                            Ok(())
+                        } else {
+                            Err(err)
                         }
                     }
                 }?;
             }
-        } else {
-            // At this point, `path` is just a plain old file.
-            // Terminate this function immediately if there is any
-            // kind of error *except* a "permission denied" error.
-            //
-            // TODO What other kinds of errors, if any, should
-            // cause us to continue walking the directory?
-            match copy_file(
-                &source_absolute,
-                local_to_target.as_path(),
-                options,
-                symlinked_files,
+        } else {
+            // At this point, `path` is just a plain old file.
+            // Terminate this function immediately if there is any
+            // kind of error *except* a "permission denied" error.
+            //
+            // TODO What other kinds of errors, if any, should
+            // cause us to continue walking the directory?
+            match copy_file(
+                &source_absolute,
+                local_to_target.as_path(),
+                options,
+                symlinked_files,
                 false,
             ) {
                 Ok(_) => {}
-                Err(Error::IoErrContext(e, _))
-                    if e.kind() == std::io::ErrorKind::PermissionDenied =>
+                Err(Error::IoErrContext(e, _))
+                    if e.kind() == std::io::ErrorKind::PermissionDenied =>
                 {
                     show!(uio_error!(
-                        e,
+                        e,
                         "cannot open {} for reading",
-                        source_relative.quote(),
+                        source_relative.quote(),
                     ));
                 }
-                Err(e) => return Err(e),
+                Err(e) => return Err(e),
             }
         }
     }
 
-    // In any other case, there is nothing to do, so we just return to
-    // continue the traversal.
-    Ok(())
+    // In any other case, there is nothing to do, so we just return to
+    // continue the traversal.
+    Ok(())
 }
 
-/// Read the contents of the directory `root` and recursively copy the
-/// contents to `target`.
-///
-/// Any errors encountered copying files in the tree will be logged but
-/// will not cause a short-circuit.
-pub(crate) fn copy_directory(
-    root: &Path,
-    target: &TargetSlice,
-    options: &Options,
-    symlinked_files: &mut HashSet<FileInformation>,
-    source_in_command_line: bool,
-) -> CopyResult<()> {
-    if !options.recursive {
-        return Err(format!("omitting directory {}", root.quote()).into());
+/// Read the contents of the directory `root` and recursively copy the
+/// contents to `target`.
+///
+/// Any errors encountered copying files in the tree will be logged but
+/// will not cause a short-circuit.
+pub(crate) fn copy_directory(
+    root: &Path,
+    target: &TargetSlice,
+    options: &Options,
+    symlinked_files: &mut HashSet<FileInformation>,
+    source_in_command_line: bool,
+) -> CopyResult<()> {
+    if !options.recursive {
+        return Err(format!("omitting directory {}", root.quote()).into());
     }
 
-    // if no-dereference is enabled and this is a symlink, copy it as a file
-    if !options.dereference(source_in_command_line) && root.is_symlink() {
-        return copy_file(
-            root,
-            target,
-            options,
-            symlinked_files,
-            source_in_command_line,
+    // if no-dereference is enabled and this is a symlink, copy it as a file
+    if !options.dereference(source_in_command_line) && root.is_symlink() {
+        return copy_file(
+            root,
+            target,
+            options,
+            symlinked_files,
+            source_in_command_line,
         );
     }
 
-    // check if root is a prefix of target
-    if path_has_prefix(target, root)? {
-        return Err(format!(
+    // check if root is a prefix of target
+    if path_has_prefix(target, root)? {
+        return Err(format!(
             "cannot copy a directory, {}, into itself, {}",
-            root.quote(),
-            target.join(root.file_name().unwrap()).quote()
+            root.quote(),
+            target.join(root.file_name().unwrap()).quote()
         )
-        .into());
+        .into());
     }
 
-    // If in `--parents` mode, create all the necessary ancestor directories.
-    //
-    // For example, if the command is `cp --parents a/b/c d`, that
-    // means we need to copy the two ancestor directories first:
-    //
-    // a -> d/a
-    // a/b -> d/a/b
-    //
-    let tmp = if options.parents {
-        if let Some(parent) = root.parent() {
-            let new_target = target.join(parent);
-            std::fs::create_dir_all(&new_target)?;
-            new_target
-        } else {
-            target.to_path_buf()
+    // If in `--parents` mode, create all the necessary ancestor directories.
+    //
+    // For example, if the command is `cp --parents a/b/c d`, that
+    // means we need to copy the two ancestor directories first:
+    //
+    // a -> d/a
+    // a/b -> d/a/b
+    //
+    let tmp = if options.parents {
+        if let Some(parent) = root.parent() {
+            let new_target = target.join(parent);
+            std::fs::create_dir_all(&new_target)?;
+            new_target
+        } else {
+            target.to_path_buf()
         }
-    } else {
-        target.to_path_buf()
+    } else {
+        target.to_path_buf()
     };
-    let target = tmp.as_path();
+    let target = tmp.as_path();
 
-    let mut hard_links: Vec<(String, u64)> = vec![];
-    let preserve_hard_links = options.preserve_hard_links();
+    let mut hard_links: Vec<(String, u64)> = vec![];
+    let preserve_hard_links = options.preserve_hard_links();
 
-    // Collect some paths here that are invariant during the traversal
-    // of the given directory, like the current working directory and
-    // the target directory.
-    let context = match Context::new(root, target) {
-        Ok(c) => c,
-        Err(e) => return Err(format!("failed to get current directory {}", e).into()),
+    // Collect some paths here that are invariant during the traversal
+    // of the given directory, like the current working directory and
+    // the target directory.
+    let context = match Context::new(root, target) {
+        Ok(c) => c,
+        Err(e) => return Err(format!("failed to get current directory {}", e).into()),
     };
 
-    // Traverse the contents of the directory, copying each one.
-    for direntry_result in WalkDir::new(root)
-        .same_file_system(options.one_file_system)
-        .follow_links(options.dereference)
+    // Traverse the contents of the directory, copying each one.
+    for direntry_result in WalkDir::new(root)
+        .same_file_system(options.one_file_system)
+        .follow_links(options.dereference)
     {
-        match direntry_result {
-            Ok(direntry) => {
-                let entry = Entry::new(&context, &direntry)?;
-                copy_direntry(
-                    entry,
-                    options,
-                    symlinked_files,
-                    preserve_hard_links,
-                    &mut hard_links,
+        match direntry_result {
+            Ok(direntry) => {
+                let entry = Entry::new(&context, &direntry)?;
+                copy_direntry(
+                    entry,
+                    options,
+                    symlinked_files,
+                    preserve_hard_links,
+                    &mut hard_links,
                 )?;
             }
-            // Print an error message, but continue traversing the directory.
-            Err(e) => show_error!("{}", e),
+            // Print an error message, but continue traversing the directory.
+            Err(e) => show_error!("{}", e),
         }
     }
-    // Copy the attributes from the root directory to the target directory.
-    copy_attributes(root, target, &options.preserve_attributes)?;
+    // Copy the attributes from the root directory to the target directory.
+    copy_attributes(root, target, &options.preserve_attributes)?;
     Ok(())
 }
 
-/// Decide whether the second path is a prefix of the first.
-///
-/// This function canonicalizes the paths via
-/// [`uucore::fs::canonicalize`] before comparing.
-///
-/// # Errors
-///
-/// If there is an error determining the canonical, absolute form of
-/// either path.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// assert!(path_has_prefix(Path::new("/usr/bin"), Path::new("/usr")))
-/// assert!(!path_has_prefix(Path::new("/usr"), Path::new("/usr/bin")))
-/// assert!(!path_has_prefix(Path::new("/usr/bin"), Path::new("/var/log")))
-/// ```
-pub fn path_has_prefix(p1: &Path, p2: &Path) -> io::Result<bool> {
-    let pathbuf1 = canonicalize(p1, MissingHandling::Normal, ResolveMode::Logical)?;
-    let pathbuf2 = canonicalize(p2, MissingHandling::Normal, ResolveMode::Logical)?;
+/// Decide whether the second path is a prefix of the first.
+///
+/// This function canonicalizes the paths via
+/// [`uucore::fs::canonicalize`] before comparing.
+///
+/// # Errors
+///
+/// If there is an error determining the canonical, absolute form of
+/// either path.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// assert!(path_has_prefix(Path::new("/usr/bin"), Path::new("/usr")))
+/// assert!(!path_has_prefix(Path::new("/usr"), Path::new("/usr/bin")))
+/// assert!(!path_has_prefix(Path::new("/usr/bin"), Path::new("/var/log")))
+/// ```
+pub fn path_has_prefix(p1: &Path, p2: &Path) -> io::Result<bool> {
+    let pathbuf1 = canonicalize(p1, MissingHandling::Normal, ResolveMode::Logical)?;
+    let pathbuf2 = canonicalize(p2, MissingHandling::Normal, ResolveMode::Logical)?;
 
-    Ok(pathbuf1.starts_with(pathbuf2))
+    Ok(pathbuf1.starts_with(pathbuf2))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_cp/cp.rs.html b/dev/src/uu_cp/cp.rs.html index e6a4b9041..ea8e78ba7 100644 --- a/dev/src/uu_cp/cp.rs.html +++ b/dev/src/uu_cp/cp.rs.html @@ -1,4 +1,4 @@ -cp.rs - source
1
+cp.rs - source
1
 2
 3
 4
@@ -1556,1563 +1556,1575 @@
 1556
 1557
 1558
-
#![allow(clippy::missing_safety_doc)]
-#![allow(clippy::extra_unused_lifetimes)]
+1559
+1560
+1561
+1562
+1563
+1564
+
#![allow(clippy::missing_safety_doc)]
+#![allow(clippy::extra_unused_lifetimes)]
 
-// This file is part of the uutils coreutils package.
-//
-// (c) Jordy Dickinson <jordy.dickinson@gmail.com>
-// (c) Joshua S. Miller <jsmiller@uchicago.edu>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+// This file is part of the uutils coreutils package.
+//
+// (c) Jordy Dickinson <jordy.dickinson@gmail.com>
+// (c) Joshua S. Miller <jsmiller@uchicago.edu>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) copydir ficlone ftruncate linkgs lstat nlink nlinks pathbuf pwrite reflink strs xattrs symlinked fiemap
+// spell-checker:ignore (ToDO) copydir ficlone ftruncate linkgs lstat nlink nlinks pathbuf pwrite reflink strs xattrs symlinked fiemap
 
-#[macro_use]
-extern crate quick_error;
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate quick_error;
+#[macro_use]
+extern crate uucore;
 
-use std::borrow::Cow;
-use std::collections::HashSet;
-use std::env;
-#[cfg(not(windows))]
-use std::ffi::CString;
-use std::fs::{self, File, OpenOptions};
-use std::io::{self, stderr, stdin, Write};
-#[cfg(unix)]
-use std::os::unix::ffi::OsStrExt;
-#[cfg(unix)]
-use std::os::unix::fs::{FileTypeExt, PermissionsExt};
-use std::path::{Path, PathBuf, StripPrefixError};
-use std::str::FromStr;
-use std::string::ToString;
+use std::borrow::Cow;
+use std::collections::HashSet;
+use std::env;
+#[cfg(not(windows))]
+use std::ffi::CString;
+use std::fs::{self, File, OpenOptions};
+use std::io::{self, stderr, stdin, Write};
+#[cfg(unix)]
+use std::os::unix::ffi::OsStrExt;
+#[cfg(unix)]
+use std::os::unix::fs::{FileTypeExt, PermissionsExt};
+use std::path::{Path, PathBuf, StripPrefixError};
+use std::str::FromStr;
+use std::string::ToString;
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use filetime::FileTime;
-#[cfg(unix)]
-use libc::mkfifo;
-use quick_error::ResultExt;
-use uucore::backup_control::{self, BackupMode};
-use uucore::display::Quotable;
-use uucore::error::{set_exit_code, UClapError, UError, UResult, UUsageError};
-use uucore::format_usage;
-use uucore::fs::{
-    canonicalize, paths_refer_to_same_file, FileInformation, MissingHandling, ResolveMode,
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use filetime::FileTime;
+#[cfg(unix)]
+use libc::mkfifo;
+use quick_error::ResultExt;
+use uucore::backup_control::{self, BackupMode};
+use uucore::display::Quotable;
+use uucore::error::{set_exit_code, UClapError, UError, UResult, UUsageError};
+use uucore::format_usage;
+use uucore::fs::{
+    canonicalize, paths_refer_to_same_file, FileInformation, MissingHandling, ResolveMode,
 };
 
-mod copydir;
-use crate::copydir::copy_directory;
+mod copydir;
+use crate::copydir::copy_directory;
 
-mod platform;
-use platform::copy_on_write;
+mod platform;
+use platform::copy_on_write;
 
-quick_error! {
-    #[derive(Debug)]
-    pub enum Error {
-        /// Simple io::Error wrapper
-        IoErr(err: io::Error) { from() source(err) display("{}", err)}
+quick_error! {
+    #[derive(Debug)]
+    pub enum Error {
+        /// Simple io::Error wrapper
+        IoErr(err: io::Error) { from() source(err) display("{}", err)}
 
-        /// Wrapper for io::Error with path context
-        IoErrContext(err: io::Error, path: String) {
-            display("{}: {}", path, err)
-            context(path: &'a str, err: io::Error) -> (err, path.to_owned())
-            context(context: String, err: io::Error) -> (err, context)
-            source(err)
+        /// Wrapper for io::Error with path context
+        IoErrContext(err: io::Error, path: String) {
+            display("{}: {}", path, err)
+            context(path: &'a str, err: io::Error) -> (err, path.to_owned())
+            context(context: String, err: io::Error) -> (err, context)
+            source(err)
         }
 
-        /// General copy error
-        Error(err: String) {
-            display("{}", err)
-            from(err: String) -> (err)
-            from(err: &'static str) -> (err.to_string())
+        /// General copy error
+        Error(err: String) {
+            display("{}", err)
+            from(err: String) -> (err)
+            from(err: &'static str) -> (err.to_string())
         }
 
-        /// Represents the state when a non-fatal error has occurred
-        /// and not all files were copied.
-        NotAllFilesCopied {}
+        /// Represents the state when a non-fatal error has occurred
+        /// and not all files were copied.
+        NotAllFilesCopied {}
 
-        /// Simple walkdir::Error wrapper
-        WalkDirErr(err: walkdir::Error) { from() display("{}", err) source(err) }
+        /// Simple walkdir::Error wrapper
+        WalkDirErr(err: walkdir::Error) { from() display("{}", err) source(err) }
 
-        /// Simple std::path::StripPrefixError wrapper
-        StripPrefixError(err: StripPrefixError) { from() }
+        /// Simple std::path::StripPrefixError wrapper
+        StripPrefixError(err: StripPrefixError) { from() }
 
-        /// Result of a skipped file
-        Skipped(reason: String) { display("{}", reason) }
+        /// Result of a skipped file
+        Skipped(reason: String) { display("{}", reason) }
 
-        /// Result of a skipped file
-        InvalidArgument(description: String) { display("{}", description) }
+        /// Result of a skipped file
+        InvalidArgument(description: String) { display("{}", description) }
 
-        /// All standard options are included as an an implementation
-        /// path, but those that are not implemented yet should return
-        /// a NotImplemented error.
-        NotImplemented(opt: String) { display("Option '{}' not yet implemented.", opt) }
+        /// All standard options are included as an an implementation
+        /// path, but those that are not implemented yet should return
+        /// a NotImplemented error.
+        NotImplemented(opt: String) { display("Option '{}' not yet implemented.", opt) }
 
-        /// Invalid arguments to backup
-        Backup(description: String) { display("{}\nTry '{} --help' for more information.", description, uucore::execution_phrase()) }
+        /// Invalid arguments to backup
+        Backup(description: String) { display("{}\nTry '{} --help' for more information.", description, uucore::execution_phrase()) }
 
-        NotADirectory(path: String) { display("'{}' is not a directory", path) }
+        NotADirectory(path: String) { display("'{}' is not a directory", path) }
     }
 }
 
-impl UError for Error {
-    fn code(&self) -> i32 {
-        EXIT_ERR
+impl UError for Error {
+    fn code(&self) -> i32 {
+        EXIT_ERR
     }
 }
 
-/// Prompts the user yes/no and returns `true` if they successfully
-/// answered yes.
-macro_rules! prompt_yes(
-    ($($args:tt)+) => ({
-        eprint!($($args)+);
+/// Prompts the user yes/no and returns `true` if they successfully
+/// answered yes.
+macro_rules! prompt_yes(
+    ($($args:tt)+) => ({
+        eprint!($($args)+);
         eprint!(" [y/N]: ");
-        crash_if_err!(1, stderr().flush());
-        let mut s = String::new();
-        match stdin().read_line(&mut s) {
-            Ok(_) => match s.char_indices().next() {
-                Some((_, x)) => x == 'y' || x == 'Y',
-                _ => false
-            },
-            _ => false
-        }
+        crash_if_err!(1, stderr().flush());
+        let mut s = String::new();
+        match stdin().read_line(&mut s) {
+            Ok(_) => match s.char_indices().next() {
+                Some((_, x)) => x == 'y' || x == 'Y',
+                _ => false
+            },
+            _ => false
+        }
     })
 );
 
-pub type CopyResult<T> = Result<T, Error>;
-pub type Source = PathBuf;
-pub type SourceSlice = Path;
-pub type Target = PathBuf;
-pub type TargetSlice = Path;
+pub type CopyResult<T> = Result<T, Error>;
+pub type Source = PathBuf;
+pub type SourceSlice = Path;
+pub type Target = PathBuf;
+pub type TargetSlice = Path;
 
-/// Specifies whether when overwrite files
-#[derive(Clone, Copy, Eq, PartialEq)]
-pub enum ClobberMode {
-    Force,
-    RemoveDestination,
-    Standard,
+/// Specifies whether when overwrite files
+#[derive(Clone, Copy, Eq, PartialEq)]
+pub enum ClobberMode {
+    Force,
+    RemoveDestination,
+    Standard,
 }
 
-/// Specifies whether when overwrite files
-#[derive(Clone, Copy, Eq, PartialEq)]
-pub enum OverwriteMode {
-    /// [Default] Always overwrite existing files
-    Clobber(ClobberMode),
-    /// Prompt before overwriting a file
-    Interactive(ClobberMode),
-    /// Never overwrite a file
-    NoClobber,
+/// Specifies whether when overwrite files
+#[derive(Clone, Copy, Eq, PartialEq)]
+pub enum OverwriteMode {
+    /// [Default] Always overwrite existing files
+    Clobber(ClobberMode),
+    /// Prompt before overwriting a file
+    Interactive(ClobberMode),
+    /// Never overwrite a file
+    NoClobber,
 }
 
-/// Possible arguments for `--reflink`.
-#[derive(Copy, Clone, Eq, PartialEq)]
-pub enum ReflinkMode {
-    Always,
-    Auto,
-    Never,
+/// Possible arguments for `--reflink`.
+#[derive(Copy, Clone, Eq, PartialEq)]
+pub enum ReflinkMode {
+    Always,
+    Auto,
+    Never,
 }
 
-/// Possible arguments for `--sparse`.
-#[derive(Copy, Clone, Eq, PartialEq)]
-pub enum SparseMode {
-    Always,
-    Auto,
-    Never,
+/// Possible arguments for `--sparse`.
+#[derive(Copy, Clone, Eq, PartialEq)]
+pub enum SparseMode {
+    Always,
+    Auto,
+    Never,
 }
 
-/// Specifies the expected file type of copy target
-pub enum TargetType {
-    Directory,
-    File,
+/// Specifies the expected file type of copy target
+pub enum TargetType {
+    Directory,
+    File,
 }
 
-pub enum CopyMode {
-    Link,
-    SymLink,
-    Copy,
-    Update,
-    AttrOnly,
+pub enum CopyMode {
+    Link,
+    SymLink,
+    Copy,
+    Update,
+    AttrOnly,
 }
 
-// The ordering here determines the order in which attributes are (re-)applied.
-// In particular, Ownership must be changed first to avoid interfering with mode change.
-#[derive(Clone, Eq, PartialEq, Debug, PartialOrd, Ord)]
-pub enum Attribute {
-    #[cfg(unix)]
-    Ownership,
-    Mode,
-    Timestamps,
-    #[cfg(feature = "feat_selinux")]
-    Context,
-    Links,
-    Xattr,
+// The ordering here determines the order in which attributes are (re-)applied.
+// In particular, Ownership must be changed first to avoid interfering with mode change.
+#[derive(Clone, Eq, PartialEq, Debug, PartialOrd, Ord)]
+pub enum Attribute {
+    #[cfg(unix)]
+    Ownership,
+    Mode,
+    Timestamps,
+    #[cfg(feature = "feat_selinux")]
+    Context,
+    Links,
+    Xattr,
 }
 
-/// Re-usable, extensible copy options
-#[allow(dead_code)]
-pub struct Options {
-    attributes_only: bool,
-    backup: BackupMode,
-    copy_contents: bool,
-    cli_dereference: bool,
-    copy_mode: CopyMode,
-    dereference: bool,
-    no_target_dir: bool,
-    one_file_system: bool,
-    overwrite: OverwriteMode,
-    parents: bool,
-    sparse_mode: SparseMode,
-    strip_trailing_slashes: bool,
-    reflink_mode: ReflinkMode,
-    preserve_attributes: Vec<Attribute>,
-    recursive: bool,
-    backup_suffix: String,
-    target_dir: Option<String>,
-    update: bool,
-    verbose: bool,
+/// Re-usable, extensible copy options
+#[allow(dead_code)]
+pub struct Options {
+    attributes_only: bool,
+    backup: BackupMode,
+    copy_contents: bool,
+    cli_dereference: bool,
+    copy_mode: CopyMode,
+    dereference: bool,
+    no_target_dir: bool,
+    one_file_system: bool,
+    overwrite: OverwriteMode,
+    parents: bool,
+    sparse_mode: SparseMode,
+    strip_trailing_slashes: bool,
+    reflink_mode: ReflinkMode,
+    preserve_attributes: Vec<Attribute>,
+    recursive: bool,
+    backup_suffix: String,
+    target_dir: Option<String>,
+    update: bool,
+    verbose: bool,
 }
 
-static ABOUT: &str = "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.";
-static EXIT_ERR: i32 = 1;
+static ABOUT: &str = "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.";
+static EXIT_ERR: i32 = 1;
 
-const USAGE: &str = "\
+const USAGE: &str = "\
     {} [OPTION]... [-T] SOURCE DEST
     {} [OPTION]... SOURCE... DIRECTORY
     {} [OPTION]... -t DIRECTORY SOURCE...";
 
-// Argument constants
-mod options {
-    pub const ARCHIVE: &str = "archive";
-    pub const ATTRIBUTES_ONLY: &str = "attributes-only";
-    pub const CLI_SYMBOLIC_LINKS: &str = "cli-symbolic-links";
-    pub const CONTEXT: &str = "context";
-    pub const COPY_CONTENTS: &str = "copy-contents";
-    pub const DEREFERENCE: &str = "dereference";
-    pub const FORCE: &str = "force";
-    pub const INTERACTIVE: &str = "interactive";
-    pub const LINK: &str = "link";
-    pub const NO_CLOBBER: &str = "no-clobber";
-    pub const NO_DEREFERENCE: &str = "no-dereference";
-    pub const NO_DEREFERENCE_PRESERVE_LINKS: &str = "no-dereference-preserve-links";
-    pub const NO_PRESERVE: &str = "no-preserve";
-    pub const NO_TARGET_DIRECTORY: &str = "no-target-directory";
-    pub const ONE_FILE_SYSTEM: &str = "one-file-system";
-    pub const PARENT: &str = "parent";
-    pub const PARENTS: &str = "parents";
-    pub const PATHS: &str = "paths";
-    pub const PRESERVE: &str = "preserve";
-    pub const PRESERVE_DEFAULT_ATTRIBUTES: &str = "preserve-default-attributes";
-    pub const RECURSIVE: &str = "recursive";
-    pub const REFLINK: &str = "reflink";
-    pub const REMOVE_DESTINATION: &str = "remove-destination";
-    pub const SPARSE: &str = "sparse";
-    pub const STRIP_TRAILING_SLASHES: &str = "strip-trailing-slashes";
-    pub const SYMBOLIC_LINK: &str = "symbolic-link";
-    pub const TARGET_DIRECTORY: &str = "target-directory";
-    pub const UPDATE: &str = "update";
-    pub const VERBOSE: &str = "verbose";
+// Argument constants
+mod options {
+    pub const ARCHIVE: &str = "archive";
+    pub const ATTRIBUTES_ONLY: &str = "attributes-only";
+    pub const CLI_SYMBOLIC_LINKS: &str = "cli-symbolic-links";
+    pub const CONTEXT: &str = "context";
+    pub const COPY_CONTENTS: &str = "copy-contents";
+    pub const DEREFERENCE: &str = "dereference";
+    pub const FORCE: &str = "force";
+    pub const INTERACTIVE: &str = "interactive";
+    pub const LINK: &str = "link";
+    pub const NO_CLOBBER: &str = "no-clobber";
+    pub const NO_DEREFERENCE: &str = "no-dereference";
+    pub const NO_DEREFERENCE_PRESERVE_LINKS: &str = "no-dereference-preserve-links";
+    pub const NO_PRESERVE: &str = "no-preserve";
+    pub const NO_TARGET_DIRECTORY: &str = "no-target-directory";
+    pub const ONE_FILE_SYSTEM: &str = "one-file-system";
+    pub const PARENT: &str = "parent";
+    pub const PARENTS: &str = "parents";
+    pub const PATHS: &str = "paths";
+    pub const PRESERVE: &str = "preserve";
+    pub const PRESERVE_DEFAULT_ATTRIBUTES: &str = "preserve-default-attributes";
+    pub const RECURSIVE: &str = "recursive";
+    pub const REFLINK: &str = "reflink";
+    pub const REMOVE_DESTINATION: &str = "remove-destination";
+    pub const SPARSE: &str = "sparse";
+    pub const STRIP_TRAILING_SLASHES: &str = "strip-trailing-slashes";
+    pub const SYMBOLIC_LINK: &str = "symbolic-link";
+    pub const TARGET_DIRECTORY: &str = "target-directory";
+    pub const UPDATE: &str = "update";
+    pub const VERBOSE: &str = "verbose";
 }
 
-#[cfg(unix)]
-static PRESERVABLE_ATTRIBUTES: &[&str] = &[
+#[cfg(unix)]
+static PRESERVABLE_ATTRIBUTES: &[&str] = &[
     "mode",
     "ownership",
     "timestamps",
-    #[cfg(feature = "feat_selinux")]
-    "context",
+    #[cfg(feature = "feat_selinux")]
+    "context",
     "links",
     "xattr",
     "all",
 ];
 
-#[cfg(not(unix))]
-static PRESERVABLE_ATTRIBUTES: &[&str] =
+#[cfg(not(unix))]
+static PRESERVABLE_ATTRIBUTES: &[&str] =
     &["mode", "timestamps", "context", "links", "xattr", "all"];
 
-static DEFAULT_ATTRIBUTES: &[Attribute] = &[
-    Attribute::Mode,
-    #[cfg(unix)]
-    Attribute::Ownership,
-    Attribute::Timestamps,
+static DEFAULT_ATTRIBUTES: &[Attribute] = &[
+    Attribute::Mode,
+    #[cfg(unix)]
+    Attribute::Ownership,
+    Attribute::Timestamps,
 ];
 
-pub fn uu_app() -> Command {
-    const MODE_ARGS: &[&str] = &[
-        options::LINK,
-        options::REFLINK,
-        options::SYMBOLIC_LINK,
-        options::ATTRIBUTES_ONLY,
-        options::COPY_CONTENTS,
+pub fn uu_app() -> Command {
+    const MODE_ARGS: &[&str] = &[
+        options::LINK,
+        options::REFLINK,
+        options::SYMBOLIC_LINK,
+        options::ATTRIBUTES_ONLY,
+        options::COPY_CONTENTS,
     ];
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::TARGET_DIRECTORY)
-                .short('t')
-                .conflicts_with(options::NO_TARGET_DIRECTORY)
-                .long(options::TARGET_DIRECTORY)
-                .value_name(options::TARGET_DIRECTORY)
-                .value_hint(clap::ValueHint::DirPath)
-                .help("copy all SOURCE arguments into target-directory"),
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::TARGET_DIRECTORY)
+                .short('t')
+                .conflicts_with(options::NO_TARGET_DIRECTORY)
+                .long(options::TARGET_DIRECTORY)
+                .value_name(options::TARGET_DIRECTORY)
+                .value_hint(clap::ValueHint::DirPath)
+                .help("copy all SOURCE arguments into target-directory"),
         )
-        .arg(
-            Arg::new(options::NO_TARGET_DIRECTORY)
-                .short('T')
-                .long(options::NO_TARGET_DIRECTORY)
-                .conflicts_with(options::TARGET_DIRECTORY)
-                .help("Treat DEST as a regular file and not a directory")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_TARGET_DIRECTORY)
+                .short('T')
+                .long(options::NO_TARGET_DIRECTORY)
+                .conflicts_with(options::TARGET_DIRECTORY)
+                .help("Treat DEST as a regular file and not a directory")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::INTERACTIVE)
-                .short('i')
-                .long(options::INTERACTIVE)
-                .overrides_with(options::NO_CLOBBER)
-                .help("ask before overwriting files")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::INTERACTIVE)
+                .short('i')
+                .long(options::INTERACTIVE)
+                .overrides_with(options::NO_CLOBBER)
+                .help("ask before overwriting files")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::LINK)
-                .short('l')
-                .long(options::LINK)
-                .overrides_with_all(MODE_ARGS)
-                .help("hard-link files instead of copying")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::LINK)
+                .short('l')
+                .long(options::LINK)
+                .overrides_with_all(MODE_ARGS)
+                .help("hard-link files instead of copying")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NO_CLOBBER)
-                .short('n')
-                .long(options::NO_CLOBBER)
-                .overrides_with(options::INTERACTIVE)
-                .help("don't overwrite a file that already exists")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_CLOBBER)
+                .short('n')
+                .long(options::NO_CLOBBER)
+                .overrides_with(options::INTERACTIVE)
+                .help("don't overwrite a file that already exists")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::RECURSIVE)
-                .short('r')
-                .visible_short_alias('R')
-                .long(options::RECURSIVE)
-                // --archive sets this option
-                .help("copy directories recursively")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RECURSIVE)
+                .short('r')
+                .visible_short_alias('R')
+                .long(options::RECURSIVE)
+                // --archive sets this option
+                .help("copy directories recursively")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::STRIP_TRAILING_SLASHES)
-                .long(options::STRIP_TRAILING_SLASHES)
-                .help("remove any trailing slashes from each SOURCE argument")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::STRIP_TRAILING_SLASHES)
+                .long(options::STRIP_TRAILING_SLASHES)
+                .help("remove any trailing slashes from each SOURCE argument")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::VERBOSE)
-                .short('v')
-                .long(options::VERBOSE)
-                .help("explicitly state what is being done")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::VERBOSE)
+                .short('v')
+                .long(options::VERBOSE)
+                .help("explicitly state what is being done")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SYMBOLIC_LINK)
-                .short('s')
-                .long(options::SYMBOLIC_LINK)
-                .overrides_with_all(MODE_ARGS)
-                .help("make symbolic links instead of copying")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SYMBOLIC_LINK)
+                .short('s')
+                .long(options::SYMBOLIC_LINK)
+                .overrides_with_all(MODE_ARGS)
+                .help("make symbolic links instead of copying")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FORCE)
-                .short('f')
-                .long(options::FORCE)
-                .help(
+        .arg(
+            Arg::new(options::FORCE)
+                .short('f')
+                .long(options::FORCE)
+                .help(
                     "if an existing destination file cannot be opened, remove it and \
                     try again (this option is ignored when the -n option is also used). \
                     Currently not implemented for Windows.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REMOVE_DESTINATION)
-                .long(options::REMOVE_DESTINATION)
-                .overrides_with(options::FORCE)
-                .help(
+        .arg(
+            Arg::new(options::REMOVE_DESTINATION)
+                .long(options::REMOVE_DESTINATION)
+                .overrides_with(options::FORCE)
+                .help(
                     "remove each existing destination file before attempting to open it \
                     (contrast with --force). On Windows, currently only works for \
                     writeable files.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(backup_control::arguments::backup())
-        .arg(backup_control::arguments::backup_no_args())
-        .arg(backup_control::arguments::suffix())
-        .arg(
-            Arg::new(options::UPDATE)
-                .short('u')
-                .long(options::UPDATE)
-                .help(
+        .arg(backup_control::arguments::backup())
+        .arg(backup_control::arguments::backup_no_args())
+        .arg(backup_control::arguments::suffix())
+        .arg(
+            Arg::new(options::UPDATE)
+                .short('u')
+                .long(options::UPDATE)
+                .help(
                     "copy only when the SOURCE file is newer than the destination file \
                     or when the destination file is missing",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REFLINK)
-                .long(options::REFLINK)
-                .value_name("WHEN")
-                .overrides_with_all(MODE_ARGS)
-                .require_equals(true)
-                .default_missing_value("always")
-                .value_parser(["auto", "always", "never"])
-                .num_args(0..=1)
-                .help("control clone/CoW copies. See below"),
+        .arg(
+            Arg::new(options::REFLINK)
+                .long(options::REFLINK)
+                .value_name("WHEN")
+                .overrides_with_all(MODE_ARGS)
+                .require_equals(true)
+                .default_missing_value("always")
+                .value_parser(["auto", "always", "never"])
+                .num_args(0..=1)
+                .help("control clone/CoW copies. See below"),
         )
-        .arg(
-            Arg::new(options::ATTRIBUTES_ONLY)
-                .long(options::ATTRIBUTES_ONLY)
-                .overrides_with_all(MODE_ARGS)
-                .help("Don't copy the file data, just the attributes")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ATTRIBUTES_ONLY)
+                .long(options::ATTRIBUTES_ONLY)
+                .overrides_with_all(MODE_ARGS)
+                .help("Don't copy the file data, just the attributes")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PRESERVE)
-                .long(options::PRESERVE)
-                .action(ArgAction::Append)
-                .use_value_delimiter(true)
-                .value_parser(clap::builder::PossibleValuesParser::new(
-                    PRESERVABLE_ATTRIBUTES,
+        .arg(
+            Arg::new(options::PRESERVE)
+                .long(options::PRESERVE)
+                .action(ArgAction::Append)
+                .use_value_delimiter(true)
+                .value_parser(clap::builder::PossibleValuesParser::new(
+                    PRESERVABLE_ATTRIBUTES,
                 ))
-                .num_args(0..)
-                .value_name("ATTR_LIST")
-                .overrides_with_all([
-                    options::ARCHIVE,
-                    options::PRESERVE_DEFAULT_ATTRIBUTES,
-                    options::NO_PRESERVE,
+                .num_args(0..)
+                .value_name("ATTR_LIST")
+                .overrides_with_all([
+                    options::ARCHIVE,
+                    options::PRESERVE_DEFAULT_ATTRIBUTES,
+                    options::NO_PRESERVE,
                 ])
-                // -d sets this option
-                // --archive sets this option
-                .help(
+                // -d sets this option
+                // --archive sets this option
+                .help(
                     "Preserve the specified attributes (default: mode, ownership (unix only), \
                      timestamps), if possible additional attributes: context, links, xattr, all",
                 ),
         )
-        .arg(
-            Arg::new(options::PRESERVE_DEFAULT_ATTRIBUTES)
-                .short('p')
-                .long(options::PRESERVE_DEFAULT_ATTRIBUTES)
-                .overrides_with_all([options::PRESERVE, options::NO_PRESERVE, options::ARCHIVE])
-                .help("same as --preserve=mode,ownership(unix only),timestamps")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PRESERVE_DEFAULT_ATTRIBUTES)
+                .short('p')
+                .long(options::PRESERVE_DEFAULT_ATTRIBUTES)
+                .overrides_with_all([options::PRESERVE, options::NO_PRESERVE, options::ARCHIVE])
+                .help("same as --preserve=mode,ownership(unix only),timestamps")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NO_PRESERVE)
-                .long(options::NO_PRESERVE)
-                .value_name("ATTR_LIST")
-                .overrides_with_all([
-                    options::PRESERVE_DEFAULT_ATTRIBUTES,
-                    options::PRESERVE,
-                    options::ARCHIVE,
+        .arg(
+            Arg::new(options::NO_PRESERVE)
+                .long(options::NO_PRESERVE)
+                .value_name("ATTR_LIST")
+                .overrides_with_all([
+                    options::PRESERVE_DEFAULT_ATTRIBUTES,
+                    options::PRESERVE,
+                    options::ARCHIVE,
                 ])
-                .help("don't preserve the specified attributes"),
+                .help("don't preserve the specified attributes"),
         )
-        .arg(
-            Arg::new(options::PARENTS)
-                .long(options::PARENTS)
-                .alias(options::PARENT)
-                .help("use full source file name under DIRECTORY")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PARENTS)
+                .long(options::PARENTS)
+                .alias(options::PARENT)
+                .help("use full source file name under DIRECTORY")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NO_DEREFERENCE)
-                .short('P')
-                .long(options::NO_DEREFERENCE)
-                .overrides_with(options::DEREFERENCE)
-                // -d sets this option
-                .help("never follow symbolic links in SOURCE")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_DEREFERENCE)
+                .short('P')
+                .long(options::NO_DEREFERENCE)
+                .overrides_with(options::DEREFERENCE)
+                // -d sets this option
+                .help("never follow symbolic links in SOURCE")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DEREFERENCE)
-                .short('L')
-                .long(options::DEREFERENCE)
-                .overrides_with(options::NO_DEREFERENCE)
-                .help("always follow symbolic links in SOURCE")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::DEREFERENCE)
+                .short('L')
+                .long(options::DEREFERENCE)
+                .overrides_with(options::NO_DEREFERENCE)
+                .help("always follow symbolic links in SOURCE")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::CLI_SYMBOLIC_LINKS)
-                .short('H')
-                .help("follow command-line symbolic links in SOURCE")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::CLI_SYMBOLIC_LINKS)
+                .short('H')
+                .help("follow command-line symbolic links in SOURCE")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ARCHIVE)
-                .short('a')
-                .long(options::ARCHIVE)
-                .overrides_with_all([
-                    options::PRESERVE_DEFAULT_ATTRIBUTES,
-                    options::PRESERVE,
-                    options::NO_PRESERVE,
+        .arg(
+            Arg::new(options::ARCHIVE)
+                .short('a')
+                .long(options::ARCHIVE)
+                .overrides_with_all([
+                    options::PRESERVE_DEFAULT_ATTRIBUTES,
+                    options::PRESERVE,
+                    options::NO_PRESERVE,
                 ])
-                .help("Same as -dR --preserve=all")
-                .action(ArgAction::SetTrue),
+                .help("Same as -dR --preserve=all")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NO_DEREFERENCE_PRESERVE_LINKS)
-                .short('d')
-                .help("same as --no-dereference --preserve=links")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_DEREFERENCE_PRESERVE_LINKS)
+                .short('d')
+                .help("same as --no-dereference --preserve=links")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ONE_FILE_SYSTEM)
-                .short('x')
-                .long(options::ONE_FILE_SYSTEM)
-                .help("stay on this file system")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ONE_FILE_SYSTEM)
+                .short('x')
+                .long(options::ONE_FILE_SYSTEM)
+                .help("stay on this file system")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SPARSE)
-                .long(options::SPARSE)
-                .value_name("WHEN")
-                .value_parser(["never", "auto", "always"])
-                .help("NotImplemented: control creation of sparse files. See below"),
+        .arg(
+            Arg::new(options::SPARSE)
+                .long(options::SPARSE)
+                .value_name("WHEN")
+                .value_parser(["never", "auto", "always"])
+                .help("NotImplemented: control creation of sparse files. See below"),
         )
-        // TODO: implement the following args
-        .arg(
-            Arg::new(options::COPY_CONTENTS)
-                .long(options::COPY_CONTENTS)
-                .overrides_with(options::ATTRIBUTES_ONLY)
-                .help("NotImplemented: copy contents of special files when recursive")
-                .action(ArgAction::SetTrue),
+        // TODO: implement the following args
+        .arg(
+            Arg::new(options::COPY_CONTENTS)
+                .long(options::COPY_CONTENTS)
+                .overrides_with(options::ATTRIBUTES_ONLY)
+                .help("NotImplemented: copy contents of special files when recursive")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::CONTEXT)
-                .long(options::CONTEXT)
-                .value_name("CTX")
-                .help(
+        .arg(
+            Arg::new(options::CONTEXT)
+                .long(options::CONTEXT)
+                .value_name("CTX")
+                .help(
                     "NotImplemented: set SELinux security context of destination file to \
                     default type",
                 ),
         )
-        // END TODO
-        .arg(
-            Arg::new(options::PATHS)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath),
+        // END TODO
+        .arg(
+            Arg::new(options::PATHS)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app()
-        .after_help(backup_control::BACKUP_CONTROL_LONG_HELP)
-        .try_get_matches_from(args);
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app()
+        .after_help(backup_control::BACKUP_CONTROL_LONG_HELP)
+        .try_get_matches_from(args);
 
-    // The error is parsed here because we do not want version or help being printed to stderr.
-    if let Err(e) = matches {
-        let mut app = uu_app().after_help(backup_control::BACKUP_CONTROL_LONG_HELP);
+    // The error is parsed here because we do not want version or help being printed to stderr.
+    if let Err(e) = matches {
+        let mut app = uu_app().after_help(backup_control::BACKUP_CONTROL_LONG_HELP);
 
-        match e.kind() {
-            clap::error::ErrorKind::DisplayHelp => {
-                app.print_help()?;
+        match e.kind() {
+            clap::error::ErrorKind::DisplayHelp => {
+                app.print_help()?;
             }
-            clap::error::ErrorKind::DisplayVersion => println!("{}", app.render_version()),
-            _ => return Err(Box::new(e.with_exit_code(1))),
+            clap::error::ErrorKind::DisplayVersion => println!("{}", app.render_version()),
+            _ => return Err(Box::new(e.with_exit_code(1))),
         };
-    } else if let Ok(matches) = matches {
-        let options = Options::from_matches(&matches)?;
+    } else if let Ok(matches) = matches {
+        let options = Options::from_matches(&matches)?;
 
-        if options.overwrite == OverwriteMode::NoClobber && options.backup != BackupMode::NoBackup {
-            return Err(UUsageError::new(
-                EXIT_ERR,
+        if options.overwrite == OverwriteMode::NoClobber && options.backup != BackupMode::NoBackup {
+            return Err(UUsageError::new(
+                EXIT_ERR,
                 "options --backup and --no-clobber are mutually exclusive",
             ));
         }
 
-        let paths: Vec<String> = matches
-            .get_many::<String>(options::PATHS)
-            .map(|v| v.map(ToString::to_string).collect())
-            .unwrap_or_default();
+        let paths: Vec<String> = matches
+            .get_many::<String>(options::PATHS)
+            .map(|v| v.map(ToString::to_string).collect())
+            .unwrap_or_default();
 
-        let (sources, target) = parse_path_args(&paths, &options)?;
+        let (sources, target) = parse_path_args(&paths, &options)?;
 
-        if let Err(error) = copy(&sources, &target, &options) {
-            match error {
-                // Error::NotAllFilesCopied is non-fatal, but the error
-                // code should still be EXIT_ERR as does GNU cp
-                Error::NotAllFilesCopied => {}
-                // Else we caught a fatal bubbled-up error, log it to stderr
-                _ => show_error!("{}", error),
+        if let Err(error) = copy(&sources, &target, &options) {
+            match error {
+                // Error::NotAllFilesCopied is non-fatal, but the error
+                // code should still be EXIT_ERR as does GNU cp
+                Error::NotAllFilesCopied => {}
+                // Else we caught a fatal bubbled-up error, log it to stderr
+                _ => show_error!("{}", error),
             };
-            set_exit_code(EXIT_ERR);
+            set_exit_code(EXIT_ERR);
         }
     }
 
     Ok(())
 }
 
-impl ClobberMode {
-    fn from_matches(matches: &ArgMatches) -> Self {
-        if matches.get_flag(options::FORCE) {
-            Self::Force
-        } else if matches.get_flag(options::REMOVE_DESTINATION) {
-            Self::RemoveDestination
-        } else {
-            Self::Standard
+impl ClobberMode {
+    fn from_matches(matches: &ArgMatches) -> Self {
+        if matches.get_flag(options::FORCE) {
+            Self::Force
+        } else if matches.get_flag(options::REMOVE_DESTINATION) {
+            Self::RemoveDestination
+        } else {
+            Self::Standard
         }
     }
 }
 
-impl OverwriteMode {
-    fn from_matches(matches: &ArgMatches) -> Self {
-        if matches.get_flag(options::INTERACTIVE) {
-            Self::Interactive(ClobberMode::from_matches(matches))
-        } else if matches.get_flag(options::NO_CLOBBER) {
-            Self::NoClobber
-        } else {
-            Self::Clobber(ClobberMode::from_matches(matches))
+impl OverwriteMode {
+    fn from_matches(matches: &ArgMatches) -> Self {
+        if matches.get_flag(options::INTERACTIVE) {
+            Self::Interactive(ClobberMode::from_matches(matches))
+        } else if matches.get_flag(options::NO_CLOBBER) {
+            Self::NoClobber
+        } else {
+            Self::Clobber(ClobberMode::from_matches(matches))
         }
     }
 }
 
-impl CopyMode {
-    fn from_matches(matches: &ArgMatches) -> Self {
-        if matches.get_flag(options::LINK) {
-            Self::Link
-        } else if matches.get_flag(options::SYMBOLIC_LINK) {
-            Self::SymLink
-        } else if matches.get_flag(options::UPDATE) {
-            Self::Update
-        } else if matches.get_flag(options::ATTRIBUTES_ONLY) {
-            Self::AttrOnly
-        } else {
-            Self::Copy
+impl CopyMode {
+    fn from_matches(matches: &ArgMatches) -> Self {
+        if matches.get_flag(options::LINK) {
+            Self::Link
+        } else if matches.get_flag(options::SYMBOLIC_LINK) {
+            Self::SymLink
+        } else if matches.get_flag(options::UPDATE) {
+            Self::Update
+        } else if matches.get_flag(options::ATTRIBUTES_ONLY) {
+            Self::AttrOnly
+        } else {
+            Self::Copy
         }
     }
 }
 
-impl FromStr for Attribute {
-    type Err = Error;
+impl FromStr for Attribute {
+    type Err = Error;
 
-    fn from_str(value: &str) -> CopyResult<Self> {
-        Ok(match &*value.to_lowercase() {
-            "mode" => Self::Mode,
-            #[cfg(unix)]
-            "ownership" => Self::Ownership,
-            "timestamps" => Self::Timestamps,
-            #[cfg(feature = "feat_selinux")]
-            "context" => Self::Context,
-            "links" => Self::Links,
-            "xattr" => Self::Xattr,
-            _ => {
-                return Err(Error::InvalidArgument(format!(
+    fn from_str(value: &str) -> CopyResult<Self> {
+        Ok(match &*value.to_lowercase() {
+            "mode" => Self::Mode,
+            #[cfg(unix)]
+            "ownership" => Self::Ownership,
+            "timestamps" => Self::Timestamps,
+            #[cfg(feature = "feat_selinux")]
+            "context" => Self::Context,
+            "links" => Self::Links,
+            "xattr" => Self::Xattr,
+            _ => {
+                return Err(Error::InvalidArgument(format!(
                     "invalid attribute {}",
-                    value.quote()
+                    value.quote()
                 )));
             }
         })
     }
 }
 
-fn add_all_attributes() -> Vec<Attribute> {
-    use Attribute::*;
+fn add_all_attributes() -> Vec<Attribute> {
+    use Attribute::*;
 
-    let attr = vec![
-        #[cfg(unix)]
-        Ownership,
-        Mode,
-        Timestamps,
-        #[cfg(feature = "feat_selinux")]
-        Context,
-        Links,
-        Xattr,
+    let attr = vec![
+        #[cfg(unix)]
+        Ownership,
+        Mode,
+        Timestamps,
+        #[cfg(feature = "feat_selinux")]
+        Context,
+        Links,
+        Xattr,
     ];
 
-    attr
+    attr
 }
 
-impl Options {
-    fn from_matches(matches: &ArgMatches) -> CopyResult<Self> {
-        let not_implemented_opts = vec![
-            options::COPY_CONTENTS,
-            #[cfg(not(any(windows, unix)))]
-            options::ONE_FILE_SYSTEM,
-            options::CONTEXT,
-            #[cfg(windows)]
-            options::FORCE,
+impl Options {
+    fn from_matches(matches: &ArgMatches) -> CopyResult<Self> {
+        let not_implemented_opts = vec![
+            options::COPY_CONTENTS,
+            #[cfg(not(any(windows, unix)))]
+            options::ONE_FILE_SYSTEM,
+            options::CONTEXT,
+            #[cfg(windows)]
+            options::FORCE,
         ];
 
-        for not_implemented_opt in not_implemented_opts {
-            if matches.contains_id(not_implemented_opt)
-                && matches.value_source(not_implemented_opt)
-                    == Some(clap::parser::ValueSource::CommandLine)
+        for not_implemented_opt in not_implemented_opts {
+            if matches.contains_id(not_implemented_opt)
+                && matches.value_source(not_implemented_opt)
+                    == Some(clap::parser::ValueSource::CommandLine)
             {
-                return Err(Error::NotImplemented(not_implemented_opt.to_string()));
+                return Err(Error::NotImplemented(not_implemented_opt.to_string()));
             }
         }
 
-        let recursive = matches.get_flag(options::RECURSIVE) || matches.get_flag(options::ARCHIVE);
+        let recursive = matches.get_flag(options::RECURSIVE) || matches.get_flag(options::ARCHIVE);
 
-        let backup_mode = match backup_control::determine_backup_mode(matches) {
-            Err(e) => return Err(Error::Backup(format!("{}", e))),
-            Ok(mode) => mode,
+        let backup_mode = match backup_control::determine_backup_mode(matches) {
+            Err(e) => return Err(Error::Backup(format!("{}", e))),
+            Ok(mode) => mode,
         };
 
-        let backup_suffix = backup_control::determine_backup_suffix(matches);
+        let backup_suffix = backup_control::determine_backup_suffix(matches);
 
-        let overwrite = OverwriteMode::from_matches(matches);
+        let overwrite = OverwriteMode::from_matches(matches);
 
-        // Parse target directory options
-        let no_target_dir = matches.get_flag(options::NO_TARGET_DIRECTORY);
-        let target_dir = matches
-            .get_one::<String>(options::TARGET_DIRECTORY)
-            .map(ToString::to_string);
+        // Parse target directory options
+        let no_target_dir = matches.get_flag(options::NO_TARGET_DIRECTORY);
+        let target_dir = matches
+            .get_one::<String>(options::TARGET_DIRECTORY)
+            .map(ToString::to_string);
 
-        if let Some(dir) = &target_dir {
-            if !Path::new(dir).is_dir() {
-                return Err(Error::NotADirectory(dir.clone()));
+        if let Some(dir) = &target_dir {
+            if !Path::new(dir).is_dir() {
+                return Err(Error::NotADirectory(dir.clone()));
             }
         };
 
-        // Parse attributes to preserve
-        let mut preserve_attributes: Vec<Attribute> = if matches.contains_id(options::PRESERVE) {
-            match matches.get_many::<String>(options::PRESERVE) {
-                None => DEFAULT_ATTRIBUTES.to_vec(),
-                Some(attribute_strs) => {
-                    let mut attributes = Vec::new();
-                    for attribute_str in attribute_strs {
-                        if attribute_str == "all" {
-                            attributes = add_all_attributes();
+        // Parse attributes to preserve
+        let mut preserve_attributes: Vec<Attribute> = if matches.contains_id(options::PRESERVE) {
+            match matches.get_many::<String>(options::PRESERVE) {
+                None => DEFAULT_ATTRIBUTES.to_vec(),
+                Some(attribute_strs) => {
+                    let mut attributes = Vec::new();
+                    for attribute_str in attribute_strs {
+                        if attribute_str == "all" {
+                            attributes = add_all_attributes();
                             break;
-                        } else {
-                            attributes.push(Attribute::from_str(attribute_str)?);
+                        } else {
+                            attributes.push(Attribute::from_str(attribute_str)?);
                         }
                     }
-                    attributes
+                    attributes
                 }
             }
-        } else if matches.get_flag(options::ARCHIVE) {
-            // --archive is used. Same as --preserve=all
-            add_all_attributes()
-        } else if matches.get_flag(options::NO_DEREFERENCE_PRESERVE_LINKS) {
-            vec![Attribute::Links]
-        } else if matches.get_flag(options::PRESERVE_DEFAULT_ATTRIBUTES) {
-            DEFAULT_ATTRIBUTES.to_vec()
-        } else {
+        } else if matches.get_flag(options::ARCHIVE) {
+            // --archive is used. Same as --preserve=all
+            add_all_attributes()
+        } else if matches.get_flag(options::NO_DEREFERENCE_PRESERVE_LINKS) {
+            vec![Attribute::Links]
+        } else if matches.get_flag(options::PRESERVE_DEFAULT_ATTRIBUTES) {
+            DEFAULT_ATTRIBUTES.to_vec()
+        } else {
             vec![]
         };
 
-        // Make sure ownership is changed before other attributes,
-        // as chown clears some of the permission and therefore could undo previous changes
-        // if not executed first.
-        preserve_attributes.sort_unstable();
+        // Make sure ownership is changed before other attributes,
+        // as chown clears some of the permission and therefore could undo previous changes
+        // if not executed first.
+        preserve_attributes.sort_unstable();
 
-        let options = Self {
-            attributes_only: matches.get_flag(options::ATTRIBUTES_ONLY),
-            copy_contents: matches.get_flag(options::COPY_CONTENTS),
-            cli_dereference: matches.get_flag(options::CLI_SYMBOLIC_LINKS),
-            copy_mode: CopyMode::from_matches(matches),
-            // No dereference is set with -p, -d and --archive
-            dereference: !(matches.get_flag(options::NO_DEREFERENCE)
-                || matches.get_flag(options::NO_DEREFERENCE_PRESERVE_LINKS)
-                || matches.get_flag(options::ARCHIVE)
-                || recursive)
-                || matches.get_flag(options::DEREFERENCE),
-            one_file_system: matches.get_flag(options::ONE_FILE_SYSTEM),
-            parents: matches.get_flag(options::PARENTS),
-            update: matches.get_flag(options::UPDATE),
-            verbose: matches.get_flag(options::VERBOSE),
-            strip_trailing_slashes: matches.get_flag(options::STRIP_TRAILING_SLASHES),
-            reflink_mode: {
-                if let Some(reflink) = matches.get_one::<String>(options::REFLINK) {
-                    match reflink.as_str() {
-                        "always" => ReflinkMode::Always,
-                        "auto" => ReflinkMode::Auto,
-                        "never" => ReflinkMode::Never,
-                        value => {
-                            return Err(Error::InvalidArgument(format!(
+        let options = Self {
+            attributes_only: matches.get_flag(options::ATTRIBUTES_ONLY),
+            copy_contents: matches.get_flag(options::COPY_CONTENTS),
+            cli_dereference: matches.get_flag(options::CLI_SYMBOLIC_LINKS),
+            copy_mode: CopyMode::from_matches(matches),
+            // No dereference is set with -p, -d and --archive
+            dereference: !(matches.get_flag(options::NO_DEREFERENCE)
+                || matches.get_flag(options::NO_DEREFERENCE_PRESERVE_LINKS)
+                || matches.get_flag(options::ARCHIVE)
+                || recursive)
+                || matches.get_flag(options::DEREFERENCE),
+            one_file_system: matches.get_flag(options::ONE_FILE_SYSTEM),
+            parents: matches.get_flag(options::PARENTS),
+            update: matches.get_flag(options::UPDATE),
+            verbose: matches.get_flag(options::VERBOSE),
+            strip_trailing_slashes: matches.get_flag(options::STRIP_TRAILING_SLASHES),
+            reflink_mode: {
+                if let Some(reflink) = matches.get_one::<String>(options::REFLINK) {
+                    match reflink.as_str() {
+                        "always" => ReflinkMode::Always,
+                        "auto" => ReflinkMode::Auto,
+                        "never" => ReflinkMode::Never,
+                        value => {
+                            return Err(Error::InvalidArgument(format!(
                                 "invalid argument {} for \'reflink\'",
-                                value.quote()
+                                value.quote()
                             )));
                         }
                     }
-                } else {
-                    #[cfg(any(target_os = "linux", target_os = "android", target_os = "macos"))]
-                    {
-                        ReflinkMode::Auto
+                } else {
+                    #[cfg(any(target_os = "linux", target_os = "android", target_os = "macos"))]
+                    {
+                        ReflinkMode::Auto
                     }
-                    #[cfg(not(any(
-                        target_os = "linux",
-                        target_os = "android",
-                        target_os = "macos"
-                    )))]
-                    {
-                        ReflinkMode::Never
+                    #[cfg(not(any(
+                        target_os = "linux",
+                        target_os = "android",
+                        target_os = "macos"
+                    )))]
+                    {
+                        ReflinkMode::Never
                     }
                 }
             },
-            sparse_mode: {
-                if let Some(val) = matches.get_one::<String>(options::SPARSE) {
-                    match val.as_str() {
-                        "always" => SparseMode::Always,
-                        "auto" => SparseMode::Auto,
-                        "never" => SparseMode::Never,
-                        _ => {
-                            return Err(Error::InvalidArgument(format!(
+            sparse_mode: {
+                if let Some(val) = matches.get_one::<String>(options::SPARSE) {
+                    match val.as_str() {
+                        "always" => SparseMode::Always,
+                        "auto" => SparseMode::Auto,
+                        "never" => SparseMode::Never,
+                        _ => {
+                            return Err(Error::InvalidArgument(format!(
                                 "invalid argument {} for \'sparse\'",
-                                val
+                                val
                             )))
                         }
                     }
-                } else {
-                    SparseMode::Auto
+                } else {
+                    SparseMode::Auto
                 }
             },
-            backup: backup_mode,
-            backup_suffix,
-            overwrite,
-            no_target_dir,
-            preserve_attributes,
-            recursive,
-            target_dir,
+            backup: backup_mode,
+            backup_suffix,
+            overwrite,
+            no_target_dir,
+            preserve_attributes,
+            recursive,
+            target_dir,
         };
 
-        Ok(options)
+        Ok(options)
     }
 
-    fn dereference(&self, in_command_line: bool) -> bool {
-        self.dereference || (in_command_line && self.cli_dereference)
+    fn dereference(&self, in_command_line: bool) -> bool {
+        self.dereference || (in_command_line && self.cli_dereference)
     }
 
-    fn preserve_hard_links(&self) -> bool {
-        for attribute in &self.preserve_attributes {
-            if *attribute == Attribute::Links {
-                return true;
+    fn preserve_hard_links(&self) -> bool {
+        for attribute in &self.preserve_attributes {
+            if *attribute == Attribute::Links {
+                return true;
             }
         }
-        false
-    }
+        false
+    }
 }
 
-impl TargetType {
-    /// Return TargetType required for `target`.
-    ///
-    /// Treat target as a dir if we have multiple sources or the target
-    /// exists and already is a directory
-    fn determine(sources: &[Source], target: &TargetSlice) -> Self {
-        if sources.len() > 1 || target.is_dir() {
-            Self::Directory
-        } else {
-            Self::File
+impl TargetType {
+    /// Return TargetType required for `target`.
+    ///
+    /// Treat target as a dir if we have multiple sources or the target
+    /// exists and already is a directory
+    fn determine(sources: &[Source], target: &TargetSlice) -> Self {
+        if sources.len() > 1 || target.is_dir() {
+            Self::Directory
+        } else {
+            Self::File
         }
     }
 }
 
-/// Returns tuple of (Source paths, Target)
-fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec<Source>, Target)> {
-    let mut paths = path_args.iter().map(PathBuf::from).collect::<Vec<_>>();
+/// Returns tuple of (Source paths, Target)
+fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec<Source>, Target)> {
+    let mut paths = path_args.iter().map(PathBuf::from).collect::<Vec<_>>();
 
-    if paths.is_empty() {
-        // No files specified
-        return Err("missing file operand".into());
+    if paths.is_empty() {
+        // No files specified
+        return Err("missing file operand".into());
     }
 
-    // Return an error if the user requested to copy more than one
-    // file source to a file target
-    if options.no_target_dir && options.target_dir.is_none() && paths.len() > 2 {
-        return Err(format!("extra operand {:?}", paths[2]).into());
+    // Return an error if the user requested to copy more than one
+    // file source to a file target
+    if options.no_target_dir && options.target_dir.is_none() && paths.len() > 2 {
+        return Err(format!("extra operand {:?}", paths[2]).into());
     }
 
-    let target = match options.target_dir {
-        Some(ref target) => {
-            // All path args are sources, and the target dir was
-            // specified separately
-            PathBuf::from(target)
+    let target = match options.target_dir {
+        Some(ref target) => {
+            // All path args are sources, and the target dir was
+            // specified separately
+            PathBuf::from(target)
         }
-        None => {
-            // If there was no explicit target-dir, then use the last
-            // path_arg
-            paths.pop().unwrap()
+        None => {
+            // If there was no explicit target-dir, then use the last
+            // path_arg
+            paths.pop().unwrap()
         }
     };
 
-    if options.strip_trailing_slashes {
-        for source in &mut paths {
-            *source = source.components().as_path().to_owned();
+    if options.strip_trailing_slashes {
+        for source in &mut paths {
+            *source = source.components().as_path().to_owned();
         }
     }
 
-    Ok((paths, target))
+    Ok((paths, target))
 }
 
-fn preserve_hardlinks(
-    hard_links: &mut Vec<(String, u64)>,
-    source: &std::path::Path,
-    dest: &std::path::Path,
-    found_hard_link: &mut bool,
-) -> CopyResult<()> {
-    // Redox does not currently support hard links
-    #[cfg(not(target_os = "redox"))]
-    {
-        if !source.is_dir() {
-            let info = match FileInformation::from_path(source, false) {
-                Ok(info) => info,
-                Err(e) => {
-                    return Err(format!("cannot stat {}: {}", source.quote(), e,).into());
+fn preserve_hardlinks(
+    hard_links: &mut Vec<(String, u64)>,
+    source: &std::path::Path,
+    dest: &std::path::Path,
+    found_hard_link: &mut bool,
+) -> CopyResult<()> {
+    // Redox does not currently support hard links
+    #[cfg(not(target_os = "redox"))]
+    {
+        if !source.is_dir() {
+            let info = match FileInformation::from_path(source, false) {
+                Ok(info) => info,
+                Err(e) => {
+                    return Err(format!("cannot stat {}: {}", source.quote(), e,).into());
                 }
             };
 
-            #[cfg(unix)]
-            let inode = info.inode();
+            #[cfg(unix)]
+            let inode = info.inode();
 
-            #[cfg(windows)]
-            let inode = info.file_index();
+            #[cfg(windows)]
+            let inode = info.file_index();
 
-            let nlinks = info.number_of_links();
+            let nlinks = info.number_of_links();
 
-            for hard_link in hard_links.iter() {
-                if hard_link.1 == inode {
-                    std::fs::hard_link(hard_link.0.clone(), dest).unwrap();
-                    *found_hard_link = true;
+            for hard_link in hard_links.iter() {
+                if hard_link.1 == inode {
+                    std::fs::hard_link(hard_link.0.clone(), dest).unwrap();
+                    *found_hard_link = true;
                 }
             }
-            if !(*found_hard_link) && nlinks > 1 {
-                hard_links.push((dest.to_str().unwrap().to_string(), inode));
+            if !(*found_hard_link) && nlinks > 1 {
+                hard_links.push((dest.to_str().unwrap().to_string(), inode));
             }
         }
     }
     Ok(())
 }
 
-/// Copy all `sources` to `target`.  Returns an
-/// `Err(Error::NotAllFilesCopied)` if at least one non-fatal error was
-/// encountered.
-///
-/// Behavior depends on `options`, see [`Options`] for details.
-///
-/// [`Options`]: ./struct.Options.html
-fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResult<()> {
-    let target_type = TargetType::determine(sources, target);
-    verify_target_type(target, &target_type)?;
+/// Copy all `sources` to `target`.  Returns an
+/// `Err(Error::NotAllFilesCopied)` if at least one non-fatal error was
+/// encountered.
+///
+/// Behavior depends on `options`, see [`Options`] for details.
+///
+/// [`Options`]: ./struct.Options.html
+fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResult<()> {
+    let target_type = TargetType::determine(sources, target);
+    verify_target_type(target, &target_type)?;
 
-    let preserve_hard_links = options.preserve_hard_links();
+    let preserve_hard_links = options.preserve_hard_links();
 
-    let mut hard_links: Vec<(String, u64)> = vec![];
+    let mut hard_links: Vec<(String, u64)> = vec![];
 
-    let mut non_fatal_errors = false;
-    let mut seen_sources = HashSet::with_capacity(sources.len());
-    let mut symlinked_files = HashSet::new();
-    for source in sources {
-        if seen_sources.contains(source) {
-            // FIXME: compare sources by the actual file they point to, not their path. (e.g. dir/file == dir/../dir/file in most cases)
-            show_warning!("source {} specified more than once", source.quote());
-        } else {
-            let mut found_hard_link = false;
-            if preserve_hard_links {
-                let dest = construct_dest_path(source, target, &target_type, options)?;
-                preserve_hardlinks(&mut hard_links, source, &dest, &mut found_hard_link)?;
+    let mut non_fatal_errors = false;
+    let mut seen_sources = HashSet::with_capacity(sources.len());
+    let mut symlinked_files = HashSet::new();
+    for source in sources {
+        if seen_sources.contains(source) {
+            // FIXME: compare sources by the actual file they point to, not their path. (e.g. dir/file == dir/../dir/file in most cases)
+            show_warning!("source {} specified more than once", source.quote());
+        } else {
+            let mut found_hard_link = false;
+            if preserve_hard_links {
+                let dest = construct_dest_path(source, target, &target_type, options)?;
+                preserve_hardlinks(&mut hard_links, source, &dest, &mut found_hard_link)?;
             }
-            if !found_hard_link {
-                if let Err(error) =
-                    copy_source(source, target, &target_type, options, &mut symlinked_files)
+            if !found_hard_link {
+                if let Err(error) =
+                    copy_source(source, target, &target_type, options, &mut symlinked_files)
                 {
-                    match error {
-                        // When using --no-clobber, we don't want to show
-                        // an error message
-                        Error::NotAllFilesCopied => (),
-                        Error::Skipped(_) => {
-                            show_error!("{}", error);
+                    match error {
+                        // When using --no-clobber, we don't want to show
+                        // an error message
+                        Error::NotAllFilesCopied => (),
+                        Error::Skipped(_) => {
+                            show_error!("{}", error);
                         }
-                        _ => {
-                            show_error!("{}", error);
-                            non_fatal_errors = true;
+                        _ => {
+                            show_error!("{}", error);
+                            non_fatal_errors = true;
                         }
                     }
                 }
             }
-            seen_sources.insert(source);
+            seen_sources.insert(source);
         }
     }
-    if non_fatal_errors {
-        Err(Error::NotAllFilesCopied)
-    } else {
+    if non_fatal_errors {
+        Err(Error::NotAllFilesCopied)
+    } else {
         Ok(())
     }
 }
 
-fn construct_dest_path(
-    source_path: &Path,
-    target: &TargetSlice,
-    target_type: &TargetType,
-    options: &Options,
-) -> CopyResult<PathBuf> {
-    if options.no_target_dir && target.is_dir() {
-        return Err(format!(
+fn construct_dest_path(
+    source_path: &Path,
+    target: &TargetSlice,
+    target_type: &TargetType,
+    options: &Options,
+) -> CopyResult<PathBuf> {
+    if options.no_target_dir && target.is_dir() {
+        return Err(format!(
             "cannot overwrite directory {} with non-directory",
-            target.quote()
+            target.quote()
         )
-        .into());
+        .into());
     }
 
-    if options.parents && !target.is_dir() {
-        return Err("with --parents, the destination must be a directory".into());
+    if options.parents && !target.is_dir() {
+        return Err("with --parents, the destination must be a directory".into());
     }
 
-    Ok(match *target_type {
-        TargetType::Directory => {
-            let root = if options.parents {
-                Path::new("")
-            } else {
-                source_path.parent().unwrap_or(source_path)
+    Ok(match *target_type {
+        TargetType::Directory => {
+            let root = if options.parents {
+                Path::new("")
+            } else {
+                source_path.parent().unwrap_or(source_path)
             };
-            localize_to_target(root, source_path, target)?
-        }
-        TargetType::File => target.to_path_buf(),
+            localize_to_target(root, source_path, target)?
+        }
+        TargetType::File => target.to_path_buf(),
     })
 }
 
-fn copy_source(
-    source: &SourceSlice,
-    target: &TargetSlice,
-    target_type: &TargetType,
-    options: &Options,
-    symlinked_files: &mut HashSet<FileInformation>,
-) -> CopyResult<()> {
-    let source_path = Path::new(&source);
-    if source_path.is_dir() {
-        // Copy as directory
-        copy_directory(source, target, options, symlinked_files, true)
-    } else {
-        // Copy as file
-        let dest = construct_dest_path(source_path, target, target_type, options)?;
-        copy_file(source_path, dest.as_path(), options, symlinked_files, true)
+fn copy_source(
+    source: &SourceSlice,
+    target: &TargetSlice,
+    target_type: &TargetType,
+    options: &Options,
+    symlinked_files: &mut HashSet<FileInformation>,
+) -> CopyResult<()> {
+    let source_path = Path::new(&source);
+    if source_path.is_dir() {
+        // Copy as directory
+        copy_directory(source, target, options, symlinked_files, true)
+    } else {
+        // Copy as file
+        let dest = construct_dest_path(source_path, target, target_type, options)?;
+        copy_file(source_path, dest.as_path(), options, symlinked_files, true)
     }
 }
 
-impl OverwriteMode {
-    fn verify(&self, path: &Path) -> CopyResult<()> {
-        match *self {
-            Self::NoClobber => Err(Error::NotAllFilesCopied),
-            Self::Interactive(_) => {
-                if prompt_yes!("{}: overwrite {}? ", uucore::util_name(), path.quote()) {
+impl OverwriteMode {
+    fn verify(&self, path: &Path) -> CopyResult<()> {
+        match *self {
+            Self::NoClobber => Err(Error::NotAllFilesCopied),
+            Self::Interactive(_) => {
+                if prompt_yes!("{}: overwrite {}? ", uucore::util_name(), path.quote()) {
                     Ok(())
-                } else {
-                    Err(Error::Skipped(format!(
+                } else {
+                    Err(Error::Skipped(format!(
                         "Not overwriting {} at user request",
-                        path.quote()
+                        path.quote()
                     )))
                 }
             }
-            Self::Clobber(_) => Ok(()),
+            Self::Clobber(_) => Ok(()),
         }
     }
 }
 
-/// Copy the specified attributes from one path to another.
-pub(crate) fn copy_attributes(
-    source: &Path,
-    dest: &Path,
-    attributes: &[Attribute],
-) -> CopyResult<()> {
-    for attribute in attributes {
-        copy_attribute(source, dest, attribute)?;
+/// Copy the specified attributes from one path to another.
+pub(crate) fn copy_attributes(
+    source: &Path,
+    dest: &Path,
+    attributes: &[Attribute],
+) -> CopyResult<()> {
+    for attribute in attributes {
+        copy_attribute(source, dest, attribute)?;
     }
     Ok(())
 }
 
-fn copy_attribute(source: &Path, dest: &Path, attribute: &Attribute) -> CopyResult<()> {
-    let context = &*format!("{} -> {}", source.quote(), dest.quote());
-    let source_metadata = fs::symlink_metadata(source).context(context)?;
-    match *attribute {
-        Attribute::Mode => {
-            // The `chmod()` system call that underlies the
-            // `fs::set_permissions()` call is unable to change the
-            // permissions of a symbolic link. In that case, we just
-            // do nothing, since every symbolic link has the same
-            // permissions.
-            if !dest.is_symlink() {
-                fs::set_permissions(dest, source_metadata.permissions()).context(context)?;
-                // FIXME: Implement this for windows as well
-                #[cfg(feature = "feat_acl")]
-                exacl::getfacl(source, None)
-                    .and_then(|acl| exacl::setfacl(&[dest], &acl, None))
-                    .map_err(|err| Error::Error(err.to_string()))?;
+fn copy_attribute(source: &Path, dest: &Path, attribute: &Attribute) -> CopyResult<()> {
+    let context = &*format!("{} -> {}", source.quote(), dest.quote());
+    let source_metadata = fs::symlink_metadata(source).context(context)?;
+    match *attribute {
+        Attribute::Mode => {
+            // The `chmod()` system call that underlies the
+            // `fs::set_permissions()` call is unable to change the
+            // permissions of a symbolic link. In that case, we just
+            // do nothing, since every symbolic link has the same
+            // permissions.
+            if !dest.is_symlink() {
+                fs::set_permissions(dest, source_metadata.permissions()).context(context)?;
+                // FIXME: Implement this for windows as well
+                #[cfg(feature = "feat_acl")]
+                exacl::getfacl(source, None)
+                    .and_then(|acl| exacl::setfacl(&[dest], &acl, None))
+                    .map_err(|err| Error::Error(err.to_string()))?;
             }
         }
-        #[cfg(unix)]
-        Attribute::Ownership => {
-            use std::os::unix::prelude::MetadataExt;
-            use uucore::perms::wrap_chown;
-            use uucore::perms::Verbosity;
-            use uucore::perms::VerbosityLevel;
+        #[cfg(unix)]
+        Attribute::Ownership => {
+            use std::os::unix::prelude::MetadataExt;
+            use uucore::perms::wrap_chown;
+            use uucore::perms::Verbosity;
+            use uucore::perms::VerbosityLevel;
 
-            let dest_uid = source_metadata.uid();
-            let dest_gid = source_metadata.gid();
+            let dest_uid = source_metadata.uid();
+            let dest_gid = source_metadata.gid();
 
-            wrap_chown(
-                dest,
-                &dest.symlink_metadata().context(context)?,
-                Some(dest_uid),
-                Some(dest_gid),
+            wrap_chown(
+                dest,
+                &dest.symlink_metadata().context(context)?,
+                Some(dest_uid),
+                Some(dest_gid),
                 false,
-                Verbosity {
-                    groups_only: false,
-                    level: VerbosityLevel::Normal,
+                Verbosity {
+                    groups_only: false,
+                    level: VerbosityLevel::Normal,
                 },
             )
-            .map_err(Error::Error)?;
+            .map_err(Error::Error)?;
         }
-        Attribute::Timestamps => {
-            let atime = FileTime::from_last_access_time(&source_metadata);
-            let mtime = FileTime::from_last_modification_time(&source_metadata);
-            if dest.is_symlink() {
-                filetime::set_symlink_file_times(dest, atime, mtime)?;
-            } else {
-                filetime::set_file_times(dest, atime, mtime)?;
+        Attribute::Timestamps => {
+            let atime = FileTime::from_last_access_time(&source_metadata);
+            let mtime = FileTime::from_last_modification_time(&source_metadata);
+            if dest.is_symlink() {
+                filetime::set_symlink_file_times(dest, atime, mtime)?;
+            } else {
+                filetime::set_file_times(dest, atime, mtime)?;
             }
         }
-        #[cfg(feature = "feat_selinux")]
-        Attribute::Context => {
-            let context = selinux::SecurityContext::of_path(source, false, false).map_err(|e| {
+        #[cfg(feature = "feat_selinux")]
+        Attribute::Context => {
+            let context = selinux::SecurityContext::of_path(source, false, false).map_err(|e| {
                 format!(
                     "failed to get security context of {}: {}",
-                    source.display(),
-                    e
+                    source.display(),
+                    e
                 )
             })?;
-            if let Some(context) = context {
-                context.set_for_path(dest, false, false).map_err(|e| {
+            if let Some(context) = context {
+                context.set_for_path(dest, false, false).map_err(|e| {
                     format!(
                         "failed to set security context for {}: {}",
-                        dest.display(),
-                        e
+                        dest.display(),
+                        e
                     )
                 })?;
             }
         }
-        Attribute::Links => {}
-        Attribute::Xattr => {
-            #[cfg(unix)]
-            {
-                let xattrs = xattr::list(source)?;
-                for attr in xattrs {
-                    if let Some(attr_value) = xattr::get(source, attr.clone())? {
-                        xattr::set(dest, attr, &attr_value[..])?;
+        Attribute::Links => {}
+        Attribute::Xattr => {
+            #[cfg(unix)]
+            {
+                let xattrs = xattr::list(source)?;
+                for attr in xattrs {
+                    if let Some(attr_value) = xattr::get(source, attr.clone())? {
+                        xattr::set(dest, attr, &attr_value[..])?;
                     }
                 }
             }
-            #[cfg(not(unix))]
-            {
-                // The documentation for GNU cp states:
-                //
-                // > Try to preserve SELinux security context and
-                // > extended attributes (xattr), but ignore any failure
-                // > to do that and print no corresponding diagnostic.
-                //
-                // so we simply do nothing here.
-                //
-                // TODO Silently ignore failures in the `#[cfg(unix)]`
-                // block instead of terminating immediately on errors.
-            }
+            #[cfg(not(unix))]
+            {
+                // The documentation for GNU cp states:
+                //
+                // > Try to preserve SELinux security context and
+                // > extended attributes (xattr), but ignore any failure
+                // > to do that and print no corresponding diagnostic.
+                //
+                // so we simply do nothing here.
+                //
+                // TODO Silently ignore failures in the `#[cfg(unix)]`
+                // block instead of terminating immediately on errors.
+            }
         }
     };
 
     Ok(())
 }
 
-fn symlink_file(
-    source: &Path,
-    dest: &Path,
-    context: &str,
-    symlinked_files: &mut HashSet<FileInformation>,
-) -> CopyResult<()> {
-    #[cfg(not(windows))]
-    {
-        std::os::unix::fs::symlink(source, dest).context(context)?;
+fn symlink_file(
+    source: &Path,
+    dest: &Path,
+    context: &str,
+    symlinked_files: &mut HashSet<FileInformation>,
+) -> CopyResult<()> {
+    #[cfg(not(windows))]
+    {
+        std::os::unix::fs::symlink(source, dest).context(context)?;
     }
-    #[cfg(windows)]
-    {
-        std::os::windows::fs::symlink_file(source, dest).context(context)?;
+    #[cfg(windows)]
+    {
+        std::os::windows::fs::symlink_file(source, dest).context(context)?;
     }
-    if let Ok(file_info) = FileInformation::from_path(dest, false) {
-        symlinked_files.insert(file_info);
+    if let Ok(file_info) = FileInformation::from_path(dest, false) {
+        symlinked_files.insert(file_info);
     }
     Ok(())
 }
 
-fn context_for(src: &Path, dest: &Path) -> String {
-    format!("{} -> {}", src.quote(), dest.quote())
+fn context_for(src: &Path, dest: &Path) -> String {
+    format!("{} -> {}", src.quote(), dest.quote())
 }
 
-/// Implements a simple backup copy for the destination file.
-/// TODO: for the backup, should this function be replaced by `copy_file(...)`?
-fn backup_dest(dest: &Path, backup_path: &Path) -> CopyResult<PathBuf> {
-    fs::copy(dest, backup_path)?;
-    Ok(backup_path.into())
+/// Implements a simple backup copy for the destination file.
+/// TODO: for the backup, should this function be replaced by `copy_file(...)`?
+fn backup_dest(dest: &Path, backup_path: &Path) -> CopyResult<PathBuf> {
+    fs::copy(dest, backup_path)?;
+    Ok(backup_path.into())
 }
 
-fn handle_existing_dest(
-    source: &Path,
-    dest: &Path,
-    options: &Options,
-    source_in_command_line: bool,
-) -> CopyResult<()> {
-    let dereference_to_compare =
-        options.dereference(source_in_command_line) || !source.is_symlink();
-    if paths_refer_to_same_file(source, dest, dereference_to_compare) {
-        return Err(format!("{}: same file", context_for(source, dest)).into());
+fn handle_existing_dest(
+    source: &Path,
+    dest: &Path,
+    options: &Options,
+    source_in_command_line: bool,
+) -> CopyResult<()> {
+    let dereference_to_compare =
+        options.dereference(source_in_command_line) || !source.is_symlink();
+    if paths_refer_to_same_file(source, dest, dereference_to_compare) {
+        return Err(format!("{}: same file", context_for(source, dest)).into());
     }
 
-    options.overwrite.verify(dest)?;
+    options.overwrite.verify(dest)?;
 
-    let backup_path = backup_control::get_backup_path(options.backup, dest, &options.backup_suffix);
-    if let Some(backup_path) = backup_path {
-        if paths_refer_to_same_file(source, &backup_path, true) {
-            return Err(format!(
+    let backup_path = backup_control::get_backup_path(options.backup, dest, &options.backup_suffix);
+    if let Some(backup_path) = backup_path {
+        if paths_refer_to_same_file(source, &backup_path, true) {
+            return Err(format!(
                 "backing up {} might destroy source;  {} not copied",
-                dest.quote(),
-                source.quote()
+                dest.quote(),
+                source.quote()
             )
-            .into());
-        } else {
-            backup_dest(dest, &backup_path)?;
+            .into());
+        } else {
+            backup_dest(dest, &backup_path)?;
         }
     }
 
-    match options.overwrite {
-        // FIXME: print that the file was removed if --verbose is enabled
-        OverwriteMode::Clobber(ClobberMode::Force) => {
-            if fs::metadata(dest)?.permissions().readonly() {
-                fs::remove_file(dest)?;
+    match options.overwrite {
+        // FIXME: print that the file was removed if --verbose is enabled
+        OverwriteMode::Clobber(ClobberMode::Force) => {
+            if fs::metadata(dest)?.permissions().readonly() {
+                fs::remove_file(dest)?;
             }
         }
-        OverwriteMode::Clobber(ClobberMode::RemoveDestination) => {
-            fs::remove_file(dest)?;
+        OverwriteMode::Clobber(ClobberMode::RemoveDestination) => {
+            fs::remove_file(dest)?;
         }
-        _ => (),
+        _ => (),
     };
 
     Ok(())
 }
 
-/// Decide whether the given path exists.
-fn file_or_link_exists(path: &Path) -> bool {
-    // Using `Path.exists()` or `Path.try_exists()` is not sufficient,
-    // because if `path` is a symbolic link and there are too many
-    // levels of symbolic link, then those methods will return false
-    // or an OS error.
-    path.symlink_metadata().is_ok()
+/// Decide whether the given path exists.
+fn file_or_link_exists(path: &Path) -> bool {
+    // Using `Path.exists()` or `Path.try_exists()` is not sufficient,
+    // because if `path` is a symbolic link and there are too many
+    // levels of symbolic link, then those methods will return false
+    // or an OS error.
+    path.symlink_metadata().is_ok()
 }
 
-/// Copy the a file from `source` to `dest`. `source` will be dereferenced if
-/// `options.dereference` is set to true. `dest` will be dereferenced only if
-/// the source was not a symlink.
-///
-/// Behavior when copying to existing files is contingent on the
-/// `options.overwrite` mode. If a file is skipped, the return type
-/// should be `Error:Skipped`
-///
-/// The original permissions of `source` will be copied to `dest`
-/// after a successful copy.
-fn copy_file(
-    source: &Path,
-    dest: &Path,
-    options: &Options,
-    symlinked_files: &mut HashSet<FileInformation>,
-    source_in_command_line: bool,
-) -> CopyResult<()> {
-    if options.update && options.overwrite == OverwriteMode::Interactive(ClobberMode::Standard) {
-        // `cp -i --update old new` when `new` exists doesn't copy anything
-        // and exit with 0
-        return Ok(());
+/// Copy the a file from `source` to `dest`. `source` will be dereferenced if
+/// `options.dereference` is set to true. `dest` will be dereferenced only if
+/// the source was not a symlink.
+///
+/// Behavior when copying to existing files is contingent on the
+/// `options.overwrite` mode. If a file is skipped, the return type
+/// should be `Error:Skipped`
+///
+/// The original permissions of `source` will be copied to `dest`
+/// after a successful copy.
+fn copy_file(
+    source: &Path,
+    dest: &Path,
+    options: &Options,
+    symlinked_files: &mut HashSet<FileInformation>,
+    source_in_command_line: bool,
+) -> CopyResult<()> {
+    if options.update && options.overwrite == OverwriteMode::Interactive(ClobberMode::Standard) {
+        // `cp -i --update old new` when `new` exists doesn't copy anything
+        // and exit with 0
+        return Ok(());
     }
 
-    if file_or_link_exists(dest) {
-        handle_existing_dest(source, dest, options, source_in_command_line)?;
-    }
-
-    // Fail if dest is a dangling symlink or a symlink this program created previously
-    if dest.is_symlink() {
-        if FileInformation::from_path(dest, false)
-            .map(|info| symlinked_files.contains(&info))
-            .unwrap_or(false)
+    // Fail if dest is a dangling symlink or a symlink this program created previously
+    if dest.is_symlink() {
+        if FileInformation::from_path(dest, false)
+            .map(|info| symlinked_files.contains(&info))
+            .unwrap_or(false)
         {
-            return Err(Error::Error(format!(
+            return Err(Error::Error(format!(
                 "will not copy '{}' through just-created symlink '{}'",
-                source.display(),
-                dest.display()
+                source.display(),
+                dest.display()
             )));
         }
-        let copy_contents = options.dereference(source_in_command_line) || !source.is_symlink();
-        if copy_contents && !dest.exists() {
-            return Err(Error::Error(format!(
-                "not writing through dangling symlink '{}'",
-                dest.display()
-            )));
-        }
-    }
-
-    if options.verbose {
-        println!("{}", context_for(source, dest));
-    }
-
-    // Calculate the context upfront before canonicalizing the path
-    let context = context_for(source, dest);
-    let context = context.as_str();
-
-    let source_metadata = {
-        let result = if options.dereference(source_in_command_line) {
-            fs::metadata(source)
-        } else {
-            fs::symlink_metadata(source)
-        };
-        result.context(context)?
-    };
-    let source_file_type = source_metadata.file_type();
-    let source_is_symlink = source_file_type.is_symlink();
-
-    #[cfg(unix)]
-    let source_is_fifo = source_file_type.is_fifo();
-    #[cfg(not(unix))]
-    let source_is_fifo = false;
-
-    let dest_permissions = if dest.exists() {
-        dest.symlink_metadata().context(context)?.permissions()
-    } else {
-        #[allow(unused_mut)]
-        let mut permissions = source_metadata.permissions();
-        #[cfg(unix)]
+        let copy_contents = options.dereference(source_in_command_line) || !source.is_symlink();
+        if copy_contents
+            && !dest.exists()
+            && !matches!(
+                options.overwrite,
+                OverwriteMode::Clobber(ClobberMode::RemoveDestination)
+            )
         {
-            use uucore::mode::get_umask;
-
-            let mut mode = permissions.mode();
-
-            // remove sticky bit, suid and gid bit
-            const SPECIAL_PERMS_MASK: u32 = 0o7000;
-            mode &= !SPECIAL_PERMS_MASK;
-
-            // apply umask
-            mode &= !get_umask();
-
-            permissions.set_mode(mode);
+            return Err(Error::Error(format!(
+                "not writing through dangling symlink '{}'",
+                dest.display()
+            )));
         }
-        permissions
+    }
+
+    if file_or_link_exists(dest) {
+        handle_existing_dest(source, dest, options, source_in_command_line)?;
+    }
+
+    if options.verbose {
+        println!("{}", context_for(source, dest));
+    }
+
+    // Calculate the context upfront before canonicalizing the path
+    let context = context_for(source, dest);
+    let context = context.as_str();
+
+    let source_metadata = {
+        let result = if options.dereference(source_in_command_line) {
+            fs::metadata(source)
+        } else {
+            fs::symlink_metadata(source)
+        };
+        result.context(context)?
+    };
+    let source_file_type = source_metadata.file_type();
+    let source_is_symlink = source_file_type.is_symlink();
+
+    #[cfg(unix)]
+    let source_is_fifo = source_file_type.is_fifo();
+    #[cfg(not(unix))]
+    let source_is_fifo = false;
+
+    let dest_permissions = if dest.exists() {
+        dest.symlink_metadata().context(context)?.permissions()
+    } else {
+        #[allow(unused_mut)]
+        let mut permissions = source_metadata.permissions();
+        #[cfg(unix)]
+        {
+            use uucore::mode::get_umask;
+
+            let mut mode = permissions.mode();
+
+            // remove sticky bit, suid and gid bit
+            const SPECIAL_PERMS_MASK: u32 = 0o7000;
+            mode &= !SPECIAL_PERMS_MASK;
+
+            // apply umask
+            mode &= !get_umask();
+
+            permissions.set_mode(mode);
+        }
+        permissions
     };
 
-    match options.copy_mode {
-        CopyMode::Link => {
-            if dest.exists() {
-                let backup_path =
-                    backup_control::get_backup_path(options.backup, dest, &options.backup_suffix);
-                if let Some(backup_path) = backup_path {
-                    backup_dest(dest, &backup_path)?;
-                    fs::remove_file(dest)?;
+    match options.copy_mode {
+        CopyMode::Link => {
+            if dest.exists() {
+                let backup_path =
+                    backup_control::get_backup_path(options.backup, dest, &options.backup_suffix);
+                if let Some(backup_path) = backup_path {
+                    backup_dest(dest, &backup_path)?;
+                    fs::remove_file(dest)?;
                 }
             }
-            if options.dereference(source_in_command_line) && source.is_symlink() {
-                let resolved =
-                    canonicalize(source, MissingHandling::Missing, ResolveMode::Physical).unwrap();
-                fs::hard_link(resolved, dest)
-            } else {
-                fs::hard_link(source, dest)
+            if options.dereference(source_in_command_line) && source.is_symlink() {
+                let resolved =
+                    canonicalize(source, MissingHandling::Missing, ResolveMode::Physical).unwrap();
+                fs::hard_link(resolved, dest)
+            } else {
+                fs::hard_link(source, dest)
             }
-            .context(context)?;
+            .context(context)?;
         }
-        CopyMode::Copy => {
-            copy_helper(
-                source,
-                dest,
-                options,
-                context,
-                source_is_symlink,
-                source_is_fifo,
-                symlinked_files,
+        CopyMode::Copy => {
+            copy_helper(
+                source,
+                dest,
+                options,
+                context,
+                source_is_symlink,
+                source_is_fifo,
+                symlinked_files,
             )?;
         }
-        CopyMode::SymLink => {
-            symlink_file(source, dest, context, symlinked_files)?;
+        CopyMode::SymLink => {
+            symlink_file(source, dest, context, symlinked_files)?;
         }
-        CopyMode::Update => {
-            if dest.exists() {
-                let dest_metadata = fs::symlink_metadata(dest)?;
+        CopyMode::Update => {
+            if dest.exists() {
+                let dest_metadata = fs::symlink_metadata(dest)?;
 
-                let src_time = source_metadata.modified()?;
-                let dest_time = dest_metadata.modified()?;
-                if src_time <= dest_time {
-                    return Ok(());
-                } else {
-                    copy_helper(
-                        source,
-                        dest,
-                        options,
-                        context,
-                        source_is_symlink,
-                        source_is_fifo,
-                        symlinked_files,
+                let src_time = source_metadata.modified()?;
+                let dest_time = dest_metadata.modified()?;
+                if src_time <= dest_time {
+                    return Ok(());
+                } else {
+                    copy_helper(
+                        source,
+                        dest,
+                        options,
+                        context,
+                        source_is_symlink,
+                        source_is_fifo,
+                        symlinked_files,
                     )?;
                 }
-            } else {
-                copy_helper(
-                    source,
-                    dest,
-                    options,
-                    context,
-                    source_is_symlink,
-                    source_is_fifo,
-                    symlinked_files,
+            } else {
+                copy_helper(
+                    source,
+                    dest,
+                    options,
+                    context,
+                    source_is_symlink,
+                    source_is_fifo,
+                    symlinked_files,
                 )?;
             }
         }
-        CopyMode::AttrOnly => {
-            OpenOptions::new()
-                .write(true)
-                .truncate(false)
-                .create(true)
-                .open(dest)
-                .unwrap();
+        CopyMode::AttrOnly => {
+            OpenOptions::new()
+                .write(true)
+                .truncate(false)
+                .create(true)
+                .open(dest)
+                .unwrap();
         }
     };
 
-    // TODO: implement something similar to gnu's lchown
-    if !dest.is_symlink() {
-        // Here, to match GNU semantics, we quietly ignore an error
-        // if a user does not have the correct ownership to modify
-        // the permissions of a file.
-        //
-        // FWIW, the OS will throw an error later, on the write op, if
-        // the user does not have permission to write to the file.
-        fs::set_permissions(dest, dest_permissions).ok();
+    // TODO: implement something similar to gnu's lchown
+    if !dest.is_symlink() {
+        // Here, to match GNU semantics, we quietly ignore an error
+        // if a user does not have the correct ownership to modify
+        // the permissions of a file.
+        //
+        // FWIW, the OS will throw an error later, on the write op, if
+        // the user does not have permission to write to the file.
+        fs::set_permissions(dest, dest_permissions).ok();
     }
-    copy_attributes(source, dest, &options.preserve_attributes)?;
+    copy_attributes(source, dest, &options.preserve_attributes)?;
     Ok(())
 }
 
-/// Copy the file from `source` to `dest` either using the normal `fs::copy` or a
-/// copy-on-write scheme if --reflink is specified and the filesystem supports it.
-fn copy_helper(
-    source: &Path,
-    dest: &Path,
-    options: &Options,
-    context: &str,
-    source_is_symlink: bool,
-    source_is_fifo: bool,
-    symlinked_files: &mut HashSet<FileInformation>,
-) -> CopyResult<()> {
-    if options.parents {
-        let parent = dest.parent().unwrap_or(dest);
-        fs::create_dir_all(parent)?;
+/// Copy the file from `source` to `dest` either using the normal `fs::copy` or a
+/// copy-on-write scheme if --reflink is specified and the filesystem supports it.
+fn copy_helper(
+    source: &Path,
+    dest: &Path,
+    options: &Options,
+    context: &str,
+    source_is_symlink: bool,
+    source_is_fifo: bool,
+    symlinked_files: &mut HashSet<FileInformation>,
+) -> CopyResult<()> {
+    if options.parents {
+        let parent = dest.parent().unwrap_or(dest);
+        fs::create_dir_all(parent)?;
     }
 
-    if source.as_os_str() == "/dev/null" {
+    if source.as_os_str() == "/dev/null" {
         /* workaround a limitation of fs::copy
          * https://github.com/rust-lang/rust/issues/79390
-         */
-        File::create(dest).context(dest.display().to_string())?;
-    } else if source_is_fifo && options.recursive {
-        #[cfg(unix)]
-        copy_fifo(dest, options.overwrite)?;
-    } else if source_is_symlink {
-        copy_link(source, dest, symlinked_files)?;
-    } else {
-        copy_on_write(
-            source,
-            dest,
-            options.reflink_mode,
-            options.sparse_mode,
-            context,
+         */
+        File::create(dest).context(dest.display().to_string())?;
+    } else if source_is_fifo && options.recursive {
+        #[cfg(unix)]
+        copy_fifo(dest, options.overwrite)?;
+    } else if source_is_symlink {
+        copy_link(source, dest, symlinked_files)?;
+    } else {
+        copy_on_write(
+            source,
+            dest,
+            options.reflink_mode,
+            options.sparse_mode,
+            context,
         )?;
     }
 
     Ok(())
 }
 
-// "Copies" a FIFO by creating a new one. This workaround is because Rust's
-// built-in fs::copy does not handle FIFOs (see rust-lang/rust/issues/79390).
-#[cfg(unix)]
-fn copy_fifo(dest: &Path, overwrite: OverwriteMode) -> CopyResult<()> {
-    if dest.exists() {
-        overwrite.verify(dest)?;
-        fs::remove_file(dest)?;
+// "Copies" a FIFO by creating a new one. This workaround is because Rust's
+// built-in fs::copy does not handle FIFOs (see rust-lang/rust/issues/79390).
+#[cfg(unix)]
+fn copy_fifo(dest: &Path, overwrite: OverwriteMode) -> CopyResult<()> {
+    if dest.exists() {
+        overwrite.verify(dest)?;
+        fs::remove_file(dest)?;
     }
 
-    let name = CString::new(dest.as_os_str().as_bytes()).unwrap();
-    let err = unsafe { mkfifo(name.as_ptr(), 0o666) };
-    if err == -1 {
-        return Err(format!("cannot create fifo {}: File exists", dest.quote()).into());
+    let name = CString::new(dest.as_os_str().as_bytes()).unwrap();
+    let err = unsafe { mkfifo(name.as_ptr(), 0o666) };
+    if err == -1 {
+        return Err(format!("cannot create fifo {}: File exists", dest.quote()).into());
     }
     Ok(())
 }
 
-fn copy_link(
-    source: &Path,
-    dest: &Path,
-    symlinked_files: &mut HashSet<FileInformation>,
-) -> CopyResult<()> {
-    // Here, we will copy the symlink itself (actually, just recreate it)
-    let link = fs::read_link(source)?;
-    let dest: Cow<'_, Path> = if dest.is_dir() {
-        match source.file_name() {
-            Some(name) => dest.join(name).into(),
-            None => crash!(
-                EXIT_ERR,
+fn copy_link(
+    source: &Path,
+    dest: &Path,
+    symlinked_files: &mut HashSet<FileInformation>,
+) -> CopyResult<()> {
+    // Here, we will copy the symlink itself (actually, just recreate it)
+    let link = fs::read_link(source)?;
+    let dest: Cow<'_, Path> = if dest.is_dir() {
+        match source.file_name() {
+            Some(name) => dest.join(name).into(),
+            None => crash!(
+                EXIT_ERR,
                 "cannot stat {}: No such file or directory",
-                source.quote()
+                source.quote()
             ),
         }
-    } else {
-        // we always need to remove the file to be able to create a symlink,
-        // even if it is writeable.
-        if dest.is_symlink() || dest.is_file() {
-            fs::remove_file(dest)?;
+    } else {
+        // we always need to remove the file to be able to create a symlink,
+        // even if it is writeable.
+        if dest.is_symlink() || dest.is_file() {
+            fs::remove_file(dest)?;
         }
-        dest.into()
+        dest.into()
     };
-    symlink_file(&link, &dest, &context_for(&link, &dest), symlinked_files)
+    symlink_file(&link, &dest, &context_for(&link, &dest), symlinked_files)
 }
 
-/// Generate an error message if `target` is not the correct `target_type`
-pub fn verify_target_type(target: &Path, target_type: &TargetType) -> CopyResult<()> {
-    match (target_type, target.is_dir()) {
-        (&TargetType::Directory, false) => {
-            Err(format!("target: {} is not a directory", target.quote()).into())
+/// Generate an error message if `target` is not the correct `target_type`
+pub fn verify_target_type(target: &Path, target_type: &TargetType) -> CopyResult<()> {
+    match (target_type, target.is_dir()) {
+        (&TargetType::Directory, false) => {
+            Err(format!("target: {} is not a directory", target.quote()).into())
         }
-        (&TargetType::File, true) => Err(format!(
+        (&TargetType::File, true) => Err(format!(
             "cannot overwrite directory {} with non-directory",
-            target.quote()
+            target.quote()
         )
-        .into()),
-        _ => Ok(()),
+        .into()),
+        _ => Ok(()),
     }
 }
 
-/// Remove the `root` prefix from `source` and prefix it with `target`
-/// to create a file that is local to `target`
-/// # Examples
-///
-/// ```ignore
-/// assert!(uu_cp::localize_to_target(
-///     &Path::new("a/source/"),
-///     &Path::new("a/source/c.txt"),
-///     &Path::new("target/"),
-/// ).unwrap() == Path::new("target/c.txt"))
-/// ```
-pub fn localize_to_target(root: &Path, source: &Path, target: &Path) -> CopyResult<PathBuf> {
-    let local_to_root = source.strip_prefix(root)?;
-    Ok(target.join(local_to_root))
+/// Remove the `root` prefix from `source` and prefix it with `target`
+/// to create a file that is local to `target`
+/// # Examples
+///
+/// ```ignore
+/// assert!(uu_cp::localize_to_target(
+///     &Path::new("a/source/"),
+///     &Path::new("a/source/c.txt"),
+///     &Path::new("target/"),
+/// ).unwrap() == Path::new("target/c.txt"))
+/// ```
+pub fn localize_to_target(root: &Path, source: &Path, target: &Path) -> CopyResult<PathBuf> {
+    let local_to_root = source.strip_prefix(root)?;
+    Ok(target.join(local_to_root))
 }
 
-#[test]
-fn test_cp_localize_to_target() {
+#[test]
+fn test_cp_localize_to_target() {
     assert!(
-        localize_to_target(
-            Path::new("a/source/"),
-            Path::new("a/source/c.txt"),
-            Path::new("target/")
+        localize_to_target(
+            Path::new("a/source/"),
+            Path::new("a/source/c.txt"),
+            Path::new("target/")
         )
-        .unwrap()
-            == Path::new("target/c.txt")
+        .unwrap()
+            == Path::new("target/c.txt")
     );
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_cp/platform/linux.rs.html b/dev/src/uu_cp/platform/linux.rs.html index b6898c97a..196b547b8 100644 --- a/dev/src/uu_cp/platform/linux.rs.html +++ b/dev/src/uu_cp/platform/linux.rs.html @@ -1,4 +1,4 @@ -linux.rs - source
1
+linux.rs - source
1
 2
 3
 4
@@ -108,115 +108,115 @@
 108
 109
 110
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore ficlone reflink ftruncate pwrite fiemap
-use std::fs::File;
-use std::io::Read;
-use std::os::unix::io::AsRawFd;
-use std::path::Path;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore ficlone reflink ftruncate pwrite fiemap
+use std::fs::File;
+use std::io::Read;
+use std::os::unix::io::AsRawFd;
+use std::path::Path;
 
-use quick_error::ResultExt;
+use quick_error::ResultExt;
 
-use crate::{CopyResult, ReflinkMode, SparseMode};
+use crate::{CopyResult, ReflinkMode, SparseMode};
 
-// From /usr/include/linux/fs.h:
-// #define FICLONE		_IOW(0x94, 9, int)
-// Use a macro as libc::ioctl expects u32 or u64 depending on the arch
-macro_rules! FICLONE {
+// From /usr/include/linux/fs.h:
+// #define FICLONE		_IOW(0x94, 9, int)
+// Use a macro as libc::ioctl expects u32 or u64 depending on the arch
+macro_rules! FICLONE {
     () => {
-        0x40049409
-    };
+        0x40049409
+    };
 }
 
-/// Use the Linux `ioctl_ficlone` API to do a copy-on-write clone.
-///
-/// If `fallback` is true and there is a failure performing the clone,
-/// then this function performs a standard [`std::fs::copy`]. Otherwise,
-/// this function returns an error.
-#[cfg(any(target_os = "linux", target_os = "android"))]
-fn clone<P>(source: P, dest: P, fallback: bool) -> std::io::Result<()>
-where
-    P: AsRef<Path>,
+/// Use the Linux `ioctl_ficlone` API to do a copy-on-write clone.
+///
+/// If `fallback` is true and there is a failure performing the clone,
+/// then this function performs a standard [`std::fs::copy`]. Otherwise,
+/// this function returns an error.
+#[cfg(any(target_os = "linux", target_os = "android"))]
+fn clone<P>(source: P, dest: P, fallback: bool) -> std::io::Result<()>
+where
+    P: AsRef<Path>,
 {
-    let src_file = File::open(&source)?;
-    let dst_file = File::create(&dest)?;
-    let src_fd = src_file.as_raw_fd();
-    let dst_fd = dst_file.as_raw_fd();
-    let result = unsafe { libc::ioctl(dst_fd, FICLONE!(), src_fd) };
-    if result != 0 {
-        if fallback {
-            std::fs::copy(source, dest).map(|_| ())
-        } else {
-            Err(std::io::Error::last_os_error())
+    let src_file = File::open(&source)?;
+    let dst_file = File::create(&dest)?;
+    let src_fd = src_file.as_raw_fd();
+    let dst_fd = dst_file.as_raw_fd();
+    let result = unsafe { libc::ioctl(dst_fd, FICLONE!(), src_fd) };
+    if result != 0 {
+        if fallback {
+            std::fs::copy(source, dest).map(|_| ())
+        } else {
+            Err(std::io::Error::last_os_error())
         }
-    } else {
+    } else {
         Ok(())
     }
 }
 
-/// Perform a sparse copy from one file to another.
-#[cfg(any(target_os = "linux", target_os = "android"))]
-fn sparse_copy<P>(source: P, dest: P) -> std::io::Result<()>
-where
-    P: AsRef<Path>,
+/// Perform a sparse copy from one file to another.
+#[cfg(any(target_os = "linux", target_os = "android"))]
+fn sparse_copy<P>(source: P, dest: P) -> std::io::Result<()>
+where
+    P: AsRef<Path>,
 {
-    use std::os::unix::prelude::MetadataExt;
+    use std::os::unix::prelude::MetadataExt;
 
-    let mut src_file = File::open(source)?;
-    let dst_file = File::create(dest)?;
-    let dst_fd = dst_file.as_raw_fd();
+    let mut src_file = File::open(source)?;
+    let dst_file = File::create(dest)?;
+    let dst_fd = dst_file.as_raw_fd();
 
-    let size: usize = src_file.metadata()?.size().try_into().unwrap();
-    if unsafe { libc::ftruncate(dst_fd, size.try_into().unwrap()) } < 0 {
-        return Err(std::io::Error::last_os_error());
+    let size: usize = src_file.metadata()?.size().try_into().unwrap();
+    if unsafe { libc::ftruncate(dst_fd, size.try_into().unwrap()) } < 0 {
+        return Err(std::io::Error::last_os_error());
     }
 
-    let blksize = dst_file.metadata()?.blksize();
-    let mut buf: Vec<u8> = vec![0; blksize.try_into().unwrap()];
-    let mut current_offset: usize = 0;
+    let blksize = dst_file.metadata()?.blksize();
+    let mut buf: Vec<u8> = vec![0; blksize.try_into().unwrap()];
+    let mut current_offset: usize = 0;
 
-    // TODO Perhaps we can employ the "fiemap ioctl" API to get the
-    // file extent mappings:
-    // https://www.kernel.org/doc/html/latest/filesystems/fiemap.html
-    while current_offset < size {
-        let this_read = src_file.read(&mut buf)?;
-        if buf.iter().any(|&x| x != 0) {
-            unsafe {
-                libc::pwrite(
-                    dst_fd,
-                    buf.as_ptr() as *const libc::c_void,
-                    this_read,
-                    current_offset.try_into().unwrap(),
+    // TODO Perhaps we can employ the "fiemap ioctl" API to get the
+    // file extent mappings:
+    // https://www.kernel.org/doc/html/latest/filesystems/fiemap.html
+    while current_offset < size {
+        let this_read = src_file.read(&mut buf)?;
+        if buf.iter().any(|&x| x != 0) {
+            unsafe {
+                libc::pwrite(
+                    dst_fd,
+                    buf.as_ptr() as *const libc::c_void,
+                    this_read,
+                    current_offset.try_into().unwrap(),
                 )
             };
         }
-        current_offset += this_read;
+        current_offset += this_read;
     }
     Ok(())
 }
 
-/// Copies `source` to `dest` using copy-on-write if possible.
-pub(crate) fn copy_on_write(
-    source: &Path,
-    dest: &Path,
-    reflink_mode: ReflinkMode,
-    sparse_mode: SparseMode,
-    context: &str,
-) -> CopyResult<()> {
-    let result = match (reflink_mode, sparse_mode) {
-        (ReflinkMode::Never, _) => std::fs::copy(source, dest).map(|_| ()),
-        (ReflinkMode::Auto, SparseMode::Always) => sparse_copy(source, dest),
-        (ReflinkMode::Auto, _) => clone(source, dest, true),
-        (ReflinkMode::Always, SparseMode::Auto) => clone(source, dest, false),
-        (ReflinkMode::Always, _) => {
-            return Err("`--reflink=always` can be used only with --sparse=auto".into())
+/// Copies `source` to `dest` using copy-on-write if possible.
+pub(crate) fn copy_on_write(
+    source: &Path,
+    dest: &Path,
+    reflink_mode: ReflinkMode,
+    sparse_mode: SparseMode,
+    context: &str,
+) -> CopyResult<()> {
+    let result = match (reflink_mode, sparse_mode) {
+        (ReflinkMode::Never, _) => std::fs::copy(source, dest).map(|_| ()),
+        (ReflinkMode::Auto, SparseMode::Always) => sparse_copy(source, dest),
+        (ReflinkMode::Auto, _) => clone(source, dest, true),
+        (ReflinkMode::Always, SparseMode::Auto) => clone(source, dest, false),
+        (ReflinkMode::Always, _) => {
+            return Err("`--reflink=always` can be used only with --sparse=auto".into())
         }
     };
-    result.context(context)?;
+    result.context(context)?;
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_cp/platform/mod.rs.html b/dev/src/uu_cp/platform/mod.rs.html index 284aba676..4d97b0750 100644 --- a/dev/src/uu_cp/platform/mod.rs.html +++ b/dev/src/uu_cp/platform/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
@@ -16,23 +16,23 @@
 16
 17
 18
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-#[cfg(target_os = "macos")]
-mod macos;
-#[cfg(target_os = "macos")]
-pub(crate) use self::macos::copy_on_write;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+#[cfg(target_os = "macos")]
+mod macos;
+#[cfg(target_os = "macos")]
+pub(crate) use self::macos::copy_on_write;
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-mod linux;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-pub(crate) use self::linux::copy_on_write;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+mod linux;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+pub(crate) use self::linux::copy_on_write;
 
-#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "macos")))]
-mod other;
-#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "macos")))]
-pub(crate) use self::other::copy_on_write;
+#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "macos")))]
+mod other;
+#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "macos")))]
+pub(crate) use self::other::copy_on_write;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_csplit/csplit.rs.html b/dev/src/uu_csplit/csplit.rs.html index ed8763894..81a6cd397 100644 --- a/dev/src/uu_csplit/csplit.rs.html +++ b/dev/src/uu_csplit/csplit.rs.html @@ -1,4 +1,4 @@ -csplit.rs - source
1
+csplit.rs - source
1
 2
 3
 4
@@ -819,189 +819,189 @@
 819
 820
 821
-
#![crate_name = "uu_csplit"]
-// spell-checker:ignore rustdoc
-#![allow(rustdoc::private_intra_doc_links)]
+
#![crate_name = "uu_csplit"]
+// spell-checker:ignore rustdoc
+#![allow(rustdoc::private_intra_doc_links)]
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use std::cmp::Ordering;
-use std::io::{self, BufReader};
-use std::{
-    fs::{remove_file, File},
-    io::{BufRead, BufWriter, Write},
+use std::cmp::Ordering;
+use std::io::{self, BufReader};
+use std::{
+    fs::{remove_file, File},
+    io::{BufRead, BufWriter, Write},
 };
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use regex::Regex;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use regex::Regex;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult};
+use uucore::format_usage;
 
-mod csplit_error;
-mod patterns;
-mod split_name;
+mod csplit_error;
+mod patterns;
+mod split_name;
 
-use crate::csplit_error::CsplitError;
-use crate::split_name::SplitName;
+use crate::csplit_error::CsplitError;
+use crate::split_name::SplitName;
 
-static ABOUT: &str = "split a file into sections determined by context lines";
-static LONG_HELP: &str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output.";
-const USAGE: &str = "{} [OPTION]... FILE PATTERN...";
+static ABOUT: &str = "split a file into sections determined by context lines";
+static LONG_HELP: &str = "Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output.";
+const USAGE: &str = "{} [OPTION]... FILE PATTERN...";
 
-mod options {
-    pub const SUFFIX_FORMAT: &str = "suffix-format";
-    pub const SUPPRESS_MATCHED: &str = "suppress-matched";
-    pub const DIGITS: &str = "digits";
-    pub const PREFIX: &str = "prefix";
-    pub const KEEP_FILES: &str = "keep-files";
-    pub const QUIET: &str = "quiet";
-    pub const ELIDE_EMPTY_FILES: &str = "elide-empty-files";
-    pub const FILE: &str = "file";
-    pub const PATTERN: &str = "pattern";
+mod options {
+    pub const SUFFIX_FORMAT: &str = "suffix-format";
+    pub const SUPPRESS_MATCHED: &str = "suppress-matched";
+    pub const DIGITS: &str = "digits";
+    pub const PREFIX: &str = "prefix";
+    pub const KEEP_FILES: &str = "keep-files";
+    pub const QUIET: &str = "quiet";
+    pub const ELIDE_EMPTY_FILES: &str = "elide-empty-files";
+    pub const FILE: &str = "file";
+    pub const PATTERN: &str = "pattern";
 }
 
-/// Command line options for csplit.
-pub struct CsplitOptions {
-    split_name: crate::SplitName,
-    keep_files: bool,
-    quiet: bool,
-    elide_empty_files: bool,
-    suppress_matched: bool,
+/// Command line options for csplit.
+pub struct CsplitOptions {
+    split_name: crate::SplitName,
+    keep_files: bool,
+    quiet: bool,
+    elide_empty_files: bool,
+    suppress_matched: bool,
 }
 
-impl CsplitOptions {
-    fn new(matches: &ArgMatches) -> Self {
-        let keep_files = matches.get_flag(options::KEEP_FILES);
-        let quiet = matches.get_flag(options::QUIET);
-        let elide_empty_files = matches.get_flag(options::ELIDE_EMPTY_FILES);
-        let suppress_matched = matches.get_flag(options::SUPPRESS_MATCHED);
+impl CsplitOptions {
+    fn new(matches: &ArgMatches) -> Self {
+        let keep_files = matches.get_flag(options::KEEP_FILES);
+        let quiet = matches.get_flag(options::QUIET);
+        let elide_empty_files = matches.get_flag(options::ELIDE_EMPTY_FILES);
+        let suppress_matched = matches.get_flag(options::SUPPRESS_MATCHED);
 
-        Self {
-            split_name: crash_if_err!(
+        Self {
+            split_name: crash_if_err!(
                 1,
-                SplitName::new(
-                    matches
-                        .get_one::<String>(options::PREFIX)
-                        .map(|s| s.to_owned()),
-                    matches
-                        .get_one::<String>(options::SUFFIX_FORMAT)
-                        .map(|s| s.to_owned()),
-                    matches
-                        .get_one::<String>(options::DIGITS)
-                        .map(|s| s.to_owned())
+                SplitName::new(
+                    matches
+                        .get_one::<String>(options::PREFIX)
+                        .map(|s| s.to_owned()),
+                    matches
+                        .get_one::<String>(options::SUFFIX_FORMAT)
+                        .map(|s| s.to_owned()),
+                    matches
+                        .get_one::<String>(options::DIGITS)
+                        .map(|s| s.to_owned())
                 )
             ),
-            keep_files,
-            quiet,
-            elide_empty_files,
-            suppress_matched,
+            keep_files,
+            quiet,
+            elide_empty_files,
+            suppress_matched,
         }
     }
 }
 
-/// Splits a file into severals according to the command line patterns.
-///
-/// # Errors
-///
-/// - [`io::Error`] if there is some problem reading/writing from/to a file.
-/// - [`CsplitError::LineOutOfRange`] if the line number pattern is larger than the number of input
-///   lines.
-/// - [`CsplitError::LineOutOfRangeOnRepetition`], like previous but after applying the pattern
-///   more than once.
-/// - [`CsplitError::MatchNotFound`] if no line matched a regular expression.
-/// - [`CsplitError::MatchNotFoundOnRepetition`], like previous but after applying the pattern
-///   more than once.
-pub fn csplit<T>(
-    options: &CsplitOptions,
-    patterns: Vec<patterns::Pattern>,
-    input: T,
-) -> Result<(), CsplitError>
-where
-    T: BufRead,
+/// Splits a file into severals according to the command line patterns.
+///
+/// # Errors
+///
+/// - [`io::Error`] if there is some problem reading/writing from/to a file.
+/// - [`CsplitError::LineOutOfRange`] if the line number pattern is larger than the number of input
+///   lines.
+/// - [`CsplitError::LineOutOfRangeOnRepetition`], like previous but after applying the pattern
+///   more than once.
+/// - [`CsplitError::MatchNotFound`] if no line matched a regular expression.
+/// - [`CsplitError::MatchNotFoundOnRepetition`], like previous but after applying the pattern
+///   more than once.
+pub fn csplit<T>(
+    options: &CsplitOptions,
+    patterns: Vec<patterns::Pattern>,
+    input: T,
+) -> Result<(), CsplitError>
+where
+    T: BufRead,
 {
-    let mut input_iter = InputSplitter::new(input.lines().enumerate());
-    let mut split_writer = SplitWriter::new(options);
-    let ret = do_csplit(&mut split_writer, patterns, &mut input_iter);
+    let mut input_iter = InputSplitter::new(input.lines().enumerate());
+    let mut split_writer = SplitWriter::new(options);
+    let ret = do_csplit(&mut split_writer, patterns, &mut input_iter);
 
-    // consume the rest
-    input_iter.rewind_buffer();
-    if let Some((_, line)) = input_iter.next() {
-        split_writer.new_writer()?;
-        split_writer.writeln(&line?)?;
-        for (_, line) in input_iter {
-            split_writer.writeln(&line?)?;
+    // consume the rest
+    input_iter.rewind_buffer();
+    if let Some((_, line)) = input_iter.next() {
+        split_writer.new_writer()?;
+        split_writer.writeln(&line?)?;
+        for (_, line) in input_iter {
+            split_writer.writeln(&line?)?;
         }
-        split_writer.finish_split();
+        split_writer.finish_split();
     }
-    // delete files on error by default
-    if ret.is_err() && !options.keep_files {
-        split_writer.delete_all_splits()?;
+    // delete files on error by default
+    if ret.is_err() && !options.keep_files {
+        split_writer.delete_all_splits()?;
     }
-    ret
+    ret
 }
 
-fn do_csplit<I>(
-    split_writer: &mut SplitWriter,
-    patterns: Vec<patterns::Pattern>,
-    input_iter: &mut InputSplitter<I>,
-) -> Result<(), CsplitError>
-where
-    I: Iterator<Item = (usize, io::Result<String>)>,
+fn do_csplit<I>(
+    split_writer: &mut SplitWriter,
+    patterns: Vec<patterns::Pattern>,
+    input_iter: &mut InputSplitter<I>,
+) -> Result<(), CsplitError>
+where
+    I: Iterator<Item = (usize, io::Result<String>)>,
 {
-    // split the file based on patterns
-    for pattern in patterns.into_iter() {
-        let pattern_as_str = pattern.to_string();
-        let is_skip = matches!(pattern, patterns::Pattern::SkipToMatch(_, _, _));
-        match pattern {
-            patterns::Pattern::UpToLine(n, ex) => {
-                let mut up_to_line = n;
-                for (_, ith) in ex.iter() {
-                    split_writer.new_writer()?;
-                    match split_writer.do_to_line(&pattern_as_str, up_to_line, input_iter) {
-                        // the error happened when applying the pattern more than once
-                        Err(CsplitError::LineOutOfRange(_)) if ith != 1 => {
-                            return Err(CsplitError::LineOutOfRangeOnRepetition(
-                                pattern_as_str.to_string(),
-                                ith - 1,
+    // split the file based on patterns
+    for pattern in patterns.into_iter() {
+        let pattern_as_str = pattern.to_string();
+        let is_skip = matches!(pattern, patterns::Pattern::SkipToMatch(_, _, _));
+        match pattern {
+            patterns::Pattern::UpToLine(n, ex) => {
+                let mut up_to_line = n;
+                for (_, ith) in ex.iter() {
+                    split_writer.new_writer()?;
+                    match split_writer.do_to_line(&pattern_as_str, up_to_line, input_iter) {
+                        // the error happened when applying the pattern more than once
+                        Err(CsplitError::LineOutOfRange(_)) if ith != 1 => {
+                            return Err(CsplitError::LineOutOfRangeOnRepetition(
+                                pattern_as_str.to_string(),
+                                ith - 1,
                             ));
                         }
-                        Err(err) => return Err(err),
-                        // continue the splitting process
-                        Ok(()) => (),
+                        Err(err) => return Err(err),
+                        // continue the splitting process
+                        Ok(()) => (),
                     }
-                    up_to_line += n;
+                    up_to_line += n;
                 }
             }
-            patterns::Pattern::UpToMatch(regex, offset, ex)
-            | patterns::Pattern::SkipToMatch(regex, offset, ex) => {
-                for (max, ith) in ex.iter() {
-                    if is_skip {
-                        // when skipping a part of the input, no writer is created
-                        split_writer.as_dev_null();
-                    } else {
-                        split_writer.new_writer()?;
+            patterns::Pattern::UpToMatch(regex, offset, ex)
+            | patterns::Pattern::SkipToMatch(regex, offset, ex) => {
+                for (max, ith) in ex.iter() {
+                    if is_skip {
+                        // when skipping a part of the input, no writer is created
+                        split_writer.as_dev_null();
+                    } else {
+                        split_writer.new_writer()?;
                     }
-                    match (
-                        split_writer.do_to_match(&pattern_as_str, &regex, offset, input_iter),
-                        max,
+                    match (
+                        split_writer.do_to_match(&pattern_as_str, &regex, offset, input_iter),
+                        max,
                     ) {
-                        // in case of ::pattern::ExecutePattern::Always, then it's fine not to find a
-                        // matching line
-                        (Err(CsplitError::MatchNotFound(_)), None) => {
-                            return Ok(());
+                        // in case of ::pattern::ExecutePattern::Always, then it's fine not to find a
+                        // matching line
+                        (Err(CsplitError::MatchNotFound(_)), None) => {
+                            return Ok(());
                         }
-                        // the error happened when applying the pattern more than once
-                        (Err(CsplitError::MatchNotFound(_)), Some(m)) if m != 1 && ith != 1 => {
-                            return Err(CsplitError::MatchNotFoundOnRepetition(
-                                pattern_as_str.to_string(),
-                                ith - 1,
+                        // the error happened when applying the pattern more than once
+                        (Err(CsplitError::MatchNotFound(_)), Some(m)) if m != 1 && ith != 1 => {
+                            return Err(CsplitError::MatchNotFoundOnRepetition(
+                                pattern_as_str.to_string(),
+                                ith - 1,
                             ));
                         }
-                        (Err(err), _) => return Err(err),
-                        // continue the splitting process
-                        (Ok(()), _) => (),
+                        (Err(err), _) => return Err(err),
+                        // continue the splitting process
+                        (Ok(()), _) => (),
                     };
                 }
             }
@@ -1010,635 +1010,635 @@
     Ok(())
 }
 
-/// Write a portion of the input file into a split which filename is based on an incrementing
-/// counter.
-struct SplitWriter<'a> {
-    /// the options set through the command line
-    options: &'a CsplitOptions,
-    /// a split counter
-    counter: usize,
-    /// the writer to the current split
-    current_writer: Option<BufWriter<File>>,
-    /// the size in bytes of the current split
-    size: usize,
-    /// flag to indicate that no content should be written to a split
-    dev_null: bool,
+/// Write a portion of the input file into a split which filename is based on an incrementing
+/// counter.
+struct SplitWriter<'a> {
+    /// the options set through the command line
+    options: &'a CsplitOptions,
+    /// a split counter
+    counter: usize,
+    /// the writer to the current split
+    current_writer: Option<BufWriter<File>>,
+    /// the size in bytes of the current split
+    size: usize,
+    /// flag to indicate that no content should be written to a split
+    dev_null: bool,
 }
 
-impl<'a> Drop for SplitWriter<'a> {
-    fn drop(&mut self) {
-        if self.options.elide_empty_files && self.size == 0 {
-            let file_name = self.options.split_name.get(self.counter);
-            remove_file(file_name).expect("Failed to elide split");
+impl<'a> Drop for SplitWriter<'a> {
+    fn drop(&mut self) {
+        if self.options.elide_empty_files && self.size == 0 {
+            let file_name = self.options.split_name.get(self.counter);
+            remove_file(file_name).expect("Failed to elide split");
         }
     }
 }
 
-impl<'a> SplitWriter<'a> {
-    fn new(options: &CsplitOptions) -> SplitWriter {
-        SplitWriter {
-            options,
-            counter: 0,
-            current_writer: None,
-            size: 0,
-            dev_null: false,
+impl<'a> SplitWriter<'a> {
+    fn new(options: &CsplitOptions) -> SplitWriter {
+        SplitWriter {
+            options,
+            counter: 0,
+            current_writer: None,
+            size: 0,
+            dev_null: false,
         }
     }
 
-    /// Creates a new split and returns its filename.
-    ///
-    /// # Errors
-    ///
-    /// The creation of the split file may fail with some [`io::Error`].
-    fn new_writer(&mut self) -> io::Result<()> {
-        let file_name = self.options.split_name.get(self.counter);
-        let file = File::create(&file_name)?;
-        self.current_writer = Some(BufWriter::new(file));
-        self.counter += 1;
-        self.size = 0;
-        self.dev_null = false;
+    /// Creates a new split and returns its filename.
+    ///
+    /// # Errors
+    ///
+    /// The creation of the split file may fail with some [`io::Error`].
+    fn new_writer(&mut self) -> io::Result<()> {
+        let file_name = self.options.split_name.get(self.counter);
+        let file = File::create(&file_name)?;
+        self.current_writer = Some(BufWriter::new(file));
+        self.counter += 1;
+        self.size = 0;
+        self.dev_null = false;
         Ok(())
     }
 
-    /// The current split will not keep any of the read input lines.
-    fn as_dev_null(&mut self) {
-        self.dev_null = true;
+    /// The current split will not keep any of the read input lines.
+    fn as_dev_null(&mut self) {
+        self.dev_null = true;
     }
 
-    /// Writes the line to the current split, appending a newline character.
-    /// If [`self.dev_null`] is true, then the line is discarded.
-    ///
-    /// # Errors
-    ///
-    /// Some [`io::Error`] may occur when attempting to write the line.
-    fn writeln(&mut self, line: &str) -> io::Result<()> {
-        if !self.dev_null {
-            match self.current_writer {
-                Some(ref mut current_writer) => {
-                    let bytes = line.as_bytes();
-                    current_writer.write_all(bytes)?;
-                    current_writer.write_all(b"\n")?;
-                    self.size += bytes.len() + 1;
+    /// Writes the line to the current split, appending a newline character.
+    /// If [`self.dev_null`] is true, then the line is discarded.
+    ///
+    /// # Errors
+    ///
+    /// Some [`io::Error`] may occur when attempting to write the line.
+    fn writeln(&mut self, line: &str) -> io::Result<()> {
+        if !self.dev_null {
+            match self.current_writer {
+                Some(ref mut current_writer) => {
+                    let bytes = line.as_bytes();
+                    current_writer.write_all(bytes)?;
+                    current_writer.write_all(b"\n")?;
+                    self.size += bytes.len() + 1;
                 }
-                None => panic!("trying to write to a split that was not created"),
+                None => panic!("trying to write to a split that was not created"),
             }
         }
         Ok(())
     }
 
-    /// Perform some operations after completing a split, i.e., either remove it
-    /// if the [`options::ELIDE_EMPTY_FILES`] option is enabled, or print how much bytes were written
-    /// to it if [`options::QUIET`] is disabled.
-    ///
-    /// # Errors
-    ///
-    /// Some [`io::Error`] if the split could not be removed in case it should be elided.
-    fn finish_split(&mut self) {
-        if !self.dev_null {
-            if self.options.elide_empty_files && self.size == 0 {
-                self.counter -= 1;
-            } else if !self.options.quiet {
-                println!("{}", self.size);
+    /// Perform some operations after completing a split, i.e., either remove it
+    /// if the [`options::ELIDE_EMPTY_FILES`] option is enabled, or print how much bytes were written
+    /// to it if [`options::QUIET`] is disabled.
+    ///
+    /// # Errors
+    ///
+    /// Some [`io::Error`] if the split could not be removed in case it should be elided.
+    fn finish_split(&mut self) {
+        if !self.dev_null {
+            if self.options.elide_empty_files && self.size == 0 {
+                self.counter -= 1;
+            } else if !self.options.quiet {
+                println!("{}", self.size);
             }
         }
     }
 
-    /// Removes all the split files that were created.
-    ///
-    /// # Errors
-    ///
-    /// Returns an [`io::Error`] if there was a problem removing a split.
-    fn delete_all_splits(&self) -> io::Result<()> {
-        let mut ret = Ok(());
-        for ith in 0..self.counter {
-            let file_name = self.options.split_name.get(ith);
-            if let Err(err) = remove_file(file_name) {
-                ret = Err(err);
+    /// Removes all the split files that were created.
+    ///
+    /// # Errors
+    ///
+    /// Returns an [`io::Error`] if there was a problem removing a split.
+    fn delete_all_splits(&self) -> io::Result<()> {
+        let mut ret = Ok(());
+        for ith in 0..self.counter {
+            let file_name = self.options.split_name.get(ith);
+            if let Err(err) = remove_file(file_name) {
+                ret = Err(err);
             }
         }
-        ret
+        ret
     }
 
-    /// Split the input stream up to the line number `n`.
-    ///
-    /// If the line number `n` is smaller than the current position in the input, then an empty
-    /// split is created.
-    ///
-    /// # Errors
-    ///
-    /// In addition to errors reading/writing from/to a file, if the line number
-    /// `n` is greater than the total available lines, then a
-    /// [`CsplitError::LineOutOfRange`] error is returned.
-    fn do_to_line<I>(
-        &mut self,
-        pattern_as_str: &str,
-        n: usize,
-        input_iter: &mut InputSplitter<I>,
-    ) -> Result<(), CsplitError>
-    where
-        I: Iterator<Item = (usize, io::Result<String>)>,
+    /// Split the input stream up to the line number `n`.
+    ///
+    /// If the line number `n` is smaller than the current position in the input, then an empty
+    /// split is created.
+    ///
+    /// # Errors
+    ///
+    /// In addition to errors reading/writing from/to a file, if the line number
+    /// `n` is greater than the total available lines, then a
+    /// [`CsplitError::LineOutOfRange`] error is returned.
+    fn do_to_line<I>(
+        &mut self,
+        pattern_as_str: &str,
+        n: usize,
+        input_iter: &mut InputSplitter<I>,
+    ) -> Result<(), CsplitError>
+    where
+        I: Iterator<Item = (usize, io::Result<String>)>,
     {
-        input_iter.rewind_buffer();
-        input_iter.set_size_of_buffer(1);
+        input_iter.rewind_buffer();
+        input_iter.set_size_of_buffer(1);
 
-        let mut ret = Err(CsplitError::LineOutOfRange(pattern_as_str.to_string()));
-        while let Some((ln, line)) = input_iter.next() {
-            let l = line?;
-            match n.cmp(&(&ln + 1)) {
-                Ordering::Less => {
+        let mut ret = Err(CsplitError::LineOutOfRange(pattern_as_str.to_string()));
+        while let Some((ln, line)) = input_iter.next() {
+            let l = line?;
+            match n.cmp(&(&ln + 1)) {
+                Ordering::Less => {
                     assert!(
-                        input_iter.add_line_to_buffer(ln, l).is_none(),
-                        "the buffer is big enough to contain 1 line"
-                    );
-                    ret = Ok(());
+                        input_iter.add_line_to_buffer(ln, l).is_none(),
+                        "the buffer is big enough to contain 1 line"
+                    );
+                    ret = Ok(());
                     break;
                 }
-                Ordering::Equal => {
+                Ordering::Equal => {
                     assert!(
-                        self.options.suppress_matched
-                            || input_iter.add_line_to_buffer(ln, l).is_none(),
-                        "the buffer is big enough to contain 1 line"
-                    );
-                    ret = Ok(());
+                        self.options.suppress_matched
+                            || input_iter.add_line_to_buffer(ln, l).is_none(),
+                        "the buffer is big enough to contain 1 line"
+                    );
+                    ret = Ok(());
                     break;
                 }
-                Ordering::Greater => (),
+                Ordering::Greater => (),
             }
-            self.writeln(&l)?;
+            self.writeln(&l)?;
         }
-        self.finish_split();
-        ret
+        self.finish_split();
+        ret
     }
 
-    /// Read lines up to the line matching a [`Regex`]. With a non-zero offset,
-    /// the block of relevant lines can be extended (if positive), or reduced
-    /// (if negative).
-    ///
-    /// # Errors
-    ///
-    /// In addition to errors reading/writing from/to a file, the following errors may be returned:
-    /// - if no line matched, an [`CsplitError::MatchNotFound`].
-    /// - if there are not enough lines to accommodate the offset, an
-    /// [`CsplitError::LineOutOfRange`].
-    fn do_to_match<I>(
-        &mut self,
-        pattern_as_str: &str,
-        regex: &Regex,
-        mut offset: i32,
-        input_iter: &mut InputSplitter<I>,
-    ) -> Result<(), CsplitError>
-    where
-        I: Iterator<Item = (usize, io::Result<String>)>,
+    /// Read lines up to the line matching a [`Regex`]. With a non-zero offset,
+    /// the block of relevant lines can be extended (if positive), or reduced
+    /// (if negative).
+    ///
+    /// # Errors
+    ///
+    /// In addition to errors reading/writing from/to a file, the following errors may be returned:
+    /// - if no line matched, an [`CsplitError::MatchNotFound`].
+    /// - if there are not enough lines to accommodate the offset, an
+    /// [`CsplitError::LineOutOfRange`].
+    fn do_to_match<I>(
+        &mut self,
+        pattern_as_str: &str,
+        regex: &Regex,
+        mut offset: i32,
+        input_iter: &mut InputSplitter<I>,
+    ) -> Result<(), CsplitError>
+    where
+        I: Iterator<Item = (usize, io::Result<String>)>,
     {
-        if offset >= 0 {
-            // The offset is zero or positive, no need for a buffer on the lines read.
-            // NOTE: drain the buffer of input_iter, no match should be done within.
-            for line in input_iter.drain_buffer() {
-                self.writeln(&line)?;
+        if offset >= 0 {
+            // The offset is zero or positive, no need for a buffer on the lines read.
+            // NOTE: drain the buffer of input_iter, no match should be done within.
+            for line in input_iter.drain_buffer() {
+                self.writeln(&line)?;
             }
-            // retain the matching line
-            input_iter.set_size_of_buffer(1);
+            // retain the matching line
+            input_iter.set_size_of_buffer(1);
 
-            while let Some((ln, line)) = input_iter.next() {
-                let l = line?;
-                if regex.is_match(&l) {
-                    match (self.options.suppress_matched, offset) {
-                        // no offset, add the line to the next split
-                        (false, 0) => {
+            while let Some((ln, line)) = input_iter.next() {
+                let l = line?;
+                if regex.is_match(&l) {
+                    match (self.options.suppress_matched, offset) {
+                        // no offset, add the line to the next split
+                        (false, 0) => {
                             assert!(
-                                input_iter.add_line_to_buffer(ln, l).is_none(),
-                                "the buffer is big enough to contain 1 line"
-                            );
+                                input_iter.add_line_to_buffer(ln, l).is_none(),
+                                "the buffer is big enough to contain 1 line"
+                            );
                         }
-                        // a positive offset, some more lines need to be added to the current split
-                        (false, _) => self.writeln(&l)?,
-                        _ => (),
+                        // a positive offset, some more lines need to be added to the current split
+                        (false, _) => self.writeln(&l)?,
+                        _ => (),
                     };
-                    offset -= 1;
+                    offset -= 1;
 
-                    // write the extra lines required by the offset
-                    while offset > 0 {
-                        match input_iter.next() {
-                            Some((_, line)) => {
-                                self.writeln(&line?)?;
+                    // write the extra lines required by the offset
+                    while offset > 0 {
+                        match input_iter.next() {
+                            Some((_, line)) => {
+                                self.writeln(&line?)?;
                             }
-                            None => {
-                                self.finish_split();
-                                return Err(CsplitError::LineOutOfRange(
-                                    pattern_as_str.to_string(),
+                            None => {
+                                self.finish_split();
+                                return Err(CsplitError::LineOutOfRange(
+                                    pattern_as_str.to_string(),
                                 ));
                             }
                         };
-                        offset -= 1;
+                        offset -= 1;
                     }
-                    self.finish_split();
-                    return Ok(());
+                    self.finish_split();
+                    return Ok(());
                 }
-                self.writeln(&l)?;
+                self.writeln(&l)?;
             }
-        } else {
-            // With a negative offset we use a buffer to keep the lines within the offset.
-            // NOTE: do not drain the buffer of input_iter, in case of an LineOutOfRange error
-            // but do not rewind it either since no match should be done within.
-            // The consequence is that the buffer may already be full with lines from a previous
-            // split, which is taken care of when calling `shrink_buffer_to_size`.
-            let offset_usize = -offset as usize;
-            input_iter.set_size_of_buffer(offset_usize);
-            while let Some((ln, line)) = input_iter.next() {
-                let l = line?;
-                if regex.is_match(&l) {
-                    for line in input_iter.shrink_buffer_to_size() {
-                        self.writeln(&line)?;
+        } else {
+            // With a negative offset we use a buffer to keep the lines within the offset.
+            // NOTE: do not drain the buffer of input_iter, in case of an LineOutOfRange error
+            // but do not rewind it either since no match should be done within.
+            // The consequence is that the buffer may already be full with lines from a previous
+            // split, which is taken care of when calling `shrink_buffer_to_size`.
+            let offset_usize = -offset as usize;
+            input_iter.set_size_of_buffer(offset_usize);
+            while let Some((ln, line)) = input_iter.next() {
+                let l = line?;
+                if regex.is_match(&l) {
+                    for line in input_iter.shrink_buffer_to_size() {
+                        self.writeln(&line)?;
                     }
-                    if !self.options.suppress_matched {
-                        // add 1 to the buffer size to make place for the matched line
-                        input_iter.set_size_of_buffer(offset_usize + 1);
+                    if !self.options.suppress_matched {
+                        // add 1 to the buffer size to make place for the matched line
+                        input_iter.set_size_of_buffer(offset_usize + 1);
                         assert!(
-                            input_iter.add_line_to_buffer(ln, l).is_none(),
-                            "should be big enough to hold every lines"
-                        );
+                            input_iter.add_line_to_buffer(ln, l).is_none(),
+                            "should be big enough to hold every lines"
+                        );
                     }
-                    self.finish_split();
-                    if input_iter.buffer_len() < offset_usize {
-                        return Err(CsplitError::LineOutOfRange(pattern_as_str.to_string()));
+                    self.finish_split();
+                    if input_iter.buffer_len() < offset_usize {
+                        return Err(CsplitError::LineOutOfRange(pattern_as_str.to_string()));
                     }
-                    return Ok(());
+                    return Ok(());
                 }
-                if let Some(line) = input_iter.add_line_to_buffer(ln, l) {
-                    self.writeln(&line)?;
+                if let Some(line) = input_iter.add_line_to_buffer(ln, l) {
+                    self.writeln(&line)?;
                 }
             }
-            // no match, drain the buffer into the current split
-            for line in input_iter.drain_buffer() {
-                self.writeln(&line)?;
+            // no match, drain the buffer into the current split
+            for line in input_iter.drain_buffer() {
+                self.writeln(&line)?;
             }
         }
 
-        self.finish_split();
-        Err(CsplitError::MatchNotFound(pattern_as_str.to_string()))
+        self.finish_split();
+        Err(CsplitError::MatchNotFound(pattern_as_str.to_string()))
     }
 }
 
-/// An iterator which can output items from a buffer filled externally.
-/// This is used to pass matching lines to the next split and to support patterns with a negative offset.
-struct InputSplitter<I>
-where
-    I: Iterator<Item = (usize, io::Result<String>)>,
+/// An iterator which can output items from a buffer filled externally.
+/// This is used to pass matching lines to the next split and to support patterns with a negative offset.
+struct InputSplitter<I>
+where
+    I: Iterator<Item = (usize, io::Result<String>)>,
 {
-    iter: I,
-    buffer: Vec<<I as Iterator>::Item>,
-    /// the number of elements the buffer may hold
-    size: usize,
-    /// flag to indicate content off the buffer should be returned instead of off the wrapped
-    /// iterator
-    rewind: bool,
+    iter: I,
+    buffer: Vec<<I as Iterator>::Item>,
+    /// the number of elements the buffer may hold
+    size: usize,
+    /// flag to indicate content off the buffer should be returned instead of off the wrapped
+    /// iterator
+    rewind: bool,
 }
 
-impl<I> InputSplitter<I>
-where
-    I: Iterator<Item = (usize, io::Result<String>)>,
+impl<I> InputSplitter<I>
+where
+    I: Iterator<Item = (usize, io::Result<String>)>,
 {
-    fn new(iter: I) -> Self {
-        Self {
-            iter,
-            buffer: Vec::new(),
-            rewind: false,
-            size: 1,
+    fn new(iter: I) -> Self {
+        Self {
+            iter,
+            buffer: Vec::new(),
+            rewind: false,
+            size: 1,
         }
     }
 
-    /// Rewind the iteration by outputting the buffer's content.
-    fn rewind_buffer(&mut self) {
-        self.rewind = true;
+    /// Rewind the iteration by outputting the buffer's content.
+    fn rewind_buffer(&mut self) {
+        self.rewind = true;
     }
 
-    /// Shrink the buffer so that its length is equal to the set size, returning an iterator for
-    /// the elements that were too much.
-    fn shrink_buffer_to_size(&mut self) -> impl Iterator<Item = String> + '_ {
-        let shrink_offset = if self.buffer.len() > self.size {
-            self.buffer.len() - self.size
-        } else {
-            0
-        };
-        self.buffer
-            .drain(..shrink_offset)
-            .map(|(_, line)| line.unwrap())
+    /// Shrink the buffer so that its length is equal to the set size, returning an iterator for
+    /// the elements that were too much.
+    fn shrink_buffer_to_size(&mut self) -> impl Iterator<Item = String> + '_ {
+        let shrink_offset = if self.buffer.len() > self.size {
+            self.buffer.len() - self.size
+        } else {
+            0
+        };
+        self.buffer
+            .drain(..shrink_offset)
+            .map(|(_, line)| line.unwrap())
     }
 
-    /// Drain the content of the buffer.
-    fn drain_buffer(&mut self) -> impl Iterator<Item = String> + '_ {
-        self.buffer.drain(..).map(|(_, line)| line.unwrap())
+    /// Drain the content of the buffer.
+    fn drain_buffer(&mut self) -> impl Iterator<Item = String> + '_ {
+        self.buffer.drain(..).map(|(_, line)| line.unwrap())
     }
 
-    /// Set the maximum number of lines to keep.
-    fn set_size_of_buffer(&mut self, size: usize) {
-        self.size = size;
+    /// Set the maximum number of lines to keep.
+    fn set_size_of_buffer(&mut self, size: usize) {
+        self.size = size;
     }
 
-    /// Add a line to the buffer. If the buffer has [`self.size`] elements, then its head is removed and
-    /// the new line is pushed to the buffer. The removed head is then available in the returned
-    /// option.
-    fn add_line_to_buffer(&mut self, ln: usize, line: String) -> Option<String> {
-        if self.rewind {
-            self.buffer.insert(0, (ln, Ok(line)));
-            None
-        } else if self.buffer.len() >= self.size {
-            let (_, head_line) = self.buffer.remove(0);
-            self.buffer.push((ln, Ok(line)));
-            Some(head_line.unwrap())
-        } else {
-            self.buffer.push((ln, Ok(line)));
-            None
-        }
+    /// Add a line to the buffer. If the buffer has [`self.size`] elements, then its head is removed and
+    /// the new line is pushed to the buffer. The removed head is then available in the returned
+    /// option.
+    fn add_line_to_buffer(&mut self, ln: usize, line: String) -> Option<String> {
+        if self.rewind {
+            self.buffer.insert(0, (ln, Ok(line)));
+            None
+        } else if self.buffer.len() >= self.size {
+            let (_, head_line) = self.buffer.remove(0);
+            self.buffer.push((ln, Ok(line)));
+            Some(head_line.unwrap())
+        } else {
+            self.buffer.push((ln, Ok(line)));
+            None
+        }
     }
 
-    /// Returns the number of lines stored in the buffer
-    fn buffer_len(&self) -> usize {
-        self.buffer.len()
+    /// Returns the number of lines stored in the buffer
+    fn buffer_len(&self) -> usize {
+        self.buffer.len()
     }
 }
 
-impl<I> Iterator for InputSplitter<I>
-where
-    I: Iterator<Item = (usize, io::Result<String>)>,
+impl<I> Iterator for InputSplitter<I>
+where
+    I: Iterator<Item = (usize, io::Result<String>)>,
 {
-    type Item = <I as Iterator>::Item;
+    type Item = <I as Iterator>::Item;
 
-    fn next(&mut self) -> Option<Self::Item> {
-        if self.rewind {
-            if !self.buffer.is_empty() {
-                return Some(self.buffer.remove(0));
+    fn next(&mut self) -> Option<Self::Item> {
+        if self.rewind {
+            if !self.buffer.is_empty() {
+                return Some(self.buffer.remove(0));
             }
-            self.rewind = false;
+            self.rewind = false;
         }
-        self.iter.next()
+        self.iter.next()
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
+#[cfg(test)]
+mod tests {
+    use super::*;
 
-    #[test]
-    fn input_splitter() {
-        let input = vec![
-            Ok(String::from("aaa")),
-            Ok(String::from("bbb")),
-            Ok(String::from("ccc")),
-            Ok(String::from("ddd")),
+    #[test]
+    fn input_splitter() {
+        let input = vec![
+            Ok(String::from("aaa")),
+            Ok(String::from("bbb")),
+            Ok(String::from("ccc")),
+            Ok(String::from("ddd")),
         ];
-        let mut input_splitter = InputSplitter::new(input.into_iter().enumerate());
+        let mut input_splitter = InputSplitter::new(input.into_iter().enumerate());
 
-        input_splitter.set_size_of_buffer(2);
-        assert_eq!(input_splitter.buffer_len(), 0);
+        input_splitter.set_size_of_buffer(2);
+        assert_eq!(input_splitter.buffer_len(), 0);
 
-        match input_splitter.next() {
-            Some((0, Ok(line))) => {
-                assert_eq!(line, String::from("aaa"));
-                assert_eq!(input_splitter.add_line_to_buffer(0, line), None);
-                assert_eq!(input_splitter.buffer_len(), 1);
+        match input_splitter.next() {
+            Some((0, Ok(line))) => {
+                assert_eq!(line, String::from("aaa"));
+                assert_eq!(input_splitter.add_line_to_buffer(0, line), None);
+                assert_eq!(input_splitter.buffer_len(), 1);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((1, Ok(line))) => {
-                assert_eq!(line, String::from("bbb"));
-                assert_eq!(input_splitter.add_line_to_buffer(1, line), None);
-                assert_eq!(input_splitter.buffer_len(), 2);
+        match input_splitter.next() {
+            Some((1, Ok(line))) => {
+                assert_eq!(line, String::from("bbb"));
+                assert_eq!(input_splitter.add_line_to_buffer(1, line), None);
+                assert_eq!(input_splitter.buffer_len(), 2);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((2, Ok(line))) => {
-                assert_eq!(line, String::from("ccc"));
+        match input_splitter.next() {
+            Some((2, Ok(line))) => {
+                assert_eq!(line, String::from("ccc"));
                 assert_eq!(
-                    input_splitter.add_line_to_buffer(2, line),
-                    Some(String::from("aaa"))
+                    input_splitter.add_line_to_buffer(2, line),
+                    Some(String::from("aaa"))
                 );
-                assert_eq!(input_splitter.buffer_len(), 2);
+                assert_eq!(input_splitter.buffer_len(), 2);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        input_splitter.rewind_buffer();
+        input_splitter.rewind_buffer();
 
-        match input_splitter.next() {
-            Some((1, Ok(line))) => {
-                assert_eq!(line, String::from("bbb"));
-                assert_eq!(input_splitter.buffer_len(), 1);
+        match input_splitter.next() {
+            Some((1, Ok(line))) => {
+                assert_eq!(line, String::from("bbb"));
+                assert_eq!(input_splitter.buffer_len(), 1);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((2, Ok(line))) => {
-                assert_eq!(line, String::from("ccc"));
-                assert_eq!(input_splitter.buffer_len(), 0);
+        match input_splitter.next() {
+            Some((2, Ok(line))) => {
+                assert_eq!(line, String::from("ccc"));
+                assert_eq!(input_splitter.buffer_len(), 0);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((3, Ok(line))) => {
-                assert_eq!(line, String::from("ddd"));
-                assert_eq!(input_splitter.buffer_len(), 0);
+        match input_splitter.next() {
+            Some((3, Ok(line))) => {
+                assert_eq!(line, String::from("ddd"));
+                assert_eq!(input_splitter.buffer_len(), 0);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        assert!(input_splitter.next().is_none());
+        assert!(input_splitter.next().is_none());
     }
 
-    #[test]
-    fn input_splitter_interrupt_rewind() {
-        let input = vec![
-            Ok(String::from("aaa")),
-            Ok(String::from("bbb")),
-            Ok(String::from("ccc")),
-            Ok(String::from("ddd")),
+    #[test]
+    fn input_splitter_interrupt_rewind() {
+        let input = vec![
+            Ok(String::from("aaa")),
+            Ok(String::from("bbb")),
+            Ok(String::from("ccc")),
+            Ok(String::from("ddd")),
         ];
-        let mut input_splitter = InputSplitter::new(input.into_iter().enumerate());
+        let mut input_splitter = InputSplitter::new(input.into_iter().enumerate());
 
-        input_splitter.set_size_of_buffer(3);
-        assert_eq!(input_splitter.buffer_len(), 0);
+        input_splitter.set_size_of_buffer(3);
+        assert_eq!(input_splitter.buffer_len(), 0);
 
-        match input_splitter.next() {
-            Some((0, Ok(line))) => {
-                assert_eq!(line, String::from("aaa"));
-                assert_eq!(input_splitter.add_line_to_buffer(0, line), None);
-                assert_eq!(input_splitter.buffer_len(), 1);
+        match input_splitter.next() {
+            Some((0, Ok(line))) => {
+                assert_eq!(line, String::from("aaa"));
+                assert_eq!(input_splitter.add_line_to_buffer(0, line), None);
+                assert_eq!(input_splitter.buffer_len(), 1);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((1, Ok(line))) => {
-                assert_eq!(line, String::from("bbb"));
-                assert_eq!(input_splitter.add_line_to_buffer(1, line), None);
-                assert_eq!(input_splitter.buffer_len(), 2);
+        match input_splitter.next() {
+            Some((1, Ok(line))) => {
+                assert_eq!(line, String::from("bbb"));
+                assert_eq!(input_splitter.add_line_to_buffer(1, line), None);
+                assert_eq!(input_splitter.buffer_len(), 2);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((2, Ok(line))) => {
-                assert_eq!(line, String::from("ccc"));
-                assert_eq!(input_splitter.add_line_to_buffer(2, line), None);
-                assert_eq!(input_splitter.buffer_len(), 3);
+        match input_splitter.next() {
+            Some((2, Ok(line))) => {
+                assert_eq!(line, String::from("ccc"));
+                assert_eq!(input_splitter.add_line_to_buffer(2, line), None);
+                assert_eq!(input_splitter.buffer_len(), 3);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        input_splitter.rewind_buffer();
+        input_splitter.rewind_buffer();
 
-        match input_splitter.next() {
-            Some((0, Ok(line))) => {
-                assert_eq!(line, String::from("aaa"));
-                assert_eq!(input_splitter.add_line_to_buffer(0, line), None);
-                assert_eq!(input_splitter.buffer_len(), 3);
+        match input_splitter.next() {
+            Some((0, Ok(line))) => {
+                assert_eq!(line, String::from("aaa"));
+                assert_eq!(input_splitter.add_line_to_buffer(0, line), None);
+                assert_eq!(input_splitter.buffer_len(), 3);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((0, Ok(line))) => {
-                assert_eq!(line, String::from("aaa"));
-                assert_eq!(input_splitter.buffer_len(), 2);
+        match input_splitter.next() {
+            Some((0, Ok(line))) => {
+                assert_eq!(line, String::from("aaa"));
+                assert_eq!(input_splitter.buffer_len(), 2);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((1, Ok(line))) => {
-                assert_eq!(line, String::from("bbb"));
-                assert_eq!(input_splitter.buffer_len(), 1);
+        match input_splitter.next() {
+            Some((1, Ok(line))) => {
+                assert_eq!(line, String::from("bbb"));
+                assert_eq!(input_splitter.buffer_len(), 1);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((2, Ok(line))) => {
-                assert_eq!(line, String::from("ccc"));
-                assert_eq!(input_splitter.buffer_len(), 0);
+        match input_splitter.next() {
+            Some((2, Ok(line))) => {
+                assert_eq!(line, String::from("ccc"));
+                assert_eq!(input_splitter.buffer_len(), 0);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        match input_splitter.next() {
-            Some((3, Ok(line))) => {
-                assert_eq!(line, String::from("ddd"));
-                assert_eq!(input_splitter.buffer_len(), 0);
+        match input_splitter.next() {
+            Some((3, Ok(line))) => {
+                assert_eq!(line, String::from("ddd"));
+                assert_eq!(input_splitter.buffer_len(), 0);
             }
-            item => panic!("wrong item: {:?}", item),
+            item => panic!("wrong item: {:?}", item),
         };
 
-        assert!(input_splitter.next().is_none());
+        assert!(input_splitter.next().is_none());
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    // get the file to split
-    let file_name = matches.get_one::<String>(options::FILE).unwrap();
+    // get the file to split
+    let file_name = matches.get_one::<String>(options::FILE).unwrap();
 
-    // get the patterns to split on
-    let patterns: Vec<String> = matches
-        .get_many::<String>(options::PATTERN)
-        .unwrap()
-        .map(|s| s.to_string())
-        .collect();
-    let patterns = patterns::get_patterns(&patterns[..])?;
-    let options = CsplitOptions::new(&matches);
-    if file_name == "-" {
-        let stdin = io::stdin();
-        Ok(csplit(&options, patterns, stdin.lock())?)
-    } else {
-        let file = File::open(file_name)
-            .map_err_context(|| format!("cannot access {}", file_name.quote()))?;
-        let file_metadata = file
-            .metadata()
-            .map_err_context(|| format!("cannot access {}", file_name.quote()))?;
-        if !file_metadata.is_file() {
-            return Err(CsplitError::NotRegularFile(file_name.to_string()).into());
+    // get the patterns to split on
+    let patterns: Vec<String> = matches
+        .get_many::<String>(options::PATTERN)
+        .unwrap()
+        .map(|s| s.to_string())
+        .collect();
+    let patterns = patterns::get_patterns(&patterns[..])?;
+    let options = CsplitOptions::new(&matches);
+    if file_name == "-" {
+        let stdin = io::stdin();
+        Ok(csplit(&options, patterns, stdin.lock())?)
+    } else {
+        let file = File::open(file_name)
+            .map_err_context(|| format!("cannot access {}", file_name.quote()))?;
+        let file_metadata = file
+            .metadata()
+            .map_err_context(|| format!("cannot access {}", file_name.quote()))?;
+        if !file_metadata.is_file() {
+            return Err(CsplitError::NotRegularFile(file_name.to_string()).into());
         }
-        Ok(csplit(&options, patterns, BufReader::new(file))?)
+        Ok(csplit(&options, patterns, BufReader::new(file))?)
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::SUFFIX_FORMAT)
-                .short('b')
-                .long(options::SUFFIX_FORMAT)
-                .value_name("FORMAT")
-                .help("use sprintf FORMAT instead of %02d"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::SUFFIX_FORMAT)
+                .short('b')
+                .long(options::SUFFIX_FORMAT)
+                .value_name("FORMAT")
+                .help("use sprintf FORMAT instead of %02d"),
         )
-        .arg(
-            Arg::new(options::PREFIX)
-                .short('f')
-                .long(options::PREFIX)
-                .value_name("PREFIX")
-                .help("use PREFIX instead of 'xx'"),
+        .arg(
+            Arg::new(options::PREFIX)
+                .short('f')
+                .long(options::PREFIX)
+                .value_name("PREFIX")
+                .help("use PREFIX instead of 'xx'"),
         )
-        .arg(
-            Arg::new(options::KEEP_FILES)
-                .short('k')
-                .long(options::KEEP_FILES)
-                .help("do not remove output files on errors")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::KEEP_FILES)
+                .short('k')
+                .long(options::KEEP_FILES)
+                .help("do not remove output files on errors")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SUPPRESS_MATCHED)
-                .long(options::SUPPRESS_MATCHED)
-                .help("suppress the lines matching PATTERN")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SUPPRESS_MATCHED)
+                .long(options::SUPPRESS_MATCHED)
+                .help("suppress the lines matching PATTERN")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DIGITS)
-                .short('n')
-                .long(options::DIGITS)
-                .value_name("DIGITS")
-                .help("use specified number of digits instead of 2"),
+        .arg(
+            Arg::new(options::DIGITS)
+                .short('n')
+                .long(options::DIGITS)
+                .value_name("DIGITS")
+                .help("use specified number of digits instead of 2"),
         )
-        .arg(
-            Arg::new(options::QUIET)
-                .short('s')
-                .long(options::QUIET)
-                .visible_alias("silent")
-                .help("do not print counts of output file sizes")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::QUIET)
+                .short('s')
+                .long(options::QUIET)
+                .visible_alias("silent")
+                .help("do not print counts of output file sizes")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ELIDE_EMPTY_FILES)
-                .short('z')
-                .long(options::ELIDE_EMPTY_FILES)
-                .help("remove empty output files")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ELIDE_EMPTY_FILES)
+                .short('z')
+                .long(options::ELIDE_EMPTY_FILES)
+                .help("remove empty output files")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .required(true)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .required(true)
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::PATTERN)
-                .hide(true)
-                .action(clap::ArgAction::Append)
-                .required(true),
+        .arg(
+            Arg::new(options::PATTERN)
+                .hide(true)
+                .action(clap::ArgAction::Append)
+                .required(true),
         )
-        .after_help(LONG_HELP)
+        .after_help(LONG_HELP)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_csplit/csplit_error.rs.html b/dev/src/uu_csplit/csplit_error.rs.html index 2853ee912..858d8f5ee 100644 --- a/dev/src/uu_csplit/csplit_error.rs.html +++ b/dev/src/uu_csplit/csplit_error.rs.html @@ -1,4 +1,4 @@ -csplit_error.rs - source
1
+csplit_error.rs - source
1
 2
 3
 4
@@ -44,51 +44,51 @@
 44
 45
 46
-
use std::io;
-use thiserror::Error;
+
use std::io;
+use thiserror::Error;
 
-use uucore::display::Quotable;
-use uucore::error::UError;
+use uucore::display::Quotable;
+use uucore::error::UError;
 
-/// Errors thrown by the csplit command
-#[derive(Debug, Error)]
-pub enum CsplitError {
-    #[error("IO error: {}", _0)]
-    IoError(io::Error),
-    #[error("{}: line number out of range", ._0.quote())]
-    LineOutOfRange(String),
-    #[error("{}: line number out of range on repetition {}", ._0.quote(), _1)]
-    LineOutOfRangeOnRepetition(String, usize),
-    #[error("{}: match not found", ._0.quote())]
-    MatchNotFound(String),
-    #[error("{}: match not found on repetition {}", ._0.quote(), _1)]
-    MatchNotFoundOnRepetition(String, usize),
-    #[error("line number must be greater than zero")]
-    LineNumberIsZero,
-    #[error("line number '{}' is smaller than preceding line number, {}", _0, _1)]
-    LineNumberSmallerThanPrevious(usize, usize),
-    #[error("{}: invalid pattern", ._0.quote())]
-    InvalidPattern(String),
-    #[error("invalid number: {}", ._0.quote())]
-    InvalidNumber(String),
-    #[error("incorrect conversion specification in suffix")]
-    SuffixFormatIncorrect,
-    #[error("too many % conversion specifications in suffix")]
-    SuffixFormatTooManyPercents,
-    #[error("{} is not a regular file", ._0.quote())]
-    NotRegularFile(String),
+/// Errors thrown by the csplit command
+#[derive(Debug, Error)]
+pub enum CsplitError {
+    #[error("IO error: {}", _0)]
+    IoError(io::Error),
+    #[error("{}: line number out of range", ._0.quote())]
+    LineOutOfRange(String),
+    #[error("{}: line number out of range on repetition {}", ._0.quote(), _1)]
+    LineOutOfRangeOnRepetition(String, usize),
+    #[error("{}: match not found", ._0.quote())]
+    MatchNotFound(String),
+    #[error("{}: match not found on repetition {}", ._0.quote(), _1)]
+    MatchNotFoundOnRepetition(String, usize),
+    #[error("line number must be greater than zero")]
+    LineNumberIsZero,
+    #[error("line number '{}' is smaller than preceding line number, {}", _0, _1)]
+    LineNumberSmallerThanPrevious(usize, usize),
+    #[error("{}: invalid pattern", ._0.quote())]
+    InvalidPattern(String),
+    #[error("invalid number: {}", ._0.quote())]
+    InvalidNumber(String),
+    #[error("incorrect conversion specification in suffix")]
+    SuffixFormatIncorrect,
+    #[error("too many % conversion specifications in suffix")]
+    SuffixFormatTooManyPercents,
+    #[error("{} is not a regular file", ._0.quote())]
+    NotRegularFile(String),
 }
 
-impl From<io::Error> for CsplitError {
-    fn from(error: io::Error) -> Self {
-        Self::IoError(error)
+impl From<io::Error> for CsplitError {
+    fn from(error: io::Error) -> Self {
+        Self::IoError(error)
     }
 }
 
-impl UError for CsplitError {
-    fn code(&self) -> i32 {
-        1
-    }
+impl UError for CsplitError {
+    fn code(&self) -> i32 {
+        1
+    }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_csplit/patterns.rs.html b/dev/src/uu_csplit/patterns.rs.html index 4f596dcb1..406d41c44 100644 --- a/dev/src/uu_csplit/patterns.rs.html +++ b/dev/src/uu_csplit/patterns.rs.html @@ -1,4 +1,4 @@ -patterns.rs - source
1
+patterns.rs - source
1
 2
 3
 4
@@ -347,216 +347,216 @@
 347
 348
 349
-
// spell-checker:ignore (regex) SKIPTO UPTO ; (vars) ntimes
+
// spell-checker:ignore (regex) SKIPTO UPTO ; (vars) ntimes
 
-use crate::csplit_error::CsplitError;
-use regex::Regex;
+use crate::csplit_error::CsplitError;
+use regex::Regex;
 
-/// The definition of a pattern to match on a line.
-#[derive(Debug)]
-pub enum Pattern {
-    /// Copy the file's content to a split up to, not including, the given line number. The number
-    /// of times the pattern is executed is detailed in [`ExecutePattern`].
-    UpToLine(usize, ExecutePattern),
-    /// Copy the file's content to a split up to, not including, the line matching the regex. The
-    /// integer is an offset relative to the matched line of what to include (if positive) or
-    /// to exclude (if negative). The number of times the pattern is executed is detailed in
-    /// [`ExecutePattern`].
-    UpToMatch(Regex, i32, ExecutePattern),
-    /// Skip the file's content up to, not including, the line matching the regex. The integer
-    /// is an offset relative to the matched line of what to include (if positive) or to exclude
-    /// (if negative). The number of times the pattern is executed is detailed in [`ExecutePattern`].
-    SkipToMatch(Regex, i32, ExecutePattern),
+/// The definition of a pattern to match on a line.
+#[derive(Debug)]
+pub enum Pattern {
+    /// Copy the file's content to a split up to, not including, the given line number. The number
+    /// of times the pattern is executed is detailed in [`ExecutePattern`].
+    UpToLine(usize, ExecutePattern),
+    /// Copy the file's content to a split up to, not including, the line matching the regex. The
+    /// integer is an offset relative to the matched line of what to include (if positive) or
+    /// to exclude (if negative). The number of times the pattern is executed is detailed in
+    /// [`ExecutePattern`].
+    UpToMatch(Regex, i32, ExecutePattern),
+    /// Skip the file's content up to, not including, the line matching the regex. The integer
+    /// is an offset relative to the matched line of what to include (if positive) or to exclude
+    /// (if negative). The number of times the pattern is executed is detailed in [`ExecutePattern`].
+    SkipToMatch(Regex, i32, ExecutePattern),
 }
 
-impl ToString for Pattern {
-    fn to_string(&self) -> String {
-        match self {
-            Self::UpToLine(n, _) => n.to_string(),
-            Self::UpToMatch(regex, 0, _) => format!("/{}/", regex.as_str()),
-            Self::UpToMatch(regex, offset, _) => format!("/{}/{:+}", regex.as_str(), offset),
-            Self::SkipToMatch(regex, 0, _) => format!("%{}%", regex.as_str()),
-            Self::SkipToMatch(regex, offset, _) => format!("%{}%{:+}", regex.as_str(), offset),
+impl ToString for Pattern {
+    fn to_string(&self) -> String {
+        match self {
+            Self::UpToLine(n, _) => n.to_string(),
+            Self::UpToMatch(regex, 0, _) => format!("/{}/", regex.as_str()),
+            Self::UpToMatch(regex, offset, _) => format!("/{}/{:+}", regex.as_str(), offset),
+            Self::SkipToMatch(regex, 0, _) => format!("%{}%", regex.as_str()),
+            Self::SkipToMatch(regex, offset, _) => format!("%{}%{:+}", regex.as_str(), offset),
         }
     }
 }
 
-/// The number of times a pattern can be used.
-#[derive(Debug)]
-pub enum ExecutePattern {
-    /// Execute the pattern as many times as possible
-    Always,
-    /// Execute the pattern a fixed number of times
-    Times(usize),
+/// The number of times a pattern can be used.
+#[derive(Debug)]
+pub enum ExecutePattern {
+    /// Execute the pattern as many times as possible
+    Always,
+    /// Execute the pattern a fixed number of times
+    Times(usize),
 }
 
-impl ExecutePattern {
-    pub fn iter(&self) -> ExecutePatternIter {
-        match self {
-            Self::Times(n) => ExecutePatternIter::new(Some(*n)),
-            Self::Always => ExecutePatternIter::new(None),
+impl ExecutePattern {
+    pub fn iter(&self) -> ExecutePatternIter {
+        match self {
+            Self::Times(n) => ExecutePatternIter::new(Some(*n)),
+            Self::Always => ExecutePatternIter::new(None),
         }
     }
 }
 
-pub struct ExecutePatternIter {
-    max: Option<usize>,
-    cur: usize,
+pub struct ExecutePatternIter {
+    max: Option<usize>,
+    cur: usize,
 }
 
-impl ExecutePatternIter {
-    fn new(max: Option<usize>) -> Self {
-        Self { max, cur: 0 }
+impl ExecutePatternIter {
+    fn new(max: Option<usize>) -> Self {
+        Self { max, cur: 0 }
     }
 }
 
-impl Iterator for ExecutePatternIter {
-    type Item = (Option<usize>, usize);
+impl Iterator for ExecutePatternIter {
+    type Item = (Option<usize>, usize);
 
-    fn next(&mut self) -> Option<(Option<usize>, usize)> {
-        match self.max {
-            // iterate until m is reached
-            Some(m) => {
-                if self.cur == m {
-                    None
-                } else {
-                    self.cur += 1;
-                    Some((self.max, self.cur))
+    fn next(&mut self) -> Option<(Option<usize>, usize)> {
+        match self.max {
+            // iterate until m is reached
+            Some(m) => {
+                if self.cur == m {
+                    None
+                } else {
+                    self.cur += 1;
+                    Some((self.max, self.cur))
                 }
             }
-            // no limit, just increment a counter
-            None => {
-                self.cur += 1;
-                Some((None, self.cur))
+            // no limit, just increment a counter
+            None => {
+                self.cur += 1;
+                Some((None, self.cur))
             }
         }
     }
 }
 
-/// Parses the definitions of patterns given on the command line into a list of [`Pattern`]s.
-///
-/// # Errors
-///
-/// If a pattern is incorrect, a [`CsplitError::InvalidPattern`] error is returned, which may be
-/// due to, e.g.,:
-/// - an invalid regular expression;
-/// - an invalid number for, e.g., the offset.
-pub fn get_patterns(args: &[String]) -> Result<Vec<Pattern>, CsplitError> {
-    let patterns = extract_patterns(args)?;
-    validate_line_numbers(&patterns)?;
-    Ok(patterns)
+/// Parses the definitions of patterns given on the command line into a list of [`Pattern`]s.
+///
+/// # Errors
+///
+/// If a pattern is incorrect, a [`CsplitError::InvalidPattern`] error is returned, which may be
+/// due to, e.g.,:
+/// - an invalid regular expression;
+/// - an invalid number for, e.g., the offset.
+pub fn get_patterns(args: &[String]) -> Result<Vec<Pattern>, CsplitError> {
+    let patterns = extract_patterns(args)?;
+    validate_line_numbers(&patterns)?;
+    Ok(patterns)
 }
 
-fn extract_patterns(args: &[String]) -> Result<Vec<Pattern>, CsplitError> {
-    let mut patterns = Vec::with_capacity(args.len());
-    let to_match_reg =
-        Regex::new(r"^(/(?P<UPTO>.+)/|%(?P<SKIPTO>.+)%)(?P<OFFSET>[\+-]\d+)?$").unwrap();
-    let execute_ntimes_reg = Regex::new(r"^\{(?P<TIMES>\d+)|\*\}$").unwrap();
-    let mut iter = args.iter().peekable();
+fn extract_patterns(args: &[String]) -> Result<Vec<Pattern>, CsplitError> {
+    let mut patterns = Vec::with_capacity(args.len());
+    let to_match_reg =
+        Regex::new(r"^(/(?P<UPTO>.+)/|%(?P<SKIPTO>.+)%)(?P<OFFSET>[\+-]\d+)?$").unwrap();
+    let execute_ntimes_reg = Regex::new(r"^\{(?P<TIMES>\d+)|\*\}$").unwrap();
+    let mut iter = args.iter().peekable();
 
-    while let Some(arg) = iter.next() {
-        // get the number of times a pattern is repeated, which is at least once plus whatever is
-        // in the quantifier.
-        let execute_ntimes = match iter.peek() {
-            None => ExecutePattern::Times(1),
-            Some(&next_item) => {
-                match execute_ntimes_reg.captures(next_item) {
-                    None => ExecutePattern::Times(1),
-                    Some(r) => {
-                        // skip the next item
-                        iter.next();
-                        if let Some(times) = r.name("TIMES") {
-                            ExecutePattern::Times(times.as_str().parse::<usize>().unwrap() + 1)
-                        } else {
-                            ExecutePattern::Always
+    while let Some(arg) = iter.next() {
+        // get the number of times a pattern is repeated, which is at least once plus whatever is
+        // in the quantifier.
+        let execute_ntimes = match iter.peek() {
+            None => ExecutePattern::Times(1),
+            Some(&next_item) => {
+                match execute_ntimes_reg.captures(next_item) {
+                    None => ExecutePattern::Times(1),
+                    Some(r) => {
+                        // skip the next item
+                        iter.next();
+                        if let Some(times) = r.name("TIMES") {
+                            ExecutePattern::Times(times.as_str().parse::<usize>().unwrap() + 1)
+                        } else {
+                            ExecutePattern::Always
                         }
                     }
                 }
             }
         };
 
-        // get the pattern definition
-        if let Some(captures) = to_match_reg.captures(arg) {
-            let offset = match captures.name("OFFSET") {
-                None => 0,
-                Some(m) => m.as_str().parse().unwrap(),
+        // get the pattern definition
+        if let Some(captures) = to_match_reg.captures(arg) {
+            let offset = match captures.name("OFFSET") {
+                None => 0,
+                Some(m) => m.as_str().parse().unwrap(),
             };
-            if let Some(up_to_match) = captures.name("UPTO") {
-                let pattern = Regex::new(up_to_match.as_str())
-                    .map_err(|_| CsplitError::InvalidPattern(arg.to_string()))?;
-                patterns.push(Pattern::UpToMatch(pattern, offset, execute_ntimes));
-            } else if let Some(skip_to_match) = captures.name("SKIPTO") {
-                let pattern = Regex::new(skip_to_match.as_str())
-                    .map_err(|_| CsplitError::InvalidPattern(arg.to_string()))?;
-                patterns.push(Pattern::SkipToMatch(pattern, offset, execute_ntimes));
+            if let Some(up_to_match) = captures.name("UPTO") {
+                let pattern = Regex::new(up_to_match.as_str())
+                    .map_err(|_| CsplitError::InvalidPattern(arg.to_string()))?;
+                patterns.push(Pattern::UpToMatch(pattern, offset, execute_ntimes));
+            } else if let Some(skip_to_match) = captures.name("SKIPTO") {
+                let pattern = Regex::new(skip_to_match.as_str())
+                    .map_err(|_| CsplitError::InvalidPattern(arg.to_string()))?;
+                patterns.push(Pattern::SkipToMatch(pattern, offset, execute_ntimes));
             }
-        } else if let Ok(line_number) = arg.parse::<usize>() {
-            patterns.push(Pattern::UpToLine(line_number, execute_ntimes));
-        } else {
-            return Err(CsplitError::InvalidPattern(arg.to_string()));
+        } else if let Ok(line_number) = arg.parse::<usize>() {
+            patterns.push(Pattern::UpToLine(line_number, execute_ntimes));
+        } else {
+            return Err(CsplitError::InvalidPattern(arg.to_string()));
         }
     }
-    Ok(patterns)
+    Ok(patterns)
 }
 
-/// Asserts the line numbers are in increasing order, starting at 1.
-fn validate_line_numbers(patterns: &[Pattern]) -> Result<(), CsplitError> {
-    patterns
-        .iter()
-        .filter_map(|pattern| match pattern {
-            Pattern::UpToLine(line_number, _) => Some(line_number),
-            _ => None,
+/// Asserts the line numbers are in increasing order, starting at 1.
+fn validate_line_numbers(patterns: &[Pattern]) -> Result<(), CsplitError> {
+    patterns
+        .iter()
+        .filter_map(|pattern| match pattern {
+            Pattern::UpToLine(line_number, _) => Some(line_number),
+            _ => None,
         })
-        .try_fold(0, |prev_ln, &current_ln| match (prev_ln, current_ln) {
-            // a line number cannot be zero
-            (_, 0) => Err(CsplitError::LineNumberIsZero),
-            // two consecutive numbers should not be equal
-            (n, m) if n == m => {
-                show_warning!("line number '{}' is the same as preceding line number", n);
-                Ok(n)
+        .try_fold(0, |prev_ln, &current_ln| match (prev_ln, current_ln) {
+            // a line number cannot be zero
+            (_, 0) => Err(CsplitError::LineNumberIsZero),
+            // two consecutive numbers should not be equal
+            (n, m) if n == m => {
+                show_warning!("line number '{}' is the same as preceding line number", n);
+                Ok(n)
             }
-            // a number cannot be greater than the one that follows
-            (n, m) if n > m => Err(CsplitError::LineNumberSmallerThanPrevious(m, n)),
-            (_, m) => Ok(m),
+            // a number cannot be greater than the one that follows
+            (n, m) if n > m => Err(CsplitError::LineNumberSmallerThanPrevious(m, n)),
+            (_, m) => Ok(m),
         })?;
     Ok(())
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
+#[cfg(test)]
+mod tests {
+    use super::*;
 
-    #[test]
-    fn bad_pattern() {
-        let input = vec!["bad".to_string()];
-        assert!(get_patterns(input.as_slice()).is_err());
+    #[test]
+    fn bad_pattern() {
+        let input = vec!["bad".to_string()];
+        assert!(get_patterns(input.as_slice()).is_err());
     }
 
-    #[test]
-    fn up_to_line_pattern() {
-        let input: Vec<String> = vec!["24", "42", "{*}", "50", "{4}"]
-            .into_iter()
-            .map(|v| v.to_string())
-            .collect();
-        let patterns = get_patterns(input.as_slice()).unwrap();
-        assert_eq!(patterns.len(), 3);
-        match patterns.get(0) {
-            Some(Pattern::UpToLine(24, ExecutePattern::Times(1))) => (),
-            _ => panic!("expected UpToLine pattern"),
+    #[test]
+    fn up_to_line_pattern() {
+        let input: Vec<String> = vec!["24", "42", "{*}", "50", "{4}"]
+            .into_iter()
+            .map(|v| v.to_string())
+            .collect();
+        let patterns = get_patterns(input.as_slice()).unwrap();
+        assert_eq!(patterns.len(), 3);
+        match patterns.get(0) {
+            Some(Pattern::UpToLine(24, ExecutePattern::Times(1))) => (),
+            _ => panic!("expected UpToLine pattern"),
         };
-        match patterns.get(1) {
-            Some(Pattern::UpToLine(42, ExecutePattern::Always)) => (),
-            _ => panic!("expected UpToLine pattern"),
+        match patterns.get(1) {
+            Some(Pattern::UpToLine(42, ExecutePattern::Always)) => (),
+            _ => panic!("expected UpToLine pattern"),
         };
-        match patterns.get(2) {
-            Some(Pattern::UpToLine(50, ExecutePattern::Times(5))) => (),
-            _ => panic!("expected UpToLine pattern"),
+        match patterns.get(2) {
+            Some(Pattern::UpToLine(50, ExecutePattern::Times(5))) => (),
+            _ => panic!("expected UpToLine pattern"),
         };
     }
 
-    #[test]
-    fn up_to_match_pattern() {
-        let input: Vec<String> = vec![
+    #[test]
+    fn up_to_match_pattern() {
+        let input: Vec<String> = vec![
             "/test1.*end$/",
             "/test2.*end$/",
             "{*}",
@@ -565,51 +565,51 @@
             "/test4.*end$/+3",
             "/test5.*end$/-3",
         ]
-        .into_iter()
-        .map(|v| v.to_string())
-        .collect();
-        let patterns = get_patterns(input.as_slice()).unwrap();
-        assert_eq!(patterns.len(), 5);
-        match patterns.get(0) {
-            Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Times(1))) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test1.*end$");
+        .into_iter()
+        .map(|v| v.to_string())
+        .collect();
+        let patterns = get_patterns(input.as_slice()).unwrap();
+        assert_eq!(patterns.len(), 5);
+        match patterns.get(0) {
+            Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Times(1))) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test1.*end$");
             }
-            _ => panic!("expected UpToMatch pattern"),
+            _ => panic!("expected UpToMatch pattern"),
         };
-        match patterns.get(1) {
-            Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Always)) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test2.*end$");
+        match patterns.get(1) {
+            Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Always)) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test2.*end$");
             }
-            _ => panic!("expected UpToMatch pattern"),
+            _ => panic!("expected UpToMatch pattern"),
         };
-        match patterns.get(2) {
-            Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Times(5))) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test3.*end$");
+        match patterns.get(2) {
+            Some(Pattern::UpToMatch(reg, 0, ExecutePattern::Times(5))) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test3.*end$");
             }
-            _ => panic!("expected UpToMatch pattern"),
+            _ => panic!("expected UpToMatch pattern"),
         };
-        match patterns.get(3) {
-            Some(Pattern::UpToMatch(reg, 3, ExecutePattern::Times(1))) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test4.*end$");
+        match patterns.get(3) {
+            Some(Pattern::UpToMatch(reg, 3, ExecutePattern::Times(1))) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test4.*end$");
             }
-            _ => panic!("expected UpToMatch pattern"),
+            _ => panic!("expected UpToMatch pattern"),
         };
-        match patterns.get(4) {
-            Some(Pattern::UpToMatch(reg, -3, ExecutePattern::Times(1))) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test5.*end$");
+        match patterns.get(4) {
+            Some(Pattern::UpToMatch(reg, -3, ExecutePattern::Times(1))) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test5.*end$");
             }
-            _ => panic!("expected UpToMatch pattern"),
+            _ => panic!("expected UpToMatch pattern"),
         };
     }
 
-    #[test]
-    fn skip_to_match_pattern() {
-        let input: Vec<String> = vec![
+    #[test]
+    fn skip_to_match_pattern() {
+        let input: Vec<String> = vec![
             "%test1.*end$%",
             "%test2.*end$%",
             "{*}",
@@ -618,83 +618,83 @@
             "%test4.*end$%+3",
             "%test5.*end$%-3",
         ]
-        .into_iter()
-        .map(|v| v.to_string())
-        .collect();
-        let patterns = get_patterns(input.as_slice()).unwrap();
-        assert_eq!(patterns.len(), 5);
-        match patterns.get(0) {
-            Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Times(1))) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test1.*end$");
+        .into_iter()
+        .map(|v| v.to_string())
+        .collect();
+        let patterns = get_patterns(input.as_slice()).unwrap();
+        assert_eq!(patterns.len(), 5);
+        match patterns.get(0) {
+            Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Times(1))) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test1.*end$");
             }
-            _ => panic!("expected SkipToMatch pattern"),
+            _ => panic!("expected SkipToMatch pattern"),
         };
-        match patterns.get(1) {
-            Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Always)) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test2.*end$");
+        match patterns.get(1) {
+            Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Always)) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test2.*end$");
             }
-            _ => panic!("expected SkipToMatch pattern"),
+            _ => panic!("expected SkipToMatch pattern"),
         };
-        match patterns.get(2) {
-            Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Times(5))) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test3.*end$");
+        match patterns.get(2) {
+            Some(Pattern::SkipToMatch(reg, 0, ExecutePattern::Times(5))) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test3.*end$");
             }
-            _ => panic!("expected SkipToMatch pattern"),
+            _ => panic!("expected SkipToMatch pattern"),
         };
-        match patterns.get(3) {
-            Some(Pattern::SkipToMatch(reg, 3, ExecutePattern::Times(1))) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test4.*end$");
+        match patterns.get(3) {
+            Some(Pattern::SkipToMatch(reg, 3, ExecutePattern::Times(1))) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test4.*end$");
             }
-            _ => panic!("expected SkipToMatch pattern"),
+            _ => panic!("expected SkipToMatch pattern"),
         };
-        match patterns.get(4) {
-            Some(Pattern::SkipToMatch(reg, -3, ExecutePattern::Times(1))) => {
-                let parsed_reg = format!("{}", reg);
-                assert_eq!(parsed_reg, "test5.*end$");
+        match patterns.get(4) {
+            Some(Pattern::SkipToMatch(reg, -3, ExecutePattern::Times(1))) => {
+                let parsed_reg = format!("{}", reg);
+                assert_eq!(parsed_reg, "test5.*end$");
             }
-            _ => panic!("expected SkipToMatch pattern"),
+            _ => panic!("expected SkipToMatch pattern"),
         };
     }
 
-    #[test]
-    fn line_number_zero() {
-        let patterns = vec![Pattern::UpToLine(0, ExecutePattern::Times(1))];
-        match validate_line_numbers(&patterns) {
-            Err(CsplitError::LineNumberIsZero) => (),
-            _ => panic!("expected LineNumberIsZero error"),
+    #[test]
+    fn line_number_zero() {
+        let patterns = vec![Pattern::UpToLine(0, ExecutePattern::Times(1))];
+        match validate_line_numbers(&patterns) {
+            Err(CsplitError::LineNumberIsZero) => (),
+            _ => panic!("expected LineNumberIsZero error"),
         }
     }
 
-    #[test]
-    fn line_number_smaller_than_previous() {
-        let input: Vec<String> = vec!["10".to_string(), "5".to_string()];
-        match get_patterns(input.as_slice()) {
-            Err(CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (),
-            _ => panic!("expected LineNumberSmallerThanPrevious error"),
+    #[test]
+    fn line_number_smaller_than_previous() {
+        let input: Vec<String> = vec!["10".to_string(), "5".to_string()];
+        match get_patterns(input.as_slice()) {
+            Err(CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (),
+            _ => panic!("expected LineNumberSmallerThanPrevious error"),
         }
     }
 
-    #[test]
-    fn line_number_smaller_than_previous_separate() {
-        let input: Vec<String> = vec!["10".to_string(), "/20/".to_string(), "5".to_string()];
-        match get_patterns(input.as_slice()) {
-            Err(CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (),
-            _ => panic!("expected LineNumberSmallerThanPrevious error"),
+    #[test]
+    fn line_number_smaller_than_previous_separate() {
+        let input: Vec<String> = vec!["10".to_string(), "/20/".to_string(), "5".to_string()];
+        match get_patterns(input.as_slice()) {
+            Err(CsplitError::LineNumberSmallerThanPrevious(5, 10)) => (),
+            _ => panic!("expected LineNumberSmallerThanPrevious error"),
         }
     }
 
-    #[test]
-    fn line_number_zero_separate() {
-        let input: Vec<String> = vec!["10".to_string(), "/20/".to_string(), "0".to_string()];
-        match get_patterns(input.as_slice()) {
-            Err(CsplitError::LineNumberIsZero) => (),
-            _ => panic!("expected LineNumberIsZero error"),
+    #[test]
+    fn line_number_zero_separate() {
+        let input: Vec<String> = vec!["10".to_string(), "/20/".to_string(), "0".to_string()];
+        match get_patterns(input.as_slice()) {
+            Err(CsplitError::LineNumberIsZero) => (),
+            _ => panic!("expected LineNumberIsZero error"),
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_csplit/split_name.rs.html b/dev/src/uu_csplit/split_name.rs.html index 1c8db8386..27ef81a73 100644 --- a/dev/src/uu_csplit/split_name.rs.html +++ b/dev/src/uu_csplit/split_name.rs.html @@ -1,4 +1,4 @@ -split_name.rs - source
1
+split_name.rs - source
1
 2
 3
 4
@@ -418,425 +418,425 @@
 418
 419
 420
-
// spell-checker:ignore (regex) diuox
+
// spell-checker:ignore (regex) diuox
 
-use regex::Regex;
+use regex::Regex;
 
-use crate::csplit_error::CsplitError;
+use crate::csplit_error::CsplitError;
 
-/// Computes the filename of a split, taking into consideration a possible user-defined suffix
-/// format.
-pub struct SplitName {
-    fn_split_name: Box<dyn Fn(usize) -> String>,
+/// Computes the filename of a split, taking into consideration a possible user-defined suffix
+/// format.
+pub struct SplitName {
+    fn_split_name: Box<dyn Fn(usize) -> String>,
 }
 
-impl SplitName {
-    /// Creates a new SplitName with the given user-defined options:
-    /// - `prefix_opt` specifies a prefix for all splits.
-    /// - `format_opt` specifies a custom format for the suffix part of the filename, using the
-    /// `sprintf` format notation.
-    /// - `n_digits_opt` defines the width of the split number.
-    ///
-    /// # Caveats
-    ///
-    /// If `prefix_opt` and `format_opt` are defined, and the `format_opt` has some string appearing
-    /// before the conversion pattern (e.g., "here-%05d"), then it is appended to the passed prefix
-    /// via `prefix_opt`.
-    ///
-    /// If `n_digits_opt` and `format_opt` are defined, then width defined in `format_opt` is
-    /// taken.
-    pub fn new(
-        prefix_opt: Option<String>,
-        format_opt: Option<String>,
-        n_digits_opt: Option<String>,
-    ) -> Result<Self, CsplitError> {
-        // get the prefix
-        let prefix = prefix_opt.unwrap_or_else(|| "xx".to_string());
-        // the width for the split offset
-        let n_digits = n_digits_opt
-            .map(|opt| {
-                opt.parse::<usize>()
-                    .map_err(|_| CsplitError::InvalidNumber(opt))
+impl SplitName {
+    /// Creates a new SplitName with the given user-defined options:
+    /// - `prefix_opt` specifies a prefix for all splits.
+    /// - `format_opt` specifies a custom format for the suffix part of the filename, using the
+    /// `sprintf` format notation.
+    /// - `n_digits_opt` defines the width of the split number.
+    ///
+    /// # Caveats
+    ///
+    /// If `prefix_opt` and `format_opt` are defined, and the `format_opt` has some string appearing
+    /// before the conversion pattern (e.g., "here-%05d"), then it is appended to the passed prefix
+    /// via `prefix_opt`.
+    ///
+    /// If `n_digits_opt` and `format_opt` are defined, then width defined in `format_opt` is
+    /// taken.
+    pub fn new(
+        prefix_opt: Option<String>,
+        format_opt: Option<String>,
+        n_digits_opt: Option<String>,
+    ) -> Result<Self, CsplitError> {
+        // get the prefix
+        let prefix = prefix_opt.unwrap_or_else(|| "xx".to_string());
+        // the width for the split offset
+        let n_digits = n_digits_opt
+            .map(|opt| {
+                opt.parse::<usize>()
+                    .map_err(|_| CsplitError::InvalidNumber(opt))
             })
-            .transpose()?
-            .unwrap_or(2);
-        // translate the custom format into a function
-        let fn_split_name: Box<dyn Fn(usize) -> String> = match format_opt {
-            None => Box::new(move |n: usize| -> String {
-                format!("{}{:0width$}", prefix, n, width = n_digits)
+            .transpose()?
+            .unwrap_or(2);
+        // translate the custom format into a function
+        let fn_split_name: Box<dyn Fn(usize) -> String> = match format_opt {
+            None => Box::new(move |n: usize| -> String {
+                format!("{}{:0width$}", prefix, n, width = n_digits)
             }),
-            Some(custom) => {
-                let spec =
-                    Regex::new(r"(?P<ALL>%((?P<FLAG>[0#-])(?P<WIDTH>\d+)?)?(?P<TYPE>[diuoxX]))")
-                        .unwrap();
-                let mut captures_iter = spec.captures_iter(&custom);
-                let custom_fn: Box<dyn Fn(usize) -> String> = match captures_iter.next() {
-                    Some(captures) => {
-                        let all = captures.name("ALL").unwrap();
-                        let before = custom[0..all.start()].to_owned();
-                        let after = custom[all.end()..].to_owned();
-                        let n_digits = match captures.name("WIDTH") {
-                            None => 0,
-                            Some(m) => m.as_str().parse::<usize>().unwrap(),
+            Some(custom) => {
+                let spec =
+                    Regex::new(r"(?P<ALL>%((?P<FLAG>[0#-])(?P<WIDTH>\d+)?)?(?P<TYPE>[diuoxX]))")
+                        .unwrap();
+                let mut captures_iter = spec.captures_iter(&custom);
+                let custom_fn: Box<dyn Fn(usize) -> String> = match captures_iter.next() {
+                    Some(captures) => {
+                        let all = captures.name("ALL").unwrap();
+                        let before = custom[0..all.start()].to_owned();
+                        let after = custom[all.end()..].to_owned();
+                        let n_digits = match captures.name("WIDTH") {
+                            None => 0,
+                            Some(m) => m.as_str().parse::<usize>().unwrap(),
                         };
-                        match (captures.name("FLAG"), captures.name("TYPE")) {
-                            (None, Some(ref t)) => match t.as_str() {
-                                "d" | "i" | "u" => Box::new(move |n: usize| -> String {
-                                    format!("{}{}{}{}", prefix, before, n, after)
+                        match (captures.name("FLAG"), captures.name("TYPE")) {
+                            (None, Some(ref t)) => match t.as_str() {
+                                "d" | "i" | "u" => Box::new(move |n: usize| -> String {
+                                    format!("{}{}{}{}", prefix, before, n, after)
                                 }),
-                                "o" => Box::new(move |n: usize| -> String {
-                                    format!("{}{}{:o}{}", prefix, before, n, after)
+                                "o" => Box::new(move |n: usize| -> String {
+                                    format!("{}{}{:o}{}", prefix, before, n, after)
                                 }),
-                                "x" => Box::new(move |n: usize| -> String {
-                                    format!("{}{}{:x}{}", prefix, before, n, after)
+                                "x" => Box::new(move |n: usize| -> String {
+                                    format!("{}{}{:x}{}", prefix, before, n, after)
                                 }),
-                                "X" => Box::new(move |n: usize| -> String {
-                                    format!("{}{}{:X}{}", prefix, before, n, after)
+                                "X" => Box::new(move |n: usize| -> String {
+                                    format!("{}{}{:X}{}", prefix, before, n, after)
                                 }),
-                                _ => return Err(CsplitError::SuffixFormatIncorrect),
+                                _ => return Err(CsplitError::SuffixFormatIncorrect),
                             },
-                            (Some(ref f), Some(ref t)) => {
-                                match (f.as_str(), t.as_str()) {
+                            (Some(ref f), Some(ref t)) => {
+                                match (f.as_str(), t.as_str()) {
                                     /*
                                      * zero padding
-                                     */
-                                    // decimal
-                                    ("0", "d") | ("0", "i") | ("0", "u") => {
-                                        Box::new(move |n: usize| -> String {
+                                     */
+                                    // decimal
+                                    ("0", "d") | ("0", "i") | ("0", "u") => {
+                                        Box::new(move |n: usize| -> String {
                                             format!(
                                                 "{}{}{:0width$}{}",
-                                                prefix,
-                                                before,
-                                                n,
-                                                after,
-                                                width = n_digits
+                                                prefix,
+                                                before,
+                                                n,
+                                                after,
+                                                width = n_digits
                                             )
                                         })
                                     }
-                                    // octal
-                                    ("0", "o") => Box::new(move |n: usize| -> String {
+                                    // octal
+                                    ("0", "o") => Box::new(move |n: usize| -> String {
                                         format!(
                                             "{}{}{:0width$o}{}",
-                                            prefix,
-                                            before,
-                                            n,
-                                            after,
-                                            width = n_digits
+                                            prefix,
+                                            before,
+                                            n,
+                                            after,
+                                            width = n_digits
                                         )
                                     }),
-                                    // lower hexadecimal
-                                    ("0", "x") => Box::new(move |n: usize| -> String {
+                                    // lower hexadecimal
+                                    ("0", "x") => Box::new(move |n: usize| -> String {
                                         format!(
                                             "{}{}{:0width$x}{}",
-                                            prefix,
-                                            before,
-                                            n,
-                                            after,
-                                            width = n_digits
+                                            prefix,
+                                            before,
+                                            n,
+                                            after,
+                                            width = n_digits
                                         )
                                     }),
-                                    // upper hexadecimal
-                                    ("0", "X") => Box::new(move |n: usize| -> String {
+                                    // upper hexadecimal
+                                    ("0", "X") => Box::new(move |n: usize| -> String {
                                         format!(
                                             "{}{}{:0width$X}{}",
-                                            prefix,
-                                            before,
-                                            n,
-                                            after,
-                                            width = n_digits
+                                            prefix,
+                                            before,
+                                            n,
+                                            after,
+                                            width = n_digits
                                         )
                                     }),
 
                                     /*
                                      * Alternate form
-                                     */
-                                    // octal
-                                    ("#", "o") => Box::new(move |n: usize| -> String {
+                                     */
+                                    // octal
+                                    ("#", "o") => Box::new(move |n: usize| -> String {
                                         format!(
                                             "{}{}{:>#width$o}{}",
-                                            prefix,
-                                            before,
-                                            n,
-                                            after,
-                                            width = n_digits
+                                            prefix,
+                                            before,
+                                            n,
+                                            after,
+                                            width = n_digits
                                         )
                                     }),
-                                    // lower hexadecimal
-                                    ("#", "x") => Box::new(move |n: usize| -> String {
+                                    // lower hexadecimal
+                                    ("#", "x") => Box::new(move |n: usize| -> String {
                                         format!(
                                             "{}{}{:>#width$x}{}",
-                                            prefix,
-                                            before,
-                                            n,
-                                            after,
-                                            width = n_digits
+                                            prefix,
+                                            before,
+                                            n,
+                                            after,
+                                            width = n_digits
                                         )
                                     }),
-                                    // upper hexadecimal
-                                    ("#", "X") => Box::new(move |n: usize| -> String {
+                                    // upper hexadecimal
+                                    ("#", "X") => Box::new(move |n: usize| -> String {
                                         format!(
                                             "{}{}{:>#width$X}{}",
-                                            prefix,
-                                            before,
-                                            n,
-                                            after,
-                                            width = n_digits
+                                            prefix,
+                                            before,
+                                            n,
+                                            after,
+                                            width = n_digits
                                         )
                                     }),
 
                                     /*
                                      * Left adjusted
-                                     */
-                                    // decimal
-                                    ("-", "d") | ("-", "i") | ("-", "u") => {
-                                        Box::new(move |n: usize| -> String {
+                                     */
+                                    // decimal
+                                    ("-", "d") | ("-", "i") | ("-", "u") => {
+                                        Box::new(move |n: usize| -> String {
                                             format!(
                                                 "{}{}{:<#width$}{}",
-                                                prefix,
-                                                before,
-                                                n,
-                                                after,
-                                                width = n_digits
+                                                prefix,
+                                                before,
+                                                n,
+                                                after,
+                                                width = n_digits
                                             )
                                         })
                                     }
-                                    // octal
-                                    ("-", "o") => Box::new(move |n: usize| -> String {
+                                    // octal
+                                    ("-", "o") => Box::new(move |n: usize| -> String {
                                         format!(
                                             "{}{}{:<#width$o}{}",
-                                            prefix,
-                                            before,
-                                            n,
-                                            after,
-                                            width = n_digits
+                                            prefix,
+                                            before,
+                                            n,
+                                            after,
+                                            width = n_digits
                                         )
                                     }),
-                                    // lower hexadecimal
-                                    ("-", "x") => Box::new(move |n: usize| -> String {
+                                    // lower hexadecimal
+                                    ("-", "x") => Box::new(move |n: usize| -> String {
                                         format!(
                                             "{}{}{:<#width$x}{}",
-                                            prefix,
-                                            before,
-                                            n,
-                                            after,
-                                            width = n_digits
+                                            prefix,
+                                            before,
+                                            n,
+                                            after,
+                                            width = n_digits
                                         )
                                     }),
-                                    // upper hexadecimal
-                                    ("-", "X") => Box::new(move |n: usize| -> String {
+                                    // upper hexadecimal
+                                    ("-", "X") => Box::new(move |n: usize| -> String {
                                         format!(
                                             "{}{}{:<#width$X}{}",
-                                            prefix,
-                                            before,
-                                            n,
-                                            after,
-                                            width = n_digits
+                                            prefix,
+                                            before,
+                                            n,
+                                            after,
+                                            width = n_digits
                                         )
                                     }),
 
-                                    _ => return Err(CsplitError::SuffixFormatIncorrect),
+                                    _ => return Err(CsplitError::SuffixFormatIncorrect),
                                 }
                             }
-                            _ => return Err(CsplitError::SuffixFormatIncorrect),
+                            _ => return Err(CsplitError::SuffixFormatIncorrect),
                         }
                     }
-                    None => return Err(CsplitError::SuffixFormatIncorrect),
+                    None => return Err(CsplitError::SuffixFormatIncorrect),
                 };
 
-                // there cannot be more than one format pattern
-                if captures_iter.next().is_some() {
-                    return Err(CsplitError::SuffixFormatTooManyPercents);
+                // there cannot be more than one format pattern
+                if captures_iter.next().is_some() {
+                    return Err(CsplitError::SuffixFormatTooManyPercents);
                 }
-                custom_fn
+                custom_fn
             }
         };
 
-        Ok(Self { fn_split_name })
+        Ok(Self { fn_split_name })
     }
 
-    /// Returns the filename of the i-th split.
-    pub fn get(&self, n: usize) -> String {
-        (self.fn_split_name)(n)
+    /// Returns the filename of the i-th split.
+    pub fn get(&self, n: usize) -> String {
+        (self.fn_split_name)(n)
     }
 }
 
-#[cfg(test)]
-mod tests {
-    // spell-checker:ignore (path) xxcst
+#[cfg(test)]
+mod tests {
+    // spell-checker:ignore (path) xxcst
 
-    use super::*;
+    use super::*;
 
-    #[test]
-    fn invalid_number() {
-        let split_name = SplitName::new(None, None, Some(String::from("bad")));
-        match split_name {
-            Err(CsplitError::InvalidNumber(_)) => (),
-            _ => panic!("should fail with InvalidNumber"),
+    #[test]
+    fn invalid_number() {
+        let split_name = SplitName::new(None, None, Some(String::from("bad")));
+        match split_name {
+            Err(CsplitError::InvalidNumber(_)) => (),
+            _ => panic!("should fail with InvalidNumber"),
         };
     }
 
-    #[test]
-    fn invalid_suffix_format1() {
-        let split_name = SplitName::new(None, Some(String::from("no conversion string")), None);
-        match split_name {
-            Err(CsplitError::SuffixFormatIncorrect) => (),
-            _ => panic!("should fail with SuffixFormatIncorrect"),
+    #[test]
+    fn invalid_suffix_format1() {
+        let split_name = SplitName::new(None, Some(String::from("no conversion string")), None);
+        match split_name {
+            Err(CsplitError::SuffixFormatIncorrect) => (),
+            _ => panic!("should fail with SuffixFormatIncorrect"),
         };
     }
 
-    #[test]
-    fn invalid_suffix_format2() {
-        let split_name = SplitName::new(None, Some(String::from("%042a")), None);
-        match split_name {
-            Err(CsplitError::SuffixFormatIncorrect) => (),
-            _ => panic!("should fail with SuffixFormatIncorrect"),
+    #[test]
+    fn invalid_suffix_format2() {
+        let split_name = SplitName::new(None, Some(String::from("%042a")), None);
+        match split_name {
+            Err(CsplitError::SuffixFormatIncorrect) => (),
+            _ => panic!("should fail with SuffixFormatIncorrect"),
         };
     }
 
-    #[test]
-    fn default_formatter() {
-        let split_name = SplitName::new(None, None, None).unwrap();
-        assert_eq!(split_name.get(2), "xx02");
+    #[test]
+    fn default_formatter() {
+        let split_name = SplitName::new(None, None, None).unwrap();
+        assert_eq!(split_name.get(2), "xx02");
     }
 
-    #[test]
-    fn default_formatter_with_prefix() {
-        let split_name = SplitName::new(Some(String::from("aaa")), None, None).unwrap();
-        assert_eq!(split_name.get(2), "aaa02");
+    #[test]
+    fn default_formatter_with_prefix() {
+        let split_name = SplitName::new(Some(String::from("aaa")), None, None).unwrap();
+        assert_eq!(split_name.get(2), "aaa02");
     }
 
-    #[test]
-    fn default_formatter_with_width() {
-        let split_name = SplitName::new(None, None, Some(String::from("5"))).unwrap();
-        assert_eq!(split_name.get(2), "xx00002");
+    #[test]
+    fn default_formatter_with_width() {
+        let split_name = SplitName::new(None, None, Some(String::from("5"))).unwrap();
+        assert_eq!(split_name.get(2), "xx00002");
     }
 
-    #[test]
-    fn no_padding_decimal() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%d-")), None).unwrap();
-        assert_eq!(split_name.get(2), "xxcst-2-");
+    #[test]
+    fn no_padding_decimal() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%d-")), None).unwrap();
+        assert_eq!(split_name.get(2), "xxcst-2-");
     }
 
-    #[test]
-    fn zero_padding_decimal1() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%03d-")), None).unwrap();
-        assert_eq!(split_name.get(2), "xxcst-002-");
+    #[test]
+    fn zero_padding_decimal1() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%03d-")), None).unwrap();
+        assert_eq!(split_name.get(2), "xxcst-002-");
     }
 
-    #[test]
-    fn zero_padding_decimal2() {
-        let split_name = SplitName::new(
-            Some(String::from("pre-")),
-            Some(String::from("cst-%03d-post")),
+    #[test]
+    fn zero_padding_decimal2() {
+        let split_name = SplitName::new(
+            Some(String::from("pre-")),
+            Some(String::from("cst-%03d-post")),
             None,
         )
-        .unwrap();
-        assert_eq!(split_name.get(2), "pre-cst-002-post");
+        .unwrap();
+        assert_eq!(split_name.get(2), "pre-cst-002-post");
     }
 
-    #[test]
-    fn zero_padding_decimal3() {
-        let split_name = SplitName::new(
+    #[test]
+    fn zero_padding_decimal3() {
+        let split_name = SplitName::new(
             None,
-            Some(String::from("cst-%03d-")),
-            Some(String::from("42")),
+            Some(String::from("cst-%03d-")),
+            Some(String::from("42")),
         )
-        .unwrap();
-        assert_eq!(split_name.get(2), "xxcst-002-");
+        .unwrap();
+        assert_eq!(split_name.get(2), "xxcst-002-");
     }
 
-    #[test]
-    fn zero_padding_decimal4() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%03i-")), None).unwrap();
-        assert_eq!(split_name.get(2), "xxcst-002-");
+    #[test]
+    fn zero_padding_decimal4() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%03i-")), None).unwrap();
+        assert_eq!(split_name.get(2), "xxcst-002-");
     }
 
-    #[test]
-    fn zero_padding_decimal5() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%03u-")), None).unwrap();
-        assert_eq!(split_name.get(2), "xxcst-002-");
+    #[test]
+    fn zero_padding_decimal5() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%03u-")), None).unwrap();
+        assert_eq!(split_name.get(2), "xxcst-002-");
     }
 
-    #[test]
-    fn zero_padding_octal() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%03o-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-052-");
+    #[test]
+    fn zero_padding_octal() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%03o-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-052-");
     }
 
-    #[test]
-    fn zero_padding_lower_hex() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%03x-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-02a-");
+    #[test]
+    fn zero_padding_lower_hex() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%03x-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-02a-");
     }
 
-    #[test]
-    fn zero_padding_upper_hex() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%03X-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-02A-");
+    #[test]
+    fn zero_padding_upper_hex() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%03X-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-02A-");
     }
 
-    #[test]
-    fn alternate_form_octal() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%#10o-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-      0o52-");
+    #[test]
+    fn alternate_form_octal() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%#10o-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-      0o52-");
     }
 
-    #[test]
-    fn alternate_form_lower_hex() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%#10x-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-      0x2a-");
+    #[test]
+    fn alternate_form_lower_hex() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%#10x-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-      0x2a-");
     }
 
-    #[test]
-    fn alternate_form_upper_hex() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%#10X-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-      0x2A-");
+    #[test]
+    fn alternate_form_upper_hex() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%#10X-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-      0x2A-");
     }
 
-    #[test]
-    fn left_adjusted_decimal1() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%-10d-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-42        -");
+    #[test]
+    fn left_adjusted_decimal1() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%-10d-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-42        -");
     }
 
-    #[test]
-    fn left_adjusted_decimal2() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%-10i-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-42        -");
+    #[test]
+    fn left_adjusted_decimal2() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%-10i-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-42        -");
     }
 
-    #[test]
-    fn left_adjusted_decimal3() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%-10u-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-42        -");
+    #[test]
+    fn left_adjusted_decimal3() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%-10u-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-42        -");
     }
 
-    #[test]
-    fn left_adjusted_octal() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%-10o-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-0o52      -");
+    #[test]
+    fn left_adjusted_octal() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%-10o-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-0o52      -");
     }
 
-    #[test]
-    fn left_adjusted_lower_hex() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%-10x-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-0x2a      -");
+    #[test]
+    fn left_adjusted_lower_hex() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%-10x-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-0x2a      -");
     }
 
-    #[test]
-    fn left_adjusted_upper_hex() {
-        let split_name = SplitName::new(None, Some(String::from("cst-%-10X-")), None).unwrap();
-        assert_eq!(split_name.get(42), "xxcst-0x2A      -");
+    #[test]
+    fn left_adjusted_upper_hex() {
+        let split_name = SplitName::new(None, Some(String::from("cst-%-10X-")), None).unwrap();
+        assert_eq!(split_name.get(42), "xxcst-0x2A      -");
     }
 
-    #[test]
-    fn too_many_percent() {
-        let split_name = SplitName::new(None, Some(String::from("%02d-%-3x")), None);
-        match split_name {
-            Err(CsplitError::SuffixFormatTooManyPercents) => (),
-            _ => panic!("should fail with SuffixFormatTooManyPercents"),
+    #[test]
+    fn too_many_percent() {
+        let split_name = SplitName::new(None, Some(String::from("%02d-%-3x")), None);
+        match split_name {
+            Err(CsplitError::SuffixFormatTooManyPercents) => (),
+            _ => panic!("should fail with SuffixFormatTooManyPercents"),
         };
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_cut/cut.rs.html b/dev/src/uu_cut/cut.rs.html index 1d2236c64..8d70f1170 100644 --- a/dev/src/uu_cut/cut.rs.html +++ b/dev/src/uu_cut/cut.rs.html @@ -1,4 +1,4 @@ -cut.rs - source
1
+cut.rs - source
1
 2
 3
 4
@@ -606,38 +606,38 @@
 606
 607
 608
-
// This file is part of the uutils coreutils package.
-//
-// (c) Rolf Morel <rolfmorel@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Rolf Morel <rolfmorel@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) delim sourcefiles
+// spell-checker:ignore (ToDO) delim sourcefiles
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use bstr::io::BufReadExt;
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fs::File;
-use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError};
+use bstr::io::BufReadExt;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fs::File;
+use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError};
 
-use self::searcher::Searcher;
-use uucore::format_usage;
-use uucore::ranges::Range;
+use self::searcher::Searcher;
+use uucore::format_usage;
+use uucore::ranges::Range;
 
-mod searcher;
+mod searcher;
 
-static NAME: &str = "cut";
-static USAGE: &str =
+static NAME: &str = "cut";
+static USAGE: &str =
     "{} [-d] [-s] [-z] [--output-delimiter] ((-f|-b|-c) {{sequence}}) {{sourcefile}}+";
-static ABOUT: &str =
+static ABOUT: &str =
     "Prints specified byte or field columns from each line of stdin or the input files";
-static LONG_HELP: &str = "
+static LONG_HELP: &str = "
  Each call must specify a mode (what to use for columns),
  a sequence (which columns to print), and provide a data source
 
@@ -717,138 +717,138 @@
     will result in 'a\\0c\\0'
 ";
 
-struct Options {
-    out_delim: Option<String>,
-    zero_terminated: bool,
+struct Options {
+    out_delim: Option<String>,
+    zero_terminated: bool,
 }
 
-struct FieldOptions {
-    delimiter: String, // one char long, String because of UTF8 representation
-    out_delimiter: Option<String>,
-    only_delimited: bool,
-    zero_terminated: bool,
+struct FieldOptions {
+    delimiter: String, // one char long, String because of UTF8 representation
+    out_delimiter: Option<String>,
+    only_delimited: bool,
+    zero_terminated: bool,
 }
 
-enum Mode {
-    Bytes(Vec<Range>, Options),
-    Characters(Vec<Range>, Options),
-    Fields(Vec<Range>, FieldOptions),
+enum Mode {
+    Bytes(Vec<Range>, Options),
+    Characters(Vec<Range>, Options),
+    Fields(Vec<Range>, FieldOptions),
 }
 
-fn stdout_writer() -> Box<dyn Write> {
-    if atty::is(atty::Stream::Stdout) {
-        Box::new(stdout())
-    } else {
-        Box::new(BufWriter::new(stdout())) as Box<dyn Write>
+fn stdout_writer() -> Box<dyn Write> {
+    if atty::is(atty::Stream::Stdout) {
+        Box::new(stdout())
+    } else {
+        Box::new(BufWriter::new(stdout())) as Box<dyn Write>
     }
 }
 
-fn list_to_ranges(list: &str, complement: bool) -> Result<Vec<Range>, String> {
-    if complement {
-        Range::from_list(list).map(|r| uucore::ranges::complement(&r))
-    } else {
-        Range::from_list(list)
+fn list_to_ranges(list: &str, complement: bool) -> Result<Vec<Range>, String> {
+    if complement {
+        Range::from_list(list).map(|r| uucore::ranges::complement(&r))
+    } else {
+        Range::from_list(list)
     }
 }
 
-fn cut_bytes<R: Read>(reader: R, ranges: &[Range], opts: &Options) -> UResult<()> {
-    let newline_char = if opts.zero_terminated { b'\0' } else { b'\n' };
-    let mut buf_in = BufReader::new(reader);
-    let mut out = stdout_writer();
-    let delim = opts
-        .out_delim
-        .as_ref()
-        .map_or("", String::as_str)
-        .as_bytes();
+fn cut_bytes<R: Read>(reader: R, ranges: &[Range], opts: &Options) -> UResult<()> {
+    let newline_char = if opts.zero_terminated { b'\0' } else { b'\n' };
+    let mut buf_in = BufReader::new(reader);
+    let mut out = stdout_writer();
+    let delim = opts
+        .out_delim
+        .as_ref()
+        .map_or("", String::as_str)
+        .as_bytes();
 
-    let result = buf_in.for_byte_record(newline_char, |line| {
-        let mut print_delim = false;
-        for &Range { low, high } in ranges {
-            if low > line.len() {
+    let result = buf_in.for_byte_record(newline_char, |line| {
+        let mut print_delim = false;
+        for &Range { low, high } in ranges {
+            if low > line.len() {
                 break;
             }
-            if print_delim {
-                out.write_all(delim)?;
-            } else if opts.out_delim.is_some() {
-                print_delim = true;
+            if print_delim {
+                out.write_all(delim)?;
+            } else if opts.out_delim.is_some() {
+                print_delim = true;
             }
-            // change `low` from 1-indexed value to 0-index value
-            let low = low - 1;
-            let high = high.min(line.len());
-            out.write_all(&line[low..high])?;
+            // change `low` from 1-indexed value to 0-index value
+            let low = low - 1;
+            let high = high.min(line.len());
+            out.write_all(&line[low..high])?;
         }
-        out.write_all(&[newline_char])?;
+        out.write_all(&[newline_char])?;
         Ok(true)
     });
 
-    if let Err(e) = result {
-        return Err(USimpleError::new(1, e.to_string()));
+    if let Err(e) = result {
+        return Err(USimpleError::new(1, e.to_string()));
     }
 
     Ok(())
 }
 
-#[allow(clippy::cognitive_complexity)]
-fn cut_fields_delimiter<R: Read>(
-    reader: R,
-    ranges: &[Range],
-    delim: &str,
-    only_delimited: bool,
-    newline_char: u8,
-    out_delim: &str,
-) -> UResult<()> {
-    let mut buf_in = BufReader::new(reader);
-    let mut out = stdout_writer();
-    let input_delim_len = delim.len();
+#[allow(clippy::cognitive_complexity)]
+fn cut_fields_delimiter<R: Read>(
+    reader: R,
+    ranges: &[Range],
+    delim: &str,
+    only_delimited: bool,
+    newline_char: u8,
+    out_delim: &str,
+) -> UResult<()> {
+    let mut buf_in = BufReader::new(reader);
+    let mut out = stdout_writer();
+    let input_delim_len = delim.len();
 
-    let result = buf_in.for_byte_record_with_terminator(newline_char, |line| {
-        let mut fields_pos = 1;
-        let mut low_idx = 0;
-        let mut delim_search = Searcher::new(line, delim.as_bytes()).peekable();
-        let mut print_delim = false;
+    let result = buf_in.for_byte_record_with_terminator(newline_char, |line| {
+        let mut fields_pos = 1;
+        let mut low_idx = 0;
+        let mut delim_search = Searcher::new(line, delim.as_bytes()).peekable();
+        let mut print_delim = false;
 
-        if delim_search.peek().is_none() {
-            if !only_delimited {
-                out.write_all(line)?;
-                if line[line.len() - 1] != newline_char {
-                    out.write_all(&[newline_char])?;
+        if delim_search.peek().is_none() {
+            if !only_delimited {
+                out.write_all(line)?;
+                if line[line.len() - 1] != newline_char {
+                    out.write_all(&[newline_char])?;
                 }
             }
 
-            return Ok(true);
+            return Ok(true);
         }
 
-        for &Range { low, high } in ranges {
-            if low - fields_pos > 0 {
-                low_idx = match delim_search.nth(low - fields_pos - 1) {
-                    Some(index) => index + input_delim_len,
-                    None => break,
+        for &Range { low, high } in ranges {
+            if low - fields_pos > 0 {
+                low_idx = match delim_search.nth(low - fields_pos - 1) {
+                    Some(index) => index + input_delim_len,
+                    None => break,
                 };
             }
 
-            for _ in 0..=high - low {
-                if print_delim {
-                    out.write_all(out_delim.as_bytes())?;
-                } else {
-                    print_delim = true;
+            for _ in 0..=high - low {
+                if print_delim {
+                    out.write_all(out_delim.as_bytes())?;
+                } else {
+                    print_delim = true;
                 }
 
-                match delim_search.next() {
-                    Some(high_idx) => {
-                        let segment = &line[low_idx..high_idx];
+                match delim_search.next() {
+                    Some(high_idx) => {
+                        let segment = &line[low_idx..high_idx];
 
-                        out.write_all(segment)?;
+                        out.write_all(segment)?;
 
-                        low_idx = high_idx + input_delim_len;
-                        fields_pos = high + 1;
+                        low_idx = high_idx + input_delim_len;
+                        fields_pos = high + 1;
                     }
-                    None => {
-                        let segment = &line[low_idx..];
+                    None => {
+                        let segment = &line[low_idx..];
 
-                        out.write_all(segment)?;
+                        out.write_all(segment)?;
 
-                        if line[line.len() - 1] == newline_char {
-                            return Ok(true);
+                        if line[line.len() - 1] == newline_char {
+                            return Ok(true);
                         }
                         break;
                     }
@@ -856,134 +856,134 @@
             }
         }
 
-        out.write_all(&[newline_char])?;
+        out.write_all(&[newline_char])?;
         Ok(true)
     });
 
-    if let Err(e) = result {
-        return Err(USimpleError::new(1, e.to_string()));
+    if let Err(e) = result {
+        return Err(USimpleError::new(1, e.to_string()));
     }
 
     Ok(())
 }
 
-#[allow(clippy::cognitive_complexity)]
-fn cut_fields<R: Read>(reader: R, ranges: &[Range], opts: &FieldOptions) -> UResult<()> {
-    let newline_char = if opts.zero_terminated { b'\0' } else { b'\n' };
-    if let Some(ref o_delim) = opts.out_delimiter {
-        return cut_fields_delimiter(
-            reader,
-            ranges,
-            &opts.delimiter,
-            opts.only_delimited,
-            newline_char,
-            o_delim,
+#[allow(clippy::cognitive_complexity)]
+fn cut_fields<R: Read>(reader: R, ranges: &[Range], opts: &FieldOptions) -> UResult<()> {
+    let newline_char = if opts.zero_terminated { b'\0' } else { b'\n' };
+    if let Some(ref o_delim) = opts.out_delimiter {
+        return cut_fields_delimiter(
+            reader,
+            ranges,
+            &opts.delimiter,
+            opts.only_delimited,
+            newline_char,
+            o_delim,
         );
     }
 
-    let mut buf_in = BufReader::new(reader);
-    let mut out = stdout_writer();
-    let delim_len = opts.delimiter.len();
+    let mut buf_in = BufReader::new(reader);
+    let mut out = stdout_writer();
+    let delim_len = opts.delimiter.len();
 
-    let result = buf_in.for_byte_record_with_terminator(newline_char, |line| {
-        let mut fields_pos = 1;
-        let mut low_idx = 0;
-        let mut delim_search = Searcher::new(line, opts.delimiter.as_bytes()).peekable();
-        let mut print_delim = false;
+    let result = buf_in.for_byte_record_with_terminator(newline_char, |line| {
+        let mut fields_pos = 1;
+        let mut low_idx = 0;
+        let mut delim_search = Searcher::new(line, opts.delimiter.as_bytes()).peekable();
+        let mut print_delim = false;
 
-        if delim_search.peek().is_none() {
-            if !opts.only_delimited {
-                out.write_all(line)?;
-                if line[line.len() - 1] != newline_char {
-                    out.write_all(&[newline_char])?;
+        if delim_search.peek().is_none() {
+            if !opts.only_delimited {
+                out.write_all(line)?;
+                if line[line.len() - 1] != newline_char {
+                    out.write_all(&[newline_char])?;
                 }
             }
 
-            return Ok(true);
+            return Ok(true);
         }
 
-        for &Range { low, high } in ranges {
-            if low - fields_pos > 0 {
-                if let Some(delim_pos) = delim_search.nth(low - fields_pos - 1) {
-                    low_idx = if print_delim {
-                        delim_pos
-                    } else {
-                        delim_pos + delim_len
+        for &Range { low, high } in ranges {
+            if low - fields_pos > 0 {
+                if let Some(delim_pos) = delim_search.nth(low - fields_pos - 1) {
+                    low_idx = if print_delim {
+                        delim_pos
+                    } else {
+                        delim_pos + delim_len
                     }
-                } else {
+                } else {
                     break;
                 }
             }
 
-            match delim_search.nth(high - low) {
-                Some(high_idx) => {
-                    let segment = &line[low_idx..high_idx];
+            match delim_search.nth(high - low) {
+                Some(high_idx) => {
+                    let segment = &line[low_idx..high_idx];
 
-                    out.write_all(segment)?;
+                    out.write_all(segment)?;
 
-                    print_delim = true;
-                    low_idx = high_idx;
-                    fields_pos = high + 1;
+                    print_delim = true;
+                    low_idx = high_idx;
+                    fields_pos = high + 1;
                 }
-                None => {
-                    let segment = &line[low_idx..line.len()];
+                None => {
+                    let segment = &line[low_idx..line.len()];
 
-                    out.write_all(segment)?;
+                    out.write_all(segment)?;
 
-                    if line[line.len() - 1] == newline_char {
-                        return Ok(true);
+                    if line[line.len() - 1] == newline_char {
+                        return Ok(true);
                     }
                     break;
                 }
             }
         }
-        out.write_all(&[newline_char])?;
+        out.write_all(&[newline_char])?;
         Ok(true)
     });
 
-    if let Err(e) = result {
-        return Err(USimpleError::new(1, e.to_string()));
+    if let Err(e) = result {
+        return Err(USimpleError::new(1, e.to_string()));
     }
 
     Ok(())
 }
 
-fn cut_files(mut filenames: Vec<String>, mode: &Mode) -> UResult<()> {
-    let mut stdin_read = false;
+fn cut_files(mut filenames: Vec<String>, mode: &Mode) -> UResult<()> {
+    let mut stdin_read = false;
 
-    if filenames.is_empty() {
-        filenames.push("-".to_owned());
+    if filenames.is_empty() {
+        filenames.push("-".to_owned());
     }
 
-    for filename in &filenames {
-        if filename == "-" {
-            if stdin_read {
+    for filename in &filenames {
+        if filename == "-" {
+            if stdin_read {
                 continue;
             }
 
-            show_if_err!(match mode {
-                Mode::Bytes(ref ranges, ref opts) => cut_bytes(stdin(), ranges, opts),
-                Mode::Characters(ref ranges, ref opts) => cut_bytes(stdin(), ranges, opts),
-                Mode::Fields(ref ranges, ref opts) => cut_fields(stdin(), ranges, opts),
+            show_if_err!(match mode {
+                Mode::Bytes(ref ranges, ref opts) => cut_bytes(stdin(), ranges, opts),
+                Mode::Characters(ref ranges, ref opts) => cut_bytes(stdin(), ranges, opts),
+                Mode::Fields(ref ranges, ref opts) => cut_fields(stdin(), ranges, opts),
             });
 
-            stdin_read = true;
-        } else {
-            let path = Path::new(&filename[..]);
+            stdin_read = true;
+        } else {
+            let path = Path::new(&filename[..]);
 
-            if path.is_dir() {
-                show_error!("{}: Is a directory", filename.maybe_quote());
+            if path.is_dir() {
+                show_error!("{}: Is a directory", filename.maybe_quote());
                 continue;
             }
 
-            show_if_err!(File::open(path)
-                .map_err_context(|| filename.maybe_quote().to_string())
-                .and_then(|file| {
-                    match &mode {
-                        Mode::Bytes(ranges, opts) | Mode::Characters(ranges, opts) => {
-                            cut_bytes(file, ranges, opts)
+            show_if_err!(File::open(path)
+                .map_err_context(|| filename.maybe_quote().to_string())
+                .and_then(|file| {
+                    match &mode {
+                        Mode::Bytes(ranges, opts) | Mode::Characters(ranges, opts) => {
+                            cut_bytes(file, ranges, opts)
                         }
-                        Mode::Fields(ranges, opts) => cut_fields(file, ranges, opts),
+                        Mode::Fields(ranges, opts) => cut_fields(file, ranges, opts),
                     }
                 }));
         }
@@ -992,227 +992,227 @@
     Ok(())
 }
 
-mod options {
-    pub const BYTES: &str = "bytes";
-    pub const CHARACTERS: &str = "characters";
-    pub const DELIMITER: &str = "delimiter";
-    pub const FIELDS: &str = "fields";
-    pub const ZERO_TERMINATED: &str = "zero-terminated";
-    pub const ONLY_DELIMITED: &str = "only-delimited";
-    pub const OUTPUT_DELIMITER: &str = "output-delimiter";
-    pub const COMPLEMENT: &str = "complement";
-    pub const FILE: &str = "file";
+mod options {
+    pub const BYTES: &str = "bytes";
+    pub const CHARACTERS: &str = "characters";
+    pub const DELIMITER: &str = "delimiter";
+    pub const FIELDS: &str = "fields";
+    pub const ZERO_TERMINATED: &str = "zero-terminated";
+    pub const ONLY_DELIMITED: &str = "only-delimited";
+    pub const OUTPUT_DELIMITER: &str = "output-delimiter";
+    pub const COMPLEMENT: &str = "complement";
+    pub const FILE: &str = "file";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let delimiter_is_equal = args.contains(&"-d=".to_string()); // special case
-    let matches = uu_app().try_get_matches_from(args)?;
+    let delimiter_is_equal = args.contains(&"-d=".to_string()); // special case
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let complement = matches.get_flag(options::COMPLEMENT);
+    let complement = matches.get_flag(options::COMPLEMENT);
 
-    let mode_parse = match (
-        matches.get_one::<String>(options::BYTES),
-        matches.get_one::<String>(options::CHARACTERS),
-        matches.get_one::<String>(options::FIELDS),
+    let mode_parse = match (
+        matches.get_one::<String>(options::BYTES),
+        matches.get_one::<String>(options::CHARACTERS),
+        matches.get_one::<String>(options::FIELDS),
     ) {
-        (Some(byte_ranges), None, None) => list_to_ranges(byte_ranges, complement).map(|ranges| {
-            Mode::Bytes(
-                ranges,
-                Options {
-                    out_delim: Some(
-                        matches
-                            .get_one::<String>(options::OUTPUT_DELIMITER)
-                            .map(|s| s.as_str())
-                            .unwrap_or_default()
-                            .to_owned(),
+        (Some(byte_ranges), None, None) => list_to_ranges(byte_ranges, complement).map(|ranges| {
+            Mode::Bytes(
+                ranges,
+                Options {
+                    out_delim: Some(
+                        matches
+                            .get_one::<String>(options::OUTPUT_DELIMITER)
+                            .map(|s| s.as_str())
+                            .unwrap_or_default()
+                            .to_owned(),
                     ),
-                    zero_terminated: matches.get_flag(options::ZERO_TERMINATED),
+                    zero_terminated: matches.get_flag(options::ZERO_TERMINATED),
                 },
             )
         }),
-        (None, Some(char_ranges), None) => list_to_ranges(char_ranges, complement).map(|ranges| {
-            Mode::Characters(
-                ranges,
-                Options {
-                    out_delim: Some(
-                        matches
-                            .get_one::<String>(options::OUTPUT_DELIMITER)
-                            .map(|s| s.as_str())
-                            .unwrap_or_default()
-                            .to_owned(),
+        (None, Some(char_ranges), None) => list_to_ranges(char_ranges, complement).map(|ranges| {
+            Mode::Characters(
+                ranges,
+                Options {
+                    out_delim: Some(
+                        matches
+                            .get_one::<String>(options::OUTPUT_DELIMITER)
+                            .map(|s| s.as_str())
+                            .unwrap_or_default()
+                            .to_owned(),
                     ),
-                    zero_terminated: matches.get_flag(options::ZERO_TERMINATED),
+                    zero_terminated: matches.get_flag(options::ZERO_TERMINATED),
                 },
             )
         }),
-        (None, None, Some(field_ranges)) => {
-            list_to_ranges(field_ranges, complement).and_then(|ranges| {
-                let out_delim = match matches.get_one::<String>(options::OUTPUT_DELIMITER) {
-                    Some(s) => {
-                        if s.is_empty() {
-                            Some("\0".to_owned())
-                        } else {
-                            Some(s.to_owned())
+        (None, None, Some(field_ranges)) => {
+            list_to_ranges(field_ranges, complement).and_then(|ranges| {
+                let out_delim = match matches.get_one::<String>(options::OUTPUT_DELIMITER) {
+                    Some(s) => {
+                        if s.is_empty() {
+                            Some("\0".to_owned())
+                        } else {
+                            Some(s.to_owned())
                         }
                     }
-                    None => None,
+                    None => None,
                 };
 
-                let only_delimited = matches.get_flag(options::ONLY_DELIMITED);
-                let zero_terminated = matches.get_flag(options::ZERO_TERMINATED);
+                let only_delimited = matches.get_flag(options::ONLY_DELIMITED);
+                let zero_terminated = matches.get_flag(options::ZERO_TERMINATED);
 
-                match matches.get_one::<String>(options::DELIMITER).map(|s| s.as_str()) {
-                    Some(mut delim) => {
-                        // GNU's `cut` supports `-d=` to set the delimiter to `=`.
-                        // Clap parsing is limited in this situation, see:
-                        // https://github.com/uutils/coreutils/issues/2424#issuecomment-863825242
-                        if delimiter_is_equal {
-                            delim = "=";
-                        } else if delim == "''" {
-                            // treat `''` as empty delimiter
-                            delim = "";
+                match matches.get_one::<String>(options::DELIMITER).map(|s| s.as_str()) {
+                    Some(mut delim) => {
+                        // GNU's `cut` supports `-d=` to set the delimiter to `=`.
+                        // Clap parsing is limited in this situation, see:
+                        // https://github.com/uutils/coreutils/issues/2424#issuecomment-863825242
+                        if delimiter_is_equal {
+                            delim = "=";
+                        } else if delim == "''" {
+                            // treat `''` as empty delimiter
+                            delim = "";
                         }
-                        if delim.chars().count() > 1 {
-                            Err("invalid input: The '--delimiter' ('-d') option expects empty or 1 character long, but was provided a value 2 characters or longer".into())
-                        } else {
-                            let delim = if delim.is_empty() {
-                                "\0".to_owned()
-                            } else {
-                                delim.to_owned()
+                        if delim.chars().count() > 1 {
+                            Err("invalid input: The '--delimiter' ('-d') option expects empty or 1 character long, but was provided a value 2 characters or longer".into())
+                        } else {
+                            let delim = if delim.is_empty() {
+                                "\0".to_owned()
+                            } else {
+                                delim.to_owned()
                             };
 
-                            Ok(Mode::Fields(
-                                ranges,
-                                FieldOptions {
-                                    delimiter: delim,
-                                    out_delimiter: out_delim,
-                                    only_delimited,
-                                    zero_terminated,
+                            Ok(Mode::Fields(
+                                ranges,
+                                FieldOptions {
+                                    delimiter: delim,
+                                    out_delimiter: out_delim,
+                                    only_delimited,
+                                    zero_terminated,
                                 },
                             ))
                         }
                     }
-                    None => Ok(Mode::Fields(
-                        ranges,
-                        FieldOptions {
-                            delimiter: "\t".to_owned(),
-                            out_delimiter: out_delim,
-                            only_delimited,
-                            zero_terminated,
+                    None => Ok(Mode::Fields(
+                        ranges,
+                        FieldOptions {
+                            delimiter: "\t".to_owned(),
+                            out_delimiter: out_delim,
+                            only_delimited,
+                            zero_terminated,
                         },
                     )),
                 }
             })
         }
-        (ref b, ref c, ref f) if b.is_some() || c.is_some() || f.is_some() => Err(
-            "invalid usage: expects no more than one of --fields (-f), --chars (-c) or --bytes (-b)".into()
+        (ref b, ref c, ref f) if b.is_some() || c.is_some() || f.is_some() => Err(
+            "invalid usage: expects no more than one of --fields (-f), --chars (-c) or --bytes (-b)".into()
         ),
-        _ => Err("invalid usage: expects one of --fields (-f), --chars (-c) or --bytes (-b)".into()),
+        _ => Err("invalid usage: expects one of --fields (-f), --chars (-c) or --bytes (-b)".into()),
     };
 
-    let mode_parse = match mode_parse {
-        Err(_) => mode_parse,
-        Ok(mode) => match mode {
-            Mode::Bytes(_, _) | Mode::Characters(_, _)
-                if matches.contains_id(options::DELIMITER) =>
+    let mode_parse = match mode_parse {
+        Err(_) => mode_parse,
+        Ok(mode) => match mode {
+            Mode::Bytes(_, _) | Mode::Characters(_, _)
+                if matches.contains_id(options::DELIMITER) =>
             {
-                Err("invalid input: The '--delimiter' ('-d') option only usable if printing a sequence of fields".into())
+                Err("invalid input: The '--delimiter' ('-d') option only usable if printing a sequence of fields".into())
             }
-            Mode::Bytes(_, _) | Mode::Characters(_, _)
-                if matches.get_flag(options::ONLY_DELIMITED) =>
+            Mode::Bytes(_, _) | Mode::Characters(_, _)
+                if matches.get_flag(options::ONLY_DELIMITED) =>
             {
-                Err("invalid input: The '--only-delimited' ('-s') option only usable if printing a sequence of fields".into())
+                Err("invalid input: The '--only-delimited' ('-s') option only usable if printing a sequence of fields".into())
             }
-            _ => Ok(mode),
+            _ => Ok(mode),
         },
     };
 
-    let files: Vec<String> = matches
-        .get_many::<String>(options::FILE)
-        .unwrap_or_default()
-        .map(|s| s.to_owned())
-        .collect();
+    let files: Vec<String> = matches
+        .get_many::<String>(options::FILE)
+        .unwrap_or_default()
+        .map(|s| s.to_owned())
+        .collect();
 
-    match mode_parse {
-        Ok(mode) => cut_files(files, &mode),
-        Err(e) => Err(USimpleError::new(1, e)),
+    match mode_parse {
+        Ok(mode) => cut_files(files, &mode),
+        Err(e) => Err(USimpleError::new(1, e)),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(ABOUT)
-        .after_help(LONG_HELP)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::BYTES)
-                .short('b')
-                .long(options::BYTES)
-                .help("filter byte columns from the input source")
-                .allow_hyphen_values(true)
-                .value_name("LIST"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(ABOUT)
+        .after_help(LONG_HELP)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::BYTES)
+                .short('b')
+                .long(options::BYTES)
+                .help("filter byte columns from the input source")
+                .allow_hyphen_values(true)
+                .value_name("LIST"),
         )
-        .arg(
-            Arg::new(options::CHARACTERS)
-                .short('c')
-                .long(options::CHARACTERS)
-                .help("alias for character mode")
-                .allow_hyphen_values(true)
-                .value_name("LIST"),
+        .arg(
+            Arg::new(options::CHARACTERS)
+                .short('c')
+                .long(options::CHARACTERS)
+                .help("alias for character mode")
+                .allow_hyphen_values(true)
+                .value_name("LIST"),
         )
-        .arg(
-            Arg::new(options::DELIMITER)
-                .short('d')
-                .long(options::DELIMITER)
-                .help("specify the delimiter character that separates fields in the input source. Defaults to Tab.")
-                .value_name("DELIM"),
+        .arg(
+            Arg::new(options::DELIMITER)
+                .short('d')
+                .long(options::DELIMITER)
+                .help("specify the delimiter character that separates fields in the input source. Defaults to Tab.")
+                .value_name("DELIM"),
         )
-        .arg(
-            Arg::new(options::FIELDS)
-                .short('f')
-                .long(options::FIELDS)
-                .help("filter field columns from the input source")
-                .allow_hyphen_values(true)
-                .value_name("LIST"),
+        .arg(
+            Arg::new(options::FIELDS)
+                .short('f')
+                .long(options::FIELDS)
+                .help("filter field columns from the input source")
+                .allow_hyphen_values(true)
+                .value_name("LIST"),
         )
-        .arg(
-            Arg::new(options::COMPLEMENT)
-                .long(options::COMPLEMENT)
-                .help("invert the filter - instead of displaying only the filtered columns, display all but those columns")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::COMPLEMENT)
+                .long(options::COMPLEMENT)
+                .help("invert the filter - instead of displaying only the filtered columns, display all but those columns")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ONLY_DELIMITED)
-                .short('s')
-                .long(options::ONLY_DELIMITED)
-                .help("in field mode, only print lines which contain the delimiter")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ONLY_DELIMITED)
+                .short('s')
+                .long(options::ONLY_DELIMITED)
+                .help("in field mode, only print lines which contain the delimiter")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ZERO_TERMINATED)
-                .short('z')
-                .long(options::ZERO_TERMINATED)
-                .help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO_TERMINATED)
+                .short('z')
+                .long(options::ZERO_TERMINATED)
+                .help("instead of filtering columns based on line, filter columns based on \\0 (NULL character)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OUTPUT_DELIMITER)
-                .long(options::OUTPUT_DELIMITER)
-                .help("in field mode, replace the delimiter in output lines with this option's argument")
-                .value_name("NEW_DELIM"),
+        .arg(
+            Arg::new(options::OUTPUT_DELIMITER)
+                .long(options::OUTPUT_DELIMITER)
+                .help("in field mode, replace the delimiter in output lines with this option's argument")
+                .value_name("NEW_DELIM"),
         )
-        .arg(
-            Arg::new(options::FILE)
-            .hide(true)
-            .action(ArgAction::Append)
-            .value_hint(clap::ValueHint::FilePath)
+        .arg(
+            Arg::new(options::FILE)
+            .hide(true)
+            .action(ArgAction::Append)
+            .value_hint(clap::ValueHint::FilePath)
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_cut/searcher.rs.html b/dev/src/uu_cut/searcher.rs.html index c318a3b3e..cf764f780 100644 --- a/dev/src/uu_cut/searcher.rs.html +++ b/dev/src/uu_cut/searcher.rs.html @@ -1,4 +1,4 @@ -searcher.rs - source
1
+searcher.rs - source
1
 2
 3
 4
@@ -103,110 +103,110 @@
 103
 104
 105
-
// This file is part of the uutils coreutils package.
-//
-// (c) Rolf Morel <rolfmorel@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Rolf Morel <rolfmorel@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-use memchr::memchr;
+use memchr::memchr;
 
-pub struct Searcher<'a> {
-    haystack: &'a [u8],
-    needle: &'a [u8],
-    position: usize,
+pub struct Searcher<'a> {
+    haystack: &'a [u8],
+    needle: &'a [u8],
+    position: usize,
 }
 
-impl<'a> Searcher<'a> {
-    pub fn new(haystack: &'a [u8], needle: &'a [u8]) -> Searcher<'a> {
-        assert!(!needle.is_empty());
-        Searcher {
-            haystack,
-            needle,
-            position: 0,
+impl<'a> Searcher<'a> {
+    pub fn new(haystack: &'a [u8], needle: &'a [u8]) -> Searcher<'a> {
+        assert!(!needle.is_empty());
+        Searcher {
+            haystack,
+            needle,
+            position: 0,
         }
     }
 }
 
-impl<'a> Iterator for Searcher<'a> {
-    type Item = usize;
+impl<'a> Iterator for Searcher<'a> {
+    type Item = usize;
 
-    fn next(&mut self) -> Option<Self::Item> {
-        loop {
-            if let Some(match_idx) = memchr(self.needle[0], self.haystack) {
-                if self.needle.len() == 1
-                    || self.haystack[match_idx + 1..].starts_with(&self.needle[1..])
+    fn next(&mut self) -> Option<Self::Item> {
+        loop {
+            if let Some(match_idx) = memchr(self.needle[0], self.haystack) {
+                if self.needle.len() == 1
+                    || self.haystack[match_idx + 1..].starts_with(&self.needle[1..])
                 {
-                    let match_pos = self.position + match_idx;
-                    let skip = match_idx + self.needle.len();
-                    self.haystack = &self.haystack[skip..];
-                    self.position += skip;
-                    return Some(match_pos);
-                } else {
-                    let skip = match_idx + 1;
-                    self.haystack = &self.haystack[skip..];
-                    self.position += skip;
-                    // continue
-                }
-            } else {
-                return None;
+                    let match_pos = self.position + match_idx;
+                    let skip = match_idx + self.needle.len();
+                    self.haystack = &self.haystack[skip..];
+                    self.position += skip;
+                    return Some(match_pos);
+                } else {
+                    let skip = match_idx + 1;
+                    self.haystack = &self.haystack[skip..];
+                    self.position += skip;
+                    // continue
+                }
+            } else {
+                return None;
             }
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use super::*;
+    use super::*;
 
-    const NEEDLE: &[u8] = "ab".as_bytes();
+    const NEEDLE: &[u8] = "ab".as_bytes();
 
-    #[test]
-    fn test_normal() {
-        let iter = Searcher::new("a.a.a".as_bytes(), "a".as_bytes());
-        let items: Vec<usize> = iter.collect();
-        assert_eq!(vec![0, 2, 4], items);
+    #[test]
+    fn test_normal() {
+        let iter = Searcher::new("a.a.a".as_bytes(), "a".as_bytes());
+        let items: Vec<usize> = iter.collect();
+        assert_eq!(vec![0, 2, 4], items);
     }
 
-    #[test]
-    fn test_empty() {
-        let iter = Searcher::new("".as_bytes(), "a".as_bytes());
-        let items: Vec<usize> = iter.collect();
-        assert_eq!(vec![] as Vec<usize>, items);
+    #[test]
+    fn test_empty() {
+        let iter = Searcher::new("".as_bytes(), "a".as_bytes());
+        let items: Vec<usize> = iter.collect();
+        assert_eq!(vec![] as Vec<usize>, items);
     }
 
-    fn test_multibyte(line: &[u8], expected: &[usize]) {
-        let iter = Searcher::new(line, NEEDLE);
-        let items: Vec<usize> = iter.collect();
-        assert_eq!(expected, items);
+    fn test_multibyte(line: &[u8], expected: &[usize]) {
+        let iter = Searcher::new(line, NEEDLE);
+        let items: Vec<usize> = iter.collect();
+        assert_eq!(expected, items);
     }
 
-    #[test]
-    fn test_multibyte_normal() {
-        test_multibyte("...ab...ab...".as_bytes(), &[3, 8]);
+    #[test]
+    fn test_multibyte_normal() {
+        test_multibyte("...ab...ab...".as_bytes(), &[3, 8]);
     }
 
-    #[test]
-    fn test_multibyte_needle_head_at_end() {
-        test_multibyte("a".as_bytes(), &[]);
+    #[test]
+    fn test_multibyte_needle_head_at_end() {
+        test_multibyte("a".as_bytes(), &[]);
     }
 
-    #[test]
-    fn test_multibyte_starting_needle() {
-        test_multibyte("ab...ab...".as_bytes(), &[0, 5]);
+    #[test]
+    fn test_multibyte_starting_needle() {
+        test_multibyte("ab...ab...".as_bytes(), &[0, 5]);
     }
 
-    #[test]
-    fn test_multibyte_trailing_needle() {
-        test_multibyte("...ab...ab".as_bytes(), &[3, 8]);
+    #[test]
+    fn test_multibyte_trailing_needle() {
+        test_multibyte("...ab...ab".as_bytes(), &[3, 8]);
     }
 
-    #[test]
-    fn test_multibyte_first_byte_false_match() {
-        test_multibyte("aA..aCaC..ab..aD".as_bytes(), &[10]);
+    #[test]
+    fn test_multibyte_first_byte_false_match() {
+        test_multibyte("aA..aCaC..ab..aD".as_bytes(), &[10]);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_date/date.rs.html b/dev/src/uu_date/date.rs.html index f7260fb8d..ff8745298 100644 --- a/dev/src/uu_date/date.rs.html +++ b/dev/src/uu_date/date.rs.html @@ -1,4 +1,4 @@ -date.rs - source
1
+date.rs - source
1
 2
 3
 4
@@ -426,255 +426,255 @@
 426
 427
 428
-
// This file is part of the uutils coreutils package.
-//
-// (c) Anthony Deschamps <anthony.j.deschamps@gmail.com>
-// (c) Sylvestre Ledru <sylvestre@debian.org>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Anthony Deschamps <anthony.j.deschamps@gmail.com>
+// (c) Sylvestre Ledru <sylvestre@debian.org>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes
+// spell-checker:ignore (chrono) Datelike Timelike ; (format) DATEFILE MMDDhhmm ; (vars) datetime datetimes
 
-use chrono::{DateTime, FixedOffset, Local, Offset, Utc};
-#[cfg(windows)]
-use chrono::{Datelike, Timelike};
-use clap::{crate_version, Arg, ArgAction, Command};
-#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
-use libc::{clock_settime, timespec, CLOCK_REALTIME};
-use std::fs::File;
-use std::io::{BufRead, BufReader};
-use std::path::PathBuf;
-use uucore::display::Quotable;
-#[cfg(not(any(target_os = "macos", target_os = "redox")))]
-use uucore::error::FromIo;
-use uucore::error::{UResult, USimpleError};
-use uucore::{format_usage, show_error};
-#[cfg(windows)]
-use windows_sys::Win32::{Foundation::SYSTEMTIME, System::SystemInformation::SetSystemTime};
+use chrono::{DateTime, FixedOffset, Local, Offset, Utc};
+#[cfg(windows)]
+use chrono::{Datelike, Timelike};
+use clap::{crate_version, Arg, ArgAction, Command};
+#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
+use libc::{clock_settime, timespec, CLOCK_REALTIME};
+use std::fs::File;
+use std::io::{BufRead, BufReader};
+use std::path::PathBuf;
+use uucore::display::Quotable;
+#[cfg(not(any(target_os = "macos", target_os = "redox")))]
+use uucore::error::FromIo;
+use uucore::error::{UResult, USimpleError};
+use uucore::{format_usage, show_error};
+#[cfg(windows)]
+use windows_sys::Win32::{Foundation::SYSTEMTIME, System::SystemInformation::SetSystemTime};
 
-// Options
-const DATE: &str = "date";
-const HOURS: &str = "hours";
-const MINUTES: &str = "minutes";
-const SECONDS: &str = "seconds";
-const HOUR: &str = "hour";
-const MINUTE: &str = "minute";
-const SECOND: &str = "second";
-const NS: &str = "ns";
+// Options
+const DATE: &str = "date";
+const HOURS: &str = "hours";
+const MINUTES: &str = "minutes";
+const SECONDS: &str = "seconds";
+const HOUR: &str = "hour";
+const MINUTE: &str = "minute";
+const SECOND: &str = "second";
+const NS: &str = "ns";
 
-const ABOUT: &str = "print or set the system date and time";
-const USAGE: &str = "\
+const ABOUT: &str = "print or set the system date and time";
+const USAGE: &str = "\
     {} [OPTION]... [+FORMAT]...
     {} [OPTION]... [MMDDhhmm[[CC]YY][.ss]]";
 
-const OPT_DATE: &str = "date";
-const OPT_FORMAT: &str = "format";
-const OPT_FILE: &str = "file";
-const OPT_DEBUG: &str = "debug";
-const OPT_ISO_8601: &str = "iso-8601";
-const OPT_RFC_EMAIL: &str = "rfc-email";
-const OPT_RFC_3339: &str = "rfc-3339";
-const OPT_SET: &str = "set";
-const OPT_REFERENCE: &str = "reference";
-const OPT_UNIVERSAL: &str = "universal";
-const OPT_UNIVERSAL_2: &str = "utc";
+const OPT_DATE: &str = "date";
+const OPT_FORMAT: &str = "format";
+const OPT_FILE: &str = "file";
+const OPT_DEBUG: &str = "debug";
+const OPT_ISO_8601: &str = "iso-8601";
+const OPT_RFC_EMAIL: &str = "rfc-email";
+const OPT_RFC_3339: &str = "rfc-3339";
+const OPT_SET: &str = "set";
+const OPT_REFERENCE: &str = "reference";
+const OPT_UNIVERSAL: &str = "universal";
+const OPT_UNIVERSAL_2: &str = "utc";
 
-// Help strings
+// Help strings
 
-static ISO_8601_HELP_STRING: &str = "output date/time in ISO 8601 format.
+static ISO_8601_HELP_STRING: &str = "output date/time in ISO 8601 format.
  FMT='date' for date only (the default),
  'hours', 'minutes', 'seconds', or 'ns'
  for date and time to the indicated precision.
  Example: 2006-08-14T02:34:56-06:00";
 
-static RFC_5322_HELP_STRING: &str = "output date and time in RFC 5322 format.
+static RFC_5322_HELP_STRING: &str = "output date and time in RFC 5322 format.
  Example: Mon, 14 Aug 2006 02:34:56 -0600";
 
-static RFC_3339_HELP_STRING: &str = "output date/time in RFC 3339 format.
+static RFC_3339_HELP_STRING: &str = "output date/time in RFC 3339 format.
  FMT='date', 'seconds', or 'ns'
  for date and time to the indicated precision.
  Example: 2006-08-14 02:34:56-06:00";
 
-#[cfg(not(any(target_os = "macos", target_os = "redox")))]
-static OPT_SET_HELP_STRING: &str = "set time described by STRING";
-#[cfg(target_os = "macos")]
-static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on mac yet)";
-#[cfg(target_os = "redox")]
-static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on redox yet)";
+#[cfg(not(any(target_os = "macos", target_os = "redox")))]
+static OPT_SET_HELP_STRING: &str = "set time described by STRING";
+#[cfg(target_os = "macos")]
+static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on mac yet)";
+#[cfg(target_os = "redox")]
+static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on redox yet)";
 
-/// Settings for this program, parsed from the command line
-struct Settings {
-    utc: bool,
-    format: Format,
-    date_source: DateSource,
-    set_to: Option<DateTime<FixedOffset>>,
+/// Settings for this program, parsed from the command line
+struct Settings {
+    utc: bool,
+    format: Format,
+    date_source: DateSource,
+    set_to: Option<DateTime<FixedOffset>>,
 }
 
-/// Various ways of displaying the date
-enum Format {
-    Iso8601(Iso8601Format),
-    Rfc5322,
-    Rfc3339(Rfc3339Format),
-    Custom(String),
-    Default,
+/// Various ways of displaying the date
+enum Format {
+    Iso8601(Iso8601Format),
+    Rfc5322,
+    Rfc3339(Rfc3339Format),
+    Custom(String),
+    Default,
 }
 
-/// Various places that dates can come from
-enum DateSource {
-    Now,
-    Custom(String),
-    File(PathBuf),
+/// Various places that dates can come from
+enum DateSource {
+    Now,
+    Custom(String),
+    File(PathBuf),
 }
 
-enum Iso8601Format {
-    Date,
-    Hours,
-    Minutes,
-    Seconds,
-    Ns,
+enum Iso8601Format {
+    Date,
+    Hours,
+    Minutes,
+    Seconds,
+    Ns,
 }
 
-impl<'a> From<&'a str> for Iso8601Format {
-    fn from(s: &str) -> Self {
-        match s {
-            HOURS | HOUR => Self::Hours,
-            MINUTES | MINUTE => Self::Minutes,
-            SECONDS | SECOND => Self::Seconds,
-            NS => Self::Ns,
-            DATE => Self::Date,
-            // Should be caught by clap
-            _ => panic!("Invalid format: {}", s),
+impl<'a> From<&'a str> for Iso8601Format {
+    fn from(s: &str) -> Self {
+        match s {
+            HOURS | HOUR => Self::Hours,
+            MINUTES | MINUTE => Self::Minutes,
+            SECONDS | SECOND => Self::Seconds,
+            NS => Self::Ns,
+            DATE => Self::Date,
+            // Should be caught by clap
+            _ => panic!("Invalid format: {}", s),
         }
     }
 }
 
-enum Rfc3339Format {
-    Date,
-    Seconds,
-    Ns,
+enum Rfc3339Format {
+    Date,
+    Seconds,
+    Ns,
 }
 
-impl<'a> From<&'a str> for Rfc3339Format {
-    fn from(s: &str) -> Self {
-        match s {
-            DATE => Self::Date,
-            SECONDS | SECOND => Self::Seconds,
-            NS => Self::Ns,
-            // Should be caught by clap
-            _ => panic!("Invalid format: {}", s),
+impl<'a> From<&'a str> for Rfc3339Format {
+    fn from(s: &str) -> Self {
+        match s {
+            DATE => Self::Date,
+            SECONDS | SECOND => Self::Seconds,
+            NS => Self::Ns,
+            // Should be caught by clap
+            _ => panic!("Invalid format: {}", s),
         }
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let format = if let Some(form) = matches.get_one::<String>(OPT_FORMAT) {
-        if !form.starts_with('+') {
-            return Err(USimpleError::new(
+    let format = if let Some(form) = matches.get_one::<String>(OPT_FORMAT) {
+        if !form.starts_with('+') {
+            return Err(USimpleError::new(
                 1,
-                format!("invalid date {}", form.quote()),
+                format!("invalid date {}", form.quote()),
             ));
         }
-        let form = form[1..].to_string();
-        Format::Custom(form)
-    } else if let Some(fmt) = matches
-        .get_many::<String>(OPT_ISO_8601)
-        .map(|mut iter| iter.next().unwrap_or(&DATE.to_string()).as_str().into())
+        let form = form[1..].to_string();
+        Format::Custom(form)
+    } else if let Some(fmt) = matches
+        .get_many::<String>(OPT_ISO_8601)
+        .map(|mut iter| iter.next().unwrap_or(&DATE.to_string()).as_str().into())
     {
-        Format::Iso8601(fmt)
-    } else if matches.get_flag(OPT_RFC_EMAIL) {
-        Format::Rfc5322
-    } else if let Some(fmt) = matches
-        .get_one::<String>(OPT_RFC_3339)
-        .map(|s| s.as_str().into())
+        Format::Iso8601(fmt)
+    } else if matches.get_flag(OPT_RFC_EMAIL) {
+        Format::Rfc5322
+    } else if let Some(fmt) = matches
+        .get_one::<String>(OPT_RFC_3339)
+        .map(|s| s.as_str().into())
     {
-        Format::Rfc3339(fmt)
-    } else {
-        Format::Default
+        Format::Rfc3339(fmt)
+    } else {
+        Format::Default
     };
 
-    let date_source = if let Some(date) = matches.get_one::<String>(OPT_DATE) {
-        DateSource::Custom(date.into())
-    } else if let Some(file) = matches.get_one::<String>(OPT_FILE) {
-        DateSource::File(file.into())
-    } else {
-        DateSource::Now
+    let date_source = if let Some(date) = matches.get_one::<String>(OPT_DATE) {
+        DateSource::Custom(date.into())
+    } else if let Some(file) = matches.get_one::<String>(OPT_FILE) {
+        DateSource::File(file.into())
+    } else {
+        DateSource::Now
     };
 
-    let set_to = match matches.get_one::<String>(OPT_SET).map(parse_date) {
-        None => None,
-        Some(Err((input, _err))) => {
-            return Err(USimpleError::new(
+    let set_to = match matches.get_one::<String>(OPT_SET).map(parse_date) {
+        None => None,
+        Some(Err((input, _err))) => {
+            return Err(USimpleError::new(
                 1,
-                format!("invalid date {}", input.quote()),
+                format!("invalid date {}", input.quote()),
             ));
         }
-        Some(Ok(date)) => Some(date),
+        Some(Ok(date)) => Some(date),
     };
 
-    let settings = Settings {
-        utc: matches.get_flag(OPT_UNIVERSAL),
-        format,
-        date_source,
-        set_to,
+    let settings = Settings {
+        utc: matches.get_flag(OPT_UNIVERSAL),
+        format,
+        date_source,
+        set_to,
     };
 
-    if let Some(date) = settings.set_to {
-        // All set time functions expect UTC datetimes.
-        let date: DateTime<Utc> = if settings.utc {
-            date.with_timezone(&Utc)
-        } else {
-            date.into()
+    if let Some(date) = settings.set_to {
+        // All set time functions expect UTC datetimes.
+        let date: DateTime<Utc> = if settings.utc {
+            date.with_timezone(&Utc)
+        } else {
+            date.into()
         };
 
-        return set_system_datetime(date);
-    } else {
-        // Declare a file here because it needs to outlive the `dates` iterator.
-        let file: File;
+        return set_system_datetime(date);
+    } else {
+        // Declare a file here because it needs to outlive the `dates` iterator.
+        let file: File;
 
-        // Get the current time, either in the local time zone or UTC.
-        let now: DateTime<FixedOffset> = if settings.utc {
-            let now = Utc::now();
-            now.with_timezone(&now.offset().fix())
-        } else {
-            let now = Local::now();
-            now.with_timezone(now.offset())
+        // Get the current time, either in the local time zone or UTC.
+        let now: DateTime<FixedOffset> = if settings.utc {
+            let now = Utc::now();
+            now.with_timezone(&now.offset().fix())
+        } else {
+            let now = Local::now();
+            now.with_timezone(now.offset())
         };
 
-        // Iterate over all dates - whether it's a single date or a file.
-        let dates: Box<dyn Iterator<Item = _>> = match settings.date_source {
-            DateSource::Custom(ref input) => {
-                let date = parse_date(input.clone());
-                let iter = std::iter::once(date);
-                Box::new(iter)
+        // Iterate over all dates - whether it's a single date or a file.
+        let dates: Box<dyn Iterator<Item = _>> = match settings.date_source {
+            DateSource::Custom(ref input) => {
+                let date = parse_date(input.clone());
+                let iter = std::iter::once(date);
+                Box::new(iter)
             }
-            DateSource::File(ref path) => {
-                file = File::open(path).unwrap();
-                let lines = BufReader::new(file).lines();
-                let iter = lines.filter_map(Result::ok).map(parse_date);
-                Box::new(iter)
+            DateSource::File(ref path) => {
+                file = File::open(path).unwrap();
+                let lines = BufReader::new(file).lines();
+                let iter = lines.filter_map(Result::ok).map(parse_date);
+                Box::new(iter)
             }
-            DateSource::Now => {
-                let iter = std::iter::once(Ok(now));
-                Box::new(iter)
+            DateSource::Now => {
+                let iter = std::iter::once(Ok(now));
+                Box::new(iter)
             }
         };
 
-        let format_string = make_format_string(&settings);
+        let format_string = make_format_string(&settings);
 
-        // Format all the dates
-        for date in dates {
-            match date {
-                Ok(date) => {
-                    // GNU `date` uses `%N` for nano seconds, however crate::chrono uses `%f`
-                    let format_string = &format_string.replace("%N", "%f");
-                    let formatted = date.format(format_string).to_string().replace("%f", "%N");
-                    println!("{}", formatted);
+        // Format all the dates
+        for date in dates {
+            match date {
+                Ok(date) => {
+                    // GNU `date` uses `%N` for nano seconds, however crate::chrono uses `%f`
+                    let format_string = &format_string.replace("%N", "%f");
+                    let formatted = date.format(format_string).to_string().replace("%f", "%N");
+                    println!("{}", formatted);
                 }
-                Err((input, _err)) => show_error!("invalid date {}", input.quote()),
+                Err((input, _err)) => show_error!("invalid date {}", input.quote()),
             }
         }
     }
@@ -682,177 +682,177 @@
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_DATE)
-                .short('d')
-                .long(OPT_DATE)
-                .value_name("STRING")
-                .help("display time described by STRING, not 'now'"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_DATE)
+                .short('d')
+                .long(OPT_DATE)
+                .value_name("STRING")
+                .help("display time described by STRING, not 'now'"),
         )
-        .arg(
-            Arg::new(OPT_FILE)
-                .short('f')
-                .long(OPT_FILE)
-                .value_name("DATEFILE")
-                .value_hint(clap::ValueHint::FilePath)
-                .help("like --date; once for each line of DATEFILE"),
+        .arg(
+            Arg::new(OPT_FILE)
+                .short('f')
+                .long(OPT_FILE)
+                .value_name("DATEFILE")
+                .value_hint(clap::ValueHint::FilePath)
+                .help("like --date; once for each line of DATEFILE"),
         )
-        .arg(
-            Arg::new(OPT_ISO_8601)
-                .short('I')
-                .long(OPT_ISO_8601)
-                .value_name("FMT")
-                .help(ISO_8601_HELP_STRING),
+        .arg(
+            Arg::new(OPT_ISO_8601)
+                .short('I')
+                .long(OPT_ISO_8601)
+                .value_name("FMT")
+                .help(ISO_8601_HELP_STRING),
         )
-        .arg(
-            Arg::new(OPT_RFC_EMAIL)
-                .short('R')
-                .long(OPT_RFC_EMAIL)
-                .help(RFC_5322_HELP_STRING)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_RFC_EMAIL)
+                .short('R')
+                .long(OPT_RFC_EMAIL)
+                .help(RFC_5322_HELP_STRING)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_RFC_3339)
-                .long(OPT_RFC_3339)
-                .value_name("FMT")
-                .help(RFC_3339_HELP_STRING),
+        .arg(
+            Arg::new(OPT_RFC_3339)
+                .long(OPT_RFC_3339)
+                .value_name("FMT")
+                .help(RFC_3339_HELP_STRING),
         )
-        .arg(
-            Arg::new(OPT_DEBUG)
-                .long(OPT_DEBUG)
-                .help("annotate the parsed date, and warn about questionable usage to stderr")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_DEBUG)
+                .long(OPT_DEBUG)
+                .help("annotate the parsed date, and warn about questionable usage to stderr")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_REFERENCE)
-                .short('r')
-                .long(OPT_REFERENCE)
-                .value_name("FILE")
-                .value_hint(clap::ValueHint::AnyPath)
-                .help("display the last modification time of FILE"),
+        .arg(
+            Arg::new(OPT_REFERENCE)
+                .short('r')
+                .long(OPT_REFERENCE)
+                .value_name("FILE")
+                .value_hint(clap::ValueHint::AnyPath)
+                .help("display the last modification time of FILE"),
         )
-        .arg(
-            Arg::new(OPT_SET)
-                .short('s')
-                .long(OPT_SET)
-                .value_name("STRING")
-                .help(OPT_SET_HELP_STRING),
+        .arg(
+            Arg::new(OPT_SET)
+                .short('s')
+                .long(OPT_SET)
+                .value_name("STRING")
+                .help(OPT_SET_HELP_STRING),
         )
-        .arg(
-            Arg::new(OPT_UNIVERSAL)
-                .short('u')
-                .long(OPT_UNIVERSAL)
-                .alias(OPT_UNIVERSAL_2)
-                .help("print or set Coordinated Universal Time (UTC)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_UNIVERSAL)
+                .short('u')
+                .long(OPT_UNIVERSAL)
+                .alias(OPT_UNIVERSAL_2)
+                .help("print or set Coordinated Universal Time (UTC)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(Arg::new(OPT_FORMAT))
+        .arg(Arg::new(OPT_FORMAT))
 }
 
-/// Return the appropriate format string for the given settings.
-fn make_format_string(settings: &Settings) -> &str {
-    match settings.format {
-        Format::Iso8601(ref fmt) => match *fmt {
-            Iso8601Format::Date => "%F",
-            Iso8601Format::Hours => "%FT%H%:z",
-            Iso8601Format::Minutes => "%FT%H:%M%:z",
-            Iso8601Format::Seconds => "%FT%T%:z",
-            Iso8601Format::Ns => "%FT%T,%f%:z",
+/// Return the appropriate format string for the given settings.
+fn make_format_string(settings: &Settings) -> &str {
+    match settings.format {
+        Format::Iso8601(ref fmt) => match *fmt {
+            Iso8601Format::Date => "%F",
+            Iso8601Format::Hours => "%FT%H%:z",
+            Iso8601Format::Minutes => "%FT%H:%M%:z",
+            Iso8601Format::Seconds => "%FT%T%:z",
+            Iso8601Format::Ns => "%FT%T,%f%:z",
         },
-        Format::Rfc5322 => "%a, %d %h %Y %T %z",
-        Format::Rfc3339(ref fmt) => match *fmt {
-            Rfc3339Format::Date => "%F",
-            Rfc3339Format::Seconds => "%F %T%:z",
-            Rfc3339Format::Ns => "%F %T.%f%:z",
+        Format::Rfc5322 => "%a, %d %h %Y %T %z",
+        Format::Rfc3339(ref fmt) => match *fmt {
+            Rfc3339Format::Date => "%F",
+            Rfc3339Format::Seconds => "%F %T%:z",
+            Rfc3339Format::Ns => "%F %T.%f%:z",
         },
-        Format::Custom(ref fmt) => fmt,
-        Format::Default => "%c",
+        Format::Custom(ref fmt) => fmt,
+        Format::Default => "%c",
     }
 }
 
-/// Parse a `String` into a `DateTime`.
-/// If it fails, return a tuple of the `String` along with its `ParseError`.
-fn parse_date<S: AsRef<str> + Clone>(
-    s: S,
-) -> Result<DateTime<FixedOffset>, (String, chrono::format::ParseError)> {
-    // TODO: The GNU date command can parse a wide variety of inputs.
-    s.as_ref().parse().map_err(|e| (s.as_ref().into(), e))
+/// Parse a `String` into a `DateTime`.
+/// If it fails, return a tuple of the `String` along with its `ParseError`.
+fn parse_date<S: AsRef<str> + Clone>(
+    s: S,
+) -> Result<DateTime<FixedOffset>, (String, chrono::format::ParseError)> {
+    // TODO: The GNU date command can parse a wide variety of inputs.
+    s.as_ref().parse().map_err(|e| (s.as_ref().into(), e))
 }
 
-#[cfg(not(any(unix, windows)))]
-fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
+#[cfg(not(any(unix, windows)))]
+fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
     unimplemented!("setting date not implemented (unsupported target)");
 }
 
-#[cfg(target_os = "macos")]
-fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
-    Err(USimpleError::new(
+#[cfg(target_os = "macos")]
+fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
+    Err(USimpleError::new(
         1,
-        "setting the date is not supported by macOS".to_string(),
+        "setting the date is not supported by macOS".to_string(),
     ))
 }
 
-#[cfg(target_os = "redox")]
-fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
-    Err(USimpleError::new(
+#[cfg(target_os = "redox")]
+fn set_system_datetime(_date: DateTime<Utc>) -> UResult<()> {
+    Err(USimpleError::new(
         1,
-        "setting the date is not supported by Redox".to_string(),
+        "setting the date is not supported by Redox".to_string(),
     ))
 }
 
-#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
-/// System call to set date (unix).
-/// See here for more:
-/// `<https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html>`
-/// `<https://linux.die.net/man/3/clock_settime>`
-/// `<https://www.gnu.org/software/libc/manual/html_node/Time-Types.html>`
-fn set_system_datetime(date: DateTime<Utc>) -> UResult<()> {
-    let timespec = timespec {
-        tv_sec: date.timestamp() as _,
-        tv_nsec: date.timestamp_subsec_nanos() as _,
+#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
+/// System call to set date (unix).
+/// See here for more:
+/// `<https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html>`
+/// `<https://linux.die.net/man/3/clock_settime>`
+/// `<https://www.gnu.org/software/libc/manual/html_node/Time-Types.html>`
+fn set_system_datetime(date: DateTime<Utc>) -> UResult<()> {
+    let timespec = timespec {
+        tv_sec: date.timestamp() as _,
+        tv_nsec: date.timestamp_subsec_nanos() as _,
     };
 
-    let result = unsafe { clock_settime(CLOCK_REALTIME, &timespec) };
+    let result = unsafe { clock_settime(CLOCK_REALTIME, &timespec) };
 
-    if result != 0 {
-        Err(std::io::Error::last_os_error().map_err_context(|| "cannot set date".to_string()))
-    } else {
+    if result != 0 {
+        Err(std::io::Error::last_os_error().map_err_context(|| "cannot set date".to_string()))
+    } else {
         Ok(())
     }
 }
 
-#[cfg(windows)]
-/// System call to set date (Windows).
-/// See here for more:
-/// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-setsystemtime
-/// https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime
-fn set_system_datetime(date: DateTime<Utc>) -> UResult<()> {
-    let system_time = SYSTEMTIME {
-        wYear: date.year() as u16,
-        wMonth: date.month() as u16,
-        // Ignored
-        wDayOfWeek: 0,
-        wDay: date.day() as u16,
-        wHour: date.hour() as u16,
-        wMinute: date.minute() as u16,
-        wSecond: date.second() as u16,
-        // TODO: be careful of leap seconds - valid range is [0, 999] - how to handle?
-        wMilliseconds: ((date.nanosecond() / 1_000_000) % 1000) as u16,
+#[cfg(windows)]
+/// System call to set date (Windows).
+/// See here for more:
+/// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-setsystemtime
+/// https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime
+fn set_system_datetime(date: DateTime<Utc>) -> UResult<()> {
+    let system_time = SYSTEMTIME {
+        wYear: date.year() as u16,
+        wMonth: date.month() as u16,
+        // Ignored
+        wDayOfWeek: 0,
+        wDay: date.day() as u16,
+        wHour: date.hour() as u16,
+        wMinute: date.minute() as u16,
+        wSecond: date.second() as u16,
+        // TODO: be careful of leap seconds - valid range is [0, 999] - how to handle?
+        wMilliseconds: ((date.nanosecond() / 1_000_000) % 1000) as u16,
     };
 
-    let result = unsafe { SetSystemTime(&system_time) };
+    let result = unsafe { SetSystemTime(&system_time) };
 
-    if result == 0 {
-        Err(std::io::Error::last_os_error().map_err_context(|| "cannot set date".to_string()))
-    } else {
+    if result == 0 {
+        Err(std::io::Error::last_os_error().map_err_context(|| "cannot set date".to_string()))
+    } else {
         Ok(())
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dd/blocks.rs.html b/dev/src/uu_dd/blocks.rs.html index 674dc9e5d..ab0e7d52f 100644 --- a/dev/src/uu_dd/blocks.rs.html +++ b/dev/src/uu_dd/blocks.rs.html @@ -1,4 +1,4 @@ -blocks.rs - source
1
+blocks.rs - source
1
 2
 3
 4
@@ -372,379 +372,379 @@
 372
 373
 374
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore datastructures rstat rposition cflags ctable
+// spell-checker:ignore datastructures rstat rposition cflags ctable
 
-use crate::conversion_tables::ConversionTable;
-use crate::datastructures::ConversionMode;
-use crate::progress::ReadStat;
+use crate::conversion_tables::ConversionTable;
+use crate::datastructures::ConversionMode;
+use crate::progress::ReadStat;
 
-const NEWLINE: u8 = b'\n';
-const SPACE: u8 = b' ';
+const NEWLINE: u8 = b'\n';
+const SPACE: u8 = b' ';
 
-/// Split a slice into chunks, padding or truncating as necessary.
-///
-/// The slice `buf` is split on newlines, then each block is resized
-/// to `cbs` bytes, padding with spaces if necessary. This function
-/// expects the input bytes to be ASCII-encoded.
-///
-/// If `sync` is true and there has been at least one partial record
-/// read from the input (as indicated in `rstat`), then leave an
-/// all-spaces block at the end. Otherwise, remove the last block if
-/// it is all spaces.
-fn block(buf: &[u8], cbs: usize, sync: bool, rstat: &mut ReadStat) -> Vec<Vec<u8>> {
-    let mut blocks = buf
-        .split(|&e| e == NEWLINE)
-        .map(|split| split.to_vec())
-        .fold(Vec::new(), |mut blocks, mut split| {
-            if split.len() > cbs {
-                rstat.records_truncated += 1;
+/// Split a slice into chunks, padding or truncating as necessary.
+///
+/// The slice `buf` is split on newlines, then each block is resized
+/// to `cbs` bytes, padding with spaces if necessary. This function
+/// expects the input bytes to be ASCII-encoded.
+///
+/// If `sync` is true and there has been at least one partial record
+/// read from the input (as indicated in `rstat`), then leave an
+/// all-spaces block at the end. Otherwise, remove the last block if
+/// it is all spaces.
+fn block(buf: &[u8], cbs: usize, sync: bool, rstat: &mut ReadStat) -> Vec<Vec<u8>> {
+    let mut blocks = buf
+        .split(|&e| e == NEWLINE)
+        .map(|split| split.to_vec())
+        .fold(Vec::new(), |mut blocks, mut split| {
+            if split.len() > cbs {
+                rstat.records_truncated += 1;
             }
-            split.resize(cbs, SPACE);
-            blocks.push(split);
+            split.resize(cbs, SPACE);
+            blocks.push(split);
 
-            blocks
+            blocks
         });
 
-    // If `sync` is true and there has been at least one partial
-    // record read from the input, then leave the all-spaces block at
-    // the end. Otherwise, remove it.
-    if let Some(last) = blocks.last() {
-        if (!sync || rstat.reads_partial == 0) && last.iter().all(|&e| e == SPACE) {
-            blocks.pop();
+    // If `sync` is true and there has been at least one partial
+    // record read from the input, then leave the all-spaces block at
+    // the end. Otherwise, remove it.
+    if let Some(last) = blocks.last() {
+        if (!sync || rstat.reads_partial == 0) && last.iter().all(|&e| e == SPACE) {
+            blocks.pop();
         }
     }
 
-    blocks
+    blocks
 }
 
-/// Trims padding from each cbs-length partition of buf
-/// as specified by conv=unblock and cbs=N
-/// Expects ascii encoded data
-fn unblock(buf: &[u8], cbs: usize) -> Vec<u8> {
-    buf.chunks(cbs).fold(Vec::new(), |mut acc, block| {
-        if let Some(last_char_idx) = block.iter().rposition(|&e| e != SPACE) {
-            // Include text up to last space.
-            acc.extend(&block[..=last_char_idx]);
+/// Trims padding from each cbs-length partition of buf
+/// as specified by conv=unblock and cbs=N
+/// Expects ascii encoded data
+fn unblock(buf: &[u8], cbs: usize) -> Vec<u8> {
+    buf.chunks(cbs).fold(Vec::new(), |mut acc, block| {
+        if let Some(last_char_idx) = block.iter().rposition(|&e| e != SPACE) {
+            // Include text up to last space.
+            acc.extend(&block[..=last_char_idx]);
         }
 
-        acc.push(NEWLINE);
-        acc
+        acc.push(NEWLINE);
+        acc
     })
 }
 
-/// Apply the specified conversion, blocking, and/or unblocking in the right order.
-///
-/// The `mode` specifies the combination of conversion, blocking, and
-/// unblocking to apply and the order in which to apply it. This
-/// function is responsible only for applying the operations.
-///
-/// `buf` is the buffer of input bytes to transform. This function
-/// mutates this input and also returns a new buffer of bytes
-/// representing the result of the transformation.
-///
-/// `rstat` maintains a running total of the number of partial and
-/// complete blocks read before calling this function. In certain
-/// settings of `mode`, this function will update the number of
-/// records truncated; that's why `rstat` is borrowed mutably.
-pub(crate) fn conv_block_unblock_helper(
-    buf: Vec<u8>,
-    mode: &ConversionMode,
-    rstat: &mut ReadStat,
-) -> Vec<u8> {
-    fn apply_conversion(buf: Vec<u8>, ct: &ConversionTable) -> impl Iterator<Item = u8> + '_ {
-        buf.into_iter().map(|b| ct[b as usize])
+/// Apply the specified conversion, blocking, and/or unblocking in the right order.
+///
+/// The `mode` specifies the combination of conversion, blocking, and
+/// unblocking to apply and the order in which to apply it. This
+/// function is responsible only for applying the operations.
+///
+/// `buf` is the buffer of input bytes to transform. This function
+/// mutates this input and also returns a new buffer of bytes
+/// representing the result of the transformation.
+///
+/// `rstat` maintains a running total of the number of partial and
+/// complete blocks read before calling this function. In certain
+/// settings of `mode`, this function will update the number of
+/// records truncated; that's why `rstat` is borrowed mutably.
+pub(crate) fn conv_block_unblock_helper(
+    buf: Vec<u8>,
+    mode: &ConversionMode,
+    rstat: &mut ReadStat,
+) -> Vec<u8> {
+    fn apply_conversion(buf: Vec<u8>, ct: &ConversionTable) -> impl Iterator<Item = u8> + '_ {
+        buf.into_iter().map(|b| ct[b as usize])
     }
 
-    match mode {
-        ConversionMode::ConvertOnly(ct) => apply_conversion(buf, ct).collect(),
-        ConversionMode::BlockThenConvert(ct, cbs, sync) => {
-            let blocks = block(&buf, *cbs, *sync, rstat);
-            blocks
-                .into_iter()
-                .flat_map(|block| apply_conversion(block, ct))
-                .collect()
+    match mode {
+        ConversionMode::ConvertOnly(ct) => apply_conversion(buf, ct).collect(),
+        ConversionMode::BlockThenConvert(ct, cbs, sync) => {
+            let blocks = block(&buf, *cbs, *sync, rstat);
+            blocks
+                .into_iter()
+                .flat_map(|block| apply_conversion(block, ct))
+                .collect()
         }
-        ConversionMode::ConvertThenBlock(ct, cbs, sync) => {
-            let buf: Vec<_> = apply_conversion(buf, ct).collect();
-            block(&buf, *cbs, *sync, rstat)
-                .into_iter()
-                .flatten()
-                .collect()
+        ConversionMode::ConvertThenBlock(ct, cbs, sync) => {
+            let buf: Vec<_> = apply_conversion(buf, ct).collect();
+            block(&buf, *cbs, *sync, rstat)
+                .into_iter()
+                .flatten()
+                .collect()
         }
-        ConversionMode::BlockOnly(cbs, sync) => block(&buf, *cbs, *sync, rstat)
-            .into_iter()
-            .flatten()
-            .collect(),
-        ConversionMode::UnblockThenConvert(ct, cbs) => {
-            let buf = unblock(&buf, *cbs);
-            apply_conversion(buf, ct).collect()
+        ConversionMode::BlockOnly(cbs, sync) => block(&buf, *cbs, *sync, rstat)
+            .into_iter()
+            .flatten()
+            .collect(),
+        ConversionMode::UnblockThenConvert(ct, cbs) => {
+            let buf = unblock(&buf, *cbs);
+            apply_conversion(buf, ct).collect()
         }
-        ConversionMode::ConvertThenUnblock(ct, cbs) => {
-            let buf: Vec<_> = apply_conversion(buf, ct).collect();
-            unblock(&buf, *cbs)
+        ConversionMode::ConvertThenUnblock(ct, cbs) => {
+            let buf: Vec<_> = apply_conversion(buf, ct).collect();
+            unblock(&buf, *cbs)
         }
-        ConversionMode::UnblockOnly(cbs) => unblock(&buf, *cbs),
+        ConversionMode::UnblockOnly(cbs) => unblock(&buf, *cbs),
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use crate::blocks::{block, unblock};
-    use crate::progress::ReadStat;
+    use crate::blocks::{block, unblock};
+    use crate::progress::ReadStat;
 
-    const NEWLINE: u8 = b'\n';
-    const SPACE: u8 = b' ';
+    const NEWLINE: u8 = b'\n';
+    const SPACE: u8 = b' ';
 
-    #[test]
-    fn block_test_no_nl() {
-        let mut rs = ReadStat::default();
-        let buf = [0u8, 1u8, 2u8, 3u8];
-        let res = block(&buf, 4, false, &mut rs);
+    #[test]
+    fn block_test_no_nl() {
+        let mut rs = ReadStat::default();
+        let buf = [0u8, 1u8, 2u8, 3u8];
+        let res = block(&buf, 4, false, &mut rs);
 
-        assert_eq!(res, vec![vec![0u8, 1u8, 2u8, 3u8],]);
+        assert_eq!(res, vec![vec![0u8, 1u8, 2u8, 3u8],]);
     }
 
-    #[test]
-    fn block_test_no_nl_short_record() {
-        let mut rs = ReadStat::default();
-        let buf = [0u8, 1u8, 2u8, 3u8];
-        let res = block(&buf, 8, false, &mut rs);
+    #[test]
+    fn block_test_no_nl_short_record() {
+        let mut rs = ReadStat::default();
+        let buf = [0u8, 1u8, 2u8, 3u8];
+        let res = block(&buf, 8, false, &mut rs);
 
         assert_eq!(
-            res,
-            vec![vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],]
+            res,
+            vec![vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],]
         );
     }
 
-    #[test]
-    fn block_test_no_nl_trunc() {
-        let mut rs = ReadStat::default();
-        let buf = [0u8, 1u8, 2u8, 3u8, 4u8];
-        let res = block(&buf, 4, false, &mut rs);
+    #[test]
+    fn block_test_no_nl_trunc() {
+        let mut rs = ReadStat::default();
+        let buf = [0u8, 1u8, 2u8, 3u8, 4u8];
+        let res = block(&buf, 4, false, &mut rs);
 
-        // Commented section(s) should be truncated and appear for reference only.
-        assert_eq!(res, vec![vec![0u8, 1u8, 2u8, 3u8 /*, 4u8*/],]);
-        assert_eq!(rs.records_truncated, 1);
+        // Commented section(s) should be truncated and appear for reference only.
+        assert_eq!(res, vec![vec![0u8, 1u8, 2u8, 3u8 /*, 4u8*/],]);
+        assert_eq!(rs.records_truncated, 1);
     }
 
-    #[test]
-    fn block_test_nl_gt_cbs_trunc() {
-        let mut rs = ReadStat::default();
-        let buf = [
-            0u8, 1u8, 2u8, 3u8, 4u8, NEWLINE, 0u8, 1u8, 2u8, 3u8, 4u8, NEWLINE, 5u8, 6u8, 7u8, 8u8,
+    #[test]
+    fn block_test_nl_gt_cbs_trunc() {
+        let mut rs = ReadStat::default();
+        let buf = [
+            0u8, 1u8, 2u8, 3u8, 4u8, NEWLINE, 0u8, 1u8, 2u8, 3u8, 4u8, NEWLINE, 5u8, 6u8, 7u8, 8u8,
         ];
-        let res = block(&buf, 4, false, &mut rs);
+        let res = block(&buf, 4, false, &mut rs);
 
         assert_eq!(
-            res,
+            res,
             vec![
-                // Commented section(s) should be truncated and appear for reference only.
-                vec![0u8, 1u8, 2u8, 3u8],
-                // vec![4u8, SPACE, SPACE, SPACE],
-                vec![0u8, 1u8, 2u8, 3u8],
-                // vec![4u8, SPACE, SPACE, SPACE],
-                vec![5u8, 6u8, 7u8, 8u8],
+                // Commented section(s) should be truncated and appear for reference only.
+                vec![0u8, 1u8, 2u8, 3u8],
+                // vec![4u8, SPACE, SPACE, SPACE],
+                vec![0u8, 1u8, 2u8, 3u8],
+                // vec![4u8, SPACE, SPACE, SPACE],
+                vec![5u8, 6u8, 7u8, 8u8],
             ]
         );
-        assert_eq!(rs.records_truncated, 2);
+        assert_eq!(rs.records_truncated, 2);
     }
 
-    #[test]
-    fn block_test_surrounded_nl() {
-        let mut rs = ReadStat::default();
-        let buf = [0u8, 1u8, 2u8, 3u8, NEWLINE, 4u8, 5u8, 6u8, 7u8, 8u8];
-        let res = block(&buf, 8, false, &mut rs);
+    #[test]
+    fn block_test_surrounded_nl() {
+        let mut rs = ReadStat::default();
+        let buf = [0u8, 1u8, 2u8, 3u8, NEWLINE, 4u8, 5u8, 6u8, 7u8, 8u8];
+        let res = block(&buf, 8, false, &mut rs);
 
         assert_eq!(
-            res,
+            res,
             vec![
-                vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
-                vec![4u8, 5u8, 6u8, 7u8, 8u8, SPACE, SPACE, SPACE],
+                vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
+                vec![4u8, 5u8, 6u8, 7u8, 8u8, SPACE, SPACE, SPACE],
             ]
         );
     }
 
-    #[test]
-    fn block_test_multiple_nl_same_cbs_block() {
-        let mut rs = ReadStat::default();
-        let buf = [
-            0u8, 1u8, 2u8, 3u8, NEWLINE, 4u8, NEWLINE, 5u8, 6u8, 7u8, 8u8, 9u8,
+    #[test]
+    fn block_test_multiple_nl_same_cbs_block() {
+        let mut rs = ReadStat::default();
+        let buf = [
+            0u8, 1u8, 2u8, 3u8, NEWLINE, 4u8, NEWLINE, 5u8, 6u8, 7u8, 8u8, 9u8,
         ];
-        let res = block(&buf, 8, false, &mut rs);
+        let res = block(&buf, 8, false, &mut rs);
 
         assert_eq!(
-            res,
+            res,
             vec![
-                vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
-                vec![4u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
-                vec![5u8, 6u8, 7u8, 8u8, 9u8, SPACE, SPACE, SPACE],
+                vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
+                vec![4u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
+                vec![5u8, 6u8, 7u8, 8u8, 9u8, SPACE, SPACE, SPACE],
             ]
         );
     }
 
-    #[test]
-    fn block_test_multiple_nl_diff_cbs_block() {
-        let mut rs = ReadStat::default();
-        let buf = [
-            0u8, 1u8, 2u8, 3u8, NEWLINE, 4u8, 5u8, 6u8, 7u8, NEWLINE, 8u8, 9u8,
+    #[test]
+    fn block_test_multiple_nl_diff_cbs_block() {
+        let mut rs = ReadStat::default();
+        let buf = [
+            0u8, 1u8, 2u8, 3u8, NEWLINE, 4u8, 5u8, 6u8, 7u8, NEWLINE, 8u8, 9u8,
         ];
-        let res = block(&buf, 8, false, &mut rs);
+        let res = block(&buf, 8, false, &mut rs);
 
         assert_eq!(
-            res,
+            res,
             vec![
-                vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
-                vec![4u8, 5u8, 6u8, 7u8, SPACE, SPACE, SPACE, SPACE],
-                vec![8u8, 9u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
+                vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
+                vec![4u8, 5u8, 6u8, 7u8, SPACE, SPACE, SPACE, SPACE],
+                vec![8u8, 9u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
             ]
         );
     }
 
-    #[test]
-    fn block_test_end_nl_diff_cbs_block() {
-        let mut rs = ReadStat::default();
-        let buf = [0u8, 1u8, 2u8, 3u8, NEWLINE];
-        let res = block(&buf, 4, false, &mut rs);
+    #[test]
+    fn block_test_end_nl_diff_cbs_block() {
+        let mut rs = ReadStat::default();
+        let buf = [0u8, 1u8, 2u8, 3u8, NEWLINE];
+        let res = block(&buf, 4, false, &mut rs);
 
-        assert_eq!(res, vec![vec![0u8, 1u8, 2u8, 3u8],]);
+        assert_eq!(res, vec![vec![0u8, 1u8, 2u8, 3u8],]);
     }
 
-    #[test]
-    fn block_test_end_nl_same_cbs_block() {
-        let mut rs = ReadStat::default();
-        let buf = [0u8, 1u8, 2u8, NEWLINE];
-        let res = block(&buf, 4, false, &mut rs);
+    #[test]
+    fn block_test_end_nl_same_cbs_block() {
+        let mut rs = ReadStat::default();
+        let buf = [0u8, 1u8, 2u8, NEWLINE];
+        let res = block(&buf, 4, false, &mut rs);
 
-        assert_eq!(res, vec![vec![0u8, 1u8, 2u8, SPACE]]);
+        assert_eq!(res, vec![vec![0u8, 1u8, 2u8, SPACE]]);
     }
 
-    #[test]
-    fn block_test_double_end_nl() {
-        let mut rs = ReadStat::default();
-        let buf = [0u8, 1u8, 2u8, NEWLINE, NEWLINE];
-        let res = block(&buf, 4, false, &mut rs);
+    #[test]
+    fn block_test_double_end_nl() {
+        let mut rs = ReadStat::default();
+        let buf = [0u8, 1u8, 2u8, NEWLINE, NEWLINE];
+        let res = block(&buf, 4, false, &mut rs);
 
         assert_eq!(
-            res,
-            vec![vec![0u8, 1u8, 2u8, SPACE], vec![SPACE, SPACE, SPACE, SPACE],]
+            res,
+            vec![vec![0u8, 1u8, 2u8, SPACE], vec![SPACE, SPACE, SPACE, SPACE],]
         );
     }
 
-    #[test]
-    fn block_test_start_nl() {
-        let mut rs = ReadStat::default();
-        let buf = [NEWLINE, 0u8, 1u8, 2u8, 3u8];
-        let res = block(&buf, 4, false, &mut rs);
+    #[test]
+    fn block_test_start_nl() {
+        let mut rs = ReadStat::default();
+        let buf = [NEWLINE, 0u8, 1u8, 2u8, 3u8];
+        let res = block(&buf, 4, false, &mut rs);
 
         assert_eq!(
-            res,
-            vec![vec![SPACE, SPACE, SPACE, SPACE], vec![0u8, 1u8, 2u8, 3u8],]
+            res,
+            vec![vec![SPACE, SPACE, SPACE, SPACE], vec![0u8, 1u8, 2u8, 3u8],]
         );
     }
 
-    #[test]
-    fn block_test_double_surrounded_nl_no_trunc() {
-        let mut rs = ReadStat::default();
-        let buf = [0u8, 1u8, 2u8, 3u8, NEWLINE, NEWLINE, 4u8, 5u8, 6u8, 7u8];
-        let res = block(&buf, 8, false, &mut rs);
+    #[test]
+    fn block_test_double_surrounded_nl_no_trunc() {
+        let mut rs = ReadStat::default();
+        let buf = [0u8, 1u8, 2u8, 3u8, NEWLINE, NEWLINE, 4u8, 5u8, 6u8, 7u8];
+        let res = block(&buf, 8, false, &mut rs);
 
         assert_eq!(
-            res,
+            res,
             vec![
-                vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
-                vec![SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
-                vec![4u8, 5u8, 6u8, 7u8, SPACE, SPACE, SPACE, SPACE],
+                vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
+                vec![SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
+                vec![4u8, 5u8, 6u8, 7u8, SPACE, SPACE, SPACE, SPACE],
             ]
         );
     }
 
-    #[test]
-    fn block_test_double_surrounded_nl_double_trunc() {
-        let mut rs = ReadStat::default();
-        let buf = [
-            0u8, 1u8, 2u8, 3u8, NEWLINE, NEWLINE, 4u8, 5u8, 6u8, 7u8, 8u8,
+    #[test]
+    fn block_test_double_surrounded_nl_double_trunc() {
+        let mut rs = ReadStat::default();
+        let buf = [
+            0u8, 1u8, 2u8, 3u8, NEWLINE, NEWLINE, 4u8, 5u8, 6u8, 7u8, 8u8,
         ];
-        let res = block(&buf, 4, false, &mut rs);
+        let res = block(&buf, 4, false, &mut rs);
 
         assert_eq!(
-            res,
+            res,
             vec![
-                // Commented section(s) should be truncated and appear for reference only.
-                vec![0u8, 1u8, 2u8, 3u8],
-                vec![SPACE, SPACE, SPACE, SPACE],
-                vec![4u8, 5u8, 6u8, 7u8 /*, 8u8*/],
+                // Commented section(s) should be truncated and appear for reference only.
+                vec![0u8, 1u8, 2u8, 3u8],
+                vec![SPACE, SPACE, SPACE, SPACE],
+                vec![4u8, 5u8, 6u8, 7u8 /*, 8u8*/],
             ]
         );
-        assert_eq!(rs.records_truncated, 1);
+        assert_eq!(rs.records_truncated, 1);
     }
 
-    #[test]
-    fn unblock_test_full_cbs() {
-        let buf = [0u8, 1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8];
-        let res = unblock(&buf, 8);
+    #[test]
+    fn unblock_test_full_cbs() {
+        let buf = [0u8, 1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8];
+        let res = unblock(&buf, 8);
 
-        assert_eq!(res, vec![0u8, 1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, NEWLINE],);
+        assert_eq!(res, vec![0u8, 1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, NEWLINE],);
     }
 
-    #[test]
-    fn unblock_test_all_space() {
-        let buf = [SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE];
-        let res = unblock(&buf, 8);
+    #[test]
+    fn unblock_test_all_space() {
+        let buf = [SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE];
+        let res = unblock(&buf, 8);
 
-        assert_eq!(res, vec![NEWLINE],);
+        assert_eq!(res, vec![NEWLINE],);
     }
 
-    #[test]
-    fn unblock_test_decoy_spaces() {
-        let buf = [0u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, 7u8];
-        let res = unblock(&buf, 8);
+    #[test]
+    fn unblock_test_decoy_spaces() {
+        let buf = [0u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, 7u8];
+        let res = unblock(&buf, 8);
 
         assert_eq!(
-            res,
-            vec![0u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, 7u8, NEWLINE],
+            res,
+            vec![0u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, 7u8, NEWLINE],
         );
     }
 
-    #[test]
-    fn unblock_test_strip_single_cbs() {
-        let buf = [0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE];
-        let res = unblock(&buf, 8);
+    #[test]
+    fn unblock_test_strip_single_cbs() {
+        let buf = [0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE];
+        let res = unblock(&buf, 8);
 
-        assert_eq!(res, vec![0u8, 1u8, 2u8, 3u8, NEWLINE],);
+        assert_eq!(res, vec![0u8, 1u8, 2u8, 3u8, NEWLINE],);
     }
 
-    #[test]
-    fn unblock_test_strip_multi_cbs() {
-        let buf = vec![
-            vec![0u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
-            vec![0u8, 1u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
-            vec![0u8, 1u8, 2u8, SPACE, SPACE, SPACE, SPACE, SPACE],
-            vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
+    #[test]
+    fn unblock_test_strip_multi_cbs() {
+        let buf = vec![
+            vec![0u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
+            vec![0u8, 1u8, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE],
+            vec![0u8, 1u8, 2u8, SPACE, SPACE, SPACE, SPACE, SPACE],
+            vec![0u8, 1u8, 2u8, 3u8, SPACE, SPACE, SPACE, SPACE],
         ]
-        .into_iter()
-        .flatten()
-        .collect::<Vec<_>>();
+        .into_iter()
+        .flatten()
+        .collect::<Vec<_>>();
 
-        let res = unblock(&buf, 8);
+        let res = unblock(&buf, 8);
 
-        let exp = vec![
-            vec![0u8, NEWLINE],
-            vec![0u8, 1u8, NEWLINE],
-            vec![0u8, 1u8, 2u8, NEWLINE],
-            vec![0u8, 1u8, 2u8, 3u8, NEWLINE],
+        let exp = vec![
+            vec![0u8, NEWLINE],
+            vec![0u8, 1u8, NEWLINE],
+            vec![0u8, 1u8, 2u8, NEWLINE],
+            vec![0u8, 1u8, 2u8, 3u8, NEWLINE],
         ]
-        .into_iter()
-        .flatten()
-        .collect::<Vec<_>>();
+        .into_iter()
+        .flatten()
+        .collect::<Vec<_>>();
 
-        assert_eq!(res, exp);
+        assert_eq!(res, exp);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dd/conversion_tables.rs.html b/dev/src/uu_dd/conversion_tables.rs.html index ab577cd5c..ae9e58224 100644 --- a/dev/src/uu_dd/conversion_tables.rs.html +++ b/dev/src/uu_dd/conversion_tables.rs.html @@ -1,4 +1,4 @@ -conversion_tables.rs - source
1
+conversion_tables.rs - source
1
 2
 3
 4
@@ -219,20 +219,20 @@
 219
 220
 221
-
// This file is part of the uutils coreutils package.
-//
-// (c) Tyler Steele <tyler.steele@protonmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Tyler Steele <tyler.steele@protonmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// Note: Conversion tables are just lookup tables.
-// eg. The ASCII->EBCDIC table stores the EBCDIC code at the index
-// obtained by treating the ASCII representation as a number.
+// Note: Conversion tables are just lookup tables.
+// eg. The ASCII->EBCDIC table stores the EBCDIC code at the index
+// obtained by treating the ASCII representation as a number.
 
-pub type ConversionTable = [u8; 256];
+pub type ConversionTable = [u8; 256];
 
-pub const ASCII_UCASE_TO_LCASE: ConversionTable = [
+pub const ASCII_UCASE_TO_LCASE: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
     0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
@@ -251,7 +251,7 @@
     0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const ASCII_LCASE_TO_UCASE: ConversionTable = [
+pub const ASCII_LCASE_TO_UCASE: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
     0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
@@ -270,7 +270,7 @@
     0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const ASCII_TO_EBCDIC: ConversionTable = [
+pub const ASCII_TO_EBCDIC: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
     0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
@@ -289,7 +289,7 @@
     0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const ASCII_TO_EBCDIC_UCASE_TO_LCASE: ConversionTable = [
+pub const ASCII_TO_EBCDIC_UCASE_TO_LCASE: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
     0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
@@ -308,7 +308,7 @@
     0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const ASCII_TO_EBCDIC_LCASE_TO_UCASE: ConversionTable = [
+pub const ASCII_TO_EBCDIC_LCASE_TO_UCASE: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
     0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
@@ -327,7 +327,7 @@
     0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const ASCII_TO_IBM: ConversionTable = [
+pub const ASCII_TO_IBM: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
     0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
@@ -346,7 +346,7 @@
     0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const ASCII_TO_IBM_UCASE_TO_LCASE: ConversionTable = [
+pub const ASCII_TO_IBM_UCASE_TO_LCASE: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
     0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
@@ -365,7 +365,7 @@
     0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const ASCII_TO_IBM_LCASE_TO_UCASE: ConversionTable = [
+pub const ASCII_TO_IBM_LCASE_TO_UCASE: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
     0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
@@ -384,7 +384,7 @@
     0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const EBCDIC_TO_ASCII: ConversionTable = [
+pub const EBCDIC_TO_ASCII: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f, 0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x9d, 0x85, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
     0x80, 0x81, 0x82, 0x83, 0x84, 0x0a, 0x17, 0x1b, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
@@ -403,7 +403,7 @@
     0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const EBCDIC_TO_ASCII_UCASE_TO_LCASE: ConversionTable = [
+pub const EBCDIC_TO_ASCII_UCASE_TO_LCASE: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
     0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
@@ -422,7 +422,7 @@
     0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-pub const EBCDIC_TO_ASCII_LCASE_TO_UCASE: ConversionTable = [
+pub const EBCDIC_TO_ASCII_LCASE_TO_UCASE: ConversionTable = [
     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x25, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
     0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
@@ -441,4 +441,4 @@
     0xdc, 0xdd, 0xde, 0xdf, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 ];
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dd/datastructures.rs.html b/dev/src/uu_dd/datastructures.rs.html index 1959c32b9..b1a10a4f1 100644 --- a/dev/src/uu_dd/datastructures.rs.html +++ b/dev/src/uu_dd/datastructures.rs.html @@ -1,4 +1,4 @@ -datastructures.rs - source
1
+datastructures.rs - source
1
 2
 3
 4
@@ -91,98 +91,98 @@
 91
 92
 93
-
// This file is part of the uutils coreutils package.
-//
-// (c) Tyler Steele <tyler.steele@protonmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
-// spell-checker:ignore ctable, outfile, iseek, oseek
+
// This file is part of the uutils coreutils package.
+//
+// (c) Tyler Steele <tyler.steele@protonmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
+// spell-checker:ignore ctable, outfile, iseek, oseek
 
-use crate::conversion_tables::*;
+use crate::conversion_tables::*;
 
-type Cbs = usize;
+type Cbs = usize;
 
-/// How to apply conversion, blocking, and/or unblocking.
-///
-/// Certain settings of the `conv` parameter to `dd` require a
-/// combination of conversion, blocking, or unblocking, applied in a
-/// certain order. The variants of this enumeration give the different
-/// ways of combining those three operations.
-#[derive(Debug, PartialEq)]
-pub(crate) enum ConversionMode {
-    ConvertOnly(&'static ConversionTable),
-    BlockOnly(Cbs, bool),
-    UnblockOnly(Cbs),
-    BlockThenConvert(&'static ConversionTable, Cbs, bool),
-    ConvertThenBlock(&'static ConversionTable, Cbs, bool),
-    UnblockThenConvert(&'static ConversionTable, Cbs),
-    ConvertThenUnblock(&'static ConversionTable, Cbs),
+/// How to apply conversion, blocking, and/or unblocking.
+///
+/// Certain settings of the `conv` parameter to `dd` require a
+/// combination of conversion, blocking, or unblocking, applied in a
+/// certain order. The variants of this enumeration give the different
+/// ways of combining those three operations.
+#[derive(Debug, PartialEq)]
+pub(crate) enum ConversionMode {
+    ConvertOnly(&'static ConversionTable),
+    BlockOnly(Cbs, bool),
+    UnblockOnly(Cbs),
+    BlockThenConvert(&'static ConversionTable, Cbs, bool),
+    ConvertThenBlock(&'static ConversionTable, Cbs, bool),
+    UnblockThenConvert(&'static ConversionTable, Cbs),
+    ConvertThenUnblock(&'static ConversionTable, Cbs),
 }
 
-/// Stores all Conv Flags that apply to the input
-#[derive(Debug, Default, PartialEq)]
-pub(crate) struct IConvFlags {
-    pub mode: Option<ConversionMode>,
-    pub swab: bool,
-    pub sync: Option<u8>,
-    pub noerror: bool,
+/// Stores all Conv Flags that apply to the input
+#[derive(Debug, Default, PartialEq)]
+pub(crate) struct IConvFlags {
+    pub mode: Option<ConversionMode>,
+    pub swab: bool,
+    pub sync: Option<u8>,
+    pub noerror: bool,
 }
 
-/// Stores all Conv Flags that apply to the output
-#[derive(Debug, Default, PartialEq, Eq)]
-pub struct OConvFlags {
-    pub sparse: bool,
-    pub excl: bool,
-    pub nocreat: bool,
-    pub notrunc: bool,
-    pub fdatasync: bool,
-    pub fsync: bool,
+/// Stores all Conv Flags that apply to the output
+#[derive(Debug, Default, PartialEq, Eq)]
+pub struct OConvFlags {
+    pub sparse: bool,
+    pub excl: bool,
+    pub nocreat: bool,
+    pub notrunc: bool,
+    pub fdatasync: bool,
+    pub fsync: bool,
 }
 
-/// Stores all Flags that apply to the input
-#[derive(Debug, Default, PartialEq, Eq)]
-pub struct IFlags {
-    pub cio: bool,
-    pub direct: bool,
-    pub directory: bool,
-    pub dsync: bool,
-    pub sync: bool,
-    pub nocache: bool,
-    pub nonblock: bool,
-    pub noatime: bool,
-    pub noctty: bool,
-    pub nofollow: bool,
-    pub nolinks: bool,
-    pub binary: bool,
-    pub text: bool,
-    pub fullblock: bool,
-    pub count_bytes: bool,
-    pub skip_bytes: bool,
+/// Stores all Flags that apply to the input
+#[derive(Debug, Default, PartialEq, Eq)]
+pub struct IFlags {
+    pub cio: bool,
+    pub direct: bool,
+    pub directory: bool,
+    pub dsync: bool,
+    pub sync: bool,
+    pub nocache: bool,
+    pub nonblock: bool,
+    pub noatime: bool,
+    pub noctty: bool,
+    pub nofollow: bool,
+    pub nolinks: bool,
+    pub binary: bool,
+    pub text: bool,
+    pub fullblock: bool,
+    pub count_bytes: bool,
+    pub skip_bytes: bool,
 }
 
-/// Stores all Flags that apply to the output
-#[derive(Debug, Default, PartialEq, Eq)]
-pub struct OFlags {
-    pub append: bool,
-    pub cio: bool,
-    pub direct: bool,
-    pub directory: bool,
-    pub dsync: bool,
-    pub sync: bool,
-    pub nocache: bool,
-    pub nonblock: bool,
-    pub noatime: bool,
-    pub noctty: bool,
-    pub nofollow: bool,
-    pub nolinks: bool,
-    pub binary: bool,
-    pub text: bool,
-    pub seek_bytes: bool,
+/// Stores all Flags that apply to the output
+#[derive(Debug, Default, PartialEq, Eq)]
+pub struct OFlags {
+    pub append: bool,
+    pub cio: bool,
+    pub direct: bool,
+    pub directory: bool,
+    pub dsync: bool,
+    pub sync: bool,
+    pub nocache: bool,
+    pub nonblock: bool,
+    pub noatime: bool,
+    pub noctty: bool,
+    pub nofollow: bool,
+    pub nolinks: bool,
+    pub binary: bool,
+    pub text: bool,
+    pub seek_bytes: bool,
 }
 
-pub mod options {
-    pub const OPERANDS: &str = "operands";
+pub mod options {
+    pub const OPERANDS: &str = "operands";
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dd/dd.rs.html b/dev/src/uu_dd/dd.rs.html index a58050da4..52d660d45 100644 --- a/dev/src/uu_dd/dd.rs.html +++ b/dev/src/uu_dd/dd.rs.html @@ -1,4 +1,4 @@ -dd.rs - source
1
+dd.rs - source
1
 2
 3
 4
@@ -977,984 +977,984 @@
 977
 978
 979
-
// This file is part of the uutils coreutils package.
-//
-// (c) Tyler Steele <tyler.steele@protonmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Tyler Steele <tyler.steele@protonmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, behaviour, bmax, bremain, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, iseek, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, oseek, outfile, parseargs, rlen, rmax, rremain, rsofar, rstat, sigusr, wlen, wstat seekable oconv canonicalized
+// spell-checker:ignore fname, tname, fpath, specfile, testfile, unspec, ifile, ofile, outfile, fullblock, urand, fileio, atoe, atoibm, behaviour, bmax, bremain, cflags, creat, ctable, ctty, datastructures, doesnt, etoa, fileout, fname, gnudd, iconvflags, iseek, nocache, noctty, noerror, nofollow, nolinks, nonblock, oconvflags, oseek, outfile, parseargs, rlen, rmax, rremain, rsofar, rstat, sigusr, wlen, wstat seekable oconv canonicalized
 
-mod datastructures;
-use datastructures::*;
+mod datastructures;
+use datastructures::*;
 
-mod parseargs;
-use parseargs::Parser;
+mod parseargs;
+use parseargs::Parser;
 
-mod conversion_tables;
+mod conversion_tables;
 
-mod progress;
-use progress::{gen_prog_updater, ProgUpdate, ReadStat, StatusLevel, WriteStat};
+mod progress;
+use progress::{gen_prog_updater, ProgUpdate, ReadStat, StatusLevel, WriteStat};
 
-mod blocks;
-use blocks::conv_block_unblock_helper;
+mod blocks;
+use blocks::conv_block_unblock_helper;
 
-use std::cmp;
-use std::env;
-use std::ffi::OsString;
-use std::fs::{File, OpenOptions};
-use std::io::{self, Read, Seek, SeekFrom, Write};
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use std::os::unix::fs::OpenOptionsExt;
-use std::path::Path;
-use std::sync::mpsc;
-use std::thread;
-use std::time;
+use std::cmp;
+use std::env;
+use std::ffi::OsString;
+use std::fs::{File, OpenOptions};
+use std::io::{self, Read, Seek, SeekFrom, Write};
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use std::os::unix::fs::OpenOptionsExt;
+use std::path::Path;
+use std::sync::mpsc;
+use std::thread;
+use std::time;
 
-use clap::{crate_version, Arg, Command};
-use gcd::Gcd;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult};
-use uucore::help_section;
-use uucore::show_error;
+use clap::{crate_version, Arg, Command};
+use gcd::Gcd;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult};
+use uucore::help_section;
+use uucore::show_error;
 
-const ABOUT: &str = help_section!("about", "dd.md");
-const AFTER_HELP: &str = help_section!("after help", "dd.md");
-const BUF_INIT_BYTE: u8 = 0xDD;
+const ABOUT: &str = help_section!("about", "dd.md");
+const AFTER_HELP: &str = help_section!("after help", "dd.md");
+const BUF_INIT_BYTE: u8 = 0xDD;
 
-/// Final settings after parsing
-#[derive(Default)]
-struct Settings {
-    infile: Option<String>,
-    outfile: Option<String>,
-    ibs: usize,
-    obs: usize,
-    skip: u64,
-    seek: u64,
-    count: Option<Num>,
-    iconv: IConvFlags,
-    iflags: IFlags,
-    oconv: OConvFlags,
-    oflags: OFlags,
-    status: Option<StatusLevel>,
+/// Final settings after parsing
+#[derive(Default)]
+struct Settings {
+    infile: Option<String>,
+    outfile: Option<String>,
+    ibs: usize,
+    obs: usize,
+    skip: u64,
+    seek: u64,
+    count: Option<Num>,
+    iconv: IConvFlags,
+    iflags: IFlags,
+    oconv: OConvFlags,
+    oflags: OFlags,
+    status: Option<StatusLevel>,
 }
 
-/// A number in blocks or bytes
-///
-/// Some values (seek, skip, iseek, oseek) can have values either in blocks or in bytes.
-/// We need to remember this because the size of the blocks (ibs) is only known after parsing
-/// all the arguments.
-#[derive(Clone, Copy, Debug, PartialEq)]
-enum Num {
-    Blocks(u64),
-    Bytes(u64),
+/// A number in blocks or bytes
+///
+/// Some values (seek, skip, iseek, oseek) can have values either in blocks or in bytes.
+/// We need to remember this because the size of the blocks (ibs) is only known after parsing
+/// all the arguments.
+#[derive(Clone, Copy, Debug, PartialEq)]
+enum Num {
+    Blocks(u64),
+    Bytes(u64),
 }
 
-impl Num {
-    fn force_bytes_if(self, force: bool) -> Self {
-        match self {
-            Self::Blocks(n) if force => Self::Bytes(n),
-            count => count,
+impl Num {
+    fn force_bytes_if(self, force: bool) -> Self {
+        match self {
+            Self::Blocks(n) if force => Self::Bytes(n),
+            count => count,
         }
     }
 
-    fn to_bytes(self, block_size: u64) -> u64 {
-        match self {
-            Self::Blocks(n) => n * block_size,
-            Self::Bytes(n) => n,
+    fn to_bytes(self, block_size: u64) -> u64 {
+        match self {
+            Self::Blocks(n) => n * block_size,
+            Self::Bytes(n) => n,
         }
     }
 }
 
-struct Input<'a, R: Read> {
-    src: R,
-    settings: &'a Settings,
+struct Input<'a, R: Read> {
+    src: R,
+    settings: &'a Settings,
 }
 
-impl<'a> Input<'a, io::Stdin> {
-    fn new(settings: &'a Settings) -> UResult<Self> {
-        let mut input = Self {
-            src: io::stdin(),
-            settings,
+impl<'a> Input<'a, io::Stdin> {
+    fn new(settings: &'a Settings) -> UResult<Self> {
+        let mut input = Self {
+            src: io::stdin(),
+            settings,
         };
 
-        if settings.skip > 0 {
-            if let Err(e) = input.read_skip(settings.skip) {
-                if let io::ErrorKind::UnexpectedEof = e.kind() {
+        if settings.skip > 0 {
+            if let Err(e) = input.read_skip(settings.skip) {
+                if let io::ErrorKind::UnexpectedEof = e.kind() {
                     show_error!("'standard input': cannot skip to specified offset");
-                } else {
-                    return io::Result::Err(e)
-                        .map_err_context(|| "I/O error while skipping".to_string());
+                } else {
+                    return io::Result::Err(e)
+                        .map_err_context(|| "I/O error while skipping".to_string());
                 }
             }
         }
 
-        Ok(input)
+        Ok(input)
     }
 }
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-fn make_linux_iflags(iflags: &IFlags) -> Option<libc::c_int> {
-    let mut flag = 0;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+fn make_linux_iflags(iflags: &IFlags) -> Option<libc::c_int> {
+    let mut flag = 0;
 
-    if iflags.direct {
-        flag |= libc::O_DIRECT;
+    if iflags.direct {
+        flag |= libc::O_DIRECT;
     }
-    if iflags.directory {
-        flag |= libc::O_DIRECTORY;
+    if iflags.directory {
+        flag |= libc::O_DIRECTORY;
     }
-    if iflags.dsync {
-        flag |= libc::O_DSYNC;
+    if iflags.dsync {
+        flag |= libc::O_DSYNC;
     }
-    if iflags.noatime {
-        flag |= libc::O_NOATIME;
+    if iflags.noatime {
+        flag |= libc::O_NOATIME;
     }
-    if iflags.noctty {
-        flag |= libc::O_NOCTTY;
+    if iflags.noctty {
+        flag |= libc::O_NOCTTY;
     }
-    if iflags.nofollow {
-        flag |= libc::O_NOFOLLOW;
+    if iflags.nofollow {
+        flag |= libc::O_NOFOLLOW;
     }
-    if iflags.nonblock {
-        flag |= libc::O_NONBLOCK;
+    if iflags.nonblock {
+        flag |= libc::O_NONBLOCK;
     }
-    if iflags.sync {
-        flag |= libc::O_SYNC;
+    if iflags.sync {
+        flag |= libc::O_SYNC;
     }
 
-    if flag != 0 {
-        Some(flag)
-    } else {
-        None
-    }
+    if flag != 0 {
+        Some(flag)
+    } else {
+        None
+    }
 }
 
-impl<'a> Input<'a, File> {
-    fn new(filename: &Path, settings: &'a Settings) -> UResult<Self> {
-        let mut src = {
-            let mut opts = OpenOptions::new();
-            opts.read(true);
+impl<'a> Input<'a, File> {
+    fn new(filename: &Path, settings: &'a Settings) -> UResult<Self> {
+        let mut src = {
+            let mut opts = OpenOptions::new();
+            opts.read(true);
 
-            #[cfg(any(target_os = "linux", target_os = "android"))]
-            if let Some(libc_flags) = make_linux_iflags(&settings.iflags) {
-                opts.custom_flags(libc_flags);
+            #[cfg(any(target_os = "linux", target_os = "android"))]
+            if let Some(libc_flags) = make_linux_iflags(&settings.iflags) {
+                opts.custom_flags(libc_flags);
             }
 
-            opts.open(filename)
-                .map_err_context(|| format!("failed to open {}", filename.quote()))?
-        };
+            opts.open(filename)
+                .map_err_context(|| format!("failed to open {}", filename.quote()))?
+        };
 
-        if settings.skip > 0 {
-            src.seek(io::SeekFrom::Start(settings.skip))
-                .map_err_context(|| "failed to seek in input file".to_string())?;
+        if settings.skip > 0 {
+            src.seek(io::SeekFrom::Start(settings.skip))
+                .map_err_context(|| "failed to seek in input file".to_string())?;
         }
 
-        Ok(Self { src, settings })
+        Ok(Self { src, settings })
     }
 }
 
-impl<'a, R: Read> Read for Input<'a, R> {
-    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
-        let mut base_idx = 0;
-        let target_len = buf.len();
-        loop {
-            match self.src.read(&mut buf[base_idx..]) {
-                Ok(0) => return Ok(base_idx),
-                Ok(rlen) if self.settings.iflags.fullblock => {
-                    base_idx += rlen;
+impl<'a, R: Read> Read for Input<'a, R> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        let mut base_idx = 0;
+        let target_len = buf.len();
+        loop {
+            match self.src.read(&mut buf[base_idx..]) {
+                Ok(0) => return Ok(base_idx),
+                Ok(rlen) if self.settings.iflags.fullblock => {
+                    base_idx += rlen;
 
-                    if base_idx >= target_len {
-                        return Ok(target_len);
+                    if base_idx >= target_len {
+                        return Ok(target_len);
                     }
                 }
-                Ok(len) => return Ok(len),
-                Err(e) if e.kind() == io::ErrorKind::Interrupted => continue,
-                Err(_) if self.settings.iconv.noerror => return Ok(base_idx),
-                Err(e) => return Err(e),
+                Ok(len) => return Ok(len),
+                Err(e) if e.kind() == io::ErrorKind::Interrupted => continue,
+                Err(_) if self.settings.iconv.noerror => return Ok(base_idx),
+                Err(e) => return Err(e),
             }
         }
     }
 }
 
-impl<'a, R: Read> Input<'a, R> {
-    /// Fills a given buffer.
-    /// Reads in increments of 'self.ibs'.
-    /// The start of each ibs-sized read follows the previous one.
-    fn fill_consecutive(&mut self, buf: &mut Vec<u8>) -> std::io::Result<ReadStat> {
-        let mut reads_complete = 0;
-        let mut reads_partial = 0;
-        let mut bytes_total = 0;
+impl<'a, R: Read> Input<'a, R> {
+    /// Fills a given buffer.
+    /// Reads in increments of 'self.ibs'.
+    /// The start of each ibs-sized read follows the previous one.
+    fn fill_consecutive(&mut self, buf: &mut Vec<u8>) -> std::io::Result<ReadStat> {
+        let mut reads_complete = 0;
+        let mut reads_partial = 0;
+        let mut bytes_total = 0;
 
-        for chunk in buf.chunks_mut(self.settings.ibs) {
-            match self.read(chunk)? {
-                rlen if rlen == self.settings.ibs => {
-                    bytes_total += rlen;
-                    reads_complete += 1;
+        for chunk in buf.chunks_mut(self.settings.ibs) {
+            match self.read(chunk)? {
+                rlen if rlen == self.settings.ibs => {
+                    bytes_total += rlen;
+                    reads_complete += 1;
                 }
-                rlen if rlen > 0 => {
-                    bytes_total += rlen;
-                    reads_partial += 1;
+                rlen if rlen > 0 => {
+                    bytes_total += rlen;
+                    reads_partial += 1;
                 }
-                _ => break,
+                _ => break,
             }
         }
 
-        buf.truncate(bytes_total);
-        Ok(ReadStat {
-            reads_complete,
-            reads_partial,
-            // Records are not truncated when filling.
-            records_truncated: 0,
+        buf.truncate(bytes_total);
+        Ok(ReadStat {
+            reads_complete,
+            reads_partial,
+            // Records are not truncated when filling.
+            records_truncated: 0,
         })
     }
 
-    /// Fills a given buffer.
-    /// Reads in increments of 'self.ibs'.
-    /// The start of each ibs-sized read is aligned to multiples of ibs; remaining space is filled with the 'pad' byte.
-    fn fill_blocks(&mut self, buf: &mut Vec<u8>, pad: u8) -> std::io::Result<ReadStat> {
-        let mut reads_complete = 0;
-        let mut reads_partial = 0;
-        let mut base_idx = 0;
+    /// Fills a given buffer.
+    /// Reads in increments of 'self.ibs'.
+    /// The start of each ibs-sized read is aligned to multiples of ibs; remaining space is filled with the 'pad' byte.
+    fn fill_blocks(&mut self, buf: &mut Vec<u8>, pad: u8) -> std::io::Result<ReadStat> {
+        let mut reads_complete = 0;
+        let mut reads_partial = 0;
+        let mut base_idx = 0;
 
-        while base_idx < buf.len() {
-            let next_blk = cmp::min(base_idx + self.settings.ibs, buf.len());
-            let target_len = next_blk - base_idx;
+        while base_idx < buf.len() {
+            let next_blk = cmp::min(base_idx + self.settings.ibs, buf.len());
+            let target_len = next_blk - base_idx;
 
-            match self.read(&mut buf[base_idx..next_blk])? {
-                0 => break,
-                rlen if rlen < target_len => {
-                    reads_partial += 1;
-                    let padding = vec![pad; target_len - rlen];
-                    buf.splice(base_idx + rlen..next_blk, padding.into_iter());
+            match self.read(&mut buf[base_idx..next_blk])? {
+                0 => break,
+                rlen if rlen < target_len => {
+                    reads_partial += 1;
+                    let padding = vec![pad; target_len - rlen];
+                    buf.splice(base_idx + rlen..next_blk, padding.into_iter());
                 }
-                _ => {
-                    reads_complete += 1;
+                _ => {
+                    reads_complete += 1;
                 }
             }
 
-            base_idx += self.settings.ibs;
+            base_idx += self.settings.ibs;
         }
 
-        buf.truncate(base_idx);
-        Ok(ReadStat {
-            reads_complete,
-            reads_partial,
-            records_truncated: 0,
+        buf.truncate(base_idx);
+        Ok(ReadStat {
+            reads_complete,
+            reads_partial,
+            records_truncated: 0,
         })
     }
 
-    /// Skips amount_to_read bytes from the Input by copying into a sink
-    fn read_skip(&mut self, amount_to_read: u64) -> std::io::Result<()> {
-        let copy_result = io::copy(&mut self.src.by_ref().take(amount_to_read), &mut io::sink());
-        if let Ok(n) = copy_result {
-            if n != amount_to_read {
-                io::Result::Err(io::Error::new(io::ErrorKind::UnexpectedEof, ""))
-            } else {
+    /// Skips amount_to_read bytes from the Input by copying into a sink
+    fn read_skip(&mut self, amount_to_read: u64) -> std::io::Result<()> {
+        let copy_result = io::copy(&mut self.src.by_ref().take(amount_to_read), &mut io::sink());
+        if let Ok(n) = copy_result {
+            if n != amount_to_read {
+                io::Result::Err(io::Error::new(io::ErrorKind::UnexpectedEof, ""))
+            } else {
                 Ok(())
             }
-        } else {
-            io::Result::Err(copy_result.unwrap_err())
+        } else {
+            io::Result::Err(copy_result.unwrap_err())
         }
     }
 }
 
-trait OutputTrait: Sized + Write {
-    fn fsync(&mut self) -> io::Result<()>;
-    fn fdatasync(&mut self) -> io::Result<()>;
+trait OutputTrait: Sized + Write {
+    fn fsync(&mut self) -> io::Result<()>;
+    fn fdatasync(&mut self) -> io::Result<()>;
 }
 
-struct Output<'a, W: Write> {
-    dst: W,
-    settings: &'a Settings,
+struct Output<'a, W: Write> {
+    dst: W,
+    settings: &'a Settings,
 }
 
-impl<'a> Output<'a, io::Stdout> {
-    fn new(settings: &'a Settings) -> UResult<Self> {
-        let mut dst = io::stdout();
+impl<'a> Output<'a, io::Stdout> {
+    fn new(settings: &'a Settings) -> UResult<Self> {
+        let mut dst = io::stdout();
 
-        // stdout is not seekable, so we just write null bytes.
-        if settings.seek > 0 {
-            io::copy(&mut io::repeat(0u8).take(settings.seek as u64), &mut dst)
-                .map_err_context(|| String::from("write error"))?;
+        // stdout is not seekable, so we just write null bytes.
+        if settings.seek > 0 {
+            io::copy(&mut io::repeat(0u8).take(settings.seek as u64), &mut dst)
+                .map_err_context(|| String::from("write error"))?;
         }
 
-        Ok(Self { dst, settings })
+        Ok(Self { dst, settings })
     }
 }
 
-impl<'a> OutputTrait for Output<'a, io::Stdout> {
-    fn fsync(&mut self) -> io::Result<()> {
-        self.dst.flush()
+impl<'a> OutputTrait for Output<'a, io::Stdout> {
+    fn fsync(&mut self) -> io::Result<()> {
+        self.dst.flush()
     }
 
-    fn fdatasync(&mut self) -> io::Result<()> {
-        self.dst.flush()
+    fn fdatasync(&mut self) -> io::Result<()> {
+        self.dst.flush()
     }
 }
 
-impl<'a, W: Write> Output<'a, W>
-where
-    Self: OutputTrait,
+impl<'a, W: Write> Output<'a, W>
+where
+    Self: OutputTrait,
 {
-    fn write_blocks(&mut self, buf: &[u8]) -> io::Result<WriteStat> {
-        let mut writes_complete = 0;
-        let mut writes_partial = 0;
-        let mut bytes_total = 0;
+    fn write_blocks(&mut self, buf: &[u8]) -> io::Result<WriteStat> {
+        let mut writes_complete = 0;
+        let mut writes_partial = 0;
+        let mut bytes_total = 0;
 
-        for chunk in buf.chunks(self.settings.obs) {
-            let wlen = self.write(chunk)?;
-            if wlen < self.settings.obs {
-                writes_partial += 1;
-            } else {
-                writes_complete += 1;
+        for chunk in buf.chunks(self.settings.obs) {
+            let wlen = self.write(chunk)?;
+            if wlen < self.settings.obs {
+                writes_partial += 1;
+            } else {
+                writes_complete += 1;
             }
-            bytes_total += wlen;
+            bytes_total += wlen;
         }
 
-        Ok(WriteStat {
-            writes_complete,
-            writes_partial,
-            bytes_total: bytes_total.try_into().unwrap_or(0u128),
+        Ok(WriteStat {
+            writes_complete,
+            writes_partial,
+            bytes_total: bytes_total.try_into().unwrap_or(0u128),
         })
     }
 
-    /// Flush the output to disk, if configured to do so.
-    fn sync(&mut self) -> std::io::Result<()> {
-        if self.settings.oconv.fsync {
-            self.fsync()
-        } else if self.settings.oconv.fdatasync {
-            self.fdatasync()
-        } else {
-            // Intentionally do nothing in this case.
-            Ok(())
+    /// Flush the output to disk, if configured to do so.
+    fn sync(&mut self) -> std::io::Result<()> {
+        if self.settings.oconv.fsync {
+            self.fsync()
+        } else if self.settings.oconv.fdatasync {
+            self.fdatasync()
+        } else {
+            // Intentionally do nothing in this case.
+            Ok(())
         }
     }
 
-    /// Copy the given input data to this output, consuming both.
-    ///
-    /// This method contains the main loop for the `dd` program. Bytes
-    /// are read in blocks from `i` and written in blocks to this
-    /// output. Read/write statistics are reported to stderr as
-    /// configured by the `status` command-line argument.
-    ///
-    /// # Errors
-    ///
-    /// If there is a problem reading from the input or writing to
-    /// this output.
-    fn dd_out<R: Read>(mut self, mut i: Input<R>) -> std::io::Result<()> {
-        // The read and write statistics.
-        //
-        // These objects are counters, initialized to zero. After each
-        // iteration of the main loop, each will be incremented by the
-        // number of blocks read and written, respectively.
-        let mut rstat = Default::default();
-        let mut wstat = Default::default();
+    /// Copy the given input data to this output, consuming both.
+    ///
+    /// This method contains the main loop for the `dd` program. Bytes
+    /// are read in blocks from `i` and written in blocks to this
+    /// output. Read/write statistics are reported to stderr as
+    /// configured by the `status` command-line argument.
+    ///
+    /// # Errors
+    ///
+    /// If there is a problem reading from the input or writing to
+    /// this output.
+    fn dd_out<R: Read>(mut self, mut i: Input<R>) -> std::io::Result<()> {
+        // The read and write statistics.
+        //
+        // These objects are counters, initialized to zero. After each
+        // iteration of the main loop, each will be incremented by the
+        // number of blocks read and written, respectively.
+        let mut rstat = Default::default();
+        let mut wstat = Default::default();
 
-        // The time at which the main loop starts executing.
-        //
-        // When `status=progress` is given on the command-line, the
-        // `dd` program reports its progress every second or so. Part
-        // of its report includes the throughput in bytes per second,
-        // which requires knowing how long the process has been
-        // running.
-        let start = time::Instant::now();
+        // The time at which the main loop starts executing.
+        //
+        // When `status=progress` is given on the command-line, the
+        // `dd` program reports its progress every second or so. Part
+        // of its report includes the throughput in bytes per second,
+        // which requires knowing how long the process has been
+        // running.
+        let start = time::Instant::now();
 
-        // A good buffer size for reading.
-        //
-        // This is an educated guess about a good buffer size based on
-        // the input and output block sizes.
-        let bsize = calc_bsize(i.settings.ibs, self.settings.obs);
+        // A good buffer size for reading.
+        //
+        // This is an educated guess about a good buffer size based on
+        // the input and output block sizes.
+        let bsize = calc_bsize(i.settings.ibs, self.settings.obs);
 
-        // Start a thread that reports transfer progress.
-        //
-        // The `dd` program reports its progress after every block is written,
-        // at most every 1 second, and only if `status=progress` is given on
-        // the command-line or a SIGUSR1 signal is received. We
-        // perform this reporting in a new thread so as not to take
-        // any CPU time away from the actual reading and writing of
-        // data. We send a `ProgUpdate` from the transmitter `prog_tx`
-        // to the receives `rx`, and the receiver prints the transfer
-        // information.
-        let (prog_tx, rx) = mpsc::channel();
-        let output_thread = thread::spawn(gen_prog_updater(rx, i.settings.status));
-        let mut progress_as_secs = 0;
+        // Start a thread that reports transfer progress.
+        //
+        // The `dd` program reports its progress after every block is written,
+        // at most every 1 second, and only if `status=progress` is given on
+        // the command-line or a SIGUSR1 signal is received. We
+        // perform this reporting in a new thread so as not to take
+        // any CPU time away from the actual reading and writing of
+        // data. We send a `ProgUpdate` from the transmitter `prog_tx`
+        // to the receives `rx`, and the receiver prints the transfer
+        // information.
+        let (prog_tx, rx) = mpsc::channel();
+        let output_thread = thread::spawn(gen_prog_updater(rx, i.settings.status));
+        let mut progress_as_secs = 0;
 
-        // Create a common buffer with a capacity of the block size.
-        // This is the max size needed.
-        let mut buf = vec![BUF_INIT_BYTE; bsize];
+        // Create a common buffer with a capacity of the block size.
+        // This is the max size needed.
+        let mut buf = vec![BUF_INIT_BYTE; bsize];
 
-        // The main read/write loop.
-        //
-        // Each iteration reads blocks from the input and writes
-        // blocks to this output. Read/write statistics are updated on
-        // each iteration and cumulative statistics are reported to
-        // the progress reporting thread.
-        while below_count_limit(&i.settings.count, &rstat, &wstat) {
-            // Read a block from the input then write the block to the output.
-            //
-            // As an optimization, make an educated guess about the
-            // best buffer size for reading based on the number of
-            // blocks already read and the number of blocks remaining.
-            let loop_bsize =
-                calc_loop_bsize(&i.settings.count, &rstat, &wstat, i.settings.ibs, bsize);
-            let rstat_update = read_helper(&mut i, &mut buf, loop_bsize)?;
-            if rstat_update.is_empty() {
+        // The main read/write loop.
+        //
+        // Each iteration reads blocks from the input and writes
+        // blocks to this output. Read/write statistics are updated on
+        // each iteration and cumulative statistics are reported to
+        // the progress reporting thread.
+        while below_count_limit(&i.settings.count, &rstat, &wstat) {
+            // Read a block from the input then write the block to the output.
+            //
+            // As an optimization, make an educated guess about the
+            // best buffer size for reading based on the number of
+            // blocks already read and the number of blocks remaining.
+            let loop_bsize =
+                calc_loop_bsize(&i.settings.count, &rstat, &wstat, i.settings.ibs, bsize);
+            let rstat_update = read_helper(&mut i, &mut buf, loop_bsize)?;
+            if rstat_update.is_empty() {
                 break;
             }
-            let wstat_update = self.write_blocks(&buf)?;
+            let wstat_update = self.write_blocks(&buf)?;
 
-            // Update the read/write stats and inform the progress thread once per second.
-            //
-            // If the receiver is disconnected, `send()` returns an
-            // error. Since it is just reporting progress and is not
-            // crucial to the operation of `dd`, let's just ignore the
-            // error.
-            rstat += rstat_update;
-            wstat += wstat_update;
-            let prog_update = ProgUpdate::new(rstat, wstat, start.elapsed(), false);
-            if prog_update.duration.as_secs() >= progress_as_secs {
-                progress_as_secs = prog_update.duration.as_secs() + 1;
-                prog_tx.send(prog_update).unwrap_or(());
+            // Update the read/write stats and inform the progress thread once per second.
+            //
+            // If the receiver is disconnected, `send()` returns an
+            // error. Since it is just reporting progress and is not
+            // crucial to the operation of `dd`, let's just ignore the
+            // error.
+            rstat += rstat_update;
+            wstat += wstat_update;
+            let prog_update = ProgUpdate::new(rstat, wstat, start.elapsed(), false);
+            if prog_update.duration.as_secs() >= progress_as_secs {
+                progress_as_secs = prog_update.duration.as_secs() + 1;
+                prog_tx.send(prog_update).unwrap_or(());
             }
         }
 
-        // Flush the output, if configured to do so.
-        self.sync()?;
+        // Flush the output, if configured to do so.
+        self.sync()?;
 
-        // Print the final read/write statistics.
-        let prog_update = ProgUpdate::new(rstat, wstat, start.elapsed(), true);
-        prog_tx.send(prog_update).unwrap_or(());
-        // Wait for the output thread to finish
-        output_thread
-            .join()
-            .expect("Failed to join with the output thread.");
+        // Print the final read/write statistics.
+        let prog_update = ProgUpdate::new(rstat, wstat, start.elapsed(), true);
+        prog_tx.send(prog_update).unwrap_or(());
+        // Wait for the output thread to finish
+        output_thread
+            .join()
+            .expect("Failed to join with the output thread.");
         Ok(())
     }
 }
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-fn make_linux_oflags(oflags: &OFlags) -> Option<libc::c_int> {
-    let mut flag = 0;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+fn make_linux_oflags(oflags: &OFlags) -> Option<libc::c_int> {
+    let mut flag = 0;
 
-    // oflag=FLAG
-    if oflags.append {
-        flag |= libc::O_APPEND;
+    // oflag=FLAG
+    if oflags.append {
+        flag |= libc::O_APPEND;
     }
-    if oflags.direct {
-        flag |= libc::O_DIRECT;
+    if oflags.direct {
+        flag |= libc::O_DIRECT;
     }
-    if oflags.directory {
-        flag |= libc::O_DIRECTORY;
+    if oflags.directory {
+        flag |= libc::O_DIRECTORY;
     }
-    if oflags.dsync {
-        flag |= libc::O_DSYNC;
+    if oflags.dsync {
+        flag |= libc::O_DSYNC;
     }
-    if oflags.noatime {
-        flag |= libc::O_NOATIME;
+    if oflags.noatime {
+        flag |= libc::O_NOATIME;
     }
-    if oflags.noctty {
-        flag |= libc::O_NOCTTY;
+    if oflags.noctty {
+        flag |= libc::O_NOCTTY;
     }
-    if oflags.nofollow {
-        flag |= libc::O_NOFOLLOW;
+    if oflags.nofollow {
+        flag |= libc::O_NOFOLLOW;
     }
-    if oflags.nonblock {
-        flag |= libc::O_NONBLOCK;
+    if oflags.nonblock {
+        flag |= libc::O_NONBLOCK;
     }
-    if oflags.sync {
-        flag |= libc::O_SYNC;
+    if oflags.sync {
+        flag |= libc::O_SYNC;
     }
 
-    if flag != 0 {
-        Some(flag)
-    } else {
-        None
-    }
+    if flag != 0 {
+        Some(flag)
+    } else {
+        None
+    }
 }
 
-impl<'a> Output<'a, File> {
-    fn new(filename: &Path, settings: &'a Settings) -> UResult<Self> {
-        fn open_dst(path: &Path, cflags: &OConvFlags, oflags: &OFlags) -> Result<File, io::Error> {
-            let mut opts = OpenOptions::new();
-            opts.write(true)
-                .create(!cflags.nocreat)
-                .create_new(cflags.excl)
-                .append(oflags.append);
+impl<'a> Output<'a, File> {
+    fn new(filename: &Path, settings: &'a Settings) -> UResult<Self> {
+        fn open_dst(path: &Path, cflags: &OConvFlags, oflags: &OFlags) -> Result<File, io::Error> {
+            let mut opts = OpenOptions::new();
+            opts.write(true)
+                .create(!cflags.nocreat)
+                .create_new(cflags.excl)
+                .append(oflags.append);
 
-            #[cfg(any(target_os = "linux", target_os = "android"))]
-            if let Some(libc_flags) = make_linux_oflags(oflags) {
-                opts.custom_flags(libc_flags);
+            #[cfg(any(target_os = "linux", target_os = "android"))]
+            if let Some(libc_flags) = make_linux_oflags(oflags) {
+                opts.custom_flags(libc_flags);
             }
 
-            opts.open(path)
+            opts.open(path)
         }
 
-        let mut dst = open_dst(filename, &settings.oconv, &settings.oflags)
-            .map_err_context(|| format!("failed to open {}", filename.quote()))?;
+        let mut dst = open_dst(filename, &settings.oconv, &settings.oflags)
+            .map_err_context(|| format!("failed to open {}", filename.quote()))?;
 
-        // Seek to the index in the output file, truncating if requested.
-        //
-        // Calling `set_len()` may result in an error (for example,
-        // when calling it on `/dev/null`), but we don't want to
-        // terminate the process when that happens.  Instead, we
-        // suppress the error by calling `Result::ok()`. This matches
-        // the behavior of GNU `dd` when given the command-line
-        // argument `of=/dev/null`.
+        // Seek to the index in the output file, truncating if requested.
+        //
+        // Calling `set_len()` may result in an error (for example,
+        // when calling it on `/dev/null`), but we don't want to
+        // terminate the process when that happens.  Instead, we
+        // suppress the error by calling `Result::ok()`. This matches
+        // the behavior of GNU `dd` when given the command-line
+        // argument `of=/dev/null`.
 
-        if !settings.oconv.notrunc {
-            dst.set_len(settings.seek).ok();
+        if !settings.oconv.notrunc {
+            dst.set_len(settings.seek).ok();
         }
-        dst.seek(io::SeekFrom::Start(settings.seek))
-            .map_err_context(|| "failed to seek in output file".to_string())?;
+        dst.seek(io::SeekFrom::Start(settings.seek))
+            .map_err_context(|| "failed to seek in output file".to_string())?;
 
-        Ok(Self { dst, settings })
+        Ok(Self { dst, settings })
     }
 }
 
-impl<'a> OutputTrait for Output<'a, File> {
-    fn fsync(&mut self) -> io::Result<()> {
-        self.dst.flush()?;
-        self.dst.sync_all()
+impl<'a> OutputTrait for Output<'a, File> {
+    fn fsync(&mut self) -> io::Result<()> {
+        self.dst.flush()?;
+        self.dst.sync_all()
     }
 
-    fn fdatasync(&mut self) -> io::Result<()> {
-        self.dst.flush()?;
-        self.dst.sync_data()
+    fn fdatasync(&mut self) -> io::Result<()> {
+        self.dst.flush()?;
+        self.dst.sync_data()
     }
 }
 
-impl<'a> Seek for Output<'a, File> {
-    fn seek(&mut self, pos: io::SeekFrom) -> io::Result<u64> {
-        self.dst.seek(pos)
+impl<'a> Seek for Output<'a, File> {
+    fn seek(&mut self, pos: io::SeekFrom) -> io::Result<u64> {
+        self.dst.seek(pos)
     }
 }
 
-impl<'a> Write for Output<'a, File> {
-    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
-        fn is_sparse(buf: &[u8]) -> bool {
-            buf.iter().all(|&e| e == 0u8)
+impl<'a> Write for Output<'a, File> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        fn is_sparse(buf: &[u8]) -> bool {
+            buf.iter().all(|&e| e == 0u8)
         }
-        // -----------------------------
-        if self.settings.oconv.sparse && is_sparse(buf) {
-            let seek_amt: i64 = buf
-                .len()
-                .try_into()
-                .expect("Internal dd Error: Seek amount greater than signed 64-bit integer");
-            self.dst.seek(io::SeekFrom::Current(seek_amt))?;
-            Ok(buf.len())
-        } else {
-            self.dst.write(buf)
+        // -----------------------------
+        if self.settings.oconv.sparse && is_sparse(buf) {
+            let seek_amt: i64 = buf
+                .len()
+                .try_into()
+                .expect("Internal dd Error: Seek amount greater than signed 64-bit integer");
+            self.dst.seek(io::SeekFrom::Current(seek_amt))?;
+            Ok(buf.len())
+        } else {
+            self.dst.write(buf)
         }
     }
 
-    fn flush(&mut self) -> io::Result<()> {
-        self.dst.flush()
+    fn flush(&mut self) -> io::Result<()> {
+        self.dst.flush()
     }
 }
 
-impl<'a> Write for Output<'a, io::Stdout> {
-    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
-        self.dst.write(buf)
+impl<'a> Write for Output<'a, io::Stdout> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.dst.write(buf)
     }
 
-    fn flush(&mut self) -> io::Result<()> {
-        self.dst.flush()
+    fn flush(&mut self) -> io::Result<()> {
+        self.dst.flush()
     }
 }
 
-/// Read helper performs read operations common to all dd reads, and dispatches the buffer to relevant helper functions as dictated by the operations requested by the user.
-fn read_helper<R: Read>(
-    i: &mut Input<R>,
-    buf: &mut Vec<u8>,
-    bsize: usize,
-) -> std::io::Result<ReadStat> {
-    // Local Helper Fns -------------------------------------------------
-    fn perform_swab(buf: &mut [u8]) {
-        for base in (1..buf.len()).step_by(2) {
-            buf.swap(base, base - 1);
+/// Read helper performs read operations common to all dd reads, and dispatches the buffer to relevant helper functions as dictated by the operations requested by the user.
+fn read_helper<R: Read>(
+    i: &mut Input<R>,
+    buf: &mut Vec<u8>,
+    bsize: usize,
+) -> std::io::Result<ReadStat> {
+    // Local Helper Fns -------------------------------------------------
+    fn perform_swab(buf: &mut [u8]) {
+        for base in (1..buf.len()).step_by(2) {
+            buf.swap(base, base - 1);
         }
     }
-    // ------------------------------------------------------------------
-    // Read
-    // Resize the buffer to the bsize. Any garbage data in the buffer is overwritten or truncated, so there is no need to fill with BUF_INIT_BYTE first.
-    buf.resize(bsize, BUF_INIT_BYTE);
+    // ------------------------------------------------------------------
+    // Read
+    // Resize the buffer to the bsize. Any garbage data in the buffer is overwritten or truncated, so there is no need to fill with BUF_INIT_BYTE first.
+    buf.resize(bsize, BUF_INIT_BYTE);
 
-    let mut rstat = match i.settings.iconv.sync {
-        Some(ch) => i.fill_blocks(buf, ch)?,
-        _ => i.fill_consecutive(buf)?,
+    let mut rstat = match i.settings.iconv.sync {
+        Some(ch) => i.fill_blocks(buf, ch)?,
+        _ => i.fill_consecutive(buf)?,
     };
-    // Return early if no data
-    if rstat.reads_complete == 0 && rstat.reads_partial == 0 {
-        return Ok(rstat);
+    // Return early if no data
+    if rstat.reads_complete == 0 && rstat.reads_partial == 0 {
+        return Ok(rstat);
     }
 
-    // Perform any conv=x[,x...] options
-    if i.settings.iconv.swab {
-        perform_swab(buf);
+    // Perform any conv=x[,x...] options
+    if i.settings.iconv.swab {
+        perform_swab(buf);
     }
 
-    match i.settings.iconv.mode {
-        Some(ref mode) => {
-            *buf = conv_block_unblock_helper(buf.clone(), mode, &mut rstat);
-            Ok(rstat)
+    match i.settings.iconv.mode {
+        Some(ref mode) => {
+            *buf = conv_block_unblock_helper(buf.clone(), mode, &mut rstat);
+            Ok(rstat)
         }
-        None => Ok(rstat),
+        None => Ok(rstat),
     }
 }
 
-// Calculate a 'good' internal buffer size.
-// For performance of the read/write functions, the buffer should hold
-// both an integral number of reads and an integral number of writes. For
-// sane real-world memory use, it should not be too large. I believe
-// the least common multiple is a good representation of these interests.
-// https://en.wikipedia.org/wiki/Least_common_multiple#Using_the_greatest_common_divisor
-fn calc_bsize(ibs: usize, obs: usize) -> usize {
-    let gcd = Gcd::gcd(ibs, obs);
-    // calculate the lcm from gcd
-    (ibs / gcd) * obs
+// Calculate a 'good' internal buffer size.
+// For performance of the read/write functions, the buffer should hold
+// both an integral number of reads and an integral number of writes. For
+// sane real-world memory use, it should not be too large. I believe
+// the least common multiple is a good representation of these interests.
+// https://en.wikipedia.org/wiki/Least_common_multiple#Using_the_greatest_common_divisor
+fn calc_bsize(ibs: usize, obs: usize) -> usize {
+    let gcd = Gcd::gcd(ibs, obs);
+    // calculate the lcm from gcd
+    (ibs / gcd) * obs
 }
 
-// Calculate the buffer size appropriate for this loop iteration, respecting
-// a count=N if present.
-fn calc_loop_bsize(
-    count: &Option<Num>,
-    rstat: &ReadStat,
-    wstat: &WriteStat,
-    ibs: usize,
-    ideal_bsize: usize,
-) -> usize {
-    match count {
-        Some(Num::Blocks(rmax)) => {
-            let rsofar = rstat.reads_complete + rstat.reads_partial;
-            let rremain = rmax - rsofar;
-            cmp::min(ideal_bsize as u64, rremain * ibs as u64) as usize
+// Calculate the buffer size appropriate for this loop iteration, respecting
+// a count=N if present.
+fn calc_loop_bsize(
+    count: &Option<Num>,
+    rstat: &ReadStat,
+    wstat: &WriteStat,
+    ibs: usize,
+    ideal_bsize: usize,
+) -> usize {
+    match count {
+        Some(Num::Blocks(rmax)) => {
+            let rsofar = rstat.reads_complete + rstat.reads_partial;
+            let rremain = rmax - rsofar;
+            cmp::min(ideal_bsize as u64, rremain * ibs as u64) as usize
         }
-        Some(Num::Bytes(bmax)) => {
-            let bmax: u128 = (*bmax).try_into().unwrap();
-            let bremain: u128 = bmax - wstat.bytes_total;
-            cmp::min(ideal_bsize as u128, bremain as u128) as usize
+        Some(Num::Bytes(bmax)) => {
+            let bmax: u128 = (*bmax).try_into().unwrap();
+            let bremain: u128 = bmax - wstat.bytes_total;
+            cmp::min(ideal_bsize as u128, bremain as u128) as usize
         }
-        None => ideal_bsize,
+        None => ideal_bsize,
     }
 }
 
-// Decide if the current progress is below a count=N limit or return
-// true if no such limit is set.
-fn below_count_limit(count: &Option<Num>, rstat: &ReadStat, wstat: &WriteStat) -> bool {
-    match count {
-        Some(Num::Blocks(n)) => {
-            let n = *n;
-            rstat.reads_complete + rstat.reads_partial <= n
+// Decide if the current progress is below a count=N limit or return
+// true if no such limit is set.
+fn below_count_limit(count: &Option<Num>, rstat: &ReadStat, wstat: &WriteStat) -> bool {
+    match count {
+        Some(Num::Blocks(n)) => {
+            let n = *n;
+            rstat.reads_complete + rstat.reads_partial <= n
         }
-        Some(Num::Bytes(n)) => {
-            let n = (*n).try_into().unwrap();
-            wstat.bytes_total <= n
+        Some(Num::Bytes(n)) => {
+            let n = (*n).try_into().unwrap();
+            wstat.bytes_total <= n
         }
-        None => true,
+        None => true,
     }
 }
 
-/// Canonicalized file name of `/dev/stdout`.
-///
-/// For example, if this process were invoked from the command line as
-/// `dd`, then this function returns the [`OsString`] form of
-/// `"/dev/stdout"`. However, if this process were invoked as `dd >
-/// outfile`, then this function returns the canonicalized path to
-/// `outfile`, something like `"/path/to/outfile"`.
-fn stdout_canonicalized() -> OsString {
-    match Path::new("/dev/stdout").canonicalize() {
-        Ok(p) => p.into_os_string(),
-        Err(_) => OsString::from("/dev/stdout"),
+/// Canonicalized file name of `/dev/stdout`.
+///
+/// For example, if this process were invoked from the command line as
+/// `dd`, then this function returns the [`OsString`] form of
+/// `"/dev/stdout"`. However, if this process were invoked as `dd >
+/// outfile`, then this function returns the canonicalized path to
+/// `outfile`, something like `"/path/to/outfile"`.
+fn stdout_canonicalized() -> OsString {
+    match Path::new("/dev/stdout").canonicalize() {
+        Ok(p) => p.into_os_string(),
+        Err(_) => OsString::from("/dev/stdout"),
     }
 }
 
-/// Decide whether stdout is being redirected to a seekable file.
-///
-/// For example, if this process were invoked from the command line as
-///
-/// ```sh
-/// dd if=/dev/zero bs=1 count=10 seek=5 > /dev/sda1
-/// ```
-///
-/// where `/dev/sda1` is a seekable block device then this function
-/// would return true. If invoked as
-///
-/// ```sh
-/// dd if=/dev/zero bs=1 count=10 seek=5
-/// ```
-///
-/// then this function would return false.
-fn is_stdout_redirected_to_seekable_file() -> bool {
-    let s = stdout_canonicalized();
-    let p = Path::new(&s);
-    match File::open(p) {
-        Ok(mut f) => {
-            f.seek(SeekFrom::Current(0)).is_ok()
-                && f.seek(SeekFrom::End(0)).is_ok()
-                && f.seek(SeekFrom::Start(0)).is_ok()
+/// Decide whether stdout is being redirected to a seekable file.
+///
+/// For example, if this process were invoked from the command line as
+///
+/// ```sh
+/// dd if=/dev/zero bs=1 count=10 seek=5 > /dev/sda1
+/// ```
+///
+/// where `/dev/sda1` is a seekable block device then this function
+/// would return true. If invoked as
+///
+/// ```sh
+/// dd if=/dev/zero bs=1 count=10 seek=5
+/// ```
+///
+/// then this function would return false.
+fn is_stdout_redirected_to_seekable_file() -> bool {
+    let s = stdout_canonicalized();
+    let p = Path::new(&s);
+    match File::open(p) {
+        Ok(mut f) => {
+            f.seek(SeekFrom::Current(0)).is_ok()
+                && f.seek(SeekFrom::End(0)).is_ok()
+                && f.seek(SeekFrom::Start(0)).is_ok()
         }
         Err(_) => false,
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let settings: Settings = Parser::new().parse(
-        &matches
-            .get_many::<String>(options::OPERANDS)
-            .unwrap_or_default()
-            .map(|s| s.as_ref())
-            .collect::<Vec<_>>()[..],
+    let settings: Settings = Parser::new().parse(
+        &matches
+            .get_many::<String>(options::OPERANDS)
+            .unwrap_or_default()
+            .map(|s| s.as_ref())
+            .collect::<Vec<_>>()[..],
     )?;
 
-    match (&settings.infile, &settings.outfile) {
-        (Some(infile), Some(outfile)) => {
-            let i = Input::<File>::new(Path::new(&infile), &settings)?;
-            let o = Output::<File>::new(Path::new(&outfile), &settings)?;
-            o.dd_out(i).map_err_context(|| "IO error".to_string())
+    match (&settings.infile, &settings.outfile) {
+        (Some(infile), Some(outfile)) => {
+            let i = Input::<File>::new(Path::new(&infile), &settings)?;
+            let o = Output::<File>::new(Path::new(&outfile), &settings)?;
+            o.dd_out(i).map_err_context(|| "IO error".to_string())
         }
-        (None, Some(outfile)) => {
-            let i = Input::<io::Stdin>::new(&settings)?;
-            let o = Output::<File>::new(Path::new(&outfile), &settings)?;
-            o.dd_out(i).map_err_context(|| "IO error".to_string())
+        (None, Some(outfile)) => {
+            let i = Input::<io::Stdin>::new(&settings)?;
+            let o = Output::<File>::new(Path::new(&outfile), &settings)?;
+            o.dd_out(i).map_err_context(|| "IO error".to_string())
         }
-        (Some(infile), None) => {
-            let i = Input::<File>::new(Path::new(&infile), &settings)?;
-            if is_stdout_redirected_to_seekable_file() {
-                let filename = stdout_canonicalized();
-                let o = Output::<File>::new(Path::new(&filename), &settings)?;
-                o.dd_out(i).map_err_context(|| "IO error".to_string())
-            } else {
-                let o = Output::<io::Stdout>::new(&settings)?;
-                o.dd_out(i).map_err_context(|| "IO error".to_string())
+        (Some(infile), None) => {
+            let i = Input::<File>::new(Path::new(&infile), &settings)?;
+            if is_stdout_redirected_to_seekable_file() {
+                let filename = stdout_canonicalized();
+                let o = Output::<File>::new(Path::new(&filename), &settings)?;
+                o.dd_out(i).map_err_context(|| "IO error".to_string())
+            } else {
+                let o = Output::<io::Stdout>::new(&settings)?;
+                o.dd_out(i).map_err_context(|| "IO error".to_string())
             }
         }
         (None, None) => {
-            let i = Input::<io::Stdin>::new(&settings)?;
-            if is_stdout_redirected_to_seekable_file() {
-                let filename = stdout_canonicalized();
-                let o = Output::<File>::new(Path::new(&filename), &settings)?;
-                o.dd_out(i).map_err_context(|| "IO error".to_string())
-            } else {
-                let o = Output::<io::Stdout>::new(&settings)?;
-                o.dd_out(i).map_err_context(|| "IO error".to_string())
+            let i = Input::<io::Stdin>::new(&settings)?;
+            if is_stdout_redirected_to_seekable_file() {
+                let filename = stdout_canonicalized();
+                let o = Output::<File>::new(Path::new(&filename), &settings)?;
+                o.dd_out(i).map_err_context(|| "IO error".to_string())
+            } else {
+                let o = Output::<io::Stdout>::new(&settings)?;
+                o.dd_out(i).map_err_context(|| "IO error".to_string())
             }
         }
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(AFTER_HELP)
-        .infer_long_args(true)
-        .arg(Arg::new(options::OPERANDS).num_args(1..))
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(AFTER_HELP)
+        .infer_long_args(true)
+        .arg(Arg::new(options::OPERANDS).num_args(1..))
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::datastructures::{IConvFlags, IFlags};
-    use crate::{calc_bsize, Input, Output, Parser, Settings};
+#[cfg(test)]
+mod tests {
+    use crate::datastructures::{IConvFlags, IFlags};
+    use crate::{calc_bsize, Input, Output, Parser, Settings};
 
-    use std::cmp;
-    use std::fs;
-    use std::fs::File;
-    use std::io;
-    use std::io::{BufReader, Read};
-    use std::path::Path;
+    use std::cmp;
+    use std::fs;
+    use std::fs::File;
+    use std::io;
+    use std::io::{BufReader, Read};
+    use std::path::Path;
 
-    struct LazyReader<R: Read> {
-        src: R,
+    struct LazyReader<R: Read> {
+        src: R,
     }
 
-    impl<R: Read> Read for LazyReader<R> {
-        fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
-            let reduced = cmp::max(buf.len() / 2, 1);
-            self.src.read(&mut buf[..reduced])
+    impl<R: Read> Read for LazyReader<R> {
+        fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+            let reduced = cmp::max(buf.len() / 2, 1);
+            self.src.read(&mut buf[..reduced])
         }
     }
 
-    #[test]
-    fn bsize_test_primes() {
-        let (n, m) = (7901, 7919);
-        let res = calc_bsize(n, m);
-        assert!(res % n == 0);
-        assert!(res % m == 0);
+    #[test]
+    fn bsize_test_primes() {
+        let (n, m) = (7901, 7919);
+        let res = calc_bsize(n, m);
+        assert!(res % n == 0);
+        assert!(res % m == 0);
 
-        assert_eq!(res, n * m);
+        assert_eq!(res, n * m);
     }
 
-    #[test]
-    fn bsize_test_rel_prime_obs_greater() {
-        let (n, m) = (7 * 5119, 13 * 5119);
-        let res = calc_bsize(n, m);
-        assert!(res % n == 0);
-        assert!(res % m == 0);
+    #[test]
+    fn bsize_test_rel_prime_obs_greater() {
+        let (n, m) = (7 * 5119, 13 * 5119);
+        let res = calc_bsize(n, m);
+        assert!(res % n == 0);
+        assert!(res % m == 0);
 
-        assert_eq!(res, 7 * 13 * 5119);
+        assert_eq!(res, 7 * 13 * 5119);
     }
 
-    #[test]
-    fn bsize_test_rel_prime_ibs_greater() {
-        let (n, m) = (13 * 5119, 7 * 5119);
-        let res = calc_bsize(n, m);
-        assert!(res % n == 0);
-        assert!(res % m == 0);
+    #[test]
+    fn bsize_test_rel_prime_ibs_greater() {
+        let (n, m) = (13 * 5119, 7 * 5119);
+        let res = calc_bsize(n, m);
+        assert!(res % n == 0);
+        assert!(res % m == 0);
 
-        assert_eq!(res, 7 * 13 * 5119);
+        assert_eq!(res, 7 * 13 * 5119);
     }
 
-    #[test]
-    fn bsize_test_3fac_rel_prime() {
-        let (n, m) = (11 * 13 * 5119, 7 * 11 * 5119);
-        let res = calc_bsize(n, m);
-        assert!(res % n == 0);
-        assert!(res % m == 0);
+    #[test]
+    fn bsize_test_3fac_rel_prime() {
+        let (n, m) = (11 * 13 * 5119, 7 * 11 * 5119);
+        let res = calc_bsize(n, m);
+        assert!(res % n == 0);
+        assert!(res % m == 0);
 
-        assert_eq!(res, 7 * 11 * 13 * 5119);
+        assert_eq!(res, 7 * 11 * 13 * 5119);
     }
 
-    #[test]
-    fn bsize_test_ibs_greater() {
-        let (n, m) = (512 * 1024, 256 * 1024);
-        let res = calc_bsize(n, m);
-        assert!(res % n == 0);
-        assert!(res % m == 0);
+    #[test]
+    fn bsize_test_ibs_greater() {
+        let (n, m) = (512 * 1024, 256 * 1024);
+        let res = calc_bsize(n, m);
+        assert!(res % n == 0);
+        assert!(res % m == 0);
 
-        assert_eq!(res, n);
+        assert_eq!(res, n);
     }
 
-    #[test]
-    fn bsize_test_obs_greater() {
-        let (n, m) = (256 * 1024, 512 * 1024);
-        let res = calc_bsize(n, m);
-        assert!(res % n == 0);
-        assert!(res % m == 0);
+    #[test]
+    fn bsize_test_obs_greater() {
+        let (n, m) = (256 * 1024, 512 * 1024);
+        let res = calc_bsize(n, m);
+        assert!(res % n == 0);
+        assert!(res % m == 0);
 
-        assert_eq!(res, m);
+        assert_eq!(res, m);
     }
 
-    #[test]
-    fn bsize_test_bs_eq() {
-        let (n, m) = (1024, 1024);
-        let res = calc_bsize(n, m);
-        assert!(res % n == 0);
-        assert!(res % m == 0);
+    #[test]
+    fn bsize_test_bs_eq() {
+        let (n, m) = (1024, 1024);
+        let res = calc_bsize(n, m);
+        assert!(res % n == 0);
+        assert!(res % m == 0);
 
-        assert_eq!(res, m);
+        assert_eq!(res, m);
     }
 
-    #[test]
-    fn test_nocreat_causes_failure_when_ofile_doesnt_exist() {
-        let args = &["conv=nocreat", "of=not-a-real.file"];
-        let settings = Parser::new().parse(args).unwrap();
+    #[test]
+    fn test_nocreat_causes_failure_when_ofile_doesnt_exist() {
+        let args = &["conv=nocreat", "of=not-a-real.file"];
+        let settings = Parser::new().parse(args).unwrap();
         assert!(
-            Output::<File>::new(Path::new(settings.outfile.as_ref().unwrap()), &settings).is_err()
+            Output::<File>::new(Path::new(settings.outfile.as_ref().unwrap()), &settings).is_err()
         );
     }
 
-    #[test]
-    fn test_deadbeef_16_delayed() {
-        let settings = Settings {
-            ibs: 16,
-            obs: 32,
-            count: None,
-            iconv: IConvFlags {
-                sync: Some(0),
-                ..Default::default()
+    #[test]
+    fn test_deadbeef_16_delayed() {
+        let settings = Settings {
+            ibs: 16,
+            obs: 32,
+            count: None,
+            iconv: IConvFlags {
+                sync: Some(0),
+                ..Default::default()
             },
-            ..Default::default()
+            ..Default::default()
         };
-        let input = Input {
-            src: LazyReader {
-                src: File::open("./test-resources/deadbeef-16.test").unwrap(),
+        let input = Input {
+            src: LazyReader {
+                src: File::open("./test-resources/deadbeef-16.test").unwrap(),
             },
-            settings: &settings,
+            settings: &settings,
         };
 
-        let output = Output {
-            dst: File::create("./test-resources/FAILED-deadbeef-16-delayed.test").unwrap(),
-            settings: &settings,
+        let output = Output {
+            dst: File::create("./test-resources/FAILED-deadbeef-16-delayed.test").unwrap(),
+            settings: &settings,
         };
 
-        output.dd_out(input).unwrap();
+        output.dd_out(input).unwrap();
 
-        let tmp_fname = "./test-resources/FAILED-deadbeef-16-delayed.test";
-        let spec = File::open("./test-resources/deadbeef-16.spec").unwrap();
+        let tmp_fname = "./test-resources/FAILED-deadbeef-16-delayed.test";
+        let spec = File::open("./test-resources/deadbeef-16.spec").unwrap();
 
-        let res = File::open(tmp_fname).unwrap();
-        // Check test file isn't empty (unless spec file is too)
-        assert_eq!(
-            res.metadata().unwrap().len(),
-            spec.metadata().unwrap().len()
+        let res = File::open(tmp_fname).unwrap();
+        // Check test file isn't empty (unless spec file is too)
+        assert_eq!(
+            res.metadata().unwrap().len(),
+            spec.metadata().unwrap().len()
         );
 
-        let spec = BufReader::new(spec);
-        let res = BufReader::new(res);
+        let spec = BufReader::new(spec);
+        let res = BufReader::new(res);
 
-        // Check all bytes match
-        for (b_res, b_spec) in res.bytes().zip(spec.bytes()) {
-            assert_eq!(b_res.unwrap(), b_spec.unwrap());
+        // Check all bytes match
+        for (b_res, b_spec) in res.bytes().zip(spec.bytes()) {
+            assert_eq!(b_res.unwrap(), b_spec.unwrap());
         }
 
-        fs::remove_file(tmp_fname).unwrap();
+        fs::remove_file(tmp_fname).unwrap();
     }
 
-    #[test]
-    fn test_random_73k_test_lazy_fullblock() {
-        let settings = Settings {
-            ibs: 521,
-            obs: 1031,
-            count: None,
-            iflags: IFlags {
-                fullblock: true,
-                ..IFlags::default()
+    #[test]
+    fn test_random_73k_test_lazy_fullblock() {
+        let settings = Settings {
+            ibs: 521,
+            obs: 1031,
+            count: None,
+            iflags: IFlags {
+                fullblock: true,
+                ..IFlags::default()
             },
-            ..Default::default()
+            ..Default::default()
         };
-        let input = Input {
-            src: LazyReader {
-                src: File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test")
-                    .unwrap(),
+        let input = Input {
+            src: LazyReader {
+                src: File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test")
+                    .unwrap(),
             },
-            settings: &settings,
+            settings: &settings,
         };
 
-        let output = Output {
-            dst: File::create("./test-resources/FAILED-random_73k_test_lazy_fullblock.test")
-                .unwrap(),
-            settings: &settings,
+        let output = Output {
+            dst: File::create("./test-resources/FAILED-random_73k_test_lazy_fullblock.test")
+                .unwrap(),
+            settings: &settings,
         };
 
-        output.dd_out(input).unwrap();
+        output.dd_out(input).unwrap();
 
-        let tmp_fname = "./test-resources/FAILED-random_73k_test_lazy_fullblock.test";
-        let spec =
-            File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap();
+        let tmp_fname = "./test-resources/FAILED-random_73k_test_lazy_fullblock.test";
+        let spec =
+            File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap();
 
-        let res = File::open(tmp_fname).unwrap();
-        // Check test file isn't empty (unless spec file is too)
-        assert_eq!(
-            res.metadata().unwrap().len(),
-            spec.metadata().unwrap().len()
+        let res = File::open(tmp_fname).unwrap();
+        // Check test file isn't empty (unless spec file is too)
+        assert_eq!(
+            res.metadata().unwrap().len(),
+            spec.metadata().unwrap().len()
         );
 
-        let spec = BufReader::new(spec);
-        let res = BufReader::new(res);
+        let spec = BufReader::new(spec);
+        let res = BufReader::new(res);
 
-        // Check all bytes match
-        for (b_res, b_spec) in res.bytes().zip(spec.bytes()) {
-            assert_eq!(b_res.unwrap(), b_spec.unwrap());
+        // Check all bytes match
+        for (b_res, b_spec) in res.bytes().zip(spec.bytes()) {
+            assert_eq!(b_res.unwrap(), b_spec.unwrap());
         }
 
-        fs::remove_file(tmp_fname).unwrap();
+        fs::remove_file(tmp_fname).unwrap();
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dd/parseargs.rs.html b/dev/src/uu_dd/parseargs.rs.html index 402bbde82..6000f2318 100644 --- a/dev/src/uu_dd/parseargs.rs.html +++ b/dev/src/uu_dd/parseargs.rs.html @@ -1,4 +1,4 @@ -parseargs.rs - source
1
+parseargs.rs - source
1
 2
 3
 4
@@ -639,646 +639,646 @@
 639
 640
 641
-
// This file is part of the uutils coreutils package.
-//
-// (c) Tyler Steele <tyler.steele@protonmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
-// spell-checker:ignore ctty, ctable, iseek, oseek, iconvflags, oconvflags parseargs outfile oconv
+
// This file is part of the uutils coreutils package.
+//
+// (c) Tyler Steele <tyler.steele@protonmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
+// spell-checker:ignore ctty, ctable, iseek, oseek, iconvflags, oconvflags parseargs outfile oconv
 
-#[cfg(test)]
-mod unit_tests;
+#[cfg(test)]
+mod unit_tests;
 
-use super::{ConversionMode, IConvFlags, IFlags, Num, OConvFlags, OFlags, Settings, StatusLevel};
-use crate::conversion_tables::ConversionTable;
-use std::error::Error;
-use uucore::display::Quotable;
-use uucore::error::UError;
-use uucore::parse_size::ParseSizeError;
-use uucore::show_warning;
+use super::{ConversionMode, IConvFlags, IFlags, Num, OConvFlags, OFlags, Settings, StatusLevel};
+use crate::conversion_tables::ConversionTable;
+use std::error::Error;
+use uucore::display::Quotable;
+use uucore::error::UError;
+use uucore::parse_size::ParseSizeError;
+use uucore::show_warning;
 
-/// Parser Errors describe errors with parser input
-#[derive(Debug, PartialEq, Eq)]
-pub enum ParseError {
-    UnrecognizedOperand(String),
-    MultipleFmtTable,
-    MultipleUCaseLCase,
-    MultipleBlockUnblock,
-    MultipleExclNoCreate,
-    FlagNoMatch(String),
-    ConvFlagNoMatch(String),
-    MultiplierStringParseFailure(String),
-    MultiplierStringOverflow(String),
-    BlockUnblockWithoutCBS,
-    StatusLevelNotRecognized(String),
-    Unimplemented(String),
-    BsOutOfRange(String),
-    InvalidNumber(String),
+/// Parser Errors describe errors with parser input
+#[derive(Debug, PartialEq, Eq)]
+pub enum ParseError {
+    UnrecognizedOperand(String),
+    MultipleFmtTable,
+    MultipleUCaseLCase,
+    MultipleBlockUnblock,
+    MultipleExclNoCreate,
+    FlagNoMatch(String),
+    ConvFlagNoMatch(String),
+    MultiplierStringParseFailure(String),
+    MultiplierStringOverflow(String),
+    BlockUnblockWithoutCBS,
+    StatusLevelNotRecognized(String),
+    Unimplemented(String),
+    BsOutOfRange(String),
+    InvalidNumber(String),
 }
 
-/// Contains a temporary state during parsing of the arguments
-#[derive(Debug, PartialEq)]
-pub struct Parser {
-    infile: Option<String>,
-    outfile: Option<String>,
-    ibs: usize,
-    obs: usize,
-    cbs: Option<usize>,
-    skip: Num,
-    seek: Num,
-    count: Option<Num>,
-    conv: ConvFlags,
-    iflag: IFlags,
-    oflag: OFlags,
-    status: Option<StatusLevel>,
+/// Contains a temporary state during parsing of the arguments
+#[derive(Debug, PartialEq)]
+pub struct Parser {
+    infile: Option<String>,
+    outfile: Option<String>,
+    ibs: usize,
+    obs: usize,
+    cbs: Option<usize>,
+    skip: Num,
+    seek: Num,
+    count: Option<Num>,
+    conv: ConvFlags,
+    iflag: IFlags,
+    oflag: OFlags,
+    status: Option<StatusLevel>,
 }
 
-impl Default for Parser {
-    fn default() -> Self {
-        Self {
-            ibs: 512,
-            obs: 512,
-            cbs: None,
-            infile: None,
-            outfile: None,
-            skip: Num::Blocks(0),
-            seek: Num::Blocks(0),
-            count: None,
-            conv: ConvFlags::default(),
-            iflag: IFlags::default(),
-            oflag: OFlags::default(),
-            status: None,
+impl Default for Parser {
+    fn default() -> Self {
+        Self {
+            ibs: 512,
+            obs: 512,
+            cbs: None,
+            infile: None,
+            outfile: None,
+            skip: Num::Blocks(0),
+            seek: Num::Blocks(0),
+            count: None,
+            conv: ConvFlags::default(),
+            iflag: IFlags::default(),
+            oflag: OFlags::default(),
+            status: None,
         }
     }
 }
 
-#[derive(Debug, Default, PartialEq, Eq)]
-pub struct ConvFlags {
-    ascii: bool,
-    ebcdic: bool,
-    ibm: bool,
-    ucase: bool,
-    lcase: bool,
-    block: bool,
-    unblock: bool,
-    swab: bool,
-    sync: bool,
-    noerror: bool,
-    sparse: bool,
-    excl: bool,
-    nocreat: bool,
-    notrunc: bool,
-    fdatasync: bool,
-    fsync: bool,
+#[derive(Debug, Default, PartialEq, Eq)]
+pub struct ConvFlags {
+    ascii: bool,
+    ebcdic: bool,
+    ibm: bool,
+    ucase: bool,
+    lcase: bool,
+    block: bool,
+    unblock: bool,
+    swab: bool,
+    sync: bool,
+    noerror: bool,
+    sparse: bool,
+    excl: bool,
+    nocreat: bool,
+    notrunc: bool,
+    fdatasync: bool,
+    fsync: bool,
 }
 
-#[derive(Clone, Copy, PartialEq)]
-enum Conversion {
-    Ascii,
-    Ebcdic,
-    Ibm,
+#[derive(Clone, Copy, PartialEq)]
+enum Conversion {
+    Ascii,
+    Ebcdic,
+    Ibm,
 }
 
-#[derive(Clone, Copy)]
-enum Case {
-    Lower,
-    Upper,
+#[derive(Clone, Copy)]
+enum Case {
+    Lower,
+    Upper,
 }
 
-#[derive(Clone, Copy)]
-enum Block {
-    Block(usize),
-    Unblock(usize),
+#[derive(Clone, Copy)]
+enum Block {
+    Block(usize),
+    Unblock(usize),
 }
 
-/// Return an Unimplemented error when the target is not Linux or Android
-macro_rules! linux_only {
-    ($s: expr, $val: expr) => {
-        if cfg!(any(target_os = "linux", target_os = "android")) {
-            $val
-        } else {
-            return Err(ParseError::Unimplemented($s.to_string()).into());
+/// Return an Unimplemented error when the target is not Linux or Android
+macro_rules! linux_only {
+    ($s: expr, $val: expr) => {
+        if cfg!(any(target_os = "linux", target_os = "android")) {
+            $val
+        } else {
+            return Err(ParseError::Unimplemented($s.to_string()).into());
         }
     };
 }
 
-impl Parser {
-    pub(crate) fn new() -> Self {
-        Self::default()
+impl Parser {
+    pub(crate) fn new() -> Self {
+        Self::default()
     }
 
-    pub(crate) fn parse(self, operands: &[&str]) -> Result<Settings, ParseError> {
-        self.read(operands)?.validate()
+    pub(crate) fn parse(self, operands: &[&str]) -> Result<Settings, ParseError> {
+        self.read(operands)?.validate()
     }
 
-    pub(crate) fn read(mut self, operands: &[&str]) -> Result<Self, ParseError> {
-        for operand in operands {
-            self.parse_operand(operand)?;
+    pub(crate) fn read(mut self, operands: &[&str]) -> Result<Self, ParseError> {
+        for operand in operands {
+            self.parse_operand(operand)?;
         }
 
         Ok(self)
     }
 
-    pub(crate) fn validate(self) -> Result<Settings, ParseError> {
-        let conv = self.conv;
-        let conversion = match (conv.ascii, conv.ebcdic, conv.ibm) {
+    pub(crate) fn validate(self) -> Result<Settings, ParseError> {
+        let conv = self.conv;
+        let conversion = match (conv.ascii, conv.ebcdic, conv.ibm) {
             (false, false, false) => None,
-            (true, false, false) => Some(Conversion::Ascii),
-            (false, true, false) => Some(Conversion::Ebcdic),
-            (false, false, true) => Some(Conversion::Ibm),
-            _ => return Err(ParseError::MultipleFmtTable),
+            (true, false, false) => Some(Conversion::Ascii),
+            (false, true, false) => Some(Conversion::Ebcdic),
+            (false, false, true) => Some(Conversion::Ibm),
+            _ => return Err(ParseError::MultipleFmtTable),
         };
 
-        let case = match (conv.ucase, conv.lcase) {
+        let case = match (conv.ucase, conv.lcase) {
             (false, false) => None,
-            (true, false) => Some(Case::Upper),
-            (false, true) => Some(Case::Lower),
-            (true, true) => return Err(ParseError::MultipleUCaseLCase),
+            (true, false) => Some(Case::Upper),
+            (false, true) => Some(Case::Lower),
+            (true, true) => return Err(ParseError::MultipleUCaseLCase),
         };
 
-        let non_ascii = matches!(conversion, Some(Conversion::Ascii));
-        let conversion_table = get_ctable(conversion, case);
+        let non_ascii = matches!(conversion, Some(Conversion::Ascii));
+        let conversion_table = get_ctable(conversion, case);
 
-        if conv.nocreat && conv.excl {
-            return Err(ParseError::MultipleExclNoCreate);
+        if conv.nocreat && conv.excl {
+            return Err(ParseError::MultipleExclNoCreate);
         }
 
-        // The GNU docs state that
-        // - ascii implies unblock
-        // - ebcdic and ibm imply block
-        // This has a side effect in how it's implemented in GNU, because this errors:
-        //     conv=block,unblock
-        // but these don't:
-        //     conv=ascii,block,unblock
-        //     conv=block,ascii,unblock
-        //     conv=block,unblock,ascii
-        //     conv=block conv=unblock conv=ascii
-        let block = if let Some(cbs) = self.cbs {
-            match conversion {
-                Some(Conversion::Ascii) => Some(Block::Unblock(cbs)),
-                Some(_) => Some(Block::Block(cbs)),
-                None => match (conv.block, conv.unblock) {
+        // The GNU docs state that
+        // - ascii implies unblock
+        // - ebcdic and ibm imply block
+        // This has a side effect in how it's implemented in GNU, because this errors:
+        //     conv=block,unblock
+        // but these don't:
+        //     conv=ascii,block,unblock
+        //     conv=block,ascii,unblock
+        //     conv=block,unblock,ascii
+        //     conv=block conv=unblock conv=ascii
+        let block = if let Some(cbs) = self.cbs {
+            match conversion {
+                Some(Conversion::Ascii) => Some(Block::Unblock(cbs)),
+                Some(_) => Some(Block::Block(cbs)),
+                None => match (conv.block, conv.unblock) {
                     (false, false) => None,
-                    (true, false) => Some(Block::Block(cbs)),
-                    (false, true) => Some(Block::Unblock(cbs)),
-                    (true, true) => return Err(ParseError::MultipleBlockUnblock),
+                    (true, false) => Some(Block::Block(cbs)),
+                    (false, true) => Some(Block::Unblock(cbs)),
+                    (true, true) => return Err(ParseError::MultipleBlockUnblock),
                 },
             }
-        } else if conv.block || conv.unblock {
-            return Err(ParseError::BlockUnblockWithoutCBS);
-        } else {
-            None
-        };
+        } else if conv.block || conv.unblock {
+            return Err(ParseError::BlockUnblockWithoutCBS);
+        } else {
+            None
+        };
 
-        let iconv = IConvFlags {
-            mode: conversion_mode(conversion_table, block, non_ascii, conv.sync),
-            swab: conv.swab,
-            sync: if conv.sync {
-                if block.is_some() {
+        let iconv = IConvFlags {
+            mode: conversion_mode(conversion_table, block, non_ascii, conv.sync),
+            swab: conv.swab,
+            sync: if conv.sync {
+                if block.is_some() {
                     Some(b' ')
-                } else {
+                } else {
                     Some(0u8)
                 }
-            } else {
-                None
-            },
-            noerror: conv.noerror,
+            } else {
+                None
+            },
+            noerror: conv.noerror,
         };
 
-        let oconv = OConvFlags {
-            sparse: conv.sparse,
-            excl: conv.excl,
-            nocreat: conv.nocreat,
-            notrunc: conv.notrunc,
-            fdatasync: conv.fdatasync,
-            fsync: conv.fsync,
+        let oconv = OConvFlags {
+            sparse: conv.sparse,
+            excl: conv.excl,
+            nocreat: conv.nocreat,
+            notrunc: conv.notrunc,
+            fdatasync: conv.fdatasync,
+            fsync: conv.fsync,
         };
 
-        let skip = self
-            .skip
-            .force_bytes_if(self.iflag.skip_bytes)
-            .to_bytes(self.ibs as u64);
+        let skip = self
+            .skip
+            .force_bytes_if(self.iflag.skip_bytes)
+            .to_bytes(self.ibs as u64);
 
-        let seek = self
-            .seek
-            .force_bytes_if(self.oflag.seek_bytes)
-            .to_bytes(self.obs as u64);
+        let seek = self
+            .seek
+            .force_bytes_if(self.oflag.seek_bytes)
+            .to_bytes(self.obs as u64);
 
-        let count = self.count.map(|c| c.force_bytes_if(self.iflag.count_bytes));
+        let count = self.count.map(|c| c.force_bytes_if(self.iflag.count_bytes));
 
-        Ok(Settings {
-            skip,
-            seek,
-            count,
-            iconv,
-            oconv,
-            ibs: self.ibs,
-            obs: self.obs,
-            infile: self.infile,
-            outfile: self.outfile,
-            iflags: self.iflag,
-            oflags: self.oflag,
-            status: self.status,
+        Ok(Settings {
+            skip,
+            seek,
+            count,
+            iconv,
+            oconv,
+            ibs: self.ibs,
+            obs: self.obs,
+            infile: self.infile,
+            outfile: self.outfile,
+            iflags: self.iflag,
+            oflags: self.oflag,
+            status: self.status,
         })
     }
 
-    fn parse_operand(&mut self, operand: &str) -> Result<(), ParseError> {
-        match operand.split_once('=') {
-            None => return Err(ParseError::UnrecognizedOperand(operand.to_string())),
-            Some((k, v)) => match k {
-                "bs" => {
-                    let bs = self.parse_bytes(k, v)?;
-                    self.ibs = bs;
-                    self.obs = bs;
+    fn parse_operand(&mut self, operand: &str) -> Result<(), ParseError> {
+        match operand.split_once('=') {
+            None => return Err(ParseError::UnrecognizedOperand(operand.to_string())),
+            Some((k, v)) => match k {
+                "bs" => {
+                    let bs = self.parse_bytes(k, v)?;
+                    self.ibs = bs;
+                    self.obs = bs;
                 }
-                "cbs" => self.cbs = Some(self.parse_bytes(k, v)?),
-                "conv" => self.parse_conv_flags(v)?,
-                "count" => self.count = Some(self.parse_n(v)?),
-                "ibs" => self.ibs = self.parse_bytes(k, v)?,
-                "if" => self.infile = Some(v.to_string()),
-                "iflag" => self.parse_input_flags(v)?,
-                "obs" => self.obs = self.parse_bytes(k, v)?,
-                "of" => self.outfile = Some(v.to_string()),
-                "oflag" => self.parse_output_flags(v)?,
-                "seek" | "oseek" => self.seek = self.parse_n(v)?,
-                "skip" | "iseek" => self.skip = self.parse_n(v)?,
-                "status" => self.status = Some(self.parse_status_level(v)?),
-                _ => return Err(ParseError::UnrecognizedOperand(operand.to_string())),
+                "cbs" => self.cbs = Some(self.parse_bytes(k, v)?),
+                "conv" => self.parse_conv_flags(v)?,
+                "count" => self.count = Some(self.parse_n(v)?),
+                "ibs" => self.ibs = self.parse_bytes(k, v)?,
+                "if" => self.infile = Some(v.to_string()),
+                "iflag" => self.parse_input_flags(v)?,
+                "obs" => self.obs = self.parse_bytes(k, v)?,
+                "of" => self.outfile = Some(v.to_string()),
+                "oflag" => self.parse_output_flags(v)?,
+                "seek" | "oseek" => self.seek = self.parse_n(v)?,
+                "skip" | "iseek" => self.skip = self.parse_n(v)?,
+                "status" => self.status = Some(self.parse_status_level(v)?),
+                _ => return Err(ParseError::UnrecognizedOperand(operand.to_string())),
             },
         }
         Ok(())
     }
 
-    fn parse_n(&self, val: &str) -> Result<Num, ParseError> {
-        let n = parse_bytes_with_opt_multiplier(val)?;
-        Ok(if val.ends_with('B') {
-            Num::Bytes(n)
-        } else {
-            Num::Blocks(n)
+    fn parse_n(&self, val: &str) -> Result<Num, ParseError> {
+        let n = parse_bytes_with_opt_multiplier(val)?;
+        Ok(if val.ends_with('B') {
+            Num::Bytes(n)
+        } else {
+            Num::Blocks(n)
         })
     }
 
-    fn parse_bytes(&self, arg: &str, val: &str) -> Result<usize, ParseError> {
-        parse_bytes_with_opt_multiplier(val)?
-            .try_into()
-            .map_err(|_| ParseError::BsOutOfRange(arg.to_string()))
+    fn parse_bytes(&self, arg: &str, val: &str) -> Result<usize, ParseError> {
+        parse_bytes_with_opt_multiplier(val)?
+            .try_into()
+            .map_err(|_| ParseError::BsOutOfRange(arg.to_string()))
     }
 
-    fn parse_status_level(&self, val: &str) -> Result<StatusLevel, ParseError> {
-        match val {
-            "none" => Ok(StatusLevel::None),
-            "noxfer" => Ok(StatusLevel::Noxfer),
-            "progress" => Ok(StatusLevel::Progress),
-            _ => Err(ParseError::StatusLevelNotRecognized(val.to_string())),
+    fn parse_status_level(&self, val: &str) -> Result<StatusLevel, ParseError> {
+        match val {
+            "none" => Ok(StatusLevel::None),
+            "noxfer" => Ok(StatusLevel::Noxfer),
+            "progress" => Ok(StatusLevel::Progress),
+            _ => Err(ParseError::StatusLevelNotRecognized(val.to_string())),
         }
     }
 
-    fn parse_input_flags(&mut self, val: &str) -> Result<(), ParseError> {
-        let mut i = &mut self.iflag;
-        for f in val.split(',') {
-            match f {
-                // Common flags
-                "cio" => return Err(ParseError::Unimplemented(f.to_string())),
-                "direct" => linux_only!(f, i.direct = true),
-                "directory" => linux_only!(f, i.directory = true),
-                "dsync" => linux_only!(f, i.dsync = true),
-                "sync" => linux_only!(f, i.sync = true),
-                "nocache" => return Err(ParseError::Unimplemented(f.to_string())),
-                "nonblock" => linux_only!(f, i.nonblock = true),
-                "noatime" => linux_only!(f, i.noatime = true),
-                "noctty" => linux_only!(f, i.noctty = true),
-                "nofollow" => linux_only!(f, i.nofollow = true),
-                "nolinks" => return Err(ParseError::Unimplemented(f.to_string())),
-                "binary" => return Err(ParseError::Unimplemented(f.to_string())),
-                "text" => return Err(ParseError::Unimplemented(f.to_string())),
+    fn parse_input_flags(&mut self, val: &str) -> Result<(), ParseError> {
+        let mut i = &mut self.iflag;
+        for f in val.split(',') {
+            match f {
+                // Common flags
+                "cio" => return Err(ParseError::Unimplemented(f.to_string())),
+                "direct" => linux_only!(f, i.direct = true),
+                "directory" => linux_only!(f, i.directory = true),
+                "dsync" => linux_only!(f, i.dsync = true),
+                "sync" => linux_only!(f, i.sync = true),
+                "nocache" => return Err(ParseError::Unimplemented(f.to_string())),
+                "nonblock" => linux_only!(f, i.nonblock = true),
+                "noatime" => linux_only!(f, i.noatime = true),
+                "noctty" => linux_only!(f, i.noctty = true),
+                "nofollow" => linux_only!(f, i.nofollow = true),
+                "nolinks" => return Err(ParseError::Unimplemented(f.to_string())),
+                "binary" => return Err(ParseError::Unimplemented(f.to_string())),
+                "text" => return Err(ParseError::Unimplemented(f.to_string())),
 
-                // Input-only flags
-                "fullblock" => i.fullblock = true,
-                "count_bytes" => i.count_bytes = true,
-                "skip_bytes" => i.skip_bytes = true,
-                // GNU silently ignores oflags given as iflag.
-                "append" | "seek_bytes" => {}
-                _ => return Err(ParseError::FlagNoMatch(f.to_string())),
+                // Input-only flags
+                "fullblock" => i.fullblock = true,
+                "count_bytes" => i.count_bytes = true,
+                "skip_bytes" => i.skip_bytes = true,
+                // GNU silently ignores oflags given as iflag.
+                "append" | "seek_bytes" => {}
+                _ => return Err(ParseError::FlagNoMatch(f.to_string())),
             }
         }
         Ok(())
     }
 
-    fn parse_output_flags(&mut self, val: &str) -> Result<(), ParseError> {
-        let mut o = &mut self.oflag;
-        for f in val.split(',') {
-            match f {
-                // Common flags
-                "cio" => return Err(ParseError::Unimplemented(val.to_string())),
-                "direct" => linux_only!(f, o.direct = true),
-                "directory" => linux_only!(f, o.directory = true),
-                "dsync" => linux_only!(f, o.dsync = true),
-                "sync" => linux_only!(f, o.sync = true),
-                "nocache" => return Err(ParseError::Unimplemented(f.to_string())),
-                "nonblock" => linux_only!(f, o.nonblock = true),
-                "noatime" => linux_only!(f, o.noatime = true),
-                "noctty" => linux_only!(f, o.noctty = true),
-                "nofollow" => linux_only!(f, o.nofollow = true),
-                "nolinks" => return Err(ParseError::Unimplemented(f.to_string())),
-                "binary" => return Err(ParseError::Unimplemented(f.to_string())),
-                "text" => return Err(ParseError::Unimplemented(f.to_string())),
+    fn parse_output_flags(&mut self, val: &str) -> Result<(), ParseError> {
+        let mut o = &mut self.oflag;
+        for f in val.split(',') {
+            match f {
+                // Common flags
+                "cio" => return Err(ParseError::Unimplemented(val.to_string())),
+                "direct" => linux_only!(f, o.direct = true),
+                "directory" => linux_only!(f, o.directory = true),
+                "dsync" => linux_only!(f, o.dsync = true),
+                "sync" => linux_only!(f, o.sync = true),
+                "nocache" => return Err(ParseError::Unimplemented(f.to_string())),
+                "nonblock" => linux_only!(f, o.nonblock = true),
+                "noatime" => linux_only!(f, o.noatime = true),
+                "noctty" => linux_only!(f, o.noctty = true),
+                "nofollow" => linux_only!(f, o.nofollow = true),
+                "nolinks" => return Err(ParseError::Unimplemented(f.to_string())),
+                "binary" => return Err(ParseError::Unimplemented(f.to_string())),
+                "text" => return Err(ParseError::Unimplemented(f.to_string())),
 
-                // Output-only flags
-                "append" => o.append = true,
-                "seek_bytes" => o.seek_bytes = true,
-                // GNU silently ignores iflags given as oflag.
-                "fullblock" | "count_bytes" | "skip_bytes" => {}
-                _ => return Err(ParseError::FlagNoMatch(f.to_string())),
+                // Output-only flags
+                "append" => o.append = true,
+                "seek_bytes" => o.seek_bytes = true,
+                // GNU silently ignores iflags given as oflag.
+                "fullblock" | "count_bytes" | "skip_bytes" => {}
+                _ => return Err(ParseError::FlagNoMatch(f.to_string())),
             }
         }
         Ok(())
     }
 
-    fn parse_conv_flags(&mut self, val: &str) -> Result<(), ParseError> {
-        let mut c = &mut self.conv;
-        for f in val.split(',') {
-            match f {
-                // Conversion
-                "ascii" => c.ascii = true,
-                "ebcdic" => c.ebcdic = true,
-                "ibm" => c.ibm = true,
+    fn parse_conv_flags(&mut self, val: &str) -> Result<(), ParseError> {
+        let mut c = &mut self.conv;
+        for f in val.split(',') {
+            match f {
+                // Conversion
+                "ascii" => c.ascii = true,
+                "ebcdic" => c.ebcdic = true,
+                "ibm" => c.ibm = true,
 
-                // Case
-                "lcase" => c.lcase = true,
-                "ucase" => c.ucase = true,
+                // Case
+                "lcase" => c.lcase = true,
+                "ucase" => c.ucase = true,
 
-                // Block
-                "block" => c.block = true,
-                "unblock" => c.unblock = true,
+                // Block
+                "block" => c.block = true,
+                "unblock" => c.unblock = true,
 
-                // Other input
-                "swab" => c.swab = true,
-                "sync" => c.sync = true,
-                "noerror" => c.noerror = true,
+                // Other input
+                "swab" => c.swab = true,
+                "sync" => c.sync = true,
+                "noerror" => c.noerror = true,
 
-                // Output
-                "sparse" => c.sparse = true,
-                "excl" => c.excl = true,
-                "nocreat" => c.nocreat = true,
-                "notrunc" => c.notrunc = true,
-                "fdatasync" => c.fdatasync = true,
-                "fsync" => c.fsync = true,
-                _ => return Err(ParseError::ConvFlagNoMatch(f.to_string())),
+                // Output
+                "sparse" => c.sparse = true,
+                "excl" => c.excl = true,
+                "nocreat" => c.nocreat = true,
+                "notrunc" => c.notrunc = true,
+                "fdatasync" => c.fdatasync = true,
+                "fsync" => c.fsync = true,
+                _ => return Err(ParseError::ConvFlagNoMatch(f.to_string())),
             }
         }
         Ok(())
     }
 }
 
-impl std::fmt::Display for ParseError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::UnrecognizedOperand(arg) => {
-                write!(f, "Unrecognized operand '{}'", arg)
+impl std::fmt::Display for ParseError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::UnrecognizedOperand(arg) => {
+                write!(f, "Unrecognized operand '{}'", arg)
             }
-            Self::MultipleFmtTable => {
+            Self::MultipleFmtTable => {
                 write!(
-                    f,
-                    "Only one of conv=ascii conv=ebcdic or conv=ibm may be specified"
-                )
+                    f,
+                    "Only one of conv=ascii conv=ebcdic or conv=ibm may be specified"
+                )
             }
-            Self::MultipleUCaseLCase => {
-                write!(f, "Only one of conv=lcase or conv=ucase may be specified")
+            Self::MultipleUCaseLCase => {
+                write!(f, "Only one of conv=lcase or conv=ucase may be specified")
             }
-            Self::MultipleBlockUnblock => {
-                write!(f, "Only one of conv=block or conv=unblock may be specified")
+            Self::MultipleBlockUnblock => {
+                write!(f, "Only one of conv=block or conv=unblock may be specified")
             }
-            Self::MultipleExclNoCreate => {
-                write!(f, "Only one ov conv=excl or conv=nocreat may be specified")
+            Self::MultipleExclNoCreate => {
+                write!(f, "Only one ov conv=excl or conv=nocreat may be specified")
             }
-            Self::FlagNoMatch(arg) => {
-                // Additional message about 'dd --help' is displayed only in this situation.
-                write!(
-                    f,
+            Self::FlagNoMatch(arg) => {
+                // Additional message about 'dd --help' is displayed only in this situation.
+                write!(
+                    f,
                     "invalid input flag: ‘{}’\nTry 'dd --help' for more information.",
-                    arg
+                    arg
                 )
             }
-            Self::ConvFlagNoMatch(arg) => {
-                write!(f, "Unrecognized conv=CONV -> {}", arg)
+            Self::ConvFlagNoMatch(arg) => {
+                write!(f, "Unrecognized conv=CONV -> {}", arg)
             }
-            Self::MultiplierStringParseFailure(arg) => {
-                write!(f, "Unrecognized byte multiplier -> {}", arg)
+            Self::MultiplierStringParseFailure(arg) => {
+                write!(f, "Unrecognized byte multiplier -> {}", arg)
             }
-            Self::MultiplierStringOverflow(arg) => {
+            Self::MultiplierStringOverflow(arg) => {
                 write!(
-                    f,
+                    f,
                     "Multiplier string would overflow on current system -> {}",
-                    arg
+                    arg
                 )
             }
-            Self::BlockUnblockWithoutCBS => {
-                write!(f, "conv=block or conv=unblock specified without cbs=N")
+            Self::BlockUnblockWithoutCBS => {
+                write!(f, "conv=block or conv=unblock specified without cbs=N")
             }
-            Self::StatusLevelNotRecognized(arg) => {
-                write!(f, "status=LEVEL not recognized -> {}", arg)
+            Self::StatusLevelNotRecognized(arg) => {
+                write!(f, "status=LEVEL not recognized -> {}", arg)
             }
-            Self::BsOutOfRange(arg) => {
-                write!(f, "{}=N cannot fit into memory", arg)
+            Self::BsOutOfRange(arg) => {
+                write!(f, "{}=N cannot fit into memory", arg)
             }
-            Self::Unimplemented(arg) => {
-                write!(f, "feature not implemented on this system -> {}", arg)
+            Self::Unimplemented(arg) => {
+                write!(f, "feature not implemented on this system -> {}", arg)
             }
-            Self::InvalidNumber(arg) => {
-                write!(f, "invalid number: ‘{}’", arg)
+            Self::InvalidNumber(arg) => {
+                write!(f, "invalid number: ‘{}’", arg)
             }
         }
     }
 }
 
-impl Error for ParseError {}
+impl Error for ParseError {}
 
-impl UError for ParseError {
-    fn code(&self) -> i32 {
-        1
-    }
+impl UError for ParseError {
+    fn code(&self) -> i32 {
+        1
+    }
 }
 
-fn show_zero_multiplier_warning() {
+fn show_zero_multiplier_warning() {
     show_warning!(
         "{} is a zero multiplier; use {} if that is intended",
-        "0x".quote(),
-        "00x".quote()
+        "0x".quote(),
+        "00x".quote()
     );
 }
 
-/// Parse bytes using str::parse, then map error if needed.
-fn parse_bytes_only(s: &str) -> Result<u64, ParseError> {
-    s.parse()
-        .map_err(|_| ParseError::MultiplierStringParseFailure(s.to_string()))
+/// Parse bytes using str::parse, then map error if needed.
+fn parse_bytes_only(s: &str) -> Result<u64, ParseError> {
+    s.parse()
+        .map_err(|_| ParseError::MultiplierStringParseFailure(s.to_string()))
 }
 
-/// Parse a number of bytes from the given string, assuming no `'x'` characters.
-///
-/// The `'x'` character means "multiply the number before the `'x'` by
-/// the number after the `'x'`". In order to compute the numbers
-/// before and after the `'x'`, use this function, which assumes there
-/// are no `'x'` characters in the string.
-///
-/// A suffix `'c'` means multiply by 1, `'w'` by 2, and `'b'` by
-/// 512. You can also use standard block size suffixes like `'k'` for
-/// 1024.
-///
-/// # Errors
-///
-/// If a number cannot be parsed or if the multiplication would cause
-/// an overflow.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// assert_eq!(parse_bytes_no_x("123", "123").unwrap(), 123);
-/// assert_eq!(parse_bytes_no_x("2c", "2c").unwrap(), 2 * 1);
-/// assert_eq!(parse_bytes_no_x("3w", "3w").unwrap(), 3 * 2);
-/// assert_eq!(parse_bytes_no_x("2b", "2b").unwrap(), 2 * 512);
-/// assert_eq!(parse_bytes_no_x("2k", "2k").unwrap(), 2 * 1024);
-/// ```
-fn parse_bytes_no_x(full: &str, s: &str) -> Result<u64, ParseError> {
-    let (num, multiplier) = match (s.find('c'), s.rfind('w'), s.rfind('b')) {
-        (None, None, None) => match uucore::parse_size::parse_size(s) {
-            Ok(n) => (n, 1),
-            Err(ParseSizeError::InvalidSuffix(_)) | Err(ParseSizeError::ParseFailure(_)) => {
-                return Err(ParseError::InvalidNumber(full.to_string()))
+/// Parse a number of bytes from the given string, assuming no `'x'` characters.
+///
+/// The `'x'` character means "multiply the number before the `'x'` by
+/// the number after the `'x'`". In order to compute the numbers
+/// before and after the `'x'`, use this function, which assumes there
+/// are no `'x'` characters in the string.
+///
+/// A suffix `'c'` means multiply by 1, `'w'` by 2, and `'b'` by
+/// 512. You can also use standard block size suffixes like `'k'` for
+/// 1024.
+///
+/// # Errors
+///
+/// If a number cannot be parsed or if the multiplication would cause
+/// an overflow.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// assert_eq!(parse_bytes_no_x("123", "123").unwrap(), 123);
+/// assert_eq!(parse_bytes_no_x("2c", "2c").unwrap(), 2 * 1);
+/// assert_eq!(parse_bytes_no_x("3w", "3w").unwrap(), 3 * 2);
+/// assert_eq!(parse_bytes_no_x("2b", "2b").unwrap(), 2 * 512);
+/// assert_eq!(parse_bytes_no_x("2k", "2k").unwrap(), 2 * 1024);
+/// ```
+fn parse_bytes_no_x(full: &str, s: &str) -> Result<u64, ParseError> {
+    let (num, multiplier) = match (s.find('c'), s.rfind('w'), s.rfind('b')) {
+        (None, None, None) => match uucore::parse_size::parse_size(s) {
+            Ok(n) => (n, 1),
+            Err(ParseSizeError::InvalidSuffix(_)) | Err(ParseSizeError::ParseFailure(_)) => {
+                return Err(ParseError::InvalidNumber(full.to_string()))
             }
-            Err(ParseSizeError::SizeTooBig(_)) => {
-                return Err(ParseError::MultiplierStringOverflow(full.to_string()))
+            Err(ParseSizeError::SizeTooBig(_)) => {
+                return Err(ParseError::MultiplierStringOverflow(full.to_string()))
             }
         },
-        (Some(i), None, None) => (parse_bytes_only(&s[..i])?, 1),
-        (None, Some(i), None) => (parse_bytes_only(&s[..i])?, 2),
-        (None, None, Some(i)) => (parse_bytes_only(&s[..i])?, 512),
-        _ => return Err(ParseError::MultiplierStringParseFailure(full.to_string())),
+        (Some(i), None, None) => (parse_bytes_only(&s[..i])?, 1),
+        (None, Some(i), None) => (parse_bytes_only(&s[..i])?, 2),
+        (None, None, Some(i)) => (parse_bytes_only(&s[..i])?, 512),
+        _ => return Err(ParseError::MultiplierStringParseFailure(full.to_string())),
     };
-    num.checked_mul(multiplier)
-        .ok_or_else(|| ParseError::MultiplierStringOverflow(full.to_string()))
+    num.checked_mul(multiplier)
+        .ok_or_else(|| ParseError::MultiplierStringOverflow(full.to_string()))
 }
 
-/// Parse byte and multiplier like 512, 5KiB, or 1G.
-/// Uses uucore::parse_size, and adds the 'w' and 'c' suffixes which are mentioned
-/// in dd's info page.
-pub fn parse_bytes_with_opt_multiplier(s: &str) -> Result<u64, ParseError> {
-    // TODO On my Linux system, there seems to be a maximum block size of 4096 bytes:
-    //
-    //     $ printf "%0.sa" {1..10000} | dd bs=4095 count=1 status=none | wc -c
-    //     4095
-    //     $ printf "%0.sa" {1..10000} | dd bs=4k count=1 status=none | wc -c
-    //     4096
-    //     $ printf "%0.sa" {1..10000} | dd bs=4097 count=1 status=none | wc -c
-    //     4096
-    //     $ printf "%0.sa" {1..10000} | dd bs=5k count=1 status=none | wc -c
-    //     4096
-    //
+/// Parse byte and multiplier like 512, 5KiB, or 1G.
+/// Uses uucore::parse_size, and adds the 'w' and 'c' suffixes which are mentioned
+/// in dd's info page.
+pub fn parse_bytes_with_opt_multiplier(s: &str) -> Result<u64, ParseError> {
+    // TODO On my Linux system, there seems to be a maximum block size of 4096 bytes:
+    //
+    //     $ printf "%0.sa" {1..10000} | dd bs=4095 count=1 status=none | wc -c
+    //     4095
+    //     $ printf "%0.sa" {1..10000} | dd bs=4k count=1 status=none | wc -c
+    //     4096
+    //     $ printf "%0.sa" {1..10000} | dd bs=4097 count=1 status=none | wc -c
+    //     4096
+    //     $ printf "%0.sa" {1..10000} | dd bs=5k count=1 status=none | wc -c
+    //     4096
+    //
 
-    // Split on the 'x' characters. Each component will be parsed
-    // individually, then multiplied together.
-    let parts: Vec<&str> = s.split('x').collect();
-    if parts.len() == 1 {
-        parse_bytes_no_x(s, parts[0])
-    } else {
-        let mut total: u64 = 1;
-        for part in parts {
-            if part == "0" {
-                show_zero_multiplier_warning();
+    // Split on the 'x' characters. Each component will be parsed
+    // individually, then multiplied together.
+    let parts: Vec<&str> = s.split('x').collect();
+    if parts.len() == 1 {
+        parse_bytes_no_x(s, parts[0])
+    } else {
+        let mut total: u64 = 1;
+        for part in parts {
+            if part == "0" {
+                show_zero_multiplier_warning();
             }
-            let num = parse_bytes_no_x(s, part)?;
-            total = total
-                .checked_mul(num)
-                .ok_or_else(|| ParseError::InvalidNumber(s.to_string()))?;
+            let num = parse_bytes_no_x(s, part)?;
+            total = total
+                .checked_mul(num)
+                .ok_or_else(|| ParseError::InvalidNumber(s.to_string()))?;
         }
-        Ok(total)
+        Ok(total)
     }
 }
 
-fn get_ctable(
-    conversion: Option<Conversion>,
-    case: Option<Case>,
-) -> Option<&'static ConversionTable> {
-    use crate::conversion_tables::*;
-    Some(match (conversion, case) {
-        (None, None) => return None,
-        (Some(conv), None) => match conv {
-            Conversion::Ascii => &EBCDIC_TO_ASCII,
-            Conversion::Ebcdic => &ASCII_TO_EBCDIC,
-            Conversion::Ibm => &ASCII_TO_IBM,
+fn get_ctable(
+    conversion: Option<Conversion>,
+    case: Option<Case>,
+) -> Option<&'static ConversionTable> {
+    use crate::conversion_tables::*;
+    Some(match (conversion, case) {
+        (None, None) => return None,
+        (Some(conv), None) => match conv {
+            Conversion::Ascii => &EBCDIC_TO_ASCII,
+            Conversion::Ebcdic => &ASCII_TO_EBCDIC,
+            Conversion::Ibm => &ASCII_TO_IBM,
         },
-        (None, Some(case)) => match case {
-            Case::Lower => &ASCII_UCASE_TO_LCASE,
-            Case::Upper => &ASCII_LCASE_TO_UCASE,
+        (None, Some(case)) => match case {
+            Case::Lower => &ASCII_UCASE_TO_LCASE,
+            Case::Upper => &ASCII_LCASE_TO_UCASE,
         },
-        (Some(conv), Some(case)) => match (conv, case) {
-            (Conversion::Ascii, Case::Upper) => &EBCDIC_TO_ASCII_LCASE_TO_UCASE,
-            (Conversion::Ascii, Case::Lower) => &EBCDIC_TO_ASCII_UCASE_TO_LCASE,
-            (Conversion::Ebcdic, Case::Upper) => &ASCII_TO_EBCDIC_LCASE_TO_UCASE,
-            (Conversion::Ebcdic, Case::Lower) => &ASCII_TO_EBCDIC_UCASE_TO_LCASE,
-            (Conversion::Ibm, Case::Upper) => &ASCII_TO_IBM_UCASE_TO_LCASE,
-            (Conversion::Ibm, Case::Lower) => &ASCII_TO_IBM_LCASE_TO_UCASE,
+        (Some(conv), Some(case)) => match (conv, case) {
+            (Conversion::Ascii, Case::Upper) => &EBCDIC_TO_ASCII_LCASE_TO_UCASE,
+            (Conversion::Ascii, Case::Lower) => &EBCDIC_TO_ASCII_UCASE_TO_LCASE,
+            (Conversion::Ebcdic, Case::Upper) => &ASCII_TO_EBCDIC_LCASE_TO_UCASE,
+            (Conversion::Ebcdic, Case::Lower) => &ASCII_TO_EBCDIC_UCASE_TO_LCASE,
+            (Conversion::Ibm, Case::Upper) => &ASCII_TO_IBM_UCASE_TO_LCASE,
+            (Conversion::Ibm, Case::Lower) => &ASCII_TO_IBM_LCASE_TO_UCASE,
         },
     })
 }
 
-/// Given the various command-line parameters, determine the conversion mode.
-///
-/// The `conv` command-line option can take many different values,
-/// each of which may combine with others. For example, `conv=ascii`,
-/// `conv=lcase`, `conv=sync`, and so on. The arguments to this
-/// function represent the settings of those various command-line
-/// parameters. This function translates those settings to a
-/// [`ConversionMode`].
-fn conversion_mode(
-    ctable: Option<&'static ConversionTable>,
-    block: Option<Block>,
-    is_ascii: bool,
-    is_sync: bool,
-) -> Option<ConversionMode> {
-    match (ctable, block) {
-        (Some(ct), None) => Some(ConversionMode::ConvertOnly(ct)),
-        (Some(ct), Some(Block::Block(cbs))) => {
-            if is_ascii {
-                Some(ConversionMode::ConvertThenBlock(ct, cbs, is_sync))
-            } else {
-                Some(ConversionMode::BlockThenConvert(ct, cbs, is_sync))
+/// Given the various command-line parameters, determine the conversion mode.
+///
+/// The `conv` command-line option can take many different values,
+/// each of which may combine with others. For example, `conv=ascii`,
+/// `conv=lcase`, `conv=sync`, and so on. The arguments to this
+/// function represent the settings of those various command-line
+/// parameters. This function translates those settings to a
+/// [`ConversionMode`].
+fn conversion_mode(
+    ctable: Option<&'static ConversionTable>,
+    block: Option<Block>,
+    is_ascii: bool,
+    is_sync: bool,
+) -> Option<ConversionMode> {
+    match (ctable, block) {
+        (Some(ct), None) => Some(ConversionMode::ConvertOnly(ct)),
+        (Some(ct), Some(Block::Block(cbs))) => {
+            if is_ascii {
+                Some(ConversionMode::ConvertThenBlock(ct, cbs, is_sync))
+            } else {
+                Some(ConversionMode::BlockThenConvert(ct, cbs, is_sync))
             }
         }
-        (Some(ct), Some(Block::Unblock(cbs))) => {
-            if is_ascii {
-                Some(ConversionMode::ConvertThenUnblock(ct, cbs))
-            } else {
-                Some(ConversionMode::UnblockThenConvert(ct, cbs))
+        (Some(ct), Some(Block::Unblock(cbs))) => {
+            if is_ascii {
+                Some(ConversionMode::ConvertThenUnblock(ct, cbs))
+            } else {
+                Some(ConversionMode::UnblockThenConvert(ct, cbs))
             }
         }
-        (None, Some(Block::Block(cbs))) => Some(ConversionMode::BlockOnly(cbs, is_sync)),
-        (None, Some(Block::Unblock(cbs))) => Some(ConversionMode::UnblockOnly(cbs)),
+        (None, Some(Block::Block(cbs))) => Some(ConversionMode::BlockOnly(cbs, is_sync)),
+        (None, Some(Block::Unblock(cbs))) => Some(ConversionMode::UnblockOnly(cbs)),
         (None, None) => None,
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use crate::parseargs::parse_bytes_with_opt_multiplier;
+    use crate::parseargs::parse_bytes_with_opt_multiplier;
 
-    #[test]
-    fn test_parse_bytes_with_opt_multiplier() {
-        assert_eq!(parse_bytes_with_opt_multiplier("123").unwrap(), 123);
-        assert_eq!(parse_bytes_with_opt_multiplier("123c").unwrap(), 123); // 123 * 1
-        assert_eq!(parse_bytes_with_opt_multiplier("123w").unwrap(), 123 * 2);
-        assert_eq!(parse_bytes_with_opt_multiplier("123b").unwrap(), 123 * 512);
-        assert_eq!(parse_bytes_with_opt_multiplier("123x3").unwrap(), 123 * 3);
-        assert_eq!(parse_bytes_with_opt_multiplier("123k").unwrap(), 123 * 1024);
-        assert_eq!(parse_bytes_with_opt_multiplier("1x2x3").unwrap(), 6); // 1 * 2 * 3
+    #[test]
+    fn test_parse_bytes_with_opt_multiplier() {
+        assert_eq!(parse_bytes_with_opt_multiplier("123").unwrap(), 123);
+        assert_eq!(parse_bytes_with_opt_multiplier("123c").unwrap(), 123); // 123 * 1
+        assert_eq!(parse_bytes_with_opt_multiplier("123w").unwrap(), 123 * 2);
+        assert_eq!(parse_bytes_with_opt_multiplier("123b").unwrap(), 123 * 512);
+        assert_eq!(parse_bytes_with_opt_multiplier("123x3").unwrap(), 123 * 3);
+        assert_eq!(parse_bytes_with_opt_multiplier("123k").unwrap(), 123 * 1024);
+        assert_eq!(parse_bytes_with_opt_multiplier("1x2x3").unwrap(), 6); // 1 * 2 * 3
 
-        assert_eq!(
-            parse_bytes_with_opt_multiplier("1wx2cx3w").unwrap(),
-            2 * 2 * (3 * 2) // (1 * 2) * (2 * 1) * (3 * 2)
-        );
-        assert!(parse_bytes_with_opt_multiplier("123asdf").is_err());
+        assert_eq!(
+            parse_bytes_with_opt_multiplier("1wx2cx3w").unwrap(),
+            2 * 2 * (3 * 2) // (1 * 2) * (2 * 1) * (3 * 2)
+        );
+        assert!(parse_bytes_with_opt_multiplier("123asdf").is_err());
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dd/progress.rs.html b/dev/src/uu_dd/progress.rs.html index 79edef5a1..3dfb741d9 100644 --- a/dev/src/uu_dd/progress.rs.html +++ b/dev/src/uu_dd/progress.rs.html @@ -1,4 +1,4 @@ -progress.rs - source
1
+progress.rs - source
1
 2
 3
 4
@@ -641,648 +641,648 @@
 641
 642
 643
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore btotal sigval
-//! Read and write progress tracking for dd.
-//!
-//! The [`ProgUpdate`] struct represents summary statistics for the
-//! read and write progress of a running `dd` process. The
-//! [`gen_prog_updater`] function can be used to implement a progress
-//! updater that runs in its own thread.
-use std::io::Write;
-use std::sync::mpsc;
-use std::time::Duration;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore btotal sigval
+//! Read and write progress tracking for dd.
+//!
+//! The [`ProgUpdate`] struct represents summary statistics for the
+//! read and write progress of a running `dd` process. The
+//! [`gen_prog_updater`] function can be used to implement a progress
+//! updater that runs in its own thread.
+use std::io::Write;
+use std::sync::mpsc;
+use std::time::Duration;
 
-use byte_unit::Byte;
+use byte_unit::Byte;
 
-// On Linux, we register a signal handler that prints progress updates.
-#[cfg(target_os = "linux")]
-use signal_hook::consts::signal;
-#[cfg(target_os = "linux")]
-use std::{
-    env,
-    error::Error,
-    sync::{
-        atomic::{AtomicUsize, Ordering},
-        Arc,
+// On Linux, we register a signal handler that prints progress updates.
+#[cfg(target_os = "linux")]
+use signal_hook::consts::signal;
+#[cfg(target_os = "linux")]
+use std::{
+    env,
+    error::Error,
+    sync::{
+        atomic::{AtomicUsize, Ordering},
+        Arc,
     },
 };
 
-/// Summary statistics for read and write progress of dd for a given duration.
-pub(crate) struct ProgUpdate {
-    /// Read statistics.
-    ///
-    /// This contains information about the number of blocks read from
-    /// the data source.
-    pub(crate) read_stat: ReadStat,
+/// Summary statistics for read and write progress of dd for a given duration.
+pub(crate) struct ProgUpdate {
+    /// Read statistics.
+    ///
+    /// This contains information about the number of blocks read from
+    /// the data source.
+    pub(crate) read_stat: ReadStat,
 
-    /// Write statistics.
-    ///
-    /// This contains information about the number of blocks and
-    /// number of bytes written to the data sink.
-    pub(crate) write_stat: WriteStat,
+    /// Write statistics.
+    ///
+    /// This contains information about the number of blocks and
+    /// number of bytes written to the data sink.
+    pub(crate) write_stat: WriteStat,
 
-    /// The time period over which the reads and writes were measured.
-    pub(crate) duration: Duration,
+    /// The time period over which the reads and writes were measured.
+    pub(crate) duration: Duration,
 
-    /// The status of the write.
-    ///
-    /// True if the write is completed, false if still in-progress.
-    pub(crate) complete: bool,
+    /// The status of the write.
+    ///
+    /// True if the write is completed, false if still in-progress.
+    pub(crate) complete: bool,
 }
 
-impl ProgUpdate {
-    /// Instantiate this struct.
-    pub(crate) fn new(
-        read_stat: ReadStat,
-        write_stat: WriteStat,
-        duration: Duration,
-        complete: bool,
-    ) -> Self {
-        Self {
-            read_stat,
-            write_stat,
-            duration,
-            complete,
+impl ProgUpdate {
+    /// Instantiate this struct.
+    pub(crate) fn new(
+        read_stat: ReadStat,
+        write_stat: WriteStat,
+        duration: Duration,
+        complete: bool,
+    ) -> Self {
+        Self {
+            read_stat,
+            write_stat,
+            duration,
+            complete,
         }
     }
 
-    /// Write the number of complete and partial records both read and written.
-    ///
-    /// The information is written to `w`.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// use std::io::Cursor;
-    /// use std::time::Duration;
-    /// use crate::progress::{ProgUpdate, ReadState, WriteStat};
-    ///
-    /// let read_stat = ReadStat::new(1, 2, 3);
-    /// let write_stat = WriteStat::new(4, 5, 6);
-    /// let duration = Duration::new(789, 0);
-    /// let prog_update = ProgUpdate {
-    ///     read_stat,
-    ///     write_stat,
-    ///     duration,
-    /// };
-    ///
-    /// let mut cursor = Cursor::new(vec![]);
-    /// prog_update.write_io_lines(&mut cursor).unwrap();
-    /// assert_eq!(
-    ///     cursor.get_ref(),
-    ///     b"1+2 records in\n3 truncated records\n4+5 records out\n"
-    /// );
-    /// ```
-    fn write_io_lines(&self, w: &mut impl Write) -> std::io::Result<()> {
-        self.read_stat.report(w)?;
-        self.write_stat.report(w)?;
-        match self.read_stat.records_truncated {
-            0 => {}
-            1 => writeln!(w, "1 truncated record")?,
-            n => writeln!(w, "{} truncated records", n)?,
+    /// Write the number of complete and partial records both read and written.
+    ///
+    /// The information is written to `w`.
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// use std::io::Cursor;
+    /// use std::time::Duration;
+    /// use crate::progress::{ProgUpdate, ReadState, WriteStat};
+    ///
+    /// let read_stat = ReadStat::new(1, 2, 3);
+    /// let write_stat = WriteStat::new(4, 5, 6);
+    /// let duration = Duration::new(789, 0);
+    /// let prog_update = ProgUpdate {
+    ///     read_stat,
+    ///     write_stat,
+    ///     duration,
+    /// };
+    ///
+    /// let mut cursor = Cursor::new(vec![]);
+    /// prog_update.write_io_lines(&mut cursor).unwrap();
+    /// assert_eq!(
+    ///     cursor.get_ref(),
+    ///     b"1+2 records in\n3 truncated records\n4+5 records out\n"
+    /// );
+    /// ```
+    fn write_io_lines(&self, w: &mut impl Write) -> std::io::Result<()> {
+        self.read_stat.report(w)?;
+        self.write_stat.report(w)?;
+        match self.read_stat.records_truncated {
+            0 => {}
+            1 => writeln!(w, "1 truncated record")?,
+            n => writeln!(w, "{} truncated records", n)?,
         }
         Ok(())
     }
 
-    /// Write the number of bytes written, duration, and throughput.
-    ///
-    /// The information is written to `w`. If `rewrite` is `true`,
-    /// then a `\r` character is written first and no newline is
-    /// written at the end. When writing to `stderr`, this has the
-    /// visual effect of overwriting the previous characters on the
-    /// line.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// use std::io::Cursor;
-    /// use std::time::Duration;
-    /// use crate::progress::{ProgUpdate, ReadState, WriteStat};
-    ///
-    /// let prog_update = ProgUpdate {
-    ///     read_stat: Default::default(),
-    ///     write_stat: Default::default(),
-    ///     duration: Duration::new(1, 0),  // one second
-    /// };
-    ///
-    /// let mut cursor = Cursor::new(vec![]);
-    /// let rewrite = false;
-    /// prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
-    /// assert_eq!(cursor.get_ref(), b"0 bytes copied, 1.0 s, 0 B/s\n");
-    /// ```
-    fn write_prog_line(&self, w: &mut impl Write, rewrite: bool) -> std::io::Result<()> {
-        let btotal_metric = Byte::from_bytes(self.write_stat.bytes_total)
-            .get_appropriate_unit(false)
-            .format(0);
-        let btotal_bin = Byte::from_bytes(self.write_stat.bytes_total)
-            .get_appropriate_unit(true)
-            .format(0);
-        let safe_millis = std::cmp::max(1, self.duration.as_millis());
-        let transfer_rate = Byte::from_bytes(1000 * (self.write_stat.bytes_total / safe_millis))
-            .get_appropriate_unit(false)
-            .format(1);
+    /// Write the number of bytes written, duration, and throughput.
+    ///
+    /// The information is written to `w`. If `rewrite` is `true`,
+    /// then a `\r` character is written first and no newline is
+    /// written at the end. When writing to `stderr`, this has the
+    /// visual effect of overwriting the previous characters on the
+    /// line.
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// use std::io::Cursor;
+    /// use std::time::Duration;
+    /// use crate::progress::{ProgUpdate, ReadState, WriteStat};
+    ///
+    /// let prog_update = ProgUpdate {
+    ///     read_stat: Default::default(),
+    ///     write_stat: Default::default(),
+    ///     duration: Duration::new(1, 0),  // one second
+    /// };
+    ///
+    /// let mut cursor = Cursor::new(vec![]);
+    /// let rewrite = false;
+    /// prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
+    /// assert_eq!(cursor.get_ref(), b"0 bytes copied, 1.0 s, 0 B/s\n");
+    /// ```
+    fn write_prog_line(&self, w: &mut impl Write, rewrite: bool) -> std::io::Result<()> {
+        let btotal_metric = Byte::from_bytes(self.write_stat.bytes_total)
+            .get_appropriate_unit(false)
+            .format(0);
+        let btotal_bin = Byte::from_bytes(self.write_stat.bytes_total)
+            .get_appropriate_unit(true)
+            .format(0);
+        let safe_millis = std::cmp::max(1, self.duration.as_millis());
+        let transfer_rate = Byte::from_bytes(1000 * (self.write_stat.bytes_total / safe_millis))
+            .get_appropriate_unit(false)
+            .format(1);
 
-        let btotal = self.write_stat.bytes_total;
-        let duration = self.duration.as_secs_f64();
+        let btotal = self.write_stat.bytes_total;
+        let duration = self.duration.as_secs_f64();
 
-        // If we are rewriting the progress line, do write a carriage
-        // return (`\r`) at the beginning and don't write a newline
-        // (`\n`) at the end.
-        let (carriage_return, newline) = if rewrite { ("\r", "") } else { ("", "\n") };
+        // If we are rewriting the progress line, do write a carriage
+        // return (`\r`) at the beginning and don't write a newline
+        // (`\n`) at the end.
+        let (carriage_return, newline) = if rewrite { ("\r", "") } else { ("", "\n") };
 
-        // If the number of bytes written is sufficiently large, then
-        // print a more concise representation of the number, like
-        // "1.2 kB" and "1.0 KiB".
-        if btotal < 1000 {
+        // If the number of bytes written is sufficiently large, then
+        // print a more concise representation of the number, like
+        // "1.2 kB" and "1.0 KiB".
+        if btotal < 1000 {
             write!(
-                w,
+                w,
                 "{}{} bytes copied, {:.1} s, {}/s{}",
-                carriage_return, btotal, duration, transfer_rate, newline,
+                carriage_return, btotal, duration, transfer_rate, newline,
             )
-        } else if btotal < 1024 {
+        } else if btotal < 1024 {
             write!(
-                w,
+                w,
                 "{}{} bytes ({}) copied, {:.1} s, {}/s{}",
-                carriage_return, btotal, btotal_metric, duration, transfer_rate, newline,
+                carriage_return, btotal, btotal_metric, duration, transfer_rate, newline,
             )
-        } else {
+        } else {
             write!(
-                w,
+                w,
                 "{}{} bytes ({}, {}) copied, {:.1} s, {}/s{}",
-                carriage_return,
-                btotal,
-                btotal_metric,
-                btotal_bin,
-                duration,
-                transfer_rate,
-                newline,
+                carriage_return,
+                btotal,
+                btotal_metric,
+                btotal_bin,
+                duration,
+                transfer_rate,
+                newline,
             )
         }
     }
 
-    /// Write all summary statistics.
-    ///
-    /// This is a convenience method that calls
-    /// [`ProgUpdate::write_io_lines`] and
-    /// [`ProgUpdate::write_prog_line`] in that order. The information
-    /// is written to `w`. It optionally begins by writing a new line,
-    /// intended to handle the case of an existing progress line.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// use std::io::Cursor;
-    /// use std::time::Duration;
-    /// use crate::progress::{ProgUpdate, ReadState, WriteStat};
-    ///
-    /// let prog_update = ProgUpdate {
-    ///     read_stat: Default::default(),
-    ///     write_stat: Default::default(),
-    ///     duration: Duration::new(1, 0), // one second
-    /// };
-    /// let mut cursor = Cursor::new(vec![]);
-    /// prog_update.write_transfer_stats(&mut cursor, false).unwrap();
-    /// let mut iter = cursor.get_ref().split(|v| *v == b'\n');
-    /// assert_eq!(iter.next().unwrap(), b"0+0 records in");
-    /// assert_eq!(iter.next().unwrap(), b"0+0 records out");
-    /// assert_eq!(iter.next().unwrap(), b"0 bytes copied, 1.0 s, 0 B/s");
-    /// assert_eq!(iter.next().unwrap(), b"");
-    /// assert!(iter.next().is_none());
-    /// ```
-    fn write_transfer_stats(&self, w: &mut impl Write, new_line: bool) -> std::io::Result<()> {
-        if new_line {
-            writeln!(w)?;
+    /// Write all summary statistics.
+    ///
+    /// This is a convenience method that calls
+    /// [`ProgUpdate::write_io_lines`] and
+    /// [`ProgUpdate::write_prog_line`] in that order. The information
+    /// is written to `w`. It optionally begins by writing a new line,
+    /// intended to handle the case of an existing progress line.
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// use std::io::Cursor;
+    /// use std::time::Duration;
+    /// use crate::progress::{ProgUpdate, ReadState, WriteStat};
+    ///
+    /// let prog_update = ProgUpdate {
+    ///     read_stat: Default::default(),
+    ///     write_stat: Default::default(),
+    ///     duration: Duration::new(1, 0), // one second
+    /// };
+    /// let mut cursor = Cursor::new(vec![]);
+    /// prog_update.write_transfer_stats(&mut cursor, false).unwrap();
+    /// let mut iter = cursor.get_ref().split(|v| *v == b'\n');
+    /// assert_eq!(iter.next().unwrap(), b"0+0 records in");
+    /// assert_eq!(iter.next().unwrap(), b"0+0 records out");
+    /// assert_eq!(iter.next().unwrap(), b"0 bytes copied, 1.0 s, 0 B/s");
+    /// assert_eq!(iter.next().unwrap(), b"");
+    /// assert!(iter.next().is_none());
+    /// ```
+    fn write_transfer_stats(&self, w: &mut impl Write, new_line: bool) -> std::io::Result<()> {
+        if new_line {
+            writeln!(w)?;
         }
-        self.write_io_lines(w)?;
-        let rewrite = false;
-        self.write_prog_line(w, rewrite)?;
+        self.write_io_lines(w)?;
+        let rewrite = false;
+        self.write_prog_line(w, rewrite)?;
         Ok(())
     }
 
-    /// Print number of complete and partial records read and written to stderr.
-    ///
-    /// See [`ProgUpdate::write_io_lines`] for more information.
-    pub(crate) fn print_io_lines(&self) {
-        let mut stderr = std::io::stderr();
-        self.write_io_lines(&mut stderr).unwrap();
+    /// Print number of complete and partial records read and written to stderr.
+    ///
+    /// See [`ProgUpdate::write_io_lines`] for more information.
+    pub(crate) fn print_io_lines(&self) {
+        let mut stderr = std::io::stderr();
+        self.write_io_lines(&mut stderr).unwrap();
     }
 
-    /// Re-print the number of bytes written, duration, and throughput.
-    ///
-    /// See [`ProgUpdate::write_prog_line`] for more information.
-    pub(crate) fn reprint_prog_line(&self) {
-        let mut stderr = std::io::stderr();
-        let rewrite = true;
-        self.write_prog_line(&mut stderr, rewrite).unwrap();
+    /// Re-print the number of bytes written, duration, and throughput.
+    ///
+    /// See [`ProgUpdate::write_prog_line`] for more information.
+    pub(crate) fn reprint_prog_line(&self) {
+        let mut stderr = std::io::stderr();
+        let rewrite = true;
+        self.write_prog_line(&mut stderr, rewrite).unwrap();
     }
 
-    /// Write all summary statistics.
-    ///
-    /// See [`ProgUpdate::write_transfer_stats`] for more information.
-    pub(crate) fn print_transfer_stats(&self, new_line: bool) {
-        let mut stderr = std::io::stderr();
-        self.write_transfer_stats(&mut stderr, new_line).unwrap();
+    /// Write all summary statistics.
+    ///
+    /// See [`ProgUpdate::write_transfer_stats`] for more information.
+    pub(crate) fn print_transfer_stats(&self, new_line: bool) {
+        let mut stderr = std::io::stderr();
+        self.write_transfer_stats(&mut stderr, new_line).unwrap();
     }
 
-    /// Write all the final statistics.
-    pub(crate) fn print_final_stats(
+    /// Write all the final statistics.
+    pub(crate) fn print_final_stats(
         &self,
-        print_level: Option<StatusLevel>,
-        progress_printed: bool,
+        print_level: Option<StatusLevel>,
+        progress_printed: bool,
     ) {
-        match print_level {
-            Some(StatusLevel::None) => {}
-            Some(StatusLevel::Noxfer) => self.print_io_lines(),
-            Some(StatusLevel::Progress) | None => self.print_transfer_stats(progress_printed),
+        match print_level {
+            Some(StatusLevel::None) => {}
+            Some(StatusLevel::Noxfer) => self.print_io_lines(),
+            Some(StatusLevel::Progress) | None => self.print_transfer_stats(progress_printed),
         }
     }
 }
 
-/// Read statistics.
-///
-/// This contains information about the number of blocks read from the
-/// input file. A block is sometimes referred to as a "record".
-#[derive(Clone, Copy, Default)]
-pub(crate) struct ReadStat {
-    /// The number of complete blocks that have been read.
-    pub(crate) reads_complete: u64,
+/// Read statistics.
+///
+/// This contains information about the number of blocks read from the
+/// input file. A block is sometimes referred to as a "record".
+#[derive(Clone, Copy, Default)]
+pub(crate) struct ReadStat {
+    /// The number of complete blocks that have been read.
+    pub(crate) reads_complete: u64,
 
-    /// The number of partial blocks that have been read.
-    ///
-    /// A partial block read can happen if, for example, there are
-    /// fewer bytes in the input file than the specified input block
-    /// size.
-    pub(crate) reads_partial: u64,
+    /// The number of partial blocks that have been read.
+    ///
+    /// A partial block read can happen if, for example, there are
+    /// fewer bytes in the input file than the specified input block
+    /// size.
+    pub(crate) reads_partial: u64,
 
-    /// The number of truncated records.
-    ///
-    /// A truncated record can only occur in `conv=block` mode.
-    pub(crate) records_truncated: u32,
+    /// The number of truncated records.
+    ///
+    /// A truncated record can only occur in `conv=block` mode.
+    pub(crate) records_truncated: u32,
 }
 
-impl ReadStat {
-    /// Create a new instance.
-    #[allow(dead_code)]
-    fn new(complete: u64, partial: u64, truncated: u32) -> Self {
-        Self {
-            reads_complete: complete,
-            reads_partial: partial,
-            records_truncated: truncated,
+impl ReadStat {
+    /// Create a new instance.
+    #[allow(dead_code)]
+    fn new(complete: u64, partial: u64, truncated: u32) -> Self {
+        Self {
+            reads_complete: complete,
+            reads_partial: partial,
+            records_truncated: truncated,
         }
     }
 
-    /// Whether this counter has zero complete reads and zero partial reads.
-    pub(crate) fn is_empty(&self) -> bool {
-        self.reads_complete == 0 && self.reads_partial == 0
-    }
+    /// Whether this counter has zero complete reads and zero partial reads.
+    pub(crate) fn is_empty(&self) -> bool {
+        self.reads_complete == 0 && self.reads_partial == 0
+    }
 
-    /// Write the counts in the format required by `dd`.
-    ///
-    /// # Errors
-    ///
-    /// If there is a problem writing to `w`.
-    fn report(&self, w: &mut impl Write) -> std::io::Result<()> {
+    /// Write the counts in the format required by `dd`.
+    ///
+    /// # Errors
+    ///
+    /// If there is a problem writing to `w`.
+    fn report(&self, w: &mut impl Write) -> std::io::Result<()> {
         writeln!(
-            w,
+            w,
             "{}+{} records in",
-            self.reads_complete, self.reads_partial
+            self.reads_complete, self.reads_partial
         )?;
         Ok(())
     }
 }
 
-impl std::ops::AddAssign for ReadStat {
-    fn add_assign(&mut self, other: Self) {
-        *self = Self {
-            reads_complete: self.reads_complete + other.reads_complete,
-            reads_partial: self.reads_partial + other.reads_partial,
-            records_truncated: self.records_truncated + other.records_truncated,
+impl std::ops::AddAssign for ReadStat {
+    fn add_assign(&mut self, other: Self) {
+        *self = Self {
+            reads_complete: self.reads_complete + other.reads_complete,
+            reads_partial: self.reads_partial + other.reads_partial,
+            records_truncated: self.records_truncated + other.records_truncated,
         }
     }
 }
 
-/// Write statistics.
-///
-/// This contains information about the number of blocks written to
-/// the output file and the total number of bytes written.
-#[derive(Clone, Copy, Default)]
-pub(crate) struct WriteStat {
-    /// The number of complete blocks that have been written.
-    pub(crate) writes_complete: u64,
+/// Write statistics.
+///
+/// This contains information about the number of blocks written to
+/// the output file and the total number of bytes written.
+#[derive(Clone, Copy, Default)]
+pub(crate) struct WriteStat {
+    /// The number of complete blocks that have been written.
+    pub(crate) writes_complete: u64,
 
-    /// The number of partial blocks that have been written.
-    ///
-    /// A partial block write can happen if, for example, there are
-    /// fewer bytes in the input file than the specified output block
-    /// size.
-    pub(crate) writes_partial: u64,
+    /// The number of partial blocks that have been written.
+    ///
+    /// A partial block write can happen if, for example, there are
+    /// fewer bytes in the input file than the specified output block
+    /// size.
+    pub(crate) writes_partial: u64,
 
-    /// The total number of bytes written.
-    pub(crate) bytes_total: u128,
+    /// The total number of bytes written.
+    pub(crate) bytes_total: u128,
 }
 
-impl WriteStat {
-    /// Create a new instance.
-    #[allow(dead_code)]
-    fn new(complete: u64, partial: u64, bytes_total: u128) -> Self {
-        Self {
-            writes_complete: complete,
-            writes_partial: partial,
-            bytes_total,
+impl WriteStat {
+    /// Create a new instance.
+    #[allow(dead_code)]
+    fn new(complete: u64, partial: u64, bytes_total: u128) -> Self {
+        Self {
+            writes_complete: complete,
+            writes_partial: partial,
+            bytes_total,
         }
     }
 
-    /// Write the counts in the format required by `dd`.
-    ///
-    /// # Errors
-    ///
-    /// If there is a problem writing to `w`.
-    fn report(&self, w: &mut impl Write) -> std::io::Result<()> {
+    /// Write the counts in the format required by `dd`.
+    ///
+    /// # Errors
+    ///
+    /// If there is a problem writing to `w`.
+    fn report(&self, w: &mut impl Write) -> std::io::Result<()> {
         writeln!(
-            w,
+            w,
             "{}+{} records out",
-            self.writes_complete, self.writes_partial
+            self.writes_complete, self.writes_partial
         )
     }
 }
 
-impl std::ops::AddAssign for WriteStat {
-    fn add_assign(&mut self, other: Self) {
-        *self = Self {
-            writes_complete: self.writes_complete + other.writes_complete,
-            writes_partial: self.writes_partial + other.writes_partial,
-            bytes_total: self.bytes_total + other.bytes_total,
+impl std::ops::AddAssign for WriteStat {
+    fn add_assign(&mut self, other: Self) {
+        *self = Self {
+            writes_complete: self.writes_complete + other.writes_complete,
+            writes_partial: self.writes_partial + other.writes_partial,
+            bytes_total: self.bytes_total + other.bytes_total,
         }
     }
 }
 
-/// How much detail to report when printing transfer statistics.
-///
-/// This corresponds to the available settings of the `status`
-/// command-line argument.
-#[derive(Copy, Clone, Debug, PartialEq)]
-pub(crate) enum StatusLevel {
-    /// Report number of blocks read and written, throughput, and volume.
-    ///
-    /// This corresponds to `status=progress`.
-    Progress,
+/// How much detail to report when printing transfer statistics.
+///
+/// This corresponds to the available settings of the `status`
+/// command-line argument.
+#[derive(Copy, Clone, Debug, PartialEq)]
+pub(crate) enum StatusLevel {
+    /// Report number of blocks read and written, throughput, and volume.
+    ///
+    /// This corresponds to `status=progress`.
+    Progress,
 
-    /// Report number of blocks read and written, but no throughput and volume.
-    ///
-    /// This corresponds to `status=noxfer`.
-    Noxfer,
+    /// Report number of blocks read and written, but no throughput and volume.
+    ///
+    /// This corresponds to `status=noxfer`.
+    Noxfer,
 
-    /// Print no status information.
-    None,
+    /// Print no status information.
+    None,
 }
 
-/// Return a closure that can be used in its own thread to print progress info.
-///
-/// This function returns a closure that receives [`ProgUpdate`]
-/// instances sent through `rx`. When a [`ProgUpdate`] instance is
-/// received, the transfer statistics are re-printed to stderr.
-#[cfg(not(target_os = "linux"))]
-pub(crate) fn gen_prog_updater(
-    rx: mpsc::Receiver<ProgUpdate>,
-    print_level: Option<StatusLevel>,
-) -> impl Fn() {
-    move || {
-        let mut progress_printed = false;
-        while let Ok(update) = rx.recv() {
-            // Print the final read/write statistics.
-            if update.complete {
-                update.print_final_stats(print_level, progress_printed);
+/// Return a closure that can be used in its own thread to print progress info.
+///
+/// This function returns a closure that receives [`ProgUpdate`]
+/// instances sent through `rx`. When a [`ProgUpdate`] instance is
+/// received, the transfer statistics are re-printed to stderr.
+#[cfg(not(target_os = "linux"))]
+pub(crate) fn gen_prog_updater(
+    rx: mpsc::Receiver<ProgUpdate>,
+    print_level: Option<StatusLevel>,
+) -> impl Fn() {
+    move || {
+        let mut progress_printed = false;
+        while let Ok(update) = rx.recv() {
+            // Print the final read/write statistics.
+            if update.complete {
+                update.print_final_stats(print_level, progress_printed);
                 return;
             }
-            if Some(StatusLevel::Progress) == print_level {
-                update.reprint_prog_line();
-                progress_printed = true;
+            if Some(StatusLevel::Progress) == print_level {
+                update.reprint_prog_line();
+                progress_printed = true;
             }
         }
     }
 }
 
-/// Return a closure that can be used in its own thread to print progress info.
-///
-/// This function returns a closure that receives [`ProgUpdate`]
-/// instances sent through `rx`. When a [`ProgUpdate`] instance is
-/// received, the transfer statistics are re-printed to stderr.
-///
-/// The closure also registers a signal handler for `SIGUSR1`. When
-/// the `SIGUSR1` signal is sent to this process, the transfer
-/// statistics are printed to stderr.
-#[cfg(target_os = "linux")]
-pub(crate) fn gen_prog_updater(
-    rx: mpsc::Receiver<ProgUpdate>,
-    print_level: Option<StatusLevel>,
-) -> impl Fn() {
-    // TODO: SIGINFO: Trigger progress line reprint. BSD-style Linux only.
-    const SIGUSR1_USIZE: usize = signal::SIGUSR1 as usize;
-    fn posixly_correct() -> bool {
-        env::var("POSIXLY_CORRECT").is_ok()
+/// Return a closure that can be used in its own thread to print progress info.
+///
+/// This function returns a closure that receives [`ProgUpdate`]
+/// instances sent through `rx`. When a [`ProgUpdate`] instance is
+/// received, the transfer statistics are re-printed to stderr.
+///
+/// The closure also registers a signal handler for `SIGUSR1`. When
+/// the `SIGUSR1` signal is sent to this process, the transfer
+/// statistics are printed to stderr.
+#[cfg(target_os = "linux")]
+pub(crate) fn gen_prog_updater(
+    rx: mpsc::Receiver<ProgUpdate>,
+    print_level: Option<StatusLevel>,
+) -> impl Fn() {
+    // TODO: SIGINFO: Trigger progress line reprint. BSD-style Linux only.
+    const SIGUSR1_USIZE: usize = signal::SIGUSR1 as usize;
+    fn posixly_correct() -> bool {
+        env::var("POSIXLY_CORRECT").is_ok()
     }
-    fn register_linux_signal_handler(sigval: Arc<AtomicUsize>) -> Result<(), Box<dyn Error>> {
-        if !posixly_correct() {
-            signal_hook::flag::register_usize(signal::SIGUSR1, sigval, SIGUSR1_USIZE)?;
+    fn register_linux_signal_handler(sigval: Arc<AtomicUsize>) -> Result<(), Box<dyn Error>> {
+        if !posixly_correct() {
+            signal_hook::flag::register_usize(signal::SIGUSR1, sigval, SIGUSR1_USIZE)?;
         }
 
         Ok(())
     }
-    // --------------------------------------------------------------
-    move || {
-        let sigval = Arc::new(AtomicUsize::new(0));
+    // --------------------------------------------------------------
+    move || {
+        let sigval = Arc::new(AtomicUsize::new(0));
 
-        register_linux_signal_handler(sigval.clone()).unwrap_or_else(|e| {
-            if Some(StatusLevel::None) != print_level {
+        register_linux_signal_handler(sigval.clone()).unwrap_or_else(|e| {
+            if Some(StatusLevel::None) != print_level {
                 eprintln!(
                     "Internal dd Warning: Unable to register signal handler \n\t{}",
-                    e
+                    e
                 );
             }
         });
 
-        // Holds the state of whether we have printed the current progress.
-        // This is needed so that we know whether or not to print a newline
-        // character before outputting non-progress data.
-        let mut progress_printed = false;
-        while let Ok(update) = rx.recv() {
-            // Print the final read/write statistics.
-            if update.complete {
-                update.print_final_stats(print_level, progress_printed);
+        // Holds the state of whether we have printed the current progress.
+        // This is needed so that we know whether or not to print a newline
+        // character before outputting non-progress data.
+        let mut progress_printed = false;
+        while let Ok(update) = rx.recv() {
+            // Print the final read/write statistics.
+            if update.complete {
+                update.print_final_stats(print_level, progress_printed);
                 return;
             }
-            // (Re)print status line if progress is requested.
-            if Some(StatusLevel::Progress) == print_level && !update.complete {
-                update.reprint_prog_line();
-                progress_printed = true;
+            // (Re)print status line if progress is requested.
+            if Some(StatusLevel::Progress) == print_level && !update.complete {
+                update.reprint_prog_line();
+                progress_printed = true;
             }
-            // Handle signals and set the signal to un-seen.
-            // This will print a maximum of 1 time per second, even though it
-            // should be printing on every SIGUSR1.
-            if let SIGUSR1_USIZE = sigval.swap(0, Ordering::Relaxed) {
-                update.print_transfer_stats(progress_printed);
-                // Reset the progress printed, since print_transfer_stats always prints a newline.
-                progress_printed = false;
+            // Handle signals and set the signal to un-seen.
+            // This will print a maximum of 1 time per second, even though it
+            // should be printing on every SIGUSR1.
+            if let SIGUSR1_USIZE = sigval.swap(0, Ordering::Relaxed) {
+                update.print_transfer_stats(progress_printed);
+                // Reset the progress printed, since print_transfer_stats always prints a newline.
+                progress_printed = false;
             }
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use std::io::Cursor;
-    use std::time::Duration;
+    use std::io::Cursor;
+    use std::time::Duration;
 
-    use super::{ProgUpdate, ReadStat, WriteStat};
+    use super::{ProgUpdate, ReadStat, WriteStat};
 
-    fn prog_update_write(n: u128) -> ProgUpdate {
-        ProgUpdate {
-            read_stat: Default::default(),
-            write_stat: WriteStat {
-                bytes_total: n,
-                ..Default::default()
+    fn prog_update_write(n: u128) -> ProgUpdate {
+        ProgUpdate {
+            read_stat: Default::default(),
+            write_stat: WriteStat {
+                bytes_total: n,
+                ..Default::default()
             },
-            duration: Duration::new(1, 0), // one second
-            complete: false,
+            duration: Duration::new(1, 0), // one second
+            complete: false,
         }
     }
 
-    #[test]
-    fn test_read_stat_report() {
-        let read_stat = ReadStat::new(1, 2, 3);
-        let mut cursor = Cursor::new(vec![]);
-        read_stat.report(&mut cursor).unwrap();
-        assert_eq!(cursor.get_ref(), b"1+2 records in\n");
+    #[test]
+    fn test_read_stat_report() {
+        let read_stat = ReadStat::new(1, 2, 3);
+        let mut cursor = Cursor::new(vec![]);
+        read_stat.report(&mut cursor).unwrap();
+        assert_eq!(cursor.get_ref(), b"1+2 records in\n");
     }
 
-    #[test]
-    fn test_write_stat_report() {
-        let write_stat = WriteStat::new(1, 2, 3);
-        let mut cursor = Cursor::new(vec![]);
-        write_stat.report(&mut cursor).unwrap();
-        assert_eq!(cursor.get_ref(), b"1+2 records out\n");
+    #[test]
+    fn test_write_stat_report() {
+        let write_stat = WriteStat::new(1, 2, 3);
+        let mut cursor = Cursor::new(vec![]);
+        write_stat.report(&mut cursor).unwrap();
+        assert_eq!(cursor.get_ref(), b"1+2 records out\n");
     }
 
-    #[test]
-    fn test_prog_update_write_io_lines() {
-        let read_stat = ReadStat::new(1, 2, 3);
-        let write_stat = WriteStat::new(4, 5, 6);
-        let duration = Duration::new(789, 0);
-        let complete = false;
-        let prog_update = ProgUpdate {
-            read_stat,
-            write_stat,
-            duration,
-            complete,
+    #[test]
+    fn test_prog_update_write_io_lines() {
+        let read_stat = ReadStat::new(1, 2, 3);
+        let write_stat = WriteStat::new(4, 5, 6);
+        let duration = Duration::new(789, 0);
+        let complete = false;
+        let prog_update = ProgUpdate {
+            read_stat,
+            write_stat,
+            duration,
+            complete,
         };
 
-        let mut cursor = Cursor::new(vec![]);
-        prog_update.write_io_lines(&mut cursor).unwrap();
+        let mut cursor = Cursor::new(vec![]);
+        prog_update.write_io_lines(&mut cursor).unwrap();
         assert_eq!(
-            cursor.get_ref(),
-            b"1+2 records in\n4+5 records out\n3 truncated records\n"
-        );
+            cursor.get_ref(),
+            b"1+2 records in\n4+5 records out\n3 truncated records\n"
+        );
     }
 
-    #[test]
-    fn test_prog_update_write_prog_line() {
-        let prog_update = ProgUpdate {
-            read_stat: Default::default(),
-            write_stat: Default::default(),
-            duration: Duration::new(1, 0), // one second
-            complete: false,
+    #[test]
+    fn test_prog_update_write_prog_line() {
+        let prog_update = ProgUpdate {
+            read_stat: Default::default(),
+            write_stat: Default::default(),
+            duration: Duration::new(1, 0), // one second
+            complete: false,
         };
 
-        let mut cursor = Cursor::new(vec![]);
-        let rewrite = false;
-        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
-        // TODO The expected output string below is what our code
-        // produces today, but it does not match GNU dd:
-        //
-        //     $ : | dd
-        //     0 bytes copied, 7.9151e-05 s, 0.0 kB/s
-        //
-        // The throughput still does not match GNU dd. For the ones
-        // that include the concise byte counts, the format is also
-        // not right.
-        assert_eq!(cursor.get_ref(), b"0 bytes copied, 1.0 s, 0 B/s\n");
+        let mut cursor = Cursor::new(vec![]);
+        let rewrite = false;
+        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
+        // TODO The expected output string below is what our code
+        // produces today, but it does not match GNU dd:
+        //
+        //     $ : | dd
+        //     0 bytes copied, 7.9151e-05 s, 0.0 kB/s
+        //
+        // The throughput still does not match GNU dd. For the ones
+        // that include the concise byte counts, the format is also
+        // not right.
+        assert_eq!(cursor.get_ref(), b"0 bytes copied, 1.0 s, 0 B/s\n");
 
-        let prog_update = prog_update_write(999);
-        let mut cursor = Cursor::new(vec![]);
-        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
-        assert_eq!(cursor.get_ref(), b"999 bytes copied, 1.0 s, 0 B/s\n");
+        let prog_update = prog_update_write(999);
+        let mut cursor = Cursor::new(vec![]);
+        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
+        assert_eq!(cursor.get_ref(), b"999 bytes copied, 1.0 s, 0 B/s\n");
 
-        let prog_update = prog_update_write(1000);
-        let mut cursor = Cursor::new(vec![]);
-        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
+        let prog_update = prog_update_write(1000);
+        let mut cursor = Cursor::new(vec![]);
+        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
         assert_eq!(
-            cursor.get_ref(),
-            b"1000 bytes (1000 B) copied, 1.0 s, 1000 B/s\n"
-        );
+            cursor.get_ref(),
+            b"1000 bytes (1000 B) copied, 1.0 s, 1000 B/s\n"
+        );
 
-        let prog_update = prog_update_write(1023);
-        let mut cursor = Cursor::new(vec![]);
-        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
+        let prog_update = prog_update_write(1023);
+        let mut cursor = Cursor::new(vec![]);
+        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
         assert_eq!(
-            cursor.get_ref(),
-            b"1023 bytes (1 KB) copied, 1.0 s, 1000 B/s\n"
-        );
+            cursor.get_ref(),
+            b"1023 bytes (1 KB) copied, 1.0 s, 1000 B/s\n"
+        );
 
-        let prog_update = prog_update_write(1024);
-        let mut cursor = Cursor::new(vec![]);
-        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
+        let prog_update = prog_update_write(1024);
+        let mut cursor = Cursor::new(vec![]);
+        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
         assert_eq!(
-            std::str::from_utf8(cursor.get_ref()).unwrap(),
-            "1024 bytes (1 KB, 1024 B) copied, 1.0 s, 1000 B/s\n"
-        );
+            std::str::from_utf8(cursor.get_ref()).unwrap(),
+            "1024 bytes (1 KB, 1024 B) copied, 1.0 s, 1000 B/s\n"
+        );
     }
 
-    #[test]
-    fn write_transfer_stats() {
-        let prog_update = ProgUpdate {
-            read_stat: Default::default(),
-            write_stat: Default::default(),
-            duration: Duration::new(1, 0), // one second
-            complete: false,
+    #[test]
+    fn write_transfer_stats() {
+        let prog_update = ProgUpdate {
+            read_stat: Default::default(),
+            write_stat: Default::default(),
+            duration: Duration::new(1, 0), // one second
+            complete: false,
         };
-        let mut cursor = Cursor::new(vec![]);
-        prog_update
-            .write_transfer_stats(&mut cursor, false)
-            .unwrap();
-        let mut iter = cursor.get_ref().split(|v| *v == b'\n');
-        assert_eq!(iter.next().unwrap(), b"0+0 records in");
-        assert_eq!(iter.next().unwrap(), b"0+0 records out");
-        assert_eq!(iter.next().unwrap(), b"0 bytes copied, 1.0 s, 0 B/s");
-        assert_eq!(iter.next().unwrap(), b"");
-        assert!(iter.next().is_none());
+        let mut cursor = Cursor::new(vec![]);
+        prog_update
+            .write_transfer_stats(&mut cursor, false)
+            .unwrap();
+        let mut iter = cursor.get_ref().split(|v| *v == b'\n');
+        assert_eq!(iter.next().unwrap(), b"0+0 records in");
+        assert_eq!(iter.next().unwrap(), b"0+0 records out");
+        assert_eq!(iter.next().unwrap(), b"0 bytes copied, 1.0 s, 0 B/s");
+        assert_eq!(iter.next().unwrap(), b"");
+        assert!(iter.next().is_none());
     }
 
-    #[test]
-    fn write_final_transfer_stats() {
-        // Tests the formatting of the final statistics written after a progress line.
-        let prog_update = ProgUpdate {
-            read_stat: Default::default(),
-            write_stat: Default::default(),
-            duration: Duration::new(1, 0), // one second
-            complete: false,
+    #[test]
+    fn write_final_transfer_stats() {
+        // Tests the formatting of the final statistics written after a progress line.
+        let prog_update = ProgUpdate {
+            read_stat: Default::default(),
+            write_stat: Default::default(),
+            duration: Duration::new(1, 0), // one second
+            complete: false,
         };
-        let mut cursor = Cursor::new(vec![]);
-        let rewrite = true;
-        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
-        prog_update.write_transfer_stats(&mut cursor, true).unwrap();
-        let mut iter = cursor.get_ref().split(|v| *v == b'\n');
-        assert_eq!(iter.next().unwrap(), b"\r0 bytes copied, 1.0 s, 0 B/s");
-        assert_eq!(iter.next().unwrap(), b"0+0 records in");
-        assert_eq!(iter.next().unwrap(), b"0+0 records out");
-        assert_eq!(iter.next().unwrap(), b"0 bytes copied, 1.0 s, 0 B/s");
-        assert_eq!(iter.next().unwrap(), b"");
-        assert!(iter.next().is_none());
+        let mut cursor = Cursor::new(vec![]);
+        let rewrite = true;
+        prog_update.write_prog_line(&mut cursor, rewrite).unwrap();
+        prog_update.write_transfer_stats(&mut cursor, true).unwrap();
+        let mut iter = cursor.get_ref().split(|v| *v == b'\n');
+        assert_eq!(iter.next().unwrap(), b"\r0 bytes copied, 1.0 s, 0 B/s");
+        assert_eq!(iter.next().unwrap(), b"0+0 records in");
+        assert_eq!(iter.next().unwrap(), b"0+0 records out");
+        assert_eq!(iter.next().unwrap(), b"0 bytes copied, 1.0 s, 0 B/s");
+        assert_eq!(iter.next().unwrap(), b"");
+        assert!(iter.next().is_none());
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_df/blocks.rs.html b/dev/src/uu_df/blocks.rs.html index 3e5d301ad..8a53768ab 100644 --- a/dev/src/uu_df/blocks.rs.html +++ b/dev/src/uu_df/blocks.rs.html @@ -1,4 +1,4 @@ -blocks.rs - source
1
+blocks.rs - source
1
 2
 3
 4
@@ -298,22 +298,22 @@
 298
 299
 300
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-//! Types for representing and displaying block sizes.
-use crate::{OPT_BLOCKSIZE, OPT_PORTABILITY};
-use clap::ArgMatches;
-use std::{env, fmt};
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+//! Types for representing and displaying block sizes.
+use crate::{OPT_BLOCKSIZE, OPT_PORTABILITY};
+use clap::ArgMatches;
+use std::{env, fmt};
 
-use uucore::{
-    display::Quotable,
-    parse_size::{parse_size, ParseSizeError},
+use uucore::{
+    display::Quotable,
+    parse_size::{parse_size, ParseSizeError},
 };
 
-/// The first ten powers of 1024.
-const IEC_BASES: [u128; 10] = [
+/// The first ten powers of 1024.
+const IEC_BASES: [u128; 10] = [
     1,
     1_024,
     1_048_576,
@@ -326,8 +326,8 @@
     1_237_940_039_285_380_274_899_124_224,
 ];
 
-/// The first ten powers of 1000.
-const SI_BASES: [u128; 10] = [
+/// The first ten powers of 1000.
+const SI_BASES: [u128; 10] = [
     1,
     1_000,
     1_000_000,
@@ -340,263 +340,263 @@
     1_000_000_000_000_000_000_000_000_000,
 ];
 
-/// A SuffixType determines whether the suffixes are 1000 or 1024 based, and whether they are
-/// intended for HumanReadable mode or not.
-#[derive(Clone, Copy)]
-pub(crate) enum SuffixType {
-    Iec,
-    Si,
-    HumanReadable(HumanReadable),
+/// A SuffixType determines whether the suffixes are 1000 or 1024 based, and whether they are
+/// intended for HumanReadable mode or not.
+#[derive(Clone, Copy)]
+pub(crate) enum SuffixType {
+    Iec,
+    Si,
+    HumanReadable(HumanReadable),
 }
 
-impl SuffixType {
-    /// The first ten powers of 1024 and 1000, respectively.
-    fn bases(&self) -> [u128; 10] {
-        match self {
-            Self::Iec | Self::HumanReadable(HumanReadable::Binary) => IEC_BASES,
-            Self::Si | Self::HumanReadable(HumanReadable::Decimal) => SI_BASES,
+impl SuffixType {
+    /// The first ten powers of 1024 and 1000, respectively.
+    fn bases(&self) -> [u128; 10] {
+        match self {
+            Self::Iec | Self::HumanReadable(HumanReadable::Binary) => IEC_BASES,
+            Self::Si | Self::HumanReadable(HumanReadable::Decimal) => SI_BASES,
         }
     }
 
-    /// Suffixes for the first nine multi-byte unit suffixes.
-    fn suffixes(&self) -> [&'static str; 9] {
-        match self {
-            // we use "kB" instead of "KB", same as GNU df
-            Self::Si => ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
-            Self::Iec => ["B", "K", "M", "G", "T", "P", "E", "Z", "Y"],
-            Self::HumanReadable(HumanReadable::Binary) => {
+    /// Suffixes for the first nine multi-byte unit suffixes.
+    fn suffixes(&self) -> [&'static str; 9] {
+        match self {
+            // we use "kB" instead of "KB", same as GNU df
+            Self::Si => ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
+            Self::Iec => ["B", "K", "M", "G", "T", "P", "E", "Z", "Y"],
+            Self::HumanReadable(HumanReadable::Binary) => {
                 ["", "K", "M", "G", "T", "P", "E", "Z", "Y"]
             }
-            Self::HumanReadable(HumanReadable::Decimal) => {
+            Self::HumanReadable(HumanReadable::Decimal) => {
                 ["", "k", "M", "G", "T", "P", "E", "Z", "Y"]
             }
         }
     }
 }
 
-/// Convert a number into a magnitude and a multi-byte unit suffix.
-///
-/// The returned string has a maximum length of 5 chars, for example: "1.1kB", "999kB", "1MB".
-pub(crate) fn to_magnitude_and_suffix(n: u128, suffix_type: SuffixType) -> String {
-    let bases = suffix_type.bases();
-    let suffixes = suffix_type.suffixes();
-    let mut i = 0;
+/// Convert a number into a magnitude and a multi-byte unit suffix.
+///
+/// The returned string has a maximum length of 5 chars, for example: "1.1kB", "999kB", "1MB".
+pub(crate) fn to_magnitude_and_suffix(n: u128, suffix_type: SuffixType) -> String {
+    let bases = suffix_type.bases();
+    let suffixes = suffix_type.suffixes();
+    let mut i = 0;
 
-    while bases[i + 1] - bases[i] < n && i < suffixes.len() {
-        i += 1;
+    while bases[i + 1] - bases[i] < n && i < suffixes.len() {
+        i += 1;
     }
 
-    let quot = n / bases[i];
-    let rem = n % bases[i];
-    let suffix = suffixes[i];
+    let quot = n / bases[i];
+    let rem = n % bases[i];
+    let suffix = suffixes[i];
 
-    if rem == 0 {
-        format!("{}{}", quot, suffix)
-    } else {
-        let tenths_place = rem / (bases[i] / 10);
+    if rem == 0 {
+        format!("{}{}", quot, suffix)
+    } else {
+        let tenths_place = rem / (bases[i] / 10);
 
-        if rem % (bases[i] / 10) == 0 {
-            format!("{}.{}{}", quot, tenths_place, suffix)
-        } else if tenths_place + 1 == 10 || quot >= 10 {
-            format!("{}{}", quot + 1, suffix)
-        } else {
-            format!("{}.{}{}", quot, tenths_place + 1, suffix)
+        if rem % (bases[i] / 10) == 0 {
+            format!("{}.{}{}", quot, tenths_place, suffix)
+        } else if tenths_place + 1 == 10 || quot >= 10 {
+            format!("{}{}", quot + 1, suffix)
+        } else {
+            format!("{}.{}{}", quot, tenths_place + 1, suffix)
         }
     }
 }
 
-/// A mode to use in condensing the human readable display of a large number
-/// of bytes.
-///
-/// The [`HumanReadable::Decimal`] and[`HumanReadable::Binary`] variants
-/// represent dynamic block sizes: as the number of bytes increases, the
-/// divisor increases as well (for example, from 1 to 1,000 to 1,000,000
-/// and so on in the case of [`HumanReadable::Decimal`]).
-#[derive(Clone, Copy)]
-pub(crate) enum HumanReadable {
-    /// Use the largest divisor corresponding to a unit, like B, K, M, G, etc.
-    ///
-    /// This variant represents powers of 1,000. Contrast with
-    /// [`HumanReadable::Binary`], which represents powers of
-    /// 1,024.
-    Decimal,
+/// A mode to use in condensing the human readable display of a large number
+/// of bytes.
+///
+/// The [`HumanReadable::Decimal`] and[`HumanReadable::Binary`] variants
+/// represent dynamic block sizes: as the number of bytes increases, the
+/// divisor increases as well (for example, from 1 to 1,000 to 1,000,000
+/// and so on in the case of [`HumanReadable::Decimal`]).
+#[derive(Clone, Copy)]
+pub(crate) enum HumanReadable {
+    /// Use the largest divisor corresponding to a unit, like B, K, M, G, etc.
+    ///
+    /// This variant represents powers of 1,000. Contrast with
+    /// [`HumanReadable::Binary`], which represents powers of
+    /// 1,024.
+    Decimal,
 
-    /// Use the largest divisor corresponding to a unit, like B, K, M, G, etc.
-    ///
-    /// This variant represents powers of 1,024. Contrast with
-    /// [`HumanReadable::Decimal`], which represents powers
-    /// of 1,000.
-    Binary,
+    /// Use the largest divisor corresponding to a unit, like B, K, M, G, etc.
+    ///
+    /// This variant represents powers of 1,024. Contrast with
+    /// [`HumanReadable::Decimal`], which represents powers
+    /// of 1,000.
+    Binary,
 }
 
-/// A block size to use in condensing the display of a large number of bytes.
-///
-/// The [`BlockSize::Bytes`] variant represents a static block
-/// size.
-///
-/// The default variant is `Bytes(1024)`.
-#[derive(Debug, PartialEq)]
-pub(crate) enum BlockSize {
-    /// A fixed number of bytes.
-    ///
-    /// The number must be positive.
-    Bytes(u64),
+/// A block size to use in condensing the display of a large number of bytes.
+///
+/// The [`BlockSize::Bytes`] variant represents a static block
+/// size.
+///
+/// The default variant is `Bytes(1024)`.
+#[derive(Debug, PartialEq)]
+pub(crate) enum BlockSize {
+    /// A fixed number of bytes.
+    ///
+    /// The number must be positive.
+    Bytes(u64),
 }
 
-impl BlockSize {
-    /// Returns the associated value
-    pub(crate) fn as_u64(&self) -> u64 {
-        match *self {
-            Self::Bytes(n) => n,
+impl BlockSize {
+    /// Returns the associated value
+    pub(crate) fn as_u64(&self) -> u64 {
+        match *self {
+            Self::Bytes(n) => n,
         }
     }
 }
 
-impl Default for BlockSize {
-    fn default() -> Self {
-        if env::var("POSIXLY_CORRECT").is_ok() {
-            Self::Bytes(512)
-        } else {
-            Self::Bytes(1024)
+impl Default for BlockSize {
+    fn default() -> Self {
+        if env::var("POSIXLY_CORRECT").is_ok() {
+            Self::Bytes(512)
+        } else {
+            Self::Bytes(1024)
         }
     }
 }
 
-pub(crate) fn read_block_size(matches: &ArgMatches) -> Result<BlockSize, ParseSizeError> {
-    if matches.contains_id(OPT_BLOCKSIZE) {
-        let s = matches.get_one::<String>(OPT_BLOCKSIZE).unwrap();
-        let bytes = parse_size(s)?;
+pub(crate) fn read_block_size(matches: &ArgMatches) -> Result<BlockSize, ParseSizeError> {
+    if matches.contains_id(OPT_BLOCKSIZE) {
+        let s = matches.get_one::<String>(OPT_BLOCKSIZE).unwrap();
+        let bytes = parse_size(s)?;
 
-        if bytes > 0 {
-            Ok(BlockSize::Bytes(bytes))
-        } else {
-            Err(ParseSizeError::ParseFailure(format!("{}", s.quote())))
+        if bytes > 0 {
+            Ok(BlockSize::Bytes(bytes))
+        } else {
+            Err(ParseSizeError::ParseFailure(format!("{}", s.quote())))
         }
-    } else if matches.get_flag(OPT_PORTABILITY) {
-        Ok(BlockSize::default())
-    } else if let Some(bytes) = block_size_from_env() {
-        Ok(BlockSize::Bytes(bytes))
-    } else {
-        Ok(BlockSize::default())
+    } else if matches.get_flag(OPT_PORTABILITY) {
+        Ok(BlockSize::default())
+    } else if let Some(bytes) = block_size_from_env() {
+        Ok(BlockSize::Bytes(bytes))
+    } else {
+        Ok(BlockSize::default())
     }
 }
 
-fn block_size_from_env() -> Option<u64> {
-    for env_var in ["DF_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] {
-        if let Ok(env_size) = env::var(env_var) {
-            if let Ok(size) = parse_size(&env_size) {
-                return Some(size);
-            } else {
-                return None;
+fn block_size_from_env() -> Option<u64> {
+    for env_var in ["DF_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] {
+        if let Ok(env_size) = env::var(env_var) {
+            if let Ok(size) = parse_size(&env_size) {
+                return Some(size);
+            } else {
+                return None;
             }
         }
     }
 
-    None
-}
+    None
+}
 
-impl fmt::Display for BlockSize {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match self {
-            Self::Bytes(n) => {
-                let s = if n % 1024 == 0 && n % 1000 != 0 {
-                    to_magnitude_and_suffix(*n as u128, SuffixType::Iec)
-                } else {
-                    to_magnitude_and_suffix(*n as u128, SuffixType::Si)
+impl fmt::Display for BlockSize {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            Self::Bytes(n) => {
+                let s = if n % 1024 == 0 && n % 1000 != 0 {
+                    to_magnitude_and_suffix(*n as u128, SuffixType::Iec)
+                } else {
+                    to_magnitude_and_suffix(*n as u128, SuffixType::Si)
                 };
 
-                write!(f, "{}", s)
+                write!(f, "{}", s)
             }
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use std::env;
+    use std::env;
 
-    use crate::blocks::{to_magnitude_and_suffix, BlockSize, SuffixType};
+    use crate::blocks::{to_magnitude_and_suffix, BlockSize, SuffixType};
 
-    #[test]
-    fn test_to_magnitude_and_suffix_powers_of_1024() {
-        assert_eq!(to_magnitude_and_suffix(1024, SuffixType::Iec), "1K");
-        assert_eq!(to_magnitude_and_suffix(2048, SuffixType::Iec), "2K");
-        assert_eq!(to_magnitude_and_suffix(4096, SuffixType::Iec), "4K");
-        assert_eq!(to_magnitude_and_suffix(1024 * 1024, SuffixType::Iec), "1M");
+    #[test]
+    fn test_to_magnitude_and_suffix_powers_of_1024() {
+        assert_eq!(to_magnitude_and_suffix(1024, SuffixType::Iec), "1K");
+        assert_eq!(to_magnitude_and_suffix(2048, SuffixType::Iec), "2K");
+        assert_eq!(to_magnitude_and_suffix(4096, SuffixType::Iec), "4K");
+        assert_eq!(to_magnitude_and_suffix(1024 * 1024, SuffixType::Iec), "1M");
         assert_eq!(
-            to_magnitude_and_suffix(2 * 1024 * 1024, SuffixType::Iec),
-            "2M"
-        );
+            to_magnitude_and_suffix(2 * 1024 * 1024, SuffixType::Iec),
+            "2M"
+        );
         assert_eq!(
-            to_magnitude_and_suffix(1024 * 1024 * 1024, SuffixType::Iec),
-            "1G"
-        );
+            to_magnitude_and_suffix(1024 * 1024 * 1024, SuffixType::Iec),
+            "1G"
+        );
         assert_eq!(
-            to_magnitude_and_suffix(34 * 1024 * 1024 * 1024, SuffixType::Iec),
-            "34G"
-        );
+            to_magnitude_and_suffix(34 * 1024 * 1024 * 1024, SuffixType::Iec),
+            "34G"
+        );
     }
 
-    #[test]
-    fn test_to_magnitude_and_suffix_not_powers_of_1024() {
-        assert_eq!(to_magnitude_and_suffix(1, SuffixType::Si), "1B");
-        assert_eq!(to_magnitude_and_suffix(999, SuffixType::Si), "999B");
+    #[test]
+    fn test_to_magnitude_and_suffix_not_powers_of_1024() {
+        assert_eq!(to_magnitude_and_suffix(1, SuffixType::Si), "1B");
+        assert_eq!(to_magnitude_and_suffix(999, SuffixType::Si), "999B");
 
-        assert_eq!(to_magnitude_and_suffix(1000, SuffixType::Si), "1kB");
-        assert_eq!(to_magnitude_and_suffix(1001, SuffixType::Si), "1.1kB");
-        assert_eq!(to_magnitude_and_suffix(1023, SuffixType::Si), "1.1kB");
-        assert_eq!(to_magnitude_and_suffix(1025, SuffixType::Si), "1.1kB");
-        assert_eq!(to_magnitude_and_suffix(10_001, SuffixType::Si), "11kB");
-        assert_eq!(to_magnitude_and_suffix(999_000, SuffixType::Si), "999kB");
+        assert_eq!(to_magnitude_and_suffix(1000, SuffixType::Si), "1kB");
+        assert_eq!(to_magnitude_and_suffix(1001, SuffixType::Si), "1.1kB");
+        assert_eq!(to_magnitude_and_suffix(1023, SuffixType::Si), "1.1kB");
+        assert_eq!(to_magnitude_and_suffix(1025, SuffixType::Si), "1.1kB");
+        assert_eq!(to_magnitude_and_suffix(10_001, SuffixType::Si), "11kB");
+        assert_eq!(to_magnitude_and_suffix(999_000, SuffixType::Si), "999kB");
 
-        assert_eq!(to_magnitude_and_suffix(999_001, SuffixType::Si), "1MB");
-        assert_eq!(to_magnitude_and_suffix(999_999, SuffixType::Si), "1MB");
-        assert_eq!(to_magnitude_and_suffix(1_000_000, SuffixType::Si), "1MB");
-        assert_eq!(to_magnitude_and_suffix(1_000_001, SuffixType::Si), "1.1MB");
-        assert_eq!(to_magnitude_and_suffix(1_100_000, SuffixType::Si), "1.1MB");
-        assert_eq!(to_magnitude_and_suffix(1_100_001, SuffixType::Si), "1.2MB");
-        assert_eq!(to_magnitude_and_suffix(1_900_000, SuffixType::Si), "1.9MB");
-        assert_eq!(to_magnitude_and_suffix(1_900_001, SuffixType::Si), "2MB");
-        assert_eq!(to_magnitude_and_suffix(9_900_000, SuffixType::Si), "9.9MB");
-        assert_eq!(to_magnitude_and_suffix(9_900_001, SuffixType::Si), "10MB");
+        assert_eq!(to_magnitude_and_suffix(999_001, SuffixType::Si), "1MB");
+        assert_eq!(to_magnitude_and_suffix(999_999, SuffixType::Si), "1MB");
+        assert_eq!(to_magnitude_and_suffix(1_000_000, SuffixType::Si), "1MB");
+        assert_eq!(to_magnitude_and_suffix(1_000_001, SuffixType::Si), "1.1MB");
+        assert_eq!(to_magnitude_and_suffix(1_100_000, SuffixType::Si), "1.1MB");
+        assert_eq!(to_magnitude_and_suffix(1_100_001, SuffixType::Si), "1.2MB");
+        assert_eq!(to_magnitude_and_suffix(1_900_000, SuffixType::Si), "1.9MB");
+        assert_eq!(to_magnitude_and_suffix(1_900_001, SuffixType::Si), "2MB");
+        assert_eq!(to_magnitude_and_suffix(9_900_000, SuffixType::Si), "9.9MB");
+        assert_eq!(to_magnitude_and_suffix(9_900_001, SuffixType::Si), "10MB");
         assert_eq!(
-            to_magnitude_and_suffix(999_000_000, SuffixType::Si),
-            "999MB"
-        );
+            to_magnitude_and_suffix(999_000_000, SuffixType::Si),
+            "999MB"
+        );
 
-        assert_eq!(to_magnitude_and_suffix(999_000_001, SuffixType::Si), "1GB");
+        assert_eq!(to_magnitude_and_suffix(999_000_001, SuffixType::Si), "1GB");
         assert_eq!(
-            to_magnitude_and_suffix(1_000_000_000, SuffixType::Si),
-            "1GB"
-        );
+            to_magnitude_and_suffix(1_000_000_000, SuffixType::Si),
+            "1GB"
+        );
         assert_eq!(
-            to_magnitude_and_suffix(1_000_000_001, SuffixType::Si),
-            "1.1GB"
-        );
+            to_magnitude_and_suffix(1_000_000_001, SuffixType::Si),
+            "1.1GB"
+        );
     }
 
-    #[test]
-    fn test_block_size_display() {
-        assert_eq!(format!("{}", BlockSize::Bytes(1024)), "1K");
-        assert_eq!(format!("{}", BlockSize::Bytes(2 * 1024)), "2K");
-        assert_eq!(format!("{}", BlockSize::Bytes(3 * 1024 * 1024)), "3M");
+    #[test]
+    fn test_block_size_display() {
+        assert_eq!(format!("{}", BlockSize::Bytes(1024)), "1K");
+        assert_eq!(format!("{}", BlockSize::Bytes(2 * 1024)), "2K");
+        assert_eq!(format!("{}", BlockSize::Bytes(3 * 1024 * 1024)), "3M");
     }
 
-    #[test]
-    fn test_block_size_display_multiples_of_1000_and_1024() {
-        assert_eq!(format!("{}", BlockSize::Bytes(128_000)), "128kB");
-        assert_eq!(format!("{}", BlockSize::Bytes(1000 * 1024)), "1.1MB");
-        assert_eq!(format!("{}", BlockSize::Bytes(1_000_000_000_000)), "1TB");
+    #[test]
+    fn test_block_size_display_multiples_of_1000_and_1024() {
+        assert_eq!(format!("{}", BlockSize::Bytes(128_000)), "128kB");
+        assert_eq!(format!("{}", BlockSize::Bytes(1000 * 1024)), "1.1MB");
+        assert_eq!(format!("{}", BlockSize::Bytes(1_000_000_000_000)), "1TB");
     }
 
-    #[test]
-    fn test_default_block_size() {
-        assert_eq!(BlockSize::Bytes(1024), BlockSize::default());
-        env::set_var("POSIXLY_CORRECT", "1");
-        assert_eq!(BlockSize::Bytes(512), BlockSize::default());
-        env::remove_var("POSIXLY_CORRECT");
+    #[test]
+    fn test_default_block_size() {
+        assert_eq!(BlockSize::Bytes(1024), BlockSize::default());
+        env::set_var("POSIXLY_CORRECT", "1");
+        assert_eq!(BlockSize::Bytes(512), BlockSize::default());
+        env::remove_var("POSIXLY_CORRECT");
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_df/columns.rs.html b/dev/src/uu_df/columns.rs.html index ce2b139b3..5b467996a 100644 --- a/dev/src/uu_df/columns.rs.html +++ b/dev/src/uu_df/columns.rs.html @@ -1,4 +1,4 @@ -columns.rs - source
1
+columns.rs - source
1
 2
 3
 4
@@ -215,222 +215,222 @@
 215
 216
 217
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore itotal iused iavail ipcent pcent squashfs
-use crate::{OPT_INODES, OPT_OUTPUT, OPT_PRINT_TYPE};
-use clap::{parser::ValueSource, ArgMatches};
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore itotal iused iavail ipcent pcent squashfs
+use crate::{OPT_INODES, OPT_OUTPUT, OPT_PRINT_TYPE};
+use clap::{parser::ValueSource, ArgMatches};
 
-/// The columns in the output table produced by `df`.
-///
-/// The [`Row`] struct has a field corresponding to each of the
-/// variants of this enumeration.
-///
-/// [`Row`]: crate::table::Row
-#[derive(PartialEq, Copy, Clone)]
-pub(crate) enum Column {
-    /// The source of the mount point, usually a device.
-    Source,
+/// The columns in the output table produced by `df`.
+///
+/// The [`Row`] struct has a field corresponding to each of the
+/// variants of this enumeration.
+///
+/// [`Row`]: crate::table::Row
+#[derive(PartialEq, Copy, Clone)]
+pub(crate) enum Column {
+    /// The source of the mount point, usually a device.
+    Source,
 
-    /// Total number of blocks.
-    Size,
+    /// Total number of blocks.
+    Size,
 
-    /// Number of used blocks.
-    Used,
+    /// Number of used blocks.
+    Used,
 
-    /// Number of available blocks.
-    Avail,
+    /// Number of available blocks.
+    Avail,
 
-    /// Percentage of blocks used out of total number of blocks.
-    Pcent,
+    /// Percentage of blocks used out of total number of blocks.
+    Pcent,
 
-    /// The mount point.
-    Target,
+    /// The mount point.
+    Target,
 
-    /// Total number of inodes.
-    Itotal,
+    /// Total number of inodes.
+    Itotal,
 
-    /// Number of used inodes.
-    Iused,
+    /// Number of used inodes.
+    Iused,
 
-    /// Number of available inodes.
-    Iavail,
+    /// Number of available inodes.
+    Iavail,
 
-    /// Percentage of inodes used out of total number of inodes.
-    Ipcent,
+    /// Percentage of inodes used out of total number of inodes.
+    Ipcent,
 
-    /// The filename given as a command-line argument.
-    File,
+    /// The filename given as a command-line argument.
+    File,
 
-    /// The filesystem type, like "ext4" or "squashfs".
-    Fstype,
+    /// The filesystem type, like "ext4" or "squashfs".
+    Fstype,
 
-    /// Percentage of bytes available to non-privileged processes.
-    #[cfg(target_os = "macos")]
-    Capacity,
+    /// Percentage of bytes available to non-privileged processes.
+    #[cfg(target_os = "macos")]
+    Capacity,
 }
 
-/// An error while defining which columns to display in the output table.
-#[derive(Debug)]
-pub(crate) enum ColumnError {
-    /// If a column appears more than once in the `--output` argument.
-    MultipleColumns(String),
+/// An error while defining which columns to display in the output table.
+#[derive(Debug)]
+pub(crate) enum ColumnError {
+    /// If a column appears more than once in the `--output` argument.
+    MultipleColumns(String),
 }
 
-impl Column {
-    /// Convert from command-line arguments to sequence of columns.
-    ///
-    /// The set of columns that will appear in the output table can be
-    /// specified by command-line arguments. This function converts
-    /// those arguments to a [`Vec`] of [`Column`] variants.
-    ///
-    /// # Errors
-    ///
-    /// This function returns an error if a column is specified more
-    /// than once in the command-line argument.
-    pub(crate) fn from_matches(matches: &ArgMatches) -> Result<Vec<Self>, ColumnError> {
-        match (
-            matches.get_flag(OPT_PRINT_TYPE),
-            matches.get_flag(OPT_INODES),
-            matches.value_source(OPT_OUTPUT) == Some(ValueSource::CommandLine),
+impl Column {
+    /// Convert from command-line arguments to sequence of columns.
+    ///
+    /// The set of columns that will appear in the output table can be
+    /// specified by command-line arguments. This function converts
+    /// those arguments to a [`Vec`] of [`Column`] variants.
+    ///
+    /// # Errors
+    ///
+    /// This function returns an error if a column is specified more
+    /// than once in the command-line argument.
+    pub(crate) fn from_matches(matches: &ArgMatches) -> Result<Vec<Self>, ColumnError> {
+        match (
+            matches.get_flag(OPT_PRINT_TYPE),
+            matches.get_flag(OPT_INODES),
+            matches.value_source(OPT_OUTPUT) == Some(ValueSource::CommandLine),
         ) {
             (false, false, false) => Ok(vec![
-                Self::Source,
-                Self::Size,
-                Self::Used,
-                Self::Avail,
-                #[cfg(target_os = "macos")]
-                Self::Capacity,
-                Self::Pcent,
-                Self::Target,
+                Self::Source,
+                Self::Size,
+                Self::Used,
+                Self::Avail,
+                #[cfg(target_os = "macos")]
+                Self::Capacity,
+                Self::Pcent,
+                Self::Target,
             ]),
             (false, false, true) => {
-                // Unwrapping should not panic because in this arm of
-                // the `match` statement, we know that `OPT_OUTPUT`
-                // is non-empty.
-                let names = matches
-                    .get_many::<String>(OPT_OUTPUT)
-                    .unwrap()
-                    .map(|s| s.as_str());
-                let mut seen: Vec<&str> = vec![];
-                let mut columns = vec![];
-                for name in names {
-                    if seen.contains(&name) {
-                        return Err(ColumnError::MultipleColumns(name.to_string()));
+                // Unwrapping should not panic because in this arm of
+                // the `match` statement, we know that `OPT_OUTPUT`
+                // is non-empty.
+                let names = matches
+                    .get_many::<String>(OPT_OUTPUT)
+                    .unwrap()
+                    .map(|s| s.as_str());
+                let mut seen: Vec<&str> = vec![];
+                let mut columns = vec![];
+                for name in names {
+                    if seen.contains(&name) {
+                        return Err(ColumnError::MultipleColumns(name.to_string()));
                     }
-                    seen.push(name);
-                    // Unwrapping here should not panic because the
-                    // command-line argument parsing library should be
-                    // responsible for ensuring each comma-separated
-                    // string is a valid column label.
-                    let column = Self::parse(name).unwrap();
-                    columns.push(column);
+                    seen.push(name);
+                    // Unwrapping here should not panic because the
+                    // command-line argument parsing library should be
+                    // responsible for ensuring each comma-separated
+                    // string is a valid column label.
+                    let column = Self::parse(name).unwrap();
+                    columns.push(column);
                 }
-                Ok(columns)
+                Ok(columns)
             }
             (false, true, false) => Ok(vec![
-                Self::Source,
-                Self::Itotal,
-                Self::Iused,
-                Self::Iavail,
-                Self::Ipcent,
-                Self::Target,
+                Self::Source,
+                Self::Itotal,
+                Self::Iused,
+                Self::Iavail,
+                Self::Ipcent,
+                Self::Target,
             ]),
             (true, false, false) => Ok(vec![
-                Self::Source,
-                Self::Fstype,
-                Self::Size,
-                Self::Used,
-                Self::Avail,
-                #[cfg(target_os = "macos")]
-                Self::Capacity,
-                Self::Pcent,
-                Self::Target,
+                Self::Source,
+                Self::Fstype,
+                Self::Size,
+                Self::Used,
+                Self::Avail,
+                #[cfg(target_os = "macos")]
+                Self::Capacity,
+                Self::Pcent,
+                Self::Target,
             ]),
             (true, true, false) => Ok(vec![
-                Self::Source,
-                Self::Fstype,
-                Self::Itotal,
-                Self::Iused,
-                Self::Iavail,
-                Self::Ipcent,
-                Self::Target,
+                Self::Source,
+                Self::Fstype,
+                Self::Itotal,
+                Self::Iused,
+                Self::Iavail,
+                Self::Ipcent,
+                Self::Target,
             ]),
-            // The command-line arguments -T and -i are each mutually
-            // exclusive with --output, so the command-line argument
-            // parser should reject those combinations before we get
-            // to this point in the code.
-            _ => unreachable!(),
+            // The command-line arguments -T and -i are each mutually
+            // exclusive with --output, so the command-line argument
+            // parser should reject those combinations before we get
+            // to this point in the code.
+            _ => unreachable!(),
         }
     }
 
-    /// Convert a column name to the corresponding enumeration variant.
-    ///
-    /// There are twelve valid column names, one for each variant:
-    ///
-    /// - "source"
-    /// - "fstype"
-    /// - "itotal"
-    /// - "iused"
-    /// - "iavail"
-    /// - "ipcent"
-    /// - "size"
-    /// - "used"
-    /// - "avail"
-    /// - "pcent"
-    /// - "file"
-    /// - "target"
-    ///
-    /// # Errors
-    ///
-    /// If the string `s` is not one of the valid column names.
-    fn parse(s: &str) -> Result<Self, ()> {
-        match s {
-            "source" => Ok(Self::Source),
-            "fstype" => Ok(Self::Fstype),
-            "itotal" => Ok(Self::Itotal),
-            "iused" => Ok(Self::Iused),
-            "iavail" => Ok(Self::Iavail),
-            "ipcent" => Ok(Self::Ipcent),
-            "size" => Ok(Self::Size),
-            "used" => Ok(Self::Used),
-            "avail" => Ok(Self::Avail),
-            "pcent" => Ok(Self::Pcent),
-            "file" => Ok(Self::File),
-            "target" => Ok(Self::Target),
-            _ => Err(()),
+    /// Convert a column name to the corresponding enumeration variant.
+    ///
+    /// There are twelve valid column names, one for each variant:
+    ///
+    /// - "source"
+    /// - "fstype"
+    /// - "itotal"
+    /// - "iused"
+    /// - "iavail"
+    /// - "ipcent"
+    /// - "size"
+    /// - "used"
+    /// - "avail"
+    /// - "pcent"
+    /// - "file"
+    /// - "target"
+    ///
+    /// # Errors
+    ///
+    /// If the string `s` is not one of the valid column names.
+    fn parse(s: &str) -> Result<Self, ()> {
+        match s {
+            "source" => Ok(Self::Source),
+            "fstype" => Ok(Self::Fstype),
+            "itotal" => Ok(Self::Itotal),
+            "iused" => Ok(Self::Iused),
+            "iavail" => Ok(Self::Iavail),
+            "ipcent" => Ok(Self::Ipcent),
+            "size" => Ok(Self::Size),
+            "used" => Ok(Self::Used),
+            "avail" => Ok(Self::Avail),
+            "pcent" => Ok(Self::Pcent),
+            "file" => Ok(Self::File),
+            "target" => Ok(Self::Target),
+            _ => Err(()),
         }
     }
 
-    /// Return the alignment of the specified column.
-    pub(crate) fn alignment(column: &Self) -> Alignment {
-        match column {
-            Self::Source | Self::Target | Self::File | Self::Fstype => Alignment::Left,
-            _ => Alignment::Right,
+    /// Return the alignment of the specified column.
+    pub(crate) fn alignment(column: &Self) -> Alignment {
+        match column {
+            Self::Source | Self::Target | Self::File | Self::Fstype => Alignment::Left,
+            _ => Alignment::Right,
         }
     }
 
-    /// Return the minimum width of the specified column.
-    pub(crate) fn min_width(column: &Self) -> usize {
-        match column {
-            // 14 = length of "Filesystem" plus 4 spaces
-            Self::Source => 14,
-            Self::Used => 5,
-            // the shortest headers have a length of 4 chars so we use that as the minimum width
-            _ => 4,
+    /// Return the minimum width of the specified column.
+    pub(crate) fn min_width(column: &Self) -> usize {
+        match column {
+            // 14 = length of "Filesystem" plus 4 spaces
+            Self::Source => 14,
+            Self::Used => 5,
+            // the shortest headers have a length of 4 chars so we use that as the minimum width
+            _ => 4,
         }
     }
 }
 
-/// A column's alignment.
-///
-/// We define our own `Alignment` enum instead of using `std::fmt::Alignment` because df doesn't
-/// have centered columns and hence a `Center` variant is not needed.
-pub(crate) enum Alignment {
-    Left,
-    Right,
+/// A column's alignment.
+///
+/// We define our own `Alignment` enum instead of using `std::fmt::Alignment` because df doesn't
+/// have centered columns and hence a `Center` variant is not needed.
+pub(crate) enum Alignment {
+    Left,
+    Right,
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_df/df.rs.html b/dev/src/uu_df/df.rs.html index a466bfd9b..52b1eddd8 100644 --- a/dev/src/uu_df/df.rs.html +++ b/dev/src/uu_df/df.rs.html @@ -1,4 +1,4 @@ -df.rs - source
1
+df.rs - source
1
 2
 3
 4
@@ -881,45 +881,45 @@
 881
 882
 883
-
// This file is part of the uutils coreutils package.
-//
-// (c) Fangxu Hu <framlog@gmail.com>
-// (c) Sylvestre Ledru <sylvestre@debian.org>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
-// spell-checker:ignore itotal iused iavail ipcent pcent tmpfs squashfs lofs
-mod blocks;
-mod columns;
-mod filesystem;
-mod table;
+
// This file is part of the uutils coreutils package.
+//
+// (c) Fangxu Hu <framlog@gmail.com>
+// (c) Sylvestre Ledru <sylvestre@debian.org>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
+// spell-checker:ignore itotal iused iavail ipcent pcent tmpfs squashfs lofs
+mod blocks;
+mod columns;
+mod filesystem;
+mod table;
 
-use blocks::HumanReadable;
-use clap::builder::ValueParser;
-use table::HeaderMode;
-use uucore::display::Quotable;
-use uucore::error::FromIo;
-use uucore::error::{UError, UResult, USimpleError};
-use uucore::fsext::{read_fs_list, MountInfo};
-use uucore::parse_size::ParseSizeError;
-use uucore::{format_usage, show};
+use blocks::HumanReadable;
+use clap::builder::ValueParser;
+use table::HeaderMode;
+use uucore::display::Quotable;
+use uucore::error::FromIo;
+use uucore::error::{UError, UResult, USimpleError};
+use uucore::fsext::{read_fs_list, MountInfo};
+use uucore::parse_size::ParseSizeError;
+use uucore::{format_usage, show};
 
-use clap::{crate_version, parser::ValueSource, Arg, ArgAction, ArgMatches, Command};
+use clap::{crate_version, parser::ValueSource, Arg, ArgAction, ArgMatches, Command};
 
-use std::error::Error;
-use std::ffi::OsString;
-use std::fmt;
-use std::path::Path;
+use std::error::Error;
+use std::ffi::OsString;
+use std::fmt;
+use std::path::Path;
 
-use crate::blocks::{read_block_size, BlockSize};
-use crate::columns::{Column, ColumnError};
-use crate::filesystem::Filesystem;
-use crate::table::Table;
+use crate::blocks::{read_block_size, BlockSize};
+use crate::columns::{Column, ColumnError};
+use crate::filesystem::Filesystem;
+use crate::table::Table;
 
-static ABOUT: &str = "Show information about the file system on which each FILE resides,\n\
+static ABOUT: &str = "Show information about the file system on which each FILE resides,\n\
                       or all file systems by default.";
-const USAGE: &str = "{} [OPTION]... [FILE]...";
-const LONG_HELP: &str = "Display values are in units of the first available SIZE from --block-size,
+const USAGE: &str = "{} [OPTION]... [FILE]...";
+const LONG_HELP: &str = "Display values are in units of the first available SIZE from --block-size,
 and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
 Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
 
@@ -927,124 +927,124 @@ SIZE is an integer and optional unit (example: 10M is 10*1024*1024).
 Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB,... (powers
 of 1000).";
 
-static OPT_HELP: &str = "help";
-static OPT_ALL: &str = "all";
-static OPT_BLOCKSIZE: &str = "blocksize";
-static OPT_TOTAL: &str = "total";
-static OPT_HUMAN_READABLE_BINARY: &str = "human-readable-binary";
-static OPT_HUMAN_READABLE_DECIMAL: &str = "human-readable-decimal";
-static OPT_INODES: &str = "inodes";
-static OPT_KILO: &str = "kilo";
-static OPT_LOCAL: &str = "local";
-static OPT_NO_SYNC: &str = "no-sync";
-static OPT_OUTPUT: &str = "output";
-static OPT_PATHS: &str = "paths";
-static OPT_PORTABILITY: &str = "portability";
-static OPT_SYNC: &str = "sync";
-static OPT_TYPE: &str = "type";
-static OPT_PRINT_TYPE: &str = "print-type";
-static OPT_EXCLUDE_TYPE: &str = "exclude-type";
-static OUTPUT_FIELD_LIST: [&str; 12] = [
+static OPT_HELP: &str = "help";
+static OPT_ALL: &str = "all";
+static OPT_BLOCKSIZE: &str = "blocksize";
+static OPT_TOTAL: &str = "total";
+static OPT_HUMAN_READABLE_BINARY: &str = "human-readable-binary";
+static OPT_HUMAN_READABLE_DECIMAL: &str = "human-readable-decimal";
+static OPT_INODES: &str = "inodes";
+static OPT_KILO: &str = "kilo";
+static OPT_LOCAL: &str = "local";
+static OPT_NO_SYNC: &str = "no-sync";
+static OPT_OUTPUT: &str = "output";
+static OPT_PATHS: &str = "paths";
+static OPT_PORTABILITY: &str = "portability";
+static OPT_SYNC: &str = "sync";
+static OPT_TYPE: &str = "type";
+static OPT_PRINT_TYPE: &str = "print-type";
+static OPT_EXCLUDE_TYPE: &str = "exclude-type";
+static OUTPUT_FIELD_LIST: [&str; 12] = [
     "source", "fstype", "itotal", "iused", "iavail", "ipcent", "size", "used", "avail", "pcent",
     "file", "target",
 ];
 
-/// Parameters that control the behavior of `df`.
-///
-/// Most of these parameters control which rows and which columns are
-/// displayed. The `block_size` determines the units to use when
-/// displaying numbers of bytes or inodes.
-struct Options {
-    show_local_fs: bool,
-    show_all_fs: bool,
-    human_readable: Option<HumanReadable>,
-    block_size: BlockSize,
-    header_mode: HeaderMode,
+/// Parameters that control the behavior of `df`.
+///
+/// Most of these parameters control which rows and which columns are
+/// displayed. The `block_size` determines the units to use when
+/// displaying numbers of bytes or inodes.
+struct Options {
+    show_local_fs: bool,
+    show_all_fs: bool,
+    human_readable: Option<HumanReadable>,
+    block_size: BlockSize,
+    header_mode: HeaderMode,
 
-    /// Optional list of filesystem types to include in the output table.
-    ///
-    /// If this is not `None`, only filesystems that match one of
-    /// these types will be listed.
-    include: Option<Vec<String>>,
+    /// Optional list of filesystem types to include in the output table.
+    ///
+    /// If this is not `None`, only filesystems that match one of
+    /// these types will be listed.
+    include: Option<Vec<String>>,
 
-    /// Optional list of filesystem types to exclude from the output table.
-    ///
-    /// If this is not `None`, filesystems that match one of these
-    /// types will *not* be listed.
-    exclude: Option<Vec<String>>,
+    /// Optional list of filesystem types to exclude from the output table.
+    ///
+    /// If this is not `None`, filesystems that match one of these
+    /// types will *not* be listed.
+    exclude: Option<Vec<String>>,
 
-    /// Whether to sync before operating.
-    sync: bool,
+    /// Whether to sync before operating.
+    sync: bool,
 
-    /// Whether to show a final row comprising the totals for each column.
-    show_total: bool,
+    /// Whether to show a final row comprising the totals for each column.
+    show_total: bool,
 
-    /// Sequence of columns to display in the output table.
-    columns: Vec<Column>,
+    /// Sequence of columns to display in the output table.
+    columns: Vec<Column>,
 }
 
-impl Default for Options {
-    fn default() -> Self {
-        Self {
-            show_local_fs: Default::default(),
-            show_all_fs: Default::default(),
-            block_size: Default::default(),
-            human_readable: Default::default(),
-            header_mode: Default::default(),
-            include: Default::default(),
-            exclude: Default::default(),
-            sync: Default::default(),
-            show_total: Default::default(),
-            columns: vec![
-                Column::Source,
-                Column::Size,
-                Column::Used,
-                Column::Avail,
-                Column::Pcent,
-                Column::Target,
+impl Default for Options {
+    fn default() -> Self {
+        Self {
+            show_local_fs: Default::default(),
+            show_all_fs: Default::default(),
+            block_size: Default::default(),
+            human_readable: Default::default(),
+            header_mode: Default::default(),
+            include: Default::default(),
+            exclude: Default::default(),
+            sync: Default::default(),
+            show_total: Default::default(),
+            columns: vec![
+                Column::Source,
+                Column::Size,
+                Column::Used,
+                Column::Avail,
+                Column::Pcent,
+                Column::Target,
             ],
         }
     }
 }
 
-#[derive(Debug)]
-enum OptionsError {
-    BlockSizeTooLarge(String),
-    InvalidBlockSize(String),
-    InvalidSuffix(String),
+#[derive(Debug)]
+enum OptionsError {
+    BlockSizeTooLarge(String),
+    InvalidBlockSize(String),
+    InvalidSuffix(String),
 
-    /// An error getting the columns to display in the output table.
-    ColumnError(ColumnError),
+    /// An error getting the columns to display in the output table.
+    ColumnError(ColumnError),
 
-    FilesystemTypeBothSelectedAndExcluded(Vec<String>),
+    FilesystemTypeBothSelectedAndExcluded(Vec<String>),
 }
 
-impl fmt::Display for OptionsError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match self {
-            // TODO This needs to vary based on whether `--block-size`
-            // or `-B` were provided.
-            Self::BlockSizeTooLarge(s) => {
-                write!(f, "--block-size argument {} too large", s.quote())
+impl fmt::Display for OptionsError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            // TODO This needs to vary based on whether `--block-size`
+            // or `-B` were provided.
+            Self::BlockSizeTooLarge(s) => {
+                write!(f, "--block-size argument {} too large", s.quote())
             }
-            // TODO This needs to vary based on whether `--block-size`
-            // or `-B` were provided.
-            Self::InvalidBlockSize(s) => write!(f, "invalid --block-size argument {}", s),
-            // TODO This needs to vary based on whether `--block-size`
-            // or `-B` were provided.
-            Self::InvalidSuffix(s) => write!(f, "invalid suffix in --block-size argument {}", s),
-            Self::ColumnError(ColumnError::MultipleColumns(s)) => write!(
-                f,
+            // TODO This needs to vary based on whether `--block-size`
+            // or `-B` were provided.
+            Self::InvalidBlockSize(s) => write!(f, "invalid --block-size argument {}", s),
+            // TODO This needs to vary based on whether `--block-size`
+            // or `-B` were provided.
+            Self::InvalidSuffix(s) => write!(f, "invalid suffix in --block-size argument {}", s),
+            Self::ColumnError(ColumnError::MultipleColumns(s)) => write!(
+                f,
                 "option --output: field {} used more than once",
-                s.quote()
+                s.quote()
             ),
-            #[allow(clippy::print_in_format_impl)]
-            Self::FilesystemTypeBothSelectedAndExcluded(types) => {
-                for t in types {
+            #[allow(clippy::print_in_format_impl)]
+            Self::FilesystemTypeBothSelectedAndExcluded(types) => {
+                for t in types {
                     eprintln!(
                         "{}: file system type {} both selected and excluded",
-                        uucore::util_name(),
-                        t.quote()
+                        uucore::util_name(),
+                        t.quote()
                     );
                 }
                 Ok(())
@@ -1053,716 +1053,716 @@ of 1000).";
     }
 }
 
-impl Options {
-    /// Convert command-line arguments into [`Options`].
-    fn from(matches: &ArgMatches) -> Result<Self, OptionsError> {
-        let include: Option<Vec<_>> = matches
-            .get_many::<OsString>(OPT_TYPE)
-            .map(|v| v.map(|s| s.to_string_lossy().to_string()).collect());
-        let exclude: Option<Vec<_>> = matches
-            .get_many::<OsString>(OPT_EXCLUDE_TYPE)
-            .map(|v| v.map(|s| s.to_string_lossy().to_string()).collect());
+impl Options {
+    /// Convert command-line arguments into [`Options`].
+    fn from(matches: &ArgMatches) -> Result<Self, OptionsError> {
+        let include: Option<Vec<_>> = matches
+            .get_many::<OsString>(OPT_TYPE)
+            .map(|v| v.map(|s| s.to_string_lossy().to_string()).collect());
+        let exclude: Option<Vec<_>> = matches
+            .get_many::<OsString>(OPT_EXCLUDE_TYPE)
+            .map(|v| v.map(|s| s.to_string_lossy().to_string()).collect());
 
-        if let (Some(include), Some(exclude)) = (&include, &exclude) {
-            if let Some(types) = Self::get_intersected_types(include, exclude) {
-                return Err(OptionsError::FilesystemTypeBothSelectedAndExcluded(types));
+        if let (Some(include), Some(exclude)) = (&include, &exclude) {
+            if let Some(types) = Self::get_intersected_types(include, exclude) {
+                return Err(OptionsError::FilesystemTypeBothSelectedAndExcluded(types));
             }
         }
 
-        Ok(Self {
-            show_local_fs: matches.get_flag(OPT_LOCAL),
-            show_all_fs: matches.get_flag(OPT_ALL),
-            sync: matches.get_flag(OPT_SYNC),
-            block_size: read_block_size(matches).map_err(|e| match e {
-                ParseSizeError::InvalidSuffix(s) => OptionsError::InvalidSuffix(s),
-                ParseSizeError::SizeTooBig(_) => OptionsError::BlockSizeTooLarge(
-                    matches
-                        .get_one::<String>(OPT_BLOCKSIZE)
-                        .unwrap()
-                        .to_string(),
+        Ok(Self {
+            show_local_fs: matches.get_flag(OPT_LOCAL),
+            show_all_fs: matches.get_flag(OPT_ALL),
+            sync: matches.get_flag(OPT_SYNC),
+            block_size: read_block_size(matches).map_err(|e| match e {
+                ParseSizeError::InvalidSuffix(s) => OptionsError::InvalidSuffix(s),
+                ParseSizeError::SizeTooBig(_) => OptionsError::BlockSizeTooLarge(
+                    matches
+                        .get_one::<String>(OPT_BLOCKSIZE)
+                        .unwrap()
+                        .to_string(),
                 ),
-                ParseSizeError::ParseFailure(s) => OptionsError::InvalidBlockSize(s),
+                ParseSizeError::ParseFailure(s) => OptionsError::InvalidBlockSize(s),
             })?,
-            header_mode: {
-                if matches.get_flag(OPT_HUMAN_READABLE_BINARY)
-                    || matches.get_flag(OPT_HUMAN_READABLE_DECIMAL)
+            header_mode: {
+                if matches.get_flag(OPT_HUMAN_READABLE_BINARY)
+                    || matches.get_flag(OPT_HUMAN_READABLE_DECIMAL)
                 {
-                    HeaderMode::HumanReadable
-                } else if matches.get_flag(OPT_PORTABILITY) {
-                    HeaderMode::PosixPortability
-                // get_flag() doesn't work here, it always returns true because OPT_OUTPUT has
-                // default values and hence is always present
-                } else if matches.value_source(OPT_OUTPUT) == Some(ValueSource::CommandLine) {
-                    HeaderMode::Output
-                } else {
-                    HeaderMode::Default
+                    HeaderMode::HumanReadable
+                } else if matches.get_flag(OPT_PORTABILITY) {
+                    HeaderMode::PosixPortability
+                // get_flag() doesn't work here, it always returns true because OPT_OUTPUT has
+                // default values and hence is always present
+                } else if matches.value_source(OPT_OUTPUT) == Some(ValueSource::CommandLine) {
+                    HeaderMode::Output
+                } else {
+                    HeaderMode::Default
                 }
             },
-            human_readable: {
-                if matches.get_flag(OPT_HUMAN_READABLE_BINARY) {
-                    Some(HumanReadable::Binary)
-                } else if matches.get_flag(OPT_HUMAN_READABLE_DECIMAL) {
-                    Some(HumanReadable::Decimal)
-                } else {
-                    None
-                }
+            human_readable: {
+                if matches.get_flag(OPT_HUMAN_READABLE_BINARY) {
+                    Some(HumanReadable::Binary)
+                } else if matches.get_flag(OPT_HUMAN_READABLE_DECIMAL) {
+                    Some(HumanReadable::Decimal)
+                } else {
+                    None
+                }
             },
-            include,
-            exclude,
-            show_total: matches.get_flag(OPT_TOTAL),
-            columns: Column::from_matches(matches).map_err(OptionsError::ColumnError)?,
+            include,
+            exclude,
+            show_total: matches.get_flag(OPT_TOTAL),
+            columns: Column::from_matches(matches).map_err(OptionsError::ColumnError)?,
         })
     }
 
-    fn get_intersected_types(include: &[String], exclude: &[String]) -> Option<Vec<String>> {
-        let mut intersected_types = Vec::new();
+    fn get_intersected_types(include: &[String], exclude: &[String]) -> Option<Vec<String>> {
+        let mut intersected_types = Vec::new();
 
-        for t in include {
-            if exclude.contains(t) {
-                intersected_types.push(t.clone());
+        for t in include {
+            if exclude.contains(t) {
+                intersected_types.push(t.clone());
             }
         }
 
-        (!intersected_types.is_empty()).then(|| intersected_types)
+        (!intersected_types.is_empty()).then(|| intersected_types)
     }
 }
 
-/// Whether to display the mount info given the inclusion settings.
-fn is_included(mi: &MountInfo, opt: &Options) -> bool {
-    // Don't show remote filesystems if `--local` has been given.
-    if mi.remote && opt.show_local_fs {
-        return false;
+/// Whether to display the mount info given the inclusion settings.
+fn is_included(mi: &MountInfo, opt: &Options) -> bool {
+    // Don't show remote filesystems if `--local` has been given.
+    if mi.remote && opt.show_local_fs {
+        return false;
     }
 
-    // Don't show pseudo filesystems unless `--all` has been given.
-    if mi.dummy && !opt.show_all_fs {
-        return false;
+    // Don't show pseudo filesystems unless `--all` has been given.
+    if mi.dummy && !opt.show_all_fs {
+        return false;
     }
 
-    // Don't show filesystems if they have been explicitly excluded.
-    if let Some(ref excludes) = opt.exclude {
-        if excludes.contains(&mi.fs_type) {
-            return false;
+    // Don't show filesystems if they have been explicitly excluded.
+    if let Some(ref excludes) = opt.exclude {
+        if excludes.contains(&mi.fs_type) {
+            return false;
         }
     }
-    if let Some(ref includes) = opt.include {
-        if !includes.contains(&mi.fs_type) {
-            return false;
+    if let Some(ref includes) = opt.include {
+        if !includes.contains(&mi.fs_type) {
+            return false;
         }
     }
 
-    true
-}
+    true
+}
 
-/// Whether the mount info in `m2` should be prioritized over `m1`.
-///
-/// The "lt" in the function name is in analogy to the
-/// [`std::cmp::PartialOrd::lt`].
-fn mount_info_lt(m1: &MountInfo, m2: &MountInfo) -> bool {
-    // let "real" devices with '/' in the name win.
-    if m1.dev_name.starts_with('/') && !m2.dev_name.starts_with('/') {
-        return false;
+/// Whether the mount info in `m2` should be prioritized over `m1`.
+///
+/// The "lt" in the function name is in analogy to the
+/// [`std::cmp::PartialOrd::lt`].
+fn mount_info_lt(m1: &MountInfo, m2: &MountInfo) -> bool {
+    // let "real" devices with '/' in the name win.
+    if m1.dev_name.starts_with('/') && !m2.dev_name.starts_with('/') {
+        return false;
     }
 
-    let m1_nearer_root = m1.mount_dir.len() < m2.mount_dir.len();
-    // With bind mounts, prefer items nearer the root of the source
-    let m2_below_root = !m1.mount_root.is_empty()
-        && !m2.mount_root.is_empty()
-        && m1.mount_root.len() > m2.mount_root.len();
-    // let points towards the root of the device win.
-    if m1_nearer_root && !m2_below_root {
-        return false;
+    let m1_nearer_root = m1.mount_dir.len() < m2.mount_dir.len();
+    // With bind mounts, prefer items nearer the root of the source
+    let m2_below_root = !m1.mount_root.is_empty()
+        && !m2.mount_root.is_empty()
+        && m1.mount_root.len() > m2.mount_root.len();
+    // let points towards the root of the device win.
+    if m1_nearer_root && !m2_below_root {
+        return false;
     }
 
-    // let an entry over-mounted on a new device win, but only when
-    // matching an existing mnt point, to avoid problematic
-    // replacement when given inaccurate mount lists, seen with some
-    // chroot environments for example.
-    if m1.dev_name != m2.dev_name && m1.mount_dir == m2.mount_dir {
-        return false;
+    // let an entry over-mounted on a new device win, but only when
+    // matching an existing mnt point, to avoid problematic
+    // replacement when given inaccurate mount lists, seen with some
+    // chroot environments for example.
+    if m1.dev_name != m2.dev_name && m1.mount_dir == m2.mount_dir {
+        return false;
     }
 
-    true
-}
+    true
+}
 
-/// Whether to prioritize given mount info over all others on the same device.
-///
-/// This function decides whether the mount info `mi` is better than
-/// all others in `previous` that mount the same device as `mi`.
-fn is_best(previous: &[MountInfo], mi: &MountInfo) -> bool {
-    for seen in previous {
-        if seen.dev_id == mi.dev_id && mount_info_lt(mi, seen) {
-            return false;
+/// Whether to prioritize given mount info over all others on the same device.
+///
+/// This function decides whether the mount info `mi` is better than
+/// all others in `previous` that mount the same device as `mi`.
+fn is_best(previous: &[MountInfo], mi: &MountInfo) -> bool {
+    for seen in previous {
+        if seen.dev_id == mi.dev_id && mount_info_lt(mi, seen) {
+            return false;
         }
     }
-    true
-}
+    true
+}
 
-/// Keep only the specified subset of [`MountInfo`] instances.
-///
-/// The `opt` argument specifies a variety of ways of excluding
-/// [`MountInfo`] instances; see [`Options`] for more information.
-///
-/// Finally, if there are duplicate entries, the one with the shorter
-/// path is kept.
+/// Keep only the specified subset of [`MountInfo`] instances.
+///
+/// The `opt` argument specifies a variety of ways of excluding
+/// [`MountInfo`] instances; see [`Options`] for more information.
+///
+/// Finally, if there are duplicate entries, the one with the shorter
+/// path is kept.
 
-fn filter_mount_list(vmi: Vec<MountInfo>, opt: &Options) -> Vec<MountInfo> {
-    let mut result = vec![];
-    for mi in vmi {
-        // TODO The running time of the `is_best()` function is linear
-        // in the length of `result`. That makes the running time of
-        // this loop quadratic in the length of `vmi`. This could be
-        // improved by a more efficient implementation of `is_best()`,
-        // but `vmi` is probably not very long in practice.
-        if is_included(&mi, opt) && is_best(&result, &mi) {
-            result.push(mi);
+fn filter_mount_list(vmi: Vec<MountInfo>, opt: &Options) -> Vec<MountInfo> {
+    let mut result = vec![];
+    for mi in vmi {
+        // TODO The running time of the `is_best()` function is linear
+        // in the length of `result`. That makes the running time of
+        // this loop quadratic in the length of `vmi`. This could be
+        // improved by a more efficient implementation of `is_best()`,
+        // but `vmi` is probably not very long in practice.
+        if is_included(&mi, opt) && is_best(&result, &mi) {
+            result.push(mi);
         }
     }
-    result
+    result
 }
 
-/// Get all currently mounted filesystems.
-///
-/// `opt` excludes certain filesystems from consideration and allows for the synchronization of filesystems before running; see
-/// [`Options`] for more information.
+/// Get all currently mounted filesystems.
+///
+/// `opt` excludes certain filesystems from consideration and allows for the synchronization of filesystems before running; see
+/// [`Options`] for more information.
 
-fn get_all_filesystems(opt: &Options) -> Result<Vec<Filesystem>, std::io::Error> {
-    // Run a sync call before any operation if so instructed.
-    if opt.sync {
-        #[cfg(not(windows))]
-        unsafe {
-            #[cfg(not(target_os = "android"))]
-            uucore::libc::sync();
-            #[cfg(target_os = "android")]
-            uucore::libc::syscall(uucore::libc::SYS_sync);
+fn get_all_filesystems(opt: &Options) -> Result<Vec<Filesystem>, std::io::Error> {
+    // Run a sync call before any operation if so instructed.
+    if opt.sync {
+        #[cfg(not(windows))]
+        unsafe {
+            #[cfg(not(target_os = "android"))]
+            uucore::libc::sync();
+            #[cfg(target_os = "android")]
+            uucore::libc::syscall(uucore::libc::SYS_sync);
         }
     }
 
-    // The list of all mounted filesystems.
-    //
-    // Filesystems excluded by the command-line options are
-    // not considered.
-    let mounts: Vec<MountInfo> = filter_mount_list(read_fs_list()?, opt);
+    // The list of all mounted filesystems.
+    //
+    // Filesystems excluded by the command-line options are
+    // not considered.
+    let mounts: Vec<MountInfo> = filter_mount_list(read_fs_list()?, opt);
 
-    // Convert each `MountInfo` into a `Filesystem`, which contains
-    // both the mount information and usage information.
-    Ok(mounts
-        .into_iter()
-        .filter_map(|m| Filesystem::new(m, None))
-        .filter(|fs| opt.show_all_fs || fs.usage.blocks > 0)
-        .collect())
+    // Convert each `MountInfo` into a `Filesystem`, which contains
+    // both the mount information and usage information.
+    Ok(mounts
+        .into_iter()
+        .filter_map(|m| Filesystem::new(m, None))
+        .filter(|fs| opt.show_all_fs || fs.usage.blocks > 0)
+        .collect())
 }
 
-/// For each path, get the filesystem that contains that path.
-fn get_named_filesystems<P>(paths: &[P], opt: &Options) -> Result<Vec<Filesystem>, std::io::Error>
-where
-    P: AsRef<Path>,
+/// For each path, get the filesystem that contains that path.
+fn get_named_filesystems<P>(paths: &[P], opt: &Options) -> Result<Vec<Filesystem>, std::io::Error>
+where
+    P: AsRef<Path>,
 {
-    // The list of all mounted filesystems.
-    //
-    // Filesystems marked as `dummy` or of type "lofs" are not
-    // considered. The "lofs" filesystem is a loopback
-    // filesystem present on Solaris and FreeBSD systems. It
-    // is similar to a symbolic link.
-    let mounts: Vec<MountInfo> = filter_mount_list(read_fs_list()?, opt)
-        .into_iter()
-        .filter(|mi| mi.fs_type != "lofs" && !mi.dummy)
-        .collect();
+    // The list of all mounted filesystems.
+    //
+    // Filesystems marked as `dummy` or of type "lofs" are not
+    // considered. The "lofs" filesystem is a loopback
+    // filesystem present on Solaris and FreeBSD systems. It
+    // is similar to a symbolic link.
+    let mounts: Vec<MountInfo> = filter_mount_list(read_fs_list()?, opt)
+        .into_iter()
+        .filter(|mi| mi.fs_type != "lofs" && !mi.dummy)
+        .collect();
 
-    let mut result = vec![];
+    let mut result = vec![];
 
-    // this happens if the file system type doesn't exist
-    if mounts.is_empty() {
-        show!(USimpleError::new(1, "no file systems processed"));
-        return Ok(result);
+    // this happens if the file system type doesn't exist
+    if mounts.is_empty() {
+        show!(USimpleError::new(1, "no file systems processed"));
+        return Ok(result);
     }
 
-    // Convert each path into a `Filesystem`, which contains
-    // both the mount information and usage information.
-    for path in paths {
-        match Filesystem::from_path(&mounts, path) {
-            Some(fs) => result.push(fs),
-            None => {
-                // this happens if specified file system type != file system type of the file
-                if path.as_ref().exists() {
-                    show!(USimpleError::new(1, "no file systems processed"));
-                } else {
-                    show!(USimpleError::new(
+    // Convert each path into a `Filesystem`, which contains
+    // both the mount information and usage information.
+    for path in paths {
+        match Filesystem::from_path(&mounts, path) {
+            Some(fs) => result.push(fs),
+            None => {
+                // this happens if specified file system type != file system type of the file
+                if path.as_ref().exists() {
+                    show!(USimpleError::new(1, "no file systems processed"));
+                } else {
+                    show!(USimpleError::new(
                         1,
-                        format!("{}: No such file or directory", path.as_ref().display())
+                        format!("{}: No such file or directory", path.as_ref().display())
                     ));
                 }
             }
         }
     }
-    Ok(result)
+    Ok(result)
 }
 
-#[derive(Debug)]
-enum DfError {
-    /// A problem while parsing command-line options.
-    OptionsError(OptionsError),
+#[derive(Debug)]
+enum DfError {
+    /// A problem while parsing command-line options.
+    OptionsError(OptionsError),
 }
 
-impl Error for DfError {}
+impl Error for DfError {}
 
-impl UError for DfError {
-    fn usage(&self) -> bool {
-        matches!(self, Self::OptionsError(OptionsError::ColumnError(_)))
+impl UError for DfError {
+    fn usage(&self) -> bool {
+        matches!(self, Self::OptionsError(OptionsError::ColumnError(_)))
     }
 }
 
-impl fmt::Display for DfError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match self {
-            Self::OptionsError(e) => e.fmt(f),
+impl fmt::Display for DfError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            Self::OptionsError(e) => e.fmt(f),
         }
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    #[cfg(windows)]
-    {
-        if matches.get_flag(OPT_INODES) {
-            println!("{}: doesn't support -i option", uucore::util_name());
-            return Ok(());
+    #[cfg(windows)]
+    {
+        if matches.get_flag(OPT_INODES) {
+            println!("{}: doesn't support -i option", uucore::util_name());
+            return Ok(());
         }
     }
 
-    let opt = Options::from(&matches).map_err(DfError::OptionsError)?;
-    // Get the list of filesystems to display in the output table.
-    let filesystems: Vec<Filesystem> = match matches.get_many::<String>(OPT_PATHS) {
-        None => {
-            let filesystems = get_all_filesystems(&opt)
-                .map_err_context(|| "cannot read table of mounted file systems".into())?;
+    let opt = Options::from(&matches).map_err(DfError::OptionsError)?;
+    // Get the list of filesystems to display in the output table.
+    let filesystems: Vec<Filesystem> = match matches.get_many::<String>(OPT_PATHS) {
+        None => {
+            let filesystems = get_all_filesystems(&opt)
+                .map_err_context(|| "cannot read table of mounted file systems".into())?;
 
-            if filesystems.is_empty() {
-                return Err(USimpleError::new(1, "no file systems processed"));
+            if filesystems.is_empty() {
+                return Err(USimpleError::new(1, "no file systems processed"));
             }
 
-            filesystems
+            filesystems
         }
-        Some(paths) => {
-            let paths: Vec<_> = paths.collect();
-            let filesystems = get_named_filesystems(&paths, &opt)
-                .map_err_context(|| "cannot read table of mounted file systems".into())?;
+        Some(paths) => {
+            let paths: Vec<_> = paths.collect();
+            let filesystems = get_named_filesystems(&paths, &opt)
+                .map_err_context(|| "cannot read table of mounted file systems".into())?;
 
-            // This can happen if paths are given as command-line arguments
-            // but none of the paths exist.
-            if filesystems.is_empty() {
-                return Ok(());
+            // This can happen if paths are given as command-line arguments
+            // but none of the paths exist.
+            if filesystems.is_empty() {
+                return Ok(());
             }
 
-            filesystems
+            filesystems
         }
     };
 
-    println!("{}", Table::new(&opt, filesystems));
+    println!("{}", Table::new(&opt, filesystems));
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .after_help(LONG_HELP)
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(OPT_HELP)
-                .long(OPT_HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .after_help(LONG_HELP)
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(OPT_HELP)
+                .long(OPT_HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new(OPT_ALL)
-                .short('a')
-                .long("all")
-                .overrides_with(OPT_ALL)
-                .help("include dummy file systems")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_ALL)
+                .short('a')
+                .long("all")
+                .overrides_with(OPT_ALL)
+                .help("include dummy file systems")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_BLOCKSIZE)
-                .short('B')
-                .long("block-size")
-                .value_name("SIZE")
-                .overrides_with_all([OPT_KILO, OPT_BLOCKSIZE])
-                .help(
+        .arg(
+            Arg::new(OPT_BLOCKSIZE)
+                .short('B')
+                .long("block-size")
+                .value_name("SIZE")
+                .overrides_with_all([OPT_KILO, OPT_BLOCKSIZE])
+                .help(
                     "scale sizes by SIZE before printing them; e.g.\
                     '-BM' prints sizes in units of 1,048,576 bytes",
                 ),
         )
-        .arg(
-            Arg::new(OPT_TOTAL)
-                .long("total")
-                .overrides_with(OPT_TOTAL)
-                .help("produce a grand total")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_TOTAL)
+                .long("total")
+                .overrides_with(OPT_TOTAL)
+                .help("produce a grand total")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_HUMAN_READABLE_BINARY)
-                .short('h')
-                .long("human-readable")
-                .overrides_with_all([OPT_HUMAN_READABLE_DECIMAL, OPT_HUMAN_READABLE_BINARY])
-                .help("print sizes in human readable format (e.g., 1K 234M 2G)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_HUMAN_READABLE_BINARY)
+                .short('h')
+                .long("human-readable")
+                .overrides_with_all([OPT_HUMAN_READABLE_DECIMAL, OPT_HUMAN_READABLE_BINARY])
+                .help("print sizes in human readable format (e.g., 1K 234M 2G)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_HUMAN_READABLE_DECIMAL)
-                .short('H')
-                .long("si")
-                .overrides_with_all([OPT_HUMAN_READABLE_BINARY, OPT_HUMAN_READABLE_DECIMAL])
-                .help("likewise, but use powers of 1000 not 1024")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_HUMAN_READABLE_DECIMAL)
+                .short('H')
+                .long("si")
+                .overrides_with_all([OPT_HUMAN_READABLE_BINARY, OPT_HUMAN_READABLE_DECIMAL])
+                .help("likewise, but use powers of 1000 not 1024")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_INODES)
-                .short('i')
-                .long("inodes")
-                .overrides_with(OPT_INODES)
-                .help("list inode information instead of block usage")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_INODES)
+                .short('i')
+                .long("inodes")
+                .overrides_with(OPT_INODES)
+                .help("list inode information instead of block usage")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_KILO)
-                .short('k')
-                .help("like --block-size=1K")
-                .overrides_with_all([OPT_BLOCKSIZE, OPT_KILO])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_KILO)
+                .short('k')
+                .help("like --block-size=1K")
+                .overrides_with_all([OPT_BLOCKSIZE, OPT_KILO])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_LOCAL)
-                .short('l')
-                .long("local")
-                .overrides_with(OPT_LOCAL)
-                .help("limit listing to local file systems")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_LOCAL)
+                .short('l')
+                .long("local")
+                .overrides_with(OPT_LOCAL)
+                .help("limit listing to local file systems")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_NO_SYNC)
-                .long("no-sync")
-                .overrides_with_all([OPT_SYNC, OPT_NO_SYNC])
-                .help("do not invoke sync before getting usage info (default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_NO_SYNC)
+                .long("no-sync")
+                .overrides_with_all([OPT_SYNC, OPT_NO_SYNC])
+                .help("do not invoke sync before getting usage info (default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_OUTPUT)
-                .long("output")
-                .value_name("FIELD_LIST")
-                .action(ArgAction::Append)
-                .num_args(0..)
-                .require_equals(true)
-                .use_value_delimiter(true)
-                .value_parser(OUTPUT_FIELD_LIST)
-                .default_missing_values(OUTPUT_FIELD_LIST)
-                .default_values(["source", "size", "used", "avail", "pcent", "target"])
-                .conflicts_with_all([OPT_INODES, OPT_PORTABILITY, OPT_PRINT_TYPE])
-                .help(
+        .arg(
+            Arg::new(OPT_OUTPUT)
+                .long("output")
+                .value_name("FIELD_LIST")
+                .action(ArgAction::Append)
+                .num_args(0..)
+                .require_equals(true)
+                .use_value_delimiter(true)
+                .value_parser(OUTPUT_FIELD_LIST)
+                .default_missing_values(OUTPUT_FIELD_LIST)
+                .default_values(["source", "size", "used", "avail", "pcent", "target"])
+                .conflicts_with_all([OPT_INODES, OPT_PORTABILITY, OPT_PRINT_TYPE])
+                .help(
                     "use the output format defined by FIELD_LIST, \
                      or print all fields if FIELD_LIST is omitted.",
                 ),
         )
-        .arg(
-            Arg::new(OPT_PORTABILITY)
-                .short('P')
-                .long("portability")
-                .overrides_with(OPT_PORTABILITY)
-                .help("use the POSIX output format")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_PORTABILITY)
+                .short('P')
+                .long("portability")
+                .overrides_with(OPT_PORTABILITY)
+                .help("use the POSIX output format")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_SYNC)
-                .long("sync")
-                .overrides_with_all([OPT_NO_SYNC, OPT_SYNC])
-                .help("invoke sync before getting usage info (non-windows only)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_SYNC)
+                .long("sync")
+                .overrides_with_all([OPT_NO_SYNC, OPT_SYNC])
+                .help("invoke sync before getting usage info (non-windows only)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_TYPE)
-                .short('t')
-                .long("type")
-                .value_parser(ValueParser::os_string())
-                .value_name("TYPE")
-                .action(ArgAction::Append)
-                .help("limit listing to file systems of type TYPE"),
+        .arg(
+            Arg::new(OPT_TYPE)
+                .short('t')
+                .long("type")
+                .value_parser(ValueParser::os_string())
+                .value_name("TYPE")
+                .action(ArgAction::Append)
+                .help("limit listing to file systems of type TYPE"),
         )
-        .arg(
-            Arg::new(OPT_PRINT_TYPE)
-                .short('T')
-                .long("print-type")
-                .overrides_with(OPT_PRINT_TYPE)
-                .help("print file system type")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_PRINT_TYPE)
+                .short('T')
+                .long("print-type")
+                .overrides_with(OPT_PRINT_TYPE)
+                .help("print file system type")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_EXCLUDE_TYPE)
-                .short('x')
-                .long("exclude-type")
-                .action(ArgAction::Append)
-                .value_parser(ValueParser::os_string())
-                .value_name("TYPE")
-                .use_value_delimiter(true)
-                .help("limit listing to file systems not of type TYPE"),
+        .arg(
+            Arg::new(OPT_EXCLUDE_TYPE)
+                .short('x')
+                .long("exclude-type")
+                .action(ArgAction::Append)
+                .value_parser(ValueParser::os_string())
+                .value_name("TYPE")
+                .use_value_delimiter(true)
+                .help("limit listing to file systems not of type TYPE"),
         )
-        .arg(
-            Arg::new(OPT_PATHS)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(OPT_PATHS)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    mod mount_info_lt {
+    mod mount_info_lt {
 
-        use crate::mount_info_lt;
-        use uucore::fsext::MountInfo;
+        use crate::mount_info_lt;
+        use uucore::fsext::MountInfo;
 
-        /// Instantiate a [`MountInfo`] with the given fields.
-        fn mount_info(dev_name: &str, mount_root: &str, mount_dir: &str) -> MountInfo {
-            MountInfo {
-                dev_id: String::new(),
-                dev_name: String::from(dev_name),
-                fs_type: String::new(),
-                mount_dir: String::from(mount_dir),
-                mount_option: String::new(),
-                mount_root: String::from(mount_root),
-                remote: false,
-                dummy: false,
+        /// Instantiate a [`MountInfo`] with the given fields.
+        fn mount_info(dev_name: &str, mount_root: &str, mount_dir: &str) -> MountInfo {
+            MountInfo {
+                dev_id: String::new(),
+                dev_name: String::from(dev_name),
+                fs_type: String::new(),
+                mount_dir: String::from(mount_dir),
+                mount_option: String::new(),
+                mount_root: String::from(mount_root),
+                remote: false,
+                dummy: false,
             }
         }
 
-        #[test]
-        fn test_absolute() {
-            // Prefer device name "/dev/foo" over "dev_foo".
-            let m1 = mount_info("/dev/foo", "/", "/mnt/bar");
-            let m2 = mount_info("dev_foo", "/", "/mnt/bar");
-            assert!(!mount_info_lt(&m1, &m2));
+        #[test]
+        fn test_absolute() {
+            // Prefer device name "/dev/foo" over "dev_foo".
+            let m1 = mount_info("/dev/foo", "/", "/mnt/bar");
+            let m2 = mount_info("dev_foo", "/", "/mnt/bar");
+            assert!(!mount_info_lt(&m1, &m2));
         }
 
-        #[test]
-        fn test_shorter() {
-            // Prefer mount directory "/mnt/bar" over "/mnt/bar/baz"...
-            let m1 = mount_info("/dev/foo", "/", "/mnt/bar");
-            let m2 = mount_info("/dev/foo", "/", "/mnt/bar/baz");
-            assert!(!mount_info_lt(&m1, &m2));
+        #[test]
+        fn test_shorter() {
+            // Prefer mount directory "/mnt/bar" over "/mnt/bar/baz"...
+            let m1 = mount_info("/dev/foo", "/", "/mnt/bar");
+            let m2 = mount_info("/dev/foo", "/", "/mnt/bar/baz");
+            assert!(!mount_info_lt(&m1, &m2));
 
-            // ..but prefer mount root "/root" over "/".
-            let m1 = mount_info("/dev/foo", "/root", "/mnt/bar");
-            let m2 = mount_info("/dev/foo", "/", "/mnt/bar/baz");
-            assert!(mount_info_lt(&m1, &m2));
+            // ..but prefer mount root "/root" over "/".
+            let m1 = mount_info("/dev/foo", "/root", "/mnt/bar");
+            let m2 = mount_info("/dev/foo", "/", "/mnt/bar/baz");
+            assert!(mount_info_lt(&m1, &m2));
         }
 
-        #[test]
-        fn test_over_mounted() {
-            // Prefer the earlier entry if the devices are different but
-            // the mount directory is the same.
-            let m1 = mount_info("/dev/foo", "/", "/mnt/baz");
-            let m2 = mount_info("/dev/bar", "/", "/mnt/baz");
-            assert!(!mount_info_lt(&m1, &m2));
+        #[test]
+        fn test_over_mounted() {
+            // Prefer the earlier entry if the devices are different but
+            // the mount directory is the same.
+            let m1 = mount_info("/dev/foo", "/", "/mnt/baz");
+            let m2 = mount_info("/dev/bar", "/", "/mnt/baz");
+            assert!(!mount_info_lt(&m1, &m2));
         }
     }
 
-    mod is_best {
+    mod is_best {
 
-        use crate::is_best;
-        use uucore::fsext::MountInfo;
+        use crate::is_best;
+        use uucore::fsext::MountInfo;
 
-        /// Instantiate a [`MountInfo`] with the given fields.
-        fn mount_info(dev_id: &str, mount_dir: &str) -> MountInfo {
-            MountInfo {
-                dev_id: String::from(dev_id),
-                dev_name: String::new(),
-                fs_type: String::new(),
-                mount_dir: String::from(mount_dir),
-                mount_option: String::new(),
-                mount_root: String::new(),
-                remote: false,
-                dummy: false,
+        /// Instantiate a [`MountInfo`] with the given fields.
+        fn mount_info(dev_id: &str, mount_dir: &str) -> MountInfo {
+            MountInfo {
+                dev_id: String::from(dev_id),
+                dev_name: String::new(),
+                fs_type: String::new(),
+                mount_dir: String::from(mount_dir),
+                mount_option: String::new(),
+                mount_root: String::new(),
+                remote: false,
+                dummy: false,
             }
         }
 
-        #[test]
-        fn test_empty() {
-            let m = mount_info("0", "/mnt/bar");
-            assert!(is_best(&[], &m));
+        #[test]
+        fn test_empty() {
+            let m = mount_info("0", "/mnt/bar");
+            assert!(is_best(&[], &m));
         }
 
-        #[test]
-        fn test_different_dev_id() {
-            let m1 = mount_info("0", "/mnt/bar");
-            let m2 = mount_info("1", "/mnt/bar");
-            assert!(is_best(&[m1.clone()], &m2));
-            assert!(is_best(&[m2], &m1));
+        #[test]
+        fn test_different_dev_id() {
+            let m1 = mount_info("0", "/mnt/bar");
+            let m2 = mount_info("1", "/mnt/bar");
+            assert!(is_best(&[m1.clone()], &m2));
+            assert!(is_best(&[m2], &m1));
         }
 
-        #[test]
-        fn test_same_dev_id() {
-            // There are several conditions under which a `MountInfo` is
-            // considered "better" than the others, we're just checking
-            // one condition in this test.
-            let m1 = mount_info("0", "/mnt/bar");
-            let m2 = mount_info("0", "/mnt/bar/baz");
-            assert!(!is_best(&[m1.clone()], &m2));
-            assert!(is_best(&[m2], &m1));
+        #[test]
+        fn test_same_dev_id() {
+            // There are several conditions under which a `MountInfo` is
+            // considered "better" than the others, we're just checking
+            // one condition in this test.
+            let m1 = mount_info("0", "/mnt/bar");
+            let m2 = mount_info("0", "/mnt/bar/baz");
+            assert!(!is_best(&[m1.clone()], &m2));
+            assert!(is_best(&[m2], &m1));
         }
     }
 
-    mod is_included {
+    mod is_included {
 
-        use crate::{is_included, Options};
-        use uucore::fsext::MountInfo;
+        use crate::{is_included, Options};
+        use uucore::fsext::MountInfo;
 
-        /// Instantiate a [`MountInfo`] with the given fields.
-        fn mount_info(fs_type: &str, mount_dir: &str, remote: bool, dummy: bool) -> MountInfo {
-            MountInfo {
-                dev_id: String::new(),
-                dev_name: String::new(),
-                fs_type: String::from(fs_type),
-                mount_dir: String::from(mount_dir),
-                mount_option: String::new(),
-                mount_root: String::new(),
-                remote,
-                dummy,
+        /// Instantiate a [`MountInfo`] with the given fields.
+        fn mount_info(fs_type: &str, mount_dir: &str, remote: bool, dummy: bool) -> MountInfo {
+            MountInfo {
+                dev_id: String::new(),
+                dev_name: String::new(),
+                fs_type: String::from(fs_type),
+                mount_dir: String::from(mount_dir),
+                mount_option: String::new(),
+                mount_root: String::new(),
+                remote,
+                dummy,
             }
         }
 
-        #[test]
-        fn test_remote_included() {
-            let opt = Default::default();
-            let m = mount_info("ext4", "/mnt/foo", true, false);
-            assert!(is_included(&m, &opt));
+        #[test]
+        fn test_remote_included() {
+            let opt = Default::default();
+            let m = mount_info("ext4", "/mnt/foo", true, false);
+            assert!(is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_remote_excluded() {
-            let opt = Options {
-                show_local_fs: true,
-                ..Default::default()
+        #[test]
+        fn test_remote_excluded() {
+            let opt = Options {
+                show_local_fs: true,
+                ..Default::default()
             };
-            let m = mount_info("ext4", "/mnt/foo", true, false);
-            assert!(!is_included(&m, &opt));
+            let m = mount_info("ext4", "/mnt/foo", true, false);
+            assert!(!is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_dummy_included() {
-            let opt = Options {
-                show_all_fs: true,
-                ..Default::default()
+        #[test]
+        fn test_dummy_included() {
+            let opt = Options {
+                show_all_fs: true,
+                ..Default::default()
             };
-            let m = mount_info("ext4", "/mnt/foo", false, true);
-            assert!(is_included(&m, &opt));
+            let m = mount_info("ext4", "/mnt/foo", false, true);
+            assert!(is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_dummy_excluded() {
-            let opt = Default::default();
-            let m = mount_info("ext4", "/mnt/foo", false, true);
-            assert!(!is_included(&m, &opt));
+        #[test]
+        fn test_dummy_excluded() {
+            let opt = Default::default();
+            let m = mount_info("ext4", "/mnt/foo", false, true);
+            assert!(!is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_exclude_match() {
-            let exclude = Some(vec![String::from("ext4")]);
-            let opt = Options {
-                exclude,
-                ..Default::default()
+        #[test]
+        fn test_exclude_match() {
+            let exclude = Some(vec![String::from("ext4")]);
+            let opt = Options {
+                exclude,
+                ..Default::default()
             };
-            let m = mount_info("ext4", "/mnt/foo", false, false);
-            assert!(!is_included(&m, &opt));
+            let m = mount_info("ext4", "/mnt/foo", false, false);
+            assert!(!is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_exclude_no_match() {
-            let exclude = Some(vec![String::from("tmpfs")]);
-            let opt = Options {
-                exclude,
-                ..Default::default()
+        #[test]
+        fn test_exclude_no_match() {
+            let exclude = Some(vec![String::from("tmpfs")]);
+            let opt = Options {
+                exclude,
+                ..Default::default()
             };
-            let m = mount_info("ext4", "/mnt/foo", false, false);
-            assert!(is_included(&m, &opt));
+            let m = mount_info("ext4", "/mnt/foo", false, false);
+            assert!(is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_include_match() {
-            let include = Some(vec![String::from("ext4")]);
-            let opt = Options {
-                include,
-                ..Default::default()
+        #[test]
+        fn test_include_match() {
+            let include = Some(vec![String::from("ext4")]);
+            let opt = Options {
+                include,
+                ..Default::default()
             };
-            let m = mount_info("ext4", "/mnt/foo", false, false);
-            assert!(is_included(&m, &opt));
+            let m = mount_info("ext4", "/mnt/foo", false, false);
+            assert!(is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_include_no_match() {
-            let include = Some(vec![String::from("tmpfs")]);
-            let opt = Options {
-                include,
-                ..Default::default()
+        #[test]
+        fn test_include_no_match() {
+            let include = Some(vec![String::from("tmpfs")]);
+            let opt = Options {
+                include,
+                ..Default::default()
             };
-            let m = mount_info("ext4", "/mnt/foo", false, false);
-            assert!(!is_included(&m, &opt));
+            let m = mount_info("ext4", "/mnt/foo", false, false);
+            assert!(!is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_include_and_exclude_match_neither() {
-            let include = Some(vec![String::from("tmpfs")]);
-            let exclude = Some(vec![String::from("squashfs")]);
-            let opt = Options {
-                include,
-                exclude,
-                ..Default::default()
+        #[test]
+        fn test_include_and_exclude_match_neither() {
+            let include = Some(vec![String::from("tmpfs")]);
+            let exclude = Some(vec![String::from("squashfs")]);
+            let opt = Options {
+                include,
+                exclude,
+                ..Default::default()
             };
-            let m = mount_info("ext4", "/mnt/foo", false, false);
-            assert!(!is_included(&m, &opt));
+            let m = mount_info("ext4", "/mnt/foo", false, false);
+            assert!(!is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_include_and_exclude_match_exclude() {
-            let include = Some(vec![String::from("tmpfs")]);
-            let exclude = Some(vec![String::from("ext4")]);
-            let opt = Options {
-                include,
-                exclude,
-                ..Default::default()
+        #[test]
+        fn test_include_and_exclude_match_exclude() {
+            let include = Some(vec![String::from("tmpfs")]);
+            let exclude = Some(vec![String::from("ext4")]);
+            let opt = Options {
+                include,
+                exclude,
+                ..Default::default()
             };
-            let m = mount_info("ext4", "/mnt/foo", false, false);
-            assert!(!is_included(&m, &opt));
+            let m = mount_info("ext4", "/mnt/foo", false, false);
+            assert!(!is_included(&m, &opt));
         }
 
-        #[test]
-        fn test_include_and_exclude_match_include() {
-            let include = Some(vec![String::from("ext4")]);
-            let exclude = Some(vec![String::from("squashfs")]);
-            let opt = Options {
-                include,
-                exclude,
-                ..Default::default()
+        #[test]
+        fn test_include_and_exclude_match_include() {
+            let include = Some(vec![String::from("ext4")]);
+            let exclude = Some(vec![String::from("squashfs")]);
+            let opt = Options {
+                include,
+                exclude,
+                ..Default::default()
             };
-            let m = mount_info("ext4", "/mnt/foo", false, false);
-            assert!(is_included(&m, &opt));
+            let m = mount_info("ext4", "/mnt/foo", false, false);
+            assert!(is_included(&m, &opt));
         }
     }
 
-    mod filter_mount_list {
+    mod filter_mount_list {
 
-        use crate::filter_mount_list;
+        use crate::filter_mount_list;
 
-        #[test]
-        fn test_empty() {
-            let opt = Default::default();
-            let mount_infos = vec![];
-            assert!(filter_mount_list(mount_infos, &opt).is_empty());
+        #[test]
+        fn test_empty() {
+            let opt = Default::default();
+            let mount_infos = vec![];
+            assert!(filter_mount_list(mount_infos, &opt).is_empty());
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_df/filesystem.rs.html b/dev/src/uu_df/filesystem.rs.html index 5d96eef3b..72fe99252 100644 --- a/dev/src/uu_df/filesystem.rs.html +++ b/dev/src/uu_df/filesystem.rs.html @@ -1,4 +1,4 @@ -filesystem.rs - source
1
+filesystem.rs - source
1
 2
 3
 4
@@ -219,226 +219,226 @@
 219
 220
 221
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-//! Provides a summary representation of a filesystem.
-//!
-//! A [`Filesystem`] struct represents a device containing a
-//! filesystem mounted at a particular directory. It also includes
-//! information on amount of space available and amount of space used.
-// spell-checker:ignore canonicalized
-use std::path::Path;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+//! Provides a summary representation of a filesystem.
+//!
+//! A [`Filesystem`] struct represents a device containing a
+//! filesystem mounted at a particular directory. It also includes
+//! information on amount of space available and amount of space used.
+// spell-checker:ignore canonicalized
+use std::path::Path;
 
-#[cfg(unix)]
-use uucore::fsext::statfs;
-use uucore::fsext::{FsUsage, MountInfo};
+#[cfg(unix)]
+use uucore::fsext::statfs;
+use uucore::fsext::{FsUsage, MountInfo};
 
-/// Summary representation of a filesystem.
-///
-/// A [`Filesystem`] struct represents a device containing a
-/// filesystem mounted at a particular directory. The
-/// [`Filesystem::mount_info`] field exposes that information. The
-/// [`Filesystem::usage`] field provides information on the amount of
-/// space available on the filesystem and the amount of space used.
-#[derive(Debug, Clone)]
-pub(crate) struct Filesystem {
-    /// The file given on the command line if any.
-    ///
-    /// When invoking `df` with a positional argument, it displays
-    /// usage information for the filesystem that contains the given
-    /// file. If given, this field contains that filename.
-    pub file: Option<String>,
+/// Summary representation of a filesystem.
+///
+/// A [`Filesystem`] struct represents a device containing a
+/// filesystem mounted at a particular directory. The
+/// [`Filesystem::mount_info`] field exposes that information. The
+/// [`Filesystem::usage`] field provides information on the amount of
+/// space available on the filesystem and the amount of space used.
+#[derive(Debug, Clone)]
+pub(crate) struct Filesystem {
+    /// The file given on the command line if any.
+    ///
+    /// When invoking `df` with a positional argument, it displays
+    /// usage information for the filesystem that contains the given
+    /// file. If given, this field contains that filename.
+    pub file: Option<String>,
 
-    /// Information about the mounted device, mount directory, and related options.
-    pub mount_info: MountInfo,
+    /// Information about the mounted device, mount directory, and related options.
+    pub mount_info: MountInfo,
 
-    /// Information about the amount of space used on the filesystem.
-    pub usage: FsUsage,
+    /// Information about the amount of space used on the filesystem.
+    pub usage: FsUsage,
 }
 
-/// Find the mount info that best matches a given filesystem path.
-///
-/// This function returns the element of `mounts` on which `path` is
-/// mounted. If there are no matches, this function returns
-/// [`None`]. If there are two or more matches, then the single
-/// [`MountInfo`] with the longest mount directory is returned.
-///
-/// If `canonicalize` is `true`, then the `path` is canonicalized
-/// before checking whether it matches any mount directories.
-///
-/// # See also
-///
-/// * [`Path::canonicalize`]
-/// * [`MountInfo::mount_dir`]
-fn mount_info_from_path<P>(
-    mounts: &[MountInfo],
-    path: P,
-    // This is really only used for testing purposes.
-    canonicalize: bool,
-) -> Option<&MountInfo>
-where
-    P: AsRef<Path>,
+/// Find the mount info that best matches a given filesystem path.
+///
+/// This function returns the element of `mounts` on which `path` is
+/// mounted. If there are no matches, this function returns
+/// [`None`]. If there are two or more matches, then the single
+/// [`MountInfo`] with the longest mount directory is returned.
+///
+/// If `canonicalize` is `true`, then the `path` is canonicalized
+/// before checking whether it matches any mount directories.
+///
+/// # See also
+///
+/// * [`Path::canonicalize`]
+/// * [`MountInfo::mount_dir`]
+fn mount_info_from_path<P>(
+    mounts: &[MountInfo],
+    path: P,
+    // This is really only used for testing purposes.
+    canonicalize: bool,
+) -> Option<&MountInfo>
+where
+    P: AsRef<Path>,
 {
-    // TODO Refactor this function with `Stater::find_mount_point()`
-    // in the `stat` crate.
-    let path = if canonicalize {
-        path.as_ref().canonicalize().ok()?
-    } else {
-        path.as_ref().to_path_buf()
+    // TODO Refactor this function with `Stater::find_mount_point()`
+    // in the `stat` crate.
+    let path = if canonicalize {
+        path.as_ref().canonicalize().ok()?
+    } else {
+        path.as_ref().to_path_buf()
     };
 
-    let maybe_mount_point = mounts
-        .iter()
-        .find(|mi| mi.dev_name.eq(&path.to_string_lossy()));
+    let maybe_mount_point = mounts
+        .iter()
+        .find(|mi| mi.dev_name.eq(&path.to_string_lossy()));
 
-    maybe_mount_point.or_else(|| {
-        mounts
-            .iter()
-            .filter(|mi| path.starts_with(&mi.mount_dir))
-            .max_by_key(|mi| mi.mount_dir.len())
+    maybe_mount_point.or_else(|| {
+        mounts
+            .iter()
+            .filter(|mi| path.starts_with(&mi.mount_dir))
+            .max_by_key(|mi| mi.mount_dir.len())
     })
 }
 
-impl Filesystem {
-    // TODO: resolve uuid in `mount_info.dev_name` if exists
-    pub(crate) fn new(mount_info: MountInfo, file: Option<String>) -> Option<Self> {
-        let _stat_path = if !mount_info.mount_dir.is_empty() {
-            mount_info.mount_dir.clone()
-        } else {
-            #[cfg(unix)]
-            {
-                mount_info.dev_name.clone()
+impl Filesystem {
+    // TODO: resolve uuid in `mount_info.dev_name` if exists
+    pub(crate) fn new(mount_info: MountInfo, file: Option<String>) -> Option<Self> {
+        let _stat_path = if !mount_info.mount_dir.is_empty() {
+            mount_info.mount_dir.clone()
+        } else {
+            #[cfg(unix)]
+            {
+                mount_info.dev_name.clone()
             }
-            #[cfg(windows)]
-            {
-                // On windows, we expect the volume id
-                mount_info.dev_id.clone()
+            #[cfg(windows)]
+            {
+                // On windows, we expect the volume id
+                mount_info.dev_id.clone()
             }
         };
-        #[cfg(unix)]
-        let usage = FsUsage::new(statfs(_stat_path).ok()?);
-        #[cfg(windows)]
-        let usage = FsUsage::new(Path::new(&_stat_path));
-        Some(Self {
-            mount_info,
-            usage,
-            file,
+        #[cfg(unix)]
+        let usage = FsUsage::new(statfs(_stat_path).ok()?);
+        #[cfg(windows)]
+        let usage = FsUsage::new(Path::new(&_stat_path));
+        Some(Self {
+            mount_info,
+            usage,
+            file,
         })
     }
 
-    /// Find and create the filesystem that best matches a given path.
-    ///
-    /// This function returns a new `Filesystem` derived from the
-    /// element of `mounts` on which `path` is mounted. If there are
-    /// no matches, this function returns [`None`]. If there are two
-    /// or more matches, then the single [`Filesystem`] with the
-    /// longest mount directory is returned.
-    ///
-    /// The `path` is canonicalized before checking whether it matches
-    /// any mount directories.
-    ///
-    /// # See also
-    ///
-    /// * [`Path::canonicalize`]
-    /// * [`MountInfo::mount_dir`]
-    ///
-    pub(crate) fn from_path<P>(mounts: &[MountInfo], path: P) -> Option<Self>
-    where
-        P: AsRef<Path>,
+    /// Find and create the filesystem that best matches a given path.
+    ///
+    /// This function returns a new `Filesystem` derived from the
+    /// element of `mounts` on which `path` is mounted. If there are
+    /// no matches, this function returns [`None`]. If there are two
+    /// or more matches, then the single [`Filesystem`] with the
+    /// longest mount directory is returned.
+    ///
+    /// The `path` is canonicalized before checking whether it matches
+    /// any mount directories.
+    ///
+    /// # See also
+    ///
+    /// * [`Path::canonicalize`]
+    /// * [`MountInfo::mount_dir`]
+    ///
+    pub(crate) fn from_path<P>(mounts: &[MountInfo], path: P) -> Option<Self>
+    where
+        P: AsRef<Path>,
     {
-        let file = path.as_ref().display().to_string();
-        let canonicalize = true;
-        let mount_info = mount_info_from_path(mounts, path, canonicalize)?;
-        // TODO Make it so that we do not need to clone the `mount_info`.
-        let mount_info = (*mount_info).clone();
-        Self::new(mount_info, Some(file))
+        let file = path.as_ref().display().to_string();
+        let canonicalize = true;
+        let mount_info = mount_info_from_path(mounts, path, canonicalize)?;
+        // TODO Make it so that we do not need to clone the `mount_info`.
+        let mount_info = (*mount_info).clone();
+        Self::new(mount_info, Some(file))
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    mod mount_info_from_path {
+    mod mount_info_from_path {
 
-        use uucore::fsext::MountInfo;
+        use uucore::fsext::MountInfo;
 
-        use crate::filesystem::mount_info_from_path;
+        use crate::filesystem::mount_info_from_path;
 
-        // Create a fake `MountInfo` with the given directory name.
-        fn mount_info(mount_dir: &str) -> MountInfo {
-            MountInfo {
-                dev_id: Default::default(),
-                dev_name: Default::default(),
-                fs_type: Default::default(),
-                mount_dir: String::from(mount_dir),
-                mount_option: Default::default(),
-                mount_root: Default::default(),
-                remote: Default::default(),
-                dummy: Default::default(),
+        // Create a fake `MountInfo` with the given directory name.
+        fn mount_info(mount_dir: &str) -> MountInfo {
+            MountInfo {
+                dev_id: Default::default(),
+                dev_name: Default::default(),
+                fs_type: Default::default(),
+                mount_dir: String::from(mount_dir),
+                mount_option: Default::default(),
+                mount_root: Default::default(),
+                remote: Default::default(),
+                dummy: Default::default(),
             }
         }
 
-        // Check whether two `MountInfo` instances are equal.
-        fn mount_info_eq(m1: &MountInfo, m2: &MountInfo) -> bool {
-            m1.dev_id == m2.dev_id
-                && m1.dev_name == m2.dev_name
-                && m1.fs_type == m2.fs_type
-                && m1.mount_dir == m2.mount_dir
-                && m1.mount_option == m2.mount_option
-                && m1.mount_root == m2.mount_root
-                && m1.remote == m2.remote
-                && m1.dummy == m2.dummy
+        // Check whether two `MountInfo` instances are equal.
+        fn mount_info_eq(m1: &MountInfo, m2: &MountInfo) -> bool {
+            m1.dev_id == m2.dev_id
+                && m1.dev_name == m2.dev_name
+                && m1.fs_type == m2.fs_type
+                && m1.mount_dir == m2.mount_dir
+                && m1.mount_option == m2.mount_option
+                && m1.mount_root == m2.mount_root
+                && m1.remote == m2.remote
+                && m1.dummy == m2.dummy
         }
 
-        #[test]
-        fn test_empty_mounts() {
-            assert!(mount_info_from_path(&[], "/", false).is_none());
+        #[test]
+        fn test_empty_mounts() {
+            assert!(mount_info_from_path(&[], "/", false).is_none());
         }
 
-        #[test]
-        fn test_exact_match() {
-            let mounts = [mount_info("/foo")];
-            let actual = mount_info_from_path(&mounts, "/foo", false).unwrap();
-            assert!(mount_info_eq(actual, &mounts[0]));
+        #[test]
+        fn test_exact_match() {
+            let mounts = [mount_info("/foo")];
+            let actual = mount_info_from_path(&mounts, "/foo", false).unwrap();
+            assert!(mount_info_eq(actual, &mounts[0]));
         }
 
-        #[test]
-        fn test_prefix_match() {
-            let mounts = [mount_info("/foo")];
-            let actual = mount_info_from_path(&mounts, "/foo/bar", false).unwrap();
-            assert!(mount_info_eq(actual, &mounts[0]));
+        #[test]
+        fn test_prefix_match() {
+            let mounts = [mount_info("/foo")];
+            let actual = mount_info_from_path(&mounts, "/foo/bar", false).unwrap();
+            assert!(mount_info_eq(actual, &mounts[0]));
         }
 
-        #[test]
-        fn test_multiple_matches() {
-            let mounts = [mount_info("/foo"), mount_info("/foo/bar")];
-            let actual = mount_info_from_path(&mounts, "/foo/bar", false).unwrap();
-            assert!(mount_info_eq(actual, &mounts[1]));
+        #[test]
+        fn test_multiple_matches() {
+            let mounts = [mount_info("/foo"), mount_info("/foo/bar")];
+            let actual = mount_info_from_path(&mounts, "/foo/bar", false).unwrap();
+            assert!(mount_info_eq(actual, &mounts[1]));
         }
 
-        #[test]
-        fn test_no_match() {
-            let mounts = [mount_info("/foo")];
-            assert!(mount_info_from_path(&mounts, "/bar", false).is_none());
+        #[test]
+        fn test_no_match() {
+            let mounts = [mount_info("/foo")];
+            assert!(mount_info_from_path(&mounts, "/bar", false).is_none());
         }
 
-        #[test]
-        fn test_partial_match() {
-            let mounts = [mount_info("/foo/bar")];
-            assert!(mount_info_from_path(&mounts, "/foo/baz", false).is_none());
+        #[test]
+        fn test_partial_match() {
+            let mounts = [mount_info("/foo/bar")];
+            assert!(mount_info_from_path(&mounts, "/foo/baz", false).is_none());
         }
 
-        #[test]
-        fn test_dev_name_match() {
-            let mut mount_info = mount_info("/foo");
-            mount_info.dev_name = "/dev/sda2".to_string();
-            let mounts = [mount_info];
-            let actual = mount_info_from_path(&mounts, "/dev/sda2", false).unwrap();
-            assert!(mount_info_eq(actual, &mounts[0]));
+        #[test]
+        fn test_dev_name_match() {
+            let mut mount_info = mount_info("/foo");
+            mount_info.dev_name = "/dev/sda2".to_string();
+            let mounts = [mount_info];
+            let actual = mount_info_from_path(&mounts, "/dev/sda2", false).unwrap();
+            assert!(mount_info_eq(actual, &mounts[0]));
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_df/table.rs.html b/dev/src/uu_df/table.rs.html index 5f4dc767e..a5199a329 100644 --- a/dev/src/uu_df/table.rs.html +++ b/dev/src/uu_df/table.rs.html @@ -1,4 +1,4 @@ -table.rs - source
1
+table.rs - source
1
 2
 3
 4
@@ -816,462 +816,462 @@
 816
 817
 818
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore tmpfs Pcent Itotal Iused Iavail Ipcent
-//! The filesystem usage data table.
-//!
-//! A table ([`Table`]) comprises a header row ([`Header`]) and a
-//! collection of data rows ([`Row`]), one per filesystem.
-use unicode_width::UnicodeWidthStr;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore tmpfs Pcent Itotal Iused Iavail Ipcent
+//! The filesystem usage data table.
+//!
+//! A table ([`Table`]) comprises a header row ([`Header`]) and a
+//! collection of data rows ([`Row`]), one per filesystem.
+use unicode_width::UnicodeWidthStr;
 
-use crate::blocks::{to_magnitude_and_suffix, SuffixType};
-use crate::columns::{Alignment, Column};
-use crate::filesystem::Filesystem;
-use crate::{BlockSize, Options};
-use uucore::fsext::{FsUsage, MountInfo};
+use crate::blocks::{to_magnitude_and_suffix, SuffixType};
+use crate::columns::{Alignment, Column};
+use crate::filesystem::Filesystem;
+use crate::{BlockSize, Options};
+use uucore::fsext::{FsUsage, MountInfo};
 
-use std::fmt;
-use std::ops::AddAssign;
+use std::fmt;
+use std::ops::AddAssign;
 
-/// A row in the filesystem usage data table.
-///
-/// A row comprises several pieces of information, including the
-/// filesystem device, the mountpoint, the number of bytes used, etc.
-pub(crate) struct Row {
-    /// The filename given on the command-line, if given.
-    file: Option<String>,
+/// A row in the filesystem usage data table.
+///
+/// A row comprises several pieces of information, including the
+/// filesystem device, the mountpoint, the number of bytes used, etc.
+pub(crate) struct Row {
+    /// The filename given on the command-line, if given.
+    file: Option<String>,
 
-    /// Name of the device on which the filesystem lives.
-    fs_device: String,
+    /// Name of the device on which the filesystem lives.
+    fs_device: String,
 
-    /// Type of filesystem (for example, `"ext4"`, `"tmpfs"`, etc.).
-    fs_type: String,
+    /// Type of filesystem (for example, `"ext4"`, `"tmpfs"`, etc.).
+    fs_type: String,
 
-    /// Path at which the filesystem is mounted.
-    fs_mount: String,
+    /// Path at which the filesystem is mounted.
+    fs_mount: String,
 
-    /// Total number of bytes in the filesystem regardless of whether they are used.
-    bytes: u64,
+    /// Total number of bytes in the filesystem regardless of whether they are used.
+    bytes: u64,
 
-    /// Number of used bytes.
-    bytes_used: u64,
+    /// Number of used bytes.
+    bytes_used: u64,
 
-    /// Number of available bytes.
-    bytes_avail: u64,
+    /// Number of available bytes.
+    bytes_avail: u64,
 
-    /// Percentage of bytes that are used, given as a float between 0 and 1.
-    ///
-    /// If the filesystem has zero bytes, then this is `None`.
-    bytes_usage: Option<f64>,
+    /// Percentage of bytes that are used, given as a float between 0 and 1.
+    ///
+    /// If the filesystem has zero bytes, then this is `None`.
+    bytes_usage: Option<f64>,
 
-    /// Percentage of bytes that are available, given as a float between 0 and 1.
-    ///
-    /// These are the bytes that are available to non-privileged processes.
-    ///
-    /// If the filesystem has zero bytes, then this is `None`.
-    #[cfg(target_os = "macos")]
-    bytes_capacity: Option<f64>,
+    /// Percentage of bytes that are available, given as a float between 0 and 1.
+    ///
+    /// These are the bytes that are available to non-privileged processes.
+    ///
+    /// If the filesystem has zero bytes, then this is `None`.
+    #[cfg(target_os = "macos")]
+    bytes_capacity: Option<f64>,
 
-    /// Total number of inodes in the filesystem.
-    inodes: u64,
+    /// Total number of inodes in the filesystem.
+    inodes: u64,
 
-    /// Number of used inodes.
-    inodes_used: u64,
+    /// Number of used inodes.
+    inodes_used: u64,
 
-    /// Number of free inodes.
-    inodes_free: u64,
+    /// Number of free inodes.
+    inodes_free: u64,
 
-    /// Percentage of inodes that are used, given as a float between 0 and 1.
-    ///
-    /// If the filesystem has zero bytes, then this is `None`.
-    inodes_usage: Option<f64>,
+    /// Percentage of inodes that are used, given as a float between 0 and 1.
+    ///
+    /// If the filesystem has zero bytes, then this is `None`.
+    inodes_usage: Option<f64>,
 }
 
-impl Row {
-    pub(crate) fn new(source: &str) -> Self {
-        Self {
-            file: None,
-            fs_device: source.into(),
-            fs_type: "-".into(),
-            fs_mount: "-".into(),
-            bytes: 0,
-            bytes_used: 0,
-            bytes_avail: 0,
-            bytes_usage: None,
-            #[cfg(target_os = "macos")]
-            bytes_capacity: None,
-            inodes: 0,
-            inodes_used: 0,
-            inodes_free: 0,
-            inodes_usage: None,
+impl Row {
+    pub(crate) fn new(source: &str) -> Self {
+        Self {
+            file: None,
+            fs_device: source.into(),
+            fs_type: "-".into(),
+            fs_mount: "-".into(),
+            bytes: 0,
+            bytes_used: 0,
+            bytes_avail: 0,
+            bytes_usage: None,
+            #[cfg(target_os = "macos")]
+            bytes_capacity: None,
+            inodes: 0,
+            inodes_used: 0,
+            inodes_free: 0,
+            inodes_usage: None,
         }
     }
 }
 
-impl AddAssign for Row {
-    /// Sum the numeric values of two rows.
-    ///
-    /// The `Row::fs_device` field is set to `"total"` and the
-    /// remaining `String` fields are set to `"-"`.
-    fn add_assign(&mut self, rhs: Self) {
-        let bytes = self.bytes + rhs.bytes;
-        let bytes_used = self.bytes_used + rhs.bytes_used;
-        let bytes_avail = self.bytes_avail + rhs.bytes_avail;
-        let inodes = self.inodes + rhs.inodes;
-        let inodes_used = self.inodes_used + rhs.inodes_used;
-        *self = Self {
-            file: None,
-            fs_device: "total".into(),
-            fs_type: "-".into(),
-            fs_mount: "-".into(),
-            bytes,
-            bytes_used,
-            bytes_avail,
-            bytes_usage: if bytes == 0 {
-                None
-            } else {
-                // We use "(bytes_used + bytes_avail)" instead of "bytes" because on some filesystems (e.g.
-                // ext4) "bytes" also includes reserved blocks we ignore for the usage calculation.
-                // https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#df-Size-and-Used-and-Available-do-not-add-up
-                Some(bytes_used as f64 / (bytes_used + bytes_avail) as f64)
+impl AddAssign for Row {
+    /// Sum the numeric values of two rows.
+    ///
+    /// The `Row::fs_device` field is set to `"total"` and the
+    /// remaining `String` fields are set to `"-"`.
+    fn add_assign(&mut self, rhs: Self) {
+        let bytes = self.bytes + rhs.bytes;
+        let bytes_used = self.bytes_used + rhs.bytes_used;
+        let bytes_avail = self.bytes_avail + rhs.bytes_avail;
+        let inodes = self.inodes + rhs.inodes;
+        let inodes_used = self.inodes_used + rhs.inodes_used;
+        *self = Self {
+            file: None,
+            fs_device: "total".into(),
+            fs_type: "-".into(),
+            fs_mount: "-".into(),
+            bytes,
+            bytes_used,
+            bytes_avail,
+            bytes_usage: if bytes == 0 {
+                None
+            } else {
+                // We use "(bytes_used + bytes_avail)" instead of "bytes" because on some filesystems (e.g.
+                // ext4) "bytes" also includes reserved blocks we ignore for the usage calculation.
+                // https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#df-Size-and-Used-and-Available-do-not-add-up
+                Some(bytes_used as f64 / (bytes_used + bytes_avail) as f64)
             },
-            // TODO Figure out how to compute this.
-            #[cfg(target_os = "macos")]
-            bytes_capacity: None,
-            inodes,
-            inodes_used,
-            inodes_free: self.inodes_free + rhs.inodes_free,
-            inodes_usage: if inodes == 0 {
-                None
-            } else {
-                Some(inodes_used as f64 / inodes as f64)
+            // TODO Figure out how to compute this.
+            #[cfg(target_os = "macos")]
+            bytes_capacity: None,
+            inodes,
+            inodes_used,
+            inodes_free: self.inodes_free + rhs.inodes_free,
+            inodes_usage: if inodes == 0 {
+                None
+            } else {
+                Some(inodes_used as f64 / inodes as f64)
             },
         }
     }
 }
 
-impl From<Filesystem> for Row {
-    fn from(fs: Filesystem) -> Self {
-        let MountInfo {
-            dev_name,
-            fs_type,
-            mount_dir,
+impl From<Filesystem> for Row {
+    fn from(fs: Filesystem) -> Self {
+        let MountInfo {
+            dev_name,
+            fs_type,
+            mount_dir,
             ..
-        } = fs.mount_info;
-        let FsUsage {
-            blocksize,
-            blocks,
-            bfree,
-            bavail,
-            files,
-            ffree,
+        } = fs.mount_info;
+        let FsUsage {
+            blocksize,
+            blocks,
+            bfree,
+            bavail,
+            files,
+            ffree,
             ..
-        } = fs.usage;
-        let bused = blocks - bfree;
-        let fused = files - ffree;
-        Self {
-            file: fs.file,
-            fs_device: dev_name,
-            fs_type,
-            fs_mount: mount_dir,
-            bytes: blocksize * blocks,
-            bytes_used: blocksize * bused,
-            bytes_avail: blocksize * bavail,
-            bytes_usage: if blocks == 0 {
-                None
-            } else {
-                // We use "(bused + bavail)" instead of "blocks" because on some filesystems (e.g.
-                // ext4) "blocks" also includes reserved blocks we ignore for the usage calculation.
-                // https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#df-Size-and-Used-and-Available-do-not-add-up
-                Some(bused as f64 / (bused + bavail) as f64)
+        } = fs.usage;
+        let bused = blocks - bfree;
+        let fused = files - ffree;
+        Self {
+            file: fs.file,
+            fs_device: dev_name,
+            fs_type,
+            fs_mount: mount_dir,
+            bytes: blocksize * blocks,
+            bytes_used: blocksize * bused,
+            bytes_avail: blocksize * bavail,
+            bytes_usage: if blocks == 0 {
+                None
+            } else {
+                // We use "(bused + bavail)" instead of "blocks" because on some filesystems (e.g.
+                // ext4) "blocks" also includes reserved blocks we ignore for the usage calculation.
+                // https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#df-Size-and-Used-and-Available-do-not-add-up
+                Some(bused as f64 / (bused + bavail) as f64)
             },
-            #[cfg(target_os = "macos")]
-            bytes_capacity: if bavail == 0 {
-                None
-            } else {
-                Some(bavail as f64 / ((bused + bavail) as f64))
+            #[cfg(target_os = "macos")]
+            bytes_capacity: if bavail == 0 {
+                None
+            } else {
+                Some(bavail as f64 / ((bused + bavail) as f64))
             },
-            inodes: files,
-            inodes_used: fused,
-            inodes_free: ffree,
-            inodes_usage: if files == 0 {
-                None
-            } else {
-                Some(fused as f64 / files as f64)
+            inodes: files,
+            inodes_used: fused,
+            inodes_free: ffree,
+            inodes_usage: if files == 0 {
+                None
+            } else {
+                Some(fused as f64 / files as f64)
             },
         }
     }
 }
 
-/// A formatter for [`Row`].
-///
-/// The `options` control how the information in the row gets formatted.
-pub(crate) struct RowFormatter<'a> {
-    /// The data in this row.
-    row: &'a Row,
+/// A formatter for [`Row`].
+///
+/// The `options` control how the information in the row gets formatted.
+pub(crate) struct RowFormatter<'a> {
+    /// The data in this row.
+    row: &'a Row,
 
-    /// Options that control how to format the data.
-    options: &'a Options,
-    // TODO We don't need all of the command-line options here. Some
-    // of the command-line options indicate which rows to include or
-    // exclude. Other command-line options indicate which columns to
-    // include or exclude. Still other options indicate how to format
-    // numbers. We could split the options up into those groups to
-    // reduce the coupling between this `table.rs` module and the main
-    // `df.rs` module.
-    /// Whether to use the special rules for displaying the total row.
-    is_total_row: bool,
+    /// Options that control how to format the data.
+    options: &'a Options,
+    // TODO We don't need all of the command-line options here. Some
+    // of the command-line options indicate which rows to include or
+    // exclude. Other command-line options indicate which columns to
+    // include or exclude. Still other options indicate how to format
+    // numbers. We could split the options up into those groups to
+    // reduce the coupling between this `table.rs` module and the main
+    // `df.rs` module.
+    /// Whether to use the special rules for displaying the total row.
+    is_total_row: bool,
 }
 
-impl<'a> RowFormatter<'a> {
-    /// Instantiate this struct.
-    pub(crate) fn new(row: &'a Row, options: &'a Options, is_total_row: bool) -> Self {
-        Self {
-            row,
-            options,
-            is_total_row,
+impl<'a> RowFormatter<'a> {
+    /// Instantiate this struct.
+    pub(crate) fn new(row: &'a Row, options: &'a Options, is_total_row: bool) -> Self {
+        Self {
+            row,
+            options,
+            is_total_row,
         }
     }
 
-    /// Get a string giving the scaled version of the input number.
-    ///
-    /// The scaling factor is defined in the `options` field.
-    fn scaled_bytes(&self, size: u64) -> String {
-        if let Some(h) = self.options.human_readable {
-            to_magnitude_and_suffix(size.into(), SuffixType::HumanReadable(h))
-        } else {
-            let BlockSize::Bytes(d) = self.options.block_size;
-            (size as f64 / d as f64).ceil().to_string()
+    /// Get a string giving the scaled version of the input number.
+    ///
+    /// The scaling factor is defined in the `options` field.
+    fn scaled_bytes(&self, size: u64) -> String {
+        if let Some(h) = self.options.human_readable {
+            to_magnitude_and_suffix(size.into(), SuffixType::HumanReadable(h))
+        } else {
+            let BlockSize::Bytes(d) = self.options.block_size;
+            (size as f64 / d as f64).ceil().to_string()
         }
     }
 
-    /// Get a string giving the scaled version of the input number.
-    ///
-    /// The scaling factor is defined in the `options` field.
-    fn scaled_inodes(&self, size: u64) -> String {
-        if let Some(h) = self.options.human_readable {
-            to_magnitude_and_suffix(size.into(), SuffixType::HumanReadable(h))
-        } else {
-            size.to_string()
+    /// Get a string giving the scaled version of the input number.
+    ///
+    /// The scaling factor is defined in the `options` field.
+    fn scaled_inodes(&self, size: u64) -> String {
+        if let Some(h) = self.options.human_readable {
+            to_magnitude_and_suffix(size.into(), SuffixType::HumanReadable(h))
+        } else {
+            size.to_string()
         }
     }
 
-    /// Convert a float between 0 and 1 into a percentage string.
-    ///
-    /// If `None`, return the string `"-"` instead.
-    fn percentage(fraction: Option<f64>) -> String {
-        match fraction {
-            None => "-".to_string(),
-            Some(x) => format!("{:.0}%", (100.0 * x).ceil()),
+    /// Convert a float between 0 and 1 into a percentage string.
+    ///
+    /// If `None`, return the string `"-"` instead.
+    fn percentage(fraction: Option<f64>) -> String {
+        match fraction {
+            None => "-".to_string(),
+            Some(x) => format!("{:.0}%", (100.0 * x).ceil()),
         }
     }
 
-    /// Returns formatted row data.
-    fn get_values(&self) -> Vec<String> {
-        let mut strings = Vec::new();
+    /// Returns formatted row data.
+    fn get_values(&self) -> Vec<String> {
+        let mut strings = Vec::new();
 
-        for column in &self.options.columns {
-            let string = match column {
-                Column::Source => {
-                    if self.is_total_row {
-                        "total".to_string()
-                    } else {
-                        self.row.fs_device.to_string()
+        for column in &self.options.columns {
+            let string = match column {
+                Column::Source => {
+                    if self.is_total_row {
+                        "total".to_string()
+                    } else {
+                        self.row.fs_device.to_string()
                     }
                 }
-                Column::Size => self.scaled_bytes(self.row.bytes),
-                Column::Used => self.scaled_bytes(self.row.bytes_used),
-                Column::Avail => self.scaled_bytes(self.row.bytes_avail),
-                Column::Pcent => Self::percentage(self.row.bytes_usage),
+                Column::Size => self.scaled_bytes(self.row.bytes),
+                Column::Used => self.scaled_bytes(self.row.bytes_used),
+                Column::Avail => self.scaled_bytes(self.row.bytes_avail),
+                Column::Pcent => Self::percentage(self.row.bytes_usage),
 
-                Column::Target => {
-                    if self.is_total_row && !self.options.columns.contains(&Column::Source) {
-                        "total".to_string()
-                    } else {
-                        self.row.fs_mount.to_string()
+                Column::Target => {
+                    if self.is_total_row && !self.options.columns.contains(&Column::Source) {
+                        "total".to_string()
+                    } else {
+                        self.row.fs_mount.to_string()
                     }
                 }
-                Column::Itotal => self.scaled_inodes(self.row.inodes),
-                Column::Iused => self.scaled_inodes(self.row.inodes_used),
-                Column::Iavail => self.scaled_inodes(self.row.inodes_free),
-                Column::Ipcent => Self::percentage(self.row.inodes_usage),
-                Column::File => self.row.file.as_ref().unwrap_or(&"-".into()).to_string(),
+                Column::Itotal => self.scaled_inodes(self.row.inodes),
+                Column::Iused => self.scaled_inodes(self.row.inodes_used),
+                Column::Iavail => self.scaled_inodes(self.row.inodes_free),
+                Column::Ipcent => Self::percentage(self.row.inodes_usage),
+                Column::File => self.row.file.as_ref().unwrap_or(&"-".into()).to_string(),
 
-                Column::Fstype => self.row.fs_type.to_string(),
-                #[cfg(target_os = "macos")]
-                Column::Capacity => Self::percentage(self.row.bytes_capacity),
+                Column::Fstype => self.row.fs_type.to_string(),
+                #[cfg(target_os = "macos")]
+                Column::Capacity => Self::percentage(self.row.bytes_capacity),
             };
 
-            strings.push(string);
+            strings.push(string);
         }
 
-        strings
+        strings
     }
 }
 
-/// A HeaderMode defines what header labels should be shown.
-pub(crate) enum HeaderMode {
-    Default,
-    // the user used -h or -H
-    HumanReadable,
-    // the user used -P
-    PosixPortability,
-    // the user used --output
-    Output,
+/// A HeaderMode defines what header labels should be shown.
+pub(crate) enum HeaderMode {
+    Default,
+    // the user used -h or -H
+    HumanReadable,
+    // the user used -P
+    PosixPortability,
+    // the user used --output
+    Output,
 }
 
-impl Default for HeaderMode {
-    fn default() -> Self {
-        Self::Default
+impl Default for HeaderMode {
+    fn default() -> Self {
+        Self::Default
     }
 }
 
-/// The data of the header row.
-struct Header {}
+/// The data of the header row.
+struct Header {}
 
-impl Header {
-    /// Return the headers for the specified columns.
-    ///
-    /// The `options` control which column headers are returned.
-    fn get_headers(options: &Options) -> Vec<String> {
-        let mut headers = Vec::new();
+impl Header {
+    /// Return the headers for the specified columns.
+    ///
+    /// The `options` control which column headers are returned.
+    fn get_headers(options: &Options) -> Vec<String> {
+        let mut headers = Vec::new();
 
-        for column in &options.columns {
-            let header = match column {
-                Column::Source => String::from("Filesystem"),
-                Column::Size => match options.header_mode {
-                    HeaderMode::HumanReadable => String::from("Size"),
-                    HeaderMode::PosixPortability => {
-                        format!("{}-blocks", options.block_size.as_u64())
+        for column in &options.columns {
+            let header = match column {
+                Column::Source => String::from("Filesystem"),
+                Column::Size => match options.header_mode {
+                    HeaderMode::HumanReadable => String::from("Size"),
+                    HeaderMode::PosixPortability => {
+                        format!("{}-blocks", options.block_size.as_u64())
                     }
-                    _ => format!("{}-blocks", options.block_size),
+                    _ => format!("{}-blocks", options.block_size),
                 },
-                Column::Used => String::from("Used"),
-                Column::Avail => match options.header_mode {
-                    HeaderMode::HumanReadable | HeaderMode::Output => String::from("Avail"),
-                    _ => String::from("Available"),
+                Column::Used => String::from("Used"),
+                Column::Avail => match options.header_mode {
+                    HeaderMode::HumanReadable | HeaderMode::Output => String::from("Avail"),
+                    _ => String::from("Available"),
                 },
-                Column::Pcent => match options.header_mode {
-                    HeaderMode::PosixPortability => String::from("Capacity"),
-                    _ => String::from("Use%"),
+                Column::Pcent => match options.header_mode {
+                    HeaderMode::PosixPortability => String::from("Capacity"),
+                    _ => String::from("Use%"),
                 },
-                Column::Target => String::from("Mounted on"),
-                Column::Itotal => String::from("Inodes"),
-                Column::Iused => String::from("IUsed"),
-                Column::Iavail => String::from("IFree"),
-                Column::Ipcent => String::from("IUse%"),
-                Column::File => String::from("File"),
-                Column::Fstype => String::from("Type"),
-                #[cfg(target_os = "macos")]
-                Column::Capacity => String::from("Capacity"),
+                Column::Target => String::from("Mounted on"),
+                Column::Itotal => String::from("Inodes"),
+                Column::Iused => String::from("IUsed"),
+                Column::Iavail => String::from("IFree"),
+                Column::Ipcent => String::from("IUse%"),
+                Column::File => String::from("File"),
+                Column::Fstype => String::from("Type"),
+                #[cfg(target_os = "macos")]
+                Column::Capacity => String::from("Capacity"),
             };
 
-            headers.push(header);
+            headers.push(header);
         }
 
-        headers
+        headers
     }
 }
 
-/// The output table.
-pub(crate) struct Table {
-    alignments: Vec<Alignment>,
-    rows: Vec<Vec<String>>,
-    widths: Vec<usize>,
+/// The output table.
+pub(crate) struct Table {
+    alignments: Vec<Alignment>,
+    rows: Vec<Vec<String>>,
+    widths: Vec<usize>,
 }
 
-impl Table {
-    pub(crate) fn new(options: &Options, filesystems: Vec<Filesystem>) -> Self {
-        let headers = Header::get_headers(options);
-        let mut widths: Vec<_> = options
-            .columns
-            .iter()
-            .enumerate()
-            .map(|(i, col)| Column::min_width(col).max(headers[i].len()))
-            .collect();
+impl Table {
+    pub(crate) fn new(options: &Options, filesystems: Vec<Filesystem>) -> Self {
+        let headers = Header::get_headers(options);
+        let mut widths: Vec<_> = options
+            .columns
+            .iter()
+            .enumerate()
+            .map(|(i, col)| Column::min_width(col).max(headers[i].len()))
+            .collect();
 
-        let mut rows = vec![headers];
+        let mut rows = vec![headers];
 
-        // The running total of filesystem sizes and usage.
-        //
-        // This accumulator is computed in case we need to display the
-        // total counts in the last row of the table.
-        let mut total = Row::new("total");
+        // The running total of filesystem sizes and usage.
+        //
+        // This accumulator is computed in case we need to display the
+        // total counts in the last row of the table.
+        let mut total = Row::new("total");
 
-        for filesystem in filesystems {
-            // If the filesystem is not empty, or if the options require
-            // showing all filesystems, then print the data as a row in
-            // the output table.
-            if options.show_all_fs || filesystem.usage.blocks > 0 {
-                let row = Row::from(filesystem);
-                let fmt = RowFormatter::new(&row, options, false);
-                let values = fmt.get_values();
-                total += row;
+        for filesystem in filesystems {
+            // If the filesystem is not empty, or if the options require
+            // showing all filesystems, then print the data as a row in
+            // the output table.
+            if options.show_all_fs || filesystem.usage.blocks > 0 {
+                let row = Row::from(filesystem);
+                let fmt = RowFormatter::new(&row, options, false);
+                let values = fmt.get_values();
+                total += row;
 
-                for (i, value) in values.iter().enumerate() {
-                    if UnicodeWidthStr::width(value.as_str()) > widths[i] {
-                        widths[i] = UnicodeWidthStr::width(value.as_str());
+                for (i, value) in values.iter().enumerate() {
+                    if UnicodeWidthStr::width(value.as_str()) > widths[i] {
+                        widths[i] = UnicodeWidthStr::width(value.as_str());
                     }
                 }
 
-                rows.push(values);
+                rows.push(values);
             }
         }
 
-        if options.show_total {
-            let total_row = RowFormatter::new(&total, options, true);
-            rows.push(total_row.get_values());
+        if options.show_total {
+            let total_row = RowFormatter::new(&total, options, true);
+            rows.push(total_row.get_values());
         }
 
-        Self {
-            rows,
-            widths,
-            alignments: Self::get_alignments(&options.columns),
+        Self {
+            rows,
+            widths,
+            alignments: Self::get_alignments(&options.columns),
         }
     }
 
-    fn get_alignments(columns: &Vec<Column>) -> Vec<Alignment> {
-        let mut alignments = Vec::new();
+    fn get_alignments(columns: &Vec<Column>) -> Vec<Alignment> {
+        let mut alignments = Vec::new();
 
-        for column in columns {
-            alignments.push(Column::alignment(column));
+        for column in columns {
+            alignments.push(Column::alignment(column));
         }
 
-        alignments
+        alignments
     }
 }
 
-impl fmt::Display for Table {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        let mut row_iter = self.rows.iter().peekable();
-        while let Some(row) = row_iter.next() {
-            let mut col_iter = row.iter().enumerate().peekable();
-            while let Some((i, elem)) = col_iter.next() {
-                let is_last_col = col_iter.peek().is_none();
+impl fmt::Display for Table {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let mut row_iter = self.rows.iter().peekable();
+        while let Some(row) = row_iter.next() {
+            let mut col_iter = row.iter().enumerate().peekable();
+            while let Some((i, elem)) = col_iter.next() {
+                let is_last_col = col_iter.peek().is_none();
 
-                match self.alignments[i] {
-                    Alignment::Left => {
-                        if is_last_col {
-                            // no trailing spaces in last column
-                            write!(f, "{}", elem)?;
-                        } else {
-                            write!(f, "{:<width$}", elem, width = self.widths[i])?;
+                match self.alignments[i] {
+                    Alignment::Left => {
+                        if is_last_col {
+                            // no trailing spaces in last column
+                            write!(f, "{}", elem)?;
+                        } else {
+                            write!(f, "{:<width$}", elem, width = self.widths[i])?;
                         }
                     }
-                    Alignment::Right => write!(f, "{:>width$}", elem, width = self.widths[i])?,
+                    Alignment::Right => write!(f, "{:>width$}", elem, width = self.widths[i])?,
                 }
 
-                if !is_last_col {
-                    // column separator
-                    write!(f, " ")?;
+                if !is_last_col {
+                    // column separator
+                    write!(f, " ")?;
                 }
             }
 
-            if row_iter.peek().is_some() {
-                writeln!(f)?;
+            if row_iter.peek().is_some() {
+                writeln!(f)?;
             }
         }
 
@@ -1279,80 +1279,80 @@
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use crate::blocks::HumanReadable;
-    use crate::columns::Column;
-    use crate::table::{Header, HeaderMode, Row, RowFormatter};
-    use crate::{BlockSize, Options};
+    use crate::blocks::HumanReadable;
+    use crate::columns::Column;
+    use crate::table::{Header, HeaderMode, Row, RowFormatter};
+    use crate::{BlockSize, Options};
 
-    const COLUMNS_WITH_FS_TYPE: [Column; 7] = [
-        Column::Source,
-        Column::Fstype,
-        Column::Size,
-        Column::Used,
-        Column::Avail,
-        Column::Pcent,
-        Column::Target,
+    const COLUMNS_WITH_FS_TYPE: [Column; 7] = [
+        Column::Source,
+        Column::Fstype,
+        Column::Size,
+        Column::Used,
+        Column::Avail,
+        Column::Pcent,
+        Column::Target,
     ];
-    const COLUMNS_WITH_INODES: [Column; 6] = [
-        Column::Source,
-        Column::Itotal,
-        Column::Iused,
-        Column::Iavail,
-        Column::Ipcent,
-        Column::Target,
+    const COLUMNS_WITH_INODES: [Column; 6] = [
+        Column::Source,
+        Column::Itotal,
+        Column::Iused,
+        Column::Iavail,
+        Column::Ipcent,
+        Column::Target,
     ];
 
-    impl Default for Row {
-        fn default() -> Self {
-            Self {
-                file: Some("/path/to/file".to_string()),
-                fs_device: "my_device".to_string(),
-                fs_type: "my_type".to_string(),
-                fs_mount: "my_mount".to_string(),
+    impl Default for Row {
+        fn default() -> Self {
+            Self {
+                file: Some("/path/to/file".to_string()),
+                fs_device: "my_device".to_string(),
+                fs_type: "my_type".to_string(),
+                fs_mount: "my_mount".to_string(),
 
-                bytes: 100,
-                bytes_used: 25,
-                bytes_avail: 75,
-                bytes_usage: Some(0.25),
+                bytes: 100,
+                bytes_used: 25,
+                bytes_avail: 75,
+                bytes_usage: Some(0.25),
 
-                #[cfg(target_os = "macos")]
-                bytes_capacity: Some(0.5),
+                #[cfg(target_os = "macos")]
+                bytes_capacity: Some(0.5),
 
-                inodes: 10,
-                inodes_used: 2,
-                inodes_free: 8,
-                inodes_usage: Some(0.2),
+                inodes: 10,
+                inodes_used: 2,
+                inodes_free: 8,
+                inodes_usage: Some(0.2),
             }
         }
     }
 
-    #[test]
-    fn test_default_header() {
-        let options = Default::default();
+    #[test]
+    fn test_default_header() {
+        let options = Default::default();
         assert_eq!(
-            Header::get_headers(&options),
+            Header::get_headers(&options),
             vec!(
                 "Filesystem",
                 "1K-blocks",
                 "Used",
                 "Available",
                 "Use%",
-                "Mounted on"
-            )
+                "Mounted on"
+            )
         );
     }
 
-    #[test]
-    fn test_header_with_fs_type() {
-        let options = Options {
-            columns: COLUMNS_WITH_FS_TYPE.to_vec(),
-            ..Default::default()
+    #[test]
+    fn test_header_with_fs_type() {
+        let options = Options {
+            columns: COLUMNS_WITH_FS_TYPE.to_vec(),
+            ..Default::default()
         };
         assert_eq!(
-            Header::get_headers(&options),
+            Header::get_headers(&options),
             vec!(
                 "Filesystem",
                 "Type",
@@ -1360,279 +1360,279 @@
                 "Used",
                 "Available",
                 "Use%",
-                "Mounted on"
-            )
+                "Mounted on"
+            )
         );
     }
 
-    #[test]
-    fn test_header_with_inodes() {
-        let options = Options {
-            columns: COLUMNS_WITH_INODES.to_vec(),
-            ..Default::default()
+    #[test]
+    fn test_header_with_inodes() {
+        let options = Options {
+            columns: COLUMNS_WITH_INODES.to_vec(),
+            ..Default::default()
         };
         assert_eq!(
-            Header::get_headers(&options),
+            Header::get_headers(&options),
             vec!(
                 "Filesystem",
                 "Inodes",
                 "IUsed",
                 "IFree",
                 "IUse%",
-                "Mounted on"
-            )
+                "Mounted on"
+            )
         );
     }
 
-    #[test]
-    fn test_header_with_block_size_1024() {
-        let options = Options {
-            block_size: BlockSize::Bytes(3 * 1024),
-            ..Default::default()
+    #[test]
+    fn test_header_with_block_size_1024() {
+        let options = Options {
+            block_size: BlockSize::Bytes(3 * 1024),
+            ..Default::default()
         };
         assert_eq!(
-            Header::get_headers(&options),
+            Header::get_headers(&options),
             vec!(
                 "Filesystem",
                 "3K-blocks",
                 "Used",
                 "Available",
                 "Use%",
-                "Mounted on"
-            )
+                "Mounted on"
+            )
         );
     }
 
-    #[test]
-    fn test_human_readable_header() {
-        let options = Options {
-            header_mode: HeaderMode::HumanReadable,
-            ..Default::default()
+    #[test]
+    fn test_human_readable_header() {
+        let options = Options {
+            header_mode: HeaderMode::HumanReadable,
+            ..Default::default()
         };
         assert_eq!(
-            Header::get_headers(&options),
+            Header::get_headers(&options),
             vec!("Filesystem", "Size", "Used", "Avail", "Use%", "Mounted on")
         );
     }
 
-    #[test]
-    fn test_posix_portability_header() {
-        let options = Options {
-            header_mode: HeaderMode::PosixPortability,
-            ..Default::default()
+    #[test]
+    fn test_posix_portability_header() {
+        let options = Options {
+            header_mode: HeaderMode::PosixPortability,
+            ..Default::default()
         };
         assert_eq!(
-            Header::get_headers(&options),
+            Header::get_headers(&options),
             vec!(
                 "Filesystem",
                 "1024-blocks",
                 "Used",
                 "Available",
                 "Capacity",
-                "Mounted on"
-            )
+                "Mounted on"
+            )
         );
     }
 
-    #[test]
-    fn test_output_header() {
-        let options = Options {
-            header_mode: HeaderMode::Output,
-            ..Default::default()
+    #[test]
+    fn test_output_header() {
+        let options = Options {
+            header_mode: HeaderMode::Output,
+            ..Default::default()
         };
         assert_eq!(
-            Header::get_headers(&options),
+            Header::get_headers(&options),
             vec!(
                 "Filesystem",
                 "1K-blocks",
                 "Used",
                 "Avail",
                 "Use%",
-                "Mounted on"
-            )
+                "Mounted on"
+            )
         );
     }
 
-    #[test]
-    fn test_row_formatter() {
-        let options = Options {
-            block_size: BlockSize::Bytes(1),
-            ..Default::default()
+    #[test]
+    fn test_row_formatter() {
+        let options = Options {
+            block_size: BlockSize::Bytes(1),
+            ..Default::default()
         };
-        let row = Row {
-            fs_device: "my_device".to_string(),
-            fs_mount: "my_mount".to_string(),
+        let row = Row {
+            fs_device: "my_device".to_string(),
+            fs_mount: "my_mount".to_string(),
 
-            bytes: 100,
-            bytes_used: 25,
-            bytes_avail: 75,
-            bytes_usage: Some(0.25),
+            bytes: 100,
+            bytes_used: 25,
+            bytes_avail: 75,
+            bytes_usage: Some(0.25),
 
-            ..Default::default()
+            ..Default::default()
         };
-        let fmt = RowFormatter::new(&row, &options, false);
+        let fmt = RowFormatter::new(&row, &options, false);
         assert_eq!(
-            fmt.get_values(),
+            fmt.get_values(),
             vec!("my_device", "100", "25", "75", "25%", "my_mount")
         );
     }
 
-    #[test]
-    fn test_row_formatter_with_fs_type() {
-        let options = Options {
-            columns: COLUMNS_WITH_FS_TYPE.to_vec(),
-            block_size: BlockSize::Bytes(1),
-            ..Default::default()
+    #[test]
+    fn test_row_formatter_with_fs_type() {
+        let options = Options {
+            columns: COLUMNS_WITH_FS_TYPE.to_vec(),
+            block_size: BlockSize::Bytes(1),
+            ..Default::default()
         };
-        let row = Row {
-            fs_device: "my_device".to_string(),
-            fs_type: "my_type".to_string(),
-            fs_mount: "my_mount".to_string(),
+        let row = Row {
+            fs_device: "my_device".to_string(),
+            fs_type: "my_type".to_string(),
+            fs_mount: "my_mount".to_string(),
 
-            bytes: 100,
-            bytes_used: 25,
-            bytes_avail: 75,
-            bytes_usage: Some(0.25),
+            bytes: 100,
+            bytes_used: 25,
+            bytes_avail: 75,
+            bytes_usage: Some(0.25),
 
-            ..Default::default()
+            ..Default::default()
         };
-        let fmt = RowFormatter::new(&row, &options, false);
+        let fmt = RowFormatter::new(&row, &options, false);
         assert_eq!(
-            fmt.get_values(),
+            fmt.get_values(),
             vec!("my_device", "my_type", "100", "25", "75", "25%", "my_mount")
         );
     }
 
-    #[test]
-    fn test_row_formatter_with_inodes() {
-        let options = Options {
-            columns: COLUMNS_WITH_INODES.to_vec(),
-            block_size: BlockSize::Bytes(1),
-            ..Default::default()
+    #[test]
+    fn test_row_formatter_with_inodes() {
+        let options = Options {
+            columns: COLUMNS_WITH_INODES.to_vec(),
+            block_size: BlockSize::Bytes(1),
+            ..Default::default()
         };
-        let row = Row {
-            fs_device: "my_device".to_string(),
-            fs_mount: "my_mount".to_string(),
+        let row = Row {
+            fs_device: "my_device".to_string(),
+            fs_mount: "my_mount".to_string(),
 
-            inodes: 10,
-            inodes_used: 2,
-            inodes_free: 8,
-            inodes_usage: Some(0.2),
+            inodes: 10,
+            inodes_used: 2,
+            inodes_free: 8,
+            inodes_usage: Some(0.2),
 
-            ..Default::default()
+            ..Default::default()
         };
-        let fmt = RowFormatter::new(&row, &options, false);
+        let fmt = RowFormatter::new(&row, &options, false);
         assert_eq!(
-            fmt.get_values(),
+            fmt.get_values(),
             vec!("my_device", "10", "2", "8", "20%", "my_mount")
         );
     }
 
-    #[test]
-    fn test_row_formatter_with_bytes_and_inodes() {
-        let options = Options {
-            columns: vec![Column::Size, Column::Itotal],
-            block_size: BlockSize::Bytes(100),
-            ..Default::default()
+    #[test]
+    fn test_row_formatter_with_bytes_and_inodes() {
+        let options = Options {
+            columns: vec![Column::Size, Column::Itotal],
+            block_size: BlockSize::Bytes(100),
+            ..Default::default()
         };
-        let row = Row {
-            bytes: 100,
-            inodes: 10,
-            ..Default::default()
+        let row = Row {
+            bytes: 100,
+            inodes: 10,
+            ..Default::default()
         };
-        let fmt = RowFormatter::new(&row, &options, false);
-        assert_eq!(fmt.get_values(), vec!("1", "10"));
+        let fmt = RowFormatter::new(&row, &options, false);
+        assert_eq!(fmt.get_values(), vec!("1", "10"));
     }
 
-    #[test]
-    fn test_row_formatter_with_human_readable_si() {
-        let options = Options {
-            human_readable: Some(HumanReadable::Decimal),
-            columns: COLUMNS_WITH_FS_TYPE.to_vec(),
-            ..Default::default()
+    #[test]
+    fn test_row_formatter_with_human_readable_si() {
+        let options = Options {
+            human_readable: Some(HumanReadable::Decimal),
+            columns: COLUMNS_WITH_FS_TYPE.to_vec(),
+            ..Default::default()
         };
-        let row = Row {
-            fs_device: "my_device".to_string(),
-            fs_type: "my_type".to_string(),
-            fs_mount: "my_mount".to_string(),
+        let row = Row {
+            fs_device: "my_device".to_string(),
+            fs_type: "my_type".to_string(),
+            fs_mount: "my_mount".to_string(),
 
-            bytes: 4000,
-            bytes_used: 1000,
-            bytes_avail: 3000,
-            bytes_usage: Some(0.25),
+            bytes: 4000,
+            bytes_used: 1000,
+            bytes_avail: 3000,
+            bytes_usage: Some(0.25),
 
-            ..Default::default()
+            ..Default::default()
         };
-        let fmt = RowFormatter::new(&row, &options, false);
+        let fmt = RowFormatter::new(&row, &options, false);
         assert_eq!(
-            fmt.get_values(),
+            fmt.get_values(),
             vec!("my_device", "my_type", "4k", "1k", "3k", "25%", "my_mount")
         );
     }
 
-    #[test]
-    fn test_row_formatter_with_human_readable_binary() {
-        let options = Options {
-            human_readable: Some(HumanReadable::Binary),
-            columns: COLUMNS_WITH_FS_TYPE.to_vec(),
-            ..Default::default()
+    #[test]
+    fn test_row_formatter_with_human_readable_binary() {
+        let options = Options {
+            human_readable: Some(HumanReadable::Binary),
+            columns: COLUMNS_WITH_FS_TYPE.to_vec(),
+            ..Default::default()
         };
-        let row = Row {
-            fs_device: "my_device".to_string(),
-            fs_type: "my_type".to_string(),
-            fs_mount: "my_mount".to_string(),
+        let row = Row {
+            fs_device: "my_device".to_string(),
+            fs_type: "my_type".to_string(),
+            fs_mount: "my_mount".to_string(),
 
-            bytes: 4096,
-            bytes_used: 1024,
-            bytes_avail: 3072,
-            bytes_usage: Some(0.25),
+            bytes: 4096,
+            bytes_used: 1024,
+            bytes_avail: 3072,
+            bytes_usage: Some(0.25),
 
-            ..Default::default()
+            ..Default::default()
         };
-        let fmt = RowFormatter::new(&row, &options, false);
+        let fmt = RowFormatter::new(&row, &options, false);
         assert_eq!(
-            fmt.get_values(),
+            fmt.get_values(),
             vec!("my_device", "my_type", "4K", "1K", "3K", "25%", "my_mount")
         );
     }
 
-    #[test]
-    fn test_row_formatter_with_round_up_usage() {
-        let options = Options {
-            columns: vec![Column::Pcent],
-            ..Default::default()
+    #[test]
+    fn test_row_formatter_with_round_up_usage() {
+        let options = Options {
+            columns: vec![Column::Pcent],
+            ..Default::default()
         };
-        let row = Row {
-            bytes_usage: Some(0.251),
-            ..Default::default()
+        let row = Row {
+            bytes_usage: Some(0.251),
+            ..Default::default()
         };
-        let fmt = RowFormatter::new(&row, &options, false);
-        assert_eq!(fmt.get_values(), vec!("26%"));
+        let fmt = RowFormatter::new(&row, &options, false);
+        assert_eq!(fmt.get_values(), vec!("26%"));
     }
 
-    #[test]
-    fn test_row_formatter_with_round_up_byte_values() {
-        fn get_formatted_values(bytes: u64, bytes_used: u64, bytes_avail: u64) -> Vec<String> {
-            let options = Options {
-                block_size: BlockSize::Bytes(1000),
-                columns: vec![Column::Size, Column::Used, Column::Avail],
-                ..Default::default()
+    #[test]
+    fn test_row_formatter_with_round_up_byte_values() {
+        fn get_formatted_values(bytes: u64, bytes_used: u64, bytes_avail: u64) -> Vec<String> {
+            let options = Options {
+                block_size: BlockSize::Bytes(1000),
+                columns: vec![Column::Size, Column::Used, Column::Avail],
+                ..Default::default()
             };
 
-            let row = Row {
-                bytes,
-                bytes_used,
-                bytes_avail,
-                ..Default::default()
+            let row = Row {
+                bytes,
+                bytes_used,
+                bytes_avail,
+                ..Default::default()
             };
-            RowFormatter::new(&row, &options, false).get_values()
+            RowFormatter::new(&row, &options, false).get_values()
         }
 
-        assert_eq!(get_formatted_values(100, 100, 0), vec!("1", "1", "0"));
-        assert_eq!(get_formatted_values(100, 99, 1), vec!("1", "1", "1"));
-        assert_eq!(get_formatted_values(1000, 1000, 0), vec!("1", "1", "0"));
-        assert_eq!(get_formatted_values(1001, 1000, 1), vec!("2", "1", "1"));
+        assert_eq!(get_formatted_values(100, 100, 0), vec!("1", "1", "0"));
+        assert_eq!(get_formatted_values(100, 99, 1), vec!("1", "1", "1"));
+        assert_eq!(get_formatted_values(1000, 1000, 0), vec!("1", "1", "0"));
+        assert_eq!(get_formatted_values(1001, 1000, 1), vec!("2", "1", "1"));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dir/dir.rs.html b/dev/src/uu_dir/dir.rs.html index 5cf79dd10..6c4cc87b7 100644 --- a/dev/src/uu_dir/dir.rs.html +++ b/dev/src/uu_dir/dir.rs.html @@ -1,4 +1,4 @@ -dir.rs - source
1
+dir.rs - source
1
 2
 3
 4
@@ -69,76 +69,76 @@
 69
 70
 71
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) gmnsii <gmnsii@protonmail.com>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) gmnsii <gmnsii@protonmail.com>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-use clap::Command;
-use std::ffi::OsString;
-use std::path::Path;
-use uu_ls::{options, Config, Format};
-use uucore::error::UResult;
-use uucore::quoting_style::{Quotes, QuotingStyle};
+use clap::Command;
+use std::ffi::OsString;
+use std::path::Path;
+use uu_ls::{options, Config, Format};
+use uucore::error::UResult;
+use uucore::quoting_style::{Quotes, QuotingStyle};
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let command = uu_app();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let command = uu_app();
 
-    let matches = command.get_matches_from(args);
+    let matches = command.get_matches_from(args);
 
-    let mut default_quoting_style = false;
-    let mut default_format_style = false;
+    let mut default_quoting_style = false;
+    let mut default_format_style = false;
 
-    // We check if any options on formatting or quoting style have been given.
-    // If not, we will use dir default formatting and quoting style options
+    // We check if any options on formatting or quoting style have been given.
+    // If not, we will use dir default formatting and quoting style options
 
-    if !matches.contains_id(options::QUOTING_STYLE)
-        && !matches.get_flag(options::quoting::C)
-        && !matches.get_flag(options::quoting::ESCAPE)
-        && !matches.get_flag(options::quoting::LITERAL)
+    if !matches.contains_id(options::QUOTING_STYLE)
+        && !matches.get_flag(options::quoting::C)
+        && !matches.get_flag(options::quoting::ESCAPE)
+        && !matches.get_flag(options::quoting::LITERAL)
     {
-        default_quoting_style = true;
+        default_quoting_style = true;
     }
-    if !matches.contains_id(options::FORMAT)
-        && !matches.get_flag(options::format::ACROSS)
-        && !matches.get_flag(options::format::COLUMNS)
-        && !matches.get_flag(options::format::COMMAS)
-        && !matches.get_flag(options::format::LONG)
-        && !matches.get_flag(options::format::LONG_NO_GROUP)
-        && !matches.get_flag(options::format::LONG_NO_OWNER)
-        && !matches.get_flag(options::format::LONG_NUMERIC_UID_GID)
-        && !matches.get_flag(options::format::ONE_LINE)
+    if !matches.contains_id(options::FORMAT)
+        && !matches.get_flag(options::format::ACROSS)
+        && !matches.get_flag(options::format::COLUMNS)
+        && !matches.get_flag(options::format::COMMAS)
+        && !matches.get_flag(options::format::LONG)
+        && !matches.get_flag(options::format::LONG_NO_GROUP)
+        && !matches.get_flag(options::format::LONG_NO_OWNER)
+        && !matches.get_flag(options::format::LONG_NUMERIC_UID_GID)
+        && !matches.get_flag(options::format::ONE_LINE)
     {
-        default_format_style = true;
+        default_format_style = true;
     }
 
-    let mut config = Config::from(&matches)?;
+    let mut config = Config::from(&matches)?;
 
-    if default_quoting_style {
-        config.quoting_style = QuotingStyle::C {
-            quotes: Quotes::None,
+    if default_quoting_style {
+        config.quoting_style = QuotingStyle::C {
+            quotes: Quotes::None,
         };
     }
-    if default_format_style {
-        config.format = Format::Columns;
+    if default_format_style {
+        config.format = Format::Columns;
     }
 
-    let locs = matches
-        .get_many::<OsString>(options::PATHS)
-        .map(|v| v.map(Path::new).collect())
-        .unwrap_or_else(|| vec![Path::new(".")]);
+    let locs = matches
+        .get_many::<OsString>(options::PATHS)
+        .map(|v| v.map(Path::new).collect())
+        .unwrap_or_else(|| vec![Path::new(".")]);
 
-    uu_ls::list(locs, &config)
+    uu_ls::list(locs, &config)
 }
 
-// To avoid code duplication, we reuse ls uu_app function which has the same
-// arguments. However, coreutils won't compile if one of the utils is missing
-// an uu_app function, so we return the `ls` app.
-pub fn uu_app() -> Command {
-    uu_ls::uu_app()
+// To avoid code duplication, we reuse ls uu_app function which has the same
+// arguments. However, coreutils won't compile if one of the utils is missing
+// an uu_app function, so we return the `ls` app.
+pub fn uu_app() -> Command {
+    uu_ls::uu_app()
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dircolors/colors.rs.html b/dev/src/uu_dircolors/colors.rs.html index 6a25f125c..d3bfc2f2b 100644 --- a/dev/src/uu_dircolors/colors.rs.html +++ b/dev/src/uu_dircolors/colors.rs.html @@ -1,4 +1,4 @@ -colors.rs - source
1
+colors.rs - source
1
 2
 3
 4
@@ -219,9 +219,9 @@
 219
 220
 221
-
// spell-checker:ignore (ToDO) EIGHTBIT ETERM MULTIHARDLINK cpio dtterm jfbterm konsole kterm mlterm rmvb rxvt stat'able svgz tmux webm xspf COLORTERM tzst avif tzst mjpg mjpeg webp dpkg rpmnew rpmorig rpmsave
+
// spell-checker:ignore (ToDO) EIGHTBIT ETERM MULTIHARDLINK cpio dtterm jfbterm konsole kterm mlterm rmvb rxvt stat'able svgz tmux webm xspf COLORTERM tzst avif tzst mjpg mjpeg webp dpkg rpmnew rpmorig rpmsave
 
-pub const INTERNAL_DB: &str = r#"# Configuration file for dircolors, a utility to help you set the
+pub const INTERNAL_DB: &str = r#"# Configuration file for dircolors, a utility to help you set the
 # LS_COLORS environment variable used by GNU ls with the --color option.
 # Copyright (C) 1996-2022 Free Software Foundation, Inc.
 # Copying and distribution of this file, with or without modification,
@@ -441,4 +441,4 @@ EXEC 01;32
 # Subsequent TERM or COLORTERM entries, can be used to add / override
 # config specific to those matching environment variables."#;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dircolors/dircolors.rs.html b/dev/src/uu_dircolors/dircolors.rs.html index 1a0050221..d1c452ae0 100644 --- a/dev/src/uu_dircolors/dircolors.rs.html +++ b/dev/src/uu_dircolors/dircolors.rs.html @@ -1,4 +1,4 @@ -dircolors.rs - source
1
+dircolors.rs - source
1
 2
 3
 4
@@ -444,451 +444,451 @@
 444
 445
 446
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-// (c) Mitchell Mebane <mitchell.mebane@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+// (c) Mitchell Mebane <mitchell.mebane@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) clrtoeol dircolors eightbit endcode fnmatch leftcode multihardlink rightcode setenv sgid suid colorterm
+// spell-checker:ignore (ToDO) clrtoeol dircolors eightbit endcode fnmatch leftcode multihardlink rightcode setenv sgid suid colorterm
 
-use std::borrow::Borrow;
-use std::env;
-use std::fs::File;
-use std::io::{BufRead, BufReader};
+use std::borrow::Borrow;
+use std::env;
+use std::fs::File;
+use std::io::{BufRead, BufReader};
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use uucore::display::Quotable;
-use uucore::error::{UResult, USimpleError, UUsageError};
+use clap::{crate_version, Arg, ArgAction, Command};
+use uucore::display::Quotable;
+use uucore::error::{UResult, USimpleError, UUsageError};
 
-mod options {
-    pub const BOURNE_SHELL: &str = "bourne-shell";
-    pub const C_SHELL: &str = "c-shell";
-    pub const PRINT_DATABASE: &str = "print-database";
-    pub const PRINT_LS_COLORS: &str = "print-ls-colors";
-    pub const FILE: &str = "FILE";
+mod options {
+    pub const BOURNE_SHELL: &str = "bourne-shell";
+    pub const C_SHELL: &str = "c-shell";
+    pub const PRINT_DATABASE: &str = "print-database";
+    pub const PRINT_LS_COLORS: &str = "print-ls-colors";
+    pub const FILE: &str = "FILE";
 }
 
-static USAGE: &str = "{} [OPTION]... [FILE]";
-static ABOUT: &str = "Output commands to set the LS_COLORS environment variable.";
-static LONG_HELP: &str = "
+static USAGE: &str = "{} [OPTION]... [FILE]";
+static ABOUT: &str = "Output commands to set the LS_COLORS environment variable.";
+static LONG_HELP: &str = "
  If FILE is specified, read it to determine which colors to use for which
  file types and extensions.  Otherwise, a precompiled database is used.
  For details on the format of these files, run 'dircolors --print-database'
 ";
 
-mod colors;
-use self::colors::INTERNAL_DB;
+mod colors;
+use self::colors::INTERNAL_DB;
 
-#[derive(PartialEq, Eq, Debug)]
-pub enum OutputFmt {
-    Shell,
-    CShell,
-    Display,
-    Unknown,
+#[derive(PartialEq, Eq, Debug)]
+pub enum OutputFmt {
+    Shell,
+    CShell,
+    Display,
+    Unknown,
 }
 
-pub fn guess_syntax() -> OutputFmt {
-    use std::path::Path;
-    match env::var("SHELL") {
-        Ok(ref s) if !s.is_empty() => {
-            let shell_path: &Path = s.as_ref();
-            if let Some(name) = shell_path.file_name() {
-                if name == "csh" || name == "tcsh" {
-                    OutputFmt::CShell
-                } else {
-                    OutputFmt::Shell
+pub fn guess_syntax() -> OutputFmt {
+    use std::path::Path;
+    match env::var("SHELL") {
+        Ok(ref s) if !s.is_empty() => {
+            let shell_path: &Path = s.as_ref();
+            if let Some(name) = shell_path.file_name() {
+                if name == "csh" || name == "tcsh" {
+                    OutputFmt::CShell
+                } else {
+                    OutputFmt::Shell
                 }
-            } else {
-                OutputFmt::Shell
+            } else {
+                OutputFmt::Shell
             }
         }
-        _ => OutputFmt::Unknown,
+        _ => OutputFmt::Unknown,
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(&args)?;
+    let matches = uu_app().try_get_matches_from(&args)?;
 
-    let files = matches
-        .get_many::<String>(options::FILE)
-        .map_or(vec![], |file_values| file_values.collect());
+    let files = matches
+        .get_many::<String>(options::FILE)
+        .map_or(vec![], |file_values| file_values.collect());
 
-    // clap provides .conflicts_with / .conflicts_with_all, but we want to
-    // manually handle conflicts so we can match the output of GNU coreutils
-    if (matches.get_flag(options::C_SHELL) || matches.get_flag(options::BOURNE_SHELL))
-        && (matches.get_flag(options::PRINT_DATABASE) || matches.get_flag(options::PRINT_LS_COLORS))
+    // clap provides .conflicts_with / .conflicts_with_all, but we want to
+    // manually handle conflicts so we can match the output of GNU coreutils
+    if (matches.get_flag(options::C_SHELL) || matches.get_flag(options::BOURNE_SHELL))
+        && (matches.get_flag(options::PRINT_DATABASE) || matches.get_flag(options::PRINT_LS_COLORS))
     {
-        return Err(UUsageError::new(
+        return Err(UUsageError::new(
             1,
             "the options to output non shell syntax,\n\
              and to select a shell syntax are mutually exclusive",
         ));
     }
 
-    if matches.get_flag(options::PRINT_DATABASE) && matches.get_flag(options::PRINT_LS_COLORS) {
-        return Err(UUsageError::new(
+    if matches.get_flag(options::PRINT_DATABASE) && matches.get_flag(options::PRINT_LS_COLORS) {
+        return Err(UUsageError::new(
             1,
             "options --print-database and --print-ls-colors are mutually exclusive",
         ));
     }
 
-    if matches.get_flag(options::PRINT_DATABASE) {
-        if !files.is_empty() {
-            return Err(UUsageError::new(
+    if matches.get_flag(options::PRINT_DATABASE) {
+        if !files.is_empty() {
+            return Err(UUsageError::new(
                 1,
                 format!(
                     "extra operand {}\nfile operands cannot be combined with \
                      --print-database (-p)",
-                    files[0].quote()
+                    files[0].quote()
                 ),
             ));
         }
-        println!("{}", INTERNAL_DB);
-        return Ok(());
+        println!("{}", INTERNAL_DB);
+        return Ok(());
     }
 
-    let mut out_format = if matches.get_flag(options::C_SHELL) {
-        OutputFmt::CShell
-    } else if matches.get_flag(options::BOURNE_SHELL) {
-        OutputFmt::Shell
-    } else if matches.get_flag(options::PRINT_LS_COLORS) {
-        OutputFmt::Display
-    } else {
-        OutputFmt::Unknown
+    let mut out_format = if matches.get_flag(options::C_SHELL) {
+        OutputFmt::CShell
+    } else if matches.get_flag(options::BOURNE_SHELL) {
+        OutputFmt::Shell
+    } else if matches.get_flag(options::PRINT_LS_COLORS) {
+        OutputFmt::Display
+    } else {
+        OutputFmt::Unknown
     };
 
-    if out_format == OutputFmt::Unknown {
-        match guess_syntax() {
-            OutputFmt::Unknown => {
-                return Err(USimpleError::new(
+    if out_format == OutputFmt::Unknown {
+        match guess_syntax() {
+            OutputFmt::Unknown => {
+                return Err(USimpleError::new(
                     1,
                     "no SHELL environment variable, and no shell type option given",
                 ));
             }
-            fmt => out_format = fmt,
+            fmt => out_format = fmt,
         }
     }
 
-    let result;
-    if files.is_empty() {
-        result = parse(INTERNAL_DB.lines(), &out_format, "");
-    } else if files.len() > 1 {
-        return Err(UUsageError::new(
+    let result;
+    if files.is_empty() {
+        result = parse(INTERNAL_DB.lines(), &out_format, "");
+    } else if files.len() > 1 {
+        return Err(UUsageError::new(
             1,
-            format!("extra operand {}", files[1].quote()),
+            format!("extra operand {}", files[1].quote()),
         ));
-    } else if files[0].eq("-") {
-        let fin = BufReader::new(std::io::stdin());
-        result = parse(fin.lines().filter_map(Result::ok), &out_format, files[0]);
-    } else {
-        match File::open(files[0]) {
-            Ok(f) => {
-                let fin = BufReader::new(f);
-                result = parse(fin.lines().filter_map(Result::ok), &out_format, files[0]);
+    } else if files[0].eq("-") {
+        let fin = BufReader::new(std::io::stdin());
+        result = parse(fin.lines().filter_map(Result::ok), &out_format, files[0]);
+    } else {
+        match File::open(files[0]) {
+            Ok(f) => {
+                let fin = BufReader::new(f);
+                result = parse(fin.lines().filter_map(Result::ok), &out_format, files[0]);
             }
-            Err(e) => {
-                return Err(USimpleError::new(
+            Err(e) => {
+                return Err(USimpleError::new(
                     1,
-                    format!("{}: {}", files[0].maybe_quote(), e),
+                    format!("{}: {}", files[0].maybe_quote(), e),
                 ));
             }
         }
     }
 
-    match result {
-        Ok(s) => {
-            println!("{}", s);
+    match result {
+        Ok(s) => {
+            println!("{}", s);
             Ok(())
         }
-        Err(s) => {
-            return Err(USimpleError::new(1, s));
+        Err(s) => {
+            return Err(USimpleError::new(1, s));
         }
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(LONG_HELP)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::BOURNE_SHELL)
-                .long("sh")
-                .short('b')
-                .visible_alias("bourne-shell")
-                .overrides_with(options::C_SHELL)
-                .help("output Bourne shell code to set LS_COLORS")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(LONG_HELP)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::BOURNE_SHELL)
+                .long("sh")
+                .short('b')
+                .visible_alias("bourne-shell")
+                .overrides_with(options::C_SHELL)
+                .help("output Bourne shell code to set LS_COLORS")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::C_SHELL)
-                .long("csh")
-                .short('c')
-                .visible_alias("c-shell")
-                .overrides_with(options::BOURNE_SHELL)
-                .help("output C shell code to set LS_COLORS")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::C_SHELL)
+                .long("csh")
+                .short('c')
+                .visible_alias("c-shell")
+                .overrides_with(options::BOURNE_SHELL)
+                .help("output C shell code to set LS_COLORS")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PRINT_DATABASE)
-                .long("print-database")
-                .short('p')
-                .help("print the byte counts")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PRINT_DATABASE)
+                .long("print-database")
+                .short('p')
+                .help("print the byte counts")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PRINT_LS_COLORS)
-                .long("print-ls-colors")
-                .help("output fully escaped colors for display")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PRINT_LS_COLORS)
+                .long("print-ls-colors")
+                .help("output fully escaped colors for display")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .value_hint(clap::ValueHint::FilePath)
-                .action(ArgAction::Append),
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .value_hint(clap::ValueHint::FilePath)
+                .action(ArgAction::Append),
         )
 }
 
-pub trait StrUtils {
-    /// Remove comments and trim whitespace
-    fn purify(&self) -> &Self;
-    /// Like split_whitespace() but only produce 2 components
-    fn split_two(&self) -> (&str, &str);
-    fn fnmatch(&self, pattern: &str) -> bool;
+pub trait StrUtils {
+    /// Remove comments and trim whitespace
+    fn purify(&self) -> &Self;
+    /// Like split_whitespace() but only produce 2 components
+    fn split_two(&self) -> (&str, &str);
+    fn fnmatch(&self, pattern: &str) -> bool;
 }
 
-impl StrUtils for str {
-    fn purify(&self) -> &Self {
-        let mut line = self;
-        for (n, _) in self
-            .as_bytes()
-            .iter()
-            .enumerate()
-            .filter(|(_, c)| **c == b'#')
+impl StrUtils for str {
+    fn purify(&self) -> &Self {
+        let mut line = self;
+        for (n, _) in self
+            .as_bytes()
+            .iter()
+            .enumerate()
+            .filter(|(_, c)| **c == b'#')
         {
-            // Ignore the content after '#'
-            // only if it is preceded by at least one whitespace
-            match self[..n].chars().last() {
-                Some(c) if c.is_whitespace() => {
-                    line = &self[..n - c.len_utf8()];
+            // Ignore the content after '#'
+            // only if it is preceded by at least one whitespace
+            match self[..n].chars().last() {
+                Some(c) if c.is_whitespace() => {
+                    line = &self[..n - c.len_utf8()];
                     break;
                 }
-                None => {
-                    // n == 0
-                    line = &self[..0];
+                None => {
+                    // n == 0
+                    line = &self[..0];
                     break;
                 }
-                _ => (),
+                _ => (),
             }
         }
-        line.trim()
+        line.trim()
     }
 
-    fn split_two(&self) -> (&str, &str) {
-        if let Some(b) = self.find(char::is_whitespace) {
-            let key = &self[..b];
-            if let Some(e) = self[b..].find(|c: char| !c.is_whitespace()) {
-                (key, &self[b + e..])
-            } else {
-                (key, "")
+    fn split_two(&self) -> (&str, &str) {
+        if let Some(b) = self.find(char::is_whitespace) {
+            let key = &self[..b];
+            if let Some(e) = self[b..].find(|c: char| !c.is_whitespace()) {
+                (key, &self[b + e..])
+            } else {
+                (key, "")
             }
-        } else {
+        } else {
             ("", "")
         }
     }
 
-    fn fnmatch(&self, pat: &str) -> bool {
-        parse_glob::from_str(pat).unwrap().matches(self)
+    fn fnmatch(&self, pat: &str) -> bool {
+        parse_glob::from_str(pat).unwrap().matches(self)
     }
 }
 
-#[derive(PartialEq)]
-enum ParseState {
-    Global,
-    Matched,
-    Continue,
-    Pass,
+#[derive(PartialEq)]
+enum ParseState {
+    Global,
+    Matched,
+    Continue,
+    Pass,
 }
 
-use std::collections::HashMap;
-use uucore::{format_usage, parse_glob};
+use std::collections::HashMap;
+use uucore::{format_usage, parse_glob};
 
-fn parse<T>(lines: T, fmt: &OutputFmt, fp: &str) -> Result<String, String>
-where
-    T: IntoIterator,
-    T::Item: Borrow<str>,
+fn parse<T>(lines: T, fmt: &OutputFmt, fp: &str) -> Result<String, String>
+where
+    T: IntoIterator,
+    T::Item: Borrow<str>,
 {
-    // 1790 > $(dircolors | wc -m)
-    let mut result = String::with_capacity(1790);
-    match fmt {
-        OutputFmt::Shell => result.push_str("LS_COLORS='"),
-        OutputFmt::CShell => result.push_str("setenv LS_COLORS '"),
-        OutputFmt::Display => (),
-        _ => unreachable!(),
+    // 1790 > $(dircolors | wc -m)
+    let mut result = String::with_capacity(1790);
+    match fmt {
+        OutputFmt::Shell => result.push_str("LS_COLORS='"),
+        OutputFmt::CShell => result.push_str("setenv LS_COLORS '"),
+        OutputFmt::Display => (),
+        _ => unreachable!(),
     }
 
-    let mut table: HashMap<&str, &str> = HashMap::with_capacity(48);
-    table.insert("normal", "no");
-    table.insert("norm", "no");
-    table.insert("file", "fi");
-    table.insert("reset", "rs");
-    table.insert("dir", "di");
-    table.insert("lnk", "ln");
-    table.insert("link", "ln");
-    table.insert("symlink", "ln");
-    table.insert("orphan", "or");
-    table.insert("missing", "mi");
-    table.insert("fifo", "pi");
-    table.insert("pipe", "pi");
-    table.insert("sock", "so");
-    table.insert("blk", "bd");
-    table.insert("block", "bd");
-    table.insert("chr", "cd");
-    table.insert("char", "cd");
-    table.insert("door", "do");
-    table.insert("exec", "ex");
-    table.insert("left", "lc");
-    table.insert("leftcode", "lc");
-    table.insert("right", "rc");
-    table.insert("rightcode", "rc");
-    table.insert("end", "ec");
-    table.insert("endcode", "ec");
-    table.insert("suid", "su");
-    table.insert("setuid", "su");
-    table.insert("sgid", "sg");
-    table.insert("setgid", "sg");
-    table.insert("sticky", "st");
-    table.insert("other_writable", "ow");
-    table.insert("owr", "ow");
-    table.insert("sticky_other_writable", "tw");
-    table.insert("owt", "tw");
-    table.insert("capability", "ca");
-    table.insert("multihardlink", "mh");
-    table.insert("clrtoeol", "cl");
+    let mut table: HashMap<&str, &str> = HashMap::with_capacity(48);
+    table.insert("normal", "no");
+    table.insert("norm", "no");
+    table.insert("file", "fi");
+    table.insert("reset", "rs");
+    table.insert("dir", "di");
+    table.insert("lnk", "ln");
+    table.insert("link", "ln");
+    table.insert("symlink", "ln");
+    table.insert("orphan", "or");
+    table.insert("missing", "mi");
+    table.insert("fifo", "pi");
+    table.insert("pipe", "pi");
+    table.insert("sock", "so");
+    table.insert("blk", "bd");
+    table.insert("block", "bd");
+    table.insert("chr", "cd");
+    table.insert("char", "cd");
+    table.insert("door", "do");
+    table.insert("exec", "ex");
+    table.insert("left", "lc");
+    table.insert("leftcode", "lc");
+    table.insert("right", "rc");
+    table.insert("rightcode", "rc");
+    table.insert("end", "ec");
+    table.insert("endcode", "ec");
+    table.insert("suid", "su");
+    table.insert("setuid", "su");
+    table.insert("sgid", "sg");
+    table.insert("setgid", "sg");
+    table.insert("sticky", "st");
+    table.insert("other_writable", "ow");
+    table.insert("owr", "ow");
+    table.insert("sticky_other_writable", "tw");
+    table.insert("owt", "tw");
+    table.insert("capability", "ca");
+    table.insert("multihardlink", "mh");
+    table.insert("clrtoeol", "cl");
 
-    let term = env::var("TERM").unwrap_or_else(|_| "none".to_owned());
-    let term = term.as_str();
+    let term = env::var("TERM").unwrap_or_else(|_| "none".to_owned());
+    let term = term.as_str();
 
-    let mut state = ParseState::Global;
+    let mut state = ParseState::Global;
 
-    for (num, line) in lines.into_iter().enumerate() {
-        let num = num + 1;
-        let line = line.borrow().purify();
-        if line.is_empty() {
+    for (num, line) in lines.into_iter().enumerate() {
+        let num = num + 1;
+        let line = line.borrow().purify();
+        if line.is_empty() {
             continue;
         }
 
-        let line = escape(line);
+        let line = escape(line);
 
-        let (key, val) = line.split_two();
-        if val.is_empty() {
-            return Err(format!(
+        let (key, val) = line.split_two();
+        if val.is_empty() {
+            return Err(format!(
                 "{}:{}: invalid line;  missing second token",
-                fp.maybe_quote(),
-                num
+                fp.maybe_quote(),
+                num
             ));
         }
-        let lower = key.to_lowercase();
+        let lower = key.to_lowercase();
 
-        if lower == "term" || lower == "colorterm" {
-            if term.fnmatch(val) {
-                state = ParseState::Matched;
-            } else if state != ParseState::Matched {
-                state = ParseState::Pass;
+        if lower == "term" || lower == "colorterm" {
+            if term.fnmatch(val) {
+                state = ParseState::Matched;
+            } else if state != ParseState::Matched {
+                state = ParseState::Pass;
             }
-        } else {
-            if state == ParseState::Matched {
-                // prevent subsequent mismatched TERM from
-                // cancelling the input
-                state = ParseState::Continue;
+        } else {
+            if state == ParseState::Matched {
+                // prevent subsequent mismatched TERM from
+                // cancelling the input
+                state = ParseState::Continue;
             }
-            if state != ParseState::Pass {
-                if key.starts_with('.') {
-                    if *fmt == OutputFmt::Display {
-                        result.push_str(format!("\x1b[{1}m*{0}\t{1}\x1b[0m\n", key, val).as_str());
-                    } else {
-                        result.push_str(format!("*{}={}:", key, val).as_str());
+            if state != ParseState::Pass {
+                if key.starts_with('.') {
+                    if *fmt == OutputFmt::Display {
+                        result.push_str(format!("\x1b[{1}m*{0}\t{1}\x1b[0m\n", key, val).as_str());
+                    } else {
+                        result.push_str(format!("*{}={}:", key, val).as_str());
                     }
-                } else if key.starts_with('*') {
-                    if *fmt == OutputFmt::Display {
-                        result.push_str(format!("\x1b[{1}m{0}\t{1}\x1b[0m\n", key, val).as_str());
-                    } else {
-                        result.push_str(format!("{}={}:", key, val).as_str());
+                } else if key.starts_with('*') {
+                    if *fmt == OutputFmt::Display {
+                        result.push_str(format!("\x1b[{1}m{0}\t{1}\x1b[0m\n", key, val).as_str());
+                    } else {
+                        result.push_str(format!("{}={}:", key, val).as_str());
                     }
-                } else if lower == "options" || lower == "color" || lower == "eightbit" {
-                    // Slackware only. Ignore
-                } else if let Some(s) = table.get(lower.as_str()) {
-                    if *fmt == OutputFmt::Display {
-                        result.push_str(format!("\x1b[{1}m{0}\t{1}\x1b[0m\n", s, val).as_str());
-                    } else {
-                        result.push_str(format!("{}={}:", s, val).as_str());
+                } else if lower == "options" || lower == "color" || lower == "eightbit" {
+                    // Slackware only. Ignore
+                } else if let Some(s) = table.get(lower.as_str()) {
+                    if *fmt == OutputFmt::Display {
+                        result.push_str(format!("\x1b[{1}m{0}\t{1}\x1b[0m\n", s, val).as_str());
+                    } else {
+                        result.push_str(format!("{}={}:", s, val).as_str());
                     }
-                } else {
-                    return Err(format!(
+                } else {
+                    return Err(format!(
                         "{}:{}: unrecognized keyword {}",
-                        fp.maybe_quote(),
-                        num,
-                        key
+                        fp.maybe_quote(),
+                        num,
+                        key
                     ));
                 }
             }
         }
     }
 
-    match fmt {
-        OutputFmt::Shell => result.push_str("';\nexport LS_COLORS"),
-        OutputFmt::CShell => result.push('\''),
-        OutputFmt::Display => {
-            // remove latest "\n"
-            result.pop();
+    match fmt {
+        OutputFmt::Shell => result.push_str("';\nexport LS_COLORS"),
+        OutputFmt::CShell => result.push('\''),
+        OutputFmt::Display => {
+            // remove latest "\n"
+            result.pop();
         }
-        _ => unreachable!(),
+        _ => unreachable!(),
     }
 
-    Ok(result)
+    Ok(result)
 }
 
-/// Escape single quotes because they are not allowed between single quotes in shell code, and code
-/// enclosed by single quotes is what is returned by `parse()`.
-///
-/// We also escape ":" to make the "quote" test pass in the GNU test suite:
-/// <https://github.com/coreutils/coreutils/blob/master/tests/misc/dircolors.pl>
-fn escape(s: &str) -> String {
-    let mut result = String::new();
-    let mut previous = ' ';
+/// Escape single quotes because they are not allowed between single quotes in shell code, and code
+/// enclosed by single quotes is what is returned by `parse()`.
+///
+/// We also escape ":" to make the "quote" test pass in the GNU test suite:
+/// <https://github.com/coreutils/coreutils/blob/master/tests/misc/dircolors.pl>
+fn escape(s: &str) -> String {
+    let mut result = String::new();
+    let mut previous = ' ';
 
-    for c in s.chars() {
-        match c {
-            '\'' => result.push_str("'\\''"),
-            ':' if previous != '\\' => result.push_str("\\:"),
-            _ => result.push_str(&c.to_string()),
+    for c in s.chars() {
+        match c {
+            '\'' => result.push_str("'\\''"),
+            ':' if previous != '\\' => result.push_str("\\:"),
+            _ => result.push_str(&c.to_string()),
         }
-        previous = c;
+        previous = c;
     }
 
-    result
+    result
 }
 
-#[cfg(test)]
-mod tests {
-    use super::escape;
+#[cfg(test)]
+mod tests {
+    use super::escape;
 
-    #[test]
-    fn test_escape() {
-        assert_eq!("", escape(""));
-        assert_eq!("'\\''", escape("'"));
-        assert_eq!("\\:", escape(":"));
-        assert_eq!("\\:", escape("\\:"));
+    #[test]
+    fn test_escape() {
+        assert_eq!("", escape(""));
+        assert_eq!("'\\''", escape("'"));
+        assert_eq!("\\:", escape(":"));
+        assert_eq!("\\:", escape("\\:"));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_dirname/dirname.rs.html b/dev/src/uu_dirname/dirname.rs.html index 7b6244be1..f737dac0f 100644 --- a/dev/src/uu_dirname/dirname.rs.html +++ b/dev/src/uu_dirname/dirname.rs.html @@ -1,4 +1,4 @@ -dirname.rs - source
1
+dirname.rs - source
1
 2
 3
 4
@@ -92,99 +92,99 @@
 92
 93
 94
-
// This file is part of the uutils coreutils package.
-//
-// (c) Derek Chiang <derekchiang93@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Derek Chiang <derekchiang93@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::path::Path;
-use uucore::display::print_verbatim;
-use uucore::error::{UResult, UUsageError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::path::Path;
+use uucore::display::print_verbatim;
+use uucore::error::{UResult, UUsageError};
+use uucore::format_usage;
 
-static ABOUT: &str = "strip last component from file name";
-const USAGE: &str = "{} [OPTION] NAME...";
+static ABOUT: &str = "strip last component from file name";
+const USAGE: &str = "{} [OPTION] NAME...";
 
-mod options {
-    pub const ZERO: &str = "zero";
-    pub const DIR: &str = "dir";
+mod options {
+    pub const ZERO: &str = "zero";
+    pub const DIR: &str = "dir";
 }
 
-fn get_long_usage() -> &'static str {
+fn get_long_usage() -> &'static str {
     "Output each NAME with its last non-slash component and trailing slashes \n\
-        removed; if NAME contains no /'s, output '.' (meaning the current directory)."
-}
+        removed; if NAME contains no /'s, output '.' (meaning the current directory)."
+}
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)?;
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)?;
 
-    let separator = if matches.get_flag(options::ZERO) {
-        "\0"
-    } else {
-        "\n"
-    };
+    let separator = if matches.get_flag(options::ZERO) {
+        "\0"
+    } else {
+        "\n"
+    };
 
-    let dirnames: Vec<String> = matches
-        .get_many::<String>(options::DIR)
-        .unwrap_or_default()
-        .map(|s| s.to_owned())
-        .collect();
+    let dirnames: Vec<String> = matches
+        .get_many::<String>(options::DIR)
+        .unwrap_or_default()
+        .map(|s| s.to_owned())
+        .collect();
 
-    if !dirnames.is_empty() {
-        for path in &dirnames {
-            let p = Path::new(path);
-            match p.parent() {
-                Some(d) => {
-                    if d.components().next().is_none() {
+    if !dirnames.is_empty() {
+        for path in &dirnames {
+            let p = Path::new(path);
+            match p.parent() {
+                Some(d) => {
+                    if d.components().next().is_none() {
                         print!(".");
-                    } else {
-                        print_verbatim(d).unwrap();
+                    } else {
+                        print_verbatim(d).unwrap();
                     }
                 }
-                None => {
-                    if p.is_absolute() || path == "/" {
+                None => {
+                    if p.is_absolute() || path == "/" {
                         print!("/");
-                    } else {
+                    } else {
                         print!(".");
                     }
                 }
             }
-            print!("{}", separator);
+            print!("{}", separator);
         }
-    } else {
-        return Err(UUsageError::new(1, "missing operand"));
+    } else {
+        return Err(UUsageError::new(1, "missing operand"));
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .about(ABOUT)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::ZERO)
-                .long(options::ZERO)
-                .short('z')
-                .help("separate output with NUL rather than newline")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .about(ABOUT)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::ZERO)
+                .long(options::ZERO)
+                .short('z')
+                .help("separate output with NUL rather than newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DIR)
-                .hide(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(options::DIR)
+                .hide(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_du/du.rs.html b/dev/src/uu_du/du.rs.html index 837f42730..c2fd1f0cb 100644 --- a/dev/src/uu_du/du.rs.html +++ b/dev/src/uu_du/du.rs.html @@ -1,4 +1,4 @@ -du.rs - source
1
+du.rs - source
1
 2
 3
 4
@@ -975,86 +975,86 @@
 975
 976
 977
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Derek Chiang <derekchiang93@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Derek Chiang <derekchiang93@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use chrono::prelude::DateTime;
-use chrono::Local;
-use clap::ArgAction;
-use clap::{crate_version, Arg, ArgMatches, Command};
-use glob::Pattern;
-use std::collections::HashSet;
-use std::env;
-use std::fs;
-use std::fs::File;
-#[cfg(not(windows))]
-use std::fs::Metadata;
-use std::io::BufRead;
-use std::io::BufReader;
-use std::io::Result;
-use std::iter;
-#[cfg(not(windows))]
-use std::os::unix::fs::MetadataExt;
-#[cfg(windows)]
-use std::os::windows::fs::MetadataExt;
-#[cfg(windows)]
-use std::os::windows::io::AsRawHandle;
-use std::path::Path;
-use std::path::PathBuf;
-use std::str::FromStr;
-use std::time::{Duration, UNIX_EPOCH};
-use std::{error::Error, fmt::Display};
-use uucore::display::{print_verbatim, Quotable};
-use uucore::error::FromIo;
-use uucore::error::{UError, UResult};
-use uucore::format_usage;
-use uucore::parse_glob;
-use uucore::parse_size::{parse_size, ParseSizeError};
-#[cfg(windows)]
-use windows_sys::Win32::Foundation::HANDLE;
-#[cfg(windows)]
-use windows_sys::Win32::Storage::FileSystem::{
-    FileIdInfo, FileStandardInfo, GetFileInformationByHandleEx, FILE_ID_128, FILE_ID_INFO,
-    FILE_STANDARD_INFO,
+use chrono::prelude::DateTime;
+use chrono::Local;
+use clap::ArgAction;
+use clap::{crate_version, Arg, ArgMatches, Command};
+use glob::Pattern;
+use std::collections::HashSet;
+use std::env;
+use std::fs;
+use std::fs::File;
+#[cfg(not(windows))]
+use std::fs::Metadata;
+use std::io::BufRead;
+use std::io::BufReader;
+use std::io::Result;
+use std::iter;
+#[cfg(not(windows))]
+use std::os::unix::fs::MetadataExt;
+#[cfg(windows)]
+use std::os::windows::fs::MetadataExt;
+#[cfg(windows)]
+use std::os::windows::io::AsRawHandle;
+use std::path::Path;
+use std::path::PathBuf;
+use std::str::FromStr;
+use std::time::{Duration, UNIX_EPOCH};
+use std::{error::Error, fmt::Display};
+use uucore::display::{print_verbatim, Quotable};
+use uucore::error::FromIo;
+use uucore::error::{UError, UResult};
+use uucore::format_usage;
+use uucore::parse_glob;
+use uucore::parse_size::{parse_size, ParseSizeError};
+#[cfg(windows)]
+use windows_sys::Win32::Foundation::HANDLE;
+#[cfg(windows)]
+use windows_sys::Win32::Storage::FileSystem::{
+    FileIdInfo, FileStandardInfo, GetFileInformationByHandleEx, FILE_ID_128, FILE_ID_INFO,
+    FILE_STANDARD_INFO,
 };
 
-mod options {
-    pub const HELP: &str = "help";
-    pub const NULL: &str = "0";
-    pub const ALL: &str = "all";
-    pub const APPARENT_SIZE: &str = "apparent-size";
-    pub const BLOCK_SIZE: &str = "block-size";
-    pub const BYTES: &str = "b";
-    pub const TOTAL: &str = "c";
-    pub const MAX_DEPTH: &str = "d";
-    pub const HUMAN_READABLE: &str = "h";
-    pub const BLOCK_SIZE_1K: &str = "k";
-    pub const COUNT_LINKS: &str = "l";
-    pub const BLOCK_SIZE_1M: &str = "m";
-    pub const SEPARATE_DIRS: &str = "S";
-    pub const SUMMARIZE: &str = "s";
-    pub const THRESHOLD: &str = "threshold";
-    pub const SI: &str = "si";
-    pub const TIME: &str = "time";
-    pub const TIME_STYLE: &str = "time-style";
-    pub const ONE_FILE_SYSTEM: &str = "one-file-system";
-    pub const DEREFERENCE: &str = "dereference";
-    pub const INODES: &str = "inodes";
-    pub const EXCLUDE: &str = "exclude";
-    pub const EXCLUDE_FROM: &str = "exclude-from";
-    pub const VERBOSE: &str = "verbose";
-    pub const FILE: &str = "FILE";
+mod options {
+    pub const HELP: &str = "help";
+    pub const NULL: &str = "0";
+    pub const ALL: &str = "all";
+    pub const APPARENT_SIZE: &str = "apparent-size";
+    pub const BLOCK_SIZE: &str = "block-size";
+    pub const BYTES: &str = "b";
+    pub const TOTAL: &str = "c";
+    pub const MAX_DEPTH: &str = "d";
+    pub const HUMAN_READABLE: &str = "h";
+    pub const BLOCK_SIZE_1K: &str = "k";
+    pub const COUNT_LINKS: &str = "l";
+    pub const BLOCK_SIZE_1M: &str = "m";
+    pub const SEPARATE_DIRS: &str = "S";
+    pub const SUMMARIZE: &str = "s";
+    pub const THRESHOLD: &str = "threshold";
+    pub const SI: &str = "si";
+    pub const TIME: &str = "time";
+    pub const TIME_STYLE: &str = "time-style";
+    pub const ONE_FILE_SYSTEM: &str = "one-file-system";
+    pub const DEREFERENCE: &str = "dereference";
+    pub const INODES: &str = "inodes";
+    pub const EXCLUDE: &str = "exclude";
+    pub const EXCLUDE_FROM: &str = "exclude-from";
+    pub const VERBOSE: &str = "verbose";
+    pub const FILE: &str = "FILE";
 }
 
-const ABOUT: &str = "estimate file space usage";
-const LONG_HELP: &str = "
+const ABOUT: &str = "estimate file space usage";
+const LONG_HELP: &str = "
 Display values are in units of the first available SIZE from --block-size,
 and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
 Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
@@ -1069,888 +1069,888 @@ are supported:
 * will match zero or more characters
 {a,b} will match a or b
 ";
-const USAGE: &str = "\
+const USAGE: &str = "\
     {} [OPTION]... [FILE]...
     {} [OPTION]... --files0-from=F";
 
-// TODO: Support Z & Y (currently limited by size of u64)
-const UNITS: [(char, u32); 6] = [('E', 6), ('P', 5), ('T', 4), ('G', 3), ('M', 2), ('K', 1)];
+// TODO: Support Z & Y (currently limited by size of u64)
+const UNITS: [(char, u32); 6] = [('E', 6), ('P', 5), ('T', 4), ('G', 3), ('M', 2), ('K', 1)];
 
-struct Options {
-    all: bool,
-    max_depth: Option<usize>,
-    total: bool,
-    separate_dirs: bool,
-    one_file_system: bool,
-    dereference: bool,
-    inodes: bool,
-    verbose: bool,
+struct Options {
+    all: bool,
+    max_depth: Option<usize>,
+    total: bool,
+    separate_dirs: bool,
+    one_file_system: bool,
+    dereference: bool,
+    inodes: bool,
+    verbose: bool,
 }
 
-#[derive(PartialEq, Eq, Hash, Clone, Copy)]
-struct FileInfo {
-    file_id: u128,
-    dev_id: u64,
+#[derive(PartialEq, Eq, Hash, Clone, Copy)]
+struct FileInfo {
+    file_id: u128,
+    dev_id: u64,
 }
 
-struct Stat {
-    path: PathBuf,
-    is_dir: bool,
-    size: u64,
-    blocks: u64,
-    inodes: u64,
-    inode: Option<FileInfo>,
-    created: Option<u64>,
-    accessed: u64,
-    modified: u64,
+struct Stat {
+    path: PathBuf,
+    is_dir: bool,
+    size: u64,
+    blocks: u64,
+    inodes: u64,
+    inode: Option<FileInfo>,
+    created: Option<u64>,
+    accessed: u64,
+    modified: u64,
 }
 
-impl Stat {
-    fn new(path: PathBuf, options: &Options) -> Result<Self> {
-        let metadata = if options.dereference {
-            fs::metadata(&path)?
-        } else {
-            fs::symlink_metadata(&path)?
+impl Stat {
+    fn new(path: PathBuf, options: &Options) -> Result<Self> {
+        let metadata = if options.dereference {
+            fs::metadata(&path)?
+        } else {
+            fs::symlink_metadata(&path)?
+        };
+
+        #[cfg(not(windows))]
+        let file_info = FileInfo {
+            file_id: metadata.ino() as u128,
+            dev_id: metadata.dev(),
         };
-
-        #[cfg(not(windows))]
-        let file_info = FileInfo {
-            file_id: metadata.ino() as u128,
-            dev_id: metadata.dev(),
-        };
-        #[cfg(not(windows))]
-        return Ok(Self {
-            path,
-            is_dir: metadata.is_dir(),
-            size: metadata.len(),
-            blocks: metadata.blocks() as u64,
-            inodes: 1,
-            inode: Some(file_info),
-            created: birth_u64(&metadata),
-            accessed: metadata.atime() as u64,
-            modified: metadata.mtime() as u64,
+        #[cfg(not(windows))]
+        return Ok(Self {
+            path,
+            is_dir: metadata.is_dir(),
+            size: metadata.len(),
+            blocks: metadata.blocks() as u64,
+            inodes: 1,
+            inode: Some(file_info),
+            created: birth_u64(&metadata),
+            accessed: metadata.atime() as u64,
+            modified: metadata.mtime() as u64,
         });
 
-        #[cfg(windows)]
-        let size_on_disk = get_size_on_disk(&path);
-        #[cfg(windows)]
-        let file_info = get_file_info(&path);
-        #[cfg(windows)]
-        Ok(Self {
-            path,
-            is_dir: metadata.is_dir(),
-            size: metadata.len(),
-            blocks: size_on_disk / 1024 * 2,
-            inode: file_info,
-            inodes: 1,
-            created: windows_creation_time_to_unix_time(metadata.creation_time()),
-            accessed: windows_time_to_unix_time(metadata.last_access_time()),
-            modified: windows_time_to_unix_time(metadata.last_write_time()),
+        #[cfg(windows)]
+        let size_on_disk = get_size_on_disk(&path);
+        #[cfg(windows)]
+        let file_info = get_file_info(&path);
+        #[cfg(windows)]
+        Ok(Self {
+            path,
+            is_dir: metadata.is_dir(),
+            size: metadata.len(),
+            blocks: size_on_disk / 1024 * 2,
+            inode: file_info,
+            inodes: 1,
+            created: windows_creation_time_to_unix_time(metadata.creation_time()),
+            accessed: windows_time_to_unix_time(metadata.last_access_time()),
+            modified: windows_time_to_unix_time(metadata.last_write_time()),
         })
     }
 }
 
-#[cfg(windows)]
-// https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.last_access_time
-// "The returned 64-bit value [...] which represents the number of 100-nanosecond intervals since January 1, 1601 (UTC)."
-// "If the underlying filesystem does not support last access time, the returned value is 0."
-fn windows_time_to_unix_time(win_time: u64) -> u64 {
-    (win_time / 10_000_000).saturating_sub(11_644_473_600)
+#[cfg(windows)]
+// https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.last_access_time
+// "The returned 64-bit value [...] which represents the number of 100-nanosecond intervals since January 1, 1601 (UTC)."
+// "If the underlying filesystem does not support last access time, the returned value is 0."
+fn windows_time_to_unix_time(win_time: u64) -> u64 {
+    (win_time / 10_000_000).saturating_sub(11_644_473_600)
 }
 
-#[cfg(windows)]
-fn windows_creation_time_to_unix_time(win_time: u64) -> Option<u64> {
-    (win_time / 10_000_000).checked_sub(11_644_473_600)
+#[cfg(windows)]
+fn windows_creation_time_to_unix_time(win_time: u64) -> Option<u64> {
+    (win_time / 10_000_000).checked_sub(11_644_473_600)
 }
 
-#[cfg(not(windows))]
-fn birth_u64(meta: &Metadata) -> Option<u64> {
-    meta.created()
-        .ok()
-        .and_then(|t| t.duration_since(UNIX_EPOCH).ok())
-        .map(|e| e.as_secs() as u64)
+#[cfg(not(windows))]
+fn birth_u64(meta: &Metadata) -> Option<u64> {
+    meta.created()
+        .ok()
+        .and_then(|t| t.duration_since(UNIX_EPOCH).ok())
+        .map(|e| e.as_secs() as u64)
 }
 
-#[cfg(windows)]
-fn get_size_on_disk(path: &Path) -> u64 {
-    let mut size_on_disk = 0;
+#[cfg(windows)]
+fn get_size_on_disk(path: &Path) -> u64 {
+    let mut size_on_disk = 0;
 
-    // bind file so it stays in scope until end of function
-    // if it goes out of scope the handle below becomes invalid
-    let file = match fs::File::open(path) {
-        Ok(file) => file,
-        Err(_) => return size_on_disk, // opening directories will fail
-    };
+    // bind file so it stays in scope until end of function
+    // if it goes out of scope the handle below becomes invalid
+    let file = match fs::File::open(path) {
+        Ok(file) => file,
+        Err(_) => return size_on_disk, // opening directories will fail
+    };
 
-    unsafe {
-        let mut file_info: FILE_STANDARD_INFO = core::mem::zeroed();
-        let file_info_ptr: *mut FILE_STANDARD_INFO = &mut file_info;
+    unsafe {
+        let mut file_info: FILE_STANDARD_INFO = core::mem::zeroed();
+        let file_info_ptr: *mut FILE_STANDARD_INFO = &mut file_info;
 
-        let success = GetFileInformationByHandleEx(
-            file.as_raw_handle() as HANDLE,
-            FileStandardInfo,
-            file_info_ptr as _,
-            std::mem::size_of::<FILE_STANDARD_INFO>() as u32,
+        let success = GetFileInformationByHandleEx(
+            file.as_raw_handle() as HANDLE,
+            FileStandardInfo,
+            file_info_ptr as _,
+            std::mem::size_of::<FILE_STANDARD_INFO>() as u32,
         );
 
-        if success != 0 {
-            size_on_disk = file_info.AllocationSize as u64;
+        if success != 0 {
+            size_on_disk = file_info.AllocationSize as u64;
         }
     }
 
-    size_on_disk
+    size_on_disk
 }
 
-#[cfg(windows)]
-fn get_file_info(path: &Path) -> Option<FileInfo> {
-    let mut result = None;
+#[cfg(windows)]
+fn get_file_info(path: &Path) -> Option<FileInfo> {
+    let mut result = None;
 
-    let file = match fs::File::open(path) {
-        Ok(file) => file,
-        Err(_) => return result,
+    let file = match fs::File::open(path) {
+        Ok(file) => file,
+        Err(_) => return result,
     };
 
-    unsafe {
-        let mut file_info: FILE_ID_INFO = core::mem::zeroed();
-        let file_info_ptr: *mut FILE_ID_INFO = &mut file_info;
+    unsafe {
+        let mut file_info: FILE_ID_INFO = core::mem::zeroed();
+        let file_info_ptr: *mut FILE_ID_INFO = &mut file_info;
 
-        let success = GetFileInformationByHandleEx(
-            file.as_raw_handle() as HANDLE,
-            FileIdInfo,
-            file_info_ptr as _,
-            std::mem::size_of::<FILE_ID_INFO>() as u32,
+        let success = GetFileInformationByHandleEx(
+            file.as_raw_handle() as HANDLE,
+            FileIdInfo,
+            file_info_ptr as _,
+            std::mem::size_of::<FILE_ID_INFO>() as u32,
         );
 
-        if success != 0 {
-            result = Some(FileInfo {
-                file_id: std::mem::transmute::<FILE_ID_128, u128>(file_info.FileId),
-                dev_id: file_info.VolumeSerialNumber,
+        if success != 0 {
+            result = Some(FileInfo {
+                file_id: std::mem::transmute::<FILE_ID_128, u128>(file_info.FileId),
+                dev_id: file_info.VolumeSerialNumber,
             });
         }
     }
 
-    result
+    result
 }
 
-fn read_block_size(s: Option<&str>) -> u64 {
-    if let Some(s) = s {
-        parse_size(s)
-            .unwrap_or_else(|e| crash!(1, "{}", format_error_message(&e, s, options::BLOCK_SIZE)))
-    } else {
-        for env_var in ["DU_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] {
-            if let Ok(env_size) = env::var(env_var) {
-                if let Ok(v) = parse_size(&env_size) {
-                    return v;
+fn read_block_size(s: Option<&str>) -> u64 {
+    if let Some(s) = s {
+        parse_size(s)
+            .unwrap_or_else(|e| crash!(1, "{}", format_error_message(&e, s, options::BLOCK_SIZE)))
+    } else {
+        for env_var in ["DU_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] {
+            if let Ok(env_size) = env::var(env_var) {
+                if let Ok(v) = parse_size(&env_size) {
+                    return v;
                 }
             }
         }
-        if env::var("POSIXLY_CORRECT").is_ok() {
-            512
-        } else {
-            1024
-        }
+        if env::var("POSIXLY_CORRECT").is_ok() {
+            512
+        } else {
+            1024
+        }
     }
 }
 
-fn choose_size(matches: &ArgMatches, stat: &Stat) -> u64 {
-    if matches.get_flag(options::INODES) {
-        stat.inodes
-    } else if matches.get_flag(options::APPARENT_SIZE) || matches.get_flag(options::BYTES) {
-        stat.size
-    } else {
-        // The st_blocks field indicates the number of blocks allocated to the file, 512-byte units.
-        // See: http://linux.die.net/man/2/stat
-        stat.blocks * 512
-    }
+fn choose_size(matches: &ArgMatches, stat: &Stat) -> u64 {
+    if matches.get_flag(options::INODES) {
+        stat.inodes
+    } else if matches.get_flag(options::APPARENT_SIZE) || matches.get_flag(options::BYTES) {
+        stat.size
+    } else {
+        // The st_blocks field indicates the number of blocks allocated to the file, 512-byte units.
+        // See: http://linux.die.net/man/2/stat
+        stat.blocks * 512
+    }
 }
 
-// this takes `my_stat` to avoid having to stat files multiple times.
-// XXX: this should use the impl Trait return type when it is stabilized
-fn du(
-    mut my_stat: Stat,
-    options: &Options,
-    depth: usize,
-    inodes: &mut HashSet<FileInfo>,
-    exclude: &[Pattern],
-) -> Box<dyn DoubleEndedIterator<Item = Stat>> {
-    let mut stats = vec![];
-    let mut futures = vec![];
+// this takes `my_stat` to avoid having to stat files multiple times.
+// XXX: this should use the impl Trait return type when it is stabilized
+fn du(
+    mut my_stat: Stat,
+    options: &Options,
+    depth: usize,
+    inodes: &mut HashSet<FileInfo>,
+    exclude: &[Pattern],
+) -> Box<dyn DoubleEndedIterator<Item = Stat>> {
+    let mut stats = vec![];
+    let mut futures = vec![];
 
-    if my_stat.is_dir {
-        let read = match fs::read_dir(&my_stat.path) {
-            Ok(read) => read,
-            Err(e) => {
+    if my_stat.is_dir {
+        let read = match fs::read_dir(&my_stat.path) {
+            Ok(read) => read,
+            Err(e) => {
                 show!(
-                    e.map_err_context(|| format!("cannot read directory {}", my_stat.path.quote()))
+                    e.map_err_context(|| format!("cannot read directory {}", my_stat.path.quote()))
                 );
-                return Box::new(iter::once(my_stat));
+                return Box::new(iter::once(my_stat));
             }
         };
 
-        'file_loop: for f in read {
-            match f {
-                Ok(entry) => {
-                    match Stat::new(entry.path(), options) {
-                        Ok(this_stat) => {
-                            // We have an exclude list
-                            for pattern in exclude {
-                                // Look at all patterns with both short and long paths
-                                // if we have 'du foo' but search to exclude 'foo/bar'
-                                // we need the full path
-                                if pattern.matches(&this_stat.path.to_string_lossy())
-                                    || pattern.matches(&entry.file_name().into_string().unwrap())
+        'file_loop: for f in read {
+            match f {
+                Ok(entry) => {
+                    match Stat::new(entry.path(), options) {
+                        Ok(this_stat) => {
+                            // We have an exclude list
+                            for pattern in exclude {
+                                // Look at all patterns with both short and long paths
+                                // if we have 'du foo' but search to exclude 'foo/bar'
+                                // we need the full path
+                                if pattern.matches(&this_stat.path.to_string_lossy())
+                                    || pattern.matches(&entry.file_name().into_string().unwrap())
                                 {
-                                    // if the directory is ignored, leave early
-                                    if options.verbose {
-                                        println!("{} ignored", &this_stat.path.quote());
+                                    // if the directory is ignored, leave early
+                                    if options.verbose {
+                                        println!("{} ignored", &this_stat.path.quote());
                                     }
-                                    // Go to the next file
-                                    continue 'file_loop;
+                                    // Go to the next file
+                                    continue 'file_loop;
                                 }
                             }
 
-                            if let Some(inode) = this_stat.inode {
-                                if inodes.contains(&inode) {
+                            if let Some(inode) = this_stat.inode {
+                                if inodes.contains(&inode) {
                                     continue;
                                 }
-                                inodes.insert(inode);
+                                inodes.insert(inode);
                             }
-                            if this_stat.is_dir {
-                                if options.one_file_system {
-                                    if let (Some(this_inode), Some(my_inode)) =
-                                        (this_stat.inode, my_stat.inode)
+                            if this_stat.is_dir {
+                                if options.one_file_system {
+                                    if let (Some(this_inode), Some(my_inode)) =
+                                        (this_stat.inode, my_stat.inode)
                                     {
-                                        if this_inode.dev_id != my_inode.dev_id {
+                                        if this_inode.dev_id != my_inode.dev_id {
                                             continue;
                                         }
                                     }
                                 }
-                                futures.push(du(this_stat, options, depth + 1, inodes, exclude));
-                            } else {
-                                my_stat.size += this_stat.size;
-                                my_stat.blocks += this_stat.blocks;
-                                my_stat.inodes += 1;
-                                if options.all {
-                                    stats.push(this_stat);
+                                futures.push(du(this_stat, options, depth + 1, inodes, exclude));
+                            } else {
+                                my_stat.size += this_stat.size;
+                                my_stat.blocks += this_stat.blocks;
+                                my_stat.inodes += 1;
+                                if options.all {
+                                    stats.push(this_stat);
                                 }
                             }
                         }
-                        Err(e) => show!(
-                            e.map_err_context(|| format!("cannot access {}", entry.path().quote()))
+                        Err(e) => show!(
+                            e.map_err_context(|| format!("cannot access {}", entry.path().quote()))
                         ),
                     }
                 }
-                Err(error) => show_error!("{}", error),
+                Err(error) => show_error!("{}", error),
             }
         }
     }
 
-    stats.extend(futures.into_iter().flatten().filter(|stat| {
-        if !options.separate_dirs && stat.path.parent().unwrap() == my_stat.path {
-            my_stat.size += stat.size;
-            my_stat.blocks += stat.blocks;
-            my_stat.inodes += stat.inodes;
+    stats.extend(futures.into_iter().flatten().filter(|stat| {
+        if !options.separate_dirs && stat.path.parent().unwrap() == my_stat.path {
+            my_stat.size += stat.size;
+            my_stat.blocks += stat.blocks;
+            my_stat.inodes += stat.inodes;
         }
-        options
-            .max_depth
-            .map_or(true, |max_depth| depth < max_depth)
+        options
+            .max_depth
+            .map_or(true, |max_depth| depth < max_depth)
     }));
-    stats.push(my_stat);
-    Box::new(stats.into_iter())
+    stats.push(my_stat);
+    Box::new(stats.into_iter())
 }
 
-fn convert_size_human(size: u64, multiplier: u64, _block_size: u64) -> String {
-    for &(unit, power) in &UNITS {
-        let limit = multiplier.pow(power);
-        if size >= limit {
-            return format!("{:.1}{}", (size as f64) / (limit as f64), unit);
+fn convert_size_human(size: u64, multiplier: u64, _block_size: u64) -> String {
+    for &(unit, power) in &UNITS {
+        let limit = multiplier.pow(power);
+        if size >= limit {
+            return format!("{:.1}{}", (size as f64) / (limit as f64), unit);
         }
     }
-    if size == 0 {
-        return "0".to_string();
+    if size == 0 {
+        return "0".to_string();
     }
-    format!("{}B", size)
+    format!("{}B", size)
 }
 
-fn convert_size_b(size: u64, _multiplier: u64, _block_size: u64) -> String {
-    format!("{}", ((size as f64) / (1_f64)).ceil())
+fn convert_size_b(size: u64, _multiplier: u64, _block_size: u64) -> String {
+    format!("{}", ((size as f64) / (1_f64)).ceil())
 }
 
-fn convert_size_k(size: u64, multiplier: u64, _block_size: u64) -> String {
-    format!("{}", ((size as f64) / (multiplier as f64)).ceil())
+fn convert_size_k(size: u64, multiplier: u64, _block_size: u64) -> String {
+    format!("{}", ((size as f64) / (multiplier as f64)).ceil())
 }
 
-fn convert_size_m(size: u64, multiplier: u64, _block_size: u64) -> String {
+fn convert_size_m(size: u64, multiplier: u64, _block_size: u64) -> String {
     format!(
         "{}",
-        ((size as f64) / ((multiplier * multiplier) as f64)).ceil()
+        ((size as f64) / ((multiplier * multiplier) as f64)).ceil()
     )
 }
 
-fn convert_size_other(size: u64, _multiplier: u64, block_size: u64) -> String {
-    format!("{}", ((size as f64) / (block_size as f64)).ceil())
+fn convert_size_other(size: u64, _multiplier: u64, block_size: u64) -> String {
+    format!("{}", ((size as f64) / (block_size as f64)).ceil())
 }
 
-#[derive(Debug)]
-enum DuError {
-    InvalidMaxDepthArg(String),
-    SummarizeDepthConflict(String),
-    InvalidTimeStyleArg(String),
-    InvalidTimeArg(String),
-    InvalidGlob(String),
+#[derive(Debug)]
+enum DuError {
+    InvalidMaxDepthArg(String),
+    SummarizeDepthConflict(String),
+    InvalidTimeStyleArg(String),
+    InvalidTimeArg(String),
+    InvalidGlob(String),
 }
 
-impl Display for DuError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::InvalidMaxDepthArg(s) => write!(f, "invalid maximum depth {}", s.quote()),
-            Self::SummarizeDepthConflict(s) => {
+impl Display for DuError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::InvalidMaxDepthArg(s) => write!(f, "invalid maximum depth {}", s.quote()),
+            Self::SummarizeDepthConflict(s) => {
                 write!(
-                    f,
+                    f,
                     "summarizing conflicts with --max-depth={}",
-                    s.maybe_quote()
+                    s.maybe_quote()
                 )
             }
-            Self::InvalidTimeStyleArg(s) => write!(
-                f,
+            Self::InvalidTimeStyleArg(s) => write!(
+                f,
                 "invalid argument {} for 'time style'
 Valid arguments are:
 - 'full-iso'
 - 'long-iso'
 - 'iso'
 Try '{} --help' for more information.",
-                s.quote(),
-                uucore::execution_phrase()
+                s.quote(),
+                uucore::execution_phrase()
             ),
-            Self::InvalidTimeArg(s) => write!(
-                f,
+            Self::InvalidTimeArg(s) => write!(
+                f,
                 "Invalid argument {} for --time.
 'birth' and 'creation' arguments are not supported on this platform.",
-                s.quote()
+                s.quote()
             ),
-            Self::InvalidGlob(s) => write!(f, "Invalid exclude syntax: {}", s),
+            Self::InvalidGlob(s) => write!(f, "Invalid exclude syntax: {}", s),
         }
     }
 }
 
-impl Error for DuError {}
+impl Error for DuError {}
 
-impl UError for DuError {
-    fn code(&self) -> i32 {
-        match self {
-            Self::InvalidMaxDepthArg(_)
-            | Self::SummarizeDepthConflict(_)
-            | Self::InvalidTimeStyleArg(_)
-            | Self::InvalidTimeArg(_)
-            | Self::InvalidGlob(_) => 1,
+impl UError for DuError {
+    fn code(&self) -> i32 {
+        match self {
+            Self::InvalidMaxDepthArg(_)
+            | Self::SummarizeDepthConflict(_)
+            | Self::InvalidTimeStyleArg(_)
+            | Self::InvalidTimeArg(_)
+            | Self::InvalidGlob(_) => 1,
         }
     }
 }
 
-// Read a file and return each line in a vector of String
-fn file_as_vec(filename: impl AsRef<Path>) -> Vec<String> {
-    let file = File::open(filename).expect("no such file");
-    let buf = BufReader::new(file);
+// Read a file and return each line in a vector of String
+fn file_as_vec(filename: impl AsRef<Path>) -> Vec<String> {
+    let file = File::open(filename).expect("no such file");
+    let buf = BufReader::new(file);
 
-    buf.lines()
-        .map(|l| l.expect("Could not parse line"))
-        .collect()
+    buf.lines()
+        .map(|l| l.expect("Could not parse line"))
+        .collect()
 }
 
-// Given the --exclude-from and/or --exclude arguments, returns the globset lists
-// to ignore the files
-fn build_exclude_patterns(matches: &ArgMatches) -> UResult<Vec<Pattern>> {
-    let exclude_from_iterator = matches
-        .get_many::<String>(options::EXCLUDE_FROM)
-        .unwrap_or_default()
-        .flat_map(file_as_vec);
+// Given the --exclude-from and/or --exclude arguments, returns the globset lists
+// to ignore the files
+fn build_exclude_patterns(matches: &ArgMatches) -> UResult<Vec<Pattern>> {
+    let exclude_from_iterator = matches
+        .get_many::<String>(options::EXCLUDE_FROM)
+        .unwrap_or_default()
+        .flat_map(file_as_vec);
 
-    let excludes_iterator = matches
-        .get_many::<String>(options::EXCLUDE)
-        .unwrap_or_default()
-        .map(|v| v.to_owned());
+    let excludes_iterator = matches
+        .get_many::<String>(options::EXCLUDE)
+        .unwrap_or_default()
+        .map(|v| v.to_owned());
 
-    let mut exclude_patterns = Vec::new();
-    for f in excludes_iterator.chain(exclude_from_iterator) {
-        if matches.get_flag(options::VERBOSE) {
-            println!("adding {:?} to the exclude list ", &f);
+    let mut exclude_patterns = Vec::new();
+    for f in excludes_iterator.chain(exclude_from_iterator) {
+        if matches.get_flag(options::VERBOSE) {
+            println!("adding {:?} to the exclude list ", &f);
         }
-        match parse_glob::from_str(&f) {
-            Ok(glob) => exclude_patterns.push(glob),
-            Err(err) => return Err(DuError::InvalidGlob(err.to_string()).into()),
+        match parse_glob::from_str(&f) {
+            Ok(glob) => exclude_patterns.push(glob),
+            Err(err) => return Err(DuError::InvalidGlob(err.to_string()).into()),
         }
     }
-    Ok(exclude_patterns)
+    Ok(exclude_patterns)
 }
 
-#[uucore::main]
-#[allow(clippy::cognitive_complexity)]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+#[allow(clippy::cognitive_complexity)]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let summarize = matches.get_flag(options::SUMMARIZE);
+    let summarize = matches.get_flag(options::SUMMARIZE);
 
-    let max_depth = parse_depth(
-        matches
-            .get_one::<String>(options::MAX_DEPTH)
-            .map(|s| s.as_str()),
-        summarize,
+    let max_depth = parse_depth(
+        matches
+            .get_one::<String>(options::MAX_DEPTH)
+            .map(|s| s.as_str()),
+        summarize,
     )?;
 
-    let options = Options {
-        all: matches.get_flag(options::ALL),
-        max_depth,
-        total: matches.get_flag(options::TOTAL),
-        separate_dirs: matches.get_flag(options::SEPARATE_DIRS),
-        one_file_system: matches.get_flag(options::ONE_FILE_SYSTEM),
-        dereference: matches.get_flag(options::DEREFERENCE),
-        inodes: matches.get_flag(options::INODES),
-        verbose: matches.get_flag(options::VERBOSE),
+    let options = Options {
+        all: matches.get_flag(options::ALL),
+        max_depth,
+        total: matches.get_flag(options::TOTAL),
+        separate_dirs: matches.get_flag(options::SEPARATE_DIRS),
+        one_file_system: matches.get_flag(options::ONE_FILE_SYSTEM),
+        dereference: matches.get_flag(options::DEREFERENCE),
+        inodes: matches.get_flag(options::INODES),
+        verbose: matches.get_flag(options::VERBOSE),
     };
 
-    let files = match matches.get_one::<String>(options::FILE) {
-        Some(_) => matches
-            .get_many::<String>(options::FILE)
-            .unwrap()
-            .map(|s| s.as_str())
-            .collect(),
-        None => vec!["."],
+    let files = match matches.get_one::<String>(options::FILE) {
+        Some(_) => matches
+            .get_many::<String>(options::FILE)
+            .unwrap()
+            .map(|s| s.as_str())
+            .collect(),
+        None => vec!["."],
     };
 
-    if options.inodes
-        && (matches.get_flag(options::APPARENT_SIZE) || matches.get_flag(options::BYTES))
+    if options.inodes
+        && (matches.get_flag(options::APPARENT_SIZE) || matches.get_flag(options::BYTES))
     {
         show_warning!("options --apparent-size and -b are ineffective with --inodes");
     }
 
-    let block_size = read_block_size(
-        matches
-            .get_one::<String>(options::BLOCK_SIZE)
-            .map(|s| s.as_str()),
+    let block_size = read_block_size(
+        matches
+            .get_one::<String>(options::BLOCK_SIZE)
+            .map(|s| s.as_str()),
     );
 
-    let threshold = matches.get_one::<String>(options::THRESHOLD).map(|s| {
-        Threshold::from_str(s)
-            .unwrap_or_else(|e| crash!(1, "{}", format_error_message(&e, s, options::THRESHOLD)))
+    let threshold = matches.get_one::<String>(options::THRESHOLD).map(|s| {
+        Threshold::from_str(s)
+            .unwrap_or_else(|e| crash!(1, "{}", format_error_message(&e, s, options::THRESHOLD)))
     });
 
-    let multiplier: u64 = if matches.get_flag(options::SI) {
-        1000
-    } else {
-        1024
-    };
-    let convert_size_fn = {
-        if matches.get_flag(options::HUMAN_READABLE) || matches.get_flag(options::SI) {
-            convert_size_human
-        } else if matches.get_flag(options::BYTES) {
-            convert_size_b
-        } else if matches.get_flag(options::BLOCK_SIZE_1K) {
-            convert_size_k
-        } else if matches.get_flag(options::BLOCK_SIZE_1M) {
-            convert_size_m
-        } else {
-            convert_size_other
+    let multiplier: u64 = if matches.get_flag(options::SI) {
+        1000
+    } else {
+        1024
+    };
+    let convert_size_fn = {
+        if matches.get_flag(options::HUMAN_READABLE) || matches.get_flag(options::SI) {
+            convert_size_human
+        } else if matches.get_flag(options::BYTES) {
+            convert_size_b
+        } else if matches.get_flag(options::BLOCK_SIZE_1K) {
+            convert_size_k
+        } else if matches.get_flag(options::BLOCK_SIZE_1M) {
+            convert_size_m
+        } else {
+            convert_size_other
         }
     };
-    let convert_size = |size: u64| {
-        if options.inodes {
-            size.to_string()
-        } else {
-            convert_size_fn(size, multiplier, block_size)
+    let convert_size = |size: u64| {
+        if options.inodes {
+            size.to_string()
+        } else {
+            convert_size_fn(size, multiplier, block_size)
         }
     };
 
-    let time_format_str =
-        parse_time_style(matches.get_one::<String>("time-style").map(|s| s.as_str()))?;
+    let time_format_str =
+        parse_time_style(matches.get_one::<String>("time-style").map(|s| s.as_str()))?;
 
-    let line_separator = if matches.get_flag(options::NULL) {
-        "\0"
-    } else {
-        "\n"
-    };
+    let line_separator = if matches.get_flag(options::NULL) {
+        "\0"
+    } else {
+        "\n"
+    };
 
-    let excludes = build_exclude_patterns(&matches)?;
+    let excludes = build_exclude_patterns(&matches)?;
 
-    let mut grand_total = 0;
-    'loop_file: for path_string in files {
-        // Skip if we don't want to ignore anything
-        if !&excludes.is_empty() {
-            for pattern in &excludes {
-                if pattern.matches(path_string) {
-                    // if the directory is ignored, leave early
-                    if options.verbose {
-                        println!("{} ignored", path_string.quote());
+    let mut grand_total = 0;
+    'loop_file: for path_string in files {
+        // Skip if we don't want to ignore anything
+        if !&excludes.is_empty() {
+            for pattern in &excludes {
+                if pattern.matches(path_string) {
+                    // if the directory is ignored, leave early
+                    if options.verbose {
+                        println!("{} ignored", path_string.quote());
                     }
-                    continue 'loop_file;
+                    continue 'loop_file;
                 }
             }
         }
 
-        let path = PathBuf::from(&path_string);
-        // Check existence of path provided in argument
-        if let Ok(stat) = Stat::new(path, &options) {
-            // Kick off the computation of disk usage from the initial path
-            let mut inodes: HashSet<FileInfo> = HashSet::new();
-            if let Some(inode) = stat.inode {
-                inodes.insert(inode);
+        let path = PathBuf::from(&path_string);
+        // Check existence of path provided in argument
+        if let Ok(stat) = Stat::new(path, &options) {
+            // Kick off the computation of disk usage from the initial path
+            let mut inodes: HashSet<FileInfo> = HashSet::new();
+            if let Some(inode) = stat.inode {
+                inodes.insert(inode);
             }
-            let iter = du(stat, &options, 0, &mut inodes, &excludes);
+            let iter = du(stat, &options, 0, &mut inodes, &excludes);
 
-            // Sum up all the returned `Stat`s and display results
-            let (_, len) = iter.size_hint();
-            let len = len.unwrap();
-            for (index, stat) in iter.enumerate() {
-                let size = choose_size(&matches, &stat);
+            // Sum up all the returned `Stat`s and display results
+            let (_, len) = iter.size_hint();
+            let len = len.unwrap();
+            for (index, stat) in iter.enumerate() {
+                let size = choose_size(&matches, &stat);
 
-                if threshold.map_or(false, |threshold| threshold.should_exclude(size)) {
+                if threshold.map_or(false, |threshold| threshold.should_exclude(size)) {
                     continue;
                 }
 
-                if matches.contains_id(options::TIME) {
-                    let tm = {
-                        let secs = {
-                            match matches.get_one::<String>(options::TIME) {
-                                Some(s) => match s.as_str() {
-                                    "ctime" | "status" => stat.modified,
-                                    "access" | "atime" | "use" => stat.accessed,
-                                    "birth" | "creation" => stat
-                                        .created
-                                        .ok_or_else(|| DuError::InvalidTimeArg(s.into()))?,
-                                    // below should never happen as clap already restricts the values.
-                                    _ => unreachable!("Invalid field for --time"),
+                if matches.contains_id(options::TIME) {
+                    let tm = {
+                        let secs = {
+                            match matches.get_one::<String>(options::TIME) {
+                                Some(s) => match s.as_str() {
+                                    "ctime" | "status" => stat.modified,
+                                    "access" | "atime" | "use" => stat.accessed,
+                                    "birth" | "creation" => stat
+                                        .created
+                                        .ok_or_else(|| DuError::InvalidTimeArg(s.into()))?,
+                                    // below should never happen as clap already restricts the values.
+                                    _ => unreachable!("Invalid field for --time"),
                                 },
-                                None => stat.modified,
+                                None => stat.modified,
                             }
                         };
-                        DateTime::<Local>::from(UNIX_EPOCH + Duration::from_secs(secs))
+                        DateTime::<Local>::from(UNIX_EPOCH + Duration::from_secs(secs))
                     };
-                    if !summarize || index == len - 1 {
-                        let time_str = tm.format(time_format_str).to_string();
-                        print!("{}\t{}\t", convert_size(size), time_str);
-                        print_verbatim(stat.path).unwrap();
-                        print!("{}", line_separator);
+                    if !summarize || index == len - 1 {
+                        let time_str = tm.format(time_format_str).to_string();
+                        print!("{}\t{}\t", convert_size(size), time_str);
+                        print_verbatim(stat.path).unwrap();
+                        print!("{}", line_separator);
                     }
-                } else if !summarize || index == len - 1 {
-                    print!("{}\t", convert_size(size));
-                    print_verbatim(stat.path).unwrap();
-                    print!("{}", line_separator);
+                } else if !summarize || index == len - 1 {
+                    print!("{}\t", convert_size(size));
+                    print_verbatim(stat.path).unwrap();
+                    print!("{}", line_separator);
                 }
-                if options.total && index == (len - 1) {
-                    // The last element will be the total size of the the path under
-                    // path_string.  We add it to the grand total.
-                    grand_total += size;
+                if options.total && index == (len - 1) {
+                    // The last element will be the total size of the the path under
+                    // path_string.  We add it to the grand total.
+                    grand_total += size;
                 }
             }
-        } else {
+        } else {
             show_error!(
                 "{}: {}",
-                path_string.maybe_quote(),
-                "No such file or directory"
-            );
+                path_string.maybe_quote(),
+                "No such file or directory"
+            );
         }
     }
 
-    if options.total {
-        print!("{}\ttotal", convert_size(grand_total));
-        print!("{}", line_separator);
+    if options.total {
+        print!("{}\ttotal", convert_size(grand_total));
+        print!("{}", line_separator);
     }
 
     Ok(())
 }
 
-fn parse_time_style(s: Option<&str>) -> UResult<&str> {
-    match s {
-        Some(s) => match s {
-            "full-iso" => Ok("%Y-%m-%d %H:%M:%S.%f %z"),
-            "long-iso" => Ok("%Y-%m-%d %H:%M"),
-            "iso" => Ok("%Y-%m-%d"),
-            _ => Err(DuError::InvalidTimeStyleArg(s.into()).into()),
+fn parse_time_style(s: Option<&str>) -> UResult<&str> {
+    match s {
+        Some(s) => match s {
+            "full-iso" => Ok("%Y-%m-%d %H:%M:%S.%f %z"),
+            "long-iso" => Ok("%Y-%m-%d %H:%M"),
+            "iso" => Ok("%Y-%m-%d"),
+            _ => Err(DuError::InvalidTimeStyleArg(s.into()).into()),
         },
-        None => Ok("%Y-%m-%d %H:%M"),
+        None => Ok("%Y-%m-%d %H:%M"),
     }
 }
 
-fn parse_depth(max_depth_str: Option<&str>, summarize: bool) -> UResult<Option<usize>> {
-    let max_depth = max_depth_str.as_ref().and_then(|s| s.parse::<usize>().ok());
-    match (max_depth_str, max_depth) {
-        (Some(s), _) if summarize => Err(DuError::SummarizeDepthConflict(s.into()).into()),
-        (Some(s), None) => Err(DuError::InvalidMaxDepthArg(s.into()).into()),
-        (Some(_), Some(_)) | (None, _) => Ok(max_depth),
+fn parse_depth(max_depth_str: Option<&str>, summarize: bool) -> UResult<Option<usize>> {
+    let max_depth = max_depth_str.as_ref().and_then(|s| s.parse::<usize>().ok());
+    match (max_depth_str, max_depth) {
+        (Some(s), _) if summarize => Err(DuError::SummarizeDepthConflict(s.into()).into()),
+        (Some(s), None) => Err(DuError::InvalidMaxDepthArg(s.into()).into()),
+        (Some(_), Some(_)) | (None, _) => Ok(max_depth),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(LONG_HELP)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help)
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(LONG_HELP)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help)
         )
-        .arg(
-            Arg::new(options::ALL)
-                .short('a')
-                .long(options::ALL)
-                .help("write counts for all files, not just directories")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::ALL)
+                .short('a')
+                .long(options::ALL)
+                .help("write counts for all files, not just directories")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::APPARENT_SIZE)
-                .long(options::APPARENT_SIZE)
-                .help(
+        .arg(
+            Arg::new(options::APPARENT_SIZE)
+                .long(options::APPARENT_SIZE)
+                .help(
                     "print apparent sizes, rather than disk usage \
                     although the apparent size is usually smaller, it may be larger due to holes \
-                    in ('sparse') files, internal fragmentation, indirect blocks, and the like"
-                )
-                .action(ArgAction::SetTrue)
+                    in ('sparse') files, internal fragmentation, indirect blocks, and the like"
+                )
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::BLOCK_SIZE)
-                .short('B')
-                .long(options::BLOCK_SIZE)
-                .value_name("SIZE")
-                .help(
+        .arg(
+            Arg::new(options::BLOCK_SIZE)
+                .short('B')
+                .long(options::BLOCK_SIZE)
+                .value_name("SIZE")
+                .help(
                     "scale sizes by SIZE before printing them. \
-                    E.g., '-BM' prints sizes in units of 1,048,576 bytes. See SIZE format below."
-                )
+                    E.g., '-BM' prints sizes in units of 1,048,576 bytes. See SIZE format below."
+                )
         )
-        .arg(
-            Arg::new(options::BYTES)
-                .short('b')
-                .long("bytes")
-                .help("equivalent to '--apparent-size --block-size=1'")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::BYTES)
+                .short('b')
+                .long("bytes")
+                .help("equivalent to '--apparent-size --block-size=1'")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::TOTAL)
-                .long("total")
-                .short('c')
-                .help("produce a grand total")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::TOTAL)
+                .long("total")
+                .short('c')
+                .help("produce a grand total")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::MAX_DEPTH)
-                .short('d')
-                .long("max-depth")
-                .value_name("N")
-                .help(
+        .arg(
+            Arg::new(options::MAX_DEPTH)
+                .short('d')
+                .long("max-depth")
+                .value_name("N")
+                .help(
                     "print the total for a directory (or file, with --all) \
                     only if it is N or fewer levels below the command \
-                    line argument;  --max-depth=0 is the same as --summarize"
-                )
+                    line argument;  --max-depth=0 is the same as --summarize"
+                )
         )
-        .arg(
-            Arg::new(options::HUMAN_READABLE)
-                .long("human-readable")
-                .short('h')
-                .help("print sizes in human readable format (e.g., 1K 234M 2G)")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::HUMAN_READABLE)
+                .long("human-readable")
+                .short('h')
+                .help("print sizes in human readable format (e.g., 1K 234M 2G)")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::INODES)
-                .long(options::INODES)
-                .help(
-                    "list inode usage information instead of block usage like --block-size=1K"
-                )
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::INODES)
+                .long(options::INODES)
+                .help(
+                    "list inode usage information instead of block usage like --block-size=1K"
+                )
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::BLOCK_SIZE_1K)
-                .short('k')
-                .help("like --block-size=1K")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::BLOCK_SIZE_1K)
+                .short('k')
+                .help("like --block-size=1K")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::COUNT_LINKS)
-                .short('l')
-                .long("count-links")
-                .help("count sizes many times if hard linked")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::COUNT_LINKS)
+                .short('l')
+                .long("count-links")
+                .help("count sizes many times if hard linked")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::DEREFERENCE)
-                .short('L')
-                .long(options::DEREFERENCE)
-                .help("dereference all symbolic links")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::DEREFERENCE)
+                .short('L')
+                .long(options::DEREFERENCE)
+                .help("dereference all symbolic links")
+                .action(ArgAction::SetTrue)
         )
-        // .arg(
-        //     Arg::new("no-dereference")
-        //         .short('P')
-        //         .long("no-dereference")
-        //         .help("don't follow any symbolic links (this is the default)")
-        //         .action(ArgAction::SetTrue),        
-        // )
-        .arg(
-            Arg::new(options::BLOCK_SIZE_1M)
-                .short('m')
-                .help("like --block-size=1M")
-                .action(ArgAction::SetTrue)
+        // .arg(
+        //     Arg::new("no-dereference")
+        //         .short('P')
+        //         .long("no-dereference")
+        //         .help("don't follow any symbolic links (this is the default)")
+        //         .action(ArgAction::SetTrue),        
+        // )
+        .arg(
+            Arg::new(options::BLOCK_SIZE_1M)
+                .short('m')
+                .help("like --block-size=1M")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::NULL)
-                .short('0')
-                .long("null")
-                .help("end each output line with 0 byte rather than newline")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::NULL)
+                .short('0')
+                .long("null")
+                .help("end each output line with 0 byte rather than newline")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::SEPARATE_DIRS)
-                .short('S')
-                .long("separate-dirs")
-                .help("do not include size of subdirectories")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::SEPARATE_DIRS)
+                .short('S')
+                .long("separate-dirs")
+                .help("do not include size of subdirectories")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::SUMMARIZE)
-                .short('s')
-                .long("summarize")
-                .help("display only a total for each argument")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::SUMMARIZE)
+                .short('s')
+                .long("summarize")
+                .help("display only a total for each argument")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::SI)
-                .long(options::SI)
-                .help("like -h, but use powers of 1000 not 1024")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::SI)
+                .long(options::SI)
+                .help("like -h, but use powers of 1000 not 1024")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::ONE_FILE_SYSTEM)
-                .short('x')
-                .long(options::ONE_FILE_SYSTEM)
-                .help("skip directories on different file systems")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::ONE_FILE_SYSTEM)
+                .short('x')
+                .long(options::ONE_FILE_SYSTEM)
+                .help("skip directories on different file systems")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::THRESHOLD)
-                .short('t')
-                .long(options::THRESHOLD)
-                .value_name("SIZE")
-                .num_args(1)
-                .allow_hyphen_values(true)
-                .help("exclude entries smaller than SIZE if positive, \
+        .arg(
+            Arg::new(options::THRESHOLD)
+                .short('t')
+                .long(options::THRESHOLD)
+                .value_name("SIZE")
+                .num_args(1)
+                .allow_hyphen_values(true)
+                .help("exclude entries smaller than SIZE if positive, \
                           or entries greater than SIZE if negative")
         )
-        .arg(
-            Arg::new(options::VERBOSE)
-                .short('v')
-                .long("verbose")
-                .help("verbose mode (option not present in GNU/Coreutils)")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new(options::VERBOSE)
+                .short('v')
+                .long("verbose")
+                .help("verbose mode (option not present in GNU/Coreutils)")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new(options::EXCLUDE)
-                .long(options::EXCLUDE)
-                .value_name("PATTERN")
-                .help("exclude files that match PATTERN")
-                .action(ArgAction::Append)
+        .arg(
+            Arg::new(options::EXCLUDE)
+                .long(options::EXCLUDE)
+                .value_name("PATTERN")
+                .help("exclude files that match PATTERN")
+                .action(ArgAction::Append)
         )
-        .arg(
-            Arg::new(options::EXCLUDE_FROM)
-                .short('X')
-                .long("exclude-from")
-                .value_name("FILE")
-                .value_hint(clap::ValueHint::FilePath)
-                .help("exclude files that match any pattern in FILE")
-                .action(ArgAction::Append)
+        .arg(
+            Arg::new(options::EXCLUDE_FROM)
+                .short('X')
+                .long("exclude-from")
+                .value_name("FILE")
+                .value_hint(clap::ValueHint::FilePath)
+                .help("exclude files that match any pattern in FILE")
+                .action(ArgAction::Append)
         )
-        .arg(
-            Arg::new(options::TIME)
-                .long(options::TIME)
-                .value_name("WORD")
-                .require_equals(true)
-                .num_args(0..)
-                .value_parser(["atime", "access", "use", "ctime", "status", "birth", "creation"])
-                .help(
+        .arg(
+            Arg::new(options::TIME)
+                .long(options::TIME)
+                .value_name("WORD")
+                .require_equals(true)
+                .num_args(0..)
+                .value_parser(["atime", "access", "use", "ctime", "status", "birth", "creation"])
+                .help(
                     "show time of the last modification of any file in the \
                     directory, or any of its subdirectories. If WORD is given, show time as WORD instead \
-                    of modification time: atime, access, use, ctime, status, birth or creation"
-                )
+                    of modification time: atime, access, use, ctime, status, birth or creation"
+                )
         )
-        .arg(
-            Arg::new(options::TIME_STYLE)
-                .long(options::TIME_STYLE)
-                .value_name("STYLE")
-                .help(
+        .arg(
+            Arg::new(options::TIME_STYLE)
+                .long(options::TIME_STYLE)
+                .value_name("STYLE")
+                .help(
                     "show times using style STYLE: \
-                    full-iso, long-iso, iso, +FORMAT FORMAT is interpreted like 'date'"
-                )
+                    full-iso, long-iso, iso, +FORMAT FORMAT is interpreted like 'date'"
+                )
         )
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .value_hint(clap::ValueHint::AnyPath)
-                .action(ArgAction::Append)
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .value_hint(clap::ValueHint::AnyPath)
+                .action(ArgAction::Append)
         )
 }
 
-#[derive(Clone, Copy)]
-enum Threshold {
-    Lower(u64),
-    Upper(u64),
+#[derive(Clone, Copy)]
+enum Threshold {
+    Lower(u64),
+    Upper(u64),
 }
 
-impl FromStr for Threshold {
-    type Err = ParseSizeError;
+impl FromStr for Threshold {
+    type Err = ParseSizeError;
 
-    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
-        let offset = usize::from(s.starts_with(&['-', '+'][..]));
+    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
+        let offset = usize::from(s.starts_with(&['-', '+'][..]));
 
-        let size = parse_size(&s[offset..])?;
+        let size = parse_size(&s[offset..])?;
 
-        if s.starts_with('-') {
-            Ok(Self::Upper(size))
-        } else {
-            Ok(Self::Lower(size))
+        if s.starts_with('-') {
+            Ok(Self::Upper(size))
+        } else {
+            Ok(Self::Lower(size))
         }
     }
 }
 
-impl Threshold {
-    fn should_exclude(&self, size: u64) -> bool {
-        match *self {
-            Self::Upper(threshold) => size > threshold,
-            Self::Lower(threshold) => size < threshold,
+impl Threshold {
+    fn should_exclude(&self, size: u64) -> bool {
+        match *self {
+            Self::Upper(threshold) => size > threshold,
+            Self::Lower(threshold) => size < threshold,
         }
     }
 }
 
-fn format_error_message(error: &ParseSizeError, s: &str, option: &str) -> String {
-    // NOTE:
-    // GNU's du echos affected flag, -B or --block-size (-t or --threshold), depending user's selection
-    match error {
-        ParseSizeError::InvalidSuffix(_) => {
-            format!("invalid suffix in --{} argument {}", option, s.quote())
+fn format_error_message(error: &ParseSizeError, s: &str, option: &str) -> String {
+    // NOTE:
+    // GNU's du echos affected flag, -B or --block-size (-t or --threshold), depending user's selection
+    match error {
+        ParseSizeError::InvalidSuffix(_) => {
+            format!("invalid suffix in --{} argument {}", option, s.quote())
         }
-        ParseSizeError::ParseFailure(_) => format!("invalid --{} argument {}", option, s.quote()),
-        ParseSizeError::SizeTooBig(_) => format!("--{} argument {} too large", option, s.quote()),
+        ParseSizeError::ParseFailure(_) => format!("invalid --{} argument {}", option, s.quote()),
+        ParseSizeError::SizeTooBig(_) => format!("--{} argument {} too large", option, s.quote()),
     }
 }
 
-#[cfg(test)]
-mod test_du {
-    #[allow(unused_imports)]
-    use super::*;
+#[cfg(test)]
+mod test_du {
+    #[allow(unused_imports)]
+    use super::*;
 
-    #[test]
-    fn test_read_block_size() {
-        let test_data = [
-            (Some("1024".to_string()), 1024),
-            (Some("K".to_string()), 1024),
+    #[test]
+    fn test_read_block_size() {
+        let test_data = [
+            (Some("1024".to_string()), 1024),
+            (Some("K".to_string()), 1024),
             (None, 1024),
         ];
-        for it in &test_data {
-            assert_eq!(read_block_size(it.0.as_deref()), it.1);
+        for it in &test_data {
+            assert_eq!(read_block_size(it.0.as_deref()), it.1);
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_echo/echo.rs.html b/dev/src/uu_echo/echo.rs.html index 5df4ee125..977d3de8d 100644 --- a/dev/src/uu_echo/echo.rs.html +++ b/dev/src/uu_echo/echo.rs.html @@ -1,4 +1,4 @@ -echo.rs - source
1
+echo.rs - source
1
 2
 3
 4
@@ -185,25 +185,25 @@
 185
 186
 187
-
// This file is part of the uutils coreutils package.
-//
-// (c) Derek Chiang <derekchiang93@gmail.com>
-// (c) Christopher Brown <ccbrown112@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Derek Chiang <derekchiang93@gmail.com>
+// (c) Christopher Brown <ccbrown112@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::io::{self, Write};
-use std::iter::Peekable;
-use std::str::Chars;
-use uucore::error::{FromIo, UResult};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::io::{self, Write};
+use std::iter::Peekable;
+use std::str::Chars;
+use uucore::error::{FromIo, UResult};
+use uucore::format_usage;
 
-const NAME: &str = "echo";
-const ABOUT: &str = "display a line of text";
-const USAGE: &str = "{} [OPTIONS]... [STRING]...";
-const AFTER_HELP: &str = r#"
+const NAME: &str = "echo";
+const ABOUT: &str = "display a line of text";
+const USAGE: &str = "{} [OPTIONS]... [STRING]...";
+const AFTER_HELP: &str = r#"
  Echo the STRING(s) to standard output.
 
  If -e is in effect, the following sequences are recognized:
@@ -222,155 +222,155 @@
  \\xHH    byte with hexadecimal value HH (1 to 2 digits)
 "#;
 
-mod options {
-    pub const STRING: &str = "STRING";
-    pub const NO_NEWLINE: &str = "no_newline";
-    pub const ENABLE_BACKSLASH_ESCAPE: &str = "enable_backslash_escape";
-    pub const DISABLE_BACKSLASH_ESCAPE: &str = "disable_backslash_escape";
+mod options {
+    pub const STRING: &str = "STRING";
+    pub const NO_NEWLINE: &str = "no_newline";
+    pub const ENABLE_BACKSLASH_ESCAPE: &str = "enable_backslash_escape";
+    pub const DISABLE_BACKSLASH_ESCAPE: &str = "disable_backslash_escape";
 }
 
-fn parse_code(
-    input: &mut Peekable<Chars>,
-    base: u32,
-    max_digits: u32,
-    bits_per_digit: u32,
-) -> Option<char> {
-    let mut ret = 0x8000_0000;
-    for _ in 0..max_digits {
-        match input.peek().and_then(|c| c.to_digit(base)) {
-            Some(n) => ret = (ret << bits_per_digit) | n,
-            None => break,
+fn parse_code(
+    input: &mut Peekable<Chars>,
+    base: u32,
+    max_digits: u32,
+    bits_per_digit: u32,
+) -> Option<char> {
+    let mut ret = 0x8000_0000;
+    for _ in 0..max_digits {
+        match input.peek().and_then(|c| c.to_digit(base)) {
+            Some(n) => ret = (ret << bits_per_digit) | n,
+            None => break,
         }
-        input.next();
+        input.next();
     }
-    std::char::from_u32(ret)
+    std::char::from_u32(ret)
 }
 
-fn print_escaped(input: &str, mut output: impl Write) -> io::Result<bool> {
-    let mut should_stop = false;
+fn print_escaped(input: &str, mut output: impl Write) -> io::Result<bool> {
+    let mut should_stop = false;
 
-    let mut buffer = ['\\'; 2];
+    let mut buffer = ['\\'; 2];
 
-    // TODO `cargo +nightly clippy` complains that `.peek()` is never
-    // called on `iter`. However, `peek()` is called inside the
-    // `parse_code()` function that borrows `iter`.
-    let mut iter = input.chars().peekable();
-    while let Some(mut c) = iter.next() {
-        let mut start = 1;
+    // TODO `cargo +nightly clippy` complains that `.peek()` is never
+    // called on `iter`. However, `peek()` is called inside the
+    // `parse_code()` function that borrows `iter`.
+    let mut iter = input.chars().peekable();
+    while let Some(mut c) = iter.next() {
+        let mut start = 1;
 
-        if c == '\\' {
-            if let Some(next) = iter.next() {
-                c = match next {
-                    '\\' => '\\',
-                    'a' => '\x07',
-                    'b' => '\x08',
-                    'c' => {
-                        should_stop = true;
+        if c == '\\' {
+            if let Some(next) = iter.next() {
+                c = match next {
+                    '\\' => '\\',
+                    'a' => '\x07',
+                    'b' => '\x08',
+                    'c' => {
+                        should_stop = true;
                         break;
                     }
-                    'e' => '\x1b',
-                    'f' => '\x0c',
-                    'n' => '\n',
-                    'r' => '\r',
-                    't' => '\t',
-                    'v' => '\x0b',
-                    'x' => parse_code(&mut iter, 16, 2, 4).unwrap_or_else(|| {
-                        start = 0;
-                        next
+                    'e' => '\x1b',
+                    'f' => '\x0c',
+                    'n' => '\n',
+                    'r' => '\r',
+                    't' => '\t',
+                    'v' => '\x0b',
+                    'x' => parse_code(&mut iter, 16, 2, 4).unwrap_or_else(|| {
+                        start = 0;
+                        next
                     }),
-                    '0' => parse_code(&mut iter, 8, 3, 3).unwrap_or('\0'),
-                    _ => {
-                        start = 0;
-                        next
+                    '0' => parse_code(&mut iter, 8, 3, 3).unwrap_or('\0'),
+                    _ => {
+                        start = 0;
+                        next
                     }
                 };
             }
         }
 
-        buffer[1] = c;
+        buffer[1] = c;
 
-        // because printing char slices is apparently not available in the standard library
-        for ch in &buffer[start..] {
-            write!(output, "{}", ch)?;
+        // because printing char slices is apparently not available in the standard library
+        for ch in &buffer[start..] {
+            write!(output, "{}", ch)?;
         }
     }
 
-    Ok(should_stop)
+    Ok(should_stop)
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
-    let matches = uu_app().get_matches_from(args);
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
+    let matches = uu_app().get_matches_from(args);
 
-    let no_newline = matches.get_flag(options::NO_NEWLINE);
-    let escaped = matches.get_flag(options::ENABLE_BACKSLASH_ESCAPE);
-    let values: Vec<String> = match matches.get_many::<String>(options::STRING) {
-        Some(s) => s.map(|s| s.to_string()).collect(),
-        None => vec!["".to_string()],
+    let no_newline = matches.get_flag(options::NO_NEWLINE);
+    let escaped = matches.get_flag(options::ENABLE_BACKSLASH_ESCAPE);
+    let values: Vec<String> = match matches.get_many::<String>(options::STRING) {
+        Some(s) => s.map(|s| s.to_string()).collect(),
+        None => vec!["".to_string()],
     };
 
-    execute(no_newline, escaped, &values)
-        .map_err_context(|| "could not write to stdout".to_string())
+    execute(no_newline, escaped, &values)
+        .map_err_context(|| "could not write to stdout".to_string())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        // TrailingVarArg specifies the final positional argument is a VarArg
-        // and it doesn't attempts the parse any further args.
-        // Final argument must have multiple(true) or the usage string equivalent.
-        .trailing_var_arg(true)
-        .allow_hyphen_values(true)
-        .infer_long_args(true)
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(AFTER_HELP)
-        .override_usage(format_usage(USAGE))
-        .arg(
-            Arg::new(options::NO_NEWLINE)
-                .short('n')
-                .help("do not output the trailing newline")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        // TrailingVarArg specifies the final positional argument is a VarArg
+        // and it doesn't attempts the parse any further args.
+        // Final argument must have multiple(true) or the usage string equivalent.
+        .trailing_var_arg(true)
+        .allow_hyphen_values(true)
+        .infer_long_args(true)
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(AFTER_HELP)
+        .override_usage(format_usage(USAGE))
+        .arg(
+            Arg::new(options::NO_NEWLINE)
+                .short('n')
+                .help("do not output the trailing newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ENABLE_BACKSLASH_ESCAPE)
-                .short('e')
-                .help("enable interpretation of backslash escapes")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ENABLE_BACKSLASH_ESCAPE)
+                .short('e')
+                .help("enable interpretation of backslash escapes")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DISABLE_BACKSLASH_ESCAPE)
-                .short('E')
-                .help("disable interpretation of backslash escapes (default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::DISABLE_BACKSLASH_ESCAPE)
+                .short('E')
+                .help("disable interpretation of backslash escapes (default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(Arg::new(options::STRING).action(ArgAction::Append))
+        .arg(Arg::new(options::STRING).action(ArgAction::Append))
 }
 
-fn execute(no_newline: bool, escaped: bool, free: &[String]) -> io::Result<()> {
-    let stdout = io::stdout();
-    let mut output = stdout.lock();
+fn execute(no_newline: bool, escaped: bool, free: &[String]) -> io::Result<()> {
+    let stdout = io::stdout();
+    let mut output = stdout.lock();
 
-    for (i, input) in free.iter().enumerate() {
-        if i > 0 {
-            write!(output, " ")?;
+    for (i, input) in free.iter().enumerate() {
+        if i > 0 {
+            write!(output, " ")?;
         }
-        if escaped {
-            let should_stop = print_escaped(input, &mut output)?;
-            if should_stop {
+        if escaped {
+            let should_stop = print_escaped(input, &mut output)?;
+            if should_stop {
                 break;
             }
-        } else {
-            write!(output, "{}", input)?;
+        } else {
+            write!(output, "{}", input)?;
         }
     }
 
-    if !no_newline {
-        writeln!(output)?;
+    if !no_newline {
+        writeln!(output)?;
     }
 
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_env/env.rs.html b/dev/src/uu_env/env.rs.html index eab49691a..c069243ac 100644 --- a/dev/src/uu_env/env.rs.html +++ b/dev/src/uu_env/env.rs.html @@ -1,4 +1,4 @@ -env.rs - source
1
+env.rs - source
1
 2
 3
 4
@@ -364,110 +364,110 @@
 364
 365
 366
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jordi Boggiano <j.boggiano@seld.be>
-// (c) Thomas Queiroz <thomasqueirozb@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jordi Boggiano <j.boggiano@seld.be>
+// (c) Thomas Queiroz <thomasqueirozb@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-/* last synced with: env (GNU coreutils) 8.13 */
+/* last synced with: env (GNU coreutils) 8.13 */
 
-// spell-checker:ignore (ToDO) chdir execvp progname subcommand subcommands unsets setenv putenv spawnp SIGSEGV SIGBUS sigaction
+// spell-checker:ignore (ToDO) chdir execvp progname subcommand subcommands unsets setenv putenv spawnp SIGSEGV SIGBUS sigaction
 
-#[macro_use]
-extern crate clap;
+#[macro_use]
+extern crate clap;
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{Arg, ArgAction, Command};
-use ini::Ini;
-#[cfg(unix)]
-use nix::sys::signal::{raise, sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal};
-use std::borrow::Cow;
-use std::env;
-use std::io::{self, Write};
-use std::iter::Iterator;
-#[cfg(unix)]
-use std::os::unix::process::ExitStatusExt;
-use std::process;
-use uucore::display::Quotable;
-use uucore::error::{UClapError, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
+use clap::{Arg, ArgAction, Command};
+use ini::Ini;
+#[cfg(unix)]
+use nix::sys::signal::{raise, sigaction, SaFlags, SigAction, SigHandler, SigSet, Signal};
+use std::borrow::Cow;
+use std::env;
+use std::io::{self, Write};
+use std::iter::Iterator;
+#[cfg(unix)]
+use std::os::unix::process::ExitStatusExt;
+use std::process;
+use uucore::display::Quotable;
+use uucore::error::{UClapError, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
 
-const ABOUT: &str = "set each NAME to VALUE in the environment and run COMMAND";
-const USAGE: &str = "{} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]";
-const AFTER_HELP: &str = "\
+const ABOUT: &str = "set each NAME to VALUE in the environment and run COMMAND";
+const USAGE: &str = "{} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]";
+const AFTER_HELP: &str = "\
 A mere - implies -i. If no COMMAND, print the resulting environment.
 ";
 
-struct Options<'a> {
-    ignore_env: bool,
-    null: bool,
-    running_directory: Option<&'a str>,
-    files: Vec<&'a str>,
-    unsets: Vec<&'a str>,
-    sets: Vec<(&'a str, &'a str)>,
-    program: Vec<&'a str>,
+struct Options<'a> {
+    ignore_env: bool,
+    null: bool,
+    running_directory: Option<&'a str>,
+    files: Vec<&'a str>,
+    unsets: Vec<&'a str>,
+    sets: Vec<(&'a str, &'a str)>,
+    program: Vec<&'a str>,
 }
 
-// print name=value env pairs on screen
-// if null is true, separate pairs with a \0, \n otherwise
-fn print_env(null: bool) {
-    let stdout_raw = io::stdout();
-    let mut stdout = stdout_raw.lock();
-    for (n, v) in env::vars() {
-        write!(stdout, "{}={}{}", n, v, if null { '\0' } else { '\n' }).unwrap();
+// print name=value env pairs on screen
+// if null is true, separate pairs with a \0, \n otherwise
+fn print_env(null: bool) {
+    let stdout_raw = io::stdout();
+    let mut stdout = stdout_raw.lock();
+    for (n, v) in env::vars() {
+        write!(stdout, "{}={}{}", n, v, if null { '\0' } else { '\n' }).unwrap();
     }
 }
 
-fn parse_name_value_opt<'a>(opts: &mut Options<'a>, opt: &'a str) -> UResult<bool> {
-    // is it a NAME=VALUE like opt ?
-    if let Some(idx) = opt.find('=') {
-        // yes, so push name, value pair
-        let (name, value) = opt.split_at(idx);
-        opts.sets.push((name, &value['='.len_utf8()..]));
+fn parse_name_value_opt<'a>(opts: &mut Options<'a>, opt: &'a str) -> UResult<bool> {
+    // is it a NAME=VALUE like opt ?
+    if let Some(idx) = opt.find('=') {
+        // yes, so push name, value pair
+        let (name, value) = opt.split_at(idx);
+        opts.sets.push((name, &value['='.len_utf8()..]));
 
         Ok(false)
-    } else {
-        // no, it's a program-like opt
-        parse_program_opt(opts, opt).map(|_| true)
+    } else {
+        // no, it's a program-like opt
+        parse_program_opt(opts, opt).map(|_| true)
     }
 }
 
-fn parse_program_opt<'a>(opts: &mut Options<'a>, opt: &'a str) -> UResult<()> {
-    if opts.null {
-        Err(UUsageError::new(
+fn parse_program_opt<'a>(opts: &mut Options<'a>, opt: &'a str) -> UResult<()> {
+    if opts.null {
+        Err(UUsageError::new(
             125,
-            "cannot specify --null (-0) with command".to_string(),
+            "cannot specify --null (-0) with command".to_string(),
         ))
-    } else {
-        opts.program.push(opt);
+    } else {
+        opts.program.push(opt);
         Ok(())
     }
 }
 
-fn load_config_file(opts: &mut Options) -> UResult<()> {
-    // NOTE: config files are parsed using an INI parser b/c it's available and compatible with ".env"-style files
-    //   ... * but support for actual INI files, although working, is not intended, nor claimed
-    for &file in &opts.files {
-        let conf = if file == "-" {
-            let stdin = io::stdin();
-            let mut stdin_locked = stdin.lock();
-            Ini::read_from(&mut stdin_locked)
-        } else {
-            Ini::load_from_file(file)
+fn load_config_file(opts: &mut Options) -> UResult<()> {
+    // NOTE: config files are parsed using an INI parser b/c it's available and compatible with ".env"-style files
+    //   ... * but support for actual INI files, although working, is not intended, nor claimed
+    for &file in &opts.files {
+        let conf = if file == "-" {
+            let stdin = io::stdin();
+            let mut stdin_locked = stdin.lock();
+            Ini::read_from(&mut stdin_locked)
+        } else {
+            Ini::load_from_file(file)
         };
 
-        let conf =
-            conf.map_err(|e| USimpleError::new(1, format!("{}: {}", file.maybe_quote(), e)))?;
+        let conf =
+            conf.map_err(|e| USimpleError::new(1, format!("{}: {}", file.maybe_quote(), e)))?;
 
-        for (_, prop) in &conf {
-            // ignore all INI section lines (treat them as comments)
-            for (key, value) in prop.iter() {
-                env::set_var(key, value);
+        for (_, prop) in &conf {
+            // ignore all INI section lines (treat them as comments)
+            for (key, value) in prop.iter() {
+                env::set_var(key, value);
             }
         }
     }
@@ -475,175 +475,175 @@ A mere - implies -i. If no COMMAND, print the resulting environment.
     Ok(())
 }
 
-#[cfg(not(windows))]
-#[allow(clippy::ptr_arg)]
-fn build_command<'a, 'b>(args: &'a mut Vec<&'b str>) -> (Cow<'b, str>, &'a [&'b str]) {
-    let progname = Cow::from(args[0]);
-    (progname, &args[1..])
+#[cfg(not(windows))]
+#[allow(clippy::ptr_arg)]
+fn build_command<'a, 'b>(args: &'a mut Vec<&'b str>) -> (Cow<'b, str>, &'a [&'b str]) {
+    let progname = Cow::from(args[0]);
+    (progname, &args[1..])
 }
 
-#[cfg(windows)]
-fn build_command<'a, 'b>(args: &'a mut Vec<&'b str>) -> (Cow<'b, str>, &'a [&'b str]) {
-    args.insert(0, "/d/c");
-    let progname = env::var("ComSpec")
-        .map(Cow::from)
-        .unwrap_or_else(|_| Cow::from("cmd"));
+#[cfg(windows)]
+fn build_command<'a, 'b>(args: &'a mut Vec<&'b str>) -> (Cow<'b, str>, &'a [&'b str]) {
+    args.insert(0, "/d/c");
+    let progname = env::var("ComSpec")
+        .map(Cow::from)
+        .unwrap_or_else(|_| Cow::from("cmd"));
 
-    (progname, &args[..])
+    (progname, &args[..])
 }
 
-pub fn uu_app() -> Command {
-    Command::new(crate_name!())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .after_help(AFTER_HELP)
-        .infer_long_args(true)
-        .trailing_var_arg(true)
-        .arg(
-            Arg::new("ignore-environment")
-                .short('i')
-                .long("ignore-environment")
-                .help("start with an empty environment")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(crate_name!())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .after_help(AFTER_HELP)
+        .infer_long_args(true)
+        .trailing_var_arg(true)
+        .arg(
+            Arg::new("ignore-environment")
+                .short('i')
+                .long("ignore-environment")
+                .help("start with an empty environment")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("chdir")
-                .short('C') // GNU env compatibility
-                .long("chdir")
-                .number_of_values(1)
-                .value_name("DIR")
-                .value_hint(clap::ValueHint::DirPath)
-                .help("change working directory to DIR"),
+        .arg(
+            Arg::new("chdir")
+                .short('C') // GNU env compatibility
+                .long("chdir")
+                .number_of_values(1)
+                .value_name("DIR")
+                .value_hint(clap::ValueHint::DirPath)
+                .help("change working directory to DIR"),
         )
-        .arg(
-            Arg::new("null")
-                .short('0')
-                .long("null")
-                .help(
+        .arg(
+            Arg::new("null")
+                .short('0')
+                .long("null")
+                .help(
                     "end each output line with a 0 byte rather than a newline (only \
                 valid when printing the environment)",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("file")
-                .short('f')
-                .long("file")
-                .value_name("PATH")
-                .value_hint(clap::ValueHint::FilePath)
-                .action(ArgAction::Append)
-                .help(
+        .arg(
+            Arg::new("file")
+                .short('f')
+                .long("file")
+                .value_name("PATH")
+                .value_hint(clap::ValueHint::FilePath)
+                .action(ArgAction::Append)
+                .help(
                     "read and set variables from a \".env\"-style configuration file \
                 (prior to any unset and/or set)",
                 ),
         )
-        .arg(
-            Arg::new("unset")
-                .short('u')
-                .long("unset")
-                .value_name("NAME")
-                .action(ArgAction::Append)
-                .help("remove variable from the environment"),
+        .arg(
+            Arg::new("unset")
+                .short('u')
+                .long("unset")
+                .value_name("NAME")
+                .action(ArgAction::Append)
+                .help("remove variable from the environment"),
         )
-        .arg(Arg::new("vars").action(ArgAction::Append))
+        .arg(Arg::new("vars").action(ArgAction::Append))
 }
 
-fn run_env(args: impl uucore::Args) -> UResult<()> {
-    let app = uu_app();
-    let matches = app.try_get_matches_from(args).with_exit_code(125)?;
+fn run_env(args: impl uucore::Args) -> UResult<()> {
+    let app = uu_app();
+    let matches = app.try_get_matches_from(args).with_exit_code(125)?;
 
-    let ignore_env = matches.get_flag("ignore-environment");
-    let null = matches.get_flag("null");
-    let running_directory = matches.get_one::<String>("chdir").map(|s| s.as_str());
-    let files = match matches.get_many::<String>("file") {
-        Some(v) => v.map(|s| s.as_str()).collect(),
-        None => Vec::with_capacity(0),
+    let ignore_env = matches.get_flag("ignore-environment");
+    let null = matches.get_flag("null");
+    let running_directory = matches.get_one::<String>("chdir").map(|s| s.as_str());
+    let files = match matches.get_many::<String>("file") {
+        Some(v) => v.map(|s| s.as_str()).collect(),
+        None => Vec::with_capacity(0),
     };
-    let unsets = match matches.get_many::<String>("unset") {
-        Some(v) => v.map(|s| s.as_str()).collect(),
-        None => Vec::with_capacity(0),
+    let unsets = match matches.get_many::<String>("unset") {
+        Some(v) => v.map(|s| s.as_str()).collect(),
+        None => Vec::with_capacity(0),
     };
 
-    let mut opts = Options {
-        ignore_env,
-        null,
-        running_directory,
-        files,
-        unsets,
-        sets: vec![],
-        program: vec![],
+    let mut opts = Options {
+        ignore_env,
+        null,
+        running_directory,
+        files,
+        unsets,
+        sets: vec![],
+        program: vec![],
     };
 
-    // change directory
-    if let Some(d) = opts.running_directory {
-        match env::set_current_dir(d) {
-            Ok(()) => d,
-            Err(error) => {
-                return Err(USimpleError::new(
+    // change directory
+    if let Some(d) = opts.running_directory {
+        match env::set_current_dir(d) {
+            Ok(()) => d,
+            Err(error) => {
+                return Err(USimpleError::new(
                     125,
-                    format!("cannot change directory to \"{}\": {}", d, error),
+                    format!("cannot change directory to \"{}\": {}", d, error),
                 ));
             }
         };
     }
 
-    let mut begin_prog_opts = false;
-    if let Some(mut iter) = matches.get_many::<String>("vars") {
-        // read NAME=VALUE arguments (and up to a single program argument)
-        while !begin_prog_opts {
-            if let Some(opt) = iter.next() {
-                if opt == "-" {
-                    opts.ignore_env = true;
-                } else {
-                    begin_prog_opts = parse_name_value_opt(&mut opts, opt)?;
+    let mut begin_prog_opts = false;
+    if let Some(mut iter) = matches.get_many::<String>("vars") {
+        // read NAME=VALUE arguments (and up to a single program argument)
+        while !begin_prog_opts {
+            if let Some(opt) = iter.next() {
+                if opt == "-" {
+                    opts.ignore_env = true;
+                } else {
+                    begin_prog_opts = parse_name_value_opt(&mut opts, opt)?;
                 }
-            } else {
+            } else {
                 break;
             }
         }
 
-        // read any leftover program arguments
-        for opt in iter {
-            parse_program_opt(&mut opts, opt)?;
+        // read any leftover program arguments
+        for opt in iter {
+            parse_program_opt(&mut opts, opt)?;
         }
     }
 
-    // GNU env tests this behavior
-    if opts.program.is_empty() && running_directory.is_some() {
-        return Err(UUsageError::new(
+    // GNU env tests this behavior
+    if opts.program.is_empty() && running_directory.is_some() {
+        return Err(UUsageError::new(
             125,
-            "must specify command with --chdir (-C)".to_string(),
+            "must specify command with --chdir (-C)".to_string(),
         ));
     }
 
-    // NOTE: we manually set and unset the env vars below rather than using Command::env() to more
-    //       easily handle the case where no command is given
+    // NOTE: we manually set and unset the env vars below rather than using Command::env() to more
+    //       easily handle the case where no command is given
 
-    // remove all env vars if told to ignore presets
-    if opts.ignore_env {
-        for (ref name, _) in env::vars() {
-            env::remove_var(name);
+    // remove all env vars if told to ignore presets
+    if opts.ignore_env {
+        for (ref name, _) in env::vars() {
+            env::remove_var(name);
         }
     }
 
-    // load .env-style config file prior to those given on the command-line
-    load_config_file(&mut opts)?;
+    // load .env-style config file prior to those given on the command-line
+    load_config_file(&mut opts)?;
 
-    // unset specified env vars
-    for name in &opts.unsets {
-        if name.is_empty() || name.contains(0 as char) || name.contains('=') {
-            return Err(USimpleError::new(
+    // unset specified env vars
+    for name in &opts.unsets {
+        if name.is_empty() || name.contains(0 as char) || name.contains('=') {
+            return Err(USimpleError::new(
                 125,
-                format!("cannot unset {}: Invalid argument", name.quote()),
+                format!("cannot unset {}: Invalid argument", name.quote()),
             ));
         }
 
-        env::remove_var(name);
+        env::remove_var(name);
     }
 
-    // set specified env vars
-    for &(name, val) in &opts.sets {
+    // set specified env vars
+    for &(name, val) in &opts.sets {
         /*
          * set_var panics if name is an empty string
          * set_var internally calls setenv (on unix at least), while GNU env calls putenv instead.
@@ -664,71 +664,71 @@ A mere - implies -i. If no COMMAND, print the resulting environment.
          *
          * There is no benefit in replicating GNU's env behavior, since it will only modify the
          * environment in weird ways
-         */
+         */
 
-        if name.is_empty() {
-            show_warning!("no name specified for value {}", val.quote());
+        if name.is_empty() {
+            show_warning!("no name specified for value {}", val.quote());
             continue;
         }
-        env::set_var(name, val);
+        env::set_var(name, val);
     }
 
-    if !opts.program.is_empty() {
-        // we need to execute a command
-        let (prog, args) = build_command(&mut opts.program);
+    if !opts.program.is_empty() {
+        // we need to execute a command
+        let (prog, args) = build_command(&mut opts.program);
 
         /*
          * On Unix-like systems Command::status either ends up calling either fork or posix_spawnp
          * (which ends up calling clone). Keep using the current process would be ideal, but the
          * standard library contains many checks and fail-safes to ensure the process ends up being
          * created. This is much simpler than dealing with the hassles of calling execvp directly.
-         */
-        match process::Command::new(&*prog).args(args).status() {
-            Ok(exit) if !exit.success() => {
-                #[cfg(unix)]
-                if let Some(exit_code) = exit.code() {
-                    return Err(exit_code.into());
-                } else {
-                    // `exit.code()` returns `None` on Unix when the process is terminated by a signal.
-                    // See std::os::unix::process::ExitStatusExt for more information. This prints out
-                    // the interrupted process and the signal it received.
-                    let signal_code = exit.signal().unwrap();
-                    let signal = Signal::try_from(signal_code).unwrap();
+         */
+        match process::Command::new(&*prog).args(args).status() {
+            Ok(exit) if !exit.success() => {
+                #[cfg(unix)]
+                if let Some(exit_code) = exit.code() {
+                    return Err(exit_code.into());
+                } else {
+                    // `exit.code()` returns `None` on Unix when the process is terminated by a signal.
+                    // See std::os::unix::process::ExitStatusExt for more information. This prints out
+                    // the interrupted process and the signal it received.
+                    let signal_code = exit.signal().unwrap();
+                    let signal = Signal::try_from(signal_code).unwrap();
 
-                    // We have to disable any handler that's installed by default.
-                    // This ensures that we exit on this signal.
-                    // For example, `SIGSEGV` and `SIGBUS` have default handlers installed in Rust.
-                    // We ignore the errors because there is not much we can do if that fails anyway.
-                    // SAFETY: The function is unsafe because installing functions is unsafe, but we are
-                    // just defaulting to default behavior and not installing a function. Hence, the call
-                    // is safe.
-                    let _ = unsafe {
-                        sigaction(
-                            signal,
-                            &SigAction::new(SigHandler::SigDfl, SaFlags::empty(), SigSet::all()),
+                    // We have to disable any handler that's installed by default.
+                    // This ensures that we exit on this signal.
+                    // For example, `SIGSEGV` and `SIGBUS` have default handlers installed in Rust.
+                    // We ignore the errors because there is not much we can do if that fails anyway.
+                    // SAFETY: The function is unsafe because installing functions is unsafe, but we are
+                    // just defaulting to default behavior and not installing a function. Hence, the call
+                    // is safe.
+                    let _ = unsafe {
+                        sigaction(
+                            signal,
+                            &SigAction::new(SigHandler::SigDfl, SaFlags::empty(), SigSet::all()),
                         )
                     };
 
-                    let _ = raise(signal);
+                    let _ = raise(signal);
                 }
-                #[cfg(not(unix))]
-                return Err(exit.code().unwrap().into());
+                #[cfg(not(unix))]
+                return Err(exit.code().unwrap().into());
             }
-            Err(ref err) if err.kind() == io::ErrorKind::NotFound => return Err(127.into()),
-            Err(_) => return Err(126.into()),
+            Err(ref err) if err.kind() == io::ErrorKind::NotFound => return Err(127.into()),
+            Err(_) => return Err(126.into()),
             Ok(_) => (),
         }
-    } else {
-        // no program provided, so just dump all env vars to stdout
-        print_env(opts.null);
+    } else {
+        // no program provided, so just dump all env vars to stdout
+        print_env(opts.null);
     }
 
     Ok(())
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    run_env(args)
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    run_env(args)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_expand/expand.rs.html b/dev/src/uu_expand/expand.rs.html index 4ad49f1f3..4ef1a73eb 100644 --- a/dev/src/uu_expand/expand.rs.html +++ b/dev/src/uu_expand/expand.rs.html @@ -1,4 +1,4 @@ -expand.rs - source
1
+expand.rs - source
1
 2
 3
 4
@@ -508,190 +508,190 @@
 508
 509
 510
-
// This file is part of the uutils coreutils package.
-//
-// (c) Virgile Andreani <virgile.andreani@anbuco.fr>
-// (c) kwantam <kwantam@gmail.com>
-//     * 2015-04-28 ~ updated to work with both UTF-8 and non-UTF-8 encodings
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Virgile Andreani <virgile.andreani@anbuco.fr>
+// (c) kwantam <kwantam@gmail.com>
+//     * 2015-04-28 ~ updated to work with both UTF-8 and non-UTF-8 encodings
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) ctype cwidth iflag nbytes nspaces nums tspaces uflag Preprocess
+// spell-checker:ignore (ToDO) ctype cwidth iflag nbytes nspaces nums tspaces uflag Preprocess
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use std::error::Error;
-use std::fmt;
-use std::fs::File;
-use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
-use std::num::IntErrorKind;
-use std::str::from_utf8;
-use unicode_width::UnicodeWidthChar;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UError, UResult};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use std::error::Error;
+use std::fmt;
+use std::fs::File;
+use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
+use std::num::IntErrorKind;
+use std::str::from_utf8;
+use unicode_width::UnicodeWidthChar;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UError, UResult};
+use uucore::format_usage;
 
-static ABOUT: &str = "Convert tabs in each FILE to spaces, writing to standard output.
+static ABOUT: &str = "Convert tabs in each FILE to spaces, writing to standard output.
  With no FILE, or when FILE is -, read standard input.";
-const USAGE: &str = "{} [OPTION]... [FILE]...";
+const USAGE: &str = "{} [OPTION]... [FILE]...";
 
-pub mod options {
-    pub static TABS: &str = "tabs";
-    pub static INITIAL: &str = "initial";
-    pub static NO_UTF8: &str = "no-utf8";
-    pub static FILES: &str = "FILES";
+pub mod options {
+    pub static TABS: &str = "tabs";
+    pub static INITIAL: &str = "initial";
+    pub static NO_UTF8: &str = "no-utf8";
+    pub static FILES: &str = "FILES";
 }
 
-static LONG_HELP: &str = "";
+static LONG_HELP: &str = "";
 
-static DEFAULT_TABSTOP: usize = 8;
+static DEFAULT_TABSTOP: usize = 8;
 
-/// The mode to use when replacing tabs beyond the last one specified in
-/// the `--tabs` argument.
-#[derive(PartialEq)]
-enum RemainingMode {
+/// The mode to use when replacing tabs beyond the last one specified in
+/// the `--tabs` argument.
+#[derive(PartialEq)]
+enum RemainingMode {
     None,
-    Slash,
-    Plus,
+    Slash,
+    Plus,
 }
 
-/// Decide whether the character is either a space or a comma.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// assert!(is_space_or_comma(' '))
-/// assert!(is_space_or_comma(','))
-/// assert!(!is_space_or_comma('a'))
-/// ```
-fn is_space_or_comma(c: char) -> bool {
-    c == ' ' || c == ','
+/// Decide whether the character is either a space or a comma.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// assert!(is_space_or_comma(' '))
+/// assert!(is_space_or_comma(','))
+/// assert!(!is_space_or_comma('a'))
+/// ```
+fn is_space_or_comma(c: char) -> bool {
+    c == ' ' || c == ','
+}
+
+/// Decide whether the character is either a digit or a comma.
+fn is_digit_or_comma(c: char) -> bool {
+    c.is_ascii_digit() || c == ','
+}
+
+/// Errors that can occur when parsing a `--tabs` argument.
+#[derive(Debug)]
+enum ParseError {
+    InvalidCharacter(String),
+    SpecifierNotAtStartOfNumber(String, String),
+    SpecifierOnlyAllowedWithLastValue(String),
+    TabSizeCannotBeZero,
+    TabSizeTooLarge(String),
+    TabSizesMustBeAscending,
 }
 
-/// Decide whether the character is either a digit or a comma.
-fn is_digit_or_comma(c: char) -> bool {
-    c.is_ascii_digit() || c == ','
-}
+impl Error for ParseError {}
+impl UError for ParseError {}
 
-/// Errors that can occur when parsing a `--tabs` argument.
-#[derive(Debug)]
-enum ParseError {
-    InvalidCharacter(String),
-    SpecifierNotAtStartOfNumber(String, String),
-    SpecifierOnlyAllowedWithLastValue(String),
-    TabSizeCannotBeZero,
-    TabSizeTooLarge(String),
-    TabSizesMustBeAscending,
-}
-
-impl Error for ParseError {}
-impl UError for ParseError {}
-
-impl fmt::Display for ParseError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match self {
-            Self::InvalidCharacter(s) => {
-                write!(f, "tab size contains invalid character(s): {}", s.quote())
+impl fmt::Display for ParseError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            Self::InvalidCharacter(s) => {
+                write!(f, "tab size contains invalid character(s): {}", s.quote())
             }
-            Self::SpecifierNotAtStartOfNumber(specifier, s) => write!(
-                f,
+            Self::SpecifierNotAtStartOfNumber(specifier, s) => write!(
+                f,
                 "{} specifier not at start of number: {}",
-                specifier.quote(),
-                s.quote(),
+                specifier.quote(),
+                s.quote(),
             ),
-            Self::SpecifierOnlyAllowedWithLastValue(specifier) => write!(
-                f,
+            Self::SpecifierOnlyAllowedWithLastValue(specifier) => write!(
+                f,
                 "{} specifier only allowed with the last value",
-                specifier.quote()
+                specifier.quote()
             ),
-            Self::TabSizeCannotBeZero => write!(f, "tab size cannot be 0"),
-            Self::TabSizeTooLarge(s) => write!(f, "tab stop is too large {}", s.quote()),
-            Self::TabSizesMustBeAscending => write!(f, "tab sizes must be ascending"),
+            Self::TabSizeCannotBeZero => write!(f, "tab size cannot be 0"),
+            Self::TabSizeTooLarge(s) => write!(f, "tab stop is too large {}", s.quote()),
+            Self::TabSizesMustBeAscending => write!(f, "tab sizes must be ascending"),
         }
     }
 }
 
-/// Parse a list of tabstops from a `--tabs` argument.
-///
-/// This function returns both the vector of numbers appearing in the
-/// comma- or space-separated list, and also an optional mode, specified
-/// by either a "/" or a "+" character appearing before the final number
-/// in the list. This mode defines the strategy to use for computing the
-/// number of spaces to use for columns beyond the end of the tab stop
-/// list specified here.
-fn tabstops_parse(s: &str) -> Result<(RemainingMode, Vec<usize>), ParseError> {
-    // Leading commas and spaces are ignored.
-    let s = s.trim_start_matches(is_space_or_comma);
+/// Parse a list of tabstops from a `--tabs` argument.
+///
+/// This function returns both the vector of numbers appearing in the
+/// comma- or space-separated list, and also an optional mode, specified
+/// by either a "/" or a "+" character appearing before the final number
+/// in the list. This mode defines the strategy to use for computing the
+/// number of spaces to use for columns beyond the end of the tab stop
+/// list specified here.
+fn tabstops_parse(s: &str) -> Result<(RemainingMode, Vec<usize>), ParseError> {
+    // Leading commas and spaces are ignored.
+    let s = s.trim_start_matches(is_space_or_comma);
 
-    // If there were only commas and spaces in the string, just use the
-    // default tabstops.
-    if s.is_empty() {
-        return Ok((RemainingMode::None, vec![DEFAULT_TABSTOP]));
+    // If there were only commas and spaces in the string, just use the
+    // default tabstops.
+    if s.is_empty() {
+        return Ok((RemainingMode::None, vec![DEFAULT_TABSTOP]));
     }
 
-    let mut nums = vec![];
-    let mut remaining_mode = RemainingMode::None;
-    let mut is_specifier_already_used = false;
-    for word in s.split(is_space_or_comma) {
-        let bytes = word.as_bytes();
-        for i in 0..bytes.len() {
-            match bytes[i] {
-                b'+' => {
-                    remaining_mode = RemainingMode::Plus;
+    let mut nums = vec![];
+    let mut remaining_mode = RemainingMode::None;
+    let mut is_specifier_already_used = false;
+    for word in s.split(is_space_or_comma) {
+        let bytes = word.as_bytes();
+        for i in 0..bytes.len() {
+            match bytes[i] {
+                b'+' => {
+                    remaining_mode = RemainingMode::Plus;
                 }
-                b'/' => {
-                    remaining_mode = RemainingMode::Slash;
+                b'/' => {
+                    remaining_mode = RemainingMode::Slash;
                 }
-                _ => {
-                    // Parse a number from the byte sequence.
-                    let s = from_utf8(&bytes[i..]).unwrap();
-                    match s.parse::<usize>() {
-                        Ok(num) => {
-                            // Tab size must be positive.
-                            if num == 0 {
-                                return Err(ParseError::TabSizeCannotBeZero);
+                _ => {
+                    // Parse a number from the byte sequence.
+                    let s = from_utf8(&bytes[i..]).unwrap();
+                    match s.parse::<usize>() {
+                        Ok(num) => {
+                            // Tab size must be positive.
+                            if num == 0 {
+                                return Err(ParseError::TabSizeCannotBeZero);
                             }
 
-                            // Tab sizes must be ascending.
-                            if let Some(last_stop) = nums.last() {
-                                if *last_stop >= num {
-                                    return Err(ParseError::TabSizesMustBeAscending);
+                            // Tab sizes must be ascending.
+                            if let Some(last_stop) = nums.last() {
+                                if *last_stop >= num {
+                                    return Err(ParseError::TabSizesMustBeAscending);
                                 }
                             }
 
-                            if is_specifier_already_used {
-                                let specifier = if remaining_mode == RemainingMode::Slash {
-                                    "/".to_string()
-                                } else {
-                                    "+".to_string()
+                            if is_specifier_already_used {
+                                let specifier = if remaining_mode == RemainingMode::Slash {
+                                    "/".to_string()
+                                } else {
+                                    "+".to_string()
                                 };
-                                return Err(ParseError::SpecifierOnlyAllowedWithLastValue(
-                                    specifier,
+                                return Err(ParseError::SpecifierOnlyAllowedWithLastValue(
+                                    specifier,
                                 ));
-                            } else if remaining_mode != RemainingMode::None {
-                                is_specifier_already_used = true;
+                            } else if remaining_mode != RemainingMode::None {
+                                is_specifier_already_used = true;
                             }
 
-                            // Append this tab stop to the list of all tabstops.
-                            nums.push(num);
+                            // Append this tab stop to the list of all tabstops.
+                            nums.push(num);
                             break;
                         }
-                        Err(e) => {
-                            if *e.kind() == IntErrorKind::PosOverflow {
-                                return Err(ParseError::TabSizeTooLarge(s.to_string()));
+                        Err(e) => {
+                            if *e.kind() == IntErrorKind::PosOverflow {
+                                return Err(ParseError::TabSizeTooLarge(s.to_string()));
                             }
 
-                            let s = s.trim_start_matches(char::is_numeric);
-                            if s.starts_with('/') || s.starts_with('+') {
-                                return Err(ParseError::SpecifierNotAtStartOfNumber(
-                                    s[0..1].to_string(),
-                                    s.to_string(),
+                            let s = s.trim_start_matches(char::is_numeric);
+                            if s.starts_with('/') || s.starts_with('+') {
+                                return Err(ParseError::SpecifierNotAtStartOfNumber(
+                                    s[0..1].to_string(),
+                                    s.to_string(),
                                 ));
-                            } else {
-                                return Err(ParseError::InvalidCharacter(s.to_string()));
+                            } else {
+                                return Err(ParseError::InvalidCharacter(s.to_string()));
                             }
                         }
                     }
@@ -699,324 +699,324 @@
             }
         }
     }
-    // If no numbers could be parsed (for example, if `s` were "+,+,+"),
-    // then just use the default tabstops.
-    if nums.is_empty() {
-        nums = vec![DEFAULT_TABSTOP];
+    // If no numbers could be parsed (for example, if `s` were "+,+,+"),
+    // then just use the default tabstops.
+    if nums.is_empty() {
+        nums = vec![DEFAULT_TABSTOP];
     }
-    Ok((remaining_mode, nums))
+    Ok((remaining_mode, nums))
 }
 
-struct Options {
-    files: Vec<String>,
-    tabstops: Vec<usize>,
-    tspaces: String,
-    iflag: bool,
-    uflag: bool,
+struct Options {
+    files: Vec<String>,
+    tabstops: Vec<usize>,
+    tspaces: String,
+    iflag: bool,
+    uflag: bool,
 
-    /// Strategy for expanding tabs for columns beyond those specified
-    /// in `tabstops`.
-    remaining_mode: RemainingMode,
+    /// Strategy for expanding tabs for columns beyond those specified
+    /// in `tabstops`.
+    remaining_mode: RemainingMode,
 }
 
-impl Options {
-    fn new(matches: &ArgMatches) -> Result<Self, ParseError> {
-        let (remaining_mode, tabstops) = match matches.get_many::<String>(options::TABS) {
-            Some(s) => tabstops_parse(&s.map(|s| s.as_str()).collect::<Vec<_>>().join(","))?,
-            None => (RemainingMode::None, vec![DEFAULT_TABSTOP]),
+impl Options {
+    fn new(matches: &ArgMatches) -> Result<Self, ParseError> {
+        let (remaining_mode, tabstops) = match matches.get_many::<String>(options::TABS) {
+            Some(s) => tabstops_parse(&s.map(|s| s.as_str()).collect::<Vec<_>>().join(","))?,
+            None => (RemainingMode::None, vec![DEFAULT_TABSTOP]),
         };
 
-        let iflag = matches.get_flag(options::INITIAL);
-        let uflag = !matches.get_flag(options::NO_UTF8);
+        let iflag = matches.get_flag(options::INITIAL);
+        let uflag = !matches.get_flag(options::NO_UTF8);
 
-        // avoid allocations when dumping out long sequences of spaces
-        // by precomputing the longest string of spaces we will ever need
-        let nspaces = tabstops
-            .iter()
-            .scan(0, |pr, &it| {
-                let ret = Some(it - *pr);
-                *pr = it;
-                ret
+        // avoid allocations when dumping out long sequences of spaces
+        // by precomputing the longest string of spaces we will ever need
+        let nspaces = tabstops
+            .iter()
+            .scan(0, |pr, &it| {
+                let ret = Some(it - *pr);
+                *pr = it;
+                ret
             })
-            .max()
-            .unwrap(); // length of tabstops is guaranteed >= 1
-        let tspaces = " ".repeat(nspaces);
+            .max()
+            .unwrap(); // length of tabstops is guaranteed >= 1
+        let tspaces = " ".repeat(nspaces);
 
-        let files: Vec<String> = match matches.get_many::<String>(options::FILES) {
-            Some(s) => s.map(|v| v.to_string()).collect(),
-            None => vec!["-".to_owned()],
+        let files: Vec<String> = match matches.get_many::<String>(options::FILES) {
+            Some(s) => s.map(|v| v.to_string()).collect(),
+            None => vec!["-".to_owned()],
         };
 
-        Ok(Self {
-            files,
-            tabstops,
-            tspaces,
-            iflag,
-            uflag,
-            remaining_mode,
+        Ok(Self {
+            files,
+            tabstops,
+            tspaces,
+            iflag,
+            uflag,
+            remaining_mode,
         })
     }
 }
 
-/// Preprocess command line arguments and expand shortcuts. For example, "-7" is expanded to
-/// "--tabs=7" and "-1,3" to "--tabs=1 --tabs=3".
-fn expand_shortcuts(args: &[String]) -> Vec<String> {
-    let mut processed_args = Vec::with_capacity(args.len());
+/// Preprocess command line arguments and expand shortcuts. For example, "-7" is expanded to
+/// "--tabs=7" and "-1,3" to "--tabs=1 --tabs=3".
+fn expand_shortcuts(args: &[String]) -> Vec<String> {
+    let mut processed_args = Vec::with_capacity(args.len());
 
-    for arg in args {
-        if arg.starts_with('-') && arg[1..].chars().all(is_digit_or_comma) {
-            arg[1..]
-                .split(',')
-                .filter(|s| !s.is_empty())
-                .for_each(|s| processed_args.push(format!("--tabs={}", s)));
-        } else {
-            processed_args.push(arg.to_string());
+    for arg in args {
+        if arg.starts_with('-') && arg[1..].chars().all(is_digit_or_comma) {
+            arg[1..]
+                .split(',')
+                .filter(|s| !s.is_empty())
+                .for_each(|s| processed_args.push(format!("--tabs={}", s)));
+        } else {
+            processed_args.push(arg.to_string());
         }
     }
 
-    processed_args
+    processed_args
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(expand_shortcuts(&args))?;
+    let matches = uu_app().try_get_matches_from(expand_shortcuts(&args))?;
 
-    expand(&Options::new(&matches)?).map_err_context(|| "failed to write output".to_string())
+    expand(&Options::new(&matches)?).map_err_context(|| "failed to write output".to_string())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(LONG_HELP)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::INITIAL)
-                .long(options::INITIAL)
-                .short('i')
-                .help("do not convert tabs after non blanks")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(LONG_HELP)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::INITIAL)
+                .long(options::INITIAL)
+                .short('i')
+                .help("do not convert tabs after non blanks")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::TABS)
-                .long(options::TABS)
-                .short('t')
-                .value_name("N, LIST")
-                .action(ArgAction::Append)
-                .help(
+        .arg(
+            Arg::new(options::TABS)
+                .long(options::TABS)
+                .short('t')
+                .value_name("N, LIST")
+                .action(ArgAction::Append)
+                .help(
                     "have tabs N characters apart, not 8 or use comma separated list \
                     of explicit tab positions",
                 ),
         )
-        .arg(
-            Arg::new(options::NO_UTF8)
-                .long(options::NO_UTF8)
-                .short('U')
-                .help("interpret input file as 8-bit ASCII rather than UTF-8")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_UTF8)
+                .long(options::NO_UTF8)
+                .short('U')
+                .help("interpret input file as 8-bit ASCII rather than UTF-8")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILES)
-                .action(ArgAction::Append)
-                .hide(true)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILES)
+                .action(ArgAction::Append)
+                .hide(true)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-fn open(path: &str) -> BufReader<Box<dyn Read + 'static>> {
-    let file_buf;
-    if path == "-" {
-        BufReader::new(Box::new(stdin()) as Box<dyn Read>)
-    } else {
-        file_buf = match File::open(path) {
-            Ok(a) => a,
-            Err(e) => crash!(1, "{}: {}\n", path.maybe_quote(), e),
+fn open(path: &str) -> BufReader<Box<dyn Read + 'static>> {
+    let file_buf;
+    if path == "-" {
+        BufReader::new(Box::new(stdin()) as Box<dyn Read>)
+    } else {
+        file_buf = match File::open(path) {
+            Ok(a) => a,
+            Err(e) => crash!(1, "{}: {}\n", path.maybe_quote(), e),
         };
-        BufReader::new(Box::new(file_buf) as Box<dyn Read>)
+        BufReader::new(Box::new(file_buf) as Box<dyn Read>)
     }
 }
 
-/// Compute the number of spaces to the next tabstop.
-///
-/// `tabstops` is the sequence of tabstop locations.
-///
-/// `col` is the index of the current cursor in the line being written.
-///
-/// If `remaining_mode` is [`RemainingMode::Plus`], then the last entry
-/// in the `tabstops` slice is interpreted as a relative number of
-/// spaces, which this function will return for every input value of
-/// `col` beyond the end of the second-to-last element of `tabstops`.
-///
-/// If `remaining_mode` is [`RemainingMode::Plus`], then the last entry
-/// in the `tabstops` slice is interpreted as a relative number of
-/// spaces, which this function will return for every input value of
-/// `col` beyond the end of the second-to-last element of `tabstops`.
-fn next_tabstop(tabstops: &[usize], col: usize, remaining_mode: &RemainingMode) -> usize {
-    let num_tabstops = tabstops.len();
-    match remaining_mode {
-        RemainingMode::Plus => match tabstops[0..num_tabstops - 1].iter().find(|&&t| t > col) {
-            Some(t) => t - col,
-            None => tabstops[num_tabstops - 1] - 1,
+/// Compute the number of spaces to the next tabstop.
+///
+/// `tabstops` is the sequence of tabstop locations.
+///
+/// `col` is the index of the current cursor in the line being written.
+///
+/// If `remaining_mode` is [`RemainingMode::Plus`], then the last entry
+/// in the `tabstops` slice is interpreted as a relative number of
+/// spaces, which this function will return for every input value of
+/// `col` beyond the end of the second-to-last element of `tabstops`.
+///
+/// If `remaining_mode` is [`RemainingMode::Plus`], then the last entry
+/// in the `tabstops` slice is interpreted as a relative number of
+/// spaces, which this function will return for every input value of
+/// `col` beyond the end of the second-to-last element of `tabstops`.
+fn next_tabstop(tabstops: &[usize], col: usize, remaining_mode: &RemainingMode) -> usize {
+    let num_tabstops = tabstops.len();
+    match remaining_mode {
+        RemainingMode::Plus => match tabstops[0..num_tabstops - 1].iter().find(|&&t| t > col) {
+            Some(t) => t - col,
+            None => tabstops[num_tabstops - 1] - 1,
         },
-        RemainingMode::Slash => match tabstops[0..num_tabstops - 1].iter().find(|&&t| t > col) {
-            Some(t) => t - col,
-            None => tabstops[num_tabstops - 1] - col % tabstops[num_tabstops - 1],
+        RemainingMode::Slash => match tabstops[0..num_tabstops - 1].iter().find(|&&t| t > col) {
+            Some(t) => t - col,
+            None => tabstops[num_tabstops - 1] - col % tabstops[num_tabstops - 1],
         },
-        RemainingMode::None => {
-            if num_tabstops == 1 {
-                tabstops[0] - col % tabstops[0]
-            } else {
-                match tabstops.iter().find(|&&t| t > col) {
-                    Some(t) => t - col,
-                    None => 1,
+        RemainingMode::None => {
+            if num_tabstops == 1 {
+                tabstops[0] - col % tabstops[0]
+            } else {
+                match tabstops.iter().find(|&&t| t > col) {
+                    Some(t) => t - col,
+                    None => 1,
                 }
             }
         }
     }
 }
 
-#[derive(PartialEq, Eq, Debug)]
-enum CharType {
-    Backspace,
-    Tab,
-    Other,
+#[derive(PartialEq, Eq, Debug)]
+enum CharType {
+    Backspace,
+    Tab,
+    Other,
 }
 
-fn expand(options: &Options) -> std::io::Result<()> {
-    use self::CharType::*;
+fn expand(options: &Options) -> std::io::Result<()> {
+    use self::CharType::*;
 
-    let mut output = BufWriter::new(stdout());
-    let ts = options.tabstops.as_ref();
-    let mut buf = Vec::new();
+    let mut output = BufWriter::new(stdout());
+    let ts = options.tabstops.as_ref();
+    let mut buf = Vec::new();
 
-    for file in &options.files {
-        let mut fh = open(file);
+    for file in &options.files {
+        let mut fh = open(file);
 
-        while match fh.read_until(b'\n', &mut buf) {
-            Ok(s) => s > 0,
-            Err(_) => buf.is_empty(),
+        while match fh.read_until(b'\n', &mut buf) {
+            Ok(s) => s > 0,
+            Err(_) => buf.is_empty(),
         } {
-            let mut col = 0;
-            let mut byte = 0;
-            let mut init = true;
+            let mut col = 0;
+            let mut byte = 0;
+            let mut init = true;
 
-            while byte < buf.len() {
-                let (ctype, cwidth, nbytes) = if options.uflag {
-                    let nbytes = char::from(buf[byte]).len_utf8();
+            while byte < buf.len() {
+                let (ctype, cwidth, nbytes) = if options.uflag {
+                    let nbytes = char::from(buf[byte]).len_utf8();
 
-                    if byte + nbytes > buf.len() {
-                        // don't overrun buffer because of invalid UTF-8
-                        (Other, 1, 1)
-                    } else if let Ok(t) = from_utf8(&buf[byte..byte + nbytes]) {
-                        match t.chars().next() {
-                            Some('\t') => (Tab, 0, nbytes),
-                            Some('\x08') => (Backspace, 0, nbytes),
-                            Some(c) => (Other, UnicodeWidthChar::width(c).unwrap_or(0), nbytes),
-                            None => {
-                                // no valid char at start of t, so take 1 byte
-                                (Other, 1, 1)
+                    if byte + nbytes > buf.len() {
+                        // don't overrun buffer because of invalid UTF-8
+                        (Other, 1, 1)
+                    } else if let Ok(t) = from_utf8(&buf[byte..byte + nbytes]) {
+                        match t.chars().next() {
+                            Some('\t') => (Tab, 0, nbytes),
+                            Some('\x08') => (Backspace, 0, nbytes),
+                            Some(c) => (Other, UnicodeWidthChar::width(c).unwrap_or(0), nbytes),
+                            None => {
+                                // no valid char at start of t, so take 1 byte
+                                (Other, 1, 1)
                             }
                         }
-                    } else {
-                        (Other, 1, 1) // implicit assumption: non-UTF-8 char is 1 col wide
-                    }
-                } else {
+                    } else {
+                        (Other, 1, 1) // implicit assumption: non-UTF-8 char is 1 col wide
+                    }
+                } else {
                     (
-                        match buf[byte] {
-                            // always take exactly 1 byte in strict ASCII mode
-                            0x09 => Tab,
-                            0x08 => Backspace,
-                            _ => Other,
+                        match buf[byte] {
+                            // always take exactly 1 byte in strict ASCII mode
+                            0x09 => Tab,
+                            0x08 => Backspace,
+                            _ => Other,
                         },
                         1,
                         1,
                     )
                 };
 
-                // figure out how many columns this char takes up
-                match ctype {
-                    Tab => {
-                        // figure out how many spaces to the next tabstop
-                        let nts = next_tabstop(ts, col, &options.remaining_mode);
-                        col += nts;
+                // figure out how many columns this char takes up
+                match ctype {
+                    Tab => {
+                        // figure out how many spaces to the next tabstop
+                        let nts = next_tabstop(ts, col, &options.remaining_mode);
+                        col += nts;
 
-                        // now dump out either spaces if we're expanding, or a literal tab if we're not
-                        if init || !options.iflag {
-                            if nts <= options.tspaces.len() {
-                                output.write_all(options.tspaces[..nts].as_bytes())?;
-                            } else {
-                                output.write_all(" ".repeat(nts).as_bytes())?;
+                        // now dump out either spaces if we're expanding, or a literal tab if we're not
+                        if init || !options.iflag {
+                            if nts <= options.tspaces.len() {
+                                output.write_all(options.tspaces[..nts].as_bytes())?;
+                            } else {
+                                output.write_all(" ".repeat(nts).as_bytes())?;
                             };
-                        } else {
-                            output.write_all(&buf[byte..byte + nbytes])?;
+                        } else {
+                            output.write_all(&buf[byte..byte + nbytes])?;
                         }
                     }
-                    _ => {
-                        col = if ctype == Other {
-                            col + cwidth
-                        } else if col > 0 {
-                            col - 1
-                        } else {
-                            0
-                        };
+                    _ => {
+                        col = if ctype == Other {
+                            col + cwidth
+                        } else if col > 0 {
+                            col - 1
+                        } else {
+                            0
+                        };
 
-                        // if we're writing anything other than a space, then we're
-                        // done with the line's leading spaces
-                        if buf[byte] != 0x20 {
-                            init = false;
+                        // if we're writing anything other than a space, then we're
+                        // done with the line's leading spaces
+                        if buf[byte] != 0x20 {
+                            init = false;
                         }
 
-                        output.write_all(&buf[byte..byte + nbytes])?;
+                        output.write_all(&buf[byte..byte + nbytes])?;
                     }
                 }
 
-                byte += nbytes; // advance the pointer
-            }
+                byte += nbytes; // advance the pointer
+            }
 
-            output.flush()?;
-            buf.truncate(0); // clear the buffer
-        }
+            output.flush()?;
+            buf.truncate(0); // clear the buffer
+        }
     }
     Ok(())
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::is_digit_or_comma;
+#[cfg(test)]
+mod tests {
+    use crate::is_digit_or_comma;
 
-    use super::next_tabstop;
-    use super::RemainingMode;
+    use super::next_tabstop;
+    use super::RemainingMode;
 
-    #[test]
-    fn test_next_tabstop_remaining_mode_none() {
-        assert_eq!(next_tabstop(&[1, 5], 0, &RemainingMode::None), 1);
-        assert_eq!(next_tabstop(&[1, 5], 3, &RemainingMode::None), 2);
-        assert_eq!(next_tabstop(&[1, 5], 6, &RemainingMode::None), 1);
+    #[test]
+    fn test_next_tabstop_remaining_mode_none() {
+        assert_eq!(next_tabstop(&[1, 5], 0, &RemainingMode::None), 1);
+        assert_eq!(next_tabstop(&[1, 5], 3, &RemainingMode::None), 2);
+        assert_eq!(next_tabstop(&[1, 5], 6, &RemainingMode::None), 1);
     }
 
-    #[test]
-    fn test_next_tabstop_remaining_mode_plus() {
-        assert_eq!(next_tabstop(&[1, 5], 0, &RemainingMode::Plus), 1);
-        assert_eq!(next_tabstop(&[1, 5], 3, &RemainingMode::Plus), 4);
-        assert_eq!(next_tabstop(&[1, 5], 6, &RemainingMode::Plus), 4);
+    #[test]
+    fn test_next_tabstop_remaining_mode_plus() {
+        assert_eq!(next_tabstop(&[1, 5], 0, &RemainingMode::Plus), 1);
+        assert_eq!(next_tabstop(&[1, 5], 3, &RemainingMode::Plus), 4);
+        assert_eq!(next_tabstop(&[1, 5], 6, &RemainingMode::Plus), 4);
     }
 
-    #[test]
-    fn test_next_tabstop_remaining_mode_slash() {
-        assert_eq!(next_tabstop(&[1, 5], 0, &RemainingMode::Slash), 1);
-        assert_eq!(next_tabstop(&[1, 5], 3, &RemainingMode::Slash), 2);
-        assert_eq!(next_tabstop(&[1, 5], 6, &RemainingMode::Slash), 4);
+    #[test]
+    fn test_next_tabstop_remaining_mode_slash() {
+        assert_eq!(next_tabstop(&[1, 5], 0, &RemainingMode::Slash), 1);
+        assert_eq!(next_tabstop(&[1, 5], 3, &RemainingMode::Slash), 2);
+        assert_eq!(next_tabstop(&[1, 5], 6, &RemainingMode::Slash), 4);
     }
 
-    #[test]
-    fn test_is_digit_or_comma() {
-        assert!(is_digit_or_comma('1'));
-        assert!(is_digit_or_comma(','));
-        assert!(!is_digit_or_comma('a'));
+    #[test]
+    fn test_is_digit_or_comma() {
+        assert!(is_digit_or_comma('1'));
+        assert!(is_digit_or_comma(','));
+        assert!(!is_digit_or_comma('a'));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_expr/expr.rs.html b/dev/src/uu_expr/expr.rs.html index 79c55afbe..6bf05933a 100644 --- a/dev/src/uu_expr/expr.rs.html +++ b/dev/src/uu_expr/expr.rs.html @@ -1,4 +1,4 @@ -expr.rs - source
1
+expr.rs - source
1
 2
 3
 4
@@ -84,91 +84,91 @@
 84
 85
 86
-
//* This file is part of the uutils coreutils package.
-//*
-//* (c) Roman Gafiyatullin <r.gafiyatullin@me.com>
-//*
-//* For the full copyright and license information, please view the LICENSE
-//* file that was distributed with this source code.
+
//* This file is part of the uutils coreutils package.
+//*
+//* (c) Roman Gafiyatullin <r.gafiyatullin@me.com>
+//*
+//* For the full copyright and license information, please view the LICENSE
+//* file that was distributed with this source code.
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use uucore::{
-    error::{UResult, USimpleError},
-    format_usage, help_section, help_usage,
+use clap::{crate_version, Arg, ArgAction, Command};
+use uucore::{
+    error::{UResult, USimpleError},
+    format_usage, help_section, help_usage,
 };
 
-mod syntax_tree;
-mod tokens;
+mod syntax_tree;
+mod tokens;
 
-mod options {
-    pub const VERSION: &str = "version";
-    pub const HELP: &str = "help";
-    pub const EXPRESSION: &str = "expression";
+mod options {
+    pub const VERSION: &str = "version";
+    pub const HELP: &str = "help";
+    pub const EXPRESSION: &str = "expression";
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(help_section!("about", "expr.md"))
-        .override_usage(format_usage(help_usage!("expr.md")))
-        .after_help(help_section!("after help", "expr.md"))
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .disable_version_flag(true)
-        .arg(
-            Arg::new(options::VERSION)
-                .long(options::VERSION)
-                .help("output version information and exit")
-                .action(ArgAction::Version),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(help_section!("about", "expr.md"))
+        .override_usage(format_usage(help_usage!("expr.md")))
+        .after_help(help_section!("after help", "expr.md"))
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .disable_version_flag(true)
+        .arg(
+            Arg::new(options::VERSION)
+                .long(options::VERSION)
+                .help("output version information and exit")
+                .action(ArgAction::Version),
         )
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("display this help and exit")
-                .action(ArgAction::Help),
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("display this help and exit")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new(options::EXPRESSION)
-                .action(ArgAction::Append)
-                .allow_hyphen_values(true),
+        .arg(
+            Arg::new(options::EXPRESSION)
+                .action(ArgAction::Append)
+                .allow_hyphen_values(true),
         )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    // For expr utility we do not want getopts.
-    // The following usage should work without escaping hyphens: `expr -15 = 1 +  2 \* \( 3 - -4 \)`
-    let matches = uu_app().try_get_matches_from(args)?;
-    let token_strings = matches
-        .get_many::<String>(options::EXPRESSION)
-        .map(|v| v.into_iter().map(|s| s.as_ref()).collect::<Vec<_>>())
-        .unwrap_or_default();
+    // For expr utility we do not want getopts.
+    // The following usage should work without escaping hyphens: `expr -15 = 1 +  2 \* \( 3 - -4 \)`
+    let matches = uu_app().try_get_matches_from(args)?;
+    let token_strings = matches
+        .get_many::<String>(options::EXPRESSION)
+        .map(|v| v.into_iter().map(|s| s.as_ref()).collect::<Vec<_>>())
+        .unwrap_or_default();
 
-    match process_expr(&token_strings[..]) {
-        Ok(expr_result) => print_expr_ok(&expr_result),
-        Err(expr_error) => Err(USimpleError::new(2, &expr_error)),
+    match process_expr(&token_strings[..]) {
+        Ok(expr_result) => print_expr_ok(&expr_result),
+        Err(expr_error) => Err(USimpleError::new(2, &expr_error)),
     }
 }
 
-fn process_expr(token_strings: &[&str]) -> Result<String, String> {
-    let maybe_tokens = tokens::strings_to_tokens(token_strings);
-    let maybe_ast = syntax_tree::tokens_to_ast(maybe_tokens);
-    evaluate_ast(maybe_ast)
+fn process_expr(token_strings: &[&str]) -> Result<String, String> {
+    let maybe_tokens = tokens::strings_to_tokens(token_strings);
+    let maybe_ast = syntax_tree::tokens_to_ast(maybe_tokens);
+    evaluate_ast(maybe_ast)
 }
 
-fn print_expr_ok(expr_result: &str) -> UResult<()> {
-    println!("{}", expr_result);
-    if expr_result == "0" || expr_result.is_empty() {
-        Err(1.into())
-    } else {
+fn print_expr_ok(expr_result: &str) -> UResult<()> {
+    println!("{}", expr_result);
+    if expr_result == "0" || expr_result.is_empty() {
+        Err(1.into())
+    } else {
         Ok(())
     }
 }
 
-fn evaluate_ast(maybe_ast: Result<Box<syntax_tree::AstNode>, String>) -> Result<String, String> {
-    maybe_ast.and_then(|ast| ast.evaluate())
+fn evaluate_ast(maybe_ast: Result<Box<syntax_tree::AstNode>, String>) -> Result<String, String> {
+    maybe_ast.and_then(|ast| ast.evaluate())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_expr/syntax_tree.rs.html b/dev/src/uu_expr/syntax_tree.rs.html index 618672594..2f0f89c02 100644 --- a/dev/src/uu_expr/syntax_tree.rs.html +++ b/dev/src/uu_expr/syntax_tree.rs.html @@ -1,4 +1,4 @@ -syntax_tree.rs - source
1
+syntax_tree.rs - source
1
 2
 3
 4
@@ -523,530 +523,530 @@
 523
 524
 525
-
//* This file is part of the uutils coreutils package.
-//*
-//* (c) Roman Gafiyatullin <r.gafiyatullin@me.com>
-//*
-//* For the full copyright and license information, please view the LICENSE
-//* file that was distributed with this source code.
+
//* This file is part of the uutils coreutils package.
+//*
+//* (c) Roman Gafiyatullin <r.gafiyatullin@me.com>
+//*
+//* For the full copyright and license information, please view the LICENSE
+//* file that was distributed with this source code.
 
-//!
-//! Here we employ shunting-yard algorithm for building AST from tokens according to operators' precedence and associative-ness.
-//! * `<https://en.wikipedia.org/wiki/Shunting-yard_algorithm>`
-//!
+//!
+//! Here we employ shunting-yard algorithm for building AST from tokens according to operators' precedence and associative-ness.
+//! * `<https://en.wikipedia.org/wiki/Shunting-yard_algorithm>`
+//!
 
-// spell-checker:ignore (ToDO) binop binops ints paren prec multibytes
+// spell-checker:ignore (ToDO) binop binops ints paren prec multibytes
 
-use num_bigint::BigInt;
-use num_traits::{One, Zero};
-use onig::{Regex, RegexOptions, Syntax};
+use num_bigint::BigInt;
+use num_traits::{One, Zero};
+use onig::{Regex, RegexOptions, Syntax};
 
-use crate::tokens::Token;
+use crate::tokens::Token;
 
-type TokenStack = Vec<(usize, Token)>;
-pub type OperandsList = Vec<Box<AstNode>>;
+type TokenStack = Vec<(usize, Token)>;
+pub type OperandsList = Vec<Box<AstNode>>;
 
-#[derive(Debug)]
-pub enum AstNode {
-    Leaf {
-        token_idx: usize,
-        value: String,
+#[derive(Debug)]
+pub enum AstNode {
+    Leaf {
+        token_idx: usize,
+        value: String,
     },
-    Node {
-        token_idx: usize,
-        op_type: String,
-        operands: OperandsList,
+    Node {
+        token_idx: usize,
+        op_type: String,
+        operands: OperandsList,
     },
 }
-impl AstNode {
-    fn debug_dump(&self) {
-        self.debug_dump_impl(1);
+impl AstNode {
+    fn debug_dump(&self) {
+        self.debug_dump_impl(1);
     }
-    fn debug_dump_impl(&self, depth: usize) {
-        for _ in 0..depth {
+    fn debug_dump_impl(&self, depth: usize) {
+        for _ in 0..depth {
             print!("\t",);
         }
-        match self {
-            Self::Leaf { token_idx, value } => println!(
+        match self {
+            Self::Leaf { token_idx, value } => println!(
                 "Leaf( {} ) at #{} ( evaluate -> {:?} )",
-                value,
-                token_idx,
-                self.evaluate()
+                value,
+                token_idx,
+                self.evaluate()
             ),
-            Self::Node {
-                token_idx,
-                op_type,
-                operands,
+            Self::Node {
+                token_idx,
+                op_type,
+                operands,
             } => {
                 println!(
                     "Node( {} ) at #{} (evaluate -> {:?})",
-                    op_type,
-                    token_idx,
-                    self.evaluate()
+                    op_type,
+                    token_idx,
+                    self.evaluate()
                 );
-                for operand in operands {
-                    operand.debug_dump_impl(depth + 1);
+                for operand in operands {
+                    operand.debug_dump_impl(depth + 1);
                 }
             }
         }
     }
 
-    fn new_node(token_idx: usize, op_type: &str, operands: OperandsList) -> Box<Self> {
-        Box::new(Self::Node {
-            token_idx,
-            op_type: op_type.into(),
-            operands,
+    fn new_node(token_idx: usize, op_type: &str, operands: OperandsList) -> Box<Self> {
+        Box::new(Self::Node {
+            token_idx,
+            op_type: op_type.into(),
+            operands,
         })
     }
-    fn new_leaf(token_idx: usize, value: &str) -> Box<Self> {
-        Box::new(Self::Leaf {
-            token_idx,
-            value: value.into(),
+    fn new_leaf(token_idx: usize, value: &str) -> Box<Self> {
+        Box::new(Self::Leaf {
+            token_idx,
+            value: value.into(),
         })
     }
-    pub fn evaluate(&self) -> Result<String, String> {
-        match self {
-            Self::Leaf { value, .. } => Ok(value.clone()),
-            Self::Node { op_type, .. } => match self.operand_values() {
-                Err(reason) => Err(reason),
-                Ok(operand_values) => match op_type.as_ref() {
-                    "+" => {
-                        infix_operator_two_ints(|a: BigInt, b: BigInt| Ok(a + b), &operand_values)
+    pub fn evaluate(&self) -> Result<String, String> {
+        match self {
+            Self::Leaf { value, .. } => Ok(value.clone()),
+            Self::Node { op_type, .. } => match self.operand_values() {
+                Err(reason) => Err(reason),
+                Ok(operand_values) => match op_type.as_ref() {
+                    "+" => {
+                        infix_operator_two_ints(|a: BigInt, b: BigInt| Ok(a + b), &operand_values)
                     }
-                    "-" => {
-                        infix_operator_two_ints(|a: BigInt, b: BigInt| Ok(a - b), &operand_values)
+                    "-" => {
+                        infix_operator_two_ints(|a: BigInt, b: BigInt| Ok(a - b), &operand_values)
                     }
-                    "*" => {
-                        infix_operator_two_ints(|a: BigInt, b: BigInt| Ok(a * b), &operand_values)
+                    "*" => {
+                        infix_operator_two_ints(|a: BigInt, b: BigInt| Ok(a * b), &operand_values)
                     }
-                    "/" => infix_operator_two_ints(
-                        |a: BigInt, b: BigInt| {
-                            if b.is_zero() {
-                                Err("division by zero".to_owned())
-                            } else {
-                                Ok(a / b)
+                    "/" => infix_operator_two_ints(
+                        |a: BigInt, b: BigInt| {
+                            if b.is_zero() {
+                                Err("division by zero".to_owned())
+                            } else {
+                                Ok(a / b)
                             }
                         },
-                        &operand_values,
+                        &operand_values,
                     ),
-                    "%" => infix_operator_two_ints(
-                        |a: BigInt, b: BigInt| {
-                            if b.is_zero() {
-                                Err("division by zero".to_owned())
-                            } else {
-                                Ok(a % b)
+                    "%" => infix_operator_two_ints(
+                        |a: BigInt, b: BigInt| {
+                            if b.is_zero() {
+                                Err("division by zero".to_owned())
+                            } else {
+                                Ok(a % b)
                             }
                         },
-                        &operand_values,
+                        &operand_values,
                     ),
-                    "=" => infix_operator_two_ints_or_two_strings(
-                        |a: BigInt, b: BigInt| Ok(bool_as_int(a == b)),
-                        |a: &String, b: &String| Ok(bool_as_string(a == b)),
-                        &operand_values,
+                    "=" => infix_operator_two_ints_or_two_strings(
+                        |a: BigInt, b: BigInt| Ok(bool_as_int(a == b)),
+                        |a: &String, b: &String| Ok(bool_as_string(a == b)),
+                        &operand_values,
                     ),
-                    "!=" => infix_operator_two_ints_or_two_strings(
-                        |a: BigInt, b: BigInt| Ok(bool_as_int(a != b)),
-                        |a: &String, b: &String| Ok(bool_as_string(a != b)),
-                        &operand_values,
+                    "!=" => infix_operator_two_ints_or_two_strings(
+                        |a: BigInt, b: BigInt| Ok(bool_as_int(a != b)),
+                        |a: &String, b: &String| Ok(bool_as_string(a != b)),
+                        &operand_values,
                     ),
-                    "<" => infix_operator_two_ints_or_two_strings(
-                        |a: BigInt, b: BigInt| Ok(bool_as_int(a < b)),
-                        |a: &String, b: &String| Ok(bool_as_string(a < b)),
-                        &operand_values,
+                    "<" => infix_operator_two_ints_or_two_strings(
+                        |a: BigInt, b: BigInt| Ok(bool_as_int(a < b)),
+                        |a: &String, b: &String| Ok(bool_as_string(a < b)),
+                        &operand_values,
                     ),
-                    ">" => infix_operator_two_ints_or_two_strings(
-                        |a: BigInt, b: BigInt| Ok(bool_as_int(a > b)),
-                        |a: &String, b: &String| Ok(bool_as_string(a > b)),
-                        &operand_values,
+                    ">" => infix_operator_two_ints_or_two_strings(
+                        |a: BigInt, b: BigInt| Ok(bool_as_int(a > b)),
+                        |a: &String, b: &String| Ok(bool_as_string(a > b)),
+                        &operand_values,
                     ),
-                    "<=" => infix_operator_two_ints_or_two_strings(
-                        |a: BigInt, b: BigInt| Ok(bool_as_int(a <= b)),
-                        |a: &String, b: &String| Ok(bool_as_string(a <= b)),
-                        &operand_values,
+                    "<=" => infix_operator_two_ints_or_two_strings(
+                        |a: BigInt, b: BigInt| Ok(bool_as_int(a <= b)),
+                        |a: &String, b: &String| Ok(bool_as_string(a <= b)),
+                        &operand_values,
                     ),
-                    ">=" => infix_operator_two_ints_or_two_strings(
-                        |a: BigInt, b: BigInt| Ok(bool_as_int(a >= b)),
-                        |a: &String, b: &String| Ok(bool_as_string(a >= b)),
-                        &operand_values,
+                    ">=" => infix_operator_two_ints_or_two_strings(
+                        |a: BigInt, b: BigInt| Ok(bool_as_int(a >= b)),
+                        |a: &String, b: &String| Ok(bool_as_string(a >= b)),
+                        &operand_values,
                     ),
-                    "|" => Ok(infix_operator_or(&operand_values)),
-                    "&" => Ok(infix_operator_and(&operand_values)),
-                    ":" | "match" => operator_match(&operand_values),
-                    "length" => Ok(prefix_operator_length(&operand_values)),
-                    "index" => Ok(prefix_operator_index(&operand_values)),
-                    "substr" => Ok(prefix_operator_substr(&operand_values)),
+                    "|" => Ok(infix_operator_or(&operand_values)),
+                    "&" => Ok(infix_operator_and(&operand_values)),
+                    ":" | "match" => operator_match(&operand_values),
+                    "length" => Ok(prefix_operator_length(&operand_values)),
+                    "index" => Ok(prefix_operator_index(&operand_values)),
+                    "substr" => Ok(prefix_operator_substr(&operand_values)),
 
-                    _ => Err(format!("operation not implemented: {}", op_type)),
+                    _ => Err(format!("operation not implemented: {}", op_type)),
                 },
             },
         }
     }
-    pub fn operand_values(&self) -> Result<Vec<String>, String> {
-        if let Self::Node { operands, .. } = self {
-            let mut out = Vec::with_capacity(operands.len());
-            for operand in operands {
-                let value = operand.evaluate()?;
-                out.push(value);
+    pub fn operand_values(&self) -> Result<Vec<String>, String> {
+        if let Self::Node { operands, .. } = self {
+            let mut out = Vec::with_capacity(operands.len());
+            for operand in operands {
+                let value = operand.evaluate()?;
+                out.push(value);
             }
-            Ok(out)
-        } else {
+            Ok(out)
+        } else {
             panic!("Invoked .operand_values(&self) not with ASTNode::Node")
         }
     }
 }
 
-pub fn tokens_to_ast(
-    maybe_tokens: Result<Vec<(usize, Token)>, String>,
-) -> Result<Box<AstNode>, String> {
-    maybe_tokens.and_then(|tokens| {
-        let mut out_stack: TokenStack = Vec::new();
-        let mut op_stack: TokenStack = Vec::new();
+pub fn tokens_to_ast(
+    maybe_tokens: Result<Vec<(usize, Token)>, String>,
+) -> Result<Box<AstNode>, String> {
+    maybe_tokens.and_then(|tokens| {
+        let mut out_stack: TokenStack = Vec::new();
+        let mut op_stack: TokenStack = Vec::new();
 
-        for (token_idx, token) in tokens {
-            push_token_to_either_stack(token_idx, &token, &mut out_stack, &mut op_stack)?;
+        for (token_idx, token) in tokens {
+            push_token_to_either_stack(token_idx, &token, &mut out_stack, &mut op_stack)?;
         }
-        move_rest_of_ops_to_out(&mut out_stack, &mut op_stack)?;
-        assert!(op_stack.is_empty());
+        move_rest_of_ops_to_out(&mut out_stack, &mut op_stack)?;
+        assert!(op_stack.is_empty());
 
-        maybe_dump_rpn(&out_stack);
-        let result = ast_from_rpn(&mut out_stack);
-        if !out_stack.is_empty() {
+        maybe_dump_rpn(&out_stack);
+        let result = ast_from_rpn(&mut out_stack);
+        if !out_stack.is_empty() {
             Err(
-                "syntax error (first RPN token does not represent the root of the expression AST)"
-                    .to_owned(),
+                "syntax error (first RPN token does not represent the root of the expression AST)"
+                    .to_owned(),
             )
-        } else {
-            maybe_dump_ast(&result);
-            result
+        } else {
+            maybe_dump_ast(&result);
+            result
         }
     })
 }
 
-fn maybe_dump_ast(result: &Result<Box<AstNode>, String>) {
-    use std::env;
-    if let Ok(debug_var) = env::var("EXPR_DEBUG_AST") {
-        if debug_var == "1" {
+fn maybe_dump_ast(result: &Result<Box<AstNode>, String>) {
+    use std::env;
+    if let Ok(debug_var) = env::var("EXPR_DEBUG_AST") {
+        if debug_var == "1" {
             println!("EXPR_DEBUG_AST");
-            match result {
-                Ok(ast) => ast.debug_dump(),
-                Err(reason) => println!("\terr: {:?}", reason),
+            match result {
+                Ok(ast) => ast.debug_dump(),
+                Err(reason) => println!("\terr: {:?}", reason),
             }
         }
     }
 }
 
-#[allow(clippy::ptr_arg)]
-fn maybe_dump_rpn(rpn: &TokenStack) {
-    use std::env;
-    if let Ok(debug_var) = env::var("EXPR_DEBUG_RPN") {
-        if debug_var == "1" {
+#[allow(clippy::ptr_arg)]
+fn maybe_dump_rpn(rpn: &TokenStack) {
+    use std::env;
+    if let Ok(debug_var) = env::var("EXPR_DEBUG_RPN") {
+        if debug_var == "1" {
             println!("EXPR_DEBUG_RPN");
-            for token in rpn {
-                println!("\t{:?}", token);
+            for token in rpn {
+                println!("\t{:?}", token);
             }
         }
     }
 }
 
-fn ast_from_rpn(rpn: &mut TokenStack) -> Result<Box<AstNode>, String> {
-    match rpn.pop() {
-        None => Err("syntax error (premature end of expression)".to_owned()),
+fn ast_from_rpn(rpn: &mut TokenStack) -> Result<Box<AstNode>, String> {
+    match rpn.pop() {
+        None => Err("syntax error (premature end of expression)".to_owned()),
 
-        Some((token_idx, Token::Value { value })) => Ok(AstNode::new_leaf(token_idx, &value)),
+        Some((token_idx, Token::Value { value })) => Ok(AstNode::new_leaf(token_idx, &value)),
 
-        Some((token_idx, Token::InfixOp { value, .. })) => {
-            maybe_ast_node(token_idx, &value, 2, rpn)
+        Some((token_idx, Token::InfixOp { value, .. })) => {
+            maybe_ast_node(token_idx, &value, 2, rpn)
         }
 
-        Some((token_idx, Token::PrefixOp { value, arity })) => {
-            maybe_ast_node(token_idx, &value, arity, rpn)
+        Some((token_idx, Token::PrefixOp { value, arity })) => {
+            maybe_ast_node(token_idx, &value, arity, rpn)
         }
 
-        Some((token_idx, unexpected_token)) => {
-            panic!("unexpected token at #{} {:?}", token_idx, unexpected_token)
+        Some((token_idx, unexpected_token)) => {
+            panic!("unexpected token at #{} {:?}", token_idx, unexpected_token)
         }
     }
 }
-fn maybe_ast_node(
-    token_idx: usize,
-    op_type: &str,
-    arity: usize,
-    rpn: &mut TokenStack,
-) -> Result<Box<AstNode>, String> {
-    let mut operands = Vec::with_capacity(arity);
-    for _ in 0..arity {
-        let operand = ast_from_rpn(rpn)?;
-        operands.push(operand);
+fn maybe_ast_node(
+    token_idx: usize,
+    op_type: &str,
+    arity: usize,
+    rpn: &mut TokenStack,
+) -> Result<Box<AstNode>, String> {
+    let mut operands = Vec::with_capacity(arity);
+    for _ in 0..arity {
+        let operand = ast_from_rpn(rpn)?;
+        operands.push(operand);
     }
-    operands.reverse();
-    Ok(AstNode::new_node(token_idx, op_type, operands))
+    operands.reverse();
+    Ok(AstNode::new_node(token_idx, op_type, operands))
 }
 
-fn move_rest_of_ops_to_out(
-    out_stack: &mut TokenStack,
-    op_stack: &mut TokenStack,
-) -> Result<(), String> {
-    loop {
-        match op_stack.pop() {
-            None => return Ok(()),
-            Some((token_idx, Token::ParOpen)) => {
-                return Err(format!(
+fn move_rest_of_ops_to_out(
+    out_stack: &mut TokenStack,
+    op_stack: &mut TokenStack,
+) -> Result<(), String> {
+    loop {
+        match op_stack.pop() {
+            None => return Ok(()),
+            Some((token_idx, Token::ParOpen)) => {
+                return Err(format!(
                     "syntax error (Mismatched open-parenthesis at #{})",
-                    token_idx
+                    token_idx
                 ))
             }
-            Some((token_idx, Token::ParClose)) => {
-                return Err(format!(
+            Some((token_idx, Token::ParClose)) => {
+                return Err(format!(
                     "syntax error (Mismatched close-parenthesis at #{})",
-                    token_idx
+                    token_idx
                 ))
             }
-            Some(other) => out_stack.push(other),
+            Some(other) => out_stack.push(other),
         }
     }
 }
 
-fn push_token_to_either_stack(
-    token_idx: usize,
-    token: &Token,
-    out_stack: &mut TokenStack,
-    op_stack: &mut TokenStack,
-) -> Result<(), String> {
-    let result = match token {
-        Token::Value { .. } => {
-            out_stack.push((token_idx, token.clone()));
+fn push_token_to_either_stack(
+    token_idx: usize,
+    token: &Token,
+    out_stack: &mut TokenStack,
+    op_stack: &mut TokenStack,
+) -> Result<(), String> {
+    let result = match token {
+        Token::Value { .. } => {
+            out_stack.push((token_idx, token.clone()));
             Ok(())
         }
 
-        Token::InfixOp { .. } => {
-            if op_stack.is_empty() {
-                op_stack.push((token_idx, token.clone()));
+        Token::InfixOp { .. } => {
+            if op_stack.is_empty() {
+                op_stack.push((token_idx, token.clone()));
                 Ok(())
-            } else {
-                push_op_to_stack(token_idx, token, out_stack, op_stack)
+            } else {
+                push_op_to_stack(token_idx, token, out_stack, op_stack)
             }
         }
 
-        Token::PrefixOp { .. } | Token::ParOpen => {
-            op_stack.push((token_idx, token.clone()));
+        Token::PrefixOp { .. } | Token::ParOpen => {
+            op_stack.push((token_idx, token.clone()));
             Ok(())
         }
 
-        Token::ParClose => move_till_match_paren(out_stack, op_stack),
+        Token::ParClose => move_till_match_paren(out_stack, op_stack),
     };
-    maybe_dump_shunting_yard_step(token_idx, token, out_stack, op_stack, &result);
-    result
+    maybe_dump_shunting_yard_step(token_idx, token, out_stack, op_stack, &result);
+    result
 }
 
-#[allow(clippy::ptr_arg)]
-fn maybe_dump_shunting_yard_step(
-    token_idx: usize,
-    token: &Token,
-    out_stack: &TokenStack,
-    op_stack: &TokenStack,
-    result: &Result<(), String>,
+#[allow(clippy::ptr_arg)]
+fn maybe_dump_shunting_yard_step(
+    token_idx: usize,
+    token: &Token,
+    out_stack: &TokenStack,
+    op_stack: &TokenStack,
+    result: &Result<(), String>,
 ) {
-    use std::env;
-    if let Ok(debug_var) = env::var("EXPR_DEBUG_SYA_STEP") {
-        if debug_var == "1" {
+    use std::env;
+    if let Ok(debug_var) = env::var("EXPR_DEBUG_SYA_STEP") {
+        if debug_var == "1" {
             println!("EXPR_DEBUG_SYA_STEP");
-            println!("\t{} => {:?}", token_idx, token);
-            println!("\t\tout: {:?}", out_stack);
-            println!("\t\top : {:?}", op_stack);
-            println!("\t\tresult: {:?}", result);
+            println!("\t{} => {:?}", token_idx, token);
+            println!("\t\tout: {:?}", out_stack);
+            println!("\t\top : {:?}", op_stack);
+            println!("\t\tresult: {:?}", result);
         }
     }
 }
 
-fn push_op_to_stack(
-    token_idx: usize,
-    token: &Token,
-    out_stack: &mut TokenStack,
-    op_stack: &mut TokenStack,
-) -> Result<(), String> {
-    if let Token::InfixOp {
-        precedence: prec,
-        left_assoc: la,
+fn push_op_to_stack(
+    token_idx: usize,
+    token: &Token,
+    out_stack: &mut TokenStack,
+    op_stack: &mut TokenStack,
+) -> Result<(), String> {
+    if let Token::InfixOp {
+        precedence: prec,
+        left_assoc: la,
         ..
-    } = *token
+    } = *token
     {
-        loop {
-            match op_stack.last() {
-                None | Some(&(_, Token::ParOpen)) => {
-                    op_stack.push((token_idx, token.clone()));
-                    return Ok(());
+        loop {
+            match op_stack.last() {
+                None | Some(&(_, Token::ParOpen)) => {
+                    op_stack.push((token_idx, token.clone()));
+                    return Ok(());
                 }
 
                 Some(&(
                     _,
-                    Token::InfixOp {
-                        precedence: prev_prec,
+                    Token::InfixOp {
+                        precedence: prev_prec,
                         ..
                     },
                 )) => {
-                    if la && prev_prec >= prec || !la && prev_prec > prec {
-                        out_stack.push(op_stack.pop().unwrap());
-                    } else {
-                        op_stack.push((token_idx, token.clone()));
-                        return Ok(());
+                    if la && prev_prec >= prec || !la && prev_prec > prec {
+                        out_stack.push(op_stack.pop().unwrap());
+                    } else {
+                        op_stack.push((token_idx, token.clone()));
+                        return Ok(());
                     }
                 }
 
-                Some(&(_, Token::PrefixOp { .. })) => {
-                    op_stack.push((token_idx, token.clone()));
-                    return Ok(());
+                Some(&(_, Token::PrefixOp { .. })) => {
+                    op_stack.push((token_idx, token.clone()));
+                    return Ok(());
                 }
 
                 Some(_) => panic!("Non-operator on op_stack"),
             }
         }
-    } else {
+    } else {
         panic!("Expected infix-op")
     }
 }
 
-fn move_till_match_paren(
-    out_stack: &mut TokenStack,
-    op_stack: &mut TokenStack,
-) -> Result<(), String> {
-    loop {
-        let op = op_stack
-            .pop()
-            .ok_or_else(|| "syntax error (Mismatched close-parenthesis)".to_string())?;
-        match op {
-            (_, Token::ParOpen) => return Ok(()),
-            other => out_stack.push(other),
+fn move_till_match_paren(
+    out_stack: &mut TokenStack,
+    op_stack: &mut TokenStack,
+) -> Result<(), String> {
+    loop {
+        let op = op_stack
+            .pop()
+            .ok_or_else(|| "syntax error (Mismatched close-parenthesis)".to_string())?;
+        match op {
+            (_, Token::ParOpen) => return Ok(()),
+            other => out_stack.push(other),
         }
     }
 }
 
-fn infix_operator_two_ints<F>(f: F, values: &[String]) -> Result<String, String>
-where
-    F: Fn(BigInt, BigInt) -> Result<BigInt, String>,
+fn infix_operator_two_ints<F>(f: F, values: &[String]) -> Result<String, String>
+where
+    F: Fn(BigInt, BigInt) -> Result<BigInt, String>,
 {
-    assert!(values.len() == 2);
-    if let Ok(left) = values[0].parse::<BigInt>() {
-        if let Ok(right) = values[1].parse::<BigInt>() {
-            return f(left, right).map(|big_int| big_int.to_string());
+    assert!(values.len() == 2);
+    if let Ok(left) = values[0].parse::<BigInt>() {
+        if let Ok(right) = values[1].parse::<BigInt>() {
+            return f(left, right).map(|big_int| big_int.to_string());
         }
     }
-    Err("Expected an integer operand".to_string())
+    Err("Expected an integer operand".to_string())
 }
 
-fn infix_operator_two_ints_or_two_strings<FI, FS>(
-    fi: FI,
-    fs: FS,
-    values: &[String],
-) -> Result<String, String>
-where
-    FI: Fn(BigInt, BigInt) -> Result<u8, String>,
-    FS: Fn(&String, &String) -> Result<String, String>,
+fn infix_operator_two_ints_or_two_strings<FI, FS>(
+    fi: FI,
+    fs: FS,
+    values: &[String],
+) -> Result<String, String>
+where
+    FI: Fn(BigInt, BigInt) -> Result<u8, String>,
+    FS: Fn(&String, &String) -> Result<String, String>,
 {
-    assert!(values.len() == 2);
-    if let (Some(a_int), Some(b_int)) = (
-        values[0].parse::<BigInt>().ok(),
-        values[1].parse::<BigInt>().ok(),
+    assert!(values.len() == 2);
+    if let (Some(a_int), Some(b_int)) = (
+        values[0].parse::<BigInt>().ok(),
+        values[1].parse::<BigInt>().ok(),
     ) {
-        match fi(a_int, b_int) {
-            Ok(result) => Ok(result.to_string()),
-            Err(reason) => Err(reason),
+        match fi(a_int, b_int) {
+            Ok(result) => Ok(result.to_string()),
+            Err(reason) => Err(reason),
         }
-    } else {
-        fs(&values[0], &values[1])
+    } else {
+        fs(&values[0], &values[1])
     }
 }
 
-fn infix_operator_or(values: &[String]) -> String {
-    assert!(values.len() == 2);
-    if value_as_bool(&values[0]) {
-        values[0].clone()
-    } else {
-        values[1].clone()
+fn infix_operator_or(values: &[String]) -> String {
+    assert!(values.len() == 2);
+    if value_as_bool(&values[0]) {
+        values[0].clone()
+    } else {
+        values[1].clone()
     }
 }
 
-fn infix_operator_and(values: &[String]) -> String {
-    if value_as_bool(&values[0]) && value_as_bool(&values[1]) {
-        values[0].clone()
-    } else {
-        0.to_string()
+fn infix_operator_and(values: &[String]) -> String {
+    if value_as_bool(&values[0]) && value_as_bool(&values[1]) {
+        values[0].clone()
+    } else {
+        0.to_string()
     }
 }
 
-fn operator_match(values: &[String]) -> Result<String, String> {
-    assert!(values.len() == 2);
-    let re = Regex::with_options(&values[1], RegexOptions::REGEX_OPTION_NONE, Syntax::grep())
-        .map_err(|err| err.description().to_string())?;
-    Ok(if re.captures_len() > 0 {
-        re.captures(&values[0])
-            .map(|captures| captures.at(1).unwrap())
-            .unwrap_or("")
-            .to_string()
-    } else {
-        re.find(&values[0])
-            .map_or("0".to_string(), |(start, end)| (end - start).to_string())
+fn operator_match(values: &[String]) -> Result<String, String> {
+    assert!(values.len() == 2);
+    let re = Regex::with_options(&values[1], RegexOptions::REGEX_OPTION_NONE, Syntax::grep())
+        .map_err(|err| err.description().to_string())?;
+    Ok(if re.captures_len() > 0 {
+        re.captures(&values[0])
+            .map(|captures| captures.at(1).unwrap())
+            .unwrap_or("")
+            .to_string()
+    } else {
+        re.find(&values[0])
+            .map_or("0".to_string(), |(start, end)| (end - start).to_string())
     })
 }
 
-fn prefix_operator_length(values: &[String]) -> String {
-    assert!(values.len() == 1);
-    // Use chars().count() as we can have some multibytes chars
-    // See https://github.com/uutils/coreutils/issues/3132
-    values[0].chars().count().to_string()
+fn prefix_operator_length(values: &[String]) -> String {
+    assert!(values.len() == 1);
+    // Use chars().count() as we can have some multibytes chars
+    // See https://github.com/uutils/coreutils/issues/3132
+    values[0].chars().count().to_string()
 }
 
-fn prefix_operator_index(values: &[String]) -> String {
-    assert!(values.len() == 2);
-    let haystack = &values[0];
-    let needles = &values[1];
+fn prefix_operator_index(values: &[String]) -> String {
+    assert!(values.len() == 2);
+    let haystack = &values[0];
+    let needles = &values[1];
 
-    for (current_idx, ch_h) in haystack.chars().enumerate() {
-        for ch_n in needles.chars() {
-            if ch_n == ch_h {
-                return current_idx.to_string();
+    for (current_idx, ch_h) in haystack.chars().enumerate() {
+        for ch_n in needles.chars() {
+            if ch_n == ch_h {
+                return current_idx.to_string();
             }
         }
     }
-    "0".to_string()
+    "0".to_string()
 }
 
-fn prefix_operator_substr(values: &[String]) -> String {
-    assert!(values.len() == 3);
-    let subj = &values[0];
-    let idx = match values[1]
-        .parse::<usize>()
-        .ok()
-        .and_then(|v| v.checked_sub(1))
+fn prefix_operator_substr(values: &[String]) -> String {
+    assert!(values.len() == 3);
+    let subj = &values[0];
+    let idx = match values[1]
+        .parse::<usize>()
+        .ok()
+        .and_then(|v| v.checked_sub(1))
     {
-        Some(i) => i,
-        None => return String::new(),
+        Some(i) => i,
+        None => return String::new(),
     };
-    let len = match values[2].parse::<usize>() {
-        Ok(i) => i,
-        Err(_) => return String::new(),
+    let len = match values[2].parse::<usize>() {
+        Ok(i) => i,
+        Err(_) => return String::new(),
     };
 
-    subj.chars().skip(idx).take(len).collect()
+    subj.chars().skip(idx).take(len).collect()
 }
 
-fn bool_as_int(b: bool) -> u8 {
-    u8::from(b)
+fn bool_as_int(b: bool) -> u8 {
+    u8::from(b)
 }
-fn bool_as_string(b: bool) -> String {
-    if b {
-        "1".to_string()
-    } else {
-        "0".to_string()
+fn bool_as_string(b: bool) -> String {
+    if b {
+        "1".to_string()
+    } else {
+        "0".to_string()
     }
 }
-fn value_as_bool(s: &str) -> bool {
-    if s.is_empty() {
-        return false;
+fn value_as_bool(s: &str) -> bool {
+    if s.is_empty() {
+        return false;
     }
-    match s.parse::<BigInt>() {
-        Ok(n) => n.is_one(),
+    match s.parse::<BigInt>() {
+        Ok(n) => n.is_one(),
         Err(_) => true,
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_expr/tokens.rs.html b/dev/src/uu_expr/tokens.rs.html index 994187cb8..25ec78e6a 100644 --- a/dev/src/uu_expr/tokens.rs.html +++ b/dev/src/uu_expr/tokens.rs.html @@ -1,4 +1,4 @@ -tokens.rs - source
1
+tokens.rs - source
1
 2
 3
 4
@@ -148,155 +148,155 @@
 148
 149
 150
-
//* This file is part of the uutils coreutils package.
-//*
-//* (c) Roman Gafiyatullin <r.gafiyatullin@me.com>
-//*
-//* For the full copyright and license information, please view the LICENSE
-//* file that was distributed with this source code.
+
//* This file is part of the uutils coreutils package.
+//*
+//* (c) Roman Gafiyatullin <r.gafiyatullin@me.com>
+//*
+//* For the full copyright and license information, please view the LICENSE
+//* file that was distributed with this source code.
 
-//!
-//! The following tokens are present in the expr grammar:
-//! * integer literal;
-//! * string literal;
-//! * infix binary operators;
-//! * prefix operators.
-//!
-//! According to the man-page of expr we have expression split into tokens (each token -- separate CLI-argument).
-//! Hence all we need is to map the strings into the Token structures, except for some ugly fiddling with +-escaping.
-//!
+//!
+//! The following tokens are present in the expr grammar:
+//! * integer literal;
+//! * string literal;
+//! * infix binary operators;
+//! * prefix operators.
+//!
+//! According to the man-page of expr we have expression split into tokens (each token -- separate CLI-argument).
+//! Hence all we need is to map the strings into the Token structures, except for some ugly fiddling with +-escaping.
+//!
 
-// spell-checker:ignore (ToDO) paren
+// spell-checker:ignore (ToDO) paren
 
-use num_bigint::BigInt;
+use num_bigint::BigInt;
 
-#[derive(Debug, Clone)]
-pub enum Token {
-    Value {
-        value: String,
+#[derive(Debug, Clone)]
+pub enum Token {
+    Value {
+        value: String,
     },
 
-    ParOpen,
-    ParClose,
+    ParOpen,
+    ParClose,
 
-    InfixOp {
-        precedence: u8,
-        left_assoc: bool,
-        value: String,
+    InfixOp {
+        precedence: u8,
+        left_assoc: bool,
+        value: String,
     },
 
-    PrefixOp {
-        arity: usize,
-        value: String,
+    PrefixOp {
+        arity: usize,
+        value: String,
     },
 }
-impl Token {
-    fn new_infix_op(v: &str, left_assoc: bool, precedence: u8) -> Self {
-        Self::InfixOp {
-            left_assoc,
-            precedence,
-            value: v.into(),
+impl Token {
+    fn new_infix_op(v: &str, left_assoc: bool, precedence: u8) -> Self {
+        Self::InfixOp {
+            left_assoc,
+            precedence,
+            value: v.into(),
         }
     }
-    fn new_value(v: &str) -> Self {
-        Self::Value { value: v.into() }
+    fn new_value(v: &str) -> Self {
+        Self::Value { value: v.into() }
     }
 
-    fn is_infix_plus(&self) -> bool {
-        match self {
-            Self::InfixOp { value, .. } => value == "+",
-            _ => false,
+    fn is_infix_plus(&self) -> bool {
+        match self {
+            Self::InfixOp { value, .. } => value == "+",
+            _ => false,
         }
     }
-    fn is_a_number(&self) -> bool {
-        match self {
-            Self::Value { value, .. } => value.parse::<BigInt>().is_ok(),
-            _ => false,
+    fn is_a_number(&self) -> bool {
+        match self {
+            Self::Value { value, .. } => value.parse::<BigInt>().is_ok(),
+            _ => false,
         }
     }
-    fn is_a_close_paren(&self) -> bool {
-        matches!(*self, Self::ParClose)
+    fn is_a_close_paren(&self) -> bool {
+        matches!(*self, Self::ParClose)
     }
 }
 
-pub fn strings_to_tokens(strings: &[&str]) -> Result<Vec<(usize, Token)>, String> {
-    let mut tokens_acc = Vec::with_capacity(strings.len());
-    let mut tok_idx = 1;
+pub fn strings_to_tokens(strings: &[&str]) -> Result<Vec<(usize, Token)>, String> {
+    let mut tokens_acc = Vec::with_capacity(strings.len());
+    let mut tok_idx = 1;
 
-    for s in strings {
-        let token_if_not_escaped = match *s {
-            "(" => Token::ParOpen,
-            ")" => Token::ParClose,
+    for s in strings {
+        let token_if_not_escaped = match *s {
+            "(" => Token::ParOpen,
+            ")" => Token::ParClose,
 
-            "^" => Token::new_infix_op(s, false, 7),
+            "^" => Token::new_infix_op(s, false, 7),
 
-            ":" => Token::new_infix_op(s, true, 6),
+            ":" => Token::new_infix_op(s, true, 6),
 
-            "*" | "/" | "%" => Token::new_infix_op(s, true, 5),
+            "*" | "/" | "%" => Token::new_infix_op(s, true, 5),
 
-            "+" | "-" => Token::new_infix_op(s, true, 4),
+            "+" | "-" => Token::new_infix_op(s, true, 4),
 
-            "=" | "!=" | "<" | ">" | "<=" | ">=" => Token::new_infix_op(s, true, 3),
+            "=" | "!=" | "<" | ">" | "<=" | ">=" => Token::new_infix_op(s, true, 3),
 
-            "&" => Token::new_infix_op(s, true, 2),
+            "&" => Token::new_infix_op(s, true, 2),
 
-            "|" => Token::new_infix_op(s, true, 1),
+            "|" => Token::new_infix_op(s, true, 1),
 
-            "match" | "index" => Token::PrefixOp {
-                arity: 2,
-                value: s.to_string(),
+            "match" | "index" => Token::PrefixOp {
+                arity: 2,
+                value: s.to_string(),
             },
-            "substr" => Token::PrefixOp {
-                arity: 3,
-                value: s.to_string(),
+            "substr" => Token::PrefixOp {
+                arity: 3,
+                value: s.to_string(),
             },
-            "length" => Token::PrefixOp {
-                arity: 1,
-                value: s.to_string(),
+            "length" => Token::PrefixOp {
+                arity: 1,
+                value: s.to_string(),
             },
 
-            _ => Token::new_value(s),
+            _ => Token::new_value(s),
         };
-        push_token_if_not_escaped(&mut tokens_acc, tok_idx, token_if_not_escaped, s);
-        tok_idx += 1;
+        push_token_if_not_escaped(&mut tokens_acc, tok_idx, token_if_not_escaped, s);
+        tok_idx += 1;
     }
-    maybe_dump_tokens_acc(&tokens_acc);
+    maybe_dump_tokens_acc(&tokens_acc);
 
-    Ok(tokens_acc)
+    Ok(tokens_acc)
 }
 
-fn maybe_dump_tokens_acc(tokens_acc: &[(usize, Token)]) {
-    use std::env;
+fn maybe_dump_tokens_acc(tokens_acc: &[(usize, Token)]) {
+    use std::env;
 
-    if let Ok(debug_var) = env::var("EXPR_DEBUG_TOKENS") {
-        if debug_var == "1" {
+    if let Ok(debug_var) = env::var("EXPR_DEBUG_TOKENS") {
+        if debug_var == "1" {
             println!("EXPR_DEBUG_TOKENS");
-            for token in tokens_acc {
-                println!("\t{:?}", token);
+            for token in tokens_acc {
+                println!("\t{:?}", token);
             }
         }
     }
 }
 
-fn push_token_if_not_escaped(acc: &mut Vec<(usize, Token)>, tok_idx: usize, token: Token, s: &str) {
-    // Smells heuristics... :(
-    let prev_is_plus = match acc.last() {
-        None => false,
-        Some(t) => t.1.is_infix_plus(),
+fn push_token_if_not_escaped(acc: &mut Vec<(usize, Token)>, tok_idx: usize, token: Token, s: &str) {
+    // Smells heuristics... :(
+    let prev_is_plus = match acc.last() {
+        None => false,
+        Some(t) => t.1.is_infix_plus(),
     };
-    let should_use_as_escaped = if prev_is_plus && acc.len() >= 2 {
-        let pre_prev = &acc[acc.len() - 2];
-        !(pre_prev.1.is_a_number() || pre_prev.1.is_a_close_paren())
-    } else {
-        prev_is_plus
+    let should_use_as_escaped = if prev_is_plus && acc.len() >= 2 {
+        let pre_prev = &acc[acc.len() - 2];
+        !(pre_prev.1.is_a_number() || pre_prev.1.is_a_close_paren())
+    } else {
+        prev_is_plus
     };
 
-    if should_use_as_escaped {
-        acc.pop();
-        acc.push((tok_idx, Token::new_value(s)));
-    } else {
-        acc.push((tok_idx, token));
+    if should_use_as_escaped {
+        acc.pop();
+        acc.push((tok_idx, Token::new_value(s)));
+    } else {
+        acc.push((tok_idx, token));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/cli.rs.html b/dev/src/uu_factor/cli.rs.html index 57c7f1268..a042a77e5 100644 --- a/dev/src/uu_factor/cli.rs.html +++ b/dev/src/uu_factor/cli.rs.html @@ -1,4 +1,4 @@ -cli.rs - source
1
+cli.rs - source
1
 2
 3
 4
@@ -85,92 +85,92 @@
 85
 86
 87
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2014 T. Jameson Little <t.jameson.little@gmail.com>
-// * (c) 2020 nicoo <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2014 T. Jameson Little <t.jameson.little@gmail.com>
+// * (c) 2020 nicoo <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use std::error::Error;
-use std::fmt::Write as FmtWrite;
-use std::io::BufRead;
-use std::io::{self, stdin, stdout, Write};
+use std::error::Error;
+use std::fmt::Write as FmtWrite;
+use std::io::BufRead;
+use std::io::{self, stdin, stdout, Write};
 
-mod factor;
-use clap::{crate_version, Arg, ArgAction, Command};
-pub use factor::*;
-use uucore::display::Quotable;
-use uucore::error::UResult;
+mod factor;
+use clap::{crate_version, Arg, ArgAction, Command};
+pub use factor::*;
+use uucore::display::Quotable;
+use uucore::error::UResult;
 
-mod miller_rabin;
-pub mod numeric;
-mod rho;
-pub mod table;
+mod miller_rabin;
+pub mod numeric;
+mod rho;
+pub mod table;
 
-static ABOUT: &str = r#"Print the prime factors of the given NUMBER(s).
+static ABOUT: &str = r#"Print the prime factors of the given NUMBER(s).
 If none are specified, read from standard input."#;
 
-mod options {
-    pub static NUMBER: &str = "NUMBER";
+mod options {
+    pub static NUMBER: &str = "NUMBER";
 }
 
-fn print_factors_str(
-    num_str: &str,
-    w: &mut io::BufWriter<impl io::Write>,
-    factors_buffer: &mut String,
-) -> Result<(), Box<dyn Error>> {
-    num_str.parse::<u64>().map_err(|e| e.into()).and_then(|x| {
-        factors_buffer.clear();
-        writeln!(factors_buffer, "{}:{}", x, factor(x))?;
-        w.write_all(factors_buffer.as_bytes())?;
+fn print_factors_str(
+    num_str: &str,
+    w: &mut io::BufWriter<impl io::Write>,
+    factors_buffer: &mut String,
+) -> Result<(), Box<dyn Error>> {
+    num_str.parse::<u64>().map_err(|e| e.into()).and_then(|x| {
+        factors_buffer.clear();
+        writeln!(factors_buffer, "{}:{}", x, factor(x))?;
+        w.write_all(factors_buffer.as_bytes())?;
         Ok(())
     })
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
-    let stdout = stdout();
-    // We use a smaller buffer here to pass a gnu test. 4KiB appears to be the default pipe size for bash.
-    let mut w = io::BufWriter::with_capacity(4 * 1024, stdout.lock());
-    let mut factors_buffer = String::new();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
+    let stdout = stdout();
+    // We use a smaller buffer here to pass a gnu test. 4KiB appears to be the default pipe size for bash.
+    let mut w = io::BufWriter::with_capacity(4 * 1024, stdout.lock());
+    let mut factors_buffer = String::new();
 
-    if let Some(values) = matches.get_many::<String>(options::NUMBER) {
-        for number in values {
-            if let Err(e) = print_factors_str(number, &mut w, &mut factors_buffer) {
-                show_warning!("{}: {}", number.maybe_quote(), e);
+    if let Some(values) = matches.get_many::<String>(options::NUMBER) {
+        for number in values {
+            if let Err(e) = print_factors_str(number, &mut w, &mut factors_buffer) {
+                show_warning!("{}: {}", number.maybe_quote(), e);
             }
         }
-    } else {
-        let stdin = stdin();
-        let lines = stdin.lock().lines();
-        for line in lines {
-            for number in line.unwrap().split_whitespace() {
-                if let Err(e) = print_factors_str(number, &mut w, &mut factors_buffer) {
-                    show_warning!("{}: {}", number.maybe_quote(), e);
+    } else {
+        let stdin = stdin();
+        let lines = stdin.lock().lines();
+        for line in lines {
+            for number in line.unwrap().split_whitespace() {
+                if let Err(e) = print_factors_str(number, &mut w, &mut factors_buffer) {
+                    show_warning!("{}: {}", number.maybe_quote(), e);
                 }
             }
         }
     }
 
-    if let Err(e) = w.flush() {
-        show_error!("{}", e);
+    if let Err(e) = w.flush() {
+        show_error!("{}", e);
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(Arg::new(options::NUMBER).action(ArgAction::Append))
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(Arg::new(options::NUMBER).action(ArgAction::Append))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/factor.rs.html b/dev/src/uu_factor/factor.rs.html index c596192f3..279a29570 100644 --- a/dev/src/uu_factor/factor.rs.html +++ b/dev/src/uu_factor/factor.rs.html @@ -1,4 +1,4 @@ -factor.rs - source
1
+factor.rs - source
1
 2
 3
 4
@@ -297,108 +297,108 @@
 297
 298
 299
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2020 nicoo <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2020 nicoo <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-use smallvec::SmallVec;
-use std::cell::RefCell;
-use std::fmt;
+use smallvec::SmallVec;
+use std::cell::RefCell;
+use std::fmt;
 
-use crate::numeric::{Arithmetic, Montgomery};
-use crate::{miller_rabin, rho, table};
+use crate::numeric::{Arithmetic, Montgomery};
+use crate::{miller_rabin, rho, table};
 
-type Exponent = u8;
+type Exponent = u8;
 
-#[derive(Clone, Debug, Default)]
-struct Decomposition(SmallVec<[(u64, Exponent); NUM_FACTORS_INLINE]>);
+#[derive(Clone, Debug, Default)]
+struct Decomposition(SmallVec<[(u64, Exponent); NUM_FACTORS_INLINE]>);
 
-// spell-checker:ignore (names) Erdős–Kac * Erdős Kac
-// The number of factors to inline directly into a `Decomposition` object.
-// As a consequence of the Erdős–Kac theorem, the average number of prime factors
-// of integers < 10²⁵ ≃ 2⁸³ is 4, so we can use a slightly higher value.
-const NUM_FACTORS_INLINE: usize = 5;
+// spell-checker:ignore (names) Erdős–Kac * Erdős Kac
+// The number of factors to inline directly into a `Decomposition` object.
+// As a consequence of the Erdős–Kac theorem, the average number of prime factors
+// of integers < 10²⁵ ≃ 2⁸³ is 4, so we can use a slightly higher value.
+const NUM_FACTORS_INLINE: usize = 5;
 
-impl Decomposition {
-    fn one() -> Self {
-        Self::default()
+impl Decomposition {
+    fn one() -> Self {
+        Self::default()
     }
 
-    fn add(&mut self, factor: u64, exp: Exponent) {
-        debug_assert!(exp > 0);
+    fn add(&mut self, factor: u64, exp: Exponent) {
+        debug_assert!(exp > 0);
 
-        if let Some((_, e)) = self.0.iter_mut().find(|(f, _)| *f == factor) {
-            *e += exp;
-        } else {
-            self.0.push((factor, exp));
+        if let Some((_, e)) = self.0.iter_mut().find(|(f, _)| *f == factor) {
+            *e += exp;
+        } else {
+            self.0.push((factor, exp));
         }
     }
 
-    #[cfg(test)]
-    fn product(&self) -> u64 {
-        self.0
-            .iter()
-            .fold(1, |acc, (p, exp)| acc * p.pow(*exp as u32))
+    #[cfg(test)]
+    fn product(&self) -> u64 {
+        self.0
+            .iter()
+            .fold(1, |acc, (p, exp)| acc * p.pow(*exp as u32))
     }
 
-    fn get(&self, p: u64) -> Option<&(u64, u8)> {
-        self.0.iter().find(|(q, _)| *q == p)
+    fn get(&self, p: u64) -> Option<&(u64, u8)> {
+        self.0.iter().find(|(q, _)| *q == p)
     }
 }
 
-impl PartialEq for Decomposition {
-    fn eq(&self, other: &Self) -> bool {
-        for p in &self.0 {
-            if other.get(p.0) != Some(p) {
-                return false;
+impl PartialEq for Decomposition {
+    fn eq(&self, other: &Self) -> bool {
+        for p in &self.0 {
+            if other.get(p.0) != Some(p) {
+                return false;
             }
         }
 
-        for p in &other.0 {
-            if self.get(p.0) != Some(p) {
-                return false;
+        for p in &other.0 {
+            if self.get(p.0) != Some(p) {
+                return false;
             }
         }
 
-        true
-    }
+        true
+    }
 }
-impl Eq for Decomposition {}
+impl Eq for Decomposition {}
 
-#[derive(Clone, Debug, Eq, PartialEq)]
-pub struct Factors(RefCell<Decomposition>);
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub struct Factors(RefCell<Decomposition>);
 
-impl Factors {
-    pub fn one() -> Self {
-        Self(RefCell::new(Decomposition::one()))
+impl Factors {
+    pub fn one() -> Self {
+        Self(RefCell::new(Decomposition::one()))
     }
 
-    pub fn add(&mut self, prime: u64, exp: Exponent) {
-        debug_assert!(miller_rabin::is_prime(prime));
-        self.0.borrow_mut().add(prime, exp);
+    pub fn add(&mut self, prime: u64, exp: Exponent) {
+        debug_assert!(miller_rabin::is_prime(prime));
+        self.0.borrow_mut().add(prime, exp);
     }
 
-    pub fn push(&mut self, prime: u64) {
-        self.add(prime, 1);
+    pub fn push(&mut self, prime: u64) {
+        self.add(prime, 1);
     }
 
-    #[cfg(test)]
-    fn product(&self) -> u64 {
-        self.0.borrow().product()
+    #[cfg(test)]
+    fn product(&self) -> u64 {
+        self.0.borrow().product()
     }
 }
 
-impl fmt::Display for Factors {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        let v = &mut (self.0).borrow_mut().0;
-        v.sort_unstable();
+impl fmt::Display for Factors {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let v = &mut (self.0).borrow_mut().0;
+        v.sort_unstable();
 
-        for (p, exp) in v.iter() {
-            for _ in 0..*exp {
-                write!(f, " {}", p)?;
+        for (p, exp) in v.iter() {
+            for _ in 0..*exp {
+                write!(f, " {}", p)?;
             }
         }
 
@@ -406,195 +406,195 @@
     }
 }
 
-fn _factor<A: Arithmetic + miller_rabin::Basis>(num: u64, f: Factors) -> Factors {
-    use miller_rabin::Result::*;
+fn _factor<A: Arithmetic + miller_rabin::Basis>(num: u64, f: Factors) -> Factors {
+    use miller_rabin::Result::*;
 
-    // Shadow the name, so the recursion automatically goes from “Big” arithmetic to small.
-    let _factor = |n, f| {
-        if n < (1 << 32) {
-            _factor::<Montgomery<u32>>(n, f)
-        } else {
-            _factor::<A>(n, f)
+    // Shadow the name, so the recursion automatically goes from “Big” arithmetic to small.
+    let _factor = |n, f| {
+        if n < (1 << 32) {
+            _factor::<Montgomery<u32>>(n, f)
+        } else {
+            _factor::<A>(n, f)
         }
     };
 
-    if num == 1 {
-        return f;
+    if num == 1 {
+        return f;
     }
 
-    let n = A::new(num);
-    let divisor = match miller_rabin::test::<A>(n) {
-        Prime => {
-            #[cfg(feature = "coz")]
-            coz::progress!("factor found");
-            let mut r = f;
-            r.push(num);
-            return r;
+    let n = A::new(num);
+    let divisor = match miller_rabin::test::<A>(n) {
+        Prime => {
+            #[cfg(feature = "coz")]
+            coz::progress!("factor found");
+            let mut r = f;
+            r.push(num);
+            return r;
         }
 
-        Composite(d) => d,
-        Pseudoprime => rho::find_divisor::<A>(n),
+        Composite(d) => d,
+        Pseudoprime => rho::find_divisor::<A>(n),
     };
 
-    let f = _factor(divisor, f);
-    _factor(num / divisor, f)
+    let f = _factor(divisor, f);
+    _factor(num / divisor, f)
 }
 
-pub fn factor(mut n: u64) -> Factors {
-    #[cfg(feature = "coz")]
-    coz::begin!("factorization");
-    let mut factors = Factors::one();
+pub fn factor(mut n: u64) -> Factors {
+    #[cfg(feature = "coz")]
+    coz::begin!("factorization");
+    let mut factors = Factors::one();
 
-    if n < 2 {
-        return factors;
+    if n < 2 {
+        return factors;
     }
 
-    let n_zeros = n.trailing_zeros();
-    if n_zeros > 0 {
-        factors.add(2, n_zeros as Exponent);
-        n >>= n_zeros;
+    let n_zeros = n.trailing_zeros();
+    if n_zeros > 0 {
+        factors.add(2, n_zeros as Exponent);
+        n >>= n_zeros;
     }
 
-    if n == 1 {
-        #[cfg(feature = "coz")]
-        coz::end!("factorization");
-        return factors;
+    if n == 1 {
+        #[cfg(feature = "coz")]
+        coz::end!("factorization");
+        return factors;
     }
 
-    table::factor(&mut n, &mut factors);
+    table::factor(&mut n, &mut factors);
 
-    #[allow(clippy::let_and_return)]
-    let r = if n < (1 << 32) {
-        _factor::<Montgomery<u32>>(n, factors)
-    } else {
-        _factor::<Montgomery<u64>>(n, factors)
+    #[allow(clippy::let_and_return)]
+    let r = if n < (1 << 32) {
+        _factor::<Montgomery<u32>>(n, factors)
+    } else {
+        _factor::<Montgomery<u64>>(n, factors)
     };
 
-    #[cfg(feature = "coz")]
-    coz::end!("factorization");
+    #[cfg(feature = "coz")]
+    coz::end!("factorization");
 
-    r
+    r
 }
 
-#[cfg(test)]
-mod tests {
-    use super::{factor, Decomposition, Exponent, Factors};
-    use quickcheck::quickcheck;
-    use smallvec::smallvec;
-    use std::cell::RefCell;
+#[cfg(test)]
+mod tests {
+    use super::{factor, Decomposition, Exponent, Factors};
+    use quickcheck::quickcheck;
+    use smallvec::smallvec;
+    use std::cell::RefCell;
 
-    #[test]
-    fn factor_2044854919485649() {
-        let f = Factors(RefCell::new(Decomposition(smallvec![
+    #[test]
+    fn factor_2044854919485649() {
+        let f = Factors(RefCell::new(Decomposition(smallvec![
             (503, 1),
             (2423, 1),
             (40961, 2)
         ])));
-        assert_eq!(factor(f.product()), f);
+        assert_eq!(factor(f.product()), f);
     }
 
-    #[test]
-    fn factor_recombines_small() {
+    #[test]
+    fn factor_recombines_small() {
         assert!((1..10_000)
-            .map(|i| 2 * i + 1)
-            .all(|i| factor(i).product() == i));
+            .map(|i| 2 * i + 1)
+            .all(|i| factor(i).product() == i));
     }
 
-    #[test]
-    fn factor_recombines_overflowing() {
+    #[test]
+    fn factor_recombines_overflowing() {
         assert!((0..250)
-            .map(|i| 2 * i + 2u64.pow(32) + 1)
-            .all(|i| factor(i).product() == i));
+            .map(|i| 2 * i + 2u64.pow(32) + 1)
+            .all(|i| factor(i).product() == i));
     }
 
-    #[test]
-    fn factor_recombines_strong_pseudoprime() {
-        // This is a strong pseudoprime (wrt. miller_rabin::BASIS)
-        //  and triggered a bug in rho::factor's code path handling
-        //  miller_rabbin::Result::Composite
-        let pseudoprime = 17179869183;
-        for _ in 0..20 {
-            // Repeat the test 20 times, as it only fails some fraction
-            // of the time.
-            assert!(factor(pseudoprime).product() == pseudoprime);
+    #[test]
+    fn factor_recombines_strong_pseudoprime() {
+        // This is a strong pseudoprime (wrt. miller_rabin::BASIS)
+        //  and triggered a bug in rho::factor's code path handling
+        //  miller_rabbin::Result::Composite
+        let pseudoprime = 17179869183;
+        for _ in 0..20 {
+            // Repeat the test 20 times, as it only fails some fraction
+            // of the time.
+            assert!(factor(pseudoprime).product() == pseudoprime);
         }
     }
 
-    quickcheck! {
-        fn factor_recombines(i: u64) -> bool {
-            i == 0 || factor(i).product() == i
+    quickcheck! {
+        fn factor_recombines(i: u64) -> bool {
+            i == 0 || factor(i).product() == i
         }
 
-        fn recombines_factors(f: Factors) -> () {
-            assert_eq!(factor(f.product()), f);
+        fn recombines_factors(f: Factors) -> () {
+            assert_eq!(factor(f.product()), f);
         }
 
-        fn exponentiate_factors(f: Factors, e: Exponent) -> () {
-            if e == 0 { return; }
-            if let Some(fe) = f.product().checked_pow(e.into()) {
-                assert_eq!(factor(fe), f ^ e);
+        fn exponentiate_factors(f: Factors, e: Exponent) -> () {
+            if e == 0 { return; }
+            if let Some(fe) = f.product().checked_pow(e.into()) {
+                assert_eq!(factor(fe), f ^ e);
             }
         }
     }
 }
 
-#[cfg(test)]
-use rand::{
-    distributions::{Distribution, Standard},
-    Rng,
+#[cfg(test)]
+use rand::{
+    distributions::{Distribution, Standard},
+    Rng,
 };
-#[cfg(test)]
-impl Distribution<Factors> for Standard {
-    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Factors {
-        let mut f = Factors::one();
-        let mut g = 1u64;
-        let mut n = u64::MAX;
+#[cfg(test)]
+impl Distribution<Factors> for Standard {
+    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Factors {
+        let mut f = Factors::one();
+        let mut g = 1u64;
+        let mut n = u64::MAX;
 
-        // spell-checker:ignore (names) Adam Kalai * Kalai's
-        // Adam Kalai's algorithm for generating uniformly-distributed
-        // integers and their factorization.
-        //
-        // See Generating Random Factored Numbers, Easily, J. Cryptology (2003)
-        'attempt: loop {
-            while n > 1 {
-                n = rng.gen_range(1..n);
-                if miller_rabin::is_prime(n) {
-                    if let Some(h) = g.checked_mul(n) {
-                        f.push(n);
-                        g = h;
-                    } else {
-                        // We are overflowing u64, retry
-                        continue 'attempt;
+        // spell-checker:ignore (names) Adam Kalai * Kalai's
+        // Adam Kalai's algorithm for generating uniformly-distributed
+        // integers and their factorization.
+        //
+        // See Generating Random Factored Numbers, Easily, J. Cryptology (2003)
+        'attempt: loop {
+            while n > 1 {
+                n = rng.gen_range(1..n);
+                if miller_rabin::is_prime(n) {
+                    if let Some(h) = g.checked_mul(n) {
+                        f.push(n);
+                        g = h;
+                    } else {
+                        // We are overflowing u64, retry
+                        continue 'attempt;
                     }
                 }
             }
 
-            return f;
+            return f;
         }
     }
 }
 
-#[cfg(test)]
-impl quickcheck::Arbitrary for Factors {
-    fn arbitrary(g: &mut quickcheck::Gen) -> Self {
-        factor(u64::arbitrary(g))
+#[cfg(test)]
+impl quickcheck::Arbitrary for Factors {
+    fn arbitrary(g: &mut quickcheck::Gen) -> Self {
+        factor(u64::arbitrary(g))
     }
 }
 
-#[cfg(test)]
-impl std::ops::BitXor<Exponent> for Factors {
-    type Output = Self;
+#[cfg(test)]
+impl std::ops::BitXor<Exponent> for Factors {
+    type Output = Self;
 
-    fn bitxor(self, rhs: Exponent) -> Self {
-        debug_assert_ne!(rhs, 0);
-        let mut r = Self::one();
-        for (p, e) in self.0.borrow().0.iter() {
-            r.add(*p, rhs * e);
+    fn bitxor(self, rhs: Exponent) -> Self {
+        debug_assert_ne!(rhs, 0);
+        let mut r = Self::one();
+        for (p, e) in self.0.borrow().0.iter() {
+            r.add(*p, rhs * e);
         }
 
-        debug_assert_eq!(r.product(), self.product().pow(rhs.into()));
-        r
+        debug_assert_eq!(r.product(), self.product().pow(rhs.into()));
+        r
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/uu_factor-a22a187695a37cb5/out/prime_table.rs.html b/dev/src/uu_factor/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/uu_factor-2ffad854a35da68f/out/prime_table.rs.html similarity index 92% rename from dev/src/uu_factor/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/uu_factor-a22a187695a37cb5/out/prime_table.rs.html rename to dev/src/uu_factor/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/uu_factor-2ffad854a35da68f/out/prime_table.rs.html index e019c48c3..21efeb292 100644 --- a/dev/src/uu_factor/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/uu_factor-a22a187695a37cb5/out/prime_table.rs.html +++ b/dev/src/uu_factor/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/uu_factor-2ffad854a35da68f/out/prime_table.rs.html @@ -1,4 +1,4 @@ -prime_table.rs - source
1
+prime_table.rs - source
1
 2
 3
 4
@@ -184,14 +184,14 @@
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
-*/
+*/
 
-// *** NOTE: this file was automatically generated.
-// Please do not edit by hand. Instead, modify and
-// re-run src/factor/gen_tables.rs.
+// *** NOTE: this file was automatically generated.
+// Please do not edit by hand. Instead, modify and
+// re-run src/factor/gen_tables.rs.
 
-#[allow(clippy::unreadable_literal)]
-pub const PRIME_INVERSIONS_U64: &[(u64, u64, u64)] = &[
+#[allow(clippy::unreadable_literal)]
+pub const PRIME_INVERSIONS_U64: &[(u64, u64, u64)] = &[
     (3, 12297829382473034411, 6148914691236517205), (5, 14757395258967641293, 3689348814741910323),
     (7, 7905747460161236407, 2635249153387078802), (11, 3353953467947191203, 1676976733973595601),
     (13, 5675921253449092805, 1418980313362273201), (17, 17361641481138401521, 1085102592571150095),
@@ -354,7 +354,7 @@
     (2129, 5588609641870672049, 8664511072667708), (2131, 16317274790681607131, 8656379199300587),
 ];
 
-#[allow(dead_code)]
-pub const NEXT_PRIME: u64 = 2137;
+#[allow(dead_code)]
+pub const NEXT_PRIME: u64 = 2137;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/miller_rabin.rs.html b/dev/src/uu_factor/miller_rabin.rs.html index 38089c5b8..49ef5e869 100644 --- a/dev/src/uu_factor/miller_rabin.rs.html +++ b/dev/src/uu_factor/miller_rabin.rs.html @@ -1,4 +1,4 @@ -miller_rabin.rs - source
1
+miller_rabin.rs - source
1
 2
 3
 4
@@ -208,215 +208,215 @@
 208
 209
 210
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2020 nicoo <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2020 nicoo <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-// spell-checker:ignore (URL) appspot
+// spell-checker:ignore (URL) appspot
 
-use crate::numeric::*;
+use crate::numeric::*;
 
-pub(crate) trait Basis {
-    const BASIS: &'static [u64];
+pub(crate) trait Basis {
+    const BASIS: &'static [u64];
 }
 
-impl Basis for Montgomery<u64> {
-    // Small set of bases for the Miller-Rabin prime test, valid for all 64b integers;
-    //  discovered by Jim Sinclair on 2011-04-20, see miller-rabin.appspot.com
-    #[allow(clippy::unreadable_literal)]
-    const BASIS: &'static [u64] = &[2, 325, 9375, 28178, 450775, 9780504, 1795265022];
+impl Basis for Montgomery<u64> {
+    // Small set of bases for the Miller-Rabin prime test, valid for all 64b integers;
+    //  discovered by Jim Sinclair on 2011-04-20, see miller-rabin.appspot.com
+    #[allow(clippy::unreadable_literal)]
+    const BASIS: &'static [u64] = &[2, 325, 9375, 28178, 450775, 9780504, 1795265022];
 }
 
-impl Basis for Montgomery<u32> {
-    // spell-checker:ignore (names) Steve Worley
-    // Small set of bases for the Miller-Rabin prime test, valid for all 32b integers;
-    //  discovered by Steve Worley on 2013-05-27, see miller-rabin.appspot.com
-    #[allow(clippy::unreadable_literal)]
-    const BASIS: &'static [u64] = &[
+impl Basis for Montgomery<u32> {
+    // spell-checker:ignore (names) Steve Worley
+    // Small set of bases for the Miller-Rabin prime test, valid for all 32b integers;
+    //  discovered by Steve Worley on 2013-05-27, see miller-rabin.appspot.com
+    #[allow(clippy::unreadable_literal)]
+    const BASIS: &'static [u64] = &[
         4230279247111683200,
         14694767155120705706,
         16641139526367750375,
     ];
 }
 
-#[derive(Eq, PartialEq)]
-#[must_use = "Ignoring the output of a primality test."]
-pub(crate) enum Result {
-    Prime,
-    Pseudoprime,
-    Composite(u64),
+#[derive(Eq, PartialEq)]
+#[must_use = "Ignoring the output of a primality test."]
+pub(crate) enum Result {
+    Prime,
+    Pseudoprime,
+    Composite(u64),
 }
 
-impl Result {
-    pub(crate) fn is_prime(&self) -> bool {
-        *self == Self::Prime
+impl Result {
+    pub(crate) fn is_prime(&self) -> bool {
+        *self == Self::Prime
     }
 }
 
-// Deterministic Miller-Rabin primality-checking algorithm, adapted to extract
-// (some) dividers; it will fail to factor strong pseudoprimes.
-#[allow(clippy::many_single_char_names)]
-pub(crate) fn test<A: Arithmetic + Basis>(m: A) -> Result {
-    use self::Result::*;
+// Deterministic Miller-Rabin primality-checking algorithm, adapted to extract
+// (some) dividers; it will fail to factor strong pseudoprimes.
+#[allow(clippy::many_single_char_names)]
+pub(crate) fn test<A: Arithmetic + Basis>(m: A) -> Result {
+    use self::Result::*;
 
-    let n = m.modulus();
-    debug_assert!(n > 1);
-    debug_assert!(n % 2 != 0);
+    let n = m.modulus();
+    debug_assert!(n > 1);
+    debug_assert!(n % 2 != 0);
 
-    // n-1 = r 2ⁱ
-    let i = (n - 1).trailing_zeros();
-    let r = (n - 1) >> i;
+    // n-1 = r 2ⁱ
+    let i = (n - 1).trailing_zeros();
+    let r = (n - 1) >> i;
 
-    let one = m.one();
-    let minus_one = m.minus_one();
+    let one = m.one();
+    let minus_one = m.minus_one();
 
-    'witness: for _a in A::BASIS.iter() {
-        let _a = _a % n;
-        if _a == 0 {
+    'witness: for _a in A::BASIS.iter() {
+        let _a = _a % n;
+        if _a == 0 {
             continue;
         }
 
-        let a = m.to_mod(_a);
+        let a = m.to_mod(_a);
 
-        // x = a^r mod n
-        let mut x = m.pow(a, r);
+        // x = a^r mod n
+        let mut x = m.pow(a, r);
 
-        if x == one || x == minus_one {
+        if x == one || x == minus_one {
             continue;
         }
 
-        for _ in 1..i {
-            let y = m.mul(x, x);
-            if y == one {
-                return Composite(gcd(m.to_u64(x) - 1, m.modulus()));
-            } else if y == minus_one {
-                // This basis element is not a witness of `n` being composite.
-                // Keep looking.
-                continue 'witness;
+        for _ in 1..i {
+            let y = m.mul(x, x);
+            if y == one {
+                return Composite(gcd(m.to_u64(x) - 1, m.modulus()));
+            } else if y == minus_one {
+                // This basis element is not a witness of `n` being composite.
+                // Keep looking.
+                continue 'witness;
             }
-            x = y;
+            x = y;
         }
 
-        return Pseudoprime;
+        return Pseudoprime;
     }
 
-    Prime
+    Prime
 }
 
-// Used by build.rs' tests and debug assertions
-#[allow(dead_code)]
-pub(crate) fn is_prime(n: u64) -> bool {
-    if n < 2 {
-        false
-    } else if n % 2 == 0 {
-        n == 2
-    } else {
-        test::<Montgomery<u64>>(Montgomery::new(n)).is_prime()
+// Used by build.rs' tests and debug assertions
+#[allow(dead_code)]
+pub(crate) fn is_prime(n: u64) -> bool {
+    if n < 2 {
+        false
+    } else if n % 2 == 0 {
+        n == 2
+    } else {
+        test::<Montgomery<u64>>(Montgomery::new(n)).is_prime()
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use crate::numeric::{traits::DoubleInt, Arithmetic, Montgomery};
-    use crate::parametrized_check;
-    use quickcheck::quickcheck;
-    use std::iter;
-    const LARGEST_U64_PRIME: u64 = 0xFFFFFFFFFFFFFFC5;
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::numeric::{traits::DoubleInt, Arithmetic, Montgomery};
+    use crate::parametrized_check;
+    use quickcheck::quickcheck;
+    use std::iter;
+    const LARGEST_U64_PRIME: u64 = 0xFFFFFFFFFFFFFFC5;
 
-    fn primes() -> impl Iterator<Item = u64> {
-        iter::once(2).chain(odd_primes())
+    fn primes() -> impl Iterator<Item = u64> {
+        iter::once(2).chain(odd_primes())
     }
 
-    fn odd_primes() -> impl Iterator<Item = u64> {
-        use crate::table::{NEXT_PRIME, PRIME_INVERSIONS_U64};
-        PRIME_INVERSIONS_U64
-            .iter()
-            .map(|(p, _, _)| *p)
-            .chain(iter::once(NEXT_PRIME))
+    fn odd_primes() -> impl Iterator<Item = u64> {
+        use crate::table::{NEXT_PRIME, PRIME_INVERSIONS_U64};
+        PRIME_INVERSIONS_U64
+            .iter()
+            .map(|(p, _, _)| *p)
+            .chain(iter::once(NEXT_PRIME))
     }
 
-    #[test]
-    fn largest_prime() {
-        assert!(is_prime(LARGEST_U64_PRIME));
+    #[test]
+    fn largest_prime() {
+        assert!(is_prime(LARGEST_U64_PRIME));
     }
 
-    #[test]
-    fn largest_composites() {
-        for i in LARGEST_U64_PRIME + 1..=u64::MAX {
-            assert!(!is_prime(i), "2⁶⁴ - {} reported prime", u64::MAX - i + 1);
+    #[test]
+    fn largest_composites() {
+        for i in LARGEST_U64_PRIME + 1..=u64::MAX {
+            assert!(!is_prime(i), "2⁶⁴ - {} reported prime", u64::MAX - i + 1);
         }
     }
 
-    #[test]
-    fn two() {
-        assert!(is_prime(2));
+    #[test]
+    fn two() {
+        assert!(is_prime(2));
     }
 
-    fn first_primes<A: DoubleInt>()
-    where
-        Montgomery<A>: Basis,
+    fn first_primes<A: DoubleInt>()
+    where
+        Montgomery<A>: Basis,
     {
-        for p in odd_primes() {
+        for p in odd_primes() {
             assert!(
-                test(Montgomery::<A>::new(p)).is_prime(),
+                test(Montgomery::<A>::new(p)).is_prime(),
                 "{} reported composite",
-                p
+                p
             );
         }
     }
-    parametrized_check!(first_primes);
+    parametrized_check!(first_primes);
 
-    #[test]
-    fn one() {
-        assert!(!is_prime(1));
+    #[test]
+    fn one() {
+        assert!(!is_prime(1));
     }
-    #[test]
-    fn zero() {
-        assert!(!is_prime(0));
+    #[test]
+    fn zero() {
+        assert!(!is_prime(0));
     }
 
-    #[test]
-    fn first_composites() {
-        for (p, q) in primes().zip(odd_primes()) {
-            for i in p + 1..q {
-                assert!(!is_prime(i), "{} reported prime", i);
+    #[test]
+    fn first_composites() {
+        for (p, q) in primes().zip(odd_primes()) {
+            for i in p + 1..q {
+                assert!(!is_prime(i), "{} reported prime", i);
             }
         }
     }
 
-    #[test]
-    fn issue_1556() {
-        // 10 425 511 = 2441 × 4271
-        assert!(!is_prime(10_425_511));
+    #[test]
+    fn issue_1556() {
+        // 10 425 511 = 2441 × 4271
+        assert!(!is_prime(10_425_511));
     }
 
-    fn small_semiprimes<A: DoubleInt>()
-    where
-        Montgomery<A>: Basis,
+    fn small_semiprimes<A: DoubleInt>()
+    where
+        Montgomery<A>: Basis,
     {
-        for p in odd_primes() {
-            for q in odd_primes().take_while(|q| *q <= p) {
-                let n = p * q;
-                let m = Montgomery::<A>::new(n);
-                assert!(!test(m).is_prime(), "{} = {} × {} reported prime", n, p, q);
+        for p in odd_primes() {
+            for q in odd_primes().take_while(|q| *q <= p) {
+                let n = p * q;
+                let m = Montgomery::<A>::new(n);
+                assert!(!test(m).is_prime(), "{} = {} × {} reported prime", n, p, q);
             }
         }
     }
-    parametrized_check!(small_semiprimes);
+    parametrized_check!(small_semiprimes);
 
-    quickcheck! {
-        fn composites(i: u64, j: u64) -> bool {
-            // TODO: #1559 factor n > 2^64 - 1
-            match i.checked_mul(j) {
-                Some(n) => i < 2 || j < 2 || !is_prime(n),
-                _ => true,
+    quickcheck! {
+        fn composites(i: u64, j: u64) -> bool {
+            // TODO: #1559 factor n > 2^64 - 1
+            match i.checked_mul(j) {
+                Some(n) => i < 2 || j < 2 || !is_prime(n),
+                _ => true,
             }
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/numeric/gcd.rs.html b/dev/src/uu_factor/numeric/gcd.rs.html index 6dfdaf164..cf1e543c1 100644 --- a/dev/src/uu_factor/numeric/gcd.rs.html +++ b/dev/src/uu_factor/numeric/gcd.rs.html @@ -1,4 +1,4 @@ -gcd.rs - source
1
+gcd.rs - source
1
 2
 3
 4
@@ -127,134 +127,134 @@
 127
 128
 129
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2015 Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
-// * (c) 2020 nicoo            <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2015 Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
+// * (c) 2020 nicoo            <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-// spell-checker:ignore (vars) kgcdab gcdac gcdbc
+// spell-checker:ignore (vars) kgcdab gcdac gcdbc
 
-use std::cmp::min;
-use std::mem::swap;
+use std::cmp::min;
+use std::mem::swap;
 
-pub fn gcd(mut u: u64, mut v: u64) -> u64 {
-    // Stein's binary GCD algorithm
-    // Base cases: gcd(n, 0) = gcd(0, n) = n
-    if u == 0 {
-        return v;
-    } else if v == 0 {
-        return u;
+pub fn gcd(mut u: u64, mut v: u64) -> u64 {
+    // Stein's binary GCD algorithm
+    // Base cases: gcd(n, 0) = gcd(0, n) = n
+    if u == 0 {
+        return v;
+    } else if v == 0 {
+        return u;
     }
 
-    // gcd(2ⁱ u, 2ʲ v) = 2ᵏ gcd(u, v) with u, v odd and k = min(i, j)
-    // 2ᵏ is the greatest power of two that divides both u and v
-    let k = {
-        let i = u.trailing_zeros();
-        let j = v.trailing_zeros();
-        u >>= i;
-        v >>= j;
-        min(i, j)
+    // gcd(2ⁱ u, 2ʲ v) = 2ᵏ gcd(u, v) with u, v odd and k = min(i, j)
+    // 2ᵏ is the greatest power of two that divides both u and v
+    let k = {
+        let i = u.trailing_zeros();
+        let j = v.trailing_zeros();
+        u >>= i;
+        v >>= j;
+        min(i, j)
     };
 
-    loop {
-        // Loop invariant: u and v are odd
-        debug_assert!(u % 2 == 1, "u = {} is even", u);
-        debug_assert!(v % 2 == 1, "v = {} is even", v);
+    loop {
+        // Loop invariant: u and v are odd
+        debug_assert!(u % 2 == 1, "u = {} is even", u);
+        debug_assert!(v % 2 == 1, "v = {} is even", v);
 
-        // gcd(u, v) = gcd(|u - v|, min(u, v))
-        if u > v {
-            swap(&mut u, &mut v);
+        // gcd(u, v) = gcd(|u - v|, min(u, v))
+        if u > v {
+            swap(&mut u, &mut v);
         }
-        v -= u;
+        v -= u;
 
-        if v == 0 {
-            // Reached the base case; gcd is 2ᵏ u
-            return u << k;
+        if v == 0 {
+            // Reached the base case; gcd is 2ᵏ u
+            return u << k;
         }
 
-        // gcd(u, 2ʲ v) = gcd(u, v) as u is odd
-        v >>= v.trailing_zeros();
+        // gcd(u, 2ʲ v) = gcd(u, v) as u is odd
+        v >>= v.trailing_zeros();
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use quickcheck::{quickcheck, TestResult};
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use quickcheck::{quickcheck, TestResult};
 
-    quickcheck! {
-        fn euclidean(a: u64, b: u64) -> bool {
-            // Test against the Euclidean algorithm
-            let g = {
-                let (mut a, mut b) = (a, b);
-                while b > 0 {
-                    a %= b;
-                    swap(&mut a, &mut b);
+    quickcheck! {
+        fn euclidean(a: u64, b: u64) -> bool {
+            // Test against the Euclidean algorithm
+            let g = {
+                let (mut a, mut b) = (a, b);
+                while b > 0 {
+                    a %= b;
+                    swap(&mut a, &mut b);
                 }
-                a
+                a
             };
-            gcd(a, b) == g
+            gcd(a, b) == g
         }
 
-        fn one(a: u64) -> bool {
-            gcd(1, a) == 1
+        fn one(a: u64) -> bool {
+            gcd(1, a) == 1
+        }
+
+        fn zero(a: u64) -> bool {
+            gcd(0, a) == a
         }
 
-        fn zero(a: u64) -> bool {
-            gcd(0, a) == a
+        fn divisor(a: u64, b: u64) -> TestResult {
+            // Test that gcd(a, b) divides a and b, unless a == b == 0
+            if a == 0 && b == 0 { return TestResult::discard(); } // restrict test domain to !(a == b == 0)
+
+            let g = gcd(a, b);
+            TestResult::from_bool( g != 0 && a % g == 0 && b % g == 0 )
         }
 
-        fn divisor(a: u64, b: u64) -> TestResult {
-            // Test that gcd(a, b) divides a and b, unless a == b == 0
-            if a == 0 && b == 0 { return TestResult::discard(); } // restrict test domain to !(a == b == 0)
-
-            let g = gcd(a, b);
-            TestResult::from_bool( g != 0 && a % g == 0 && b % g == 0 )
+        fn commutative(a: u64, b: u64) -> bool {
+            gcd(a, b) == gcd(b, a)
         }
 
-        fn commutative(a: u64, b: u64) -> bool {
-            gcd(a, b) == gcd(b, a)
+        fn associative(a: u64, b: u64, c: u64) -> bool {
+            gcd(a, gcd(b, c)) == gcd(gcd(a, b), c)
         }
 
-        fn associative(a: u64, b: u64, c: u64) -> bool {
-            gcd(a, gcd(b, c)) == gcd(gcd(a, b), c)
+        fn scalar_multiplication(a: u64, b: u64, k: u64) -> bool {
+            // TODO: #1559 factor n > 2^64 - 1
+            match (k.checked_mul(a), k.checked_mul(b), k.checked_mul(gcd(a, b))) {
+                (Some(ka), Some(kb), Some(kgcdab)) => gcd(ka, kb) == kgcdab,
+                _ => true
+            }
         }
 
-        fn scalar_multiplication(a: u64, b: u64, k: u64) -> bool {
-            // TODO: #1559 factor n > 2^64 - 1
-            match (k.checked_mul(a), k.checked_mul(b), k.checked_mul(gcd(a, b))) {
-                (Some(ka), Some(kb), Some(kgcdab)) => gcd(ka, kb) == kgcdab,
-                _ => true
-            }
-        }
-
-        fn multiplicative(a: u64, b: u64, c: u64) -> bool {
-            // TODO: #1559 factor n > 2^64 - 1
-            match (a.checked_mul(b), gcd(a, c).checked_mul(gcd(b, c))) {
-                (Some(ab), Some(gcdac_gcdbc)) => {
-                    // gcd(ab, c) = gcd(a, c) gcd(b, c) when a and b coprime
-                    gcd(a, b) != 1 || gcd(ab, c) == gcdac_gcdbc
+        fn multiplicative(a: u64, b: u64, c: u64) -> bool {
+            // TODO: #1559 factor n > 2^64 - 1
+            match (a.checked_mul(b), gcd(a, c).checked_mul(gcd(b, c))) {
+                (Some(ab), Some(gcdac_gcdbc)) => {
+                    // gcd(ab, c) = gcd(a, c) gcd(b, c) when a and b coprime
+                    gcd(a, b) != 1 || gcd(ab, c) == gcdac_gcdbc
                 },
-                _ => true,
+                _ => true,
             }
         }
 
-        fn linearity(a: u64, b: u64, k: u64) -> bool {
-            // TODO: #1559 factor n > 2^64 - 1
-            match k.checked_mul(b) {
-                Some(kb) => {
-                    match a.checked_add(kb) {
-                        Some(a_plus_kb) => gcd(a_plus_kb, b) == gcd(a, b),
-                        _ => true,
+        fn linearity(a: u64, b: u64, k: u64) -> bool {
+            // TODO: #1559 factor n > 2^64 - 1
+            match k.checked_mul(b) {
+                Some(kb) => {
+                    match a.checked_add(kb) {
+                        Some(a_plus_kb) => gcd(a_plus_kb, b) == gcd(a, b),
+                        _ => true,
                     }
                 }
-                _ => true,
+                _ => true,
             }
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/numeric/mod.rs.html b/dev/src/uu_factor/numeric/mod.rs.html index dec0171e5..c9fb4e7d6 100644 --- a/dev/src/uu_factor/numeric/mod.rs.html +++ b/dev/src/uu_factor/numeric/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
@@ -15,22 +15,22 @@
 15
 16
 17
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2020 nicoo            <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2020 nicoo            <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-mod gcd;
-pub use gcd::gcd;
+mod gcd;
+pub use gcd::gcd;
 
-pub(crate) mod traits;
+pub(crate) mod traits;
 
-mod modular_inverse;
-pub(crate) use modular_inverse::modular_inverse;
+mod modular_inverse;
+pub(crate) use modular_inverse::modular_inverse;
 
-mod montgomery;
-pub(crate) use montgomery::{Arithmetic, Montgomery};
+mod montgomery;
+pub(crate) use montgomery::{Arithmetic, Montgomery};
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/numeric/modular_inverse.rs.html b/dev/src/uu_factor/numeric/modular_inverse.rs.html index e64962eeb..943831bb0 100644 --- a/dev/src/uu_factor/numeric/modular_inverse.rs.html +++ b/dev/src/uu_factor/numeric/modular_inverse.rs.html @@ -1,4 +1,4 @@ -modular_inverse.rs - source
1
+modular_inverse.rs - source
1
 2
 3
 4
@@ -77,84 +77,84 @@
 77
 78
 79
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2015 Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
-// * (c) 2020 nicoo            <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2015 Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
+// * (c) 2020 nicoo            <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-use super::traits::Int;
+use super::traits::Int;
 
-// extended Euclid algorithm
-// precondition: a is odd
-pub(crate) fn modular_inverse<T: Int>(a: T) -> T {
-    let zero = T::zero();
-    let one = T::one();
-    debug_assert!(a % (one + one) == one, "{:?} is not odd", a);
+// extended Euclid algorithm
+// precondition: a is odd
+pub(crate) fn modular_inverse<T: Int>(a: T) -> T {
+    let zero = T::zero();
+    let one = T::one();
+    debug_assert!(a % (one + one) == one, "{:?} is not odd", a);
 
-    let mut t = zero;
-    let mut new_t = one;
-    let mut r = zero;
-    let mut new_r = a;
+    let mut t = zero;
+    let mut new_t = one;
+    let mut r = zero;
+    let mut new_r = a;
 
-    while new_r != zero {
-        let quot = if r == zero {
-            // special case when we're just starting out
-            // This works because we know that
-            // a does not divide 2^64, so floor(2^64 / a) == floor((2^64-1) / a);
-            T::max_value()
-        } else {
-            r
-        } / new_r;
+    while new_r != zero {
+        let quot = if r == zero {
+            // special case when we're just starting out
+            // This works because we know that
+            // a does not divide 2^64, so floor(2^64 / a) == floor((2^64-1) / a);
+            T::max_value()
+        } else {
+            r
+        } / new_r;
 
-        let new_tp = t.wrapping_sub(&quot.wrapping_mul(&new_t));
-        t = new_t;
-        new_t = new_tp;
+        let new_tp = t.wrapping_sub(&quot.wrapping_mul(&new_t));
+        t = new_t;
+        new_t = new_tp;
 
-        let new_rp = r.wrapping_sub(&quot.wrapping_mul(&new_r));
-        r = new_r;
-        new_r = new_rp;
+        let new_rp = r.wrapping_sub(&quot.wrapping_mul(&new_r));
+        r = new_r;
+        new_r = new_rp;
     }
 
-    debug_assert_eq!(r, one);
-    t
+    debug_assert_eq!(r, one);
+    t
 }
 
-#[cfg(test)]
-mod tests {
-    use super::{super::traits::Int, *};
-    use crate::parametrized_check;
-    use quickcheck::quickcheck;
+#[cfg(test)]
+mod tests {
+    use super::{super::traits::Int, *};
+    use crate::parametrized_check;
+    use quickcheck::quickcheck;
 
-    fn small_values<T: Int>() {
-        // All odd integers from 1 to 20 000
-        let one = T::from(1).unwrap();
-        let two = T::from(2).unwrap();
-        let mut test_values = (0..10_000)
-            .map(|i| T::from(i).unwrap())
-            .map(|i| two * i + one);
+    fn small_values<T: Int>() {
+        // All odd integers from 1 to 20 000
+        let one = T::from(1).unwrap();
+        let two = T::from(2).unwrap();
+        let mut test_values = (0..10_000)
+            .map(|i| T::from(i).unwrap())
+            .map(|i| two * i + one);
 
-        assert!(test_values.all(|x| x.wrapping_mul(&modular_inverse(x)) == one));
+        assert!(test_values.all(|x| x.wrapping_mul(&modular_inverse(x)) == one));
     }
-    parametrized_check!(small_values);
+    parametrized_check!(small_values);
 
-    quickcheck! {
-        fn random_values_u32(n: u32) -> bool {
-            match 2_u32.checked_mul(n) {
-                Some(n) => modular_inverse(n + 1).wrapping_mul(n + 1) == 1,
-                _ => true,
+    quickcheck! {
+        fn random_values_u32(n: u32) -> bool {
+            match 2_u32.checked_mul(n) {
+                Some(n) => modular_inverse(n + 1).wrapping_mul(n + 1) == 1,
+                _ => true,
             }
         }
 
-        fn random_values_u64(n: u64) -> bool {
-            match 2_u64.checked_mul(n) {
-                Some(n) => modular_inverse(n + 1).wrapping_mul(n + 1) == 1,
-                _ => true,
+        fn random_values_u64(n: u64) -> bool {
+            match 2_u64.checked_mul(n) {
+                Some(n) => modular_inverse(n + 1).wrapping_mul(n + 1) == 1,
+                _ => true,
             }
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/numeric/montgomery.rs.html b/dev/src/uu_factor/numeric/montgomery.rs.html index fd54521e7..3600c99a1 100644 --- a/dev/src/uu_factor/numeric/montgomery.rs.html +++ b/dev/src/uu_factor/numeric/montgomery.rs.html @@ -1,4 +1,4 @@ -montgomery.rs - source
1
+montgomery.rs - source
1
 2
 3
 4
@@ -227,234 +227,234 @@
 227
 228
 229
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2020 Alex Lyon  <arcterus@mail.com>
-// * (c) 2020 nicoo      <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2020 Alex Lyon  <arcterus@mail.com>
+// * (c) 2020 nicoo      <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-use super::*;
+use super::*;
 
-use traits::{DoubleInt, Int, One, OverflowingAdd, Zero};
+use traits::{DoubleInt, Int, One, OverflowingAdd, Zero};
 
-pub(crate) trait Arithmetic: Copy + Sized {
-    // The type of integers mod m, in some opaque representation
-    type ModInt: Copy + Sized + Eq;
+pub(crate) trait Arithmetic: Copy + Sized {
+    // The type of integers mod m, in some opaque representation
+    type ModInt: Copy + Sized + Eq;
 
-    fn new(m: u64) -> Self;
-    fn modulus(&self) -> u64;
-    fn to_mod(&self, n: u64) -> Self::ModInt;
-    fn to_u64(&self, n: Self::ModInt) -> u64;
-    fn add(&self, a: Self::ModInt, b: Self::ModInt) -> Self::ModInt;
-    fn mul(&self, a: Self::ModInt, b: Self::ModInt) -> Self::ModInt;
+    fn new(m: u64) -> Self;
+    fn modulus(&self) -> u64;
+    fn to_mod(&self, n: u64) -> Self::ModInt;
+    fn to_u64(&self, n: Self::ModInt) -> u64;
+    fn add(&self, a: Self::ModInt, b: Self::ModInt) -> Self::ModInt;
+    fn mul(&self, a: Self::ModInt, b: Self::ModInt) -> Self::ModInt;
 
-    fn pow(&self, mut a: Self::ModInt, mut b: u64) -> Self::ModInt {
-        let (_a, _b) = (a, b);
-        let mut result = self.one();
-        while b > 0 {
-            if b & 1 != 0 {
-                result = self.mul(result, a);
+    fn pow(&self, mut a: Self::ModInt, mut b: u64) -> Self::ModInt {
+        let (_a, _b) = (a, b);
+        let mut result = self.one();
+        while b > 0 {
+            if b & 1 != 0 {
+                result = self.mul(result, a);
             }
-            a = self.mul(a, a);
-            b >>= 1;
+            a = self.mul(a, a);
+            b >>= 1;
         }
 
-        // Check that r (reduced back to the usual representation) equals
-        //  a^b % n, unless the latter computation overflows
-        // Temporarily commented-out, as there u64::checked_pow is not available
-        //  on the minimum supported Rust version, nor is an appropriate method
-        //  for compiling the check conditionally.
-        //debug_assert!(self
-        //    .to_u64(_a)
-        //    .checked_pow(_b as u32)
-        //    .map(|r| r % self.modulus() == self.to_u64(result))
-        //    .unwrap_or(true));
+        // Check that r (reduced back to the usual representation) equals
+        //  a^b % n, unless the latter computation overflows
+        // Temporarily commented-out, as there u64::checked_pow is not available
+        //  on the minimum supported Rust version, nor is an appropriate method
+        //  for compiling the check conditionally.
+        //debug_assert!(self
+        //    .to_u64(_a)
+        //    .checked_pow(_b as u32)
+        //    .map(|r| r % self.modulus() == self.to_u64(result))
+        //    .unwrap_or(true));
 
-        result
+        result
     }
 
-    fn one(&self) -> Self::ModInt {
-        self.to_mod(1)
+    fn one(&self) -> Self::ModInt {
+        self.to_mod(1)
     }
-    fn minus_one(&self) -> Self::ModInt {
-        self.to_mod(self.modulus() - 1)
+    fn minus_one(&self) -> Self::ModInt {
+        self.to_mod(self.modulus() - 1)
     }
-    fn zero(&self) -> Self::ModInt {
-        self.to_mod(0)
+    fn zero(&self) -> Self::ModInt {
+        self.to_mod(0)
     }
 }
 
-#[derive(Clone, Copy, Debug)]
-pub(crate) struct Montgomery<T: DoubleInt> {
-    a: T,
-    n: T,
+#[derive(Clone, Copy, Debug)]
+pub(crate) struct Montgomery<T: DoubleInt> {
+    a: T,
+    n: T,
 }
 
-impl<T: DoubleInt> Montgomery<T> {
-    /// computes x/R mod n efficiently
-    fn reduce(&self, x: T::DoubleWidth) -> T {
-        let t_bits = T::zero().count_zeros() as usize;
+impl<T: DoubleInt> Montgomery<T> {
+    /// computes x/R mod n efficiently
+    fn reduce(&self, x: T::DoubleWidth) -> T {
+        let t_bits = T::zero().count_zeros() as usize;
 
-        debug_assert!(x < (self.n.as_double_width()) << t_bits);
-        // TODO: optimize
-        let Self { a, n } = self;
-        let m = T::from_double_width(x).wrapping_mul(a);
-        let nm = (n.as_double_width()) * (m.as_double_width());
-        let (xnm, overflow) = x.overflowing_add(&nm); // x + n*m
-        debug_assert_eq!(
-            xnm % (T::DoubleWidth::one() << T::zero().count_zeros() as usize),
-            T::DoubleWidth::zero()
+        debug_assert!(x < (self.n.as_double_width()) << t_bits);
+        // TODO: optimize
+        let Self { a, n } = self;
+        let m = T::from_double_width(x).wrapping_mul(a);
+        let nm = (n.as_double_width()) * (m.as_double_width());
+        let (xnm, overflow) = x.overflowing_add(&nm); // x + n*m
+        debug_assert_eq!(
+            xnm % (T::DoubleWidth::one() << T::zero().count_zeros() as usize),
+            T::DoubleWidth::zero()
         );
 
-        // (x + n*m) / R
-        // in case of overflow, this is (2¹²⁸ + xnm)/2⁶⁴ - n = xnm/2⁶⁴ + (2⁶⁴ - n)
-        let y = T::from_double_width(xnm >> t_bits)
-            + if !overflow {
-                T::zero()
-            } else {
-                n.wrapping_neg()
+        // (x + n*m) / R
+        // in case of overflow, this is (2¹²⁸ + xnm)/2⁶⁴ - n = xnm/2⁶⁴ + (2⁶⁴ - n)
+        let y = T::from_double_width(xnm >> t_bits)
+            + if !overflow {
+                T::zero()
+            } else {
+                n.wrapping_neg()
             };
 
-        if y >= *n {
-            y - *n
-        } else {
-            y
+        if y >= *n {
+            y - *n
+        } else {
+            y
         }
     }
 }
 
-impl<T: DoubleInt> Arithmetic for Montgomery<T> {
-    // Montgomery transform, R=2⁶⁴
-    // Provides fast arithmetic mod n (n odd, u64)
-    type ModInt = T;
+impl<T: DoubleInt> Arithmetic for Montgomery<T> {
+    // Montgomery transform, R=2⁶⁴
+    // Provides fast arithmetic mod n (n odd, u64)
+    type ModInt = T;
 
-    fn new(n: u64) -> Self {
-        debug_assert!(T::zero().count_zeros() >= 64 || n < (1 << T::zero().count_zeros() as usize));
-        let n = T::from_u64(n);
-        let a = modular_inverse(n).wrapping_neg();
-        debug_assert_eq!(n.wrapping_mul(&a), T::one().wrapping_neg());
-        Self { a, n }
+    fn new(n: u64) -> Self {
+        debug_assert!(T::zero().count_zeros() >= 64 || n < (1 << T::zero().count_zeros() as usize));
+        let n = T::from_u64(n);
+        let a = modular_inverse(n).wrapping_neg();
+        debug_assert_eq!(n.wrapping_mul(&a), T::one().wrapping_neg());
+        Self { a, n }
     }
 
-    fn modulus(&self) -> u64 {
-        self.n.as_u64()
+    fn modulus(&self) -> u64 {
+        self.n.as_u64()
     }
 
-    fn to_mod(&self, x: u64) -> Self::ModInt {
-        // TODO: optimise!
-        debug_assert!(x < self.n.as_u64());
-        let r = T::from_double_width(
-            ((T::DoubleWidth::from_u64(x)) << T::zero().count_zeros() as usize)
-                % self.n.as_double_width(),
+    fn to_mod(&self, x: u64) -> Self::ModInt {
+        // TODO: optimise!
+        debug_assert!(x < self.n.as_u64());
+        let r = T::from_double_width(
+            ((T::DoubleWidth::from_u64(x)) << T::zero().count_zeros() as usize)
+                % self.n.as_double_width(),
         );
-        debug_assert_eq!(x, self.to_u64(r));
-        r
+        debug_assert_eq!(x, self.to_u64(r));
+        r
     }
 
-    fn to_u64(&self, n: Self::ModInt) -> u64 {
-        self.reduce(n.as_double_width()).as_u64()
+    fn to_u64(&self, n: Self::ModInt) -> u64 {
+        self.reduce(n.as_double_width()).as_u64()
     }
 
-    fn add(&self, a: Self::ModInt, b: Self::ModInt) -> Self::ModInt {
-        let (r, overflow) = a.overflowing_add(&b);
+    fn add(&self, a: Self::ModInt, b: Self::ModInt) -> Self::ModInt {
+        let (r, overflow) = a.overflowing_add(&b);
 
-        // In case of overflow, a+b = 2⁶⁴ + r = (2⁶⁴ - n) + r (working mod n)
-        let r = if !overflow {
-            r
-        } else {
-            r + self.n.wrapping_neg()
+        // In case of overflow, a+b = 2⁶⁴ + r = (2⁶⁴ - n) + r (working mod n)
+        let r = if !overflow {
+            r
+        } else {
+            r + self.n.wrapping_neg()
         };
 
-        // Normalize to [0; n[
-        let r = if r < self.n { r } else { r - self.n };
+        // Normalize to [0; n[
+        let r = if r < self.n { r } else { r - self.n };
 
-        // Check that r (reduced back to the usual representation) equals
-        // a+b % n
-        #[cfg(debug_assertions)]
-        {
-            let a_r = self.to_u64(a) as u128;
-            let b_r = self.to_u64(b) as u128;
-            let r_r = self.to_u64(r);
-            let r_2 = ((a_r + b_r) % self.n.as_u128()) as u64;
+        // Check that r (reduced back to the usual representation) equals
+        // a+b % n
+        #[cfg(debug_assertions)]
+        {
+            let a_r = self.to_u64(a) as u128;
+            let b_r = self.to_u64(b) as u128;
+            let r_r = self.to_u64(r);
+            let r_2 = ((a_r + b_r) % self.n.as_u128()) as u64;
             debug_assert_eq!(
-                r_r, r_2,
+                r_r, r_2,
                 "[{}] = {} ≠ {} = {} + {} = [{}] + [{}] mod {}; a = {}",
-                r, r_r, r_2, a_r, b_r, a, b, self.n, self.a
+                r, r_r, r_2, a_r, b_r, a, b, self.n, self.a
             );
         }
-        r
+        r
     }
 
-    fn mul(&self, a: Self::ModInt, b: Self::ModInt) -> Self::ModInt {
-        let r = self.reduce(a.as_double_width() * b.as_double_width());
+    fn mul(&self, a: Self::ModInt, b: Self::ModInt) -> Self::ModInt {
+        let r = self.reduce(a.as_double_width() * b.as_double_width());
 
-        // Check that r (reduced back to the usual representation) equals
-        // a*b % n
-        #[cfg(debug_assertions)]
-        {
-            let a_r = self.to_u64(a) as u128;
-            let b_r = self.to_u64(b) as u128;
-            let r_r = self.to_u64(r);
-            let r_2: u64 = ((a_r * b_r) % self.n.as_u128()) as u64;
+        // Check that r (reduced back to the usual representation) equals
+        // a*b % n
+        #[cfg(debug_assertions)]
+        {
+            let a_r = self.to_u64(a) as u128;
+            let b_r = self.to_u64(b) as u128;
+            let r_r = self.to_u64(r);
+            let r_2: u64 = ((a_r * b_r) % self.n.as_u128()) as u64;
             debug_assert_eq!(
-                r_r, r_2,
+                r_r, r_2,
                 "[{}] = {} ≠ {} = {} * {} = [{}] * [{}] mod {}; a = {}",
-                r, r_r, r_2, a_r, b_r, a, b, self.n, self.a
+                r, r_r, r_2, a_r, b_r, a, b, self.n, self.a
             );
         }
-        r
+        r
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use crate::parametrized_check;
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::parametrized_check;
 
-    fn test_add<A: DoubleInt>() {
-        for n in 0..100 {
-            let n = 2 * n + 1;
-            let m = Montgomery::<A>::new(n);
-            for x in 0..n {
-                let m_x = m.to_mod(x);
-                for y in 0..=x {
-                    let m_y = m.to_mod(y);
-                    println!("{n:?}, {x:?}, {y:?}", n = n, x = x, y = y);
-                    assert_eq!((x + y) % n, m.to_u64(m.add(m_x, m_y)));
+    fn test_add<A: DoubleInt>() {
+        for n in 0..100 {
+            let n = 2 * n + 1;
+            let m = Montgomery::<A>::new(n);
+            for x in 0..n {
+                let m_x = m.to_mod(x);
+                for y in 0..=x {
+                    let m_y = m.to_mod(y);
+                    println!("{n:?}, {x:?}, {y:?}", n = n, x = x, y = y);
+                    assert_eq!((x + y) % n, m.to_u64(m.add(m_x, m_y)));
                 }
             }
         }
     }
-    parametrized_check!(test_add);
+    parametrized_check!(test_add);
 
-    fn test_multiplication<A: DoubleInt>() {
-        for n in 0..100 {
-            let n = 2 * n + 1;
-            let m = Montgomery::<A>::new(n);
-            for x in 0..n {
-                let m_x = m.to_mod(x);
-                for y in 0..=x {
-                    let m_y = m.to_mod(y);
-                    assert_eq!((x * y) % n, m.to_u64(m.mul(m_x, m_y)));
+    fn test_multiplication<A: DoubleInt>() {
+        for n in 0..100 {
+            let n = 2 * n + 1;
+            let m = Montgomery::<A>::new(n);
+            for x in 0..n {
+                let m_x = m.to_mod(x);
+                for y in 0..=x {
+                    let m_y = m.to_mod(y);
+                    assert_eq!((x * y) % n, m.to_u64(m.mul(m_x, m_y)));
                 }
             }
         }
     }
-    parametrized_check!(test_multiplication);
+    parametrized_check!(test_multiplication);
 
-    fn test_roundtrip<A: DoubleInt>() {
-        for n in 0..100 {
-            let n = 2 * n + 1;
-            let m = Montgomery::<A>::new(n);
-            for x in 0..n {
-                let x_ = m.to_mod(x);
-                assert_eq!(x, m.to_u64(x_));
+    fn test_roundtrip<A: DoubleInt>() {
+        for n in 0..100 {
+            let n = 2 * n + 1;
+            let m = Montgomery::<A>::new(n);
+            for x in 0..n {
+                let x_ = m.to_mod(x);
+                assert_eq!(x, m.to_u64(x_));
             }
         }
     }
-    parametrized_check!(test_roundtrip);
+    parametrized_check!(test_roundtrip);
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/numeric/traits.rs.html b/dev/src/uu_factor/numeric/traits.rs.html index 5dec64989..ef2181891 100644 --- a/dev/src/uu_factor/numeric/traits.rs.html +++ b/dev/src/uu_factor/numeric/traits.rs.html @@ -1,4 +1,4 @@ -traits.rs - source
1
+traits.rs - source
1
 2
 3
 4
@@ -88,95 +88,95 @@
 88
 89
 90
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2020 Alex Lyon  <arcterus@mail.com>
-// * (c) 2020 nicoo      <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2020 Alex Lyon  <arcterus@mail.com>
+// * (c) 2020 nicoo      <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-pub(crate) use num_traits::{
-    identities::{One, Zero},
-    ops::overflowing::OverflowingAdd,
+pub(crate) use num_traits::{
+    identities::{One, Zero},
+    ops::overflowing::OverflowingAdd,
 };
-use num_traits::{
-    int::PrimInt,
-    ops::wrapping::{WrappingMul, WrappingNeg, WrappingSub},
+use num_traits::{
+    int::PrimInt,
+    ops::wrapping::{WrappingMul, WrappingNeg, WrappingSub},
 };
-use std::fmt::{Debug, Display};
+use std::fmt::{Debug, Display};
 
-pub(crate) trait Int:
-    Display + Debug + PrimInt + OverflowingAdd + WrappingNeg + WrappingSub + WrappingMul
+pub(crate) trait Int:
+    Display + Debug + PrimInt + OverflowingAdd + WrappingNeg + WrappingSub + WrappingMul
 {
-    fn as_u64(&self) -> u64;
-    fn from_u64(n: u64) -> Self;
+    fn as_u64(&self) -> u64;
+    fn from_u64(n: u64) -> Self;
 
-    #[cfg(debug_assertions)]
-    fn as_u128(&self) -> u128;
+    #[cfg(debug_assertions)]
+    fn as_u128(&self) -> u128;
 }
 
-pub(crate) trait DoubleInt: Int {
-    /// An integer type with twice the width of `Self`.
-    /// In particular, multiplications (of `Int` values) can be performed in
-    ///  `Self::DoubleWidth` without possibility of overflow.
-    type DoubleWidth: Int;
+pub(crate) trait DoubleInt: Int {
+    /// An integer type with twice the width of `Self`.
+    /// In particular, multiplications (of `Int` values) can be performed in
+    ///  `Self::DoubleWidth` without possibility of overflow.
+    type DoubleWidth: Int;
 
-    fn as_double_width(self) -> Self::DoubleWidth;
-    fn from_double_width(n: Self::DoubleWidth) -> Self;
+    fn as_double_width(self) -> Self::DoubleWidth;
+    fn from_double_width(n: Self::DoubleWidth) -> Self;
 }
 
-macro_rules! int {
-    ( $x:ty ) => {
-        impl Int for $x {
-            fn as_u64(&self) -> u64 {
-                *self as u64
+macro_rules! int {
+    ( $x:ty ) => {
+        impl Int for $x {
+            fn as_u64(&self) -> u64 {
+                *self as u64
             }
-            fn from_u64(n: u64) -> Self {
-                n as _
-            }
-            #[cfg(debug_assertions)]
-            fn as_u128(&self) -> u128 {
-                *self as u128
+            fn from_u64(n: u64) -> Self {
+                n as _
+            }
+            #[cfg(debug_assertions)]
+            fn as_u128(&self) -> u128 {
+                *self as u128
             }
         }
     };
 }
-macro_rules! double_int {
-    ( $x:ty, $y:ty ) => {
-        int!($x);
-        impl DoubleInt for $x {
-            type DoubleWidth = $y;
+macro_rules! double_int {
+    ( $x:ty, $y:ty ) => {
+        int!($x);
+        impl DoubleInt for $x {
+            type DoubleWidth = $y;
 
-            fn as_double_width(self) -> $y {
-                self as _
-            }
-            fn from_double_width(n: $y) -> Self {
-                n as _
-            }
+            fn as_double_width(self) -> $y {
+                self as _
+            }
+            fn from_double_width(n: $y) -> Self {
+                n as _
+            }
         }
     };
 }
-double_int!(u32, u64);
-double_int!(u64, u128);
-int!(u128);
+double_int!(u32, u64);
+double_int!(u64, u128);
+int!(u128);
 
-/// Helper macro for instantiating tests over u32 and u64
-#[cfg(test)]
-#[macro_export]
-macro_rules! parametrized_check {
-    ( $f:ident ) => {
-        paste::item! {
-            #[test]
-            fn [< $f _ u32 >]() {
-                $f::<u32>()
+/// Helper macro for instantiating tests over u32 and u64
+#[cfg(test)]
+#[macro_export]
+macro_rules! parametrized_check {
+    ( $f:ident ) => {
+        paste::item! {
+            #[test]
+            fn [< $f _ u32 >]() {
+                $f::<u32>()
             }
-            #[test]
-            fn [< $f _ u64 >]() {
-                $f::<u64>()
+            #[test]
+            fn [< $f _ u64 >]() {
+                $f::<u64>()
             }
         }
     };
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/rho.rs.html b/dev/src/uu_factor/rho.rs.html index 8e5b45848..6f9c84fff 100644 --- a/dev/src/uu_factor/rho.rs.html +++ b/dev/src/uu_factor/rho.rs.html @@ -1,4 +1,4 @@ -rho.rs - source
1
+rho.rs - source
1
 2
 3
 4
@@ -45,52 +45,52 @@
 45
 46
 47
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2015 Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
-// * (c) 2020 nicoo <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2015 Wiktor Kuropatwa <wiktor.kuropatwa@gmail.com>
+// * (c) 2020 nicoo <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-use rand::distributions::{Distribution, Uniform};
-use rand::rngs::SmallRng;
-use rand::{thread_rng, SeedableRng};
-use std::cmp::{max, min};
+use rand::distributions::{Distribution, Uniform};
+use rand::rngs::SmallRng;
+use rand::{thread_rng, SeedableRng};
+use std::cmp::{max, min};
 
-use crate::numeric::*;
+use crate::numeric::*;
 
-pub(crate) fn find_divisor<A: Arithmetic>(n: A) -> u64 {
-    #![allow(clippy::many_single_char_names)]
-    let mut rand = {
-        let range = Uniform::new(1, n.modulus());
-        let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap();
-        move || n.to_mod(range.sample(&mut rng))
+pub(crate) fn find_divisor<A: Arithmetic>(n: A) -> u64 {
+    #![allow(clippy::many_single_char_names)]
+    let mut rand = {
+        let range = Uniform::new(1, n.modulus());
+        let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap();
+        move || n.to_mod(range.sample(&mut rng))
     };
 
-    let quadratic = |a, b| move |x| n.add(n.mul(a, n.mul(x, x)), b);
+    let quadratic = |a, b| move |x| n.add(n.mul(a, n.mul(x, x)), b);
 
-    loop {
-        let f = quadratic(rand(), rand());
-        let mut x = rand();
-        let mut y = x;
+    loop {
+        let f = quadratic(rand(), rand());
+        let mut x = rand();
+        let mut y = x;
 
-        loop {
-            x = f(x);
-            y = f(f(y));
-            let d = {
-                let _x = n.to_u64(x);
-                let _y = n.to_u64(y);
-                gcd(n.modulus(), max(_x, _y) - min(_x, _y))
+        loop {
+            x = f(x);
+            y = f(f(y));
+            let d = {
+                let _x = n.to_u64(x);
+                let _y = n.to_u64(y);
+                gcd(n.modulus(), max(_x, _y) - min(_x, _y))
             };
-            if d == n.modulus() {
-                // Failure, retry with a different quadratic
-                break;
-            } else if d > 1 {
-                return d;
+            if d == n.modulus() {
+                // Failure, retry with a different quadratic
+                break;
+            } else if d > 1 {
+                return d;
             }
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_factor/table.rs.html b/dev/src/uu_factor/table.rs.html index 8077a4063..3327d536c 100644 --- a/dev/src/uu_factor/table.rs.html +++ b/dev/src/uu_factor/table.rs.html @@ -1,4 +1,4 @@ -table.rs - source
1
+table.rs - source
1
 2
 3
 4
@@ -99,44 +99,44 @@
 99
 100
 101
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) 2015 kwantam <kwantam@gmail.com>
-// * (c) 2020 nicoo   <nicoo@debian.org>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) 2015 kwantam <kwantam@gmail.com>
+// * (c) 2020 nicoo   <nicoo@debian.org>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-// spell-checker: ignore (ToDO) INVS
+// spell-checker: ignore (ToDO) INVS
 
-use crate::Factors;
+use crate::Factors;
 
 include!(concat!(env!("OUT_DIR"), "/prime_table.rs"));
 
-pub fn factor(num: &mut u64, factors: &mut Factors) {
-    for &(prime, inv, ceil) in PRIME_INVERSIONS_U64 {
-        if *num == 1 {
+pub fn factor(num: &mut u64, factors: &mut Factors) {
+    for &(prime, inv, ceil) in PRIME_INVERSIONS_U64 {
+        if *num == 1 {
             break;
         }
 
-        // inv = prime^-1 mod 2^64
-        // ceil = floor((2^64-1) / prime)
-        // if (num * inv) mod 2^64 <= ceil, then prime divides num
-        // See https://math.stackexchange.com/questions/1251327/
-        // for a nice explanation.
-        let mut k = 0;
-        loop {
-            let x = num.wrapping_mul(inv);
+        // inv = prime^-1 mod 2^64
+        // ceil = floor((2^64-1) / prime)
+        // if (num * inv) mod 2^64 <= ceil, then prime divides num
+        // See https://math.stackexchange.com/questions/1251327/
+        // for a nice explanation.
+        let mut k = 0;
+        loop {
+            let x = num.wrapping_mul(inv);
 
-            // While prime divides num
-            if x <= ceil {
-                *num = x;
-                k += 1;
-                #[cfg(feature = "coz")]
-                coz::progress!("factor found");
-            } else {
-                if k > 0 {
-                    factors.add(prime, k);
+            // While prime divides num
+            if x <= ceil {
+                *num = x;
+                k += 1;
+                #[cfg(feature = "coz")]
+                coz::progress!("factor found");
+            } else {
+                if k > 0 {
+                    factors.add(prime, k);
                 }
                 break;
             }
@@ -144,28 +144,28 @@
     }
 }
 
-pub const CHUNK_SIZE: usize = 8;
-pub fn factor_chunk(n_s: &mut [u64; CHUNK_SIZE], f_s: &mut [Factors; CHUNK_SIZE]) {
-    for &(prime, inv, ceil) in PRIME_INVERSIONS_U64 {
-        if n_s[0] == 1 && n_s[1] == 1 && n_s[2] == 1 && n_s[3] == 1 {
+pub const CHUNK_SIZE: usize = 8;
+pub fn factor_chunk(n_s: &mut [u64; CHUNK_SIZE], f_s: &mut [Factors; CHUNK_SIZE]) {
+    for &(prime, inv, ceil) in PRIME_INVERSIONS_U64 {
+        if n_s[0] == 1 && n_s[1] == 1 && n_s[2] == 1 && n_s[3] == 1 {
             break;
         }
 
-        for (num, factors) in n_s.iter_mut().zip(f_s.iter_mut()) {
-            if *num == 1 {
+        for (num, factors) in n_s.iter_mut().zip(f_s.iter_mut()) {
+            if *num == 1 {
                 continue;
             }
-            let mut k = 0;
-            loop {
-                let x = num.wrapping_mul(inv);
+            let mut k = 0;
+            loop {
+                let x = num.wrapping_mul(inv);
 
-                // While prime divides num
-                if x <= ceil {
-                    *num = x;
-                    k += 1;
-                } else {
-                    if k > 0 {
-                        factors.add(prime, k);
+                // While prime divides num
+                if x <= ceil {
+                    *num = x;
+                    k += 1;
+                } else {
+                    if k > 0 {
+                        factors.add(prime, k);
                     }
                     break;
                 }
@@ -174,31 +174,31 @@
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use crate::Factors;
-    use quickcheck::quickcheck;
-    use rand::{rngs::SmallRng, Rng, SeedableRng};
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::Factors;
+    use quickcheck::quickcheck;
+    use rand::{rngs::SmallRng, Rng, SeedableRng};
 
-    quickcheck! {
-        fn chunk_vs_iter(seed: u64) -> () {
-            let mut rng = SmallRng::seed_from_u64(seed);
-            let mut n_c: [u64; CHUNK_SIZE] = rng.gen();
-            let mut f_c: [Factors; CHUNK_SIZE] = rng.gen();
+    quickcheck! {
+        fn chunk_vs_iter(seed: u64) -> () {
+            let mut rng = SmallRng::seed_from_u64(seed);
+            let mut n_c: [u64; CHUNK_SIZE] = rng.gen();
+            let mut f_c: [Factors; CHUNK_SIZE] = rng.gen();
 
-            let mut n_i = n_c;
-            let mut f_i = f_c.clone();
-            for (n, f) in n_i.iter_mut().zip(f_i.iter_mut()) {
-                factor(n, f);
+            let mut n_i = n_c;
+            let mut f_i = f_c.clone();
+            for (n, f) in n_i.iter_mut().zip(f_i.iter_mut()) {
+                factor(n, f);
             }
 
-            factor_chunk(&mut n_c, &mut f_c);
+            factor_chunk(&mut n_c, &mut f_c);
 
-            assert_eq!(n_i, n_c);
-            assert_eq!(f_i, f_c);
+            assert_eq!(n_i, n_c);
+            assert_eq!(f_i, f_c);
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_false/false.rs.html b/dev/src/uu_false/false.rs.html index 49d7a99a0..10afad8ef 100644 --- a/dev/src/uu_false/false.rs.html +++ b/dev/src/uu_false/false.rs.html @@ -1,4 +1,4 @@ -false.rs - source
1
+false.rs - source
1
 2
 3
 4
@@ -70,17 +70,17 @@
 70
 71
 72
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Jordi Boggiano <j.boggiano@seld.be>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-use clap::{Arg, ArgAction, Command};
-use std::{ffi::OsString, io::Write};
-use uucore::error::{set_exit_code, UResult};
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Jordi Boggiano <j.boggiano@seld.be>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+use clap::{Arg, ArgAction, Command};
+use std::{ffi::OsString, io::Write};
+use uucore::error::{set_exit_code, UResult};
 
-static ABOUT: &str = "\
+static ABOUT: &str = "\
 Returns false, an unsuccessful exit status.
 
 Immediately returns with the exit status `1`. When invoked with one of the recognized options it
@@ -88,59 +88,59 @@ will try to write the help or version text. Any IO error during this operation i
 the program will also return `1`.
 ";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let mut command = uu_app();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let mut command = uu_app();
 
-    // Mirror GNU options, always return `1`. In particular even the 'successful' cases of no-op,
-    // and the interrupted display of help and version should return `1`. Also, we return Ok in all
-    // paths to avoid the allocation of an error object, an operation that could, in theory, fail
-    // and unwind through the standard library allocation handling machinery.
-    set_exit_code(1);
+    // Mirror GNU options, always return `1`. In particular even the 'successful' cases of no-op,
+    // and the interrupted display of help and version should return `1`. Also, we return Ok in all
+    // paths to avoid the allocation of an error object, an operation that could, in theory, fail
+    // and unwind through the standard library allocation handling machinery.
+    set_exit_code(1);
 
-    let args: Vec<OsString> = args.collect();
-    if args.len() > 2 {
-        return Ok(());
+    let args: Vec<OsString> = args.collect();
+    if args.len() > 2 {
+        return Ok(());
     }
 
-    if let Err(e) = command.try_get_matches_from_mut(args) {
-        let error = match e.kind() {
-            clap::error::ErrorKind::DisplayHelp => command.print_help(),
-            clap::error::ErrorKind::DisplayVersion => {
-                writeln!(std::io::stdout(), "{}", command.render_version())
+    if let Err(e) = command.try_get_matches_from_mut(args) {
+        let error = match e.kind() {
+            clap::error::ErrorKind::DisplayHelp => command.print_help(),
+            clap::error::ErrorKind::DisplayVersion => {
+                writeln!(std::io::stdout(), "{}", command.render_version())
             }
-            _ => Ok(()),
+            _ => Ok(()),
         };
 
-        // Try to display this error.
-        if let Err(print_fail) = error {
-            // Completely ignore any error here, no more failover and we will fail in any case.
-            let _ = writeln!(std::io::stderr(), "{}: {}", uucore::util_name(), print_fail);
+        // Try to display this error.
+        if let Err(print_fail) = error {
+            // Completely ignore any error here, no more failover and we will fail in any case.
+            let _ = writeln!(std::io::stderr(), "{}: {}", uucore::util_name(), print_fail);
         }
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(clap::crate_version!())
-        .about(ABOUT)
-        // We provide our own help and version options, to ensure maximum compatibility with GNU.
-        .disable_help_flag(true)
-        .disable_version_flag(true)
-        .arg(
-            Arg::new("help")
-                .long("help")
-                .help("Print help information")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(clap::crate_version!())
+        .about(ABOUT)
+        // We provide our own help and version options, to ensure maximum compatibility with GNU.
+        .disable_help_flag(true)
+        .disable_version_flag(true)
+        .arg(
+            Arg::new("help")
+                .long("help")
+                .help("Print help information")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new("version")
-                .long("version")
-                .help("Print version information")
-                .action(ArgAction::Version),
+        .arg(
+            Arg::new("version")
+                .long("version")
+                .help("Print version information")
+                .action(ArgAction::Version),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_fmt/fmt.rs.html b/dev/src/uu_fmt/fmt.rs.html index 22e2f13e6..8ee28adea 100644 --- a/dev/src/uu_fmt/fmt.rs.html +++ b/dev/src/uu_fmt/fmt.rs.html @@ -1,4 +1,4 @@ -fmt.rs - source
1
+fmt.rs - source
1
 2
 3
 4
@@ -360,367 +360,367 @@
 360
 361
 362
-
//  * This file is part of `fmt` from the uutils coreutils package.
-//  *
-//  * (c) kwantam <kwantam@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of `fmt` from the uutils coreutils package.
+//  *
+//  * (c) kwantam <kwantam@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) PSKIP linebreak ostream parasplit tabwidth xanti xprefix
+// spell-checker:ignore (ToDO) PSKIP linebreak ostream parasplit tabwidth xanti xprefix
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::cmp;
-use std::fs::File;
-use std::io::{stdin, stdout, Write};
-use std::io::{BufReader, BufWriter, Read};
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::cmp;
+use std::fs::File;
+use std::io::{stdin, stdout, Write};
+use std::io::{BufReader, BufWriter, Read};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError};
+use uucore::format_usage;
 
-use self::linebreak::break_lines;
-use self::parasplit::ParagraphStream;
+use self::linebreak::break_lines;
+use self::parasplit::ParagraphStream;
 
-mod linebreak;
-mod parasplit;
+mod linebreak;
+mod parasplit;
 
-static ABOUT: &str = "Reformat paragraphs from input files (or stdin) to stdout.";
-const USAGE: &str = "{} [OPTION]... [FILE]...";
-static MAX_WIDTH: usize = 2500;
+static ABOUT: &str = "Reformat paragraphs from input files (or stdin) to stdout.";
+const USAGE: &str = "{} [OPTION]... [FILE]...";
+static MAX_WIDTH: usize = 2500;
 
-static OPT_CROWN_MARGIN: &str = "crown-margin";
-static OPT_TAGGED_PARAGRAPH: &str = "tagged-paragraph";
-static OPT_PRESERVE_HEADERS: &str = "preserve-headers";
-static OPT_SPLIT_ONLY: &str = "split-only";
-static OPT_UNIFORM_SPACING: &str = "uniform-spacing";
-static OPT_PREFIX: &str = "prefix";
-static OPT_SKIP_PREFIX: &str = "skip-prefix";
-static OPT_EXACT_PREFIX: &str = "exact-prefix";
-static OPT_EXACT_SKIP_PREFIX: &str = "exact-skip-prefix";
-static OPT_WIDTH: &str = "width";
-static OPT_GOAL: &str = "goal";
-static OPT_QUICK: &str = "quick";
-static OPT_TAB_WIDTH: &str = "tab-width";
+static OPT_CROWN_MARGIN: &str = "crown-margin";
+static OPT_TAGGED_PARAGRAPH: &str = "tagged-paragraph";
+static OPT_PRESERVE_HEADERS: &str = "preserve-headers";
+static OPT_SPLIT_ONLY: &str = "split-only";
+static OPT_UNIFORM_SPACING: &str = "uniform-spacing";
+static OPT_PREFIX: &str = "prefix";
+static OPT_SKIP_PREFIX: &str = "skip-prefix";
+static OPT_EXACT_PREFIX: &str = "exact-prefix";
+static OPT_EXACT_SKIP_PREFIX: &str = "exact-skip-prefix";
+static OPT_WIDTH: &str = "width";
+static OPT_GOAL: &str = "goal";
+static OPT_QUICK: &str = "quick";
+static OPT_TAB_WIDTH: &str = "tab-width";
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-pub type FileOrStdReader = BufReader<Box<dyn Read + 'static>>;
-pub struct FmtOptions {
-    crown: bool,
-    tagged: bool,
-    mail: bool,
-    split_only: bool,
-    use_prefix: bool,
-    prefix: String,
-    xprefix: bool,
-    use_anti_prefix: bool,
-    anti_prefix: String,
-    xanti_prefix: bool,
-    uniform: bool,
-    quick: bool,
-    width: usize,
-    goal: usize,
-    tabwidth: usize,
+pub type FileOrStdReader = BufReader<Box<dyn Read + 'static>>;
+pub struct FmtOptions {
+    crown: bool,
+    tagged: bool,
+    mail: bool,
+    split_only: bool,
+    use_prefix: bool,
+    prefix: String,
+    xprefix: bool,
+    use_anti_prefix: bool,
+    anti_prefix: String,
+    xanti_prefix: bool,
+    uniform: bool,
+    quick: bool,
+    width: usize,
+    goal: usize,
+    tabwidth: usize,
 }
 
-#[uucore::main]
-#[allow(clippy::cognitive_complexity)]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+#[allow(clippy::cognitive_complexity)]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let mut files: Vec<String> = matches
-        .get_many::<String>(ARG_FILES)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let mut files: Vec<String> = matches
+        .get_many::<String>(ARG_FILES)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    let mut fmt_opts = FmtOptions {
-        crown: false,
-        tagged: false,
-        mail: false,
-        uniform: false,
-        quick: false,
-        split_only: false,
-        use_prefix: false,
-        prefix: String::new(),
-        xprefix: false,
-        use_anti_prefix: false,
-        anti_prefix: String::new(),
-        xanti_prefix: false,
-        width: 79,
-        goal: 74,
-        tabwidth: 8,
+    let mut fmt_opts = FmtOptions {
+        crown: false,
+        tagged: false,
+        mail: false,
+        uniform: false,
+        quick: false,
+        split_only: false,
+        use_prefix: false,
+        prefix: String::new(),
+        xprefix: false,
+        use_anti_prefix: false,
+        anti_prefix: String::new(),
+        xanti_prefix: false,
+        width: 79,
+        goal: 74,
+        tabwidth: 8,
     };
 
-    fmt_opts.tagged = matches.get_flag(OPT_TAGGED_PARAGRAPH);
-    if matches.get_flag(OPT_CROWN_MARGIN) {
-        fmt_opts.crown = true;
-        fmt_opts.tagged = false;
+    fmt_opts.tagged = matches.get_flag(OPT_TAGGED_PARAGRAPH);
+    if matches.get_flag(OPT_CROWN_MARGIN) {
+        fmt_opts.crown = true;
+        fmt_opts.tagged = false;
     }
-    fmt_opts.mail = matches.get_flag(OPT_PRESERVE_HEADERS);
-    fmt_opts.uniform = matches.get_flag(OPT_UNIFORM_SPACING);
-    fmt_opts.quick = matches.get_flag(OPT_QUICK);
-    if matches.get_flag(OPT_SPLIT_ONLY) {
-        fmt_opts.split_only = true;
-        fmt_opts.crown = false;
-        fmt_opts.tagged = false;
+    fmt_opts.mail = matches.get_flag(OPT_PRESERVE_HEADERS);
+    fmt_opts.uniform = matches.get_flag(OPT_UNIFORM_SPACING);
+    fmt_opts.quick = matches.get_flag(OPT_QUICK);
+    if matches.get_flag(OPT_SPLIT_ONLY) {
+        fmt_opts.split_only = true;
+        fmt_opts.crown = false;
+        fmt_opts.tagged = false;
     }
-    fmt_opts.xprefix = matches.contains_id(OPT_EXACT_PREFIX);
-    fmt_opts.xanti_prefix = matches.contains_id(OPT_SKIP_PREFIX);
+    fmt_opts.xprefix = matches.contains_id(OPT_EXACT_PREFIX);
+    fmt_opts.xanti_prefix = matches.contains_id(OPT_SKIP_PREFIX);
 
-    if let Some(s) = matches.get_one::<String>(OPT_PREFIX).map(String::from) {
-        fmt_opts.prefix = s;
-        fmt_opts.use_prefix = true;
+    if let Some(s) = matches.get_one::<String>(OPT_PREFIX).map(String::from) {
+        fmt_opts.prefix = s;
+        fmt_opts.use_prefix = true;
     };
 
-    if let Some(s) = matches.get_one::<String>(OPT_SKIP_PREFIX).map(String::from) {
-        fmt_opts.anti_prefix = s;
-        fmt_opts.use_anti_prefix = true;
+    if let Some(s) = matches.get_one::<String>(OPT_SKIP_PREFIX).map(String::from) {
+        fmt_opts.anti_prefix = s;
+        fmt_opts.use_anti_prefix = true;
     };
 
-    if let Some(s) = matches.get_one::<String>(OPT_WIDTH) {
-        fmt_opts.width = match s.parse::<usize>() {
-            Ok(t) => t,
-            Err(e) => {
-                return Err(USimpleError::new(
+    if let Some(s) = matches.get_one::<String>(OPT_WIDTH) {
+        fmt_opts.width = match s.parse::<usize>() {
+            Ok(t) => t,
+            Err(e) => {
+                return Err(USimpleError::new(
                     1,
-                    format!("Invalid WIDTH specification: {}: {}", s.quote(), e),
+                    format!("Invalid WIDTH specification: {}: {}", s.quote(), e),
                 ));
             }
         };
-        if fmt_opts.width > MAX_WIDTH {
-            return Err(USimpleError::new(
+        if fmt_opts.width > MAX_WIDTH {
+            return Err(USimpleError::new(
                 1,
                 format!(
                     "invalid width: '{}': Numerical result out of range",
-                    fmt_opts.width,
+                    fmt_opts.width,
                 ),
             ));
         }
-        fmt_opts.goal = cmp::min(fmt_opts.width * 94 / 100, fmt_opts.width - 3);
+        fmt_opts.goal = cmp::min(fmt_opts.width * 94 / 100, fmt_opts.width - 3);
     };
 
-    if let Some(s) = matches.get_one::<String>(OPT_GOAL) {
-        fmt_opts.goal = match s.parse::<usize>() {
-            Ok(t) => t,
-            Err(e) => {
-                return Err(USimpleError::new(
+    if let Some(s) = matches.get_one::<String>(OPT_GOAL) {
+        fmt_opts.goal = match s.parse::<usize>() {
+            Ok(t) => t,
+            Err(e) => {
+                return Err(USimpleError::new(
                     1,
-                    format!("Invalid GOAL specification: {}: {}", s.quote(), e),
+                    format!("Invalid GOAL specification: {}: {}", s.quote(), e),
                 ));
             }
         };
-        if !matches.get_flag(OPT_WIDTH) {
-            fmt_opts.width = cmp::max(fmt_opts.goal * 100 / 94, fmt_opts.goal + 3);
-        } else if fmt_opts.goal > fmt_opts.width {
-            return Err(USimpleError::new(1, "GOAL cannot be greater than WIDTH."));
+        if !matches.get_flag(OPT_WIDTH) {
+            fmt_opts.width = cmp::max(fmt_opts.goal * 100 / 94, fmt_opts.goal + 3);
+        } else if fmt_opts.goal > fmt_opts.width {
+            return Err(USimpleError::new(1, "GOAL cannot be greater than WIDTH."));
         }
     };
 
-    if let Some(s) = matches.get_one::<String>(OPT_TAB_WIDTH) {
-        fmt_opts.tabwidth = match s.parse::<usize>() {
-            Ok(t) => t,
-            Err(e) => {
-                return Err(USimpleError::new(
+    if let Some(s) = matches.get_one::<String>(OPT_TAB_WIDTH) {
+        fmt_opts.tabwidth = match s.parse::<usize>() {
+            Ok(t) => t,
+            Err(e) => {
+                return Err(USimpleError::new(
                     1,
-                    format!("Invalid TABWIDTH specification: {}: {}", s.quote(), e),
+                    format!("Invalid TABWIDTH specification: {}: {}", s.quote(), e),
                 ));
             }
         };
     };
 
-    if fmt_opts.tabwidth < 1 {
-        fmt_opts.tabwidth = 1;
+    if fmt_opts.tabwidth < 1 {
+        fmt_opts.tabwidth = 1;
     }
 
-    // immutable now
-    let fmt_opts = fmt_opts;
+    // immutable now
+    let fmt_opts = fmt_opts;
 
-    if files.is_empty() {
-        files.push("-".to_owned());
+    if files.is_empty() {
+        files.push("-".to_owned());
     }
 
-    let mut ostream = BufWriter::new(stdout());
+    let mut ostream = BufWriter::new(stdout());
 
-    for i in files.iter().map(|x| &x[..]) {
-        let mut fp = match i {
-            "-" => BufReader::new(Box::new(stdin()) as Box<dyn Read + 'static>),
-            _ => match File::open(i) {
-                Ok(f) => BufReader::new(Box::new(f) as Box<dyn Read + 'static>),
-                Err(e) => {
-                    show_warning!("{}: {}", i.maybe_quote(), e);
+    for i in files.iter().map(|x| &x[..]) {
+        let mut fp = match i {
+            "-" => BufReader::new(Box::new(stdin()) as Box<dyn Read + 'static>),
+            _ => match File::open(i) {
+                Ok(f) => BufReader::new(Box::new(f) as Box<dyn Read + 'static>),
+                Err(e) => {
+                    show_warning!("{}: {}", i.maybe_quote(), e);
                     continue;
                 }
             },
         };
-        let p_stream = ParagraphStream::new(&fmt_opts, &mut fp);
-        for para_result in p_stream {
-            match para_result {
-                Err(s) => {
-                    ostream
-                        .write_all(s.as_bytes())
-                        .map_err_context(|| "failed to write output".to_string())?;
-                    ostream
-                        .write_all(b"\n")
-                        .map_err_context(|| "failed to write output".to_string())?;
+        let p_stream = ParagraphStream::new(&fmt_opts, &mut fp);
+        for para_result in p_stream {
+            match para_result {
+                Err(s) => {
+                    ostream
+                        .write_all(s.as_bytes())
+                        .map_err_context(|| "failed to write output".to_string())?;
+                    ostream
+                        .write_all(b"\n")
+                        .map_err_context(|| "failed to write output".to_string())?;
                 }
-                Ok(para) => break_lines(&para, &fmt_opts, &mut ostream)
-                    .map_err_context(|| "failed to write output".to_string())?,
+                Ok(para) => break_lines(&para, &fmt_opts, &mut ostream)
+                    .map_err_context(|| "failed to write output".to_string())?,
             }
         }
 
-        // flush the output after each file
-        ostream
-            .flush()
-            .map_err_context(|| "failed to write output".to_string())?;
+        // flush the output after each file
+        ostream
+            .flush()
+            .map_err_context(|| "failed to write output".to_string())?;
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_CROWN_MARGIN)
-                .short('c')
-                .long(OPT_CROWN_MARGIN)
-                .help(
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_CROWN_MARGIN)
+                .short('c')
+                .long(OPT_CROWN_MARGIN)
+                .help(
                     "First and second line of paragraph \
                     may have different indentations, in which \
                     case the first line's indentation is preserved, \
                     and each subsequent line's indentation matches the second line.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_TAGGED_PARAGRAPH)
-                .short('t')
-                .long("tagged-paragraph")
-                .help(
+        .arg(
+            Arg::new(OPT_TAGGED_PARAGRAPH)
+                .short('t')
+                .long("tagged-paragraph")
+                .help(
                     "Like -c, except that the first and second line of a paragraph *must* \
                     have different indentation or they are treated as separate paragraphs.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_PRESERVE_HEADERS)
-                .short('m')
-                .long("preserve-headers")
-                .help(
+        .arg(
+            Arg::new(OPT_PRESERVE_HEADERS)
+                .short('m')
+                .long("preserve-headers")
+                .help(
                     "Attempt to detect and preserve mail headers in the input. \
                     Be careful when combining this flag with -p.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_SPLIT_ONLY)
-                .short('s')
-                .long("split-only")
-                .help("Split lines only, do not reflow.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_SPLIT_ONLY)
+                .short('s')
+                .long("split-only")
+                .help("Split lines only, do not reflow.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_UNIFORM_SPACING)
-                .short('u')
-                .long("uniform-spacing")
-                .help(
+        .arg(
+            Arg::new(OPT_UNIFORM_SPACING)
+                .short('u')
+                .long("uniform-spacing")
+                .help(
                     "Insert exactly one \
                     space between words, and two between sentences. \
                     Sentence breaks in the input are detected as [?!.] \
                     followed by two spaces or a newline; other punctuation \
                     is not interpreted as a sentence break.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_PREFIX)
-                .short('p')
-                .long("prefix")
-                .help(
+        .arg(
+            Arg::new(OPT_PREFIX)
+                .short('p')
+                .long("prefix")
+                .help(
                     "Reformat only lines \
                     beginning with PREFIX, reattaching PREFIX to reformatted lines. \
                     Unless -x is specified, leading whitespace will be ignored \
                     when matching PREFIX.",
                 )
-                .value_name("PREFIX"),
+                .value_name("PREFIX"),
         )
-        .arg(
-            Arg::new(OPT_SKIP_PREFIX)
-                .short('P')
-                .long("skip-prefix")
-                .help(
+        .arg(
+            Arg::new(OPT_SKIP_PREFIX)
+                .short('P')
+                .long("skip-prefix")
+                .help(
                     "Do not reformat lines \
                     beginning with PSKIP. Unless -X is specified, leading whitespace \
                     will be ignored when matching PSKIP",
                 )
-                .value_name("PSKIP"),
+                .value_name("PSKIP"),
         )
-        .arg(
-            Arg::new(OPT_EXACT_PREFIX)
-                .short('x')
-                .long("exact-prefix")
-                .help(
+        .arg(
+            Arg::new(OPT_EXACT_PREFIX)
+                .short('x')
+                .long("exact-prefix")
+                .help(
                     "PREFIX must match at the \
                     beginning of the line with no preceding whitespace.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_EXACT_SKIP_PREFIX)
-                .short('X')
-                .long("exact-skip-prefix")
-                .help(
+        .arg(
+            Arg::new(OPT_EXACT_SKIP_PREFIX)
+                .short('X')
+                .long("exact-skip-prefix")
+                .help(
                     "PSKIP must match at the \
                     beginning of the line with no preceding whitespace.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_WIDTH)
-                .short('w')
-                .long("width")
-                .help("Fill output lines up to a maximum of WIDTH columns, default 79.")
-                .value_name("WIDTH"),
+        .arg(
+            Arg::new(OPT_WIDTH)
+                .short('w')
+                .long("width")
+                .help("Fill output lines up to a maximum of WIDTH columns, default 79.")
+                .value_name("WIDTH"),
         )
-        .arg(
-            Arg::new(OPT_GOAL)
-                .short('g')
-                .long("goal")
-                .help("Goal width, default ~0.94*WIDTH. Must be less than WIDTH.")
-                .value_name("GOAL"),
+        .arg(
+            Arg::new(OPT_GOAL)
+                .short('g')
+                .long("goal")
+                .help("Goal width, default ~0.94*WIDTH. Must be less than WIDTH.")
+                .value_name("GOAL"),
         )
-        .arg(
-            Arg::new(OPT_QUICK)
-                .short('q')
-                .long("quick")
-                .help(
+        .arg(
+            Arg::new(OPT_QUICK)
+                .short('q')
+                .long("quick")
+                .help(
                     "Break lines more quickly at the \
             expense of a potentially more ragged appearance.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_TAB_WIDTH)
-                .short('T')
-                .long("tab-width")
-                .help(
+        .arg(
+            Arg::new(OPT_TAB_WIDTH)
+                .short('T')
+                .long("tab-width")
+                .help(
                     "Treat tabs as TABWIDTH spaces for \
                     determining line length, default 8. Note that this is used only for \
                     calculating line lengths; tabs are preserved in the output.",
                 )
-                .value_name("TABWIDTH"),
+                .value_name("TABWIDTH"),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_fmt/linebreak.rs.html b/dev/src/uu_fmt/linebreak.rs.html index 4adc3f42b..ceccb6f62 100644 --- a/dev/src/uu_fmt/linebreak.rs.html +++ b/dev/src/uu_fmt/linebreak.rs.html @@ -1,4 +1,4 @@ -linebreak.rs - source
1
+linebreak.rs - source
1
 2
 3
 4
@@ -519,526 +519,526 @@
 519
 520
 521
-
//  * This file is part of `fmt` from the uutils coreutils package.
-//  *
-//  * (c) kwantam <kwantam@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of `fmt` from the uutils coreutils package.
+//  *
+//  * (c) kwantam <kwantam@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) INFTY MULT accum breakwords linebreak linebreaking linebreaks linelen maxlength minlength nchars ostream overlen parasplit plass posn powf punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen
+// spell-checker:ignore (ToDO) INFTY MULT accum breakwords linebreak linebreaking linebreaks linelen maxlength minlength nchars ostream overlen parasplit plass posn powf punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen
 
-use std::cmp;
-use std::i64;
-use std::io::{BufWriter, Stdout, Write};
-use std::mem;
+use std::cmp;
+use std::i64;
+use std::io::{BufWriter, Stdout, Write};
+use std::mem;
 
-use crate::parasplit::{ParaWords, Paragraph, WordInfo};
-use crate::FmtOptions;
+use crate::parasplit::{ParaWords, Paragraph, WordInfo};
+use crate::FmtOptions;
 
-struct BreakArgs<'a> {
-    opts: &'a FmtOptions,
-    init_len: usize,
-    indent_str: &'a str,
-    indent_len: usize,
-    uniform: bool,
-    ostream: &'a mut BufWriter<Stdout>,
+struct BreakArgs<'a> {
+    opts: &'a FmtOptions,
+    init_len: usize,
+    indent_str: &'a str,
+    indent_len: usize,
+    uniform: bool,
+    ostream: &'a mut BufWriter<Stdout>,
 }
 
-impl<'a> BreakArgs<'a> {
-    fn compute_width<'b>(&self, winfo: &WordInfo<'b>, posn: usize, fresh: bool) -> usize {
-        if fresh {
-            0
-        } else {
-            let post = winfo.after_tab;
-            match winfo.before_tab {
-                None => post,
-                Some(pre) => {
-                    post + ((pre + posn) / self.opts.tabwidth + 1) * self.opts.tabwidth - posn
+impl<'a> BreakArgs<'a> {
+    fn compute_width<'b>(&self, winfo: &WordInfo<'b>, posn: usize, fresh: bool) -> usize {
+        if fresh {
+            0
+        } else {
+            let post = winfo.after_tab;
+            match winfo.before_tab {
+                None => post,
+                Some(pre) => {
+                    post + ((pre + posn) / self.opts.tabwidth + 1) * self.opts.tabwidth - posn
                 }
             }
         }
     }
 }
 
-pub fn break_lines(
-    para: &Paragraph,
-    opts: &FmtOptions,
-    ostream: &mut BufWriter<Stdout>,
-) -> std::io::Result<()> {
-    // indent
-    let p_indent = &para.indent_str[..];
-    let p_indent_len = para.indent_len;
+pub fn break_lines(
+    para: &Paragraph,
+    opts: &FmtOptions,
+    ostream: &mut BufWriter<Stdout>,
+) -> std::io::Result<()> {
+    // indent
+    let p_indent = &para.indent_str[..];
+    let p_indent_len = para.indent_len;
 
-    // words
-    let p_words = ParaWords::new(opts, para);
-    let mut p_words_words = p_words.words();
+    // words
+    let p_words = ParaWords::new(opts, para);
+    let mut p_words_words = p_words.words();
 
-    // the first word will *always* appear on the first line
-    // make sure of this here
-    let (w, w_len) = match p_words_words.next() {
-        Some(winfo) => (winfo.word, winfo.word_nchars),
-        None => {
-            return ostream.write_all(b"\n");
+    // the first word will *always* appear on the first line
+    // make sure of this here
+    let (w, w_len) = match p_words_words.next() {
+        Some(winfo) => (winfo.word, winfo.word_nchars),
+        None => {
+            return ostream.write_all(b"\n");
         }
     };
-    // print the init, if it exists, and get its length
-    let p_init_len = w_len
-        + if opts.crown || opts.tagged {
-            // handle "init" portion
-            ostream.write_all(para.init_str.as_bytes())?;
-            para.init_len
-        } else if !para.mail_header {
-            // for non-(crown, tagged) that's the same as a normal indent
-            ostream.write_all(p_indent.as_bytes())?;
-            p_indent_len
-        } else {
-            // except that mail headers get no indent at all
-            0
-        };
-    // write first word after writing init
-    ostream.write_all(w.as_bytes())?;
+    // print the init, if it exists, and get its length
+    let p_init_len = w_len
+        + if opts.crown || opts.tagged {
+            // handle "init" portion
+            ostream.write_all(para.init_str.as_bytes())?;
+            para.init_len
+        } else if !para.mail_header {
+            // for non-(crown, tagged) that's the same as a normal indent
+            ostream.write_all(p_indent.as_bytes())?;
+            p_indent_len
+        } else {
+            // except that mail headers get no indent at all
+            0
+        };
+    // write first word after writing init
+    ostream.write_all(w.as_bytes())?;
 
-    // does this paragraph require uniform spacing?
-    let uniform = para.mail_header || opts.uniform;
+    // does this paragraph require uniform spacing?
+    let uniform = para.mail_header || opts.uniform;
 
-    let mut break_args = BreakArgs {
-        opts,
-        init_len: p_init_len,
-        indent_str: p_indent,
-        indent_len: p_indent_len,
-        uniform,
-        ostream,
+    let mut break_args = BreakArgs {
+        opts,
+        init_len: p_init_len,
+        indent_str: p_indent,
+        indent_len: p_indent_len,
+        uniform,
+        ostream,
     };
 
-    if opts.quick || para.mail_header {
-        break_simple(p_words_words, &mut break_args)
-    } else {
-        break_knuth_plass(p_words_words, &mut break_args)
+    if opts.quick || para.mail_header {
+        break_simple(p_words_words, &mut break_args)
+    } else {
+        break_knuth_plass(p_words_words, &mut break_args)
     }
 }
 
-// break_simple implements a "greedy" breaking algorithm: print words until
-// maxlength would be exceeded, then print a linebreak and indent and continue.
-fn break_simple<'a, T: Iterator<Item = &'a WordInfo<'a>>>(
-    mut iter: T,
-    args: &mut BreakArgs<'a>,
-) -> std::io::Result<()> {
-    iter.try_fold((args.init_len, false), |l, winfo| {
-        accum_words_simple(args, l, winfo)
+// break_simple implements a "greedy" breaking algorithm: print words until
+// maxlength would be exceeded, then print a linebreak and indent and continue.
+fn break_simple<'a, T: Iterator<Item = &'a WordInfo<'a>>>(
+    mut iter: T,
+    args: &mut BreakArgs<'a>,
+) -> std::io::Result<()> {
+    iter.try_fold((args.init_len, false), |l, winfo| {
+        accum_words_simple(args, l, winfo)
     })?;
-    args.ostream.write_all(b"\n")
+    args.ostream.write_all(b"\n")
 }
 
-fn accum_words_simple<'a>(
-    args: &mut BreakArgs<'a>,
-    (l, prev_punct): (usize, bool),
-    winfo: &'a WordInfo<'a>,
-) -> std::io::Result<(usize, bool)> {
-    // compute the length of this word, considering how tabs will expand at this position on the line
-    let wlen = winfo.word_nchars + args.compute_width(winfo, l, false);
+fn accum_words_simple<'a>(
+    args: &mut BreakArgs<'a>,
+    (l, prev_punct): (usize, bool),
+    winfo: &'a WordInfo<'a>,
+) -> std::io::Result<(usize, bool)> {
+    // compute the length of this word, considering how tabs will expand at this position on the line
+    let wlen = winfo.word_nchars + args.compute_width(winfo, l, false);
 
-    let slen = compute_slen(
-        args.uniform,
-        winfo.new_line,
-        winfo.sentence_start,
-        prev_punct,
+    let slen = compute_slen(
+        args.uniform,
+        winfo.new_line,
+        winfo.sentence_start,
+        prev_punct,
     );
 
-    if l + wlen + slen > args.opts.width {
-        write_newline(args.indent_str, args.ostream)?;
-        write_with_spaces(&winfo.word[winfo.word_start..], 0, args.ostream)?;
-        Ok((args.indent_len + winfo.word_nchars, winfo.ends_punct))
-    } else {
-        write_with_spaces(winfo.word, slen, args.ostream)?;
-        Ok((l + wlen + slen, winfo.ends_punct))
+    if l + wlen + slen > args.opts.width {
+        write_newline(args.indent_str, args.ostream)?;
+        write_with_spaces(&winfo.word[winfo.word_start..], 0, args.ostream)?;
+        Ok((args.indent_len + winfo.word_nchars, winfo.ends_punct))
+    } else {
+        write_with_spaces(winfo.word, slen, args.ostream)?;
+        Ok((l + wlen + slen, winfo.ends_punct))
     }
 }
 
-// break_knuth_plass implements an "optimal" breaking algorithm in the style of
-//    Knuth, D.E., and Plass, M.F. "Breaking Paragraphs into Lines." in Software,
-//    Practice and Experience. Vol. 11, No. 11, November 1981.
-//    http://onlinelibrary.wiley.com/doi/10.1002/spe.4380111102/pdf
-fn break_knuth_plass<'a, T: Clone + Iterator<Item = &'a WordInfo<'a>>>(
-    mut iter: T,
-    args: &mut BreakArgs<'a>,
-) -> std::io::Result<()> {
-    // run the algorithm to get the breakpoints
-    let breakpoints = find_kp_breakpoints(iter.clone(), args);
+// break_knuth_plass implements an "optimal" breaking algorithm in the style of
+//    Knuth, D.E., and Plass, M.F. "Breaking Paragraphs into Lines." in Software,
+//    Practice and Experience. Vol. 11, No. 11, November 1981.
+//    http://onlinelibrary.wiley.com/doi/10.1002/spe.4380111102/pdf
+fn break_knuth_plass<'a, T: Clone + Iterator<Item = &'a WordInfo<'a>>>(
+    mut iter: T,
+    args: &mut BreakArgs<'a>,
+) -> std::io::Result<()> {
+    // run the algorithm to get the breakpoints
+    let breakpoints = find_kp_breakpoints(iter.clone(), args);
 
-    // iterate through the breakpoints (note that breakpoints is in reverse break order, so we .rev() it
-    let result: std::io::Result<(bool, bool)> = breakpoints.iter().rev().try_fold(
+    // iterate through the breakpoints (note that breakpoints is in reverse break order, so we .rev() it
+    let result: std::io::Result<(bool, bool)> = breakpoints.iter().rev().try_fold(
         (false, false),
-        |(mut prev_punct, mut fresh), &(next_break, break_before)| {
-            if fresh {
-                write_newline(args.indent_str, args.ostream)?;
+        |(mut prev_punct, mut fresh), &(next_break, break_before)| {
+            if fresh {
+                write_newline(args.indent_str, args.ostream)?;
             }
-            // at each breakpoint, keep emitting words until we find the word matching this breakpoint
-            for winfo in &mut iter {
-                let (slen, word) = slice_if_fresh(
-                    fresh,
-                    winfo.word,
-                    winfo.word_start,
-                    args.uniform,
-                    winfo.new_line,
-                    winfo.sentence_start,
-                    prev_punct,
+            // at each breakpoint, keep emitting words until we find the word matching this breakpoint
+            for winfo in &mut iter {
+                let (slen, word) = slice_if_fresh(
+                    fresh,
+                    winfo.word,
+                    winfo.word_start,
+                    args.uniform,
+                    winfo.new_line,
+                    winfo.sentence_start,
+                    prev_punct,
                 );
-                fresh = false;
-                prev_punct = winfo.ends_punct;
+                fresh = false;
+                prev_punct = winfo.ends_punct;
 
-                // We find identical breakpoints here by comparing addresses of the references.
-                // This is OK because the backing vector is not mutating once we are linebreaking.
-                let winfo_ptr = winfo as *const _;
-                let next_break_ptr = next_break as *const _;
-                if winfo_ptr == next_break_ptr {
-                    // OK, we found the matching word
-                    if break_before {
-                        write_newline(args.indent_str, args.ostream)?;
-                        write_with_spaces(&winfo.word[winfo.word_start..], 0, args.ostream)?;
-                    } else {
-                        // breaking after this word, so that means "fresh" is true for the next iteration
-                        write_with_spaces(word, slen, args.ostream)?;
-                        fresh = true;
+                // We find identical breakpoints here by comparing addresses of the references.
+                // This is OK because the backing vector is not mutating once we are linebreaking.
+                let winfo_ptr = winfo as *const _;
+                let next_break_ptr = next_break as *const _;
+                if winfo_ptr == next_break_ptr {
+                    // OK, we found the matching word
+                    if break_before {
+                        write_newline(args.indent_str, args.ostream)?;
+                        write_with_spaces(&winfo.word[winfo.word_start..], 0, args.ostream)?;
+                    } else {
+                        // breaking after this word, so that means "fresh" is true for the next iteration
+                        write_with_spaces(word, slen, args.ostream)?;
+                        fresh = true;
                     }
                     break;
-                } else {
-                    write_with_spaces(word, slen, args.ostream)?;
+                } else {
+                    write_with_spaces(word, slen, args.ostream)?;
                 }
             }
-            Ok((prev_punct, fresh))
+            Ok((prev_punct, fresh))
         },
     );
-    let (mut prev_punct, mut fresh) = result?;
+    let (mut prev_punct, mut fresh) = result?;
 
-    // after the last linebreak, write out the rest of the final line.
-    for winfo in iter {
-        if fresh {
-            write_newline(args.indent_str, args.ostream)?;
+    // after the last linebreak, write out the rest of the final line.
+    for winfo in iter {
+        if fresh {
+            write_newline(args.indent_str, args.ostream)?;
         }
-        let (slen, word) = slice_if_fresh(
-            fresh,
-            winfo.word,
-            winfo.word_start,
-            args.uniform,
-            winfo.new_line,
-            winfo.sentence_start,
-            prev_punct,
+        let (slen, word) = slice_if_fresh(
+            fresh,
+            winfo.word,
+            winfo.word_start,
+            args.uniform,
+            winfo.new_line,
+            winfo.sentence_start,
+            prev_punct,
         );
-        prev_punct = winfo.ends_punct;
-        fresh = false;
-        write_with_spaces(word, slen, args.ostream)?;
+        prev_punct = winfo.ends_punct;
+        fresh = false;
+        write_with_spaces(word, slen, args.ostream)?;
     }
-    args.ostream.write_all(b"\n")
+    args.ostream.write_all(b"\n")
 }
 
-struct LineBreak<'a> {
-    prev: usize,
-    linebreak: Option<&'a WordInfo<'a>>,
-    break_before: bool,
-    demerits: i64,
-    prev_rat: f32,
-    length: usize,
-    fresh: bool,
+struct LineBreak<'a> {
+    prev: usize,
+    linebreak: Option<&'a WordInfo<'a>>,
+    break_before: bool,
+    demerits: i64,
+    prev_rat: f32,
+    length: usize,
+    fresh: bool,
 }
 
-fn find_kp_breakpoints<'a, T: Iterator<Item = &'a WordInfo<'a>>>(
-    iter: T,
-    args: &BreakArgs<'a>,
-) -> Vec<(&'a WordInfo<'a>, bool)> {
-    let mut iter = iter.peekable();
-    // set up the initial null linebreak
-    let mut linebreaks = vec![LineBreak {
-        prev: 0,
-        linebreak: None,
-        break_before: false,
-        demerits: 0,
-        prev_rat: 0.0f32,
-        length: args.init_len,
-        fresh: false,
+fn find_kp_breakpoints<'a, T: Iterator<Item = &'a WordInfo<'a>>>(
+    iter: T,
+    args: &BreakArgs<'a>,
+) -> Vec<(&'a WordInfo<'a>, bool)> {
+    let mut iter = iter.peekable();
+    // set up the initial null linebreak
+    let mut linebreaks = vec![LineBreak {
+        prev: 0,
+        linebreak: None,
+        break_before: false,
+        demerits: 0,
+        prev_rat: 0.0f32,
+        length: args.init_len,
+        fresh: false,
     }];
-    // this vec holds the current active linebreaks; next_ holds the breaks that will be active for
-    // the next word
-    let active_breaks = &mut vec![0];
-    let next_active_breaks = &mut vec![];
+    // this vec holds the current active linebreaks; next_ holds the breaks that will be active for
+    // the next word
+    let active_breaks = &mut vec![0];
+    let next_active_breaks = &mut vec![];
 
-    let stretch = (args.opts.width - args.opts.goal) as isize;
-    let minlength = args.opts.goal - stretch as usize;
-    let mut new_linebreaks = vec![];
-    let mut is_sentence_start = false;
-    let mut least_demerits = 0;
-    loop {
-        let w = match iter.next() {
-            None => break,
-            Some(w) => w,
+    let stretch = (args.opts.width - args.opts.goal) as isize;
+    let minlength = args.opts.goal - stretch as usize;
+    let mut new_linebreaks = vec![];
+    let mut is_sentence_start = false;
+    let mut least_demerits = 0;
+    loop {
+        let w = match iter.next() {
+            None => break,
+            Some(w) => w,
         };
 
-        // if this is the last word, we don't add additional demerits for this break
-        let (is_last_word, is_sentence_end) = match iter.peek() {
-            None => (true, true),
-            Some(&&WordInfo {
-                sentence_start: st,
-                new_line: nl,
+        // if this is the last word, we don't add additional demerits for this break
+        let (is_last_word, is_sentence_end) = match iter.peek() {
+            None => (true, true),
+            Some(&&WordInfo {
+                sentence_start: st,
+                new_line: nl,
                 ..
-            }) => (false, st || (nl && w.ends_punct)),
+            }) => (false, st || (nl && w.ends_punct)),
         };
 
-        // should we be adding extra space at the beginning of the next sentence?
-        let slen = compute_slen(args.uniform, w.new_line, is_sentence_start, false);
+        // should we be adding extra space at the beginning of the next sentence?
+        let slen = compute_slen(args.uniform, w.new_line, is_sentence_start, false);
 
-        let mut ld_new = i64::MAX;
-        let mut ld_next = i64::MAX;
-        let mut ld_idx = 0;
-        new_linebreaks.clear();
-        next_active_breaks.clear();
-        // go through each active break, extending it and possibly adding a new active
-        // break if we are above the minimum required length
-        for &i in active_breaks.iter() {
-            let active = &mut linebreaks[i];
-            // normalize demerits to avoid overflow, and record if this is the least
-            active.demerits -= least_demerits;
-            if active.demerits < ld_next {
-                ld_next = active.demerits;
-                ld_idx = i;
+        let mut ld_new = i64::MAX;
+        let mut ld_next = i64::MAX;
+        let mut ld_idx = 0;
+        new_linebreaks.clear();
+        next_active_breaks.clear();
+        // go through each active break, extending it and possibly adding a new active
+        // break if we are above the minimum required length
+        for &i in active_breaks.iter() {
+            let active = &mut linebreaks[i];
+            // normalize demerits to avoid overflow, and record if this is the least
+            active.demerits -= least_demerits;
+            if active.demerits < ld_next {
+                ld_next = active.demerits;
+                ld_idx = i;
             }
 
-            // get the new length
-            let tlen = w.word_nchars
-                + args.compute_width(w, active.length, active.fresh)
-                + slen
-                + active.length;
+            // get the new length
+            let tlen = w.word_nchars
+                + args.compute_width(w, active.length, active.fresh)
+                + slen
+                + active.length;
 
-            // if tlen is longer than args.opts.width, we drop this break from the active list
-            // otherwise, we extend the break, and possibly add a new break at this point
-            if tlen <= args.opts.width {
-                // this break will still be active next time
-                next_active_breaks.push(i);
-                // we can put this word on this line
-                active.fresh = false;
-                active.length = tlen;
+            // if tlen is longer than args.opts.width, we drop this break from the active list
+            // otherwise, we extend the break, and possibly add a new break at this point
+            if tlen <= args.opts.width {
+                // this break will still be active next time
+                next_active_breaks.push(i);
+                // we can put this word on this line
+                active.fresh = false;
+                active.length = tlen;
 
-                // if we're above the minlength, we can also consider breaking here
-                if tlen >= minlength {
-                    let (new_demerits, new_ratio) = if is_last_word {
-                        // there is no penalty for the final line's length
-                        (0, 0.0)
-                    } else {
-                        compute_demerits(
-                            args.opts.goal as isize - tlen as isize,
-                            stretch,
-                            w.word_nchars as isize,
-                            active.prev_rat,
+                // if we're above the minlength, we can also consider breaking here
+                if tlen >= minlength {
+                    let (new_demerits, new_ratio) = if is_last_word {
+                        // there is no penalty for the final line's length
+                        (0, 0.0)
+                    } else {
+                        compute_demerits(
+                            args.opts.goal as isize - tlen as isize,
+                            stretch,
+                            w.word_nchars as isize,
+                            active.prev_rat,
                         )
                     };
 
-                    // do not even consider adding a line that has too many demerits
-                    // also, try to detect overflow by checking signum
-                    let total_demerits = new_demerits + active.demerits;
-                    if new_demerits < BAD_INFTY_SQ
-                        && total_demerits < ld_new
-                        && active.demerits.signum() <= new_demerits.signum()
+                    // do not even consider adding a line that has too many demerits
+                    // also, try to detect overflow by checking signum
+                    let total_demerits = new_demerits + active.demerits;
+                    if new_demerits < BAD_INFTY_SQ
+                        && total_demerits < ld_new
+                        && active.demerits.signum() <= new_demerits.signum()
                     {
-                        ld_new = total_demerits;
-                        new_linebreaks.push(LineBreak {
-                            prev: i,
-                            linebreak: Some(w),
-                            break_before: false,
-                            demerits: total_demerits,
-                            prev_rat: new_ratio,
-                            length: args.indent_len,
-                            fresh: true,
+                        ld_new = total_demerits;
+                        new_linebreaks.push(LineBreak {
+                            prev: i,
+                            linebreak: Some(w),
+                            break_before: false,
+                            demerits: total_demerits,
+                            prev_rat: new_ratio,
+                            length: args.indent_len,
+                            fresh: true,
                         });
                     }
                 }
             }
         }
 
-        // if we generated any new linebreaks, add the last one to the list
-        // the last one is always the best because we don't add to new_linebreaks unless
-        // it's better than the best one so far
-        match new_linebreaks.pop() {
-            None => (),
-            Some(lb) => {
-                next_active_breaks.push(linebreaks.len());
-                linebreaks.push(lb);
+        // if we generated any new linebreaks, add the last one to the list
+        // the last one is always the best because we don't add to new_linebreaks unless
+        // it's better than the best one so far
+        match new_linebreaks.pop() {
+            None => (),
+            Some(lb) => {
+                next_active_breaks.push(linebreaks.len());
+                linebreaks.push(lb);
             }
         }
 
-        if next_active_breaks.is_empty() {
-            // every potential linebreak is too long! choose the linebreak with the least demerits, ld_idx
-            let new_break =
-                restart_active_breaks(args, &linebreaks[ld_idx], ld_idx, w, slen, minlength);
-            next_active_breaks.push(linebreaks.len());
-            linebreaks.push(new_break);
-            least_demerits = 0;
-        } else {
-            // next time around, normalize out the demerits fields
-            // on active linebreaks to make overflow less likely
-            least_demerits = cmp::max(ld_next, 0);
+        if next_active_breaks.is_empty() {
+            // every potential linebreak is too long! choose the linebreak with the least demerits, ld_idx
+            let new_break =
+                restart_active_breaks(args, &linebreaks[ld_idx], ld_idx, w, slen, minlength);
+            next_active_breaks.push(linebreaks.len());
+            linebreaks.push(new_break);
+            least_demerits = 0;
+        } else {
+            // next time around, normalize out the demerits fields
+            // on active linebreaks to make overflow less likely
+            least_demerits = cmp::max(ld_next, 0);
         }
-        // swap in new list of active breaks
-        mem::swap(active_breaks, next_active_breaks);
-        // If this was the last word in a sentence, the next one must be the first in the next.
-        is_sentence_start = is_sentence_end;
+        // swap in new list of active breaks
+        mem::swap(active_breaks, next_active_breaks);
+        // If this was the last word in a sentence, the next one must be the first in the next.
+        is_sentence_start = is_sentence_end;
     }
 
-    // return the best path
-    build_best_path(&linebreaks, active_breaks)
+    // return the best path
+    build_best_path(&linebreaks, active_breaks)
 }
 
-fn build_best_path<'a>(paths: &[LineBreak<'a>], active: &[usize]) -> Vec<(&'a WordInfo<'a>, bool)> {
-    let mut breakwords = vec![];
-    // of the active paths, we select the one with the fewest demerits
-    let mut best_idx = match active.iter().min_by_key(|&&a| paths[a].demerits) {
-        None => crash!(
+fn build_best_path<'a>(paths: &[LineBreak<'a>], active: &[usize]) -> Vec<(&'a WordInfo<'a>, bool)> {
+    let mut breakwords = vec![];
+    // of the active paths, we select the one with the fewest demerits
+    let mut best_idx = match active.iter().min_by_key(|&&a| paths[a].demerits) {
+        None => crash!(
             1,
-            "Failed to find a k-p linebreak solution. This should never happen."
-        ),
-        Some(&s) => s,
+            "Failed to find a k-p linebreak solution. This should never happen."
+        ),
+        Some(&s) => s,
     };
 
-    // now, chase the pointers back through the break list, recording
-    // the words at which we should break
-    loop {
-        let next_best = &paths[best_idx];
-        match next_best.linebreak {
-            None => return breakwords,
-            Some(prev) => {
-                breakwords.push((prev, next_best.break_before));
-                best_idx = next_best.prev;
+    // now, chase the pointers back through the break list, recording
+    // the words at which we should break
+    loop {
+        let next_best = &paths[best_idx];
+        match next_best.linebreak {
+            None => return breakwords,
+            Some(prev) => {
+                breakwords.push((prev, next_best.break_before));
+                best_idx = next_best.prev;
             }
         }
     }
 }
 
-// "infinite" badness is more like (1+BAD_INFTY)^2 because of how demerits are computed
-const BAD_INFTY: i64 = 10_000_000;
-const BAD_INFTY_SQ: i64 = BAD_INFTY * BAD_INFTY;
-// badness = BAD_MULT * abs(r) ^ 3
-const BAD_MULT: f32 = 100.0;
-// DR_MULT is multiplier for delta-R between lines
-const DR_MULT: f32 = 600.0;
-// DL_MULT is penalty multiplier for short words at end of line
-const DL_MULT: f32 = 300.0;
+// "infinite" badness is more like (1+BAD_INFTY)^2 because of how demerits are computed
+const BAD_INFTY: i64 = 10_000_000;
+const BAD_INFTY_SQ: i64 = BAD_INFTY * BAD_INFTY;
+// badness = BAD_MULT * abs(r) ^ 3
+const BAD_MULT: f32 = 100.0;
+// DR_MULT is multiplier for delta-R between lines
+const DR_MULT: f32 = 600.0;
+// DL_MULT is penalty multiplier for short words at end of line
+const DL_MULT: f32 = 300.0;
 
-fn compute_demerits(delta_len: isize, stretch: isize, wlen: isize, prev_rat: f32) -> (i64, f32) {
-    // how much stretch are we using?
-    let ratio = if delta_len == 0 {
-        0.0f32
-    } else {
-        delta_len as f32 / stretch as f32
+fn compute_demerits(delta_len: isize, stretch: isize, wlen: isize, prev_rat: f32) -> (i64, f32) {
+    // how much stretch are we using?
+    let ratio = if delta_len == 0 {
+        0.0f32
+    } else {
+        delta_len as f32 / stretch as f32
     };
 
-    // compute badness given the stretch ratio
-    let bad_linelen = if ratio.abs() > 1.0f32 {
-        BAD_INFTY
-    } else {
-        (BAD_MULT * ratio.powi(3).abs()) as i64
+    // compute badness given the stretch ratio
+    let bad_linelen = if ratio.abs() > 1.0f32 {
+        BAD_INFTY
+    } else {
+        (BAD_MULT * ratio.powi(3).abs()) as i64
     };
 
-    // we penalize lines ending in really short words
-    let bad_wordlen = if wlen >= stretch {
-        0
-    } else {
-        (DL_MULT
-            * ((stretch - wlen) as f32 / (stretch - 1) as f32)
-                .powi(3)
-                .abs()) as i64
+    // we penalize lines ending in really short words
+    let bad_wordlen = if wlen >= stretch {
+        0
+    } else {
+        (DL_MULT
+            * ((stretch - wlen) as f32 / (stretch - 1) as f32)
+                .powi(3)
+                .abs()) as i64
     };
 
-    // we penalize lines that have very different ratios from previous lines
-    let bad_delta_r = (DR_MULT * (((ratio - prev_rat) / 2.0).powi(3)).abs()) as i64;
+    // we penalize lines that have very different ratios from previous lines
+    let bad_delta_r = (DR_MULT * (((ratio - prev_rat) / 2.0).powi(3)).abs()) as i64;
 
-    let demerits = i64::pow(1 + bad_linelen + bad_wordlen + bad_delta_r, 2);
+    let demerits = i64::pow(1 + bad_linelen + bad_wordlen + bad_delta_r, 2);
 
-    (demerits, ratio)
+    (demerits, ratio)
 }
 
-fn restart_active_breaks<'a>(
-    args: &BreakArgs<'a>,
-    active: &LineBreak<'a>,
-    act_idx: usize,
-    w: &'a WordInfo<'a>,
-    slen: usize,
-    min: usize,
-) -> LineBreak<'a> {
-    let (break_before, line_length) = if active.fresh {
-        // never break before a word if that word would be the first on a line
-        (false, args.indent_len)
-    } else {
-        // choose the lesser evil: breaking too early, or breaking too late
-        let wlen = w.word_nchars + args.compute_width(w, active.length, active.fresh);
-        let underlen = (min - active.length) as isize;
-        let overlen = ((wlen + slen + active.length) - args.opts.width) as isize;
-        if overlen > underlen {
-            // break early, put this word on the next line
-            (true, args.indent_len + w.word_nchars)
-        } else {
-            (false, args.indent_len)
+fn restart_active_breaks<'a>(
+    args: &BreakArgs<'a>,
+    active: &LineBreak<'a>,
+    act_idx: usize,
+    w: &'a WordInfo<'a>,
+    slen: usize,
+    min: usize,
+) -> LineBreak<'a> {
+    let (break_before, line_length) = if active.fresh {
+        // never break before a word if that word would be the first on a line
+        (false, args.indent_len)
+    } else {
+        // choose the lesser evil: breaking too early, or breaking too late
+        let wlen = w.word_nchars + args.compute_width(w, active.length, active.fresh);
+        let underlen = (min - active.length) as isize;
+        let overlen = ((wlen + slen + active.length) - args.opts.width) as isize;
+        if overlen > underlen {
+            // break early, put this word on the next line
+            (true, args.indent_len + w.word_nchars)
+        } else {
+            (false, args.indent_len)
         }
     };
 
-    // restart the linebreak. This will be our only active path.
-    LineBreak {
-        prev: act_idx,
-        linebreak: Some(w),
-        break_before,
-        demerits: 0, // this is the only active break, so we can reset the demerit count
-        prev_rat: if break_before { 1.0 } else { -1.0 },
-        length: line_length,
-        fresh: !break_before,
+    // restart the linebreak. This will be our only active path.
+    LineBreak {
+        prev: act_idx,
+        linebreak: Some(w),
+        break_before,
+        demerits: 0, // this is the only active break, so we can reset the demerit count
+        prev_rat: if break_before { 1.0 } else { -1.0 },
+        length: line_length,
+        fresh: !break_before,
     }
 }
 
-// Number of spaces to add before a word, based on mode, newline, sentence start.
-fn compute_slen(uniform: bool, newline: bool, start: bool, punct: bool) -> usize {
-    if uniform || newline {
-        if start || (newline && punct) {
-            2
-        } else {
-            1
-        }
-    } else {
-        0
+// Number of spaces to add before a word, based on mode, newline, sentence start.
+fn compute_slen(uniform: bool, newline: bool, start: bool, punct: bool) -> usize {
+    if uniform || newline {
+        if start || (newline && punct) {
+            2
+        } else {
+            1
+        }
+    } else {
+        0
+    }
+}
+
+// If we're on a fresh line, slen=0 and we slice off leading whitespace.
+// Otherwise, compute slen and leave whitespace alone.
+fn slice_if_fresh(
+    fresh: bool,
+    word: &str,
+    start: usize,
+    uniform: bool,
+    newline: bool,
+    sstart: bool,
+    punct: bool,
+) -> (usize, &str) {
+    if fresh {
+        (0, &word[start..])
+    } else {
+        (compute_slen(uniform, newline, sstart, punct), word)
     }
 }
 
-// If we're on a fresh line, slen=0 and we slice off leading whitespace.
-// Otherwise, compute slen and leave whitespace alone.
-fn slice_if_fresh(
-    fresh: bool,
-    word: &str,
-    start: usize,
-    uniform: bool,
-    newline: bool,
-    sstart: bool,
-    punct: bool,
-) -> (usize, &str) {
-    if fresh {
-        (0, &word[start..])
-    } else {
-        (compute_slen(uniform, newline, sstart, punct), word)
-    }
+// Write a newline and add the indent.
+fn write_newline(indent: &str, ostream: &mut BufWriter<Stdout>) -> std::io::Result<()> {
+    ostream.write_all(b"\n")?;
+    ostream.write_all(indent.as_bytes())
 }
 
-// Write a newline and add the indent.
-fn write_newline(indent: &str, ostream: &mut BufWriter<Stdout>) -> std::io::Result<()> {
-    ostream.write_all(b"\n")?;
-    ostream.write_all(indent.as_bytes())
-}
-
-// Write the word, along with slen spaces.
-fn write_with_spaces(
-    word: &str,
-    slen: usize,
-    ostream: &mut BufWriter<Stdout>,
-) -> std::io::Result<()> {
-    if slen == 2 {
-        ostream.write_all(b"  ")?;
-    } else if slen == 1 {
-        ostream.write_all(b" ")?;
+// Write the word, along with slen spaces.
+fn write_with_spaces(
+    word: &str,
+    slen: usize,
+    ostream: &mut BufWriter<Stdout>,
+) -> std::io::Result<()> {
+    if slen == 2 {
+        ostream.write_all(b"  ")?;
+    } else if slen == 1 {
+        ostream.write_all(b" ")?;
     }
-    ostream.write_all(word.as_bytes())
+    ostream.write_all(word.as_bytes())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_fmt/parasplit.rs.html b/dev/src/uu_fmt/parasplit.rs.html index 181a13e57..ba6bd14f8 100644 --- a/dev/src/uu_fmt/parasplit.rs.html +++ b/dev/src/uu_fmt/parasplit.rs.html @@ -1,4 +1,4 @@ -parasplit.rs - source
1
+parasplit.rs - source
1
 2
 3
 4
@@ -625,120 +625,120 @@
 625
 626
 627
-
//  * This file is part of `fmt` from the uutils coreutils package.
-//  *
-//  * (c) kwantam <kwantam@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of `fmt` from the uutils coreutils package.
+//  *
+//  * (c) kwantam <kwantam@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) INFTY MULT PSKIP accum aftertab beforetab breakwords fmt's formatline linebreak linebreaking linebreaks linelen maxlength minlength nchars noformat noformatline ostream overlen parasplit pfxind plass pmatch poffset posn powf prefixindent punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen wordsplits xanti xprefix
+// spell-checker:ignore (ToDO) INFTY MULT PSKIP accum aftertab beforetab breakwords fmt's formatline linebreak linebreaking linebreaks linelen maxlength minlength nchars noformat noformatline ostream overlen parasplit pfxind plass pmatch poffset posn powf prefixindent punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen wordsplits xanti xprefix
 
-use std::io::{BufRead, Lines};
-use std::iter::Peekable;
-use std::slice::Iter;
-use unicode_width::UnicodeWidthChar;
+use std::io::{BufRead, Lines};
+use std::iter::Peekable;
+use std::slice::Iter;
+use unicode_width::UnicodeWidthChar;
 
-use crate::FileOrStdReader;
-use crate::FmtOptions;
+use crate::FileOrStdReader;
+use crate::FmtOptions;
 
-fn char_width(c: char) -> usize {
-    if (c as usize) < 0xA0 {
-        // if it is ASCII, call it exactly 1 wide (including control chars)
-        // calling control chars' widths 1 is consistent with OpenBSD fmt
-        1
-    } else {
-        // otherwise, get the unicode width
-        // note that we shouldn't actually get None here because only c < 0xA0
-        // can return None, but for safety and future-proofing we do it this way
-        UnicodeWidthChar::width(c).unwrap_or(1)
+fn char_width(c: char) -> usize {
+    if (c as usize) < 0xA0 {
+        // if it is ASCII, call it exactly 1 wide (including control chars)
+        // calling control chars' widths 1 is consistent with OpenBSD fmt
+        1
+    } else {
+        // otherwise, get the unicode width
+        // note that we shouldn't actually get None here because only c < 0xA0
+        // can return None, but for safety and future-proofing we do it this way
+        UnicodeWidthChar::width(c).unwrap_or(1)
     }
 }
 
-// lines with PSKIP, lacking PREFIX, or which are entirely blank are
-// NoFormatLines; otherwise, they are FormatLines
-#[derive(Debug)]
-pub enum Line {
-    FormatLine(FileLine),
-    NoFormatLine(String, bool),
+// lines with PSKIP, lacking PREFIX, or which are entirely blank are
+// NoFormatLines; otherwise, they are FormatLines
+#[derive(Debug)]
+pub enum Line {
+    FormatLine(FileLine),
+    NoFormatLine(String, bool),
 }
 
-impl Line {
-    // when we know that it's a FormatLine, as in the ParagraphStream iterator
-    fn get_formatline(self) -> FileLine {
-        match self {
-            Self::FormatLine(fl) => fl,
-            Self::NoFormatLine(..) => panic!("Found NoFormatLine when expecting FormatLine"),
+impl Line {
+    // when we know that it's a FormatLine, as in the ParagraphStream iterator
+    fn get_formatline(self) -> FileLine {
+        match self {
+            Self::FormatLine(fl) => fl,
+            Self::NoFormatLine(..) => panic!("Found NoFormatLine when expecting FormatLine"),
         }
     }
 
-    // when we know that it's a NoFormatLine, as in the ParagraphStream iterator
-    fn get_noformatline(self) -> (String, bool) {
-        match self {
-            Self::NoFormatLine(s, b) => (s, b),
-            Self::FormatLine(..) => panic!("Found FormatLine when expecting NoFormatLine"),
+    // when we know that it's a NoFormatLine, as in the ParagraphStream iterator
+    fn get_noformatline(self) -> (String, bool) {
+        match self {
+            Self::NoFormatLine(s, b) => (s, b),
+            Self::FormatLine(..) => panic!("Found FormatLine when expecting NoFormatLine"),
         }
     }
 }
 
-// each line's prefix has to be considered to know whether to merge it with
-// the next line or not
-#[derive(Debug)]
-pub struct FileLine {
-    line: String,
-    indent_end: usize, // the end of the indent, always the start of the text
-    pfxind_end: usize, // the end of the PREFIX's indent, that is, the spaces before the prefix
-    indent_len: usize, // display length of indent taking into account tabs
-    prefix_len: usize, // PREFIX indent length taking into account tabs
+// each line's prefix has to be considered to know whether to merge it with
+// the next line or not
+#[derive(Debug)]
+pub struct FileLine {
+    line: String,
+    indent_end: usize, // the end of the indent, always the start of the text
+    pfxind_end: usize, // the end of the PREFIX's indent, that is, the spaces before the prefix
+    indent_len: usize, // display length of indent taking into account tabs
+    prefix_len: usize, // PREFIX indent length taking into account tabs
+}
+
+// iterator that produces a stream of Lines from a file
+pub struct FileLines<'a> {
+    opts: &'a FmtOptions,
+    lines: Lines<&'a mut FileOrStdReader>,
 }
 
-// iterator that produces a stream of Lines from a file
-pub struct FileLines<'a> {
-    opts: &'a FmtOptions,
-    lines: Lines<&'a mut FileOrStdReader>,
-}
-
-impl<'a> FileLines<'a> {
-    fn new<'b>(opts: &'b FmtOptions, lines: Lines<&'b mut FileOrStdReader>) -> FileLines<'b> {
-        FileLines { opts, lines }
+impl<'a> FileLines<'a> {
+    fn new<'b>(opts: &'b FmtOptions, lines: Lines<&'b mut FileOrStdReader>) -> FileLines<'b> {
+        FileLines { opts, lines }
     }
 
-    // returns true if this line should be formatted
-    fn match_prefix(&self, line: &str) -> (bool, usize) {
-        if !self.opts.use_prefix {
-            return (true, 0);
+    // returns true if this line should be formatted
+    fn match_prefix(&self, line: &str) -> (bool, usize) {
+        if !self.opts.use_prefix {
+            return (true, 0);
         }
 
-        FileLines::match_prefix_generic(&self.opts.prefix[..], line, self.opts.xprefix)
+        FileLines::match_prefix_generic(&self.opts.prefix[..], line, self.opts.xprefix)
     }
 
-    // returns true if this line should be formatted
-    fn match_anti_prefix(&self, line: &str) -> bool {
-        if !self.opts.use_anti_prefix {
-            return true;
+    // returns true if this line should be formatted
+    fn match_anti_prefix(&self, line: &str) -> bool {
+        if !self.opts.use_anti_prefix {
+            return true;
         }
 
-        match FileLines::match_prefix_generic(
-            &self.opts.anti_prefix[..],
-            line,
-            self.opts.xanti_prefix,
+        match FileLines::match_prefix_generic(
+            &self.opts.anti_prefix[..],
+            line,
+            self.opts.xanti_prefix,
         ) {
             (true, _) => false,
             (_, _) => true,
         }
     }
 
-    fn match_prefix_generic(pfx: &str, line: &str, exact: bool) -> (bool, usize) {
-        if line.starts_with(pfx) {
-            return (true, 0);
+    fn match_prefix_generic(pfx: &str, line: &str, exact: bool) -> (bool, usize) {
+        if line.starts_with(pfx) {
+            return (true, 0);
         }
 
-        if !exact {
-            // we do it this way rather than byte indexing to support unicode whitespace chars
-            for (i, char) in line.char_indices() {
-                if line[i..].starts_with(pfx) {
-                    return (true, i);
-                } else if !char.is_whitespace() {
+        if !exact {
+            // we do it this way rather than byte indexing to support unicode whitespace chars
+            for (i, char) in line.char_indices() {
+                if line[i..].starts_with(pfx) {
+                    return (true, i);
+                } else if !char.is_whitespace() {
                     break;
                 }
             }
@@ -747,510 +747,510 @@
         (false, 0)
     }
 
-    fn compute_indent(&self, string: &str, prefix_end: usize) -> (usize, usize, usize) {
-        let mut prefix_len = 0;
-        let mut indent_len = 0;
-        let mut indent_end = 0;
-        for (os, c) in string.char_indices() {
-            if os == prefix_end {
-                // we found the end of the prefix, so this is the printed length of the prefix here
-                prefix_len = indent_len;
+    fn compute_indent(&self, string: &str, prefix_end: usize) -> (usize, usize, usize) {
+        let mut prefix_len = 0;
+        let mut indent_len = 0;
+        let mut indent_end = 0;
+        for (os, c) in string.char_indices() {
+            if os == prefix_end {
+                // we found the end of the prefix, so this is the printed length of the prefix here
+                prefix_len = indent_len;
             }
 
-            if (os >= prefix_end) && !c.is_whitespace() {
-                // found first non-whitespace after prefix, this is indent_end
-                indent_end = os;
+            if (os >= prefix_end) && !c.is_whitespace() {
+                // found first non-whitespace after prefix, this is indent_end
+                indent_end = os;
                 break;
-            } else if c == '\t' {
-                // compute tab length
-                indent_len = (indent_len / self.opts.tabwidth + 1) * self.opts.tabwidth;
-            } else {
-                // non-tab character
-                indent_len += char_width(c);
+            } else if c == '\t' {
+                // compute tab length
+                indent_len = (indent_len / self.opts.tabwidth + 1) * self.opts.tabwidth;
+            } else {
+                // non-tab character
+                indent_len += char_width(c);
             }
         }
-        (indent_end, prefix_len, indent_len)
+        (indent_end, prefix_len, indent_len)
     }
 }
 
-impl<'a> Iterator for FileLines<'a> {
-    type Item = Line;
+impl<'a> Iterator for FileLines<'a> {
+    type Item = Line;
 
-    fn next(&mut self) -> Option<Line> {
-        let n = match self.lines.next() {
-            Some(t) => match t {
-                Ok(tt) => tt,
-                Err(_) => return None,
+    fn next(&mut self) -> Option<Line> {
+        let n = match self.lines.next() {
+            Some(t) => match t {
+                Ok(tt) => tt,
+                Err(_) => return None,
             },
-            None => return None,
+            None => return None,
         };
 
-        // if this line is entirely whitespace,
-        // emit a blank line
-        // Err(true) indicates that this was a linebreak,
-        // which is important to know when detecting mail headers
-        if n.chars().all(char::is_whitespace) {
-            return Some(Line::NoFormatLine("".to_owned(), true));
+        // if this line is entirely whitespace,
+        // emit a blank line
+        // Err(true) indicates that this was a linebreak,
+        // which is important to know when detecting mail headers
+        if n.chars().all(char::is_whitespace) {
+            return Some(Line::NoFormatLine("".to_owned(), true));
         }
 
-        let (pmatch, poffset) = self.match_prefix(&n[..]);
+        let (pmatch, poffset) = self.match_prefix(&n[..]);
 
-        // if this line does not match the prefix,
-        // emit the line unprocessed and iterate again
-        if !pmatch {
-            return Some(Line::NoFormatLine(n, false));
+        // if this line does not match the prefix,
+        // emit the line unprocessed and iterate again
+        if !pmatch {
+            return Some(Line::NoFormatLine(n, false));
         }
 
-        // if the line matches the prefix, but is blank after,
-        // don't allow lines to be combined through it (that is,
-        // treat it like a blank line, except that since it's
-        // not truly blank we will not allow mail headers on the
-        // following line)
-        if pmatch
-            && n[poffset + self.opts.prefix.len()..]
-                .chars()
-                .all(char::is_whitespace)
+        // if the line matches the prefix, but is blank after,
+        // don't allow lines to be combined through it (that is,
+        // treat it like a blank line, except that since it's
+        // not truly blank we will not allow mail headers on the
+        // following line)
+        if pmatch
+            && n[poffset + self.opts.prefix.len()..]
+                .chars()
+                .all(char::is_whitespace)
         {
-            return Some(Line::NoFormatLine(n, false));
+            return Some(Line::NoFormatLine(n, false));
         }
 
-        // skip if this line matches the anti_prefix
-        // (NOTE definition of match_anti_prefix is TRUE if we should process)
-        if !self.match_anti_prefix(&n[..]) {
-            return Some(Line::NoFormatLine(n, false));
+        // skip if this line matches the anti_prefix
+        // (NOTE definition of match_anti_prefix is TRUE if we should process)
+        if !self.match_anti_prefix(&n[..]) {
+            return Some(Line::NoFormatLine(n, false));
         }
 
-        // figure out the indent, prefix, and prefixindent ending points
-        let prefix_end = poffset + self.opts.prefix.len();
-        let (indent_end, prefix_len, indent_len) = self.compute_indent(&n[..], prefix_end);
+        // figure out the indent, prefix, and prefixindent ending points
+        let prefix_end = poffset + self.opts.prefix.len();
+        let (indent_end, prefix_len, indent_len) = self.compute_indent(&n[..], prefix_end);
 
-        Some(Line::FormatLine(FileLine {
-            line: n,
-            indent_end,
-            pfxind_end: poffset,
-            indent_len,
-            prefix_len,
+        Some(Line::FormatLine(FileLine {
+            line: n,
+            indent_end,
+            pfxind_end: poffset,
+            indent_len,
+            prefix_len,
         }))
     }
 }
 
-// a paragraph : a collection of FileLines that are to be formatted
-// plus info about the paragraph's indentation
-// (but we only retain the String from the FileLine; the other info
-// is only there to help us in deciding how to merge lines into Paragraphs
-#[derive(Debug)]
-pub struct Paragraph {
-    lines: Vec<String>,     // the lines of the file
-    pub init_str: String,   // string representing the init, that is, the first line's indent
-    pub init_len: usize,    // printable length of the init string considering TABWIDTH
-    init_end: usize,        // byte location of end of init in first line String
-    pub indent_str: String, // string representing indent
-    pub indent_len: usize,  // length of above
-    indent_end: usize, // byte location of end of indent (in crown and tagged mode, only applies to 2nd line and onward)
-    pub mail_header: bool, // we need to know if this is a mail header because we do word splitting differently in that case
+// a paragraph : a collection of FileLines that are to be formatted
+// plus info about the paragraph's indentation
+// (but we only retain the String from the FileLine; the other info
+// is only there to help us in deciding how to merge lines into Paragraphs
+#[derive(Debug)]
+pub struct Paragraph {
+    lines: Vec<String>,     // the lines of the file
+    pub init_str: String,   // string representing the init, that is, the first line's indent
+    pub init_len: usize,    // printable length of the init string considering TABWIDTH
+    init_end: usize,        // byte location of end of init in first line String
+    pub indent_str: String, // string representing indent
+    pub indent_len: usize,  // length of above
+    indent_end: usize, // byte location of end of indent (in crown and tagged mode, only applies to 2nd line and onward)
+    pub mail_header: bool, // we need to know if this is a mail header because we do word splitting differently in that case
+}
+
+// an iterator producing a stream of paragraphs from a stream of lines
+// given a set of options.
+pub struct ParagraphStream<'a> {
+    lines: Peekable<FileLines<'a>>,
+    next_mail: bool,
+    opts: &'a FmtOptions,
 }
 
-// an iterator producing a stream of paragraphs from a stream of lines
-// given a set of options.
-pub struct ParagraphStream<'a> {
-    lines: Peekable<FileLines<'a>>,
-    next_mail: bool,
-    opts: &'a FmtOptions,
-}
-
-impl<'a> ParagraphStream<'a> {
-    pub fn new<'b>(opts: &'b FmtOptions, reader: &'b mut FileOrStdReader) -> ParagraphStream<'b> {
-        let lines = FileLines::new(opts, reader.lines()).peekable();
-        // at the beginning of the file, we might find mail headers
-        ParagraphStream {
-            lines,
-            next_mail: true,
-            opts,
+impl<'a> ParagraphStream<'a> {
+    pub fn new<'b>(opts: &'b FmtOptions, reader: &'b mut FileOrStdReader) -> ParagraphStream<'b> {
+        let lines = FileLines::new(opts, reader.lines()).peekable();
+        // at the beginning of the file, we might find mail headers
+        ParagraphStream {
+            lines,
+            next_mail: true,
+            opts,
         }
     }
 
-    // detect RFC822 mail header
-    fn is_mail_header(line: &FileLine) -> bool {
-        // a mail header begins with either "From " (envelope sender line)
-        // or with a sequence of printable ASCII chars (33 to 126, inclusive,
-        // except colon) followed by a colon.
-        if line.indent_end > 0 {
-            false
-        } else {
-            let l_slice = &line.line[..];
-            if l_slice.starts_with("From ") {
-                true
-            } else {
-                let colon_posn = match l_slice.find(':') {
-                    Some(n) => n,
-                    None => return false,
+    // detect RFC822 mail header
+    fn is_mail_header(line: &FileLine) -> bool {
+        // a mail header begins with either "From " (envelope sender line)
+        // or with a sequence of printable ASCII chars (33 to 126, inclusive,
+        // except colon) followed by a colon.
+        if line.indent_end > 0 {
+            false
+        } else {
+            let l_slice = &line.line[..];
+            if l_slice.starts_with("From ") {
+                true
+            } else {
+                let colon_posn = match l_slice.find(':') {
+                    Some(n) => n,
+                    None => return false,
                 };
 
-                // header field must be nonzero length
-                if colon_posn == 0 {
-                    return false;
+                // header field must be nonzero length
+                if colon_posn == 0 {
+                    return false;
                 }
 
-                l_slice[..colon_posn]
-                    .chars()
-                    .all(|x| !matches!(x as usize, y if !(33..=126).contains(&y)))
+                l_slice[..colon_posn]
+                    .chars()
+                    .all(|x| !matches!(x as usize, y if !(33..=126).contains(&y)))
             }
         }
     }
 }
 
-impl<'a> Iterator for ParagraphStream<'a> {
-    type Item = Result<Paragraph, String>;
+impl<'a> Iterator for ParagraphStream<'a> {
+    type Item = Result<Paragraph, String>;
 
-    fn next(&mut self) -> Option<Result<Paragraph, String>> {
-        // return a NoFormatLine in an Err; it should immediately be output
-        let noformat = match self.lines.peek() {
-            None => return None,
-            Some(l) => match *l {
-                Line::FormatLine(_) => false,
-                Line::NoFormatLine(_, _) => true,
+    fn next(&mut self) -> Option<Result<Paragraph, String>> {
+        // return a NoFormatLine in an Err; it should immediately be output
+        let noformat = match self.lines.peek() {
+            None => return None,
+            Some(l) => match *l {
+                Line::FormatLine(_) => false,
+                Line::NoFormatLine(_, _) => true,
             },
         };
 
-        // found a NoFormatLine, immediately dump it out
-        if noformat {
-            let (s, nm) = self.lines.next().unwrap().get_noformatline();
-            self.next_mail = nm;
-            return Some(Err(s));
+        // found a NoFormatLine, immediately dump it out
+        if noformat {
+            let (s, nm) = self.lines.next().unwrap().get_noformatline();
+            self.next_mail = nm;
+            return Some(Err(s));
         }
 
-        // found a FormatLine, now build a paragraph
-        let mut init_str = String::new();
-        let mut init_end = 0;
-        let mut init_len = 0;
-        let mut indent_str = String::new();
-        let mut indent_end = 0;
-        let mut indent_len = 0;
-        let mut prefix_len = 0;
-        let mut pfxind_end = 0;
-        let mut p_lines = Vec::new();
+        // found a FormatLine, now build a paragraph
+        let mut init_str = String::new();
+        let mut init_end = 0;
+        let mut init_len = 0;
+        let mut indent_str = String::new();
+        let mut indent_end = 0;
+        let mut indent_len = 0;
+        let mut prefix_len = 0;
+        let mut pfxind_end = 0;
+        let mut p_lines = Vec::new();
 
-        let mut in_mail = false;
-        let mut second_done = false; // for when we use crown or tagged mode
-        loop {
+        let mut in_mail = false;
+        let mut second_done = false; // for when we use crown or tagged mode
+        loop {
             {
-                // peek ahead
-                // need to explicitly force fl out of scope before we can call self.lines.next()
-                let fl = match self.lines.peek() {
-                    None => break,
-                    Some(l) => match *l {
-                        Line::FormatLine(ref x) => x,
-                        Line::NoFormatLine(..) => break,
+                // peek ahead
+                // need to explicitly force fl out of scope before we can call self.lines.next()
+                let fl = match self.lines.peek() {
+                    None => break,
+                    Some(l) => match *l {
+                        Line::FormatLine(ref x) => x,
+                        Line::NoFormatLine(..) => break,
                     },
                 };
 
-                if p_lines.is_empty() {
-                    // first time through the loop, get things set up
-                    // detect mail header
-                    if self.opts.mail && self.next_mail && ParagraphStream::is_mail_header(fl) {
-                        in_mail = true;
-                        // there can't be any indent or pfxind because otherwise is_mail_header
-                        // would fail since there cannot be any whitespace before the colon in a
-                        // valid header field
-                        indent_str.push_str("  ");
-                        indent_len = 2;
-                    } else {
-                        if self.opts.crown || self.opts.tagged {
-                            init_str.push_str(&fl.line[..fl.indent_end]);
-                            init_len = fl.indent_len;
-                            init_end = fl.indent_end;
-                        } else {
-                            second_done = true;
+                if p_lines.is_empty() {
+                    // first time through the loop, get things set up
+                    // detect mail header
+                    if self.opts.mail && self.next_mail && ParagraphStream::is_mail_header(fl) {
+                        in_mail = true;
+                        // there can't be any indent or pfxind because otherwise is_mail_header
+                        // would fail since there cannot be any whitespace before the colon in a
+                        // valid header field
+                        indent_str.push_str("  ");
+                        indent_len = 2;
+                    } else {
+                        if self.opts.crown || self.opts.tagged {
+                            init_str.push_str(&fl.line[..fl.indent_end]);
+                            init_len = fl.indent_len;
+                            init_end = fl.indent_end;
+                        } else {
+                            second_done = true;
                         }
 
-                        // these will be overwritten in the 2nd line of crown or tagged mode, but
-                        // we are not guaranteed to get to the 2nd line, e.g., if the next line
-                        // is a NoFormatLine or None. Thus, we set sane defaults the 1st time around
-                        indent_str.push_str(&fl.line[..fl.indent_end]);
-                        indent_len = fl.indent_len;
-                        indent_end = fl.indent_end;
+                        // these will be overwritten in the 2nd line of crown or tagged mode, but
+                        // we are not guaranteed to get to the 2nd line, e.g., if the next line
+                        // is a NoFormatLine or None. Thus, we set sane defaults the 1st time around
+                        indent_str.push_str(&fl.line[..fl.indent_end]);
+                        indent_len = fl.indent_len;
+                        indent_end = fl.indent_end;
 
-                        // save these to check for matching lines
-                        prefix_len = fl.prefix_len;
-                        pfxind_end = fl.pfxind_end;
+                        // save these to check for matching lines
+                        prefix_len = fl.prefix_len;
+                        pfxind_end = fl.pfxind_end;
 
-                        // in tagged mode, add 4 spaces of additional indenting by default
-                        // (gnu fmt's behavior is different: it seems to find the closest column to
-                        // indent_end that is divisible by 3. But honestly that behavior seems
-                        // pretty arbitrary.
-                        // Perhaps a better default would be 1 TABWIDTH? But ugh that's so big.
-                        if self.opts.tagged {
-                            indent_str.push_str("    ");
-                            indent_len += 4;
+                        // in tagged mode, add 4 spaces of additional indenting by default
+                        // (gnu fmt's behavior is different: it seems to find the closest column to
+                        // indent_end that is divisible by 3. But honestly that behavior seems
+                        // pretty arbitrary.
+                        // Perhaps a better default would be 1 TABWIDTH? But ugh that's so big.
+                        if self.opts.tagged {
+                            indent_str.push_str("    ");
+                            indent_len += 4;
                         }
                     }
-                } else if in_mail {
-                    // lines following mail headers must begin with spaces
-                    if fl.indent_end == 0 || (self.opts.use_prefix && fl.pfxind_end == 0) {
-                        break; // this line does not begin with spaces
-                    }
-                } else if !second_done {
-                    // now we have enough info to handle crown margin and tagged mode
+                } else if in_mail {
+                    // lines following mail headers must begin with spaces
+                    if fl.indent_end == 0 || (self.opts.use_prefix && fl.pfxind_end == 0) {
+                        break; // this line does not begin with spaces
+                    }
+                } else if !second_done {
+                    // now we have enough info to handle crown margin and tagged mode
 
-                    // in both crown and tagged modes we require that prefix_len is the same
-                    if prefix_len != fl.prefix_len || pfxind_end != fl.pfxind_end {
+                    // in both crown and tagged modes we require that prefix_len is the same
+                    if prefix_len != fl.prefix_len || pfxind_end != fl.pfxind_end {
                         break;
                     }
 
-                    // in tagged mode, indent has to be *different* on following lines
-                    if self.opts.tagged
-                        && indent_len - 4 == fl.indent_len
-                        && indent_end == fl.indent_end
+                    // in tagged mode, indent has to be *different* on following lines
+                    if self.opts.tagged
+                        && indent_len - 4 == fl.indent_len
+                        && indent_end == fl.indent_end
                     {
                         break;
                     }
 
-                    // this is part of the same paragraph, get the indent info from this line
-                    indent_str.clear();
-                    indent_str.push_str(&fl.line[..fl.indent_end]);
-                    indent_len = fl.indent_len;
-                    indent_end = fl.indent_end;
+                    // this is part of the same paragraph, get the indent info from this line
+                    indent_str.clear();
+                    indent_str.push_str(&fl.line[..fl.indent_end]);
+                    indent_len = fl.indent_len;
+                    indent_end = fl.indent_end;
 
-                    second_done = true;
-                } else {
-                    // detect mismatch
-                    if indent_end != fl.indent_end
-                        || pfxind_end != fl.pfxind_end
-                        || indent_len != fl.indent_len
-                        || prefix_len != fl.prefix_len
+                    second_done = true;
+                } else {
+                    // detect mismatch
+                    if indent_end != fl.indent_end
+                        || pfxind_end != fl.pfxind_end
+                        || indent_len != fl.indent_len
+                        || prefix_len != fl.prefix_len
                     {
                         break;
                     }
                 }
             }
 
-            p_lines.push(self.lines.next().unwrap().get_formatline().line);
+            p_lines.push(self.lines.next().unwrap().get_formatline().line);
 
-            // when we're in split-only mode, we never join lines, so stop here
-            if self.opts.split_only {
+            // when we're in split-only mode, we never join lines, so stop here
+            if self.opts.split_only {
                 break;
             }
         }
 
-        // if this was a mail header, then the next line can be detected as one. Otherwise, it cannot.
-        // NOTE next_mail is true at ParagraphStream instantiation, and is set to true after a blank
-        // NoFormatLine.
-        self.next_mail = in_mail;
+        // if this was a mail header, then the next line can be detected as one. Otherwise, it cannot.
+        // NOTE next_mail is true at ParagraphStream instantiation, and is set to true after a blank
+        // NoFormatLine.
+        self.next_mail = in_mail;
 
-        Some(Ok(Paragraph {
-            lines: p_lines,
-            init_str,
-            init_len,
-            init_end,
-            indent_str,
-            indent_len,
-            indent_end,
-            mail_header: in_mail,
+        Some(Ok(Paragraph {
+            lines: p_lines,
+            init_str,
+            init_len,
+            init_end,
+            indent_str,
+            indent_len,
+            indent_end,
+            mail_header: in_mail,
         }))
     }
 }
 
-pub struct ParaWords<'a> {
-    opts: &'a FmtOptions,
-    para: &'a Paragraph,
-    words: Vec<WordInfo<'a>>,
+pub struct ParaWords<'a> {
+    opts: &'a FmtOptions,
+    para: &'a Paragraph,
+    words: Vec<WordInfo<'a>>,
 }
 
-impl<'a> ParaWords<'a> {
-    pub fn new<'b>(opts: &'b FmtOptions, para: &'b Paragraph) -> ParaWords<'b> {
-        let mut pw = ParaWords {
-            opts,
-            para,
-            words: Vec::new(),
+impl<'a> ParaWords<'a> {
+    pub fn new<'b>(opts: &'b FmtOptions, para: &'b Paragraph) -> ParaWords<'b> {
+        let mut pw = ParaWords {
+            opts,
+            para,
+            words: Vec::new(),
         };
-        pw.create_words();
-        pw
+        pw.create_words();
+        pw
     }
 
-    fn create_words(&mut self) {
-        if self.para.mail_header {
-            // no extra spacing for mail headers; always exactly 1 space
-            // safe to trim_start on every line of a mail header, since the
-            // first line is guaranteed not to have any spaces
-            self.words.extend(
-                self.para
-                    .lines
-                    .iter()
-                    .flat_map(|x| x.split_whitespace())
-                    .map(|x| WordInfo {
-                        word: x,
-                        word_start: 0,
-                        word_nchars: x.len(), // OK for mail headers; only ASCII allowed (unicode is escaped)
-                        before_tab: None,
-                        after_tab: 0,
-                        sentence_start: false,
-                        ends_punct: false,
-                        new_line: false,
+    fn create_words(&mut self) {
+        if self.para.mail_header {
+            // no extra spacing for mail headers; always exactly 1 space
+            // safe to trim_start on every line of a mail header, since the
+            // first line is guaranteed not to have any spaces
+            self.words.extend(
+                self.para
+                    .lines
+                    .iter()
+                    .flat_map(|x| x.split_whitespace())
+                    .map(|x| WordInfo {
+                        word: x,
+                        word_start: 0,
+                        word_nchars: x.len(), // OK for mail headers; only ASCII allowed (unicode is escaped)
+                        before_tab: None,
+                        after_tab: 0,
+                        sentence_start: false,
+                        ends_punct: false,
+                        new_line: false,
                     }),
             );
-        } else {
-            // first line
-            self.words.extend(if self.opts.crown || self.opts.tagged {
-                // crown and tagged mode has the "init" in the first line, so slice from there
-                WordSplit::new(self.opts, &self.para.lines[0][self.para.init_end..])
-            } else {
-                // otherwise we slice from the indent
-                WordSplit::new(self.opts, &self.para.lines[0][self.para.indent_end..])
+        } else {
+            // first line
+            self.words.extend(if self.opts.crown || self.opts.tagged {
+                // crown and tagged mode has the "init" in the first line, so slice from there
+                WordSplit::new(self.opts, &self.para.lines[0][self.para.init_end..])
+            } else {
+                // otherwise we slice from the indent
+                WordSplit::new(self.opts, &self.para.lines[0][self.para.indent_end..])
             });
 
-            if self.para.lines.len() > 1 {
-                let indent_end = self.para.indent_end;
-                let opts = self.opts;
-                self.words.extend(
-                    self.para
-                        .lines
-                        .iter()
-                        .skip(1)
-                        .flat_map(|x| WordSplit::new(opts, &x[indent_end..])),
+            if self.para.lines.len() > 1 {
+                let indent_end = self.para.indent_end;
+                let opts = self.opts;
+                self.words.extend(
+                    self.para
+                        .lines
+                        .iter()
+                        .skip(1)
+                        .flat_map(|x| WordSplit::new(opts, &x[indent_end..])),
                 );
             }
         }
     }
 
-    pub fn words(&'a self) -> Iter<'a, WordInfo<'a>> {
-        self.words.iter()
+    pub fn words(&'a self) -> Iter<'a, WordInfo<'a>> {
+        self.words.iter()
     }
 }
 
-struct WordSplit<'a> {
-    opts: &'a FmtOptions,
-    string: &'a str,
-    length: usize,
-    position: usize,
-    prev_punct: bool,
+struct WordSplit<'a> {
+    opts: &'a FmtOptions,
+    string: &'a str,
+    length: usize,
+    position: usize,
+    prev_punct: bool,
 }
 
-impl<'a> WordSplit<'a> {
-    fn analyze_tabs(&self, string: &str) -> (Option<usize>, usize, Option<usize>) {
-        // given a string, determine (length before tab) and (printed length after first tab)
-        // if there are no tabs, beforetab = -1 and aftertab is the printed length
-        let mut beforetab = None;
-        let mut aftertab = 0;
-        let mut word_start = None;
-        for (os, c) in string.char_indices() {
-            if !c.is_whitespace() {
-                word_start = Some(os);
+impl<'a> WordSplit<'a> {
+    fn analyze_tabs(&self, string: &str) -> (Option<usize>, usize, Option<usize>) {
+        // given a string, determine (length before tab) and (printed length after first tab)
+        // if there are no tabs, beforetab = -1 and aftertab is the printed length
+        let mut beforetab = None;
+        let mut aftertab = 0;
+        let mut word_start = None;
+        for (os, c) in string.char_indices() {
+            if !c.is_whitespace() {
+                word_start = Some(os);
                 break;
-            } else if c == '\t' {
-                if beforetab.is_none() {
-                    beforetab = Some(aftertab);
-                    aftertab = 0;
-                } else {
-                    aftertab = (aftertab / self.opts.tabwidth + 1) * self.opts.tabwidth;
+            } else if c == '\t' {
+                if beforetab.is_none() {
+                    beforetab = Some(aftertab);
+                    aftertab = 0;
+                } else {
+                    aftertab = (aftertab / self.opts.tabwidth + 1) * self.opts.tabwidth;
                 }
-            } else {
-                aftertab += 1;
+            } else {
+                aftertab += 1;
             }
         }
-        (beforetab, aftertab, word_start)
+        (beforetab, aftertab, word_start)
     }
 }
 
-impl<'a> WordSplit<'a> {
-    fn new<'b>(opts: &'b FmtOptions, string: &'b str) -> WordSplit<'b> {
-        // wordsplits *must* start at a non-whitespace character
-        let trim_string = string.trim_start();
-        WordSplit {
-            opts,
-            string: trim_string,
-            length: string.len(),
-            position: 0,
-            prev_punct: false,
+impl<'a> WordSplit<'a> {
+    fn new<'b>(opts: &'b FmtOptions, string: &'b str) -> WordSplit<'b> {
+        // wordsplits *must* start at a non-whitespace character
+        let trim_string = string.trim_start();
+        WordSplit {
+            opts,
+            string: trim_string,
+            length: string.len(),
+            position: 0,
+            prev_punct: false,
         }
     }
 
-    fn is_punctuation(c: char) -> bool {
-        matches!(c, '!' | '.' | '?')
+    fn is_punctuation(c: char) -> bool {
+        matches!(c, '!' | '.' | '?')
     }
 }
 
-pub struct WordInfo<'a> {
-    pub word: &'a str,
-    pub word_start: usize,
-    pub word_nchars: usize,
-    pub before_tab: Option<usize>,
-    pub after_tab: usize,
-    pub sentence_start: bool,
-    pub ends_punct: bool,
-    pub new_line: bool,
+pub struct WordInfo<'a> {
+    pub word: &'a str,
+    pub word_start: usize,
+    pub word_nchars: usize,
+    pub before_tab: Option<usize>,
+    pub after_tab: usize,
+    pub sentence_start: bool,
+    pub ends_punct: bool,
+    pub new_line: bool,
 }
 
-// returns (&str, is_start_of_sentence)
-impl<'a> Iterator for WordSplit<'a> {
-    type Item = WordInfo<'a>;
+// returns (&str, is_start_of_sentence)
+impl<'a> Iterator for WordSplit<'a> {
+    type Item = WordInfo<'a>;
 
-    fn next(&mut self) -> Option<WordInfo<'a>> {
-        if self.position >= self.length {
-            return None;
+    fn next(&mut self) -> Option<WordInfo<'a>> {
+        if self.position >= self.length {
+            return None;
         }
 
-        let old_position = self.position;
-        let new_line = old_position == 0;
+        let old_position = self.position;
+        let new_line = old_position == 0;
 
-        // find the start of the next word, and record if we find a tab character
-        let (before_tab, after_tab, word_start) =
-            match self.analyze_tabs(&self.string[old_position..]) {
-                (b, a, Some(s)) => (b, a, s + old_position),
+        // find the start of the next word, and record if we find a tab character
+        let (before_tab, after_tab, word_start) =
+            match self.analyze_tabs(&self.string[old_position..]) {
+                (b, a, Some(s)) => (b, a, s + old_position),
                 (_, _, None) => {
-                    self.position = self.length;
-                    return None;
+                    self.position = self.length;
+                    return None;
                 }
             };
 
-        // find the beginning of the next whitespace
-        // note that this preserves the invariant that self.position
-        // points to whitespace character OR end of string
-        let mut word_nchars = 0;
-        self.position = match self.string[word_start..].find(|x: char| {
-            if !x.is_whitespace() {
-                word_nchars += char_width(x);
-                false
-            } else {
-                true
-            }
+        // find the beginning of the next whitespace
+        // note that this preserves the invariant that self.position
+        // points to whitespace character OR end of string
+        let mut word_nchars = 0;
+        self.position = match self.string[word_start..].find(|x: char| {
+            if !x.is_whitespace() {
+                word_nchars += char_width(x);
+                false
+            } else {
+                true
+            }
         }) {
-            None => self.length,
-            Some(s) => s + word_start,
+            None => self.length,
+            Some(s) => s + word_start,
         };
 
-        let word_start_relative = word_start - old_position;
-        // if the previous sentence was punctuation and this sentence has >2 whitespace or one tab, is a new sentence.
-        let is_start_of_sentence =
-            self.prev_punct && (before_tab.is_some() || word_start_relative > 1);
+        let word_start_relative = word_start - old_position;
+        // if the previous sentence was punctuation and this sentence has >2 whitespace or one tab, is a new sentence.
+        let is_start_of_sentence =
+            self.prev_punct && (before_tab.is_some() || word_start_relative > 1);
 
-        // now record whether this word ends in punctuation
-        self.prev_punct = match self.string[..self.position].chars().rev().next() {
-            Some(ch) => WordSplit::is_punctuation(ch),
-            _ => panic!("fatal: expected word not to be empty"),
+        // now record whether this word ends in punctuation
+        self.prev_punct = match self.string[..self.position].chars().rev().next() {
+            Some(ch) => WordSplit::is_punctuation(ch),
+            _ => panic!("fatal: expected word not to be empty"),
         };
 
-        let (word, word_start_relative, before_tab, after_tab) = if self.opts.uniform {
-            (&self.string[word_start..self.position], 0, None, 0)
-        } else {
+        let (word, word_start_relative, before_tab, after_tab) = if self.opts.uniform {
+            (&self.string[word_start..self.position], 0, None, 0)
+        } else {
             (
-                &self.string[old_position..self.position],
-                word_start_relative,
-                before_tab,
-                after_tab,
+                &self.string[old_position..self.position],
+                word_start_relative,
+                before_tab,
+                after_tab,
             )
         };
 
-        Some(WordInfo {
-            word,
-            word_start: word_start_relative,
-            word_nchars,
-            before_tab,
-            after_tab,
-            sentence_start: is_start_of_sentence,
-            ends_punct: self.prev_punct,
-            new_line,
+        Some(WordInfo {
+            word,
+            word_start: word_start_relative,
+            word_nchars,
+            before_tab,
+            after_tab,
+            sentence_start: is_start_of_sentence,
+            ends_punct: self.prev_punct,
+            new_line,
         })
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_fold/fold.rs.html b/dev/src/uu_fold/fold.rs.html index d486f8f47..5b43ee727 100644 --- a/dev/src/uu_fold/fold.rs.html +++ b/dev/src/uu_fold/fold.rs.html @@ -1,4 +1,4 @@ -fold.rs - source
1
+fold.rs - source
1
 2
 3
 4
@@ -298,305 +298,305 @@
 298
 299
 300
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDOs) ncount routput
+// spell-checker:ignore (ToDOs) ncount routput
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fs::File;
-use std::io::{stdin, BufRead, BufReader, Read};
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fs::File;
+use std::io::{stdin, BufRead, BufReader, Read};
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError};
+use uucore::format_usage;
 
-const TAB_WIDTH: usize = 8;
+const TAB_WIDTH: usize = 8;
 
-static NAME: &str = "fold";
-static USAGE: &str = "{} [OPTION]... [FILE]...";
-static ABOUT: &str = "Writes each file (or standard input if no files are given)
+static NAME: &str = "fold";
+static USAGE: &str = "{} [OPTION]... [FILE]...";
+static ABOUT: &str = "Writes each file (or standard input if no files are given)
  to standard output whilst breaking long lines";
 
-mod options {
-    pub const BYTES: &str = "bytes";
-    pub const SPACES: &str = "spaces";
-    pub const WIDTH: &str = "width";
-    pub const FILE: &str = "file";
+mod options {
+    pub const BYTES: &str = "bytes";
+    pub const SPACES: &str = "spaces";
+    pub const WIDTH: &str = "width";
+    pub const FILE: &str = "file";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let (args, obs_width) = handle_obsolete(&args[..]);
-    let matches = uu_app().try_get_matches_from(args)?;
+    let (args, obs_width) = handle_obsolete(&args[..]);
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let bytes = matches.get_flag(options::BYTES);
-    let spaces = matches.get_flag(options::SPACES);
-    let poss_width = match matches.get_one::<String>(options::WIDTH) {
-        Some(v) => Some(v.to_owned()),
-        None => obs_width,
+    let bytes = matches.get_flag(options::BYTES);
+    let spaces = matches.get_flag(options::SPACES);
+    let poss_width = match matches.get_one::<String>(options::WIDTH) {
+        Some(v) => Some(v.to_owned()),
+        None => obs_width,
     };
 
-    let width = match poss_width {
-        Some(inp_width) => inp_width.parse::<usize>().map_err(|e| {
-            USimpleError::new(
+    let width = match poss_width {
+        Some(inp_width) => inp_width.parse::<usize>().map_err(|e| {
+            USimpleError::new(
                 1,
-                format!("illegal width value ({}): {}", inp_width.quote(), e),
+                format!("illegal width value ({}): {}", inp_width.quote(), e),
             )
         })?,
-        None => 80,
+        None => 80,
     };
 
-    let files = match matches.get_many::<String>(options::FILE) {
-        Some(v) => v.map(|v| v.to_owned()).collect(),
-        None => vec!["-".to_owned()],
+    let files = match matches.get_many::<String>(options::FILE) {
+        Some(v) => v.map(|v| v.to_owned()).collect(),
+        None => vec!["-".to_owned()],
     };
 
-    fold(&files, bytes, spaces, width)
+    fold(&files, bytes, spaces, width)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::BYTES)
-                .long(options::BYTES)
-                .short('b')
-                .help(
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::BYTES)
+                .long(options::BYTES)
+                .short('b')
+                .help(
                     "count using bytes rather than columns (meaning control characters \
                      such as newline are not treated specially)",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SPACES)
-                .long(options::SPACES)
-                .short('s')
-                .help("break lines at word boundaries rather than a hard cut-off")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SPACES)
+                .long(options::SPACES)
+                .short('s')
+                .help("break lines at word boundaries rather than a hard cut-off")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::WIDTH)
-                .long(options::WIDTH)
-                .short('w')
-                .help("set WIDTH as the maximum line width rather than 80")
-                .value_name("WIDTH")
-                .allow_hyphen_values(true),
+        .arg(
+            Arg::new(options::WIDTH)
+                .long(options::WIDTH)
+                .short('w')
+                .help("set WIDTH as the maximum line width rather than 80")
+                .value_name("WIDTH")
+                .allow_hyphen_values(true),
         )
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) {
-    for (i, arg) in args.iter().enumerate() {
-        let slice = &arg;
-        if slice.starts_with('-') && slice.chars().nth(1).map_or(false, |c| c.is_ascii_digit()) {
-            let mut v = args.to_vec();
-            v.remove(i);
-            return (v, Some(slice[1..].to_owned()));
+fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) {
+    for (i, arg) in args.iter().enumerate() {
+        let slice = &arg;
+        if slice.starts_with('-') && slice.chars().nth(1).map_or(false, |c| c.is_ascii_digit()) {
+            let mut v = args.to_vec();
+            v.remove(i);
+            return (v, Some(slice[1..].to_owned()));
         }
     }
-    (args.to_vec(), None)
+    (args.to_vec(), None)
 }
 
-fn fold(filenames: &[String], bytes: bool, spaces: bool, width: usize) -> UResult<()> {
-    for filename in filenames {
-        let filename: &str = filename;
-        let mut stdin_buf;
-        let mut file_buf;
-        let buffer = BufReader::new(if filename == "-" {
-            stdin_buf = stdin();
-            &mut stdin_buf as &mut dyn Read
-        } else {
-            file_buf = File::open(Path::new(filename)).map_err_context(|| filename.to_string())?;
-            &mut file_buf as &mut dyn Read
+fn fold(filenames: &[String], bytes: bool, spaces: bool, width: usize) -> UResult<()> {
+    for filename in filenames {
+        let filename: &str = filename;
+        let mut stdin_buf;
+        let mut file_buf;
+        let buffer = BufReader::new(if filename == "-" {
+            stdin_buf = stdin();
+            &mut stdin_buf as &mut dyn Read
+        } else {
+            file_buf = File::open(Path::new(filename)).map_err_context(|| filename.to_string())?;
+            &mut file_buf as &mut dyn Read
         });
 
-        if bytes {
-            fold_file_bytewise(buffer, spaces, width)?;
-        } else {
-            fold_file(buffer, spaces, width)?;
+        if bytes {
+            fold_file_bytewise(buffer, spaces, width)?;
+        } else {
+            fold_file(buffer, spaces, width)?;
         }
     }
     Ok(())
 }
 
-/// Fold `file` to fit `width` (number of columns), counting all characters as
-/// one column.
-///
-/// This function handles folding for the `-b`/`--bytes` option, counting
-/// tab, backspace, and carriage return as occupying one column, identically
-/// to all other characters in the stream.
-///
-///  If `spaces` is `true`, attempt to break lines at whitespace boundaries.
-fn fold_file_bytewise<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) -> UResult<()> {
-    let mut line = String::new();
+/// Fold `file` to fit `width` (number of columns), counting all characters as
+/// one column.
+///
+/// This function handles folding for the `-b`/`--bytes` option, counting
+/// tab, backspace, and carriage return as occupying one column, identically
+/// to all other characters in the stream.
+///
+///  If `spaces` is `true`, attempt to break lines at whitespace boundaries.
+fn fold_file_bytewise<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) -> UResult<()> {
+    let mut line = String::new();
 
-    loop {
-        if file
-            .read_line(&mut line)
-            .map_err_context(|| "failed to read line".to_string())?
-            == 0
-        {
+    loop {
+        if file
+            .read_line(&mut line)
+            .map_err_context(|| "failed to read line".to_string())?
+            == 0
+        {
             break;
         }
 
-        if line == "\n" {
+        if line == "\n" {
             println!();
-            line.truncate(0);
+            line.truncate(0);
             continue;
         }
 
-        let len = line.len();
-        let mut i = 0;
+        let len = line.len();
+        let mut i = 0;
 
-        while i < len {
-            let width = if len - i >= width { width } else { len - i };
-            let slice = {
-                let slice = &line[i..i + width];
-                if spaces && i + width < len {
-                    match slice.rfind(|c: char| c.is_whitespace() && c != '\r') {
-                        Some(m) => &slice[..=m],
-                        None => slice,
+        while i < len {
+            let width = if len - i >= width { width } else { len - i };
+            let slice = {
+                let slice = &line[i..i + width];
+                if spaces && i + width < len {
+                    match slice.rfind(|c: char| c.is_whitespace() && c != '\r') {
+                        Some(m) => &slice[..=m],
+                        None => slice,
                     }
-                } else {
-                    slice
+                } else {
+                    slice
                 }
             };
 
-            // Don't duplicate trailing newlines: if the slice is "\n", the
-            // previous iteration folded just before the end of the line and
-            // has already printed this newline.
-            if slice == "\n" {
+            // Don't duplicate trailing newlines: if the slice is "\n", the
+            // previous iteration folded just before the end of the line and
+            // has already printed this newline.
+            if slice == "\n" {
                 break;
             }
 
-            i += slice.len();
+            i += slice.len();
 
-            let at_eol = i >= len;
+            let at_eol = i >= len;
 
-            if at_eol {
-                print!("{}", slice);
-            } else {
-                println!("{}", slice);
+            if at_eol {
+                print!("{}", slice);
+            } else {
+                println!("{}", slice);
             }
         }
 
-        line.truncate(0);
+        line.truncate(0);
     }
 
     Ok(())
 }
 
-/// Fold `file` to fit `width` (number of columns).
-///
-/// By default `fold` treats tab, backspace, and carriage return specially:
-/// tab characters count as 8 columns, backspace decreases the
-/// column count, and carriage return resets the column count to 0.
-///
-/// If `spaces` is `true`, attempt to break lines at whitespace boundaries.
-#[allow(unused_assignments)]
-fn fold_file<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) -> UResult<()> {
-    let mut line = String::new();
-    let mut output = String::new();
-    let mut col_count = 0;
-    let mut last_space = None;
+/// Fold `file` to fit `width` (number of columns).
+///
+/// By default `fold` treats tab, backspace, and carriage return specially:
+/// tab characters count as 8 columns, backspace decreases the
+/// column count, and carriage return resets the column count to 0.
+///
+/// If `spaces` is `true`, attempt to break lines at whitespace boundaries.
+#[allow(unused_assignments)]
+fn fold_file<T: Read>(mut file: BufReader<T>, spaces: bool, width: usize) -> UResult<()> {
+    let mut line = String::new();
+    let mut output = String::new();
+    let mut col_count = 0;
+    let mut last_space = None;
 
-    /// Print the output line, resetting the column and character counts.
-    ///
-    /// If `spaces` is `true`, print the output line up to the last
-    /// encountered whitespace character (inclusive) and set the remaining
-    /// characters as the start of the next line.
-    macro_rules! emit_output {
+    /// Print the output line, resetting the column and character counts.
+    ///
+    /// If `spaces` is `true`, print the output line up to the last
+    /// encountered whitespace character (inclusive) and set the remaining
+    /// characters as the start of the next line.
+    macro_rules! emit_output {
         () => {
-            let consume = match last_space {
-                Some(i) => i + 1,
-                None => output.len(),
+            let consume = match last_space {
+                Some(i) => i + 1,
+                None => output.len(),
             };
 
-            println!("{}", &output[..consume]);
-            output.replace_range(..consume, "");
+            println!("{}", &output[..consume]);
+            output.replace_range(..consume, "");
 
-            // we know there are no tabs left in output, so each char counts
-            // as 1 column
-            col_count = output.len();
+            // we know there are no tabs left in output, so each char counts
+            // as 1 column
+            col_count = output.len();
 
-            last_space = None;
+            last_space = None;
         };
     }
 
-    loop {
-        if file
-            .read_line(&mut line)
-            .map_err_context(|| "failed to read line".to_string())?
-            == 0
-        {
+    loop {
+        if file
+            .read_line(&mut line)
+            .map_err_context(|| "failed to read line".to_string())?
+            == 0
+        {
             break;
         }
 
-        for ch in line.chars() {
-            if ch == '\n' {
-                // make sure to _not_ split output at whitespace, since we
-                // know the entire output will fit
-                last_space = None;
+        for ch in line.chars() {
+            if ch == '\n' {
+                // make sure to _not_ split output at whitespace, since we
+                // know the entire output will fit
+                last_space = None;
                 emit_output!();
                 break;
             }
 
-            if col_count >= width {
+            if col_count >= width {
                 emit_output!();
             }
 
-            match ch {
-                '\r' => col_count = 0,
-                '\t' => {
-                    let next_tab_stop = col_count + TAB_WIDTH - col_count % TAB_WIDTH;
+            match ch {
+                '\r' => col_count = 0,
+                '\t' => {
+                    let next_tab_stop = col_count + TAB_WIDTH - col_count % TAB_WIDTH;
 
-                    if next_tab_stop > width && !output.is_empty() {
+                    if next_tab_stop > width && !output.is_empty() {
                         emit_output!();
                     }
 
-                    col_count = next_tab_stop;
-                    last_space = if spaces { Some(output.len()) } else { None };
+                    col_count = next_tab_stop;
+                    last_space = if spaces { Some(output.len()) } else { None };
                 }
-                '\x08' => {
-                    if col_count > 0 {
-                        col_count -= 1;
+                '\x08' => {
+                    if col_count > 0 {
+                        col_count -= 1;
                     }
                 }
-                _ if spaces && ch.is_whitespace() => {
-                    last_space = Some(output.len());
-                    col_count += 1;
+                _ if spaces && ch.is_whitespace() => {
+                    last_space = Some(output.len());
+                    col_count += 1;
                 }
-                _ => col_count += 1,
+                _ => col_count += 1,
             };
 
-            output.push(ch);
+            output.push(ch);
         }
 
-        if !output.is_empty() {
-            print!("{}", output);
-            output.truncate(0);
+        if !output.is_empty() {
+            print!("{}", output);
+            output.truncate(0);
         }
 
-        line.truncate(0);
+        line.truncate(0);
     }
 
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_groups/groups.rs.html b/dev/src/uu_groups/groups.rs.html index 951def53d..d5d6beba2 100644 --- a/dev/src/uu_groups/groups.rs.html +++ b/dev/src/uu_groups/groups.rs.html @@ -1,4 +1,4 @@ -groups.rs - source
1
+groups.rs - source
1
 2
 3
 4
@@ -115,122 +115,122 @@
 115
 116
 117
-
// This file is part of the uutils coreutils package.
-//
-// (c) Alan Andrade <alan.andradec@gmail.com>
-// (c) Jian Zeng <anonymousknight96 AT gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
-//
-// ============================================================================
-// Test suite summary for GNU coreutils 8.32.162-4eda
-// ============================================================================
-// PASS: tests/misc/groups-dash.sh
-// PASS: tests/misc/groups-process-all.sh
-// PASS: tests/misc/groups-version.sh
+
// This file is part of the uutils coreutils package.
+//
+// (c) Alan Andrade <alan.andradec@gmail.com>
+// (c) Jian Zeng <anonymousknight96 AT gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
+//
+// ============================================================================
+// Test suite summary for GNU coreutils 8.32.162-4eda
+// ============================================================================
+// PASS: tests/misc/groups-dash.sh
+// PASS: tests/misc/groups-process-all.sh
+// PASS: tests/misc/groups-version.sh
 
-// spell-checker:ignore (ToDO) passwd
+// spell-checker:ignore (ToDO) passwd
 
-#[macro_use]
-extern crate uucore;
-use std::error::Error;
-use std::fmt::Display;
-use uucore::{
-    display::Quotable,
-    entries::{get_groups_gnu, gid2grp, Locate, Passwd},
-    error::{UError, UResult},
-    format_usage,
+#[macro_use]
+extern crate uucore;
+use std::error::Error;
+use std::fmt::Display;
+use uucore::{
+    display::Quotable,
+    entries::{get_groups_gnu, gid2grp, Locate, Passwd},
+    error::{UError, UResult},
+    format_usage,
 };
 
-use clap::{crate_version, Arg, ArgAction, Command};
+use clap::{crate_version, Arg, ArgAction, Command};
 
-mod options {
-    pub const USERS: &str = "USERNAME";
+mod options {
+    pub const USERS: &str = "USERNAME";
 }
-static ABOUT: &str = "Print group memberships for each USERNAME or, \
+static ABOUT: &str = "Print group memberships for each USERNAME or, \
                       if no USERNAME is specified, for\nthe current process \
                       (which may differ if the groups data‐base has changed).";
 
-const USAGE: &str = "{} [OPTION]... [USERNAME]...";
+const USAGE: &str = "{} [OPTION]... [USERNAME]...";
 
-#[derive(Debug)]
-enum GroupsError {
-    GetGroupsFailed,
-    GroupNotFound(u32),
-    UserNotFound(String),
+#[derive(Debug)]
+enum GroupsError {
+    GetGroupsFailed,
+    GroupNotFound(u32),
+    UserNotFound(String),
 }
 
-impl Error for GroupsError {}
-impl UError for GroupsError {}
+impl Error for GroupsError {}
+impl UError for GroupsError {}
 
-impl Display for GroupsError {
-    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
-        match self {
-            Self::GetGroupsFailed => write!(f, "failed to fetch groups"),
-            Self::GroupNotFound(gid) => write!(f, "cannot find name for group ID {}", gid),
-            Self::UserNotFound(user) => write!(f, "{}: no such user", user.quote()),
+impl Display for GroupsError {
+    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+        match self {
+            Self::GetGroupsFailed => write!(f, "failed to fetch groups"),
+            Self::GroupNotFound(gid) => write!(f, "cannot find name for group ID {}", gid),
+            Self::UserNotFound(user) => write!(f, "{}: no such user", user.quote()),
         }
     }
 }
 
-fn infallible_gid2grp(gid: &u32) -> String {
-    match gid2grp(*gid) {
-        Ok(grp) => grp,
+fn infallible_gid2grp(gid: &u32) -> String {
+    match gid2grp(*gid) {
+        Ok(grp) => grp,
         Err(_) => {
-            // The `show!()` macro sets the global exit code for the program.
-            show!(GroupsError::GroupNotFound(*gid));
-            gid.to_string()
+            // The `show!()` macro sets the global exit code for the program.
+            show!(GroupsError::GroupNotFound(*gid));
+            gid.to_string()
         }
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let users: Vec<String> = matches
-        .get_many::<String>(options::USERS)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let users: Vec<String> = matches
+        .get_many::<String>(options::USERS)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    if users.is_empty() {
-        let gids = match get_groups_gnu(None) {
-            Ok(v) => v,
-            Err(_) => return Err(GroupsError::GetGroupsFailed.into()),
+    if users.is_empty() {
+        let gids = match get_groups_gnu(None) {
+            Ok(v) => v,
+            Err(_) => return Err(GroupsError::GetGroupsFailed.into()),
         };
-        let groups: Vec<String> = gids.iter().map(infallible_gid2grp).collect();
-        println!("{}", groups.join(" "));
-        return Ok(());
+        let groups: Vec<String> = gids.iter().map(infallible_gid2grp).collect();
+        println!("{}", groups.join(" "));
+        return Ok(());
     }
 
-    for user in users {
-        match Passwd::locate(user.as_str()) {
-            Ok(p) => {
-                let groups: Vec<String> = p.belongs_to().iter().map(infallible_gid2grp).collect();
-                println!("{} : {}", user, groups.join(" "));
+    for user in users {
+        match Passwd::locate(user.as_str()) {
+            Ok(p) => {
+                let groups: Vec<String> = p.belongs_to().iter().map(infallible_gid2grp).collect();
+                println!("{} : {}", user, groups.join(" "));
             }
             Err(_) => {
-                // The `show!()` macro sets the global exit code for the program.
-                show!(GroupsError::UserNotFound(user));
+                // The `show!()` macro sets the global exit code for the program.
+                show!(GroupsError::UserNotFound(user));
             }
         }
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::USERS)
-                .action(ArgAction::Append)
-                .value_name(options::USERS)
-                .value_hint(clap::ValueHint::Username),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::USERS)
+                .action(ArgAction::Append)
+                .value_name(options::USERS)
+                .value_hint(clap::ValueHint::Username),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_hashsum/digest.rs.html b/dev/src/uu_hashsum/digest.rs.html index 9e57fa216..5b3987a26 100644 --- a/dev/src/uu_hashsum/digest.rs.html +++ b/dev/src/uu_hashsum/digest.rs.html @@ -1,4 +1,4 @@ -digest.rs - source
1
+digest.rs - source
1
 2
 3
 4
@@ -291,298 +291,298 @@
 291
 292
 293
-
// spell-checker:ignore memmem
-//! Implementations of digest functions, like md5 and sha1.
-//!
-//! The [`Digest`] trait represents the interface for providing inputs
-//! to these digest functions and accessing the resulting hash. The
-//! [`DigestWriter`] struct provides a wrapper around [`Digest`] that
-//! implements the [`Write`] trait, for use in situations where calling
-//! [`write`] would be useful.
-extern crate digest;
-extern crate md5;
-extern crate sha1;
-extern crate sha2;
-extern crate sha3;
+
// spell-checker:ignore memmem
+//! Implementations of digest functions, like md5 and sha1.
+//!
+//! The [`Digest`] trait represents the interface for providing inputs
+//! to these digest functions and accessing the resulting hash. The
+//! [`DigestWriter`] struct provides a wrapper around [`Digest`] that
+//! implements the [`Write`] trait, for use in situations where calling
+//! [`write`] would be useful.
+extern crate digest;
+extern crate md5;
+extern crate sha1;
+extern crate sha2;
+extern crate sha3;
 
-use std::io::Write;
+use std::io::Write;
 
-use hex::encode;
-#[cfg(windows)]
-use memchr::memmem;
+use hex::encode;
+#[cfg(windows)]
+use memchr::memmem;
 
-pub trait Digest {
-    fn new() -> Self
-    where
-        Self: Sized;
-    fn input(&mut self, input: &[u8]);
-    fn result(&mut self, out: &mut [u8]);
-    fn reset(&mut self);
-    fn output_bits(&self) -> usize;
-    fn output_bytes(&self) -> usize {
-        (self.output_bits() + 7) / 8
-    }
-    fn result_str(&mut self) -> String {
-        let mut buf: Vec<u8> = vec![0; self.output_bytes()];
-        self.result(&mut buf);
-        encode(buf)
+pub trait Digest {
+    fn new() -> Self
+    where
+        Self: Sized;
+    fn input(&mut self, input: &[u8]);
+    fn result(&mut self, out: &mut [u8]);
+    fn reset(&mut self);
+    fn output_bits(&self) -> usize;
+    fn output_bytes(&self) -> usize {
+        (self.output_bits() + 7) / 8
+    }
+    fn result_str(&mut self) -> String {
+        let mut buf: Vec<u8> = vec![0; self.output_bytes()];
+        self.result(&mut buf);
+        encode(buf)
     }
 }
 
-impl Digest for blake2b_simd::State {
-    fn new() -> Self {
-        Self::new()
+impl Digest for blake2b_simd::State {
+    fn new() -> Self {
+        Self::new()
     }
 
-    fn input(&mut self, input: &[u8]) {
-        self.update(input);
+    fn input(&mut self, input: &[u8]) {
+        self.update(input);
     }
 
-    fn result(&mut self, out: &mut [u8]) {
-        let hash_result = &self.finalize();
-        out.copy_from_slice(hash_result.as_bytes());
+    fn result(&mut self, out: &mut [u8]) {
+        let hash_result = &self.finalize();
+        out.copy_from_slice(hash_result.as_bytes());
     }
 
-    fn reset(&mut self) {
-        *self = Self::new();
+    fn reset(&mut self) {
+        *self = Self::new();
     }
 
-    fn output_bits(&self) -> usize {
-        512
-    }
+    fn output_bits(&self) -> usize {
+        512
+    }
 }
 
-impl Digest for blake3::Hasher {
-    fn new() -> Self {
-        Self::new()
+impl Digest for blake3::Hasher {
+    fn new() -> Self {
+        Self::new()
     }
 
-    fn input(&mut self, input: &[u8]) {
-        self.update(input);
+    fn input(&mut self, input: &[u8]) {
+        self.update(input);
     }
 
-    fn result(&mut self, out: &mut [u8]) {
-        let hash_result = &self.finalize();
-        out.copy_from_slice(hash_result.as_bytes());
+    fn result(&mut self, out: &mut [u8]) {
+        let hash_result = &self.finalize();
+        out.copy_from_slice(hash_result.as_bytes());
     }
 
-    fn reset(&mut self) {
-        *self = Self::new();
+    fn reset(&mut self) {
+        *self = Self::new();
     }
 
-    fn output_bits(&self) -> usize {
-        256
-    }
+    fn output_bits(&self) -> usize {
+        256
+    }
 }
 
-// Implements the Digest trait for sha2 / sha3 algorithms with fixed output
-macro_rules! impl_digest_common {
-    ($type: ty, $size: expr) => {
-        impl Digest for $type {
-            fn new() -> Self {
-                Self::default()
+// Implements the Digest trait for sha2 / sha3 algorithms with fixed output
+macro_rules! impl_digest_common {
+    ($type: ty, $size: expr) => {
+        impl Digest for $type {
+            fn new() -> Self {
+                Self::default()
             }
 
-            fn input(&mut self, input: &[u8]) {
-                digest::Digest::update(self, input);
+            fn input(&mut self, input: &[u8]) {
+                digest::Digest::update(self, input);
             }
 
-            fn result(&mut self, out: &mut [u8]) {
-                digest::Digest::finalize_into_reset(self, out.into());
+            fn result(&mut self, out: &mut [u8]) {
+                digest::Digest::finalize_into_reset(self, out.into());
             }
 
-            fn reset(&mut self) {
-                *self = Self::new();
+            fn reset(&mut self) {
+                *self = Self::new();
             }
 
-            fn output_bits(&self) -> usize {
-                $size
-            }
+            fn output_bits(&self) -> usize {
+                $size
+            }
         }
     };
 }
 
-// Implements the Digest trait for sha2 / sha3 algorithms with variable output
-macro_rules! impl_digest_shake {
+// Implements the Digest trait for sha2 / sha3 algorithms with variable output
+macro_rules! impl_digest_shake {
     ($type: ty) => {
-        impl Digest for $type {
-            fn new() -> Self {
-                Self::default()
+        impl Digest for $type {
+            fn new() -> Self {
+                Self::default()
             }
 
-            fn input(&mut self, input: &[u8]) {
-                digest::Update::update(self, input);
+            fn input(&mut self, input: &[u8]) {
+                digest::Update::update(self, input);
             }
 
-            fn result(&mut self, out: &mut [u8]) {
-                digest::ExtendableOutputReset::finalize_xof_reset_into(self, out);
+            fn result(&mut self, out: &mut [u8]) {
+                digest::ExtendableOutputReset::finalize_xof_reset_into(self, out);
             }
 
-            fn reset(&mut self) {
-                *self = Self::new();
+            fn reset(&mut self) {
+                *self = Self::new();
             }
 
-            fn output_bits(&self) -> usize {
-                0
-            }
+            fn output_bits(&self) -> usize {
+                0
+            }
         }
     };
 }
 
-impl_digest_common!(md5::Md5, 128);
-impl_digest_common!(sha1::Sha1, 160);
-impl_digest_common!(sha2::Sha224, 224);
-impl_digest_common!(sha2::Sha256, 256);
-impl_digest_common!(sha2::Sha384, 384);
-impl_digest_common!(sha2::Sha512, 512);
+impl_digest_common!(md5::Md5, 128);
+impl_digest_common!(sha1::Sha1, 160);
+impl_digest_common!(sha2::Sha224, 224);
+impl_digest_common!(sha2::Sha256, 256);
+impl_digest_common!(sha2::Sha384, 384);
+impl_digest_common!(sha2::Sha512, 512);
 
-impl_digest_common!(sha3::Sha3_224, 224);
-impl_digest_common!(sha3::Sha3_256, 256);
-impl_digest_common!(sha3::Sha3_384, 384);
-impl_digest_common!(sha3::Sha3_512, 512);
-impl_digest_shake!(sha3::Shake128);
-impl_digest_shake!(sha3::Shake256);
+impl_digest_common!(sha3::Sha3_224, 224);
+impl_digest_common!(sha3::Sha3_256, 256);
+impl_digest_common!(sha3::Sha3_384, 384);
+impl_digest_common!(sha3::Sha3_512, 512);
+impl_digest_shake!(sha3::Shake128);
+impl_digest_shake!(sha3::Shake256);
 
-/// A struct that writes to a digest.
-///
-/// This struct wraps a [`Digest`] and provides a [`Write`]
-/// implementation that passes input bytes directly to the
-/// [`Digest::input`].
-///
-/// On Windows, if `binary` is `false`, then the [`write`]
-/// implementation replaces instances of "\r\n" with "\n" before passing
-/// the input bytes to the [`digest`].
-pub struct DigestWriter<'a> {
-    digest: &'a mut Box<dyn Digest>,
+/// A struct that writes to a digest.
+///
+/// This struct wraps a [`Digest`] and provides a [`Write`]
+/// implementation that passes input bytes directly to the
+/// [`Digest::input`].
+///
+/// On Windows, if `binary` is `false`, then the [`write`]
+/// implementation replaces instances of "\r\n" with "\n" before passing
+/// the input bytes to the [`digest`].
+pub struct DigestWriter<'a> {
+    digest: &'a mut Box<dyn Digest>,
 
-    /// Whether to write to the digest in binary mode or text mode on Windows.
-    ///
-    /// If this is `false`, then instances of "\r\n" are replaced with
-    /// "\n" before passing input bytes to the [`digest`].
-    #[allow(dead_code)]
-    binary: bool,
+    /// Whether to write to the digest in binary mode or text mode on Windows.
+    ///
+    /// If this is `false`, then instances of "\r\n" are replaced with
+    /// "\n" before passing input bytes to the [`digest`].
+    #[allow(dead_code)]
+    binary: bool,
 
-    /// Whether the previous
-    #[allow(dead_code)]
-    was_last_character_carriage_return: bool,
-    // TODO These are dead code only on non-Windows operating systems.
-    // It might be better to use a `#[cfg(windows)]` guard here.
-}
+    /// Whether the previous
+    #[allow(dead_code)]
+    was_last_character_carriage_return: bool,
+    // TODO These are dead code only on non-Windows operating systems.
+    // It might be better to use a `#[cfg(windows)]` guard here.
+}
 
-impl<'a> DigestWriter<'a> {
-    pub fn new(digest: &'a mut Box<dyn Digest>, binary: bool) -> DigestWriter {
-        let was_last_character_carriage_return = false;
-        DigestWriter {
-            digest,
-            binary,
-            was_last_character_carriage_return,
+impl<'a> DigestWriter<'a> {
+    pub fn new(digest: &'a mut Box<dyn Digest>, binary: bool) -> DigestWriter {
+        let was_last_character_carriage_return = false;
+        DigestWriter {
+            digest,
+            binary,
+            was_last_character_carriage_return,
         }
     }
 
-    pub fn finalize(&mut self) -> bool {
-        if self.was_last_character_carriage_return {
-            self.digest.input(&[b'\r']);
-            true
-        } else {
-            false
-        }
+    pub fn finalize(&mut self) -> bool {
+        if self.was_last_character_carriage_return {
+            self.digest.input(&[b'\r']);
+            true
+        } else {
+            false
+        }
     }
 }
 
-impl<'a> Write for DigestWriter<'a> {
-    #[cfg(not(windows))]
-    fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
-        self.digest.input(buf);
-        Ok(buf.len())
+impl<'a> Write for DigestWriter<'a> {
+    #[cfg(not(windows))]
+    fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
+        self.digest.input(buf);
+        Ok(buf.len())
     }
 
-    #[cfg(windows)]
-    fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
-        if self.binary {
-            self.digest.input(buf);
-            return Ok(buf.len());
+    #[cfg(windows)]
+    fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
+        if self.binary {
+            self.digest.input(buf);
+            return Ok(buf.len());
         }
 
-        // The remaining code handles Windows text mode, where we must
-        // replace each occurrence of "\r\n" with "\n".
-        //
-        // First, if the last character written was "\r" and the first
-        // character in the current buffer to write is not "\n", then we
-        // need to write the "\r" that we buffered from the previous
-        // call to `write()`.
-        let n = buf.len();
-        if self.was_last_character_carriage_return && n > 0 && buf[0] != b'\n' {
-            self.digest.input(&[b'\r']);
+        // The remaining code handles Windows text mode, where we must
+        // replace each occurrence of "\r\n" with "\n".
+        //
+        // First, if the last character written was "\r" and the first
+        // character in the current buffer to write is not "\n", then we
+        // need to write the "\r" that we buffered from the previous
+        // call to `write()`.
+        let n = buf.len();
+        if self.was_last_character_carriage_return && n > 0 && buf[0] != b'\n' {
+            self.digest.input(&[b'\r']);
         }
 
-        // Next, find all occurrences of "\r\n", inputting the slice
-        // just before the "\n" in the previous instance of "\r\n" and
-        // the beginning of this "\r\n".
-        let mut i_prev = 0;
-        for i in memmem::find_iter(buf, b"\r\n") {
-            self.digest.input(&buf[i_prev..i]);
-            i_prev = i + 1;
+        // Next, find all occurrences of "\r\n", inputting the slice
+        // just before the "\n" in the previous instance of "\r\n" and
+        // the beginning of this "\r\n".
+        let mut i_prev = 0;
+        for i in memmem::find_iter(buf, b"\r\n") {
+            self.digest.input(&buf[i_prev..i]);
+            i_prev = i + 1;
         }
 
-        // Finally, check whether the last character is "\r". If so,
-        // buffer it until we know that the next character is not "\n",
-        // which can only be known on the next call to `write()`.
-        //
-        // This all assumes that `write()` will be called on adjacent
-        // blocks of the input.
-        if n > 0 && buf[n - 1] == b'\r' {
-            self.was_last_character_carriage_return = true;
-            self.digest.input(&buf[i_prev..n - 1]);
-        } else {
-            self.was_last_character_carriage_return = false;
-            self.digest.input(&buf[i_prev..n]);
+        // Finally, check whether the last character is "\r". If so,
+        // buffer it until we know that the next character is not "\n",
+        // which can only be known on the next call to `write()`.
+        //
+        // This all assumes that `write()` will be called on adjacent
+        // blocks of the input.
+        if n > 0 && buf[n - 1] == b'\r' {
+            self.was_last_character_carriage_return = true;
+            self.digest.input(&buf[i_prev..n - 1]);
+        } else {
+            self.was_last_character_carriage_return = false;
+            self.digest.input(&buf[i_prev..n]);
         }
 
-        // Even though we dropped a "\r" for each "\r\n" we found, we
-        // still report the number of bytes written as `n`. This is
-        // because the meaning of the returned number is supposed to be
-        // the number of bytes consumed by the writer, so that if the
-        // calling code were calling `write()` in a loop, it would know
-        // where the next contiguous slice of the buffer starts.
-        Ok(n)
+        // Even though we dropped a "\r" for each "\r\n" we found, we
+        // still report the number of bytes written as `n`. This is
+        // because the meaning of the returned number is supposed to be
+        // the number of bytes consumed by the writer, so that if the
+        // calling code were calling `write()` in a loop, it would know
+        // where the next contiguous slice of the buffer starts.
+        Ok(n)
     }
 
-    fn flush(&mut self) -> std::io::Result<()> {
+    fn flush(&mut self) -> std::io::Result<()> {
         Ok(())
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    /// Test for replacing a "\r\n" sequence with "\n" when the "\r" is
-    /// at the end of one block and the "\n" is at the beginning of the
-    /// next block, when reading in blocks.
-    #[cfg(windows)]
-    #[test]
-    fn test_crlf_across_blocks() {
-        use std::io::Write;
+    /// Test for replacing a "\r\n" sequence with "\n" when the "\r" is
+    /// at the end of one block and the "\n" is at the beginning of the
+    /// next block, when reading in blocks.
+    #[cfg(windows)]
+    #[test]
+    fn test_crlf_across_blocks() {
+        use std::io::Write;
 
-        use crate::digest::Digest;
-        use crate::digest::DigestWriter;
+        use crate::digest::Digest;
+        use crate::digest::DigestWriter;
 
-        // Writing "\r" in one call to `write()`, and then "\n" in another.
-        let mut digest = Box::new(md5::Md5::new()) as Box<dyn Digest>;
-        let mut writer_crlf = DigestWriter::new(&mut digest, false);
-        writer_crlf.write_all(&[b'\r']).unwrap();
-        writer_crlf.write_all(&[b'\n']).unwrap();
-        writer_crlf.finalize();
-        let result_crlf = digest.result_str();
+        // Writing "\r" in one call to `write()`, and then "\n" in another.
+        let mut digest = Box::new(md5::Md5::new()) as Box<dyn Digest>;
+        let mut writer_crlf = DigestWriter::new(&mut digest, false);
+        writer_crlf.write_all(&[b'\r']).unwrap();
+        writer_crlf.write_all(&[b'\n']).unwrap();
+        writer_crlf.finalize();
+        let result_crlf = digest.result_str();
 
-        // We expect "\r\n" to be replaced with "\n" in text mode on Windows.
-        let mut digest = Box::new(md5::Md5::new()) as Box<dyn Digest>;
-        let mut writer_lf = DigestWriter::new(&mut digest, false);
-        writer_lf.write_all(&[b'\n']).unwrap();
-        writer_lf.finalize();
-        let result_lf = digest.result_str();
+        // We expect "\r\n" to be replaced with "\n" in text mode on Windows.
+        let mut digest = Box::new(md5::Md5::new()) as Box<dyn Digest>;
+        let mut writer_lf = DigestWriter::new(&mut digest, false);
+        writer_lf.write_all(&[b'\n']).unwrap();
+        writer_lf.finalize();
+        let result_lf = digest.result_str();
 
-        assert_eq!(result_crlf, result_lf);
+        assert_eq!(result_crlf, result_lf);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_hashsum/hashsum.rs.html b/dev/src/uu_hashsum/hashsum.rs.html index 35134f3a3..d0de5b9ed 100644 --- a/dev/src/uu_hashsum/hashsum.rs.html +++ b/dev/src/uu_hashsum/hashsum.rs.html @@ -1,4 +1,4 @@ -hashsum.rs - source
1
+hashsum.rs - source
1
 2
 3
 4
@@ -688,423 +688,423 @@
 688
 689
 690
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  * (c) Vsevolod Velichko <torkvemada@sorokdva.net>
-//  * (c) Gil Cottle <gcottle@redtown.org>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  * (c) Vsevolod Velichko <torkvemada@sorokdva.net>
+//  * (c) Gil Cottle <gcottle@redtown.org>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) algo, algoname, regexes, nread, nonames
+// spell-checker:ignore (ToDO) algo, algoname, regexes, nread, nonames
 
-#[macro_use]
-extern crate clap;
+#[macro_use]
+extern crate clap;
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-mod digest;
+mod digest;
 
-use self::digest::Digest;
-use self::digest::DigestWriter;
+use self::digest::Digest;
+use self::digest::DigestWriter;
 
-use clap::builder::ValueParser;
-use clap::ArgAction;
-use clap::{Arg, ArgMatches, Command};
-use hex::encode;
-use md5::Md5;
-use regex::Regex;
-use sha1::Sha1;
-use sha2::{Sha224, Sha256, Sha384, Sha512};
-use sha3::{Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shake256};
-use std::cmp::Ordering;
-use std::error::Error;
-use std::ffi::{OsStr, OsString};
-use std::fs::File;
-use std::io::{self, stdin, BufRead, BufReader, Read};
-use std::iter;
-use std::num::ParseIntError;
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UError, UResult};
+use clap::builder::ValueParser;
+use clap::ArgAction;
+use clap::{Arg, ArgMatches, Command};
+use hex::encode;
+use md5::Md5;
+use regex::Regex;
+use sha1::Sha1;
+use sha2::{Sha224, Sha256, Sha384, Sha512};
+use sha3::{Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shake256};
+use std::cmp::Ordering;
+use std::error::Error;
+use std::ffi::{OsStr, OsString};
+use std::fs::File;
+use std::io::{self, stdin, BufRead, BufReader, Read};
+use std::iter;
+use std::num::ParseIntError;
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UError, UResult};
 
-const NAME: &str = "hashsum";
+const NAME: &str = "hashsum";
 
-struct Options {
-    algoname: &'static str,
-    digest: Box<dyn Digest + 'static>,
-    binary: bool,
-    check: bool,
-    tag: bool,
-    nonames: bool,
-    status: bool,
-    quiet: bool,
-    strict: bool,
-    warn: bool,
-    output_bits: usize,
+struct Options {
+    algoname: &'static str,
+    digest: Box<dyn Digest + 'static>,
+    binary: bool,
+    check: bool,
+    tag: bool,
+    nonames: bool,
+    status: bool,
+    quiet: bool,
+    strict: bool,
+    warn: bool,
+    output_bits: usize,
 }
 
-#[allow(clippy::cognitive_complexity)]
-fn detect_algo(
-    program: &str,
-    matches: &ArgMatches,
-) -> (&'static str, Box<dyn Digest + 'static>, usize) {
-    let mut alg: Option<Box<dyn Digest>> = None;
-    let mut name: &'static str = "";
-    let mut output_bits = 0;
-    match program {
-        "md5sum" => ("MD5", Box::new(Md5::new()) as Box<dyn Digest>, 128),
-        "sha1sum" => ("SHA1", Box::new(Sha1::new()) as Box<dyn Digest>, 160),
-        "sha224sum" => ("SHA224", Box::new(Sha224::new()) as Box<dyn Digest>, 224),
-        "sha256sum" => ("SHA256", Box::new(Sha256::new()) as Box<dyn Digest>, 256),
-        "sha384sum" => ("SHA384", Box::new(Sha384::new()) as Box<dyn Digest>, 384),
-        "sha512sum" => ("SHA512", Box::new(Sha512::new()) as Box<dyn Digest>, 512),
-        "b2sum" => (
+#[allow(clippy::cognitive_complexity)]
+fn detect_algo(
+    program: &str,
+    matches: &ArgMatches,
+) -> (&'static str, Box<dyn Digest + 'static>, usize) {
+    let mut alg: Option<Box<dyn Digest>> = None;
+    let mut name: &'static str = "";
+    let mut output_bits = 0;
+    match program {
+        "md5sum" => ("MD5", Box::new(Md5::new()) as Box<dyn Digest>, 128),
+        "sha1sum" => ("SHA1", Box::new(Sha1::new()) as Box<dyn Digest>, 160),
+        "sha224sum" => ("SHA224", Box::new(Sha224::new()) as Box<dyn Digest>, 224),
+        "sha256sum" => ("SHA256", Box::new(Sha256::new()) as Box<dyn Digest>, 256),
+        "sha384sum" => ("SHA384", Box::new(Sha384::new()) as Box<dyn Digest>, 384),
+        "sha512sum" => ("SHA512", Box::new(Sha512::new()) as Box<dyn Digest>, 512),
+        "b2sum" => (
             "BLAKE2",
-            Box::new(blake2b_simd::State::new()) as Box<dyn Digest>,
+            Box::new(blake2b_simd::State::new()) as Box<dyn Digest>,
             512,
         ),
-        "b3sum" => (
+        "b3sum" => (
             "BLAKE3",
-            Box::new(blake3::Hasher::new()) as Box<dyn Digest>,
+            Box::new(blake3::Hasher::new()) as Box<dyn Digest>,
             256,
         ),
-        "sha3sum" => match matches.get_one::<usize>("bits") {
+        "sha3sum" => match matches.get_one::<usize>("bits") {
             Some(224) => (
                 "SHA3-224",
-                Box::new(Sha3_224::new()) as Box<dyn Digest>,
+                Box::new(Sha3_224::new()) as Box<dyn Digest>,
                 224,
             ),
             Some(256) => (
                 "SHA3-256",
-                Box::new(Sha3_256::new()) as Box<dyn Digest>,
+                Box::new(Sha3_256::new()) as Box<dyn Digest>,
                 256,
             ),
             Some(384) => (
                 "SHA3-384",
-                Box::new(Sha3_384::new()) as Box<dyn Digest>,
+                Box::new(Sha3_384::new()) as Box<dyn Digest>,
                 384,
             ),
             Some(512) => (
                 "SHA3-512",
-                Box::new(Sha3_512::new()) as Box<dyn Digest>,
+                Box::new(Sha3_512::new()) as Box<dyn Digest>,
                 512,
             ),
             Some(_) => crash!(
                 1,
-                "Invalid output size for SHA3 (expected 224, 256, 384, or 512)"
-            ),
-            None => crash!(1, "--bits required for SHA3"),
+                "Invalid output size for SHA3 (expected 224, 256, 384, or 512)"
+            ),
+            None => crash!(1, "--bits required for SHA3"),
         },
-        "sha3-224sum" => (
+        "sha3-224sum" => (
             "SHA3-224",
-            Box::new(Sha3_224::new()) as Box<dyn Digest>,
+            Box::new(Sha3_224::new()) as Box<dyn Digest>,
             224,
         ),
-        "sha3-256sum" => (
+        "sha3-256sum" => (
             "SHA3-256",
-            Box::new(Sha3_256::new()) as Box<dyn Digest>,
+            Box::new(Sha3_256::new()) as Box<dyn Digest>,
             256,
         ),
-        "sha3-384sum" => (
+        "sha3-384sum" => (
             "SHA3-384",
-            Box::new(Sha3_384::new()) as Box<dyn Digest>,
+            Box::new(Sha3_384::new()) as Box<dyn Digest>,
             384,
         ),
-        "sha3-512sum" => (
+        "sha3-512sum" => (
             "SHA3-512",
-            Box::new(Sha3_512::new()) as Box<dyn Digest>,
+            Box::new(Sha3_512::new()) as Box<dyn Digest>,
             512,
         ),
-        "shake128sum" => match matches.get_one::<usize>("bits") {
-            Some(bits) => (
+        "shake128sum" => match matches.get_one::<usize>("bits") {
+            Some(bits) => (
                 "SHAKE128",
-                Box::new(Shake128::new()) as Box<dyn Digest>,
-                *bits,
+                Box::new(Shake128::new()) as Box<dyn Digest>,
+                *bits,
             ),
-            None => crash!(1, "--bits required for SHAKE-128"),
+            None => crash!(1, "--bits required for SHAKE-128"),
         },
-        "shake256sum" => match matches.get_one::<usize>("bits") {
-            Some(bits) => (
+        "shake256sum" => match matches.get_one::<usize>("bits") {
+            Some(bits) => (
                 "SHAKE256",
-                Box::new(Shake256::new()) as Box<dyn Digest>,
-                *bits,
+                Box::new(Shake256::new()) as Box<dyn Digest>,
+                *bits,
             ),
-            None => crash!(1, "--bits required for SHAKE-256"),
+            None => crash!(1, "--bits required for SHAKE-256"),
         },
-        _ => {
+        _ => {
             {
-                let mut set_or_crash = |n, val, bits| {
-                    if alg.is_some() {
+                let mut set_or_crash = |n, val, bits| {
+                    if alg.is_some() {
                         crash!(1, "You cannot combine multiple hash algorithms!")
                     };
-                    name = n;
-                    alg = Some(val);
-                    output_bits = bits;
+                    name = n;
+                    alg = Some(val);
+                    output_bits = bits;
                 };
-                if matches.get_flag("md5") {
-                    set_or_crash("MD5", Box::new(Md5::new()), 128);
+                if matches.get_flag("md5") {
+                    set_or_crash("MD5", Box::new(Md5::new()), 128);
                 }
-                if matches.get_flag("sha1") {
-                    set_or_crash("SHA1", Box::new(Sha1::new()), 160);
+                if matches.get_flag("sha1") {
+                    set_or_crash("SHA1", Box::new(Sha1::new()), 160);
                 }
-                if matches.get_flag("sha224") {
-                    set_or_crash("SHA224", Box::new(Sha224::new()), 224);
+                if matches.get_flag("sha224") {
+                    set_or_crash("SHA224", Box::new(Sha224::new()), 224);
                 }
-                if matches.get_flag("sha256") {
-                    set_or_crash("SHA256", Box::new(Sha256::new()), 256);
+                if matches.get_flag("sha256") {
+                    set_or_crash("SHA256", Box::new(Sha256::new()), 256);
                 }
-                if matches.get_flag("sha384") {
-                    set_or_crash("SHA384", Box::new(Sha384::new()), 384);
+                if matches.get_flag("sha384") {
+                    set_or_crash("SHA384", Box::new(Sha384::new()), 384);
                 }
-                if matches.get_flag("sha512") {
-                    set_or_crash("SHA512", Box::new(Sha512::new()), 512);
+                if matches.get_flag("sha512") {
+                    set_or_crash("SHA512", Box::new(Sha512::new()), 512);
                 }
-                if matches.get_flag("b2sum") {
-                    set_or_crash("BLAKE2", Box::new(blake2b_simd::State::new()), 512);
+                if matches.get_flag("b2sum") {
+                    set_or_crash("BLAKE2", Box::new(blake2b_simd::State::new()), 512);
                 }
-                if matches.get_flag("b3sum") {
-                    set_or_crash("BLAKE3", Box::new(blake3::Hasher::new()), 256);
+                if matches.get_flag("b3sum") {
+                    set_or_crash("BLAKE3", Box::new(blake3::Hasher::new()), 256);
                 }
-                if matches.get_flag("sha3") {
-                    match matches.get_one::<usize>("bits") {
-                        Some(224) => set_or_crash(
+                if matches.get_flag("sha3") {
+                    match matches.get_one::<usize>("bits") {
+                        Some(224) => set_or_crash(
                             "SHA3-224",
-                            Box::new(Sha3_224::new()) as Box<dyn Digest>,
+                            Box::new(Sha3_224::new()) as Box<dyn Digest>,
                             224,
                         ),
-                        Some(256) => set_or_crash(
+                        Some(256) => set_or_crash(
                             "SHA3-256",
-                            Box::new(Sha3_256::new()) as Box<dyn Digest>,
+                            Box::new(Sha3_256::new()) as Box<dyn Digest>,
                             256,
                         ),
-                        Some(384) => set_or_crash(
+                        Some(384) => set_or_crash(
                             "SHA3-384",
-                            Box::new(Sha3_384::new()) as Box<dyn Digest>,
+                            Box::new(Sha3_384::new()) as Box<dyn Digest>,
                             384,
                         ),
-                        Some(512) => set_or_crash(
+                        Some(512) => set_or_crash(
                             "SHA3-512",
-                            Box::new(Sha3_512::new()) as Box<dyn Digest>,
+                            Box::new(Sha3_512::new()) as Box<dyn Digest>,
                             512,
                         ),
                         Some(_) => crash!(
                             1,
-                            "Invalid output size for SHA3 (expected 224, 256, 384, or 512)"
-                        ),
-                        None => crash!(1, "--bits required for SHA3"),
+                            "Invalid output size for SHA3 (expected 224, 256, 384, or 512)"
+                        ),
+                        None => crash!(1, "--bits required for SHA3"),
                     }
                 }
-                if matches.get_flag("sha3-224") {
-                    set_or_crash("SHA3-224", Box::new(Sha3_224::new()), 224);
+                if matches.get_flag("sha3-224") {
+                    set_or_crash("SHA3-224", Box::new(Sha3_224::new()), 224);
                 }
-                if matches.get_flag("sha3-256") {
-                    set_or_crash("SHA3-256", Box::new(Sha3_256::new()), 256);
+                if matches.get_flag("sha3-256") {
+                    set_or_crash("SHA3-256", Box::new(Sha3_256::new()), 256);
                 }
-                if matches.get_flag("sha3-384") {
-                    set_or_crash("SHA3-384", Box::new(Sha3_384::new()), 384);
+                if matches.get_flag("sha3-384") {
+                    set_or_crash("SHA3-384", Box::new(Sha3_384::new()), 384);
                 }
-                if matches.get_flag("sha3-512") {
-                    set_or_crash("SHA3-512", Box::new(Sha3_512::new()), 512);
+                if matches.get_flag("sha3-512") {
+                    set_or_crash("SHA3-512", Box::new(Sha3_512::new()), 512);
                 }
-                if matches.get_flag("shake128") {
-                    match matches.get_one::<usize>("bits") {
-                        Some(bits) => set_or_crash("SHAKE128", Box::new(Shake128::new()), *bits),
-                        None => crash!(1, "--bits required for SHAKE-128"),
+                if matches.get_flag("shake128") {
+                    match matches.get_one::<usize>("bits") {
+                        Some(bits) => set_or_crash("SHAKE128", Box::new(Shake128::new()), *bits),
+                        None => crash!(1, "--bits required for SHAKE-128"),
                     }
                 }
-                if matches.get_flag("shake256") {
-                    match matches.get_one::<usize>("bits") {
-                        Some(bits) => set_or_crash("SHAKE256", Box::new(Shake256::new()), *bits),
-                        None => crash!(1, "--bits required for SHAKE-256"),
+                if matches.get_flag("shake256") {
+                    match matches.get_one::<usize>("bits") {
+                        Some(bits) => set_or_crash("SHAKE256", Box::new(Shake256::new()), *bits),
+                        None => crash!(1, "--bits required for SHAKE-256"),
                     }
                 }
             }
-            let alg = alg.unwrap_or_else(|| crash!(1, "You must specify hash algorithm!"));
-            (name, alg, output_bits)
+            let alg = alg.unwrap_or_else(|| crash!(1, "You must specify hash algorithm!"));
+            (name, alg, output_bits)
         }
     }
 }
 
-// TODO: return custom error type
-fn parse_bit_num(arg: &str) -> Result<usize, ParseIntError> {
-    arg.parse()
+// TODO: return custom error type
+fn parse_bit_num(arg: &str) -> Result<usize, ParseIntError> {
+    arg.parse()
 }
 
-#[uucore::main]
-pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
-    // if there is no program name for some reason, default to "hashsum"
-    let program = args.next().unwrap_or_else(|| OsString::from(NAME));
-    let binary_name = Path::new(&program)
-        .file_name()
-        .unwrap_or_else(|| OsStr::new(NAME))
-        .to_string_lossy();
+#[uucore::main]
+pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
+    // if there is no program name for some reason, default to "hashsum"
+    let program = args.next().unwrap_or_else(|| OsString::from(NAME));
+    let binary_name = Path::new(&program)
+        .file_name()
+        .unwrap_or_else(|| OsStr::new(NAME))
+        .to_string_lossy();
 
-    let args = iter::once(program.clone()).chain(args);
+    let args = iter::once(program.clone()).chain(args);
 
-    // Default binary in Windows, text mode otherwise
-    let binary_flag_default = cfg!(windows);
+    // Default binary in Windows, text mode otherwise
+    let binary_flag_default = cfg!(windows);
 
-    let command = uu_app(&binary_name);
+    let command = uu_app(&binary_name);
 
-    // FIXME: this should use try_get_matches_from() and crash!(), but at the moment that just
-    //        causes "error: " to be printed twice (once from crash!() and once from clap).  With
-    //        the current setup, the name of the utility is not printed, but I think this is at
-    //        least somewhat better from a user's perspective.
-    let matches = command.try_get_matches_from(args)?;
+    // FIXME: this should use try_get_matches_from() and crash!(), but at the moment that just
+    //        causes "error: " to be printed twice (once from crash!() and once from clap).  With
+    //        the current setup, the name of the utility is not printed, but I think this is at
+    //        least somewhat better from a user's perspective.
+    let matches = command.try_get_matches_from(args)?;
 
-    let (name, algo, bits) = detect_algo(&binary_name, &matches);
+    let (name, algo, bits) = detect_algo(&binary_name, &matches);
 
-    let binary = if matches.get_flag("binary") {
-        true
-    } else if matches.get_flag("text") {
-        false
-    } else {
-        binary_flag_default
+    let binary = if matches.get_flag("binary") {
+        true
+    } else if matches.get_flag("text") {
+        false
+    } else {
+        binary_flag_default
     };
-    let check = matches.get_flag("check");
-    let tag = matches.get_flag("tag");
-    let nonames = *matches
-        .try_get_one("no-names")
-        .unwrap_or(None)
-        .unwrap_or(&false);
-    let status = matches.get_flag("status");
-    let quiet = matches.get_flag("quiet") || status;
-    let strict = matches.get_flag("strict");
-    let warn = matches.get_flag("warn") && !status;
+    let check = matches.get_flag("check");
+    let tag = matches.get_flag("tag");
+    let nonames = *matches
+        .try_get_one("no-names")
+        .unwrap_or(None)
+        .unwrap_or(&false);
+    let status = matches.get_flag("status");
+    let quiet = matches.get_flag("quiet") || status;
+    let strict = matches.get_flag("strict");
+    let warn = matches.get_flag("warn") && !status;
 
-    let opts = Options {
-        algoname: name,
-        digest: algo,
-        output_bits: bits,
-        binary,
-        check,
-        tag,
-        nonames,
-        status,
-        quiet,
-        strict,
-        warn,
+    let opts = Options {
+        algoname: name,
+        digest: algo,
+        output_bits: bits,
+        binary,
+        check,
+        tag,
+        nonames,
+        status,
+        quiet,
+        strict,
+        warn,
     };
 
-    match matches.get_many::<OsString>("FILE") {
-        Some(files) => hashsum(opts, files.map(|f| f.as_os_str())),
-        None => hashsum(opts, iter::once(OsStr::new("-"))),
+    match matches.get_many::<OsString>("FILE") {
+        Some(files) => hashsum(opts, files.map(|f| f.as_os_str())),
+        None => hashsum(opts, iter::once(OsStr::new("-"))),
     }
 }
 
-pub fn uu_app_common() -> Command {
-    #[cfg(windows)]
-    const BINARY_HELP: &str = "read in binary mode (default)";
-    #[cfg(not(windows))]
-    const BINARY_HELP: &str = "read in binary mode";
-    #[cfg(windows)]
-    const TEXT_HELP: &str = "read in text mode";
-    #[cfg(not(windows))]
-    const TEXT_HELP: &str = "read in text mode (default)";
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about("Compute and check message digests.")
-        .infer_long_args(true)
-        .arg(
-            Arg::new("binary")
-                .short('b')
-                .long("binary")
-                .help(BINARY_HELP)
-                .action(ArgAction::SetTrue),
+pub fn uu_app_common() -> Command {
+    #[cfg(windows)]
+    const BINARY_HELP: &str = "read in binary mode (default)";
+    #[cfg(not(windows))]
+    const BINARY_HELP: &str = "read in binary mode";
+    #[cfg(windows)]
+    const TEXT_HELP: &str = "read in text mode";
+    #[cfg(not(windows))]
+    const TEXT_HELP: &str = "read in text mode (default)";
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about("Compute and check message digests.")
+        .infer_long_args(true)
+        .arg(
+            Arg::new("binary")
+                .short('b')
+                .long("binary")
+                .help(BINARY_HELP)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("check")
-                .short('c')
-                .long("check")
-                .help("read hashsums from the FILEs and check them")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("check")
+                .short('c')
+                .long("check")
+                .help("read hashsums from the FILEs and check them")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("tag")
-                .long("tag")
-                .help("create a BSD-style checksum")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("tag")
+                .long("tag")
+                .help("create a BSD-style checksum")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("text")
-                .short('t')
-                .long("text")
-                .help(TEXT_HELP)
-                .conflicts_with("binary")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("text")
+                .short('t')
+                .long("text")
+                .help(TEXT_HELP)
+                .conflicts_with("binary")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("quiet")
-                .short('q')
-                .long("quiet")
-                .help("don't print OK for each successfully verified file")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("quiet")
+                .short('q')
+                .long("quiet")
+                .help("don't print OK for each successfully verified file")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("status")
-                .short('s')
-                .long("status")
-                .help("don't output anything, status code shows success")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("status")
+                .short('s')
+                .long("status")
+                .help("don't output anything, status code shows success")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("strict")
-                .long("strict")
-                .help("exit non-zero for improperly formatted checksum lines")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("strict")
+                .long("strict")
+                .help("exit non-zero for improperly formatted checksum lines")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("warn")
-                .short('w')
-                .long("warn")
-                .help("warn about improperly formatted checksum lines")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("warn")
+                .short('w')
+                .long("warn")
+                .help("warn about improperly formatted checksum lines")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("FILE")
-                .index(1)
-                .action(ArgAction::Append)
-                .value_name("FILE")
-                .value_hint(clap::ValueHint::FilePath)
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new("FILE")
+                .index(1)
+                .action(ArgAction::Append)
+                .value_name("FILE")
+                .value_hint(clap::ValueHint::FilePath)
+                .value_parser(ValueParser::os_string()),
         )
 }
 
-pub fn uu_app_b3sum() -> Command {
-    uu_app_b3sum_opts(uu_app_common())
+pub fn uu_app_b3sum() -> Command {
+    uu_app_b3sum_opts(uu_app_common())
 }
 
-fn uu_app_b3sum_opts(command: Command) -> Command {
-    command.arg(
-        Arg::new("no-names")
-            .long("no-names")
-            .help("Omits filenames in the output (option not present in GNU/Coreutils)")
-            .action(ArgAction::SetTrue),
+fn uu_app_b3sum_opts(command: Command) -> Command {
+    command.arg(
+        Arg::new("no-names")
+            .long("no-names")
+            .help("Omits filenames in the output (option not present in GNU/Coreutils)")
+            .action(ArgAction::SetTrue),
     )
 }
 
-pub fn uu_app_bits() -> Command {
-    uu_app_opt_bits(uu_app_common())
+pub fn uu_app_bits() -> Command {
+    uu_app_opt_bits(uu_app_common())
 }
 
-fn uu_app_opt_bits(command: Command) -> Command {
-    // Needed for variable-length output sums (e.g. SHAKE)
-    command.arg(
-        Arg::new("bits")
-            .long("bits")
-            .help("set the size of the output (only for SHAKE)")
-            .value_name("BITS")
-            // XXX: should we actually use validators?  they're not particularly efficient
-            .value_parser(parse_bit_num),
+fn uu_app_opt_bits(command: Command) -> Command {
+    // Needed for variable-length output sums (e.g. SHAKE)
+    command.arg(
+        Arg::new("bits")
+            .long("bits")
+            .help("set the size of the output (only for SHAKE)")
+            .value_name("BITS")
+            // XXX: should we actually use validators?  they're not particularly efficient
+            .value_parser(parse_bit_num),
     )
 }
 
-pub fn uu_app_custom() -> Command {
-    let mut command = uu_app_b3sum_opts(uu_app_opt_bits(uu_app_common()));
-    let algorithms = &[
+pub fn uu_app_custom() -> Command {
+    let mut command = uu_app_b3sum_opts(uu_app_opt_bits(uu_app_common()));
+    let algorithms = &[
         ("md5", "work with MD5"),
         ("sha1", "work with SHA1"),
         ("sha224", "work with SHA224"),
@@ -1128,255 +1128,255 @@
         ("b3sum", "work with BLAKE3"),
     ];
 
-    for (name, desc) in algorithms {
-        command = command.arg(
-            Arg::new(*name)
-                .long(name)
-                .help(*desc)
-                .action(ArgAction::SetTrue),
+    for (name, desc) in algorithms {
+        command = command.arg(
+            Arg::new(*name)
+                .long(name)
+                .help(*desc)
+                .action(ArgAction::SetTrue),
         );
     }
-    command
+    command
 }
 
-// hashsum is handled differently in build.rs, therefore this is not the same
-// as in other utilities.
-fn uu_app(binary_name: &str) -> Command {
-    match binary_name {
-        // These all support the same options.
-        "md5sum" | "sha1sum" | "sha224sum" | "sha256sum" | "sha384sum" | "sha512sum" => {
-            uu_app_common()
+// hashsum is handled differently in build.rs, therefore this is not the same
+// as in other utilities.
+fn uu_app(binary_name: &str) -> Command {
+    match binary_name {
+        // These all support the same options.
+        "md5sum" | "sha1sum" | "sha224sum" | "sha256sum" | "sha384sum" | "sha512sum" => {
+            uu_app_common()
         }
-        // b2sum supports the md5sum options plus -l/--length.
-        "b2sum" => uu_app_common(), // TODO: Implement -l/--length
-        // These have never been part of GNU Coreutils, but can function with the same
-        // options as md5sum.
-        "sha3-224sum" | "sha3-256sum" | "sha3-384sum" | "sha3-512sum" => uu_app_common(),
-        // These have never been part of GNU Coreutils, and require an additional --bits
-        // option to specify their output size.
-        "sha3sum" | "shake128sum" | "shake256sum" => uu_app_bits(),
-        // b3sum has never been part of GNU Coreutils, and has a --no-names option in
-        // addition to the b2sum options.
-        "b3sum" => uu_app_b3sum(),
-        // We're probably just being called as `hashsum`, so give them everything.
-        _ => uu_app_custom(),
+        // b2sum supports the md5sum options plus -l/--length.
+        "b2sum" => uu_app_common(), // TODO: Implement -l/--length
+        // These have never been part of GNU Coreutils, but can function with the same
+        // options as md5sum.
+        "sha3-224sum" | "sha3-256sum" | "sha3-384sum" | "sha3-512sum" => uu_app_common(),
+        // These have never been part of GNU Coreutils, and require an additional --bits
+        // option to specify their output size.
+        "sha3sum" | "shake128sum" | "shake256sum" => uu_app_bits(),
+        // b3sum has never been part of GNU Coreutils, and has a --no-names option in
+        // addition to the b2sum options.
+        "b3sum" => uu_app_b3sum(),
+        // We're probably just being called as `hashsum`, so give them everything.
+        _ => uu_app_custom(),
     }
 }
 
-#[derive(Debug)]
-enum HashsumError {
-    InvalidRegex,
-    InvalidFormat,
+#[derive(Debug)]
+enum HashsumError {
+    InvalidRegex,
+    InvalidFormat,
 }
 
-impl Error for HashsumError {}
-impl UError for HashsumError {}
+impl Error for HashsumError {}
+impl UError for HashsumError {}
 
-impl std::fmt::Display for HashsumError {
-    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
-        match self {
-            Self::InvalidRegex => write!(f, "invalid regular expression"),
-            Self::InvalidFormat => Ok(()),
+impl std::fmt::Display for HashsumError {
+    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+        match self {
+            Self::InvalidRegex => write!(f, "invalid regular expression"),
+            Self::InvalidFormat => Ok(()),
         }
     }
 }
 
-#[allow(clippy::cognitive_complexity)]
-fn hashsum<'a, I>(mut options: Options, files: I) -> UResult<()>
-where
-    I: Iterator<Item = &'a OsStr>,
+#[allow(clippy::cognitive_complexity)]
+fn hashsum<'a, I>(mut options: Options, files: I) -> UResult<()>
+where
+    I: Iterator<Item = &'a OsStr>,
 {
-    let mut bad_format = 0;
-    let mut failed_cksum = 0;
-    let mut failed_open_file = 0;
-    let binary_marker = if options.binary { "*" } else { " " };
-    for filename in files {
-        let filename = Path::new(filename);
+    let mut bad_format = 0;
+    let mut failed_cksum = 0;
+    let mut failed_open_file = 0;
+    let binary_marker = if options.binary { "*" } else { " " };
+    for filename in files {
+        let filename = Path::new(filename);
 
-        let stdin_buf;
-        let file_buf;
-        let mut file = BufReader::new(if filename == OsStr::new("-") {
-            stdin_buf = stdin();
-            Box::new(stdin_buf) as Box<dyn Read>
-        } else {
-            file_buf =
-                File::open(filename).map_err_context(|| "failed to open file".to_string())?;
-            Box::new(file_buf) as Box<dyn Read>
+        let stdin_buf;
+        let file_buf;
+        let mut file = BufReader::new(if filename == OsStr::new("-") {
+            stdin_buf = stdin();
+            Box::new(stdin_buf) as Box<dyn Read>
+        } else {
+            file_buf =
+                File::open(filename).map_err_context(|| "failed to open file".to_string())?;
+            Box::new(file_buf) as Box<dyn Read>
         });
-        if options.check {
-            // Set up Regexes for line validation and parsing
-            //
-            // First, we compute the number of bytes we expect to be in
-            // the digest string. If the algorithm has a variable number
-            // of output bits, then we use the `+` modifier in the
-            // regular expression, otherwise we use the `{n}` modifier,
-            // where `n` is the number of bytes.
-            let bytes = options.digest.output_bits() / 4;
-            let modifier = if bytes > 0 {
-                format!("{{{}}}", bytes)
-            } else {
-                "+".to_string()
+        if options.check {
+            // Set up Regexes for line validation and parsing
+            //
+            // First, we compute the number of bytes we expect to be in
+            // the digest string. If the algorithm has a variable number
+            // of output bits, then we use the `+` modifier in the
+            // regular expression, otherwise we use the `{n}` modifier,
+            // where `n` is the number of bytes.
+            let bytes = options.digest.output_bits() / 4;
+            let modifier = if bytes > 0 {
+                format!("{{{}}}", bytes)
+            } else {
+                "+".to_string()
             };
-            let gnu_re = Regex::new(&format!(
+            let gnu_re = Regex::new(&format!(
                 r"^(?P<digest>[a-fA-F0-9]{}) (?P<binary>[ \*])(?P<fileName>.*)",
-                modifier,
+                modifier,
             ))
-            .map_err(|_| HashsumError::InvalidRegex)?;
-            let bsd_re = Regex::new(&format!(
+            .map_err(|_| HashsumError::InvalidRegex)?;
+            let bsd_re = Regex::new(&format!(
                 r"^{algorithm} \((?P<fileName>.*)\) = (?P<digest>[a-fA-F0-9]{digest_size})",
-                algorithm = options.algoname,
-                digest_size = modifier,
+                algorithm = options.algoname,
+                digest_size = modifier,
             ))
-            .map_err(|_| HashsumError::InvalidRegex)?;
+            .map_err(|_| HashsumError::InvalidRegex)?;
 
-            let buffer = file;
-            for (i, maybe_line) in buffer.lines().enumerate() {
-                let line = match maybe_line {
-                    Ok(l) => l,
-                    Err(e) => return Err(e.map_err_context(|| "failed to read file".to_string())),
+            let buffer = file;
+            for (i, maybe_line) in buffer.lines().enumerate() {
+                let line = match maybe_line {
+                    Ok(l) => l,
+                    Err(e) => return Err(e.map_err_context(|| "failed to read file".to_string())),
                 };
-                let (ck_filename, sum, binary_check) = match gnu_re.captures(&line) {
-                    Some(caps) => (
-                        caps.name("fileName").unwrap().as_str(),
-                        caps.name("digest").unwrap().as_str().to_ascii_lowercase(),
-                        caps.name("binary").unwrap().as_str() == "*",
+                let (ck_filename, sum, binary_check) = match gnu_re.captures(&line) {
+                    Some(caps) => (
+                        caps.name("fileName").unwrap().as_str(),
+                        caps.name("digest").unwrap().as_str().to_ascii_lowercase(),
+                        caps.name("binary").unwrap().as_str() == "*",
                     ),
-                    None => match bsd_re.captures(&line) {
-                        Some(caps) => (
-                            caps.name("fileName").unwrap().as_str(),
-                            caps.name("digest").unwrap().as_str().to_ascii_lowercase(),
+                    None => match bsd_re.captures(&line) {
+                        Some(caps) => (
+                            caps.name("fileName").unwrap().as_str(),
+                            caps.name("digest").unwrap().as_str().to_ascii_lowercase(),
                             true,
                         ),
-                        None => {
-                            bad_format += 1;
-                            if options.strict {
-                                return Err(HashsumError::InvalidFormat.into());
+                        None => {
+                            bad_format += 1;
+                            if options.strict {
+                                return Err(HashsumError::InvalidFormat.into());
                             }
-                            if options.warn {
+                            if options.warn {
                                 show_warning!(
                                     "{}: {}: improperly formatted {} checksum line",
-                                    filename.maybe_quote(),
-                                    i + 1,
-                                    options.algoname
+                                    filename.maybe_quote(),
+                                    i + 1,
+                                    options.algoname
                                 );
                             }
                             continue;
                         }
                     },
                 };
-                let f = match File::open(ck_filename) {
+                let f = match File::open(ck_filename) {
                     Err(_) => {
-                        failed_open_file += 1;
+                        failed_open_file += 1;
                         println!(
                             "{}: {}: No such file or directory",
-                            uucore::util_name(),
-                            ck_filename
+                            uucore::util_name(),
+                            ck_filename
                         );
-                        println!("{}: FAILED open or read", ck_filename);
+                        println!("{}: FAILED open or read", ck_filename);
                         continue;
                     }
-                    Ok(file) => file,
+                    Ok(file) => file,
                 };
-                let mut ckf = BufReader::new(Box::new(f) as Box<dyn Read>);
-                let real_sum = digest_reader(
-                    &mut options.digest,
-                    &mut ckf,
-                    binary_check,
-                    options.output_bits,
+                let mut ckf = BufReader::new(Box::new(f) as Box<dyn Read>);
+                let real_sum = digest_reader(
+                    &mut options.digest,
+                    &mut ckf,
+                    binary_check,
+                    options.output_bits,
                 )
-                .map_err_context(|| "failed to read input".to_string())?
-                .to_ascii_lowercase();
-                // FIXME: Filenames with newlines should be treated specially.
-                // GNU appears to replace newlines by \n and backslashes by
-                // \\ and prepend a backslash (to the hash or filename) if it did
-                // this escaping.
-                // Different sorts of output (checking vs outputting hashes) may
-                // handle this differently. Compare carefully to GNU.
-                // If you can, try to preserve invalid unicode using OsStr(ing)Ext
-                // and display it using uucore::display::print_verbatim(). This is
-                // easier (and more important) on Unix than on Windows.
-                if sum == real_sum {
-                    if !options.quiet {
-                        println!("{}: OK", ck_filename);
+                .map_err_context(|| "failed to read input".to_string())?
+                .to_ascii_lowercase();
+                // FIXME: Filenames with newlines should be treated specially.
+                // GNU appears to replace newlines by \n and backslashes by
+                // \\ and prepend a backslash (to the hash or filename) if it did
+                // this escaping.
+                // Different sorts of output (checking vs outputting hashes) may
+                // handle this differently. Compare carefully to GNU.
+                // If you can, try to preserve invalid unicode using OsStr(ing)Ext
+                // and display it using uucore::display::print_verbatim(). This is
+                // easier (and more important) on Unix than on Windows.
+                if sum == real_sum {
+                    if !options.quiet {
+                        println!("{}: OK", ck_filename);
                     }
-                } else {
-                    if !options.status {
-                        println!("{}: FAILED", ck_filename);
+                } else {
+                    if !options.status {
+                        println!("{}: FAILED", ck_filename);
                     }
-                    failed_cksum += 1;
+                    failed_cksum += 1;
                 }
             }
-        } else {
-            let sum = digest_reader(
-                &mut options.digest,
-                &mut file,
-                options.binary,
-                options.output_bits,
+        } else {
+            let sum = digest_reader(
+                &mut options.digest,
+                &mut file,
+                options.binary,
+                options.output_bits,
             )
-            .map_err_context(|| "failed to read input".to_string())?;
-            if options.tag {
-                println!("{} ({}) = {}", options.algoname, filename.display(), sum);
-            } else if options.nonames {
-                println!("{}", sum);
-            } else {
-                println!("{} {}{}", sum, binary_marker, filename.display());
+            .map_err_context(|| "failed to read input".to_string())?;
+            if options.tag {
+                println!("{} ({}) = {}", options.algoname, filename.display(), sum);
+            } else if options.nonames {
+                println!("{}", sum);
+            } else {
+                println!("{} {}{}", sum, binary_marker, filename.display());
             }
         }
     }
-    if !options.status {
-        match bad_format.cmp(&1) {
-            Ordering::Equal => show_warning!("{} line is improperly formatted", bad_format),
-            Ordering::Greater => show_warning!("{} lines are improperly formatted", bad_format),
-            _ => {}
+    if !options.status {
+        match bad_format.cmp(&1) {
+            Ordering::Equal => show_warning!("{} line is improperly formatted", bad_format),
+            Ordering::Greater => show_warning!("{} lines are improperly formatted", bad_format),
+            _ => {}
         };
-        if failed_cksum > 0 {
-            show_warning!("{} computed checksum did NOT match", failed_cksum);
+        if failed_cksum > 0 {
+            show_warning!("{} computed checksum did NOT match", failed_cksum);
         }
-        match failed_open_file.cmp(&1) {
-            Ordering::Equal => show_warning!("{} listed file could not be read", failed_open_file),
-            Ordering::Greater => {
-                show_warning!("{} listed files could not be read", failed_open_file);
+        match failed_open_file.cmp(&1) {
+            Ordering::Equal => show_warning!("{} listed file could not be read", failed_open_file),
+            Ordering::Greater => {
+                show_warning!("{} listed files could not be read", failed_open_file);
             }
-            _ => {}
+            _ => {}
         }
     }
 
     Ok(())
 }
 
-fn digest_reader<T: Read>(
-    digest: &mut Box<dyn Digest>,
-    reader: &mut BufReader<T>,
-    binary: bool,
-    output_bits: usize,
-) -> io::Result<String> {
-    digest.reset();
+fn digest_reader<T: Read>(
+    digest: &mut Box<dyn Digest>,
+    reader: &mut BufReader<T>,
+    binary: bool,
+    output_bits: usize,
+) -> io::Result<String> {
+    digest.reset();
 
-    // Read bytes from `reader` and write those bytes to `digest`.
-    //
-    // If `binary` is `false` and the operating system is Windows, then
-    // `DigestWriter` replaces "\r\n" with "\n" before it writes the
-    // bytes into `digest`. Otherwise, it just inserts the bytes as-is.
-    //
-    // In order to support replacing "\r\n", we must call `finalize()`
-    // in order to support the possibility that the last character read
-    // from the reader was "\r". (This character gets buffered by
-    // `DigestWriter` and only written if the following character is
-    // "\n". But when "\r" is the last character read, we need to force
-    // it to be written.)
-    let mut digest_writer = DigestWriter::new(digest, binary);
-    std::io::copy(reader, &mut digest_writer)?;
-    digest_writer.finalize();
+    // Read bytes from `reader` and write those bytes to `digest`.
+    //
+    // If `binary` is `false` and the operating system is Windows, then
+    // `DigestWriter` replaces "\r\n" with "\n" before it writes the
+    // bytes into `digest`. Otherwise, it just inserts the bytes as-is.
+    //
+    // In order to support replacing "\r\n", we must call `finalize()`
+    // in order to support the possibility that the last character read
+    // from the reader was "\r". (This character gets buffered by
+    // `DigestWriter` and only written if the following character is
+    // "\n". But when "\r" is the last character read, we need to force
+    // it to be written.)
+    let mut digest_writer = DigestWriter::new(digest, binary);
+    std::io::copy(reader, &mut digest_writer)?;
+    digest_writer.finalize();
 
-    if digest.output_bits() > 0 {
-        Ok(digest.result_str())
-    } else {
-        // Assume it's SHAKE.  result_str() doesn't work with shake (as of 8/30/2016)
-        let mut bytes = Vec::new();
-        bytes.resize((output_bits + 7) / 8, 0);
-        digest.result(&mut bytes);
-        Ok(encode(bytes))
+    if digest.output_bits() > 0 {
+        Ok(digest.result_str())
+    } else {
+        // Assume it's SHAKE.  result_str() doesn't work with shake (as of 8/30/2016)
+        let mut bytes = Vec::new();
+        bytes.resize((output_bits + 7) / 8, 0);
+        digest.result(&mut bytes);
+        Ok(encode(bytes))
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_head/head.rs.html b/dev/src/uu_head/head.rs.html index 4794e727e..344a7684b 100644 --- a/dev/src/uu_head/head.rs.html +++ b/dev/src/uu_head/head.rs.html @@ -1,4 +1,4 @@ -head.rs - source
1
+head.rs - source
1
 2
 3
 4
@@ -652,659 +652,659 @@
 652
 653
 654
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (vars) zlines BUFWRITER seekable
+// spell-checker:ignore (vars) zlines BUFWRITER seekable
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use std::ffi::OsString;
-use std::io::{self, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write};
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UError, UResult, USimpleError};
-use uucore::lines::lines;
-use uucore::{format_usage, show};
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use std::ffi::OsString;
+use std::io::{self, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UError, UResult, USimpleError};
+use uucore::lines::lines;
+use uucore::{format_usage, show};
 
-const BUF_SIZE: usize = 65536;
+const BUF_SIZE: usize = 65536;
 
-/// The capacity in bytes for buffered writers.
-const BUFWRITER_CAPACITY: usize = 16_384; // 16 kilobytes
+/// The capacity in bytes for buffered writers.
+const BUFWRITER_CAPACITY: usize = 16_384; // 16 kilobytes
 
-const ABOUT: &str = "\
+const ABOUT: &str = "\
                      Print the first 10 lines of each FILE to standard output.\n\
                      With more than one FILE, precede each with a header giving the file name.\n\
                      With no FILE, or when FILE is -, read standard input.\n\
                      \n\
                      Mandatory arguments to long flags are mandatory for short flags too.\
                      ";
-const USAGE: &str = "{} [FLAG]... [FILE]...";
+const USAGE: &str = "{} [FLAG]... [FILE]...";
 
-mod options {
-    pub const BYTES_NAME: &str = "BYTES";
-    pub const LINES_NAME: &str = "LINES";
-    pub const QUIET_NAME: &str = "QUIET";
-    pub const VERBOSE_NAME: &str = "VERBOSE";
-    pub const ZERO_NAME: &str = "ZERO";
-    pub const FILES_NAME: &str = "FILE";
-    pub const PRESUME_INPUT_PIPE: &str = "-PRESUME-INPUT-PIPE";
+mod options {
+    pub const BYTES_NAME: &str = "BYTES";
+    pub const LINES_NAME: &str = "LINES";
+    pub const QUIET_NAME: &str = "QUIET";
+    pub const VERBOSE_NAME: &str = "VERBOSE";
+    pub const ZERO_NAME: &str = "ZERO";
+    pub const FILES_NAME: &str = "FILE";
+    pub const PRESUME_INPUT_PIPE: &str = "-PRESUME-INPUT-PIPE";
 }
-mod parse;
-mod take;
-use take::take_all_but;
-use take::take_lines;
+mod parse;
+mod take;
+use take::take_all_but;
+use take::take_lines;
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::BYTES_NAME)
-                .short('c')
-                .long("bytes")
-                .value_name("[-]NUM")
-                .help(
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::BYTES_NAME)
+                .short('c')
+                .long("bytes")
+                .value_name("[-]NUM")
+                .help(
                     "\
                      print the first NUM bytes of each file;\n\
                      with the leading '-', print all but the last\n\
                      NUM bytes of each file\
                      ",
                 )
-                .overrides_with_all([options::BYTES_NAME, options::LINES_NAME])
-                .allow_hyphen_values(true),
+                .overrides_with_all([options::BYTES_NAME, options::LINES_NAME])
+                .allow_hyphen_values(true),
         )
-        .arg(
-            Arg::new(options::LINES_NAME)
-                .short('n')
-                .long("lines")
-                .value_name("[-]NUM")
-                .help(
+        .arg(
+            Arg::new(options::LINES_NAME)
+                .short('n')
+                .long("lines")
+                .value_name("[-]NUM")
+                .help(
                     "\
                      print the first NUM lines instead of the first 10;\n\
                      with the leading '-', print all but the last\n\
                      NUM lines of each file\
                      ",
                 )
-                .overrides_with_all([options::LINES_NAME, options::BYTES_NAME])
-                .allow_hyphen_values(true),
+                .overrides_with_all([options::LINES_NAME, options::BYTES_NAME])
+                .allow_hyphen_values(true),
         )
-        .arg(
-            Arg::new(options::QUIET_NAME)
-                .short('q')
-                .long("quiet")
-                .visible_alias("silent")
-                .help("never print headers giving file names")
-                .overrides_with_all([options::VERBOSE_NAME, options::QUIET_NAME])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::QUIET_NAME)
+                .short('q')
+                .long("quiet")
+                .visible_alias("silent")
+                .help("never print headers giving file names")
+                .overrides_with_all([options::VERBOSE_NAME, options::QUIET_NAME])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::VERBOSE_NAME)
-                .short('v')
-                .long("verbose")
-                .help("always print headers giving file names")
-                .overrides_with_all([options::QUIET_NAME, options::VERBOSE_NAME])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::VERBOSE_NAME)
+                .short('v')
+                .long("verbose")
+                .help("always print headers giving file names")
+                .overrides_with_all([options::QUIET_NAME, options::VERBOSE_NAME])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PRESUME_INPUT_PIPE)
-                .long("presume-input-pipe")
-                .alias("-presume-input-pipe")
-                .hide(true)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PRESUME_INPUT_PIPE)
+                .long("presume-input-pipe")
+                .alias("-presume-input-pipe")
+                .hide(true)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ZERO_NAME)
-                .short('z')
-                .long("zero-terminated")
-                .help("line delimiter is NUL, not newline")
-                .overrides_with(options::ZERO_NAME)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO_NAME)
+                .short('z')
+                .long("zero-terminated")
+                .help("line delimiter is NUL, not newline")
+                .overrides_with(options::ZERO_NAME)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILES_NAME)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILES_NAME)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-#[derive(Debug, PartialEq)]
-enum Mode {
-    FirstLines(u64),
-    AllButLastLines(u64),
-    FirstBytes(u64),
-    AllButLastBytes(u64),
+#[derive(Debug, PartialEq)]
+enum Mode {
+    FirstLines(u64),
+    AllButLastLines(u64),
+    FirstBytes(u64),
+    AllButLastBytes(u64),
 }
 
-impl Default for Mode {
-    fn default() -> Self {
-        Self::FirstLines(10)
+impl Default for Mode {
+    fn default() -> Self {
+        Self::FirstLines(10)
     }
 }
 
-impl Mode {
-    fn from(matches: &ArgMatches) -> Result<Self, String> {
-        if let Some(v) = matches.get_one::<String>(options::BYTES_NAME) {
-            let (n, all_but_last) =
-                parse::parse_num(v).map_err(|err| format!("invalid number of bytes: {}", err))?;
-            if all_but_last {
-                Ok(Self::AllButLastBytes(n))
-            } else {
-                Ok(Self::FirstBytes(n))
+impl Mode {
+    fn from(matches: &ArgMatches) -> Result<Self, String> {
+        if let Some(v) = matches.get_one::<String>(options::BYTES_NAME) {
+            let (n, all_but_last) =
+                parse::parse_num(v).map_err(|err| format!("invalid number of bytes: {}", err))?;
+            if all_but_last {
+                Ok(Self::AllButLastBytes(n))
+            } else {
+                Ok(Self::FirstBytes(n))
             }
-        } else if let Some(v) = matches.get_one::<String>(options::LINES_NAME) {
-            let (n, all_but_last) =
-                parse::parse_num(v).map_err(|err| format!("invalid number of lines: {}", err))?;
-            if all_but_last {
-                Ok(Self::AllButLastLines(n))
-            } else {
-                Ok(Self::FirstLines(n))
+        } else if let Some(v) = matches.get_one::<String>(options::LINES_NAME) {
+            let (n, all_but_last) =
+                parse::parse_num(v).map_err(|err| format!("invalid number of lines: {}", err))?;
+            if all_but_last {
+                Ok(Self::AllButLastLines(n))
+            } else {
+                Ok(Self::FirstLines(n))
             }
-        } else {
-            Ok(Default::default())
+        } else {
+            Ok(Default::default())
         }
     }
 }
 
-fn arg_iterate<'a>(
-    mut args: impl uucore::Args + 'a,
-) -> UResult<Box<dyn Iterator<Item = OsString> + 'a>> {
-    // argv[0] is always present
-    let first = args.next().unwrap();
-    if let Some(second) = args.next() {
-        if let Some(s) = second.to_str() {
-            match parse::parse_obsolete(s) {
-                Some(Ok(iter)) => Ok(Box::new(vec![first].into_iter().chain(iter).chain(args))),
-                Some(Err(e)) => match e {
-                    parse::ParseError::Syntax => Err(USimpleError::new(
+fn arg_iterate<'a>(
+    mut args: impl uucore::Args + 'a,
+) -> UResult<Box<dyn Iterator<Item = OsString> + 'a>> {
+    // argv[0] is always present
+    let first = args.next().unwrap();
+    if let Some(second) = args.next() {
+        if let Some(s) = second.to_str() {
+            match parse::parse_obsolete(s) {
+                Some(Ok(iter)) => Ok(Box::new(vec![first].into_iter().chain(iter).chain(args))),
+                Some(Err(e)) => match e {
+                    parse::ParseError::Syntax => Err(USimpleError::new(
                         1,
-                        format!("bad argument format: {}", s.quote()),
+                        format!("bad argument format: {}", s.quote()),
                     )),
-                    parse::ParseError::Overflow => Err(USimpleError::new(
+                    parse::ParseError::Overflow => Err(USimpleError::new(
                         1,
                         format!(
                             "invalid argument: {} Value too large for defined datatype",
-                            s.quote()
+                            s.quote()
                         ),
                     )),
                 },
-                None => Ok(Box::new(vec![first, second].into_iter().chain(args))),
+                None => Ok(Box::new(vec![first, second].into_iter().chain(args))),
             }
-        } else {
-            Err(USimpleError::new(1, "bad argument encoding".to_owned()))
+        } else {
+            Err(USimpleError::new(1, "bad argument encoding".to_owned()))
         }
-    } else {
-        Ok(Box::new(vec![first].into_iter()))
+    } else {
+        Ok(Box::new(vec![first].into_iter()))
     }
 }
 
-#[derive(Debug, PartialEq, Default)]
-struct HeadOptions {
-    pub quiet: bool,
-    pub verbose: bool,
-    pub zeroed: bool,
-    pub presume_input_pipe: bool,
-    pub mode: Mode,
-    pub files: Vec<String>,
+#[derive(Debug, PartialEq, Default)]
+struct HeadOptions {
+    pub quiet: bool,
+    pub verbose: bool,
+    pub zeroed: bool,
+    pub presume_input_pipe: bool,
+    pub mode: Mode,
+    pub files: Vec<String>,
 }
 
-impl HeadOptions {
-    ///Construct options from matches
-    pub fn get_from(matches: &clap::ArgMatches) -> Result<Self, String> {
-        let mut options = Self::default();
+impl HeadOptions {
+    ///Construct options from matches
+    pub fn get_from(matches: &clap::ArgMatches) -> Result<Self, String> {
+        let mut options = Self::default();
 
-        options.quiet = matches.get_flag(options::QUIET_NAME);
-        options.verbose = matches.get_flag(options::VERBOSE_NAME);
-        options.zeroed = matches.get_flag(options::ZERO_NAME);
-        options.presume_input_pipe = matches.get_flag(options::PRESUME_INPUT_PIPE);
+        options.quiet = matches.get_flag(options::QUIET_NAME);
+        options.verbose = matches.get_flag(options::VERBOSE_NAME);
+        options.zeroed = matches.get_flag(options::ZERO_NAME);
+        options.presume_input_pipe = matches.get_flag(options::PRESUME_INPUT_PIPE);
 
-        options.mode = Mode::from(matches)?;
+        options.mode = Mode::from(matches)?;
 
-        options.files = match matches.get_many::<String>(options::FILES_NAME) {
-            Some(v) => v.map(|s| s.to_owned()).collect(),
-            None => vec!["-".to_owned()],
+        options.files = match matches.get_many::<String>(options::FILES_NAME) {
+            Some(v) => v.map(|s| s.to_owned()).collect(),
+            None => vec!["-".to_owned()],
         };
-        //println!("{:#?}", options);
-        Ok(options)
+        //println!("{:#?}", options);
+        Ok(options)
     }
 }
 
-fn read_n_bytes<R>(input: R, n: u64) -> std::io::Result<()>
-where
-    R: Read,
+fn read_n_bytes<R>(input: R, n: u64) -> std::io::Result<()>
+where
+    R: Read,
 {
-    // Read the first `n` bytes from the `input` reader.
-    let mut reader = input.take(n);
+    // Read the first `n` bytes from the `input` reader.
+    let mut reader = input.take(n);
 
-    // Write those bytes to `stdout`.
-    let stdout = std::io::stdout();
-    let mut stdout = stdout.lock();
+    // Write those bytes to `stdout`.
+    let stdout = std::io::stdout();
+    let mut stdout = stdout.lock();
 
-    io::copy(&mut reader, &mut stdout)?;
+    io::copy(&mut reader, &mut stdout)?;
 
     Ok(())
 }
 
-fn read_n_lines(input: &mut impl std::io::BufRead, n: u64, zero: bool) -> std::io::Result<()> {
-    // Read the first `n` lines from the `input` reader.
-    let separator = if zero { b'\0' } else { b'\n' };
-    let mut reader = take_lines(input, n, separator);
+fn read_n_lines(input: &mut impl std::io::BufRead, n: u64, zero: bool) -> std::io::Result<()> {
+    // Read the first `n` lines from the `input` reader.
+    let separator = if zero { b'\0' } else { b'\n' };
+    let mut reader = take_lines(input, n, separator);
 
-    // Write those bytes to `stdout`.
-    let stdout = std::io::stdout();
-    let stdout = stdout.lock();
-    let mut writer = BufWriter::with_capacity(BUFWRITER_CAPACITY, stdout);
+    // Write those bytes to `stdout`.
+    let stdout = std::io::stdout();
+    let stdout = stdout.lock();
+    let mut writer = BufWriter::with_capacity(BUFWRITER_CAPACITY, stdout);
 
-    io::copy(&mut reader, &mut writer)?;
+    io::copy(&mut reader, &mut writer)?;
 
     Ok(())
 }
 
-fn read_but_last_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io::Result<()> {
-    if n == 0 {
-        //prints everything
-        return read_n_bytes(input, std::u64::MAX);
+fn read_but_last_n_bytes(input: &mut impl std::io::BufRead, n: usize) -> std::io::Result<()> {
+    if n == 0 {
+        //prints everything
+        return read_n_bytes(input, std::u64::MAX);
     }
 
-    let stdout = std::io::stdout();
-    let mut stdout = stdout.lock();
+    let stdout = std::io::stdout();
+    let mut stdout = stdout.lock();
 
-    let mut ring_buffer = vec![0u8; n];
+    let mut ring_buffer = vec![0u8; n];
 
-    // first we fill the ring buffer
-    if let Err(e) = input.read_exact(&mut ring_buffer) {
-        if e.kind() == ErrorKind::UnexpectedEof {
-            return Ok(());
-        } else {
-            return Err(e);
+    // first we fill the ring buffer
+    if let Err(e) = input.read_exact(&mut ring_buffer) {
+        if e.kind() == ErrorKind::UnexpectedEof {
+            return Ok(());
+        } else {
+            return Err(e);
         }
     }
-    let mut buffer = [0u8; BUF_SIZE];
-    loop {
-        let read = loop {
-            match input.read(&mut buffer) {
-                Ok(n) => break n,
-                Err(e) => match e.kind() {
-                    ErrorKind::Interrupted => {}
-                    _ => return Err(e),
+    let mut buffer = [0u8; BUF_SIZE];
+    loop {
+        let read = loop {
+            match input.read(&mut buffer) {
+                Ok(n) => break n,
+                Err(e) => match e.kind() {
+                    ErrorKind::Interrupted => {}
+                    _ => return Err(e),
                 },
             }
         };
-        if read == 0 {
-            return Ok(());
-        } else if read >= n {
-            stdout.write_all(&ring_buffer)?;
-            stdout.write_all(&buffer[..read - n])?;
-            for i in 0..n {
-                ring_buffer[i] = buffer[read - n + i];
+        if read == 0 {
+            return Ok(());
+        } else if read >= n {
+            stdout.write_all(&ring_buffer)?;
+            stdout.write_all(&buffer[..read - n])?;
+            for i in 0..n {
+                ring_buffer[i] = buffer[read - n + i];
             }
-        } else {
-            stdout.write_all(&ring_buffer[..read])?;
-            for i in 0..n - read {
-                ring_buffer[i] = ring_buffer[read + i];
+        } else {
+            stdout.write_all(&ring_buffer[..read])?;
+            for i in 0..n - read {
+                ring_buffer[i] = ring_buffer[read + i];
             }
-            ring_buffer[n - read..].copy_from_slice(&buffer[..read]);
+            ring_buffer[n - read..].copy_from_slice(&buffer[..read]);
         }
     }
 }
 
-fn read_but_last_n_lines(
-    input: impl std::io::BufRead,
-    n: usize,
-    zero: bool,
-) -> std::io::Result<()> {
-    if zero {
-        let stdout = std::io::stdout();
-        let mut stdout = stdout.lock();
-        for bytes in take_all_but(lines(input, b'\0'), n) {
-            stdout.write_all(&bytes?)?;
+fn read_but_last_n_lines(
+    input: impl std::io::BufRead,
+    n: usize,
+    zero: bool,
+) -> std::io::Result<()> {
+    if zero {
+        let stdout = std::io::stdout();
+        let mut stdout = stdout.lock();
+        for bytes in take_all_but(lines(input, b'\0'), n) {
+            stdout.write_all(&bytes?)?;
         }
-    } else {
-        let stdout = std::io::stdout();
-        let mut stdout = stdout.lock();
-        for bytes in take_all_but(lines(input, b'\n'), n) {
-            stdout.write_all(&bytes?)?;
+    } else {
+        let stdout = std::io::stdout();
+        let mut stdout = stdout.lock();
+        for bytes in take_all_but(lines(input, b'\n'), n) {
+            stdout.write_all(&bytes?)?;
         }
     }
     Ok(())
 }
 
-/// Return the index in `input` just after the `n`th line from the end.
-///
-/// If `n` exceeds the number of lines in this file, then return 0.
-///
-/// The cursor must be at the start of the seekable input before
-/// calling this function. This function rewinds the cursor to the
-/// beginning of the input just before returning unless there is an
-/// I/O error.
-///
-/// If `zeroed` is `false`, interpret the newline character `b'\n'` as
-/// a line ending. If `zeroed` is `true`, interpret the null character
-/// `b'\0'` as a line ending instead.
-///
-/// # Errors
-///
-/// This function returns an error if there is a problem seeking
-/// through or reading the input.
-///
-/// # Examples
-///
-/// The function returns the index of the byte immediately following
-/// the line ending character of the `n`th line from the end of the
-/// input:
-///
-/// ```rust,ignore
-/// let mut input = Cursor::new("x\ny\nz\n");
-/// assert_eq!(find_nth_line_from_end(&mut input, 0, false).unwrap(), 6);
-/// assert_eq!(find_nth_line_from_end(&mut input, 1, false).unwrap(), 4);
-/// assert_eq!(find_nth_line_from_end(&mut input, 2, false).unwrap(), 2);
-/// ```
-///
-/// If `n` exceeds the number of lines in the file, always return 0:
-///
-/// ```rust,ignore
-/// let mut input = Cursor::new("x\ny\nz\n");
-/// assert_eq!(find_nth_line_from_end(&mut input, 3, false).unwrap(), 0);
-/// assert_eq!(find_nth_line_from_end(&mut input, 4, false).unwrap(), 0);
-/// assert_eq!(find_nth_line_from_end(&mut input, 1000, false).unwrap(), 0);
-/// ```
-fn find_nth_line_from_end<R>(input: &mut R, n: u64, zeroed: bool) -> std::io::Result<u64>
-where
-    R: Read + Seek,
+/// Return the index in `input` just after the `n`th line from the end.
+///
+/// If `n` exceeds the number of lines in this file, then return 0.
+///
+/// The cursor must be at the start of the seekable input before
+/// calling this function. This function rewinds the cursor to the
+/// beginning of the input just before returning unless there is an
+/// I/O error.
+///
+/// If `zeroed` is `false`, interpret the newline character `b'\n'` as
+/// a line ending. If `zeroed` is `true`, interpret the null character
+/// `b'\0'` as a line ending instead.
+///
+/// # Errors
+///
+/// This function returns an error if there is a problem seeking
+/// through or reading the input.
+///
+/// # Examples
+///
+/// The function returns the index of the byte immediately following
+/// the line ending character of the `n`th line from the end of the
+/// input:
+///
+/// ```rust,ignore
+/// let mut input = Cursor::new("x\ny\nz\n");
+/// assert_eq!(find_nth_line_from_end(&mut input, 0, false).unwrap(), 6);
+/// assert_eq!(find_nth_line_from_end(&mut input, 1, false).unwrap(), 4);
+/// assert_eq!(find_nth_line_from_end(&mut input, 2, false).unwrap(), 2);
+/// ```
+///
+/// If `n` exceeds the number of lines in the file, always return 0:
+///
+/// ```rust,ignore
+/// let mut input = Cursor::new("x\ny\nz\n");
+/// assert_eq!(find_nth_line_from_end(&mut input, 3, false).unwrap(), 0);
+/// assert_eq!(find_nth_line_from_end(&mut input, 4, false).unwrap(), 0);
+/// assert_eq!(find_nth_line_from_end(&mut input, 1000, false).unwrap(), 0);
+/// ```
+fn find_nth_line_from_end<R>(input: &mut R, n: u64, zeroed: bool) -> std::io::Result<u64>
+where
+    R: Read + Seek,
 {
-    let size = input.seek(SeekFrom::End(0))?;
+    let size = input.seek(SeekFrom::End(0))?;
 
-    let mut buffer = [0u8; BUF_SIZE];
-    let buf_size: usize = (BUF_SIZE as u64).min(size).try_into().unwrap();
-    let buffer = &mut buffer[..buf_size];
+    let mut buffer = [0u8; BUF_SIZE];
+    let buf_size: usize = (BUF_SIZE as u64).min(size).try_into().unwrap();
+    let buffer = &mut buffer[..buf_size];
 
-    let mut i = 0u64;
-    let mut lines = 0u64;
+    let mut i = 0u64;
+    let mut lines = 0u64;
 
-    loop {
-        // the casts here are ok, `buffer.len()` should never be above a few k
-        input.seek(SeekFrom::Current(
-            -((buffer.len() as i64).min((size - i) as i64)),
+    loop {
+        // the casts here are ok, `buffer.len()` should never be above a few k
+        input.seek(SeekFrom::Current(
+            -((buffer.len() as i64).min((size - i) as i64)),
         ))?;
-        input.read_exact(buffer)?;
-        for byte in buffer.iter().rev() {
-            match byte {
-                b'\n' if !zeroed => {
-                    lines += 1;
+        input.read_exact(buffer)?;
+        for byte in buffer.iter().rev() {
+            match byte {
+                b'\n' if !zeroed => {
+                    lines += 1;
                 }
-                0u8 if zeroed => {
-                    lines += 1;
+                0u8 if zeroed => {
+                    lines += 1;
                 }
-                _ => {}
+                _ => {}
             }
-            // if it were just `n`,
-            if lines == n + 1 {
-                input.seek(SeekFrom::Start(0))?;
-                return Ok(size - i);
+            // if it were just `n`,
+            if lines == n + 1 {
+                input.seek(SeekFrom::Start(0))?;
+                return Ok(size - i);
             }
-            i += 1;
+            i += 1;
         }
-        if size - i == 0 {
-            input.seek(SeekFrom::Start(0))?;
-            return Ok(0);
+        if size - i == 0 {
+            input.seek(SeekFrom::Start(0))?;
+            return Ok(0);
         }
     }
 }
 
-fn head_backwards_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Result<()> {
-    match options.mode {
-        Mode::AllButLastBytes(n) => {
-            let size = input.metadata()?.len();
-            if n >= size {
-                return Ok(());
-            } else {
-                read_n_bytes(
-                    &mut std::io::BufReader::with_capacity(BUF_SIZE, input),
-                    size - n,
+fn head_backwards_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Result<()> {
+    match options.mode {
+        Mode::AllButLastBytes(n) => {
+            let size = input.metadata()?.len();
+            if n >= size {
+                return Ok(());
+            } else {
+                read_n_bytes(
+                    &mut std::io::BufReader::with_capacity(BUF_SIZE, input),
+                    size - n,
                 )?;
             }
         }
-        Mode::AllButLastLines(n) => {
-            let found = find_nth_line_from_end(input, n, options.zeroed)?;
-            read_n_bytes(
-                &mut std::io::BufReader::with_capacity(BUF_SIZE, input),
-                found,
+        Mode::AllButLastLines(n) => {
+            let found = find_nth_line_from_end(input, n, options.zeroed)?;
+            read_n_bytes(
+                &mut std::io::BufReader::with_capacity(BUF_SIZE, input),
+                found,
             )?;
         }
-        _ => unreachable!(),
+        _ => unreachable!(),
     }
     Ok(())
 }
 
-fn head_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Result<()> {
-    match options.mode {
-        Mode::FirstBytes(n) => {
-            read_n_bytes(&mut std::io::BufReader::with_capacity(BUF_SIZE, input), n)
+fn head_file(input: &mut std::fs::File, options: &HeadOptions) -> std::io::Result<()> {
+    match options.mode {
+        Mode::FirstBytes(n) => {
+            read_n_bytes(&mut std::io::BufReader::with_capacity(BUF_SIZE, input), n)
         }
-        Mode::FirstLines(n) => read_n_lines(
-            &mut std::io::BufReader::with_capacity(BUF_SIZE, input),
-            n,
-            options.zeroed,
+        Mode::FirstLines(n) => read_n_lines(
+            &mut std::io::BufReader::with_capacity(BUF_SIZE, input),
+            n,
+            options.zeroed,
         ),
-        Mode::AllButLastBytes(_) | Mode::AllButLastLines(_) => head_backwards_file(input, options),
+        Mode::AllButLastBytes(_) | Mode::AllButLastLines(_) => head_backwards_file(input, options),
     }
 }
 
-fn uu_head(options: &HeadOptions) -> UResult<()> {
-    let mut first = true;
-    for file in &options.files {
-        let res = match (file.as_str(), options.presume_input_pipe) {
-            (_, true) | ("-", false) => {
-                if (options.files.len() > 1 && !options.quiet) || options.verbose {
-                    if !first {
+fn uu_head(options: &HeadOptions) -> UResult<()> {
+    let mut first = true;
+    for file in &options.files {
+        let res = match (file.as_str(), options.presume_input_pipe) {
+            (_, true) | ("-", false) => {
+                if (options.files.len() > 1 && !options.quiet) || options.verbose {
+                    if !first {
                         println!();
                     }
                     println!("==> standard input <==");
                 }
-                let stdin = std::io::stdin();
-                let mut stdin = stdin.lock();
+                let stdin = std::io::stdin();
+                let mut stdin = stdin.lock();
 
-                // Outputting "all-but-last" requires us to use a ring buffer with size n, so n
-                // must be converted from u64 to usize to fit in memory. If such conversion fails,
-                // it means the platform doesn't have enough memory to hold the buffer, so we fail.
-                if let Mode::AllButLastLines(n) | Mode::AllButLastBytes(n) = options.mode {
-                    if let Err(e) = usize::try_from(n) {
-                        show!(USimpleError::new(
+                // Outputting "all-but-last" requires us to use a ring buffer with size n, so n
+                // must be converted from u64 to usize to fit in memory. If such conversion fails,
+                // it means the platform doesn't have enough memory to hold the buffer, so we fail.
+                if let Mode::AllButLastLines(n) | Mode::AllButLastBytes(n) = options.mode {
+                    if let Err(e) = usize::try_from(n) {
+                        show!(USimpleError::new(
                             1,
-                            format!("{}: number of bytes is too large", e)
+                            format!("{}: number of bytes is too large", e)
                         ));
                         continue;
                     };
                 };
 
-                match options.mode {
-                    Mode::FirstBytes(n) => read_n_bytes(&mut stdin, n),
-                    // unwrap is guaranteed to succeed because we checked the value of n above
-                    Mode::AllButLastBytes(n) => {
-                        read_but_last_n_bytes(&mut stdin, n.try_into().unwrap())
+                match options.mode {
+                    Mode::FirstBytes(n) => read_n_bytes(&mut stdin, n),
+                    // unwrap is guaranteed to succeed because we checked the value of n above
+                    Mode::AllButLastBytes(n) => {
+                        read_but_last_n_bytes(&mut stdin, n.try_into().unwrap())
                     }
-                    Mode::FirstLines(n) => read_n_lines(&mut stdin, n, options.zeroed),
-                    // unwrap is guaranteed to succeed because we checked the value of n above
-                    Mode::AllButLastLines(n) => {
-                        read_but_last_n_lines(&mut stdin, n.try_into().unwrap(), options.zeroed)
+                    Mode::FirstLines(n) => read_n_lines(&mut stdin, n, options.zeroed),
+                    // unwrap is guaranteed to succeed because we checked the value of n above
+                    Mode::AllButLastLines(n) => {
+                        read_but_last_n_lines(&mut stdin, n.try_into().unwrap(), options.zeroed)
                     }
                 }
             }
-            (name, false) => {
-                let mut file = match std::fs::File::open(name) {
-                    Ok(f) => f,
-                    Err(err) => {
-                        show!(err.map_err_context(|| format!(
+            (name, false) => {
+                let mut file = match std::fs::File::open(name) {
+                    Ok(f) => f,
+                    Err(err) => {
+                        show!(err.map_err_context(|| format!(
                             "cannot open {} for reading",
-                            name.quote()
+                            name.quote()
                         )));
                         continue;
                     }
                 };
-                if (options.files.len() > 1 && !options.quiet) || options.verbose {
-                    if !first {
+                if (options.files.len() > 1 && !options.quiet) || options.verbose {
+                    if !first {
                         println!();
                     }
-                    println!("==> {} <==", name);
+                    println!("==> {} <==", name);
                 }
-                head_file(&mut file, options)
+                head_file(&mut file, options)
             }
         };
-        if res.is_err() {
-            let name = if file.as_str() == "-" {
-                "standard input"
-            } else {
-                file
+        if res.is_err() {
+            let name = if file.as_str() == "-" {
+                "standard input"
+            } else {
+                file
             };
-            show!(USimpleError::new(
+            show!(USimpleError::new(
                 1,
-                format!("error reading {}: Input/output error", name)
+                format!("error reading {}: Input/output error", name)
             ));
         }
-        first = false;
+        first = false;
     }
-    // Even though this is returning `Ok`, it is possible that a call
-    // to `show!()` and thus a call to `set_exit_code()` has been
-    // called above. If that happens, then this process will exit with
-    // a non-zero exit code.
-    Ok(())
+    // Even though this is returning `Ok`, it is possible that a call
+    // to `show!()` and thus a call to `set_exit_code()` has been
+    // called above. If that happens, then this process will exit with
+    // a non-zero exit code.
+    Ok(())
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(arg_iterate(args)?)?;
-    let args = match HeadOptions::get_from(&matches) {
-        Ok(o) => o,
-        Err(s) => {
-            return Err(USimpleError::new(1, s));
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(arg_iterate(args)?)?;
+    let args = match HeadOptions::get_from(&matches) {
+        Ok(o) => o,
+        Err(s) => {
+            return Err(USimpleError::new(1, s));
         }
     };
-    uu_head(&args)
+    uu_head(&args)
 }
 
-#[cfg(test)]
-mod tests {
-    use std::ffi::OsString;
-    use std::io::Cursor;
+#[cfg(test)]
+mod tests {
+    use std::ffi::OsString;
+    use std::io::Cursor;
 
-    use super::*;
-    fn options(args: &str) -> Result<HeadOptions, String> {
-        let combined = "head ".to_owned() + args;
-        let args = combined.split_whitespace().map(OsString::from);
-        let matches = uu_app()
-            .get_matches_from(arg_iterate(args).map_err(|_| String::from("Arg iterate failed"))?);
-        HeadOptions::get_from(&matches)
+    use super::*;
+    fn options(args: &str) -> Result<HeadOptions, String> {
+        let combined = "head ".to_owned() + args;
+        let args = combined.split_whitespace().map(OsString::from);
+        let matches = uu_app()
+            .get_matches_from(arg_iterate(args).map_err(|_| String::from("Arg iterate failed"))?);
+        HeadOptions::get_from(&matches)
     }
-    #[test]
-    fn test_args_modes() {
-        let args = options("-n -10M -vz").unwrap();
-        assert!(args.zeroed);
-        assert!(args.verbose);
-        assert_eq!(args.mode, Mode::AllButLastLines(10 * 1024 * 1024));
+    #[test]
+    fn test_args_modes() {
+        let args = options("-n -10M -vz").unwrap();
+        assert!(args.zeroed);
+        assert!(args.verbose);
+        assert_eq!(args.mode, Mode::AllButLastLines(10 * 1024 * 1024));
     }
-    #[test]
-    fn test_gnu_compatibility() {
-        let args = options("-n 1 -c 1 -n 5 -c kiB -vqvqv").unwrap(); // spell-checker:disable-line
-        assert!(args.mode == Mode::FirstBytes(1024));
-        assert!(args.verbose);
-        assert_eq!(options("-5").unwrap().mode, Mode::FirstLines(5));
-        assert_eq!(options("-2b").unwrap().mode, Mode::FirstBytes(1024));
-        assert_eq!(options("-5 -c 1").unwrap().mode, Mode::FirstBytes(1));
+    #[test]
+    fn test_gnu_compatibility() {
+        let args = options("-n 1 -c 1 -n 5 -c kiB -vqvqv").unwrap(); // spell-checker:disable-line
+        assert!(args.mode == Mode::FirstBytes(1024));
+        assert!(args.verbose);
+        assert_eq!(options("-5").unwrap().mode, Mode::FirstLines(5));
+        assert_eq!(options("-2b").unwrap().mode, Mode::FirstBytes(1024));
+        assert_eq!(options("-5 -c 1").unwrap().mode, Mode::FirstBytes(1));
     }
-    #[test]
-    fn all_args_test() {
-        assert!(options("--silent").unwrap().quiet);
-        assert!(options("--quiet").unwrap().quiet);
-        assert!(options("-q").unwrap().quiet);
-        assert!(options("--verbose").unwrap().verbose);
-        assert!(options("-v").unwrap().verbose);
-        assert!(options("--zero-terminated").unwrap().zeroed);
-        assert!(options("-z").unwrap().zeroed);
-        assert_eq!(options("--lines 15").unwrap().mode, Mode::FirstLines(15));
-        assert_eq!(options("-n 15").unwrap().mode, Mode::FirstLines(15));
-        assert_eq!(options("--bytes 15").unwrap().mode, Mode::FirstBytes(15));
-        assert_eq!(options("-c 15").unwrap().mode, Mode::FirstBytes(15));
+    #[test]
+    fn all_args_test() {
+        assert!(options("--silent").unwrap().quiet);
+        assert!(options("--quiet").unwrap().quiet);
+        assert!(options("-q").unwrap().quiet);
+        assert!(options("--verbose").unwrap().verbose);
+        assert!(options("-v").unwrap().verbose);
+        assert!(options("--zero-terminated").unwrap().zeroed);
+        assert!(options("-z").unwrap().zeroed);
+        assert_eq!(options("--lines 15").unwrap().mode, Mode::FirstLines(15));
+        assert_eq!(options("-n 15").unwrap().mode, Mode::FirstLines(15));
+        assert_eq!(options("--bytes 15").unwrap().mode, Mode::FirstBytes(15));
+        assert_eq!(options("-c 15").unwrap().mode, Mode::FirstBytes(15));
     }
-    #[test]
-    fn test_options_errors() {
-        assert!(options("-n IsThisTheRealLife?").is_err());
-        assert!(options("-c IsThisJustFantasy").is_err());
+    #[test]
+    fn test_options_errors() {
+        assert!(options("-n IsThisTheRealLife?").is_err());
+        assert!(options("-c IsThisJustFantasy").is_err());
     }
-    #[test]
-    fn test_options_correct_defaults() {
-        let opts: HeadOptions = Default::default();
+    #[test]
+    fn test_options_correct_defaults() {
+        let opts: HeadOptions = Default::default();
 
-        assert!(!opts.verbose);
-        assert!(!opts.quiet);
-        assert!(!opts.zeroed);
-        assert_eq!(opts.mode, Mode::FirstLines(10));
-        assert!(opts.files.is_empty());
+        assert!(!opts.verbose);
+        assert!(!opts.quiet);
+        assert!(!opts.zeroed);
+        assert_eq!(opts.mode, Mode::FirstLines(10));
+        assert!(opts.files.is_empty());
     }
-    fn arg_outputs(src: &str) -> Result<String, ()> {
-        let split = src.split_whitespace().map(OsString::from);
-        match arg_iterate(split) {
-            Ok(args) => {
-                let vec = args
-                    .map(|s| s.to_str().unwrap().to_owned())
-                    .collect::<Vec<_>>();
-                Ok(vec.join(" "))
+    fn arg_outputs(src: &str) -> Result<String, ()> {
+        let split = src.split_whitespace().map(OsString::from);
+        match arg_iterate(split) {
+            Ok(args) => {
+                let vec = args
+                    .map(|s| s.to_str().unwrap().to_owned())
+                    .collect::<Vec<_>>();
+                Ok(vec.join(" "))
             }
             Err(_) => Err(()),
         }
     }
-    #[test]
-    fn test_arg_iterate() {
-        // test that normal args remain unchanged
-        assert_eq!(
-            arg_outputs("head -n -5 -zv"),
-            Ok("head -n -5 -zv".to_owned())
+    #[test]
+    fn test_arg_iterate() {
+        // test that normal args remain unchanged
+        assert_eq!(
+            arg_outputs("head -n -5 -zv"),
+            Ok("head -n -5 -zv".to_owned())
         );
-        // tests that nonsensical args are unchanged
-        assert_eq!(
-            arg_outputs("head -to_be_or_not_to_be,..."),
-            Ok("head -to_be_or_not_to_be,...".to_owned())
+        // tests that nonsensical args are unchanged
+        assert_eq!(
+            arg_outputs("head -to_be_or_not_to_be,..."),
+            Ok("head -to_be_or_not_to_be,...".to_owned())
         );
-        //test that the obsolete syntax is unrolled
-        assert_eq!(
-            arg_outputs("head -123qvqvqzc"), // spell-checker:disable-line
-            Ok("head -q -z -c 123".to_owned())
+        //test that the obsolete syntax is unrolled
+        assert_eq!(
+            arg_outputs("head -123qvqvqzc"), // spell-checker:disable-line
+            Ok("head -q -z -c 123".to_owned())
         );
-        //test that bad obsoletes are an error
-        assert!(arg_outputs("head -123FooBar").is_err());
-        //test overflow
-        assert!(arg_outputs("head -100000000000000000000000000000000000000000").is_err());
-        //test that empty args remain unchanged
-        assert_eq!(arg_outputs("head"), Ok("head".to_owned()));
+        //test that bad obsoletes are an error
+        assert!(arg_outputs("head -123FooBar").is_err());
+        //test overflow
+        assert!(arg_outputs("head -100000000000000000000000000000000000000000").is_err());
+        //test that empty args remain unchanged
+        assert_eq!(arg_outputs("head"), Ok("head".to_owned()));
     }
-    #[test]
-    #[cfg(target_os = "linux")]
-    fn test_arg_iterate_bad_encoding() {
-        #[allow(clippy::invalid_utf8_in_unchecked)]
-        let invalid = unsafe { std::str::from_utf8_unchecked(b"\x80\x81") };
-        // this arises from a conversion from OsString to &str
-        assert!(
-            arg_iterate(vec![OsString::from("head"), OsString::from(invalid)].into_iter()).is_err()
+    #[test]
+    #[cfg(target_os = "linux")]
+    fn test_arg_iterate_bad_encoding() {
+        #[allow(clippy::invalid_utf8_in_unchecked)]
+        let invalid = unsafe { std::str::from_utf8_unchecked(b"\x80\x81") };
+        // this arises from a conversion from OsString to &str
+        assert!(
+            arg_iterate(vec![OsString::from("head"), OsString::from(invalid)].into_iter()).is_err()
         );
     }
-    #[test]
-    fn read_early_exit() {
-        let mut empty = std::io::BufReader::new(std::io::Cursor::new(Vec::new()));
-        assert!(read_n_bytes(&mut empty, 0).is_ok());
-        assert!(read_n_lines(&mut empty, 0, false).is_ok());
+    #[test]
+    fn read_early_exit() {
+        let mut empty = std::io::BufReader::new(std::io::Cursor::new(Vec::new()));
+        assert!(read_n_bytes(&mut empty, 0).is_ok());
+        assert!(read_n_lines(&mut empty, 0, false).is_ok());
     }
 
-    #[test]
-    fn test_find_nth_line_from_end() {
-        let mut input = Cursor::new("x\ny\nz\n");
-        assert_eq!(find_nth_line_from_end(&mut input, 0, false).unwrap(), 6);
-        assert_eq!(find_nth_line_from_end(&mut input, 1, false).unwrap(), 4);
-        assert_eq!(find_nth_line_from_end(&mut input, 2, false).unwrap(), 2);
-        assert_eq!(find_nth_line_from_end(&mut input, 3, false).unwrap(), 0);
-        assert_eq!(find_nth_line_from_end(&mut input, 4, false).unwrap(), 0);
-        assert_eq!(find_nth_line_from_end(&mut input, 1000, false).unwrap(), 0);
+    #[test]
+    fn test_find_nth_line_from_end() {
+        let mut input = Cursor::new("x\ny\nz\n");
+        assert_eq!(find_nth_line_from_end(&mut input, 0, false).unwrap(), 6);
+        assert_eq!(find_nth_line_from_end(&mut input, 1, false).unwrap(), 4);
+        assert_eq!(find_nth_line_from_end(&mut input, 2, false).unwrap(), 2);
+        assert_eq!(find_nth_line_from_end(&mut input, 3, false).unwrap(), 0);
+        assert_eq!(find_nth_line_from_end(&mut input, 4, false).unwrap(), 0);
+        assert_eq!(find_nth_line_from_end(&mut input, 1000, false).unwrap(), 0);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_head/parse.rs.html b/dev/src/uu_head/parse.rs.html index c33897e67..7821944ac 100644 --- a/dev/src/uu_head/parse.rs.html +++ b/dev/src/uu_head/parse.rs.html @@ -1,4 +1,4 @@ -parse.rs - source
1
+parse.rs - source
1
 2
 3
 4
@@ -180,187 +180,187 @@
 180
 181
 182
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-use std::ffi::OsString;
-use uucore::parse_size::{parse_size, ParseSizeError};
+use std::ffi::OsString;
+use uucore::parse_size::{parse_size, ParseSizeError};
 
-#[derive(PartialEq, Eq, Debug)]
-pub enum ParseError {
-    Syntax,
-    Overflow,
+#[derive(PartialEq, Eq, Debug)]
+pub enum ParseError {
+    Syntax,
+    Overflow,
 }
-/// Parses obsolete syntax
-/// head -NUM\[kmzv\] // spell-checker:disable-line
-pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>, ParseError>> {
-    let mut chars = src.char_indices();
-    if let Some((_, '-')) = chars.next() {
-        let mut num_end = 0usize;
-        let mut has_num = false;
-        let mut last_char = 0 as char;
-        for (n, c) in &mut chars {
-            if c.is_ascii_digit() {
-                has_num = true;
-                num_end = n;
-            } else {
-                last_char = c;
+/// Parses obsolete syntax
+/// head -NUM\[kmzv\] // spell-checker:disable-line
+pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>, ParseError>> {
+    let mut chars = src.char_indices();
+    if let Some((_, '-')) = chars.next() {
+        let mut num_end = 0usize;
+        let mut has_num = false;
+        let mut last_char = 0 as char;
+        for (n, c) in &mut chars {
+            if c.is_ascii_digit() {
+                has_num = true;
+                num_end = n;
+            } else {
+                last_char = c;
                 break;
             }
         }
-        if has_num {
-            match src[1..=num_end].parse::<usize>() {
-                Ok(num) => {
-                    let mut quiet = false;
-                    let mut verbose = false;
-                    let mut zero_terminated = false;
-                    let mut multiplier = None;
-                    let mut c = last_char;
-                    loop {
-                        // not that here, we only match lower case 'k', 'c', and 'm'
-                        match c {
-                            // we want to preserve order
-                            // this also saves us 1 heap allocation
-                            'q' => {
-                                quiet = true;
-                                verbose = false;
+        if has_num {
+            match src[1..=num_end].parse::<usize>() {
+                Ok(num) => {
+                    let mut quiet = false;
+                    let mut verbose = false;
+                    let mut zero_terminated = false;
+                    let mut multiplier = None;
+                    let mut c = last_char;
+                    loop {
+                        // not that here, we only match lower case 'k', 'c', and 'm'
+                        match c {
+                            // we want to preserve order
+                            // this also saves us 1 heap allocation
+                            'q' => {
+                                quiet = true;
+                                verbose = false;
                             }
-                            'v' => {
-                                verbose = true;
-                                quiet = false;
+                            'v' => {
+                                verbose = true;
+                                quiet = false;
                             }
-                            'z' => zero_terminated = true,
-                            'c' => multiplier = Some(1),
-                            'b' => multiplier = Some(512),
-                            'k' => multiplier = Some(1024),
-                            'm' => multiplier = Some(1024 * 1024),
-                            '\0' => {}
-                            _ => return Some(Err(ParseError::Syntax)),
+                            'z' => zero_terminated = true,
+                            'c' => multiplier = Some(1),
+                            'b' => multiplier = Some(512),
+                            'k' => multiplier = Some(1024),
+                            'm' => multiplier = Some(1024 * 1024),
+                            '\0' => {}
+                            _ => return Some(Err(ParseError::Syntax)),
                         }
-                        if let Some((_, next)) = chars.next() {
-                            c = next;
-                        } else {
+                        if let Some((_, next)) = chars.next() {
+                            c = next;
+                        } else {
                             break;
                         }
                     }
-                    let mut options = Vec::new();
-                    if quiet {
-                        options.push(OsString::from("-q"));
+                    let mut options = Vec::new();
+                    if quiet {
+                        options.push(OsString::from("-q"));
                     }
-                    if verbose {
-                        options.push(OsString::from("-v"));
+                    if verbose {
+                        options.push(OsString::from("-v"));
                     }
-                    if zero_terminated {
-                        options.push(OsString::from("-z"));
+                    if zero_terminated {
+                        options.push(OsString::from("-z"));
                     }
-                    if let Some(n) = multiplier {
-                        options.push(OsString::from("-c"));
-                        let num = match num.checked_mul(n) {
-                            Some(n) => n,
-                            None => return Some(Err(ParseError::Overflow)),
+                    if let Some(n) = multiplier {
+                        options.push(OsString::from("-c"));
+                        let num = match num.checked_mul(n) {
+                            Some(n) => n,
+                            None => return Some(Err(ParseError::Overflow)),
                         };
-                        options.push(OsString::from(format!("{}", num)));
-                    } else {
-                        options.push(OsString::from("-n"));
-                        options.push(OsString::from(format!("{}", num)));
+                        options.push(OsString::from(format!("{}", num)));
+                    } else {
+                        options.push(OsString::from("-n"));
+                        options.push(OsString::from(format!("{}", num)));
                     }
-                    Some(Ok(options.into_iter()))
+                    Some(Ok(options.into_iter()))
                 }
-                Err(_) => Some(Err(ParseError::Overflow)),
+                Err(_) => Some(Err(ParseError::Overflow)),
             }
-        } else {
-            None
-        }
-    } else {
-        None
-    }
+        } else {
+            None
+        }
+    } else {
+        None
+    }
 }
-/// Parses an -c or -n argument,
-/// the bool specifies whether to read from the end
-pub fn parse_num(src: &str) -> Result<(u64, bool), ParseSizeError> {
-    let mut size_string = src.trim();
-    let mut all_but_last = false;
+/// Parses an -c or -n argument,
+/// the bool specifies whether to read from the end
+pub fn parse_num(src: &str) -> Result<(u64, bool), ParseSizeError> {
+    let mut size_string = src.trim();
+    let mut all_but_last = false;
 
-    if let Some(c) = size_string.chars().next() {
-        if c == '+' || c == '-' {
-            // head: '+' is not documented (8.32 man pages)
-            size_string = &size_string[1..];
-            if c == '-' {
-                all_but_last = true;
+    if let Some(c) = size_string.chars().next() {
+        if c == '+' || c == '-' {
+            // head: '+' is not documented (8.32 man pages)
+            size_string = &size_string[1..];
+            if c == '-' {
+                all_but_last = true;
             }
         }
-    } else {
-        return Err(ParseSizeError::ParseFailure(src.to_string()));
+    } else {
+        return Err(ParseSizeError::ParseFailure(src.to_string()));
     }
 
-    parse_size(size_string).map(|n| (n, all_but_last))
+    parse_size(size_string).map(|n| (n, all_but_last))
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    fn obsolete(src: &str) -> Option<Result<Vec<String>, ParseError>> {
-        let r = parse_obsolete(src);
-        match r {
-            Some(s) => match s {
-                Ok(v) => Some(Ok(v.map(|s| s.to_str().unwrap().to_owned()).collect())),
-                Err(e) => Some(Err(e)),
+#[cfg(test)]
+mod tests {
+    use super::*;
+    fn obsolete(src: &str) -> Option<Result<Vec<String>, ParseError>> {
+        let r = parse_obsolete(src);
+        match r {
+            Some(s) => match s {
+                Ok(v) => Some(Ok(v.map(|s| s.to_str().unwrap().to_owned()).collect())),
+                Err(e) => Some(Err(e)),
             },
-            None => None,
+            None => None,
         }
     }
-    fn obsolete_result(src: &[&str]) -> Option<Result<Vec<String>, ParseError>> {
-        Some(Ok(src.iter().map(|s| s.to_string()).collect()))
+    fn obsolete_result(src: &[&str]) -> Option<Result<Vec<String>, ParseError>> {
+        Some(Ok(src.iter().map(|s| s.to_string()).collect()))
     }
-    #[test]
-    fn test_parse_numbers_obsolete() {
-        assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"]));
-        assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"]));
-        assert_eq!(obsolete("-5m"), obsolete_result(&["-c", "5242880"]));
-        assert_eq!(obsolete("-1k"), obsolete_result(&["-c", "1024"]));
-        assert_eq!(obsolete("-2b"), obsolete_result(&["-c", "1024"]));
-        assert_eq!(obsolete("-1mmk"), obsolete_result(&["-c", "1024"]));
-        assert_eq!(obsolete("-1vz"), obsolete_result(&["-v", "-z", "-n", "1"]));
+    #[test]
+    fn test_parse_numbers_obsolete() {
+        assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"]));
+        assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"]));
+        assert_eq!(obsolete("-5m"), obsolete_result(&["-c", "5242880"]));
+        assert_eq!(obsolete("-1k"), obsolete_result(&["-c", "1024"]));
+        assert_eq!(obsolete("-2b"), obsolete_result(&["-c", "1024"]));
+        assert_eq!(obsolete("-1mmk"), obsolete_result(&["-c", "1024"]));
+        assert_eq!(obsolete("-1vz"), obsolete_result(&["-v", "-z", "-n", "1"]));
         assert_eq!(
-            obsolete("-1vzqvq"), // spell-checker:disable-line
-            obsolete_result(&["-q", "-z", "-n", "1"])
+            obsolete("-1vzqvq"), // spell-checker:disable-line
+            obsolete_result(&["-q", "-z", "-n", "1"])
         );
-        assert_eq!(obsolete("-1vzc"), obsolete_result(&["-v", "-z", "-c", "1"]));
+        assert_eq!(obsolete("-1vzc"), obsolete_result(&["-v", "-z", "-c", "1"]));
         assert_eq!(
-            obsolete("-105kzm"),
-            obsolete_result(&["-z", "-c", "110100480"])
+            obsolete("-105kzm"),
+            obsolete_result(&["-z", "-c", "110100480"])
         );
     }
-    #[test]
-    fn test_parse_errors_obsolete() {
-        assert_eq!(obsolete("-5n"), Some(Err(ParseError::Syntax)));
-        assert_eq!(obsolete("-5c5"), Some(Err(ParseError::Syntax)));
+    #[test]
+    fn test_parse_errors_obsolete() {
+        assert_eq!(obsolete("-5n"), Some(Err(ParseError::Syntax)));
+        assert_eq!(obsolete("-5c5"), Some(Err(ParseError::Syntax)));
     }
-    #[test]
-    fn test_parse_obsolete_no_match() {
-        assert_eq!(obsolete("-k"), None);
-        assert_eq!(obsolete("asd"), None);
+    #[test]
+    fn test_parse_obsolete_no_match() {
+        assert_eq!(obsolete("-k"), None);
+        assert_eq!(obsolete("asd"), None);
     }
-    #[test]
-    #[cfg(target_pointer_width = "64")]
-    fn test_parse_obsolete_overflow_x64() {
+    #[test]
+    #[cfg(target_pointer_width = "64")]
+    fn test_parse_obsolete_overflow_x64() {
         assert_eq!(
-            obsolete("-1000000000000000m"),
-            Some(Err(ParseError::Overflow))
+            obsolete("-1000000000000000m"),
+            Some(Err(ParseError::Overflow))
         );
         assert_eq!(
-            obsolete("-10000000000000000000000"),
-            Some(Err(ParseError::Overflow))
+            obsolete("-10000000000000000000000"),
+            Some(Err(ParseError::Overflow))
         );
     }
-    #[test]
-    #[cfg(target_pointer_width = "32")]
-    fn test_parse_obsolete_overflow_x32() {
-        assert_eq!(obsolete("-42949672960"), Some(Err(ParseError::Overflow)));
-        assert_eq!(obsolete("-42949672k"), Some(Err(ParseError::Overflow)));
+    #[test]
+    #[cfg(target_pointer_width = "32")]
+    fn test_parse_obsolete_overflow_x32() {
+        assert_eq!(obsolete("-42949672960"), Some(Err(ParseError::Overflow)));
+        assert_eq!(obsolete("-42949672k"), Some(Err(ParseError::Overflow)));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_head/take.rs.html b/dev/src/uu_head/take.rs.html index 288577487..f584c9bd4 100644 --- a/dev/src/uu_head/take.rs.html +++ b/dev/src/uu_head/take.rs.html @@ -1,4 +1,4 @@ -take.rs - source
1
+take.rs - source
1
 2
 3
 4
@@ -177,184 +177,184 @@
 177
 178
 179
-
//! Take all but the last elements of an iterator.
-use std::io::Read;
+
//! Take all but the last elements of an iterator.
+use std::io::Read;
 
-use memchr::memchr_iter;
+use memchr::memchr_iter;
 
-use uucore::ringbuffer::RingBuffer;
+use uucore::ringbuffer::RingBuffer;
 
-/// Create an iterator over all but the last `n` elements of `iter`.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// let data = [1, 2, 3, 4, 5];
-/// let n = 2;
-/// let mut iter = take_all_but(data.iter(), n);
-/// assert_eq!(Some(4), iter.next());
-/// assert_eq!(Some(5), iter.next());
-/// assert_eq!(None, iter.next());
-/// ```
-pub fn take_all_but<I: Iterator>(iter: I, n: usize) -> TakeAllBut<I> {
-    TakeAllBut::new(iter, n)
+/// Create an iterator over all but the last `n` elements of `iter`.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// let data = [1, 2, 3, 4, 5];
+/// let n = 2;
+/// let mut iter = take_all_but(data.iter(), n);
+/// assert_eq!(Some(4), iter.next());
+/// assert_eq!(Some(5), iter.next());
+/// assert_eq!(None, iter.next());
+/// ```
+pub fn take_all_but<I: Iterator>(iter: I, n: usize) -> TakeAllBut<I> {
+    TakeAllBut::new(iter, n)
 }
 
-/// An iterator that only iterates over the last elements of another iterator.
-pub struct TakeAllBut<I: Iterator> {
-    iter: I,
-    buf: RingBuffer<<I as Iterator>::Item>,
+/// An iterator that only iterates over the last elements of another iterator.
+pub struct TakeAllBut<I: Iterator> {
+    iter: I,
+    buf: RingBuffer<<I as Iterator>::Item>,
 }
 
-impl<I: Iterator> TakeAllBut<I> {
-    pub fn new(mut iter: I, n: usize) -> Self {
-        // Create a new ring buffer and fill it up.
-        //
-        // If there are fewer than `n` elements in `iter`, then we
-        // exhaust the iterator so that whenever `TakeAllBut::next()` is
-        // called, it will return `None`, as expected.
-        let mut buf = RingBuffer::new(n);
-        for _ in 0..n {
-            let value = match iter.next() {
-                None => {
+impl<I: Iterator> TakeAllBut<I> {
+    pub fn new(mut iter: I, n: usize) -> Self {
+        // Create a new ring buffer and fill it up.
+        //
+        // If there are fewer than `n` elements in `iter`, then we
+        // exhaust the iterator so that whenever `TakeAllBut::next()` is
+        // called, it will return `None`, as expected.
+        let mut buf = RingBuffer::new(n);
+        for _ in 0..n {
+            let value = match iter.next() {
+                None => {
                     break;
                 }
-                Some(x) => x,
+                Some(x) => x,
             };
-            buf.push_back(value);
+            buf.push_back(value);
         }
-        Self { iter, buf }
+        Self { iter, buf }
     }
 }
 
-impl<I: Iterator> Iterator for TakeAllBut<I>
-where
-    I: Iterator,
+impl<I: Iterator> Iterator for TakeAllBut<I>
+where
+    I: Iterator,
 {
-    type Item = <I as Iterator>::Item;
+    type Item = <I as Iterator>::Item;
 
-    fn next(&mut self) -> Option<<I as Iterator>::Item> {
-        match self.iter.next() {
-            Some(value) => self.buf.push_back(value),
-            None => None,
+    fn next(&mut self) -> Option<<I as Iterator>::Item> {
+        match self.iter.next() {
+            Some(value) => self.buf.push_back(value),
+            None => None,
         }
     }
 }
 
-/// Like `std::io::Take`, but for lines instead of bytes.
-///
-/// This struct is generally created by calling [`take_lines`] on a
-/// reader. Please see the documentation of [`take_lines`] for more
-/// details.
-pub struct TakeLines<T> {
-    inner: T,
-    limit: u64,
-    separator: u8,
+/// Like `std::io::Take`, but for lines instead of bytes.
+///
+/// This struct is generally created by calling [`take_lines`] on a
+/// reader. Please see the documentation of [`take_lines`] for more
+/// details.
+pub struct TakeLines<T> {
+    inner: T,
+    limit: u64,
+    separator: u8,
 }
 
-impl<T: Read> Read for TakeLines<T> {
-    /// Read bytes from a buffer up to the requested number of lines.
-    fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
-        if self.limit == 0 {
-            return Ok(0);
+impl<T: Read> Read for TakeLines<T> {
+    /// Read bytes from a buffer up to the requested number of lines.
+    fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
+        if self.limit == 0 {
+            return Ok(0);
         }
-        match self.inner.read(buf) {
+        match self.inner.read(buf) {
             Ok(0) => Ok(0),
-            Ok(n) => {
-                for i in memchr_iter(self.separator, &buf[..n]) {
-                    self.limit -= 1;
-                    if self.limit == 0 {
-                        return Ok(i + 1);
+            Ok(n) => {
+                for i in memchr_iter(self.separator, &buf[..n]) {
+                    self.limit -= 1;
+                    if self.limit == 0 {
+                        return Ok(i + 1);
                     }
                 }
-                Ok(n)
+                Ok(n)
             }
-            Err(e) => Err(e),
+            Err(e) => Err(e),
         }
     }
 }
 
-/// Create an adaptor that will read at most `limit` lines from a given reader.
-///
-/// This function returns a new instance of `Read` that will read at
-/// most `limit` lines, after which it will always return EOF
-/// (`Ok(0)`).
-///
-/// The `separator` defines the character to interpret as the line
-/// ending. For the usual notion of "line", set this to `b'\n'`.
-pub fn take_lines<R>(reader: R, limit: u64, separator: u8) -> TakeLines<R> {
-    TakeLines {
-        inner: reader,
-        limit,
-        separator,
+/// Create an adaptor that will read at most `limit` lines from a given reader.
+///
+/// This function returns a new instance of `Read` that will read at
+/// most `limit` lines, after which it will always return EOF
+/// (`Ok(0)`).
+///
+/// The `separator` defines the character to interpret as the line
+/// ending. For the usual notion of "line", set this to `b'\n'`.
+pub fn take_lines<R>(reader: R, limit: u64, separator: u8) -> TakeLines<R> {
+    TakeLines {
+        inner: reader,
+        limit,
+        separator,
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use std::io::BufRead;
-    use std::io::BufReader;
+    use std::io::BufRead;
+    use std::io::BufReader;
 
-    use crate::take::take_all_but;
-    use crate::take::take_lines;
+    use crate::take::take_all_but;
+    use crate::take::take_lines;
 
-    #[test]
-    fn test_fewer_elements() {
-        let mut iter = take_all_but([0, 1, 2].iter(), 2);
-        assert_eq!(Some(&0), iter.next());
-        assert_eq!(None, iter.next());
+    #[test]
+    fn test_fewer_elements() {
+        let mut iter = take_all_but([0, 1, 2].iter(), 2);
+        assert_eq!(Some(&0), iter.next());
+        assert_eq!(None, iter.next());
     }
 
-    #[test]
-    fn test_same_number_of_elements() {
-        let mut iter = take_all_but([0, 1].iter(), 2);
-        assert_eq!(None, iter.next());
+    #[test]
+    fn test_same_number_of_elements() {
+        let mut iter = take_all_but([0, 1].iter(), 2);
+        assert_eq!(None, iter.next());
     }
 
-    #[test]
-    fn test_more_elements() {
-        let mut iter = take_all_but([0].iter(), 2);
-        assert_eq!(None, iter.next());
+    #[test]
+    fn test_more_elements() {
+        let mut iter = take_all_but([0].iter(), 2);
+        assert_eq!(None, iter.next());
     }
 
-    #[test]
-    fn test_zero_elements() {
-        let mut iter = take_all_but([0, 1, 2].iter(), 0);
-        assert_eq!(Some(&0), iter.next());
-        assert_eq!(Some(&1), iter.next());
-        assert_eq!(Some(&2), iter.next());
-        assert_eq!(None, iter.next());
+    #[test]
+    fn test_zero_elements() {
+        let mut iter = take_all_but([0, 1, 2].iter(), 0);
+        assert_eq!(Some(&0), iter.next());
+        assert_eq!(Some(&1), iter.next());
+        assert_eq!(Some(&2), iter.next());
+        assert_eq!(None, iter.next());
     }
 
-    #[test]
-    fn test_zero_lines() {
-        let input_reader = std::io::Cursor::new("a\nb\nc\n");
-        let output_reader = BufReader::new(take_lines(input_reader, 0, b'\n'));
-        let mut iter = output_reader.lines().map(|l| l.unwrap());
-        assert_eq!(None, iter.next());
+    #[test]
+    fn test_zero_lines() {
+        let input_reader = std::io::Cursor::new("a\nb\nc\n");
+        let output_reader = BufReader::new(take_lines(input_reader, 0, b'\n'));
+        let mut iter = output_reader.lines().map(|l| l.unwrap());
+        assert_eq!(None, iter.next());
     }
 
-    #[test]
-    fn test_fewer_lines() {
-        let input_reader = std::io::Cursor::new("a\nb\nc\n");
-        let output_reader = BufReader::new(take_lines(input_reader, 2, b'\n'));
-        let mut iter = output_reader.lines().map(|l| l.unwrap());
-        assert_eq!(Some(String::from("a")), iter.next());
-        assert_eq!(Some(String::from("b")), iter.next());
-        assert_eq!(None, iter.next());
+    #[test]
+    fn test_fewer_lines() {
+        let input_reader = std::io::Cursor::new("a\nb\nc\n");
+        let output_reader = BufReader::new(take_lines(input_reader, 2, b'\n'));
+        let mut iter = output_reader.lines().map(|l| l.unwrap());
+        assert_eq!(Some(String::from("a")), iter.next());
+        assert_eq!(Some(String::from("b")), iter.next());
+        assert_eq!(None, iter.next());
     }
 
-    #[test]
-    fn test_more_lines() {
-        let input_reader = std::io::Cursor::new("a\nb\nc\n");
-        let output_reader = BufReader::new(take_lines(input_reader, 4, b'\n'));
-        let mut iter = output_reader.lines().map(|l| l.unwrap());
-        assert_eq!(Some(String::from("a")), iter.next());
-        assert_eq!(Some(String::from("b")), iter.next());
-        assert_eq!(Some(String::from("c")), iter.next());
-        assert_eq!(None, iter.next());
+    #[test]
+    fn test_more_lines() {
+        let input_reader = std::io::Cursor::new("a\nb\nc\n");
+        let output_reader = BufReader::new(take_lines(input_reader, 4, b'\n'));
+        let mut iter = output_reader.lines().map(|l| l.unwrap());
+        assert_eq!(Some(String::from("a")), iter.next());
+        assert_eq!(Some(String::from("b")), iter.next());
+        assert_eq!(Some(String::from("c")), iter.next());
+        assert_eq!(None, iter.next());
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_hostid/hostid.rs.html b/dev/src/uu_hostid/hostid.rs.html index 3c274c0a3..8f308b15e 100644 --- a/dev/src/uu_hostid/hostid.rs.html +++ b/dev/src/uu_hostid/hostid.rs.html @@ -1,4 +1,4 @@ -hostid.rs - source
1
+hostid.rs - source
1
 2
 3
 4
@@ -52,59 +52,59 @@
 52
 53
 54
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Maciej Dziardziel <fiedzia@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE file
-//  * that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Maciej Dziardziel <fiedzia@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE file
+//  * that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) gethostid
+// spell-checker:ignore (ToDO) gethostid
 
-use clap::{crate_version, Command};
-use libc::c_long;
-use uucore::{error::UResult, format_usage};
+use clap::{crate_version, Command};
+use libc::c_long;
+use uucore::{error::UResult, format_usage};
 
-const USAGE: &str = "{} [options]";
-const ABOUT: &str = "Print the numeric identifier (in hexadecimal) for the current host";
+const USAGE: &str = "{} [options]";
+const ABOUT: &str = "Print the numeric identifier (in hexadecimal) for the current host";
 
-// currently rust libc interface doesn't include gethostid
-extern "C" {
-    pub fn gethostid() -> c_long;
+// currently rust libc interface doesn't include gethostid
+extern "C" {
+    pub fn gethostid() -> c_long;
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    uu_app().get_matches_from(args);
-    hostid();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    uu_app().get_matches_from(args);
+    hostid();
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
 }
 
-fn hostid() {
+fn hostid() {
     /*
      * POSIX says gethostid returns a "32-bit identifier" but is silent
      * whether it's sign-extended.  Turn off any sign-extension.  This
      * is a no-op unless unsigned int is wider than 32 bits.
-     */
+     */
 
-    let mut result: c_long;
-    unsafe {
-        result = gethostid();
+    let mut result: c_long;
+    unsafe {
+        result = gethostid();
     }
 
-    #[allow(overflowing_literals)]
-    let mask = 0xffff_ffff;
+    #[allow(overflowing_literals)]
+    let mask = 0xffff_ffff;
 
-    result &= mask;
-    println!("{:0>8x}", result);
+    result &= mask;
+    println!("{:0>8x}", result);
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_hostname/hostname.rs.html b/dev/src/uu_hostname/hostname.rs.html index 16c047a9a..3df5591a8 100644 --- a/dev/src/uu_hostname/hostname.rs.html +++ b/dev/src/uu_hostname/hostname.rs.html @@ -1,4 +1,4 @@ -hostname.rs - source
1
+hostname.rs - source
1
 2
 3
 4
@@ -169,176 +169,176 @@
 169
 170
 171
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alan Andrade <alan.andradec@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alan Andrade <alan.andradec@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) MAKEWORD addrs hashset
+// spell-checker:ignore (ToDO) MAKEWORD addrs hashset
 
-use std::net::ToSocketAddrs;
-use std::str;
-use std::{collections::hash_set::HashSet, ffi::OsString};
+use std::net::ToSocketAddrs;
+use std::str;
+use std::{collections::hash_set::HashSet, ffi::OsString};
 
-use clap::builder::ValueParser;
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use clap::builder::ValueParser;
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
 
-use uucore::{
-    error::{FromIo, UResult},
-    format_usage,
+use uucore::{
+    error::{FromIo, UResult},
+    format_usage,
 };
 
-static ABOUT: &str = "Display or set the system's host name.";
-const USAGE: &str = "{} [OPTION]... [HOSTNAME]";
+static ABOUT: &str = "Display or set the system's host name.";
+const USAGE: &str = "{} [OPTION]... [HOSTNAME]";
 
-static OPT_DOMAIN: &str = "domain";
-static OPT_IP_ADDRESS: &str = "ip-address";
-static OPT_FQDN: &str = "fqdn";
-static OPT_SHORT: &str = "short";
-static OPT_HOST: &str = "host";
+static OPT_DOMAIN: &str = "domain";
+static OPT_IP_ADDRESS: &str = "ip-address";
+static OPT_FQDN: &str = "fqdn";
+static OPT_SHORT: &str = "short";
+static OPT_HOST: &str = "host";
 
-#[cfg(windows)]
-mod wsa {
-    use std::io;
+#[cfg(windows)]
+mod wsa {
+    use std::io;
 
-    use windows_sys::Win32::Networking::WinSock::{WSACleanup, WSAStartup, WSADATA};
+    use windows_sys::Win32::Networking::WinSock::{WSACleanup, WSAStartup, WSADATA};
 
-    pub(super) struct WsaHandle(());
+    pub(super) struct WsaHandle(());
 
-    pub(super) fn start() -> io::Result<WsaHandle> {
-        let err = unsafe {
-            let mut data = std::mem::MaybeUninit::<WSADATA>::uninit();
-            WSAStartup(0x0202, data.as_mut_ptr())
+    pub(super) fn start() -> io::Result<WsaHandle> {
+        let err = unsafe {
+            let mut data = std::mem::MaybeUninit::<WSADATA>::uninit();
+            WSAStartup(0x0202, data.as_mut_ptr())
         };
-        if err != 0 {
-            Err(io::Error::from_raw_os_error(err))
-        } else {
-            Ok(WsaHandle(()))
+        if err != 0 {
+            Err(io::Error::from_raw_os_error(err))
+        } else {
+            Ok(WsaHandle(()))
         }
     }
 
-    impl Drop for WsaHandle {
-        fn drop(&mut self) {
-            unsafe {
-                // This possibly returns an error but we can't handle it
-                let _err = WSACleanup();
+    impl Drop for WsaHandle {
+        fn drop(&mut self) {
+            unsafe {
+                // This possibly returns an error but we can't handle it
+                let _err = WSACleanup();
             }
         }
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    #[cfg(windows)]
-    let _handle = wsa::start().map_err_context(|| "failed to start Winsock".to_owned())?;
+    #[cfg(windows)]
+    let _handle = wsa::start().map_err_context(|| "failed to start Winsock".to_owned())?;
 
-    match matches.get_one::<OsString>(OPT_HOST) {
-        None => display_hostname(&matches),
-        Some(host) => hostname::set(host).map_err_context(|| "failed to set hostname".to_owned()),
+    match matches.get_one::<OsString>(OPT_HOST) {
+        None => display_hostname(&matches),
+        Some(host) => hostname::set(host).map_err_context(|| "failed to set hostname".to_owned()),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_DOMAIN)
-                .short('d')
-                .long("domain")
-                .overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
-                .help("Display the name of the DNS domain if possible")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_DOMAIN)
+                .short('d')
+                .long("domain")
+                .overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
+                .help("Display the name of the DNS domain if possible")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_IP_ADDRESS)
-                .short('i')
-                .long("ip-address")
-                .overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
-                .help("Display the network address(es) of the host")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_IP_ADDRESS)
+                .short('i')
+                .long("ip-address")
+                .overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
+                .help("Display the network address(es) of the host")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_FQDN)
-                .short('f')
-                .long("fqdn")
-                .overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
-                .help("Display the FQDN (Fully Qualified Domain Name) (default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_FQDN)
+                .short('f')
+                .long("fqdn")
+                .overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
+                .help("Display the FQDN (Fully Qualified Domain Name) (default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_SHORT)
-                .short('s')
-                .long("short")
-                .overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
-                .help("Display the short hostname (the portion before the first dot) if possible")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_SHORT)
+                .short('s')
+                .long("short")
+                .overrides_with_all([OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
+                .help("Display the short hostname (the portion before the first dot) if possible")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_HOST)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::Hostname),
+        .arg(
+            Arg::new(OPT_HOST)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::Hostname),
         )
 }
 
-fn display_hostname(matches: &ArgMatches) -> UResult<()> {
-    let hostname = hostname::get()
-        .map_err_context(|| "failed to get hostname".to_owned())?
-        .to_string_lossy()
-        .into_owned();
+fn display_hostname(matches: &ArgMatches) -> UResult<()> {
+    let hostname = hostname::get()
+        .map_err_context(|| "failed to get hostname".to_owned())?
+        .to_string_lossy()
+        .into_owned();
 
-    if matches.get_flag(OPT_IP_ADDRESS) {
-        // XXX: to_socket_addrs needs hostname:port so append a dummy port and remove it later.
-        // This was originally supposed to use std::net::lookup_host, but that seems to be
-        // deprecated.  Perhaps we should use the dns-lookup crate?
-        let hostname = hostname + ":1";
-        let addresses = hostname
-            .to_socket_addrs()
-            .map_err_context(|| "failed to resolve socket addresses".to_owned())?;
-        let mut hashset = HashSet::new();
-        let mut output = String::new();
-        for addr in addresses {
-            // XXX: not sure why this is necessary...
-            if !hashset.contains(&addr) {
-                let mut ip = addr.to_string();
-                if ip.ends_with(":1") {
-                    let len = ip.len();
-                    ip.truncate(len - 2);
+    if matches.get_flag(OPT_IP_ADDRESS) {
+        // XXX: to_socket_addrs needs hostname:port so append a dummy port and remove it later.
+        // This was originally supposed to use std::net::lookup_host, but that seems to be
+        // deprecated.  Perhaps we should use the dns-lookup crate?
+        let hostname = hostname + ":1";
+        let addresses = hostname
+            .to_socket_addrs()
+            .map_err_context(|| "failed to resolve socket addresses".to_owned())?;
+        let mut hashset = HashSet::new();
+        let mut output = String::new();
+        for addr in addresses {
+            // XXX: not sure why this is necessary...
+            if !hashset.contains(&addr) {
+                let mut ip = addr.to_string();
+                if ip.ends_with(":1") {
+                    let len = ip.len();
+                    ip.truncate(len - 2);
                 }
-                output.push_str(&ip);
-                output.push(' ');
-                hashset.insert(addr);
+                output.push_str(&ip);
+                output.push(' ');
+                hashset.insert(addr);
             }
         }
-        let len = output.len();
-        if len > 0 {
-            println!("{}", &output[0..len - 1]);
+        let len = output.len();
+        if len > 0 {
+            println!("{}", &output[0..len - 1]);
         }
 
         Ok(())
-    } else {
-        if matches.get_flag(OPT_SHORT) || matches.get_flag(OPT_DOMAIN) {
-            let mut it = hostname.char_indices().filter(|&ci| ci.1 == '.');
-            if let Some(ci) = it.next() {
-                if matches.get_flag(OPT_SHORT) {
-                    println!("{}", &hostname[0..ci.0]);
-                } else {
-                    println!("{}", &hostname[ci.0 + 1..]);
+    } else {
+        if matches.get_flag(OPT_SHORT) || matches.get_flag(OPT_DOMAIN) {
+            let mut it = hostname.char_indices().filter(|&ci| ci.1 == '.');
+            if let Some(ci) = it.next() {
+                if matches.get_flag(OPT_SHORT) {
+                    println!("{}", &hostname[0..ci.0]);
+                } else {
+                    println!("{}", &hostname[ci.0 + 1..]);
                 }
-                return Ok(());
+                return Ok(());
             }
         }
 
-        println!("{}", hostname);
+        println!("{}", hostname);
 
         Ok(())
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_id/id.rs.html b/dev/src/uu_id/id.rs.html index 62714682f..0be3b3a54 100644 --- a/dev/src/uu_id/id.rs.html +++ b/dev/src/uu_id/id.rs.html @@ -1,4 +1,4 @@ -id.rs - source
1
+id.rs - source
1
 2
 3
 4
@@ -683,340 +683,340 @@
 683
 684
 685
-
// This file is part of the uutils coreutils package.
-//
-// (c) Alan Andrade <alan.andradec@gmail.com>
-// (c) Jian Zeng <anonymousknight96 AT gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Alan Andrade <alan.andradec@gmail.com>
+// (c) Jian Zeng <anonymousknight96 AT gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag zflag cflag
+// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag gsflag zflag cflag
 
-// README:
-// This was originally based on BSD's `id`
-// (noticeable in functionality, usage text, options text, etc.)
-// and synced with:
-//  http://ftp-archive.freebsd.org/mirror/FreeBSD-Archive/old-releases/i386/1.0-RELEASE/ports/shellutils/src/id.c
-//  http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c
-//
-// * This was partially rewritten in order for stdout/stderr/exit_code
-//   to be conform with GNU coreutils (8.32) test suite for `id`.
-//
-// * This supports multiple users (a feature that was introduced in coreutils 8.31)
-//
-// * This passes GNU's coreutils Test suite (8.32)
-//   for "tests/id/uid.sh" and "tests/id/zero/sh".
-//
-// * Option '--zero' does not exist for BSD's `id`, therefore '--zero' is only
-//   allowed together with other options that are available on GNU's `id`.
-//
-// * Help text based on BSD's `id` manpage and GNU's `id` manpage.
-//
-// * This passes GNU's coreutils Test suite (8.32) for "tests/id/context.sh" if compiled with
-//   `--features feat_selinux`. It should also pass "tests/id/no-context.sh", but that depends on
-//   `uu_ls -Z` being implemented and therefore fails at the moment
-//
+// README:
+// This was originally based on BSD's `id`
+// (noticeable in functionality, usage text, options text, etc.)
+// and synced with:
+//  http://ftp-archive.freebsd.org/mirror/FreeBSD-Archive/old-releases/i386/1.0-RELEASE/ports/shellutils/src/id.c
+//  http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c
+//
+// * This was partially rewritten in order for stdout/stderr/exit_code
+//   to be conform with GNU coreutils (8.32) test suite for `id`.
+//
+// * This supports multiple users (a feature that was introduced in coreutils 8.31)
+//
+// * This passes GNU's coreutils Test suite (8.32)
+//   for "tests/id/uid.sh" and "tests/id/zero/sh".
+//
+// * Option '--zero' does not exist for BSD's `id`, therefore '--zero' is only
+//   allowed together with other options that are available on GNU's `id`.
+//
+// * Help text based on BSD's `id` manpage and GNU's `id` manpage.
+//
+// * This passes GNU's coreutils Test suite (8.32) for "tests/id/context.sh" if compiled with
+//   `--features feat_selinux`. It should also pass "tests/id/no-context.sh", but that depends on
+//   `uu_ls -Z` being implemented and therefore fails at the moment
+//
 
-#![allow(non_camel_case_types)]
-#![allow(dead_code)]
+#![allow(non_camel_case_types)]
+#![allow(dead_code)]
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::ffi::CStr;
-use uucore::display::Quotable;
-use uucore::entries::{self, Group, Locate, Passwd};
-use uucore::error::UResult;
-use uucore::error::{set_exit_code, USimpleError};
-use uucore::format_usage;
-pub use uucore::libc;
-use uucore::libc::{getlogin, uid_t};
-use uucore::process::{getegid, geteuid, getgid, getuid};
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::ffi::CStr;
+use uucore::display::Quotable;
+use uucore::entries::{self, Group, Locate, Passwd};
+use uucore::error::UResult;
+use uucore::error::{set_exit_code, USimpleError};
+use uucore::format_usage;
+pub use uucore::libc;
+use uucore::libc::{getlogin, uid_t};
+use uucore::process::{getegid, geteuid, getgid, getuid};
 
-macro_rules! cstr2cow {
-    ($v:expr) => {
-        unsafe { CStr::from_ptr($v).to_string_lossy() }
+macro_rules! cstr2cow {
+    ($v:expr) => {
+        unsafe { CStr::from_ptr($v).to_string_lossy() }
     };
 }
 
-static ABOUT: &str = "Print user and group information for each specified USER,
+static ABOUT: &str = "Print user and group information for each specified USER,
 or (when USER omitted) for the current user.";
-const USAGE: &str = "{} [OPTION]... [USER]...";
+const USAGE: &str = "{} [OPTION]... [USER]...";
 
-#[cfg(not(feature = "selinux"))]
-static CONTEXT_HELP_TEXT: &str = "print only the security context of the process (not enabled)";
-#[cfg(feature = "selinux")]
-static CONTEXT_HELP_TEXT: &str = "print only the security context of the process";
+#[cfg(not(feature = "selinux"))]
+static CONTEXT_HELP_TEXT: &str = "print only the security context of the process (not enabled)";
+#[cfg(feature = "selinux")]
+static CONTEXT_HELP_TEXT: &str = "print only the security context of the process";
 
-mod options {
-    pub const OPT_AUDIT: &str = "audit"; // GNU's id does not have this
-    pub const OPT_CONTEXT: &str = "context";
-    pub const OPT_EFFECTIVE_USER: &str = "user";
-    pub const OPT_GROUP: &str = "group";
-    pub const OPT_GROUPS: &str = "groups";
-    pub const OPT_HUMAN_READABLE: &str = "human-readable"; // GNU's id does not have this
-    pub const OPT_NAME: &str = "name";
-    pub const OPT_PASSWORD: &str = "password"; // GNU's id does not have this
-    pub const OPT_REAL_ID: &str = "real";
-    pub const OPT_ZERO: &str = "zero"; // BSD's id does not have this
-    pub const ARG_USERS: &str = "USER";
+mod options {
+    pub const OPT_AUDIT: &str = "audit"; // GNU's id does not have this
+    pub const OPT_CONTEXT: &str = "context";
+    pub const OPT_EFFECTIVE_USER: &str = "user";
+    pub const OPT_GROUP: &str = "group";
+    pub const OPT_GROUPS: &str = "groups";
+    pub const OPT_HUMAN_READABLE: &str = "human-readable"; // GNU's id does not have this
+    pub const OPT_NAME: &str = "name";
+    pub const OPT_PASSWORD: &str = "password"; // GNU's id does not have this
+    pub const OPT_REAL_ID: &str = "real";
+    pub const OPT_ZERO: &str = "zero"; // BSD's id does not have this
+    pub const ARG_USERS: &str = "USER";
 }
 
-fn get_description() -> &'static str {
+fn get_description() -> &'static str {
     "The id utility displays the user and group names and numeric IDs, of the \
     calling process, to the standard output. If the real and effective IDs are \
     different, both are displayed, otherwise only the real ID is displayed.\n\n\
     If a user (login name or user ID) is specified, the user and group IDs of \
     that user are displayed. In this case, the real and effective IDs are \
-    assumed to be the same."
+    assumed to be the same."
+}
+
+struct Ids {
+    uid: u32,  // user id
+    gid: u32,  // group id
+    euid: u32, // effective uid
+    egid: u32, // effective gid
+}
+
+struct State {
+    nflag: bool,  // --name
+    uflag: bool,  // --user
+    gflag: bool,  // --group
+    gsflag: bool, // --groups
+    rflag: bool,  // --real
+    zflag: bool,  // --zero
+    cflag: bool,  // --context
+    selinux_supported: bool,
+    ids: Option<Ids>,
+    // The behavior for calling GNU's `id` and calling GNU's `id $USER` is similar but different.
+    // * The SELinux context is only displayed without a specified user.
+    // * The `getgroups` system call is only used without a specified user, this causes
+    //   the order of the displayed groups to be different between `id` and `id $USER`.
+    //
+    // Example:
+    // $ strace -e getgroups id -G $USER
+    // 1000 10 975 968
+    // +++ exited with 0 +++
+    // $ strace -e getgroups id -G
+    // getgroups(0, NULL)                      = 4
+    // getgroups(4, [10, 968, 975, 1000])      = 4
+    // 1000 10 968 975
+    // +++ exited with 0 +++
+    user_specified: bool,
 }
 
-struct Ids {
-    uid: u32,  // user id
-    gid: u32,  // group id
-    euid: u32, // effective uid
-    egid: u32, // effective gid
-}
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app()
+        .after_help(get_description())
+        .try_get_matches_from(args)?;
 
-struct State {
-    nflag: bool,  // --name
-    uflag: bool,  // --user
-    gflag: bool,  // --group
-    gsflag: bool, // --groups
-    rflag: bool,  // --real
-    zflag: bool,  // --zero
-    cflag: bool,  // --context
-    selinux_supported: bool,
-    ids: Option<Ids>,
-    // The behavior for calling GNU's `id` and calling GNU's `id $USER` is similar but different.
-    // * The SELinux context is only displayed without a specified user.
-    // * The `getgroups` system call is only used without a specified user, this causes
-    //   the order of the displayed groups to be different between `id` and `id $USER`.
-    //
-    // Example:
-    // $ strace -e getgroups id -G $USER
-    // 1000 10 975 968
-    // +++ exited with 0 +++
-    // $ strace -e getgroups id -G
-    // getgroups(0, NULL)                      = 4
-    // getgroups(4, [10, 968, 975, 1000])      = 4
-    // 1000 10 968 975
-    // +++ exited with 0 +++
-    user_specified: bool,
-}
+    let users: Vec<String> = matches
+        .get_many::<String>(options::ARG_USERS)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app()
-        .after_help(get_description())
-        .try_get_matches_from(args)?;
+    let mut state = State {
+        nflag: matches.get_flag(options::OPT_NAME),
+        uflag: matches.get_flag(options::OPT_EFFECTIVE_USER),
+        gflag: matches.get_flag(options::OPT_GROUP),
+        gsflag: matches.get_flag(options::OPT_GROUPS),
+        rflag: matches.get_flag(options::OPT_REAL_ID),
+        zflag: matches.get_flag(options::OPT_ZERO),
+        cflag: matches.get_flag(options::OPT_CONTEXT),
 
-    let users: Vec<String> = matches
-        .get_many::<String>(options::ARG_USERS)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
-
-    let mut state = State {
-        nflag: matches.get_flag(options::OPT_NAME),
-        uflag: matches.get_flag(options::OPT_EFFECTIVE_USER),
-        gflag: matches.get_flag(options::OPT_GROUP),
-        gsflag: matches.get_flag(options::OPT_GROUPS),
-        rflag: matches.get_flag(options::OPT_REAL_ID),
-        zflag: matches.get_flag(options::OPT_ZERO),
-        cflag: matches.get_flag(options::OPT_CONTEXT),
-
-        selinux_supported: {
-            #[cfg(feature = "selinux")]
-            {
-                selinux::kernel_support() != selinux::KernelSupport::Unsupported
-            }
-            #[cfg(not(feature = "selinux"))]
-            {
-                false
+        selinux_supported: {
+            #[cfg(feature = "selinux")]
+            {
+                selinux::kernel_support() != selinux::KernelSupport::Unsupported
             }
+            #[cfg(not(feature = "selinux"))]
+            {
+                false
+            }
         },
-        user_specified: !users.is_empty(),
-        ids: None,
+        user_specified: !users.is_empty(),
+        ids: None,
     };
 
-    let default_format = {
-        // "default format" is when none of '-ugG' was used
-        !(state.uflag || state.gflag || state.gsflag)
+    let default_format = {
+        // "default format" is when none of '-ugG' was used
+        !(state.uflag || state.gflag || state.gsflag)
     };
 
-    if (state.nflag || state.rflag) && default_format && !state.cflag {
-        return Err(USimpleError::new(
+    if (state.nflag || state.rflag) && default_format && !state.cflag {
+        return Err(USimpleError::new(
             1,
             "cannot print only names or real IDs in default format",
         ));
     }
-    if state.zflag && default_format && !state.cflag {
-        // NOTE: GNU test suite "id/zero.sh" needs this stderr output:
-        return Err(USimpleError::new(
+    if state.zflag && default_format && !state.cflag {
+        // NOTE: GNU test suite "id/zero.sh" needs this stderr output:
+        return Err(USimpleError::new(
             1,
             "option --zero not permitted in default format",
         ));
     }
-    if state.user_specified && state.cflag {
-        return Err(USimpleError::new(
+    if state.user_specified && state.cflag {
+        return Err(USimpleError::new(
             1,
             "cannot print security context when user specified",
         ));
     }
 
-    let delimiter = {
-        if state.zflag {
-            "\0".to_string()
-        } else {
-            " ".to_string()
+    let delimiter = {
+        if state.zflag {
+            "\0".to_string()
+        } else {
+            " ".to_string()
         }
     };
-    let line_ending = {
-        if state.zflag {
-            '\0'
-        } else {
-            '\n'
-        }
+    let line_ending = {
+        if state.zflag {
+            '\0'
+        } else {
+            '\n'
+        }
     };
 
-    if state.cflag {
-        if state.selinux_supported {
-            // print SElinux context and exit
-            #[cfg(all(any(target_os = "linux", target_os = "android"), feature = "selinux"))]
-            if let Ok(context) = selinux::SecurityContext::current(false) {
-                let bytes = context.as_bytes();
-                print!("{}{}", String::from_utf8_lossy(bytes), line_ending);
-            } else {
-                // print error because `cflag` was explicitly requested
-                return Err(USimpleError::new(1, "can't get process context"));
+    if state.cflag {
+        if state.selinux_supported {
+            // print SElinux context and exit
+            #[cfg(all(any(target_os = "linux", target_os = "android"), feature = "selinux"))]
+            if let Ok(context) = selinux::SecurityContext::current(false) {
+                let bytes = context.as_bytes();
+                print!("{}{}", String::from_utf8_lossy(bytes), line_ending);
+            } else {
+                // print error because `cflag` was explicitly requested
+                return Err(USimpleError::new(1, "can't get process context"));
             }
-            return Ok(());
-        } else {
-            return Err(USimpleError::new(
+            return Ok(());
+        } else {
+            return Err(USimpleError::new(
                 1,
                 "--context (-Z) works only on an SELinux-enabled kernel",
             ));
         }
     }
 
-    for i in 0..=users.len() {
-        let possible_pw = if !state.user_specified {
-            None
-        } else {
-            match Passwd::locate(users[i].as_str()) {
-                Ok(p) => Some(p),
+    for i in 0..=users.len() {
+        let possible_pw = if !state.user_specified {
+            None
+        } else {
+            match Passwd::locate(users[i].as_str()) {
+                Ok(p) => Some(p),
                 Err(_) => {
-                    show_error!("{}: no such user", users[i].quote());
-                    set_exit_code(1);
-                    if i + 1 >= users.len() {
+                    show_error!("{}: no such user", users[i].quote());
+                    set_exit_code(1);
+                    if i + 1 >= users.len() {
                         break;
-                    } else {
+                    } else {
                         continue;
                     }
                 }
             }
         };
 
-        // GNU's `id` does not support the flags: -p/-P/-A.
-        if matches.get_flag(options::OPT_PASSWORD) {
-            // BSD's `id` ignores all but the first specified user
-            pline(possible_pw.as_ref().map(|v| v.uid));
-            return Ok(());
+        // GNU's `id` does not support the flags: -p/-P/-A.
+        if matches.get_flag(options::OPT_PASSWORD) {
+            // BSD's `id` ignores all but the first specified user
+            pline(possible_pw.as_ref().map(|v| v.uid));
+            return Ok(());
         };
-        if matches.get_flag(options::OPT_HUMAN_READABLE) {
-            // BSD's `id` ignores all but the first specified user
-            pretty(possible_pw);
-            return Ok(());
+        if matches.get_flag(options::OPT_HUMAN_READABLE) {
+            // BSD's `id` ignores all but the first specified user
+            pretty(possible_pw);
+            return Ok(());
         }
-        if matches.get_flag(options::OPT_AUDIT) {
-            // BSD's `id` ignores specified users
-            auditid();
-            return Ok(());
+        if matches.get_flag(options::OPT_AUDIT) {
+            // BSD's `id` ignores specified users
+            auditid();
+            return Ok(());
         }
 
-        let (uid, gid) = possible_pw.as_ref().map(|p| (p.uid, p.gid)).unwrap_or((
-            if state.rflag { getuid() } else { geteuid() },
-            if state.rflag { getgid() } else { getegid() },
+        let (uid, gid) = possible_pw.as_ref().map(|p| (p.uid, p.gid)).unwrap_or((
+            if state.rflag { getuid() } else { geteuid() },
+            if state.rflag { getgid() } else { getegid() },
         ));
-        state.ids = Some(Ids {
-            uid,
-            gid,
-            euid: geteuid(),
-            egid: getegid(),
+        state.ids = Some(Ids {
+            uid,
+            gid,
+            euid: geteuid(),
+            egid: getegid(),
         });
 
-        if state.gflag {
+        if state.gflag {
             print!(
                 "{}",
-                if state.nflag {
-                    entries::gid2grp(gid).unwrap_or_else(|_| {
-                        show_error!("cannot find name for group ID {}", gid);
-                        set_exit_code(1);
-                        gid.to_string()
+                if state.nflag {
+                    entries::gid2grp(gid).unwrap_or_else(|_| {
+                        show_error!("cannot find name for group ID {}", gid);
+                        set_exit_code(1);
+                        gid.to_string()
                     })
-                } else {
-                    gid.to_string()
+                } else {
+                    gid.to_string()
                 }
             );
         }
 
-        if state.uflag {
+        if state.uflag {
             print!(
                 "{}",
-                if state.nflag {
-                    entries::uid2usr(uid).unwrap_or_else(|_| {
-                        show_error!("cannot find name for user ID {}", uid);
-                        set_exit_code(1);
-                        uid.to_string()
+                if state.nflag {
+                    entries::uid2usr(uid).unwrap_or_else(|_| {
+                        show_error!("cannot find name for user ID {}", uid);
+                        set_exit_code(1);
+                        uid.to_string()
                     })
-                } else {
-                    uid.to_string()
+                } else {
+                    uid.to_string()
                 }
             );
         }
 
-        let groups = entries::get_groups_gnu(Some(gid)).unwrap();
-        let groups = if state.user_specified {
-            possible_pw.as_ref().map(|p| p.belongs_to()).unwrap()
-        } else {
-            groups.clone()
+        let groups = entries::get_groups_gnu(Some(gid)).unwrap();
+        let groups = if state.user_specified {
+            possible_pw.as_ref().map(|p| p.belongs_to()).unwrap()
+        } else {
+            groups.clone()
         };
 
-        if state.gsflag {
+        if state.gsflag {
             print!(
                 "{}{}",
-                groups
-                    .iter()
-                    .map(|&id| {
-                        if state.nflag {
-                            entries::gid2grp(id).unwrap_or_else(|_| {
-                                show_error!("cannot find name for group ID {}", id);
-                                set_exit_code(1);
-                                id.to_string()
+                groups
+                    .iter()
+                    .map(|&id| {
+                        if state.nflag {
+                            entries::gid2grp(id).unwrap_or_else(|_| {
+                                show_error!("cannot find name for group ID {}", id);
+                                set_exit_code(1);
+                                id.to_string()
                             })
-                        } else {
-                            id.to_string()
+                        } else {
+                            id.to_string()
                         }
                     })
-                    .collect::<Vec<_>>()
-                    .join(&delimiter),
-                // NOTE: this is necessary to pass GNU's "tests/id/zero.sh":
-                if state.zflag && state.user_specified && users.len() > 1 {
-                    "\0"
-                } else {
-                    ""
-                }
+                    .collect::<Vec<_>>()
+                    .join(&delimiter),
+                // NOTE: this is necessary to pass GNU's "tests/id/zero.sh":
+                if state.zflag && state.user_specified && users.len() > 1 {
+                    "\0"
+                } else {
+                    ""
+                }
             );
         }
 
-        if default_format {
-            id_print(&mut state, &groups);
+        if default_format {
+            id_print(&mut state, &groups);
         }
-        print!("{}", line_ending);
+        print!("{}", line_ending);
 
-        if i + 1 >= users.len() {
+        if i + 1 >= users.len() {
             break;
         }
     }
@@ -1024,349 +1024,349 @@ or (when USER omitted) for the current user.";
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::OPT_AUDIT)
-                .short('A')
-                .conflicts_with_all([
-                    options::OPT_GROUP,
-                    options::OPT_EFFECTIVE_USER,
-                    options::OPT_HUMAN_READABLE,
-                    options::OPT_PASSWORD,
-                    options::OPT_GROUPS,
-                    options::OPT_ZERO,
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::OPT_AUDIT)
+                .short('A')
+                .conflicts_with_all([
+                    options::OPT_GROUP,
+                    options::OPT_EFFECTIVE_USER,
+                    options::OPT_HUMAN_READABLE,
+                    options::OPT_PASSWORD,
+                    options::OPT_GROUPS,
+                    options::OPT_ZERO,
                 ])
-                .help(
+                .help(
                     "Display the process audit user ID and other process audit properties,\n\
                       which requires privilege (not available on Linux).",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OPT_EFFECTIVE_USER)
-                .short('u')
-                .long(options::OPT_EFFECTIVE_USER)
-                .conflicts_with(options::OPT_GROUP)
-                .help("Display only the effective user ID as a number.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OPT_EFFECTIVE_USER)
+                .short('u')
+                .long(options::OPT_EFFECTIVE_USER)
+                .conflicts_with(options::OPT_GROUP)
+                .help("Display only the effective user ID as a number.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OPT_GROUP)
-                .short('g')
-                .long(options::OPT_GROUP)
-                .conflicts_with(options::OPT_EFFECTIVE_USER)
-                .help("Display only the effective group ID as a number")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OPT_GROUP)
+                .short('g')
+                .long(options::OPT_GROUP)
+                .conflicts_with(options::OPT_EFFECTIVE_USER)
+                .help("Display only the effective group ID as a number")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OPT_GROUPS)
-                .short('G')
-                .long(options::OPT_GROUPS)
-                .conflicts_with_all([
-                    options::OPT_GROUP,
-                    options::OPT_EFFECTIVE_USER,
-                    options::OPT_CONTEXT,
-                    options::OPT_HUMAN_READABLE,
-                    options::OPT_PASSWORD,
-                    options::OPT_AUDIT,
+        .arg(
+            Arg::new(options::OPT_GROUPS)
+                .short('G')
+                .long(options::OPT_GROUPS)
+                .conflicts_with_all([
+                    options::OPT_GROUP,
+                    options::OPT_EFFECTIVE_USER,
+                    options::OPT_CONTEXT,
+                    options::OPT_HUMAN_READABLE,
+                    options::OPT_PASSWORD,
+                    options::OPT_AUDIT,
                 ])
-                .help(
+                .help(
                     "Display only the different group IDs as white-space separated numbers, \
                       in no particular order.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OPT_HUMAN_READABLE)
-                .short('p')
-                .help("Make the output human-readable. Each display is on a separate line.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OPT_HUMAN_READABLE)
+                .short('p')
+                .help("Make the output human-readable. Each display is on a separate line.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OPT_NAME)
-                .short('n')
-                .long(options::OPT_NAME)
-                .help(
+        .arg(
+            Arg::new(options::OPT_NAME)
+                .short('n')
+                .long(options::OPT_NAME)
+                .help(
                     "Display the name of the user or group ID for the -G, -g and -u options \
                       instead of the number.\nIf any of the ID numbers cannot be mapped into \
                       names, the number will be displayed as usual.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OPT_PASSWORD)
-                .short('P')
-                .help("Display the id as a password file entry.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OPT_PASSWORD)
+                .short('P')
+                .help("Display the id as a password file entry.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OPT_REAL_ID)
-                .short('r')
-                .long(options::OPT_REAL_ID)
-                .help(
+        .arg(
+            Arg::new(options::OPT_REAL_ID)
+                .short('r')
+                .long(options::OPT_REAL_ID)
+                .help(
                     "Display the real ID for the -G, -g and -u options instead of \
                       the effective ID.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OPT_ZERO)
-                .short('z')
-                .long(options::OPT_ZERO)
-                .help(
+        .arg(
+            Arg::new(options::OPT_ZERO)
+                .short('z')
+                .long(options::OPT_ZERO)
+                .help(
                     "delimit entries with NUL characters, not whitespace;\n\
                       not permitted in default format",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OPT_CONTEXT)
-                .short('Z')
-                .long(options::OPT_CONTEXT)
-                .conflicts_with_all([options::OPT_GROUP, options::OPT_EFFECTIVE_USER])
-                .help(CONTEXT_HELP_TEXT)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OPT_CONTEXT)
+                .short('Z')
+                .long(options::OPT_CONTEXT)
+                .conflicts_with_all([options::OPT_GROUP, options::OPT_EFFECTIVE_USER])
+                .help(CONTEXT_HELP_TEXT)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ARG_USERS)
-                .action(ArgAction::Append)
-                .value_name(options::ARG_USERS)
-                .value_hint(clap::ValueHint::Username),
+        .arg(
+            Arg::new(options::ARG_USERS)
+                .action(ArgAction::Append)
+                .value_name(options::ARG_USERS)
+                .value_hint(clap::ValueHint::Username),
         )
 }
 
-fn pretty(possible_pw: Option<Passwd>) {
-    if let Some(p) = possible_pw {
-        print!("uid\t{}\ngroups\t", p.name);
+fn pretty(possible_pw: Option<Passwd>) {
+    if let Some(p) = possible_pw {
+        print!("uid\t{}\ngroups\t", p.name);
         println!(
             "{}",
-            p.belongs_to()
-                .iter()
-                .map(|&gr| entries::gid2grp(gr).unwrap())
-                .collect::<Vec<_>>()
-                .join(" ")
+            p.belongs_to()
+                .iter()
+                .map(|&gr| entries::gid2grp(gr).unwrap())
+                .collect::<Vec<_>>()
+                .join(" ")
         );
-    } else {
-        let login = cstr2cow!(getlogin() as *const _);
-        let rid = getuid();
-        if let Ok(p) = Passwd::locate(rid) {
-            if login == p.name {
-                println!("login\t{}", login);
+    } else {
+        let login = cstr2cow!(getlogin() as *const _);
+        let rid = getuid();
+        if let Ok(p) = Passwd::locate(rid) {
+            if login == p.name {
+                println!("login\t{}", login);
             }
-            println!("uid\t{}", p.name);
-        } else {
-            println!("uid\t{}", rid);
+            println!("uid\t{}", p.name);
+        } else {
+            println!("uid\t{}", rid);
         }
 
-        let eid = getegid();
-        if eid == rid {
-            if let Ok(p) = Passwd::locate(eid) {
-                println!("euid\t{}", p.name);
-            } else {
-                println!("euid\t{}", eid);
+        let eid = getegid();
+        if eid == rid {
+            if let Ok(p) = Passwd::locate(eid) {
+                println!("euid\t{}", p.name);
+            } else {
+                println!("euid\t{}", eid);
             }
         }
 
-        let rid = getgid();
-        if rid != eid {
-            if let Ok(g) = Group::locate(rid) {
-                println!("euid\t{}", g.name);
-            } else {
-                println!("euid\t{}", rid);
+        let rid = getgid();
+        if rid != eid {
+            if let Ok(g) = Group::locate(rid) {
+                println!("euid\t{}", g.name);
+            } else {
+                println!("euid\t{}", rid);
             }
         }
 
         println!(
             "groups\t{}",
-            entries::get_groups_gnu(None)
-                .unwrap()
-                .iter()
-                .map(|&gr| entries::gid2grp(gr).unwrap())
-                .collect::<Vec<_>>()
-                .join(" ")
+            entries::get_groups_gnu(None)
+                .unwrap()
+                .iter()
+                .map(|&gr| entries::gid2grp(gr).unwrap())
+                .collect::<Vec<_>>()
+                .join(" ")
         );
     }
 }
 
-#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
-fn pline(possible_uid: Option<uid_t>) {
-    let uid = possible_uid.unwrap_or_else(getuid);
-    let pw = Passwd::locate(uid).unwrap();
+#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
+fn pline(possible_uid: Option<uid_t>) {
+    let uid = possible_uid.unwrap_or_else(getuid);
+    let pw = Passwd::locate(uid).unwrap();
 
     println!(
         "{}:{}:{}:{}:{}:{}:{}:{}:{}:{}",
-        pw.name,
-        pw.user_passwd.unwrap_or_default(),
-        pw.uid,
-        pw.gid,
-        pw.user_access_class.unwrap_or_default(),
-        pw.passwd_change_time,
-        pw.expiration,
-        pw.user_info.unwrap_or_default(),
-        pw.user_dir.unwrap_or_default(),
-        pw.user_shell.unwrap_or_default()
+        pw.name,
+        pw.user_passwd.unwrap_or_default(),
+        pw.uid,
+        pw.gid,
+        pw.user_access_class.unwrap_or_default(),
+        pw.passwd_change_time,
+        pw.expiration,
+        pw.user_info.unwrap_or_default(),
+        pw.user_dir.unwrap_or_default(),
+        pw.user_shell.unwrap_or_default()
     );
 }
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-fn pline(possible_uid: Option<uid_t>) {
-    let uid = possible_uid.unwrap_or_else(getuid);
-    let pw = Passwd::locate(uid).unwrap();
+#[cfg(any(target_os = "linux", target_os = "android"))]
+fn pline(possible_uid: Option<uid_t>) {
+    let uid = possible_uid.unwrap_or_else(getuid);
+    let pw = Passwd::locate(uid).unwrap();
 
     println!(
         "{}:{}:{}:{}:{}:{}:{}",
-        pw.name,
-        pw.user_passwd.unwrap_or_default(),
-        pw.uid,
-        pw.gid,
-        pw.user_info.unwrap_or_default(),
-        pw.user_dir.unwrap_or_default(),
-        pw.user_shell.unwrap_or_default()
+        pw.name,
+        pw.user_passwd.unwrap_or_default(),
+        pw.uid,
+        pw.gid,
+        pw.user_info.unwrap_or_default(),
+        pw.user_dir.unwrap_or_default(),
+        pw.user_shell.unwrap_or_default()
     );
 }
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-fn auditid() {}
+#[cfg(any(target_os = "linux", target_os = "android"))]
+fn auditid() {}
 
-#[cfg(not(any(target_os = "linux", target_os = "android")))]
-fn auditid() {
-    use std::mem::MaybeUninit;
+#[cfg(not(any(target_os = "linux", target_os = "android")))]
+fn auditid() {
+    use std::mem::MaybeUninit;
 
-    let mut auditinfo: MaybeUninit<audit::c_auditinfo_addr_t> = MaybeUninit::uninit();
-    let address = auditinfo.as_mut_ptr();
-    if unsafe { audit::getaudit(address) } < 0 {
+    let mut auditinfo: MaybeUninit<audit::c_auditinfo_addr_t> = MaybeUninit::uninit();
+    let address = auditinfo.as_mut_ptr();
+    if unsafe { audit::getaudit(address) } < 0 {
         println!("couldn't retrieve information");
         return;
     }
 
-    // SAFETY: getaudit wrote a valid struct to auditinfo
-    let auditinfo = unsafe { auditinfo.assume_init() };
+    // SAFETY: getaudit wrote a valid struct to auditinfo
+    let auditinfo = unsafe { auditinfo.assume_init() };
 
-    println!("auid={}", auditinfo.ai_auid);
-    println!("mask.success=0x{:x}", auditinfo.ai_mask.am_success);
-    println!("mask.failure=0x{:x}", auditinfo.ai_mask.am_failure);
-    println!("termid.port=0x{:x}", auditinfo.ai_termid.port);
-    println!("asid={}", auditinfo.ai_asid);
+    println!("auid={}", auditinfo.ai_auid);
+    println!("mask.success=0x{:x}", auditinfo.ai_mask.am_success);
+    println!("mask.failure=0x{:x}", auditinfo.ai_mask.am_failure);
+    println!("termid.port=0x{:x}", auditinfo.ai_termid.port);
+    println!("asid={}", auditinfo.ai_asid);
 }
 
-fn id_print(state: &mut State, groups: &[u32]) {
-    let uid = state.ids.as_ref().unwrap().uid;
-    let gid = state.ids.as_ref().unwrap().gid;
-    let euid = state.ids.as_ref().unwrap().euid;
-    let egid = state.ids.as_ref().unwrap().egid;
+fn id_print(state: &mut State, groups: &[u32]) {
+    let uid = state.ids.as_ref().unwrap().uid;
+    let gid = state.ids.as_ref().unwrap().gid;
+    let euid = state.ids.as_ref().unwrap().euid;
+    let egid = state.ids.as_ref().unwrap().egid;
 
     print!(
         "uid={}({})",
-        uid,
-        entries::uid2usr(uid).unwrap_or_else(|_| {
-            show_error!("cannot find name for user ID {}", uid);
-            set_exit_code(1);
-            uid.to_string()
+        uid,
+        entries::uid2usr(uid).unwrap_or_else(|_| {
+            show_error!("cannot find name for user ID {}", uid);
+            set_exit_code(1);
+            uid.to_string()
         })
     );
     print!(
         " gid={}({})",
-        gid,
-        entries::gid2grp(gid).unwrap_or_else(|_| {
-            show_error!("cannot find name for group ID {}", gid);
-            set_exit_code(1);
-            gid.to_string()
+        gid,
+        entries::gid2grp(gid).unwrap_or_else(|_| {
+            show_error!("cannot find name for group ID {}", gid);
+            set_exit_code(1);
+            gid.to_string()
         })
     );
-    if !state.user_specified && (euid != uid) {
+    if !state.user_specified && (euid != uid) {
         print!(
             " euid={}({})",
-            euid,
-            entries::uid2usr(euid).unwrap_or_else(|_| {
-                show_error!("cannot find name for user ID {}", euid);
-                set_exit_code(1);
-                euid.to_string()
+            euid,
+            entries::uid2usr(euid).unwrap_or_else(|_| {
+                show_error!("cannot find name for user ID {}", euid);
+                set_exit_code(1);
+                euid.to_string()
             })
         );
     }
-    if !state.user_specified && (egid != gid) {
+    if !state.user_specified && (egid != gid) {
         print!(
             " egid={}({})",
-            euid,
-            entries::gid2grp(egid).unwrap_or_else(|_| {
-                show_error!("cannot find name for group ID {}", egid);
-                set_exit_code(1);
-                egid.to_string()
+            euid,
+            entries::gid2grp(egid).unwrap_or_else(|_| {
+                show_error!("cannot find name for group ID {}", egid);
+                set_exit_code(1);
+                egid.to_string()
             })
         );
     }
     print!(
         " groups={}",
-        groups
-            .iter()
-            .map(|&gr| format!(
+        groups
+            .iter()
+            .map(|&gr| format!(
                 "{}({})",
-                gr,
-                entries::gid2grp(gr).unwrap_or_else(|_| {
-                    show_error!("cannot find name for group ID {}", gr);
-                    set_exit_code(1);
-                    gr.to_string()
+                gr,
+                entries::gid2grp(gr).unwrap_or_else(|_| {
+                    show_error!("cannot find name for group ID {}", gr);
+                    set_exit_code(1);
+                    gr.to_string()
                 })
             ))
-            .collect::<Vec<_>>()
-            .join(",")
+            .collect::<Vec<_>>()
+            .join(",")
     );
 
-    #[cfg(all(any(target_os = "linux", target_os = "android"), feature = "selinux"))]
-    if state.selinux_supported
-        && !state.user_specified
-        && std::env::var_os("POSIXLY_CORRECT").is_none()
+    #[cfg(all(any(target_os = "linux", target_os = "android"), feature = "selinux"))]
+    if state.selinux_supported
+        && !state.user_specified
+        && std::env::var_os("POSIXLY_CORRECT").is_none()
     {
-        // print SElinux context (does not depend on "-Z")
-        if let Ok(context) = selinux::SecurityContext::current(false) {
-            let bytes = context.as_bytes();
-            print!(" context={}", String::from_utf8_lossy(bytes));
+        // print SElinux context (does not depend on "-Z")
+        if let Ok(context) = selinux::SecurityContext::current(false) {
+            let bytes = context.as_bytes();
+            print!(" context={}", String::from_utf8_lossy(bytes));
         }
     }
 }
 
-#[cfg(not(any(target_os = "linux", target_os = "android")))]
-mod audit {
-    use super::libc::{c_int, c_uint, dev_t, pid_t, uid_t};
+#[cfg(not(any(target_os = "linux", target_os = "android")))]
+mod audit {
+    use super::libc::{c_int, c_uint, dev_t, pid_t, uid_t};
 
-    pub type au_id_t = uid_t;
-    pub type au_asid_t = pid_t;
-    pub type au_event_t = c_uint;
-    pub type au_emod_t = c_uint;
-    pub type au_class_t = c_int;
-    pub type au_flag_t = u64;
+    pub type au_id_t = uid_t;
+    pub type au_asid_t = pid_t;
+    pub type au_event_t = c_uint;
+    pub type au_emod_t = c_uint;
+    pub type au_class_t = c_int;
+    pub type au_flag_t = u64;
 
-    #[repr(C)]
-    pub struct au_mask {
-        pub am_success: c_uint,
-        pub am_failure: c_uint,
+    #[repr(C)]
+    pub struct au_mask {
+        pub am_success: c_uint,
+        pub am_failure: c_uint,
     }
-    pub type au_mask_t = au_mask;
+    pub type au_mask_t = au_mask;
 
-    #[repr(C)]
-    pub struct au_tid_addr {
-        pub port: dev_t,
+    #[repr(C)]
+    pub struct au_tid_addr {
+        pub port: dev_t,
     }
-    pub type au_tid_addr_t = au_tid_addr;
+    pub type au_tid_addr_t = au_tid_addr;
 
-    #[repr(C)]
-    pub struct c_auditinfo_addr {
-        pub ai_auid: au_id_t,         // Audit user ID
-        pub ai_mask: au_mask_t,       // Audit masks.
-        pub ai_termid: au_tid_addr_t, // Terminal ID.
-        pub ai_asid: au_asid_t,       // Audit session ID.
-        pub ai_flags: au_flag_t,      // Audit session flags
-    }
-    pub type c_auditinfo_addr_t = c_auditinfo_addr;
+    #[repr(C)]
+    pub struct c_auditinfo_addr {
+        pub ai_auid: au_id_t,         // Audit user ID
+        pub ai_mask: au_mask_t,       // Audit masks.
+        pub ai_termid: au_tid_addr_t, // Terminal ID.
+        pub ai_asid: au_asid_t,       // Audit session ID.
+        pub ai_flags: au_flag_t,      // Audit session flags
+    }
+    pub type c_auditinfo_addr_t = c_auditinfo_addr;
 
-    extern "C" {
-        pub fn getaudit(auditinfo_addr: *mut c_auditinfo_addr_t) -> c_int;
+    extern "C" {
+        pub fn getaudit(auditinfo_addr: *mut c_auditinfo_addr_t) -> c_int;
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_install/install.rs.html b/dev/src/uu_install/install.rs.html index 89f55f6de..50a36faa8 100644 --- a/dev/src/uu_install/install.rs.html +++ b/dev/src/uu_install/install.rs.html @@ -1,4 +1,4 @@ -install.rs - source
1
+install.rs - source
1
 2
 3
 4
@@ -855,862 +855,862 @@
 855
 856
 857
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Ben Eills <ben@beneills.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE file
-//  * that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Ben Eills <ben@beneills.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE file
+//  * that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) rwxr sourcepath targetpath Isnt uioerror
+// spell-checker:ignore (ToDO) rwxr sourcepath targetpath Isnt uioerror
 
-mod mode;
+mod mode;
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use file_diff::diff;
-use filetime::{set_file_times, FileTime};
-use uucore::backup_control::{self, BackupMode};
-use uucore::display::Quotable;
-use uucore::entries::{grp2gid, usr2uid};
-use uucore::error::{FromIo, UError, UIoError, UResult, UUsageError};
-use uucore::format_usage;
-use uucore::fs::dir_strip_dot_for_creation;
-use uucore::mode::get_umask;
-use uucore::perms::{wrap_chown, Verbosity, VerbosityLevel};
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use file_diff::diff;
+use filetime::{set_file_times, FileTime};
+use uucore::backup_control::{self, BackupMode};
+use uucore::display::Quotable;
+use uucore::entries::{grp2gid, usr2uid};
+use uucore::error::{FromIo, UError, UIoError, UResult, UUsageError};
+use uucore::format_usage;
+use uucore::fs::dir_strip_dot_for_creation;
+use uucore::mode::get_umask;
+use uucore::perms::{wrap_chown, Verbosity, VerbosityLevel};
 
-use libc::{getegid, geteuid};
-use std::error::Error;
-use std::fmt::{Debug, Display};
-use std::fs;
-use std::fs::File;
-use std::os::unix::fs::MetadataExt;
-use std::path::{Path, PathBuf};
-use std::process;
+use libc::{getegid, geteuid};
+use std::error::Error;
+use std::fmt::{Debug, Display};
+use std::fs;
+use std::fs::File;
+use std::os::unix::fs::MetadataExt;
+use std::path::{Path, PathBuf};
+use std::process;
 
-const DEFAULT_MODE: u32 = 0o755;
-const DEFAULT_STRIP_PROGRAM: &str = "strip";
+const DEFAULT_MODE: u32 = 0o755;
+const DEFAULT_STRIP_PROGRAM: &str = "strip";
 
-#[allow(dead_code)]
-pub struct Behavior {
-    main_function: MainFunction,
-    specified_mode: Option<u32>,
-    backup_mode: BackupMode,
-    suffix: String,
-    owner: String,
-    group: String,
-    verbose: bool,
-    preserve_timestamps: bool,
-    compare: bool,
-    strip: bool,
-    strip_program: String,
-    create_leading: bool,
-    target_dir: Option<String>,
+#[allow(dead_code)]
+pub struct Behavior {
+    main_function: MainFunction,
+    specified_mode: Option<u32>,
+    backup_mode: BackupMode,
+    suffix: String,
+    owner: String,
+    group: String,
+    verbose: bool,
+    preserve_timestamps: bool,
+    compare: bool,
+    strip: bool,
+    strip_program: String,
+    create_leading: bool,
+    target_dir: Option<String>,
 }
 
-#[derive(Debug)]
-enum InstallError {
-    Unimplemented(String),
-    DirNeedsArg(),
-    CreateDirFailed(PathBuf, std::io::Error),
-    ChmodFailed(PathBuf),
-    InvalidTarget(PathBuf),
-    TargetDirIsntDir(PathBuf),
-    BackupFailed(PathBuf, PathBuf, std::io::Error),
-    InstallFailed(PathBuf, PathBuf, std::io::Error),
-    StripProgramFailed(String),
-    MetadataFailed(std::io::Error),
-    NoSuchUser(String),
-    NoSuchGroup(String),
-    OmittingDirectory(PathBuf),
+#[derive(Debug)]
+enum InstallError {
+    Unimplemented(String),
+    DirNeedsArg(),
+    CreateDirFailed(PathBuf, std::io::Error),
+    ChmodFailed(PathBuf),
+    InvalidTarget(PathBuf),
+    TargetDirIsntDir(PathBuf),
+    BackupFailed(PathBuf, PathBuf, std::io::Error),
+    InstallFailed(PathBuf, PathBuf, std::io::Error),
+    StripProgramFailed(String),
+    MetadataFailed(std::io::Error),
+    NoSuchUser(String),
+    NoSuchGroup(String),
+    OmittingDirectory(PathBuf),
 }
 
-impl UError for InstallError {
-    fn code(&self) -> i32 {
-        match self {
-            Self::Unimplemented(_) => 2,
-            _ => 1,
+impl UError for InstallError {
+    fn code(&self) -> i32 {
+        match self {
+            Self::Unimplemented(_) => 2,
+            _ => 1,
         }
     }
 
-    fn usage(&self) -> bool {
-        false
-    }
+    fn usage(&self) -> bool {
+        false
+    }
 }
 
-impl Error for InstallError {}
+impl Error for InstallError {}
 
-impl Display for InstallError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::Unimplemented(opt) => write!(f, "Unimplemented feature: {}", opt),
-            Self::DirNeedsArg() => {
+impl Display for InstallError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::Unimplemented(opt) => write!(f, "Unimplemented feature: {}", opt),
+            Self::DirNeedsArg() => {
                 write!(
-                    f,
+                    f,
                     "{} with -d requires at least one argument.",
-                    uucore::util_name()
+                    uucore::util_name()
                 )
             }
-            Self::CreateDirFailed(dir, e) => {
-                Display::fmt(&uio_error!(e, "failed to create {}", dir.quote()), f)
+            Self::CreateDirFailed(dir, e) => {
+                Display::fmt(&uio_error!(e, "failed to create {}", dir.quote()), f)
             }
-            Self::ChmodFailed(file) => write!(f, "failed to chmod {}", file.quote()),
-            Self::InvalidTarget(target) => write!(
-                f,
+            Self::ChmodFailed(file) => write!(f, "failed to chmod {}", file.quote()),
+            Self::InvalidTarget(target) => write!(
+                f,
                 "invalid target {}: No such file or directory",
-                target.quote()
+                target.quote()
             ),
-            Self::TargetDirIsntDir(target) => {
-                write!(f, "target {} is not a directory", target.quote())
+            Self::TargetDirIsntDir(target) => {
+                write!(f, "target {} is not a directory", target.quote())
             }
-            Self::BackupFailed(from, to, e) => Display::fmt(
-                &uio_error!(e, "cannot backup {} to {}", from.quote(), to.quote()),
-                f,
+            Self::BackupFailed(from, to, e) => Display::fmt(
+                &uio_error!(e, "cannot backup {} to {}", from.quote(), to.quote()),
+                f,
             ),
-            Self::InstallFailed(from, to, e) => Display::fmt(
-                &uio_error!(e, "cannot install {} to {}", from.quote(), to.quote()),
-                f,
+            Self::InstallFailed(from, to, e) => Display::fmt(
+                &uio_error!(e, "cannot install {} to {}", from.quote(), to.quote()),
+                f,
             ),
-            Self::StripProgramFailed(msg) => write!(f, "strip program failed: {}", msg),
-            Self::MetadataFailed(e) => Display::fmt(&uio_error!(e, ""), f),
-            Self::NoSuchUser(user) => write!(f, "no such user: {}", user.maybe_quote()),
-            Self::NoSuchGroup(group) => write!(f, "no such group: {}", group.maybe_quote()),
-            Self::OmittingDirectory(dir) => write!(f, "omitting directory {}", dir.quote()),
+            Self::StripProgramFailed(msg) => write!(f, "strip program failed: {}", msg),
+            Self::MetadataFailed(e) => Display::fmt(&uio_error!(e, ""), f),
+            Self::NoSuchUser(user) => write!(f, "no such user: {}", user.maybe_quote()),
+            Self::NoSuchGroup(group) => write!(f, "no such group: {}", group.maybe_quote()),
+            Self::OmittingDirectory(dir) => write!(f, "omitting directory {}", dir.quote()),
         }
     }
 }
 
-#[derive(Clone, Eq, PartialEq)]
-pub enum MainFunction {
-    /// Create directories
-    Directory,
-    /// Install files to locations (primary functionality)
-    Standard,
+#[derive(Clone, Eq, PartialEq)]
+pub enum MainFunction {
+    /// Create directories
+    Directory,
+    /// Install files to locations (primary functionality)
+    Standard,
 }
 
-impl Behavior {
-    /// Determine the mode for chmod after copy.
-    pub fn mode(&self) -> u32 {
-        match self.specified_mode {
-            Some(x) => x,
-            None => DEFAULT_MODE,
+impl Behavior {
+    /// Determine the mode for chmod after copy.
+    pub fn mode(&self) -> u32 {
+        match self.specified_mode {
+            Some(x) => x,
+            None => DEFAULT_MODE,
         }
     }
 }
 
-static ABOUT: &str = "Copy SOURCE to DEST or multiple SOURCE(s) to the existing
+static ABOUT: &str = "Copy SOURCE to DEST or multiple SOURCE(s) to the existing
  DIRECTORY, while setting permission modes and owner/group";
-const USAGE: &str = "{} [OPTION]... [FILE]...";
+const USAGE: &str = "{} [OPTION]... [FILE]...";
 
-static OPT_COMPARE: &str = "compare";
-static OPT_DIRECTORY: &str = "directory";
-static OPT_IGNORED: &str = "ignored";
-static OPT_CREATE_LEADING: &str = "create-leading";
-static OPT_GROUP: &str = "group";
-static OPT_MODE: &str = "mode";
-static OPT_OWNER: &str = "owner";
-static OPT_PRESERVE_TIMESTAMPS: &str = "preserve-timestamps";
-static OPT_STRIP: &str = "strip";
-static OPT_STRIP_PROGRAM: &str = "strip-program";
-static OPT_TARGET_DIRECTORY: &str = "target-directory";
-static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory";
-static OPT_VERBOSE: &str = "verbose";
-static OPT_PRESERVE_CONTEXT: &str = "preserve-context";
-static OPT_CONTEXT: &str = "context";
+static OPT_COMPARE: &str = "compare";
+static OPT_DIRECTORY: &str = "directory";
+static OPT_IGNORED: &str = "ignored";
+static OPT_CREATE_LEADING: &str = "create-leading";
+static OPT_GROUP: &str = "group";
+static OPT_MODE: &str = "mode";
+static OPT_OWNER: &str = "owner";
+static OPT_PRESERVE_TIMESTAMPS: &str = "preserve-timestamps";
+static OPT_STRIP: &str = "strip";
+static OPT_STRIP_PROGRAM: &str = "strip-program";
+static OPT_TARGET_DIRECTORY: &str = "target-directory";
+static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory";
+static OPT_VERBOSE: &str = "verbose";
+static OPT_PRESERVE_CONTEXT: &str = "preserve-context";
+static OPT_CONTEXT: &str = "context";
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-/// Main install utility function, called from main.rs.
-///
-/// Returns a program return code.
-///
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+/// Main install utility function, called from main.rs.
+///
+/// Returns a program return code.
+///
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let paths: Vec<String> = matches
-        .get_many::<String>(ARG_FILES)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let paths: Vec<String> = matches
+        .get_many::<String>(ARG_FILES)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    check_unimplemented(&matches)?;
+    check_unimplemented(&matches)?;
 
-    let behavior = behavior(&matches)?;
+    let behavior = behavior(&matches)?;
 
-    match behavior.main_function {
-        MainFunction::Directory => directory(&paths, &behavior),
-        MainFunction::Standard => standard(paths, &behavior),
+    match behavior.main_function {
+        MainFunction::Directory => directory(&paths, &behavior),
+        MainFunction::Standard => standard(paths, &behavior),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(backup_control::arguments::backup())
-        .arg(backup_control::arguments::backup_no_args())
-        .arg(
-            Arg::new(OPT_IGNORED)
-                .short('c')
-                .help("ignored")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(backup_control::arguments::backup())
+        .arg(backup_control::arguments::backup_no_args())
+        .arg(
+            Arg::new(OPT_IGNORED)
+                .short('c')
+                .help("ignored")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_COMPARE)
-                .short('C')
-                .long(OPT_COMPARE)
-                .help(
+        .arg(
+            Arg::new(OPT_COMPARE)
+                .short('C')
+                .long(OPT_COMPARE)
+                .help(
                     "compare each pair of source and destination files, and in some cases, \
                     do not modify the destination at all",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_DIRECTORY)
-                .short('d')
-                .long(OPT_DIRECTORY)
-                .help(
+        .arg(
+            Arg::new(OPT_DIRECTORY)
+                .short('d')
+                .long(OPT_DIRECTORY)
+                .help(
                     "treat all arguments as directory names. create all components of \
                         the specified directories",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            // TODO implement flag
-            Arg::new(OPT_CREATE_LEADING)
-                .short('D')
-                .help(
+        .arg(
+            // TODO implement flag
+            Arg::new(OPT_CREATE_LEADING)
+                .short('D')
+                .help(
                     "create all leading components of DEST except the last, then copy \
                         SOURCE to DEST",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_GROUP)
-                .short('g')
-                .long(OPT_GROUP)
-                .help("set group ownership, instead of process's current group")
-                .value_name("GROUP"),
+        .arg(
+            Arg::new(OPT_GROUP)
+                .short('g')
+                .long(OPT_GROUP)
+                .help("set group ownership, instead of process's current group")
+                .value_name("GROUP"),
         )
-        .arg(
-            Arg::new(OPT_MODE)
-                .short('m')
-                .long(OPT_MODE)
-                .help("set permission mode (as in chmod), instead of rwxr-xr-x")
-                .value_name("MODE"),
+        .arg(
+            Arg::new(OPT_MODE)
+                .short('m')
+                .long(OPT_MODE)
+                .help("set permission mode (as in chmod), instead of rwxr-xr-x")
+                .value_name("MODE"),
         )
-        .arg(
-            Arg::new(OPT_OWNER)
-                .short('o')
-                .long(OPT_OWNER)
-                .help("set ownership (super-user only)")
-                .value_name("OWNER")
-                .value_hint(clap::ValueHint::Username),
+        .arg(
+            Arg::new(OPT_OWNER)
+                .short('o')
+                .long(OPT_OWNER)
+                .help("set ownership (super-user only)")
+                .value_name("OWNER")
+                .value_hint(clap::ValueHint::Username),
         )
-        .arg(
-            Arg::new(OPT_PRESERVE_TIMESTAMPS)
-                .short('p')
-                .long(OPT_PRESERVE_TIMESTAMPS)
-                .help(
+        .arg(
+            Arg::new(OPT_PRESERVE_TIMESTAMPS)
+                .short('p')
+                .long(OPT_PRESERVE_TIMESTAMPS)
+                .help(
                     "apply access/modification times of SOURCE files to \
                     corresponding destination files",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_STRIP)
-                .short('s')
-                .long(OPT_STRIP)
-                .help("strip symbol tables (no action Windows)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_STRIP)
+                .short('s')
+                .long(OPT_STRIP)
+                .help("strip symbol tables (no action Windows)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_STRIP_PROGRAM)
-                .long(OPT_STRIP_PROGRAM)
-                .help("program used to strip binaries (no action Windows)")
-                .value_name("PROGRAM")
-                .value_hint(clap::ValueHint::CommandName),
+        .arg(
+            Arg::new(OPT_STRIP_PROGRAM)
+                .long(OPT_STRIP_PROGRAM)
+                .help("program used to strip binaries (no action Windows)")
+                .value_name("PROGRAM")
+                .value_hint(clap::ValueHint::CommandName),
         )
-        .arg(backup_control::arguments::suffix())
-        .arg(
-            // TODO implement flag
-            Arg::new(OPT_TARGET_DIRECTORY)
-                .short('t')
-                .long(OPT_TARGET_DIRECTORY)
-                .help("move all SOURCE arguments into DIRECTORY")
-                .value_name("DIRECTORY")
-                .value_hint(clap::ValueHint::DirPath),
+        .arg(backup_control::arguments::suffix())
+        .arg(
+            // TODO implement flag
+            Arg::new(OPT_TARGET_DIRECTORY)
+                .short('t')
+                .long(OPT_TARGET_DIRECTORY)
+                .help("move all SOURCE arguments into DIRECTORY")
+                .value_name("DIRECTORY")
+                .value_hint(clap::ValueHint::DirPath),
         )
-        .arg(
-            // TODO implement flag
-            Arg::new(OPT_NO_TARGET_DIRECTORY)
-                .short('T')
-                .long(OPT_NO_TARGET_DIRECTORY)
-                .help("(unimplemented) treat DEST as a normal file")
-                .action(ArgAction::SetTrue),
+        .arg(
+            // TODO implement flag
+            Arg::new(OPT_NO_TARGET_DIRECTORY)
+                .short('T')
+                .long(OPT_NO_TARGET_DIRECTORY)
+                .help("(unimplemented) treat DEST as a normal file")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_VERBOSE)
-                .short('v')
-                .long(OPT_VERBOSE)
-                .help("explain what is being done")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_VERBOSE)
+                .short('v')
+                .long(OPT_VERBOSE)
+                .help("explain what is being done")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            // TODO implement flag
-            Arg::new(OPT_PRESERVE_CONTEXT)
-                .short('P')
-                .long(OPT_PRESERVE_CONTEXT)
-                .help("(unimplemented) preserve security context")
-                .action(ArgAction::SetTrue),
+        .arg(
+            // TODO implement flag
+            Arg::new(OPT_PRESERVE_CONTEXT)
+                .short('P')
+                .long(OPT_PRESERVE_CONTEXT)
+                .help("(unimplemented) preserve security context")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            // TODO implement flag
-            Arg::new(OPT_CONTEXT)
-                .short('Z')
-                .long(OPT_CONTEXT)
-                .help("(unimplemented) set security context of files and directories")
-                .value_name("CONTEXT")
-                .action(ArgAction::SetTrue),
+        .arg(
+            // TODO implement flag
+            Arg::new(OPT_CONTEXT)
+                .short('Z')
+                .long(OPT_CONTEXT)
+                .help("(unimplemented) set security context of files and directories")
+                .value_name("CONTEXT")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .num_args(1..)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .num_args(1..)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-/// Check for unimplemented command line arguments.
-///
-/// Either return the degenerate Ok value, or an Err with string.
-///
-/// # Errors
-///
-/// Error datum is a string of the unimplemented argument.
-///
-///
-fn check_unimplemented(matches: &ArgMatches) -> UResult<()> {
-    if matches.get_flag(OPT_NO_TARGET_DIRECTORY) {
-        Err(InstallError::Unimplemented(String::from("--no-target-directory, -T")).into())
-    } else if matches.get_flag(OPT_PRESERVE_CONTEXT) {
-        Err(InstallError::Unimplemented(String::from("--preserve-context, -P")).into())
-    } else if matches.get_flag(OPT_CONTEXT) {
-        Err(InstallError::Unimplemented(String::from("--context, -Z")).into())
-    } else {
+/// Check for unimplemented command line arguments.
+///
+/// Either return the degenerate Ok value, or an Err with string.
+///
+/// # Errors
+///
+/// Error datum is a string of the unimplemented argument.
+///
+///
+fn check_unimplemented(matches: &ArgMatches) -> UResult<()> {
+    if matches.get_flag(OPT_NO_TARGET_DIRECTORY) {
+        Err(InstallError::Unimplemented(String::from("--no-target-directory, -T")).into())
+    } else if matches.get_flag(OPT_PRESERVE_CONTEXT) {
+        Err(InstallError::Unimplemented(String::from("--preserve-context, -P")).into())
+    } else if matches.get_flag(OPT_CONTEXT) {
+        Err(InstallError::Unimplemented(String::from("--context, -Z")).into())
+    } else {
         Ok(())
     }
 }
 
-/// Determine behavior, given command line arguments.
-///
-/// If successful, returns a filled-out Behavior struct.
-///
-/// # Errors
-///
-/// In event of failure, returns an integer intended as a program return code.
-///
-fn behavior(matches: &ArgMatches) -> UResult<Behavior> {
-    let main_function = if matches.get_flag(OPT_DIRECTORY) {
-        MainFunction::Directory
-    } else {
-        MainFunction::Standard
+/// Determine behavior, given command line arguments.
+///
+/// If successful, returns a filled-out Behavior struct.
+///
+/// # Errors
+///
+/// In event of failure, returns an integer intended as a program return code.
+///
+fn behavior(matches: &ArgMatches) -> UResult<Behavior> {
+    let main_function = if matches.get_flag(OPT_DIRECTORY) {
+        MainFunction::Directory
+    } else {
+        MainFunction::Standard
     };
 
-    let considering_dir: bool = MainFunction::Directory == main_function;
+    let considering_dir: bool = MainFunction::Directory == main_function;
 
-    let specified_mode: Option<u32> = if matches.contains_id(OPT_MODE) {
-        let x = matches.get_one::<String>(OPT_MODE).ok_or(1)?;
-        Some(mode::parse(x, considering_dir, get_umask()).map_err(|err| {
-            show_error!("Invalid mode string: {}", err);
-            1
-        })?)
-    } else {
-        None
-    };
+    let specified_mode: Option<u32> = if matches.contains_id(OPT_MODE) {
+        let x = matches.get_one::<String>(OPT_MODE).ok_or(1)?;
+        Some(mode::parse(x, considering_dir, get_umask()).map_err(|err| {
+            show_error!("Invalid mode string: {}", err);
+            1
+        })?)
+    } else {
+        None
+    };
 
-    let backup_mode = backup_control::determine_backup_mode(matches)?;
-    let target_dir = matches
-        .get_one::<String>(OPT_TARGET_DIRECTORY)
-        .map(|d| d.to_owned());
+    let backup_mode = backup_control::determine_backup_mode(matches)?;
+    let target_dir = matches
+        .get_one::<String>(OPT_TARGET_DIRECTORY)
+        .map(|d| d.to_owned());
 
-    let preserve_timestamps = matches.get_flag(OPT_PRESERVE_TIMESTAMPS);
-    let compare = matches.get_flag(OPT_COMPARE);
-    let strip = matches.get_flag(OPT_STRIP);
-    if preserve_timestamps && compare {
+    let preserve_timestamps = matches.get_flag(OPT_PRESERVE_TIMESTAMPS);
+    let compare = matches.get_flag(OPT_COMPARE);
+    let strip = matches.get_flag(OPT_STRIP);
+    if preserve_timestamps && compare {
         show_error!("Options --compare and --preserve-timestamps are mutually exclusive");
-        return Err(1.into());
+        return Err(1.into());
     }
-    if compare && strip {
+    if compare && strip {
         show_error!("Options --compare and --strip are mutually exclusive");
-        return Err(1.into());
+        return Err(1.into());
     }
-    Ok(Behavior {
-        main_function,
-        specified_mode,
-        backup_mode,
-        suffix: backup_control::determine_backup_suffix(matches),
-        owner: matches
-            .get_one::<String>(OPT_OWNER)
-            .map(|s| s.as_str())
-            .unwrap_or("")
-            .to_string(),
-        group: matches
-            .get_one::<String>(OPT_GROUP)
-            .map(|s| s.as_str())
-            .unwrap_or("")
-            .to_string(),
-        verbose: matches.get_flag(OPT_VERBOSE),
-        preserve_timestamps,
-        compare,
-        strip,
-        strip_program: String::from(
-            matches
-                .get_one::<String>(OPT_STRIP_PROGRAM)
-                .map(|s| s.as_str())
-                .unwrap_or(DEFAULT_STRIP_PROGRAM),
+    Ok(Behavior {
+        main_function,
+        specified_mode,
+        backup_mode,
+        suffix: backup_control::determine_backup_suffix(matches),
+        owner: matches
+            .get_one::<String>(OPT_OWNER)
+            .map(|s| s.as_str())
+            .unwrap_or("")
+            .to_string(),
+        group: matches
+            .get_one::<String>(OPT_GROUP)
+            .map(|s| s.as_str())
+            .unwrap_or("")
+            .to_string(),
+        verbose: matches.get_flag(OPT_VERBOSE),
+        preserve_timestamps,
+        compare,
+        strip,
+        strip_program: String::from(
+            matches
+                .get_one::<String>(OPT_STRIP_PROGRAM)
+                .map(|s| s.as_str())
+                .unwrap_or(DEFAULT_STRIP_PROGRAM),
         ),
-        create_leading: matches.get_flag(OPT_CREATE_LEADING),
-        target_dir,
+        create_leading: matches.get_flag(OPT_CREATE_LEADING),
+        target_dir,
     })
 }
 
-/// Creates directories.
-///
-/// GNU man pages describe this functionality as creating 'all components of
-/// the specified directories'.
-///
-/// Returns a Result type with the Err variant containing the error message.
-///
-fn directory(paths: &[String], b: &Behavior) -> UResult<()> {
-    if paths.is_empty() {
-        Err(InstallError::DirNeedsArg().into())
-    } else {
-        for path in paths.iter().map(Path::new) {
-            // if the path already exist, don't try to create it again
-            if !path.exists() {
-                // Special case to match GNU's behavior:
-                // install -d foo/. should work and just create foo/
-                // std::fs::create_dir("foo/."); fails in pure Rust
-                // See also mkdir.rs for another occurrence of this
-                let path_to_create = dir_strip_dot_for_creation(path);
-                // Differently than the primary functionality
-                // (MainFunction::Standard), the directory functionality should
-                // create all ancestors (or components) of a directory
-                // regardless of the presence of the "-D" flag.
-                //
-                // NOTE: the GNU "install" sets the expected mode only for the
-                // target directory. All created ancestor directories will have
-                // the default mode. Hence it is safe to use fs::create_dir_all
-                // and then only modify the target's dir mode.
-                if let Err(e) = fs::create_dir_all(path_to_create.as_path())
-                    .map_err_context(|| path_to_create.as_path().maybe_quote().to_string())
+/// Creates directories.
+///
+/// GNU man pages describe this functionality as creating 'all components of
+/// the specified directories'.
+///
+/// Returns a Result type with the Err variant containing the error message.
+///
+fn directory(paths: &[String], b: &Behavior) -> UResult<()> {
+    if paths.is_empty() {
+        Err(InstallError::DirNeedsArg().into())
+    } else {
+        for path in paths.iter().map(Path::new) {
+            // if the path already exist, don't try to create it again
+            if !path.exists() {
+                // Special case to match GNU's behavior:
+                // install -d foo/. should work and just create foo/
+                // std::fs::create_dir("foo/."); fails in pure Rust
+                // See also mkdir.rs for another occurrence of this
+                let path_to_create = dir_strip_dot_for_creation(path);
+                // Differently than the primary functionality
+                // (MainFunction::Standard), the directory functionality should
+                // create all ancestors (or components) of a directory
+                // regardless of the presence of the "-D" flag.
+                //
+                // NOTE: the GNU "install" sets the expected mode only for the
+                // target directory. All created ancestor directories will have
+                // the default mode. Hence it is safe to use fs::create_dir_all
+                // and then only modify the target's dir mode.
+                if let Err(e) = fs::create_dir_all(path_to_create.as_path())
+                    .map_err_context(|| path_to_create.as_path().maybe_quote().to_string())
                 {
-                    show!(e);
+                    show!(e);
                     continue;
                 }
 
-                if b.verbose {
-                    println!("creating directory {}", path_to_create.quote());
+                if b.verbose {
+                    println!("creating directory {}", path_to_create.quote());
                 }
             }
 
-            if mode::chmod(path, b.mode()).is_err() {
-                // Error messages are printed by the mode::chmod function!
-                uucore::error::set_exit_code(1);
+            if mode::chmod(path, b.mode()).is_err() {
+                // Error messages are printed by the mode::chmod function!
+                uucore::error::set_exit_code(1);
                 continue;
             }
         }
-        // If the exit code was set, or show! has been called at least once
-        // (which sets the exit code as well), function execution will end after
-        // this return.
-        Ok(())
+        // If the exit code was set, or show! has been called at least once
+        // (which sets the exit code as well), function execution will end after
+        // this return.
+        Ok(())
     }
 }
 
-/// Test if the path is a new file path that can be
-/// created immediately
-fn is_new_file_path(path: &Path) -> bool {
-    !path.exists()
-        && (path.parent().map(Path::is_dir).unwrap_or(true)
-            || path.parent().unwrap().as_os_str().is_empty()) // In case of a simple file
-}
+/// Test if the path is a new file path that can be
+/// created immediately
+fn is_new_file_path(path: &Path) -> bool {
+    !path.exists()
+        && (path.parent().map(Path::is_dir).unwrap_or(true)
+            || path.parent().unwrap().as_os_str().is_empty()) // In case of a simple file
+}
 
-/// Perform an install, given a list of paths and behavior.
-///
-/// Returns a Result type with the Err variant containing the error message.
-///
-fn standard(mut paths: Vec<String>, b: &Behavior) -> UResult<()> {
-    let target: PathBuf = if let Some(path) = &b.target_dir {
-        path.into()
-    } else {
-        paths
-            .pop()
-            .ok_or_else(|| UUsageError::new(1, "missing file operand"))?
-            .into()
+/// Perform an install, given a list of paths and behavior.
+///
+/// Returns a Result type with the Err variant containing the error message.
+///
+fn standard(mut paths: Vec<String>, b: &Behavior) -> UResult<()> {
+    let target: PathBuf = if let Some(path) = &b.target_dir {
+        path.into()
+    } else {
+        paths
+            .pop()
+            .ok_or_else(|| UUsageError::new(1, "missing file operand"))?
+            .into()
     };
 
-    let sources = &paths.iter().map(PathBuf::from).collect::<Vec<_>>();
+    let sources = &paths.iter().map(PathBuf::from).collect::<Vec<_>>();
 
-    if sources.len() > 1 || (target.exists() && target.is_dir()) {
-        copy_files_into_dir(sources, &target, b)
-    } else {
-        // if -t is used in combination with -D, create whole target because it does not include filename
-        let to_create: Option<&Path> = if b.target_dir.is_some() && b.create_leading {
-            Some(target.as_path())
-        } else {
-            target.parent()
+    if sources.len() > 1 || (target.exists() && target.is_dir()) {
+        copy_files_into_dir(sources, &target, b)
+    } else {
+        // if -t is used in combination with -D, create whole target because it does not include filename
+        let to_create: Option<&Path> = if b.target_dir.is_some() && b.create_leading {
+            Some(target.as_path())
+        } else {
+            target.parent()
         };
 
-        if let Some(to_create) = to_create {
-            if !to_create.exists() && b.create_leading {
-                if b.verbose {
-                    let mut result = PathBuf::new();
-                    // When creating directories with -Dv, show directory creations step by step
-                    for part in to_create.components() {
-                        result.push(part.as_os_str());
-                        if !Path::new(part.as_os_str()).is_dir() {
-                            // Don't display when the directory already exists
-                            println!("install: creating directory {}", result.quote());
+        if let Some(to_create) = to_create {
+            if !to_create.exists() && b.create_leading {
+                if b.verbose {
+                    let mut result = PathBuf::new();
+                    // When creating directories with -Dv, show directory creations step by step
+                    for part in to_create.components() {
+                        result.push(part.as_os_str());
+                        if !Path::new(part.as_os_str()).is_dir() {
+                            // Don't display when the directory already exists
+                            println!("install: creating directory {}", result.quote());
                         }
                     }
                 }
 
-                if let Err(e) = fs::create_dir_all(to_create) {
-                    return Err(InstallError::CreateDirFailed(to_create.to_path_buf(), e).into());
+                if let Err(e) = fs::create_dir_all(to_create) {
+                    return Err(InstallError::CreateDirFailed(to_create.to_path_buf(), e).into());
                 }
 
-                // Silent the warning as we want to the error message
-                #[allow(clippy::question_mark)]
-                if mode::chmod(to_create, b.mode()).is_err() {
-                    return Err(InstallError::ChmodFailed(to_create.to_path_buf()).into());
+                // Silent the warning as we want to the error message
+                #[allow(clippy::question_mark)]
+                if mode::chmod(to_create, b.mode()).is_err() {
+                    return Err(InstallError::ChmodFailed(to_create.to_path_buf()).into());
                 }
             }
         }
 
-        let source = sources.first().ok_or_else(|| {
-            UUsageError::new(
+        let source = sources.first().ok_or_else(|| {
+            UUsageError::new(
                 1,
                 format!(
                     "missing destination file operand after '{}'",
-                    target.to_str().unwrap()
+                    target.to_str().unwrap()
                 ),
             )
         })?;
 
-        // If the -D flag was passed (target does not include filename),
-        // we need to add the source name to the target_dir
-        // because `copy` expects `to` to be a file, not a directory
-        let target = if target.is_dir() && b.create_leading {
-            target.join(source)
-        } else {
-            target // already includes dest filename
-        };
+        // If the -D flag was passed (target does not include filename),
+        // we need to add the source name to the target_dir
+        // because `copy` expects `to` to be a file, not a directory
+        let target = if target.is_dir() && b.create_leading {
+            target.join(source)
+        } else {
+            target // already includes dest filename
+        };
 
-        if target.is_file() || is_new_file_path(&target) {
-            copy(source, &target, b)
-        } else {
-            Err(InstallError::InvalidTarget(target).into())
+        if target.is_file() || is_new_file_path(&target) {
+            copy(source, &target, b)
+        } else {
+            Err(InstallError::InvalidTarget(target).into())
         }
     }
 }
 
-/// Copy some files into a directory.
-///
-/// Prints verbose information and error messages.
-/// Returns a Result type with the Err variant containing the error message.
-///
-/// # Parameters
-///
-/// _files_ must all exist as non-directories.
-/// _target_dir_ must be a directory.
-///
-fn copy_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UResult<()> {
-    if !target_dir.is_dir() {
-        return Err(InstallError::TargetDirIsntDir(target_dir.to_path_buf()).into());
+/// Copy some files into a directory.
+///
+/// Prints verbose information and error messages.
+/// Returns a Result type with the Err variant containing the error message.
+///
+/// # Parameters
+///
+/// _files_ must all exist as non-directories.
+/// _target_dir_ must be a directory.
+///
+fn copy_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UResult<()> {
+    if !target_dir.is_dir() {
+        return Err(InstallError::TargetDirIsntDir(target_dir.to_path_buf()).into());
     }
-    for sourcepath in files.iter() {
-        if let Err(err) = sourcepath
-            .metadata()
-            .map_err_context(|| format!("cannot stat {}", sourcepath.quote()))
+    for sourcepath in files.iter() {
+        if let Err(err) = sourcepath
+            .metadata()
+            .map_err_context(|| format!("cannot stat {}", sourcepath.quote()))
         {
-            show!(err);
+            show!(err);
             continue;
         }
 
-        if sourcepath.is_dir() {
-            let err = InstallError::OmittingDirectory(sourcepath.to_path_buf());
-            show!(err);
+        if sourcepath.is_dir() {
+            let err = InstallError::OmittingDirectory(sourcepath.to_path_buf());
+            show!(err);
             continue;
         }
 
-        let mut targetpath = target_dir.to_path_buf();
-        let filename = sourcepath.components().last().unwrap();
-        targetpath.push(filename);
+        let mut targetpath = target_dir.to_path_buf();
+        let filename = sourcepath.components().last().unwrap();
+        targetpath.push(filename);
 
-        show_if_err!(copy(sourcepath, &targetpath, b));
+        show_if_err!(copy(sourcepath, &targetpath, b));
     }
-    // If the exit code was set, or show! has been called at least once
-    // (which sets the exit code as well), function execution will end after
-    // this return.
-    Ok(())
+    // If the exit code was set, or show! has been called at least once
+    // (which sets the exit code as well), function execution will end after
+    // this return.
+    Ok(())
 }
 
-/// Copy one file to a new location, changing metadata.
-///
-/// Returns a Result type with the Err variant containing the error message.
-///
-/// # Parameters
-///
-/// _from_ must exist as a non-directory.
-/// _to_ must be a non-existent file, whose parent directory exists.
-///
-/// # Errors
-///
-/// If the copy system call fails, we print a verbose error and return an empty error value.
-///
-#[allow(clippy::cognitive_complexity)]
-fn copy(from: &Path, to: &Path, b: &Behavior) -> UResult<()> {
-    if b.compare && !need_copy(from, to, b)? {
-        return Ok(());
+/// Copy one file to a new location, changing metadata.
+///
+/// Returns a Result type with the Err variant containing the error message.
+///
+/// # Parameters
+///
+/// _from_ must exist as a non-directory.
+/// _to_ must be a non-existent file, whose parent directory exists.
+///
+/// # Errors
+///
+/// If the copy system call fails, we print a verbose error and return an empty error value.
+///
+#[allow(clippy::cognitive_complexity)]
+fn copy(from: &Path, to: &Path, b: &Behavior) -> UResult<()> {
+    if b.compare && !need_copy(from, to, b)? {
+        return Ok(());
     }
-    // Declare the path here as we may need it for the verbose output below.
-    let mut backup_path = None;
+    // Declare the path here as we may need it for the verbose output below.
+    let mut backup_path = None;
 
-    // Perform backup, if any, before overwriting 'to'
-    //
-    // The codes actually making use of the backup process don't seem to agree
-    // on how best to approach the issue. (mv and ln, for example)
-    if to.exists() {
-        if b.verbose {
-            println!("removed {}", to.quote());
+    // Perform backup, if any, before overwriting 'to'
+    //
+    // The codes actually making use of the backup process don't seem to agree
+    // on how best to approach the issue. (mv and ln, for example)
+    if to.exists() {
+        if b.verbose {
+            println!("removed {}", to.quote());
         }
-        backup_path = backup_control::get_backup_path(b.backup_mode, to, &b.suffix);
-        if let Some(ref backup_path) = backup_path {
-            // TODO!!
-            if let Err(err) = fs::rename(to, backup_path) {
-                return Err(InstallError::BackupFailed(
-                    to.to_path_buf(),
-                    backup_path.to_path_buf(),
-                    err,
+        backup_path = backup_control::get_backup_path(b.backup_mode, to, &b.suffix);
+        if let Some(ref backup_path) = backup_path {
+            // TODO!!
+            if let Err(err) = fs::rename(to, backup_path) {
+                return Err(InstallError::BackupFailed(
+                    to.to_path_buf(),
+                    backup_path.to_path_buf(),
+                    err,
                 )
-                .into());
+                .into());
             }
         }
     }
 
-    if from.as_os_str() == "/dev/null" {
+    if from.as_os_str() == "/dev/null" {
         /* workaround a limitation of fs::copy
          * https://github.com/rust-lang/rust/issues/79390
-         */
-        if let Err(err) = File::create(to) {
-            return Err(
-                InstallError::InstallFailed(from.to_path_buf(), to.to_path_buf(), err).into(),
+         */
+        if let Err(err) = File::create(to) {
+            return Err(
+                InstallError::InstallFailed(from.to_path_buf(), to.to_path_buf(), err).into(),
             );
         }
-    } else if let Err(err) = fs::copy(from, to) {
-        return Err(InstallError::InstallFailed(from.to_path_buf(), to.to_path_buf(), err).into());
+    } else if let Err(err) = fs::copy(from, to) {
+        return Err(InstallError::InstallFailed(from.to_path_buf(), to.to_path_buf(), err).into());
     }
 
-    if b.strip && cfg!(not(windows)) {
-        match process::Command::new(&b.strip_program).arg(to).output() {
-            Ok(o) => {
-                if !o.status.success() {
-                    // Follow GNU's behavior: if strip fails, removes the target
-                    let _ = fs::remove_file(to);
-                    return Err(InstallError::StripProgramFailed(
-                        String::from_utf8(o.stderr).unwrap_or_default(),
+    if b.strip && cfg!(not(windows)) {
+        match process::Command::new(&b.strip_program).arg(to).output() {
+            Ok(o) => {
+                if !o.status.success() {
+                    // Follow GNU's behavior: if strip fails, removes the target
+                    let _ = fs::remove_file(to);
+                    return Err(InstallError::StripProgramFailed(
+                        String::from_utf8(o.stderr).unwrap_or_default(),
                     )
-                    .into());
+                    .into());
                 }
             }
-            Err(e) => {
-                // Follow GNU's behavior: if strip fails, removes the target
-                let _ = fs::remove_file(to);
-                return Err(InstallError::StripProgramFailed(e.to_string()).into());
+            Err(e) => {
+                // Follow GNU's behavior: if strip fails, removes the target
+                let _ = fs::remove_file(to);
+                return Err(InstallError::StripProgramFailed(e.to_string()).into());
             }
         }
     }
 
-    // Silent the warning as we want to the error message
-    #[allow(clippy::question_mark)]
-    if mode::chmod(to, b.mode()).is_err() {
-        return Err(InstallError::ChmodFailed(to.to_path_buf()).into());
+    // Silent the warning as we want to the error message
+    #[allow(clippy::question_mark)]
+    if mode::chmod(to, b.mode()).is_err() {
+        return Err(InstallError::ChmodFailed(to.to_path_buf()).into());
     }
 
-    if !b.owner.is_empty() {
-        let meta = match fs::metadata(to) {
-            Ok(meta) => meta,
-            Err(e) => return Err(InstallError::MetadataFailed(e).into()),
+    if !b.owner.is_empty() {
+        let meta = match fs::metadata(to) {
+            Ok(meta) => meta,
+            Err(e) => return Err(InstallError::MetadataFailed(e).into()),
         };
 
-        let owner_id = match usr2uid(&b.owner) {
-            Ok(g) => g,
-            _ => return Err(InstallError::NoSuchUser(b.owner.clone()).into()),
+        let owner_id = match usr2uid(&b.owner) {
+            Ok(g) => g,
+            _ => return Err(InstallError::NoSuchUser(b.owner.clone()).into()),
         };
-        let gid = meta.gid();
-        match wrap_chown(
-            to,
-            &meta,
-            Some(owner_id),
-            Some(gid),
+        let gid = meta.gid();
+        match wrap_chown(
+            to,
+            &meta,
+            Some(owner_id),
+            Some(gid),
             false,
-            Verbosity {
-                groups_only: false,
-                level: VerbosityLevel::Normal,
+            Verbosity {
+                groups_only: false,
+                level: VerbosityLevel::Normal,
             },
         ) {
-            Ok(n) => {
-                if !n.is_empty() {
-                    show_error!("{}", n);
+            Ok(n) => {
+                if !n.is_empty() {
+                    show_error!("{}", n);
                 }
             }
-            Err(e) => show_error!("{}", e),
+            Err(e) => show_error!("{}", e),
         }
     }
 
-    if !b.group.is_empty() {
-        let meta = match fs::metadata(to) {
-            Ok(meta) => meta,
-            Err(e) => return Err(InstallError::MetadataFailed(e).into()),
+    if !b.group.is_empty() {
+        let meta = match fs::metadata(to) {
+            Ok(meta) => meta,
+            Err(e) => return Err(InstallError::MetadataFailed(e).into()),
         };
 
-        let group_id = match grp2gid(&b.group) {
-            Ok(g) => g,
-            _ => return Err(InstallError::NoSuchGroup(b.group.clone()).into()),
+        let group_id = match grp2gid(&b.group) {
+            Ok(g) => g,
+            _ => return Err(InstallError::NoSuchGroup(b.group.clone()).into()),
         };
-        match wrap_chown(
-            to,
-            &meta,
-            Some(group_id),
+        match wrap_chown(
+            to,
+            &meta,
+            Some(group_id),
             None,
             false,
-            Verbosity {
-                groups_only: true,
-                level: VerbosityLevel::Normal,
+            Verbosity {
+                groups_only: true,
+                level: VerbosityLevel::Normal,
             },
         ) {
-            Ok(n) => {
-                if !n.is_empty() {
-                    show_error!("{}", n);
+            Ok(n) => {
+                if !n.is_empty() {
+                    show_error!("{}", n);
                 }
             }
-            Err(e) => show_error!("{}", e),
+            Err(e) => show_error!("{}", e),
         }
     }
 
-    if b.preserve_timestamps {
-        let meta = match fs::metadata(from) {
-            Ok(meta) => meta,
-            Err(e) => return Err(InstallError::MetadataFailed(e).into()),
+    if b.preserve_timestamps {
+        let meta = match fs::metadata(from) {
+            Ok(meta) => meta,
+            Err(e) => return Err(InstallError::MetadataFailed(e).into()),
         };
 
-        let modified_time = FileTime::from_last_modification_time(&meta);
-        let accessed_time = FileTime::from_last_access_time(&meta);
+        let modified_time = FileTime::from_last_modification_time(&meta);
+        let accessed_time = FileTime::from_last_access_time(&meta);
 
-        match set_file_times(to, accessed_time, modified_time) {
+        match set_file_times(to, accessed_time, modified_time) {
             Ok(_) => {}
-            Err(e) => show_error!("{}", e),
+            Err(e) => show_error!("{}", e),
         }
     }
 
-    if b.verbose {
-        print!("{} -> {}", from.quote(), to.quote());
-        match backup_path {
-            Some(path) => println!(" (backup: {})", path.quote()),
-            None => println!(),
+    if b.verbose {
+        print!("{} -> {}", from.quote(), to.quote());
+        match backup_path {
+            Some(path) => println!(" (backup: {})", path.quote()),
+            None => println!(),
         }
     }
 
     Ok(())
 }
 
-/// Return true if a file is necessary to copy. This is the case when:
-///
-/// - _from_ or _to_ is nonexistent;
-/// - either file has a sticky bit or set\[ug\]id bit, or the user specified one;
-/// - either file isn't a regular file;
-/// - the sizes of _from_ and _to_ differ;
-/// - _to_'s owner differs from intended; or
-/// - the contents of _from_ and _to_ differ.
-///
-/// # Parameters
-///
-/// _from_ and _to_, if existent, must be non-directories.
-///
-/// # Errors
-///
-/// Crashes the program if a nonexistent owner or group is specified in _b_.
-///
-fn need_copy(from: &Path, to: &Path, b: &Behavior) -> UResult<bool> {
-    let from_meta = match fs::metadata(from) {
-        Ok(meta) => meta,
-        Err(_) => return Ok(true),
+/// Return true if a file is necessary to copy. This is the case when:
+///
+/// - _from_ or _to_ is nonexistent;
+/// - either file has a sticky bit or set\[ug\]id bit, or the user specified one;
+/// - either file isn't a regular file;
+/// - the sizes of _from_ and _to_ differ;
+/// - _to_'s owner differs from intended; or
+/// - the contents of _from_ and _to_ differ.
+///
+/// # Parameters
+///
+/// _from_ and _to_, if existent, must be non-directories.
+///
+/// # Errors
+///
+/// Crashes the program if a nonexistent owner or group is specified in _b_.
+///
+fn need_copy(from: &Path, to: &Path, b: &Behavior) -> UResult<bool> {
+    let from_meta = match fs::metadata(from) {
+        Ok(meta) => meta,
+        Err(_) => return Ok(true),
     };
-    let to_meta = match fs::metadata(to) {
-        Ok(meta) => meta,
-        Err(_) => return Ok(true),
+    let to_meta = match fs::metadata(to) {
+        Ok(meta) => meta,
+        Err(_) => return Ok(true),
     };
 
-    // setuid || setgid || sticky
-    let extra_mode: u32 = 0o7000;
-    // setuid || setgid || sticky || permissions
-    let all_modes: u32 = 0o7777;
+    // setuid || setgid || sticky
+    let extra_mode: u32 = 0o7000;
+    // setuid || setgid || sticky || permissions
+    let all_modes: u32 = 0o7777;
 
-    if b.specified_mode.unwrap_or(0) & extra_mode != 0
-        || from_meta.mode() & extra_mode != 0
-        || to_meta.mode() & extra_mode != 0
-    {
-        return Ok(true);
+    if b.specified_mode.unwrap_or(0) & extra_mode != 0
+        || from_meta.mode() & extra_mode != 0
+        || to_meta.mode() & extra_mode != 0
+    {
+        return Ok(true);
     }
-    if b.mode() != to_meta.mode() & all_modes {
-        return Ok(true);
+    if b.mode() != to_meta.mode() & all_modes {
+        return Ok(true);
     }
 
-    if !from_meta.is_file() || !to_meta.is_file() {
-        return Ok(true);
+    if !from_meta.is_file() || !to_meta.is_file() {
+        return Ok(true);
     }
 
-    if from_meta.len() != to_meta.len() {
-        return Ok(true);
+    if from_meta.len() != to_meta.len() {
+        return Ok(true);
     }
 
-    // TODO: if -P (#1809) and from/to contexts mismatch, return true.
+    // TODO: if -P (#1809) and from/to contexts mismatch, return true.
 
-    if !b.owner.is_empty() {
-        let owner_id = match usr2uid(&b.owner) {
-            Ok(id) => id,
-            _ => return Err(InstallError::NoSuchUser(b.owner.clone()).into()),
+    if !b.owner.is_empty() {
+        let owner_id = match usr2uid(&b.owner) {
+            Ok(id) => id,
+            _ => return Err(InstallError::NoSuchUser(b.owner.clone()).into()),
         };
-        if owner_id != to_meta.uid() {
-            return Ok(true);
+        if owner_id != to_meta.uid() {
+            return Ok(true);
         }
-    } else if !b.group.is_empty() {
-        let group_id = match grp2gid(&b.group) {
-            Ok(id) => id,
-            _ => return Err(InstallError::NoSuchGroup(b.group.clone()).into()),
+    } else if !b.group.is_empty() {
+        let group_id = match grp2gid(&b.group) {
+            Ok(id) => id,
+            _ => return Err(InstallError::NoSuchGroup(b.group.clone()).into()),
         };
-        if group_id != to_meta.gid() {
-            return Ok(true);
+        if group_id != to_meta.gid() {
+            return Ok(true);
         }
-    } else {
-        #[cfg(not(target_os = "windows"))]
-        unsafe {
-            if to_meta.uid() != geteuid() || to_meta.gid() != getegid() {
-                return Ok(true);
+    } else {
+        #[cfg(not(target_os = "windows"))]
+        unsafe {
+            if to_meta.uid() != geteuid() || to_meta.gid() != getegid() {
+                return Ok(true);
             }
         }
     }
 
-    if !diff(from.to_str().unwrap(), to.to_str().unwrap()) {
-        return Ok(true);
+    if !diff(from.to_str().unwrap(), to.to_str().unwrap()) {
+        return Ok(true);
     }
 
     Ok(false)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_install/mode.rs.html b/dev/src/uu_install/mode.rs.html index 18897ce0a..c1b15f865 100644 --- a/dev/src/uu_install/mode.rs.html +++ b/dev/src/uu_install/mode.rs.html @@ -1,4 +1,4 @@ -mode.rs - source
1
+mode.rs - source
1
 2
 3
 4
@@ -37,44 +37,44 @@
 37
 38
 39
-
use std::fs;
-use std::path::Path;
-#[cfg(not(windows))]
-use uucore::mode;
+
use std::fs;
+use std::path::Path;
+#[cfg(not(windows))]
+use uucore::mode;
 
-/// Takes a user-supplied string and tries to parse to u16 mode bitmask.
-pub fn parse(mode_string: &str, considering_dir: bool, umask: u32) -> Result<u32, String> {
-    let numbers: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
+/// Takes a user-supplied string and tries to parse to u16 mode bitmask.
+pub fn parse(mode_string: &str, considering_dir: bool, umask: u32) -> Result<u32, String> {
+    let numbers: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
 
-    // Passing 000 as the existing permissions seems to mirror GNU behavior.
-    if mode_string.contains(numbers) {
-        mode::parse_numeric(0, mode_string, considering_dir)
-    } else {
-        mode::parse_symbolic(0, mode_string, umask, considering_dir)
+    // Passing 000 as the existing permissions seems to mirror GNU behavior.
+    if mode_string.contains(numbers) {
+        mode::parse_numeric(0, mode_string, considering_dir)
+    } else {
+        mode::parse_symbolic(0, mode_string, umask, considering_dir)
     }
 }
 
-/// chmod a file or directory on UNIX.
-///
-/// Adapted from mkdir.rs.  Handles own error printing.
-///
-#[cfg(any(unix, target_os = "redox"))]
-pub fn chmod(path: &Path, mode: u32) -> Result<(), ()> {
-    use std::os::unix::fs::PermissionsExt;
-    use uucore::display::Quotable;
-    fs::set_permissions(path, fs::Permissions::from_mode(mode)).map_err(|err| {
-        show_error!("{}: chmod failed with error {}", path.maybe_quote(), err);
+/// chmod a file or directory on UNIX.
+///
+/// Adapted from mkdir.rs.  Handles own error printing.
+///
+#[cfg(any(unix, target_os = "redox"))]
+pub fn chmod(path: &Path, mode: u32) -> Result<(), ()> {
+    use std::os::unix::fs::PermissionsExt;
+    use uucore::display::Quotable;
+    fs::set_permissions(path, fs::Permissions::from_mode(mode)).map_err(|err| {
+        show_error!("{}: chmod failed with error {}", path.maybe_quote(), err);
     })
 }
 
-/// chmod a file or directory on Windows.
-///
-/// Adapted from mkdir.rs.
-///
-#[cfg(windows)]
-pub fn chmod(path: &Path, mode: u32) -> Result<(), ()> {
-    // chmod on Windows only sets the readonly flag, which isn't even honored on directories
-    Ok(())
+/// chmod a file or directory on Windows.
+///
+/// Adapted from mkdir.rs.
+///
+#[cfg(windows)]
+pub fn chmod(path: &Path, mode: u32) -> Result<(), ()> {
+    // chmod on Windows only sets the readonly flag, which isn't even honored on directories
+    Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_join/join.rs.html b/dev/src/uu_join/join.rs.html index 7c935511a..716e70a63 100644 --- a/dev/src/uu_join/join.rs.html +++ b/dev/src/uu_join/join.rs.html @@ -1,4 +1,4 @@ -join.rs - source
1
+join.rs - source
1
 2
 3
 4
@@ -1004,1011 +1004,1011 @@
 1004
 1005
 1006
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Konstantin Pospelov <kupospelov@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Konstantin Pospelov <kupospelov@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) autoformat FILENUM whitespaces pairable unpairable nocheck
+// spell-checker:ignore (ToDO) autoformat FILENUM whitespaces pairable unpairable nocheck
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::builder::ValueParser;
-use clap::{crate_version, Arg, ArgAction, Command};
-use memchr::{memchr3_iter, memchr_iter};
-use std::cmp::Ordering;
-use std::convert::From;
-use std::error::Error;
-use std::ffi::OsString;
-use std::fmt::Display;
-use std::fs::File;
-use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Split, Stdin, Write};
-use std::num::IntErrorKind;
-#[cfg(unix)]
-use std::os::unix::ffi::OsStrExt;
-use uucore::display::Quotable;
-use uucore::error::{set_exit_code, UError, UResult, USimpleError};
+use clap::builder::ValueParser;
+use clap::{crate_version, Arg, ArgAction, Command};
+use memchr::{memchr3_iter, memchr_iter};
+use std::cmp::Ordering;
+use std::convert::From;
+use std::error::Error;
+use std::ffi::OsString;
+use std::fmt::Display;
+use std::fs::File;
+use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Split, Stdin, Write};
+use std::num::IntErrorKind;
+#[cfg(unix)]
+use std::os::unix::ffi::OsStrExt;
+use uucore::display::Quotable;
+use uucore::error::{set_exit_code, UError, UResult, USimpleError};
 
-static NAME: &str = "join";
+static NAME: &str = "join";
 
-#[derive(Debug)]
-enum JoinError {
-    IOError(std::io::Error),
-    UnorderedInput(String),
+#[derive(Debug)]
+enum JoinError {
+    IOError(std::io::Error),
+    UnorderedInput(String),
 }
 
-impl UError for JoinError {
-    fn code(&self) -> i32 {
-        1
-    }
+impl UError for JoinError {
+    fn code(&self) -> i32 {
+        1
+    }
 }
 
-impl Error for JoinError {}
+impl Error for JoinError {}
 
-impl Display for JoinError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::IOError(e) => write!(f, "io error: {}", e),
-            Self::UnorderedInput(e) => f.write_str(e),
+impl Display for JoinError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::IOError(e) => write!(f, "io error: {}", e),
+            Self::UnorderedInput(e) => f.write_str(e),
         }
     }
 }
 
-impl From<std::io::Error> for JoinError {
-    fn from(error: std::io::Error) -> Self {
-        Self::IOError(error)
+impl From<std::io::Error> for JoinError {
+    fn from(error: std::io::Error) -> Self {
+        Self::IOError(error)
     }
 }
 
-#[derive(Copy, Clone, PartialEq)]
-enum FileNum {
-    File1,
-    File2,
+#[derive(Copy, Clone, PartialEq)]
+enum FileNum {
+    File1,
+    File2,
 }
 
-#[repr(u8)]
-#[derive(Copy, Clone)]
-enum LineEnding {
-    Nul = 0,
-    Newline = b'\n',
+#[repr(u8)]
+#[derive(Copy, Clone)]
+enum LineEnding {
+    Nul = 0,
+    Newline = b'\n',
 }
 
-#[derive(Copy, Clone, PartialEq)]
-enum Sep {
-    Char(u8),
-    Line,
-    Whitespaces,
+#[derive(Copy, Clone, PartialEq)]
+enum Sep {
+    Char(u8),
+    Line,
+    Whitespaces,
 }
 
-#[derive(Copy, Clone, PartialEq)]
-enum CheckOrder {
-    Default,
-    Disabled,
-    Enabled,
+#[derive(Copy, Clone, PartialEq)]
+enum CheckOrder {
+    Default,
+    Disabled,
+    Enabled,
 }
 
-struct Settings {
-    key1: usize,
-    key2: usize,
-    print_unpaired1: bool,
-    print_unpaired2: bool,
-    print_joined: bool,
-    ignore_case: bool,
-    line_ending: LineEnding,
-    separator: Sep,
-    autoformat: bool,
-    format: Vec<Spec>,
-    empty: Vec<u8>,
-    check_order: CheckOrder,
-    headers: bool,
+struct Settings {
+    key1: usize,
+    key2: usize,
+    print_unpaired1: bool,
+    print_unpaired2: bool,
+    print_joined: bool,
+    ignore_case: bool,
+    line_ending: LineEnding,
+    separator: Sep,
+    autoformat: bool,
+    format: Vec<Spec>,
+    empty: Vec<u8>,
+    check_order: CheckOrder,
+    headers: bool,
 }
 
-impl Default for Settings {
-    fn default() -> Self {
-        Self {
-            key1: 0,
-            key2: 0,
-            print_unpaired1: false,
-            print_unpaired2: false,
-            print_joined: true,
-            ignore_case: false,
-            line_ending: LineEnding::Newline,
-            separator: Sep::Whitespaces,
-            autoformat: false,
-            format: vec![],
-            empty: vec![],
-            check_order: CheckOrder::Default,
-            headers: false,
+impl Default for Settings {
+    fn default() -> Self {
+        Self {
+            key1: 0,
+            key2: 0,
+            print_unpaired1: false,
+            print_unpaired2: false,
+            print_joined: true,
+            ignore_case: false,
+            line_ending: LineEnding::Newline,
+            separator: Sep::Whitespaces,
+            autoformat: false,
+            format: vec![],
+            empty: vec![],
+            check_order: CheckOrder::Default,
+            headers: false,
         }
     }
 }
 
-/// Output representation.
-struct Repr<'a> {
-    line_ending: LineEnding,
-    separator: u8,
-    format: &'a [Spec],
-    empty: &'a [u8],
+/// Output representation.
+struct Repr<'a> {
+    line_ending: LineEnding,
+    separator: u8,
+    format: &'a [Spec],
+    empty: &'a [u8],
 }
 
-impl<'a> Repr<'a> {
-    fn new(
-        line_ending: LineEnding,
-        separator: u8,
-        format: &'a [Spec],
-        empty: &'a [u8],
-    ) -> Repr<'a> {
-        Repr {
-            line_ending,
-            separator,
-            format,
-            empty,
+impl<'a> Repr<'a> {
+    fn new(
+        line_ending: LineEnding,
+        separator: u8,
+        format: &'a [Spec],
+        empty: &'a [u8],
+    ) -> Repr<'a> {
+        Repr {
+            line_ending,
+            separator,
+            format,
+            empty,
         }
     }
 
-    fn uses_format(&self) -> bool {
-        !self.format.is_empty()
+    fn uses_format(&self) -> bool {
+        !self.format.is_empty()
     }
 
-    /// Print the field or empty filler if the field is not set.
-    fn print_field(
+    /// Print the field or empty filler if the field is not set.
+    fn print_field(
         &self,
-        writer: &mut impl Write,
-        field: Option<&[u8]>,
-    ) -> Result<(), std::io::Error> {
-        let value = match field {
-            Some(field) => field,
-            None => self.empty,
+        writer: &mut impl Write,
+        field: Option<&[u8]>,
+    ) -> Result<(), std::io::Error> {
+        let value = match field {
+            Some(field) => field,
+            None => self.empty,
         };
 
-        writer.write_all(value)
+        writer.write_all(value)
     }
 
-    /// Print each field except the one at the index.
-    fn print_fields(
+    /// Print each field except the one at the index.
+    fn print_fields(
         &self,
-        writer: &mut impl Write,
-        line: &Line,
-        index: usize,
-    ) -> Result<(), std::io::Error> {
-        for i in 0..line.field_ranges.len() {
-            if i != index {
-                writer.write_all(&[self.separator])?;
-                writer.write_all(line.get_field(i).unwrap())?;
+        writer: &mut impl Write,
+        line: &Line,
+        index: usize,
+    ) -> Result<(), std::io::Error> {
+        for i in 0..line.field_ranges.len() {
+            if i != index {
+                writer.write_all(&[self.separator])?;
+                writer.write_all(line.get_field(i).unwrap())?;
             }
         }
         Ok(())
     }
 
-    /// Print each field or the empty filler if the field is not set.
-    fn print_format<F>(&self, writer: &mut impl Write, f: F) -> Result<(), std::io::Error>
-    where
-        F: Fn(&Spec) -> Option<&'a [u8]>,
+    /// Print each field or the empty filler if the field is not set.
+    fn print_format<F>(&self, writer: &mut impl Write, f: F) -> Result<(), std::io::Error>
+    where
+        F: Fn(&Spec) -> Option<&'a [u8]>,
     {
-        for i in 0..self.format.len() {
-            if i > 0 {
-                writer.write_all(&[self.separator])?;
+        for i in 0..self.format.len() {
+            if i > 0 {
+                writer.write_all(&[self.separator])?;
             }
 
-            let field = match f(&self.format[i]) {
-                Some(value) => value,
-                None => self.empty,
+            let field = match f(&self.format[i]) {
+                Some(value) => value,
+                None => self.empty,
             };
 
-            writer.write_all(field)?;
+            writer.write_all(field)?;
         }
         Ok(())
     }
 
-    fn print_line_ending(&self, writer: &mut impl Write) -> Result<(), std::io::Error> {
-        writer.write_all(&[self.line_ending as u8])
+    fn print_line_ending(&self, writer: &mut impl Write) -> Result<(), std::io::Error> {
+        writer.write_all(&[self.line_ending as u8])
     }
 }
 
-/// Input processing parameters.
-struct Input {
-    separator: Sep,
-    ignore_case: bool,
-    check_order: CheckOrder,
+/// Input processing parameters.
+struct Input {
+    separator: Sep,
+    ignore_case: bool,
+    check_order: CheckOrder,
 }
 
-impl Input {
-    fn new(separator: Sep, ignore_case: bool, check_order: CheckOrder) -> Self {
-        Self {
-            separator,
-            ignore_case,
-            check_order,
+impl Input {
+    fn new(separator: Sep, ignore_case: bool, check_order: CheckOrder) -> Self {
+        Self {
+            separator,
+            ignore_case,
+            check_order,
         }
     }
 
-    fn compare(&self, field1: Option<&[u8]>, field2: Option<&[u8]>) -> Ordering {
-        if let (Some(field1), Some(field2)) = (field1, field2) {
-            if self.ignore_case {
-                field1
-                    .to_ascii_lowercase()
-                    .cmp(&field2.to_ascii_lowercase())
-            } else {
-                field1.cmp(field2)
+    fn compare(&self, field1: Option<&[u8]>, field2: Option<&[u8]>) -> Ordering {
+        if let (Some(field1), Some(field2)) = (field1, field2) {
+            if self.ignore_case {
+                field1
+                    .to_ascii_lowercase()
+                    .cmp(&field2.to_ascii_lowercase())
+            } else {
+                field1.cmp(field2)
             }
-        } else {
-            match field1 {
-                Some(_) => Ordering::Greater,
-                None => match field2 {
-                    Some(_) => Ordering::Less,
-                    None => Ordering::Equal,
+        } else {
+            match field1 {
+                Some(_) => Ordering::Greater,
+                None => match field2 {
+                    Some(_) => Ordering::Less,
+                    None => Ordering::Equal,
                 },
             }
         }
     }
 }
 
-enum Spec {
-    Key,
-    Field(FileNum, usize),
+enum Spec {
+    Key,
+    Field(FileNum, usize),
 }
 
-impl Spec {
-    fn parse(format: &str) -> UResult<Self> {
-        let mut chars = format.chars();
+impl Spec {
+    fn parse(format: &str) -> UResult<Self> {
+        let mut chars = format.chars();
 
-        let file_num = match chars.next() {
+        let file_num = match chars.next() {
             Some('0') => {
-                // Must be all alone without a field specifier.
-                if chars.next().is_none() {
-                    return Ok(Self::Key);
+                // Must be all alone without a field specifier.
+                if chars.next().is_none() {
+                    return Ok(Self::Key);
                 }
-                return Err(USimpleError::new(
+                return Err(USimpleError::new(
                     1,
-                    format!("invalid field specifier: {}", format.quote()),
+                    format!("invalid field specifier: {}", format.quote()),
                 ));
             }
-            Some('1') => FileNum::File1,
-            Some('2') => FileNum::File2,
-            _ => {
-                return Err(USimpleError::new(
+            Some('1') => FileNum::File1,
+            Some('2') => FileNum::File2,
+            _ => {
+                return Err(USimpleError::new(
                     1,
-                    format!("invalid file number in field spec: {}", format.quote()),
+                    format!("invalid file number in field spec: {}", format.quote()),
                 ));
             }
         };
 
-        if let Some('.') = chars.next() {
-            return Ok(Self::Field(file_num, parse_field_number(chars.as_str())?));
+        if let Some('.') = chars.next() {
+            return Ok(Self::Field(file_num, parse_field_number(chars.as_str())?));
         }
 
-        Err(USimpleError::new(
+        Err(USimpleError::new(
             1,
-            format!("invalid field specifier: {}", format.quote()),
+            format!("invalid field specifier: {}", format.quote()),
         ))
     }
 }
 
-struct Line {
-    field_ranges: Vec<(usize, usize)>,
-    string: Vec<u8>,
+struct Line {
+    field_ranges: Vec<(usize, usize)>,
+    string: Vec<u8>,
 }
 
-impl Line {
-    fn new(string: Vec<u8>, separator: Sep, len_guess: usize) -> Self {
-        let mut field_ranges = Vec::with_capacity(len_guess);
-        let mut last_end = 0;
-        if separator == Sep::Whitespaces {
-            // GNU join uses Bourne shell field splitters by default
-            for i in memchr3_iter(b' ', b'\t', b'\n', &string) {
-                if i > last_end {
-                    field_ranges.push((last_end, i));
+impl Line {
+    fn new(string: Vec<u8>, separator: Sep, len_guess: usize) -> Self {
+        let mut field_ranges = Vec::with_capacity(len_guess);
+        let mut last_end = 0;
+        if separator == Sep::Whitespaces {
+            // GNU join uses Bourne shell field splitters by default
+            for i in memchr3_iter(b' ', b'\t', b'\n', &string) {
+                if i > last_end {
+                    field_ranges.push((last_end, i));
                 }
-                last_end = i + 1;
+                last_end = i + 1;
             }
-        } else if let Sep::Char(sep) = separator {
-            for i in memchr_iter(sep, &string) {
-                field_ranges.push((last_end, i));
-                last_end = i + 1;
+        } else if let Sep::Char(sep) = separator {
+            for i in memchr_iter(sep, &string) {
+                field_ranges.push((last_end, i));
+                last_end = i + 1;
             }
         }
-        field_ranges.push((last_end, string.len()));
+        field_ranges.push((last_end, string.len()));
 
-        Self {
-            field_ranges,
-            string,
+        Self {
+            field_ranges,
+            string,
         }
     }
 
-    /// Get field at index.
-    fn get_field(&self, index: usize) -> Option<&[u8]> {
-        if index < self.field_ranges.len() {
-            let (low, high) = self.field_ranges[index];
-            Some(&self.string[low..high])
-        } else {
-            None
-        }
+    /// Get field at index.
+    fn get_field(&self, index: usize) -> Option<&[u8]> {
+        if index < self.field_ranges.len() {
+            let (low, high) = self.field_ranges[index];
+            Some(&self.string[low..high])
+        } else {
+            None
+        }
     }
 }
 
-struct State<'a> {
-    key: usize,
-    file_name: &'a str,
-    file_num: FileNum,
-    print_unpaired: bool,
-    lines: Split<Box<dyn BufRead + 'a>>,
-    max_len: usize,
-    seq: Vec<Line>,
-    line_num: usize,
-    has_failed: bool,
-    has_unpaired: bool,
+struct State<'a> {
+    key: usize,
+    file_name: &'a str,
+    file_num: FileNum,
+    print_unpaired: bool,
+    lines: Split<Box<dyn BufRead + 'a>>,
+    max_len: usize,
+    seq: Vec<Line>,
+    line_num: usize,
+    has_failed: bool,
+    has_unpaired: bool,
 }
 
-impl<'a> State<'a> {
-    fn new(
-        file_num: FileNum,
-        name: &'a str,
-        stdin: &'a Stdin,
-        key: usize,
-        line_ending: LineEnding,
-        print_unpaired: bool,
-    ) -> State<'a> {
-        let f = if name == "-" {
-            Box::new(stdin.lock()) as Box<dyn BufRead>
-        } else {
-            match File::open(name) {
-                Ok(file) => Box::new(BufReader::new(file)) as Box<dyn BufRead>,
-                Err(err) => crash!(1, "{}: {}", name.maybe_quote(), err),
+impl<'a> State<'a> {
+    fn new(
+        file_num: FileNum,
+        name: &'a str,
+        stdin: &'a Stdin,
+        key: usize,
+        line_ending: LineEnding,
+        print_unpaired: bool,
+    ) -> State<'a> {
+        let f = if name == "-" {
+            Box::new(stdin.lock()) as Box<dyn BufRead>
+        } else {
+            match File::open(name) {
+                Ok(file) => Box::new(BufReader::new(file)) as Box<dyn BufRead>,
+                Err(err) => crash!(1, "{}: {}", name.maybe_quote(), err),
             }
         };
 
-        State {
-            key,
-            file_name: name,
-            file_num,
-            print_unpaired,
-            lines: f.split(line_ending as u8),
-            max_len: 1,
-            seq: Vec::new(),
-            line_num: 0,
-            has_failed: false,
-            has_unpaired: false,
+        State {
+            key,
+            file_name: name,
+            file_num,
+            print_unpaired,
+            lines: f.split(line_ending as u8),
+            max_len: 1,
+            seq: Vec::new(),
+            line_num: 0,
+            has_failed: false,
+            has_unpaired: false,
         }
     }
 
-    /// Skip the current unpaired line.
-    fn skip_line(
-        &mut self,
-        writer: &mut impl Write,
-        input: &Input,
-        repr: &Repr,
-    ) -> Result<(), JoinError> {
-        if self.print_unpaired {
-            self.print_first_line(writer, repr)?;
+    /// Skip the current unpaired line.
+    fn skip_line(
+        &mut self,
+        writer: &mut impl Write,
+        input: &Input,
+        repr: &Repr,
+    ) -> Result<(), JoinError> {
+        if self.print_unpaired {
+            self.print_first_line(writer, repr)?;
         }
 
-        self.reset_next_line(input)?;
+        self.reset_next_line(input)?;
         Ok(())
     }
 
-    /// Keep reading line sequence until the key does not change, return
-    /// the first line whose key differs.
-    fn extend(&mut self, input: &Input) -> Result<Option<Line>, JoinError> {
-        while let Some(line) = self.next_line(input)? {
-            let diff = input.compare(self.get_current_key(), line.get_field(self.key));
+    /// Keep reading line sequence until the key does not change, return
+    /// the first line whose key differs.
+    fn extend(&mut self, input: &Input) -> Result<Option<Line>, JoinError> {
+        while let Some(line) = self.next_line(input)? {
+            let diff = input.compare(self.get_current_key(), line.get_field(self.key));
 
-            if diff == Ordering::Equal {
-                self.seq.push(line);
-            } else {
-                return Ok(Some(line));
+            if diff == Ordering::Equal {
+                self.seq.push(line);
+            } else {
+                return Ok(Some(line));
             }
         }
 
         Ok(None)
     }
 
-    /// Print lines in the buffers as headers.
-    fn print_headers(
+    /// Print lines in the buffers as headers.
+    fn print_headers(
         &self,
-        writer: &mut impl Write,
-        other: &State,
-        repr: &Repr,
-    ) -> Result<(), std::io::Error> {
-        if self.has_line() {
-            if other.has_line() {
-                self.combine(writer, other, repr)?;
-            } else {
-                self.print_first_line(writer, repr)?;
+        writer: &mut impl Write,
+        other: &State,
+        repr: &Repr,
+    ) -> Result<(), std::io::Error> {
+        if self.has_line() {
+            if other.has_line() {
+                self.combine(writer, other, repr)?;
+            } else {
+                self.print_first_line(writer, repr)?;
             }
-        } else if other.has_line() {
-            other.print_first_line(writer, repr)?;
+        } else if other.has_line() {
+            other.print_first_line(writer, repr)?;
         }
 
         Ok(())
     }
 
-    /// Combine two line sequences.
-    fn combine(
+    /// Combine two line sequences.
+    fn combine(
         &self,
-        writer: &mut impl Write,
-        other: &State,
-        repr: &Repr,
-    ) -> Result<(), std::io::Error> {
-        let key = self.get_current_key();
+        writer: &mut impl Write,
+        other: &State,
+        repr: &Repr,
+    ) -> Result<(), std::io::Error> {
+        let key = self.get_current_key();
 
-        for line1 in &self.seq {
-            for line2 in &other.seq {
-                if repr.uses_format() {
-                    repr.print_format(writer, |spec| match *spec {
-                        Spec::Key => key,
-                        Spec::Field(file_num, field_num) => {
-                            if file_num == self.file_num {
-                                return line1.get_field(field_num);
+        for line1 in &self.seq {
+            for line2 in &other.seq {
+                if repr.uses_format() {
+                    repr.print_format(writer, |spec| match *spec {
+                        Spec::Key => key,
+                        Spec::Field(file_num, field_num) => {
+                            if file_num == self.file_num {
+                                return line1.get_field(field_num);
                             }
 
-                            if file_num == other.file_num {
-                                return line2.get_field(field_num);
+                            if file_num == other.file_num {
+                                return line2.get_field(field_num);
                             }
 
-                            None
-                        }
+                            None
+                        }
                     })?;
-                } else {
-                    repr.print_field(writer, key)?;
-                    repr.print_fields(writer, line1, self.key)?;
-                    repr.print_fields(writer, line2, other.key)?;
+                } else {
+                    repr.print_field(writer, key)?;
+                    repr.print_fields(writer, line1, self.key)?;
+                    repr.print_fields(writer, line2, other.key)?;
                 }
 
-                repr.print_line_ending(writer)?;
+                repr.print_line_ending(writer)?;
             }
         }
 
         Ok(())
     }
 
-    /// Reset with the next line.
-    fn reset(&mut self, next_line: Option<Line>) {
-        self.seq.clear();
+    /// Reset with the next line.
+    fn reset(&mut self, next_line: Option<Line>) {
+        self.seq.clear();
 
-        if let Some(line) = next_line {
-            self.seq.push(line);
+        if let Some(line) = next_line {
+            self.seq.push(line);
         }
     }
 
-    fn reset_read_line(&mut self, input: &Input) -> Result<(), std::io::Error> {
-        let line = self.read_line(input.separator)?;
-        self.reset(line);
+    fn reset_read_line(&mut self, input: &Input) -> Result<(), std::io::Error> {
+        let line = self.read_line(input.separator)?;
+        self.reset(line);
         Ok(())
     }
 
-    fn reset_next_line(&mut self, input: &Input) -> Result<(), JoinError> {
-        let line = self.next_line(input)?;
-        self.reset(line);
+    fn reset_next_line(&mut self, input: &Input) -> Result<(), JoinError> {
+        let line = self.next_line(input)?;
+        self.reset(line);
         Ok(())
     }
 
-    fn has_line(&self) -> bool {
-        !self.seq.is_empty()
+    fn has_line(&self) -> bool {
+        !self.seq.is_empty()
     }
 
-    fn initialize(&mut self, read_sep: Sep, autoformat: bool) -> usize {
-        if let Some(line) = crash_if_err!(1, self.read_line(read_sep)) {
-            self.seq.push(line);
+    fn initialize(&mut self, read_sep: Sep, autoformat: bool) -> usize {
+        if let Some(line) = crash_if_err!(1, self.read_line(read_sep)) {
+            self.seq.push(line);
 
-            if autoformat {
-                return self.seq[0].field_ranges.len();
+            if autoformat {
+                return self.seq[0].field_ranges.len();
             }
         }
-        0
-    }
+        0
+    }
 
-    fn finalize(
-        &mut self,
-        writer: &mut impl Write,
-        input: &Input,
-        repr: &Repr,
-    ) -> Result<(), JoinError> {
-        if self.has_line() {
-            if self.print_unpaired {
-                self.print_first_line(writer, repr)?;
+    fn finalize(
+        &mut self,
+        writer: &mut impl Write,
+        input: &Input,
+        repr: &Repr,
+    ) -> Result<(), JoinError> {
+        if self.has_line() {
+            if self.print_unpaired {
+                self.print_first_line(writer, repr)?;
             }
 
-            let mut next_line = self.next_line(input)?;
-            while let Some(line) = &next_line {
-                if self.print_unpaired {
-                    self.print_line(writer, line, repr)?;
+            let mut next_line = self.next_line(input)?;
+            while let Some(line) = &next_line {
+                if self.print_unpaired {
+                    self.print_line(writer, line, repr)?;
                 }
-                self.reset(next_line);
-                next_line = self.next_line(input)?;
+                self.reset(next_line);
+                next_line = self.next_line(input)?;
             }
         }
 
         Ok(())
     }
 
-    /// Get the next line without the order check.
-    fn read_line(&mut self, sep: Sep) -> Result<Option<Line>, std::io::Error> {
-        match self.lines.next() {
-            Some(value) => {
-                self.line_num += 1;
-                let line = Line::new(value?, sep, self.max_len);
-                if line.field_ranges.len() > self.max_len {
-                    self.max_len = line.field_ranges.len();
+    /// Get the next line without the order check.
+    fn read_line(&mut self, sep: Sep) -> Result<Option<Line>, std::io::Error> {
+        match self.lines.next() {
+            Some(value) => {
+                self.line_num += 1;
+                let line = Line::new(value?, sep, self.max_len);
+                if line.field_ranges.len() > self.max_len {
+                    self.max_len = line.field_ranges.len();
                 }
-                Ok(Some(line))
+                Ok(Some(line))
             }
-            None => Ok(None),
+            None => Ok(None),
         }
     }
 
-    /// Get the next line with the order check.
-    fn next_line(&mut self, input: &Input) -> Result<Option<Line>, JoinError> {
-        if let Some(line) = self.read_line(input.separator)? {
-            if input.check_order == CheckOrder::Disabled {
-                return Ok(Some(line));
+    /// Get the next line with the order check.
+    fn next_line(&mut self, input: &Input) -> Result<Option<Line>, JoinError> {
+        if let Some(line) = self.read_line(input.separator)? {
+            if input.check_order == CheckOrder::Disabled {
+                return Ok(Some(line));
             }
 
-            let diff = input.compare(self.get_current_key(), line.get_field(self.key));
+            let diff = input.compare(self.get_current_key(), line.get_field(self.key));
 
-            if diff == Ordering::Greater
-                && (input.check_order == CheckOrder::Enabled
-                    || (self.has_unpaired && !self.has_failed))
+            if diff == Ordering::Greater
+                && (input.check_order == CheckOrder::Enabled
+                    || (self.has_unpaired && !self.has_failed))
             {
-                let err_msg = format!(
+                let err_msg = format!(
                     "{}:{}: is not sorted: {}",
-                    self.file_name.maybe_quote(),
-                    self.line_num,
-                    String::from_utf8_lossy(&line.string)
+                    self.file_name.maybe_quote(),
+                    self.line_num,
+                    String::from_utf8_lossy(&line.string)
                 );
-                // This is fatal if the check is enabled.
-                if input.check_order == CheckOrder::Enabled {
-                    return Err(JoinError::UnorderedInput(err_msg));
+                // This is fatal if the check is enabled.
+                if input.check_order == CheckOrder::Enabled {
+                    return Err(JoinError::UnorderedInput(err_msg));
                 }
-                eprintln!("{}: {}", uucore::execution_phrase(), err_msg);
-                self.has_failed = true;
+                eprintln!("{}: {}", uucore::execution_phrase(), err_msg);
+                self.has_failed = true;
             }
 
-            Ok(Some(line))
-        } else {
+            Ok(Some(line))
+        } else {
             Ok(None)
         }
     }
 
-    /// Gets the key value of the lines stored in seq.
-    fn get_current_key(&self) -> Option<&[u8]> {
-        self.seq[0].get_field(self.key)
+    /// Gets the key value of the lines stored in seq.
+    fn get_current_key(&self) -> Option<&[u8]> {
+        self.seq[0].get_field(self.key)
     }
 
-    fn print_line(
+    fn print_line(
         &self,
-        writer: &mut impl Write,
-        line: &Line,
-        repr: &Repr,
-    ) -> Result<(), std::io::Error> {
-        if repr.uses_format() {
-            repr.print_format(writer, |spec| match *spec {
-                Spec::Key => line.get_field(self.key),
-                Spec::Field(file_num, field_num) => {
-                    if file_num == self.file_num {
-                        line.get_field(field_num)
-                    } else {
-                        None
-                    }
+        writer: &mut impl Write,
+        line: &Line,
+        repr: &Repr,
+    ) -> Result<(), std::io::Error> {
+        if repr.uses_format() {
+            repr.print_format(writer, |spec| match *spec {
+                Spec::Key => line.get_field(self.key),
+                Spec::Field(file_num, field_num) => {
+                    if file_num == self.file_num {
+                        line.get_field(field_num)
+                    } else {
+                        None
+                    }
                 }
             })?;
-        } else {
-            repr.print_field(writer, line.get_field(self.key))?;
-            repr.print_fields(writer, line, self.key)?;
+        } else {
+            repr.print_field(writer, line.get_field(self.key))?;
+            repr.print_fields(writer, line, self.key)?;
         }
 
-        repr.print_line_ending(writer)
+        repr.print_line_ending(writer)
     }
 
-    fn print_first_line(&self, writer: &mut impl Write, repr: &Repr) -> Result<(), std::io::Error> {
-        self.print_line(writer, &self.seq[0], repr)
+    fn print_first_line(&self, writer: &mut impl Write, repr: &Repr) -> Result<(), std::io::Error> {
+        self.print_line(writer, &self.seq[0], repr)
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let keys = parse_field_number_option(matches.get_one::<String>("j").map(|s| s.as_str()))?;
-    let key1 = parse_field_number_option(matches.get_one::<String>("1").map(|s| s.as_str()))?;
-    let key2 = parse_field_number_option(matches.get_one::<String>("2").map(|s| s.as_str()))?;
+    let keys = parse_field_number_option(matches.get_one::<String>("j").map(|s| s.as_str()))?;
+    let key1 = parse_field_number_option(matches.get_one::<String>("1").map(|s| s.as_str()))?;
+    let key2 = parse_field_number_option(matches.get_one::<String>("2").map(|s| s.as_str()))?;
 
-    let mut settings: Settings = Default::default();
+    let mut settings: Settings = Default::default();
 
-    let v_values = matches.get_many::<String>("v");
-    if v_values.is_some() {
-        settings.print_joined = false;
+    let v_values = matches.get_many::<String>("v");
+    if v_values.is_some() {
+        settings.print_joined = false;
     }
 
-    let unpaired = v_values
-        .unwrap_or_default()
-        .chain(matches.get_many("a").unwrap_or_default());
-    for file_num in unpaired {
-        match parse_file_number(file_num)? {
-            FileNum::File1 => settings.print_unpaired1 = true,
-            FileNum::File2 => settings.print_unpaired2 = true,
+    let unpaired = v_values
+        .unwrap_or_default()
+        .chain(matches.get_many("a").unwrap_or_default());
+    for file_num in unpaired {
+        match parse_file_number(file_num)? {
+            FileNum::File1 => settings.print_unpaired1 = true,
+            FileNum::File2 => settings.print_unpaired2 = true,
         }
     }
 
-    settings.ignore_case = matches.get_flag("i");
-    settings.key1 = get_field_number(keys, key1)?;
-    settings.key2 = get_field_number(keys, key2)?;
+    settings.ignore_case = matches.get_flag("i");
+    settings.key1 = get_field_number(keys, key1)?;
+    settings.key2 = get_field_number(keys, key2)?;
 
-    if let Some(value_os) = matches.get_one::<OsString>("t") {
-        #[cfg(unix)]
-        let value = value_os.as_bytes();
-        #[cfg(not(unix))]
-        let value = match value_os.to_str() {
-            Some(value) => value.as_bytes(),
-            None => {
-                return Err(USimpleError::new(
+    if let Some(value_os) = matches.get_one::<OsString>("t") {
+        #[cfg(unix)]
+        let value = value_os.as_bytes();
+        #[cfg(not(unix))]
+        let value = match value_os.to_str() {
+            Some(value) => value.as_bytes(),
+            None => {
+                return Err(USimpleError::new(
                     1,
                     "unprintable field separators are only supported on unix-like platforms",
                 ))
             }
         };
-        settings.separator = match value.len() {
-            0 => Sep::Line,
-            1 => Sep::Char(value[0]),
-            2 if value[0] == b'\\' && value[1] == b'0' => Sep::Char(0),
-            _ => {
-                return Err(USimpleError::new(
+        settings.separator = match value.len() {
+            0 => Sep::Line,
+            1 => Sep::Char(value[0]),
+            2 if value[0] == b'\\' && value[1] == b'0' => Sep::Char(0),
+            _ => {
+                return Err(USimpleError::new(
                     1,
-                    format!("multi-character tab {}", value_os.to_string_lossy()),
+                    format!("multi-character tab {}", value_os.to_string_lossy()),
                 ))
             }
         };
     }
 
-    if let Some(format) = matches.get_one::<String>("o") {
-        if format == "auto" {
-            settings.autoformat = true;
-        } else {
-            let mut specs = vec![];
-            for part in format.split(|c| c == ' ' || c == ',' || c == '\t') {
-                specs.push(Spec::parse(part)?);
+    if let Some(format) = matches.get_one::<String>("o") {
+        if format == "auto" {
+            settings.autoformat = true;
+        } else {
+            let mut specs = vec![];
+            for part in format.split(|c| c == ' ' || c == ',' || c == '\t') {
+                specs.push(Spec::parse(part)?);
             }
-            settings.format = specs;
+            settings.format = specs;
         }
     }
 
-    if let Some(empty) = matches.get_one::<String>("e") {
-        settings.empty = empty.as_bytes().to_vec();
+    if let Some(empty) = matches.get_one::<String>("e") {
+        settings.empty = empty.as_bytes().to_vec();
     }
 
-    if matches.get_flag("nocheck-order") {
-        settings.check_order = CheckOrder::Disabled;
+    if matches.get_flag("nocheck-order") {
+        settings.check_order = CheckOrder::Disabled;
     }
 
-    if matches.get_flag("check-order") {
-        settings.check_order = CheckOrder::Enabled;
+    if matches.get_flag("check-order") {
+        settings.check_order = CheckOrder::Enabled;
     }
 
-    if matches.get_flag("header") {
-        settings.headers = true;
+    if matches.get_flag("header") {
+        settings.headers = true;
     }
 
-    if matches.get_flag("z") {
-        settings.line_ending = LineEnding::Nul;
+    if matches.get_flag("z") {
+        settings.line_ending = LineEnding::Nul;
     }
 
-    let file1 = matches.get_one::<String>("file1").unwrap();
-    let file2 = matches.get_one::<String>("file2").unwrap();
+    let file1 = matches.get_one::<String>("file1").unwrap();
+    let file2 = matches.get_one::<String>("file2").unwrap();
 
-    if file1 == "-" && file2 == "-" {
-        return Err(USimpleError::new(1, "both files cannot be standard input"));
+    if file1 == "-" && file2 == "-" {
+        return Err(USimpleError::new(1, "both files cannot be standard input"));
     }
 
-    match exec(file1, file2, settings) {
+    match exec(file1, file2, settings) {
         Ok(_) => Ok(()),
-        Err(e) => Err(USimpleError::new(1, format!("{}", e))),
+        Err(e) => Err(USimpleError::new(1, format!("{}", e))),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(NAME)
-        .version(crate_version!())
-        .about(
+pub fn uu_app() -> Command {
+    Command::new(NAME)
+        .version(crate_version!())
+        .about(
             "For each pair of input lines with identical join fields, write a line to
 standard output. The default join field is the first, delimited by blanks.
 
 When FILE1 or FILE2 (not both) is -, read standard input.",
         )
-        .infer_long_args(true)
-        .arg(
-            Arg::new("a")
-                .short('a')
-                .action(ArgAction::Append)
-                .num_args(1)
-                .value_parser(["1", "2"])
-                .value_name("FILENUM")
-                .help(
+        .infer_long_args(true)
+        .arg(
+            Arg::new("a")
+                .short('a')
+                .action(ArgAction::Append)
+                .num_args(1)
+                .value_parser(["1", "2"])
+                .value_name("FILENUM")
+                .help(
                     "also print unpairable lines from file FILENUM, where
 FILENUM is 1 or 2, corresponding to FILE1 or FILE2",
                 ),
         )
-        .arg(
-            Arg::new("v")
-                .short('v')
-                .action(ArgAction::Append)
-                .num_args(1)
-                .value_parser(["1", "2"])
-                .value_name("FILENUM")
-                .help("like -a FILENUM, but suppress joined output lines"),
+        .arg(
+            Arg::new("v")
+                .short('v')
+                .action(ArgAction::Append)
+                .num_args(1)
+                .value_parser(["1", "2"])
+                .value_name("FILENUM")
+                .help("like -a FILENUM, but suppress joined output lines"),
         )
-        .arg(
-            Arg::new("e")
-                .short('e')
-                .value_name("EMPTY")
-                .help("replace missing input fields with EMPTY"),
+        .arg(
+            Arg::new("e")
+                .short('e')
+                .value_name("EMPTY")
+                .help("replace missing input fields with EMPTY"),
         )
-        .arg(
-            Arg::new("i")
-                .short('i')
-                .long("ignore-case")
-                .help("ignore differences in case when comparing fields")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("i")
+                .short('i')
+                .long("ignore-case")
+                .help("ignore differences in case when comparing fields")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("j")
-                .short('j')
-                .value_name("FIELD")
-                .help("equivalent to '-1 FIELD -2 FIELD'"),
+        .arg(
+            Arg::new("j")
+                .short('j')
+                .value_name("FIELD")
+                .help("equivalent to '-1 FIELD -2 FIELD'"),
         )
-        .arg(
-            Arg::new("o")
-                .short('o')
-                .value_name("FORMAT")
-                .help("obey FORMAT while constructing output line"),
+        .arg(
+            Arg::new("o")
+                .short('o')
+                .value_name("FORMAT")
+                .help("obey FORMAT while constructing output line"),
         )
-        .arg(
-            Arg::new("t")
-                .short('t')
-                .value_name("CHAR")
-                .value_parser(ValueParser::os_string())
-                .help("use CHAR as input and output field separator"),
+        .arg(
+            Arg::new("t")
+                .short('t')
+                .value_name("CHAR")
+                .value_parser(ValueParser::os_string())
+                .help("use CHAR as input and output field separator"),
         )
-        .arg(
-            Arg::new("1")
-                .short('1')
-                .value_name("FIELD")
-                .help("join on this FIELD of file 1"),
+        .arg(
+            Arg::new("1")
+                .short('1')
+                .value_name("FIELD")
+                .help("join on this FIELD of file 1"),
         )
-        .arg(
-            Arg::new("2")
-                .short('2')
-                .value_name("FIELD")
-                .help("join on this FIELD of file 2"),
+        .arg(
+            Arg::new("2")
+                .short('2')
+                .value_name("FIELD")
+                .help("join on this FIELD of file 2"),
         )
-        .arg(
-            Arg::new("check-order")
-                .long("check-order")
-                .help(
+        .arg(
+            Arg::new("check-order")
+                .long("check-order")
+                .help(
                     "check that the input is correctly sorted, \
              even if all input lines are pairable",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("nocheck-order")
-                .long("nocheck-order")
-                .help("do not check that the input is correctly sorted")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("nocheck-order")
+                .long("nocheck-order")
+                .help("do not check that the input is correctly sorted")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("header")
-                .long("header")
-                .help(
+        .arg(
+            Arg::new("header")
+                .long("header")
+                .help(
                     "treat the first line in each file as field headers, \
              print them without trying to pair them",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("z")
-                .short('z')
-                .long("zero-terminated")
-                .help("line delimiter is NUL, not newline")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("z")
+                .short('z')
+                .long("zero-terminated")
+                .help("line delimiter is NUL, not newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("file1")
-                .required(true)
-                .value_name("FILE1")
-                .value_hint(clap::ValueHint::FilePath)
-                .hide(true),
+        .arg(
+            Arg::new("file1")
+                .required(true)
+                .value_name("FILE1")
+                .value_hint(clap::ValueHint::FilePath)
+                .hide(true),
         )
-        .arg(
-            Arg::new("file2")
-                .required(true)
-                .value_name("FILE2")
-                .value_hint(clap::ValueHint::FilePath)
-                .hide(true),
+        .arg(
+            Arg::new("file2")
+                .required(true)
+                .value_name("FILE2")
+                .value_hint(clap::ValueHint::FilePath)
+                .hide(true),
         )
 }
 
-fn exec(file1: &str, file2: &str, settings: Settings) -> Result<(), JoinError> {
-    let stdin = stdin();
+fn exec(file1: &str, file2: &str, settings: Settings) -> Result<(), JoinError> {
+    let stdin = stdin();
 
-    let mut state1 = State::new(
-        FileNum::File1,
-        file1,
-        &stdin,
-        settings.key1,
-        settings.line_ending,
-        settings.print_unpaired1,
+    let mut state1 = State::new(
+        FileNum::File1,
+        file1,
+        &stdin,
+        settings.key1,
+        settings.line_ending,
+        settings.print_unpaired1,
     );
 
-    let mut state2 = State::new(
-        FileNum::File2,
-        file2,
-        &stdin,
-        settings.key2,
-        settings.line_ending,
-        settings.print_unpaired2,
+    let mut state2 = State::new(
+        FileNum::File2,
+        file2,
+        &stdin,
+        settings.key2,
+        settings.line_ending,
+        settings.print_unpaired2,
     );
 
-    let input = Input::new(
-        settings.separator,
-        settings.ignore_case,
-        settings.check_order,
+    let input = Input::new(
+        settings.separator,
+        settings.ignore_case,
+        settings.check_order,
     );
 
-    let format = if settings.autoformat {
-        let mut format = vec![Spec::Key];
-        let mut initialize = |state: &mut State| {
-            let max_fields = state.initialize(settings.separator, settings.autoformat);
-            for i in 0..max_fields {
-                if i != state.key {
-                    format.push(Spec::Field(state.file_num, i));
+    let format = if settings.autoformat {
+        let mut format = vec![Spec::Key];
+        let mut initialize = |state: &mut State| {
+            let max_fields = state.initialize(settings.separator, settings.autoformat);
+            for i in 0..max_fields {
+                if i != state.key {
+                    format.push(Spec::Field(state.file_num, i));
                 }
             }
         };
-        initialize(&mut state1);
-        initialize(&mut state2);
-        format
-    } else {
-        state1.initialize(settings.separator, settings.autoformat);
-        state2.initialize(settings.separator, settings.autoformat);
-        settings.format
+        initialize(&mut state1);
+        initialize(&mut state2);
+        format
+    } else {
+        state1.initialize(settings.separator, settings.autoformat);
+        state2.initialize(settings.separator, settings.autoformat);
+        settings.format
     };
 
-    let repr = Repr::new(
-        settings.line_ending,
-        match settings.separator {
-            Sep::Char(sep) => sep,
-            _ => b' ',
+    let repr = Repr::new(
+        settings.line_ending,
+        match settings.separator {
+            Sep::Char(sep) => sep,
+            _ => b' ',
         },
-        &format,
-        &settings.empty,
+        &format,
+        &settings.empty,
     );
 
-    let stdout = stdout();
-    let mut writer = BufWriter::new(stdout.lock());
+    let stdout = stdout();
+    let mut writer = BufWriter::new(stdout.lock());
 
-    if settings.headers {
-        state1.print_headers(&mut writer, &state2, &repr)?;
-        state1.reset_read_line(&input)?;
-        state2.reset_read_line(&input)?;
+    if settings.headers {
+        state1.print_headers(&mut writer, &state2, &repr)?;
+        state1.reset_read_line(&input)?;
+        state2.reset_read_line(&input)?;
     }
 
-    while state1.has_line() && state2.has_line() {
-        let diff = input.compare(state1.get_current_key(), state2.get_current_key());
+    while state1.has_line() && state2.has_line() {
+        let diff = input.compare(state1.get_current_key(), state2.get_current_key());
 
-        match diff {
-            Ordering::Less => {
-                if let Err(e) = state1.skip_line(&mut writer, &input, &repr) {
-                    writer.flush()?;
-                    return Err(e);
+        match diff {
+            Ordering::Less => {
+                if let Err(e) = state1.skip_line(&mut writer, &input, &repr) {
+                    writer.flush()?;
+                    return Err(e);
                 }
-                state1.has_unpaired = true;
-                state2.has_unpaired = true;
+                state1.has_unpaired = true;
+                state2.has_unpaired = true;
             }
-            Ordering::Greater => {
-                if let Err(e) = state2.skip_line(&mut writer, &input, &repr) {
-                    writer.flush()?;
-                    return Err(e);
+            Ordering::Greater => {
+                if let Err(e) = state2.skip_line(&mut writer, &input, &repr) {
+                    writer.flush()?;
+                    return Err(e);
                 }
-                state1.has_unpaired = true;
-                state2.has_unpaired = true;
+                state1.has_unpaired = true;
+                state2.has_unpaired = true;
             }
-            Ordering::Equal => {
-                let next_line1 = match state1.extend(&input) {
-                    Ok(line) => line,
-                    Err(e) => {
-                        writer.flush()?;
-                        return Err(e);
+            Ordering::Equal => {
+                let next_line1 = match state1.extend(&input) {
+                    Ok(line) => line,
+                    Err(e) => {
+                        writer.flush()?;
+                        return Err(e);
                     }
                 };
-                let next_line2 = match state2.extend(&input) {
-                    Ok(line) => line,
-                    Err(e) => {
-                        writer.flush()?;
-                        return Err(e);
+                let next_line2 = match state2.extend(&input) {
+                    Ok(line) => line,
+                    Err(e) => {
+                        writer.flush()?;
+                        return Err(e);
                     }
                 };
 
-                if settings.print_joined {
-                    state1.combine(&mut writer, &state2, &repr)?;
+                if settings.print_joined {
+                    state1.combine(&mut writer, &state2, &repr)?;
                 }
 
-                state1.reset(next_line1);
-                state2.reset(next_line2);
+                state1.reset(next_line1);
+                state2.reset(next_line2);
             }
         }
     }
 
-    if let Err(e) = state1.finalize(&mut writer, &input, &repr) {
-        writer.flush()?;
-        return Err(e);
+    if let Err(e) = state1.finalize(&mut writer, &input, &repr) {
+        writer.flush()?;
+        return Err(e);
     };
-    if let Err(e) = state2.finalize(&mut writer, &input, &repr) {
-        writer.flush()?;
-        return Err(e);
+    if let Err(e) = state2.finalize(&mut writer, &input, &repr) {
+        writer.flush()?;
+        return Err(e);
     };
 
-    writer.flush()?;
+    writer.flush()?;
 
-    if state1.has_failed || state2.has_failed {
+    if state1.has_failed || state2.has_failed {
         eprintln!(
             "{}: input is not in sorted order",
-            uucore::execution_phrase()
+            uucore::execution_phrase()
         );
-        set_exit_code(1);
+        set_exit_code(1);
     }
     Ok(())
 }
 
-/// Check that keys for both files and for a particular file are not
-/// contradictory and return the key index.
-fn get_field_number(keys: Option<usize>, key: Option<usize>) -> UResult<usize> {
-    if let Some(keys) = keys {
-        if let Some(key) = key {
-            if keys != key {
-                // Show zero-based field numbers as one-based.
-                return Err(USimpleError::new(
+/// Check that keys for both files and for a particular file are not
+/// contradictory and return the key index.
+fn get_field_number(keys: Option<usize>, key: Option<usize>) -> UResult<usize> {
+    if let Some(keys) = keys {
+        if let Some(key) = key {
+            if keys != key {
+                // Show zero-based field numbers as one-based.
+                return Err(USimpleError::new(
                     1,
-                    format!("incompatible join fields {}, {}", keys + 1, key + 1),
+                    format!("incompatible join fields {}, {}", keys + 1, key + 1),
                 ));
             }
         }
 
-        return Ok(keys);
+        return Ok(keys);
     }
 
-    Ok(key.unwrap_or(0))
+    Ok(key.unwrap_or(0))
 }
 
-/// Parse the specified field string as a natural number and return
-/// the zero-based field number.
-fn parse_field_number(value: &str) -> UResult<usize> {
-    match value.parse::<usize>() {
-        Ok(result) if result > 0 => Ok(result - 1),
-        Err(e) if e.kind() == &IntErrorKind::PosOverflow => Ok(usize::MAX),
-        _ => Err(USimpleError::new(
+/// Parse the specified field string as a natural number and return
+/// the zero-based field number.
+fn parse_field_number(value: &str) -> UResult<usize> {
+    match value.parse::<usize>() {
+        Ok(result) if result > 0 => Ok(result - 1),
+        Err(e) if e.kind() == &IntErrorKind::PosOverflow => Ok(usize::MAX),
+        _ => Err(USimpleError::new(
             1,
-            format!("invalid field number: {}", value.quote()),
+            format!("invalid field number: {}", value.quote()),
         )),
     }
 }
 
-fn parse_file_number(value: &str) -> UResult<FileNum> {
-    match value {
-        "1" => Ok(FileNum::File1),
-        "2" => Ok(FileNum::File2),
-        value => Err(USimpleError::new(
+fn parse_file_number(value: &str) -> UResult<FileNum> {
+    match value {
+        "1" => Ok(FileNum::File1),
+        "2" => Ok(FileNum::File2),
+        value => Err(USimpleError::new(
             1,
-            format!("invalid file number: {}", value.quote()),
+            format!("invalid file number: {}", value.quote()),
         )),
     }
 }
 
-fn parse_field_number_option(value: Option<&str>) -> UResult<Option<usize>> {
-    match value {
-        None => Ok(None),
-        Some(val) => Ok(Some(parse_field_number(val)?)),
+fn parse_field_number_option(value: Option<&str>) -> UResult<Option<usize>> {
+    match value {
+        None => Ok(None),
+        Some(val) => Ok(Some(parse_field_number(val)?)),
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_kill/kill.rs.html b/dev/src/uu_kill/kill.rs.html index 1baa011fb..cc2a7d958 100644 --- a/dev/src/uu_kill/kill.rs.html +++ b/dev/src/uu_kill/kill.rs.html @@ -1,4 +1,4 @@ -kill.rs - source
1
+kill.rs - source
1
 2
 3
 4
@@ -212,219 +212,219 @@
 212
 213
 214
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Maciej Dziardziel <fiedzia@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE file
-//  * that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Maciej Dziardziel <fiedzia@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE file
+//  * that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) signalname pids killpg
+// spell-checker:ignore (ToDO) signalname pids killpg
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use nix::sys::signal::{self, Signal};
-use nix::unistd::Pid;
-use std::io::Error;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UError, UResult, USimpleError};
-use uucore::format_usage;
-use uucore::signals::{signal_by_name_or_value, ALL_SIGNALS};
+use clap::{crate_version, Arg, ArgAction, Command};
+use nix::sys::signal::{self, Signal};
+use nix::unistd::Pid;
+use std::io::Error;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UError, UResult, USimpleError};
+use uucore::format_usage;
+use uucore::signals::{signal_by_name_or_value, ALL_SIGNALS};
 
-static ABOUT: &str = "Send signal to processes or list information about signals.";
-const USAGE: &str = "{} [OPTIONS]... PID...";
+static ABOUT: &str = "Send signal to processes or list information about signals.";
+const USAGE: &str = "{} [OPTIONS]... PID...";
 
-pub mod options {
-    pub static PIDS_OR_SIGNALS: &str = "pids_or_signals";
-    pub static LIST: &str = "list";
-    pub static TABLE: &str = "table";
-    pub static SIGNAL: &str = "signal";
+pub mod options {
+    pub static PIDS_OR_SIGNALS: &str = "pids_or_signals";
+    pub static LIST: &str = "list";
+    pub static TABLE: &str = "table";
+    pub static SIGNAL: &str = "signal";
 }
 
-#[derive(Clone, Copy)]
-pub enum Mode {
-    Kill,
-    Table,
-    List,
+#[derive(Clone, Copy)]
+pub enum Mode {
+    Kill,
+    Table,
+    List,
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let mut args = args.collect_ignore();
-    let obs_signal = handle_obsolete(&mut args);
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let mut args = args.collect_ignore();
+    let obs_signal = handle_obsolete(&mut args);
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let mode = if matches.get_flag(options::TABLE) {
-        Mode::Table
-    } else if matches.get_flag(options::LIST) {
-        Mode::List
-    } else {
-        Mode::Kill
+    let mode = if matches.get_flag(options::TABLE) {
+        Mode::Table
+    } else if matches.get_flag(options::LIST) {
+        Mode::List
+    } else {
+        Mode::Kill
     };
 
-    let pids_or_signals: Vec<String> = matches
-        .get_many::<String>(options::PIDS_OR_SIGNALS)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let pids_or_signals: Vec<String> = matches
+        .get_many::<String>(options::PIDS_OR_SIGNALS)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    match mode {
-        Mode::Kill => {
-            let sig = if let Some(signal) = obs_signal {
-                signal
-            } else if let Some(signal) = matches.get_one::<String>(options::SIGNAL) {
-                parse_signal_value(signal)?
-            } else {
-                15_usize //SIGTERM
-            };
-            let sig: Signal = (sig as i32)
-                .try_into()
-                .map_err(|e| std::io::Error::from_raw_os_error(e as i32))?;
-            let pids = parse_pids(&pids_or_signals)?;
-            kill(sig, &pids);
+    match mode {
+        Mode::Kill => {
+            let sig = if let Some(signal) = obs_signal {
+                signal
+            } else if let Some(signal) = matches.get_one::<String>(options::SIGNAL) {
+                parse_signal_value(signal)?
+            } else {
+                15_usize //SIGTERM
+            };
+            let sig: Signal = (sig as i32)
+                .try_into()
+                .map_err(|e| std::io::Error::from_raw_os_error(e as i32))?;
+            let pids = parse_pids(&pids_or_signals)?;
+            kill(sig, &pids);
             Ok(())
         }
-        Mode::Table => {
-            table();
+        Mode::Table => {
+            table();
             Ok(())
         }
-        Mode::List => list(pids_or_signals.get(0)),
+        Mode::List => list(pids_or_signals.get(0)),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .allow_negative_numbers(true)
-        .arg(
-            Arg::new(options::LIST)
-                .short('l')
-                .long(options::LIST)
-                .help("Lists signals")
-                .conflicts_with(options::TABLE)
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .allow_negative_numbers(true)
+        .arg(
+            Arg::new(options::LIST)
+                .short('l')
+                .long(options::LIST)
+                .help("Lists signals")
+                .conflicts_with(options::TABLE)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::TABLE)
-                .short('t')
-                .short_alias('L')
-                .long(options::TABLE)
-                .help("Lists table of signals")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::TABLE)
+                .short('t')
+                .short_alias('L')
+                .long(options::TABLE)
+                .help("Lists table of signals")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SIGNAL)
-                .short('s')
-                .long(options::SIGNAL)
-                .value_name("signal")
-                .help("Sends given signal instead of SIGTERM"),
+        .arg(
+            Arg::new(options::SIGNAL)
+                .short('s')
+                .long(options::SIGNAL)
+                .value_name("signal")
+                .help("Sends given signal instead of SIGTERM"),
         )
-        .arg(
-            Arg::new(options::PIDS_OR_SIGNALS)
-                .hide(true)
-                .action(ArgAction::Append),
+        .arg(
+            Arg::new(options::PIDS_OR_SIGNALS)
+                .hide(true)
+                .action(ArgAction::Append),
         )
 }
 
-fn handle_obsolete(args: &mut Vec<String>) -> Option<usize> {
-    // Sanity check
-    if args.len() > 2 {
-        // Old signal can only be in the first argument position
-        let slice = args[1].as_str();
-        if let Some(signal) = slice.strip_prefix('-') {
-            // Check if it is a valid signal
-            let opt_signal = signal_by_name_or_value(signal);
-            if opt_signal.is_some() {
-                // remove the signal before return
-                args.remove(1);
-                return opt_signal;
+fn handle_obsolete(args: &mut Vec<String>) -> Option<usize> {
+    // Sanity check
+    if args.len() > 2 {
+        // Old signal can only be in the first argument position
+        let slice = args[1].as_str();
+        if let Some(signal) = slice.strip_prefix('-') {
+            // Check if it is a valid signal
+            let opt_signal = signal_by_name_or_value(signal);
+            if opt_signal.is_some() {
+                // remove the signal before return
+                args.remove(1);
+                return opt_signal;
             }
         }
     }
-    None
-}
+    None
+}
 
-fn table() {
-    let name_width = ALL_SIGNALS.iter().map(|n| n.len()).max().unwrap();
+fn table() {
+    let name_width = ALL_SIGNALS.iter().map(|n| n.len()).max().unwrap();
 
-    for (idx, signal) in ALL_SIGNALS.iter().enumerate() {
-        print!("{0: >#2} {1: <#2$}", idx, signal, name_width + 2);
-        if (idx + 1) % 7 == 0 {
+    for (idx, signal) in ALL_SIGNALS.iter().enumerate() {
+        print!("{0: >#2} {1: <#2$}", idx, signal, name_width + 2);
+        if (idx + 1) % 7 == 0 {
             println!();
         }
     }
     println!();
 }
 
-fn print_signal(signal_name_or_value: &str) -> UResult<()> {
-    for (value, &signal) in ALL_SIGNALS.iter().enumerate() {
-        if signal == signal_name_or_value || (format!("SIG{}", signal)) == signal_name_or_value {
-            println!("{}", value);
-            return Ok(());
-        } else if signal_name_or_value == value.to_string() {
-            println!("{}", signal);
-            return Ok(());
+fn print_signal(signal_name_or_value: &str) -> UResult<()> {
+    for (value, &signal) in ALL_SIGNALS.iter().enumerate() {
+        if signal == signal_name_or_value || (format!("SIG{}", signal)) == signal_name_or_value {
+            println!("{}", value);
+            return Ok(());
+        } else if signal_name_or_value == value.to_string() {
+            println!("{}", signal);
+            return Ok(());
         }
     }
-    Err(USimpleError::new(
+    Err(USimpleError::new(
         1,
-        format!("unknown signal name {}", signal_name_or_value.quote()),
+        format!("unknown signal name {}", signal_name_or_value.quote()),
     ))
 }
 
-fn print_signals() {
-    for (idx, signal) in ALL_SIGNALS.iter().enumerate() {
-        if idx > 0 {
+fn print_signals() {
+    for (idx, signal) in ALL_SIGNALS.iter().enumerate() {
+        if idx > 0 {
             print!(" ");
         }
-        print!("{}", signal);
+        print!("{}", signal);
     }
     println!();
 }
 
-fn list(arg: Option<&String>) -> UResult<()> {
-    match arg {
-        Some(x) => print_signal(x),
-        None => {
-            print_signals();
+fn list(arg: Option<&String>) -> UResult<()> {
+    match arg {
+        Some(x) => print_signal(x),
+        None => {
+            print_signals();
             Ok(())
         }
     }
 }
 
-fn parse_signal_value(signal_name: &str) -> UResult<usize> {
-    let optional_signal_value = signal_by_name_or_value(signal_name);
-    match optional_signal_value {
-        Some(x) => Ok(x),
-        None => Err(USimpleError::new(
+fn parse_signal_value(signal_name: &str) -> UResult<usize> {
+    let optional_signal_value = signal_by_name_or_value(signal_name);
+    match optional_signal_value {
+        Some(x) => Ok(x),
+        None => Err(USimpleError::new(
             1,
-            format!("unknown signal name {}", signal_name.quote()),
+            format!("unknown signal name {}", signal_name.quote()),
         )),
     }
 }
 
-fn parse_pids(pids: &[String]) -> UResult<Vec<i32>> {
-    pids.iter()
-        .map(|x| {
-            x.parse::<i32>().map_err(|e| {
-                USimpleError::new(1, format!("failed to parse argument {}: {}", x.quote(), e))
+fn parse_pids(pids: &[String]) -> UResult<Vec<i32>> {
+    pids.iter()
+        .map(|x| {
+            x.parse::<i32>().map_err(|e| {
+                USimpleError::new(1, format!("failed to parse argument {}: {}", x.quote(), e))
             })
         })
-        .collect()
+        .collect()
 }
 
-fn kill(sig: Signal, pids: &[i32]) {
-    for &pid in pids {
-        if let Err(e) = signal::kill(Pid::from_raw(pid), sig) {
-            show!(Error::from_raw_os_error(e as i32)
-                .map_err_context(|| format!("sending signal to {} failed", pid)));
+fn kill(sig: Signal, pids: &[i32]) {
+    for &pid in pids {
+        if let Err(e) = signal::kill(Pid::from_raw(pid), sig) {
+            show!(Error::from_raw_os_error(e as i32)
+                .map_err_context(|| format!("sending signal to {} failed", pid)));
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_link/link.rs.html b/dev/src/uu_link/link.rs.html index 667567436..dedaa204d 100644 --- a/dev/src/uu_link/link.rs.html +++ b/dev/src/uu_link/link.rs.html @@ -1,4 +1,4 @@ -link.rs - source
1
+link.rs - source
1
 2
 3
 4
@@ -50,57 +50,57 @@
 50
 51
 52
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Michael Gehring <mg@ebfe.org>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-use clap::builder::ValueParser;
-use clap::{crate_version, Arg, Command};
-use std::ffi::OsString;
-use std::fs::hard_link;
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult};
-use uucore::format_usage;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Michael Gehring <mg@ebfe.org>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+use clap::builder::ValueParser;
+use clap::{crate_version, Arg, Command};
+use std::ffi::OsString;
+use std::fs::hard_link;
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult};
+use uucore::format_usage;
 
-static ABOUT: &str = "Call the link function to create a link named FILE2 to an existing FILE1.";
-const USAGE: &str = "{} FILE1 FILE2";
+static ABOUT: &str = "Call the link function to create a link named FILE2 to an existing FILE1.";
+const USAGE: &str = "{} FILE1 FILE2";
 
-pub mod options {
-    pub static FILES: &str = "FILES";
+pub mod options {
+    pub static FILES: &str = "FILES";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let files: Vec<_> = matches
-        .get_many::<OsString>(options::FILES)
-        .unwrap_or_default()
-        .collect();
-    let old = Path::new(files[0]);
-    let new = Path::new(files[1]);
+    let files: Vec<_> = matches
+        .get_many::<OsString>(options::FILES)
+        .unwrap_or_default()
+        .collect();
+    let old = Path::new(files[0]);
+    let new = Path::new(files[1]);
 
-    hard_link(old, new)
-        .map_err_context(|| format!("cannot create link {} to {}", new.quote(), old.quote()))
+    hard_link(old, new)
+        .map_err_context(|| format!("cannot create link {} to {}", new.quote(), old.quote()))
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::FILES)
-                .hide(true)
-                .required(true)
-                .num_args(2)
-                .value_hint(clap::ValueHint::AnyPath)
-                .value_parser(ValueParser::os_string()),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::FILES)
+                .hide(true)
+                .required(true)
+                .num_args(2)
+                .value_hint(clap::ValueHint::AnyPath)
+                .value_parser(ValueParser::os_string()),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_ln/ln.rs.html b/dev/src/uu_ln/ln.rs.html index f4ec1331d..94889b8fa 100644 --- a/dev/src/uu_ln/ln.rs.html +++ b/dev/src/uu_ln/ln.rs.html @@ -1,4 +1,4 @@ -ln.rs - source
1
+ln.rs - source
1
 2
 3
 4
@@ -506,99 +506,99 @@
 506
 507
 508
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Joseph Crail <jbcrail@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Joseph Crail <jbcrail@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) srcpath targetpath EEXIST
+// spell-checker:ignore (ToDO) srcpath targetpath EEXIST
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UError, UResult};
-use uucore::format_usage;
-use uucore::fs::{make_path_relative_to, paths_refer_to_same_file};
+use clap::{crate_version, Arg, ArgAction, Command};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UError, UResult};
+use uucore::format_usage;
+use uucore::fs::{make_path_relative_to, paths_refer_to_same_file};
 
-use std::borrow::Cow;
-use std::error::Error;
-use std::ffi::OsString;
-use std::fmt::Display;
-use std::fs;
+use std::borrow::Cow;
+use std::error::Error;
+use std::ffi::OsString;
+use std::fmt::Display;
+use std::fs;
 
-use std::io::stdin;
-#[cfg(any(unix, target_os = "redox"))]
-use std::os::unix::fs::symlink;
-#[cfg(windows)]
-use std::os::windows::fs::{symlink_dir, symlink_file};
-use std::path::{Path, PathBuf};
-use uucore::backup_control::{self, BackupMode};
-use uucore::fs::{canonicalize, MissingHandling, ResolveMode};
+use std::io::stdin;
+#[cfg(any(unix, target_os = "redox"))]
+use std::os::unix::fs::symlink;
+#[cfg(windows)]
+use std::os::windows::fs::{symlink_dir, symlink_file};
+use std::path::{Path, PathBuf};
+use uucore::backup_control::{self, BackupMode};
+use uucore::fs::{canonicalize, MissingHandling, ResolveMode};
 
-pub struct Settings {
-    overwrite: OverwriteMode,
-    backup: BackupMode,
-    suffix: String,
-    symbolic: bool,
-    relative: bool,
-    logical: bool,
-    target_dir: Option<String>,
-    no_target_dir: bool,
-    no_dereference: bool,
-    verbose: bool,
+pub struct Settings {
+    overwrite: OverwriteMode,
+    backup: BackupMode,
+    suffix: String,
+    symbolic: bool,
+    relative: bool,
+    logical: bool,
+    target_dir: Option<String>,
+    no_target_dir: bool,
+    no_dereference: bool,
+    verbose: bool,
 }
 
-#[derive(Clone, Debug, Eq, PartialEq)]
-pub enum OverwriteMode {
-    NoClobber,
-    Interactive,
-    Force,
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub enum OverwriteMode {
+    NoClobber,
+    Interactive,
+    Force,
 }
 
-#[derive(Debug)]
-enum LnError {
-    TargetIsDirectory(PathBuf),
-    SomeLinksFailed,
-    SameFile(PathBuf, PathBuf),
-    MissingDestination(PathBuf),
-    ExtraOperand(OsString),
+#[derive(Debug)]
+enum LnError {
+    TargetIsDirectory(PathBuf),
+    SomeLinksFailed,
+    SameFile(PathBuf, PathBuf),
+    MissingDestination(PathBuf),
+    ExtraOperand(OsString),
 }
 
-impl Display for LnError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::TargetIsDirectory(s) => write!(f, "target {} is not a directory", s.quote()),
-            Self::SameFile(s, d) => {
-                write!(f, "{} and {} are the same file", s.quote(), d.quote())
+impl Display for LnError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::TargetIsDirectory(s) => write!(f, "target {} is not a directory", s.quote()),
+            Self::SameFile(s, d) => {
+                write!(f, "{} and {} are the same file", s.quote(), d.quote())
             }
-            Self::SomeLinksFailed => Ok(()),
-            Self::MissingDestination(s) => {
-                write!(f, "missing destination file operand after {}", s.quote())
+            Self::SomeLinksFailed => Ok(()),
+            Self::MissingDestination(s) => {
+                write!(f, "missing destination file operand after {}", s.quote())
             }
-            Self::ExtraOperand(s) => write!(
-                f,
+            Self::ExtraOperand(s) => write!(
+                f,
                 "extra operand {}\nTry '{} --help' for more information.",
-                s.quote(),
-                uucore::execution_phrase()
+                s.quote(),
+                uucore::execution_phrase()
             ),
         }
     }
 }
 
-impl Error for LnError {}
+impl Error for LnError {}
 
-impl UError for LnError {
-    fn code(&self) -> i32 {
-        1
-    }
+impl UError for LnError {
+    fn code(&self) -> i32 {
+        1
+    }
 }
 
-fn long_usage() -> String {
-    String::from(
+fn long_usage() -> String {
+    String::from(
         " In the 1st form, create a link to TARGET with the name LINK_NAME.
         In the 2nd form, create a link to TARGET in the current directory.
         In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.
@@ -611,408 +611,408 @@
     )
 }
 
-static ABOUT: &str = "change file owner and group";
-const USAGE: &str = "\
+static ABOUT: &str = "change file owner and group";
+const USAGE: &str = "\
     {} [OPTION]... [-T] TARGET LINK_NAME
     {} [OPTION]... TARGET
     {} [OPTION]... TARGET... DIRECTORY
     {} [OPTION]... -t DIRECTORY TARGET...";
 
-mod options {
-    pub const FORCE: &str = "force";
-    //pub const DIRECTORY: &str = "directory";
-    pub const INTERACTIVE: &str = "interactive";
-    pub const NO_DEREFERENCE: &str = "no-dereference";
-    pub const SYMBOLIC: &str = "symbolic";
-    pub const LOGICAL: &str = "logical";
-    pub const PHYSICAL: &str = "physical";
-    pub const TARGET_DIRECTORY: &str = "target-directory";
-    pub const NO_TARGET_DIRECTORY: &str = "no-target-directory";
-    pub const RELATIVE: &str = "relative";
-    pub const VERBOSE: &str = "verbose";
+mod options {
+    pub const FORCE: &str = "force";
+    //pub const DIRECTORY: &str = "directory";
+    pub const INTERACTIVE: &str = "interactive";
+    pub const NO_DEREFERENCE: &str = "no-dereference";
+    pub const SYMBOLIC: &str = "symbolic";
+    pub const LOGICAL: &str = "logical";
+    pub const PHYSICAL: &str = "physical";
+    pub const TARGET_DIRECTORY: &str = "target-directory";
+    pub const NO_TARGET_DIRECTORY: &str = "no-target-directory";
+    pub const RELATIVE: &str = "relative";
+    pub const VERBOSE: &str = "verbose";
 }
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    // clap requires a 'static string
-    let long_usage = format!(
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    // clap requires a 'static string
+    let long_usage = format!(
         "{}\n{}",
-        long_usage(),
-        backup_control::BACKUP_CONTROL_LONG_HELP
+        long_usage(),
+        backup_control::BACKUP_CONTROL_LONG_HELP
     );
 
-    let matches = uu_app().after_help(long_usage).try_get_matches_from(args)?;
+    let matches = uu_app().after_help(long_usage).try_get_matches_from(args)?;
 
-    /* the list of files */
+    /* the list of files */
 
-    let paths: Vec<PathBuf> = matches
-        .get_many::<String>(ARG_FILES)
-        .unwrap()
-        .map(PathBuf::from)
-        .collect();
+    let paths: Vec<PathBuf> = matches
+        .get_many::<String>(ARG_FILES)
+        .unwrap()
+        .map(PathBuf::from)
+        .collect();
 
-    let symbolic = matches.get_flag(options::SYMBOLIC);
+    let symbolic = matches.get_flag(options::SYMBOLIC);
 
-    let overwrite_mode = if matches.get_flag(options::FORCE) {
-        OverwriteMode::Force
-    } else if matches.get_flag(options::INTERACTIVE) {
-        OverwriteMode::Interactive
-    } else {
-        OverwriteMode::NoClobber
+    let overwrite_mode = if matches.get_flag(options::FORCE) {
+        OverwriteMode::Force
+    } else if matches.get_flag(options::INTERACTIVE) {
+        OverwriteMode::Interactive
+    } else {
+        OverwriteMode::NoClobber
     };
 
-    let backup_mode = backup_control::determine_backup_mode(&matches)?;
-    let backup_suffix = backup_control::determine_backup_suffix(&matches);
+    let backup_mode = backup_control::determine_backup_mode(&matches)?;
+    let backup_suffix = backup_control::determine_backup_suffix(&matches);
 
-    // When we have "-L" or "-L -P", false otherwise
-    let logical = matches.get_flag(options::LOGICAL);
+    // When we have "-L" or "-L -P", false otherwise
+    let logical = matches.get_flag(options::LOGICAL);
 
-    let settings = Settings {
-        overwrite: overwrite_mode,
-        backup: backup_mode,
-        suffix: backup_suffix,
-        symbolic,
-        logical,
-        relative: matches.get_flag(options::RELATIVE),
-        target_dir: matches
-            .get_one::<String>(options::TARGET_DIRECTORY)
-            .map(String::from),
-        no_target_dir: matches.get_flag(options::NO_TARGET_DIRECTORY),
-        no_dereference: matches.get_flag(options::NO_DEREFERENCE),
-        verbose: matches.get_flag(options::VERBOSE),
+    let settings = Settings {
+        overwrite: overwrite_mode,
+        backup: backup_mode,
+        suffix: backup_suffix,
+        symbolic,
+        logical,
+        relative: matches.get_flag(options::RELATIVE),
+        target_dir: matches
+            .get_one::<String>(options::TARGET_DIRECTORY)
+            .map(String::from),
+        no_target_dir: matches.get_flag(options::NO_TARGET_DIRECTORY),
+        no_dereference: matches.get_flag(options::NO_DEREFERENCE),
+        verbose: matches.get_flag(options::VERBOSE),
     };
 
-    exec(&paths[..], &settings)
+    exec(&paths[..], &settings)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(backup_control::arguments::backup())
-        .arg(backup_control::arguments::backup_no_args())
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(backup_control::arguments::backup())
+        .arg(backup_control::arguments::backup_no_args())
         /*.arg(
             Arg::new(options::DIRECTORY)
                 .short('d')
                 .long(options::DIRECTORY)
                 .help("allow users with appropriate privileges to attempt to make hard links to directories")
-        )*/
-        .arg(
-            Arg::new(options::FORCE)
-                .short('f')
-                .long(options::FORCE)
-                .help("remove existing destination files")
-                .action(ArgAction::SetTrue),
+        )*/
+        .arg(
+            Arg::new(options::FORCE)
+                .short('f')
+                .long(options::FORCE)
+                .help("remove existing destination files")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::INTERACTIVE)
-                .short('i')
-                .long(options::INTERACTIVE)
-                .help("prompt whether to remove existing destination files")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::INTERACTIVE)
+                .short('i')
+                .long(options::INTERACTIVE)
+                .help("prompt whether to remove existing destination files")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NO_DEREFERENCE)
-                .short('n')
-                .long(options::NO_DEREFERENCE)
-                .help(
+        .arg(
+            Arg::new(options::NO_DEREFERENCE)
+                .short('n')
+                .long(options::NO_DEREFERENCE)
+                .help(
                     "treat LINK_NAME as a normal file if it is a \
                      symbolic link to a directory",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::LOGICAL)
-                .short('L')
-                .long(options::LOGICAL)
-                .help("dereference TARGETs that are symbolic links")
-                .overrides_with(options::PHYSICAL)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::LOGICAL)
+                .short('L')
+                .long(options::LOGICAL)
+                .help("dereference TARGETs that are symbolic links")
+                .overrides_with(options::PHYSICAL)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            // Not implemented yet
-            Arg::new(options::PHYSICAL)
-                .short('P')
-                .long(options::PHYSICAL)
-                .help("make hard links directly to symbolic links")
-                .action(ArgAction::SetTrue),
+        .arg(
+            // Not implemented yet
+            Arg::new(options::PHYSICAL)
+                .short('P')
+                .long(options::PHYSICAL)
+                .help("make hard links directly to symbolic links")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SYMBOLIC)
-                .short('s')
-                .long(options::SYMBOLIC)
-                .help("make symbolic links instead of hard links")
-                // override added for https://github.com/uutils/coreutils/issues/2359
-                .overrides_with(options::SYMBOLIC)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SYMBOLIC)
+                .short('s')
+                .long(options::SYMBOLIC)
+                .help("make symbolic links instead of hard links")
+                // override added for https://github.com/uutils/coreutils/issues/2359
+                .overrides_with(options::SYMBOLIC)
+                .action(ArgAction::SetTrue),
         )
-        .arg(backup_control::arguments::suffix())
-        .arg(
-            Arg::new(options::TARGET_DIRECTORY)
-                .short('t')
-                .long(options::TARGET_DIRECTORY)
-                .help("specify the DIRECTORY in which to create the links")
-                .value_name("DIRECTORY")
-                .value_hint(clap::ValueHint::DirPath)
-                .conflicts_with(options::NO_TARGET_DIRECTORY),
+        .arg(backup_control::arguments::suffix())
+        .arg(
+            Arg::new(options::TARGET_DIRECTORY)
+                .short('t')
+                .long(options::TARGET_DIRECTORY)
+                .help("specify the DIRECTORY in which to create the links")
+                .value_name("DIRECTORY")
+                .value_hint(clap::ValueHint::DirPath)
+                .conflicts_with(options::NO_TARGET_DIRECTORY),
         )
-        .arg(
-            Arg::new(options::NO_TARGET_DIRECTORY)
-                .short('T')
-                .long(options::NO_TARGET_DIRECTORY)
-                .help("treat LINK_NAME as a normal file always")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_TARGET_DIRECTORY)
+                .short('T')
+                .long(options::NO_TARGET_DIRECTORY)
+                .help("treat LINK_NAME as a normal file always")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::RELATIVE)
-                .short('r')
-                .long(options::RELATIVE)
-                .help("create symbolic links relative to link location")
-                .requires(options::SYMBOLIC)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RELATIVE)
+                .short('r')
+                .long(options::RELATIVE)
+                .help("create symbolic links relative to link location")
+                .requires(options::SYMBOLIC)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::VERBOSE)
-                .short('v')
-                .long(options::VERBOSE)
-                .help("print name of each linked file")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::VERBOSE)
+                .short('v')
+                .long(options::VERBOSE)
+                .help("print name of each linked file")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath)
-                .required(true)
-                .num_args(1..),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath)
+                .required(true)
+                .num_args(1..),
         )
 }
 
-fn exec(files: &[PathBuf], settings: &Settings) -> UResult<()> {
-    // Handle cases where we create links in a directory first.
-    if let Some(ref name) = settings.target_dir {
-        // 4th form: a directory is specified by -t.
-        return link_files_in_dir(files, &PathBuf::from(name), settings);
+fn exec(files: &[PathBuf], settings: &Settings) -> UResult<()> {
+    // Handle cases where we create links in a directory first.
+    if let Some(ref name) = settings.target_dir {
+        // 4th form: a directory is specified by -t.
+        return link_files_in_dir(files, &PathBuf::from(name), settings);
     }
-    if !settings.no_target_dir {
-        if files.len() == 1 {
-            // 2nd form: the target directory is the current directory.
-            return link_files_in_dir(files, &PathBuf::from("."), settings);
+    if !settings.no_target_dir {
+        if files.len() == 1 {
+            // 2nd form: the target directory is the current directory.
+            return link_files_in_dir(files, &PathBuf::from("."), settings);
         }
-        let last_file = &PathBuf::from(files.last().unwrap());
-        if files.len() > 2 || last_file.is_dir() {
-            // 3rd form: create links in the last argument.
-            return link_files_in_dir(&files[0..files.len() - 1], last_file, settings);
+        let last_file = &PathBuf::from(files.last().unwrap());
+        if files.len() > 2 || last_file.is_dir() {
+            // 3rd form: create links in the last argument.
+            return link_files_in_dir(&files[0..files.len() - 1], last_file, settings);
         }
     }
 
-    // 1st form. Now there should be only two operands, but if -T is
-    // specified we may have a wrong number of operands.
-    if files.len() == 1 {
-        return Err(LnError::MissingDestination(files[0].clone()).into());
+    // 1st form. Now there should be only two operands, but if -T is
+    // specified we may have a wrong number of operands.
+    if files.len() == 1 {
+        return Err(LnError::MissingDestination(files[0].clone()).into());
     }
-    if files.len() > 2 {
-        return Err(LnError::ExtraOperand(files[2].clone().into()).into());
+    if files.len() > 2 {
+        return Err(LnError::ExtraOperand(files[2].clone().into()).into());
     }
-    assert!(!files.is_empty());
+    assert!(!files.is_empty());
 
-    link(&files[0], &files[1], settings)
+    link(&files[0], &files[1], settings)
 }
 
-fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) -> UResult<()> {
-    if !target_dir.is_dir() {
-        return Err(LnError::TargetIsDirectory(target_dir.to_owned()).into());
+fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) -> UResult<()> {
+    if !target_dir.is_dir() {
+        return Err(LnError::TargetIsDirectory(target_dir.to_owned()).into());
     }
 
-    let mut all_successful = true;
-    for srcpath in files.iter() {
-        let targetpath =
-            if settings.no_dereference && matches!(settings.overwrite, OverwriteMode::Force) {
-                // In that case, we don't want to do link resolution
-                // We need to clean the target
-                if target_dir.is_symlink() {
-                    if target_dir.is_file() {
-                        if let Err(e) = fs::remove_file(target_dir) {
-                            show_error!("Could not update {}: {}", target_dir.quote(), e);
+    let mut all_successful = true;
+    for srcpath in files.iter() {
+        let targetpath =
+            if settings.no_dereference && matches!(settings.overwrite, OverwriteMode::Force) {
+                // In that case, we don't want to do link resolution
+                // We need to clean the target
+                if target_dir.is_symlink() {
+                    if target_dir.is_file() {
+                        if let Err(e) = fs::remove_file(target_dir) {
+                            show_error!("Could not update {}: {}", target_dir.quote(), e);
                         };
                     }
-                    if target_dir.is_dir() {
-                        // Not sure why but on Windows, the symlink can be
-                        // considered as a dir
-                        // See test_ln::test_symlink_no_deref_dir
-                        if let Err(e) = fs::remove_dir(target_dir) {
-                            show_error!("Could not update {}: {}", target_dir.quote(), e);
+                    if target_dir.is_dir() {
+                        // Not sure why but on Windows, the symlink can be
+                        // considered as a dir
+                        // See test_ln::test_symlink_no_deref_dir
+                        if let Err(e) = fs::remove_dir(target_dir) {
+                            show_error!("Could not update {}: {}", target_dir.quote(), e);
                         };
                     }
                 }
-                target_dir.to_path_buf()
-            } else {
-                match srcpath.as_os_str().to_str() {
-                    Some(name) => {
-                        match Path::new(name).file_name() {
-                            Some(basename) => target_dir.join(basename),
-                            // This can be None only for "." or "..". Trying
-                            // to create a link with such name will fail with
-                            // EEXIST, which agrees with the behavior of GNU
-                            // coreutils.
-                            None => target_dir.join(name),
+                target_dir.to_path_buf()
+            } else {
+                match srcpath.as_os_str().to_str() {
+                    Some(name) => {
+                        match Path::new(name).file_name() {
+                            Some(basename) => target_dir.join(basename),
+                            // This can be None only for "." or "..". Trying
+                            // to create a link with such name will fail with
+                            // EEXIST, which agrees with the behavior of GNU
+                            // coreutils.
+                            None => target_dir.join(name),
                         }
                     }
-                    None => {
-                        show_error!("cannot stat {}: No such file or directory", srcpath.quote());
-                        all_successful = false;
+                    None => {
+                        show_error!("cannot stat {}: No such file or directory", srcpath.quote());
+                        all_successful = false;
                         continue;
                     }
                 }
             };
 
-        if let Err(e) = link(srcpath, &targetpath, settings) {
-            show_error!("{}", e);
-            all_successful = false;
+        if let Err(e) = link(srcpath, &targetpath, settings) {
+            show_error!("{}", e);
+            all_successful = false;
         }
     }
-    if all_successful {
+    if all_successful {
         Ok(())
-    } else {
-        Err(LnError::SomeLinksFailed.into())
+    } else {
+        Err(LnError::SomeLinksFailed.into())
     }
 }
 
-fn relative_path<'a>(src: &'a Path, dst: &Path) -> Cow<'a, Path> {
-    if let Ok(src_abs) = canonicalize(src, MissingHandling::Missing, ResolveMode::Physical) {
-        if let Ok(dst_abs) = canonicalize(
-            dst.parent().unwrap(),
-            MissingHandling::Missing,
-            ResolveMode::Physical,
+fn relative_path<'a>(src: &'a Path, dst: &Path) -> Cow<'a, Path> {
+    if let Ok(src_abs) = canonicalize(src, MissingHandling::Missing, ResolveMode::Physical) {
+        if let Ok(dst_abs) = canonicalize(
+            dst.parent().unwrap(),
+            MissingHandling::Missing,
+            ResolveMode::Physical,
         ) {
-            return make_path_relative_to(src_abs, dst_abs).into();
+            return make_path_relative_to(src_abs, dst_abs).into();
         }
     }
-    src.into()
+    src.into()
 }
 
-fn link(src: &Path, dst: &Path, settings: &Settings) -> UResult<()> {
-    let mut backup_path = None;
-    let source: Cow<'_, Path> = if settings.relative {
-        relative_path(src, dst)
-    } else {
-        src.into()
+fn link(src: &Path, dst: &Path, settings: &Settings) -> UResult<()> {
+    let mut backup_path = None;
+    let source: Cow<'_, Path> = if settings.relative {
+        relative_path(src, dst)
+    } else {
+        src.into()
     };
 
-    if dst.is_symlink() || dst.exists() {
-        backup_path = match settings.backup {
-            BackupMode::NoBackup => None,
-            BackupMode::SimpleBackup => Some(simple_backup_path(dst, &settings.suffix)),
-            BackupMode::NumberedBackup => Some(numbered_backup_path(dst)),
-            BackupMode::ExistingBackup => Some(existing_backup_path(dst, &settings.suffix)),
+    if dst.is_symlink() || dst.exists() {
+        backup_path = match settings.backup {
+            BackupMode::NoBackup => None,
+            BackupMode::SimpleBackup => Some(simple_backup_path(dst, &settings.suffix)),
+            BackupMode::NumberedBackup => Some(numbered_backup_path(dst)),
+            BackupMode::ExistingBackup => Some(existing_backup_path(dst, &settings.suffix)),
         };
-        if settings.backup == BackupMode::ExistingBackup && !settings.symbolic {
-            // when ln --backup f f, it should detect that it is the same file
-            if paths_refer_to_same_file(src, dst, true) {
-                return Err(LnError::SameFile(src.to_owned(), dst.to_owned()).into());
+        if settings.backup == BackupMode::ExistingBackup && !settings.symbolic {
+            // when ln --backup f f, it should detect that it is the same file
+            if paths_refer_to_same_file(src, dst, true) {
+                return Err(LnError::SameFile(src.to_owned(), dst.to_owned()).into());
             }
         }
-        if let Some(ref p) = backup_path {
-            fs::rename(dst, p).map_err_context(|| format!("cannot backup {}", dst.quote()))?;
+        if let Some(ref p) = backup_path {
+            fs::rename(dst, p).map_err_context(|| format!("cannot backup {}", dst.quote()))?;
         }
-        match settings.overwrite {
-            OverwriteMode::NoClobber => {}
-            OverwriteMode::Interactive => {
-                print!("{}: overwrite {}? ", uucore::util_name(), dst.quote());
-                if !read_yes() {
-                    return Ok(());
+        match settings.overwrite {
+            OverwriteMode::NoClobber => {}
+            OverwriteMode::Interactive => {
+                print!("{}: overwrite {}? ", uucore::util_name(), dst.quote());
+                if !read_yes() {
+                    return Ok(());
                 }
 
-                if fs::remove_file(dst).is_ok() {};
-                // In case of error, don't do anything
-            }
-            OverwriteMode::Force => {
-                if !dst.is_symlink() && paths_refer_to_same_file(src, dst, true) {
-                    return Err(LnError::SameFile(src.to_owned(), dst.to_owned()).into());
+                if fs::remove_file(dst).is_ok() {};
+                // In case of error, don't do anything
+            }
+            OverwriteMode::Force => {
+                if !dst.is_symlink() && paths_refer_to_same_file(src, dst, true) {
+                    return Err(LnError::SameFile(src.to_owned(), dst.to_owned()).into());
                 }
-                if fs::remove_file(dst).is_ok() {};
-                // In case of error, don't do anything
-            }
+                if fs::remove_file(dst).is_ok() {};
+                // In case of error, don't do anything
+            }
         };
     }
 
-    if settings.symbolic {
-        symlink(&source, dst)?;
-    } else {
-        let p = if settings.logical && source.is_symlink() {
-            // if we want to have an hard link,
-            // source is a symlink and -L is passed
-            // we want to resolve the symlink to create the hardlink
-            fs::canonicalize(&source)
-                .map_err_context(|| format!("failed to access {}", source.quote()))?
-        } else {
-            source.to_path_buf()
+    if settings.symbolic {
+        symlink(&source, dst)?;
+    } else {
+        let p = if settings.logical && source.is_symlink() {
+            // if we want to have an hard link,
+            // source is a symlink and -L is passed
+            // we want to resolve the symlink to create the hardlink
+            fs::canonicalize(&source)
+                .map_err_context(|| format!("failed to access {}", source.quote()))?
+        } else {
+            source.to_path_buf()
         };
-        fs::hard_link(&p, dst).map_err_context(|| {
+        fs::hard_link(&p, dst).map_err_context(|| {
             format!(
                 "failed to create hard link {} => {}",
-                source.quote(),
-                dst.quote()
+                source.quote(),
+                dst.quote()
             )
         })?;
     }
 
-    if settings.verbose {
-        print!("{} -> {}", dst.quote(), source.quote());
-        match backup_path {
-            Some(path) => println!(" (backup: {})", path.quote()),
-            None => println!(),
+    if settings.verbose {
+        print!("{} -> {}", dst.quote(), source.quote());
+        match backup_path {
+            Some(path) => println!(" (backup: {})", path.quote()),
+            None => println!(),
         }
     }
     Ok(())
 }
 
-fn read_yes() -> bool {
-    let mut s = String::new();
-    match stdin().read_line(&mut s) {
-        Ok(_) => match s.char_indices().next() {
-            Some((_, x)) => x == 'y' || x == 'Y',
-            _ => false,
+fn read_yes() -> bool {
+    let mut s = String::new();
+    match stdin().read_line(&mut s) {
+        Ok(_) => match s.char_indices().next() {
+            Some((_, x)) => x == 'y' || x == 'Y',
+            _ => false,
         },
-        _ => false,
+        _ => false,
     }
 }
 
-fn simple_backup_path(path: &Path, suffix: &str) -> PathBuf {
-    let mut p = path.as_os_str().to_str().unwrap().to_owned();
-    p.push_str(suffix);
-    PathBuf::from(p)
+fn simple_backup_path(path: &Path, suffix: &str) -> PathBuf {
+    let mut p = path.as_os_str().to_str().unwrap().to_owned();
+    p.push_str(suffix);
+    PathBuf::from(p)
 }
 
-fn numbered_backup_path(path: &Path) -> PathBuf {
-    let mut i: u64 = 1;
-    loop {
-        let new_path = simple_backup_path(path, &format!(".~{}~", i));
-        if !new_path.exists() {
-            return new_path;
+fn numbered_backup_path(path: &Path) -> PathBuf {
+    let mut i: u64 = 1;
+    loop {
+        let new_path = simple_backup_path(path, &format!(".~{}~", i));
+        if !new_path.exists() {
+            return new_path;
         }
-        i += 1;
+        i += 1;
     }
 }
 
-fn existing_backup_path(path: &Path, suffix: &str) -> PathBuf {
-    let test_path = simple_backup_path(path, ".~1~");
-    if test_path.exists() {
-        return numbered_backup_path(path);
+fn existing_backup_path(path: &Path, suffix: &str) -> PathBuf {
+    let test_path = simple_backup_path(path, ".~1~");
+    if test_path.exists() {
+        return numbered_backup_path(path);
     }
-    simple_backup_path(path, suffix)
+    simple_backup_path(path, suffix)
 }
 
-#[cfg(windows)]
-pub fn symlink<P1: AsRef<Path>, P2: AsRef<Path>>(src: P1, dst: P2) -> std::io::Result<()> {
-    if src.as_ref().is_dir() {
-        symlink_dir(src, dst)
-    } else {
-        symlink_file(src, dst)
+#[cfg(windows)]
+pub fn symlink<P1: AsRef<Path>, P2: AsRef<Path>>(src: P1, dst: P2) -> std::io::Result<()> {
+    if src.as_ref().is_dir() {
+        symlink_dir(src, dst)
+    } else {
+        symlink_file(src, dst)
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_logname/logname.rs.html b/dev/src/uu_logname/logname.rs.html index e101e8f45..2aeab206a 100644 --- a/dev/src/uu_logname/logname.rs.html +++ b/dev/src/uu_logname/logname.rs.html @@ -1,4 +1,4 @@ -logname.rs - source
1
+logname.rs - source
1
 2
 3
 4
@@ -55,62 +55,62 @@
 55
 56
 57
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Benoit Benedetti <benoit.benedetti@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Benoit Benedetti <benoit.benedetti@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-/* last synced with: logname (GNU coreutils) 8.22 */
+/* last synced with: logname (GNU coreutils) 8.22 */
 
-// spell-checker:ignore (ToDO) getlogin userlogin
+// spell-checker:ignore (ToDO) getlogin userlogin
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Command};
-use std::ffi::CStr;
-use uucore::error::UResult;
+use clap::{crate_version, Command};
+use std::ffi::CStr;
+use uucore::error::UResult;
 
-extern "C" {
-    // POSIX requires using getlogin (or equivalent code)
-    pub fn getlogin() -> *const libc::c_char;
+extern "C" {
+    // POSIX requires using getlogin (or equivalent code)
+    pub fn getlogin() -> *const libc::c_char;
 }
 
-fn get_userlogin() -> Option<String> {
-    unsafe {
-        let login: *const libc::c_char = getlogin();
-        if login.is_null() {
-            None
-        } else {
-            Some(String::from_utf8_lossy(CStr::from_ptr(login).to_bytes()).to_string())
+fn get_userlogin() -> Option<String> {
+    unsafe {
+        let login: *const libc::c_char = getlogin();
+        if login.is_null() {
+            None
+        } else {
+            Some(String::from_utf8_lossy(CStr::from_ptr(login).to_bytes()).to_string())
         }
     }
 }
 
-static ABOUT: &str = "Print user's login name";
+static ABOUT: &str = "Print user's login name";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let _ = uu_app().try_get_matches_from(args)?;
+    let _ = uu_app().try_get_matches_from(args)?;
 
-    match get_userlogin() {
-        Some(userlogin) => println!("{}", userlogin),
-        None => show_error!("no login name"),
+    match get_userlogin() {
+        Some(userlogin) => println!("{}", userlogin),
+        None => show_error!("no login name"),
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .override_usage(uucore::execution_phrase())
-        .about(ABOUT)
-        .infer_long_args(true)
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .override_usage(uucore::execution_phrase())
+        .about(ABOUT)
+        .infer_long_args(true)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_ls/ls.rs.html b/dev/src/uu_ls/ls.rs.html index aa9668e37..892eb2a34 100644 --- a/dev/src/uu_ls/ls.rs.html +++ b/dev/src/uu_ls/ls.rs.html @@ -1,4 +1,4 @@ -ls.rs - source
1
+ls.rs - source
1
 2
 3
 4
@@ -3050,978 +3050,978 @@
 3050
 3051
 3052
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jeremiah Peschka <jeremiah.peschka@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jeremiah Peschka <jeremiah.peschka@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf tabsize dired
+// spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf tabsize dired
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{
-    builder::{NonEmptyStringValueParser, ValueParser},
-    crate_version, Arg, ArgAction, Command,
+use clap::{
+    builder::{NonEmptyStringValueParser, ValueParser},
+    crate_version, Arg, ArgAction, Command,
 };
-use glob::{MatchOptions, Pattern};
-use lscolors::LsColors;
-use number_prefix::NumberPrefix;
-use once_cell::unsync::OnceCell;
-use std::collections::HashSet;
-#[cfg(windows)]
-use std::os::windows::fs::MetadataExt;
-use std::{
-    cmp::Reverse,
-    error::Error,
-    ffi::{OsStr, OsString},
-    fmt::{Display, Write as FmtWrite},
-    fs::{self, DirEntry, FileType, Metadata, ReadDir},
-    io::{stdout, BufWriter, ErrorKind, Stdout, Write},
-    path::{Path, PathBuf},
-    time::{SystemTime, UNIX_EPOCH},
+use glob::{MatchOptions, Pattern};
+use lscolors::LsColors;
+use number_prefix::NumberPrefix;
+use once_cell::unsync::OnceCell;
+use std::collections::HashSet;
+#[cfg(windows)]
+use std::os::windows::fs::MetadataExt;
+use std::{
+    cmp::Reverse,
+    error::Error,
+    ffi::{OsStr, OsString},
+    fmt::{Display, Write as FmtWrite},
+    fs::{self, DirEntry, FileType, Metadata, ReadDir},
+    io::{stdout, BufWriter, ErrorKind, Stdout, Write},
+    path::{Path, PathBuf},
+    time::{SystemTime, UNIX_EPOCH},
 };
-#[cfg(unix)]
-use std::{
-    collections::HashMap,
-    os::unix::fs::{FileTypeExt, MetadataExt},
-    time::Duration,
+#[cfg(unix)]
+use std::{
+    collections::HashMap,
+    os::unix::fs::{FileTypeExt, MetadataExt},
+    time::Duration,
 };
-use term_grid::{Cell, Direction, Filling, Grid, GridOptions};
-use unicode_width::UnicodeWidthStr;
-#[cfg(unix)]
-use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR};
-use uucore::parse_glob;
-use uucore::quoting_style::{escape_name, QuotingStyle};
-use uucore::{
-    display::Quotable,
-    error::{set_exit_code, UError, UResult},
-    format_usage,
-    fs::display_permissions,
-    parse_size::parse_size,
-    version_cmp::version_cmp,
+use term_grid::{Cell, Direction, Filling, Grid, GridOptions};
+use unicode_width::UnicodeWidthStr;
+#[cfg(unix)]
+use uucore::libc::{S_IXGRP, S_IXOTH, S_IXUSR};
+use uucore::parse_glob;
+use uucore::quoting_style::{escape_name, QuotingStyle};
+use uucore::{
+    display::Quotable,
+    error::{set_exit_code, UError, UResult},
+    format_usage,
+    fs::display_permissions,
+    parse_size::parse_size,
+    version_cmp::version_cmp,
 };
 
-#[cfg(not(feature = "selinux"))]
-static CONTEXT_HELP_TEXT: &str = "print any security context of each file (not enabled)";
-#[cfg(feature = "selinux")]
-static CONTEXT_HELP_TEXT: &str = "print any security context of each file";
+#[cfg(not(feature = "selinux"))]
+static CONTEXT_HELP_TEXT: &str = "print any security context of each file (not enabled)";
+#[cfg(feature = "selinux")]
+static CONTEXT_HELP_TEXT: &str = "print any security context of each file";
 
-const ABOUT: &str = r#"List directory contents.
+const ABOUT: &str = r#"List directory contents.
 Ignore files and directories starting with a '.' by default"#;
 
-const USAGE: &str = "{} [OPTION]... [FILE]...";
+const USAGE: &str = "{} [OPTION]... [FILE]...";
 
-pub mod options {
+pub mod options {
 
-    pub mod format {
-        pub static ONE_LINE: &str = "1";
-        pub static LONG: &str = "long";
-        pub static COLUMNS: &str = "C";
-        pub static ACROSS: &str = "x";
-        pub static TAB_SIZE: &str = "tabsize"; // silently ignored (see #3624)
-        pub static COMMAS: &str = "m";
-        pub static LONG_NO_OWNER: &str = "g";
-        pub static LONG_NO_GROUP: &str = "o";
-        pub static LONG_NUMERIC_UID_GID: &str = "numeric-uid-gid";
+    pub mod format {
+        pub static ONE_LINE: &str = "1";
+        pub static LONG: &str = "long";
+        pub static COLUMNS: &str = "C";
+        pub static ACROSS: &str = "x";
+        pub static TAB_SIZE: &str = "tabsize"; // silently ignored (see #3624)
+        pub static COMMAS: &str = "m";
+        pub static LONG_NO_OWNER: &str = "g";
+        pub static LONG_NO_GROUP: &str = "o";
+        pub static LONG_NUMERIC_UID_GID: &str = "numeric-uid-gid";
     }
 
-    pub mod files {
-        pub static ALL: &str = "all";
-        pub static ALMOST_ALL: &str = "almost-all";
+    pub mod files {
+        pub static ALL: &str = "all";
+        pub static ALMOST_ALL: &str = "almost-all";
     }
 
-    pub mod sort {
-        pub static SIZE: &str = "S";
-        pub static TIME: &str = "t";
-        pub static NONE: &str = "U";
-        pub static VERSION: &str = "v";
-        pub static EXTENSION: &str = "X";
+    pub mod sort {
+        pub static SIZE: &str = "S";
+        pub static TIME: &str = "t";
+        pub static NONE: &str = "U";
+        pub static VERSION: &str = "v";
+        pub static EXTENSION: &str = "X";
     }
 
-    pub mod time {
-        pub static ACCESS: &str = "u";
-        pub static CHANGE: &str = "c";
+    pub mod time {
+        pub static ACCESS: &str = "u";
+        pub static CHANGE: &str = "c";
     }
 
-    pub mod size {
-        pub static ALLOCATION_SIZE: &str = "size";
-        pub static BLOCK_SIZE: &str = "block-size";
-        pub static HUMAN_READABLE: &str = "human-readable";
-        pub static SI: &str = "si";
-        pub static KIBIBYTES: &str = "kibibytes";
+    pub mod size {
+        pub static ALLOCATION_SIZE: &str = "size";
+        pub static BLOCK_SIZE: &str = "block-size";
+        pub static HUMAN_READABLE: &str = "human-readable";
+        pub static SI: &str = "si";
+        pub static KIBIBYTES: &str = "kibibytes";
     }
 
-    pub mod quoting {
-        pub static ESCAPE: &str = "escape";
-        pub static LITERAL: &str = "literal";
-        pub static C: &str = "quote-name";
+    pub mod quoting {
+        pub static ESCAPE: &str = "escape";
+        pub static LITERAL: &str = "literal";
+        pub static C: &str = "quote-name";
     }
 
-    pub mod indicator_style {
-        pub static SLASH: &str = "p";
-        pub static FILE_TYPE: &str = "file-type";
-        pub static CLASSIFY: &str = "classify";
+    pub mod indicator_style {
+        pub static SLASH: &str = "p";
+        pub static FILE_TYPE: &str = "file-type";
+        pub static CLASSIFY: &str = "classify";
     }
 
-    pub mod dereference {
-        pub static ALL: &str = "dereference";
-        pub static ARGS: &str = "dereference-command-line";
-        pub static DIR_ARGS: &str = "dereference-command-line-symlink-to-dir";
+    pub mod dereference {
+        pub static ALL: &str = "dereference";
+        pub static ARGS: &str = "dereference-command-line";
+        pub static DIR_ARGS: &str = "dereference-command-line-symlink-to-dir";
     }
 
-    pub static HELP: &str = "help";
-    pub static QUOTING_STYLE: &str = "quoting-style";
-    pub static HIDE_CONTROL_CHARS: &str = "hide-control-chars";
-    pub static SHOW_CONTROL_CHARS: &str = "show-control-chars";
-    pub static WIDTH: &str = "width";
-    pub static AUTHOR: &str = "author";
-    pub static NO_GROUP: &str = "no-group";
-    pub static FORMAT: &str = "format";
-    pub static SORT: &str = "sort";
-    pub static TIME: &str = "time";
-    pub static IGNORE_BACKUPS: &str = "ignore-backups";
-    pub static DIRECTORY: &str = "directory";
-    pub static INODE: &str = "inode";
-    pub static REVERSE: &str = "reverse";
-    pub static RECURSIVE: &str = "recursive";
-    pub static COLOR: &str = "color";
-    pub static PATHS: &str = "paths";
-    pub static INDICATOR_STYLE: &str = "indicator-style";
-    pub static TIME_STYLE: &str = "time-style";
-    pub static FULL_TIME: &str = "full-time";
-    pub static HIDE: &str = "hide";
-    pub static IGNORE: &str = "ignore";
-    pub static CONTEXT: &str = "context";
-    pub static GROUP_DIRECTORIES_FIRST: &str = "group-directories-first";
-    pub static ZERO: &str = "zero";
-    pub static DIRED: &str = "dired";
+    pub static HELP: &str = "help";
+    pub static QUOTING_STYLE: &str = "quoting-style";
+    pub static HIDE_CONTROL_CHARS: &str = "hide-control-chars";
+    pub static SHOW_CONTROL_CHARS: &str = "show-control-chars";
+    pub static WIDTH: &str = "width";
+    pub static AUTHOR: &str = "author";
+    pub static NO_GROUP: &str = "no-group";
+    pub static FORMAT: &str = "format";
+    pub static SORT: &str = "sort";
+    pub static TIME: &str = "time";
+    pub static IGNORE_BACKUPS: &str = "ignore-backups";
+    pub static DIRECTORY: &str = "directory";
+    pub static INODE: &str = "inode";
+    pub static REVERSE: &str = "reverse";
+    pub static RECURSIVE: &str = "recursive";
+    pub static COLOR: &str = "color";
+    pub static PATHS: &str = "paths";
+    pub static INDICATOR_STYLE: &str = "indicator-style";
+    pub static TIME_STYLE: &str = "time-style";
+    pub static FULL_TIME: &str = "full-time";
+    pub static HIDE: &str = "hide";
+    pub static IGNORE: &str = "ignore";
+    pub static CONTEXT: &str = "context";
+    pub static GROUP_DIRECTORIES_FIRST: &str = "group-directories-first";
+    pub static ZERO: &str = "zero";
+    pub static DIRED: &str = "dired";
 }
 
-const DEFAULT_TERM_WIDTH: u16 = 80;
-const POSIXLY_CORRECT_BLOCK_SIZE: u64 = 512;
-#[cfg(unix)]
-const DEFAULT_BLOCK_SIZE: u64 = 1024;
+const DEFAULT_TERM_WIDTH: u16 = 80;
+const POSIXLY_CORRECT_BLOCK_SIZE: u64 = 512;
+#[cfg(unix)]
+const DEFAULT_BLOCK_SIZE: u64 = 1024;
 
-#[derive(Debug)]
-enum LsError {
-    InvalidLineWidth(String),
-    IOError(std::io::Error),
-    IOErrorContext(std::io::Error, PathBuf, bool),
-    BlockSizeParseError(String),
-    AlreadyListedError(PathBuf),
-    TimeStyleParseError(String, Vec<String>),
+#[derive(Debug)]
+enum LsError {
+    InvalidLineWidth(String),
+    IOError(std::io::Error),
+    IOErrorContext(std::io::Error, PathBuf, bool),
+    BlockSizeParseError(String),
+    AlreadyListedError(PathBuf),
+    TimeStyleParseError(String, Vec<String>),
 }
 
-impl UError for LsError {
-    fn code(&self) -> i32 {
-        match self {
-            Self::InvalidLineWidth(_) => 2,
-            Self::IOError(_) => 1,
-            Self::IOErrorContext(_, _, false) => 1,
-            Self::IOErrorContext(_, _, true) => 2,
-            Self::BlockSizeParseError(_) => 1,
-            Self::AlreadyListedError(_) => 2,
-            Self::TimeStyleParseError(_, _) => 1,
+impl UError for LsError {
+    fn code(&self) -> i32 {
+        match self {
+            Self::InvalidLineWidth(_) => 2,
+            Self::IOError(_) => 1,
+            Self::IOErrorContext(_, _, false) => 1,
+            Self::IOErrorContext(_, _, true) => 2,
+            Self::BlockSizeParseError(_) => 1,
+            Self::AlreadyListedError(_) => 2,
+            Self::TimeStyleParseError(_, _) => 1,
         }
     }
 }
 
-impl Error for LsError {}
+impl Error for LsError {}
 
-impl Display for LsError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::BlockSizeParseError(s) => {
-                write!(f, "invalid --block-size argument {}", s.quote())
+impl Display for LsError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::BlockSizeParseError(s) => {
+                write!(f, "invalid --block-size argument {}", s.quote())
             }
-            Self::TimeStyleParseError(s, possible_time_styles) => {
+            Self::TimeStyleParseError(s, possible_time_styles) => {
                 write!(
-                    f,
+                    f,
                     "invalid --time-style argument {}\nPossible values are: {:?}\n\nFor more information try --help",
-                    s.quote(),
-                    possible_time_styles
+                    s.quote(),
+                    possible_time_styles
                 )
             }
-            Self::InvalidLineWidth(s) => write!(f, "invalid line width: {}", s.quote()),
-            Self::IOError(e) => write!(f, "general io error: {}", e),
-            Self::IOErrorContext(e, p, _) => {
-                let error_kind = e.kind();
-                let errno = e.raw_os_error().unwrap_or(1i32);
+            Self::InvalidLineWidth(s) => write!(f, "invalid line width: {}", s.quote()),
+            Self::IOError(e) => write!(f, "general io error: {}", e),
+            Self::IOErrorContext(e, p, _) => {
+                let error_kind = e.kind();
+                let errno = e.raw_os_error().unwrap_or(1i32);
 
-                match error_kind {
-                    // No such file or directory
-                    ErrorKind::NotFound => {
+                match error_kind {
+                    // No such file or directory
+                    ErrorKind::NotFound => {
                         write!(
-                            f,
+                            f,
                             "cannot access '{}': No such file or directory",
-                            p.to_string_lossy(),
+                            p.to_string_lossy(),
                         )
                     }
-                    // Permission denied and Operation not permitted
-                    ErrorKind::PermissionDenied =>
+                    // Permission denied and Operation not permitted
+                    ErrorKind::PermissionDenied =>
                     {
-                        #[allow(clippy::wildcard_in_or_patterns)]
-                        match errno {
-                            1i32 => {
+                        #[allow(clippy::wildcard_in_or_patterns)]
+                        match errno {
+                            1i32 => {
                                 write!(
-                                    f,
+                                    f,
                                     "cannot access '{}': Operation not permitted",
-                                    p.to_string_lossy(),
+                                    p.to_string_lossy(),
                                 )
                             }
-                            13i32 | _ => {
-                                if p.is_dir() {
+                            13i32 | _ => {
+                                if p.is_dir() {
                                     write!(
-                                        f,
+                                        f,
                                         "cannot open directory '{}': Permission denied",
-                                        p.to_string_lossy(),
+                                        p.to_string_lossy(),
                                     )
-                                } else {
+                                } else {
                                     write!(
-                                        f,
+                                        f,
                                         "cannot open file '{}': Permission denied",
-                                        p.to_string_lossy(),
+                                        p.to_string_lossy(),
                                     )
                                 }
                             }
                         }
                     }
-                    _ => match errno {
-                        9i32 => {
-                            // only should ever occur on a read_dir on a bad fd
-                            write!(
-                                f,
+                    _ => match errno {
+                        9i32 => {
+                            // only should ever occur on a read_dir on a bad fd
+                            write!(
+                                f,
                                 "cannot open directory '{}': Bad file descriptor",
-                                p.to_string_lossy(),
+                                p.to_string_lossy(),
                             )
                         }
-                        _ => {
+                        _ => {
                             write!(
-                                f,
+                                f,
                                 "unknown io error: '{:?}', '{:?}'",
-                                p.to_string_lossy(),
-                                e
+                                p.to_string_lossy(),
+                                e
                             )
                         }
                     },
                 }
             }
-            Self::AlreadyListedError(path) => {
+            Self::AlreadyListedError(path) => {
                 write!(
-                    f,
+                    f,
                     "{}: not listing already-listed directory",
-                    path.to_string_lossy()
+                    path.to_string_lossy()
                 )
             }
         }
     }
 }
 
-#[derive(PartialEq, Eq, Debug)]
-pub enum Format {
-    Columns,
-    Long,
-    OneLine,
-    Across,
-    Commas,
+#[derive(PartialEq, Eq, Debug)]
+pub enum Format {
+    Columns,
+    Long,
+    OneLine,
+    Across,
+    Commas,
 }
 
-#[derive(PartialEq, Eq)]
-enum Sort {
+#[derive(PartialEq, Eq)]
+enum Sort {
     None,
-    Name,
-    Size,
-    Time,
-    Version,
-    Extension,
+    Name,
+    Size,
+    Time,
+    Version,
+    Extension,
 }
 
-#[derive(PartialEq)]
-enum SizeFormat {
-    Bytes,
-    Binary,  // Powers of 1024, --human-readable, -h
-    Decimal, // Powers of 1000, --si
+#[derive(PartialEq)]
+enum SizeFormat {
+    Bytes,
+    Binary,  // Powers of 1024, --human-readable, -h
+    Decimal, // Powers of 1000, --si
+}
+
+#[derive(PartialEq, Eq)]
+enum Files {
+    All,
+    AlmostAll,
+    Normal,
 }
 
-#[derive(PartialEq, Eq)]
-enum Files {
-    All,
-    AlmostAll,
-    Normal,
+enum Time {
+    Modification,
+    Access,
+    Change,
+    Birth,
 }
 
-enum Time {
-    Modification,
-    Access,
-    Change,
-    Birth,
+#[derive(Debug)]
+enum TimeStyle {
+    FullIso,
+    LongIso,
+    Iso,
+    Locale,
+    Format(String),
 }
 
-#[derive(Debug)]
-enum TimeStyle {
-    FullIso,
-    LongIso,
-    Iso,
-    Locale,
-    Format(String),
-}
-
-fn parse_time_style(options: &clap::ArgMatches) -> Result<TimeStyle, LsError> {
-    let possible_time_styles = vec![
-        "full-iso".to_string(),
-        "long-iso".to_string(),
-        "iso".to_string(),
-        "locale".to_string(),
-        "+FORMAT (e.g., +%H:%M) for a 'date'-style format".to_string(),
+fn parse_time_style(options: &clap::ArgMatches) -> Result<TimeStyle, LsError> {
+    let possible_time_styles = vec![
+        "full-iso".to_string(),
+        "long-iso".to_string(),
+        "iso".to_string(),
+        "locale".to_string(),
+        "+FORMAT (e.g., +%H:%M) for a 'date'-style format".to_string(),
     ];
-    if let Some(field) = options.get_one::<String>(options::TIME_STYLE) {
-        //If both FULL_TIME and TIME_STYLE are present
-        //The one added last is dominant
-        if options.get_flag(options::FULL_TIME)
-            && options.indices_of(options::FULL_TIME).unwrap().last()
-                > options.indices_of(options::TIME_STYLE).unwrap().last()
+    if let Some(field) = options.get_one::<String>(options::TIME_STYLE) {
+        //If both FULL_TIME and TIME_STYLE are present
+        //The one added last is dominant
+        if options.get_flag(options::FULL_TIME)
+            && options.indices_of(options::FULL_TIME).unwrap().last()
+                > options.indices_of(options::TIME_STYLE).unwrap().last()
         {
-            Ok(TimeStyle::FullIso)
-        } else {
-            match field.as_str() {
-                "full-iso" => Ok(TimeStyle::FullIso),
-                "long-iso" => Ok(TimeStyle::LongIso),
-                "iso" => Ok(TimeStyle::Iso),
-                "locale" => Ok(TimeStyle::Locale),
-                _ => match field.chars().next().unwrap() {
-                    '+' => Ok(TimeStyle::Format(String::from(&field[1..]))),
-                    _ => Err(LsError::TimeStyleParseError(
-                        String::from(field),
-                        possible_time_styles,
+            Ok(TimeStyle::FullIso)
+        } else {
+            match field.as_str() {
+                "full-iso" => Ok(TimeStyle::FullIso),
+                "long-iso" => Ok(TimeStyle::LongIso),
+                "iso" => Ok(TimeStyle::Iso),
+                "locale" => Ok(TimeStyle::Locale),
+                _ => match field.chars().next().unwrap() {
+                    '+' => Ok(TimeStyle::Format(String::from(&field[1..]))),
+                    _ => Err(LsError::TimeStyleParseError(
+                        String::from(field),
+                        possible_time_styles,
                     )),
                 },
             }
         }
-    } else if options.get_flag(options::FULL_TIME) {
-        Ok(TimeStyle::FullIso)
-    } else {
-        Ok(TimeStyle::Locale)
+    } else if options.get_flag(options::FULL_TIME) {
+        Ok(TimeStyle::FullIso)
+    } else {
+        Ok(TimeStyle::Locale)
     }
 }
-enum Dereference {
+enum Dereference {
     None,
-    DirArgs,
-    Args,
-    All,
+    DirArgs,
+    Args,
+    All,
 }
 
-#[derive(PartialEq, Eq)]
-enum IndicatorStyle {
+#[derive(PartialEq, Eq)]
+enum IndicatorStyle {
     None,
-    Slash,
-    FileType,
-    Classify,
+    Slash,
+    FileType,
+    Classify,
 }
 
-pub struct Config {
-    // Dir and vdir needs access to this field
-    pub format: Format,
-    files: Files,
-    sort: Sort,
-    recursive: bool,
-    reverse: bool,
-    dereference: Dereference,
-    ignore_patterns: Vec<Pattern>,
-    size_format: SizeFormat,
-    directory: bool,
-    time: Time,
-    #[cfg(unix)]
-    inode: bool,
-    color: Option<LsColors>,
-    long: LongFormat,
-    alloc_size: bool,
-    block_size: Option<u64>,
-    width: u16,
-    // Dir and vdir needs access to this field
-    pub quoting_style: QuotingStyle,
-    indicator_style: IndicatorStyle,
-    time_style: TimeStyle,
-    context: bool,
-    selinux_supported: bool,
-    group_directories_first: bool,
-    eol: char,
+pub struct Config {
+    // Dir and vdir needs access to this field
+    pub format: Format,
+    files: Files,
+    sort: Sort,
+    recursive: bool,
+    reverse: bool,
+    dereference: Dereference,
+    ignore_patterns: Vec<Pattern>,
+    size_format: SizeFormat,
+    directory: bool,
+    time: Time,
+    #[cfg(unix)]
+    inode: bool,
+    color: Option<LsColors>,
+    long: LongFormat,
+    alloc_size: bool,
+    block_size: Option<u64>,
+    width: u16,
+    // Dir and vdir needs access to this field
+    pub quoting_style: QuotingStyle,
+    indicator_style: IndicatorStyle,
+    time_style: TimeStyle,
+    context: bool,
+    selinux_supported: bool,
+    group_directories_first: bool,
+    eol: char,
 }
 
-// Fields that can be removed or added to the long format
-struct LongFormat {
-    author: bool,
-    group: bool,
-    owner: bool,
-    #[cfg(unix)]
-    numeric_uid_gid: bool,
+// Fields that can be removed or added to the long format
+struct LongFormat {
+    author: bool,
+    group: bool,
+    owner: bool,
+    #[cfg(unix)]
+    numeric_uid_gid: bool,
 }
 
-struct PaddingCollection {
-    #[cfg(unix)]
-    inode: usize,
-    link_count: usize,
-    uname: usize,
-    group: usize,
-    context: usize,
-    size: usize,
-    #[cfg(unix)]
-    major: usize,
-    #[cfg(unix)]
-    minor: usize,
-    block_size: usize,
+struct PaddingCollection {
+    #[cfg(unix)]
+    inode: usize,
+    link_count: usize,
+    uname: usize,
+    group: usize,
+    context: usize,
+    size: usize,
+    #[cfg(unix)]
+    major: usize,
+    #[cfg(unix)]
+    minor: usize,
+    block_size: usize,
 }
 
-impl Config {
-    #[allow(clippy::cognitive_complexity)]
-    pub fn from(options: &clap::ArgMatches) -> UResult<Self> {
-        let context = options.get_flag(options::CONTEXT);
-        let (mut format, opt) = if let Some(format_) = options.get_one::<String>(options::FORMAT) {
+impl Config {
+    #[allow(clippy::cognitive_complexity)]
+    pub fn from(options: &clap::ArgMatches) -> UResult<Self> {
+        let context = options.get_flag(options::CONTEXT);
+        let (mut format, opt) = if let Some(format_) = options.get_one::<String>(options::FORMAT) {
             (
-                match format_.as_str() {
-                    "long" | "verbose" => Format::Long,
-                    "single-column" => Format::OneLine,
-                    "columns" | "vertical" => Format::Columns,
-                    "across" | "horizontal" => Format::Across,
-                    "commas" => Format::Commas,
-                    // below should never happen as clap already restricts the values.
-                    _ => unreachable!("Invalid field for --format"),
+                match format_.as_str() {
+                    "long" | "verbose" => Format::Long,
+                    "single-column" => Format::OneLine,
+                    "columns" | "vertical" => Format::Columns,
+                    "across" | "horizontal" => Format::Across,
+                    "commas" => Format::Commas,
+                    // below should never happen as clap already restricts the values.
+                    _ => unreachable!("Invalid field for --format"),
                 },
-                Some(options::FORMAT),
+                Some(options::FORMAT),
             )
-        } else if options.get_flag(options::format::LONG) {
-            (Format::Long, Some(options::format::LONG))
-        } else if options.get_flag(options::format::ACROSS) {
-            (Format::Across, Some(options::format::ACROSS))
-        } else if options.get_flag(options::format::COMMAS) {
-            (Format::Commas, Some(options::format::COMMAS))
-        } else if options.get_flag(options::format::COLUMNS) {
-            (Format::Columns, Some(options::format::COLUMNS))
-        } else if atty::is(atty::Stream::Stdout) {
-            (Format::Columns, None)
-        } else {
-            (Format::OneLine, None)
+        } else if options.get_flag(options::format::LONG) {
+            (Format::Long, Some(options::format::LONG))
+        } else if options.get_flag(options::format::ACROSS) {
+            (Format::Across, Some(options::format::ACROSS))
+        } else if options.get_flag(options::format::COMMAS) {
+            (Format::Commas, Some(options::format::COMMAS))
+        } else if options.get_flag(options::format::COLUMNS) {
+            (Format::Columns, Some(options::format::COLUMNS))
+        } else if atty::is(atty::Stream::Stdout) {
+            (Format::Columns, None)
+        } else {
+            (Format::OneLine, None)
         };
 
-        // The -o, -n and -g options are tricky. They cannot override with each
-        // other because it's possible to combine them. For example, the option
-        // -og should hide both owner and group. Furthermore, they are not
-        // reset if -l or --format=long is used. So these should just show the
-        // group: -gl or "-g --format=long". Finally, they are also not reset
-        // when switching to a different format option in-between like this:
-        // -ogCl or "-og --format=vertical --format=long".
-        //
-        // -1 has a similar issue: it does nothing if the format is long. This
-        // actually makes it distinct from the --format=singe-column option,
-        // which always applies.
-        //
-        // The idea here is to not let these options override with the other
-        // options, but manually whether they have an index that's greater than
-        // the other format options. If so, we set the appropriate format.
-        if format != Format::Long {
-            let idx = opt
-                .and_then(|opt| options.indices_of(opt).map(|x| x.max().unwrap()))
-                .unwrap_or(0);
-            if [
-                options::format::LONG_NO_OWNER,
-                options::format::LONG_NO_GROUP,
-                options::format::LONG_NUMERIC_UID_GID,
-                options::FULL_TIME,
+        // The -o, -n and -g options are tricky. They cannot override with each
+        // other because it's possible to combine them. For example, the option
+        // -og should hide both owner and group. Furthermore, they are not
+        // reset if -l or --format=long is used. So these should just show the
+        // group: -gl or "-g --format=long". Finally, they are also not reset
+        // when switching to a different format option in-between like this:
+        // -ogCl or "-og --format=vertical --format=long".
+        //
+        // -1 has a similar issue: it does nothing if the format is long. This
+        // actually makes it distinct from the --format=singe-column option,
+        // which always applies.
+        //
+        // The idea here is to not let these options override with the other
+        // options, but manually whether they have an index that's greater than
+        // the other format options. If so, we set the appropriate format.
+        if format != Format::Long {
+            let idx = opt
+                .and_then(|opt| options.indices_of(opt).map(|x| x.max().unwrap()))
+                .unwrap_or(0);
+            if [
+                options::format::LONG_NO_OWNER,
+                options::format::LONG_NO_GROUP,
+                options::format::LONG_NUMERIC_UID_GID,
+                options::FULL_TIME,
             ]
-            .iter()
-            .flat_map(|opt| {
-                if options.value_source(opt) == Some(clap::parser::ValueSource::CommandLine) {
-                    options.indices_of(opt)
-                } else {
-                    None
-                }
+            .iter()
+            .flat_map(|opt| {
+                if options.value_source(opt) == Some(clap::parser::ValueSource::CommandLine) {
+                    options.indices_of(opt)
+                } else {
+                    None
+                }
             })
-            .flatten()
-            .any(|i| i >= idx)
+            .flatten()
+            .any(|i| i >= idx)
             {
-                format = Format::Long;
-            } else if let Some(mut indices) = options.indices_of(options::format::ONE_LINE) {
-                if options.value_source(options::format::ONE_LINE)
-                    == Some(clap::parser::ValueSource::CommandLine)
-                    && indices.any(|i| i > idx)
+                format = Format::Long;
+            } else if let Some(mut indices) = options.indices_of(options::format::ONE_LINE) {
+                if options.value_source(options::format::ONE_LINE)
+                    == Some(clap::parser::ValueSource::CommandLine)
+                    && indices.any(|i| i > idx)
                 {
-                    format = Format::OneLine;
+                    format = Format::OneLine;
                 }
             }
         }
 
-        let files = if options.get_flag(options::files::ALL) {
-            Files::All
-        } else if options.get_flag(options::files::ALMOST_ALL) {
-            Files::AlmostAll
-        } else {
-            Files::Normal
+        let files = if options.get_flag(options::files::ALL) {
+            Files::All
+        } else if options.get_flag(options::files::ALMOST_ALL) {
+            Files::AlmostAll
+        } else {
+            Files::Normal
         };
 
-        let sort = if let Some(field) = options.get_one::<String>(options::SORT) {
-            match field.as_str() {
-                "none" => Sort::None,
-                "name" => Sort::Name,
-                "time" => Sort::Time,
-                "size" => Sort::Size,
-                "version" => Sort::Version,
-                "extension" => Sort::Extension,
-                // below should never happen as clap already restricts the values.
-                _ => unreachable!("Invalid field for --sort"),
+        let sort = if let Some(field) = options.get_one::<String>(options::SORT) {
+            match field.as_str() {
+                "none" => Sort::None,
+                "name" => Sort::Name,
+                "time" => Sort::Time,
+                "size" => Sort::Size,
+                "version" => Sort::Version,
+                "extension" => Sort::Extension,
+                // below should never happen as clap already restricts the values.
+                _ => unreachable!("Invalid field for --sort"),
             }
-        } else if options.get_flag(options::sort::TIME) {
-            Sort::Time
-        } else if options.get_flag(options::sort::SIZE) {
-            Sort::Size
-        } else if options.get_flag(options::sort::NONE) {
-            Sort::None
-        } else if options.get_flag(options::sort::VERSION) {
-            Sort::Version
-        } else if options.get_flag(options::sort::EXTENSION) {
-            Sort::Extension
-        } else {
-            Sort::Name
+        } else if options.get_flag(options::sort::TIME) {
+            Sort::Time
+        } else if options.get_flag(options::sort::SIZE) {
+            Sort::Size
+        } else if options.get_flag(options::sort::NONE) {
+            Sort::None
+        } else if options.get_flag(options::sort::VERSION) {
+            Sort::Version
+        } else if options.get_flag(options::sort::EXTENSION) {
+            Sort::Extension
+        } else {
+            Sort::Name
         };
 
-        let time = if let Some(field) = options.get_one::<String>(options::TIME) {
-            match field.as_str() {
-                "ctime" | "status" => Time::Change,
-                "access" | "atime" | "use" => Time::Access,
-                "birth" | "creation" => Time::Birth,
-                // below should never happen as clap already restricts the values.
-                _ => unreachable!("Invalid field for --time"),
+        let time = if let Some(field) = options.get_one::<String>(options::TIME) {
+            match field.as_str() {
+                "ctime" | "status" => Time::Change,
+                "access" | "atime" | "use" => Time::Access,
+                "birth" | "creation" => Time::Birth,
+                // below should never happen as clap already restricts the values.
+                _ => unreachable!("Invalid field for --time"),
             }
-        } else if options.get_flag(options::time::ACCESS) {
-            Time::Access
-        } else if options.get_flag(options::time::CHANGE) {
-            Time::Change
-        } else {
-            Time::Modification
+        } else if options.get_flag(options::time::ACCESS) {
+            Time::Access
+        } else if options.get_flag(options::time::CHANGE) {
+            Time::Change
+        } else {
+            Time::Modification
         };
 
-        let mut needs_color = match options.get_one::<String>(options::COLOR) {
-            None => options.contains_id(options::COLOR),
-            Some(val) => match val.as_str() {
-                "" | "always" | "yes" | "force" => true,
-                "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout),
-                /* "never" | "no" | "none" | */ _ => false,
+        let mut needs_color = match options.get_one::<String>(options::COLOR) {
+            None => options.contains_id(options::COLOR),
+            Some(val) => match val.as_str() {
+                "" | "always" | "yes" | "force" => true,
+                "auto" | "tty" | "if-tty" => atty::is(atty::Stream::Stdout),
+                /* "never" | "no" | "none" | */ _ => false,
             },
         };
 
-        let cmd_line_bs = options.get_one::<String>(options::size::BLOCK_SIZE);
-        let opt_si = cmd_line_bs.is_some()
-            && options
-                .get_one::<String>(options::size::BLOCK_SIZE)
-                .unwrap()
-                .eq("si")
-            || options.get_flag(options::size::SI);
-        let opt_hr = (cmd_line_bs.is_some()
-            && options
-                .get_one::<String>(options::size::BLOCK_SIZE)
-                .unwrap()
-                .eq("human-readable"))
-            || options.get_flag(options::size::HUMAN_READABLE);
-        let opt_kb = options.get_flag(options::size::KIBIBYTES);
+        let cmd_line_bs = options.get_one::<String>(options::size::BLOCK_SIZE);
+        let opt_si = cmd_line_bs.is_some()
+            && options
+                .get_one::<String>(options::size::BLOCK_SIZE)
+                .unwrap()
+                .eq("si")
+            || options.get_flag(options::size::SI);
+        let opt_hr = (cmd_line_bs.is_some()
+            && options
+                .get_one::<String>(options::size::BLOCK_SIZE)
+                .unwrap()
+                .eq("human-readable"))
+            || options.get_flag(options::size::HUMAN_READABLE);
+        let opt_kb = options.get_flag(options::size::KIBIBYTES);
 
-        let bs_env_var = std::env::var_os("BLOCK_SIZE");
-        let ls_bs_env_var = std::env::var_os("LS_BLOCK_SIZE");
-        let pc_env_var = std::env::var_os("POSIXLY_CORRECT");
+        let bs_env_var = std::env::var_os("BLOCK_SIZE");
+        let ls_bs_env_var = std::env::var_os("LS_BLOCK_SIZE");
+        let pc_env_var = std::env::var_os("POSIXLY_CORRECT");
 
-        let size_format = if opt_si {
-            SizeFormat::Decimal
-        } else if opt_hr {
-            SizeFormat::Binary
-        } else {
-            SizeFormat::Bytes
+        let size_format = if opt_si {
+            SizeFormat::Decimal
+        } else if opt_hr {
+            SizeFormat::Binary
+        } else {
+            SizeFormat::Bytes
         };
 
-        let raw_bs = if let Some(cmd_line_bs) = cmd_line_bs {
-            OsString::from(cmd_line_bs)
-        } else if !opt_kb {
-            if let Some(ls_bs_env_var) = ls_bs_env_var {
-                ls_bs_env_var
-            } else if let Some(bs_env_var) = bs_env_var {
-                bs_env_var
-            } else {
-                OsString::from("")
+        let raw_bs = if let Some(cmd_line_bs) = cmd_line_bs {
+            OsString::from(cmd_line_bs)
+        } else if !opt_kb {
+            if let Some(ls_bs_env_var) = ls_bs_env_var {
+                ls_bs_env_var
+            } else if let Some(bs_env_var) = bs_env_var {
+                bs_env_var
+            } else {
+                OsString::from("")
             }
-        } else {
-            OsString::from("")
+        } else {
+            OsString::from("")
         };
 
-        let block_size: Option<u64> = if !opt_si && !opt_hr && !raw_bs.is_empty() {
-            match parse_size(&raw_bs.to_string_lossy()) {
-                Ok(size) => Some(size),
+        let block_size: Option<u64> = if !opt_si && !opt_hr && !raw_bs.is_empty() {
+            match parse_size(&raw_bs.to_string_lossy()) {
+                Ok(size) => Some(size),
                 Err(_) => {
-                    show!(LsError::BlockSizeParseError(
-                        cmd_line_bs.unwrap().to_owned()
+                    show!(LsError::BlockSizeParseError(
+                        cmd_line_bs.unwrap().to_owned()
                     ));
-                    None
-                }
+                    None
+                }
             }
-        } else if let Some(pc) = pc_env_var {
-            if pc.as_os_str() == OsStr::new("true") || pc == OsStr::new("1") {
-                Some(POSIXLY_CORRECT_BLOCK_SIZE)
-            } else {
-                None
-            }
-        } else {
-            None
-        };
+        } else if let Some(pc) = pc_env_var {
+            if pc.as_os_str() == OsStr::new("true") || pc == OsStr::new("1") {
+                Some(POSIXLY_CORRECT_BLOCK_SIZE)
+            } else {
+                None
+            }
+        } else {
+            None
+        };
 
-        let long = {
-            let author = options.get_flag(options::AUTHOR);
-            let group = !options.get_flag(options::NO_GROUP)
-                && !options.get_flag(options::format::LONG_NO_GROUP);
-            let owner = !options.get_flag(options::format::LONG_NO_OWNER);
-            #[cfg(unix)]
-            let numeric_uid_gid = options.get_flag(options::format::LONG_NUMERIC_UID_GID);
-            LongFormat {
-                author,
-                group,
-                owner,
-                #[cfg(unix)]
-                numeric_uid_gid,
+        let long = {
+            let author = options.get_flag(options::AUTHOR);
+            let group = !options.get_flag(options::NO_GROUP)
+                && !options.get_flag(options::format::LONG_NO_GROUP);
+            let owner = !options.get_flag(options::format::LONG_NO_OWNER);
+            #[cfg(unix)]
+            let numeric_uid_gid = options.get_flag(options::format::LONG_NUMERIC_UID_GID);
+            LongFormat {
+                author,
+                group,
+                owner,
+                #[cfg(unix)]
+                numeric_uid_gid,
             }
         };
 
-        let width = match options.get_one::<String>(options::WIDTH) {
-            Some(x) => {
-                if x.starts_with('0') && x.len() > 1 {
-                    // Read number as octal
-                    match u16::from_str_radix(x, 8) {
-                        Ok(v) => v,
-                        Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
+        let width = match options.get_one::<String>(options::WIDTH) {
+            Some(x) => {
+                if x.starts_with('0') && x.len() > 1 {
+                    // Read number as octal
+                    match u16::from_str_radix(x, 8) {
+                        Ok(v) => v,
+                        Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
                     }
-                } else {
-                    match x.parse::<u16>() {
-                        Ok(u) => u,
-                        Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
+                } else {
+                    match x.parse::<u16>() {
+                        Ok(u) => u,
+                        Err(_) => return Err(LsError::InvalidLineWidth(x.into()).into()),
                     }
                 }
             }
-            None => match terminal_size::terminal_size() {
-                Some((width, _)) => width.0,
-                None => match std::env::var_os("COLUMNS") {
-                    Some(columns) => match columns.to_str().and_then(|s| s.parse().ok()) {
-                        Some(columns) => columns,
-                        None => {
+            None => match terminal_size::terminal_size() {
+                Some((width, _)) => width.0,
+                None => match std::env::var_os("COLUMNS") {
+                    Some(columns) => match columns.to_str().and_then(|s| s.parse().ok()) {
+                        Some(columns) => columns,
+                        None => {
                             show_error!(
                                 "ignoring invalid width in environment variable COLUMNS: {}",
-                                columns.quote()
+                                columns.quote()
                             );
-                            DEFAULT_TERM_WIDTH
+                            DEFAULT_TERM_WIDTH
                         }
                     },
-                    None => DEFAULT_TERM_WIDTH,
+                    None => DEFAULT_TERM_WIDTH,
                 },
             },
         };
 
-        #[allow(clippy::needless_bool)]
-        let mut show_control = if options.get_flag(options::HIDE_CONTROL_CHARS) {
-            false
-        } else if options.get_flag(options::SHOW_CONTROL_CHARS) {
-            true
-        } else {
-            !atty::is(atty::Stream::Stdout)
+        #[allow(clippy::needless_bool)]
+        let mut show_control = if options.get_flag(options::HIDE_CONTROL_CHARS) {
+            false
+        } else if options.get_flag(options::SHOW_CONTROL_CHARS) {
+            true
+        } else {
+            !atty::is(atty::Stream::Stdout)
         };
 
-        let opt_quoting_style = options
-            .get_one::<String>(options::QUOTING_STYLE)
-            .map(|cmd_line_qs| cmd_line_qs.to_owned());
+        let opt_quoting_style = options
+            .get_one::<String>(options::QUOTING_STYLE)
+            .map(|cmd_line_qs| cmd_line_qs.to_owned());
 
-        let mut quoting_style = if let Some(style) = opt_quoting_style {
-            match style.as_str() {
-                "literal" => QuotingStyle::Literal { show_control },
-                "shell" => QuotingStyle::Shell {
-                    escape: false,
-                    always_quote: false,
-                    show_control,
+        let mut quoting_style = if let Some(style) = opt_quoting_style {
+            match style.as_str() {
+                "literal" => QuotingStyle::Literal { show_control },
+                "shell" => QuotingStyle::Shell {
+                    escape: false,
+                    always_quote: false,
+                    show_control,
                 },
-                "shell-always" => QuotingStyle::Shell {
-                    escape: false,
-                    always_quote: true,
-                    show_control,
+                "shell-always" => QuotingStyle::Shell {
+                    escape: false,
+                    always_quote: true,
+                    show_control,
                 },
-                "shell-escape" => QuotingStyle::Shell {
-                    escape: true,
-                    always_quote: false,
-                    show_control,
+                "shell-escape" => QuotingStyle::Shell {
+                    escape: true,
+                    always_quote: false,
+                    show_control,
                 },
-                "shell-escape-always" => QuotingStyle::Shell {
-                    escape: true,
-                    always_quote: true,
-                    show_control,
+                "shell-escape-always" => QuotingStyle::Shell {
+                    escape: true,
+                    always_quote: true,
+                    show_control,
                 },
-                "c" => QuotingStyle::C {
-                    quotes: quoting_style::Quotes::Double,
+                "c" => QuotingStyle::C {
+                    quotes: quoting_style::Quotes::Double,
                 },
-                "escape" => QuotingStyle::C {
-                    quotes: quoting_style::Quotes::None,
+                "escape" => QuotingStyle::C {
+                    quotes: quoting_style::Quotes::None,
                 },
-                _ => unreachable!("Should have been caught by Clap"),
+                _ => unreachable!("Should have been caught by Clap"),
             }
-        } else if options.get_flag(options::quoting::LITERAL) {
-            QuotingStyle::Literal { show_control }
-        } else if options.get_flag(options::quoting::ESCAPE) {
-            QuotingStyle::C {
-                quotes: quoting_style::Quotes::None,
+        } else if options.get_flag(options::quoting::LITERAL) {
+            QuotingStyle::Literal { show_control }
+        } else if options.get_flag(options::quoting::ESCAPE) {
+            QuotingStyle::C {
+                quotes: quoting_style::Quotes::None,
             }
-        } else if options.get_flag(options::quoting::C) {
-            QuotingStyle::C {
-                quotes: quoting_style::Quotes::Double,
+        } else if options.get_flag(options::quoting::C) {
+            QuotingStyle::C {
+                quotes: quoting_style::Quotes::Double,
             }
-        } else {
-            // TODO: use environment variable if available
-            QuotingStyle::Shell {
-                escape: true,
-                always_quote: false,
-                show_control,
+        } else {
+            // TODO: use environment variable if available
+            QuotingStyle::Shell {
+                escape: true,
+                always_quote: false,
+                show_control,
             }
         };
 
-        let indicator_style = if let Some(field) =
-            options.get_one::<String>(options::INDICATOR_STYLE)
+        let indicator_style = if let Some(field) =
+            options.get_one::<String>(options::INDICATOR_STYLE)
         {
-            match field.as_str() {
-                "none" => IndicatorStyle::None,
-                "file-type" => IndicatorStyle::FileType,
-                "classify" => IndicatorStyle::Classify,
-                "slash" => IndicatorStyle::Slash,
-                &_ => IndicatorStyle::None,
+            match field.as_str() {
+                "none" => IndicatorStyle::None,
+                "file-type" => IndicatorStyle::FileType,
+                "classify" => IndicatorStyle::Classify,
+                "slash" => IndicatorStyle::Slash,
+                &_ => IndicatorStyle::None,
             }
-        } else if let Some(field) = options.get_one::<String>(options::indicator_style::CLASSIFY) {
-            match field.as_str() {
-                "never" | "no" | "none" => IndicatorStyle::None,
-                "always" | "yes" | "force" => IndicatorStyle::Classify,
-                "auto" | "tty" | "if-tty" => {
-                    if atty::is(atty::Stream::Stdout) {
-                        IndicatorStyle::Classify
-                    } else {
-                        IndicatorStyle::None
+        } else if let Some(field) = options.get_one::<String>(options::indicator_style::CLASSIFY) {
+            match field.as_str() {
+                "never" | "no" | "none" => IndicatorStyle::None,
+                "always" | "yes" | "force" => IndicatorStyle::Classify,
+                "auto" | "tty" | "if-tty" => {
+                    if atty::is(atty::Stream::Stdout) {
+                        IndicatorStyle::Classify
+                    } else {
+                        IndicatorStyle::None
                     }
                 }
-                &_ => IndicatorStyle::None,
+                &_ => IndicatorStyle::None,
             }
-        } else if options.get_flag(options::indicator_style::SLASH) {
-            IndicatorStyle::Slash
-        } else if options.get_flag(options::indicator_style::FILE_TYPE) {
-            IndicatorStyle::FileType
-        } else {
-            IndicatorStyle::None
+        } else if options.get_flag(options::indicator_style::SLASH) {
+            IndicatorStyle::Slash
+        } else if options.get_flag(options::indicator_style::FILE_TYPE) {
+            IndicatorStyle::FileType
+        } else {
+            IndicatorStyle::None
         };
-        let time_style = parse_time_style(options)?;
+        let time_style = parse_time_style(options)?;
 
-        let mut ignore_patterns: Vec<Pattern> = Vec::new();
+        let mut ignore_patterns: Vec<Pattern> = Vec::new();
 
-        if options.get_flag(options::IGNORE_BACKUPS) {
-            ignore_patterns.push(Pattern::new("*~").unwrap());
-            ignore_patterns.push(Pattern::new(".*~").unwrap());
+        if options.get_flag(options::IGNORE_BACKUPS) {
+            ignore_patterns.push(Pattern::new("*~").unwrap());
+            ignore_patterns.push(Pattern::new(".*~").unwrap());
         }
 
-        for pattern in options
-            .get_many::<String>(options::IGNORE)
-            .into_iter()
-            .flatten()
+        for pattern in options
+            .get_many::<String>(options::IGNORE)
+            .into_iter()
+            .flatten()
         {
-            match parse_glob::from_str(pattern) {
-                Ok(p) => {
-                    ignore_patterns.push(p);
+            match parse_glob::from_str(pattern) {
+                Ok(p) => {
+                    ignore_patterns.push(p);
                 }
-                Err(_) => show_warning!("Invalid pattern for ignore: {}", pattern.quote()),
+                Err(_) => show_warning!("Invalid pattern for ignore: {}", pattern.quote()),
             }
         }
 
-        if files == Files::Normal {
-            for pattern in options
-                .get_many::<String>(options::HIDE)
-                .into_iter()
-                .flatten()
+        if files == Files::Normal {
+            for pattern in options
+                .get_many::<String>(options::HIDE)
+                .into_iter()
+                .flatten()
             {
-                match parse_glob::from_str(pattern) {
-                    Ok(p) => {
-                        ignore_patterns.push(p);
+                match parse_glob::from_str(pattern) {
+                    Ok(p) => {
+                        ignore_patterns.push(p);
                     }
-                    Err(_) => show_warning!("Invalid pattern for hide: {}", pattern.quote()),
+                    Err(_) => show_warning!("Invalid pattern for hide: {}", pattern.quote()),
                 }
             }
         }
 
-        // According to ls info page, `--zero` implies the following flags:
-        //  - `--show-control-chars`
-        //  - `--format=single-column`
-        //  - `--color=none`
-        //  - `--quoting-style=literal`
-        // Current GNU ls implementation allows `--zero` Behavior to be
-        // overridden by later flags.
-        let zero_formats_opts = [
-            options::format::ACROSS,
-            options::format::COLUMNS,
-            options::format::COMMAS,
-            options::format::LONG,
-            options::format::LONG_NO_GROUP,
-            options::format::LONG_NO_OWNER,
-            options::format::LONG_NUMERIC_UID_GID,
-            options::format::ONE_LINE,
-            options::FORMAT,
+        // According to ls info page, `--zero` implies the following flags:
+        //  - `--show-control-chars`
+        //  - `--format=single-column`
+        //  - `--color=none`
+        //  - `--quoting-style=literal`
+        // Current GNU ls implementation allows `--zero` Behavior to be
+        // overridden by later flags.
+        let zero_formats_opts = [
+            options::format::ACROSS,
+            options::format::COLUMNS,
+            options::format::COMMAS,
+            options::format::LONG,
+            options::format::LONG_NO_GROUP,
+            options::format::LONG_NO_OWNER,
+            options::format::LONG_NUMERIC_UID_GID,
+            options::format::ONE_LINE,
+            options::FORMAT,
         ];
-        let zero_colors_opts = [options::COLOR];
-        let zero_show_control_opts = [options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS];
-        let zero_quoting_style_opts = [
-            options::QUOTING_STYLE,
-            options::quoting::C,
-            options::quoting::ESCAPE,
-            options::quoting::LITERAL,
+        let zero_colors_opts = [options::COLOR];
+        let zero_show_control_opts = [options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS];
+        let zero_quoting_style_opts = [
+            options::QUOTING_STYLE,
+            options::quoting::C,
+            options::quoting::ESCAPE,
+            options::quoting::LITERAL,
         ];
-        let get_last = |flag: &str| -> usize {
-            if options.value_source(flag) == Some(clap::parser::ValueSource::CommandLine) {
-                options.index_of(flag).unwrap_or(0)
-            } else {
-                0
-            }
+        let get_last = |flag: &str| -> usize {
+            if options.value_source(flag) == Some(clap::parser::ValueSource::CommandLine) {
+                options.index_of(flag).unwrap_or(0)
+            } else {
+                0
+            }
         };
-        if get_last(options::ZERO)
-            > zero_formats_opts
-                .into_iter()
-                .map(get_last)
-                .max()
-                .unwrap_or(0)
+        if get_last(options::ZERO)
+            > zero_formats_opts
+                .into_iter()
+                .map(get_last)
+                .max()
+                .unwrap_or(0)
         {
-            format = if format == Format::Long {
-                format
-            } else {
-                Format::OneLine
+            format = if format == Format::Long {
+                format
+            } else {
+                Format::OneLine
             };
         }
-        if get_last(options::ZERO)
-            > zero_colors_opts
-                .into_iter()
-                .map(get_last)
-                .max()
-                .unwrap_or(0)
+        if get_last(options::ZERO)
+            > zero_colors_opts
+                .into_iter()
+                .map(get_last)
+                .max()
+                .unwrap_or(0)
         {
-            needs_color = false;
+            needs_color = false;
         }
-        if get_last(options::ZERO)
-            > zero_show_control_opts
-                .into_iter()
-                .map(get_last)
-                .max()
-                .unwrap_or(0)
+        if get_last(options::ZERO)
+            > zero_show_control_opts
+                .into_iter()
+                .map(get_last)
+                .max()
+                .unwrap_or(0)
         {
-            show_control = true;
+            show_control = true;
         }
-        if get_last(options::ZERO)
-            > zero_quoting_style_opts
-                .into_iter()
-                .map(get_last)
-                .max()
-                .unwrap_or(0)
+        if get_last(options::ZERO)
+            > zero_quoting_style_opts
+                .into_iter()
+                .map(get_last)
+                .max()
+                .unwrap_or(0)
         {
-            quoting_style = QuotingStyle::Literal { show_control };
+            quoting_style = QuotingStyle::Literal { show_control };
         }
 
-        let color = if needs_color {
-            Some(LsColors::from_env().unwrap_or_default())
-        } else {
-            None
+        let color = if needs_color {
+            Some(LsColors::from_env().unwrap_or_default())
+        } else {
+            None
+        };
+
+        let dereference = if options.get_flag(options::dereference::ALL) {
+            Dereference::All
+        } else if options.get_flag(options::dereference::ARGS) {
+            Dereference::Args
+        } else if options.get_flag(options::dereference::DIR_ARGS) {
+            Dereference::DirArgs
+        } else if options.get_flag(options::DIRECTORY)
+            || indicator_style == IndicatorStyle::Classify
+            || format == Format::Long
+        {
+            Dereference::None
+        } else {
+            Dereference::DirArgs
         };
 
-        let dereference = if options.get_flag(options::dereference::ALL) {
-            Dereference::All
-        } else if options.get_flag(options::dereference::ARGS) {
-            Dereference::Args
-        } else if options.get_flag(options::dereference::DIR_ARGS) {
-            Dereference::DirArgs
-        } else if options.get_flag(options::DIRECTORY)
-            || indicator_style == IndicatorStyle::Classify
-            || format == Format::Long
-        {
-            Dereference::None
-        } else {
-            Dereference::DirArgs
-        };
-
-        Ok(Self {
-            format,
-            files,
-            sort,
-            recursive: options.get_flag(options::RECURSIVE),
-            reverse: options.get_flag(options::REVERSE),
-            dereference,
-            ignore_patterns,
-            size_format,
-            directory: options.get_flag(options::DIRECTORY),
-            time,
-            color,
-            #[cfg(unix)]
-            inode: options.get_flag(options::INODE),
-            long,
-            alloc_size: options.get_flag(options::size::ALLOCATION_SIZE),
-            block_size,
-            width,
-            quoting_style,
-            indicator_style,
-            time_style,
-            context,
-            selinux_supported: {
-                #[cfg(feature = "selinux")]
-                {
-                    selinux::kernel_support() != selinux::KernelSupport::Unsupported
-                }
-                #[cfg(not(feature = "selinux"))]
-                {
-                    false
+        Ok(Self {
+            format,
+            files,
+            sort,
+            recursive: options.get_flag(options::RECURSIVE),
+            reverse: options.get_flag(options::REVERSE),
+            dereference,
+            ignore_patterns,
+            size_format,
+            directory: options.get_flag(options::DIRECTORY),
+            time,
+            color,
+            #[cfg(unix)]
+            inode: options.get_flag(options::INODE),
+            long,
+            alloc_size: options.get_flag(options::size::ALLOCATION_SIZE),
+            block_size,
+            width,
+            quoting_style,
+            indicator_style,
+            time_style,
+            context,
+            selinux_supported: {
+                #[cfg(feature = "selinux")]
+                {
+                    selinux::kernel_support() != selinux::KernelSupport::Unsupported
                 }
+                #[cfg(not(feature = "selinux"))]
+                {
+                    false
+                }
             },
-            group_directories_first: options.get_flag(options::GROUP_DIRECTORIES_FIRST),
-            eol: if options.get_flag(options::ZERO) {
-                '\0'
-            } else {
-                '\n'
-            },
+            group_directories_first: options.get_flag(options::GROUP_DIRECTORIES_FIRST),
+            eol: if options.get_flag(options::ZERO) {
+                '\0'
+            } else {
+                '\n'
+            },
         })
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let command = uu_app();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let command = uu_app();
 
-    let matches = command.get_matches_from(args);
+    let matches = command.get_matches_from(args);
 
-    let config = Config::from(&matches)?;
+    let config = Config::from(&matches)?;
 
-    let locs = matches
-        .get_many::<OsString>(options::PATHS)
-        .map(|v| v.map(Path::new).collect())
-        .unwrap_or_else(|| vec![Path::new(".")]);
+    let locs = matches
+        .get_many::<OsString>(options::PATHS)
+        .map(|v| v.map(Path::new).collect())
+        .unwrap_or_else(|| vec![Path::new(".")]);
 
-    list(locs, &config)
+    list(locs, &config)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(ABOUT)
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(ABOUT)
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help),
         )
-        // Format arguments
-        .arg(
-            Arg::new(options::FORMAT)
-                .long(options::FORMAT)
-                .help("Set the display format.")
-                .value_parser([
+        // Format arguments
+        .arg(
+            Arg::new(options::FORMAT)
+                .long(options::FORMAT)
+                .help("Set the display format.")
+                .value_parser([
                     "long",
                     "verbose",
                     "single-column",
@@ -4031,133 +4031,133 @@ Ignore files and directories starting with a '.' by default"#"horizontal",
                     "commas",
                 ])
-                .hide_possible_values(true)
-                .require_equals(true)
-                .overrides_with_all([
-                    options::FORMAT,
-                    options::format::COLUMNS,
-                    options::format::LONG,
-                    options::format::ACROSS,
-                    options::format::COLUMNS,
+                .hide_possible_values(true)
+                .require_equals(true)
+                .overrides_with_all([
+                    options::FORMAT,
+                    options::format::COLUMNS,
+                    options::format::LONG,
+                    options::format::ACROSS,
+                    options::format::COLUMNS,
                 ]),
         )
-        .arg(
-            Arg::new(options::format::COLUMNS)
-                .short('C')
-                .help("Display the files in columns.")
-                .overrides_with_all([
-                    options::FORMAT,
-                    options::format::COLUMNS,
-                    options::format::LONG,
-                    options::format::ACROSS,
-                    options::format::COLUMNS,
+        .arg(
+            Arg::new(options::format::COLUMNS)
+                .short('C')
+                .help("Display the files in columns.")
+                .overrides_with_all([
+                    options::FORMAT,
+                    options::format::COLUMNS,
+                    options::format::LONG,
+                    options::format::ACROSS,
+                    options::format::COLUMNS,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::format::LONG)
-                .short('l')
-                .long(options::format::LONG)
-                .help("Display detailed information.")
-                .overrides_with_all([
-                    options::FORMAT,
-                    options::format::COLUMNS,
-                    options::format::LONG,
-                    options::format::ACROSS,
-                    options::format::COLUMNS,
+        .arg(
+            Arg::new(options::format::LONG)
+                .short('l')
+                .long(options::format::LONG)
+                .help("Display detailed information.")
+                .overrides_with_all([
+                    options::FORMAT,
+                    options::format::COLUMNS,
+                    options::format::LONG,
+                    options::format::ACROSS,
+                    options::format::COLUMNS,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::format::ACROSS)
-                .short('x')
-                .help("List entries in rows instead of in columns.")
-                .overrides_with_all([
-                    options::FORMAT,
-                    options::format::COLUMNS,
-                    options::format::LONG,
-                    options::format::ACROSS,
-                    options::format::COLUMNS,
+        .arg(
+            Arg::new(options::format::ACROSS)
+                .short('x')
+                .help("List entries in rows instead of in columns.")
+                .overrides_with_all([
+                    options::FORMAT,
+                    options::format::COLUMNS,
+                    options::format::LONG,
+                    options::format::ACROSS,
+                    options::format::COLUMNS,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            // silently ignored (see #3624)
-            Arg::new(options::format::TAB_SIZE)
-                .short('T')
-                .long(options::format::TAB_SIZE)
-                .env("TABSIZE")
-                .value_name("COLS")
-                .help("Assume tab stops at each COLS instead of 8 (unimplemented)"),
+        .arg(
+            // silently ignored (see #3624)
+            Arg::new(options::format::TAB_SIZE)
+                .short('T')
+                .long(options::format::TAB_SIZE)
+                .env("TABSIZE")
+                .value_name("COLS")
+                .help("Assume tab stops at each COLS instead of 8 (unimplemented)"),
         )
-        .arg(
-            Arg::new(options::format::COMMAS)
-                .short('m')
-                .help("List entries separated by commas.")
-                .overrides_with_all([
-                    options::FORMAT,
-                    options::format::COLUMNS,
-                    options::format::LONG,
-                    options::format::ACROSS,
-                    options::format::COLUMNS,
+        .arg(
+            Arg::new(options::format::COMMAS)
+                .short('m')
+                .help("List entries separated by commas.")
+                .overrides_with_all([
+                    options::FORMAT,
+                    options::format::COLUMNS,
+                    options::format::LONG,
+                    options::format::ACROSS,
+                    options::format::COLUMNS,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ZERO)
-                .long(options::ZERO)
-                .conflicts_with(options::DIRED)
-                .overrides_with(options::ZERO)
-                .help("List entries separated by ASCII NUL characters.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO)
+                .long(options::ZERO)
+                .conflicts_with(options::DIRED)
+                .overrides_with(options::ZERO)
+                .help("List entries separated by ASCII NUL characters.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DIRED)
-                .long(options::DIRED)
-                .short('D')
-                .hide(true)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::DIRED)
+                .long(options::DIRED)
+                .short('D')
+                .hide(true)
+                .action(ArgAction::SetTrue),
         )
-        // The next four arguments do not override with the other format
-        // options, see the comment in Config::from for the reason.
-        // Ideally, they would use Arg::override_with, with their own name
-        // but that doesn't seem to work in all cases. Example:
-        // ls -1g1
-        // even though `ls -11` and `ls -1 -g -1` work.
-        .arg(
-            Arg::new(options::format::ONE_LINE)
-                .short('1')
-                .help("List one file per line.")
-                .action(ArgAction::SetTrue),
+        // The next four arguments do not override with the other format
+        // options, see the comment in Config::from for the reason.
+        // Ideally, they would use Arg::override_with, with their own name
+        // but that doesn't seem to work in all cases. Example:
+        // ls -1g1
+        // even though `ls -11` and `ls -1 -g -1` work.
+        .arg(
+            Arg::new(options::format::ONE_LINE)
+                .short('1')
+                .help("List one file per line.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::format::LONG_NO_GROUP)
-                .short('o')
-                .help(
+        .arg(
+            Arg::new(options::format::LONG_NO_GROUP)
+                .short('o')
+                .help(
                     "Long format without group information. \
                         Identical to --format=long with --no-group.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::format::LONG_NO_OWNER)
-                .short('g')
-                .help("Long format without owner information.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::format::LONG_NO_OWNER)
+                .short('g')
+                .help("Long format without owner information.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::format::LONG_NUMERIC_UID_GID)
-                .short('n')
-                .long(options::format::LONG_NUMERIC_UID_GID)
-                .help("-l with numeric UIDs and GIDs.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::format::LONG_NUMERIC_UID_GID)
+                .short('n')
+                .long(options::format::LONG_NUMERIC_UID_GID)
+                .help("-l with numeric UIDs and GIDs.")
+                .action(ArgAction::SetTrue),
         )
-        // Quoting style
-        .arg(
-            Arg::new(options::QUOTING_STYLE)
-                .long(options::QUOTING_STYLE)
-                .help("Set quoting style.")
-                .value_parser([
+        // Quoting style
+        .arg(
+            Arg::new(options::QUOTING_STYLE)
+                .long(options::QUOTING_STYLE)
+                .help("Set quoting style.")
+                .value_parser([
                     "literal",
                     "shell",
                     "shell-always",
@@ -4166,418 +4166,418 @@ Ignore files and directories starting with a '.' by default"#"c",
                     "escape",
                 ])
-                .overrides_with_all([
-                    options::QUOTING_STYLE,
-                    options::quoting::LITERAL,
-                    options::quoting::ESCAPE,
-                    options::quoting::C,
+                .overrides_with_all([
+                    options::QUOTING_STYLE,
+                    options::quoting::LITERAL,
+                    options::quoting::ESCAPE,
+                    options::quoting::C,
                 ]),
         )
-        .arg(
-            Arg::new(options::quoting::LITERAL)
-                .short('N')
-                .long(options::quoting::LITERAL)
-                .help("Use literal quoting style. Equivalent to `--quoting-style=literal`")
-                .overrides_with_all([
-                    options::QUOTING_STYLE,
-                    options::quoting::LITERAL,
-                    options::quoting::ESCAPE,
-                    options::quoting::C,
+        .arg(
+            Arg::new(options::quoting::LITERAL)
+                .short('N')
+                .long(options::quoting::LITERAL)
+                .help("Use literal quoting style. Equivalent to `--quoting-style=literal`")
+                .overrides_with_all([
+                    options::QUOTING_STYLE,
+                    options::quoting::LITERAL,
+                    options::quoting::ESCAPE,
+                    options::quoting::C,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::quoting::ESCAPE)
-                .short('b')
-                .long(options::quoting::ESCAPE)
-                .help("Use escape quoting style. Equivalent to `--quoting-style=escape`")
-                .overrides_with_all([
-                    options::QUOTING_STYLE,
-                    options::quoting::LITERAL,
-                    options::quoting::ESCAPE,
-                    options::quoting::C,
+        .arg(
+            Arg::new(options::quoting::ESCAPE)
+                .short('b')
+                .long(options::quoting::ESCAPE)
+                .help("Use escape quoting style. Equivalent to `--quoting-style=escape`")
+                .overrides_with_all([
+                    options::QUOTING_STYLE,
+                    options::quoting::LITERAL,
+                    options::quoting::ESCAPE,
+                    options::quoting::C,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::quoting::C)
-                .short('Q')
-                .long(options::quoting::C)
-                .help("Use C quoting style. Equivalent to `--quoting-style=c`")
-                .overrides_with_all([
-                    options::QUOTING_STYLE,
-                    options::quoting::LITERAL,
-                    options::quoting::ESCAPE,
-                    options::quoting::C,
+        .arg(
+            Arg::new(options::quoting::C)
+                .short('Q')
+                .long(options::quoting::C)
+                .help("Use C quoting style. Equivalent to `--quoting-style=c`")
+                .overrides_with_all([
+                    options::QUOTING_STYLE,
+                    options::quoting::LITERAL,
+                    options::quoting::ESCAPE,
+                    options::quoting::C,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        // Control characters
-        .arg(
-            Arg::new(options::HIDE_CONTROL_CHARS)
-                .short('q')
-                .long(options::HIDE_CONTROL_CHARS)
-                .help("Replace control characters with '?' if they are not escaped.")
-                .overrides_with_all([options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS])
-                .action(ArgAction::SetTrue),
+        // Control characters
+        .arg(
+            Arg::new(options::HIDE_CONTROL_CHARS)
+                .short('q')
+                .long(options::HIDE_CONTROL_CHARS)
+                .help("Replace control characters with '?' if they are not escaped.")
+                .overrides_with_all([options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SHOW_CONTROL_CHARS)
-                .long(options::SHOW_CONTROL_CHARS)
-                .help("Show control characters 'as is' if they are not escaped.")
-                .overrides_with_all([options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SHOW_CONTROL_CHARS)
+                .long(options::SHOW_CONTROL_CHARS)
+                .help("Show control characters 'as is' if they are not escaped.")
+                .overrides_with_all([options::HIDE_CONTROL_CHARS, options::SHOW_CONTROL_CHARS])
+                .action(ArgAction::SetTrue),
         )
-        // Time arguments
-        .arg(
-            Arg::new(options::TIME)
-                .long(options::TIME)
-                .help(
+        // Time arguments
+        .arg(
+            Arg::new(options::TIME)
+                .long(options::TIME)
+                .help(
                     "Show time in <field>:\n\
                         \taccess time (-u): atime, access, use;\n\
                         \tchange time (-t): ctime, status.\n\
                         \tbirth time: birth, creation;",
                 )
-                .value_name("field")
-                .value_parser([
+                .value_name("field")
+                .value_parser([
                     "atime", "access", "use", "ctime", "status", "birth", "creation",
                 ])
-                .hide_possible_values(true)
-                .require_equals(true)
-                .overrides_with_all([options::TIME, options::time::ACCESS, options::time::CHANGE]),
+                .hide_possible_values(true)
+                .require_equals(true)
+                .overrides_with_all([options::TIME, options::time::ACCESS, options::time::CHANGE]),
         )
-        .arg(
-            Arg::new(options::time::CHANGE)
-                .short('c')
-                .help(
+        .arg(
+            Arg::new(options::time::CHANGE)
+                .short('c')
+                .help(
                     "If the long listing format (e.g., -l, -o) is being used, print the \
                         status change time (the 'ctime' in the inode) instead of the modification \
                         time. When explicitly sorting by time (--sort=time or -t) or when not \
                         using a long listing format, sort according to the status change time.",
                 )
-                .overrides_with_all([options::TIME, options::time::ACCESS, options::time::CHANGE])
-                .action(ArgAction::SetTrue),
+                .overrides_with_all([options::TIME, options::time::ACCESS, options::time::CHANGE])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::time::ACCESS)
-                .short('u')
-                .help(
+        .arg(
+            Arg::new(options::time::ACCESS)
+                .short('u')
+                .help(
                     "If the long listing format (e.g., -l, -o) is being used, print the \
                         status access time instead of the modification time. When explicitly \
                         sorting by time (--sort=time or -t) or when not using a long listing \
                         format, sort according to the access time.",
                 )
-                .overrides_with_all([options::TIME, options::time::ACCESS, options::time::CHANGE])
-                .action(ArgAction::SetTrue),
+                .overrides_with_all([options::TIME, options::time::ACCESS, options::time::CHANGE])
+                .action(ArgAction::SetTrue),
         )
-        // Hide and ignore
-        .arg(
-            Arg::new(options::HIDE)
-                .long(options::HIDE)
-                .action(ArgAction::Append)
-                .value_name("PATTERN")
-                .help(
+        // Hide and ignore
+        .arg(
+            Arg::new(options::HIDE)
+                .long(options::HIDE)
+                .action(ArgAction::Append)
+                .value_name("PATTERN")
+                .help(
                     "do not list implied entries matching shell PATTERN (overridden by -a or -A)",
                 ),
         )
-        .arg(
-            Arg::new(options::IGNORE)
-                .short('I')
-                .long(options::IGNORE)
-                .action(ArgAction::Append)
-                .value_name("PATTERN")
-                .help("do not list implied entries matching shell PATTERN"),
+        .arg(
+            Arg::new(options::IGNORE)
+                .short('I')
+                .long(options::IGNORE)
+                .action(ArgAction::Append)
+                .value_name("PATTERN")
+                .help("do not list implied entries matching shell PATTERN"),
         )
-        .arg(
-            Arg::new(options::IGNORE_BACKUPS)
-                .short('B')
-                .long(options::IGNORE_BACKUPS)
-                .help("Ignore entries which end with ~.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::IGNORE_BACKUPS)
+                .short('B')
+                .long(options::IGNORE_BACKUPS)
+                .help("Ignore entries which end with ~.")
+                .action(ArgAction::SetTrue),
         )
-        // Sort arguments
-        .arg(
-            Arg::new(options::SORT)
-                .long(options::SORT)
-                .help("Sort by <field>: name, none (-U), time (-t), size (-S) or extension (-X)")
-                .value_name("field")
-                .value_parser(["name", "none", "time", "size", "version", "extension"])
-                .require_equals(true)
-                .overrides_with_all([
-                    options::SORT,
-                    options::sort::SIZE,
-                    options::sort::TIME,
-                    options::sort::NONE,
-                    options::sort::VERSION,
-                    options::sort::EXTENSION,
+        // Sort arguments
+        .arg(
+            Arg::new(options::SORT)
+                .long(options::SORT)
+                .help("Sort by <field>: name, none (-U), time (-t), size (-S) or extension (-X)")
+                .value_name("field")
+                .value_parser(["name", "none", "time", "size", "version", "extension"])
+                .require_equals(true)
+                .overrides_with_all([
+                    options::SORT,
+                    options::sort::SIZE,
+                    options::sort::TIME,
+                    options::sort::NONE,
+                    options::sort::VERSION,
+                    options::sort::EXTENSION,
                 ]),
         )
-        .arg(
-            Arg::new(options::sort::SIZE)
-                .short('S')
-                .help("Sort by file size, largest first.")
-                .overrides_with_all([
-                    options::SORT,
-                    options::sort::SIZE,
-                    options::sort::TIME,
-                    options::sort::NONE,
-                    options::sort::VERSION,
-                    options::sort::EXTENSION,
+        .arg(
+            Arg::new(options::sort::SIZE)
+                .short('S')
+                .help("Sort by file size, largest first.")
+                .overrides_with_all([
+                    options::SORT,
+                    options::sort::SIZE,
+                    options::sort::TIME,
+                    options::sort::NONE,
+                    options::sort::VERSION,
+                    options::sort::EXTENSION,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::sort::TIME)
-                .short('t')
-                .help("Sort by modification time (the 'mtime' in the inode), newest first.")
-                .overrides_with_all([
-                    options::SORT,
-                    options::sort::SIZE,
-                    options::sort::TIME,
-                    options::sort::NONE,
-                    options::sort::VERSION,
-                    options::sort::EXTENSION,
+        .arg(
+            Arg::new(options::sort::TIME)
+                .short('t')
+                .help("Sort by modification time (the 'mtime' in the inode), newest first.")
+                .overrides_with_all([
+                    options::SORT,
+                    options::sort::SIZE,
+                    options::sort::TIME,
+                    options::sort::NONE,
+                    options::sort::VERSION,
+                    options::sort::EXTENSION,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::sort::VERSION)
-                .short('v')
-                .help("Natural sort of (version) numbers in the filenames.")
-                .overrides_with_all([
-                    options::SORT,
-                    options::sort::SIZE,
-                    options::sort::TIME,
-                    options::sort::NONE,
-                    options::sort::VERSION,
-                    options::sort::EXTENSION,
+        .arg(
+            Arg::new(options::sort::VERSION)
+                .short('v')
+                .help("Natural sort of (version) numbers in the filenames.")
+                .overrides_with_all([
+                    options::SORT,
+                    options::sort::SIZE,
+                    options::sort::TIME,
+                    options::sort::NONE,
+                    options::sort::VERSION,
+                    options::sort::EXTENSION,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::sort::EXTENSION)
-                .short('X')
-                .help("Sort alphabetically by entry extension.")
-                .overrides_with_all([
-                    options::SORT,
-                    options::sort::SIZE,
-                    options::sort::TIME,
-                    options::sort::NONE,
-                    options::sort::VERSION,
-                    options::sort::EXTENSION,
+        .arg(
+            Arg::new(options::sort::EXTENSION)
+                .short('X')
+                .help("Sort alphabetically by entry extension.")
+                .overrides_with_all([
+                    options::SORT,
+                    options::sort::SIZE,
+                    options::sort::TIME,
+                    options::sort::NONE,
+                    options::sort::VERSION,
+                    options::sort::EXTENSION,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::sort::NONE)
-                .short('U')
-                .help(
+        .arg(
+            Arg::new(options::sort::NONE)
+                .short('U')
+                .help(
                     "Do not sort; list the files in whatever order they are stored in the \
                     directory.  This is especially useful when listing very large directories, \
                     since not doing any sorting can be noticeably faster.",
                 )
-                .overrides_with_all([
-                    options::SORT,
-                    options::sort::SIZE,
-                    options::sort::TIME,
-                    options::sort::NONE,
-                    options::sort::VERSION,
-                    options::sort::EXTENSION,
+                .overrides_with_all([
+                    options::SORT,
+                    options::sort::SIZE,
+                    options::sort::TIME,
+                    options::sort::NONE,
+                    options::sort::VERSION,
+                    options::sort::EXTENSION,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        // Dereferencing
-        .arg(
-            Arg::new(options::dereference::ALL)
-                .short('L')
-                .long(options::dereference::ALL)
-                .help(
+        // Dereferencing
+        .arg(
+            Arg::new(options::dereference::ALL)
+                .short('L')
+                .long(options::dereference::ALL)
+                .help(
                     "When showing file information for a symbolic link, show information for the \
                     file the link references rather than the link itself.",
                 )
-                .overrides_with_all([
-                    options::dereference::ALL,
-                    options::dereference::DIR_ARGS,
-                    options::dereference::ARGS,
+                .overrides_with_all([
+                    options::dereference::ALL,
+                    options::dereference::DIR_ARGS,
+                    options::dereference::ARGS,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::dereference::DIR_ARGS)
-                .long(options::dereference::DIR_ARGS)
-                .help(
+        .arg(
+            Arg::new(options::dereference::DIR_ARGS)
+                .long(options::dereference::DIR_ARGS)
+                .help(
                     "Do not dereference symlinks except when they link to directories and are \
                     given as command line arguments.",
                 )
-                .overrides_with_all([
-                    options::dereference::ALL,
-                    options::dereference::DIR_ARGS,
-                    options::dereference::ARGS,
+                .overrides_with_all([
+                    options::dereference::ALL,
+                    options::dereference::DIR_ARGS,
+                    options::dereference::ARGS,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::dereference::ARGS)
-                .short('H')
-                .long(options::dereference::ARGS)
-                .help("Do not dereference symlinks except when given as command line arguments.")
-                .overrides_with_all([
-                    options::dereference::ALL,
-                    options::dereference::DIR_ARGS,
-                    options::dereference::ARGS,
+        .arg(
+            Arg::new(options::dereference::ARGS)
+                .short('H')
+                .long(options::dereference::ARGS)
+                .help("Do not dereference symlinks except when given as command line arguments.")
+                .overrides_with_all([
+                    options::dereference::ALL,
+                    options::dereference::DIR_ARGS,
+                    options::dereference::ARGS,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        // Long format options
-        .arg(
-            Arg::new(options::NO_GROUP)
-                .long(options::NO_GROUP)
-                .short('G')
-                .help("Do not show group in long format.")
-                .action(ArgAction::SetTrue),
+        // Long format options
+        .arg(
+            Arg::new(options::NO_GROUP)
+                .long(options::NO_GROUP)
+                .short('G')
+                .help("Do not show group in long format.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(Arg::new(options::AUTHOR).long(options::AUTHOR).help(
+        .arg(Arg::new(options::AUTHOR).long(options::AUTHOR).help(
             "Show author in long format. On the supported platforms, \
             the author always matches the file owner.",
-        ).action(ArgAction::SetTrue))
-        // Other Flags
-        .arg(
-            Arg::new(options::files::ALL)
-                .short('a')
-                .long(options::files::ALL)
-                // Overrides -A (as the order matters)
-                .overrides_with_all([options::files::ALL, options::files::ALMOST_ALL])
-                .help("Do not ignore hidden files (files with names that start with '.').")
-                .action(ArgAction::SetTrue),
+        ).action(ArgAction::SetTrue))
+        // Other Flags
+        .arg(
+            Arg::new(options::files::ALL)
+                .short('a')
+                .long(options::files::ALL)
+                // Overrides -A (as the order matters)
+                .overrides_with_all([options::files::ALL, options::files::ALMOST_ALL])
+                .help("Do not ignore hidden files (files with names that start with '.').")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::files::ALMOST_ALL)
-                .short('A')
-                .long(options::files::ALMOST_ALL)
-                // Overrides -a (as the order matters)
-                .overrides_with_all([options::files::ALL, options::files::ALMOST_ALL])
-                .help(
+        .arg(
+            Arg::new(options::files::ALMOST_ALL)
+                .short('A')
+                .long(options::files::ALMOST_ALL)
+                // Overrides -a (as the order matters)
+                .overrides_with_all([options::files::ALL, options::files::ALMOST_ALL])
+                .help(
                     "In a directory, do not ignore all file names that start with '.', \
                     only ignore '.' and '..'.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DIRECTORY)
-                .short('d')
-                .long(options::DIRECTORY)
-                .help(
+        .arg(
+            Arg::new(options::DIRECTORY)
+                .short('d')
+                .long(options::DIRECTORY)
+                .help(
                     "Only list the names of directories, rather than listing directory contents. \
                     This will not follow symbolic links unless one of `--dereference-command-line \
                     (-H)`, `--dereference (-L)`, or `--dereference-command-line-symlink-to-dir` is \
                     specified.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::size::HUMAN_READABLE)
-                .short('h')
-                .long(options::size::HUMAN_READABLE)
-                .help("Print human readable file sizes (e.g. 1K 234M 56G).")
-                .overrides_with(options::size::SI)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::size::HUMAN_READABLE)
+                .short('h')
+                .long(options::size::HUMAN_READABLE)
+                .help("Print human readable file sizes (e.g. 1K 234M 56G).")
+                .overrides_with(options::size::SI)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::size::KIBIBYTES)
-                .short('k')
-                .long(options::size::KIBIBYTES)
-                .help(
+        .arg(
+            Arg::new(options::size::KIBIBYTES)
+                .short('k')
+                .long(options::size::KIBIBYTES)
+                .help(
                     "default to 1024-byte blocks for file system usage; used only with -s and per \
                     directory totals",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::size::SI)
-                .long(options::size::SI)
-                .help("Print human readable file sizes using powers of 1000 instead of 1024.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::size::SI)
+                .long(options::size::SI)
+                .help("Print human readable file sizes using powers of 1000 instead of 1024.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::size::BLOCK_SIZE)
-                .long(options::size::BLOCK_SIZE)
-                .require_equals(true)
-                .value_name("BLOCK_SIZE")
-                .help("scale sizes by BLOCK_SIZE when printing them"),
+        .arg(
+            Arg::new(options::size::BLOCK_SIZE)
+                .long(options::size::BLOCK_SIZE)
+                .require_equals(true)
+                .value_name("BLOCK_SIZE")
+                .help("scale sizes by BLOCK_SIZE when printing them"),
         )
-        .arg(
-            Arg::new(options::INODE)
-                .short('i')
-                .long(options::INODE)
-                .help("print the index number of each file")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::INODE)
+                .short('i')
+                .long(options::INODE)
+                .help("print the index number of each file")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REVERSE)
-                .short('r')
-                .long(options::REVERSE)
-                .help(
+        .arg(
+            Arg::new(options::REVERSE)
+                .short('r')
+                .long(options::REVERSE)
+                .help(
                     "Reverse whatever the sorting method is e.g., list files in reverse \
             alphabetical order, youngest first, smallest first, or whatever.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::RECURSIVE)
-                .short('R')
-                .long(options::RECURSIVE)
-                .help("List the contents of all directories recursively.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RECURSIVE)
+                .short('R')
+                .long(options::RECURSIVE)
+                .help("List the contents of all directories recursively.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::WIDTH)
-                .long(options::WIDTH)
-                .short('w')
-                .help("Assume that the terminal is COLS columns wide.")
-                .value_name("COLS"),
+        .arg(
+            Arg::new(options::WIDTH)
+                .long(options::WIDTH)
+                .short('w')
+                .help("Assume that the terminal is COLS columns wide.")
+                .value_name("COLS"),
         )
-        .arg(
-            Arg::new(options::size::ALLOCATION_SIZE)
-                .short('s')
-                .long(options::size::ALLOCATION_SIZE)
-                .help("print the allocated size of each file, in blocks")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::size::ALLOCATION_SIZE)
+                .short('s')
+                .long(options::size::ALLOCATION_SIZE)
+                .help("print the allocated size of each file, in blocks")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::COLOR)
-                .long(options::COLOR)
-                .help("Color output based on file type.")
-                .value_parser([
+        .arg(
+            Arg::new(options::COLOR)
+                .long(options::COLOR)
+                .help("Color output based on file type.")
+                .value_parser([
                     "always", "yes", "force", "auto", "tty", "if-tty", "never", "no", "none",
                 ])
-                .require_equals(true)
-                .num_args(0..=1),
+                .require_equals(true)
+                .num_args(0..=1),
         )
-        .arg(
-            Arg::new(options::INDICATOR_STYLE)
-                .long(options::INDICATOR_STYLE)
-                .help(
+        .arg(
+            Arg::new(options::INDICATOR_STYLE)
+                .long(options::INDICATOR_STYLE)
+                .help(
                     "Append indicator with style WORD to entry names: \
                 none (default),  slash (-p), file-type (--file-type), classify (-F)",
                 )
-                .value_parser(["none", "slash", "file-type", "classify"])
-                .overrides_with_all([
-                    options::indicator_style::FILE_TYPE,
-                    options::indicator_style::SLASH,
-                    options::indicator_style::CLASSIFY,
-                    options::INDICATOR_STYLE,
+                .value_parser(["none", "slash", "file-type", "classify"])
+                .overrides_with_all([
+                    options::indicator_style::FILE_TYPE,
+                    options::indicator_style::SLASH,
+                    options::indicator_style::CLASSIFY,
+                    options::INDICATOR_STYLE,
                 ]),
         )
-        .arg(
-            // The --classify flag can take an optional when argument to
-            // control its behavior from version 9 of GNU coreutils.
-            // There is currently an inconsistency where GNU coreutils allows only
-            // the long form of the flag to take the argument while we allow it
-            // for both the long and short form of the flag.
-            Arg::new(options::indicator_style::CLASSIFY)
-                .short('F')
-                .long(options::indicator_style::CLASSIFY)
-                .help(
+        .arg(
+            // The --classify flag can take an optional when argument to
+            // control its behavior from version 9 of GNU coreutils.
+            // There is currently an inconsistency where GNU coreutils allows only
+            // the long form of the flag to take the argument while we allow it
+            // for both the long and short form of the flag.
+            Arg::new(options::indicator_style::CLASSIFY)
+                .short('F')
+                .long(options::indicator_style::CLASSIFY)
+                .help(
                     "Append a character to each file name indicating the file type. Also, for \
                     regular files that are executable, append '*'. The file type indicators are \
                     '/' for directories, '@' for symbolic links, '|' for FIFOs, '=' for sockets, \
@@ -4590,485 +4590,485 @@ Ignore files and directories starting with a '.' by default"#,
                 )
-                .value_name("when")
-                .value_parser([
+                .value_name("when")
+                .value_parser([
                     "always", "yes", "force", "auto", "tty", "if-tty", "never", "no", "none",
                 ])
-                .default_missing_value("always")
-                .require_equals(true)
-                .num_args(0..=1)
-                .overrides_with_all([
-                    options::indicator_style::FILE_TYPE,
-                    options::indicator_style::SLASH,
-                    options::indicator_style::CLASSIFY,
-                    options::INDICATOR_STYLE,
+                .default_missing_value("always")
+                .require_equals(true)
+                .num_args(0..=1)
+                .overrides_with_all([
+                    options::indicator_style::FILE_TYPE,
+                    options::indicator_style::SLASH,
+                    options::indicator_style::CLASSIFY,
+                    options::INDICATOR_STYLE,
                 ]),
         )
-        .arg(
-            Arg::new(options::indicator_style::FILE_TYPE)
-                .long(options::indicator_style::FILE_TYPE)
-                .help("Same as --classify, but do not append '*'")
-                .overrides_with_all([
-                    options::indicator_style::FILE_TYPE,
-                    options::indicator_style::SLASH,
-                    options::indicator_style::CLASSIFY,
-                    options::INDICATOR_STYLE,
+        .arg(
+            Arg::new(options::indicator_style::FILE_TYPE)
+                .long(options::indicator_style::FILE_TYPE)
+                .help("Same as --classify, but do not append '*'")
+                .overrides_with_all([
+                    options::indicator_style::FILE_TYPE,
+                    options::indicator_style::SLASH,
+                    options::indicator_style::CLASSIFY,
+                    options::INDICATOR_STYLE,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::indicator_style::SLASH)
-                .short('p')
-                .help("Append / indicator to directories.")
-                .overrides_with_all([
-                    options::indicator_style::FILE_TYPE,
-                    options::indicator_style::SLASH,
-                    options::indicator_style::CLASSIFY,
-                    options::INDICATOR_STYLE,
+        .arg(
+            Arg::new(options::indicator_style::SLASH)
+                .short('p')
+                .help("Append / indicator to directories.")
+                .overrides_with_all([
+                    options::indicator_style::FILE_TYPE,
+                    options::indicator_style::SLASH,
+                    options::indicator_style::CLASSIFY,
+                    options::INDICATOR_STYLE,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            //This still needs support for posix-*
-            Arg::new(options::TIME_STYLE)
-                .long(options::TIME_STYLE)
-                .help("time/date format with -l; see TIME_STYLE below")
-                .value_name("TIME_STYLE")
-                .env("TIME_STYLE")
-                .value_parser(NonEmptyStringValueParser::new())
-                .overrides_with_all([options::TIME_STYLE]),
+        .arg(
+            //This still needs support for posix-*
+            Arg::new(options::TIME_STYLE)
+                .long(options::TIME_STYLE)
+                .help("time/date format with -l; see TIME_STYLE below")
+                .value_name("TIME_STYLE")
+                .env("TIME_STYLE")
+                .value_parser(NonEmptyStringValueParser::new())
+                .overrides_with_all([options::TIME_STYLE]),
         )
-        .arg(
-            Arg::new(options::FULL_TIME)
-                .long(options::FULL_TIME)
-                .overrides_with(options::FULL_TIME)
-                .help("like -l --time-style=full-iso")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::FULL_TIME)
+                .long(options::FULL_TIME)
+                .overrides_with(options::FULL_TIME)
+                .help("like -l --time-style=full-iso")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::CONTEXT)
-                .short('Z')
-                .long(options::CONTEXT)
-                .help(CONTEXT_HELP_TEXT)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::CONTEXT)
+                .short('Z')
+                .long(options::CONTEXT)
+                .help(CONTEXT_HELP_TEXT)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::GROUP_DIRECTORIES_FIRST)
-                .long(options::GROUP_DIRECTORIES_FIRST)
-                .help(
+        .arg(
+            Arg::new(options::GROUP_DIRECTORIES_FIRST)
+                .long(options::GROUP_DIRECTORIES_FIRST)
+                .help(
                     "group directories before files; can be augmented with \
                     a --sort option, but any use of --sort=none (-U) disables grouping",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        // Positional arguments
-        .arg(
-            Arg::new(options::PATHS)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath)
-                .value_parser(ValueParser::os_string()),
+        // Positional arguments
+        .arg(
+            Arg::new(options::PATHS)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath)
+                .value_parser(ValueParser::os_string()),
         )
-        .after_help(
+        .after_help(
             "The TIME_STYLE argument can be full-iso, long-iso, iso, locale or +FORMAT. FORMAT is interpreted like in date. \
             Also the TIME_STYLE environment variable sets the default style to use.",
         )
 }
 
-/// Represents a Path along with it's associated data.
-/// Any data that will be reused several times makes sense to be added to this structure.
-/// Caching data here helps eliminate redundant syscalls to fetch same information.
-#[derive(Debug)]
-struct PathData {
-    // Result<MetaData> got from symlink_metadata() or metadata() based on config
-    md: OnceCell<Option<Metadata>>,
-    ft: OnceCell<Option<FileType>>,
-    de: Option<DirEntry>,
-    // Name of the file - will be empty for . or ..
-    display_name: OsString,
-    // PathBuf that all above data corresponds to
-    p_buf: PathBuf,
-    must_dereference: bool,
-    security_context: String,
-    command_line: bool,
+/// Represents a Path along with it's associated data.
+/// Any data that will be reused several times makes sense to be added to this structure.
+/// Caching data here helps eliminate redundant syscalls to fetch same information.
+#[derive(Debug)]
+struct PathData {
+    // Result<MetaData> got from symlink_metadata() or metadata() based on config
+    md: OnceCell<Option<Metadata>>,
+    ft: OnceCell<Option<FileType>>,
+    de: Option<DirEntry>,
+    // Name of the file - will be empty for . or ..
+    display_name: OsString,
+    // PathBuf that all above data corresponds to
+    p_buf: PathBuf,
+    must_dereference: bool,
+    security_context: String,
+    command_line: bool,
 }
 
-impl PathData {
-    fn new(
-        p_buf: PathBuf,
-        dir_entry: Option<std::io::Result<DirEntry>>,
-        file_name: Option<OsString>,
-        config: &Config,
-        command_line: bool,
-    ) -> Self {
-        // We cannot use `Path::ends_with` or `Path::Components`, because they remove occurrences of '.'
-        // For '..', the filename is None
-        let display_name = if let Some(name) = file_name {
-            name
-        } else if command_line {
-            p_buf.clone().into()
-        } else {
-            p_buf
-                .file_name()
-                .unwrap_or_else(|| p_buf.iter().next_back().unwrap())
-                .to_owned()
+impl PathData {
+    fn new(
+        p_buf: PathBuf,
+        dir_entry: Option<std::io::Result<DirEntry>>,
+        file_name: Option<OsString>,
+        config: &Config,
+        command_line: bool,
+    ) -> Self {
+        // We cannot use `Path::ends_with` or `Path::Components`, because they remove occurrences of '.'
+        // For '..', the filename is None
+        let display_name = if let Some(name) = file_name {
+            name
+        } else if command_line {
+            p_buf.clone().into()
+        } else {
+            p_buf
+                .file_name()
+                .unwrap_or_else(|| p_buf.iter().next_back().unwrap())
+                .to_owned()
         };
-        let must_dereference = match &config.dereference {
-            Dereference::All => true,
-            Dereference::Args => command_line,
-            Dereference::DirArgs => {
-                if command_line {
-                    if let Ok(md) = p_buf.metadata() {
-                        md.is_dir()
-                    } else {
-                        false
-                    }
-                } else {
-                    false
-                }
+        let must_dereference = match &config.dereference {
+            Dereference::All => true,
+            Dereference::Args => command_line,
+            Dereference::DirArgs => {
+                if command_line {
+                    if let Ok(md) = p_buf.metadata() {
+                        md.is_dir()
+                    } else {
+                        false
+                    }
+                } else {
+                    false
+                }
             }
-            Dereference::None => false,
+            Dereference::None => false,
         };
 
-        let de: Option<DirEntry> = match dir_entry {
-            Some(de) => de.ok(),
-            None => None,
+        let de: Option<DirEntry> = match dir_entry {
+            Some(de) => de.ok(),
+            None => None,
         };
 
-        // Why prefer to check the DirEntry file_type()?  B/c the call is
-        // nearly free compared to a metadata() call on a Path
-        fn get_file_type(
-            de: &DirEntry,
-            p_buf: &Path,
-            must_dereference: bool,
-        ) -> OnceCell<Option<FileType>> {
-            if must_dereference {
-                if let Ok(md_pb) = p_buf.metadata() {
-                    return OnceCell::from(Some(md_pb.file_type()));
+        // Why prefer to check the DirEntry file_type()?  B/c the call is
+        // nearly free compared to a metadata() call on a Path
+        fn get_file_type(
+            de: &DirEntry,
+            p_buf: &Path,
+            must_dereference: bool,
+        ) -> OnceCell<Option<FileType>> {
+            if must_dereference {
+                if let Ok(md_pb) = p_buf.metadata() {
+                    return OnceCell::from(Some(md_pb.file_type()));
                 }
             }
-            if let Ok(ft_de) = de.file_type() {
-                OnceCell::from(Some(ft_de))
-            } else if let Ok(md_pb) = p_buf.symlink_metadata() {
-                OnceCell::from(Some(md_pb.file_type()))
-            } else {
-                OnceCell::new()
+            if let Ok(ft_de) = de.file_type() {
+                OnceCell::from(Some(ft_de))
+            } else if let Ok(md_pb) = p_buf.symlink_metadata() {
+                OnceCell::from(Some(md_pb.file_type()))
+            } else {
+                OnceCell::new()
             }
         }
-        let ft = match de {
-            Some(ref de) => get_file_type(de, &p_buf, must_dereference),
-            None => OnceCell::new(),
+        let ft = match de {
+            Some(ref de) => get_file_type(de, &p_buf, must_dereference),
+            None => OnceCell::new(),
         };
 
-        let security_context = if config.context {
-            get_security_context(config, &p_buf, must_dereference)
-        } else {
-            String::new()
+        let security_context = if config.context {
+            get_security_context(config, &p_buf, must_dereference)
+        } else {
+            String::new()
         };
 
-        Self {
-            md: OnceCell::new(),
-            ft,
-            de,
-            display_name,
-            p_buf,
-            must_dereference,
-            security_context,
-            command_line,
+        Self {
+            md: OnceCell::new(),
+            ft,
+            de,
+            display_name,
+            p_buf,
+            must_dereference,
+            security_context,
+            command_line,
         }
     }
 
-    fn md(&self, out: &mut BufWriter<Stdout>) -> Option<&Metadata> {
-        self.md
-            .get_or_init(|| {
-                // check if we can use DirEntry metadata
-                if !self.must_dereference {
-                    if let Some(dir_entry) = &self.de {
-                        return dir_entry.metadata().ok();
+    fn md(&self, out: &mut BufWriter<Stdout>) -> Option<&Metadata> {
+        self.md
+            .get_or_init(|| {
+                // check if we can use DirEntry metadata
+                if !self.must_dereference {
+                    if let Some(dir_entry) = &self.de {
+                        return dir_entry.metadata().ok();
                     }
                 }
 
-                // if not, check if we can use Path metadata
-                match get_metadata(self.p_buf.as_path(), self.must_dereference) {
-                    Err(err) => {
-                        // FIXME: A bit tricky to propagate the result here
-                        out.flush().unwrap();
-                        let errno = err.raw_os_error().unwrap_or(1i32);
-                        // a bad fd will throw an error when dereferenced,
-                        // but GNU will not throw an error until a bad fd "dir"
-                        // is entered, here we match that GNU behavior, by handing
-                        // back the non-dereferenced metadata upon an EBADF
-                        if self.must_dereference && errno == 9i32 {
-                            if let Some(dir_entry) = &self.de {
-                                return dir_entry.metadata().ok();
+                // if not, check if we can use Path metadata
+                match get_metadata(self.p_buf.as_path(), self.must_dereference) {
+                    Err(err) => {
+                        // FIXME: A bit tricky to propagate the result here
+                        out.flush().unwrap();
+                        let errno = err.raw_os_error().unwrap_or(1i32);
+                        // a bad fd will throw an error when dereferenced,
+                        // but GNU will not throw an error until a bad fd "dir"
+                        // is entered, here we match that GNU behavior, by handing
+                        // back the non-dereferenced metadata upon an EBADF
+                        if self.must_dereference && errno == 9i32 {
+                            if let Some(dir_entry) = &self.de {
+                                return dir_entry.metadata().ok();
                             }
                         }
-                        show!(LsError::IOErrorContext(
-                            err,
-                            self.p_buf.clone(),
-                            self.command_line
+                        show!(LsError::IOErrorContext(
+                            err,
+                            self.p_buf.clone(),
+                            self.command_line
                         ));
-                        None
-                    }
-                    Ok(md) => Some(md),
+                        None
+                    }
+                    Ok(md) => Some(md),
                 }
             })
-            .as_ref()
+            .as_ref()
     }
 
-    fn file_type(&self, out: &mut BufWriter<Stdout>) -> Option<&FileType> {
-        self.ft
-            .get_or_init(|| self.md(out).map(|md| md.file_type()))
-            .as_ref()
+    fn file_type(&self, out: &mut BufWriter<Stdout>) -> Option<&FileType> {
+        self.ft
+            .get_or_init(|| self.md(out).map(|md| md.file_type()))
+            .as_ref()
     }
 }
 
-pub fn list(locs: Vec<&Path>, config: &Config) -> UResult<()> {
-    let mut files = Vec::<PathData>::new();
-    let mut dirs = Vec::<PathData>::new();
-    let mut out = BufWriter::new(stdout());
-    let initial_locs_len = locs.len();
+pub fn list(locs: Vec<&Path>, config: &Config) -> UResult<()> {
+    let mut files = Vec::<PathData>::new();
+    let mut dirs = Vec::<PathData>::new();
+    let mut out = BufWriter::new(stdout());
+    let initial_locs_len = locs.len();
 
-    for loc in locs {
-        let path_data = PathData::new(PathBuf::from(loc), None, None, config, true);
+    for loc in locs {
+        let path_data = PathData::new(PathBuf::from(loc), None, None, config, true);
 
-        // Getting metadata here is no big deal as it's just the CWD
-        // and we really just want to know if the strings exist as files/dirs
-        //
-        // Proper GNU handling is don't show if dereferenced symlink DNE
-        // but only for the base dir, for a child dir show, and print ?s
-        // in long format
-        if path_data.md(&mut out).is_none() {
+        // Getting metadata here is no big deal as it's just the CWD
+        // and we really just want to know if the strings exist as files/dirs
+        //
+        // Proper GNU handling is don't show if dereferenced symlink DNE
+        // but only for the base dir, for a child dir show, and print ?s
+        // in long format
+        if path_data.md(&mut out).is_none() {
             continue;
         }
 
-        let show_dir_contents = match path_data.file_type(&mut out) {
-            Some(ft) => !config.directory && ft.is_dir(),
-            None => {
-                set_exit_code(1);
-                false
-            }
+        let show_dir_contents = match path_data.file_type(&mut out) {
+            Some(ft) => !config.directory && ft.is_dir(),
+            None => {
+                set_exit_code(1);
+                false
+            }
         };
 
-        if show_dir_contents {
-            dirs.push(path_data);
-        } else {
-            files.push(path_data);
+        if show_dir_contents {
+            dirs.push(path_data);
+        } else {
+            files.push(path_data);
         }
     }
 
-    sort_entries(&mut files, config, &mut out);
-    sort_entries(&mut dirs, config, &mut out);
+    sort_entries(&mut files, config, &mut out);
+    sort_entries(&mut dirs, config, &mut out);
 
-    display_items(&files, config, &mut out)?;
+    display_items(&files, config, &mut out)?;
 
-    for (pos, path_data) in dirs.iter().enumerate() {
-        // Do read_dir call here to match GNU semantics by printing
-        // read_dir errors before directory headings, names and totals
-        let read_dir = match fs::read_dir(&path_data.p_buf) {
-            Err(err) => {
-                // flush stdout buffer before the error to preserve formatting and order
-                out.flush()?;
-                show!(LsError::IOErrorContext(
-                    err,
-                    path_data.p_buf.clone(),
-                    path_data.command_line
+    for (pos, path_data) in dirs.iter().enumerate() {
+        // Do read_dir call here to match GNU semantics by printing
+        // read_dir errors before directory headings, names and totals
+        let read_dir = match fs::read_dir(&path_data.p_buf) {
+            Err(err) => {
+                // flush stdout buffer before the error to preserve formatting and order
+                out.flush()?;
+                show!(LsError::IOErrorContext(
+                    err,
+                    path_data.p_buf.clone(),
+                    path_data.command_line
                 ));
                 continue;
             }
-            Ok(rd) => rd,
+            Ok(rd) => rd,
         };
 
-        // Print dir heading - name... 'total' comes after error display
-        if initial_locs_len > 1 || config.recursive {
-            if pos.eq(&0usize) && files.is_empty() {
-                writeln!(out, "{}:", path_data.p_buf.display())?;
-            } else {
-                writeln!(out, "\n{}:", path_data.p_buf.display())?;
+        // Print dir heading - name... 'total' comes after error display
+        if initial_locs_len > 1 || config.recursive {
+            if pos.eq(&0usize) && files.is_empty() {
+                writeln!(out, "{}:", path_data.p_buf.display())?;
+            } else {
+                writeln!(out, "\n{}:", path_data.p_buf.display())?;
             }
         }
-        let mut listed_ancestors = HashSet::new();
-        listed_ancestors.insert(FileInformation::from_path(
-            &path_data.p_buf,
-            path_data.must_dereference,
+        let mut listed_ancestors = HashSet::new();
+        listed_ancestors.insert(FileInformation::from_path(
+            &path_data.p_buf,
+            path_data.must_dereference,
         )?);
-        enter_directory(path_data, read_dir, config, &mut out, &mut listed_ancestors)?;
+        enter_directory(path_data, read_dir, config, &mut out, &mut listed_ancestors)?;
     }
 
     Ok(())
 }
 
-fn sort_entries(entries: &mut [PathData], config: &Config, out: &mut BufWriter<Stdout>) {
-    match config.sort {
-        Sort::Time => entries.sort_by_key(|k| {
-            Reverse(
-                k.md(out)
-                    .and_then(|md| get_system_time(md, config))
-                    .unwrap_or(UNIX_EPOCH),
+fn sort_entries(entries: &mut [PathData], config: &Config, out: &mut BufWriter<Stdout>) {
+    match config.sort {
+        Sort::Time => entries.sort_by_key(|k| {
+            Reverse(
+                k.md(out)
+                    .and_then(|md| get_system_time(md, config))
+                    .unwrap_or(UNIX_EPOCH),
             )
         }),
-        Sort::Size => entries.sort_by_key(|k| Reverse(k.md(out).map(|md| md.len()).unwrap_or(0))),
-        // The default sort in GNU ls is case insensitive
-        Sort::Name => entries.sort_by(|a, b| a.display_name.cmp(&b.display_name)),
-        Sort::Version => entries
-            .sort_by(|a, b| version_cmp(&a.p_buf.to_string_lossy(), &b.p_buf.to_string_lossy())),
-        Sort::Extension => entries.sort_by(|a, b| {
-            a.p_buf
-                .extension()
-                .cmp(&b.p_buf.extension())
-                .then(a.p_buf.file_stem().cmp(&b.p_buf.file_stem()))
+        Sort::Size => entries.sort_by_key(|k| Reverse(k.md(out).map(|md| md.len()).unwrap_or(0))),
+        // The default sort in GNU ls is case insensitive
+        Sort::Name => entries.sort_by(|a, b| a.display_name.cmp(&b.display_name)),
+        Sort::Version => entries
+            .sort_by(|a, b| version_cmp(&a.p_buf.to_string_lossy(), &b.p_buf.to_string_lossy())),
+        Sort::Extension => entries.sort_by(|a, b| {
+            a.p_buf
+                .extension()
+                .cmp(&b.p_buf.extension())
+                .then(a.p_buf.file_stem().cmp(&b.p_buf.file_stem()))
         }),
-        Sort::None => {}
+        Sort::None => {}
     }
 
-    if config.reverse {
-        entries.reverse();
+    if config.reverse {
+        entries.reverse();
     }
 
-    if config.group_directories_first && config.sort != Sort::None {
-        entries.sort_by_key(|p| {
-            let md = {
-                // We will always try to deref symlinks to group directories, so PathData.md
-                // is not always useful.
-                if p.must_dereference {
-                    p.md.get()
-                } else {
-                    None
-                }
+    if config.group_directories_first && config.sort != Sort::None {
+        entries.sort_by_key(|p| {
+            let md = {
+                // We will always try to deref symlinks to group directories, so PathData.md
+                // is not always useful.
+                if p.must_dereference {
+                    p.md.get()
+                } else {
+                    None
+                }
             };
 
-            !match md {
-                None | Some(None) => {
-                    // If it metadata cannot be determined, treat as a file.
-                    get_metadata(p.p_buf.as_path(), true).map_or_else(|_| false, |m| m.is_dir())
+            !match md {
+                None | Some(None) => {
+                    // If it metadata cannot be determined, treat as a file.
+                    get_metadata(p.p_buf.as_path(), true).map_or_else(|_| false, |m| m.is_dir())
                 }
-                Some(Some(m)) => m.is_dir(),
+                Some(Some(m)) => m.is_dir(),
             }
         });
     }
 }
 
-fn is_hidden(file_path: &DirEntry) -> bool {
-    #[cfg(windows)]
-    {
-        let metadata = file_path.metadata().unwrap();
-        let attr = metadata.file_attributes();
-        (attr & 0x2) > 0
-    }
-    #[cfg(not(windows))]
-    {
-        file_path
-            .file_name()
-            .to_str()
-            .map(|res| res.starts_with('.'))
-            .unwrap_or(false)
+fn is_hidden(file_path: &DirEntry) -> bool {
+    #[cfg(windows)]
+    {
+        let metadata = file_path.metadata().unwrap();
+        let attr = metadata.file_attributes();
+        (attr & 0x2) > 0
+    }
+    #[cfg(not(windows))]
+    {
+        file_path
+            .file_name()
+            .to_str()
+            .map(|res| res.starts_with('.'))
+            .unwrap_or(false)
     }
 }
 
-fn should_display(entry: &DirEntry, config: &Config) -> bool {
-    // check if hidden
-    if config.files == Files::Normal && is_hidden(entry) {
-        return false;
+fn should_display(entry: &DirEntry, config: &Config) -> bool {
+    // check if hidden
+    if config.files == Files::Normal && is_hidden(entry) {
+        return false;
     }
 
-    // check if it is among ignore_patterns
-    let options = MatchOptions {
-        // setting require_literal_leading_dot to match behavior in GNU ls
-        require_literal_leading_dot: true,
-        require_literal_separator: false,
-        case_sensitive: true,
+    // check if it is among ignore_patterns
+    let options = MatchOptions {
+        // setting require_literal_leading_dot to match behavior in GNU ls
+        require_literal_leading_dot: true,
+        require_literal_separator: false,
+        case_sensitive: true,
     };
-    let file_name = entry.file_name().into_string().unwrap();
-    !config
-        .ignore_patterns
-        .iter()
-        .any(|p| p.matches_with(&file_name, options))
+    let file_name = entry.file_name().into_string().unwrap();
+    !config
+        .ignore_patterns
+        .iter()
+        .any(|p| p.matches_with(&file_name, options))
 }
 
-fn enter_directory(
-    path_data: &PathData,
-    read_dir: ReadDir,
-    config: &Config,
-    out: &mut BufWriter<Stdout>,
-    listed_ancestors: &mut HashSet<FileInformation>,
-) -> UResult<()> {
-    // Create vec of entries with initial dot files
-    let mut entries: Vec<PathData> = if config.files == Files::All {
+fn enter_directory(
+    path_data: &PathData,
+    read_dir: ReadDir,
+    config: &Config,
+    out: &mut BufWriter<Stdout>,
+    listed_ancestors: &mut HashSet<FileInformation>,
+) -> UResult<()> {
+    // Create vec of entries with initial dot files
+    let mut entries: Vec<PathData> = if config.files == Files::All {
         vec![
-            PathData::new(
-                path_data.p_buf.clone(),
+            PathData::new(
+                path_data.p_buf.clone(),
                 None,
-                Some(".".into()),
-                config,
+                Some(".".into()),
+                config,
                 false,
             ),
-            PathData::new(
-                path_data.p_buf.join(".."),
+            PathData::new(
+                path_data.p_buf.join(".."),
                 None,
-                Some("..".into()),
-                config,
+                Some("..".into()),
+                config,
                 false,
             ),
         ]
-    } else {
+    } else {
         vec![]
     };
 
-    // Convert those entries to the PathData struct
-    for raw_entry in read_dir {
-        let dir_entry = match raw_entry {
-            Ok(path) => path,
-            Err(err) => {
-                out.flush()?;
-                show!(LsError::IOError(err));
+    // Convert those entries to the PathData struct
+    for raw_entry in read_dir {
+        let dir_entry = match raw_entry {
+            Ok(path) => path,
+            Err(err) => {
+                out.flush()?;
+                show!(LsError::IOError(err));
                 continue;
             }
         };
 
-        if should_display(&dir_entry, config) {
-            let entry_path_data =
-                PathData::new(dir_entry.path(), Some(Ok(dir_entry)), None, config, false);
-            entries.push(entry_path_data);
+        if should_display(&dir_entry, config) {
+            let entry_path_data =
+                PathData::new(dir_entry.path(), Some(Ok(dir_entry)), None, config, false);
+            entries.push(entry_path_data);
         };
     }
 
-    sort_entries(&mut entries, config, out);
+    sort_entries(&mut entries, config, out);
 
-    // Print total after any error display
-    if config.format == Format::Long || config.alloc_size {
-        display_total(&entries, config, out)?;
+    // Print total after any error display
+    if config.format == Format::Long || config.alloc_size {
+        display_total(&entries, config, out)?;
     }
 
-    display_items(&entries, config, out)?;
+    display_items(&entries, config, out)?;
 
-    if config.recursive {
-        for e in entries
-            .iter()
-            .skip(if config.files == Files::All { 2 } else { 0 })
-            .filter(|p| p.ft.get().is_some())
-            .filter(|p| p.ft.get().unwrap().is_some())
-            .filter(|p| p.ft.get().unwrap().unwrap().is_dir())
+    if config.recursive {
+        for e in entries
+            .iter()
+            .skip(if config.files == Files::All { 2 } else { 0 })
+            .filter(|p| p.ft.get().is_some())
+            .filter(|p| p.ft.get().unwrap().is_some())
+            .filter(|p| p.ft.get().unwrap().unwrap().is_dir())
         {
-            match fs::read_dir(&e.p_buf) {
-                Err(err) => {
-                    out.flush()?;
-                    show!(LsError::IOErrorContext(
-                        err,
-                        e.p_buf.clone(),
-                        e.command_line
+            match fs::read_dir(&e.p_buf) {
+                Err(err) => {
+                    out.flush()?;
+                    show!(LsError::IOErrorContext(
+                        err,
+                        e.p_buf.clone(),
+                        e.command_line
                     ));
                     continue;
                 }
-                Ok(rd) => {
-                    if !listed_ancestors
-                        .insert(FileInformation::from_path(&e.p_buf, e.must_dereference)?)
+                Ok(rd) => {
+                    if !listed_ancestors
+                        .insert(FileInformation::from_path(&e.p_buf, e.must_dereference)?)
                     {
-                        out.flush()?;
-                        show!(LsError::AlreadyListedError(e.p_buf.clone()));
-                    } else {
-                        writeln!(out, "\n{}:", e.p_buf.display())?;
-                        enter_directory(e, rd, config, out, listed_ancestors)?;
-                        listed_ancestors
-                            .remove(&FileInformation::from_path(&e.p_buf, e.must_dereference)?);
+                        out.flush()?;
+                        show!(LsError::AlreadyListedError(e.p_buf.clone()));
+                    } else {
+                        writeln!(out, "\n{}:", e.p_buf.display())?;
+                        enter_directory(e, rd, config, out, listed_ancestors)?;
+                        listed_ancestors
+                            .remove(&FileInformation::from_path(&e.p_buf, e.must_dereference)?);
                     }
                 }
             }
@@ -5078,179 +5078,179 @@ Ignore files and directories starting with a '.' by default"#Ok(())
 }
 
-fn get_metadata(p_buf: &Path, dereference: bool) -> std::io::Result<Metadata> {
-    if dereference {
-        p_buf.metadata()
-    } else {
-        p_buf.symlink_metadata()
+fn get_metadata(p_buf: &Path, dereference: bool) -> std::io::Result<Metadata> {
+    if dereference {
+        p_buf.metadata()
+    } else {
+        p_buf.symlink_metadata()
     }
 }
 
-fn display_dir_entry_size(
-    entry: &PathData,
-    config: &Config,
-    out: &mut BufWriter<std::io::Stdout>,
-) -> (usize, usize, usize, usize, usize, usize) {
-    // TODO: Cache/memorize the display_* results so we don't have to recalculate them.
-    if let Some(md) = entry.md(out) {
-        let (size_len, major_len, minor_len) = match display_len_or_rdev(md, config) {
-            SizeOrDeviceId::Device(major, minor) => (
-                (major.len() + minor.len() + 2usize),
-                major.len(),
-                minor.len(),
+fn display_dir_entry_size(
+    entry: &PathData,
+    config: &Config,
+    out: &mut BufWriter<std::io::Stdout>,
+) -> (usize, usize, usize, usize, usize, usize) {
+    // TODO: Cache/memorize the display_* results so we don't have to recalculate them.
+    if let Some(md) = entry.md(out) {
+        let (size_len, major_len, minor_len) = match display_len_or_rdev(md, config) {
+            SizeOrDeviceId::Device(major, minor) => (
+                (major.len() + minor.len() + 2usize),
+                major.len(),
+                minor.len(),
             ),
-            SizeOrDeviceId::Size(size) => (size.len(), 0usize, 0usize),
+            SizeOrDeviceId::Size(size) => (size.len(), 0usize, 0usize),
         };
         (
-            display_symlink_count(md).len(),
-            display_uname(md, config).len(),
-            display_group(md, config).len(),
-            size_len,
-            major_len,
-            minor_len,
+            display_symlink_count(md).len(),
+            display_uname(md, config).len(),
+            display_group(md, config).len(),
+            size_len,
+            major_len,
+            minor_len,
         )
-    } else {
+    } else {
         (0, 0, 0, 0, 0, 0)
     }
 }
 
-fn pad_left(string: &str, count: usize) -> String {
-    format!("{:>width$}", string, width = count)
+fn pad_left(string: &str, count: usize) -> String {
+    format!("{:>width$}", string, width = count)
 }
 
-fn pad_right(string: &str, count: usize) -> String {
-    format!("{:<width$}", string, width = count)
+fn pad_right(string: &str, count: usize) -> String {
+    format!("{:<width$}", string, width = count)
 }
 
-fn display_total(items: &[PathData], config: &Config, out: &mut BufWriter<Stdout>) -> UResult<()> {
-    let mut total_size = 0;
-    for item in items {
-        total_size += item
-            .md(out)
-            .as_ref()
-            .map_or(0, |md| get_block_size(md, config));
+fn display_total(items: &[PathData], config: &Config, out: &mut BufWriter<Stdout>) -> UResult<()> {
+    let mut total_size = 0;
+    for item in items {
+        total_size += item
+            .md(out)
+            .as_ref()
+            .map_or(0, |md| get_block_size(md, config));
     }
     write!(
-        out,
+        out,
         "total {}{}",
-        display_size(total_size, config),
-        config.eol
+        display_size(total_size, config),
+        config.eol
     )?;
     Ok(())
 }
 
-fn display_additional_leading_info(
-    item: &PathData,
-    padding: &PaddingCollection,
-    config: &Config,
-    out: &mut BufWriter<Stdout>,
-) -> UResult<String> {
-    let mut result = String::new();
-    #[cfg(unix)]
-    {
-        if config.inode {
-            let i = if let Some(md) = item.md(out) {
-                get_inode(md)
-            } else {
-                "?".to_owned()
+fn display_additional_leading_info(
+    item: &PathData,
+    padding: &PaddingCollection,
+    config: &Config,
+    out: &mut BufWriter<Stdout>,
+) -> UResult<String> {
+    let mut result = String::new();
+    #[cfg(unix)]
+    {
+        if config.inode {
+            let i = if let Some(md) = item.md(out) {
+                get_inode(md)
+            } else {
+                "?".to_owned()
             };
-            write!(result, "{} ", pad_left(&i, padding.inode)).unwrap();
+            write!(result, "{} ", pad_left(&i, padding.inode)).unwrap();
         }
     }
 
-    if config.alloc_size {
-        let s = if let Some(md) = item.md(out) {
-            display_size(get_block_size(md, config), config)
-        } else {
-            "?".to_owned()
+    if config.alloc_size {
+        let s = if let Some(md) = item.md(out) {
+            display_size(get_block_size(md, config), config)
+        } else {
+            "?".to_owned()
         };
-        // extra space is insert to align the sizes, as needed for all formats, except for the comma format.
-        if config.format == Format::Commas {
-            write!(result, "{} ", s).unwrap();
-        } else {
-            write!(result, "{} ", pad_left(&s, padding.block_size)).unwrap();
+        // extra space is insert to align the sizes, as needed for all formats, except for the comma format.
+        if config.format == Format::Commas {
+            write!(result, "{} ", s).unwrap();
+        } else {
+            write!(result, "{} ", pad_left(&s, padding.block_size)).unwrap();
         };
     }
-    Ok(result)
+    Ok(result)
 }
 
-fn display_items(items: &[PathData], config: &Config, out: &mut BufWriter<Stdout>) -> UResult<()> {
-    // `-Z`, `--context`:
-    // Display the SELinux security context or '?' if none is found. When used with the `-l`
-    // option, print the security context to the left of the size column.
+fn display_items(items: &[PathData], config: &Config, out: &mut BufWriter<Stdout>) -> UResult<()> {
+    // `-Z`, `--context`:
+    // Display the SELinux security context or '?' if none is found. When used with the `-l`
+    // option, print the security context to the left of the size column.
 
-    if config.format == Format::Long {
-        let padding_collection = calculate_padding_collection(items, config, out);
+    if config.format == Format::Long {
+        let padding_collection = calculate_padding_collection(items, config, out);
 
-        for item in items {
-            #[cfg(unix)]
-            if config.inode || config.alloc_size {
-                let more_info =
-                    display_additional_leading_info(item, &padding_collection, config, out)?;
-                write!(out, "{}", more_info)?;
+        for item in items {
+            #[cfg(unix)]
+            if config.inode || config.alloc_size {
+                let more_info =
+                    display_additional_leading_info(item, &padding_collection, config, out)?;
+                write!(out, "{}", more_info)?;
             }
-            #[cfg(not(unix))]
-            if config.alloc_size {
-                let more_info =
-                    display_additional_leading_info(item, &padding_collection, config, out)?;
-                write!(out, "{}", more_info)?;
+            #[cfg(not(unix))]
+            if config.alloc_size {
+                let more_info =
+                    display_additional_leading_info(item, &padding_collection, config, out)?;
+                write!(out, "{}", more_info)?;
             }
-            display_item_long(item, &padding_collection, config, out)?;
+            display_item_long(item, &padding_collection, config, out)?;
         }
-    } else {
-        let mut longest_context_len = 1;
-        let prefix_context = if config.context {
-            for item in items {
-                let context_len = item.security_context.len();
-                longest_context_len = context_len.max(longest_context_len);
+    } else {
+        let mut longest_context_len = 1;
+        let prefix_context = if config.context {
+            for item in items {
+                let context_len = item.security_context.len();
+                longest_context_len = context_len.max(longest_context_len);
             }
-            Some(longest_context_len)
-        } else {
-            None
-        };
+            Some(longest_context_len)
+        } else {
+            None
+        };
 
-        let padding = calculate_padding_collection(items, config, out);
+        let padding = calculate_padding_collection(items, config, out);
 
-        let mut names_vec = Vec::new();
+        let mut names_vec = Vec::new();
 
-        for i in items {
-            let more_info = display_additional_leading_info(i, &padding, config, out)?;
-            let cell = display_file_name(i, config, prefix_context, more_info, out);
-            names_vec.push(cell);
+        for i in items {
+            let more_info = display_additional_leading_info(i, &padding, config, out)?;
+            let cell = display_file_name(i, config, prefix_context, more_info, out);
+            names_vec.push(cell);
         }
 
-        let names = names_vec.into_iter();
+        let names = names_vec.into_iter();
 
-        match config.format {
-            Format::Columns => display_grid(names, config.width, Direction::TopToBottom, out)?,
-            Format::Across => display_grid(names, config.width, Direction::LeftToRight, out)?,
-            Format::Commas => {
-                let mut current_col = 0;
-                let mut names = names;
-                if let Some(name) = names.next() {
-                    write!(out, "{}", name.contents)?;
-                    current_col = name.width as u16 + 2;
+        match config.format {
+            Format::Columns => display_grid(names, config.width, Direction::TopToBottom, out)?,
+            Format::Across => display_grid(names, config.width, Direction::LeftToRight, out)?,
+            Format::Commas => {
+                let mut current_col = 0;
+                let mut names = names;
+                if let Some(name) = names.next() {
+                    write!(out, "{}", name.contents)?;
+                    current_col = name.width as u16 + 2;
                 }
-                for name in names {
-                    let name_width = name.width as u16;
-                    // If the width is 0 we print one single line
-                    if config.width != 0 && current_col + name_width + 1 > config.width {
-                        current_col = name_width + 2;
-                        write!(out, ",\n{}", name.contents)?;
-                    } else {
-                        current_col += name_width + 2;
-                        write!(out, ", {}", name.contents)?;
+                for name in names {
+                    let name_width = name.width as u16;
+                    // If the width is 0 we print one single line
+                    if config.width != 0 && current_col + name_width + 1 > config.width {
+                        current_col = name_width + 2;
+                        write!(out, ",\n{}", name.contents)?;
+                    } else {
+                        current_col += name_width + 2;
+                        write!(out, ", {}", name.contents)?;
                     }
                 }
-                // Current col is never zero again if names have been printed.
-                // So we print a newline.
-                if current_col > 0 {
-                    write!(out, "{}", config.eol)?;
+                // Current col is never zero again if names have been printed.
+                // So we print a newline.
+                if current_col > 0 {
+                    write!(out, "{}", config.eol)?;
                 }
             }
-            _ => {
-                for name in names {
-                    write!(out, "{}{}", name.contents, config.eol)?;
+            _ => {
+                for name in names {
+                    write!(out, "{}{}", name.contents, config.eol)?;
                 }
             }
         };
@@ -5259,848 +5259,848 @@ Ignore files and directories starting with a '.' by default"#Ok(())
 }
 
-#[allow(unused_variables)]
-fn get_block_size(md: &Metadata, config: &Config) -> u64 {
+#[allow(unused_variables)]
+fn get_block_size(md: &Metadata, config: &Config) -> u64 {
     /* GNU ls will display sizes in terms of block size
        md.len() will differ from this value when the file has some holes
-    */
-    #[cfg(unix)]
-    {
-        let raw_blocks = if md.file_type().is_char_device() || md.file_type().is_block_device() {
-            0u64
-        } else {
-            md.blocks() * 512
-        };
-        match config.size_format {
-            SizeFormat::Binary | SizeFormat::Decimal => raw_blocks,
-            SizeFormat::Bytes => {
-                if cfg!(unix) {
-                    if let Some(user_block_size) = config.block_size {
-                        raw_blocks / user_block_size
-                    } else {
-                        raw_blocks / DEFAULT_BLOCK_SIZE
+    */
+    #[cfg(unix)]
+    {
+        let raw_blocks = if md.file_type().is_char_device() || md.file_type().is_block_device() {
+            0u64
+        } else {
+            md.blocks() * 512
+        };
+        match config.size_format {
+            SizeFormat::Binary | SizeFormat::Decimal => raw_blocks,
+            SizeFormat::Bytes => {
+                if cfg!(unix) {
+                    if let Some(user_block_size) = config.block_size {
+                        raw_blocks / user_block_size
+                    } else {
+                        raw_blocks / DEFAULT_BLOCK_SIZE
                     }
-                } else {
-                    raw_blocks
+                } else {
+                    raw_blocks
                 }
             }
         }
     }
-    #[cfg(not(unix))]
-    {
-        // no way to get block size for windows, fall-back to file size
-        md.len()
+    #[cfg(not(unix))]
+    {
+        // no way to get block size for windows, fall-back to file size
+        md.len()
     }
 }
 
-fn display_grid(
-    names: impl Iterator<Item = Cell>,
-    width: u16,
-    direction: Direction,
-    out: &mut BufWriter<Stdout>,
-) -> UResult<()> {
-    if width == 0 {
-        // If the width is 0 we print one single line
-        let mut printed_something = false;
-        for name in names {
-            if printed_something {
-                write!(out, "  ")?;
+fn display_grid(
+    names: impl Iterator<Item = Cell>,
+    width: u16,
+    direction: Direction,
+    out: &mut BufWriter<Stdout>,
+) -> UResult<()> {
+    if width == 0 {
+        // If the width is 0 we print one single line
+        let mut printed_something = false;
+        for name in names {
+            if printed_something {
+                write!(out, "  ")?;
             }
-            printed_something = true;
-            write!(out, "{}", name.contents)?;
+            printed_something = true;
+            write!(out, "{}", name.contents)?;
         }
-        if printed_something {
-            writeln!(out)?;
+        if printed_something {
+            writeln!(out)?;
         }
-    } else {
-        let mut grid = Grid::new(GridOptions {
-            filling: Filling::Spaces(2),
-            direction,
+    } else {
+        let mut grid = Grid::new(GridOptions {
+            filling: Filling::Spaces(2),
+            direction,
         });
 
-        for name in names {
-            grid.add(name);
+        for name in names {
+            grid.add(name);
         }
 
-        match grid.fit_into_width(width as usize) {
-            Some(output) => {
-                write!(out, "{}", output)?;
+        match grid.fit_into_width(width as usize) {
+            Some(output) => {
+                write!(out, "{}", output)?;
             }
-            // Width is too small for the grid, so we fit it in one column
-            None => {
-                write!(out, "{}", grid.fit_into_columns(1))?;
+            // Width is too small for the grid, so we fit it in one column
+            None => {
+                write!(out, "{}", grid.fit_into_columns(1))?;
             }
         }
     }
     Ok(())
 }
 
-/// This writes to the BufWriter out a single string of the output of `ls -l`.
-///
-/// It writes the following keys, in order:
-/// * `inode` ([`get_inode`], config-optional)
-/// * `permissions` ([`display_permissions`])
-/// * `symlink_count` ([`display_symlink_count`])
-/// * `owner` ([`display_uname`], config-optional)
-/// * `group` ([`display_group`], config-optional)
-/// * `author` ([`display_uname`], config-optional)
-/// * `size / rdev` ([`display_len_or_rdev`])
-/// * `system_time` ([`get_system_time`])
-/// * `file_name` ([`display_file_name`])
-///
-/// This function needs to display information in columns:
-/// * permissions and system_time are already guaranteed to be pre-formatted in fixed length.
-/// * file_name is the last column and is left-aligned.
-/// * Everything else needs to be padded using [`pad_left`].
-///
-/// That's why we have the parameters:
-/// ```txt
-///    longest_link_count_len: usize,
-///    longest_uname_len: usize,
-///    longest_group_len: usize,
-///    longest_context_len: usize,
-///    longest_size_len: usize,
-/// ```
-/// that decide the maximum possible character count of each field.
-#[allow(clippy::write_literal)]
-fn display_item_long(
-    item: &PathData,
-    padding: &PaddingCollection,
-    config: &Config,
-    out: &mut BufWriter<Stdout>,
-) -> UResult<()> {
-    if let Some(md) = item.md(out) {
+/// This writes to the BufWriter out a single string of the output of `ls -l`.
+///
+/// It writes the following keys, in order:
+/// * `inode` ([`get_inode`], config-optional)
+/// * `permissions` ([`display_permissions`])
+/// * `symlink_count` ([`display_symlink_count`])
+/// * `owner` ([`display_uname`], config-optional)
+/// * `group` ([`display_group`], config-optional)
+/// * `author` ([`display_uname`], config-optional)
+/// * `size / rdev` ([`display_len_or_rdev`])
+/// * `system_time` ([`get_system_time`])
+/// * `file_name` ([`display_file_name`])
+///
+/// This function needs to display information in columns:
+/// * permissions and system_time are already guaranteed to be pre-formatted in fixed length.
+/// * file_name is the last column and is left-aligned.
+/// * Everything else needs to be padded using [`pad_left`].
+///
+/// That's why we have the parameters:
+/// ```txt
+///    longest_link_count_len: usize,
+///    longest_uname_len: usize,
+///    longest_group_len: usize,
+///    longest_context_len: usize,
+///    longest_size_len: usize,
+/// ```
+/// that decide the maximum possible character count of each field.
+#[allow(clippy::write_literal)]
+fn display_item_long(
+    item: &PathData,
+    padding: &PaddingCollection,
+    config: &Config,
+    out: &mut BufWriter<Stdout>,
+) -> UResult<()> {
+    if let Some(md) = item.md(out) {
         write!(
-            out,
+            out,
             "{}{} {}",
-            display_permissions(md, true),
-            if item.security_context.len() > 1 {
-                // GNU `ls` uses a "." character to indicate a file with a security context,
-                // but not other alternate access method.
-                "."
-            } else {
-                ""
-            },
-            pad_left(&display_symlink_count(md), padding.link_count)
+            display_permissions(md, true),
+            if item.security_context.len() > 1 {
+                // GNU `ls` uses a "." character to indicate a file with a security context,
+                // but not other alternate access method.
+                "."
+            } else {
+                ""
+            },
+            pad_left(&display_symlink_count(md), padding.link_count)
         )?;
 
-        if config.long.owner {
+        if config.long.owner {
             write!(
-                out,
+                out,
                 " {}",
-                pad_right(&display_uname(md, config), padding.uname)
+                pad_right(&display_uname(md, config), padding.uname)
             )?;
         }
 
-        if config.long.group {
+        if config.long.group {
             write!(
-                out,
+                out,
                 " {}",
-                pad_right(&display_group(md, config), padding.group)
+                pad_right(&display_group(md, config), padding.group)
             )?;
         }
 
-        if config.context {
+        if config.context {
             write!(
-                out,
+                out,
                 " {}",
-                pad_right(&item.security_context, padding.context)
+                pad_right(&item.security_context, padding.context)
             )?;
         }
 
-        // Author is only different from owner on GNU/Hurd, so we reuse
-        // the owner, since GNU/Hurd is not currently supported by Rust.
-        if config.long.author {
+        // Author is only different from owner on GNU/Hurd, so we reuse
+        // the owner, since GNU/Hurd is not currently supported by Rust.
+        if config.long.author {
             write!(
-                out,
+                out,
                 " {}",
-                pad_right(&display_uname(md, config), padding.uname)
+                pad_right(&display_uname(md, config), padding.uname)
             )?;
         }
 
-        match display_len_or_rdev(md, config) {
-            SizeOrDeviceId::Size(size) => {
-                write!(out, " {}", pad_left(&size, padding.size))?;
+        match display_len_or_rdev(md, config) {
+            SizeOrDeviceId::Size(size) => {
+                write!(out, " {}", pad_left(&size, padding.size))?;
             }
-            SizeOrDeviceId::Device(major, minor) => {
+            SizeOrDeviceId::Device(major, minor) => {
                 write!(
-                    out,
+                    out,
                     " {}, {}",
-                    pad_left(
-                        &major,
-                        #[cfg(not(unix))]
-                        0usize,
-                        #[cfg(unix)]
-                        padding.major.max(
-                            padding
-                                .size
-                                .saturating_sub(padding.minor.saturating_add(2usize))
+                    pad_left(
+                        &major,
+                        #[cfg(not(unix))]
+                        0usize,
+                        #[cfg(unix)]
+                        padding.major.max(
+                            padding
+                                .size
+                                .saturating_sub(padding.minor.saturating_add(2usize))
                         )
                     ),
-                    pad_left(
-                        &minor,
-                        #[cfg(not(unix))]
-                        0usize,
-                        #[cfg(unix)]
-                        padding.minor,
+                    pad_left(
+                        &minor,
+                        #[cfg(not(unix))]
+                        0usize,
+                        #[cfg(unix)]
+                        padding.minor,
                     ),
                 )?;
             }
         };
 
-        let dfn = display_file_name(item, config, None, "".to_owned(), out).contents;
+        let dfn = display_file_name(item, config, None, "".to_owned(), out).contents;
 
-        write!(out, " {} {}{}", display_date(md, config), dfn, config.eol)?;
-    } else {
-        #[cfg(unix)]
-        let leading_char = {
-            if let Some(Some(ft)) = item.ft.get() {
-                if ft.is_char_device() {
-                    "c"
-                } else if ft.is_block_device() {
-                    "b"
-                } else if ft.is_symlink() {
-                    "l"
-                } else if ft.is_dir() {
-                    "d"
-                } else {
-                    "-"
-                }
-            } else {
-                "-"
-            }
+        write!(out, " {} {}{}", display_date(md, config), dfn, config.eol)?;
+    } else {
+        #[cfg(unix)]
+        let leading_char = {
+            if let Some(Some(ft)) = item.ft.get() {
+                if ft.is_char_device() {
+                    "c"
+                } else if ft.is_block_device() {
+                    "b"
+                } else if ft.is_symlink() {
+                    "l"
+                } else if ft.is_dir() {
+                    "d"
+                } else {
+                    "-"
+                }
+            } else {
+                "-"
+            }
         };
-        #[cfg(not(unix))]
-        let leading_char = {
-            if let Some(Some(ft)) = item.ft.get() {
-                if ft.is_symlink() {
-                    "l"
-                } else if ft.is_dir() {
-                    "d"
-                } else {
-                    "-"
-                }
-            } else {
-                "-"
-            }
+        #[cfg(not(unix))]
+        let leading_char = {
+            if let Some(Some(ft)) = item.ft.get() {
+                if ft.is_symlink() {
+                    "l"
+                } else if ft.is_dir() {
+                    "d"
+                } else {
+                    "-"
+                }
+            } else {
+                "-"
+            }
         };
 
         write!(
-            out,
+            out,
             "{}{} {}",
-            format_args!("{}?????????", leading_char),
-            if item.security_context.len() > 1 {
-                // GNU `ls` uses a "." character to indicate a file with a security context,
-                // but not other alternate access method.
-                "."
-            } else {
-                ""
-            },
-            pad_left("?", padding.link_count)
+            format_args!("{}?????????", leading_char),
+            if item.security_context.len() > 1 {
+                // GNU `ls` uses a "." character to indicate a file with a security context,
+                // but not other alternate access method.
+                "."
+            } else {
+                ""
+            },
+            pad_left("?", padding.link_count)
         )?;
 
-        if config.long.owner {
-            write!(out, " {}", pad_right("?", padding.uname))?;
+        if config.long.owner {
+            write!(out, " {}", pad_right("?", padding.uname))?;
         }
 
-        if config.long.group {
-            write!(out, " {}", pad_right("?", padding.group))?;
+        if config.long.group {
+            write!(out, " {}", pad_right("?", padding.group))?;
         }
 
-        if config.context {
+        if config.context {
             write!(
-                out,
+                out,
                 " {}",
-                pad_right(&item.security_context, padding.context)
+                pad_right(&item.security_context, padding.context)
             )?;
         }
 
-        // Author is only different from owner on GNU/Hurd, so we reuse
-        // the owner, since GNU/Hurd is not currently supported by Rust.
-        if config.long.author {
-            write!(out, " {}", pad_right("?", padding.uname))?;
+        // Author is only different from owner on GNU/Hurd, so we reuse
+        // the owner, since GNU/Hurd is not currently supported by Rust.
+        if config.long.author {
+            write!(out, " {}", pad_right("?", padding.uname))?;
         }
 
-        let dfn = display_file_name(item, config, None, "".to_owned(), out).contents;
-        let date_len = 12;
+        let dfn = display_file_name(item, config, None, "".to_owned(), out).contents;
+        let date_len = 12;
 
         writeln!(
-            out,
+            out,
             " {} {} {}",
-            pad_left("?", padding.size),
-            pad_left("?", date_len),
-            dfn,
+            pad_left("?", padding.size),
+            pad_left("?", date_len),
+            dfn,
         )?;
     }
 
     Ok(())
 }
 
-#[cfg(unix)]
-fn get_inode(metadata: &Metadata) -> String {
-    format!("{}", metadata.ino())
+#[cfg(unix)]
+fn get_inode(metadata: &Metadata) -> String {
+    format!("{}", metadata.ino())
 }
 
-// Currently getpwuid is `linux` target only. If it's broken out into
-// a posix-compliant attribute this can be updated...
-#[cfg(unix)]
-use once_cell::sync::Lazy;
-#[cfg(unix)]
-use std::sync::Mutex;
-#[cfg(unix)]
-use uucore::entries;
-use uucore::fs::FileInformation;
-use uucore::quoting_style;
+// Currently getpwuid is `linux` target only. If it's broken out into
+// a posix-compliant attribute this can be updated...
+#[cfg(unix)]
+use once_cell::sync::Lazy;
+#[cfg(unix)]
+use std::sync::Mutex;
+#[cfg(unix)]
+use uucore::entries;
+use uucore::fs::FileInformation;
+use uucore::quoting_style;
 
-#[cfg(unix)]
-fn cached_uid2usr(uid: u32) -> String {
-    static UID_CACHE: Lazy<Mutex<HashMap<u32, String>>> = Lazy::new(|| Mutex::new(HashMap::new()));
+#[cfg(unix)]
+fn cached_uid2usr(uid: u32) -> String {
+    static UID_CACHE: Lazy<Mutex<HashMap<u32, String>>> = Lazy::new(|| Mutex::new(HashMap::new()));
 
-    let mut uid_cache = UID_CACHE.lock().unwrap();
-    uid_cache
-        .entry(uid)
-        .or_insert_with(|| entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()))
-        .clone()
+    let mut uid_cache = UID_CACHE.lock().unwrap();
+    uid_cache
+        .entry(uid)
+        .or_insert_with(|| entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()))
+        .clone()
 }
 
-#[cfg(unix)]
-fn display_uname(metadata: &Metadata, config: &Config) -> String {
-    if config.long.numeric_uid_gid {
-        metadata.uid().to_string()
-    } else {
-        cached_uid2usr(metadata.uid())
+#[cfg(unix)]
+fn display_uname(metadata: &Metadata, config: &Config) -> String {
+    if config.long.numeric_uid_gid {
+        metadata.uid().to_string()
+    } else {
+        cached_uid2usr(metadata.uid())
     }
 }
 
-#[cfg(all(unix, not(target_os = "redox")))]
-fn cached_gid2grp(gid: u32) -> String {
-    static GID_CACHE: Lazy<Mutex<HashMap<u32, String>>> = Lazy::new(|| Mutex::new(HashMap::new()));
+#[cfg(all(unix, not(target_os = "redox")))]
+fn cached_gid2grp(gid: u32) -> String {
+    static GID_CACHE: Lazy<Mutex<HashMap<u32, String>>> = Lazy::new(|| Mutex::new(HashMap::new()));
 
-    let mut gid_cache = GID_CACHE.lock().unwrap();
-    gid_cache
-        .entry(gid)
-        .or_insert_with(|| entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()))
-        .clone()
+    let mut gid_cache = GID_CACHE.lock().unwrap();
+    gid_cache
+        .entry(gid)
+        .or_insert_with(|| entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()))
+        .clone()
 }
 
-#[cfg(all(unix, not(target_os = "redox")))]
-fn display_group(metadata: &Metadata, config: &Config) -> String {
-    if config.long.numeric_uid_gid {
-        metadata.gid().to_string()
-    } else {
-        cached_gid2grp(metadata.gid())
+#[cfg(all(unix, not(target_os = "redox")))]
+fn display_group(metadata: &Metadata, config: &Config) -> String {
+    if config.long.numeric_uid_gid {
+        metadata.gid().to_string()
+    } else {
+        cached_gid2grp(metadata.gid())
     }
 }
 
-#[cfg(target_os = "redox")]
-fn display_group(metadata: &Metadata, config: &Config) -> String {
-    metadata.gid().to_string()
+#[cfg(target_os = "redox")]
+fn display_group(metadata: &Metadata, config: &Config) -> String {
+    metadata.gid().to_string()
 }
 
-#[cfg(not(unix))]
-fn display_uname(_metadata: &Metadata, _config: &Config) -> String {
-    "somebody".to_string()
+#[cfg(not(unix))]
+fn display_uname(_metadata: &Metadata, _config: &Config) -> String {
+    "somebody".to_string()
 }
 
-#[cfg(not(unix))]
-fn display_group(_metadata: &Metadata, _config: &Config) -> String {
-    "somegroup".to_string()
+#[cfg(not(unix))]
+fn display_group(_metadata: &Metadata, _config: &Config) -> String {
+    "somegroup".to_string()
 }
 
-// The implementations for get_time are separated because some options, such
-// as ctime will not be available
-#[cfg(unix)]
-fn get_system_time(md: &Metadata, config: &Config) -> Option<SystemTime> {
-    match config.time {
-        Time::Change => Some(UNIX_EPOCH + Duration::new(md.ctime() as u64, md.ctime_nsec() as u32)),
-        Time::Modification => md.modified().ok(),
-        Time::Access => md.accessed().ok(),
-        Time::Birth => md.created().ok(),
+// The implementations for get_time are separated because some options, such
+// as ctime will not be available
+#[cfg(unix)]
+fn get_system_time(md: &Metadata, config: &Config) -> Option<SystemTime> {
+    match config.time {
+        Time::Change => Some(UNIX_EPOCH + Duration::new(md.ctime() as u64, md.ctime_nsec() as u32)),
+        Time::Modification => md.modified().ok(),
+        Time::Access => md.accessed().ok(),
+        Time::Birth => md.created().ok(),
     }
 }
 
-#[cfg(not(unix))]
-fn get_system_time(md: &Metadata, config: &Config) -> Option<SystemTime> {
-    match config.time {
-        Time::Modification => md.modified().ok(),
-        Time::Access => md.accessed().ok(),
-        Time::Birth => md.created().ok(),
-        _ => None,
+#[cfg(not(unix))]
+fn get_system_time(md: &Metadata, config: &Config) -> Option<SystemTime> {
+    match config.time {
+        Time::Modification => md.modified().ok(),
+        Time::Access => md.accessed().ok(),
+        Time::Birth => md.created().ok(),
+        _ => None,
     }
 }
 
-fn get_time(md: &Metadata, config: &Config) -> Option<chrono::DateTime<chrono::Local>> {
-    let time = get_system_time(md, config)?;
-    Some(time.into())
+fn get_time(md: &Metadata, config: &Config) -> Option<chrono::DateTime<chrono::Local>> {
+    let time = get_system_time(md, config)?;
+    Some(time.into())
 }
 
-fn display_date(metadata: &Metadata, config: &Config) -> String {
-    match get_time(metadata, config) {
-        Some(time) => {
-            //Date is recent if from past 6 months
-            //According to GNU a Gregorian year has 365.2425 * 24 * 60 * 60 == 31556952 seconds on the average.
-            let recent = time + chrono::Duration::seconds(31_556_952 / 2) > chrono::Local::now();
+fn display_date(metadata: &Metadata, config: &Config) -> String {
+    match get_time(metadata, config) {
+        Some(time) => {
+            //Date is recent if from past 6 months
+            //According to GNU a Gregorian year has 365.2425 * 24 * 60 * 60 == 31556952 seconds on the average.
+            let recent = time + chrono::Duration::seconds(31_556_952 / 2) > chrono::Local::now();
 
-            match &config.time_style {
-                TimeStyle::FullIso => time.format("%Y-%m-%d %H:%M:%S.%f %z"),
-                TimeStyle::LongIso => time.format("%Y-%m-%d %H:%M"),
-                TimeStyle::Iso => time.format(if recent { "%m-%d %H:%M" } else { "%Y-%m-%d " }),
-                TimeStyle::Locale => {
-                    let fmt = if recent { "%b %e %H:%M" } else { "%b %e  %Y" };
+            match &config.time_style {
+                TimeStyle::FullIso => time.format("%Y-%m-%d %H:%M:%S.%f %z"),
+                TimeStyle::LongIso => time.format("%Y-%m-%d %H:%M"),
+                TimeStyle::Iso => time.format(if recent { "%m-%d %H:%M" } else { "%Y-%m-%d " }),
+                TimeStyle::Locale => {
+                    let fmt = if recent { "%b %e %H:%M" } else { "%b %e  %Y" };
 
-                    // spell-checker:ignore (word) datetime
-                    //In this version of chrono translating can be done
-                    //The function is chrono::datetime::DateTime::format_localized
-                    //However it's currently still hard to get the current pure-rust-locale
-                    //So it's not yet implemented
+                    // spell-checker:ignore (word) datetime
+                    //In this version of chrono translating can be done
+                    //The function is chrono::datetime::DateTime::format_localized
+                    //However it's currently still hard to get the current pure-rust-locale
+                    //So it's not yet implemented
 
-                    time.format(fmt)
+                    time.format(fmt)
                 }
-                TimeStyle::Format(e) => time.format(e),
+                TimeStyle::Format(e) => time.format(e),
             }
-            .to_string()
+            .to_string()
         }
-        None => "???".into(),
+        None => "???".into(),
     }
 }
 
-// There are a few peculiarities to how GNU formats the sizes:
-// 1. One decimal place is given if and only if the size is smaller than 10
-// 2. It rounds sizes up.
-// 3. The human-readable format uses powers for 1024, but does not display the "i"
-//    that is commonly used to denote Kibi, Mebi, etc.
-// 4. Kibi and Kilo are denoted differently ("k" and "K", respectively)
-fn format_prefixed(prefixed: &NumberPrefix<f64>) -> String {
-    match prefixed {
-        NumberPrefix::Standalone(bytes) => bytes.to_string(),
-        NumberPrefix::Prefixed(prefix, bytes) => {
-            // Remove the "i" from "Ki", "Mi", etc. if present
-            let prefix_str = prefix.symbol().trim_end_matches('i');
+// There are a few peculiarities to how GNU formats the sizes:
+// 1. One decimal place is given if and only if the size is smaller than 10
+// 2. It rounds sizes up.
+// 3. The human-readable format uses powers for 1024, but does not display the "i"
+//    that is commonly used to denote Kibi, Mebi, etc.
+// 4. Kibi and Kilo are denoted differently ("k" and "K", respectively)
+fn format_prefixed(prefixed: &NumberPrefix<f64>) -> String {
+    match prefixed {
+        NumberPrefix::Standalone(bytes) => bytes.to_string(),
+        NumberPrefix::Prefixed(prefix, bytes) => {
+            // Remove the "i" from "Ki", "Mi", etc. if present
+            let prefix_str = prefix.symbol().trim_end_matches('i');
 
-            // Check whether we get more than 10 if we round up to the first decimal
-            // because we want do display 9.81 as "9.9", not as "10".
-            if (10.0 * bytes).ceil() >= 100.0 {
-                format!("{:.0}{}", bytes.ceil(), prefix_str)
-            } else {
-                format!("{:.1}{}", (10.0 * bytes).ceil() / 10.0, prefix_str)
+            // Check whether we get more than 10 if we round up to the first decimal
+            // because we want do display 9.81 as "9.9", not as "10".
+            if (10.0 * bytes).ceil() >= 100.0 {
+                format!("{:.0}{}", bytes.ceil(), prefix_str)
+            } else {
+                format!("{:.1}{}", (10.0 * bytes).ceil() / 10.0, prefix_str)
             }
         }
     }
 }
 
-#[allow(dead_code)]
-enum SizeOrDeviceId {
-    Size(String),
-    Device(String, String),
+#[allow(dead_code)]
+enum SizeOrDeviceId {
+    Size(String),
+    Device(String, String),
 }
 
-fn display_len_or_rdev(metadata: &Metadata, config: &Config) -> SizeOrDeviceId {
-    #[cfg(any(target_os = "macos", target_os = "ios"))]
-    {
-        let ft = metadata.file_type();
-        if ft.is_char_device() || ft.is_block_device() {
-            let dev: u64 = metadata.rdev();
-            let major = (dev >> 24) as u8;
-            let minor = (dev & 0xff) as u8;
-            return SizeOrDeviceId::Device(major.to_string(), minor.to_string());
+fn display_len_or_rdev(metadata: &Metadata, config: &Config) -> SizeOrDeviceId {
+    #[cfg(any(target_os = "macos", target_os = "ios"))]
+    {
+        let ft = metadata.file_type();
+        if ft.is_char_device() || ft.is_block_device() {
+            let dev: u64 = metadata.rdev();
+            let major = (dev >> 24) as u8;
+            let minor = (dev & 0xff) as u8;
+            return SizeOrDeviceId::Device(major.to_string(), minor.to_string());
         }
     }
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    {
-        let ft = metadata.file_type();
-        if ft.is_char_device() || ft.is_block_device() {
-            let dev: u64 = metadata.rdev();
-            let major = (dev >> 8) as u8;
-            let minor = (dev & 0xff) as u8;
-            return SizeOrDeviceId::Device(major.to_string(), minor.to_string());
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    {
+        let ft = metadata.file_type();
+        if ft.is_char_device() || ft.is_block_device() {
+            let dev: u64 = metadata.rdev();
+            let major = (dev >> 8) as u8;
+            let minor = (dev & 0xff) as u8;
+            return SizeOrDeviceId::Device(major.to_string(), minor.to_string());
         }
     }
-    // Reported file len only adjusted for block_size when block_size is set
-    if let Some(user_block_size) = config.block_size {
-        // ordinary division of unsigned integers rounds down,
-        // this is similar to the Rust API for division that rounds up,
-        // currently in nightly only, however once
-        // https://github.com/rust-lang/rust/pull/88582 : "div_ceil"
-        // is stable we should use that instead
-        let len_adjusted = {
-            let d = metadata.len() / user_block_size;
-            let r = metadata.len() % user_block_size;
-            if r == 0 {
-                d
-            } else {
-                d + 1
-            }
+    // Reported file len only adjusted for block_size when block_size is set
+    if let Some(user_block_size) = config.block_size {
+        // ordinary division of unsigned integers rounds down,
+        // this is similar to the Rust API for division that rounds up,
+        // currently in nightly only, however once
+        // https://github.com/rust-lang/rust/pull/88582 : "div_ceil"
+        // is stable we should use that instead
+        let len_adjusted = {
+            let d = metadata.len() / user_block_size;
+            let r = metadata.len() % user_block_size;
+            if r == 0 {
+                d
+            } else {
+                d + 1
+            }
         };
-        SizeOrDeviceId::Size(display_size(len_adjusted, config))
-    } else {
-        SizeOrDeviceId::Size(display_size(metadata.len(), config))
+        SizeOrDeviceId::Size(display_size(len_adjusted, config))
+    } else {
+        SizeOrDeviceId::Size(display_size(metadata.len(), config))
     }
 }
 
-fn display_size(size: u64, config: &Config) -> String {
-    // NOTE: The human-readable behavior deviates from the GNU ls.
-    // The GNU ls uses binary prefixes by default.
-    match config.size_format {
-        SizeFormat::Binary => format_prefixed(&NumberPrefix::binary(size as f64)),
-        SizeFormat::Decimal => format_prefixed(&NumberPrefix::decimal(size as f64)),
-        SizeFormat::Bytes => size.to_string(),
+fn display_size(size: u64, config: &Config) -> String {
+    // NOTE: The human-readable behavior deviates from the GNU ls.
+    // The GNU ls uses binary prefixes by default.
+    match config.size_format {
+        SizeFormat::Binary => format_prefixed(&NumberPrefix::binary(size as f64)),
+        SizeFormat::Decimal => format_prefixed(&NumberPrefix::decimal(size as f64)),
+        SizeFormat::Bytes => size.to_string(),
     }
 }
 
-#[cfg(unix)]
-fn file_is_executable(md: &Metadata) -> bool {
-    // Mode always returns u32, but the flags might not be, based on the platform
-    // e.g. linux has u32, mac has u16.
-    // S_IXUSR -> user has execute permission
-    // S_IXGRP -> group has execute permission
-    // S_IXOTH -> other users have execute permission
-    md.mode() & ((S_IXUSR | S_IXGRP | S_IXOTH) as u32) != 0
-}
+#[cfg(unix)]
+fn file_is_executable(md: &Metadata) -> bool {
+    // Mode always returns u32, but the flags might not be, based on the platform
+    // e.g. linux has u32, mac has u16.
+    // S_IXUSR -> user has execute permission
+    // S_IXGRP -> group has execute permission
+    // S_IXOTH -> other users have execute permission
+    md.mode() & ((S_IXUSR | S_IXGRP | S_IXOTH) as u32) != 0
+}
 
-fn classify_file(path: &PathData, out: &mut BufWriter<Stdout>) -> Option<char> {
-    let file_type = path.file_type(out)?;
+fn classify_file(path: &PathData, out: &mut BufWriter<Stdout>) -> Option<char> {
+    let file_type = path.file_type(out)?;
 
-    if file_type.is_dir() {
+    if file_type.is_dir() {
         Some('/')
-    } else if file_type.is_symlink() {
+    } else if file_type.is_symlink() {
         Some('@')
-    } else {
-        #[cfg(unix)]
-        {
-            if file_type.is_socket() {
+    } else {
+        #[cfg(unix)]
+        {
+            if file_type.is_socket() {
                 Some('=')
-            } else if file_type.is_fifo() {
+            } else if file_type.is_fifo() {
                 Some('|')
-            } else if file_type.is_file() && file_is_executable(path.md(out).as_ref().unwrap()) {
+            } else if file_type.is_file() && file_is_executable(path.md(out).as_ref().unwrap()) {
                 Some('*')
-            } else {
-                None
-            }
+            } else {
+                None
+            }
         }
-        #[cfg(not(unix))]
-        None
-    }
+        #[cfg(not(unix))]
+        None
+    }
 }
 
-/// Takes a [`PathData`] struct and returns a cell with a name ready for displaying.
-///
-/// This function relies on the following parameters in the provided `&Config`:
-/// * `config.quoting_style` to decide how we will escape `name` using [`escape_name`].
-/// * `config.inode` decides whether to display inode numbers beside names using [`get_inode`].
-/// * `config.color` decides whether it's going to color `name` using [`color_name`].
-/// * `config.indicator_style` to append specific characters to `name` using [`classify_file`].
-/// * `config.format` to display symlink targets if `Format::Long`. This function is also
-///   responsible for coloring symlink target names if `config.color` is specified.
-/// * `config.context` to prepend security context to `name` if compiled with `feat_selinux`.
-///
-/// Note that non-unicode sequences in symlink targets are dealt with using
-/// [`std::path::Path::to_string_lossy`].
-#[allow(unused_variables)]
-fn display_file_name(
-    path: &PathData,
-    config: &Config,
-    prefix_context: Option<usize>,
-    more_info: String,
-    out: &mut BufWriter<Stdout>,
-) -> Cell {
-    // This is our return value. We start by `&path.display_name` and modify it along the way.
-    let mut name = escape_name(&path.display_name, &config.quoting_style);
+/// Takes a [`PathData`] struct and returns a cell with a name ready for displaying.
+///
+/// This function relies on the following parameters in the provided `&Config`:
+/// * `config.quoting_style` to decide how we will escape `name` using [`escape_name`].
+/// * `config.inode` decides whether to display inode numbers beside names using [`get_inode`].
+/// * `config.color` decides whether it's going to color `name` using [`color_name`].
+/// * `config.indicator_style` to append specific characters to `name` using [`classify_file`].
+/// * `config.format` to display symlink targets if `Format::Long`. This function is also
+///   responsible for coloring symlink target names if `config.color` is specified.
+/// * `config.context` to prepend security context to `name` if compiled with `feat_selinux`.
+///
+/// Note that non-unicode sequences in symlink targets are dealt with using
+/// [`std::path::Path::to_string_lossy`].
+#[allow(unused_variables)]
+fn display_file_name(
+    path: &PathData,
+    config: &Config,
+    prefix_context: Option<usize>,
+    more_info: String,
+    out: &mut BufWriter<Stdout>,
+) -> Cell {
+    // This is our return value. We start by `&path.display_name` and modify it along the way.
+    let mut name = escape_name(&path.display_name, &config.quoting_style);
 
-    // We need to keep track of the width ourselves instead of letting term_grid
-    // infer it because the color codes mess up term_grid's width calculation.
-    let mut width = name.width();
+    // We need to keep track of the width ourselves instead of letting term_grid
+    // infer it because the color codes mess up term_grid's width calculation.
+    let mut width = name.width();
 
-    if let Some(ls_colors) = &config.color {
-        let md = path.md(out);
-        name = if md.is_some() {
-            color_name(name, &path.p_buf, md, ls_colors)
-        } else {
-            color_name(
-                name,
-                &path.p_buf,
-                path.p_buf.symlink_metadata().ok().as_ref(),
-                ls_colors,
+    if let Some(ls_colors) = &config.color {
+        let md = path.md(out);
+        name = if md.is_some() {
+            color_name(name, &path.p_buf, md, ls_colors)
+        } else {
+            color_name(
+                name,
+                &path.p_buf,
+                path.p_buf.symlink_metadata().ok().as_ref(),
+                ls_colors,
             )
         };
     }
 
-    if config.format != Format::Long && !more_info.is_empty() {
-        // increment width here b/c name was given colors and name.width() is now the wrong
-        // size for display
-        width += more_info.width();
-        name = more_info + &name;
+    if config.format != Format::Long && !more_info.is_empty() {
+        // increment width here b/c name was given colors and name.width() is now the wrong
+        // size for display
+        width += more_info.width();
+        name = more_info + &name;
     }
 
-    if config.indicator_style != IndicatorStyle::None {
-        let sym = classify_file(path, out);
+    if config.indicator_style != IndicatorStyle::None {
+        let sym = classify_file(path, out);
 
-        let char_opt = match config.indicator_style {
-            IndicatorStyle::Classify => sym,
-            IndicatorStyle::FileType => {
-                // Don't append an asterisk.
-                match sym {
+        let char_opt = match config.indicator_style {
+            IndicatorStyle::Classify => sym,
+            IndicatorStyle::FileType => {
+                // Don't append an asterisk.
+                match sym {
                     Some('*') => None,
-                    _ => sym,
+                    _ => sym,
                 }
             }
-            IndicatorStyle::Slash => {
-                // Append only a slash.
-                match sym {
+            IndicatorStyle::Slash => {
+                // Append only a slash.
+                match sym {
                     Some('/') => Some('/'),
-                    _ => None,
+                    _ => None,
                 }
             }
-            IndicatorStyle::None => None,
+            IndicatorStyle::None => None,
         };
 
-        if let Some(c) = char_opt {
-            name.push(c);
-            width += 1;
+        if let Some(c) = char_opt {
+            name.push(c);
+            width += 1;
         }
     }
 
-    if config.format == Format::Long
-        && path.file_type(out).is_some()
-        && path.file_type(out).unwrap().is_symlink()
-        && !path.must_dereference
+    if config.format == Format::Long
+        && path.file_type(out).is_some()
+        && path.file_type(out).unwrap().is_symlink()
+        && !path.must_dereference
     {
-        if let Ok(target) = path.p_buf.read_link() {
-            name.push_str(" -> ");
+        if let Ok(target) = path.p_buf.read_link() {
+            name.push_str(" -> ");
 
-            // We might as well color the symlink output after the arrow.
-            // This makes extra system calls, but provides important information that
-            // people run `ls -l --color` are very interested in.
-            if let Some(ls_colors) = &config.color {
-                // We get the absolute path to be able to construct PathData with valid Metadata.
-                // This is because relative symlinks will fail to get_metadata.
-                let mut absolute_target = target.clone();
-                if target.is_relative() {
-                    if let Some(parent) = path.p_buf.parent() {
-                        absolute_target = parent.join(absolute_target);
+            // We might as well color the symlink output after the arrow.
+            // This makes extra system calls, but provides important information that
+            // people run `ls -l --color` are very interested in.
+            if let Some(ls_colors) = &config.color {
+                // We get the absolute path to be able to construct PathData with valid Metadata.
+                // This is because relative symlinks will fail to get_metadata.
+                let mut absolute_target = target.clone();
+                if target.is_relative() {
+                    if let Some(parent) = path.p_buf.parent() {
+                        absolute_target = parent.join(absolute_target);
                     }
                 }
 
-                let target_data = PathData::new(absolute_target, None, None, config, false);
+                let target_data = PathData::new(absolute_target, None, None, config, false);
 
-                // If we have a symlink to a valid file, we use the metadata of said file.
-                // Because we use an absolute path, we can assume this is guaranteed to exist.
-                // Otherwise, we use path.md(), which will guarantee we color to the same
-                // color of non-existent symlinks according to style_for_path_with_metadata.
-                if path.md(out).is_none()
-                    && get_metadata(target_data.p_buf.as_path(), target_data.must_dereference)
-                        .is_err()
+                // If we have a symlink to a valid file, we use the metadata of said file.
+                // Because we use an absolute path, we can assume this is guaranteed to exist.
+                // Otherwise, we use path.md(), which will guarantee we color to the same
+                // color of non-existent symlinks according to style_for_path_with_metadata.
+                if path.md(out).is_none()
+                    && get_metadata(target_data.p_buf.as_path(), target_data.must_dereference)
+                        .is_err()
                 {
-                    name.push_str(&path.p_buf.read_link().unwrap().to_string_lossy());
-                } else {
-                    // Use fn get_metadata instead of md() here and above because ls
-                    // should not exit with an err, if we are unable to obtain the target_metadata
-                    let target_metadata = match get_metadata(
-                        target_data.p_buf.as_path(),
-                        target_data.must_dereference,
+                    name.push_str(&path.p_buf.read_link().unwrap().to_string_lossy());
+                } else {
+                    // Use fn get_metadata instead of md() here and above because ls
+                    // should not exit with an err, if we are unable to obtain the target_metadata
+                    let target_metadata = match get_metadata(
+                        target_data.p_buf.as_path(),
+                        target_data.must_dereference,
                     ) {
-                        Ok(md) => md,
-                        Err(_) => path.md(out).unwrap().to_owned(),
+                        Ok(md) => md,
+                        Err(_) => path.md(out).unwrap().to_owned(),
                     };
 
-                    name.push_str(&color_name(
-                        escape_name(target.as_os_str(), &config.quoting_style),
-                        &target_data.p_buf,
-                        Some(&target_metadata),
-                        ls_colors,
+                    name.push_str(&color_name(
+                        escape_name(target.as_os_str(), &config.quoting_style),
+                        &target_data.p_buf,
+                        Some(&target_metadata),
+                        ls_colors,
                     ));
                 }
-            } else {
-                // If no coloring is required, we just use target as is.
-                // Apply the right quoting
-                name.push_str(&escape_name(target.as_os_str(), &config.quoting_style));
+            } else {
+                // If no coloring is required, we just use target as is.
+                // Apply the right quoting
+                name.push_str(&escape_name(target.as_os_str(), &config.quoting_style));
             }
         }
     }
 
-    // Prepend the security context to the `name` and adjust `width` in order
-    // to get correct alignment from later calls to`display_grid()`.
-    if config.context {
-        if let Some(pad_count) = prefix_context {
-            let security_context = if !matches!(config.format, Format::Commas) {
-                pad_left(&path.security_context, pad_count)
-            } else {
-                path.security_context.to_owned()
+    // Prepend the security context to the `name` and adjust `width` in order
+    // to get correct alignment from later calls to`display_grid()`.
+    if config.context {
+        if let Some(pad_count) = prefix_context {
+            let security_context = if !matches!(config.format, Format::Commas) {
+                pad_left(&path.security_context, pad_count)
+            } else {
+                path.security_context.to_owned()
             };
-            name = format!("{} {}", security_context, name);
-            width += security_context.len() + 1;
+            name = format!("{} {}", security_context, name);
+            width += security_context.len() + 1;
         }
     }
 
-    Cell {
-        contents: name,
-        width,
+    Cell {
+        contents: name,
+        width,
     }
 }
 
-fn color_name(name: String, path: &Path, md: Option<&Metadata>, ls_colors: &LsColors) -> String {
-    match ls_colors.style_for_path_with_metadata(path, md) {
-        Some(style) => {
-            return style.to_ansi_term_style().paint(name).to_string();
+fn color_name(name: String, path: &Path, md: Option<&Metadata>, ls_colors: &LsColors) -> String {
+    match ls_colors.style_for_path_with_metadata(path, md) {
+        Some(style) => {
+            return style.to_ansi_term_style().paint(name).to_string();
         }
-        None => name,
+        None => name,
     }
 }
 
-#[cfg(not(unix))]
-fn display_symlink_count(_metadata: &Metadata) -> String {
-    // Currently not sure of how to get this on Windows, so I'm punting.
-    // Git Bash looks like it may do the same thing.
-    String::from("1")
+#[cfg(not(unix))]
+fn display_symlink_count(_metadata: &Metadata) -> String {
+    // Currently not sure of how to get this on Windows, so I'm punting.
+    // Git Bash looks like it may do the same thing.
+    String::from("1")
 }
 
-#[cfg(unix)]
-fn display_symlink_count(metadata: &Metadata) -> String {
-    metadata.nlink().to_string()
+#[cfg(unix)]
+fn display_symlink_count(metadata: &Metadata) -> String {
+    metadata.nlink().to_string()
 }
 
-#[cfg(unix)]
-fn display_inode(metadata: &Metadata) -> String {
-    get_inode(metadata)
+#[cfg(unix)]
+fn display_inode(metadata: &Metadata) -> String {
+    get_inode(metadata)
 }
 
-// This returns the SELinux security context as UTF8 `String`.
-// In the long term this should be changed to `OsStr`, see discussions at #2621/#2656
-#[allow(unused_variables)]
-fn get_security_context(config: &Config, p_buf: &Path, must_dereference: bool) -> String {
-    let substitute_string = "?".to_string();
-    if config.selinux_supported {
-        #[cfg(feature = "selinux")]
-        {
-            match selinux::SecurityContext::of_path(p_buf, must_dereference.to_owned(), false) {
-                Err(_r) => {
-                    // TODO: show the actual reason why it failed
-                    show_warning!("failed to get security context of: {}", p_buf.quote());
-                    substitute_string
+// This returns the SELinux security context as UTF8 `String`.
+// In the long term this should be changed to `OsStr`, see discussions at #2621/#2656
+#[allow(unused_variables)]
+fn get_security_context(config: &Config, p_buf: &Path, must_dereference: bool) -> String {
+    let substitute_string = "?".to_string();
+    if config.selinux_supported {
+        #[cfg(feature = "selinux")]
+        {
+            match selinux::SecurityContext::of_path(p_buf, must_dereference.to_owned(), false) {
+                Err(_r) => {
+                    // TODO: show the actual reason why it failed
+                    show_warning!("failed to get security context of: {}", p_buf.quote());
+                    substitute_string
                 }
-                Ok(None) => substitute_string,
-                Ok(Some(context)) => {
-                    let context = context.as_bytes();
+                Ok(None) => substitute_string,
+                Ok(Some(context)) => {
+                    let context = context.as_bytes();
 
-                    let context = context.strip_suffix(&[0]).unwrap_or(context);
-                    String::from_utf8(context.to_vec()).unwrap_or_else(|e| {
+                    let context = context.strip_suffix(&[0]).unwrap_or(context);
+                    String::from_utf8(context.to_vec()).unwrap_or_else(|e| {
                         show_warning!(
                             "getting security context of: {}: {}",
-                            p_buf.quote(),
-                            e.to_string()
+                            p_buf.quote(),
+                            e.to_string()
                         );
-                        String::from_utf8_lossy(context).into_owned()
+                        String::from_utf8_lossy(context).into_owned()
                     })
                 }
             }
         }
-        #[cfg(not(feature = "selinux"))]
-        {
-            substitute_string
+        #[cfg(not(feature = "selinux"))]
+        {
+            substitute_string
         }
-    } else {
-        substitute_string
+    } else {
+        substitute_string
     }
 }
 
-#[cfg(unix)]
-fn calculate_padding_collection(
-    items: &[PathData],
-    config: &Config,
-    out: &mut BufWriter<Stdout>,
-) -> PaddingCollection {
-    let mut padding_collections = PaddingCollection {
-        inode: 1,
-        link_count: 1,
-        uname: 1,
-        group: 1,
-        context: 1,
-        size: 1,
-        major: 1,
-        minor: 1,
-        block_size: 1,
+#[cfg(unix)]
+fn calculate_padding_collection(
+    items: &[PathData],
+    config: &Config,
+    out: &mut BufWriter<Stdout>,
+) -> PaddingCollection {
+    let mut padding_collections = PaddingCollection {
+        inode: 1,
+        link_count: 1,
+        uname: 1,
+        group: 1,
+        context: 1,
+        size: 1,
+        major: 1,
+        minor: 1,
+        block_size: 1,
     };
 
-    for item in items {
-        #[cfg(unix)]
-        if config.inode {
-            let inode_len = if let Some(md) = item.md(out) {
-                display_inode(md).len()
-            } else {
+    for item in items {
+        #[cfg(unix)]
+        if config.inode {
+            let inode_len = if let Some(md) = item.md(out) {
+                display_inode(md).len()
+            } else {
                 continue;
             };
-            padding_collections.inode = inode_len.max(padding_collections.inode);
+            padding_collections.inode = inode_len.max(padding_collections.inode);
         }
 
-        if config.alloc_size {
-            if let Some(md) = item.md(out) {
-                let block_size_len = display_size(get_block_size(md, config), config).len();
-                padding_collections.block_size = block_size_len.max(padding_collections.block_size);
+        if config.alloc_size {
+            if let Some(md) = item.md(out) {
+                let block_size_len = display_size(get_block_size(md, config), config).len();
+                padding_collections.block_size = block_size_len.max(padding_collections.block_size);
             }
         }
 
-        if config.format == Format::Long {
-            let context_len = item.security_context.len();
-            let (link_count_len, uname_len, group_len, size_len, major_len, minor_len) =
-                display_dir_entry_size(item, config, out);
-            padding_collections.link_count = link_count_len.max(padding_collections.link_count);
-            padding_collections.uname = uname_len.max(padding_collections.uname);
-            padding_collections.group = group_len.max(padding_collections.group);
-            if config.context {
-                padding_collections.context = context_len.max(padding_collections.context);
+        if config.format == Format::Long {
+            let context_len = item.security_context.len();
+            let (link_count_len, uname_len, group_len, size_len, major_len, minor_len) =
+                display_dir_entry_size(item, config, out);
+            padding_collections.link_count = link_count_len.max(padding_collections.link_count);
+            padding_collections.uname = uname_len.max(padding_collections.uname);
+            padding_collections.group = group_len.max(padding_collections.group);
+            if config.context {
+                padding_collections.context = context_len.max(padding_collections.context);
             }
-            if items.len() == 1usize {
-                padding_collections.size = 0usize;
-                padding_collections.major = 0usize;
-                padding_collections.minor = 0usize;
-            } else {
-                padding_collections.major = major_len.max(padding_collections.major);
-                padding_collections.minor = minor_len.max(padding_collections.minor);
-                padding_collections.size = size_len
-                    .max(padding_collections.size)
-                    .max(padding_collections.major + padding_collections.minor + 2usize);
+            if items.len() == 1usize {
+                padding_collections.size = 0usize;
+                padding_collections.major = 0usize;
+                padding_collections.minor = 0usize;
+            } else {
+                padding_collections.major = major_len.max(padding_collections.major);
+                padding_collections.minor = minor_len.max(padding_collections.minor);
+                padding_collections.size = size_len
+                    .max(padding_collections.size)
+                    .max(padding_collections.major + padding_collections.minor + 2usize);
             }
         }
     }
 
-    padding_collections
+    padding_collections
 }
 
-#[cfg(not(unix))]
-fn calculate_padding_collection(
-    items: &[PathData],
-    config: &Config,
-    out: &mut BufWriter<Stdout>,
-) -> PaddingCollection {
-    let mut padding_collections = PaddingCollection {
-        link_count: 1,
-        uname: 1,
-        group: 1,
-        context: 1,
-        size: 1,
-        block_size: 1,
+#[cfg(not(unix))]
+fn calculate_padding_collection(
+    items: &[PathData],
+    config: &Config,
+    out: &mut BufWriter<Stdout>,
+) -> PaddingCollection {
+    let mut padding_collections = PaddingCollection {
+        link_count: 1,
+        uname: 1,
+        group: 1,
+        context: 1,
+        size: 1,
+        block_size: 1,
     };
 
-    for item in items {
-        if config.alloc_size {
-            if let Some(md) = item.md(out) {
-                let block_size_len = display_size(get_block_size(md, config), config).len();
-                padding_collections.block_size = block_size_len.max(padding_collections.block_size);
+    for item in items {
+        if config.alloc_size {
+            if let Some(md) = item.md(out) {
+                let block_size_len = display_size(get_block_size(md, config), config).len();
+                padding_collections.block_size = block_size_len.max(padding_collections.block_size);
             }
         }
 
-        let context_len = item.security_context.len();
-        let (link_count_len, uname_len, group_len, size_len, _major_len, _minor_len) =
-            display_dir_entry_size(item, config, out);
-        padding_collections.link_count = link_count_len.max(padding_collections.link_count);
-        padding_collections.uname = uname_len.max(padding_collections.uname);
-        padding_collections.group = group_len.max(padding_collections.group);
-        if config.context {
-            padding_collections.context = context_len.max(padding_collections.context);
+        let context_len = item.security_context.len();
+        let (link_count_len, uname_len, group_len, size_len, _major_len, _minor_len) =
+            display_dir_entry_size(item, config, out);
+        padding_collections.link_count = link_count_len.max(padding_collections.link_count);
+        padding_collections.uname = uname_len.max(padding_collections.uname);
+        padding_collections.group = group_len.max(padding_collections.group);
+        if config.context {
+            padding_collections.context = context_len.max(padding_collections.context);
         }
-        padding_collections.size = size_len.max(padding_collections.size);
+        padding_collections.size = size_len.max(padding_collections.size);
     }
 
-    padding_collections
+    padding_collections
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_mkdir/mkdir.rs.html b/dev/src/uu_mkdir/mkdir.rs.html index bf16d3a06..e02e73bdd 100644 --- a/dev/src/uu_mkdir/mkdir.rs.html +++ b/dev/src/uu_mkdir/mkdir.rs.html @@ -1,4 +1,4 @@ -mkdir.rs - source
1
+mkdir.rs - source
1
 2
 3
 4
@@ -221,228 +221,228 @@
 221
 222
 223
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Nicholas Juszczak <juszczakn@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Nicholas Juszczak <juszczakn@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) ugoa cmode
+// spell-checker:ignore (ToDO) ugoa cmode
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::builder::ValueParser;
-use clap::parser::ValuesRef;
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use std::ffi::OsString;
-use std::path::{Path, PathBuf};
-#[cfg(not(windows))]
-use uucore::error::FromIo;
-use uucore::error::{UResult, USimpleError};
-use uucore::format_usage;
-#[cfg(not(windows))]
-use uucore::mode;
-use uucore::{display::Quotable, fs::dir_strip_dot_for_creation};
+use clap::builder::ValueParser;
+use clap::parser::ValuesRef;
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use std::ffi::OsString;
+use std::path::{Path, PathBuf};
+#[cfg(not(windows))]
+use uucore::error::FromIo;
+use uucore::error::{UResult, USimpleError};
+use uucore::format_usage;
+#[cfg(not(windows))]
+use uucore::mode;
+use uucore::{display::Quotable, fs::dir_strip_dot_for_creation};
 
-static DEFAULT_PERM: u32 = 0o755;
+static DEFAULT_PERM: u32 = 0o755;
 
-static ABOUT: &str = "Create the given DIRECTORY(ies) if they do not exist";
-const USAGE: &str = "{} [OPTION]... [USER]";
+static ABOUT: &str = "Create the given DIRECTORY(ies) if they do not exist";
+const USAGE: &str = "{} [OPTION]... [USER]";
 
-mod options {
-    pub const MODE: &str = "mode";
-    pub const PARENTS: &str = "parents";
-    pub const VERBOSE: &str = "verbose";
-    pub const DIRS: &str = "dirs";
+mod options {
+    pub const MODE: &str = "mode";
+    pub const PARENTS: &str = "parents";
+    pub const VERBOSE: &str = "verbose";
+    pub const DIRS: &str = "dirs";
 }
 
-fn get_long_usage() -> &'static str {
-    "Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'."
+fn get_long_usage() -> &'static str {
+    "Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'."
+}
+
+#[cfg(windows)]
+fn get_mode(_matches: &ArgMatches, _mode_had_minus_prefix: bool) -> Result<u32, String> {
+    Ok(DEFAULT_PERM)
 }
 
-#[cfg(windows)]
-fn get_mode(_matches: &ArgMatches, _mode_had_minus_prefix: bool) -> Result<u32, String> {
-    Ok(DEFAULT_PERM)
-}
-
-#[cfg(not(windows))]
-fn get_mode(matches: &ArgMatches, mode_had_minus_prefix: bool) -> Result<u32, String> {
-    let digits: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
-    // Translate a ~str in octal form to u16, default to 755
-    // Not tested on Windows
-    let mut new_mode = DEFAULT_PERM;
-    match matches.get_one::<String>(options::MODE) {
-        Some(m) => {
-            for mode in m.split(',') {
-                if mode.contains(digits) {
-                    new_mode = mode::parse_numeric(new_mode, m, true)?;
-                } else {
-                    let cmode = if mode_had_minus_prefix {
-                        // clap parsing is finished, now put prefix back
-                        format!("-{}", mode)
-                    } else {
-                        mode.to_string()
+#[cfg(not(windows))]
+fn get_mode(matches: &ArgMatches, mode_had_minus_prefix: bool) -> Result<u32, String> {
+    let digits: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
+    // Translate a ~str in octal form to u16, default to 755
+    // Not tested on Windows
+    let mut new_mode = DEFAULT_PERM;
+    match matches.get_one::<String>(options::MODE) {
+        Some(m) => {
+            for mode in m.split(',') {
+                if mode.contains(digits) {
+                    new_mode = mode::parse_numeric(new_mode, m, true)?;
+                } else {
+                    let cmode = if mode_had_minus_prefix {
+                        // clap parsing is finished, now put prefix back
+                        format!("-{}", mode)
+                    } else {
+                        mode.to_string()
                     };
-                    new_mode = mode::parse_symbolic(new_mode, &cmode, mode::get_umask(), true)?;
+                    new_mode = mode::parse_symbolic(new_mode, &cmode, mode::get_umask(), true)?;
                 }
             }
-            Ok(new_mode)
+            Ok(new_mode)
         }
-        None => {
-            // If no mode argument is specified return the mode derived from umask
-            Ok(!mode::get_umask() & 0o0777)
+        None => {
+            // If no mode argument is specified return the mode derived from umask
+            Ok(!mode::get_umask() & 0o0777)
         }
     }
 }
 
-#[cfg(windows)]
-fn strip_minus_from_mode(_args: &mut [String]) -> bool {
-    false
+#[cfg(windows)]
+fn strip_minus_from_mode(_args: &mut [String]) -> bool {
+    false
+}
+
+#[cfg(not(windows))]
+fn strip_minus_from_mode(args: &mut Vec<String>) -> bool {
+    mode::strip_minus_from_mode(args)
 }
 
-#[cfg(not(windows))]
-fn strip_minus_from_mode(args: &mut Vec<String>) -> bool {
-    mode::strip_minus_from_mode(args)
-}
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let mut args = args.collect_lossy();
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let mut args = args.collect_lossy();
+    // Before we can parse 'args' with clap (and previously getopts),
+    // a possible MODE prefix '-' needs to be removed (e.g. "chmod -x FILE").
+    let mode_had_minus_prefix = strip_minus_from_mode(&mut args);
 
-    // Before we can parse 'args' with clap (and previously getopts),
-    // a possible MODE prefix '-' needs to be removed (e.g. "chmod -x FILE").
-    let mode_had_minus_prefix = strip_minus_from_mode(&mut args);
+    // Linux-specific options, not implemented
+    // opts.optflag("Z", "context", "set SELinux security context" +
+    // " of each created directory to CTX"),
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)?;
 
-    // Linux-specific options, not implemented
-    // opts.optflag("Z", "context", "set SELinux security context" +
-    // " of each created directory to CTX"),
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)?;
+    let dirs = matches
+        .get_many::<OsString>(options::DIRS)
+        .unwrap_or_default();
+    let verbose = matches.get_flag(options::VERBOSE);
+    let recursive = matches.get_flag(options::PARENTS);
 
-    let dirs = matches
-        .get_many::<OsString>(options::DIRS)
-        .unwrap_or_default();
-    let verbose = matches.get_flag(options::VERBOSE);
-    let recursive = matches.get_flag(options::PARENTS);
-
-    match get_mode(&matches, mode_had_minus_prefix) {
-        Ok(mode) => exec(dirs, recursive, mode, verbose),
-        Err(f) => Err(USimpleError::new(1, f)),
+    match get_mode(&matches, mode_had_minus_prefix) {
+        Ok(mode) => exec(dirs, recursive, mode, verbose),
+        Err(f) => Err(USimpleError::new(1, f)),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::MODE)
-                .short('m')
-                .long(options::MODE)
-                .help("set file mode (not implemented on windows)"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::MODE)
+                .short('m')
+                .long(options::MODE)
+                .help("set file mode (not implemented on windows)"),
         )
-        .arg(
-            Arg::new(options::PARENTS)
-                .short('p')
-                .long(options::PARENTS)
-                .help("make parent directories as needed")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PARENTS)
+                .short('p')
+                .long(options::PARENTS)
+                .help("make parent directories as needed")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::VERBOSE)
-                .short('v')
-                .long(options::VERBOSE)
-                .help("print a message for each printed directory")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::VERBOSE)
+                .short('v')
+                .long(options::VERBOSE)
+                .help("print a message for each printed directory")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DIRS)
-                .action(ArgAction::Append)
-                .num_args(1..)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::DirPath),
+        .arg(
+            Arg::new(options::DIRS)
+                .action(ArgAction::Append)
+                .num_args(1..)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::DirPath),
         )
 }
 
 /**
  * Create the list of new directories
- */
-fn exec(dirs: ValuesRef<OsString>, recursive: bool, mode: u32, verbose: bool) -> UResult<()> {
-    for dir in dirs {
-        // Special case to match GNU's behavior:
-        // mkdir -p foo/. should work and just create foo/
-        // std::fs::create_dir("foo/."); fails in pure Rust
-        let path = if recursive {
-            dir_strip_dot_for_creation(&PathBuf::from(dir))
-        } else {
-            // Normal case
-            PathBuf::from(dir)
+ */
+fn exec(dirs: ValuesRef<OsString>, recursive: bool, mode: u32, verbose: bool) -> UResult<()> {
+    for dir in dirs {
+        // Special case to match GNU's behavior:
+        // mkdir -p foo/. should work and just create foo/
+        // std::fs::create_dir("foo/."); fails in pure Rust
+        let path = if recursive {
+            dir_strip_dot_for_creation(&PathBuf::from(dir))
+        } else {
+            // Normal case
+            PathBuf::from(dir)
         };
-        show_if_err!(mkdir(path.as_path(), recursive, mode, verbose));
+        show_if_err!(mkdir(path.as_path(), recursive, mode, verbose));
     }
     Ok(())
 }
 
-fn mkdir(path: &Path, recursive: bool, mode: u32, verbose: bool) -> UResult<()> {
-    create_dir(path, recursive, verbose)?;
-    chmod(path, mode)
+fn mkdir(path: &Path, recursive: bool, mode: u32, verbose: bool) -> UResult<()> {
+    create_dir(path, recursive, verbose)?;
+    chmod(path, mode)
 }
 
-#[cfg(any(unix, target_os = "redox"))]
-fn chmod(path: &Path, mode: u32) -> UResult<()> {
-    use std::fs::{set_permissions, Permissions};
-    use std::os::unix::fs::PermissionsExt;
+#[cfg(any(unix, target_os = "redox"))]
+fn chmod(path: &Path, mode: u32) -> UResult<()> {
+    use std::fs::{set_permissions, Permissions};
+    use std::os::unix::fs::PermissionsExt;
 
-    let mode = Permissions::from_mode(mode);
+    let mode = Permissions::from_mode(mode);
 
-    set_permissions(path, mode)
-        .map_err_context(|| format!("cannot set permissions {}", path.quote()))
+    set_permissions(path, mode)
+        .map_err_context(|| format!("cannot set permissions {}", path.quote()))
 }
 
-#[cfg(windows)]
-fn chmod(_path: &Path, _mode: u32) -> UResult<()> {
-    // chmod on Windows only sets the readonly flag, which isn't even honored on directories
-    Ok(())
+#[cfg(windows)]
+fn chmod(_path: &Path, _mode: u32) -> UResult<()> {
+    // chmod on Windows only sets the readonly flag, which isn't even honored on directories
+    Ok(())
 }
 
-fn create_dir(path: &Path, recursive: bool, verbose: bool) -> UResult<()> {
-    if path.exists() && !recursive {
-        return Err(USimpleError::new(
+fn create_dir(path: &Path, recursive: bool, verbose: bool) -> UResult<()> {
+    if path.exists() && !recursive {
+        return Err(USimpleError::new(
             1,
-            format!("{}: File exists", path.display()),
+            format!("{}: File exists", path.display()),
         ));
     }
-    if path == Path::new("") {
-        return Ok(());
+    if path == Path::new("") {
+        return Ok(());
     }
 
-    if recursive {
-        match path.parent() {
-            Some(p) => create_dir(p, recursive, verbose)?,
-            None => {
-                USimpleError::new(1, "failed to create whole tree");
+    if recursive {
+        match path.parent() {
+            Some(p) => create_dir(p, recursive, verbose)?,
+            None => {
+                USimpleError::new(1, "failed to create whole tree");
             }
         }
     }
-    match std::fs::create_dir(path) {
+    match std::fs::create_dir(path) {
         Ok(()) => {
-            if verbose {
+            if verbose {
                 println!(
                     "{}: created directory {}",
-                    uucore::util_name(),
-                    path.quote()
+                    uucore::util_name(),
+                    path.quote()
                 );
             }
             Ok(())
         }
-        Err(_) if path.is_dir() => Ok(()),
-        Err(e) => Err(e.into()),
+        Err(_) if path.is_dir() => Ok(()),
+        Err(e) => Err(e.into()),
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_mkfifo/mkfifo.rs.html b/dev/src/uu_mkfifo/mkfifo.rs.html index 84225f120..0d1c887f1 100644 --- a/dev/src/uu_mkfifo/mkfifo.rs.html +++ b/dev/src/uu_mkfifo/mkfifo.rs.html @@ -1,4 +1,4 @@ -mkfifo.rs - source
1
+mkfifo.rs - source
1
 2
 3
 4
@@ -105,69 +105,69 @@
 105
 106
 107
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Michael Gehring <mg@ebfe.org>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Michael Gehring <mg@ebfe.org>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use libc::mkfifo;
-use std::ffi::CString;
-use uucore::display::Quotable;
-use uucore::error::{UResult, USimpleError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use libc::mkfifo;
+use std::ffi::CString;
+use uucore::display::Quotable;
+use uucore::error::{UResult, USimpleError};
+use uucore::format_usage;
 
-static NAME: &str = "mkfifo";
-static USAGE: &str = "{} [OPTION]... NAME...";
-static ABOUT: &str = "Create a FIFO with the given name.";
+static NAME: &str = "mkfifo";
+static USAGE: &str = "{} [OPTION]... NAME...";
+static ABOUT: &str = "Create a FIFO with the given name.";
 
-mod options {
-    pub static MODE: &str = "mode";
-    pub static SE_LINUX_SECURITY_CONTEXT: &str = "Z";
-    pub static CONTEXT: &str = "context";
-    pub static FIFO: &str = "fifo";
+mod options {
+    pub static MODE: &str = "mode";
+    pub static SE_LINUX_SECURITY_CONTEXT: &str = "Z";
+    pub static CONTEXT: &str = "context";
+    pub static FIFO: &str = "fifo";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    if matches.contains_id(options::CONTEXT) {
-        return Err(USimpleError::new(1, "--context is not implemented"));
+    if matches.contains_id(options::CONTEXT) {
+        return Err(USimpleError::new(1, "--context is not implemented"));
     }
-    if matches.get_flag(options::SE_LINUX_SECURITY_CONTEXT) {
-        return Err(USimpleError::new(1, "-Z is not implemented"));
+    if matches.get_flag(options::SE_LINUX_SECURITY_CONTEXT) {
+        return Err(USimpleError::new(1, "-Z is not implemented"));
     }
 
-    let mode = match matches.get_one::<String>(options::MODE) {
-        Some(m) => match usize::from_str_radix(m, 8) {
-            Ok(m) => m,
-            Err(e) => return Err(USimpleError::new(1, format!("invalid mode: {}", e))),
+    let mode = match matches.get_one::<String>(options::MODE) {
+        Some(m) => match usize::from_str_radix(m, 8) {
+            Ok(m) => m,
+            Err(e) => return Err(USimpleError::new(1, format!("invalid mode: {}", e))),
         },
-        None => 0o666,
+        None => 0o666,
     };
 
-    let fifos: Vec<String> = match matches.get_many::<String>(options::FIFO) {
-        Some(v) => v.clone().map(|s| s.to_owned()).collect(),
-        None => return Err(USimpleError::new(1, "missing operand")),
+    let fifos: Vec<String> = match matches.get_many::<String>(options::FIFO) {
+        Some(v) => v.clone().map(|s| s.to_owned()).collect(),
+        None => return Err(USimpleError::new(1, "missing operand")),
     };
 
-    for f in fifos {
-        let err = unsafe {
-            let name = CString::new(f.as_bytes()).unwrap();
-            mkfifo(name.as_ptr(), mode as libc::mode_t)
+    for f in fifos {
+        let err = unsafe {
+            let name = CString::new(f.as_bytes()).unwrap();
+            mkfifo(name.as_ptr(), mode as libc::mode_t)
         };
-        if err == -1 {
-            show!(USimpleError::new(
+        if err == -1 {
+            show!(USimpleError::new(
                 1,
-                format!("cannot create fifo {}: File exists", f.quote())
+                format!("cannot create fifo {}: File exists", f.quote())
             ));
         }
     }
@@ -175,42 +175,42 @@
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::MODE)
-                .short('m')
-                .long(options::MODE)
-                .help("file permissions for the fifo")
-                .default_value("0666")
-                .value_name("MODE"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::MODE)
+                .short('m')
+                .long(options::MODE)
+                .help("file permissions for the fifo")
+                .default_value("0666")
+                .value_name("MODE"),
         )
-        .arg(
-            Arg::new(options::SE_LINUX_SECURITY_CONTEXT)
-                .short('Z')
-                .help("set the SELinux security context to default type")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SE_LINUX_SECURITY_CONTEXT)
+                .short('Z')
+                .help("set the SELinux security context to default type")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::CONTEXT)
-                .long(options::CONTEXT)
-                .value_name("CTX")
-                .help(
+        .arg(
+            Arg::new(options::CONTEXT)
+                .long(options::CONTEXT)
+                .value_name("CTX")
+                .help(
                     "like -Z, or if CTX is specified then set the SELinux \
                     or SMACK security context to CTX",
                 ),
         )
-        .arg(
-            Arg::new(options::FIFO)
-                .hide(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(options::FIFO)
+                .hide(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_mknod/mknod.rs.html b/dev/src/uu_mknod/mknod.rs.html index 4bc2dc2ec..e81be3424 100644 --- a/dev/src/uu_mknod/mknod.rs.html +++ b/dev/src/uu_mknod/mknod.rs.html @@ -1,4 +1,4 @@ -mknod.rs - source
1
+mknod.rs - source
1
 2
 3
 4
@@ -208,27 +208,27 @@
 208
 209
 210
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) parsemode makedev sysmacros perror IFBLK IFCHR IFIFO
+// spell-checker:ignore (ToDO) parsemode makedev sysmacros perror IFBLK IFCHR IFIFO
 
-use clap::{crate_version, value_parser, Arg, ArgMatches, Command};
-use libc::{dev_t, mode_t};
-use libc::{S_IFBLK, S_IFCHR, S_IFIFO, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR};
-use std::ffi::CString;
+use clap::{crate_version, value_parser, Arg, ArgMatches, Command};
+use libc::{dev_t, mode_t};
+use libc::{S_IFBLK, S_IFCHR, S_IFIFO, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR};
+use std::ffi::CString;
 
-use uucore::display::Quotable;
-use uucore::error::{set_exit_code, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
+use uucore::display::Quotable;
+use uucore::error::{set_exit_code, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
 
-static ABOUT: &str = "Create the special file NAME of the given TYPE.";
-static USAGE: &str = "{} [OPTION]... NAME TYPE [MAJOR MINOR]";
-static LONG_HELP: &str = "Mandatory arguments to long options are mandatory for short options too.
+static ABOUT: &str = "Create the special file NAME of the given TYPE.";
+static USAGE: &str = "{} [OPTION]... NAME TYPE [MAJOR MINOR]";
+static LONG_HELP: &str = "Mandatory arguments to long options are mandatory for short options too.
 -m, --mode=MODE    set file permission bits to MODE, not a=rw - umask
 --help     display this help and exit
 --version  output version information and exit
@@ -247,176 +247,176 @@ the version described here.  Please refer to your shell's documentation
 for details about the options it supports.
 ";
 
-const MODE_RW_UGO: mode_t = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+const MODE_RW_UGO: mode_t = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
 
-#[inline(always)]
-fn makedev(maj: u64, min: u64) -> dev_t {
-    // pick up from <sys/sysmacros.h>
-    ((min & 0xff) | ((maj & 0xfff) << 8) | ((min & !0xff) << 12) | ((maj & !0xfff) << 32)) as dev_t
+#[inline(always)]
+fn makedev(maj: u64, min: u64) -> dev_t {
+    // pick up from <sys/sysmacros.h>
+    ((min & 0xff) | ((maj & 0xfff) << 8) | ((min & !0xff) << 12) | ((maj & !0xfff) << 32)) as dev_t
 }
 
-#[cfg(windows)]
-fn _mknod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 {
+#[cfg(windows)]
+fn _mknod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 {
     panic!("Unsupported for windows platform")
 }
 
-#[derive(Clone, PartialEq)]
-enum FileType {
-    Block,
-    Character,
-    Fifo,
+#[derive(Clone, PartialEq)]
+enum FileType {
+    Block,
+    Character,
+    Fifo,
 }
 
-#[cfg(unix)]
-fn _mknod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 {
-    let c_str = CString::new(file_name).expect("Failed to convert to CString");
+#[cfg(unix)]
+fn _mknod(file_name: &str, mode: mode_t, dev: dev_t) -> i32 {
+    let c_str = CString::new(file_name).expect("Failed to convert to CString");
 
-    // the user supplied a mode
-    let set_umask = mode & MODE_RW_UGO != MODE_RW_UGO;
+    // the user supplied a mode
+    let set_umask = mode & MODE_RW_UGO != MODE_RW_UGO;
 
-    unsafe {
-        // store prev umask
-        let last_umask = if set_umask { libc::umask(0) } else { 0 };
+    unsafe {
+        // store prev umask
+        let last_umask = if set_umask { libc::umask(0) } else { 0 };
 
-        let errno = libc::mknod(c_str.as_ptr(), mode, dev);
+        let errno = libc::mknod(c_str.as_ptr(), mode, dev);
 
-        // set umask back to original value
-        if set_umask {
-            libc::umask(last_umask);
+        // set umask back to original value
+        if set_umask {
+            libc::umask(last_umask);
         }
 
-        if errno == -1 {
-            let c_str = CString::new(uucore::execution_phrase().as_bytes())
-                .expect("Failed to convert to CString");
-            // shows the error from the mknod syscall
-            libc::perror(c_str.as_ptr());
+        if errno == -1 {
+            let c_str = CString::new(uucore::execution_phrase().as_bytes())
+                .expect("Failed to convert to CString");
+            // shows the error from the mknod syscall
+            libc::perror(c_str.as_ptr());
         }
-        errno
+        errno
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
-    // Linux-specific options, not implemented
-    // opts.optflag("Z", "", "set the SELinux security context to default type");
-    // opts.optopt("", "context", "like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX");
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
+    // Linux-specific options, not implemented
+    // opts.optflag("Z", "", "set the SELinux security context to default type");
+    // opts.optopt("", "context", "like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX");
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let mode = get_mode(&matches).map_err(|e| USimpleError::new(1, e))?;
+    let mode = get_mode(&matches).map_err(|e| USimpleError::new(1, e))?;
 
-    let file_name = matches
-        .get_one::<String>("name")
-        .expect("Missing argument 'NAME'");
+    let file_name = matches
+        .get_one::<String>("name")
+        .expect("Missing argument 'NAME'");
 
-    let file_type = matches.get_one::<FileType>("type").unwrap();
+    let file_type = matches.get_one::<FileType>("type").unwrap();
 
-    if *file_type == FileType::Fifo {
-        if matches.contains_id("major") || matches.contains_id("minor") {
-            Err(UUsageError::new(
+    if *file_type == FileType::Fifo {
+        if matches.contains_id("major") || matches.contains_id("minor") {
+            Err(UUsageError::new(
                 1,
                 "Fifos do not have major and minor device numbers.",
             ))
-        } else {
-            let exit_code = _mknod(file_name, S_IFIFO | mode, 0);
-            set_exit_code(exit_code);
+        } else {
+            let exit_code = _mknod(file_name, S_IFIFO | mode, 0);
+            set_exit_code(exit_code);
             Ok(())
         }
-    } else {
-        match (
-            matches.get_one::<u64>("major"),
-            matches.get_one::<u64>("minor"),
+    } else {
+        match (
+            matches.get_one::<u64>("major"),
+            matches.get_one::<u64>("minor"),
         ) {
-            (_, None) | (None, _) => {
-                return Err(UUsageError::new(
+            (_, None) | (None, _) => {
+                return Err(UUsageError::new(
                     1,
                     "Special files require major and minor device numbers.",
                 ));
             }
-            (Some(&major), Some(&minor)) => {
-                let dev = makedev(major, minor);
-                let exit_code = match file_type {
-                    FileType::Block => _mknod(file_name, S_IFBLK | mode, dev),
-                    FileType::Character => _mknod(file_name, S_IFCHR | mode, dev),
-                    _ => unreachable!("file_type was validated to be only block or character"),
+            (Some(&major), Some(&minor)) => {
+                let dev = makedev(major, minor);
+                let exit_code = match file_type {
+                    FileType::Block => _mknod(file_name, S_IFBLK | mode, dev),
+                    FileType::Character => _mknod(file_name, S_IFCHR | mode, dev),
+                    _ => unreachable!("file_type was validated to be only block or character"),
                 };
-                set_exit_code(exit_code);
+                set_exit_code(exit_code);
                 Ok(())
             }
         }
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .after_help(LONG_HELP)
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new("mode")
-                .short('m')
-                .long("mode")
-                .value_name("MODE")
-                .help("set file permission bits to MODE, not a=rw - umask"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .after_help(LONG_HELP)
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new("mode")
+                .short('m')
+                .long("mode")
+                .value_name("MODE")
+                .help("set file permission bits to MODE, not a=rw - umask"),
         )
-        .arg(
-            Arg::new("name")
-                .value_name("NAME")
-                .help("name of the new file")
-                .required(true)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new("name")
+                .value_name("NAME")
+                .help("name of the new file")
+                .required(true)
+                .value_hint(clap::ValueHint::AnyPath),
         )
-        .arg(
-            Arg::new("type")
-                .value_name("TYPE")
-                .help("type of the new file (b, c, u or p)")
-                .required(true)
-                .value_parser(parse_type),
+        .arg(
+            Arg::new("type")
+                .value_name("TYPE")
+                .help("type of the new file (b, c, u or p)")
+                .required(true)
+                .value_parser(parse_type),
         )
-        .arg(
-            Arg::new("major")
-                .value_name("MAJOR")
-                .help("major file type")
-                .value_parser(value_parser!(u64)),
+        .arg(
+            Arg::new("major")
+                .value_name("MAJOR")
+                .help("major file type")
+                .value_parser(value_parser!(u64)),
         )
-        .arg(
-            Arg::new("minor")
-                .value_name("MINOR")
-                .help("minor file type")
-                .value_parser(value_parser!(u64)),
+        .arg(
+            Arg::new("minor")
+                .value_name("MINOR")
+                .help("minor file type")
+                .value_parser(value_parser!(u64)),
         )
 }
 
-fn get_mode(matches: &ArgMatches) -> Result<mode_t, String> {
-    match matches.get_one::<String>("mode") {
-        None => Ok(MODE_RW_UGO),
-        Some(str_mode) => uucore::mode::parse_mode(str_mode)
-            .map_err(|e| format!("invalid mode ({})", e))
-            .and_then(|mode| {
-                if mode > 0o777 {
-                    Err("mode must specify only file permission bits".to_string())
-                } else {
-                    Ok(mode)
+fn get_mode(matches: &ArgMatches) -> Result<mode_t, String> {
+    match matches.get_one::<String>("mode") {
+        None => Ok(MODE_RW_UGO),
+        Some(str_mode) => uucore::mode::parse_mode(str_mode)
+            .map_err(|e| format!("invalid mode ({})", e))
+            .and_then(|mode| {
+                if mode > 0o777 {
+                    Err("mode must specify only file permission bits".to_string())
+                } else {
+                    Ok(mode)
                 }
             }),
     }
 }
 
-fn parse_type(tpe: &str) -> Result<FileType, String> {
-    // Only check the first character, to allow mnemonic usage like
-    // 'mknod /dev/rst0 character 18 0'.
-    tpe.chars()
-        .next()
-        .ok_or_else(|| "missing device type".to_string())
-        .and_then(|first_char| match first_char {
-            'b' => Ok(FileType::Block),
-            'c' | 'u' => Ok(FileType::Character),
-            'p' => Ok(FileType::Fifo),
-            _ => Err(format!("invalid device type {}", tpe.quote())),
+fn parse_type(tpe: &str) -> Result<FileType, String> {
+    // Only check the first character, to allow mnemonic usage like
+    // 'mknod /dev/rst0 character 18 0'.
+    tpe.chars()
+        .next()
+        .ok_or_else(|| "missing device type".to_string())
+        .and_then(|first_char| match first_char {
+            'b' => Ok(FileType::Block),
+            'c' | 'u' => Ok(FileType::Character),
+            'p' => Ok(FileType::Fifo),
+            _ => Err(format!("invalid device type {}", tpe.quote())),
         })
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_mktemp/mktemp.rs.html b/dev/src/uu_mktemp/mktemp.rs.html index e946b5d08..a4740f47e 100644 --- a/dev/src/uu_mktemp/mktemp.rs.html +++ b/dev/src/uu_mktemp/mktemp.rs.html @@ -1,4 +1,4 @@ -mktemp.rs - source
1
+mktemp.rs - source
1
 2
 3
 4
@@ -579,586 +579,592 @@
 579
 580
 581
-
// This file is part of the uutils coreutils package.
-//
-// (c) Sunrin SHIMURA
-// Collaborator: Jian Zeng
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+582
+583
+584
+
// This file is part of the uutils coreutils package.
+//
+// (c) Sunrin SHIMURA
+// Collaborator: Jian Zeng
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (paths) GPGHome findxs
+// spell-checker:ignore (paths) GPGHome findxs
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use uucore::display::{println_verbatim, Quotable};
-use uucore::error::{FromIo, UError, UResult, UUsageError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use uucore::display::{println_verbatim, Quotable};
+use uucore::error::{FromIo, UError, UResult, UUsageError};
+use uucore::format_usage;
 
-use std::env;
-use std::error::Error;
-use std::fmt::Display;
-use std::io::ErrorKind;
-use std::iter;
-use std::path::{Path, PathBuf, MAIN_SEPARATOR};
+use std::env;
+use std::error::Error;
+use std::fmt::Display;
+use std::io::ErrorKind;
+use std::iter;
+use std::path::{Path, PathBuf, MAIN_SEPARATOR};
 
-#[cfg(unix)]
-use std::fs;
-#[cfg(unix)]
-use std::os::unix::prelude::PermissionsExt;
+#[cfg(unix)]
+use std::fs;
+#[cfg(unix)]
+use std::os::unix::prelude::PermissionsExt;
 
-use rand::Rng;
-use tempfile::Builder;
+use rand::Rng;
+use tempfile::Builder;
 
-static ABOUT: &str = "create a temporary file or directory.";
-const USAGE: &str = "{} [OPTION]... [TEMPLATE]";
+static ABOUT: &str = "create a temporary file or directory.";
+const USAGE: &str = "{} [OPTION]... [TEMPLATE]";
 
-static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX";
+static DEFAULT_TEMPLATE: &str = "tmp.XXXXXXXXXX";
 
-static OPT_DIRECTORY: &str = "directory";
-static OPT_DRY_RUN: &str = "dry-run";
-static OPT_QUIET: &str = "quiet";
-static OPT_SUFFIX: &str = "suffix";
-static OPT_TMPDIR: &str = "tmpdir";
-static OPT_T: &str = "t";
+static OPT_DIRECTORY: &str = "directory";
+static OPT_DRY_RUN: &str = "dry-run";
+static OPT_QUIET: &str = "quiet";
+static OPT_SUFFIX: &str = "suffix";
+static OPT_TMPDIR: &str = "tmpdir";
+static OPT_T: &str = "t";
 
-static ARG_TEMPLATE: &str = "template";
+static ARG_TEMPLATE: &str = "template";
 
-#[derive(Debug)]
-enum MkTempError {
-    PersistError(PathBuf),
-    MustEndInX(String),
-    TooFewXs(String),
+#[derive(Debug)]
+enum MkTempError {
+    PersistError(PathBuf),
+    MustEndInX(String),
+    TooFewXs(String),
 
-    /// The template prefix contains a path separator (e.g. `"a/bXXX"`).
-    PrefixContainsDirSeparator(String),
+    /// The template prefix contains a path separator (e.g. `"a/bXXX"`).
+    PrefixContainsDirSeparator(String),
 
-    /// The template suffix contains a path separator (e.g. `"XXXa/b"`).
-    SuffixContainsDirSeparator(String),
-    InvalidTemplate(String),
-    TooManyTemplates,
+    /// The template suffix contains a path separator (e.g. `"XXXa/b"`).
+    SuffixContainsDirSeparator(String),
+    InvalidTemplate(String),
+    TooManyTemplates,
 
-    /// When a specified temporary directory could not be found.
-    NotFound(String, String),
+    /// When a specified temporary directory could not be found.
+    NotFound(String, String),
 }
 
-impl UError for MkTempError {
-    fn usage(&self) -> bool {
-        matches!(self, Self::TooManyTemplates)
+impl UError for MkTempError {
+    fn usage(&self) -> bool {
+        matches!(self, Self::TooManyTemplates)
     }
 }
 
-impl Error for MkTempError {}
+impl Error for MkTempError {}
 
-impl Display for MkTempError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        use MkTempError::*;
-        match self {
-            PersistError(p) => write!(f, "could not persist file {}", p.quote()),
-            MustEndInX(s) => write!(f, "with --suffix, template {} must end in X", s.quote()),
-            TooFewXs(s) => write!(f, "too few X's in template {}", s.quote()),
-            PrefixContainsDirSeparator(s) => {
+impl Display for MkTempError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        use MkTempError::*;
+        match self {
+            PersistError(p) => write!(f, "could not persist file {}", p.quote()),
+            MustEndInX(s) => write!(f, "with --suffix, template {} must end in X", s.quote()),
+            TooFewXs(s) => write!(f, "too few X's in template {}", s.quote()),
+            PrefixContainsDirSeparator(s) => {
                 write!(
-                    f,
+                    f,
                     "invalid template, {}, contains directory separator",
-                    s.quote()
+                    s.quote()
                 )
             }
-            SuffixContainsDirSeparator(s) => {
+            SuffixContainsDirSeparator(s) => {
                 write!(
-                    f,
+                    f,
                     "invalid suffix {}, contains directory separator",
-                    s.quote()
+                    s.quote()
                 )
             }
-            InvalidTemplate(s) => write!(
-                f,
+            InvalidTemplate(s) => write!(
+                f,
                 "invalid template, {}; with --tmpdir, it may not be absolute",
-                s.quote()
+                s.quote()
             ),
-            TooManyTemplates => {
-                write!(f, "too many templates")
+            TooManyTemplates => {
+                write!(f, "too many templates")
             }
-            NotFound(template_type, s) => write!(
-                f,
+            NotFound(template_type, s) => write!(
+                f,
                 "failed to create {} via template {}: No such file or directory",
-                template_type,
-                s.quote()
+                template_type,
+                s.quote()
             ),
         }
     }
 }
 
-/// Options parsed from the command-line.
-///
-/// This provides a layer of indirection between the application logic
-/// and the argument parsing library `clap`, allowing each to vary
-/// independently.
-struct Options {
-    /// Whether to create a temporary directory instead of a file.
-    directory: bool,
+/// Options parsed from the command-line.
+///
+/// This provides a layer of indirection between the application logic
+/// and the argument parsing library `clap`, allowing each to vary
+/// independently.
+struct Options {
+    /// Whether to create a temporary directory instead of a file.
+    directory: bool,
 
-    /// Whether to just print the name of a file that would have been created.
-    dry_run: bool,
+    /// Whether to just print the name of a file that would have been created.
+    dry_run: bool,
 
-    /// Whether to suppress file creation error messages.
-    quiet: bool,
+    /// Whether to suppress file creation error messages.
+    quiet: bool,
 
-    /// The directory in which to create the temporary file.
-    ///
-    /// If `None`, the file will be created in the current directory.
-    tmpdir: Option<String>,
+    /// The directory in which to create the temporary file.
+    ///
+    /// If `None`, the file will be created in the current directory.
+    tmpdir: Option<String>,
 
-    /// The suffix to append to the temporary file, if any.
-    suffix: Option<String>,
+    /// The suffix to append to the temporary file, if any.
+    suffix: Option<String>,
 
-    /// Whether to treat the template argument as a single file path component.
-    treat_as_template: bool,
+    /// Whether to treat the template argument as a single file path component.
+    treat_as_template: bool,
 
-    /// The template to use for the name of the temporary file.
-    template: String,
+    /// The template to use for the name of the temporary file.
+    template: String,
 }
 
-/// Decide whether the argument to `--tmpdir` should actually be the template.
-///
-/// This function is required to work around a limitation of `clap`,
-/// the command-line argument parsing library. In case the command
-/// line is
-///
-/// ```sh
-/// mktemp --tmpdir XXX
-/// ```
-///
-/// the program should behave like
-///
-/// ```sh
-/// mktemp --tmpdir=${TMPDIR:-/tmp} XXX
-/// ```
-///
-/// However, `clap` thinks that `XXX` is the value of the `--tmpdir`
-/// option. This function returns `true` in this case and `false`
-/// in all other cases.
-fn is_tmpdir_argument_actually_the_template(matches: &ArgMatches) -> bool {
-    if !matches.contains_id(ARG_TEMPLATE) {
-        if let Some(tmpdir) = matches.get_one::<String>(OPT_TMPDIR) {
-            if !Path::new(tmpdir).is_dir() && tmpdir.contains("XXX") {
-                return true;
+/// Decide whether the argument to `--tmpdir` should actually be the template.
+///
+/// This function is required to work around a limitation of `clap`,
+/// the command-line argument parsing library. In case the command
+/// line is
+///
+/// ```sh
+/// mktemp --tmpdir XXX
+/// ```
+///
+/// the program should behave like
+///
+/// ```sh
+/// mktemp --tmpdir=${TMPDIR:-/tmp} XXX
+/// ```
+///
+/// However, `clap` thinks that `XXX` is the value of the `--tmpdir`
+/// option. This function returns `true` in this case and `false`
+/// in all other cases.
+fn is_tmpdir_argument_actually_the_template(matches: &ArgMatches) -> bool {
+    if !matches.contains_id(ARG_TEMPLATE) {
+        if let Some(tmpdir) = matches.get_one::<String>(OPT_TMPDIR) {
+            if !Path::new(tmpdir).is_dir() && tmpdir.contains("XXX") {
+                return true;
             }
         }
     }
-    false
-}
+    false
+}
 
-impl Options {
-    fn from(matches: &ArgMatches) -> Self {
-        // Special case to work around a limitation of `clap`; see
-        // `is_tmpdir_argument_actually_the_template()` for more
-        // information.
-        //
-        // Fixed in clap 3
-        // See https://github.com/clap-rs/clap/pull/1587
-        let (tmpdir, template) = if is_tmpdir_argument_actually_the_template(matches) {
-            let tmpdir = Some(env::temp_dir().display().to_string());
-            let template = matches.get_one::<String>(OPT_TMPDIR).unwrap().to_string();
-            (tmpdir, template)
-        } else {
-            // If no template argument is given, `--tmpdir` is implied.
-            match matches.get_one::<String>(ARG_TEMPLATE) {
-                None => {
-                    let tmpdir = match matches.get_one::<String>(OPT_TMPDIR) {
-                        None => Some(env::temp_dir().display().to_string()),
-                        Some(tmpdir) => Some(tmpdir.to_string()),
+impl Options {
+    fn from(matches: &ArgMatches) -> Self {
+        // Special case to work around a limitation of `clap`; see
+        // `is_tmpdir_argument_actually_the_template()` for more
+        // information.
+        //
+        // Fixed in clap 3
+        // See https://github.com/clap-rs/clap/pull/1587
+        let (tmpdir, template) = if is_tmpdir_argument_actually_the_template(matches) {
+            let tmpdir = Some(env::temp_dir().display().to_string());
+            let template = matches.get_one::<String>(OPT_TMPDIR).unwrap().to_string();
+            (tmpdir, template)
+        } else {
+            // If no template argument is given, `--tmpdir` is implied.
+            match matches.get_one::<String>(ARG_TEMPLATE) {
+                None => {
+                    let tmpdir = match matches.get_one::<String>(OPT_TMPDIR) {
+                        None => Some(env::temp_dir().display().to_string()),
+                        Some(tmpdir) => Some(tmpdir.to_string()),
                     };
-                    let template = DEFAULT_TEMPLATE;
-                    (tmpdir, template.to_string())
+                    let template = DEFAULT_TEMPLATE;
+                    (tmpdir, template.to_string())
                 }
-                Some(template) => {
-                    let tmpdir = matches.get_one::<String>(OPT_TMPDIR).map(String::from);
-                    (tmpdir, template.to_string())
+                Some(template) => {
+                    let tmpdir = matches.get_one::<String>(OPT_TMPDIR).map(String::from);
+                    (tmpdir, template.to_string())
                 }
             }
         };
-        Self {
-            directory: matches.get_flag(OPT_DIRECTORY),
-            dry_run: matches.get_flag(OPT_DRY_RUN),
-            quiet: matches.get_flag(OPT_QUIET),
-            tmpdir,
-            suffix: matches.get_one::<String>(OPT_SUFFIX).map(String::from),
-            treat_as_template: matches.get_flag(OPT_T),
-            template,
+        Self {
+            directory: matches.get_flag(OPT_DIRECTORY),
+            dry_run: matches.get_flag(OPT_DRY_RUN),
+            quiet: matches.get_flag(OPT_QUIET),
+            tmpdir,
+            suffix: matches.get_one::<String>(OPT_SUFFIX).map(String::from),
+            treat_as_template: matches.get_flag(OPT_T),
+            template,
         }
     }
 }
 
-/// Parameters that control the path to and name of the temporary file.
-///
-/// The temporary file will be created at
-///
-/// ```text
-/// {directory}/{prefix}{XXX}{suffix}
-/// ```
-///
-/// where `{XXX}` is a sequence of random characters whose length is
-/// `num_rand_chars`.
-struct Params {
-    /// The directory that will contain the temporary file.
-    directory: String,
+/// Parameters that control the path to and name of the temporary file.
+///
+/// The temporary file will be created at
+///
+/// ```text
+/// {directory}/{prefix}{XXX}{suffix}
+/// ```
+///
+/// where `{XXX}` is a sequence of random characters whose length is
+/// `num_rand_chars`.
+struct Params {
+    /// The directory that will contain the temporary file.
+    directory: String,
 
-    /// The (non-random) prefix of the temporary file.
-    prefix: String,
+    /// The (non-random) prefix of the temporary file.
+    prefix: String,
 
-    /// The number of random characters in the name of the temporary file.
-    num_rand_chars: usize,
+    /// The number of random characters in the name of the temporary file.
+    num_rand_chars: usize,
 
-    /// The (non-random) suffix of the temporary file.
-    suffix: String,
+    /// The (non-random) suffix of the temporary file.
+    suffix: String,
 }
 
-/// Find the start and end indices of the last contiguous block of Xs.
-///
-/// If no contiguous block of at least three Xs could be found, this
-/// function returns `None`.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// assert_eq!(find_last_contiguous_block_of_xs("XXX_XXX"), Some((4, 7)));
-/// assert_eq!(find_last_contiguous_block_of_xs("aXbXcX"), None);
-/// ```
-fn find_last_contiguous_block_of_xs(s: &str) -> Option<(usize, usize)> {
-    let j = s.rfind("XXX")? + 3;
-    let i = s[..j].rfind(|c| c != 'X').map_or(0, |i| i + 1);
-    Some((i, j))
+/// Find the start and end indices of the last contiguous block of Xs.
+///
+/// If no contiguous block of at least three Xs could be found, this
+/// function returns `None`.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// assert_eq!(find_last_contiguous_block_of_xs("XXX_XXX"), Some((4, 7)));
+/// assert_eq!(find_last_contiguous_block_of_xs("aXbXcX"), None);
+/// ```
+fn find_last_contiguous_block_of_xs(s: &str) -> Option<(usize, usize)> {
+    let j = s.rfind("XXX")? + 3;
+    let i = s[..j].rfind(|c| c != 'X').map_or(0, |i| i + 1);
+    Some((i, j))
 }
 
-impl Params {
-    fn from(options: Options) -> Result<Self, MkTempError> {
-        // The template argument must end in 'X' if a suffix option is given.
-        if options.suffix.is_some() && !options.template.ends_with('X') {
-            return Err(MkTempError::MustEndInX(options.template));
+impl Params {
+    fn from(options: Options) -> Result<Self, MkTempError> {
+        // The template argument must end in 'X' if a suffix option is given.
+        if options.suffix.is_some() && !options.template.ends_with('X') {
+            return Err(MkTempError::MustEndInX(options.template));
         }
 
-        // Get the start and end indices of the randomized part of the template.
-        //
-        // For example, if the template is "abcXXXXyz", then `i` is 3 and `j` is 7.
-        let (i, j) = match find_last_contiguous_block_of_xs(&options.template) {
-            None => {
-                let s = match options.suffix {
-                    None => options.template,
-                    Some(s) => format!("{}{}", options.template, s),
+        // Get the start and end indices of the randomized part of the template.
+        //
+        // For example, if the template is "abcXXXXyz", then `i` is 3 and `j` is 7.
+        let (i, j) = match find_last_contiguous_block_of_xs(&options.template) {
+            None => {
+                let s = match options.suffix {
+                    None => options.template,
+                    Some(s) => format!("{}{}", options.template, s),
                 };
-                return Err(MkTempError::TooFewXs(s));
+                return Err(MkTempError::TooFewXs(s));
             }
-            Some(indices) => indices,
+            Some(indices) => indices,
         };
 
-        // Combine the directory given as an option and the prefix of the template.
-        //
-        // For example, if `tmpdir` is "a/b" and the template is "c/dXXX",
-        // then `prefix` is "a/b/c/d".
-        let tmpdir = options.tmpdir;
-        let prefix_from_option = tmpdir.clone().unwrap_or_default();
-        let prefix_from_template = &options.template[..i];
-        let prefix = Path::new(&prefix_from_option)
-            .join(prefix_from_template)
-            .display()
-            .to_string();
-        if options.treat_as_template && prefix.contains(MAIN_SEPARATOR) {
-            return Err(MkTempError::PrefixContainsDirSeparator(options.template));
+        // Combine the directory given as an option and the prefix of the template.
+        //
+        // For example, if `tmpdir` is "a/b" and the template is "c/dXXX",
+        // then `prefix` is "a/b/c/d".
+        let tmpdir = options.tmpdir;
+        let prefix_from_option = tmpdir.clone().unwrap_or_default();
+        let prefix_from_template = &options.template[..i];
+        let prefix = Path::new(&prefix_from_option)
+            .join(prefix_from_template)
+            .display()
+            .to_string();
+        if options.treat_as_template && prefix.contains(MAIN_SEPARATOR) {
+            return Err(MkTempError::PrefixContainsDirSeparator(options.template));
         }
-        if tmpdir.is_some() && Path::new(prefix_from_template).is_absolute() {
-            return Err(MkTempError::InvalidTemplate(options.template));
+        if tmpdir.is_some() && Path::new(prefix_from_template).is_absolute() {
+            return Err(MkTempError::InvalidTemplate(options.template));
         }
 
-        // Split the parent directory from the file part of the prefix.
-        //
-        // For example, if `prefix` is "a/b/c/d", then `directory` is
-        // "a/b/c" is `prefix` gets reassigned to "d".
-        let (directory, prefix) = if prefix.ends_with(MAIN_SEPARATOR) {
-            (prefix, "".to_string())
-        } else {
-            let path = Path::new(&prefix);
-            let directory = match path.parent() {
-                None => String::new(),
-                Some(d) => d.display().to_string(),
+        // Split the parent directory from the file part of the prefix.
+        //
+        // For example, if `prefix` is "a/b/c/d", then `directory` is
+        // "a/b/c" is `prefix` gets reassigned to "d".
+        let (directory, prefix) = if prefix.ends_with(MAIN_SEPARATOR) {
+            (prefix, "".to_string())
+        } else {
+            let path = Path::new(&prefix);
+            let directory = match path.parent() {
+                None => String::new(),
+                Some(d) => d.display().to_string(),
             };
-            let prefix = match path.file_name() {
-                None => String::new(),
-                Some(f) => f.to_str().unwrap().to_string(),
+            let prefix = match path.file_name() {
+                None => String::new(),
+                Some(f) => f.to_str().unwrap().to_string(),
             };
-            (directory, prefix)
+            (directory, prefix)
         };
 
-        // Combine the suffix from the template with the suffix given as an option.
-        //
-        // For example, if the suffix command-line argument is ".txt" and
-        // the template is "XXXabc", then `suffix` is "abc.txt".
-        let suffix_from_option = options.suffix.unwrap_or_default();
-        let suffix_from_template = &options.template[j..];
-        let suffix = format!("{}{}", suffix_from_template, suffix_from_option);
-        if suffix.contains(MAIN_SEPARATOR) {
-            return Err(MkTempError::SuffixContainsDirSeparator(suffix));
+        // Combine the suffix from the template with the suffix given as an option.
+        //
+        // For example, if the suffix command-line argument is ".txt" and
+        // the template is "XXXabc", then `suffix` is "abc.txt".
+        let suffix_from_option = options.suffix.unwrap_or_default();
+        let suffix_from_template = &options.template[j..];
+        let suffix = format!("{}{}", suffix_from_template, suffix_from_option);
+        if suffix.contains(MAIN_SEPARATOR) {
+            return Err(MkTempError::SuffixContainsDirSeparator(suffix));
         }
 
-        // The number of random characters in the template.
-        //
-        // For example, if the template is "abcXXXXyz", then the number of
-        // random characters is four.
-        let num_rand_chars = j - i;
+        // The number of random characters in the template.
+        //
+        // For example, if the template is "abcXXXXyz", then the number of
+        // random characters is four.
+        let num_rand_chars = j - i;
 
-        Ok(Self {
-            directory,
-            prefix,
-            num_rand_chars,
-            suffix,
+        Ok(Self {
+            directory,
+            prefix,
+            num_rand_chars,
+            suffix,
         })
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = match uu_app().try_get_matches_from(&args) {
-        Ok(m) => m,
-        Err(e) => {
-            if e.kind() == clap::error::ErrorKind::TooManyValues
-                && e.context().any(|(kind, val)| {
-                    kind == clap::error::ContextKind::InvalidArg
-                        && val == &clap::error::ContextValue::String("[template]".into())
+    let matches = match uu_app().try_get_matches_from(&args) {
+        Ok(m) => m,
+        Err(e) => {
+            if e.kind() == clap::error::ErrorKind::TooManyValues
+                && e.context().any(|(kind, val)| {
+                    kind == clap::error::ContextKind::InvalidArg
+                        && val == &clap::error::ContextValue::String("[template]".into())
                 })
             {
-                return Err(UUsageError::new(1, "too many templates"));
+                return Err(UUsageError::new(1, "too many templates"));
             }
-            return Err(e.into());
+            return Err(e.into());
         }
     };
 
-    // Parse command-line options into a format suitable for the
-    // application logic.
-    let options = Options::from(&matches);
+    // Parse command-line options into a format suitable for the
+    // application logic.
+    let options = Options::from(&matches);
 
-    if env::var("POSIXLY_CORRECT").is_ok() {
-        // If POSIXLY_CORRECT was set, template MUST be the last argument.
-        if is_tmpdir_argument_actually_the_template(&matches) || matches.contains_id(ARG_TEMPLATE) {
-            // Template argument was provided, check if was the last one.
-            if args.last().unwrap() != &options.template {
-                return Err(Box::new(MkTempError::TooManyTemplates));
+    if env::var("POSIXLY_CORRECT").is_ok() {
+        // If POSIXLY_CORRECT was set, template MUST be the last argument.
+        if is_tmpdir_argument_actually_the_template(&matches) || matches.contains_id(ARG_TEMPLATE) {
+            // Template argument was provided, check if was the last one.
+            if args.last().unwrap() != &options.template {
+                return Err(Box::new(MkTempError::TooManyTemplates));
             }
         }
     }
 
-    let dry_run = options.dry_run;
-    let suppress_file_err = options.quiet;
-    let make_dir = options.directory;
+    let dry_run = options.dry_run;
+    let suppress_file_err = options.quiet;
+    let make_dir = options.directory;
 
-    // Parse file path parameters from the command-line options.
-    let Params {
-        directory: tmpdir,
-        prefix,
-        num_rand_chars: rand,
-        suffix,
-    } = Params::from(options)?;
+    // Parse file path parameters from the command-line options.
+    let Params {
+        directory: tmpdir,
+        prefix,
+        num_rand_chars: rand,
+        suffix,
+    } = Params::from(options)?;
 
-    // Create the temporary file or directory, or simulate creating it.
-    let res = if dry_run {
-        dry_exec(&tmpdir, &prefix, rand, &suffix)
-    } else {
-        exec(&tmpdir, &prefix, rand, &suffix, make_dir)
+    // Create the temporary file or directory, or simulate creating it.
+    let res = if dry_run {
+        dry_exec(&tmpdir, &prefix, rand, &suffix)
+    } else {
+        exec(&tmpdir, &prefix, rand, &suffix, make_dir)
     };
 
-    if suppress_file_err {
-        // Mapping all UErrors to ExitCodes prevents the errors from being printed
-        res.map_err(|e| e.code().into())
-    } else {
-        res
+    if suppress_file_err {
+        // Mapping all UErrors to ExitCodes prevents the errors from being printed
+        res.map_err(|e| e.code().into())
+    } else {
+        res
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_DIRECTORY)
-                .short('d')
-                .long(OPT_DIRECTORY)
-                .help("Make a directory instead of a file")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_DIRECTORY)
+                .short('d')
+                .long(OPT_DIRECTORY)
+                .help("Make a directory instead of a file")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_DRY_RUN)
-                .short('u')
-                .long(OPT_DRY_RUN)
-                .help("do not create anything; merely print a name (unsafe)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_DRY_RUN)
+                .short('u')
+                .long(OPT_DRY_RUN)
+                .help("do not create anything; merely print a name (unsafe)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_QUIET)
-                .short('q')
-                .long("quiet")
-                .help("Fail silently if an error occurs.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_QUIET)
+                .short('q')
+                .long("quiet")
+                .help("Fail silently if an error occurs.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_SUFFIX)
-                .long(OPT_SUFFIX)
-                .help(
+        .arg(
+            Arg::new(OPT_SUFFIX)
+                .long(OPT_SUFFIX)
+                .help(
                     "append SUFFIX to TEMPLATE; SUFFIX must not contain a path separator. \
                      This option is implied if TEMPLATE does not end with X.",
                 )
-                .value_name("SUFFIX"),
+                .value_name("SUFFIX"),
         )
-        .arg(
-            Arg::new(OPT_TMPDIR)
-                .short('p')
-                .long(OPT_TMPDIR)
-                .help(
+        .arg(
+            Arg::new(OPT_TMPDIR)
+                .short('p')
+                .long(OPT_TMPDIR)
+                .help(
                     "interpret TEMPLATE relative to DIR; if DIR is not specified, use \
                      $TMPDIR ($TMP on windows) if set, else /tmp. With this option, \
                      TEMPLATE must not be an absolute name; unlike with -t, TEMPLATE \
                      may contain slashes, but mktemp creates only the final component",
                 )
-                .value_name("DIR")
-                .value_hint(clap::ValueHint::DirPath),
+                .value_name("DIR")
+                // Allows use of default argument just by setting --tmpdir. Else,
+                // use provided input to generate tmpdir
+                .num_args(0..=1)
+                .value_hint(clap::ValueHint::DirPath),
         )
-        .arg(
-            Arg::new(OPT_T)
-                .short('t')
-                .help(
+        .arg(
+            Arg::new(OPT_T)
+                .short('t')
+                .help(
                     "Generate a template (using the supplied prefix and TMPDIR \
                 (TMP on windows) if set) to create a filename template [deprecated]",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(Arg::new(ARG_TEMPLATE).num_args(..=1))
+        .arg(Arg::new(ARG_TEMPLATE).num_args(..=1))
 }
 
-pub fn dry_exec(tmpdir: &str, prefix: &str, rand: usize, suffix: &str) -> UResult<()> {
-    let len = prefix.len() + suffix.len() + rand;
-    let mut buf = Vec::with_capacity(len);
-    buf.extend(prefix.as_bytes());
-    buf.extend(iter::repeat(b'X').take(rand));
-    buf.extend(suffix.as_bytes());
+pub fn dry_exec(tmpdir: &str, prefix: &str, rand: usize, suffix: &str) -> UResult<()> {
+    let len = prefix.len() + suffix.len() + rand;
+    let mut buf = Vec::with_capacity(len);
+    buf.extend(prefix.as_bytes());
+    buf.extend(iter::repeat(b'X').take(rand));
+    buf.extend(suffix.as_bytes());
 
-    // Randomize.
-    let bytes = &mut buf[prefix.len()..prefix.len() + rand];
-    rand::thread_rng().fill(bytes);
-    for byte in bytes.iter_mut() {
-        *byte = match *byte % 62 {
-            v @ 0..=9 => v + b'0',
-            v @ 10..=35 => v - 10 + b'a',
-            v @ 36..=61 => v - 36 + b'A',
-            _ => unreachable!(),
+    // Randomize.
+    let bytes = &mut buf[prefix.len()..prefix.len() + rand];
+    rand::thread_rng().fill(bytes);
+    for byte in bytes.iter_mut() {
+        *byte = match *byte % 62 {
+            v @ 0..=9 => v + b'0',
+            v @ 10..=35 => v - 10 + b'a',
+            v @ 36..=61 => v - 36 + b'A',
+            _ => unreachable!(),
         }
     }
-    // We guarantee utf8.
-    let buf = String::from_utf8(buf).unwrap();
-    let tmpdir = Path::new(tmpdir).join(buf);
-    println_verbatim(tmpdir).map_err_context(|| "failed to print directory name".to_owned())
+    // We guarantee utf8.
+    let buf = String::from_utf8(buf).unwrap();
+    let tmpdir = Path::new(tmpdir).join(buf);
+    println_verbatim(tmpdir).map_err_context(|| "failed to print directory name".to_owned())
 }
 
-/// Create a temporary directory with the given parameters.
-///
-/// This function creates a temporary directory as a subdirectory of
-/// `dir`. The name of the directory is the concatenation of `prefix`,
-/// a string of `rand` random characters, and `suffix`. The
-/// permissions of the directory are set to `u+rwx`
-///
-/// # Errors
-///
-/// If the temporary directory could not be written to disk or if the
-/// given directory `dir` does not exist.
-fn make_temp_dir(dir: &str, prefix: &str, rand: usize, suffix: &str) -> UResult<PathBuf> {
-    let mut builder = Builder::new();
-    builder.prefix(prefix).rand_bytes(rand).suffix(suffix);
-    match builder.tempdir_in(dir) {
-        Ok(d) => {
-            // `into_path` consumes the TempDir without removing it
-            let path = d.into_path();
-            #[cfg(not(windows))]
-            fs::set_permissions(&path, fs::Permissions::from_mode(0o700))?;
-            Ok(path)
+/// Create a temporary directory with the given parameters.
+///
+/// This function creates a temporary directory as a subdirectory of
+/// `dir`. The name of the directory is the concatenation of `prefix`,
+/// a string of `rand` random characters, and `suffix`. The
+/// permissions of the directory are set to `u+rwx`
+///
+/// # Errors
+///
+/// If the temporary directory could not be written to disk or if the
+/// given directory `dir` does not exist.
+fn make_temp_dir(dir: &str, prefix: &str, rand: usize, suffix: &str) -> UResult<PathBuf> {
+    let mut builder = Builder::new();
+    builder.prefix(prefix).rand_bytes(rand).suffix(suffix);
+    match builder.tempdir_in(dir) {
+        Ok(d) => {
+            // `into_path` consumes the TempDir without removing it
+            let path = d.into_path();
+            #[cfg(not(windows))]
+            fs::set_permissions(&path, fs::Permissions::from_mode(0o700))?;
+            Ok(path)
         }
-        Err(e) if e.kind() == ErrorKind::NotFound => {
-            let filename = format!("{}{}{}", prefix, "X".repeat(rand), suffix);
-            let path = Path::new(dir).join(filename);
-            let s = path.display().to_string();
-            Err(MkTempError::NotFound("directory".to_string(), s).into())
+        Err(e) if e.kind() == ErrorKind::NotFound => {
+            let filename = format!("{}{}{}", prefix, "X".repeat(rand), suffix);
+            let path = Path::new(dir).join(filename);
+            let s = path.display().to_string();
+            Err(MkTempError::NotFound("directory".to_string(), s).into())
         }
-        Err(e) => Err(e.into()),
+        Err(e) => Err(e.into()),
     }
 }
 
-/// Create a temporary file with the given parameters.
-///
-/// This function creates a temporary file in the directory `dir`. The
-/// name of the file is the concatenation of `prefix`, a string of
-/// `rand` random characters, and `suffix`. The permissions of the
-/// file are set to `u+rw`.
-///
-/// # Errors
-///
-/// If the file could not be written to disk or if the directory does
-/// not exist.
-fn make_temp_file(dir: &str, prefix: &str, rand: usize, suffix: &str) -> UResult<PathBuf> {
-    let mut builder = Builder::new();
-    builder.prefix(prefix).rand_bytes(rand).suffix(suffix);
-    match builder.tempfile_in(dir) {
-        // `keep` ensures that the file is not deleted
-        Ok(named_tempfile) => match named_tempfile.keep() {
-            Ok((_, pathbuf)) => Ok(pathbuf),
-            Err(e) => Err(MkTempError::PersistError(e.file.path().to_path_buf()).into()),
+/// Create a temporary file with the given parameters.
+///
+/// This function creates a temporary file in the directory `dir`. The
+/// name of the file is the concatenation of `prefix`, a string of
+/// `rand` random characters, and `suffix`. The permissions of the
+/// file are set to `u+rw`.
+///
+/// # Errors
+///
+/// If the file could not be written to disk or if the directory does
+/// not exist.
+fn make_temp_file(dir: &str, prefix: &str, rand: usize, suffix: &str) -> UResult<PathBuf> {
+    let mut builder = Builder::new();
+    builder.prefix(prefix).rand_bytes(rand).suffix(suffix);
+    match builder.tempfile_in(dir) {
+        // `keep` ensures that the file is not deleted
+        Ok(named_tempfile) => match named_tempfile.keep() {
+            Ok((_, pathbuf)) => Ok(pathbuf),
+            Err(e) => Err(MkTempError::PersistError(e.file.path().to_path_buf()).into()),
         },
-        Err(e) if e.kind() == ErrorKind::NotFound => {
-            let filename = format!("{}{}{}", prefix, "X".repeat(rand), suffix);
-            let path = Path::new(dir).join(filename);
-            let s = path.display().to_string();
-            Err(MkTempError::NotFound("file".to_string(), s).into())
+        Err(e) if e.kind() == ErrorKind::NotFound => {
+            let filename = format!("{}{}{}", prefix, "X".repeat(rand), suffix);
+            let path = Path::new(dir).join(filename);
+            let s = path.display().to_string();
+            Err(MkTempError::NotFound("file".to_string(), s).into())
         }
-        Err(e) => Err(e.into()),
+        Err(e) => Err(e.into()),
     }
 }
 
-fn exec(dir: &str, prefix: &str, rand: usize, suffix: &str, make_dir: bool) -> UResult<()> {
-    let path = if make_dir {
-        make_temp_dir(dir, prefix, rand, suffix)?
-    } else {
-        make_temp_file(dir, prefix, rand, suffix)?
-    };
+fn exec(dir: &str, prefix: &str, rand: usize, suffix: &str, make_dir: bool) -> UResult<()> {
+    let path = if make_dir {
+        make_temp_dir(dir, prefix, rand, suffix)?
+    } else {
+        make_temp_file(dir, prefix, rand, suffix)?
+    };
 
-    // Get just the last component of the path to the created
-    // temporary file or directory.
-    let filename = path.file_name();
-    let filename = filename.unwrap().to_str().unwrap();
+    // Get just the last component of the path to the created
+    // temporary file or directory.
+    let filename = path.file_name();
+    let filename = filename.unwrap().to_str().unwrap();
 
-    // Join the directory to the path to get the path to print. We
-    // cannot use the path returned by the `Builder` because it gives
-    // the absolute path and we need to return a filename that matches
-    // the template given on the command-line which might be a
-    // relative path.
-    let path = Path::new(dir).join(filename);
+    // Join the directory to the path to get the path to print. We
+    // cannot use the path returned by the `Builder` because it gives
+    // the absolute path and we need to return a filename that matches
+    // the template given on the command-line which might be a
+    // relative path.
+    let path = Path::new(dir).join(filename);
 
-    println_verbatim(path).map_err_context(|| "failed to print directory name".to_owned())
+    println_verbatim(path).map_err_context(|| "failed to print directory name".to_owned())
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::find_last_contiguous_block_of_xs as findxs;
+#[cfg(test)]
+mod tests {
+    use crate::find_last_contiguous_block_of_xs as findxs;
 
-    #[test]
-    fn test_find_last_contiguous_block_of_xs() {
-        assert_eq!(findxs("XXX"), Some((0, 3)));
-        assert_eq!(findxs("XXX_XXX"), Some((4, 7)));
-        assert_eq!(findxs("XXX_XXX_XXX"), Some((8, 11)));
-        assert_eq!(findxs("aaXXXbb"), Some((2, 5)));
-        assert_eq!(findxs(""), None);
-        assert_eq!(findxs("X"), None);
-        assert_eq!(findxs("XX"), None);
-        assert_eq!(findxs("aXbXcX"), None);
-        assert_eq!(findxs("aXXbXXcXX"), None);
+    #[test]
+    fn test_find_last_contiguous_block_of_xs() {
+        assert_eq!(findxs("XXX"), Some((0, 3)));
+        assert_eq!(findxs("XXX_XXX"), Some((4, 7)));
+        assert_eq!(findxs("XXX_XXX_XXX"), Some((8, 11)));
+        assert_eq!(findxs("aaXXXbb"), Some((2, 5)));
+        assert_eq!(findxs(""), None);
+        assert_eq!(findxs("X"), None);
+        assert_eq!(findxs("XX"), None);
+        assert_eq!(findxs("aXbXcX"), None);
+        assert_eq!(findxs("aXXbXXcXX"), None);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_more/more.rs.html b/dev/src/uu_more/more.rs.html index 44258ad90..5b653ed18 100644 --- a/dev/src/uu_more/more.rs.html +++ b/dev/src/uu_more/more.rs.html @@ -1,4 +1,4 @@ -more.rs - source
1
+more.rs - source
1
 2
 3
 4
@@ -514,119 +514,119 @@
 514
 515
 516
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Martin Kysel <code@martinkysel.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE file
-//  * that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Martin Kysel <code@martinkysel.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE file
+//  * that was distributed with this source code.
 
-// spell-checker:ignore (methods) isnt
+// spell-checker:ignore (methods) isnt
 
-use std::{
-    fs::File,
-    io::{stdin, stdout, BufReader, Read, Stdout, Write},
-    path::Path,
-    time::Duration,
+use std::{
+    fs::File,
+    io::{stdin, stdout, BufReader, Read, Stdout, Write},
+    path::Path,
+    time::Duration,
 };
 
-#[cfg(all(unix, not(target_os = "fuchsia")))]
-extern crate nix;
+#[cfg(all(unix, not(target_os = "fuchsia")))]
+extern crate nix;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use crossterm::event::KeyEventKind;
-use crossterm::{
-    event::{self, Event, KeyCode, KeyEvent, KeyModifiers},
-    execute, queue,
-    style::Attribute,
-    terminal,
+use clap::{crate_version, Arg, ArgAction, Command};
+use crossterm::event::KeyEventKind;
+use crossterm::{
+    event::{self, Event, KeyCode, KeyEvent, KeyModifiers},
+    execute, queue,
+    style::Attribute,
+    terminal,
 };
 
-use unicode_segmentation::UnicodeSegmentation;
-use unicode_width::UnicodeWidthStr;
-use uucore::display::Quotable;
-use uucore::error::{UResult, USimpleError, UUsageError};
+use unicode_segmentation::UnicodeSegmentation;
+use unicode_width::UnicodeWidthStr;
+use uucore::display::Quotable;
+use uucore::error::{UResult, USimpleError, UUsageError};
 
-const BELL: &str = "\x07";
+const BELL: &str = "\x07";
 
-pub mod options {
-    pub const SILENT: &str = "silent";
-    pub const LOGICAL: &str = "logical";
-    pub const NO_PAUSE: &str = "no-pause";
-    pub const PRINT_OVER: &str = "print-over";
-    pub const CLEAN_PRINT: &str = "clean-print";
-    pub const SQUEEZE: &str = "squeeze";
-    pub const PLAIN: &str = "plain";
-    pub const LINES: &str = "lines";
-    pub const NUMBER: &str = "number";
-    pub const PATTERN: &str = "pattern";
-    pub const FROM_LINE: &str = "from-line";
-    pub const FILES: &str = "files";
+pub mod options {
+    pub const SILENT: &str = "silent";
+    pub const LOGICAL: &str = "logical";
+    pub const NO_PAUSE: &str = "no-pause";
+    pub const PRINT_OVER: &str = "print-over";
+    pub const CLEAN_PRINT: &str = "clean-print";
+    pub const SQUEEZE: &str = "squeeze";
+    pub const PLAIN: &str = "plain";
+    pub const LINES: &str = "lines";
+    pub const NUMBER: &str = "number";
+    pub const PATTERN: &str = "pattern";
+    pub const FROM_LINE: &str = "from-line";
+    pub const FILES: &str = "files";
 }
 
-const MULTI_FILE_TOP_PROMPT: &str = "::::::::::::::\n{}\n::::::::::::::\n";
+const MULTI_FILE_TOP_PROMPT: &str = "::::::::::::::\n{}\n::::::::::::::\n";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().get_matches_from(args);
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().get_matches_from(args);
 
-    let mut buff = String::new();
-    let silent = matches.get_flag(options::SILENT);
-    if let Some(files) = matches.get_many::<String>(options::FILES) {
-        let mut stdout = setup_term();
-        let length = files.len();
+    let mut buff = String::new();
+    let silent = matches.get_flag(options::SILENT);
+    if let Some(files) = matches.get_many::<String>(options::FILES) {
+        let mut stdout = setup_term();
+        let length = files.len();
 
-        let mut files_iter = files.map(|s| s.as_str()).peekable();
-        while let (Some(file), next_file) = (files_iter.next(), files_iter.peek()) {
-            let file = Path::new(file);
-            if file.is_dir() {
-                terminal::disable_raw_mode().unwrap();
-                return Err(UUsageError::new(
+        let mut files_iter = files.map(|s| s.as_str()).peekable();
+        while let (Some(file), next_file) = (files_iter.next(), files_iter.peek()) {
+            let file = Path::new(file);
+            if file.is_dir() {
+                terminal::disable_raw_mode().unwrap();
+                return Err(UUsageError::new(
                     1,
-                    format!("{} is a directory.", file.quote()),
+                    format!("{} is a directory.", file.quote()),
                 ));
             }
-            if !file.exists() {
-                terminal::disable_raw_mode().unwrap();
-                return Err(USimpleError::new(
+            if !file.exists() {
+                terminal::disable_raw_mode().unwrap();
+                return Err(USimpleError::new(
                     1,
-                    format!("cannot open {}: No such file or directory", file.quote()),
+                    format!("cannot open {}: No such file or directory", file.quote()),
                 ));
             }
-            if length > 1 {
-                buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", file.to_str().unwrap()));
+            if length > 1 {
+                buff.push_str(&MULTI_FILE_TOP_PROMPT.replace("{}", file.to_str().unwrap()));
             }
-            let mut reader = BufReader::new(File::open(file).unwrap());
-            reader.read_to_string(&mut buff).unwrap();
-            more(&buff, &mut stdout, next_file.copied(), silent)?;
-            buff.clear();
+            let mut reader = BufReader::new(File::open(file).unwrap());
+            reader.read_to_string(&mut buff).unwrap();
+            more(&buff, &mut stdout, next_file.copied(), silent)?;
+            buff.clear();
         }
-        reset_term(&mut stdout);
-    } else if atty::isnt(atty::Stream::Stdin) {
-        stdin().read_to_string(&mut buff).unwrap();
-        let mut stdout = setup_term();
-        more(&buff, &mut stdout, None, silent)?;
-        reset_term(&mut stdout);
-    } else {
-        return Err(UUsageError::new(1, "bad usage"));
+        reset_term(&mut stdout);
+    } else if atty::isnt(atty::Stream::Stdin) {
+        stdin().read_to_string(&mut buff).unwrap();
+        let mut stdout = setup_term();
+        more(&buff, &mut stdout, None, silent)?;
+        reset_term(&mut stdout);
+    } else {
+        return Err(UUsageError::new(1, "bad usage"));
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .about("A file perusal filter for CRT viewing.")
-        .version(crate_version!())
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::SILENT)
-                .short('d')
-                .long(options::SILENT)
-                .help("Display help instead of ringing bell")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .about("A file perusal filter for CRT viewing.")
+        .version(crate_version!())
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::SILENT)
+                .short('d')
+                .long(options::SILENT)
+                .help("Display help instead of ringing bell")
+                .action(ArgAction::SetTrue),
         )
-        // The commented arguments below are unimplemented:
-        /*
+        // The commented arguments below are unimplemented:
+        /*
         .arg(
             Arg::new(options::LOGICAL)
                 .short('f')
@@ -696,339 +696,339 @@
                 .takes_value(true)
                 .help("Display file beginning from pattern match"),
         )
-        */
-        .arg(
-            Arg::new(options::FILES)
-                .required(false)
-                .action(ArgAction::Append)
-                .help("Path to the files to be read")
-                .value_hint(clap::ValueHint::FilePath),
+        */
+        .arg(
+            Arg::new(options::FILES)
+                .required(false)
+                .action(ArgAction::Append)
+                .help("Path to the files to be read")
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-#[cfg(not(target_os = "fuchsia"))]
-fn setup_term() -> std::io::Stdout {
-    let stdout = stdout();
-    terminal::enable_raw_mode().unwrap();
-    stdout
+#[cfg(not(target_os = "fuchsia"))]
+fn setup_term() -> std::io::Stdout {
+    let stdout = stdout();
+    terminal::enable_raw_mode().unwrap();
+    stdout
 }
 
-#[cfg(target_os = "fuchsia")]
-#[inline(always)]
-fn setup_term() -> usize {
-    0
+#[cfg(target_os = "fuchsia")]
+#[inline(always)]
+fn setup_term() -> usize {
+    0
+}
+
+#[cfg(not(target_os = "fuchsia"))]
+fn reset_term(stdout: &mut std::io::Stdout) {
+    terminal::disable_raw_mode().unwrap();
+    // Clear the prompt
+    queue!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap();
+    // Move cursor to the beginning without printing new line
+    print!("\r");
+    stdout.flush().unwrap();
 }
 
-#[cfg(not(target_os = "fuchsia"))]
-fn reset_term(stdout: &mut std::io::Stdout) {
-    terminal::disable_raw_mode().unwrap();
-    // Clear the prompt
-    queue!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap();
-    // Move cursor to the beginning without printing new line
-    print!("\r");
-    stdout.flush().unwrap();
-}
+#[cfg(target_os = "fuchsia")]
+#[inline(always)]
+fn reset_term(_: &mut usize) {}
 
-#[cfg(target_os = "fuchsia")]
-#[inline(always)]
-fn reset_term(_: &mut usize) {}
+fn more(buff: &str, stdout: &mut Stdout, next_file: Option<&str>, silent: bool) -> UResult<()> {
+    let (cols, rows) = terminal::size().unwrap();
+    let lines = break_buff(buff, usize::from(cols));
 
-fn more(buff: &str, stdout: &mut Stdout, next_file: Option<&str>, silent: bool) -> UResult<()> {
-    let (cols, rows) = terminal::size().unwrap();
-    let lines = break_buff(buff, usize::from(cols));
-
-    let mut pager = Pager::new(rows, lines, next_file, silent);
-    pager.draw(stdout, None);
-    if pager.should_close() {
-        return Ok(());
+    let mut pager = Pager::new(rows, lines, next_file, silent);
+    pager.draw(stdout, None);
+    if pager.should_close() {
+        return Ok(());
     }
 
-    loop {
-        let mut wrong_key = None;
-        if event::poll(Duration::from_millis(10)).unwrap() {
-            match event::read().unwrap() {
-                Event::Key(KeyEvent {
-                    kind: KeyEventKind::Release,
+    loop {
+        let mut wrong_key = None;
+        if event::poll(Duration::from_millis(10)).unwrap() {
+            match event::read().unwrap() {
+                Event::Key(KeyEvent {
+                    kind: KeyEventKind::Release,
                     ..
                 }) => continue,
-                Event::Key(KeyEvent {
-                    code: KeyCode::Char('q'),
-                    modifiers: KeyModifiers::NONE,
-                    kind: KeyEventKind::Press,
+                Event::Key(KeyEvent {
+                    code: KeyCode::Char('q'),
+                    modifiers: KeyModifiers::NONE,
+                    kind: KeyEventKind::Press,
                     ..
                 })
-                | Event::Key(KeyEvent {
-                    code: KeyCode::Char('c'),
-                    modifiers: KeyModifiers::CONTROL,
-                    kind: KeyEventKind::Press,
+                | Event::Key(KeyEvent {
+                    code: KeyCode::Char('c'),
+                    modifiers: KeyModifiers::CONTROL,
+                    kind: KeyEventKind::Press,
                     ..
                 }) => {
-                    reset_term(stdout);
-                    std::process::exit(0);
+                    reset_term(stdout);
+                    std::process::exit(0);
                 }
-                Event::Key(KeyEvent {
-                    code: KeyCode::Down,
-                    modifiers: KeyModifiers::NONE,
+                Event::Key(KeyEvent {
+                    code: KeyCode::Down,
+                    modifiers: KeyModifiers::NONE,
                     ..
                 })
-                | Event::Key(KeyEvent {
-                    code: KeyCode::Char(' '),
-                    modifiers: KeyModifiers::NONE,
+                | Event::Key(KeyEvent {
+                    code: KeyCode::Char(' '),
+                    modifiers: KeyModifiers::NONE,
                     ..
                 }) => {
-                    if pager.should_close() {
-                        return Ok(());
-                    } else {
-                        pager.page_down();
+                    if pager.should_close() {
+                        return Ok(());
+                    } else {
+                        pager.page_down();
                     }
                 }
-                Event::Key(KeyEvent {
-                    code: KeyCode::Up,
-                    modifiers: KeyModifiers::NONE,
+                Event::Key(KeyEvent {
+                    code: KeyCode::Up,
+                    modifiers: KeyModifiers::NONE,
                     ..
                 }) => {
-                    pager.page_up();
+                    pager.page_up();
                 }
-                Event::Key(KeyEvent {
-                    code: KeyCode::Char('j'),
-                    modifiers: KeyModifiers::NONE,
+                Event::Key(KeyEvent {
+                    code: KeyCode::Char('j'),
+                    modifiers: KeyModifiers::NONE,
                     ..
                 }) => {
-                    if pager.should_close() {
-                        return Ok(());
-                    } else {
-                        pager.next_line();
+                    if pager.should_close() {
+                        return Ok(());
+                    } else {
+                        pager.next_line();
                     }
                 }
-                Event::Key(KeyEvent {
-                    code: KeyCode::Char('k'),
-                    modifiers: KeyModifiers::NONE,
+                Event::Key(KeyEvent {
+                    code: KeyCode::Char('k'),
+                    modifiers: KeyModifiers::NONE,
                     ..
                 }) => {
-                    pager.prev_line();
+                    pager.prev_line();
                 }
-                Event::Resize(col, row) => {
-                    pager.page_resize(col, row);
+                Event::Resize(col, row) => {
+                    pager.page_resize(col, row);
                 }
-                Event::Key(KeyEvent {
-                    code: KeyCode::Char(k),
+                Event::Key(KeyEvent {
+                    code: KeyCode::Char(k),
                     ..
-                }) => wrong_key = Some(k),
-                _ => continue,
+                }) => wrong_key = Some(k),
+                _ => continue,
             }
 
-            pager.draw(stdout, wrong_key);
+            pager.draw(stdout, wrong_key);
         }
     }
 }
 
-struct Pager<'a> {
-    // The current line at the top of the screen
-    upper_mark: usize,
-    // The number of rows that fit on the screen
-    content_rows: u16,
-    lines: Vec<String>,
-    next_file: Option<&'a str>,
-    line_count: usize,
-    silent: bool,
+struct Pager<'a> {
+    // The current line at the top of the screen
+    upper_mark: usize,
+    // The number of rows that fit on the screen
+    content_rows: u16,
+    lines: Vec<String>,
+    next_file: Option<&'a str>,
+    line_count: usize,
+    silent: bool,
 }
 
-impl<'a> Pager<'a> {
-    fn new(rows: u16, lines: Vec<String>, next_file: Option<&'a str>, silent: bool) -> Self {
-        let line_count = lines.len();
-        Self {
-            upper_mark: 0,
-            content_rows: rows.saturating_sub(1),
-            lines,
-            next_file,
-            line_count,
-            silent,
+impl<'a> Pager<'a> {
+    fn new(rows: u16, lines: Vec<String>, next_file: Option<&'a str>, silent: bool) -> Self {
+        let line_count = lines.len();
+        Self {
+            upper_mark: 0,
+            content_rows: rows.saturating_sub(1),
+            lines,
+            next_file,
+            line_count,
+            silent,
         }
     }
 
-    fn should_close(&mut self) -> bool {
-        self.upper_mark
-            .saturating_add(self.content_rows.into())
-            .ge(&self.line_count)
+    fn should_close(&mut self) -> bool {
+        self.upper_mark
+            .saturating_add(self.content_rows.into())
+            .ge(&self.line_count)
     }
 
-    fn page_down(&mut self) {
-        // If the next page down position __after redraw__ is greater than the total line count,
-        // the upper mark must not grow past top of the screen at the end of the open file.
-        if self
-            .upper_mark
-            .saturating_add(self.content_rows as usize * 2)
-            .ge(&self.line_count)
+    fn page_down(&mut self) {
+        // If the next page down position __after redraw__ is greater than the total line count,
+        // the upper mark must not grow past top of the screen at the end of the open file.
+        if self
+            .upper_mark
+            .saturating_add(self.content_rows as usize * 2)
+            .ge(&self.line_count)
         {
-            self.upper_mark = self.line_count - self.content_rows as usize;
+            self.upper_mark = self.line_count - self.content_rows as usize;
             return;
         }
 
-        self.upper_mark = self.upper_mark.saturating_add(self.content_rows.into());
+        self.upper_mark = self.upper_mark.saturating_add(self.content_rows.into());
     }
 
-    fn page_up(&mut self) {
-        self.upper_mark = self.upper_mark.saturating_sub(self.content_rows.into());
+    fn page_up(&mut self) {
+        self.upper_mark = self.upper_mark.saturating_sub(self.content_rows.into());
     }
 
-    fn next_line(&mut self) {
-        self.upper_mark = self.upper_mark.saturating_add(1);
+    fn next_line(&mut self) {
+        self.upper_mark = self.upper_mark.saturating_add(1);
     }
 
-    fn prev_line(&mut self) {
-        self.upper_mark = self.upper_mark.saturating_sub(1);
+    fn prev_line(&mut self) {
+        self.upper_mark = self.upper_mark.saturating_sub(1);
     }
 
-    // TODO: Deal with column size changes.
-    fn page_resize(&mut self, _: u16, row: u16) {
-        self.content_rows = row.saturating_sub(1);
+    // TODO: Deal with column size changes.
+    fn page_resize(&mut self, _: u16, row: u16) {
+        self.content_rows = row.saturating_sub(1);
     }
 
-    fn draw(&self, stdout: &mut std::io::Stdout, wrong_key: Option<char>) {
-        let lower_mark = self
-            .line_count
-            .min(self.upper_mark.saturating_add(self.content_rows.into()));
-        self.draw_lines(stdout);
-        self.draw_prompt(stdout, lower_mark, wrong_key);
-        stdout.flush().unwrap();
+    fn draw(&self, stdout: &mut std::io::Stdout, wrong_key: Option<char>) {
+        let lower_mark = self
+            .line_count
+            .min(self.upper_mark.saturating_add(self.content_rows.into()));
+        self.draw_lines(stdout);
+        self.draw_prompt(stdout, lower_mark, wrong_key);
+        stdout.flush().unwrap();
     }
 
-    fn draw_lines(&self, stdout: &mut std::io::Stdout) {
-        execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap();
-        let displayed_lines = self
-            .lines
-            .iter()
-            .skip(self.upper_mark)
-            .take(self.content_rows.into());
+    fn draw_lines(&self, stdout: &mut std::io::Stdout) {
+        execute!(stdout, terminal::Clear(terminal::ClearType::CurrentLine)).unwrap();
+        let displayed_lines = self
+            .lines
+            .iter()
+            .skip(self.upper_mark)
+            .take(self.content_rows.into());
 
-        for line in displayed_lines {
-            stdout
-                .write_all(format!("\r{}\n", line).as_bytes())
-                .unwrap();
+        for line in displayed_lines {
+            stdout
+                .write_all(format!("\r{}\n", line).as_bytes())
+                .unwrap();
         }
     }
 
-    fn draw_prompt(&self, stdout: &mut Stdout, lower_mark: usize, wrong_key: Option<char>) {
-        let status_inner = if lower_mark == self.line_count {
-            format!("Next file: {}", self.next_file.unwrap_or_default())
-        } else {
+    fn draw_prompt(&self, stdout: &mut Stdout, lower_mark: usize, wrong_key: Option<char>) {
+        let status_inner = if lower_mark == self.line_count {
+            format!("Next file: {}", self.next_file.unwrap_or_default())
+        } else {
             format!(
                 "{}%",
-                (lower_mark as f64 / self.line_count as f64 * 100.0).round() as u16
+                (lower_mark as f64 / self.line_count as f64 * 100.0).round() as u16
             )
         };
 
-        let status = format!("--More--({})", status_inner);
+        let status = format!("--More--({})", status_inner);
 
-        let banner = match (self.silent, wrong_key) {
-            (true, Some(key)) => format!(
+        let banner = match (self.silent, wrong_key) {
+            (true, Some(key)) => format!(
                 "{} [Unknown key: '{}'. Press 'h' for instructions. (unimplemented)]",
-                status, key
+                status, key
             ),
-            (true, None) => format!("{}[Press space to continue, 'q' to quit.]", status),
-            (false, Some(_)) => format!("{}{}", status, BELL),
-            (false, None) => status,
+            (true, None) => format!("{}[Press space to continue, 'q' to quit.]", status),
+            (false, Some(_)) => format!("{}{}", status, BELL),
+            (false, None) => status,
         };
 
         write!(
-            stdout,
+            stdout,
             "\r{}{}{}",
-            Attribute::Reverse,
-            banner,
-            Attribute::Reset
+            Attribute::Reverse,
+            banner,
+            Attribute::Reset
         )
-        .unwrap();
+        .unwrap();
     }
 }
 
-// Break the lines on the cols of the terminal
-fn break_buff(buff: &str, cols: usize) -> Vec<String> {
-    let mut lines = Vec::with_capacity(buff.lines().count());
+// Break the lines on the cols of the terminal
+fn break_buff(buff: &str, cols: usize) -> Vec<String> {
+    let mut lines = Vec::with_capacity(buff.lines().count());
 
-    for l in buff.lines() {
-        lines.append(&mut break_line(l, cols));
+    for l in buff.lines() {
+        lines.append(&mut break_line(l, cols));
     }
-    lines
+    lines
 }
 
-fn break_line(line: &str, cols: usize) -> Vec<String> {
-    let width = UnicodeWidthStr::width(line);
-    let mut lines = Vec::new();
-    if width < cols {
-        lines.push(line.to_string());
-        return lines;
+fn break_line(line: &str, cols: usize) -> Vec<String> {
+    let width = UnicodeWidthStr::width(line);
+    let mut lines = Vec::new();
+    if width < cols {
+        lines.push(line.to_string());
+        return lines;
     }
 
-    let gr_idx = UnicodeSegmentation::grapheme_indices(line, true);
-    let mut last_index = 0;
-    let mut total_width = 0;
-    for (index, grapheme) in gr_idx {
-        let width = UnicodeWidthStr::width(grapheme);
-        total_width += width;
+    let gr_idx = UnicodeSegmentation::grapheme_indices(line, true);
+    let mut last_index = 0;
+    let mut total_width = 0;
+    for (index, grapheme) in gr_idx {
+        let width = UnicodeWidthStr::width(grapheme);
+        total_width += width;
 
-        if total_width > cols {
-            lines.push(line[last_index..index].to_string());
-            last_index = index;
-            total_width = width;
+        if total_width > cols {
+            lines.push(line[last_index..index].to_string());
+            last_index = index;
+            total_width = width;
         }
     }
 
-    if last_index != line.len() {
-        lines.push(line[last_index..].to_string());
+    if last_index != line.len() {
+        lines.push(line[last_index..].to_string());
     }
-    lines
+    lines
 }
 
-#[cfg(test)]
-mod tests {
-    use super::break_line;
-    use unicode_width::UnicodeWidthStr;
+#[cfg(test)]
+mod tests {
+    use super::break_line;
+    use unicode_width::UnicodeWidthStr;
 
-    #[test]
-    fn test_break_lines_long() {
-        let mut test_string = String::with_capacity(100);
-        for _ in 0..200 {
-            test_string.push('#');
+    #[test]
+    fn test_break_lines_long() {
+        let mut test_string = String::with_capacity(100);
+        for _ in 0..200 {
+            test_string.push('#');
         }
 
-        let lines = break_line(&test_string, 80);
-        let widths: Vec<usize> = lines
-            .iter()
-            .map(|s| UnicodeWidthStr::width(&s[..]))
-            .collect();
+        let lines = break_line(&test_string, 80);
+        let widths: Vec<usize> = lines
+            .iter()
+            .map(|s| UnicodeWidthStr::width(&s[..]))
+            .collect();
 
-        assert_eq!((80, 80, 40), (widths[0], widths[1], widths[2]));
+        assert_eq!((80, 80, 40), (widths[0], widths[1], widths[2]));
     }
 
-    #[test]
-    fn test_break_lines_short() {
-        let mut test_string = String::with_capacity(100);
-        for _ in 0..20 {
-            test_string.push('#');
+    #[test]
+    fn test_break_lines_short() {
+        let mut test_string = String::with_capacity(100);
+        for _ in 0..20 {
+            test_string.push('#');
         }
 
-        let lines = break_line(&test_string, 80);
+        let lines = break_line(&test_string, 80);
 
-        assert_eq!(20, lines[0].len());
+        assert_eq!(20, lines[0].len());
     }
 
-    #[test]
-    fn test_break_line_zwj() {
-        let mut test_string = String::with_capacity(1100);
-        for _ in 0..20 {
-            test_string.push_str("👩🏻‍🔬");
+    #[test]
+    fn test_break_line_zwj() {
+        let mut test_string = String::with_capacity(1100);
+        for _ in 0..20 {
+            test_string.push_str("👩🏻‍🔬");
         }
 
-        let lines = break_line(&test_string, 80);
+        let lines = break_line(&test_string, 80);
 
-        let widths: Vec<usize> = lines
-            .iter()
-            .map(|s| UnicodeWidthStr::width(&s[..]))
-            .collect();
+        let widths: Vec<usize> = lines
+            .iter()
+            .map(|s| UnicodeWidthStr::width(&s[..]))
+            .collect();
 
-        // Each 👩🏻‍🔬 is 6 character width it break line to the closest number to 80 => 6 * 13 = 78
-        assert_eq!((78, 42), (widths[0], widths[1]));
+        // Each 👩🏻‍🔬 is 6 character width it break line to the closest number to 80 => 6 * 13 = 78
+        assert_eq!((78, 42), (widths[0], widths[1]));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_mv/error.rs.html b/dev/src/uu_mv/error.rs.html index 5d04c1027..170733849 100644 --- a/dev/src/uu_mv/error.rs.html +++ b/dev/src/uu_mv/error.rs.html @@ -1,4 +1,4 @@ -error.rs - source
1
+error.rs - source
1
 2
 3
 4
@@ -41,48 +41,48 @@
 41
 42
 43
-
// This file is part of the uutils coreutils package.
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
-use std::error::Error;
-use std::fmt::{Display, Formatter, Result};
+
// This file is part of the uutils coreutils package.
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
+use std::error::Error;
+use std::fmt::{Display, Formatter, Result};
 
-use uucore::error::UError;
+use uucore::error::UError;
 
-#[derive(Debug)]
-pub enum MvError {
-    NoSuchFile(String),
-    SameFile(String, String),
-    SelfSubdirectory(String),
-    DirectoryToNonDirectory(String),
-    NonDirectoryToDirectory(String, String),
-    NotADirectory(String),
+#[derive(Debug)]
+pub enum MvError {
+    NoSuchFile(String),
+    SameFile(String, String),
+    SelfSubdirectory(String),
+    DirectoryToNonDirectory(String),
+    NonDirectoryToDirectory(String, String),
+    NotADirectory(String),
 }
 
-impl Error for MvError {}
-impl UError for MvError {}
-impl Display for MvError {
-    fn fmt(&self, f: &mut Formatter) -> Result {
-        match self {
-            Self::NoSuchFile(s) => write!(f, "cannot stat {}: No such file or directory", s),
-            Self::SameFile(s, t) => write!(f, "{} and {} are the same file", s, t),
-            Self::SelfSubdirectory(s) => write!(
-                f,
+impl Error for MvError {}
+impl UError for MvError {}
+impl Display for MvError {
+    fn fmt(&self, f: &mut Formatter) -> Result {
+        match self {
+            Self::NoSuchFile(s) => write!(f, "cannot stat {}: No such file or directory", s),
+            Self::SameFile(s, t) => write!(f, "{} and {} are the same file", s, t),
+            Self::SelfSubdirectory(s) => write!(
+                f,
                 "cannot move '{s}' to a subdirectory of itself, '{s}/{s}'",
-                s = s
+                s = s
             ),
-            Self::DirectoryToNonDirectory(t) => {
-                write!(f, "cannot overwrite directory {} with non-directory", t)
+            Self::DirectoryToNonDirectory(t) => {
+                write!(f, "cannot overwrite directory {} with non-directory", t)
             }
-            Self::NonDirectoryToDirectory(s, t) => write!(
-                f,
+            Self::NonDirectoryToDirectory(s, t) => write!(
+                f,
                 "cannot overwrite non-directory {} with directory {}",
-                t, s
+                t, s
             ),
-            Self::NotADirectory(t) => write!(f, "target {} is not a directory", t),
+            Self::NotADirectory(t) => write!(f, "target {} is not a directory", t),
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_mv/mv.rs.html b/dev/src/uu_mv/mv.rs.html index e6c9bd9a0..43e7312e2 100644 --- a/dev/src/uu_mv/mv.rs.html +++ b/dev/src/uu_mv/mv.rs.html @@ -1,4 +1,4 @@ -mv.rs - source
1
+mv.rs - source
1
 2
 3
 4
@@ -514,357 +514,357 @@
 514
 515
 516
-
// This file is part of the uutils coreutils package.
-//
-// (c) Orvar Segerström <orvarsegerstrom@gmail.com>
-// (c) Sokovikov Evgeniy  <skv-headless@yandex.ru>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Orvar Segerström <orvarsegerstrom@gmail.com>
+// (c) Sokovikov Evgeniy  <skv-headless@yandex.ru>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) sourcepath targetpath
+// spell-checker:ignore (ToDO) sourcepath targetpath
 
-mod error;
+mod error;
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::builder::ValueParser;
-use clap::{crate_version, error::ErrorKind, Arg, ArgAction, ArgMatches, Command};
-use std::env;
-use std::ffi::OsString;
-use std::fs;
-use std::io::{self, stdin};
-#[cfg(unix)]
-use std::os::unix;
-#[cfg(windows)]
-use std::os::windows;
-use std::path::{Path, PathBuf};
-use uucore::backup_control::{self, BackupMode};
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UError, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
+use clap::builder::ValueParser;
+use clap::{crate_version, error::ErrorKind, Arg, ArgAction, ArgMatches, Command};
+use std::env;
+use std::ffi::OsString;
+use std::fs;
+use std::io::{self, stdin};
+#[cfg(unix)]
+use std::os::unix;
+#[cfg(windows)]
+use std::os::windows;
+use std::path::{Path, PathBuf};
+use uucore::backup_control::{self, BackupMode};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UError, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
 
-use fs_extra::dir::{move_dir, CopyOptions as DirCopyOptions};
+use fs_extra::dir::{move_dir, CopyOptions as DirCopyOptions};
 
-use crate::error::MvError;
+use crate::error::MvError;
 
-pub struct Behavior {
-    overwrite: OverwriteMode,
-    backup: BackupMode,
-    suffix: String,
-    update: bool,
-    target_dir: Option<OsString>,
-    no_target_dir: bool,
-    verbose: bool,
-    strip_slashes: bool,
+pub struct Behavior {
+    overwrite: OverwriteMode,
+    backup: BackupMode,
+    suffix: String,
+    update: bool,
+    target_dir: Option<OsString>,
+    no_target_dir: bool,
+    verbose: bool,
+    strip_slashes: bool,
 }
 
-#[derive(Clone, Eq, PartialEq)]
-pub enum OverwriteMode {
-    NoClobber,
-    Interactive,
-    Force,
+#[derive(Clone, Eq, PartialEq)]
+pub enum OverwriteMode {
+    NoClobber,
+    Interactive,
+    Force,
 }
 
-static ABOUT: &str = "Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.";
-static LONG_HELP: &str = "";
-const USAGE: &str = "\
+static ABOUT: &str = "Move SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.";
+static LONG_HELP: &str = "";
+const USAGE: &str = "\
     {} [OPTION]... [-T] SOURCE DEST
     {} [OPTION]... SOURCE... DIRECTORY
     {} [OPTION]... -t DIRECTORY SOURCE...";
 
-static OPT_FORCE: &str = "force";
-static OPT_INTERACTIVE: &str = "interactive";
-static OPT_NO_CLOBBER: &str = "no-clobber";
-static OPT_STRIP_TRAILING_SLASHES: &str = "strip-trailing-slashes";
-static OPT_TARGET_DIRECTORY: &str = "target-directory";
-static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory";
-static OPT_UPDATE: &str = "update";
-static OPT_VERBOSE: &str = "verbose";
+static OPT_FORCE: &str = "force";
+static OPT_INTERACTIVE: &str = "interactive";
+static OPT_NO_CLOBBER: &str = "no-clobber";
+static OPT_STRIP_TRAILING_SLASHES: &str = "strip-trailing-slashes";
+static OPT_TARGET_DIRECTORY: &str = "target-directory";
+static OPT_NO_TARGET_DIRECTORY: &str = "no-target-directory";
+static OPT_UPDATE: &str = "update";
+static OPT_VERBOSE: &str = "verbose";
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let help = format!(
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let help = format!(
         "{}\n{}",
-        LONG_HELP,
-        backup_control::BACKUP_CONTROL_LONG_HELP
+        LONG_HELP,
+        backup_control::BACKUP_CONTROL_LONG_HELP
     );
-    let mut app = uu_app().after_help(help);
-    let matches = app.try_get_matches_from_mut(args)?;
+    let mut app = uu_app().after_help(help);
+    let matches = app.try_get_matches_from_mut(args)?;
 
-    if !matches.contains_id(OPT_TARGET_DIRECTORY)
-        && matches
-            .get_many::<OsString>(ARG_FILES)
-            .map(|f| f.len())
-            .unwrap_or(0)
-            == 1
-    {
-        app.error(
-            ErrorKind::TooFewValues,
+    if !matches.contains_id(OPT_TARGET_DIRECTORY)
+        && matches
+            .get_many::<OsString>(ARG_FILES)
+            .map(|f| f.len())
+            .unwrap_or(0)
+            == 1
+    {
+        app.error(
+            ErrorKind::TooFewValues,
             format!(
                 "The argument '<{}>...' requires at least 2 values, but only 1 was provided",
-                ARG_FILES
+                ARG_FILES
             ),
         )
-        .exit();
+        .exit();
     }
 
-    let files: Vec<OsString> = matches
-        .get_many::<OsString>(ARG_FILES)
-        .unwrap_or_default()
-        .map(|v| v.to_os_string())
-        .collect();
+    let files: Vec<OsString> = matches
+        .get_many::<OsString>(ARG_FILES)
+        .unwrap_or_default()
+        .map(|v| v.to_os_string())
+        .collect();
 
-    let overwrite_mode = determine_overwrite_mode(&matches);
-    let backup_mode = backup_control::determine_backup_mode(&matches)?;
+    let overwrite_mode = determine_overwrite_mode(&matches);
+    let backup_mode = backup_control::determine_backup_mode(&matches)?;
 
-    if overwrite_mode == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup {
-        return Err(UUsageError::new(
+    if overwrite_mode == OverwriteMode::NoClobber && backup_mode != BackupMode::NoBackup {
+        return Err(UUsageError::new(
             1,
             "options --backup and --no-clobber are mutually exclusive",
         ));
     }
 
-    let backup_suffix = backup_control::determine_backup_suffix(&matches);
+    let backup_suffix = backup_control::determine_backup_suffix(&matches);
 
-    let behavior = Behavior {
-        overwrite: overwrite_mode,
-        backup: backup_mode,
-        suffix: backup_suffix,
-        update: matches.get_flag(OPT_UPDATE),
-        target_dir: matches
-            .get_one::<OsString>(OPT_TARGET_DIRECTORY)
-            .map(OsString::from),
-        no_target_dir: matches.get_flag(OPT_NO_TARGET_DIRECTORY),
-        verbose: matches.get_flag(OPT_VERBOSE),
-        strip_slashes: matches.get_flag(OPT_STRIP_TRAILING_SLASHES),
+    let behavior = Behavior {
+        overwrite: overwrite_mode,
+        backup: backup_mode,
+        suffix: backup_suffix,
+        update: matches.get_flag(OPT_UPDATE),
+        target_dir: matches
+            .get_one::<OsString>(OPT_TARGET_DIRECTORY)
+            .map(OsString::from),
+        no_target_dir: matches.get_flag(OPT_NO_TARGET_DIRECTORY),
+        verbose: matches.get_flag(OPT_VERBOSE),
+        strip_slashes: matches.get_flag(OPT_STRIP_TRAILING_SLASHES),
     };
 
-    exec(&files[..], &behavior)
+    exec(&files[..], &behavior)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(backup_control::arguments::backup())
-        .arg(backup_control::arguments::backup_no_args())
-        .arg(
-            Arg::new(OPT_FORCE)
-                .short('f')
-                .long(OPT_FORCE)
-                .help("do not prompt before overwriting")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(backup_control::arguments::backup())
+        .arg(backup_control::arguments::backup_no_args())
+        .arg(
+            Arg::new(OPT_FORCE)
+                .short('f')
+                .long(OPT_FORCE)
+                .help("do not prompt before overwriting")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_INTERACTIVE)
-                .short('i')
-                .long(OPT_INTERACTIVE)
-                .help("prompt before override")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_INTERACTIVE)
+                .short('i')
+                .long(OPT_INTERACTIVE)
+                .help("prompt before override")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_NO_CLOBBER)
-                .short('n')
-                .long(OPT_NO_CLOBBER)
-                .help("do not overwrite an existing file")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_NO_CLOBBER)
+                .short('n')
+                .long(OPT_NO_CLOBBER)
+                .help("do not overwrite an existing file")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_STRIP_TRAILING_SLASHES)
-                .long(OPT_STRIP_TRAILING_SLASHES)
-                .help("remove any trailing slashes from each SOURCE argument")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_STRIP_TRAILING_SLASHES)
+                .long(OPT_STRIP_TRAILING_SLASHES)
+                .help("remove any trailing slashes from each SOURCE argument")
+                .action(ArgAction::SetTrue),
         )
-        .arg(backup_control::arguments::suffix())
-        .arg(
-            Arg::new(OPT_TARGET_DIRECTORY)
-                .short('t')
-                .long(OPT_TARGET_DIRECTORY)
-                .help("move all SOURCE arguments into DIRECTORY")
-                .value_name("DIRECTORY")
-                .value_hint(clap::ValueHint::DirPath)
-                .conflicts_with(OPT_NO_TARGET_DIRECTORY)
-                .value_parser(ValueParser::os_string()),
+        .arg(backup_control::arguments::suffix())
+        .arg(
+            Arg::new(OPT_TARGET_DIRECTORY)
+                .short('t')
+                .long(OPT_TARGET_DIRECTORY)
+                .help("move all SOURCE arguments into DIRECTORY")
+                .value_name("DIRECTORY")
+                .value_hint(clap::ValueHint::DirPath)
+                .conflicts_with(OPT_NO_TARGET_DIRECTORY)
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(OPT_NO_TARGET_DIRECTORY)
-                .short('T')
-                .long(OPT_NO_TARGET_DIRECTORY)
-                .help("treat DEST as a normal file")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_NO_TARGET_DIRECTORY)
+                .short('T')
+                .long(OPT_NO_TARGET_DIRECTORY)
+                .help("treat DEST as a normal file")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_UPDATE)
-                .short('u')
-                .long(OPT_UPDATE)
-                .help(
+        .arg(
+            Arg::new(OPT_UPDATE)
+                .short('u')
+                .long(OPT_UPDATE)
+                .help(
                     "move only when the SOURCE file is newer than the destination file \
                        or when the destination file is missing",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_VERBOSE)
-                .short('v')
-                .long(OPT_VERBOSE)
-                .help("explain what is being done")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_VERBOSE)
+                .short('v')
+                .long(OPT_VERBOSE)
+                .help("explain what is being done")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .num_args(1..)
-                .required(true)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .num_args(1..)
+                .required(true)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-fn determine_overwrite_mode(matches: &ArgMatches) -> OverwriteMode {
-    // This does not exactly match the GNU implementation:
-    // The GNU mv defaults to Force, but if more than one of the
-    // overwrite options are supplied, only the last takes effect.
-    // To default to no-clobber in that situation seems safer:
-    //
-    if matches.get_flag(OPT_NO_CLOBBER) {
-        OverwriteMode::NoClobber
-    } else if matches.get_flag(OPT_INTERACTIVE) {
-        OverwriteMode::Interactive
-    } else {
-        OverwriteMode::Force
+fn determine_overwrite_mode(matches: &ArgMatches) -> OverwriteMode {
+    // This does not exactly match the GNU implementation:
+    // The GNU mv defaults to Force, but if more than one of the
+    // overwrite options are supplied, only the last takes effect.
+    // To default to no-clobber in that situation seems safer:
+    //
+    if matches.get_flag(OPT_NO_CLOBBER) {
+        OverwriteMode::NoClobber
+    } else if matches.get_flag(OPT_INTERACTIVE) {
+        OverwriteMode::Interactive
+    } else {
+        OverwriteMode::Force
     }
 }
 
-fn exec(files: &[OsString], b: &Behavior) -> UResult<()> {
-    let paths: Vec<PathBuf> = {
-        let paths = files.iter().map(Path::new);
+fn exec(files: &[OsString], b: &Behavior) -> UResult<()> {
+    let paths: Vec<PathBuf> = {
+        let paths = files.iter().map(Path::new);
 
-        // Strip slashes from path, if strip opt present
-        if b.strip_slashes {
-            paths
-                .map(|p| p.components().as_path().to_owned())
-                .collect::<Vec<PathBuf>>()
-        } else {
-            paths.map(|p| p.to_owned()).collect::<Vec<PathBuf>>()
+        // Strip slashes from path, if strip opt present
+        if b.strip_slashes {
+            paths
+                .map(|p| p.components().as_path().to_owned())
+                .collect::<Vec<PathBuf>>()
+        } else {
+            paths.map(|p| p.to_owned()).collect::<Vec<PathBuf>>()
         }
     };
 
-    if let Some(ref name) = b.target_dir {
-        return move_files_into_dir(&paths, &PathBuf::from(name), b);
+    if let Some(ref name) = b.target_dir {
+        return move_files_into_dir(&paths, &PathBuf::from(name), b);
     }
-    match paths.len() {
-        /* case 0/1 are not possible thanks to clap */
-        2 => {
-            let source = &paths[0];
-            let target = &paths[1];
-            // Here we use the `symlink_metadata()` method instead of `exists()`,
-            // since it handles dangling symlinks correctly. The method gives an
-            // `Ok()` results unless the source does not exist, or the user
-            // lacks permission to access metadata.
-            if source.symlink_metadata().is_err() {
-                return Err(MvError::NoSuchFile(source.quote().to_string()).into());
+    match paths.len() {
+        /* case 0/1 are not possible thanks to clap */
+        2 => {
+            let source = &paths[0];
+            let target = &paths[1];
+            // Here we use the `symlink_metadata()` method instead of `exists()`,
+            // since it handles dangling symlinks correctly. The method gives an
+            // `Ok()` results unless the source does not exist, or the user
+            // lacks permission to access metadata.
+            if source.symlink_metadata().is_err() {
+                return Err(MvError::NoSuchFile(source.quote().to_string()).into());
             }
 
-            // GNU semantics are: if the source and target are the same, no move occurs and we print an error
-            if source.eq(target) {
-                // Done to match GNU semantics for the dot file
-                if source.eq(Path::new(".")) || source.ends_with("/.") || source.is_file() {
-                    return Err(MvError::SameFile(
-                        source.quote().to_string(),
-                        target.quote().to_string(),
+            // GNU semantics are: if the source and target are the same, no move occurs and we print an error
+            if source.eq(target) {
+                // Done to match GNU semantics for the dot file
+                if source.eq(Path::new(".")) || source.ends_with("/.") || source.is_file() {
+                    return Err(MvError::SameFile(
+                        source.quote().to_string(),
+                        target.quote().to_string(),
                     )
-                    .into());
-                } else {
-                    return Err(MvError::SelfSubdirectory(source.display().to_string()).into());
+                    .into());
+                } else {
+                    return Err(MvError::SelfSubdirectory(source.display().to_string()).into());
                 }
             }
 
-            if target.is_dir() {
-                if b.no_target_dir {
-                    if !source.is_dir() {
-                        Err(MvError::DirectoryToNonDirectory(target.quote().to_string()).into())
-                    } else {
-                        rename(source, target, b).map_err_context(|| {
-                            format!("cannot move {} to {}", source.quote(), target.quote())
+            if target.is_dir() {
+                if b.no_target_dir {
+                    if !source.is_dir() {
+                        Err(MvError::DirectoryToNonDirectory(target.quote().to_string()).into())
+                    } else {
+                        rename(source, target, b).map_err_context(|| {
+                            format!("cannot move {} to {}", source.quote(), target.quote())
                         })
                     }
-                } else {
-                    move_files_into_dir(&[source.clone()], target, b)
+                } else {
+                    move_files_into_dir(&[source.clone()], target, b)
                 }
-            } else if target.exists() && source.is_dir() {
-                match b.overwrite {
-                    OverwriteMode::NoClobber => return Ok(()),
-                    OverwriteMode::Interactive => {
-                        println!("{}: overwrite {}? ", uucore::util_name(), target.quote());
-                        if !read_yes() {
-                            return Ok(());
+            } else if target.exists() && source.is_dir() {
+                match b.overwrite {
+                    OverwriteMode::NoClobber => return Ok(()),
+                    OverwriteMode::Interactive => {
+                        println!("{}: overwrite {}? ", uucore::util_name(), target.quote());
+                        if !read_yes() {
+                            return Ok(());
                         }
                     }
-                    OverwriteMode::Force => {}
+                    OverwriteMode::Force => {}
                 };
-                Err(MvError::NonDirectoryToDirectory(
-                    source.quote().to_string(),
-                    target.quote().to_string(),
+                Err(MvError::NonDirectoryToDirectory(
+                    source.quote().to_string(),
+                    target.quote().to_string(),
                 )
-                .into())
-            } else {
-                rename(source, target, b).map_err(|e| USimpleError::new(1, format!("{}", e)))
+                .into())
+            } else {
+                rename(source, target, b).map_err(|e| USimpleError::new(1, format!("{}", e)))
             }
         }
-        _ => {
-            if b.no_target_dir {
-                return Err(UUsageError::new(
+        _ => {
+            if b.no_target_dir {
+                return Err(UUsageError::new(
                     1,
-                    format!("mv: extra operand {}", files[2].quote()),
+                    format!("mv: extra operand {}", files[2].quote()),
                 ));
             }
-            let target_dir = paths.last().unwrap();
-            let sources = &paths[..paths.len() - 1];
+            let target_dir = paths.last().unwrap();
+            let sources = &paths[..paths.len() - 1];
 
-            move_files_into_dir(sources, target_dir, b)
+            move_files_into_dir(sources, target_dir, b)
         }
     }
 }
 
-fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UResult<()> {
-    if !target_dir.is_dir() {
-        return Err(MvError::NotADirectory(target_dir.quote().to_string()).into());
+fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, b: &Behavior) -> UResult<()> {
+    if !target_dir.is_dir() {
+        return Err(MvError::NotADirectory(target_dir.quote().to_string()).into());
     }
 
-    let canonized_target_dir = target_dir
-        .canonicalize()
-        .unwrap_or_else(|_| target_dir.to_path_buf());
+    let canonized_target_dir = target_dir
+        .canonicalize()
+        .unwrap_or_else(|_| target_dir.to_path_buf());
 
-    for sourcepath in files.iter() {
-        let targetpath = match sourcepath.file_name() {
-            Some(name) => target_dir.join(name),
-            None => {
-                show!(MvError::NoSuchFile(sourcepath.quote().to_string()));
+    for sourcepath in files.iter() {
+        let targetpath = match sourcepath.file_name() {
+            Some(name) => target_dir.join(name),
+            None => {
+                show!(MvError::NoSuchFile(sourcepath.quote().to_string()));
                 continue;
             }
         };
 
-        // Check if we have mv dir1 dir2 dir2
-        // And generate an error if this is the case
-        if let Ok(canonized_source) = sourcepath.canonicalize() {
-            if canonized_source == canonized_target_dir {
-                // User tried to move directory to itself, warning is shown
-                // and process of moving files is continued.
-                show!(USimpleError::new(
+        // Check if we have mv dir1 dir2 dir2
+        // And generate an error if this is the case
+        if let Ok(canonized_source) = sourcepath.canonicalize() {
+            if canonized_source == canonized_target_dir {
+                // User tried to move directory to itself, warning is shown
+                // and process of moving files is continued.
+                show!(USimpleError::new(
                     1,
                     format!(
                         "cannot move '{}' to a subdirectory of itself, '{}/{}'",
-                        sourcepath.display(),
-                        target_dir.display(),
-                        canonized_target_dir.components().last().map_or_else(
-                            || target_dir.display().to_string(),
-                            |dir| { PathBuf::from(dir.as_os_str()).display().to_string() }
+                        sourcepath.display(),
+                        target_dir.display(),
+                        canonized_target_dir.components().last().map_or_else(
+                            || target_dir.display().to_string(),
+                            |dir| { PathBuf::from(dir.as_os_str()).display().to_string() }
                         )
                     )
                 ));
@@ -873,162 +873,162 @@
         }
 
         show_if_err!(
-            rename(sourcepath, &targetpath, b).map_err_context(|| format!(
+            rename(sourcepath, &targetpath, b).map_err_context(|| format!(
                 "cannot move {} to {}",
-                sourcepath.quote(),
-                targetpath.quote()
+                sourcepath.quote(),
+                targetpath.quote()
             ))
         );
     }
     Ok(())
 }
 
-fn rename(from: &Path, to: &Path, b: &Behavior) -> io::Result<()> {
-    let mut backup_path = None;
+fn rename(from: &Path, to: &Path, b: &Behavior) -> io::Result<()> {
+    let mut backup_path = None;
 
-    if to.exists() {
-        if b.update && b.overwrite == OverwriteMode::Interactive {
-            // `mv -i --update old new` when `new` exists doesn't move anything
-            // and exit with 0
-            return Ok(());
+    if to.exists() {
+        if b.update && b.overwrite == OverwriteMode::Interactive {
+            // `mv -i --update old new` when `new` exists doesn't move anything
+            // and exit with 0
+            return Ok(());
         }
 
-        match b.overwrite {
-            OverwriteMode::NoClobber => return Ok(()),
-            OverwriteMode::Interactive => {
-                println!("{}: overwrite {}? ", uucore::util_name(), to.quote());
-                if !read_yes() {
-                    return Ok(());
+        match b.overwrite {
+            OverwriteMode::NoClobber => return Ok(()),
+            OverwriteMode::Interactive => {
+                println!("{}: overwrite {}? ", uucore::util_name(), to.quote());
+                if !read_yes() {
+                    return Ok(());
                 }
             }
-            OverwriteMode::Force => {}
+            OverwriteMode::Force => {}
         };
 
-        backup_path = backup_control::get_backup_path(b.backup, to, &b.suffix);
-        if let Some(ref backup_path) = backup_path {
-            rename_with_fallback(to, backup_path)?;
+        backup_path = backup_control::get_backup_path(b.backup, to, &b.suffix);
+        if let Some(ref backup_path) = backup_path {
+            rename_with_fallback(to, backup_path)?;
         }
 
-        if b.update && fs::metadata(from)?.modified()? <= fs::metadata(to)?.modified()? {
-            return Ok(());
+        if b.update && fs::metadata(from)?.modified()? <= fs::metadata(to)?.modified()? {
+            return Ok(());
         }
     }
 
-    // "to" may no longer exist if it was backed up
-    if to.exists() && to.is_dir() {
-        // normalize behavior between *nix and windows
-        if from.is_dir() {
-            if is_empty_dir(to) {
-                fs::remove_dir(to)?;
-            } else {
-                return Err(io::Error::new(io::ErrorKind::Other, "Directory not empty"));
+    // "to" may no longer exist if it was backed up
+    if to.exists() && to.is_dir() {
+        // normalize behavior between *nix and windows
+        if from.is_dir() {
+            if is_empty_dir(to) {
+                fs::remove_dir(to)?;
+            } else {
+                return Err(io::Error::new(io::ErrorKind::Other, "Directory not empty"));
             }
         }
     }
 
-    rename_with_fallback(from, to)?;
+    rename_with_fallback(from, to)?;
 
-    if b.verbose {
-        print!("{} -> {}", from.quote(), to.quote());
-        match backup_path {
-            Some(path) => println!(" (backup: {})", path.quote()),
-            None => println!(),
+    if b.verbose {
+        print!("{} -> {}", from.quote(), to.quote());
+        match backup_path {
+            Some(path) => println!(" (backup: {})", path.quote()),
+            None => println!(),
         }
     }
     Ok(())
 }
 
-/// A wrapper around `fs::rename`, so that if it fails, we try falling back on
-/// copying and removing.
-fn rename_with_fallback(from: &Path, to: &Path) -> io::Result<()> {
-    if fs::rename(from, to).is_err() {
-        // Get metadata without following symlinks
-        let metadata = from.symlink_metadata()?;
-        let file_type = metadata.file_type();
+/// A wrapper around `fs::rename`, so that if it fails, we try falling back on
+/// copying and removing.
+fn rename_with_fallback(from: &Path, to: &Path) -> io::Result<()> {
+    if fs::rename(from, to).is_err() {
+        // Get metadata without following symlinks
+        let metadata = from.symlink_metadata()?;
+        let file_type = metadata.file_type();
 
-        if file_type.is_symlink() {
-            rename_symlink_fallback(from, to)?;
-        } else if file_type.is_dir() {
-            // We remove the destination directory if it exists to match the
-            // behavior of `fs::rename`. As far as I can tell, `fs_extra`'s
-            // `move_dir` would otherwise behave differently.
-            if to.exists() {
-                fs::remove_dir_all(to)?;
+        if file_type.is_symlink() {
+            rename_symlink_fallback(from, to)?;
+        } else if file_type.is_dir() {
+            // We remove the destination directory if it exists to match the
+            // behavior of `fs::rename`. As far as I can tell, `fs_extra`'s
+            // `move_dir` would otherwise behave differently.
+            if to.exists() {
+                fs::remove_dir_all(to)?;
             }
-            let options = DirCopyOptions {
-                // From the `fs_extra` documentation:
-                // "Recursively copy a directory with a new name or place it
-                // inside the destination. (same behaviors like cp -r in Unix)"
-                copy_inside: true,
-                ..DirCopyOptions::new()
+            let options = DirCopyOptions {
+                // From the `fs_extra` documentation:
+                // "Recursively copy a directory with a new name or place it
+                // inside the destination. (same behaviors like cp -r in Unix)"
+                copy_inside: true,
+                ..DirCopyOptions::new()
             };
-            if let Err(err) = move_dir(from, to, &options) {
-                return match err.kind {
-                    fs_extra::error::ErrorKind::PermissionDenied => Err(io::Error::new(
-                        io::ErrorKind::PermissionDenied,
+            if let Err(err) = move_dir(from, to, &options) {
+                return match err.kind {
+                    fs_extra::error::ErrorKind::PermissionDenied => Err(io::Error::new(
+                        io::ErrorKind::PermissionDenied,
                         "Permission denied",
                     )),
-                    _ => Err(io::Error::new(io::ErrorKind::Other, format!("{:?}", err))),
+                    _ => Err(io::Error::new(io::ErrorKind::Other, format!("{:?}", err))),
                 };
             }
-        } else {
-            fs::copy(from, to).and_then(|_| fs::remove_file(from))?;
+        } else {
+            fs::copy(from, to).and_then(|_| fs::remove_file(from))?;
         }
     }
     Ok(())
 }
 
-/// Move the given symlink to the given destination. On Windows, dangling
-/// symlinks return an error.
-#[inline]
-fn rename_symlink_fallback(from: &Path, to: &Path) -> io::Result<()> {
-    let path_symlink_points_to = fs::read_link(from)?;
-    #[cfg(unix)]
-    {
-        unix::fs::symlink(&path_symlink_points_to, to).and_then(|_| fs::remove_file(from))?;
+/// Move the given symlink to the given destination. On Windows, dangling
+/// symlinks return an error.
+#[inline]
+fn rename_symlink_fallback(from: &Path, to: &Path) -> io::Result<()> {
+    let path_symlink_points_to = fs::read_link(from)?;
+    #[cfg(unix)]
+    {
+        unix::fs::symlink(&path_symlink_points_to, to).and_then(|_| fs::remove_file(from))?;
     }
-    #[cfg(windows)]
-    {
-        if path_symlink_points_to.exists() {
-            if path_symlink_points_to.is_dir() {
-                windows::fs::symlink_dir(&path_symlink_points_to, &to)?;
-            } else {
-                windows::fs::symlink_file(&path_symlink_points_to, &to)?;
+    #[cfg(windows)]
+    {
+        if path_symlink_points_to.exists() {
+            if path_symlink_points_to.is_dir() {
+                windows::fs::symlink_dir(&path_symlink_points_to, &to)?;
+            } else {
+                windows::fs::symlink_file(&path_symlink_points_to, &to)?;
             }
-            fs::remove_file(&from)?;
-        } else {
-            return Err(io::Error::new(
-                io::ErrorKind::NotFound,
+            fs::remove_file(&from)?;
+        } else {
+            return Err(io::Error::new(
+                io::ErrorKind::NotFound,
                 "can't determine symlink type, since it is dangling",
             ));
         }
     }
-    #[cfg(not(any(windows, unix)))]
-    {
-        return Err(io::Error::new(
-            io::ErrorKind::Other,
+    #[cfg(not(any(windows, unix)))]
+    {
+        return Err(io::Error::new(
+            io::ErrorKind::Other,
             "your operating system does not support symlinks",
         ));
     }
     Ok(())
 }
 
-fn read_yes() -> bool {
-    let mut s = String::new();
-    match stdin().read_line(&mut s) {
-        Ok(_) => match s.chars().next() {
-            Some(x) => x == 'y' || x == 'Y',
-            _ => false,
+fn read_yes() -> bool {
+    let mut s = String::new();
+    match stdin().read_line(&mut s) {
+        Ok(_) => match s.chars().next() {
+            Some(x) => x == 'y' || x == 'Y',
+            _ => false,
         },
-        _ => false,
+        _ => false,
     }
 }
 
-fn is_empty_dir(path: &Path) -> bool {
-    match fs::read_dir(path) {
-        Ok(contents) => contents.peekable().peek().is_none(),
-        Err(_e) => false,
+fn is_empty_dir(path: &Path) -> bool {
+    match fs::read_dir(path) {
+        Ok(contents) => contents.peekable().peek().is_none(),
+        Err(_e) => false,
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_nice/nice.rs.html b/dev/src/uu_nice/nice.rs.html index f89085e2e..531f30fb3 100644 --- a/dev/src/uu_nice/nice.rs.html +++ b/dev/src/uu_nice/nice.rs.html @@ -1,4 +1,4 @@ -nice.rs - source
1
+nice.rs - source
1
 2
 3
 4
@@ -120,127 +120,127 @@
 120
 121
 122
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) getpriority execvp setpriority nstr PRIO cstrs ENOENT
+// spell-checker:ignore (ToDO) getpriority execvp setpriority nstr PRIO cstrs ENOENT
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use libc::{c_char, c_int, execvp, PRIO_PROCESS};
-use std::ffi::CString;
-use std::io::Error;
-use std::ptr;
+use libc::{c_char, c_int, execvp, PRIO_PROCESS};
+use std::ffi::CString;
+use std::io::Error;
+use std::ptr;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use uucore::{
-    error::{set_exit_code, UClapError, UResult, USimpleError, UUsageError},
-    format_usage,
+use clap::{crate_version, Arg, ArgAction, Command};
+use uucore::{
+    error::{set_exit_code, UClapError, UResult, USimpleError, UUsageError},
+    format_usage,
 };
 
-pub mod options {
-    pub static ADJUSTMENT: &str = "adjustment";
-    pub static COMMAND: &str = "COMMAND";
+pub mod options {
+    pub static ADJUSTMENT: &str = "adjustment";
+    pub static COMMAND: &str = "COMMAND";
 }
 
-const ABOUT: &str = "\
+const ABOUT: &str = "\
     Run COMMAND with an adjusted niceness, which affects process scheduling. \
     With no COMMAND, print the current niceness.  Niceness values range from at \
     least -20 (most favorable to the process) to 19 (least favorable to the \
     process).";
-const USAGE: &str = "{} [OPTIONS] [COMMAND [ARGS]]";
+const USAGE: &str = "{} [OPTIONS] [COMMAND [ARGS]]";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
 
-    nix::errno::Errno::clear();
-    let mut niceness = unsafe { libc::getpriority(PRIO_PROCESS, 0) };
-    if Error::last_os_error().raw_os_error().unwrap() != 0 {
-        return Err(USimpleError::new(
+    nix::errno::Errno::clear();
+    let mut niceness = unsafe { libc::getpriority(PRIO_PROCESS, 0) };
+    if Error::last_os_error().raw_os_error().unwrap() != 0 {
+        return Err(USimpleError::new(
             125,
-            format!("getpriority: {}", Error::last_os_error()),
+            format!("getpriority: {}", Error::last_os_error()),
         ));
     }
 
-    let adjustment = match matches.get_one::<String>(options::ADJUSTMENT) {
-        Some(nstr) => {
-            if !matches.contains_id(options::COMMAND) {
-                return Err(UUsageError::new(
+    let adjustment = match matches.get_one::<String>(options::ADJUSTMENT) {
+        Some(nstr) => {
+            if !matches.contains_id(options::COMMAND) {
+                return Err(UUsageError::new(
                     125,
                     "A command must be given with an adjustment.",
                 ));
             }
-            match nstr.parse() {
-                Ok(num) => num,
-                Err(e) => {
-                    return Err(USimpleError::new(
+            match nstr.parse() {
+                Ok(num) => num,
+                Err(e) => {
+                    return Err(USimpleError::new(
                         125,
-                        format!("\"{}\" is not a valid number: {}", nstr, e),
+                        format!("\"{}\" is not a valid number: {}", nstr, e),
                     ))
                 }
             }
         }
-        None => {
-            if !matches.contains_id(options::COMMAND) {
-                println!("{}", niceness);
-                return Ok(());
+        None => {
+            if !matches.contains_id(options::COMMAND) {
+                println!("{}", niceness);
+                return Ok(());
             }
-            10_i32
-        }
+            10_i32
+        }
     };
 
-    niceness += adjustment;
-    if unsafe { libc::setpriority(PRIO_PROCESS, 0, niceness) } == -1 {
-        show_warning!("setpriority: {}", Error::last_os_error());
+    niceness += adjustment;
+    if unsafe { libc::setpriority(PRIO_PROCESS, 0, niceness) } == -1 {
+        show_warning!("setpriority: {}", Error::last_os_error());
     }
 
-    let cstrs: Vec<CString> = matches
-        .get_many::<String>(options::COMMAND)
-        .unwrap()
-        .map(|x| CString::new(x.as_bytes()).unwrap())
-        .collect();
+    let cstrs: Vec<CString> = matches
+        .get_many::<String>(options::COMMAND)
+        .unwrap()
+        .map(|x| CString::new(x.as_bytes()).unwrap())
+        .collect();
 
-    let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect();
-    args.push(ptr::null::<c_char>());
-    unsafe {
-        execvp(args[0], args.as_mut_ptr());
+    let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect();
+    args.push(ptr::null::<c_char>());
+    unsafe {
+        execvp(args[0], args.as_mut_ptr());
     }
 
-    show_error!("execvp: {}", Error::last_os_error());
-    let exit_code = if Error::last_os_error().raw_os_error().unwrap() as c_int == libc::ENOENT {
-        127
-    } else {
-        126
-    };
-    set_exit_code(exit_code);
+    show_error!("execvp: {}", Error::last_os_error());
+    let exit_code = if Error::last_os_error().raw_os_error().unwrap() as c_int == libc::ENOENT {
+        127
+    } else {
+        126
+    };
+    set_exit_code(exit_code);
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .trailing_var_arg(true)
-        .infer_long_args(true)
-        .version(crate_version!())
-        .arg(
-            Arg::new(options::ADJUSTMENT)
-                .short('n')
-                .long(options::ADJUSTMENT)
-                .help("add N to the niceness (default is 10)")
-                .allow_hyphen_values(true),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .trailing_var_arg(true)
+        .infer_long_args(true)
+        .version(crate_version!())
+        .arg(
+            Arg::new(options::ADJUSTMENT)
+                .short('n')
+                .long(options::ADJUSTMENT)
+                .help("add N to the niceness (default is 10)")
+                .allow_hyphen_values(true),
         )
-        .arg(
-            Arg::new(options::COMMAND)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::CommandName),
+        .arg(
+            Arg::new(options::COMMAND)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::CommandName),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_nl/helper.rs.html b/dev/src/uu_nl/helper.rs.html index 3f37c7cce..120273997 100644 --- a/dev/src/uu_nl/helper.rs.html +++ b/dev/src/uu_nl/helper.rs.html @@ -1,4 +1,4 @@ -helper.rs - source
1
+helper.rs - source
1
 2
 3
 4
@@ -144,151 +144,151 @@
 144
 145
 146
-
// spell-checker:ignore (ToDO) conv
+
// spell-checker:ignore (ToDO) conv
 
-use crate::options;
+use crate::options;
 
-// parse_style parses a style string into a NumberingStyle.
-fn parse_style(chars: &[char]) -> Result<crate::NumberingStyle, String> {
-    if chars.len() == 1 && chars[0] == 'a' {
-        Ok(crate::NumberingStyle::NumberForAll)
-    } else if chars.len() == 1 && chars[0] == 't' {
-        Ok(crate::NumberingStyle::NumberForNonEmpty)
-    } else if chars.len() == 1 && chars[0] == 'n' {
-        Ok(crate::NumberingStyle::NumberForNone)
-    } else if chars.len() > 1 && chars[0] == 'p' {
-        let s: String = chars[1..].iter().cloned().collect();
-        match regex::Regex::new(&s) {
-            Ok(re) => Ok(crate::NumberingStyle::NumberForRegularExpression(Box::new(
-                re,
+// parse_style parses a style string into a NumberingStyle.
+fn parse_style(chars: &[char]) -> Result<crate::NumberingStyle, String> {
+    if chars.len() == 1 && chars[0] == 'a' {
+        Ok(crate::NumberingStyle::NumberForAll)
+    } else if chars.len() == 1 && chars[0] == 't' {
+        Ok(crate::NumberingStyle::NumberForNonEmpty)
+    } else if chars.len() == 1 && chars[0] == 'n' {
+        Ok(crate::NumberingStyle::NumberForNone)
+    } else if chars.len() > 1 && chars[0] == 'p' {
+        let s: String = chars[1..].iter().cloned().collect();
+        match regex::Regex::new(&s) {
+            Ok(re) => Ok(crate::NumberingStyle::NumberForRegularExpression(Box::new(
+                re,
             ))),
-            Err(_) => Err(String::from("Illegal regular expression")),
+            Err(_) => Err(String::from("Illegal regular expression")),
         }
-    } else {
-        Err(String::from("Illegal style encountered"))
+    } else {
+        Err(String::from("Illegal style encountered"))
     }
 }
 
-// parse_options loads the options into the settings, returning an array of
-// error messages.
-pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> Vec<String> {
-    // This vector holds error messages encountered.
-    let mut errs: Vec<String> = vec![];
-    settings.renumber = !opts.contains_id(options::NO_RENUMBER);
-    match opts.get_one::<String>(options::NUMBER_SEPARATOR) {
-        None => {}
-        Some(val) => {
-            settings.number_separator = val.to_owned();
+// parse_options loads the options into the settings, returning an array of
+// error messages.
+pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> Vec<String> {
+    // This vector holds error messages encountered.
+    let mut errs: Vec<String> = vec![];
+    settings.renumber = !opts.contains_id(options::NO_RENUMBER);
+    match opts.get_one::<String>(options::NUMBER_SEPARATOR) {
+        None => {}
+        Some(val) => {
+            settings.number_separator = val.to_owned();
         }
     }
-    match opts.get_one::<String>(options::NUMBER_FORMAT) {
-        None => {}
-        Some(val) => match val.as_str() {
-            "ln" => {
-                settings.number_format = crate::NumberFormat::Left;
+    match opts.get_one::<String>(options::NUMBER_FORMAT) {
+        None => {}
+        Some(val) => match val.as_str() {
+            "ln" => {
+                settings.number_format = crate::NumberFormat::Left;
             }
-            "rn" => {
-                settings.number_format = crate::NumberFormat::Right;
+            "rn" => {
+                settings.number_format = crate::NumberFormat::Right;
             }
-            "rz" => {
-                settings.number_format = crate::NumberFormat::RightZero;
+            "rz" => {
+                settings.number_format = crate::NumberFormat::RightZero;
             }
-            _ => {
-                errs.push(String::from("Illegal value for -n"));
+            _ => {
+                errs.push(String::from("Illegal value for -n"));
             }
         },
     }
-    match opts.get_one::<String>(options::BODY_NUMBERING) {
-        None => {}
-        Some(val) => {
-            let chars: Vec<char> = val.chars().collect();
-            match parse_style(&chars) {
-                Ok(s) => {
-                    settings.body_numbering = s;
+    match opts.get_one::<String>(options::BODY_NUMBERING) {
+        None => {}
+        Some(val) => {
+            let chars: Vec<char> = val.chars().collect();
+            match parse_style(&chars) {
+                Ok(s) => {
+                    settings.body_numbering = s;
                 }
-                Err(message) => {
-                    errs.push(message);
+                Err(message) => {
+                    errs.push(message);
                 }
             }
         }
     }
-    match opts.get_one::<String>(options::FOOTER_NUMBERING) {
-        None => {}
-        Some(val) => {
-            let chars: Vec<char> = val.chars().collect();
-            match parse_style(&chars) {
-                Ok(s) => {
-                    settings.footer_numbering = s;
+    match opts.get_one::<String>(options::FOOTER_NUMBERING) {
+        None => {}
+        Some(val) => {
+            let chars: Vec<char> = val.chars().collect();
+            match parse_style(&chars) {
+                Ok(s) => {
+                    settings.footer_numbering = s;
                 }
-                Err(message) => {
-                    errs.push(message);
+                Err(message) => {
+                    errs.push(message);
                 }
             }
         }
     }
-    match opts.get_one::<String>(options::HEADER_NUMBERING) {
-        None => {}
-        Some(val) => {
-            let chars: Vec<char> = val.chars().collect();
-            match parse_style(&chars) {
-                Ok(s) => {
-                    settings.header_numbering = s;
+    match opts.get_one::<String>(options::HEADER_NUMBERING) {
+        None => {}
+        Some(val) => {
+            let chars: Vec<char> = val.chars().collect();
+            match parse_style(&chars) {
+                Ok(s) => {
+                    settings.header_numbering = s;
                 }
-                Err(message) => {
-                    errs.push(message);
+                Err(message) => {
+                    errs.push(message);
                 }
             }
         }
     }
-    match opts.get_one::<String>(options::LINE_INCREMENT) {
-        None => {}
-        Some(val) => {
-            let conv: Option<u64> = val.parse().ok();
-            match conv {
-                None => {
-                    errs.push(String::from("Illegal value for -i"));
+    match opts.get_one::<String>(options::LINE_INCREMENT) {
+        None => {}
+        Some(val) => {
+            let conv: Option<u64> = val.parse().ok();
+            match conv {
+                None => {
+                    errs.push(String::from("Illegal value for -i"));
                 }
-                Some(num) => settings.line_increment = num,
+                Some(num) => settings.line_increment = num,
             }
         }
     }
-    match opts.get_one::<String>(options::NUMBER_WIDTH) {
-        None => {}
-        Some(val) => {
-            let conv: Option<usize> = val.parse().ok();
-            match conv {
-                None => {
-                    errs.push(String::from("Illegal value for -w"));
+    match opts.get_one::<String>(options::NUMBER_WIDTH) {
+        None => {}
+        Some(val) => {
+            let conv: Option<usize> = val.parse().ok();
+            match conv {
+                None => {
+                    errs.push(String::from("Illegal value for -w"));
                 }
-                Some(num) => settings.number_width = num,
+                Some(num) => settings.number_width = num,
             }
         }
     }
-    match opts.get_one::<String>(options::STARTING_LINE_NUMBER) {
-        None => {}
-        Some(val) => {
-            let conv: Option<u64> = val.parse().ok();
-            match conv {
-                None => {
-                    errs.push(String::from("Illegal value for -v"));
+    match opts.get_one::<String>(options::STARTING_LINE_NUMBER) {
+        None => {}
+        Some(val) => {
+            let conv: Option<u64> = val.parse().ok();
+            match conv {
+                None => {
+                    errs.push(String::from("Illegal value for -v"));
                 }
-                Some(num) => settings.starting_line_number = num,
+                Some(num) => settings.starting_line_number = num,
             }
         }
     }
-    match opts.get_one::<String>(options::JOIN_BLANK_LINES) {
-        None => {}
-        Some(val) => {
-            let conv: Option<u64> = val.parse().ok();
-            match conv {
-                None => {
-                    errs.push(String::from("Illegal value for -l"));
+    match opts.get_one::<String>(options::JOIN_BLANK_LINES) {
+        None => {}
+        Some(val) => {
+            let conv: Option<u64> = val.parse().ok();
+            match conv {
+                None => {
+                    errs.push(String::from("Illegal value for -l"));
                 }
-                Some(num) => settings.join_blank_lines = num,
+                Some(num) => settings.join_blank_lines = num,
             }
         }
     }
-    errs
+    errs
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_nl/nl.rs.html b/dev/src/uu_nl/nl.rs.html index e21387f80..779e3aa53 100644 --- a/dev/src/uu_nl/nl.rs.html +++ b/dev/src/uu_nl/nl.rs.html @@ -1,4 +1,4 @@ -nl.rs - source
1
+nl.rs - source
1
 2
 3
 4
@@ -402,409 +402,409 @@
 402
 403
 404
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Tobias Bohumir Schottdorf <tobias.schottdorf@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-//  *
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Tobias Bohumir Schottdorf <tobias.schottdorf@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+//  *
 
-// spell-checker:ignore (ToDO) corasick memchr
+// spell-checker:ignore (ToDO) corasick memchr
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fs::File;
-use std::io::{stdin, BufRead, BufReader, Read};
-use std::iter::repeat;
-use std::path::Path;
-use uucore::error::{FromIo, UResult, USimpleError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fs::File;
+use std::io::{stdin, BufRead, BufReader, Read};
+use std::iter::repeat;
+use std::path::Path;
+use uucore::error::{FromIo, UResult, USimpleError};
+use uucore::format_usage;
 
-mod helper;
+mod helper;
 
-static NAME: &str = "nl";
-static ABOUT: &str = "number lines of files";
-static USAGE: &str = "{} [OPTION]... [FILE]...";
+static NAME: &str = "nl";
+static ABOUT: &str = "number lines of files";
+static USAGE: &str = "{} [OPTION]... [FILE]...";
 
-// Settings store options used by nl to produce its output.
-pub struct Settings {
-    // The variables corresponding to the options -h, -b, and -f.
-    header_numbering: NumberingStyle,
-    body_numbering: NumberingStyle,
-    footer_numbering: NumberingStyle,
-    // The variable corresponding to -d
-    section_delimiter: [char; 2],
-    // The variables corresponding to the options -v, -i, -l, -w.
-    starting_line_number: u64,
-    line_increment: u64,
-    join_blank_lines: u64,
-    number_width: usize, // Used with String::from_char, hence usize.
-    // The format of the number and the (default value for)
-    // renumbering each page.
-    number_format: NumberFormat,
-    renumber: bool,
-    // The string appended to each line number output.
-    number_separator: String,
+// Settings store options used by nl to produce its output.
+pub struct Settings {
+    // The variables corresponding to the options -h, -b, and -f.
+    header_numbering: NumberingStyle,
+    body_numbering: NumberingStyle,
+    footer_numbering: NumberingStyle,
+    // The variable corresponding to -d
+    section_delimiter: [char; 2],
+    // The variables corresponding to the options -v, -i, -l, -w.
+    starting_line_number: u64,
+    line_increment: u64,
+    join_blank_lines: u64,
+    number_width: usize, // Used with String::from_char, hence usize.
+    // The format of the number and the (default value for)
+    // renumbering each page.
+    number_format: NumberFormat,
+    renumber: bool,
+    // The string appended to each line number output.
+    number_separator: String,
 }
 
-// NumberingStyle stores which lines are to be numbered.
-// The possible options are:
-// 1. Number all lines
-// 2. Number only nonempty lines
-// 3. Don't number any lines at all
-// 4. Number all lines that match a basic regular expression.
-#[allow(clippy::enum_variant_names)]
-enum NumberingStyle {
-    NumberForAll,
-    NumberForNonEmpty,
-    NumberForNone,
-    NumberForRegularExpression(Box<regex::Regex>),
+// NumberingStyle stores which lines are to be numbered.
+// The possible options are:
+// 1. Number all lines
+// 2. Number only nonempty lines
+// 3. Don't number any lines at all
+// 4. Number all lines that match a basic regular expression.
+#[allow(clippy::enum_variant_names)]
+enum NumberingStyle {
+    NumberForAll,
+    NumberForNonEmpty,
+    NumberForNone,
+    NumberForRegularExpression(Box<regex::Regex>),
 }
 
-// NumberFormat specifies how line numbers are output within their allocated
-// space. They are justified to the left or right, in the latter case with
-// the option of having all unused space to its left turned into leading zeroes.
-enum NumberFormat {
-    Left,
-    Right,
-    RightZero,
+// NumberFormat specifies how line numbers are output within their allocated
+// space. They are justified to the left or right, in the latter case with
+// the option of having all unused space to its left turned into leading zeroes.
+enum NumberFormat {
+    Left,
+    Right,
+    RightZero,
 }
 
-pub mod options {
-    pub const HELP: &str = "help";
-    pub const FILE: &str = "file";
-    pub const BODY_NUMBERING: &str = "body-numbering";
-    pub const SECTION_DELIMITER: &str = "section-delimiter";
-    pub const FOOTER_NUMBERING: &str = "footer-numbering";
-    pub const HEADER_NUMBERING: &str = "header-numbering";
-    pub const LINE_INCREMENT: &str = "line-increment";
-    pub const JOIN_BLANK_LINES: &str = "join-blank-lines";
-    pub const NUMBER_FORMAT: &str = "number-format";
-    pub const NO_RENUMBER: &str = "no-renumber";
-    pub const NUMBER_SEPARATOR: &str = "number-separator";
-    pub const STARTING_LINE_NUMBER: &str = "starting-line-number";
-    pub const NUMBER_WIDTH: &str = "number-width";
+pub mod options {
+    pub const HELP: &str = "help";
+    pub const FILE: &str = "file";
+    pub const BODY_NUMBERING: &str = "body-numbering";
+    pub const SECTION_DELIMITER: &str = "section-delimiter";
+    pub const FOOTER_NUMBERING: &str = "footer-numbering";
+    pub const HEADER_NUMBERING: &str = "header-numbering";
+    pub const LINE_INCREMENT: &str = "line-increment";
+    pub const JOIN_BLANK_LINES: &str = "join-blank-lines";
+    pub const NUMBER_FORMAT: &str = "number-format";
+    pub const NO_RENUMBER: &str = "no-renumber";
+    pub const NUMBER_SEPARATOR: &str = "number-separator";
+    pub const STARTING_LINE_NUMBER: &str = "starting-line-number";
+    pub const NUMBER_WIDTH: &str = "number-width";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    // A mutable settings object, initialized with the defaults.
-    let mut settings = Settings {
-        header_numbering: NumberingStyle::NumberForNone,
-        body_numbering: NumberingStyle::NumberForAll,
-        footer_numbering: NumberingStyle::NumberForNone,
-        section_delimiter: ['\\', ':'],
-        starting_line_number: 1,
-        line_increment: 1,
-        join_blank_lines: 1,
-        number_width: 6,
-        number_format: NumberFormat::Right,
-        renumber: true,
-        number_separator: String::from("\t"),
+    // A mutable settings object, initialized with the defaults.
+    let mut settings = Settings {
+        header_numbering: NumberingStyle::NumberForNone,
+        body_numbering: NumberingStyle::NumberForAll,
+        footer_numbering: NumberingStyle::NumberForNone,
+        section_delimiter: ['\\', ':'],
+        starting_line_number: 1,
+        line_increment: 1,
+        join_blank_lines: 1,
+        number_width: 6,
+        number_format: NumberFormat::Right,
+        renumber: true,
+        number_separator: String::from("\t"),
     };
 
-    // Update the settings from the command line options, and terminate the
-    // program if some options could not successfully be parsed.
-    let parse_errors = helper::parse_options(&mut settings, &matches);
-    if !parse_errors.is_empty() {
-        return Err(USimpleError::new(
+    // Update the settings from the command line options, and terminate the
+    // program if some options could not successfully be parsed.
+    let parse_errors = helper::parse_options(&mut settings, &matches);
+    if !parse_errors.is_empty() {
+        return Err(USimpleError::new(
             1,
-            format!("Invalid arguments supplied.\n{}", parse_errors.join("\n")),
+            format!("Invalid arguments supplied.\n{}", parse_errors.join("\n")),
         ));
     }
 
-    let mut read_stdin = false;
-    let files: Vec<String> = match matches.get_many::<String>(options::FILE) {
-        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
-        None => vec!["-".to_owned()],
+    let mut read_stdin = false;
+    let files: Vec<String> = match matches.get_many::<String>(options::FILE) {
+        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
+        None => vec!["-".to_owned()],
     };
 
-    for file in &files {
-        if file == "-" {
-            // If both file names and '-' are specified, we choose to treat first all
-            // regular files, and then read from stdin last.
-            read_stdin = true;
+    for file in &files {
+        if file == "-" {
+            // If both file names and '-' are specified, we choose to treat first all
+            // regular files, and then read from stdin last.
+            read_stdin = true;
             continue;
         }
-        let path = Path::new(file);
-        let reader = File::open(path).map_err_context(|| file.to_string())?;
-        let mut buffer = BufReader::new(reader);
-        nl(&mut buffer, &settings)?;
+        let path = Path::new(file);
+        let reader = File::open(path).map_err_context(|| file.to_string())?;
+        let mut buffer = BufReader::new(reader);
+        nl(&mut buffer, &settings)?;
     }
 
-    if read_stdin {
-        let mut buffer = BufReader::new(stdin());
-        nl(&mut buffer, &settings)?;
+    if read_stdin {
+        let mut buffer = BufReader::new(stdin());
+        nl(&mut buffer, &settings)?;
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .about(ABOUT)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .about(ABOUT)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::BODY_NUMBERING)
-                .short('b')
-                .long(options::BODY_NUMBERING)
-                .help("use STYLE for numbering body lines")
-                .value_name("SYNTAX"),
+        .arg(
+            Arg::new(options::BODY_NUMBERING)
+                .short('b')
+                .long(options::BODY_NUMBERING)
+                .help("use STYLE for numbering body lines")
+                .value_name("SYNTAX"),
         )
-        .arg(
-            Arg::new(options::SECTION_DELIMITER)
-                .short('d')
-                .long(options::SECTION_DELIMITER)
-                .help("use CC for separating logical pages")
-                .value_name("CC"),
+        .arg(
+            Arg::new(options::SECTION_DELIMITER)
+                .short('d')
+                .long(options::SECTION_DELIMITER)
+                .help("use CC for separating logical pages")
+                .value_name("CC"),
         )
-        .arg(
-            Arg::new(options::FOOTER_NUMBERING)
-                .short('f')
-                .long(options::FOOTER_NUMBERING)
-                .help("use STYLE for numbering footer lines")
-                .value_name("STYLE"),
+        .arg(
+            Arg::new(options::FOOTER_NUMBERING)
+                .short('f')
+                .long(options::FOOTER_NUMBERING)
+                .help("use STYLE for numbering footer lines")
+                .value_name("STYLE"),
         )
-        .arg(
-            Arg::new(options::HEADER_NUMBERING)
-                .short('h')
-                .long(options::HEADER_NUMBERING)
-                .help("use STYLE for numbering header lines")
-                .value_name("STYLE"),
+        .arg(
+            Arg::new(options::HEADER_NUMBERING)
+                .short('h')
+                .long(options::HEADER_NUMBERING)
+                .help("use STYLE for numbering header lines")
+                .value_name("STYLE"),
         )
-        .arg(
-            Arg::new(options::LINE_INCREMENT)
-                .short('i')
-                .long(options::LINE_INCREMENT)
-                .help("line number increment at each line")
-                .value_name("NUMBER"),
+        .arg(
+            Arg::new(options::LINE_INCREMENT)
+                .short('i')
+                .long(options::LINE_INCREMENT)
+                .help("line number increment at each line")
+                .value_name("NUMBER"),
         )
-        .arg(
-            Arg::new(options::JOIN_BLANK_LINES)
-                .short('l')
-                .long(options::JOIN_BLANK_LINES)
-                .help("group of NUMBER empty lines counted as one")
-                .value_name("NUMBER"),
+        .arg(
+            Arg::new(options::JOIN_BLANK_LINES)
+                .short('l')
+                .long(options::JOIN_BLANK_LINES)
+                .help("group of NUMBER empty lines counted as one")
+                .value_name("NUMBER"),
         )
-        .arg(
-            Arg::new(options::NUMBER_FORMAT)
-                .short('n')
-                .long(options::NUMBER_FORMAT)
-                .help("insert line numbers according to FORMAT")
-                .value_name("FORMAT"),
+        .arg(
+            Arg::new(options::NUMBER_FORMAT)
+                .short('n')
+                .long(options::NUMBER_FORMAT)
+                .help("insert line numbers according to FORMAT")
+                .value_name("FORMAT"),
         )
-        .arg(
-            Arg::new(options::NO_RENUMBER)
-                .short('p')
-                .long(options::NO_RENUMBER)
-                .help("do not reset line numbers at logical pages"),
+        .arg(
+            Arg::new(options::NO_RENUMBER)
+                .short('p')
+                .long(options::NO_RENUMBER)
+                .help("do not reset line numbers at logical pages"),
         )
-        .arg(
-            Arg::new(options::NUMBER_SEPARATOR)
-                .short('s')
-                .long(options::NUMBER_SEPARATOR)
-                .help("add STRING after (possible) line number")
-                .value_name("STRING"),
+        .arg(
+            Arg::new(options::NUMBER_SEPARATOR)
+                .short('s')
+                .long(options::NUMBER_SEPARATOR)
+                .help("add STRING after (possible) line number")
+                .value_name("STRING"),
         )
-        .arg(
-            Arg::new(options::STARTING_LINE_NUMBER)
-                .short('v')
-                .long(options::STARTING_LINE_NUMBER)
-                .help("first line number on each logical page")
-                .value_name("NUMBER"),
+        .arg(
+            Arg::new(options::STARTING_LINE_NUMBER)
+                .short('v')
+                .long(options::STARTING_LINE_NUMBER)
+                .help("first line number on each logical page")
+                .value_name("NUMBER"),
         )
-        .arg(
-            Arg::new(options::NUMBER_WIDTH)
-                .short('w')
-                .long(options::NUMBER_WIDTH)
-                .help("use NUMBER columns for line numbers")
-                .value_name("NUMBER"),
+        .arg(
+            Arg::new(options::NUMBER_WIDTH)
+                .short('w')
+                .long(options::NUMBER_WIDTH)
+                .help("use NUMBER columns for line numbers")
+                .value_name("NUMBER"),
         )
 }
 
-// nl implements the main functionality for an individual buffer.
-fn nl<T: Read>(reader: &mut BufReader<T>, settings: &Settings) -> UResult<()> {
-    let regexp: regex::Regex = regex::Regex::new(r".?").unwrap();
-    let mut line_no = settings.starting_line_number;
-    // The current line number's width as a string. Using to_string is inefficient
-    // but since we only do it once, it should not hurt.
-    let mut line_no_width = line_no.to_string().len();
-    let line_no_width_initial = line_no_width;
-    // Stores the smallest integer with one more digit than line_no, so that
-    // when line_no >= line_no_threshold, we need to use one more digit.
-    let mut line_no_threshold = 10u64.pow(line_no_width as u32);
-    let mut empty_line_count: u64 = 0;
-    let fill_char = match settings.number_format {
-        NumberFormat::RightZero => '0',
-        _ => ' ',
+// nl implements the main functionality for an individual buffer.
+fn nl<T: Read>(reader: &mut BufReader<T>, settings: &Settings) -> UResult<()> {
+    let regexp: regex::Regex = regex::Regex::new(r".?").unwrap();
+    let mut line_no = settings.starting_line_number;
+    // The current line number's width as a string. Using to_string is inefficient
+    // but since we only do it once, it should not hurt.
+    let mut line_no_width = line_no.to_string().len();
+    let line_no_width_initial = line_no_width;
+    // Stores the smallest integer with one more digit than line_no, so that
+    // when line_no >= line_no_threshold, we need to use one more digit.
+    let mut line_no_threshold = 10u64.pow(line_no_width as u32);
+    let mut empty_line_count: u64 = 0;
+    let fill_char = match settings.number_format {
+        NumberFormat::RightZero => '0',
+        _ => ' ',
     };
-    // Initially, we use the body's line counting settings
-    let mut regex_filter = match settings.body_numbering {
-        NumberingStyle::NumberForRegularExpression(ref re) => re,
-        _ => &regexp,
+    // Initially, we use the body's line counting settings
+    let mut regex_filter = match settings.body_numbering {
+        NumberingStyle::NumberForRegularExpression(ref re) => re,
+        _ => &regexp,
     };
-    let mut line_filter: fn(&str, &regex::Regex) -> bool = pass_regex;
-    for l in reader.lines() {
-        let mut l = l.map_err_context(|| "could not read line".to_string())?;
-        // Sanitize the string. We want to print the newline ourselves.
-        if l.ends_with('\n') {
-            l.pop();
+    let mut line_filter: fn(&str, &regex::Regex) -> bool = pass_regex;
+    for l in reader.lines() {
+        let mut l = l.map_err_context(|| "could not read line".to_string())?;
+        // Sanitize the string. We want to print the newline ourselves.
+        if l.ends_with('\n') {
+            l.pop();
         }
-        // Next we iterate through the individual chars to see if this
-        // is one of the special lines starting a new "section" in the
-        // document.
-        let line = l;
-        let mut odd = false;
-        // matched_group counts how many copies of section_delimiter
-        // this string consists of (0 if there's anything else)
-        let mut matched_groups = 0u8;
-        for c in line.chars() {
-            // If this is a newline character, the loop should end.
-            if c == '\n' {
+        // Next we iterate through the individual chars to see if this
+        // is one of the special lines starting a new "section" in the
+        // document.
+        let line = l;
+        let mut odd = false;
+        // matched_group counts how many copies of section_delimiter
+        // this string consists of (0 if there's anything else)
+        let mut matched_groups = 0u8;
+        for c in line.chars() {
+            // If this is a newline character, the loop should end.
+            if c == '\n' {
                 break;
             }
-            // If we have already seen three groups (corresponding to
-            // a header) or the current char does not form part of
-            // a new group, then this line is not a segment indicator.
-            if matched_groups >= 3 || settings.section_delimiter[usize::from(odd)] != c {
-                matched_groups = 0;
+            // If we have already seen three groups (corresponding to
+            // a header) or the current char does not form part of
+            // a new group, then this line is not a segment indicator.
+            if matched_groups >= 3 || settings.section_delimiter[usize::from(odd)] != c {
+                matched_groups = 0;
                 break;
             }
-            if odd {
-                // We have seen a new group and count it.
-                matched_groups += 1;
+            if odd {
+                // We have seen a new group and count it.
+                matched_groups += 1;
             }
-            odd = !odd;
+            odd = !odd;
         }
 
-        // See how many groups we matched. That will tell us if this is
-        // a line starting a new segment, and the number of groups
-        // indicates what type of segment.
-        if matched_groups > 0 {
-            // The current line is a section delimiter, so we output
-            // a blank line.
-            println!();
-            // However the line does not count as a blank line, so we
-            // reset the counter used for --join-blank-lines.
-            empty_line_count = 0;
-            match *match matched_groups {
-                3 => {
-                    // This is a header, so we may need to reset the
-                    // line number and the line width
-                    if settings.renumber {
-                        line_no = settings.starting_line_number;
-                        line_no_width = line_no_width_initial;
-                        line_no_threshold = 10u64.pow(line_no_width as u32);
+        // See how many groups we matched. That will tell us if this is
+        // a line starting a new segment, and the number of groups
+        // indicates what type of segment.
+        if matched_groups > 0 {
+            // The current line is a section delimiter, so we output
+            // a blank line.
+            println!();
+            // However the line does not count as a blank line, so we
+            // reset the counter used for --join-blank-lines.
+            empty_line_count = 0;
+            match *match matched_groups {
+                3 => {
+                    // This is a header, so we may need to reset the
+                    // line number and the line width
+                    if settings.renumber {
+                        line_no = settings.starting_line_number;
+                        line_no_width = line_no_width_initial;
+                        line_no_threshold = 10u64.pow(line_no_width as u32);
                     }
-                    &settings.header_numbering
+                    &settings.header_numbering
                 }
-                1 => &settings.footer_numbering,
-                // The only option left is 2, but rust wants
-                // a catch-all here.
-                _ => &settings.body_numbering,
+                1 => &settings.footer_numbering,
+                // The only option left is 2, but rust wants
+                // a catch-all here.
+                _ => &settings.body_numbering,
             } {
-                NumberingStyle::NumberForAll => {
-                    line_filter = pass_all;
+                NumberingStyle::NumberForAll => {
+                    line_filter = pass_all;
                 }
-                NumberingStyle::NumberForNonEmpty => {
-                    line_filter = pass_nonempty;
+                NumberingStyle::NumberForNonEmpty => {
+                    line_filter = pass_nonempty;
                 }
-                NumberingStyle::NumberForNone => {
-                    line_filter = pass_none;
+                NumberingStyle::NumberForNone => {
+                    line_filter = pass_none;
                 }
-                NumberingStyle::NumberForRegularExpression(ref re) => {
-                    line_filter = pass_regex;
-                    regex_filter = re;
+                NumberingStyle::NumberForRegularExpression(ref re) => {
+                    line_filter = pass_regex;
+                    regex_filter = re;
                 }
             }
             continue;
         }
-        // From this point on we format and print a "regular" line.
-        if line.is_empty() {
-            // The line is empty, which means that we have to care
-            // about the --join-blank-lines parameter.
-            empty_line_count += 1;
-        } else {
-            // This saves us from having to check for an empty string
-            // in the next selector.
-            empty_line_count = 0;
+        // From this point on we format and print a "regular" line.
+        if line.is_empty() {
+            // The line is empty, which means that we have to care
+            // about the --join-blank-lines parameter.
+            empty_line_count += 1;
+        } else {
+            // This saves us from having to check for an empty string
+            // in the next selector.
+            empty_line_count = 0;
         }
-        if !line_filter(&line, regex_filter)
-            || (empty_line_count > 0 && empty_line_count < settings.join_blank_lines)
+        if !line_filter(&line, regex_filter)
+            || (empty_line_count > 0 && empty_line_count < settings.join_blank_lines)
         {
-            // No number is printed for this line. Either we did not
-            // want to print one in the first place, or it is a blank
-            // line but we are still collecting more blank lines via
-            // the option --join-blank-lines.
-            println!("{}", line);
+            // No number is printed for this line. Either we did not
+            // want to print one in the first place, or it is a blank
+            // line but we are still collecting more blank lines via
+            // the option --join-blank-lines.
+            println!("{}", line);
             continue;
         }
-        // If we make it here, then either we are printing a non-empty
-        // line or assigning a line number to an empty line. Either
-        // way, start counting empties from zero once more.
-        empty_line_count = 0;
-        // A line number is to be printed.
-        let w = if settings.number_width > line_no_width {
-            settings.number_width - line_no_width
-        } else {
-            0
-        };
-        let fill: String = repeat(fill_char).take(w).collect();
-        match settings.number_format {
-            NumberFormat::Left => println!(
+        // If we make it here, then either we are printing a non-empty
+        // line or assigning a line number to an empty line. Either
+        // way, start counting empties from zero once more.
+        empty_line_count = 0;
+        // A line number is to be printed.
+        let w = if settings.number_width > line_no_width {
+            settings.number_width - line_no_width
+        } else {
+            0
+        };
+        let fill: String = repeat(fill_char).take(w).collect();
+        match settings.number_format {
+            NumberFormat::Left => println!(
                 "{1}{0}{2}{3}",
-                fill, line_no, settings.number_separator, line
+                fill, line_no, settings.number_separator, line
             ),
-            _ => println!(
+            _ => println!(
                 "{0}{1}{2}{3}",
-                fill, line_no, settings.number_separator, line
+                fill, line_no, settings.number_separator, line
             ),
         }
-        // Now update the variables for the (potential) next
-        // line.
-        line_no += settings.line_increment;
-        while line_no >= line_no_threshold {
-            // The line number just got longer.
-            line_no_threshold *= 10;
-            line_no_width += 1;
+        // Now update the variables for the (potential) next
+        // line.
+        line_no += settings.line_increment;
+        while line_no >= line_no_threshold {
+            // The line number just got longer.
+            line_no_threshold *= 10;
+            line_no_width += 1;
         }
     }
     Ok(())
 }
 
-fn pass_regex(line: &str, re: &regex::Regex) -> bool {
-    re.is_match(line)
+fn pass_regex(line: &str, re: &regex::Regex) -> bool {
+    re.is_match(line)
 }
 
-fn pass_nonempty(line: &str, _: &regex::Regex) -> bool {
-    !line.is_empty()
+fn pass_nonempty(line: &str, _: &regex::Regex) -> bool {
+    !line.is_empty()
 }
 
-fn pass_none(_: &str, _: &regex::Regex) -> bool {
-    false
-}
+fn pass_none(_: &str, _: &regex::Regex) -> bool {
+    false
+}
 
-fn pass_all(_: &str, _: &regex::Regex) -> bool {
-    true
-}
+fn pass_all(_: &str, _: &regex::Regex) -> bool {
+    true
+}
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_nohup/nohup.rs.html b/dev/src/uu_nohup/nohup.rs.html index ac07b3ec2..7386741f3 100644 --- a/dev/src/uu_nohup/nohup.rs.html +++ b/dev/src/uu_nohup/nohup.rs.html @@ -1,4 +1,4 @@ -nohup.rs - source
1
+nohup.rs - source
1
 2
 3
 4
@@ -216,223 +216,223 @@
 216
 217
 218
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) 2014 Vsevolod Velichko <torkvemada@sorokdva.net>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) 2014 Vsevolod Velichko <torkvemada@sorokdva.net>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) execvp SIGHUP cproc vprocmgr cstrs homeout
+// spell-checker:ignore (ToDO) execvp SIGHUP cproc vprocmgr cstrs homeout
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use libc::{c_char, dup2, execvp, signal};
-use libc::{SIGHUP, SIG_IGN};
-use std::env;
-use std::ffi::CString;
-use std::fmt::{Display, Formatter};
-use std::fs::{File, OpenOptions};
-use std::io::Error;
-use std::os::unix::prelude::*;
-use std::path::{Path, PathBuf};
-use uucore::display::Quotable;
-use uucore::error::{set_exit_code, UClapError, UError, UResult};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use libc::{c_char, dup2, execvp, signal};
+use libc::{SIGHUP, SIG_IGN};
+use std::env;
+use std::ffi::CString;
+use std::fmt::{Display, Formatter};
+use std::fs::{File, OpenOptions};
+use std::io::Error;
+use std::os::unix::prelude::*;
+use std::path::{Path, PathBuf};
+use uucore::display::Quotable;
+use uucore::error::{set_exit_code, UClapError, UError, UResult};
+use uucore::format_usage;
 
-static ABOUT: &str = "Run COMMAND ignoring hangup signals.";
-static LONG_HELP: &str = "
+static ABOUT: &str = "Run COMMAND ignoring hangup signals.";
+static LONG_HELP: &str = "
 If standard input is terminal, it'll be replaced with /dev/null.
 If standard output is terminal, it'll be appended to nohup.out instead,
 or $HOME/nohup.out, if nohup.out open failed.
 If standard error is terminal, it'll be redirected to stdout.
 ";
-const USAGE: &str = "\
+const USAGE: &str = "\
     {} COMMAND [ARG]...
     {} FLAG";
-static NOHUP_OUT: &str = "nohup.out";
-// exit codes that match the GNU implementation
-static EXIT_CANCELED: i32 = 125;
-static EXIT_CANNOT_INVOKE: i32 = 126;
-static EXIT_ENOENT: i32 = 127;
-static POSIX_NOHUP_FAILURE: i32 = 127;
+static NOHUP_OUT: &str = "nohup.out";
+// exit codes that match the GNU implementation
+static EXIT_CANCELED: i32 = 125;
+static EXIT_CANNOT_INVOKE: i32 = 126;
+static EXIT_ENOENT: i32 = 127;
+static POSIX_NOHUP_FAILURE: i32 = 127;
 
-mod options {
-    pub const CMD: &str = "cmd";
+mod options {
+    pub const CMD: &str = "cmd";
 }
 
-#[derive(Debug)]
-enum NohupError {
-    CannotDetach,
-    CannotReplace(&'static str, std::io::Error),
-    OpenFailed(i32, std::io::Error),
-    OpenFailed2(i32, std::io::Error, String, std::io::Error),
+#[derive(Debug)]
+enum NohupError {
+    CannotDetach,
+    CannotReplace(&'static str, std::io::Error),
+    OpenFailed(i32, std::io::Error),
+    OpenFailed2(i32, std::io::Error, String, std::io::Error),
 }
 
-impl std::error::Error for NohupError {}
+impl std::error::Error for NohupError {}
 
-impl UError for NohupError {
-    fn code(&self) -> i32 {
-        match self {
-            Self::OpenFailed(code, _) | Self::OpenFailed2(code, _, _, _) => *code,
-            _ => 2,
+impl UError for NohupError {
+    fn code(&self) -> i32 {
+        match self {
+            Self::OpenFailed(code, _) | Self::OpenFailed2(code, _, _, _) => *code,
+            _ => 2,
         }
     }
 }
 
-impl Display for NohupError {
-    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
-        match self {
-            Self::CannotDetach => write!(f, "Cannot detach from console"),
-            Self::CannotReplace(s, e) => write!(f, "Cannot replace {}: {}", s, e),
-            Self::OpenFailed(_, e) => {
-                write!(f, "failed to open {}: {}", NOHUP_OUT.quote(), e)
+impl Display for NohupError {
+    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
+        match self {
+            Self::CannotDetach => write!(f, "Cannot detach from console"),
+            Self::CannotReplace(s, e) => write!(f, "Cannot replace {}: {}", s, e),
+            Self::OpenFailed(_, e) => {
+                write!(f, "failed to open {}: {}", NOHUP_OUT.quote(), e)
             }
-            Self::OpenFailed2(_, e1, s, e2) => write!(
-                f,
+            Self::OpenFailed2(_, e1, s, e2) => write!(
+                f,
                 "failed to open {}: {}\nfailed to open {}: {}",
-                NOHUP_OUT.quote(),
-                e1,
-                s.quote(),
-                e2
+                NOHUP_OUT.quote(),
+                e1,
+                s.quote(),
+                e2
             ),
         }
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
+    let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
 
-    replace_fds()?;
+    replace_fds()?;
 
-    unsafe { signal(SIGHUP, SIG_IGN) };
+    unsafe { signal(SIGHUP, SIG_IGN) };
 
-    if unsafe { !_vprocmgr_detach_from_console(0).is_null() } {
-        return Err(NohupError::CannotDetach.into());
+    if unsafe { !_vprocmgr_detach_from_console(0).is_null() } {
+        return Err(NohupError::CannotDetach.into());
     };
 
-    let cstrs: Vec<CString> = matches
-        .get_many::<String>(options::CMD)
-        .unwrap()
-        .map(|x| CString::new(x.as_bytes()).unwrap())
-        .collect();
-    let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect();
-    args.push(std::ptr::null());
+    let cstrs: Vec<CString> = matches
+        .get_many::<String>(options::CMD)
+        .unwrap()
+        .map(|x| CString::new(x.as_bytes()).unwrap())
+        .collect();
+    let mut args: Vec<*const c_char> = cstrs.iter().map(|s| s.as_ptr()).collect();
+    args.push(std::ptr::null());
 
-    let ret = unsafe { execvp(args[0], args.as_mut_ptr()) };
-    match ret {
-        libc::ENOENT => set_exit_code(EXIT_ENOENT),
-        _ => set_exit_code(EXIT_CANNOT_INVOKE),
+    let ret = unsafe { execvp(args[0], args.as_mut_ptr()) };
+    match ret {
+        libc::ENOENT => set_exit_code(EXIT_ENOENT),
+        _ => set_exit_code(EXIT_CANNOT_INVOKE),
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(LONG_HELP)
-        .override_usage(format_usage(USAGE))
-        .arg(
-            Arg::new(options::CMD)
-                .hide(true)
-                .required(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::CommandName),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(LONG_HELP)
+        .override_usage(format_usage(USAGE))
+        .arg(
+            Arg::new(options::CMD)
+                .hide(true)
+                .required(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::CommandName),
         )
-        .trailing_var_arg(true)
-        .infer_long_args(true)
+        .trailing_var_arg(true)
+        .infer_long_args(true)
 }
 
-fn replace_fds() -> UResult<()> {
-    if atty::is(atty::Stream::Stdin) {
-        let new_stdin = File::open(Path::new("/dev/null"))
-            .map_err(|e| NohupError::CannotReplace("STDIN", e))?;
-        if unsafe { dup2(new_stdin.as_raw_fd(), 0) } != 0 {
-            return Err(NohupError::CannotReplace("STDIN", Error::last_os_error()).into());
+fn replace_fds() -> UResult<()> {
+    if atty::is(atty::Stream::Stdin) {
+        let new_stdin = File::open(Path::new("/dev/null"))
+            .map_err(|e| NohupError::CannotReplace("STDIN", e))?;
+        if unsafe { dup2(new_stdin.as_raw_fd(), 0) } != 0 {
+            return Err(NohupError::CannotReplace("STDIN", Error::last_os_error()).into());
         }
     }
 
-    if atty::is(atty::Stream::Stdout) {
-        let new_stdout = find_stdout()?;
-        let fd = new_stdout.as_raw_fd();
+    if atty::is(atty::Stream::Stdout) {
+        let new_stdout = find_stdout()?;
+        let fd = new_stdout.as_raw_fd();
 
-        if unsafe { dup2(fd, 1) } != 1 {
-            return Err(NohupError::CannotReplace("STDOUT", Error::last_os_error()).into());
+        if unsafe { dup2(fd, 1) } != 1 {
+            return Err(NohupError::CannotReplace("STDOUT", Error::last_os_error()).into());
         }
     }
 
-    if atty::is(atty::Stream::Stderr) && unsafe { dup2(1, 2) } != 2 {
-        return Err(NohupError::CannotReplace("STDERR", Error::last_os_error()).into());
+    if atty::is(atty::Stream::Stderr) && unsafe { dup2(1, 2) } != 2 {
+        return Err(NohupError::CannotReplace("STDERR", Error::last_os_error()).into());
     }
     Ok(())
 }
 
-fn find_stdout() -> UResult<File> {
-    let internal_failure_code = match std::env::var("POSIXLY_CORRECT") {
-        Ok(_) => POSIX_NOHUP_FAILURE,
-        Err(_) => EXIT_CANCELED,
+fn find_stdout() -> UResult<File> {
+    let internal_failure_code = match std::env::var("POSIXLY_CORRECT") {
+        Ok(_) => POSIX_NOHUP_FAILURE,
+        Err(_) => EXIT_CANCELED,
     };
 
-    match OpenOptions::new()
-        .write(true)
-        .create(true)
-        .append(true)
-        .open(Path::new(NOHUP_OUT))
+    match OpenOptions::new()
+        .write(true)
+        .create(true)
+        .append(true)
+        .open(Path::new(NOHUP_OUT))
     {
-        Ok(t) => {
+        Ok(t) => {
             show_error!(
                 "ignoring input and appending output to {}",
-                NOHUP_OUT.quote()
+                NOHUP_OUT.quote()
             );
-            Ok(t)
+            Ok(t)
         }
-        Err(e1) => {
-            let home = match env::var("HOME") {
-                Err(_) => return Err(NohupError::OpenFailed(internal_failure_code, e1).into()),
-                Ok(h) => h,
+        Err(e1) => {
+            let home = match env::var("HOME") {
+                Err(_) => return Err(NohupError::OpenFailed(internal_failure_code, e1).into()),
+                Ok(h) => h,
             };
-            let mut homeout = PathBuf::from(home);
-            homeout.push(NOHUP_OUT);
-            let homeout_str = homeout.to_str().unwrap();
-            match OpenOptions::new()
-                .write(true)
-                .create(true)
-                .append(true)
-                .open(&homeout)
+            let mut homeout = PathBuf::from(home);
+            homeout.push(NOHUP_OUT);
+            let homeout_str = homeout.to_str().unwrap();
+            match OpenOptions::new()
+                .write(true)
+                .create(true)
+                .append(true)
+                .open(&homeout)
             {
-                Ok(t) => {
+                Ok(t) => {
                     show_error!(
                         "ignoring input and appending output to {}",
-                        homeout_str.quote()
+                        homeout_str.quote()
                     );
-                    Ok(t)
+                    Ok(t)
                 }
-                Err(e2) => Err(NohupError::OpenFailed2(
-                    internal_failure_code,
-                    e1,
-                    homeout_str.to_string(),
-                    e2,
+                Err(e2) => Err(NohupError::OpenFailed2(
+                    internal_failure_code,
+                    e1,
+                    homeout_str.to_string(),
+                    e2,
                 )
-                .into()),
+                .into()),
             }
         }
     }
 }
 
-#[cfg(target_vendor = "apple")]
-extern "C" {
-    fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int;
+#[cfg(target_vendor = "apple")]
+extern "C" {
+    fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int;
 }
 
-#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))]
-unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int {
-    std::ptr::null()
+#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))]
+unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int {
+    std::ptr::null()
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_nproc/nproc.rs.html b/dev/src/uu_nproc/nproc.rs.html index cb80f30f0..375ffcaa9 100644 --- a/dev/src/uu_nproc/nproc.rs.html +++ b/dev/src/uu_nproc/nproc.rs.html @@ -1,4 +1,4 @@ -nproc.rs - source
1
+nproc.rs - source
1
 2
 3
 4
@@ -145,152 +145,152 @@
 145
 146
 147
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Michael Gehring <mg@ebfe.org>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Michael Gehring <mg@ebfe.org>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf
+// spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::env;
-use uucore::display::Quotable;
-use uucore::error::{UResult, USimpleError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::env;
+use uucore::display::Quotable;
+use uucore::error::{UResult, USimpleError};
+use uucore::format_usage;
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-pub const _SC_NPROCESSORS_CONF: libc::c_int = 83;
-#[cfg(target_vendor = "apple")]
-pub const _SC_NPROCESSORS_CONF: libc::c_int = libc::_SC_NPROCESSORS_CONF;
-#[cfg(target_os = "freebsd")]
-pub const _SC_NPROCESSORS_CONF: libc::c_int = 57;
-#[cfg(target_os = "netbsd")]
-pub const _SC_NPROCESSORS_CONF: libc::c_int = 1001;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+pub const _SC_NPROCESSORS_CONF: libc::c_int = 83;
+#[cfg(target_vendor = "apple")]
+pub const _SC_NPROCESSORS_CONF: libc::c_int = libc::_SC_NPROCESSORS_CONF;
+#[cfg(target_os = "freebsd")]
+pub const _SC_NPROCESSORS_CONF: libc::c_int = 57;
+#[cfg(target_os = "netbsd")]
+pub const _SC_NPROCESSORS_CONF: libc::c_int = 1001;
 
-static OPT_ALL: &str = "all";
-static OPT_IGNORE: &str = "ignore";
+static OPT_ALL: &str = "all";
+static OPT_IGNORE: &str = "ignore";
 
-static ABOUT: &str = r#"Print the number of cores available to the current process.
+static ABOUT: &str = r#"Print the number of cores available to the current process.
 If the OMP_NUM_THREADS or OMP_THREAD_LIMIT environment variables are set, then
 they will determine the minimum and maximum returned value respectively."#;
-const USAGE: &str = "{} [OPTIONS]...";
+const USAGE: &str = "{} [OPTIONS]...";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let ignore = match matches.get_one::<String>(OPT_IGNORE) {
-        Some(numstr) => match numstr.trim().parse() {
-            Ok(num) => num,
-            Err(e) => {
-                return Err(USimpleError::new(
+    let ignore = match matches.get_one::<String>(OPT_IGNORE) {
+        Some(numstr) => match numstr.trim().parse() {
+            Ok(num) => num,
+            Err(e) => {
+                return Err(USimpleError::new(
                     1,
-                    format!("{} is not a valid number: {}", numstr.quote(), e),
+                    format!("{} is not a valid number: {}", numstr.quote(), e),
                 ));
             }
         },
-        None => 0,
+        None => 0,
     };
 
-    let limit = match env::var("OMP_THREAD_LIMIT") {
-        // Uses the OpenMP variable to limit the number of threads
-        // If the parsing fails, returns the max size (so, no impact)
-        // If OMP_THREAD_LIMIT=0, rejects the value
-        Ok(threadstr) => match threadstr.parse() {
-            Ok(0) | Err(_) => usize::MAX,
-            Ok(n) => n,
+    let limit = match env::var("OMP_THREAD_LIMIT") {
+        // Uses the OpenMP variable to limit the number of threads
+        // If the parsing fails, returns the max size (so, no impact)
+        // If OMP_THREAD_LIMIT=0, rejects the value
+        Ok(threadstr) => match threadstr.parse() {
+            Ok(0) | Err(_) => usize::MAX,
+            Ok(n) => n,
         },
-        // the variable 'OMP_THREAD_LIMIT' doesn't exist
-        // fallback to the max
-        Err(_) => usize::MAX,
+        // the variable 'OMP_THREAD_LIMIT' doesn't exist
+        // fallback to the max
+        Err(_) => usize::MAX,
     };
 
-    let mut cores = if matches.get_flag(OPT_ALL) {
-        num_cpus_all()
-    } else {
-        // OMP_NUM_THREADS doesn't have an impact on --all
-        match env::var("OMP_NUM_THREADS") {
-            // Uses the OpenMP variable to force the number of threads
-            // If the parsing fails, returns the number of CPU
-            Ok(threadstr) => {
-                // In some cases, OMP_NUM_THREADS can be "x,y,z"
-                // In this case, only take the first one (like GNU)
-                // If OMP_NUM_THREADS=0, rejects the value
-                let thread: Vec<&str> = threadstr.split_terminator(',').collect();
-                match &thread[..] {
-                    [] => num_cpus::get(),
-                    [s, ..] => match s.parse() {
-                        Ok(0) | Err(_) => num_cpus::get(),
-                        Ok(n) => n,
+    let mut cores = if matches.get_flag(OPT_ALL) {
+        num_cpus_all()
+    } else {
+        // OMP_NUM_THREADS doesn't have an impact on --all
+        match env::var("OMP_NUM_THREADS") {
+            // Uses the OpenMP variable to force the number of threads
+            // If the parsing fails, returns the number of CPU
+            Ok(threadstr) => {
+                // In some cases, OMP_NUM_THREADS can be "x,y,z"
+                // In this case, only take the first one (like GNU)
+                // If OMP_NUM_THREADS=0, rejects the value
+                let thread: Vec<&str> = threadstr.split_terminator(',').collect();
+                match &thread[..] {
+                    [] => num_cpus::get(),
+                    [s, ..] => match s.parse() {
+                        Ok(0) | Err(_) => num_cpus::get(),
+                        Ok(n) => n,
                     },
                 }
             }
-            // the variable 'OMP_NUM_THREADS' doesn't exist
-            // fallback to the regular CPU detection
-            Err(_) => num_cpus::get(),
+            // the variable 'OMP_NUM_THREADS' doesn't exist
+            // fallback to the regular CPU detection
+            Err(_) => num_cpus::get(),
         }
     };
 
-    cores = std::cmp::min(limit, cores);
-    if cores <= ignore {
-        cores = 1;
-    } else {
-        cores -= ignore;
+    cores = std::cmp::min(limit, cores);
+    if cores <= ignore {
+        cores = 1;
+    } else {
+        cores -= ignore;
     }
-    println!("{}", cores);
+    println!("{}", cores);
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_ALL)
-                .long(OPT_ALL)
-                .help("print the number of cores available to the system")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_ALL)
+                .long(OPT_ALL)
+                .help("print the number of cores available to the system")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_IGNORE)
-                .long(OPT_IGNORE)
-                .value_name("N")
-                .help("ignore up to N cores"),
+        .arg(
+            Arg::new(OPT_IGNORE)
+                .long(OPT_IGNORE)
+                .value_name("N")
+                .help("ignore up to N cores"),
         )
 }
 
-#[cfg(any(
-    target_os = "linux",
-    target_vendor = "apple",
-    target_os = "freebsd",
-    target_os = "netbsd"
-))]
-fn num_cpus_all() -> usize {
-    let nprocs = unsafe { libc::sysconf(_SC_NPROCESSORS_CONF) };
-    if nprocs == 1 {
-        // In some situation, /proc and /sys are not mounted, and sysconf returns 1.
-        // However, we want to guarantee that `nproc --all` >= `nproc`.
-        num_cpus::get()
-    } else if nprocs > 0 {
-        nprocs as usize
-    } else {
-        1
-    }
+#[cfg(any(
+    target_os = "linux",
+    target_vendor = "apple",
+    target_os = "freebsd",
+    target_os = "netbsd"
+))]
+fn num_cpus_all() -> usize {
+    let nprocs = unsafe { libc::sysconf(_SC_NPROCESSORS_CONF) };
+    if nprocs == 1 {
+        // In some situation, /proc and /sys are not mounted, and sysconf returns 1.
+        // However, we want to guarantee that `nproc --all` >= `nproc`.
+        num_cpus::get()
+    } else if nprocs > 0 {
+        nprocs as usize
+    } else {
+        1
+    }
 }
 
-// Other platforms (e.g., windows), num_cpus::get() directly.
-#[cfg(not(any(
-    target_os = "linux",
-    target_vendor = "apple",
-    target_os = "freebsd",
-    target_os = "netbsd"
-)))]
-fn num_cpus_all() -> usize {
-    num_cpus::get()
+// Other platforms (e.g., windows), num_cpus::get() directly.
+#[cfg(not(any(
+    target_os = "linux",
+    target_vendor = "apple",
+    target_os = "freebsd",
+    target_os = "netbsd"
+)))]
+fn num_cpus_all() -> usize {
+    num_cpus::get()
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_numfmt/errors.rs.html b/dev/src/uu_numfmt/errors.rs.html index f7c7b5352..4e7f8d9f9 100644 --- a/dev/src/uu_numfmt/errors.rs.html +++ b/dev/src/uu_numfmt/errors.rs.html @@ -1,4 +1,4 @@ -errors.rs - source
1
+errors.rs - source
1
 2
 3
 4
@@ -37,44 +37,44 @@
 37
 38
 39
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-use std::{
-    error::Error,
-    fmt::{Debug, Display},
+use std::{
+    error::Error,
+    fmt::{Debug, Display},
 };
-use uucore::error::UError;
+use uucore::error::UError;
 
-#[derive(Debug)]
-pub enum NumfmtError {
-    IoError(String),
-    IllegalArgument(String),
-    FormattingError(String),
+#[derive(Debug)]
+pub enum NumfmtError {
+    IoError(String),
+    IllegalArgument(String),
+    FormattingError(String),
 }
 
-impl UError for NumfmtError {
-    fn code(&self) -> i32 {
-        match self {
-            Self::IoError(_) => 1,
-            Self::IllegalArgument(_) => 1,
-            Self::FormattingError(_) => 2,
+impl UError for NumfmtError {
+    fn code(&self) -> i32 {
+        match self {
+            Self::IoError(_) => 1,
+            Self::IllegalArgument(_) => 1,
+            Self::FormattingError(_) => 2,
         }
     }
 }
 
-impl Error for NumfmtError {}
+impl Error for NumfmtError {}
 
-impl Display for NumfmtError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::IoError(s) | Self::IllegalArgument(s) | Self::FormattingError(s) => {
-                write!(f, "{}", s)
+impl Display for NumfmtError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::IoError(s) | Self::IllegalArgument(s) | Self::FormattingError(s) => {
+                write!(f, "{}", s)
             }
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_numfmt/format.rs.html b/dev/src/uu_numfmt/format.rs.html index 10609bda5..7df55445f 100644 --- a/dev/src/uu_numfmt/format.rs.html +++ b/dev/src/uu_numfmt/format.rs.html @@ -1,4 +1,4 @@ -format.rs - source
1
+format.rs - source
1
 2
 3
 4
@@ -459,378 +459,378 @@
 459
 460
 461
-
// spell-checker:ignore powf
-use uucore::display::Quotable;
+
// spell-checker:ignore powf
+use uucore::display::Quotable;
 
-use crate::options::{NumfmtOptions, RoundMethod, TransformOptions};
-use crate::units::{DisplayableSuffix, RawSuffix, Result, Suffix, Unit, IEC_BASES, SI_BASES};
+use crate::options::{NumfmtOptions, RoundMethod, TransformOptions};
+use crate::units::{DisplayableSuffix, RawSuffix, Result, Suffix, Unit, IEC_BASES, SI_BASES};
 
-/// Iterate over a line's fields, where each field is a contiguous sequence of
-/// non-whitespace, optionally prefixed with one or more characters of leading
-/// whitespace. Fields are returned as tuples of `(prefix, field)`.
-///
-/// # Examples:
-///
-/// ```
-/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("    1234 5") };
-///
-/// assert_eq!(Some(("    ", "1234")), fields.next());
-/// assert_eq!(Some((" ", "5")), fields.next());
-/// assert_eq!(None, fields.next());
-/// ```
-///
-/// Delimiters are included in the results; `prefix` will be empty only for
-/// the first field of the line (including the case where the input line is
-/// empty):
-///
-/// ```
-/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("first second") };
-///
-/// assert_eq!(Some(("", "first")), fields.next());
-/// assert_eq!(Some((" ", "second")), fields.next());
-///
-/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("") };
-///
-/// assert_eq!(Some(("", "")), fields.next());
-/// ```
-pub struct WhitespaceSplitter<'a> {
-    pub s: Option<&'a str>,
+/// Iterate over a line's fields, where each field is a contiguous sequence of
+/// non-whitespace, optionally prefixed with one or more characters of leading
+/// whitespace. Fields are returned as tuples of `(prefix, field)`.
+///
+/// # Examples:
+///
+/// ```
+/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("    1234 5") };
+///
+/// assert_eq!(Some(("    ", "1234")), fields.next());
+/// assert_eq!(Some((" ", "5")), fields.next());
+/// assert_eq!(None, fields.next());
+/// ```
+///
+/// Delimiters are included in the results; `prefix` will be empty only for
+/// the first field of the line (including the case where the input line is
+/// empty):
+///
+/// ```
+/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("first second") };
+///
+/// assert_eq!(Some(("", "first")), fields.next());
+/// assert_eq!(Some((" ", "second")), fields.next());
+///
+/// let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("") };
+///
+/// assert_eq!(Some(("", "")), fields.next());
+/// ```
+pub struct WhitespaceSplitter<'a> {
+    pub s: Option<&'a str>,
 }
 
-impl<'a> Iterator for WhitespaceSplitter<'a> {
-    type Item = (&'a str, &'a str);
+impl<'a> Iterator for WhitespaceSplitter<'a> {
+    type Item = (&'a str, &'a str);
 
-    /// Yield the next field in the input string as a tuple `(prefix, field)`.
-    fn next(&mut self) -> Option<Self::Item> {
-        let haystack = self.s?;
+    /// Yield the next field in the input string as a tuple `(prefix, field)`.
+    fn next(&mut self) -> Option<Self::Item> {
+        let haystack = self.s?;
 
-        let (prefix, field) = haystack.split_at(
-            haystack
-                .find(|c: char| !c.is_whitespace())
-                .unwrap_or(haystack.len()),
+        let (prefix, field) = haystack.split_at(
+            haystack
+                .find(|c: char| !c.is_whitespace())
+                .unwrap_or(haystack.len()),
         );
 
-        let (field, rest) = field.split_at(
-            field
-                .find(|c: char| c.is_whitespace())
-                .unwrap_or(field.len()),
+        let (field, rest) = field.split_at(
+            field
+                .find(|c: char| c.is_whitespace())
+                .unwrap_or(field.len()),
         );
 
-        self.s = if !rest.is_empty() { Some(rest) } else { None };
+        self.s = if !rest.is_empty() { Some(rest) } else { None };
 
-        Some((prefix, field))
+        Some((prefix, field))
     }
 }
 
-fn parse_suffix(s: &str) -> Result<(f64, Option<Suffix>)> {
-    if s.is_empty() {
-        return Err("invalid number: ''".to_string());
+fn parse_suffix(s: &str) -> Result<(f64, Option<Suffix>)> {
+    if s.is_empty() {
+        return Err("invalid number: ''".to_string());
     }
 
-    let with_i = s.ends_with('i');
-    let mut iter = s.chars();
-    if with_i {
-        iter.next_back();
+    let with_i = s.ends_with('i');
+    let mut iter = s.chars();
+    if with_i {
+        iter.next_back();
     }
-    let suffix = match iter.next_back() {
-        Some('K') => Some((RawSuffix::K, with_i)),
-        Some('M') => Some((RawSuffix::M, with_i)),
-        Some('G') => Some((RawSuffix::G, with_i)),
-        Some('T') => Some((RawSuffix::T, with_i)),
-        Some('P') => Some((RawSuffix::P, with_i)),
-        Some('E') => Some((RawSuffix::E, with_i)),
-        Some('Z') => Some((RawSuffix::Z, with_i)),
-        Some('Y') => Some((RawSuffix::Y, with_i)),
-        Some('0'..='9') if !with_i => None,
-        _ => return Err(format!("invalid suffix in input: {}", s.quote())),
+    let suffix = match iter.next_back() {
+        Some('K') => Some((RawSuffix::K, with_i)),
+        Some('M') => Some((RawSuffix::M, with_i)),
+        Some('G') => Some((RawSuffix::G, with_i)),
+        Some('T') => Some((RawSuffix::T, with_i)),
+        Some('P') => Some((RawSuffix::P, with_i)),
+        Some('E') => Some((RawSuffix::E, with_i)),
+        Some('Z') => Some((RawSuffix::Z, with_i)),
+        Some('Y') => Some((RawSuffix::Y, with_i)),
+        Some('0'..='9') if !with_i => None,
+        _ => return Err(format!("invalid suffix in input: {}", s.quote())),
     };
 
-    let suffix_len = match suffix {
-        None => 0,
+    let suffix_len = match suffix {
+        None => 0,
         Some((_, false)) => 1,
         Some((_, true)) => 2,
     };
 
-    let number = s[..s.len() - suffix_len]
-        .parse::<f64>()
-        .map_err(|_| format!("invalid number: {}", s.quote()))?;
+    let number = s[..s.len() - suffix_len]
+        .parse::<f64>()
+        .map_err(|_| format!("invalid number: {}", s.quote()))?;
 
-    Ok((number, suffix))
+    Ok((number, suffix))
 }
 
-// Returns the implicit precision of a number, which is the count of digits after the dot. For
-// example, 1.23 has an implicit precision of 2.
-fn parse_implicit_precision(s: &str) -> usize {
-    match s.split_once('.') {
-        Some((_, decimal_part)) => decimal_part
-            .chars()
-            .take_while(|c| c.is_ascii_digit())
-            .count(),
-        None => 0,
+// Returns the implicit precision of a number, which is the count of digits after the dot. For
+// example, 1.23 has an implicit precision of 2.
+fn parse_implicit_precision(s: &str) -> usize {
+    match s.split_once('.') {
+        Some((_, decimal_part)) => decimal_part
+            .chars()
+            .take_while(|c| c.is_ascii_digit())
+            .count(),
+        None => 0,
     }
 }
 
-fn remove_suffix(i: f64, s: Option<Suffix>, u: &Unit) -> Result<f64> {
-    match (s, u) {
-        (Some((raw_suffix, false)), &Unit::Auto) | (Some((raw_suffix, false)), &Unit::Si) => {
-            match raw_suffix {
-                RawSuffix::K => Ok(i * 1e3),
-                RawSuffix::M => Ok(i * 1e6),
-                RawSuffix::G => Ok(i * 1e9),
-                RawSuffix::T => Ok(i * 1e12),
-                RawSuffix::P => Ok(i * 1e15),
-                RawSuffix::E => Ok(i * 1e18),
-                RawSuffix::Z => Ok(i * 1e21),
-                RawSuffix::Y => Ok(i * 1e24),
+fn remove_suffix(i: f64, s: Option<Suffix>, u: &Unit) -> Result<f64> {
+    match (s, u) {
+        (Some((raw_suffix, false)), &Unit::Auto) | (Some((raw_suffix, false)), &Unit::Si) => {
+            match raw_suffix {
+                RawSuffix::K => Ok(i * 1e3),
+                RawSuffix::M => Ok(i * 1e6),
+                RawSuffix::G => Ok(i * 1e9),
+                RawSuffix::T => Ok(i * 1e12),
+                RawSuffix::P => Ok(i * 1e15),
+                RawSuffix::E => Ok(i * 1e18),
+                RawSuffix::Z => Ok(i * 1e21),
+                RawSuffix::Y => Ok(i * 1e24),
             }
         }
-        (Some((raw_suffix, false)), &Unit::Iec(false))
-        | (Some((raw_suffix, true)), &Unit::Auto)
-        | (Some((raw_suffix, true)), &Unit::Iec(true)) => match raw_suffix {
-            RawSuffix::K => Ok(i * IEC_BASES[1]),
-            RawSuffix::M => Ok(i * IEC_BASES[2]),
-            RawSuffix::G => Ok(i * IEC_BASES[3]),
-            RawSuffix::T => Ok(i * IEC_BASES[4]),
-            RawSuffix::P => Ok(i * IEC_BASES[5]),
-            RawSuffix::E => Ok(i * IEC_BASES[6]),
-            RawSuffix::Z => Ok(i * IEC_BASES[7]),
-            RawSuffix::Y => Ok(i * IEC_BASES[8]),
+        (Some((raw_suffix, false)), &Unit::Iec(false))
+        | (Some((raw_suffix, true)), &Unit::Auto)
+        | (Some((raw_suffix, true)), &Unit::Iec(true)) => match raw_suffix {
+            RawSuffix::K => Ok(i * IEC_BASES[1]),
+            RawSuffix::M => Ok(i * IEC_BASES[2]),
+            RawSuffix::G => Ok(i * IEC_BASES[3]),
+            RawSuffix::T => Ok(i * IEC_BASES[4]),
+            RawSuffix::P => Ok(i * IEC_BASES[5]),
+            RawSuffix::E => Ok(i * IEC_BASES[6]),
+            RawSuffix::Z => Ok(i * IEC_BASES[7]),
+            RawSuffix::Y => Ok(i * IEC_BASES[8]),
         },
-        (None, &Unit::Iec(true)) => Err(format!(
+        (None, &Unit::Iec(true)) => Err(format!(
             "missing 'i' suffix in input: '{}' (e.g Ki/Mi/Gi)",
-            i
+            i
         )),
-        (Some((raw_suffix, false)), &Unit::Iec(true)) => Err(format!(
+        (Some((raw_suffix, false)), &Unit::Iec(true)) => Err(format!(
             "missing 'i' suffix in input: '{}{:?}' (e.g Ki/Mi/Gi)",
-            i, raw_suffix
+            i, raw_suffix
         )),
-        (Some((raw_suffix, with_i)), &Unit::None) => Err(format!(
+        (Some((raw_suffix, with_i)), &Unit::None) => Err(format!(
             "rejecting suffix in input: '{}{:?}{}' (consider using --from)",
-            i,
-            raw_suffix,
-            if with_i { "i" } else { "" }
+            i,
+            raw_suffix,
+            if with_i { "i" } else { "" }
         )),
-        (None, _) => Ok(i),
-        (_, _) => Err("This suffix is unsupported for specified unit".to_owned()),
+        (None, _) => Ok(i),
+        (_, _) => Err("This suffix is unsupported for specified unit".to_owned()),
     }
 }
 
-fn transform_from(s: &str, opts: &TransformOptions) -> Result<f64> {
-    let (i, suffix) = parse_suffix(s)?;
-    let i = i * (opts.from_unit as f64);
+fn transform_from(s: &str, opts: &TransformOptions) -> Result<f64> {
+    let (i, suffix) = parse_suffix(s)?;
+    let i = i * (opts.from_unit as f64);
 
-    remove_suffix(i, suffix, &opts.from).map(|n| {
-        // GNU numfmt doesn't round values if no --from argument is provided by the user
-        if opts.from == Unit::None {
-            if n == -0.0 {
-                0.0
-            } else {
-                n
+    remove_suffix(i, suffix, &opts.from).map(|n| {
+        // GNU numfmt doesn't round values if no --from argument is provided by the user
+        if opts.from == Unit::None {
+            if n == -0.0 {
+                0.0
+            } else {
+                n
             }
-        } else if n < 0.0 {
-            -n.abs().ceil()
-        } else {
-            n.ceil()
+        } else if n < 0.0 {
+            -n.abs().ceil()
+        } else {
+            n.ceil()
         }
     })
 }
 
-/// Divide numerator by denominator, with rounding.
-///
-/// If the result of the division is less than 10.0, round to one decimal point.
-///
-/// Otherwise, round to an integer.
-///
-/// # Examples:
-///
-/// ```
-/// use uu_numfmt::format::div_round;
-/// use uu_numfmt::options::RoundMethod;
-///
-/// // Rounding methods:
-/// assert_eq!(div_round(1.01, 1.0, RoundMethod::FromZero), 1.1);
-/// assert_eq!(div_round(1.01, 1.0, RoundMethod::TowardsZero), 1.0);
-/// assert_eq!(div_round(1.01, 1.0, RoundMethod::Up), 1.1);
-/// assert_eq!(div_round(1.01, 1.0, RoundMethod::Down), 1.0);
-/// assert_eq!(div_round(1.01, 1.0, RoundMethod::Nearest), 1.0);
-///
-/// // Division:
-/// assert_eq!(div_round(999.1, 1000.0, RoundMethod::FromZero), 1.0);
-/// assert_eq!(div_round(1001., 10., RoundMethod::FromZero), 101.);
-/// assert_eq!(div_round(9991., 10., RoundMethod::FromZero), 1000.);
-/// assert_eq!(div_round(-12.34, 1.0, RoundMethod::FromZero), -13.0);
-/// assert_eq!(div_round(1000.0, -3.14, RoundMethod::FromZero), -319.0);
-/// assert_eq!(div_round(-271828.0, -271.0, RoundMethod::FromZero), 1004.0);
-/// ```
-pub fn div_round(n: f64, d: f64, method: RoundMethod) -> f64 {
-    let v = n / d;
+/// Divide numerator by denominator, with rounding.
+///
+/// If the result of the division is less than 10.0, round to one decimal point.
+///
+/// Otherwise, round to an integer.
+///
+/// # Examples:
+///
+/// ```
+/// use uu_numfmt::format::div_round;
+/// use uu_numfmt::options::RoundMethod;
+///
+/// // Rounding methods:
+/// assert_eq!(div_round(1.01, 1.0, RoundMethod::FromZero), 1.1);
+/// assert_eq!(div_round(1.01, 1.0, RoundMethod::TowardsZero), 1.0);
+/// assert_eq!(div_round(1.01, 1.0, RoundMethod::Up), 1.1);
+/// assert_eq!(div_round(1.01, 1.0, RoundMethod::Down), 1.0);
+/// assert_eq!(div_round(1.01, 1.0, RoundMethod::Nearest), 1.0);
+///
+/// // Division:
+/// assert_eq!(div_round(999.1, 1000.0, RoundMethod::FromZero), 1.0);
+/// assert_eq!(div_round(1001., 10., RoundMethod::FromZero), 101.);
+/// assert_eq!(div_round(9991., 10., RoundMethod::FromZero), 1000.);
+/// assert_eq!(div_round(-12.34, 1.0, RoundMethod::FromZero), -13.0);
+/// assert_eq!(div_round(1000.0, -3.14, RoundMethod::FromZero), -319.0);
+/// assert_eq!(div_round(-271828.0, -271.0, RoundMethod::FromZero), 1004.0);
+/// ```
+pub fn div_round(n: f64, d: f64, method: RoundMethod) -> f64 {
+    let v = n / d;
 
-    if v.abs() < 10.0 {
-        method.round(10.0 * v) / 10.0
-    } else {
-        method.round(v)
+    if v.abs() < 10.0 {
+        method.round(10.0 * v) / 10.0
+    } else {
+        method.round(v)
     }
 }
 
-// Rounds to the specified number of decimal points.
-fn round_with_precision(n: f64, method: RoundMethod, precision: usize) -> f64 {
-    let p = 10.0_f64.powf(precision as f64);
+// Rounds to the specified number of decimal points.
+fn round_with_precision(n: f64, method: RoundMethod, precision: usize) -> f64 {
+    let p = 10.0_f64.powf(precision as f64);
 
-    method.round(p * n) / p
+    method.round(p * n) / p
 }
 
-fn consider_suffix(
-    n: f64,
-    u: &Unit,
-    round_method: RoundMethod,
-    precision: usize,
-) -> Result<(f64, Option<Suffix>)> {
-    use crate::units::RawSuffix::*;
+fn consider_suffix(
+    n: f64,
+    u: &Unit,
+    round_method: RoundMethod,
+    precision: usize,
+) -> Result<(f64, Option<Suffix>)> {
+    use crate::units::RawSuffix::*;
 
-    let abs_n = n.abs();
-    let suffixes = [K, M, G, T, P, E, Z, Y];
+    let abs_n = n.abs();
+    let suffixes = [K, M, G, T, P, E, Z, Y];
 
-    let (bases, with_i) = match *u {
-        Unit::Si => (&SI_BASES, false),
-        Unit::Iec(with_i) => (&IEC_BASES, with_i),
-        Unit::Auto => return Err("Unit 'auto' isn't supported with --to options".to_owned()),
-        Unit::None => return Ok((n, None)),
+    let (bases, with_i) = match *u {
+        Unit::Si => (&SI_BASES, false),
+        Unit::Iec(with_i) => (&IEC_BASES, with_i),
+        Unit::Auto => return Err("Unit 'auto' isn't supported with --to options".to_owned()),
+        Unit::None => return Ok((n, None)),
     };
 
-    let i = match abs_n {
-        _ if abs_n <= bases[1] - 1.0 => return Ok((n, None)),
-        _ if abs_n < bases[2] => 1,
-        _ if abs_n < bases[3] => 2,
-        _ if abs_n < bases[4] => 3,
-        _ if abs_n < bases[5] => 4,
-        _ if abs_n < bases[6] => 5,
-        _ if abs_n < bases[7] => 6,
-        _ if abs_n < bases[8] => 7,
-        _ if abs_n < bases[9] => 8,
-        _ => return Err("Number is too big and unsupported".to_string()),
+    let i = match abs_n {
+        _ if abs_n <= bases[1] - 1.0 => return Ok((n, None)),
+        _ if abs_n < bases[2] => 1,
+        _ if abs_n < bases[3] => 2,
+        _ if abs_n < bases[4] => 3,
+        _ if abs_n < bases[5] => 4,
+        _ if abs_n < bases[6] => 5,
+        _ if abs_n < bases[7] => 6,
+        _ if abs_n < bases[8] => 7,
+        _ if abs_n < bases[9] => 8,
+        _ => return Err("Number is too big and unsupported".to_string()),
     };
 
-    let v = if precision > 0 {
-        round_with_precision(n / bases[i], round_method, precision)
-    } else {
-        div_round(n, bases[i], round_method)
+    let v = if precision > 0 {
+        round_with_precision(n / bases[i], round_method, precision)
+    } else {
+        div_round(n, bases[i], round_method)
     };
 
-    // check if rounding pushed us into the next base
-    if v.abs() >= bases[1] {
-        Ok((v / bases[1], Some((suffixes[i], with_i))))
-    } else {
-        Ok((v, Some((suffixes[i - 1], with_i))))
+    // check if rounding pushed us into the next base
+    if v.abs() >= bases[1] {
+        Ok((v / bases[1], Some((suffixes[i], with_i))))
+    } else {
+        Ok((v, Some((suffixes[i - 1], with_i))))
     }
 }
 
-fn transform_to(
-    s: f64,
-    opts: &TransformOptions,
-    round_method: RoundMethod,
-    precision: usize,
-) -> Result<String> {
-    let (i2, s) = consider_suffix(s, &opts.to, round_method, precision)?;
-    let i2 = i2 / (opts.to_unit as f64);
-    Ok(match s {
-        None => {
+fn transform_to(
+    s: f64,
+    opts: &TransformOptions,
+    round_method: RoundMethod,
+    precision: usize,
+) -> Result<String> {
+    let (i2, s) = consider_suffix(s, &opts.to, round_method, precision)?;
+    let i2 = i2 / (opts.to_unit as f64);
+    Ok(match s {
+        None => {
             format!(
                 "{:.precision$}",
-                round_with_precision(i2, round_method, precision),
-                precision = precision
+                round_with_precision(i2, round_method, precision),
+                precision = precision
             )
         }
-        Some(s) if precision > 0 => {
+        Some(s) if precision > 0 => {
             format!(
                 "{:.precision$}{}",
-                i2,
-                DisplayableSuffix(s),
-                precision = precision
+                i2,
+                DisplayableSuffix(s),
+                precision = precision
             )
         }
-        Some(s) if i2.abs() < 10.0 => format!("{:.1}{}", i2, DisplayableSuffix(s)),
-        Some(s) => format!("{:.0}{}", i2, DisplayableSuffix(s)),
+        Some(s) if i2.abs() < 10.0 => format!("{:.1}{}", i2, DisplayableSuffix(s)),
+        Some(s) => format!("{:.0}{}", i2, DisplayableSuffix(s)),
     })
 }
 
-fn format_string(
-    source: &str,
-    options: &NumfmtOptions,
-    implicit_padding: Option<isize>,
-) -> Result<String> {
-    // strip the (optional) suffix before applying any transformation
-    let source_without_suffix = match &options.suffix {
-        Some(suffix) => source.strip_suffix(suffix).unwrap_or(source),
-        None => source,
+fn format_string(
+    source: &str,
+    options: &NumfmtOptions,
+    implicit_padding: Option<isize>,
+) -> Result<String> {
+    // strip the (optional) suffix before applying any transformation
+    let source_without_suffix = match &options.suffix {
+        Some(suffix) => source.strip_suffix(suffix).unwrap_or(source),
+        None => source,
     };
 
-    let precision = if let Some(p) = options.format.precision {
-        p
-    } else if options.transform.from == Unit::None && options.transform.to == Unit::None {
-        parse_implicit_precision(source_without_suffix)
-    } else {
-        0
-    };
+    let precision = if let Some(p) = options.format.precision {
+        p
+    } else if options.transform.from == Unit::None && options.transform.to == Unit::None {
+        parse_implicit_precision(source_without_suffix)
+    } else {
+        0
+    };
 
-    let number = transform_to(
-        transform_from(source_without_suffix, &options.transform)?,
-        &options.transform,
-        options.round,
-        precision,
+    let number = transform_to(
+        transform_from(source_without_suffix, &options.transform)?,
+        &options.transform,
+        options.round,
+        precision,
     )?;
 
-    // bring back the suffix before applying padding
-    let number_with_suffix = match &options.suffix {
-        Some(suffix) => format!("{}{}", number, suffix),
-        None => number,
+    // bring back the suffix before applying padding
+    let number_with_suffix = match &options.suffix {
+        Some(suffix) => format!("{}{}", number, suffix),
+        None => number,
     };
 
-    let padding = options
-        .format
-        .padding
-        .unwrap_or_else(|| implicit_padding.unwrap_or(options.padding));
+    let padding = options
+        .format
+        .padding
+        .unwrap_or_else(|| implicit_padding.unwrap_or(options.padding));
 
-    let padded_number = match padding {
-        0 => number_with_suffix,
-        p if p > 0 && options.format.zero_padding => {
-            let zero_padded = format!("{:0>padding$}", number_with_suffix, padding = p as usize);
+    let padded_number = match padding {
+        0 => number_with_suffix,
+        p if p > 0 && options.format.zero_padding => {
+            let zero_padded = format!("{:0>padding$}", number_with_suffix, padding = p as usize);
 
-            match implicit_padding.unwrap_or(options.padding) {
-                0 => zero_padded,
-                p if p > 0 => format!("{:>padding$}", zero_padded, padding = p as usize),
-                p => format!("{:<padding$}", zero_padded, padding = p.unsigned_abs()),
+            match implicit_padding.unwrap_or(options.padding) {
+                0 => zero_padded,
+                p if p > 0 => format!("{:>padding$}", zero_padded, padding = p as usize),
+                p => format!("{:<padding$}", zero_padded, padding = p.unsigned_abs()),
             }
         }
-        p if p > 0 => format!("{:>padding$}", number_with_suffix, padding = p as usize),
-        p => format!(
+        p if p > 0 => format!("{:>padding$}", number_with_suffix, padding = p as usize),
+        p => format!(
             "{:<padding$}",
-            number_with_suffix,
-            padding = p.unsigned_abs()
+            number_with_suffix,
+            padding = p.unsigned_abs()
         ),
     };
 
     Ok(format!(
         "{}{}{}",
-        options.format.prefix, padded_number, options.format.suffix
+        options.format.prefix, padded_number, options.format.suffix
     ))
 }
 
-fn format_and_print_delimited(s: &str, options: &NumfmtOptions) -> Result<()> {
-    let delimiter = options.delimiter.as_ref().unwrap();
+fn format_and_print_delimited(s: &str, options: &NumfmtOptions) -> Result<()> {
+    let delimiter = options.delimiter.as_ref().unwrap();
 
-    for (n, field) in (1..).zip(s.split(delimiter)) {
-        let field_selected = uucore::ranges::contain(&options.fields, n);
+    for (n, field) in (1..).zip(s.split(delimiter)) {
+        let field_selected = uucore::ranges::contain(&options.fields, n);
 
-        // print delimiter before second and subsequent fields
-        if n > 1 {
-            print!("{}", delimiter);
+        // print delimiter before second and subsequent fields
+        if n > 1 {
+            print!("{}", delimiter);
         }
 
-        if field_selected {
-            print!("{}", format_string(field.trim_start(), options, None)?);
-        } else {
-            // print unselected field without conversion
-            print!("{}", field);
+        if field_selected {
+            print!("{}", format_string(field.trim_start(), options, None)?);
+        } else {
+            // print unselected field without conversion
+            print!("{}", field);
         }
     }
 
@@ -839,31 +839,31 @@
     Ok(())
 }
 
-fn format_and_print_whitespace(s: &str, options: &NumfmtOptions) -> Result<()> {
-    for (n, (prefix, field)) in (1..).zip(WhitespaceSplitter { s: Some(s) }) {
-        let field_selected = uucore::ranges::contain(&options.fields, n);
+fn format_and_print_whitespace(s: &str, options: &NumfmtOptions) -> Result<()> {
+    for (n, (prefix, field)) in (1..).zip(WhitespaceSplitter { s: Some(s) }) {
+        let field_selected = uucore::ranges::contain(&options.fields, n);
 
-        if field_selected {
-            let empty_prefix = prefix.is_empty();
+        if field_selected {
+            let empty_prefix = prefix.is_empty();
 
-            // print delimiter before second and subsequent fields
-            let prefix = if n > 1 {
+            // print delimiter before second and subsequent fields
+            let prefix = if n > 1 {
                 print!(" ");
-                &prefix[1..]
-            } else {
-                prefix
+                &prefix[1..]
+            } else {
+                prefix
             };
 
-            let implicit_padding = if !empty_prefix && options.padding == 0 {
-                Some((prefix.len() + field.len()) as isize)
-            } else {
-                None
-            };
+            let implicit_padding = if !empty_prefix && options.padding == 0 {
+                Some((prefix.len() + field.len()) as isize)
+            } else {
+                None
+            };
 
-            print!("{}", format_string(field, options, implicit_padding)?);
-        } else {
-            // print unselected field without conversion
-            print!("{}{}", prefix, field);
+            print!("{}", format_string(field, options, implicit_padding)?);
+        } else {
+            // print unselected field without conversion
+            print!("{}{}", prefix, field);
         }
     }
 
@@ -872,53 +872,53 @@
     Ok(())
 }
 
-/// Format a line of text according to the selected options.
-///
-/// Given a line of text `s`, split the line into fields, transform and format
-/// any selected numeric fields, and print the result to stdout. Fields not
-/// selected for conversion are passed through unmodified.
-pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<()> {
-    match &options.delimiter {
-        Some(_) => format_and_print_delimited(s, options),
-        None => format_and_print_whitespace(s, options),
+/// Format a line of text according to the selected options.
+///
+/// Given a line of text `s`, split the line into fields, transform and format
+/// any selected numeric fields, and print the result to stdout. Fields not
+/// selected for conversion are passed through unmodified.
+pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<()> {
+    match &options.delimiter {
+        Some(_) => format_and_print_delimited(s, options),
+        None => format_and_print_whitespace(s, options),
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
+#[cfg(test)]
+mod tests {
+    use super::*;
 
-    #[test]
-    fn test_round_with_precision() {
-        let rm = RoundMethod::FromZero;
-        assert_eq!(1.0, round_with_precision(0.12345, rm, 0));
-        assert_eq!(0.2, round_with_precision(0.12345, rm, 1));
-        assert_eq!(0.13, round_with_precision(0.12345, rm, 2));
-        assert_eq!(0.124, round_with_precision(0.12345, rm, 3));
-        assert_eq!(0.1235, round_with_precision(0.12345, rm, 4));
-        assert_eq!(0.12345, round_with_precision(0.12345, rm, 5));
+    #[test]
+    fn test_round_with_precision() {
+        let rm = RoundMethod::FromZero;
+        assert_eq!(1.0, round_with_precision(0.12345, rm, 0));
+        assert_eq!(0.2, round_with_precision(0.12345, rm, 1));
+        assert_eq!(0.13, round_with_precision(0.12345, rm, 2));
+        assert_eq!(0.124, round_with_precision(0.12345, rm, 3));
+        assert_eq!(0.1235, round_with_precision(0.12345, rm, 4));
+        assert_eq!(0.12345, round_with_precision(0.12345, rm, 5));
 
-        let rm = RoundMethod::TowardsZero;
-        assert_eq!(0.0, round_with_precision(0.12345, rm, 0));
-        assert_eq!(0.1, round_with_precision(0.12345, rm, 1));
-        assert_eq!(0.12, round_with_precision(0.12345, rm, 2));
-        assert_eq!(0.123, round_with_precision(0.12345, rm, 3));
-        assert_eq!(0.1234, round_with_precision(0.12345, rm, 4));
-        assert_eq!(0.12345, round_with_precision(0.12345, rm, 5));
+        let rm = RoundMethod::TowardsZero;
+        assert_eq!(0.0, round_with_precision(0.12345, rm, 0));
+        assert_eq!(0.1, round_with_precision(0.12345, rm, 1));
+        assert_eq!(0.12, round_with_precision(0.12345, rm, 2));
+        assert_eq!(0.123, round_with_precision(0.12345, rm, 3));
+        assert_eq!(0.1234, round_with_precision(0.12345, rm, 4));
+        assert_eq!(0.12345, round_with_precision(0.12345, rm, 5));
     }
 
-    #[test]
-    fn test_parse_implicit_precision() {
-        assert_eq!(0, parse_implicit_precision(""));
-        assert_eq!(0, parse_implicit_precision("1"));
-        assert_eq!(1, parse_implicit_precision("1.2"));
-        assert_eq!(2, parse_implicit_precision("1.23"));
-        assert_eq!(3, parse_implicit_precision("1.234"));
-        assert_eq!(0, parse_implicit_precision("1K"));
-        assert_eq!(1, parse_implicit_precision("1.2K"));
-        assert_eq!(2, parse_implicit_precision("1.23K"));
-        assert_eq!(3, parse_implicit_precision("1.234K"));
+    #[test]
+    fn test_parse_implicit_precision() {
+        assert_eq!(0, parse_implicit_precision(""));
+        assert_eq!(0, parse_implicit_precision("1"));
+        assert_eq!(1, parse_implicit_precision("1.2"));
+        assert_eq!(2, parse_implicit_precision("1.23"));
+        assert_eq!(3, parse_implicit_precision("1.234"));
+        assert_eq!(0, parse_implicit_precision("1K"));
+        assert_eq!(1, parse_implicit_precision("1.2K"));
+        assert_eq!(2, parse_implicit_precision("1.23K"));
+        assert_eq!(3, parse_implicit_precision("1.234K"));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_numfmt/numfmt.rs.html b/dev/src/uu_numfmt/numfmt.rs.html index d92ca686a..608562128 100644 --- a/dev/src/uu_numfmt/numfmt.rs.html +++ b/dev/src/uu_numfmt/numfmt.rs.html @@ -1,4 +1,4 @@ -numfmt.rs - source
1
+numfmt.rs - source
1
 2
 3
 4
@@ -463,470 +463,470 @@
 463
 464
 465
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Yury Krivopalov <ykrivopalov@yandex.ru>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Yury Krivopalov <ykrivopalov@yandex.ru>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-use crate::errors::*;
-use crate::format::format_and_print;
-use crate::options::*;
-use crate::units::{Result, Unit};
-use clap::{crate_version, parser::ValueSource, Arg, ArgAction, ArgMatches, Command};
-use std::io::{BufRead, Write};
-use units::{IEC_BASES, SI_BASES};
-use uucore::display::Quotable;
-use uucore::error::UResult;
-use uucore::format_usage;
-use uucore::ranges::Range;
-use uucore::{help_section, help_usage};
+use crate::errors::*;
+use crate::format::format_and_print;
+use crate::options::*;
+use crate::units::{Result, Unit};
+use clap::{crate_version, parser::ValueSource, Arg, ArgAction, ArgMatches, Command};
+use std::io::{BufRead, Write};
+use units::{IEC_BASES, SI_BASES};
+use uucore::display::Quotable;
+use uucore::error::UResult;
+use uucore::format_usage;
+use uucore::ranges::Range;
+use uucore::{help_section, help_usage};
 
-pub mod errors;
-pub mod format;
-pub mod options;
-mod units;
+pub mod errors;
+pub mod format;
+pub mod options;
+mod units;
 
-const ABOUT: &str = help_section!("about", "numfmt.md");
-const LONG_HELP: &str = help_section!("long help", "numfmt.md");
-const USAGE: &str = help_usage!("numfmt.md");
+const ABOUT: &str = help_section!("about", "numfmt.md");
+const LONG_HELP: &str = help_section!("long help", "numfmt.md");
+const USAGE: &str = help_usage!("numfmt.md");
 
-fn handle_args<'a>(args: impl Iterator<Item = &'a str>, options: &NumfmtOptions) -> UResult<()> {
-    for l in args {
-        match format_and_print(l, options) {
+fn handle_args<'a>(args: impl Iterator<Item = &'a str>, options: &NumfmtOptions) -> UResult<()> {
+    for l in args {
+        match format_and_print(l, options) {
             Ok(_) => Ok(()),
-            Err(e) => Err(NumfmtError::FormattingError(e.to_string())),
+            Err(e) => Err(NumfmtError::FormattingError(e.to_string())),
         }?;
     }
 
     Ok(())
 }
 
-fn handle_buffer<R>(input: R, options: &NumfmtOptions) -> UResult<()>
-where
-    R: BufRead,
+fn handle_buffer<R>(input: R, options: &NumfmtOptions) -> UResult<()>
+where
+    R: BufRead,
 {
-    let mut lines = input.lines();
-    for (idx, line) in lines.by_ref().enumerate() {
-        match line {
-            Ok(l) if idx < options.header => {
-                println!("{}", l);
+    let mut lines = input.lines();
+    for (idx, line) in lines.by_ref().enumerate() {
+        match line {
+            Ok(l) if idx < options.header => {
+                println!("{}", l);
                 Ok(())
             }
-            Ok(l) => match format_and_print(&l, options) {
+            Ok(l) => match format_and_print(&l, options) {
                 Ok(_) => Ok(()),
-                Err(e) => Err(NumfmtError::FormattingError(e.to_string())),
+                Err(e) => Err(NumfmtError::FormattingError(e.to_string())),
             },
-            Err(e) => Err(NumfmtError::IoError(e.to_string())),
+            Err(e) => Err(NumfmtError::IoError(e.to_string())),
         }?;
     }
     Ok(())
 }
 
-fn parse_unit(s: &str) -> Result<Unit> {
-    match s {
-        "auto" => Ok(Unit::Auto),
-        "si" => Ok(Unit::Si),
-        "iec" => Ok(Unit::Iec(false)),
-        "iec-i" => Ok(Unit::Iec(true)),
-        "none" => Ok(Unit::None),
-        _ => Err("Unsupported unit is specified".to_owned()),
+fn parse_unit(s: &str) -> Result<Unit> {
+    match s {
+        "auto" => Ok(Unit::Auto),
+        "si" => Ok(Unit::Si),
+        "iec" => Ok(Unit::Iec(false)),
+        "iec-i" => Ok(Unit::Iec(true)),
+        "none" => Ok(Unit::None),
+        _ => Err("Unsupported unit is specified".to_owned()),
     }
 }
 
-// Parses a unit size. Suffixes are turned into their integer representations. For example, 'K'
-// will return `Ok(1000)`, and '2K' will return `Ok(2000)`.
-fn parse_unit_size(s: &str) -> Result<usize> {
-    let number: String = s.chars().take_while(char::is_ascii_digit).collect();
-    let suffix = &s[number.len()..];
+// Parses a unit size. Suffixes are turned into their integer representations. For example, 'K'
+// will return `Ok(1000)`, and '2K' will return `Ok(2000)`.
+fn parse_unit_size(s: &str) -> Result<usize> {
+    let number: String = s.chars().take_while(char::is_ascii_digit).collect();
+    let suffix = &s[number.len()..];
 
-    if number.is_empty() || "0".repeat(number.len()) != number {
-        if let Some(multiplier) = parse_unit_size_suffix(suffix) {
-            if number.is_empty() {
-                return Ok(multiplier);
+    if number.is_empty() || "0".repeat(number.len()) != number {
+        if let Some(multiplier) = parse_unit_size_suffix(suffix) {
+            if number.is_empty() {
+                return Ok(multiplier);
             }
 
-            if let Ok(n) = number.parse::<usize>() {
-                return Ok(n * multiplier);
+            if let Ok(n) = number.parse::<usize>() {
+                return Ok(n * multiplier);
             }
         }
     }
 
-    Err(format!("invalid unit size: {}", s.quote()))
+    Err(format!("invalid unit size: {}", s.quote()))
 }
 
-// Parses a suffix of a unit size and returns the corresponding multiplier. For example,
-// the suffix 'K' will return `Some(1000)`, and 'Ki' will return `Some(1024)`.
-//
-// If the suffix is empty, `Some(1)` is returned.
-//
-// If the suffix is unknown, `None` is returned.
-fn parse_unit_size_suffix(s: &str) -> Option<usize> {
-    if s.is_empty() {
-        return Some(1);
+// Parses a suffix of a unit size and returns the corresponding multiplier. For example,
+// the suffix 'K' will return `Some(1000)`, and 'Ki' will return `Some(1024)`.
+//
+// If the suffix is empty, `Some(1)` is returned.
+//
+// If the suffix is unknown, `None` is returned.
+fn parse_unit_size_suffix(s: &str) -> Option<usize> {
+    if s.is_empty() {
+        return Some(1);
     }
 
-    let suffix = s.chars().next().unwrap();
+    let suffix = s.chars().next().unwrap();
 
-    if let Some(i) = ['K', 'M', 'G', 'T', 'P', 'E']
-        .iter()
-        .position(|&ch| ch == suffix)
+    if let Some(i) = ['K', 'M', 'G', 'T', 'P', 'E']
+        .iter()
+        .position(|&ch| ch == suffix)
     {
-        return match s.len() {
-            1 => Some(SI_BASES[i + 1] as usize),
-            2 if s.ends_with('i') => Some(IEC_BASES[i + 1] as usize),
-            _ => None,
+        return match s.len() {
+            1 => Some(SI_BASES[i + 1] as usize),
+            2 if s.ends_with('i') => Some(IEC_BASES[i + 1] as usize),
+            _ => None,
         };
     }
 
-    None
-}
+    None
+}
 
-fn parse_options(args: &ArgMatches) -> Result<NumfmtOptions> {
-    let from = parse_unit(args.get_one::<String>(options::FROM).unwrap())?;
-    let to = parse_unit(args.get_one::<String>(options::TO).unwrap())?;
-    let from_unit = parse_unit_size(args.get_one::<String>(options::FROM_UNIT).unwrap())?;
-    let to_unit = parse_unit_size(args.get_one::<String>(options::TO_UNIT).unwrap())?;
+fn parse_options(args: &ArgMatches) -> Result<NumfmtOptions> {
+    let from = parse_unit(args.get_one::<String>(options::FROM).unwrap())?;
+    let to = parse_unit(args.get_one::<String>(options::TO).unwrap())?;
+    let from_unit = parse_unit_size(args.get_one::<String>(options::FROM_UNIT).unwrap())?;
+    let to_unit = parse_unit_size(args.get_one::<String>(options::TO_UNIT).unwrap())?;
 
-    let transform = TransformOptions {
-        from,
-        from_unit,
-        to,
-        to_unit,
+    let transform = TransformOptions {
+        from,
+        from_unit,
+        to,
+        to_unit,
     };
 
-    let padding = match args.get_one::<String>(options::PADDING) {
-        Some(s) => s
-            .parse::<isize>()
-            .map_err(|_| s)
-            .and_then(|n| match n {
-                0 => Err(s),
-                _ => Ok(n),
+    let padding = match args.get_one::<String>(options::PADDING) {
+        Some(s) => s
+            .parse::<isize>()
+            .map_err(|_| s)
+            .and_then(|n| match n {
+                0 => Err(s),
+                _ => Ok(n),
             })
-            .map_err(|s| format!("invalid padding value {}", s.quote())),
-        None => Ok(0),
+            .map_err(|s| format!("invalid padding value {}", s.quote())),
+        None => Ok(0),
     }?;
 
-    let header = if args.value_source(options::HEADER) == Some(ValueSource::CommandLine) {
-        let value = args.get_one::<String>(options::HEADER).unwrap();
+    let header = if args.value_source(options::HEADER) == Some(ValueSource::CommandLine) {
+        let value = args.get_one::<String>(options::HEADER).unwrap();
 
-        value
-            .parse::<usize>()
-            .map_err(|_| value)
-            .and_then(|n| match n {
-                0 => Err(value),
-                _ => Ok(n),
+        value
+            .parse::<usize>()
+            .map_err(|_| value)
+            .and_then(|n| match n {
+                0 => Err(value),
+                _ => Ok(n),
             })
-            .map_err(|value| format!("invalid header value {}", value.quote()))
-    } else {
+            .map_err(|value| format!("invalid header value {}", value.quote()))
+    } else {
         Ok(0)
     }?;
 
-    let fields = args.get_one::<String>(options::FIELD).unwrap().as_str();
-    // a lone "-" means "all fields", even as part of a list of fields
-    let fields = if fields.split(&[',', ' ']).any(|x| x == "-") {
-        vec![Range {
-            low: 1,
-            high: std::usize::MAX,
+    let fields = args.get_one::<String>(options::FIELD).unwrap().as_str();
+    // a lone "-" means "all fields", even as part of a list of fields
+    let fields = if fields.split(&[',', ' ']).any(|x| x == "-") {
+        vec![Range {
+            low: 1,
+            high: std::usize::MAX,
         }]
-    } else {
-        Range::from_list(fields)?
+    } else {
+        Range::from_list(fields)?
+    };
+
+    let format = match args.get_one::<String>(options::FORMAT) {
+        Some(s) => s.parse()?,
+        None => FormatOptions::default(),
     };
 
-    let format = match args.get_one::<String>(options::FORMAT) {
-        Some(s) => s.parse()?,
-        None => FormatOptions::default(),
-    };
-
-    if format.grouping && to != Unit::None {
-        return Err("grouping cannot be combined with --to".to_string());
+    if format.grouping && to != Unit::None {
+        return Err("grouping cannot be combined with --to".to_string());
     }
 
-    let delimiter = args
-        .get_one::<String>(options::DELIMITER)
-        .map_or(Ok(None), |arg| {
-            if arg.len() == 1 {
-                Ok(Some(arg.to_string()))
-            } else {
-                Err("the delimiter must be a single character".to_string())
+    let delimiter = args
+        .get_one::<String>(options::DELIMITER)
+        .map_or(Ok(None), |arg| {
+            if arg.len() == 1 {
+                Ok(Some(arg.to_string()))
+            } else {
+                Err("the delimiter must be a single character".to_string())
             }
         })?;
 
-    // unwrap is fine because the argument has a default value
-    let round = match args.get_one::<String>(options::ROUND).unwrap().as_str() {
-        "up" => RoundMethod::Up,
-        "down" => RoundMethod::Down,
-        "from-zero" => RoundMethod::FromZero,
-        "towards-zero" => RoundMethod::TowardsZero,
-        "nearest" => RoundMethod::Nearest,
-        _ => unreachable!("Should be restricted by clap"),
+    // unwrap is fine because the argument has a default value
+    let round = match args.get_one::<String>(options::ROUND).unwrap().as_str() {
+        "up" => RoundMethod::Up,
+        "down" => RoundMethod::Down,
+        "from-zero" => RoundMethod::FromZero,
+        "towards-zero" => RoundMethod::TowardsZero,
+        "nearest" => RoundMethod::Nearest,
+        _ => unreachable!("Should be restricted by clap"),
     };
 
-    let suffix = args
-        .get_one::<String>(options::SUFFIX)
-        .map(|s| s.to_owned());
+    let suffix = args
+        .get_one::<String>(options::SUFFIX)
+        .map(|s| s.to_owned());
 
-    Ok(NumfmtOptions {
-        transform,
-        padding,
-        header,
-        fields,
-        delimiter,
-        round,
-        suffix,
-        format,
+    Ok(NumfmtOptions {
+        transform,
+        padding,
+        header,
+        fields,
+        delimiter,
+        round,
+        suffix,
+        format,
     })
 }
 
-// If the --format argument and its value are provided separately, they are concatenated to avoid a
-// potential clap error. For example: "--format --%f--" is changed to "--format=--%f--".
-fn concat_format_arg_and_value(args: &[String]) -> Vec<String> {
-    let mut processed_args: Vec<String> = Vec::with_capacity(args.len());
-    let mut iter = args.iter().peekable();
+// If the --format argument and its value are provided separately, they are concatenated to avoid a
+// potential clap error. For example: "--format --%f--" is changed to "--format=--%f--".
+fn concat_format_arg_and_value(args: &[String]) -> Vec<String> {
+    let mut processed_args: Vec<String> = Vec::with_capacity(args.len());
+    let mut iter = args.iter().peekable();
 
-    while let Some(arg) = iter.next() {
-        if arg == "--format" && iter.peek().is_some() {
-            processed_args.push(format!("--format={}", iter.peek().unwrap()));
-            iter.next();
-        } else {
-            processed_args.push(arg.to_string());
+    while let Some(arg) = iter.next() {
+        if arg == "--format" && iter.peek().is_some() {
+            processed_args.push(format!("--format={}", iter.peek().unwrap()));
+            iter.next();
+        } else {
+            processed_args.push(arg.to_string());
         }
     }
 
-    processed_args
+    processed_args
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(concat_format_arg_and_value(&args))?;
+    let matches = uu_app().try_get_matches_from(concat_format_arg_and_value(&args))?;
 
-    let options = parse_options(&matches).map_err(NumfmtError::IllegalArgument)?;
+    let options = parse_options(&matches).map_err(NumfmtError::IllegalArgument)?;
 
-    let result = match matches.get_many::<String>(options::NUMBER) {
-        Some(values) => handle_args(values.map(|s| s.as_str()), &options),
-        None => {
-            let stdin = std::io::stdin();
-            let mut locked_stdin = stdin.lock();
-            handle_buffer(&mut locked_stdin, &options)
+    let result = match matches.get_many::<String>(options::NUMBER) {
+        Some(values) => handle_args(values.map(|s| s.as_str()), &options),
+        None => {
+            let stdin = std::io::stdin();
+            let mut locked_stdin = stdin.lock();
+            handle_buffer(&mut locked_stdin, &options)
         }
     };
 
-    match result {
-        Err(e) => {
-            std::io::stdout().flush().expect("error flushing stdout");
-            Err(e)
+    match result {
+        Err(e) => {
+            std::io::stdout().flush().expect("error flushing stdout");
+            Err(e)
         }
-        _ => Ok(()),
+        _ => Ok(()),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(LONG_HELP)
-        .override_usage(format_usage(USAGE))
-        .allow_negative_numbers(true)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::DELIMITER)
-                .short('d')
-                .long(options::DELIMITER)
-                .value_name("X")
-                .help("use X instead of whitespace for field delimiter"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(LONG_HELP)
+        .override_usage(format_usage(USAGE))
+        .allow_negative_numbers(true)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::DELIMITER)
+                .short('d')
+                .long(options::DELIMITER)
+                .value_name("X")
+                .help("use X instead of whitespace for field delimiter"),
         )
-        .arg(
-            Arg::new(options::FIELD)
-                .long(options::FIELD)
-                .help("replace the numbers in these input fields; see FIELDS below")
-                .value_name("FIELDS")
-                .allow_hyphen_values(true)
-                .default_value(options::FIELD_DEFAULT),
+        .arg(
+            Arg::new(options::FIELD)
+                .long(options::FIELD)
+                .help("replace the numbers in these input fields; see FIELDS below")
+                .value_name("FIELDS")
+                .allow_hyphen_values(true)
+                .default_value(options::FIELD_DEFAULT),
         )
-        .arg(
-            Arg::new(options::FORMAT)
-                .long(options::FORMAT)
-                .help("use printf style floating-point FORMAT; see FORMAT below for details")
-                .value_name("FORMAT"),
+        .arg(
+            Arg::new(options::FORMAT)
+                .long(options::FORMAT)
+                .help("use printf style floating-point FORMAT; see FORMAT below for details")
+                .value_name("FORMAT"),
         )
-        .arg(
-            Arg::new(options::FROM)
-                .long(options::FROM)
-                .help("auto-scale input numbers to UNITs; see UNIT below")
-                .value_name("UNIT")
-                .default_value(options::FROM_DEFAULT),
+        .arg(
+            Arg::new(options::FROM)
+                .long(options::FROM)
+                .help("auto-scale input numbers to UNITs; see UNIT below")
+                .value_name("UNIT")
+                .default_value(options::FROM_DEFAULT),
         )
-        .arg(
-            Arg::new(options::FROM_UNIT)
-                .long(options::FROM_UNIT)
-                .help("specify the input unit size")
-                .value_name("N")
-                .default_value(options::FROM_UNIT_DEFAULT),
+        .arg(
+            Arg::new(options::FROM_UNIT)
+                .long(options::FROM_UNIT)
+                .help("specify the input unit size")
+                .value_name("N")
+                .default_value(options::FROM_UNIT_DEFAULT),
         )
-        .arg(
-            Arg::new(options::TO)
-                .long(options::TO)
-                .help("auto-scale output numbers to UNITs; see UNIT below")
-                .value_name("UNIT")
-                .default_value(options::TO_DEFAULT),
+        .arg(
+            Arg::new(options::TO)
+                .long(options::TO)
+                .help("auto-scale output numbers to UNITs; see UNIT below")
+                .value_name("UNIT")
+                .default_value(options::TO_DEFAULT),
         )
-        .arg(
-            Arg::new(options::TO_UNIT)
-                .long(options::TO_UNIT)
-                .help("the output unit size")
-                .value_name("N")
-                .default_value(options::TO_UNIT_DEFAULT),
+        .arg(
+            Arg::new(options::TO_UNIT)
+                .long(options::TO_UNIT)
+                .help("the output unit size")
+                .value_name("N")
+                .default_value(options::TO_UNIT_DEFAULT),
         )
-        .arg(
-            Arg::new(options::PADDING)
-                .long(options::PADDING)
-                .help(
+        .arg(
+            Arg::new(options::PADDING)
+                .long(options::PADDING)
+                .help(
                     "pad the output to N characters; positive N will \
                      right-align; negative N will left-align; padding is \
                      ignored if the output is wider than N; the default is \
                      to automatically pad if a whitespace is found",
                 )
-                .value_name("N"),
+                .value_name("N"),
         )
-        .arg(
-            Arg::new(options::HEADER)
-                .long(options::HEADER)
-                .help(
+        .arg(
+            Arg::new(options::HEADER)
+                .long(options::HEADER)
+                .help(
                     "print (without converting) the first N header lines; \
                      N defaults to 1 if not specified",
                 )
-                .num_args(..=1)
-                .value_name("N")
-                .default_missing_value(options::HEADER_DEFAULT)
-                .hide_default_value(true),
+                .num_args(..=1)
+                .value_name("N")
+                .default_missing_value(options::HEADER_DEFAULT)
+                .hide_default_value(true),
         )
-        .arg(
-            Arg::new(options::ROUND)
-                .long(options::ROUND)
-                .help(
+        .arg(
+            Arg::new(options::ROUND)
+                .long(options::ROUND)
+                .help(
                     "use METHOD for rounding when scaling; METHOD can be: up,\
                     down, from-zero, towards-zero, nearest",
                 )
-                .value_name("METHOD")
-                .default_value("from-zero")
-                .value_parser(["up", "down", "from-zero", "towards-zero", "nearest"]),
+                .value_name("METHOD")
+                .default_value("from-zero")
+                .value_parser(["up", "down", "from-zero", "towards-zero", "nearest"]),
         )
-        .arg(
-            Arg::new(options::SUFFIX)
-                .long(options::SUFFIX)
-                .help(
+        .arg(
+            Arg::new(options::SUFFIX)
+                .long(options::SUFFIX)
+                .help(
                     "print SUFFIX after each formatted number, and accept \
                     inputs optionally ending with SUFFIX",
                 )
-                .value_name("SUFFIX"),
+                .value_name("SUFFIX"),
         )
-        .arg(
-            Arg::new(options::NUMBER)
-                .hide(true)
-                .action(ArgAction::Append),
+        .arg(
+            Arg::new(options::NUMBER)
+                .hide(true)
+                .action(ArgAction::Append),
         )
 }
 
-#[cfg(test)]
-mod tests {
-    use super::{
-        handle_buffer, parse_unit_size, parse_unit_size_suffix, FormatOptions, NumfmtOptions,
-        Range, RoundMethod, TransformOptions, Unit,
+#[cfg(test)]
+mod tests {
+    use super::{
+        handle_buffer, parse_unit_size, parse_unit_size_suffix, FormatOptions, NumfmtOptions,
+        Range, RoundMethod, TransformOptions, Unit,
     };
-    use std::io::{BufReader, Error, ErrorKind, Read};
-    struct MockBuffer {}
+    use std::io::{BufReader, Error, ErrorKind, Read};
+    struct MockBuffer {}
 
-    impl Read for MockBuffer {
-        fn read(&mut self, _: &mut [u8]) -> Result<usize, Error> {
-            Err(Error::new(ErrorKind::BrokenPipe, "broken pipe"))
+    impl Read for MockBuffer {
+        fn read(&mut self, _: &mut [u8]) -> Result<usize, Error> {
+            Err(Error::new(ErrorKind::BrokenPipe, "broken pipe"))
         }
     }
 
-    fn get_valid_options() -> NumfmtOptions {
-        NumfmtOptions {
-            transform: TransformOptions {
-                from: Unit::None,
-                from_unit: 1,
-                to: Unit::None,
-                to_unit: 1,
+    fn get_valid_options() -> NumfmtOptions {
+        NumfmtOptions {
+            transform: TransformOptions {
+                from: Unit::None,
+                from_unit: 1,
+                to: Unit::None,
+                to_unit: 1,
             },
-            padding: 10,
-            header: 1,
-            fields: vec![Range { low: 0, high: 1 }],
-            delimiter: None,
-            round: RoundMethod::Nearest,
-            suffix: None,
-            format: FormatOptions::default(),
+            padding: 10,
+            header: 1,
+            fields: vec![Range { low: 0, high: 1 }],
+            delimiter: None,
+            round: RoundMethod::Nearest,
+            suffix: None,
+            format: FormatOptions::default(),
         }
     }
 
-    #[test]
-    fn broken_buffer_returns_io_error() {
-        let mock_buffer = MockBuffer {};
-        let result = handle_buffer(BufReader::new(mock_buffer), &get_valid_options())
-            .expect_err("returned Ok after receiving IO error");
-        let result_debug = format!("{:?}", result);
-        let result_display = format!("{}", result);
-        assert_eq!(result_debug, "IoError(\"broken pipe\")");
-        assert_eq!(result_display, "broken pipe");
-        assert_eq!(result.code(), 1);
+    #[test]
+    fn broken_buffer_returns_io_error() {
+        let mock_buffer = MockBuffer {};
+        let result = handle_buffer(BufReader::new(mock_buffer), &get_valid_options())
+            .expect_err("returned Ok after receiving IO error");
+        let result_debug = format!("{:?}", result);
+        let result_display = format!("{}", result);
+        assert_eq!(result_debug, "IoError(\"broken pipe\")");
+        assert_eq!(result_display, "broken pipe");
+        assert_eq!(result.code(), 1);
     }
 
-    #[test]
-    fn non_numeric_returns_formatting_error() {
-        let input_value = b"135\nhello";
-        let result = handle_buffer(BufReader::new(&input_value[..]), &get_valid_options())
-            .expect_err("returned Ok after receiving improperly formatted input");
-        let result_debug = format!("{:?}", result);
-        let result_display = format!("{}", result);
+    #[test]
+    fn non_numeric_returns_formatting_error() {
+        let input_value = b"135\nhello";
+        let result = handle_buffer(BufReader::new(&input_value[..]), &get_valid_options())
+            .expect_err("returned Ok after receiving improperly formatted input");
+        let result_debug = format!("{:?}", result);
+        let result_display = format!("{}", result);
         assert_eq!(
-            result_debug,
-            "FormattingError(\"invalid suffix in input: 'hello'\")"
-        );
-        assert_eq!(result_display, "invalid suffix in input: 'hello'");
-        assert_eq!(result.code(), 2);
+            result_debug,
+            "FormattingError(\"invalid suffix in input: 'hello'\")"
+        );
+        assert_eq!(result_display, "invalid suffix in input: 'hello'");
+        assert_eq!(result.code(), 2);
     }
 
-    #[test]
-    fn valid_input_returns_ok() {
-        let input_value = b"165\n100\n300\n500";
-        let result = handle_buffer(BufReader::new(&input_value[..]), &get_valid_options());
-        assert!(result.is_ok(), "did not return Ok for valid input");
+    #[test]
+    fn valid_input_returns_ok() {
+        let input_value = b"165\n100\n300\n500";
+        let result = handle_buffer(BufReader::new(&input_value[..]), &get_valid_options());
+        assert!(result.is_ok(), "did not return Ok for valid input");
     }
 
-    #[test]
-    fn test_parse_unit_size() {
-        assert_eq!(1, parse_unit_size("1").unwrap());
-        assert_eq!(1, parse_unit_size("01").unwrap());
-        assert!(parse_unit_size("1.1").is_err());
-        assert!(parse_unit_size("0").is_err());
-        assert!(parse_unit_size("-1").is_err());
-        assert!(parse_unit_size("A").is_err());
-        assert!(parse_unit_size("18446744073709551616").is_err());
+    #[test]
+    fn test_parse_unit_size() {
+        assert_eq!(1, parse_unit_size("1").unwrap());
+        assert_eq!(1, parse_unit_size("01").unwrap());
+        assert!(parse_unit_size("1.1").is_err());
+        assert!(parse_unit_size("0").is_err());
+        assert!(parse_unit_size("-1").is_err());
+        assert!(parse_unit_size("A").is_err());
+        assert!(parse_unit_size("18446744073709551616").is_err());
     }
 
-    #[test]
-    fn test_parse_unit_size_with_suffix() {
-        assert_eq!(1000, parse_unit_size("K").unwrap());
-        assert_eq!(1024, parse_unit_size("Ki").unwrap());
-        assert_eq!(2000, parse_unit_size("2K").unwrap());
-        assert_eq!(2048, parse_unit_size("2Ki").unwrap());
-        assert!(parse_unit_size("0K").is_err());
+    #[test]
+    fn test_parse_unit_size_with_suffix() {
+        assert_eq!(1000, parse_unit_size("K").unwrap());
+        assert_eq!(1024, parse_unit_size("Ki").unwrap());
+        assert_eq!(2000, parse_unit_size("2K").unwrap());
+        assert_eq!(2048, parse_unit_size("2Ki").unwrap());
+        assert!(parse_unit_size("0K").is_err());
     }
 
-    #[test]
-    fn test_parse_unit_size_suffix() {
-        assert_eq!(1, parse_unit_size_suffix("").unwrap());
-        assert_eq!(1000, parse_unit_size_suffix("K").unwrap());
-        assert_eq!(1024, parse_unit_size_suffix("Ki").unwrap());
-        assert_eq!(1000 * 1000, parse_unit_size_suffix("M").unwrap());
-        assert_eq!(1024 * 1024, parse_unit_size_suffix("Mi").unwrap());
-        assert!(parse_unit_size_suffix("Kii").is_none());
-        assert!(parse_unit_size_suffix("A").is_none());
+    #[test]
+    fn test_parse_unit_size_suffix() {
+        assert_eq!(1, parse_unit_size_suffix("").unwrap());
+        assert_eq!(1000, parse_unit_size_suffix("K").unwrap());
+        assert_eq!(1024, parse_unit_size_suffix("Ki").unwrap());
+        assert_eq!(1000 * 1000, parse_unit_size_suffix("M").unwrap());
+        assert_eq!(1024 * 1024, parse_unit_size_suffix("Mi").unwrap());
+        assert!(parse_unit_size_suffix("Kii").is_none());
+        assert!(parse_unit_size_suffix("A").is_none());
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_numfmt/options.rs.html b/dev/src/uu_numfmt/options.rs.html index b35db2291..f80e7549f 100644 --- a/dev/src/uu_numfmt/options.rs.html +++ b/dev/src/uu_numfmt/options.rs.html @@ -1,4 +1,4 @@ -options.rs - source
1
+options.rs - source
1
 2
 3
 4
@@ -353,282 +353,282 @@
 353
 354
 355
-
use std::str::FromStr;
+
use std::str::FromStr;
 
-use crate::units::Unit;
-use uucore::ranges::Range;
+use crate::units::Unit;
+use uucore::ranges::Range;
 
-pub const DELIMITER: &str = "delimiter";
-pub const FIELD: &str = "field";
-pub const FIELD_DEFAULT: &str = "1";
-pub const FORMAT: &str = "format";
-pub const FROM: &str = "from";
-pub const FROM_DEFAULT: &str = "none";
-pub const FROM_UNIT: &str = "from-unit";
-pub const FROM_UNIT_DEFAULT: &str = "1";
-pub const HEADER: &str = "header";
-pub const HEADER_DEFAULT: &str = "1";
-pub const NUMBER: &str = "NUMBER";
-pub const PADDING: &str = "padding";
-pub const ROUND: &str = "round";
-pub const SUFFIX: &str = "suffix";
-pub const TO: &str = "to";
-pub const TO_DEFAULT: &str = "none";
-pub const TO_UNIT: &str = "to-unit";
-pub const TO_UNIT_DEFAULT: &str = "1";
+pub const DELIMITER: &str = "delimiter";
+pub const FIELD: &str = "field";
+pub const FIELD_DEFAULT: &str = "1";
+pub const FORMAT: &str = "format";
+pub const FROM: &str = "from";
+pub const FROM_DEFAULT: &str = "none";
+pub const FROM_UNIT: &str = "from-unit";
+pub const FROM_UNIT_DEFAULT: &str = "1";
+pub const HEADER: &str = "header";
+pub const HEADER_DEFAULT: &str = "1";
+pub const NUMBER: &str = "NUMBER";
+pub const PADDING: &str = "padding";
+pub const ROUND: &str = "round";
+pub const SUFFIX: &str = "suffix";
+pub const TO: &str = "to";
+pub const TO_DEFAULT: &str = "none";
+pub const TO_UNIT: &str = "to-unit";
+pub const TO_UNIT_DEFAULT: &str = "1";
 
-pub struct TransformOptions {
-    pub from: Unit,
-    pub from_unit: usize,
-    pub to: Unit,
-    pub to_unit: usize,
+pub struct TransformOptions {
+    pub from: Unit,
+    pub from_unit: usize,
+    pub to: Unit,
+    pub to_unit: usize,
 }
 
-pub struct NumfmtOptions {
-    pub transform: TransformOptions,
-    pub padding: isize,
-    pub header: usize,
-    pub fields: Vec<Range>,
-    pub delimiter: Option<String>,
-    pub round: RoundMethod,
-    pub suffix: Option<String>,
-    pub format: FormatOptions,
+pub struct NumfmtOptions {
+    pub transform: TransformOptions,
+    pub padding: isize,
+    pub header: usize,
+    pub fields: Vec<Range>,
+    pub delimiter: Option<String>,
+    pub round: RoundMethod,
+    pub suffix: Option<String>,
+    pub format: FormatOptions,
 }
 
-#[derive(Clone, Copy)]
-pub enum RoundMethod {
-    Up,
-    Down,
-    FromZero,
-    TowardsZero,
-    Nearest,
+#[derive(Clone, Copy)]
+pub enum RoundMethod {
+    Up,
+    Down,
+    FromZero,
+    TowardsZero,
+    Nearest,
 }
 
-impl RoundMethod {
-    pub fn round(&self, f: f64) -> f64 {
-        match self {
-            Self::Up => f.ceil(),
-            Self::Down => f.floor(),
-            Self::FromZero => {
-                if f < 0.0 {
-                    f.floor()
-                } else {
-                    f.ceil()
+impl RoundMethod {
+    pub fn round(&self, f: f64) -> f64 {
+        match self {
+            Self::Up => f.ceil(),
+            Self::Down => f.floor(),
+            Self::FromZero => {
+                if f < 0.0 {
+                    f.floor()
+                } else {
+                    f.ceil()
                 }
             }
-            Self::TowardsZero => {
-                if f < 0.0 {
-                    f.ceil()
-                } else {
-                    f.floor()
+            Self::TowardsZero => {
+                if f < 0.0 {
+                    f.ceil()
+                } else {
+                    f.floor()
                 }
             }
-            Self::Nearest => f.round(),
+            Self::Nearest => f.round(),
         }
     }
 }
 
-// Represents the options extracted from the --format argument provided by the user.
-#[derive(Debug, PartialEq, Eq)]
-pub struct FormatOptions {
-    pub grouping: bool,
-    pub padding: Option<isize>,
-    pub precision: Option<usize>,
-    pub prefix: String,
-    pub suffix: String,
-    pub zero_padding: bool,
+// Represents the options extracted from the --format argument provided by the user.
+#[derive(Debug, PartialEq, Eq)]
+pub struct FormatOptions {
+    pub grouping: bool,
+    pub padding: Option<isize>,
+    pub precision: Option<usize>,
+    pub prefix: String,
+    pub suffix: String,
+    pub zero_padding: bool,
 }
 
-impl Default for FormatOptions {
-    fn default() -> Self {
-        Self {
-            grouping: false,
-            padding: None,
-            precision: None,
-            prefix: String::from(""),
-            suffix: String::from(""),
-            zero_padding: false,
+impl Default for FormatOptions {
+    fn default() -> Self {
+        Self {
+            grouping: false,
+            padding: None,
+            precision: None,
+            prefix: String::from(""),
+            suffix: String::from(""),
+            zero_padding: false,
         }
     }
 }
 
-impl FromStr for FormatOptions {
-    type Err = String;
+impl FromStr for FormatOptions {
+    type Err = String;
 
-    // The recognized format is: [PREFIX]%[0]['][-][N][.][N]f[SUFFIX]
-    //
-    // The format defines the printing of a floating point argument '%f'.
-    // An optional quote (%'f) enables --grouping.
-    // An optional width value (%10f) will pad the number.
-    // An optional zero (%010f) will zero pad the number.
-    // An optional negative value (%-10f) will left align.
-    // An optional precision (%.1f) determines the precision of the number.
-    fn from_str(s: &str) -> Result<Self, Self::Err> {
-        let mut iter = s.chars().peekable();
-        let mut options = Self::default();
+    // The recognized format is: [PREFIX]%[0]['][-][N][.][N]f[SUFFIX]
+    //
+    // The format defines the printing of a floating point argument '%f'.
+    // An optional quote (%'f) enables --grouping.
+    // An optional width value (%10f) will pad the number.
+    // An optional zero (%010f) will zero pad the number.
+    // An optional negative value (%-10f) will left align.
+    // An optional precision (%.1f) determines the precision of the number.
+    fn from_str(s: &str) -> Result<Self, Self::Err> {
+        let mut iter = s.chars().peekable();
+        let mut options = Self::default();
 
-        let mut padding = String::from("");
-        let mut precision = String::from("");
-        let mut double_percentage_counter = 0;
+        let mut padding = String::from("");
+        let mut precision = String::from("");
+        let mut double_percentage_counter = 0;
 
-        // '%' chars in the prefix, if any, must appear in blocks of even length, for example: "%%%%" and
-        // "%% %%" are ok, "%%% %" is not ok. A single '%' is treated as the beginning of the
-        // floating point argument.
-        while let Some(c) = iter.next() {
-            match c {
-                '%' if iter.peek() == Some(&'%') => {
-                    iter.next();
-                    double_percentage_counter += 1;
+        // '%' chars in the prefix, if any, must appear in blocks of even length, for example: "%%%%" and
+        // "%% %%" are ok, "%%% %" is not ok. A single '%' is treated as the beginning of the
+        // floating point argument.
+        while let Some(c) = iter.next() {
+            match c {
+                '%' if iter.peek() == Some(&'%') => {
+                    iter.next();
+                    double_percentage_counter += 1;
 
-                    for _ in 0..2 {
-                        options.prefix.push('%');
+                    for _ in 0..2 {
+                        options.prefix.push('%');
                     }
                 }
-                '%' => break,
-                _ => options.prefix.push(c),
+                '%' => break,
+                _ => options.prefix.push(c),
             }
         }
 
-        // GNU numfmt drops a char from the prefix for every '%%' in the prefix, so we do the same
-        for _ in 0..double_percentage_counter {
-            options.prefix.pop();
+        // GNU numfmt drops a char from the prefix for every '%%' in the prefix, so we do the same
+        for _ in 0..double_percentage_counter {
+            options.prefix.pop();
         }
 
-        if iter.peek().is_none() {
-            return if options.prefix == s {
-                Err(format!("format '{}' has no % directive", s))
-            } else {
-                Err(format!("format '{}' ends in %", s))
+        if iter.peek().is_none() {
+            return if options.prefix == s {
+                Err(format!("format '{}' has no % directive", s))
+            } else {
+                Err(format!("format '{}' ends in %", s))
             };
         }
 
-        // GNU numfmt allows to mix the characters " ", "'", and "0" in any way, so we do the same
-        while matches!(iter.peek(), Some(' ') | Some('\'') | Some('0')) {
-            match iter.next().unwrap() {
-                ' ' => (),
-                '\'' => options.grouping = true,
-                '0' => options.zero_padding = true,
-                _ => unreachable!(),
+        // GNU numfmt allows to mix the characters " ", "'", and "0" in any way, so we do the same
+        while matches!(iter.peek(), Some(' ') | Some('\'') | Some('0')) {
+            match iter.next().unwrap() {
+                ' ' => (),
+                '\'' => options.grouping = true,
+                '0' => options.zero_padding = true,
+                _ => unreachable!(),
             }
         }
 
-        if let Some('-') = iter.peek() {
-            iter.next();
+        if let Some('-') = iter.peek() {
+            iter.next();
 
-            match iter.peek() {
-                Some(c) if c.is_ascii_digit() => padding.push('-'),
-                _ => {
-                    return Err(format!(
+            match iter.peek() {
+                Some(c) if c.is_ascii_digit() => padding.push('-'),
+                _ => {
+                    return Err(format!(
                         "invalid format '{}', directive must be %[0]['][-][N][.][N]f",
-                        s
+                        s
                     ))
                 }
             }
         }
 
-        while let Some(c) = iter.peek() {
-            if c.is_ascii_digit() {
-                padding.push(*c);
-                iter.next();
-            } else {
+        while let Some(c) = iter.peek() {
+            if c.is_ascii_digit() {
+                padding.push(*c);
+                iter.next();
+            } else {
                 break;
             }
         }
 
-        if !padding.is_empty() {
-            if let Ok(p) = padding.parse() {
-                options.padding = Some(p);
-            } else {
-                return Err(format!("invalid format '{}' (width overflow)", s));
+        if !padding.is_empty() {
+            if let Ok(p) = padding.parse() {
+                options.padding = Some(p);
+            } else {
+                return Err(format!("invalid format '{}' (width overflow)", s));
             }
         }
 
-        if let Some('.') = iter.peek() {
-            iter.next();
+        if let Some('.') = iter.peek() {
+            iter.next();
 
-            if matches!(iter.peek(), Some(' ') | Some('+') | Some('-')) {
-                return Err(format!("invalid precision in format '{}'", s));
+            if matches!(iter.peek(), Some(' ') | Some('+') | Some('-')) {
+                return Err(format!("invalid precision in format '{}'", s));
             }
 
-            while let Some(c) = iter.peek() {
-                if c.is_ascii_digit() {
-                    precision.push(*c);
-                    iter.next();
-                } else {
+            while let Some(c) = iter.peek() {
+                if c.is_ascii_digit() {
+                    precision.push(*c);
+                    iter.next();
+                } else {
                     break;
                 }
             }
 
-            if !precision.is_empty() {
-                if let Ok(p) = precision.parse() {
-                    options.precision = Some(p);
-                } else {
-                    return Err(format!("invalid precision in format '{}'", s));
+            if !precision.is_empty() {
+                if let Ok(p) = precision.parse() {
+                    options.precision = Some(p);
+                } else {
+                    return Err(format!("invalid precision in format '{}'", s));
                 }
-            } else {
-                options.precision = Some(0);
+            } else {
+                options.precision = Some(0);
             }
         }
 
-        if let Some('f') = iter.peek() {
-            iter.next();
-        } else {
-            return Err(format!(
+        if let Some('f') = iter.peek() {
+            iter.next();
+        } else {
+            return Err(format!(
                 "invalid format '{}', directive must be %[0]['][-][N][.][N]f",
-                s
+                s
             ));
         }
 
-        // '%' chars in the suffix, if any, must appear in blocks of even length, otherwise
-        // it is an error. For example: "%%%%" and "%% %%" are ok, "%%% %" is not ok.
-        while let Some(c) = iter.next() {
-            if c != '%' {
-                options.suffix.push(c);
-            } else if iter.peek() == Some(&'%') {
-                for _ in 0..2 {
-                    options.suffix.push('%');
+        // '%' chars in the suffix, if any, must appear in blocks of even length, otherwise
+        // it is an error. For example: "%%%%" and "%% %%" are ok, "%%% %" is not ok.
+        while let Some(c) = iter.next() {
+            if c != '%' {
+                options.suffix.push(c);
+            } else if iter.peek() == Some(&'%') {
+                for _ in 0..2 {
+                    options.suffix.push('%');
                 }
-                iter.next();
-            } else {
-                return Err(format!("format '{}' has too many % directives", s));
+                iter.next();
+            } else {
+                return Err(format!("format '{}' has too many % directives", s));
             }
         }
 
-        Ok(options)
+        Ok(options)
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
+#[cfg(test)]
+mod tests {
+    use super::*;
 
-    #[test]
-    fn test_parse_format() {
-        assert_eq!(FormatOptions::default(), "%f".parse().unwrap());
-        assert_eq!(FormatOptions::default(), "%  f".parse().unwrap());
+    #[test]
+    fn test_parse_format() {
+        assert_eq!(FormatOptions::default(), "%f".parse().unwrap());
+        assert_eq!(FormatOptions::default(), "%  f".parse().unwrap());
     }
 
-    #[test]
-    fn test_parse_format_with_invalid_formats() {
-        assert!("".parse::<FormatOptions>().is_err());
-        assert!("hello".parse::<FormatOptions>().is_err());
-        assert!("hello%".parse::<FormatOptions>().is_err());
-        assert!("%-f".parse::<FormatOptions>().is_err());
-        assert!("%d".parse::<FormatOptions>().is_err());
-        assert!("%4 f".parse::<FormatOptions>().is_err());
-        assert!("%f%".parse::<FormatOptions>().is_err());
-        assert!("%f%%%".parse::<FormatOptions>().is_err());
-        assert!("%%f".parse::<FormatOptions>().is_err());
-        assert!("%%%%f".parse::<FormatOptions>().is_err());
-        assert!("%.-1f".parse::<FormatOptions>().is_err());
-        assert!("%. 1f".parse::<FormatOptions>().is_err());
-        assert!("%18446744073709551616f".parse::<FormatOptions>().is_err());
-        assert!("%.18446744073709551616f".parse::<FormatOptions>().is_err());
+    #[test]
+    fn test_parse_format_with_invalid_formats() {
+        assert!("".parse::<FormatOptions>().is_err());
+        assert!("hello".parse::<FormatOptions>().is_err());
+        assert!("hello%".parse::<FormatOptions>().is_err());
+        assert!("%-f".parse::<FormatOptions>().is_err());
+        assert!("%d".parse::<FormatOptions>().is_err());
+        assert!("%4 f".parse::<FormatOptions>().is_err());
+        assert!("%f%".parse::<FormatOptions>().is_err());
+        assert!("%f%%%".parse::<FormatOptions>().is_err());
+        assert!("%%f".parse::<FormatOptions>().is_err());
+        assert!("%%%%f".parse::<FormatOptions>().is_err());
+        assert!("%.-1f".parse::<FormatOptions>().is_err());
+        assert!("%. 1f".parse::<FormatOptions>().is_err());
+        assert!("%18446744073709551616f".parse::<FormatOptions>().is_err());
+        assert!("%.18446744073709551616f".parse::<FormatOptions>().is_err());
     }
 
-    #[test]
-    fn test_parse_format_with_prefix_and_suffix() {
-        let formats = vec![
+    #[test]
+    fn test_parse_format_with_prefix_and_suffix() {
+        let formats = vec![
             ("--%f", "--", ""),
             ("%f::", "", "::"),
             ("--%f::", "--", "::"),
@@ -637,76 +637,76 @@
             ("%% %f", "%%", ""),
         ];
 
-        for (format, expected_prefix, expected_suffix) in formats {
-            let options: FormatOptions = format.parse().unwrap();
-            assert_eq!(expected_prefix, options.prefix);
-            assert_eq!(expected_suffix, options.suffix);
+        for (format, expected_prefix, expected_suffix) in formats {
+            let options: FormatOptions = format.parse().unwrap();
+            assert_eq!(expected_prefix, options.prefix);
+            assert_eq!(expected_suffix, options.suffix);
         }
     }
 
-    #[test]
-    fn test_parse_format_with_padding() {
-        let mut expected_options = FormatOptions::default();
-        let formats = vec![("%12f", Some(12)), ("%-12f", Some(-12))];
+    #[test]
+    fn test_parse_format_with_padding() {
+        let mut expected_options = FormatOptions::default();
+        let formats = vec![("%12f", Some(12)), ("%-12f", Some(-12))];
 
-        for (format, expected_padding) in formats {
-            expected_options.padding = expected_padding;
-            assert_eq!(expected_options, format.parse().unwrap());
+        for (format, expected_padding) in formats {
+            expected_options.padding = expected_padding;
+            assert_eq!(expected_options, format.parse().unwrap());
         }
     }
 
-    #[test]
-    fn test_parse_format_with_precision() {
-        let mut expected_options = FormatOptions::default();
-        let formats = vec![
+    #[test]
+    fn test_parse_format_with_precision() {
+        let mut expected_options = FormatOptions::default();
+        let formats = vec![
             ("%6.2f", Some(6), Some(2)),
             ("%6.f", Some(6), Some(0)),
             ("%.2f", None, Some(2)),
             ("%.f", None, Some(0)),
         ];
 
-        for (format, expected_padding, expected_precision) in formats {
-            expected_options.padding = expected_padding;
-            expected_options.precision = expected_precision;
-            assert_eq!(expected_options, format.parse().unwrap());
+        for (format, expected_padding, expected_precision) in formats {
+            expected_options.padding = expected_padding;
+            expected_options.precision = expected_precision;
+            assert_eq!(expected_options, format.parse().unwrap());
         }
     }
 
-    #[test]
-    fn test_parse_format_with_grouping() {
-        let expected_options = FormatOptions {
-            grouping: true,
-            ..Default::default()
+    #[test]
+    fn test_parse_format_with_grouping() {
+        let expected_options = FormatOptions {
+            grouping: true,
+            ..Default::default()
         };
-        assert_eq!(expected_options, "%'f".parse().unwrap());
-        assert_eq!(expected_options, "% ' f".parse().unwrap());
-        assert_eq!(expected_options, "%'''''''f".parse().unwrap());
+        assert_eq!(expected_options, "%'f".parse().unwrap());
+        assert_eq!(expected_options, "% ' f".parse().unwrap());
+        assert_eq!(expected_options, "%'''''''f".parse().unwrap());
     }
 
-    #[test]
-    fn test_parse_format_with_zero_padding() {
-        let expected_options = FormatOptions {
-            padding: Some(10),
-            zero_padding: true,
-            ..Default::default()
+    #[test]
+    fn test_parse_format_with_zero_padding() {
+        let expected_options = FormatOptions {
+            padding: Some(10),
+            zero_padding: true,
+            ..Default::default()
         };
-        assert_eq!(expected_options, "%010f".parse().unwrap());
-        assert_eq!(expected_options, "% 0 10f".parse().unwrap());
-        assert_eq!(expected_options, "%0000000010f".parse().unwrap());
+        assert_eq!(expected_options, "%010f".parse().unwrap());
+        assert_eq!(expected_options, "% 0 10f".parse().unwrap());
+        assert_eq!(expected_options, "%0000000010f".parse().unwrap());
     }
 
-    #[test]
-    fn test_parse_format_with_grouping_and_zero_padding() {
-        let expected_options = FormatOptions {
-            grouping: true,
-            zero_padding: true,
-            ..Default::default()
+    #[test]
+    fn test_parse_format_with_grouping_and_zero_padding() {
+        let expected_options = FormatOptions {
+            grouping: true,
+            zero_padding: true,
+            ..Default::default()
         };
-        assert_eq!(expected_options, "%0'f".parse().unwrap());
-        assert_eq!(expected_options, "%'0f".parse().unwrap());
-        assert_eq!(expected_options, "%0'0'0'f".parse().unwrap());
-        assert_eq!(expected_options, "%'0'0'0f".parse().unwrap());
+        assert_eq!(expected_options, "%0'f".parse().unwrap());
+        assert_eq!(expected_options, "%'0f".parse().unwrap());
+        assert_eq!(expected_options, "%0'0'0'f".parse().unwrap());
+        assert_eq!(expected_options, "%'0'0'0f".parse().unwrap());
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_numfmt/units.rs.html b/dev/src/uu_numfmt/units.rs.html index 7c4ffd9c0..351c94e47 100644 --- a/dev/src/uu_numfmt/units.rs.html +++ b/dev/src/uu_numfmt/units.rs.html @@ -1,4 +1,4 @@ -units.rs - source
1
+units.rs - source
1
 2
 3
 4
@@ -62,11 +62,11 @@
 62
 63
 64
-
use std::fmt;
+
use std::fmt;
 
-pub const SI_BASES: [f64; 10] = [1., 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24, 1e27];
+pub const SI_BASES: [f64; 10] = [1., 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24, 1e27];
 
-pub const IEC_BASES: [f64; 10] = [
+pub const IEC_BASES: [f64; 10] = [
     1.,
     1_024.,
     1_048_576.,
@@ -79,52 +79,52 @@
     1_237_940_039_285_380_274_899_124_224.,
 ];
 
-pub type WithI = bool;
+pub type WithI = bool;
 
-#[derive(Clone, Copy, PartialEq, Eq)]
-pub enum Unit {
-    Auto,
-    Si,
-    Iec(WithI),
+#[derive(Clone, Copy, PartialEq, Eq)]
+pub enum Unit {
+    Auto,
+    Si,
+    Iec(WithI),
     None,
 }
 
-pub type Result<T> = std::result::Result<T, String>;
+pub type Result<T> = std::result::Result<T, String>;
 
-#[derive(Clone, Copy, Debug)]
-pub enum RawSuffix {
-    K,
-    M,
-    G,
-    T,
-    P,
-    E,
-    Z,
-    Y,
+#[derive(Clone, Copy, Debug)]
+pub enum RawSuffix {
+    K,
+    M,
+    G,
+    T,
+    P,
+    E,
+    Z,
+    Y,
 }
 
-pub type Suffix = (RawSuffix, WithI);
+pub type Suffix = (RawSuffix, WithI);
 
-pub struct DisplayableSuffix(pub Suffix);
+pub struct DisplayableSuffix(pub Suffix);
 
-impl fmt::Display for DisplayableSuffix {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        let Self((ref raw_suffix, ref with_i)) = *self;
-        match raw_suffix {
-            RawSuffix::K => write!(f, "K"),
-            RawSuffix::M => write!(f, "M"),
-            RawSuffix::G => write!(f, "G"),
-            RawSuffix::T => write!(f, "T"),
-            RawSuffix::P => write!(f, "P"),
-            RawSuffix::E => write!(f, "E"),
-            RawSuffix::Z => write!(f, "Z"),
-            RawSuffix::Y => write!(f, "Y"),
+impl fmt::Display for DisplayableSuffix {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let Self((ref raw_suffix, ref with_i)) = *self;
+        match raw_suffix {
+            RawSuffix::K => write!(f, "K"),
+            RawSuffix::M => write!(f, "M"),
+            RawSuffix::G => write!(f, "G"),
+            RawSuffix::T => write!(f, "T"),
+            RawSuffix::P => write!(f, "P"),
+            RawSuffix::E => write!(f, "E"),
+            RawSuffix::Z => write!(f, "Z"),
+            RawSuffix::Y => write!(f, "Y"),
         }
-        .and_then(|()| match with_i {
-            true => write!(f, "i"),
-            false => Ok(()),
+        .and_then(|()| match with_i {
+            true => write!(f, "i"),
+            false => Ok(()),
         })
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/byteorder_io.rs.html b/dev/src/uu_od/byteorder_io.rs.html index 23631a24d..33cbdd5ff 100644 --- a/dev/src/uu_od/byteorder_io.rs.html +++ b/dev/src/uu_od/byteorder_io.rs.html @@ -1,4 +1,4 @@ -byteorder_io.rs - source
1
+byteorder_io.rs - source
1
 2
 3
 4
@@ -50,57 +50,57 @@
 50
 51
 52
-
// spell-checker:ignore (ToDO) byteorder
+
// spell-checker:ignore (ToDO) byteorder
 
-// workaround until https://github.com/BurntSushi/byteorder/issues/41 has been fixed
-// based on: https://github.com/netvl/immeta/blob/4460ee/src/utils.rs#L76
+// workaround until https://github.com/BurntSushi/byteorder/issues/41 has been fixed
+// based on: https://github.com/netvl/immeta/blob/4460ee/src/utils.rs#L76
 
-use byteorder::ByteOrder as ByteOrderTrait;
-use byteorder::{BigEndian, LittleEndian, NativeEndian};
+use byteorder::ByteOrder as ByteOrderTrait;
+use byteorder::{BigEndian, LittleEndian, NativeEndian};
 
-#[derive(Copy, Clone, Debug, Eq, PartialEq)]
-pub enum ByteOrder {
-    Little,
-    Big,
-    Native,
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub enum ByteOrder {
+    Little,
+    Big,
+    Native,
 }
 
-macro_rules! gen_byte_order_ops {
-    ($($read_name:ident, $write_name:ident -> $tpe:ty),+) => {
-        impl ByteOrder {
+macro_rules! gen_byte_order_ops {
+    ($($read_name:ident, $write_name:ident -> $tpe:ty),+) => {
+        impl ByteOrder {
             $(
-            #[allow(dead_code)]
-            #[inline]
-            pub fn $read_name(self, source: &[u8]) -> $tpe {
-                match self {
-                    ByteOrder::Little => LittleEndian::$read_name(source),
-                    ByteOrder::Big => BigEndian::$read_name(source),
-                    ByteOrder::Native => NativeEndian::$read_name(source),
+            #[allow(dead_code)]
+            #[inline]
+            pub fn $read_name(self, source: &[u8]) -> $tpe {
+                match self {
+                    ByteOrder::Little => LittleEndian::$read_name(source),
+                    ByteOrder::Big => BigEndian::$read_name(source),
+                    ByteOrder::Native => NativeEndian::$read_name(source),
                 }
             }
 
-            #[allow(dead_code)]
-            pub fn $write_name(self, target: &mut [u8], n: $tpe) {
-                match self {
-                    ByteOrder::Little => LittleEndian::$write_name(target, n),
-                    ByteOrder::Big => BigEndian::$write_name(target, n),
-                    ByteOrder::Native => NativeEndian::$write_name(target, n),
+            #[allow(dead_code)]
+            pub fn $write_name(self, target: &mut [u8], n: $tpe) {
+                match self {
+                    ByteOrder::Little => LittleEndian::$write_name(target, n),
+                    ByteOrder::Big => BigEndian::$write_name(target, n),
+                    ByteOrder::Native => NativeEndian::$write_name(target, n),
                 }
             }
-            )+
+            )+
         }
     }
 }
 
-gen_byte_order_ops! {
-    read_u16, write_u16 -> u16,
-    read_u32, write_u32 -> u32,
-    read_u64, write_u64 -> u64,
-    read_i16, write_i16 -> i16,
-    read_i32, write_i32 -> i32,
-    read_i64, write_i64 -> i64,
-    read_f32, write_f32 -> f32,
-    read_f64, write_f64 -> f64
+gen_byte_order_ops! {
+    read_u16, write_u16 -> u16,
+    read_u32, write_u32 -> u32,
+    read_u64, write_u64 -> u64,
+    read_i16, write_i16 -> i16,
+    read_i32, write_i32 -> i32,
+    read_i64, write_i64 -> i64,
+    read_f32, write_f32 -> f32,
+    read_f64, write_f64 -> f64
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/formatteriteminfo.rs.html b/dev/src/uu_od/formatteriteminfo.rs.html index e4dc01c3b..85a5b2736 100644 --- a/dev/src/uu_od/formatteriteminfo.rs.html +++ b/dev/src/uu_od/formatteriteminfo.rs.html @@ -1,4 +1,4 @@ -formatteriteminfo.rs - source
1
+formatteriteminfo.rs - source
1
 2
 3
 4
@@ -57,64 +57,64 @@
 57
 58
 59
-
// spell-checker:ignore (ToDO) formatteriteminfo
+
// spell-checker:ignore (ToDO) formatteriteminfo
 
-use std::fmt;
+use std::fmt;
 
-#[allow(clippy::enum_variant_names)]
-#[derive(Copy)]
-pub enum FormatWriter {
-    IntWriter(fn(u64) -> String),
-    FloatWriter(fn(f64) -> String),
-    MultibyteWriter(fn(&[u8]) -> String),
+#[allow(clippy::enum_variant_names)]
+#[derive(Copy)]
+pub enum FormatWriter {
+    IntWriter(fn(u64) -> String),
+    FloatWriter(fn(f64) -> String),
+    MultibyteWriter(fn(&[u8]) -> String),
 }
 
-impl Clone for FormatWriter {
-    #[inline]
-    fn clone(&self) -> Self {
-        *self
-    }
+impl Clone for FormatWriter {
+    #[inline]
+    fn clone(&self) -> Self {
+        *self
+    }
 }
 
-impl PartialEq for FormatWriter {
-    fn eq(&self, other: &Self) -> bool {
-        use crate::formatteriteminfo::FormatWriter::*;
+impl PartialEq for FormatWriter {
+    fn eq(&self, other: &Self) -> bool {
+        use crate::formatteriteminfo::FormatWriter::*;
 
-        match (self, other) {
-            (&IntWriter(ref a), &IntWriter(ref b)) => a == b,
-            (&FloatWriter(ref a), &FloatWriter(ref b)) => a == b,
-            (&MultibyteWriter(ref a), &MultibyteWriter(ref b)) => *a as usize == *b as usize,
-            _ => false,
+        match (self, other) {
+            (&IntWriter(ref a), &IntWriter(ref b)) => a == b,
+            (&FloatWriter(ref a), &FloatWriter(ref b)) => a == b,
+            (&MultibyteWriter(ref a), &MultibyteWriter(ref b)) => *a as usize == *b as usize,
+            _ => false,
         }
     }
 }
 
-impl Eq for FormatWriter {}
+impl Eq for FormatWriter {}
 
-impl fmt::Debug for FormatWriter {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match *self {
-            Self::IntWriter(ref p) => {
-                f.write_str("IntWriter:")?;
-                fmt::Pointer::fmt(p, f)
+impl fmt::Debug for FormatWriter {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            Self::IntWriter(ref p) => {
+                f.write_str("IntWriter:")?;
+                fmt::Pointer::fmt(p, f)
             }
-            Self::FloatWriter(ref p) => {
-                f.write_str("FloatWriter:")?;
-                fmt::Pointer::fmt(p, f)
+            Self::FloatWriter(ref p) => {
+                f.write_str("FloatWriter:")?;
+                fmt::Pointer::fmt(p, f)
             }
-            Self::MultibyteWriter(ref p) => {
-                f.write_str("MultibyteWriter:")?;
-                fmt::Pointer::fmt(&(*p as *const ()), f)
+            Self::MultibyteWriter(ref p) => {
+                f.write_str("MultibyteWriter:")?;
+                fmt::Pointer::fmt(&(*p as *const ()), f)
             }
         }
     }
 }
 
-#[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub struct FormatterItemInfo {
-    pub byte_size: usize,
-    pub print_width: usize, // including a space in front of the text
-    pub formatter: FormatWriter,
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+pub struct FormatterItemInfo {
+    pub byte_size: usize,
+    pub print_width: usize, // including a space in front of the text
+    pub formatter: FormatWriter,
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/inputdecoder.rs.html b/dev/src/uu_od/inputdecoder.rs.html index 4016b7925..866457595 100644 --- a/dev/src/uu_od/inputdecoder.rs.html +++ b/dev/src/uu_od/inputdecoder.rs.html @@ -1,4 +1,4 @@ -inputdecoder.rs - source
1
+inputdecoder.rs - source
1
 2
 3
 4
@@ -194,201 +194,201 @@
 194
 195
 196
-
use half::f16;
-use std::io;
+
use half::f16;
+use std::io;
 
-use crate::byteorder_io::ByteOrder;
-use crate::multifilereader::HasError;
-use crate::peekreader::PeekRead;
+use crate::byteorder_io::ByteOrder;
+use crate::multifilereader::HasError;
+use crate::peekreader::PeekRead;
 
-/// Processes an input and provides access to the data read in various formats
-///
-/// Currently only useful if the input implements `PeekRead`.
-pub struct InputDecoder<'a, I>
-where
-    I: 'a,
+/// Processes an input and provides access to the data read in various formats
+///
+/// Currently only useful if the input implements `PeekRead`.
+pub struct InputDecoder<'a, I>
+where
+    I: 'a,
 {
-    /// The input from which data is read
-    input: &'a mut I,
+    /// The input from which data is read
+    input: &'a mut I,
 
-    /// A memory buffer, it's size is set in `new`.
-    data: Vec<u8>,
-    /// The number of bytes in the buffer reserved for the peek data from `PeekRead`.
-    reserved_peek_length: usize,
+    /// A memory buffer, it's size is set in `new`.
+    data: Vec<u8>,
+    /// The number of bytes in the buffer reserved for the peek data from `PeekRead`.
+    reserved_peek_length: usize,
 
-    /// The number of (valid) bytes in the buffer.
-    used_normal_length: usize,
-    /// The number of peek bytes in the buffer.
-    used_peek_length: usize,
+    /// The number of (valid) bytes in the buffer.
+    used_normal_length: usize,
+    /// The number of peek bytes in the buffer.
+    used_peek_length: usize,
 
-    /// Byte order used to read data from the buffer.
-    byte_order: ByteOrder,
+    /// Byte order used to read data from the buffer.
+    byte_order: ByteOrder,
 }
 
-impl<'a, I> InputDecoder<'a, I> {
-    /// Creates a new `InputDecoder` with an allocated buffer of `normal_length` + `peek_length` bytes.
-    /// `byte_order` determines how to read multibyte formats from the buffer.
-    pub fn new(
-        input: &mut I,
-        normal_length: usize,
-        peek_length: usize,
-        byte_order: ByteOrder,
-    ) -> InputDecoder<I> {
-        let bytes = vec![0; normal_length + peek_length];
+impl<'a, I> InputDecoder<'a, I> {
+    /// Creates a new `InputDecoder` with an allocated buffer of `normal_length` + `peek_length` bytes.
+    /// `byte_order` determines how to read multibyte formats from the buffer.
+    pub fn new(
+        input: &mut I,
+        normal_length: usize,
+        peek_length: usize,
+        byte_order: ByteOrder,
+    ) -> InputDecoder<I> {
+        let bytes = vec![0; normal_length + peek_length];
 
-        InputDecoder {
-            input,
-            data: bytes,
-            reserved_peek_length: peek_length,
-            used_normal_length: 0,
-            used_peek_length: 0,
-            byte_order,
+        InputDecoder {
+            input,
+            data: bytes,
+            reserved_peek_length: peek_length,
+            used_normal_length: 0,
+            used_peek_length: 0,
+            byte_order,
         }
     }
 }
 
-impl<'a, I> InputDecoder<'a, I>
-where
-    I: PeekRead,
+impl<'a, I> InputDecoder<'a, I>
+where
+    I: PeekRead,
 {
-    /// calls `peek_read` on the internal stream to (re)fill the buffer. Returns a
-    /// MemoryDecoder providing access to the result or returns an i/o error.
-    pub fn peek_read(&mut self) -> io::Result<MemoryDecoder> {
-        match self
-            .input
-            .peek_read(self.data.as_mut_slice(), self.reserved_peek_length)
+    /// calls `peek_read` on the internal stream to (re)fill the buffer. Returns a
+    /// MemoryDecoder providing access to the result or returns an i/o error.
+    pub fn peek_read(&mut self) -> io::Result<MemoryDecoder> {
+        match self
+            .input
+            .peek_read(self.data.as_mut_slice(), self.reserved_peek_length)
         {
-            Ok((n, p)) => {
-                self.used_normal_length = n;
-                self.used_peek_length = p;
-                Ok(MemoryDecoder {
-                    data: &mut self.data,
-                    used_normal_length: self.used_normal_length,
-                    used_peek_length: self.used_peek_length,
-                    byte_order: self.byte_order,
+            Ok((n, p)) => {
+                self.used_normal_length = n;
+                self.used_peek_length = p;
+                Ok(MemoryDecoder {
+                    data: &mut self.data,
+                    used_normal_length: self.used_normal_length,
+                    used_peek_length: self.used_peek_length,
+                    byte_order: self.byte_order,
                 })
             }
-            Err(e) => Err(e),
+            Err(e) => Err(e),
         }
     }
 }
 
-impl<'a, I> HasError for InputDecoder<'a, I>
-where
-    I: HasError,
+impl<'a, I> HasError for InputDecoder<'a, I>
+where
+    I: HasError,
 {
-    /// calls has_error on the internal stream.
-    fn has_error(&self) -> bool {
-        self.input.has_error()
+    /// calls has_error on the internal stream.
+    fn has_error(&self) -> bool {
+        self.input.has_error()
     }
 }
 
-/// Provides access to the internal data in various formats
-pub struct MemoryDecoder<'a> {
-    /// A reference to the parents' data
-    data: &'a mut Vec<u8>,
-    /// The number of (valid) bytes in the buffer.
-    used_normal_length: usize,
-    /// The number of peek bytes in the buffer.
-    used_peek_length: usize,
-    /// Byte order used to read data from the buffer.
-    byte_order: ByteOrder,
+/// Provides access to the internal data in various formats
+pub struct MemoryDecoder<'a> {
+    /// A reference to the parents' data
+    data: &'a mut Vec<u8>,
+    /// The number of (valid) bytes in the buffer.
+    used_normal_length: usize,
+    /// The number of peek bytes in the buffer.
+    used_peek_length: usize,
+    /// Byte order used to read data from the buffer.
+    byte_order: ByteOrder,
 }
 
-impl<'a> MemoryDecoder<'a> {
-    /// Set a part of the internal buffer to zero.
-    /// access to the whole buffer is possible, not just to the valid data.
-    pub fn zero_out_buffer(&mut self, start: usize, end: usize) {
-        for i in start..end {
-            self.data[i] = 0;
+impl<'a> MemoryDecoder<'a> {
+    /// Set a part of the internal buffer to zero.
+    /// access to the whole buffer is possible, not just to the valid data.
+    pub fn zero_out_buffer(&mut self, start: usize, end: usize) {
+        for i in start..end {
+            self.data[i] = 0;
         }
     }
 
-    /// Returns the current length of the buffer. (ie. how much valid data it contains.)
-    pub fn length(&self) -> usize {
-        self.used_normal_length
+    /// Returns the current length of the buffer. (ie. how much valid data it contains.)
+    pub fn length(&self) -> usize {
+        self.used_normal_length
     }
 
-    /// Creates a clone of the internal buffer. The clone only contain the valid data.
-    pub fn clone_buffer(&self, other: &mut Vec<u8>) {
-        other.clone_from(self.data);
-        other.resize(self.used_normal_length, 0);
+    /// Creates a clone of the internal buffer. The clone only contain the valid data.
+    pub fn clone_buffer(&self, other: &mut Vec<u8>) {
+        other.clone_from(self.data);
+        other.resize(self.used_normal_length, 0);
     }
 
-    /// Returns a slice to the internal buffer starting at `start`.
-    pub fn get_buffer(&self, start: usize) -> &[u8] {
-        &self.data[start..self.used_normal_length]
+    /// Returns a slice to the internal buffer starting at `start`.
+    pub fn get_buffer(&self, start: usize) -> &[u8] {
+        &self.data[start..self.used_normal_length]
     }
 
-    /// Returns a slice to the internal buffer including the peek data starting at `start`.
-    pub fn get_full_buffer(&self, start: usize) -> &[u8] {
-        &self.data[start..self.used_normal_length + self.used_peek_length]
+    /// Returns a slice to the internal buffer including the peek data starting at `start`.
+    pub fn get_full_buffer(&self, start: usize) -> &[u8] {
+        &self.data[start..self.used_normal_length + self.used_peek_length]
     }
 
-    /// Returns a u8/u16/u32/u64 from the internal buffer at position `start`.
-    pub fn read_uint(&self, start: usize, byte_size: usize) -> u64 {
-        match byte_size {
-            1 => u64::from(self.data[start]),
-            2 => u64::from(self.byte_order.read_u16(&self.data[start..start + 2])),
-            4 => u64::from(self.byte_order.read_u32(&self.data[start..start + 4])),
-            8 => self.byte_order.read_u64(&self.data[start..start + 8]),
-            _ => panic!("Invalid byte_size: {}", byte_size),
+    /// Returns a u8/u16/u32/u64 from the internal buffer at position `start`.
+    pub fn read_uint(&self, start: usize, byte_size: usize) -> u64 {
+        match byte_size {
+            1 => u64::from(self.data[start]),
+            2 => u64::from(self.byte_order.read_u16(&self.data[start..start + 2])),
+            4 => u64::from(self.byte_order.read_u32(&self.data[start..start + 4])),
+            8 => self.byte_order.read_u64(&self.data[start..start + 8]),
+            _ => panic!("Invalid byte_size: {}", byte_size),
         }
     }
 
-    /// Returns a f32/f64 from the internal buffer at position `start`.
-    pub fn read_float(&self, start: usize, byte_size: usize) -> f64 {
-        match byte_size {
-            2 => f64::from(f16::from_bits(
-                self.byte_order.read_u16(&self.data[start..start + 2]),
+    /// Returns a f32/f64 from the internal buffer at position `start`.
+    pub fn read_float(&self, start: usize, byte_size: usize) -> f64 {
+        match byte_size {
+            2 => f64::from(f16::from_bits(
+                self.byte_order.read_u16(&self.data[start..start + 2]),
             )),
-            4 => f64::from(self.byte_order.read_f32(&self.data[start..start + 4])),
-            8 => self.byte_order.read_f64(&self.data[start..start + 8]),
-            _ => panic!("Invalid byte_size: {}", byte_size),
+            4 => f64::from(self.byte_order.read_f32(&self.data[start..start + 4])),
+            8 => self.byte_order.read_f64(&self.data[start..start + 8]),
+            _ => panic!("Invalid byte_size: {}", byte_size),
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use crate::byteorder_io::ByteOrder;
-    use crate::peekreader::PeekReader;
-    use std::io::Cursor;
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::byteorder_io::ByteOrder;
+    use crate::peekreader::PeekReader;
+    use std::io::Cursor;
 
-    #[test]
-    #[allow(clippy::float_cmp)]
-    fn smoke_test() {
-        let data = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xff, 0xff];
-        let mut input = PeekReader::new(Cursor::new(&data));
-        let mut sut = InputDecoder::new(&mut input, 8, 2, ByteOrder::Little);
+    #[test]
+    #[allow(clippy::float_cmp)]
+    fn smoke_test() {
+        let data = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xff, 0xff];
+        let mut input = PeekReader::new(Cursor::new(&data));
+        let mut sut = InputDecoder::new(&mut input, 8, 2, ByteOrder::Little);
 
-        // Peek normal length
-        let mut mem = sut.peek_read().unwrap();
+        // Peek normal length
+        let mut mem = sut.peek_read().unwrap();
 
-        assert_eq!(8, mem.length());
+        assert_eq!(8, mem.length());
 
-        assert_eq!(-2.0, mem.read_float(0, 8));
-        assert_eq!(-2.0, mem.read_float(4, 4));
-        assert_eq!(0xc000000000000000, mem.read_uint(0, 8));
-        assert_eq!(0xc0000000, mem.read_uint(4, 4));
-        assert_eq!(0xc000, mem.read_uint(6, 2));
-        assert_eq!(0xc0, mem.read_uint(7, 1));
-        assert_eq!(&[0, 0xc0], mem.get_buffer(6));
-        assert_eq!(&[0, 0xc0, 0xff, 0xff], mem.get_full_buffer(6));
+        assert_eq!(-2.0, mem.read_float(0, 8));
+        assert_eq!(-2.0, mem.read_float(4, 4));
+        assert_eq!(0xc000000000000000, mem.read_uint(0, 8));
+        assert_eq!(0xc0000000, mem.read_uint(4, 4));
+        assert_eq!(0xc000, mem.read_uint(6, 2));
+        assert_eq!(0xc0, mem.read_uint(7, 1));
+        assert_eq!(&[0, 0xc0], mem.get_buffer(6));
+        assert_eq!(&[0, 0xc0, 0xff, 0xff], mem.get_full_buffer(6));
 
-        let mut copy: Vec<u8> = Vec::new();
-        mem.clone_buffer(&mut copy);
-        assert_eq!(vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0], copy);
+        let mut copy: Vec<u8> = Vec::new();
+        mem.clone_buffer(&mut copy);
+        assert_eq!(vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0], copy);
 
-        mem.zero_out_buffer(7, 8);
-        assert_eq!(&[0, 0, 0xff, 0xff], mem.get_full_buffer(6));
+        mem.zero_out_buffer(7, 8);
+        assert_eq!(&[0, 0, 0xff, 0xff], mem.get_full_buffer(6));
 
-        // Peek tail
-        let mem = sut.peek_read().unwrap();
-        assert_eq!(2, mem.length());
-        assert_eq!(0xffff, mem.read_uint(0, 2));
+        // Peek tail
+        let mem = sut.peek_read().unwrap();
+        assert_eq!(2, mem.length());
+        assert_eq!(0xffff, mem.read_uint(0, 2));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/inputoffset.rs.html b/dev/src/uu_od/inputoffset.rs.html index 7da0c3295..4784f3090 100644 --- a/dev/src/uu_od/inputoffset.rs.html +++ b/dev/src/uu_od/inputoffset.rs.html @@ -1,4 +1,4 @@ -inputoffset.rs - source
1
+inputoffset.rs - source
1
 2
 3
 4
@@ -112,119 +112,119 @@
 112
 113
 114
-
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
-pub enum Radix {
-    Decimal,
-    Hexadecimal,
-    Octal,
-    NoPrefix,
+
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub enum Radix {
+    Decimal,
+    Hexadecimal,
+    Octal,
+    NoPrefix,
 }
 
-/// provides the byte offset printed at the left margin
-pub struct InputOffset {
-    /// The radix to print the byte offset. NoPrefix will not print a byte offset.
-    radix: Radix,
-    /// The current position. Initialize at `new`, increase using `increase_position`.
-    byte_pos: u64,
-    /// An optional label printed in parentheses, typically different from `byte_pos`,
-    /// but will increase with the same value if `byte_pos` in increased.
-    label: Option<u64>,
+/// provides the byte offset printed at the left margin
+pub struct InputOffset {
+    /// The radix to print the byte offset. NoPrefix will not print a byte offset.
+    radix: Radix,
+    /// The current position. Initialize at `new`, increase using `increase_position`.
+    byte_pos: u64,
+    /// An optional label printed in parentheses, typically different from `byte_pos`,
+    /// but will increase with the same value if `byte_pos` in increased.
+    label: Option<u64>,
 }
 
-impl InputOffset {
-    /// creates a new `InputOffset` using the provided values.
-    pub fn new(radix: Radix, byte_pos: u64, label: Option<u64>) -> Self {
-        Self {
-            radix,
-            byte_pos,
-            label,
+impl InputOffset {
+    /// creates a new `InputOffset` using the provided values.
+    pub fn new(radix: Radix, byte_pos: u64, label: Option<u64>) -> Self {
+        Self {
+            radix,
+            byte_pos,
+            label,
         }
     }
 
-    /// Increase `byte_pos` and `label` if a label is used.
-    pub fn increase_position(&mut self, n: u64) {
-        self.byte_pos += n;
-        if let Some(l) = self.label {
-            self.label = Some(l + n);
+    /// Increase `byte_pos` and `label` if a label is used.
+    pub fn increase_position(&mut self, n: u64) {
+        self.byte_pos += n;
+        if let Some(l) = self.label {
+            self.label = Some(l + n);
         }
     }
 
-    #[cfg(test)]
-    fn set_radix(&mut self, radix: Radix) {
-        self.radix = radix;
+    #[cfg(test)]
+    fn set_radix(&mut self, radix: Radix) {
+        self.radix = radix;
     }
 
-    /// returns a string with the current byte offset
-    pub fn format_byte_offset(&self) -> String {
-        match (self.radix, self.label) {
-            (Radix::Decimal, None) => format!("{:07}", self.byte_pos),
-            (Radix::Decimal, Some(l)) => format!("{:07} ({:07})", self.byte_pos, l),
-            (Radix::Hexadecimal, None) => format!("{:06X}", self.byte_pos),
-            (Radix::Hexadecimal, Some(l)) => format!("{:06X} ({:06X})", self.byte_pos, l),
-            (Radix::Octal, None) => format!("{:07o}", self.byte_pos),
-            (Radix::Octal, Some(l)) => format!("{:07o} ({:07o})", self.byte_pos, l),
-            (Radix::NoPrefix, None) => String::from(""),
-            (Radix::NoPrefix, Some(l)) => format!("({:07o})", l),
+    /// returns a string with the current byte offset
+    pub fn format_byte_offset(&self) -> String {
+        match (self.radix, self.label) {
+            (Radix::Decimal, None) => format!("{:07}", self.byte_pos),
+            (Radix::Decimal, Some(l)) => format!("{:07} ({:07})", self.byte_pos, l),
+            (Radix::Hexadecimal, None) => format!("{:06X}", self.byte_pos),
+            (Radix::Hexadecimal, Some(l)) => format!("{:06X} ({:06X})", self.byte_pos, l),
+            (Radix::Octal, None) => format!("{:07o}", self.byte_pos),
+            (Radix::Octal, Some(l)) => format!("{:07o} ({:07o})", self.byte_pos, l),
+            (Radix::NoPrefix, None) => String::from(""),
+            (Radix::NoPrefix, Some(l)) => format!("({:07o})", l),
         }
     }
 
-    /// Prints the byte offset followed by a newline, or nothing at all if
-    /// both `Radix::NoPrefix` was set and no label (--traditional) is used.
-    pub fn print_final_offset(&self) {
-        if self.radix != Radix::NoPrefix || self.label.is_some() {
-            println!("{}", self.format_byte_offset());
+    /// Prints the byte offset followed by a newline, or nothing at all if
+    /// both `Radix::NoPrefix` was set and no label (--traditional) is used.
+    pub fn print_final_offset(&self) {
+        if self.radix != Radix::NoPrefix || self.label.is_some() {
+            println!("{}", self.format_byte_offset());
         }
     }
 }
 
-#[test]
-fn test_input_offset() {
-    let mut sut = InputOffset::new(Radix::Hexadecimal, 10, None);
-    assert_eq!("00000A", &sut.format_byte_offset());
-    sut.increase_position(10);
-    assert_eq!("000014", &sut.format_byte_offset());
+#[test]
+fn test_input_offset() {
+    let mut sut = InputOffset::new(Radix::Hexadecimal, 10, None);
+    assert_eq!("00000A", &sut.format_byte_offset());
+    sut.increase_position(10);
+    assert_eq!("000014", &sut.format_byte_offset());
 
-    // note normally the radix will not change after initialization
-    sut.set_radix(Radix::Decimal);
-    assert_eq!("0000020", &sut.format_byte_offset());
+    // note normally the radix will not change after initialization
+    sut.set_radix(Radix::Decimal);
+    assert_eq!("0000020", &sut.format_byte_offset());
 
-    sut.set_radix(Radix::Hexadecimal);
-    assert_eq!("000014", &sut.format_byte_offset());
+    sut.set_radix(Radix::Hexadecimal);
+    assert_eq!("000014", &sut.format_byte_offset());
 
-    sut.set_radix(Radix::Octal);
-    assert_eq!("0000024", &sut.format_byte_offset());
+    sut.set_radix(Radix::Octal);
+    assert_eq!("0000024", &sut.format_byte_offset());
 
-    sut.set_radix(Radix::NoPrefix);
-    assert_eq!("", &sut.format_byte_offset());
+    sut.set_radix(Radix::NoPrefix);
+    assert_eq!("", &sut.format_byte_offset());
 
-    sut.increase_position(10);
-    sut.set_radix(Radix::Octal);
-    assert_eq!("0000036", &sut.format_byte_offset());
+    sut.increase_position(10);
+    sut.set_radix(Radix::Octal);
+    assert_eq!("0000036", &sut.format_byte_offset());
 }
 
-#[test]
-fn test_input_offset_with_label() {
-    let mut sut = InputOffset::new(Radix::Hexadecimal, 10, Some(20));
-    assert_eq!("00000A (000014)", &sut.format_byte_offset());
-    sut.increase_position(10);
-    assert_eq!("000014 (00001E)", &sut.format_byte_offset());
+#[test]
+fn test_input_offset_with_label() {
+    let mut sut = InputOffset::new(Radix::Hexadecimal, 10, Some(20));
+    assert_eq!("00000A (000014)", &sut.format_byte_offset());
+    sut.increase_position(10);
+    assert_eq!("000014 (00001E)", &sut.format_byte_offset());
 
-    // note normally the radix will not change after initialization
-    sut.set_radix(Radix::Decimal);
-    assert_eq!("0000020 (0000030)", &sut.format_byte_offset());
+    // note normally the radix will not change after initialization
+    sut.set_radix(Radix::Decimal);
+    assert_eq!("0000020 (0000030)", &sut.format_byte_offset());
 
-    sut.set_radix(Radix::Hexadecimal);
-    assert_eq!("000014 (00001E)", &sut.format_byte_offset());
+    sut.set_radix(Radix::Hexadecimal);
+    assert_eq!("000014 (00001E)", &sut.format_byte_offset());
 
-    sut.set_radix(Radix::Octal);
-    assert_eq!("0000024 (0000036)", &sut.format_byte_offset());
+    sut.set_radix(Radix::Octal);
+    assert_eq!("0000024 (0000036)", &sut.format_byte_offset());
 
-    sut.set_radix(Radix::NoPrefix);
-    assert_eq!("(0000036)", &sut.format_byte_offset());
+    sut.set_radix(Radix::NoPrefix);
+    assert_eq!("(0000036)", &sut.format_byte_offset());
 
-    sut.increase_position(10);
-    sut.set_radix(Radix::Octal);
-    assert_eq!("0000036 (0000050)", &sut.format_byte_offset());
+    sut.increase_position(10);
+    sut.set_radix(Radix::Octal);
+    assert_eq!("0000036 (0000050)", &sut.format_byte_offset());
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/multifilereader.rs.html b/dev/src/uu_od/multifilereader.rs.html index e9d7065a8..f14ed0d7b 100644 --- a/dev/src/uu_od/multifilereader.rs.html +++ b/dev/src/uu_od/multifilereader.rs.html @@ -1,4 +1,4 @@ -multifilereader.rs - source
1
+multifilereader.rs - source
1
 2
 3
 4
@@ -205,74 +205,74 @@
 205
 206
 207
-
// spell-checker:ignore (ToDO) multifile curr fnames fname xfrd fillloop mockstream
+
// spell-checker:ignore (ToDO) multifile curr fnames fname xfrd fillloop mockstream
 
-use std::fs::File;
-use std::io;
-use std::io::BufReader;
-use std::vec::Vec;
+use std::fs::File;
+use std::io;
+use std::io::BufReader;
+use std::vec::Vec;
 
-use uucore::display::Quotable;
+use uucore::display::Quotable;
 
-pub enum InputSource<'a> {
-    FileName(&'a str),
-    Stdin,
-    #[allow(dead_code)]
-    Stream(Box<dyn io::Read>),
+pub enum InputSource<'a> {
+    FileName(&'a str),
+    Stdin,
+    #[allow(dead_code)]
+    Stream(Box<dyn io::Read>),
 }
 
-// MultifileReader - concatenate all our input, file or stdin.
-pub struct MultifileReader<'a> {
-    ni: Vec<InputSource<'a>>,
-    curr_file: Option<Box<dyn io::Read>>,
-    any_err: bool,
+// MultifileReader - concatenate all our input, file or stdin.
+pub struct MultifileReader<'a> {
+    ni: Vec<InputSource<'a>>,
+    curr_file: Option<Box<dyn io::Read>>,
+    any_err: bool,
 }
 
-pub trait HasError {
-    fn has_error(&self) -> bool;
+pub trait HasError {
+    fn has_error(&self) -> bool;
 }
 
-impl<'b> MultifileReader<'b> {
-    pub fn new(fnames: Vec<InputSource>) -> MultifileReader {
-        let mut mf = MultifileReader {
-            ni: fnames,
-            curr_file: None, // normally this means done; call next_file()
-            any_err: false,
+impl<'b> MultifileReader<'b> {
+    pub fn new(fnames: Vec<InputSource>) -> MultifileReader {
+        let mut mf = MultifileReader {
+            ni: fnames,
+            curr_file: None, // normally this means done; call next_file()
+            any_err: false,
         };
-        mf.next_file();
-        mf
+        mf.next_file();
+        mf
     }
 
-    fn next_file(&mut self) {
-        // loop retries with subsequent files if err - normally 'loops' once
-        loop {
-            if self.ni.is_empty() {
-                self.curr_file = None;
+    fn next_file(&mut self) {
+        // loop retries with subsequent files if err - normally 'loops' once
+        loop {
+            if self.ni.is_empty() {
+                self.curr_file = None;
                 break;
             }
-            match self.ni.remove(0) {
-                InputSource::Stdin => {
-                    self.curr_file = Some(Box::new(BufReader::new(std::io::stdin())));
+            match self.ni.remove(0) {
+                InputSource::Stdin => {
+                    self.curr_file = Some(Box::new(BufReader::new(std::io::stdin())));
                     break;
                 }
-                InputSource::FileName(fname) => {
-                    match File::open(fname) {
-                        Ok(f) => {
-                            self.curr_file = Some(Box::new(BufReader::new(f)));
+                InputSource::FileName(fname) => {
+                    match File::open(fname) {
+                        Ok(f) => {
+                            self.curr_file = Some(Box::new(BufReader::new(f)));
                             break;
                         }
-                        Err(e) => {
-                            // If any file can't be opened,
-                            // print an error at the time that the file is needed,
-                            // then move on the the next file.
-                            // This matches the behavior of the original `od`
-                            show_error!("{}: {}", fname.maybe_quote(), e);
-                            self.any_err = true;
+                        Err(e) => {
+                            // If any file can't be opened,
+                            // print an error at the time that the file is needed,
+                            // then move on the the next file.
+                            // This matches the behavior of the original `od`
+                            show_error!("{}: {}", fname.maybe_quote(), e);
+                            self.any_err = true;
                         }
                     }
                 }
-                InputSource::Stream(s) => {
-                    self.curr_file = Some(s);
+                InputSource::Stream(s) => {
+                    self.curr_file = Some(s);
                     break;
                 }
             }
@@ -280,137 +280,137 @@
     }
 }
 
-impl<'b> io::Read for MultifileReader<'b> {
-    // Fill buf with bytes read from the list of files
-    // Returns Ok(<number of bytes read>)
-    // Handles io errors itself, thus always returns OK
-    // Fills the provided buffer completely, unless it has run out of input.
-    // If any call returns short (< buf.len()), all subsequent calls will return Ok<0>
-    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
-        let mut xfrd = 0;
-        // while buffer we are filling is not full.. May go through several files.
-        'fillloop: while xfrd < buf.len() {
-            match self.curr_file {
-                None => break,
-                Some(ref mut curr_file) => {
-                    loop {
-                        // stdin may return on 'return' (enter), even though the buffer isn't full.
-                        xfrd += match curr_file.read(&mut buf[xfrd..]) {
+impl<'b> io::Read for MultifileReader<'b> {
+    // Fill buf with bytes read from the list of files
+    // Returns Ok(<number of bytes read>)
+    // Handles io errors itself, thus always returns OK
+    // Fills the provided buffer completely, unless it has run out of input.
+    // If any call returns short (< buf.len()), all subsequent calls will return Ok<0>
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        let mut xfrd = 0;
+        // while buffer we are filling is not full.. May go through several files.
+        'fillloop: while xfrd < buf.len() {
+            match self.curr_file {
+                None => break,
+                Some(ref mut curr_file) => {
+                    loop {
+                        // stdin may return on 'return' (enter), even though the buffer isn't full.
+                        xfrd += match curr_file.read(&mut buf[xfrd..]) {
                             Ok(0) => break,
-                            Ok(n) => n,
-                            Err(e) => {
-                                show_error!("I/O: {}", e);
-                                self.any_err = true;
+                            Ok(n) => n,
+                            Err(e) => {
+                                show_error!("I/O: {}", e);
+                                self.any_err = true;
                                 break;
                             }
                         };
-                        if xfrd == buf.len() {
-                            // transferred all that was asked for.
-                            break 'fillloop;
+                        if xfrd == buf.len() {
+                            // transferred all that was asked for.
+                            break 'fillloop;
                         }
                     }
                 }
             }
-            self.next_file();
+            self.next_file();
         }
-        Ok(xfrd)
+        Ok(xfrd)
     }
 }
 
-impl<'b> HasError for MultifileReader<'b> {
-    fn has_error(&self) -> bool {
-        self.any_err
+impl<'b> HasError for MultifileReader<'b> {
+    fn has_error(&self) -> bool {
+        self.any_err
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use crate::mockstream::*;
-    use std::io::{Cursor, ErrorKind, Read};
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::mockstream::*;
+    use std::io::{Cursor, ErrorKind, Read};
 
-    #[test]
-    fn test_multi_file_reader_one_read() {
-        let inputs = vec![
-            InputSource::Stream(Box::new(Cursor::new(&b"abcd"[..]))),
-            InputSource::Stream(Box::new(Cursor::new(&b"ABCD"[..]))),
+    #[test]
+    fn test_multi_file_reader_one_read() {
+        let inputs = vec![
+            InputSource::Stream(Box::new(Cursor::new(&b"abcd"[..]))),
+            InputSource::Stream(Box::new(Cursor::new(&b"ABCD"[..]))),
         ];
-        let mut v = [0; 10];
+        let mut v = [0; 10];
 
-        let mut sut = MultifileReader::new(inputs);
+        let mut sut = MultifileReader::new(inputs);
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 8);
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x41, 0x42, 0x43, 0x44, 0, 0]);
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 0);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 8);
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x41, 0x42, 0x43, 0x44, 0, 0]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 0);
     }
 
-    #[test]
-    fn test_multi_file_reader_two_reads() {
-        let inputs = vec![
-            InputSource::Stream(Box::new(Cursor::new(&b"abcd"[..]))),
-            InputSource::Stream(Box::new(Cursor::new(&b"ABCD"[..]))),
+    #[test]
+    fn test_multi_file_reader_two_reads() {
+        let inputs = vec![
+            InputSource::Stream(Box::new(Cursor::new(&b"abcd"[..]))),
+            InputSource::Stream(Box::new(Cursor::new(&b"ABCD"[..]))),
         ];
-        let mut v = [0; 5];
+        let mut v = [0; 5];
 
-        let mut sut = MultifileReader::new(inputs);
+        let mut sut = MultifileReader::new(inputs);
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 5);
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x41]);
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
-        assert_eq!(v, [0x42, 0x43, 0x44, 0x64, 0x41]); // last two bytes are not overwritten
-    }
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 5);
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x41]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
+        assert_eq!(v, [0x42, 0x43, 0x44, 0x64, 0x41]); // last two bytes are not overwritten
+    }
 
-    #[test]
-    fn test_multi_file_reader_read_error() {
-        let c = Cursor::new(&b"1234"[..])
-            .chain(FailingMockStream::new(ErrorKind::Other, "Failing", 1))
-            .chain(Cursor::new(&b"5678"[..]));
-        let inputs = vec![
-            InputSource::Stream(Box::new(c)),
-            InputSource::Stream(Box::new(Cursor::new(&b"ABCD"[..]))),
+    #[test]
+    fn test_multi_file_reader_read_error() {
+        let c = Cursor::new(&b"1234"[..])
+            .chain(FailingMockStream::new(ErrorKind::Other, "Failing", 1))
+            .chain(Cursor::new(&b"5678"[..]));
+        let inputs = vec![
+            InputSource::Stream(Box::new(c)),
+            InputSource::Stream(Box::new(Cursor::new(&b"ABCD"[..]))),
         ];
-        let mut v = [0; 5];
+        let mut v = [0; 5];
 
-        let mut sut = MultifileReader::new(inputs);
+        let mut sut = MultifileReader::new(inputs);
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 5);
-        assert_eq!(v, [49, 50, 51, 52, 65]);
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
-        assert_eq!(v, [66, 67, 68, 52, 65]); // last two bytes are not overwritten
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 5);
+        assert_eq!(v, [49, 50, 51, 52, 65]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
+        assert_eq!(v, [66, 67, 68, 52, 65]); // last two bytes are not overwritten
 
-        // note: no retry on i/o error, so 5678 is missing
-    }
+        // note: no retry on i/o error, so 5678 is missing
+    }
 
-    #[test]
-    fn test_multi_file_reader_read_error_at_start() {
-        let inputs = vec![
-            InputSource::Stream(Box::new(FailingMockStream::new(
-                ErrorKind::Other,
+    #[test]
+    fn test_multi_file_reader_read_error_at_start() {
+        let inputs = vec![
+            InputSource::Stream(Box::new(FailingMockStream::new(
+                ErrorKind::Other,
                 "Failing",
                 1,
             ))),
-            InputSource::Stream(Box::new(Cursor::new(&b"abcd"[..]))),
-            InputSource::Stream(Box::new(FailingMockStream::new(
-                ErrorKind::Other,
+            InputSource::Stream(Box::new(Cursor::new(&b"abcd"[..]))),
+            InputSource::Stream(Box::new(FailingMockStream::new(
+                ErrorKind::Other,
                 "Failing",
                 1,
             ))),
-            InputSource::Stream(Box::new(Cursor::new(&b"ABCD"[..]))),
-            InputSource::Stream(Box::new(FailingMockStream::new(
-                ErrorKind::Other,
+            InputSource::Stream(Box::new(Cursor::new(&b"ABCD"[..]))),
+            InputSource::Stream(Box::new(FailingMockStream::new(
+                ErrorKind::Other,
                 "Failing",
                 1,
             ))),
         ];
-        let mut v = [0; 5];
+        let mut v = [0; 5];
 
-        let mut sut = MultifileReader::new(inputs);
+        let mut sut = MultifileReader::new(inputs);
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 5);
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x41]);
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
-        assert_eq!(v, [0x42, 0x43, 0x44, 0x64, 0x41]); // last two bytes are not overwritten
-    }
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 5);
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x41]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
+        assert_eq!(v, [0x42, 0x43, 0x44, 0x64, 0x41]); // last two bytes are not overwritten
+    }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/od.rs.html b/dev/src/uu_od/od.rs.html index 8b35977af..4ca238051 100644 --- a/dev/src/uu_od/od.rs.html +++ b/dev/src/uu_od/od.rs.html @@ -1,4 +1,4 @@ -od.rs - source
1
+od.rs - source
1
 2
 3
 4
@@ -672,67 +672,67 @@
 672
 673
 674
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Ben Hirsch <benhirsch24@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Ben Hirsch <benhirsch24@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (clap) dont
-// spell-checker:ignore (ToDO) formatteriteminfo inputdecoder inputoffset mockstream nrofbytes partialreader odfunc multifile exitcode
+// spell-checker:ignore (clap) dont
+// spell-checker:ignore (ToDO) formatteriteminfo inputdecoder inputoffset mockstream nrofbytes partialreader odfunc multifile exitcode
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-mod byteorder_io;
-mod formatteriteminfo;
-mod inputdecoder;
-mod inputoffset;
-#[cfg(test)]
-mod mockstream;
-mod multifilereader;
-mod output_info;
-mod parse_formats;
-mod parse_inputs;
-mod parse_nrofbytes;
-mod partialreader;
-mod peekreader;
-mod prn_char;
-mod prn_float;
-mod prn_int;
+mod byteorder_io;
+mod formatteriteminfo;
+mod inputdecoder;
+mod inputoffset;
+#[cfg(test)]
+mod mockstream;
+mod multifilereader;
+mod output_info;
+mod parse_formats;
+mod parse_inputs;
+mod parse_nrofbytes;
+mod partialreader;
+mod peekreader;
+mod prn_char;
+mod prn_float;
+mod prn_int;
 
-use std::cmp;
-use std::fmt::Write;
+use std::cmp;
+use std::fmt::Write;
 
-use crate::byteorder_io::*;
-use crate::formatteriteminfo::*;
-use crate::inputdecoder::{InputDecoder, MemoryDecoder};
-use crate::inputoffset::{InputOffset, Radix};
-use crate::multifilereader::*;
-use crate::output_info::OutputInfo;
-use crate::parse_formats::{parse_format_flags, ParsedFormatterItemInfo};
-use crate::parse_inputs::{parse_inputs, CommandLineInputs};
-use crate::parse_nrofbytes::parse_number_of_bytes;
-use crate::partialreader::*;
-use crate::peekreader::*;
-use crate::prn_char::format_ascii_dump;
-use clap::ArgAction;
-use clap::{crate_version, parser::ValueSource, Arg, ArgMatches, Command};
-use uucore::display::Quotable;
-use uucore::error::{UResult, USimpleError};
-use uucore::format_usage;
-use uucore::parse_size::ParseSizeError;
+use crate::byteorder_io::*;
+use crate::formatteriteminfo::*;
+use crate::inputdecoder::{InputDecoder, MemoryDecoder};
+use crate::inputoffset::{InputOffset, Radix};
+use crate::multifilereader::*;
+use crate::output_info::OutputInfo;
+use crate::parse_formats::{parse_format_flags, ParsedFormatterItemInfo};
+use crate::parse_inputs::{parse_inputs, CommandLineInputs};
+use crate::parse_nrofbytes::parse_number_of_bytes;
+use crate::partialreader::*;
+use crate::peekreader::*;
+use crate::prn_char::format_ascii_dump;
+use clap::ArgAction;
+use clap::{crate_version, parser::ValueSource, Arg, ArgMatches, Command};
+use uucore::display::Quotable;
+use uucore::error::{UResult, USimpleError};
+use uucore::format_usage;
+use uucore::parse_size::ParseSizeError;
 
-const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes
-static ABOUT: &str = "dump files in octal and other formats";
+const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes
+static ABOUT: &str = "dump files in octal and other formats";
 
-static USAGE: &str = "\
+static USAGE: &str = "\
     {} [OPTION]... [--] [FILENAME]...
     {} [-abcdDefFhHiIlLoOsxX] [FILENAME] [[+][0x]OFFSET[.][b]]
     {} --traditional [OPTION]... [FILENAME] [[+][0x]OFFSET[.][b] [[+][0x]LABEL[.][b]]]";
 
-static LONG_HELP: &str = r#"
+static LONG_HELP: &str = r#"
 Displays data in various human-readable formats. If multiple formats are
 specified, the output will contain all formats in the order they appear on the
 command line. Each format will be printed on a new line. Only the line
@@ -771,143 +771,143 @@ Any type specification can have a "z" suffix, which will add a ASCII d
 If an error occurred, a diagnostic message will be printed to stderr, and the
 exitcode will be non-zero."#;
 
-pub(crate) mod options {
-    pub const HELP: &str = "help";
-    pub const ADDRESS_RADIX: &str = "address-radix";
-    pub const SKIP_BYTES: &str = "skip-bytes";
-    pub const READ_BYTES: &str = "read-bytes";
-    pub const ENDIAN: &str = "endian";
-    pub const STRINGS: &str = "strings";
-    pub const FORMAT: &str = "format";
-    pub const OUTPUT_DUPLICATES: &str = "output-duplicates";
-    pub const TRADITIONAL: &str = "traditional";
-    pub const WIDTH: &str = "width";
-    pub const FILENAME: &str = "FILENAME";
+pub(crate) mod options {
+    pub const HELP: &str = "help";
+    pub const ADDRESS_RADIX: &str = "address-radix";
+    pub const SKIP_BYTES: &str = "skip-bytes";
+    pub const READ_BYTES: &str = "read-bytes";
+    pub const ENDIAN: &str = "endian";
+    pub const STRINGS: &str = "strings";
+    pub const FORMAT: &str = "format";
+    pub const OUTPUT_DUPLICATES: &str = "output-duplicates";
+    pub const TRADITIONAL: &str = "traditional";
+    pub const WIDTH: &str = "width";
+    pub const FILENAME: &str = "FILENAME";
 }
 
-struct OdOptions {
-    byte_order: ByteOrder,
-    skip_bytes: u64,
-    read_bytes: Option<u64>,
-    label: Option<u64>,
-    input_strings: Vec<String>,
-    formats: Vec<ParsedFormatterItemInfo>,
-    line_bytes: usize,
-    output_duplicates: bool,
-    radix: Radix,
+struct OdOptions {
+    byte_order: ByteOrder,
+    skip_bytes: u64,
+    read_bytes: Option<u64>,
+    label: Option<u64>,
+    input_strings: Vec<String>,
+    formats: Vec<ParsedFormatterItemInfo>,
+    line_bytes: usize,
+    output_duplicates: bool,
+    radix: Radix,
 }
 
-impl OdOptions {
-    fn new(matches: &ArgMatches, args: &[String]) -> UResult<Self> {
-        let byte_order = if let Some(s) = matches.get_one::<String>(options::ENDIAN) {
-            match s.as_str() {
-                "little" => ByteOrder::Little,
-                "big" => ByteOrder::Big,
-                _ => {
-                    return Err(USimpleError::new(
+impl OdOptions {
+    fn new(matches: &ArgMatches, args: &[String]) -> UResult<Self> {
+        let byte_order = if let Some(s) = matches.get_one::<String>(options::ENDIAN) {
+            match s.as_str() {
+                "little" => ByteOrder::Little,
+                "big" => ByteOrder::Big,
+                _ => {
+                    return Err(USimpleError::new(
                         1,
-                        format!("Invalid argument --endian={}", s),
+                        format!("Invalid argument --endian={}", s),
                     ))
                 }
             }
-        } else {
-            ByteOrder::Native
+        } else {
+            ByteOrder::Native
         };
 
-        let mut skip_bytes = match matches.get_one::<String>(options::SKIP_BYTES) {
-            None => 0,
-            Some(s) => match parse_number_of_bytes(s) {
-                Ok(n) => n,
-                Err(e) => {
-                    return Err(USimpleError::new(
+        let mut skip_bytes = match matches.get_one::<String>(options::SKIP_BYTES) {
+            None => 0,
+            Some(s) => match parse_number_of_bytes(s) {
+                Ok(n) => n,
+                Err(e) => {
+                    return Err(USimpleError::new(
                         1,
-                        format_error_message(&e, s, options::SKIP_BYTES),
+                        format_error_message(&e, s, options::SKIP_BYTES),
                     ))
                 }
             },
         };
 
-        let mut label: Option<u64> = None;
+        let mut label: Option<u64> = None;
 
-        let parsed_input = parse_inputs(matches)
-            .map_err(|e| USimpleError::new(1, format!("Invalid inputs: {}", e)))?;
-        let input_strings = match parsed_input {
-            CommandLineInputs::FileNames(v) => v,
-            CommandLineInputs::FileAndOffset((f, s, l)) => {
-                skip_bytes = s;
-                label = l;
-                vec![f]
+        let parsed_input = parse_inputs(matches)
+            .map_err(|e| USimpleError::new(1, format!("Invalid inputs: {}", e)))?;
+        let input_strings = match parsed_input {
+            CommandLineInputs::FileNames(v) => v,
+            CommandLineInputs::FileAndOffset((f, s, l)) => {
+                skip_bytes = s;
+                label = l;
+                vec![f]
             }
         };
 
-        let formats = parse_format_flags(args).map_err(|e| USimpleError::new(1, e))?;
+        let formats = parse_format_flags(args).map_err(|e| USimpleError::new(1, e))?;
 
-        let mut line_bytes = match matches.get_one::<String>(options::WIDTH) {
-            None => 16,
-            Some(s) => {
-                if matches.value_source(options::WIDTH) == Some(ValueSource::CommandLine) {
-                    match parse_number_of_bytes(s) {
-                        Ok(n) => usize::try_from(n)
-                            .map_err(|_| USimpleError::new(1, format!("‘{}‘ is too large", s)))?,
-                        Err(e) => {
-                            return Err(USimpleError::new(
+        let mut line_bytes = match matches.get_one::<String>(options::WIDTH) {
+            None => 16,
+            Some(s) => {
+                if matches.value_source(options::WIDTH) == Some(ValueSource::CommandLine) {
+                    match parse_number_of_bytes(s) {
+                        Ok(n) => usize::try_from(n)
+                            .map_err(|_| USimpleError::new(1, format!("‘{}‘ is too large", s)))?,
+                        Err(e) => {
+                            return Err(USimpleError::new(
                                 1,
-                                format_error_message(&e, s, options::WIDTH),
+                                format_error_message(&e, s, options::WIDTH),
                             ))
                         }
                     }
-                } else {
-                    16
-                }
+                } else {
+                    16
+                }
             }
         };
 
-        let min_bytes = formats.iter().fold(1, |max, next| {
-            cmp::max(max, next.formatter_item_info.byte_size)
+        let min_bytes = formats.iter().fold(1, |max, next| {
+            cmp::max(max, next.formatter_item_info.byte_size)
         });
-        if line_bytes == 0 || line_bytes % min_bytes != 0 {
-            show_warning!("invalid width {}; using {} instead", line_bytes, min_bytes);
-            line_bytes = min_bytes;
+        if line_bytes == 0 || line_bytes % min_bytes != 0 {
+            show_warning!("invalid width {}; using {} instead", line_bytes, min_bytes);
+            line_bytes = min_bytes;
         }
 
-        let output_duplicates = matches.get_flag(options::OUTPUT_DUPLICATES);
+        let output_duplicates = matches.get_flag(options::OUTPUT_DUPLICATES);
 
-        let read_bytes = match matches.get_one::<String>(options::READ_BYTES) {
-            None => None,
-            Some(s) => match parse_number_of_bytes(s) {
-                Ok(n) => Some(n),
-                Err(e) => {
-                    return Err(USimpleError::new(
+        let read_bytes = match matches.get_one::<String>(options::READ_BYTES) {
+            None => None,
+            Some(s) => match parse_number_of_bytes(s) {
+                Ok(n) => Some(n),
+                Err(e) => {
+                    return Err(USimpleError::new(
                         1,
-                        format_error_message(&e, s, options::READ_BYTES),
+                        format_error_message(&e, s, options::READ_BYTES),
                     ))
                 }
             },
         };
 
-        let radix = match matches.get_one::<String>(options::ADDRESS_RADIX) {
-            None => Radix::Octal,
-            Some(s) => {
-                let st = s.as_bytes();
-                if st.len() != 1 {
-                    return Err(USimpleError::new(
+        let radix = match matches.get_one::<String>(options::ADDRESS_RADIX) {
+            None => Radix::Octal,
+            Some(s) => {
+                let st = s.as_bytes();
+                if st.len() != 1 {
+                    return Err(USimpleError::new(
                         1,
-                        "Radix must be one of [d, o, n, x]".to_string(),
+                        "Radix must be one of [d, o, n, x]".to_string(),
                     ));
-                } else {
-                    let radix: char = *(st
-                        .first()
-                        .expect("byte string of length 1 lacks a 0th elem"))
-                        as char;
-                    match radix {
-                        'd' => Radix::Decimal,
-                        'x' => Radix::Hexadecimal,
-                        'o' => Radix::Octal,
-                        'n' => Radix::NoPrefix,
-                        _ => {
-                            return Err(USimpleError::new(
+                } else {
+                    let radix: char = *(st
+                        .first()
+                        .expect("byte string of length 1 lacks a 0th elem"))
+                        as char;
+                    match radix {
+                        'd' => Radix::Decimal,
+                        'x' => Radix::Hexadecimal,
+                        'o' => Radix::Octal,
+                        'n' => Radix::NoPrefix,
+                        _ => {
+                            return Err(USimpleError::new(
                                 1,
-                                "Radix must be one of [d, o, n, x]".to_string(),
+                                "Radix must be one of [d, o, n, x]".to_string(),
                             ))
                         }
                     }
@@ -915,436 +915,436 @@ exitcode will be non-zero."#;
             }
         };
 
-        Ok(Self {
-            byte_order,
-            skip_bytes,
-            read_bytes,
-            label,
-            input_strings,
-            formats,
-            line_bytes,
-            output_duplicates,
-            radix,
+        Ok(Self {
+            byte_order,
+            skip_bytes,
+            read_bytes,
+            label,
+            input_strings,
+            formats,
+            line_bytes,
+            output_duplicates,
+            radix,
         })
     }
 }
 
-/// parses and validates command line parameters, prepares data structures,
-/// opens the input and calls `odfunc` to process the input.
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+/// parses and validates command line parameters, prepares data structures,
+/// opens the input and calls `odfunc` to process the input.
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let clap_opts = uu_app();
+    let clap_opts = uu_app();
 
-    let clap_matches = clap_opts.try_get_matches_from(&args)?;
+    let clap_matches = clap_opts.try_get_matches_from(&args)?;
 
-    let od_options = OdOptions::new(&clap_matches, &args)?;
+    let od_options = OdOptions::new(&clap_matches, &args)?;
 
-    let mut input_offset =
-        InputOffset::new(od_options.radix, od_options.skip_bytes, od_options.label);
+    let mut input_offset =
+        InputOffset::new(od_options.radix, od_options.skip_bytes, od_options.label);
 
-    let mut input = open_input_peek_reader(
-        &od_options.input_strings,
-        od_options.skip_bytes,
-        od_options.read_bytes,
+    let mut input = open_input_peek_reader(
+        &od_options.input_strings,
+        od_options.skip_bytes,
+        od_options.read_bytes,
     );
-    let mut input_decoder = InputDecoder::new(
-        &mut input,
-        od_options.line_bytes,
-        PEEK_BUFFER_SIZE,
-        od_options.byte_order,
+    let mut input_decoder = InputDecoder::new(
+        &mut input,
+        od_options.line_bytes,
+        PEEK_BUFFER_SIZE,
+        od_options.byte_order,
     );
 
-    let output_info = OutputInfo::new(
-        od_options.line_bytes,
-        &od_options.formats[..],
-        od_options.output_duplicates,
+    let output_info = OutputInfo::new(
+        od_options.line_bytes,
+        &od_options.formats[..],
+        od_options.output_duplicates,
     );
 
-    odfunc(&mut input_offset, &mut input_decoder, &output_info)
+    odfunc(&mut input_offset, &mut input_decoder, &output_info)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .after_help(LONG_HELP)
-        .trailing_var_arg(true)
-        .dont_delimit_trailing_values(true)
-        .infer_long_args(true)
-        .args_override_self(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help)
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .after_help(LONG_HELP)
+        .trailing_var_arg(true)
+        .dont_delimit_trailing_values(true)
+        .infer_long_args(true)
+        .args_override_self(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help)
         )
-        .arg(
-            Arg::new(options::ADDRESS_RADIX)
-                .short('A')
-                .long(options::ADDRESS_RADIX)
-                .help("Select the base in which file offsets are printed.")
-                .value_name("RADIX"),
+        .arg(
+            Arg::new(options::ADDRESS_RADIX)
+                .short('A')
+                .long(options::ADDRESS_RADIX)
+                .help("Select the base in which file offsets are printed.")
+                .value_name("RADIX"),
         )
-        .arg(
-            Arg::new(options::SKIP_BYTES)
-                .short('j')
-                .long(options::SKIP_BYTES)
-                .help("Skip bytes input bytes before formatting and writing.")
-                .value_name("BYTES"),
+        .arg(
+            Arg::new(options::SKIP_BYTES)
+                .short('j')
+                .long(options::SKIP_BYTES)
+                .help("Skip bytes input bytes before formatting and writing.")
+                .value_name("BYTES"),
         )
-        .arg(
-            Arg::new(options::READ_BYTES)
-                .short('N')
-                .long(options::READ_BYTES)
-                .help("limit dump to BYTES input bytes")
-                .value_name("BYTES"),
+        .arg(
+            Arg::new(options::READ_BYTES)
+                .short('N')
+                .long(options::READ_BYTES)
+                .help("limit dump to BYTES input bytes")
+                .value_name("BYTES"),
         )
-        .arg(
-            Arg::new(options::ENDIAN)
-                .long(options::ENDIAN)
-                .help("byte order to use for multi-byte formats")
-                .value_parser(["big", "little"])
-                .value_name("big|little"),
+        .arg(
+            Arg::new(options::ENDIAN)
+                .long(options::ENDIAN)
+                .help("byte order to use for multi-byte formats")
+                .value_parser(["big", "little"])
+                .value_name("big|little"),
         )
-        .arg(
-            Arg::new(options::STRINGS)
-                .short('S')
-                .long(options::STRINGS)
-                .help(
+        .arg(
+            Arg::new(options::STRINGS)
+                .short('S')
+                .long(options::STRINGS)
+                .help(
                     "NotImplemented: output strings of at least BYTES graphic chars. 3 is assumed when \
                      BYTES is not specified.",
                 )
-                .default_missing_value("3")
-                .value_name("BYTES"),
+                .default_missing_value("3")
+                .value_name("BYTES"),
         )
-        .arg(
-            Arg::new("a")
-                .short('a')
-                .help("named characters, ignoring high-order bit")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("a")
+                .short('a')
+                .help("named characters, ignoring high-order bit")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("b")
-                .short('b')
-                .help("octal bytes")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("b")
+                .short('b')
+                .help("octal bytes")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("c")
-                .short('c')
-                .help("ASCII characters or backslash escapes")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("c")
+                .short('c')
+                .help("ASCII characters or backslash escapes")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("d")
-                .short('d')
-                .help("unsigned decimal 2-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("d")
+                .short('d')
+                .help("unsigned decimal 2-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("D")
-                .short('D')
-                .help("unsigned decimal 4-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("D")
+                .short('D')
+                .help("unsigned decimal 4-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("o")
-                .short('o')
-                .help("octal 2-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("o")
+                .short('o')
+                .help("octal 2-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("I")
-                .short('I')
-                .help("decimal 8-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("I")
+                .short('I')
+                .help("decimal 8-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("L")
-                .short('L')
-                .help("decimal 8-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("L")
+                .short('L')
+                .help("decimal 8-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("i")
-                .short('i')
-                .help("decimal 4-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("i")
+                .short('i')
+                .help("decimal 4-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("l")
-                .short('l')
-                .help("decimal 8-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("l")
+                .short('l')
+                .help("decimal 8-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("x")
-                .short('x')
-                .help("hexadecimal 2-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("x")
+                .short('x')
+                .help("hexadecimal 2-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("h")
-                .short('h')
-                .help("hexadecimal 2-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("h")
+                .short('h')
+                .help("hexadecimal 2-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("O")
-                .short('O')
-                .help("octal 4-byte units")
-                .action(ArgAction::SetTrue)
+        .arg(
+            Arg::new("O")
+                .short('O')
+                .help("octal 4-byte units")
+                .action(ArgAction::SetTrue)
         )
-        .arg(
-            Arg::new("s")
-                .short('s')
-                .help("decimal 2-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("s")
+                .short('s')
+                .help("decimal 2-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("X")
-                .short('X')
-                .help("hexadecimal 4-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("X")
+                .short('X')
+                .help("hexadecimal 4-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("H")
-                .short('H')
-                .help("hexadecimal 4-byte units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("H")
+                .short('H')
+                .help("hexadecimal 4-byte units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("e")
-                .short('e')
-                .help("floating point double precision (64-bit) units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("e")
+                .short('e')
+                .help("floating point double precision (64-bit) units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("f")
-                .short('f')
-                .help("floating point double precision (32-bit) units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("f")
+                .short('f')
+                .help("floating point double precision (32-bit) units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new("F")
-                .short('F')
-                .help("floating point double precision (64-bit) units")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new("F")
+                .short('F')
+                .help("floating point double precision (64-bit) units")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FORMAT)
-                .short('t')
-                .long("format")
-                .help("select output format or formats")
-                .action(ArgAction::Append)
-                .num_args(1)
-                .value_name("TYPE"),
+        .arg(
+            Arg::new(options::FORMAT)
+                .short('t')
+                .long("format")
+                .help("select output format or formats")
+                .action(ArgAction::Append)
+                .num_args(1)
+                .value_name("TYPE"),
         )
-        .arg(
-            Arg::new(options::OUTPUT_DUPLICATES)
-                .short('v')
-                .long(options::OUTPUT_DUPLICATES)
-                .help("do not use * to mark line suppression")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OUTPUT_DUPLICATES)
+                .short('v')
+                .long(options::OUTPUT_DUPLICATES)
+                .help("do not use * to mark line suppression")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::WIDTH)
-                .short('w')
-                .long(options::WIDTH)
-                .help(
+        .arg(
+            Arg::new(options::WIDTH)
+                .short('w')
+                .long(options::WIDTH)
+                .help(
                     "output BYTES bytes per output line. 32 is implied when BYTES is not \
                      specified.",
                 )
-                .default_missing_value("32")
-                .value_name("BYTES")
-                .num_args(..=1),
+                .default_missing_value("32")
+                .value_name("BYTES")
+                .num_args(..=1),
         )
-        .arg(
-            Arg::new(options::TRADITIONAL)
-                .long(options::TRADITIONAL)
-                .help("compatibility mode with one input, offset and label.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::TRADITIONAL)
+                .long(options::TRADITIONAL)
+                .help("compatibility mode with one input, offset and label.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILENAME)
-                .hide(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILENAME)
+                .hide(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-/// Loops through the input line by line, calling print_bytes to take care of the output.
-fn odfunc<I>(
-    input_offset: &mut InputOffset,
-    input_decoder: &mut InputDecoder<I>,
-    output_info: &OutputInfo,
-) -> UResult<()>
-where
-    I: PeekRead + HasError,
+/// Loops through the input line by line, calling print_bytes to take care of the output.
+fn odfunc<I>(
+    input_offset: &mut InputOffset,
+    input_decoder: &mut InputDecoder<I>,
+    output_info: &OutputInfo,
+) -> UResult<()>
+where
+    I: PeekRead + HasError,
 {
-    let mut duplicate_line = false;
-    let mut previous_bytes: Vec<u8> = Vec::new();
-    let line_bytes = output_info.byte_size_line;
+    let mut duplicate_line = false;
+    let mut previous_bytes: Vec<u8> = Vec::new();
+    let line_bytes = output_info.byte_size_line;
 
-    loop {
-        // print each line data (or multi-format raster of several lines describing the same data).
+    loop {
+        // print each line data (or multi-format raster of several lines describing the same data).
 
-        match input_decoder.peek_read() {
-            Ok(mut memory_decoder) => {
-                let length = memory_decoder.length();
+        match input_decoder.peek_read() {
+            Ok(mut memory_decoder) => {
+                let length = memory_decoder.length();
 
-                if length == 0 {
-                    input_offset.print_final_offset();
+                if length == 0 {
+                    input_offset.print_final_offset();
                     break;
                 }
 
-                // not enough byte for a whole element, this should only happen on the last line.
-                if length != line_bytes {
-                    // set zero bytes in the part of the buffer that will be used, but is not filled.
-                    let mut max_used = length + output_info.byte_size_block;
-                    if max_used > line_bytes {
-                        max_used = line_bytes;
+                // not enough byte for a whole element, this should only happen on the last line.
+                if length != line_bytes {
+                    // set zero bytes in the part of the buffer that will be used, but is not filled.
+                    let mut max_used = length + output_info.byte_size_block;
+                    if max_used > line_bytes {
+                        max_used = line_bytes;
                     }
 
-                    memory_decoder.zero_out_buffer(length, max_used);
+                    memory_decoder.zero_out_buffer(length, max_used);
                 }
 
-                if !output_info.output_duplicates
-                    && length == line_bytes
-                    && memory_decoder.get_buffer(0) == &previous_bytes[..]
+                if !output_info.output_duplicates
+                    && length == line_bytes
+                    && memory_decoder.get_buffer(0) == &previous_bytes[..]
                 {
-                    if !duplicate_line {
-                        duplicate_line = true;
+                    if !duplicate_line {
+                        duplicate_line = true;
                         println!("*");
                     }
-                } else {
-                    duplicate_line = false;
-                    if length == line_bytes {
-                        // save a copy of the input unless it is the last line
-                        memory_decoder.clone_buffer(&mut previous_bytes);
+                } else {
+                    duplicate_line = false;
+                    if length == line_bytes {
+                        // save a copy of the input unless it is the last line
+                        memory_decoder.clone_buffer(&mut previous_bytes);
                     }
 
-                    print_bytes(
-                        &input_offset.format_byte_offset(),
-                        &memory_decoder,
-                        output_info,
+                    print_bytes(
+                        &input_offset.format_byte_offset(),
+                        &memory_decoder,
+                        output_info,
                     );
                 }
 
-                input_offset.increase_position(length as u64);
+                input_offset.increase_position(length as u64);
             }
-            Err(e) => {
-                show_error!("{}", e);
-                input_offset.print_final_offset();
-                return Err(1.into());
+            Err(e) => {
+                show_error!("{}", e);
+                input_offset.print_final_offset();
+                return Err(1.into());
             }
         };
     }
 
-    if input_decoder.has_error() {
-        Err(1.into())
-    } else {
+    if input_decoder.has_error() {
+        Err(1.into())
+    } else {
         Ok(())
     }
 }
 
-/// Outputs a single line of input, into one or more lines human readable output.
-fn print_bytes(prefix: &str, input_decoder: &MemoryDecoder, output_info: &OutputInfo) {
-    let mut first = true; // First line of a multi-format raster.
-    for f in output_info.spaced_formatters_iter() {
-        let mut output_text = String::new();
+/// Outputs a single line of input, into one or more lines human readable output.
+fn print_bytes(prefix: &str, input_decoder: &MemoryDecoder, output_info: &OutputInfo) {
+    let mut first = true; // First line of a multi-format raster.
+    for f in output_info.spaced_formatters_iter() {
+        let mut output_text = String::new();
 
-        let mut b = 0;
-        while b < input_decoder.length() {
+        let mut b = 0;
+        while b < input_decoder.length() {
             write!(
-                output_text,
+                output_text,
                 "{:>width$}",
                 "",
-                width = f.spacing[b % output_info.byte_size_block]
+                width = f.spacing[b % output_info.byte_size_block]
             )
-            .unwrap();
+            .unwrap();
 
-            match f.formatter_item_info.formatter {
-                FormatWriter::IntWriter(func) => {
-                    let p = input_decoder.read_uint(b, f.formatter_item_info.byte_size);
-                    output_text.push_str(&func(p));
+            match f.formatter_item_info.formatter {
+                FormatWriter::IntWriter(func) => {
+                    let p = input_decoder.read_uint(b, f.formatter_item_info.byte_size);
+                    output_text.push_str(&func(p));
                 }
-                FormatWriter::FloatWriter(func) => {
-                    let p = input_decoder.read_float(b, f.formatter_item_info.byte_size);
-                    output_text.push_str(&func(p));
+                FormatWriter::FloatWriter(func) => {
+                    let p = input_decoder.read_float(b, f.formatter_item_info.byte_size);
+                    output_text.push_str(&func(p));
                 }
-                FormatWriter::MultibyteWriter(func) => {
-                    output_text.push_str(&func(input_decoder.get_full_buffer(b)));
+                FormatWriter::MultibyteWriter(func) => {
+                    output_text.push_str(&func(input_decoder.get_full_buffer(b)));
                 }
             }
 
-            b += f.formatter_item_info.byte_size;
+            b += f.formatter_item_info.byte_size;
         }
 
-        if f.add_ascii_dump {
-            let missing_spacing = output_info
-                .print_width_line
-                .saturating_sub(output_text.chars().count());
+        if f.add_ascii_dump {
+            let missing_spacing = output_info
+                .print_width_line
+                .saturating_sub(output_text.chars().count());
             write!(
-                output_text,
+                output_text,
                 "{:>width$}  {}",
                 "",
-                format_ascii_dump(input_decoder.get_buffer(0)),
-                width = missing_spacing
+                format_ascii_dump(input_decoder.get_buffer(0)),
+                width = missing_spacing
             )
-            .unwrap();
+            .unwrap();
         }
 
-        if first {
-            print!("{}", prefix); // print offset
-                                  // if printing in multiple formats offset is printed only once
-            first = false;
-        } else {
-            // this takes the space of the file offset on subsequent
-            // lines of multi-format rasters.
-            print!("{:>width$}", "", width = prefix.chars().count());
+        if first {
+            print!("{}", prefix); // print offset
+                                  // if printing in multiple formats offset is printed only once
+            first = false;
+        } else {
+            // this takes the space of the file offset on subsequent
+            // lines of multi-format rasters.
+            print!("{:>width$}", "", width = prefix.chars().count());
         }
-        println!("{}", output_text);
+        println!("{}", output_text);
     }
 }
 
-/// returns a reader implementing `PeekRead + Read + HasError` providing the combined input
-///
-/// `skip_bytes` is the number of bytes skipped from the input
-/// `read_bytes` is an optional limit to the number of bytes to read
-fn open_input_peek_reader(
-    input_strings: &[String],
-    skip_bytes: u64,
-    read_bytes: Option<u64>,
-) -> PeekReader<PartialReader<MultifileReader>> {
-    // should return  "impl PeekRead + Read + HasError" when supported in (stable) rust
-    let inputs = input_strings
-        .iter()
-        .map(|w| match w as &str {
-            "-" => InputSource::Stdin,
-            x => InputSource::FileName(x),
+/// returns a reader implementing `PeekRead + Read + HasError` providing the combined input
+///
+/// `skip_bytes` is the number of bytes skipped from the input
+/// `read_bytes` is an optional limit to the number of bytes to read
+fn open_input_peek_reader(
+    input_strings: &[String],
+    skip_bytes: u64,
+    read_bytes: Option<u64>,
+) -> PeekReader<PartialReader<MultifileReader>> {
+    // should return  "impl PeekRead + Read + HasError" when supported in (stable) rust
+    let inputs = input_strings
+        .iter()
+        .map(|w| match w as &str {
+            "-" => InputSource::Stdin,
+            x => InputSource::FileName(x),
         })
-        .collect::<Vec<_>>();
+        .collect::<Vec<_>>();
 
-    let mf = MultifileReader::new(inputs);
-    let pr = PartialReader::new(mf, skip_bytes, read_bytes);
-    PeekReader::new(pr)
+    let mf = MultifileReader::new(inputs);
+    let pr = PartialReader::new(mf, skip_bytes, read_bytes);
+    PeekReader::new(pr)
 }
 
-fn format_error_message(error: &ParseSizeError, s: &str, option: &str) -> String {
-    // NOTE:
-    // GNU's od echos affected flag, -N or --read-bytes (-j or --skip-bytes, etc.), depending user's selection
-    match error {
-        ParseSizeError::InvalidSuffix(_) => {
-            format!("invalid suffix in --{} argument {}", option, s.quote())
+fn format_error_message(error: &ParseSizeError, s: &str, option: &str) -> String {
+    // NOTE:
+    // GNU's od echos affected flag, -N or --read-bytes (-j or --skip-bytes, etc.), depending user's selection
+    match error {
+        ParseSizeError::InvalidSuffix(_) => {
+            format!("invalid suffix in --{} argument {}", option, s.quote())
         }
-        ParseSizeError::ParseFailure(_) => format!("invalid --{} argument {}", option, s.quote()),
-        ParseSizeError::SizeTooBig(_) => format!("--{} argument {} too large", option, s.quote()),
+        ParseSizeError::ParseFailure(_) => format!("invalid --{} argument {}", option, s.quote()),
+        ParseSizeError::SizeTooBig(_) => format!("--{} argument {} too large", option, s.quote()),
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/output_info.rs.html b/dev/src/uu_od/output_info.rs.html index fc63e6118..d6c50bd2e 100644 --- a/dev/src/uu_od/output_info.rs.html +++ b/dev/src/uu_od/output_info.rs.html @@ -1,4 +1,4 @@ -output_info.rs - source
1
+output_info.rs - source
1
 2
 3
 4
@@ -445,452 +445,452 @@
 445
 446
 447
-
// spell-checker:ignore formatteriteminfo blocksize thisblock
+
// spell-checker:ignore formatteriteminfo blocksize thisblock
 
-use std::cmp;
-use std::slice::Iter;
+use std::cmp;
+use std::slice::Iter;
 
-use crate::formatteriteminfo::FormatterItemInfo;
-use crate::parse_formats::ParsedFormatterItemInfo;
+use crate::formatteriteminfo::FormatterItemInfo;
+use crate::parse_formats::ParsedFormatterItemInfo;
 
-/// Size in bytes of the max datatype. ie set to 16 for 128-bit numbers.
-const MAX_BYTES_PER_UNIT: usize = 8;
+/// Size in bytes of the max datatype. ie set to 16 for 128-bit numbers.
+const MAX_BYTES_PER_UNIT: usize = 8;
 
-/// Contains information to output single output line in human readable form
-pub struct SpacedFormatterItemInfo {
-    /// Contains a function pointer to output data, and information about the output format.
-    pub formatter_item_info: FormatterItemInfo,
-    /// Contains the number of spaces to add to align data with other output formats.
-    ///
-    /// If the corresponding data is a single byte, each entry in this array contains
-    /// the number of spaces to insert when outputting each byte. If the corresponding
-    /// data is multi-byte, only the fist byte position is used. For example a 32-bit
-    /// datatype, could use positions 0, 4, 8, 12, ....
-    /// As each block is formatted identically, only the spacing for a single block is set.
-    pub spacing: [usize; MAX_BYTES_PER_UNIT],
-    /// if set adds a ascii dump at the end of the line
-    pub add_ascii_dump: bool,
+/// Contains information to output single output line in human readable form
+pub struct SpacedFormatterItemInfo {
+    /// Contains a function pointer to output data, and information about the output format.
+    pub formatter_item_info: FormatterItemInfo,
+    /// Contains the number of spaces to add to align data with other output formats.
+    ///
+    /// If the corresponding data is a single byte, each entry in this array contains
+    /// the number of spaces to insert when outputting each byte. If the corresponding
+    /// data is multi-byte, only the fist byte position is used. For example a 32-bit
+    /// datatype, could use positions 0, 4, 8, 12, ....
+    /// As each block is formatted identically, only the spacing for a single block is set.
+    pub spacing: [usize; MAX_BYTES_PER_UNIT],
+    /// if set adds a ascii dump at the end of the line
+    pub add_ascii_dump: bool,
 }
 
-/// Contains information about all output lines.
-pub struct OutputInfo {
-    /// The number of bytes of a line.
-    pub byte_size_line: usize,
-    /// The width of a line in human readable format.
-    pub print_width_line: usize,
+/// Contains information about all output lines.
+pub struct OutputInfo {
+    /// The number of bytes of a line.
+    pub byte_size_line: usize,
+    /// The width of a line in human readable format.
+    pub print_width_line: usize,
 
-    /// The number of bytes in a block. (This is the size of the largest datatype in `spaced_formatters`.)
-    pub byte_size_block: usize,
-    /// The width of a block in human readable format. (The size of the largest format.)
-    pub print_width_block: usize,
-    /// All formats.
-    spaced_formatters: Vec<SpacedFormatterItemInfo>,
-    /// determines if duplicate output lines should be printed, or
-    /// skipped with a "*" showing one or more skipped lines.
-    pub output_duplicates: bool,
+    /// The number of bytes in a block. (This is the size of the largest datatype in `spaced_formatters`.)
+    pub byte_size_block: usize,
+    /// The width of a block in human readable format. (The size of the largest format.)
+    pub print_width_block: usize,
+    /// All formats.
+    spaced_formatters: Vec<SpacedFormatterItemInfo>,
+    /// determines if duplicate output lines should be printed, or
+    /// skipped with a "*" showing one or more skipped lines.
+    pub output_duplicates: bool,
 }
 
-impl OutputInfo {
-    /// Returns an iterator over the `SpacedFormatterItemInfo` vector.
-    pub fn spaced_formatters_iter(&self) -> Iter<SpacedFormatterItemInfo> {
-        self.spaced_formatters.iter()
+impl OutputInfo {
+    /// Returns an iterator over the `SpacedFormatterItemInfo` vector.
+    pub fn spaced_formatters_iter(&self) -> Iter<SpacedFormatterItemInfo> {
+        self.spaced_formatters.iter()
     }
 
-    /// Creates a new `OutputInfo` based on the parameters
-    pub fn new(
-        line_bytes: usize,
-        formats: &[ParsedFormatterItemInfo],
-        output_duplicates: bool,
-    ) -> Self {
-        let byte_size_block = formats.iter().fold(1, |max, next| {
-            cmp::max(max, next.formatter_item_info.byte_size)
+    /// Creates a new `OutputInfo` based on the parameters
+    pub fn new(
+        line_bytes: usize,
+        formats: &[ParsedFormatterItemInfo],
+        output_duplicates: bool,
+    ) -> Self {
+        let byte_size_block = formats.iter().fold(1, |max, next| {
+            cmp::max(max, next.formatter_item_info.byte_size)
         });
-        let print_width_block = formats.iter().fold(1, |max, next| {
-            cmp::max(
-                max,
-                next.formatter_item_info.print_width
-                    * (byte_size_block / next.formatter_item_info.byte_size),
+        let print_width_block = formats.iter().fold(1, |max, next| {
+            cmp::max(
+                max,
+                next.formatter_item_info.print_width
+                    * (byte_size_block / next.formatter_item_info.byte_size),
             )
         });
-        let print_width_line = print_width_block * (line_bytes / byte_size_block);
+        let print_width_line = print_width_block * (line_bytes / byte_size_block);
 
-        let spaced_formatters =
-            Self::create_spaced_formatter_info(formats, byte_size_block, print_width_block);
+        let spaced_formatters =
+            Self::create_spaced_formatter_info(formats, byte_size_block, print_width_block);
 
-        Self {
-            byte_size_line: line_bytes,
-            print_width_line,
-            byte_size_block,
-            print_width_block,
-            spaced_formatters,
-            output_duplicates,
+        Self {
+            byte_size_line: line_bytes,
+            print_width_line,
+            byte_size_block,
+            print_width_block,
+            spaced_formatters,
+            output_duplicates,
         }
     }
 
-    fn create_spaced_formatter_info(
-        formats: &[ParsedFormatterItemInfo],
-        byte_size_block: usize,
-        print_width_block: usize,
-    ) -> Vec<SpacedFormatterItemInfo> {
-        formats
-            .iter()
-            .map(|f| SpacedFormatterItemInfo {
-                formatter_item_info: f.formatter_item_info,
-                add_ascii_dump: f.add_ascii_dump,
-                spacing: Self::calculate_alignment(f, byte_size_block, print_width_block),
+    fn create_spaced_formatter_info(
+        formats: &[ParsedFormatterItemInfo],
+        byte_size_block: usize,
+        print_width_block: usize,
+    ) -> Vec<SpacedFormatterItemInfo> {
+        formats
+            .iter()
+            .map(|f| SpacedFormatterItemInfo {
+                formatter_item_info: f.formatter_item_info,
+                add_ascii_dump: f.add_ascii_dump,
+                spacing: Self::calculate_alignment(f, byte_size_block, print_width_block),
             })
-            .collect()
+            .collect()
     }
 
-    /// calculates proper alignment for a single line of output
-    ///
-    /// Multiple representations of the same data, will be right-aligned for easy reading.
-    /// For example a 64 bit octal and a 32-bit decimal with a 16-bit hexadecimal looks like this:
-    /// ```ignore
-    /// 1777777777777777777777 1777777777777777777777
-    ///  4294967295 4294967295  4294967295 4294967295
-    ///   ffff ffff  ffff ffff   ffff ffff  ffff ffff
-    /// ```
-    /// In this example is additional spacing before the first and third decimal number,
-    /// and there is additional spacing before the 1st, 3rd, 5th and 7th hexadecimal number.
-    /// This way both the octal and decimal, as well as the decimal and hexadecimal numbers
-    /// left align. Note that the alignment below both octal numbers is identical.
-    ///
-    /// This function calculates the required spacing for a single line, given the size
-    /// of a block, and the width of a block. The size of a block is the largest type
-    /// and the width is width of the the type which needs the most space to print that
-    /// number of bytes. So both numbers might refer to different types. All widths
-    /// include a space at the front. For example the width of a 8-bit hexadecimal,
-    /// is 3 characters, for example " FF".
-    ///
-    /// This algorithm first calculates how many spaces needs to be added, based the
-    /// block size and the size of the type, and the widths of the block and the type.
-    /// The required spaces are spread across the available positions.
-    /// If the blocksize is 8, and the size of the type is 8 too, there will be just
-    /// one value in a block, so all spacing will be assigned to position 0.
-    /// If the blocksize is 8, and the size of the type is 2, the spacing will be
-    /// spread across position 0, 2, 4, 6. All 4 positions will get an additional
-    /// space as long as there are more then 4 spaces available. If there are 2
-    /// spaces available, they will be assigned to position 0 and 4. If there is
-    /// 1 space available, it will be assigned to position 0. This will be combined,
-    /// For example 7 spaces will be assigned to position 0, 2, 4, 6 like: 3, 1, 2, 1.
-    /// And 7 spaces with 2 positions will be assigned to position 0 and 4 like 4, 3.
-    ///
-    /// Here is another example showing the alignment of 64-bit unsigned decimal numbers,
-    /// 32-bit hexadecimal number, 16-bit octal numbers and 8-bit hexadecimal numbers:
-    /// ```ignore
-    ///        18446744073709551615        18446744073709551615
-    ///      ffffffff      ffffffff      ffffffff      ffffffff
-    /// 177777 177777 177777 177777 177777 177777 177777 177777
-    ///  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff
-    /// ```
-    ///
-    /// This algorithm assumes the size of all types is a power of 2 (1, 2, 4, 8, 16, ...)
-    /// Increase MAX_BYTES_PER_UNIT to allow larger types.
-    fn calculate_alignment(
-        sf: &dyn TypeSizeInfo,
-        byte_size_block: usize,
-        print_width_block: usize,
-    ) -> [usize; MAX_BYTES_PER_UNIT] {
+    /// calculates proper alignment for a single line of output
+    ///
+    /// Multiple representations of the same data, will be right-aligned for easy reading.
+    /// For example a 64 bit octal and a 32-bit decimal with a 16-bit hexadecimal looks like this:
+    /// ```ignore
+    /// 1777777777777777777777 1777777777777777777777
+    ///  4294967295 4294967295  4294967295 4294967295
+    ///   ffff ffff  ffff ffff   ffff ffff  ffff ffff
+    /// ```
+    /// In this example is additional spacing before the first and third decimal number,
+    /// and there is additional spacing before the 1st, 3rd, 5th and 7th hexadecimal number.
+    /// This way both the octal and decimal, as well as the decimal and hexadecimal numbers
+    /// left align. Note that the alignment below both octal numbers is identical.
+    ///
+    /// This function calculates the required spacing for a single line, given the size
+    /// of a block, and the width of a block. The size of a block is the largest type
+    /// and the width is width of the the type which needs the most space to print that
+    /// number of bytes. So both numbers might refer to different types. All widths
+    /// include a space at the front. For example the width of a 8-bit hexadecimal,
+    /// is 3 characters, for example " FF".
+    ///
+    /// This algorithm first calculates how many spaces needs to be added, based the
+    /// block size and the size of the type, and the widths of the block and the type.
+    /// The required spaces are spread across the available positions.
+    /// If the blocksize is 8, and the size of the type is 8 too, there will be just
+    /// one value in a block, so all spacing will be assigned to position 0.
+    /// If the blocksize is 8, and the size of the type is 2, the spacing will be
+    /// spread across position 0, 2, 4, 6. All 4 positions will get an additional
+    /// space as long as there are more then 4 spaces available. If there are 2
+    /// spaces available, they will be assigned to position 0 and 4. If there is
+    /// 1 space available, it will be assigned to position 0. This will be combined,
+    /// For example 7 spaces will be assigned to position 0, 2, 4, 6 like: 3, 1, 2, 1.
+    /// And 7 spaces with 2 positions will be assigned to position 0 and 4 like 4, 3.
+    ///
+    /// Here is another example showing the alignment of 64-bit unsigned decimal numbers,
+    /// 32-bit hexadecimal number, 16-bit octal numbers and 8-bit hexadecimal numbers:
+    /// ```ignore
+    ///        18446744073709551615        18446744073709551615
+    ///      ffffffff      ffffffff      ffffffff      ffffffff
+    /// 177777 177777 177777 177777 177777 177777 177777 177777
+    ///  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff
+    /// ```
+    ///
+    /// This algorithm assumes the size of all types is a power of 2 (1, 2, 4, 8, 16, ...)
+    /// Increase MAX_BYTES_PER_UNIT to allow larger types.
+    fn calculate_alignment(
+        sf: &dyn TypeSizeInfo,
+        byte_size_block: usize,
+        print_width_block: usize,
+    ) -> [usize; MAX_BYTES_PER_UNIT] {
         assert!(
-            byte_size_block <= MAX_BYTES_PER_UNIT,
+            byte_size_block <= MAX_BYTES_PER_UNIT,
             "{}-bits types are unsupported. Current max={}-bits.",
-            8 * byte_size_block,
-            8 * MAX_BYTES_PER_UNIT
+            8 * byte_size_block,
+            8 * MAX_BYTES_PER_UNIT
         );
-        let mut spacing = [0; MAX_BYTES_PER_UNIT];
+        let mut spacing = [0; MAX_BYTES_PER_UNIT];
 
-        let mut byte_size = sf.byte_size();
-        let mut items_in_block = byte_size_block / byte_size;
-        let thisblock_width = sf.print_width() * items_in_block;
-        let mut missing_spacing = print_width_block - thisblock_width;
+        let mut byte_size = sf.byte_size();
+        let mut items_in_block = byte_size_block / byte_size;
+        let thisblock_width = sf.print_width() * items_in_block;
+        let mut missing_spacing = print_width_block - thisblock_width;
 
-        while items_in_block > 0 {
-            let avg_spacing: usize = missing_spacing / items_in_block;
-            for i in 0..items_in_block {
-                spacing[i * byte_size] += avg_spacing;
-                missing_spacing -= avg_spacing;
+        while items_in_block > 0 {
+            let avg_spacing: usize = missing_spacing / items_in_block;
+            for i in 0..items_in_block {
+                spacing[i * byte_size] += avg_spacing;
+                missing_spacing -= avg_spacing;
             }
 
-            items_in_block /= 2;
-            byte_size *= 2;
+            items_in_block /= 2;
+            byte_size *= 2;
         }
 
-        spacing
+        spacing
     }
 }
 
-trait TypeSizeInfo {
-    fn byte_size(&self) -> usize;
-    fn print_width(&self) -> usize;
+trait TypeSizeInfo {
+    fn byte_size(&self) -> usize;
+    fn print_width(&self) -> usize;
 }
 
-impl TypeSizeInfo for ParsedFormatterItemInfo {
-    fn byte_size(&self) -> usize {
-        self.formatter_item_info.byte_size
+impl TypeSizeInfo for ParsedFormatterItemInfo {
+    fn byte_size(&self) -> usize {
+        self.formatter_item_info.byte_size
     }
-    fn print_width(&self) -> usize {
-        self.formatter_item_info.print_width
+    fn print_width(&self) -> usize {
+        self.formatter_item_info.print_width
     }
 }
 
-#[cfg(test)]
-struct TypeInfo {
-    byte_size: usize,
-    print_width: usize,
+#[cfg(test)]
+struct TypeInfo {
+    byte_size: usize,
+    print_width: usize,
 }
 
-#[cfg(test)]
-impl TypeSizeInfo for TypeInfo {
-    fn byte_size(&self) -> usize {
-        self.byte_size
+#[cfg(test)]
+impl TypeSizeInfo for TypeInfo {
+    fn byte_size(&self) -> usize {
+        self.byte_size
     }
-    fn print_width(&self) -> usize {
-        self.print_width
+    fn print_width(&self) -> usize {
+        self.print_width
     }
 }
 
-#[test]
-fn test_calculate_alignment() {
-    // For this example `byte_size_block` is 8 and 'print_width_block' is 23:
-    // 1777777777777777777777 1777777777777777777777
-    //  4294967295 4294967295  4294967295 4294967295
-    //   ffff ffff  ffff ffff   ffff ffff  ffff ffff
+#[test]
+fn test_calculate_alignment() {
+    // For this example `byte_size_block` is 8 and 'print_width_block' is 23:
+    // 1777777777777777777777 1777777777777777777777
+    //  4294967295 4294967295  4294967295 4294967295
+    //   ffff ffff  ffff ffff   ffff ffff  ffff ffff
 
-    // the first line has no additional spacing:
-    assert_eq!(
+    // the first line has no additional spacing:
+    assert_eq!(
         [0, 0, 0, 0, 0, 0, 0, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 8,
-                print_width: 23,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 8,
+                print_width: 23,
             },
             8,
-            23
-        )
+            23
+        )
     );
-    // the second line a single space at the start of the block:
-    assert_eq!(
+    // the second line a single space at the start of the block:
+    assert_eq!(
         [1, 0, 0, 0, 0, 0, 0, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 4,
-                print_width: 11,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 4,
+                print_width: 11,
             },
             8,
-            23
-        )
+            23
+        )
     );
-    // the third line two spaces at pos 0, and 1 space at pos 4:
-    assert_eq!(
+    // the third line two spaces at pos 0, and 1 space at pos 4:
+    assert_eq!(
         [2, 0, 0, 0, 1, 0, 0, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 2,
-                print_width: 5,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 2,
+                print_width: 5,
             },
             8,
-            23
-        )
+            23
+        )
     );
 
-    // For this example `byte_size_block` is 8 and 'print_width_block' is 28:
-    //        18446744073709551615        18446744073709551615
-    //      ffffffff      ffffffff      ffffffff      ffffffff
-    // 177777 177777 177777 177777 177777 177777 177777 177777
-    //  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff
+    // For this example `byte_size_block` is 8 and 'print_width_block' is 28:
+    //        18446744073709551615        18446744073709551615
+    //      ffffffff      ffffffff      ffffffff      ffffffff
+    // 177777 177777 177777 177777 177777 177777 177777 177777
+    //  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff  ff ff
 
-    assert_eq!(
+    assert_eq!(
         [7, 0, 0, 0, 0, 0, 0, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 8,
-                print_width: 21,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 8,
+                print_width: 21,
             },
             8,
-            28
-        )
+            28
+        )
     );
     assert_eq!(
         [5, 0, 0, 0, 5, 0, 0, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 4,
-                print_width: 9,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 4,
+                print_width: 9,
             },
             8,
-            28
-        )
+            28
+        )
     );
     assert_eq!(
         [0, 0, 0, 0, 0, 0, 0, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 2,
-                print_width: 7,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 2,
+                print_width: 7,
             },
             8,
-            28
-        )
+            28
+        )
     );
     assert_eq!(
         [1, 0, 1, 0, 1, 0, 1, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 3,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 3,
             },
             8,
-            28
-        )
+            28
+        )
     );
 
-    // 9 tests where 8 .. 16 spaces are spread across 8 positions
-    assert_eq!(
+    // 9 tests where 8 .. 16 spaces are spread across 8 positions
+    assert_eq!(
         [1, 1, 1, 1, 1, 1, 1, 1],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 8
-        )
+            16 + 8
+        )
     );
     assert_eq!(
         [2, 1, 1, 1, 1, 1, 1, 1],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 9
-        )
+            16 + 9
+        )
     );
     assert_eq!(
         [2, 1, 1, 1, 2, 1, 1, 1],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 10
-        )
+            16 + 10
+        )
     );
     assert_eq!(
         [3, 1, 1, 1, 2, 1, 1, 1],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 11
-        )
+            16 + 11
+        )
     );
     assert_eq!(
         [2, 1, 2, 1, 2, 1, 2, 1],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 12
-        )
+            16 + 12
+        )
     );
     assert_eq!(
         [3, 1, 2, 1, 2, 1, 2, 1],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 13
-        )
+            16 + 13
+        )
     );
     assert_eq!(
         [3, 1, 2, 1, 3, 1, 2, 1],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 14
-        )
+            16 + 14
+        )
     );
     assert_eq!(
         [4, 1, 2, 1, 3, 1, 2, 1],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 15
-        )
+            16 + 15
+        )
     );
     assert_eq!(
         [2, 2, 2, 2, 2, 2, 2, 2],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 16
-        )
+            16 + 16
+        )
     );
 
-    // 4 tests where 15 spaces are spread across 8, 4, 2 or 1 position(s)
-    assert_eq!(
+    // 4 tests where 15 spaces are spread across 8, 4, 2 or 1 position(s)
+    assert_eq!(
         [4, 1, 2, 1, 3, 1, 2, 1],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 1,
-                print_width: 2,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 1,
+                print_width: 2,
             },
             8,
-            16 + 15
-        )
+            16 + 15
+        )
     );
     assert_eq!(
         [5, 0, 3, 0, 4, 0, 3, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 2,
-                print_width: 4,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 2,
+                print_width: 4,
             },
             8,
-            16 + 15
-        )
+            16 + 15
+        )
     );
     assert_eq!(
         [8, 0, 0, 0, 7, 0, 0, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 4,
-                print_width: 8,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 4,
+                print_width: 8,
             },
             8,
-            16 + 15
-        )
+            16 + 15
+        )
     );
     assert_eq!(
         [15, 0, 0, 0, 0, 0, 0, 0],
-        OutputInfo::calculate_alignment(
-            &TypeInfo {
-                byte_size: 8,
-                print_width: 16,
+        OutputInfo::calculate_alignment(
+            &TypeInfo {
+                byte_size: 8,
+                print_width: 16,
             },
             8,
-            16 + 15
-        )
+            16 + 15
+        )
     );
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/parse_formats.rs.html b/dev/src/uu_od/parse_formats.rs.html index 34aa088e4..7e8251cf6 100644 --- a/dev/src/uu_od/parse_formats.rs.html +++ b/dev/src/uu_od/parse_formats.rs.html @@ -1,4 +1,4 @@ -parse_formats.rs - source
1
+parse_formats.rs - source
1
 2
 3
 4
@@ -537,544 +537,544 @@
 537
 538
 539
-
// spell-checker:ignore formatteriteminfo docopt fvox fvoxw vals acdx
+
// spell-checker:ignore formatteriteminfo docopt fvox fvoxw vals acdx
 
-use uucore::display::Quotable;
+use uucore::display::Quotable;
 
-use crate::formatteriteminfo::FormatterItemInfo;
-use crate::prn_char::*;
-use crate::prn_float::*;
-use crate::prn_int::*;
+use crate::formatteriteminfo::FormatterItemInfo;
+use crate::prn_char::*;
+use crate::prn_float::*;
+use crate::prn_int::*;
 
-#[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub struct ParsedFormatterItemInfo {
-    pub formatter_item_info: FormatterItemInfo,
-    pub add_ascii_dump: bool,
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+pub struct ParsedFormatterItemInfo {
+    pub formatter_item_info: FormatterItemInfo,
+    pub add_ascii_dump: bool,
 }
 
-impl ParsedFormatterItemInfo {
-    pub fn new(formatter_item_info: FormatterItemInfo, add_ascii_dump: bool) -> Self {
-        Self {
-            formatter_item_info,
-            add_ascii_dump,
+impl ParsedFormatterItemInfo {
+    pub fn new(formatter_item_info: FormatterItemInfo, add_ascii_dump: bool) -> Self {
+        Self {
+            formatter_item_info,
+            add_ascii_dump,
         }
     }
 }
 
-fn od_argument_traditional_format(ch: char) -> Option<FormatterItemInfo> {
-    match ch {
-        'a' => Some(FORMAT_ITEM_A),
-        'B' => Some(FORMAT_ITEM_OCT16),
-        'b' => Some(FORMAT_ITEM_OCT8),
-        'c' => Some(FORMAT_ITEM_C),
-        'D' => Some(FORMAT_ITEM_DEC32U),
-        'd' => Some(FORMAT_ITEM_DEC16U),
-        'e' => Some(FORMAT_ITEM_F64),
-        'F' => Some(FORMAT_ITEM_F64),
-        'f' => Some(FORMAT_ITEM_F32),
-        'H' => Some(FORMAT_ITEM_HEX32),
-        'h' => Some(FORMAT_ITEM_HEX16),
-        'i' => Some(FORMAT_ITEM_DEC32S),
-        'I' => Some(FORMAT_ITEM_DEC64S),
-        'L' => Some(FORMAT_ITEM_DEC64S),
-        'l' => Some(FORMAT_ITEM_DEC64S),
-        'O' => Some(FORMAT_ITEM_OCT32),
-        'o' => Some(FORMAT_ITEM_OCT16),
-        's' => Some(FORMAT_ITEM_DEC16S),
-        'X' => Some(FORMAT_ITEM_HEX32),
-        'x' => Some(FORMAT_ITEM_HEX16),
-        _ => None,
+fn od_argument_traditional_format(ch: char) -> Option<FormatterItemInfo> {
+    match ch {
+        'a' => Some(FORMAT_ITEM_A),
+        'B' => Some(FORMAT_ITEM_OCT16),
+        'b' => Some(FORMAT_ITEM_OCT8),
+        'c' => Some(FORMAT_ITEM_C),
+        'D' => Some(FORMAT_ITEM_DEC32U),
+        'd' => Some(FORMAT_ITEM_DEC16U),
+        'e' => Some(FORMAT_ITEM_F64),
+        'F' => Some(FORMAT_ITEM_F64),
+        'f' => Some(FORMAT_ITEM_F32),
+        'H' => Some(FORMAT_ITEM_HEX32),
+        'h' => Some(FORMAT_ITEM_HEX16),
+        'i' => Some(FORMAT_ITEM_DEC32S),
+        'I' => Some(FORMAT_ITEM_DEC64S),
+        'L' => Some(FORMAT_ITEM_DEC64S),
+        'l' => Some(FORMAT_ITEM_DEC64S),
+        'O' => Some(FORMAT_ITEM_OCT32),
+        'o' => Some(FORMAT_ITEM_OCT16),
+        's' => Some(FORMAT_ITEM_DEC16S),
+        'X' => Some(FORMAT_ITEM_HEX32),
+        'x' => Some(FORMAT_ITEM_HEX16),
+        _ => None,
     }
 }
 
-fn od_format_type(type_char: FormatType, byte_size: u8) -> Option<FormatterItemInfo> {
-    match (type_char, byte_size) {
-        (FormatType::Ascii, _) => Some(FORMAT_ITEM_A),
-        (FormatType::Char, _) => Some(FORMAT_ITEM_C),
+fn od_format_type(type_char: FormatType, byte_size: u8) -> Option<FormatterItemInfo> {
+    match (type_char, byte_size) {
+        (FormatType::Ascii, _) => Some(FORMAT_ITEM_A),
+        (FormatType::Char, _) => Some(FORMAT_ITEM_C),
 
-        (FormatType::DecimalInt, 1) => Some(FORMAT_ITEM_DEC8S),
-        (FormatType::DecimalInt, 2) => Some(FORMAT_ITEM_DEC16S),
-        (FormatType::DecimalInt, 0) | (FormatType::DecimalInt, 4) => Some(FORMAT_ITEM_DEC32S),
-        (FormatType::DecimalInt, 8) => Some(FORMAT_ITEM_DEC64S),
+        (FormatType::DecimalInt, 1) => Some(FORMAT_ITEM_DEC8S),
+        (FormatType::DecimalInt, 2) => Some(FORMAT_ITEM_DEC16S),
+        (FormatType::DecimalInt, 0) | (FormatType::DecimalInt, 4) => Some(FORMAT_ITEM_DEC32S),
+        (FormatType::DecimalInt, 8) => Some(FORMAT_ITEM_DEC64S),
 
-        (FormatType::OctalInt, 1) => Some(FORMAT_ITEM_OCT8),
-        (FormatType::OctalInt, 2) => Some(FORMAT_ITEM_OCT16),
-        (FormatType::OctalInt, 0) | (FormatType::OctalInt, 4) => Some(FORMAT_ITEM_OCT32),
-        (FormatType::OctalInt, 8) => Some(FORMAT_ITEM_OCT64),
+        (FormatType::OctalInt, 1) => Some(FORMAT_ITEM_OCT8),
+        (FormatType::OctalInt, 2) => Some(FORMAT_ITEM_OCT16),
+        (FormatType::OctalInt, 0) | (FormatType::OctalInt, 4) => Some(FORMAT_ITEM_OCT32),
+        (FormatType::OctalInt, 8) => Some(FORMAT_ITEM_OCT64),
 
-        (FormatType::UnsignedInt, 1) => Some(FORMAT_ITEM_DEC8U),
-        (FormatType::UnsignedInt, 2) => Some(FORMAT_ITEM_DEC16U),
-        (FormatType::UnsignedInt, 0) | (FormatType::UnsignedInt, 4) => Some(FORMAT_ITEM_DEC32U),
-        (FormatType::UnsignedInt, 8) => Some(FORMAT_ITEM_DEC64U),
+        (FormatType::UnsignedInt, 1) => Some(FORMAT_ITEM_DEC8U),
+        (FormatType::UnsignedInt, 2) => Some(FORMAT_ITEM_DEC16U),
+        (FormatType::UnsignedInt, 0) | (FormatType::UnsignedInt, 4) => Some(FORMAT_ITEM_DEC32U),
+        (FormatType::UnsignedInt, 8) => Some(FORMAT_ITEM_DEC64U),
 
-        (FormatType::HexadecimalInt, 1) => Some(FORMAT_ITEM_HEX8),
-        (FormatType::HexadecimalInt, 2) => Some(FORMAT_ITEM_HEX16),
-        (FormatType::HexadecimalInt, 0) | (FormatType::HexadecimalInt, 4) => {
-            Some(FORMAT_ITEM_HEX32)
+        (FormatType::HexadecimalInt, 1) => Some(FORMAT_ITEM_HEX8),
+        (FormatType::HexadecimalInt, 2) => Some(FORMAT_ITEM_HEX16),
+        (FormatType::HexadecimalInt, 0) | (FormatType::HexadecimalInt, 4) => {
+            Some(FORMAT_ITEM_HEX32)
         }
-        (FormatType::HexadecimalInt, 8) => Some(FORMAT_ITEM_HEX64),
+        (FormatType::HexadecimalInt, 8) => Some(FORMAT_ITEM_HEX64),
 
-        (FormatType::Float, 2) => Some(FORMAT_ITEM_F16),
-        (FormatType::Float, 0) | (FormatType::Float, 4) => Some(FORMAT_ITEM_F32),
-        (FormatType::Float, 8) => Some(FORMAT_ITEM_F64),
+        (FormatType::Float, 2) => Some(FORMAT_ITEM_F16),
+        (FormatType::Float, 0) | (FormatType::Float, 4) => Some(FORMAT_ITEM_F32),
+        (FormatType::Float, 8) => Some(FORMAT_ITEM_F64),
 
-        _ => None,
+        _ => None,
     }
 }
 
-fn od_argument_with_option(ch: char) -> bool {
-    matches!(ch, 'A' | 'j' | 'N' | 'S' | 'w')
+fn od_argument_with_option(ch: char) -> bool {
+    matches!(ch, 'A' | 'j' | 'N' | 'S' | 'w')
 }
 
-/// Parses format flags from command line
-///
-/// getopts, docopt, clap don't seem suitable to parse the command line
-/// arguments used for formats. In particular arguments can appear
-/// multiple times and the order they appear in, is significant.
-///
-/// arguments like -f, -o, -x can appear separate or combined: -fox
-/// it can also be mixed with non format related flags like -v: -fvox
-/// arguments with parameters like -w16 can only appear at the end: -fvoxw16
-/// parameters of -t/--format specify 1 or more formats.
-/// if -- appears on the command line, parsing should stop.
-pub fn parse_format_flags(args: &[String]) -> Result<Vec<ParsedFormatterItemInfo>, String> {
-    let mut formats = Vec::new();
+/// Parses format flags from command line
+///
+/// getopts, docopt, clap don't seem suitable to parse the command line
+/// arguments used for formats. In particular arguments can appear
+/// multiple times and the order they appear in, is significant.
+///
+/// arguments like -f, -o, -x can appear separate or combined: -fox
+/// it can also be mixed with non format related flags like -v: -fvox
+/// arguments with parameters like -w16 can only appear at the end: -fvoxw16
+/// parameters of -t/--format specify 1 or more formats.
+/// if -- appears on the command line, parsing should stop.
+pub fn parse_format_flags(args: &[String]) -> Result<Vec<ParsedFormatterItemInfo>, String> {
+    let mut formats = Vec::new();
 
-    // args[0] is the name of the binary
-    let arg_iter = args.iter().skip(1);
-    let mut expect_type_string = false;
+    // args[0] is the name of the binary
+    let arg_iter = args.iter().skip(1);
+    let mut expect_type_string = false;
 
-    for arg in arg_iter {
-        if expect_type_string {
-            let v = parse_type_string(arg)?;
-            formats.extend(v.into_iter());
-            expect_type_string = false;
-        } else if arg.starts_with("--") {
-            if arg.len() == 2 {
+    for arg in arg_iter {
+        if expect_type_string {
+            let v = parse_type_string(arg)?;
+            formats.extend(v.into_iter());
+            expect_type_string = false;
+        } else if arg.starts_with("--") {
+            if arg.len() == 2 {
                 break;
             }
-            if arg.starts_with("--format=") {
-                let params: String = arg.chars().skip_while(|c| *c != '=').skip(1).collect();
-                let v = parse_type_string(&params)?;
-                formats.extend(v.into_iter());
+            if arg.starts_with("--format=") {
+                let params: String = arg.chars().skip_while(|c| *c != '=').skip(1).collect();
+                let v = parse_type_string(&params)?;
+                formats.extend(v.into_iter());
             }
-            if arg == "--format" {
-                expect_type_string = true;
+            if arg == "--format" {
+                expect_type_string = true;
             }
-        } else if arg.starts_with('-') {
-            let flags = arg.chars().skip(1);
-            let mut format_spec = String::new();
-            for c in flags {
-                if expect_type_string {
-                    format_spec.push(c);
-                } else if od_argument_with_option(c) {
+        } else if arg.starts_with('-') {
+            let flags = arg.chars().skip(1);
+            let mut format_spec = String::new();
+            for c in flags {
+                if expect_type_string {
+                    format_spec.push(c);
+                } else if od_argument_with_option(c) {
                     break;
-                } else if c == 't' {
-                    expect_type_string = true;
-                } else {
-                    // not every option is a format
-                    if let Some(r) = od_argument_traditional_format(c) {
-                        formats.push(ParsedFormatterItemInfo::new(r, false));
+                } else if c == 't' {
+                    expect_type_string = true;
+                } else {
+                    // not every option is a format
+                    if let Some(r) = od_argument_traditional_format(c) {
+                        formats.push(ParsedFormatterItemInfo::new(r, false));
                     }
                 }
             }
-            if !format_spec.is_empty() {
-                let v = parse_type_string(&format_spec)?;
-                formats.extend(v.into_iter());
-                expect_type_string = false;
+            if !format_spec.is_empty() {
+                let v = parse_type_string(&format_spec)?;
+                formats.extend(v.into_iter());
+                expect_type_string = false;
             }
         }
     }
-    if expect_type_string {
-        return Err("missing format specification after '--format' / '-t'".to_string());
+    if expect_type_string {
+        return Err("missing format specification after '--format' / '-t'".to_string());
     }
 
-    if formats.is_empty() {
-        formats.push(ParsedFormatterItemInfo::new(FORMAT_ITEM_OCT16, false)); // 2 byte octal is the default
-    }
+    if formats.is_empty() {
+        formats.push(ParsedFormatterItemInfo::new(FORMAT_ITEM_OCT16, false)); // 2 byte octal is the default
+    }
 
-    Ok(formats)
+    Ok(formats)
 }
 
-#[derive(PartialEq, Eq, Debug, Copy, Clone)]
-enum FormatType {
-    Ascii,
-    Char,
-    DecimalInt,
-    OctalInt,
-    UnsignedInt,
-    HexadecimalInt,
-    Float,
+#[derive(PartialEq, Eq, Debug, Copy, Clone)]
+enum FormatType {
+    Ascii,
+    Char,
+    DecimalInt,
+    OctalInt,
+    UnsignedInt,
+    HexadecimalInt,
+    Float,
 }
 
-#[derive(PartialEq, Eq, Debug, Copy, Clone)]
-enum FormatTypeCategory {
-    Char,
-    Integer,
-    Float,
+#[derive(PartialEq, Eq, Debug, Copy, Clone)]
+enum FormatTypeCategory {
+    Char,
+    Integer,
+    Float,
 }
 
-fn format_type(ch: char) -> Option<FormatType> {
-    match ch {
-        'a' => Some(FormatType::Ascii),
-        'c' => Some(FormatType::Char),
-        'd' => Some(FormatType::DecimalInt),
-        'o' => Some(FormatType::OctalInt),
-        'u' => Some(FormatType::UnsignedInt),
-        'x' => Some(FormatType::HexadecimalInt),
-        'f' => Some(FormatType::Float),
-        _ => None,
+fn format_type(ch: char) -> Option<FormatType> {
+    match ch {
+        'a' => Some(FormatType::Ascii),
+        'c' => Some(FormatType::Char),
+        'd' => Some(FormatType::DecimalInt),
+        'o' => Some(FormatType::OctalInt),
+        'u' => Some(FormatType::UnsignedInt),
+        'x' => Some(FormatType::HexadecimalInt),
+        'f' => Some(FormatType::Float),
+        _ => None,
     }
 }
 
-fn format_type_category(t: FormatType) -> FormatTypeCategory {
-    match t {
-        FormatType::Ascii | FormatType::Char => FormatTypeCategory::Char,
-        FormatType::DecimalInt
-        | FormatType::OctalInt
-        | FormatType::UnsignedInt
-        | FormatType::HexadecimalInt => FormatTypeCategory::Integer,
-        FormatType::Float => FormatTypeCategory::Float,
+fn format_type_category(t: FormatType) -> FormatTypeCategory {
+    match t {
+        FormatType::Ascii | FormatType::Char => FormatTypeCategory::Char,
+        FormatType::DecimalInt
+        | FormatType::OctalInt
+        | FormatType::UnsignedInt
+        | FormatType::HexadecimalInt => FormatTypeCategory::Integer,
+        FormatType::Float => FormatTypeCategory::Float,
     }
 }
 
-fn is_format_size_char(
-    ch: Option<char>,
-    format_type: FormatTypeCategory,
-    byte_size: &mut u8,
-) -> bool {
-    match (format_type, ch) {
-        (FormatTypeCategory::Integer, Some('C')) => {
-            *byte_size = 1;
-            true
-        }
-        (FormatTypeCategory::Integer, Some('S')) => {
-            *byte_size = 2;
-            true
-        }
-        (FormatTypeCategory::Integer, Some('I')) => {
-            *byte_size = 4;
-            true
-        }
-        (FormatTypeCategory::Integer, Some('L')) => {
-            *byte_size = 8;
-            true
-        }
+fn is_format_size_char(
+    ch: Option<char>,
+    format_type: FormatTypeCategory,
+    byte_size: &mut u8,
+) -> bool {
+    match (format_type, ch) {
+        (FormatTypeCategory::Integer, Some('C')) => {
+            *byte_size = 1;
+            true
+        }
+        (FormatTypeCategory::Integer, Some('S')) => {
+            *byte_size = 2;
+            true
+        }
+        (FormatTypeCategory::Integer, Some('I')) => {
+            *byte_size = 4;
+            true
+        }
+        (FormatTypeCategory::Integer, Some('L')) => {
+            *byte_size = 8;
+            true
+        }
 
-        (FormatTypeCategory::Float, Some('F')) => {
-            *byte_size = 4;
-            true
-        }
-        (FormatTypeCategory::Float, Some('D')) => {
-            *byte_size = 8;
-            true
-        }
-        // FormatTypeCategory::Float, 'L' => *byte_size = 16, // TODO support f128
-        _ => false,
+        (FormatTypeCategory::Float, Some('F')) => {
+            *byte_size = 4;
+            true
+        }
+        (FormatTypeCategory::Float, Some('D')) => {
+            *byte_size = 8;
+            true
+        }
+        // FormatTypeCategory::Float, 'L' => *byte_size = 16, // TODO support f128
+        _ => false,
     }
 }
 
-fn is_format_size_decimal(
-    ch: Option<char>,
-    format_type: FormatTypeCategory,
-    decimal_size: &mut String,
-) -> bool {
-    if format_type == FormatTypeCategory::Char {
-        return false;
+fn is_format_size_decimal(
+    ch: Option<char>,
+    format_type: FormatTypeCategory,
+    decimal_size: &mut String,
+) -> bool {
+    if format_type == FormatTypeCategory::Char {
+        return false;
     }
-    match ch {
-        Some(d) if d.is_ascii_digit() => {
-            decimal_size.push(d);
-            true
-        }
-        _ => false,
+    match ch {
+        Some(d) if d.is_ascii_digit() => {
+            decimal_size.push(d);
+            true
+        }
+        _ => false,
     }
 }
 
-fn is_format_dump_char(ch: Option<char>, show_ascii_dump: &mut bool) -> bool {
-    match ch {
+fn is_format_dump_char(ch: Option<char>, show_ascii_dump: &mut bool) -> bool {
+    match ch {
         Some('z') => {
-            *show_ascii_dump = true;
-            true
-        }
-        _ => false,
+            *show_ascii_dump = true;
+            true
+        }
+        _ => false,
     }
 }
 
-fn parse_type_string(params: &str) -> Result<Vec<ParsedFormatterItemInfo>, String> {
-    let mut formats = Vec::new();
+fn parse_type_string(params: &str) -> Result<Vec<ParsedFormatterItemInfo>, String> {
+    let mut formats = Vec::new();
 
-    let mut chars = params.chars();
-    let mut ch = chars.next();
+    let mut chars = params.chars();
+    let mut ch = chars.next();
 
-    while let Some(type_char) = ch {
-        let type_char = format_type(type_char).ok_or_else(|| {
+    while let Some(type_char) = ch {
+        let type_char = format_type(type_char).ok_or_else(|| {
             format!(
                 "unexpected char '{}' in format specification {}",
-                type_char,
-                params.quote()
+                type_char,
+                params.quote()
             )
         })?;
 
-        let type_cat = format_type_category(type_char);
+        let type_cat = format_type_category(type_char);
 
-        ch = chars.next();
+        ch = chars.next();
 
-        let mut byte_size = 0u8;
-        let mut show_ascii_dump = false;
-        if is_format_size_char(ch, type_cat, &mut byte_size) {
-            ch = chars.next();
-        } else {
-            let mut decimal_size = String::new();
-            while is_format_size_decimal(ch, type_cat, &mut decimal_size) {
-                ch = chars.next();
+        let mut byte_size = 0u8;
+        let mut show_ascii_dump = false;
+        if is_format_size_char(ch, type_cat, &mut byte_size) {
+            ch = chars.next();
+        } else {
+            let mut decimal_size = String::new();
+            while is_format_size_decimal(ch, type_cat, &mut decimal_size) {
+                ch = chars.next();
             }
-            if !decimal_size.is_empty() {
-                byte_size = decimal_size.parse().map_err(|_| {
+            if !decimal_size.is_empty() {
+                byte_size = decimal_size.parse().map_err(|_| {
                     format!(
                         "invalid number {} in format specification {}",
-                        decimal_size.quote(),
-                        params.quote()
+                        decimal_size.quote(),
+                        params.quote()
                     )
                 })?;
             }
         }
-        if is_format_dump_char(ch, &mut show_ascii_dump) {
-            ch = chars.next();
+        if is_format_dump_char(ch, &mut show_ascii_dump) {
+            ch = chars.next();
         }
 
-        let ft = od_format_type(type_char, byte_size).ok_or_else(|| {
+        let ft = od_format_type(type_char, byte_size).ok_or_else(|| {
             format!(
                 "invalid size '{}' in format specification {}",
-                byte_size,
-                params.quote()
+                byte_size,
+                params.quote()
             )
         })?;
-        formats.push(ParsedFormatterItemInfo::new(ft, show_ascii_dump));
+        formats.push(ParsedFormatterItemInfo::new(ft, show_ascii_dump));
     }
 
-    Ok(formats)
+    Ok(formats)
 }
 
-#[cfg(test)]
-pub fn parse_format_flags_str(args_str: &[&'static str]) -> Result<Vec<FormatterItemInfo>, String> {
-    let args: Vec<String> = args_str.iter().map(|s| s.to_string()).collect();
-    parse_format_flags(&args).map(|v| {
-        // tests using this function assume add_ascii_dump is not set
-        v.into_iter()
-            .inspect(|f| assert!(!f.add_ascii_dump))
-            .map(|f| f.formatter_item_info)
-            .collect()
+#[cfg(test)]
+pub fn parse_format_flags_str(args_str: &[&'static str]) -> Result<Vec<FormatterItemInfo>, String> {
+    let args: Vec<String> = args_str.iter().map(|s| s.to_string()).collect();
+    parse_format_flags(&args).map(|v| {
+        // tests using this function assume add_ascii_dump is not set
+        v.into_iter()
+            .inspect(|f| assert!(!f.add_ascii_dump))
+            .map(|f| f.formatter_item_info)
+            .collect()
     })
 }
 
-#[test]
-fn test_no_options() {
+#[test]
+fn test_no_options() {
     assert_eq!(
-        parse_format_flags_str(&["od"]).unwrap(),
-        vec![FORMAT_ITEM_OCT16]
+        parse_format_flags_str(&["od"]).unwrap(),
+        vec![FORMAT_ITEM_OCT16]
     );
 }
 
-#[test]
-fn test_one_option() {
+#[test]
+fn test_one_option() {
     assert_eq!(
-        parse_format_flags_str(&["od", "-F"]).unwrap(),
-        vec![FORMAT_ITEM_F64]
+        parse_format_flags_str(&["od", "-F"]).unwrap(),
+        vec![FORMAT_ITEM_F64]
     );
 }
 
-#[test]
-fn test_two_separate_options() {
+#[test]
+fn test_two_separate_options() {
     assert_eq!(
-        parse_format_flags_str(&["od", "-F", "-x"]).unwrap(),
-        vec![FORMAT_ITEM_F64, FORMAT_ITEM_HEX16]
+        parse_format_flags_str(&["od", "-F", "-x"]).unwrap(),
+        vec![FORMAT_ITEM_F64, FORMAT_ITEM_HEX16]
     );
 }
 
-#[test]
-fn test_two_combined_options() {
+#[test]
+fn test_two_combined_options() {
     assert_eq!(
-        parse_format_flags_str(&["od", "-Fx"]).unwrap(),
-        vec![FORMAT_ITEM_F64, FORMAT_ITEM_HEX16]
+        parse_format_flags_str(&["od", "-Fx"]).unwrap(),
+        vec![FORMAT_ITEM_F64, FORMAT_ITEM_HEX16]
     );
 }
 
-#[test]
-fn test_ignore_non_format_parameters() {
+#[test]
+fn test_ignore_non_format_parameters() {
     assert_eq!(
-        parse_format_flags_str(&["od", "-d", "-Ax"]).unwrap(),
-        vec![FORMAT_ITEM_DEC16U]
+        parse_format_flags_str(&["od", "-d", "-Ax"]).unwrap(),
+        vec![FORMAT_ITEM_DEC16U]
     );
 }
 
-#[test]
-fn test_ignore_separate_parameters() {
+#[test]
+fn test_ignore_separate_parameters() {
     assert_eq!(
-        parse_format_flags_str(&["od", "-I", "-A", "x"]).unwrap(),
-        vec![FORMAT_ITEM_DEC64S]
+        parse_format_flags_str(&["od", "-I", "-A", "x"]).unwrap(),
+        vec![FORMAT_ITEM_DEC64S]
     );
 }
 
-#[test]
-fn test_ignore_trailing_vals() {
+#[test]
+fn test_ignore_trailing_vals() {
     assert_eq!(
-        parse_format_flags_str(&["od", "-D", "--", "-x"]).unwrap(),
-        vec![FORMAT_ITEM_DEC32U]
+        parse_format_flags_str(&["od", "-D", "--", "-x"]).unwrap(),
+        vec![FORMAT_ITEM_DEC32U]
     );
 }
 
-#[test]
-fn test_invalid_long_format() {
-    parse_format_flags_str(&["od", "--format=X"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=xX"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=aC"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=fI"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=xD"]).unwrap_err();
+#[test]
+fn test_invalid_long_format() {
+    parse_format_flags_str(&["od", "--format=X"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=xX"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=aC"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=fI"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=xD"]).unwrap_err();
 
-    parse_format_flags_str(&["od", "--format=xC1"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=x1C"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=xz1"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=xzC"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=xzz"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=xCC"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=xC1"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=x1C"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=xz1"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=xzC"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=xzz"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=xCC"]).unwrap_err();
 
-    parse_format_flags_str(&["od", "--format=c1"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=x256"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=d5"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format=f1"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=c1"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=x256"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=d5"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format=f1"]).unwrap_err();
 }
 
-#[test]
-fn test_long_format_a() {
+#[test]
+fn test_long_format_a() {
     assert_eq!(
-        parse_format_flags_str(&["od", "--format=a"]).unwrap(),
-        vec![FORMAT_ITEM_A]
+        parse_format_flags_str(&["od", "--format=a"]).unwrap(),
+        vec![FORMAT_ITEM_A]
     );
 }
 
-#[test]
-fn test_long_format_cz() {
+#[test]
+fn test_long_format_cz() {
     assert_eq!(
-        parse_format_flags(&["od".to_string(), "--format=cz".to_string()]).unwrap(),
-        vec![ParsedFormatterItemInfo::new(FORMAT_ITEM_C, true)]
+        parse_format_flags(&["od".to_string(), "--format=cz".to_string()]).unwrap(),
+        vec![ParsedFormatterItemInfo::new(FORMAT_ITEM_C, true)]
     );
 }
 
-#[test]
-fn test_long_format_d() {
+#[test]
+fn test_long_format_d() {
     assert_eq!(
-        parse_format_flags_str(&["od", "--format=d8"]).unwrap(),
-        vec![FORMAT_ITEM_DEC64S]
+        parse_format_flags_str(&["od", "--format=d8"]).unwrap(),
+        vec![FORMAT_ITEM_DEC64S]
     );
 }
 
-#[test]
-fn test_long_format_d_default() {
+#[test]
+fn test_long_format_d_default() {
     assert_eq!(
-        parse_format_flags_str(&["od", "--format=d"]).unwrap(),
-        vec![FORMAT_ITEM_DEC32S]
+        parse_format_flags_str(&["od", "--format=d"]).unwrap(),
+        vec![FORMAT_ITEM_DEC32S]
     );
 }
 
-#[test]
-fn test_long_format_o_default() {
+#[test]
+fn test_long_format_o_default() {
     assert_eq!(
-        parse_format_flags_str(&["od", "--format=o"]).unwrap(),
-        vec![FORMAT_ITEM_OCT32]
+        parse_format_flags_str(&["od", "--format=o"]).unwrap(),
+        vec![FORMAT_ITEM_OCT32]
     );
 }
 
-#[test]
-fn test_long_format_u_default() {
+#[test]
+fn test_long_format_u_default() {
     assert_eq!(
-        parse_format_flags_str(&["od", "--format=u"]).unwrap(),
-        vec![FORMAT_ITEM_DEC32U]
+        parse_format_flags_str(&["od", "--format=u"]).unwrap(),
+        vec![FORMAT_ITEM_DEC32U]
     );
 }
 
-#[test]
-fn test_long_format_x_default() {
+#[test]
+fn test_long_format_x_default() {
     assert_eq!(
-        parse_format_flags_str(&["od", "--format=x"]).unwrap(),
-        vec![FORMAT_ITEM_HEX32]
+        parse_format_flags_str(&["od", "--format=x"]).unwrap(),
+        vec![FORMAT_ITEM_HEX32]
     );
 }
 
-#[test]
-fn test_long_format_f_default() {
+#[test]
+fn test_long_format_f_default() {
     assert_eq!(
-        parse_format_flags_str(&["od", "--format=f"]).unwrap(),
-        vec![FORMAT_ITEM_F32]
+        parse_format_flags_str(&["od", "--format=f"]).unwrap(),
+        vec![FORMAT_ITEM_F32]
     );
 }
 
-#[test]
-fn test_long_format_next_arg() {
+#[test]
+fn test_long_format_next_arg() {
     assert_eq!(
-        parse_format_flags_str(&["od", "--format", "f8"]).unwrap(),
-        vec![FORMAT_ITEM_F64]
+        parse_format_flags_str(&["od", "--format", "f8"]).unwrap(),
+        vec![FORMAT_ITEM_F64]
     );
 }
 
-#[test]
-fn test_short_format_next_arg() {
+#[test]
+fn test_short_format_next_arg() {
     assert_eq!(
-        parse_format_flags_str(&["od", "-t", "x8"]).unwrap(),
-        vec![FORMAT_ITEM_HEX64]
+        parse_format_flags_str(&["od", "-t", "x8"]).unwrap(),
+        vec![FORMAT_ITEM_HEX64]
     );
 }
 
-#[test]
-fn test_short_format_combined_arg() {
+#[test]
+fn test_short_format_combined_arg() {
     assert_eq!(
-        parse_format_flags_str(&["od", "-tu8"]).unwrap(),
-        vec![FORMAT_ITEM_DEC64U]
+        parse_format_flags_str(&["od", "-tu8"]).unwrap(),
+        vec![FORMAT_ITEM_DEC64U]
     );
 }
 
-#[test]
-fn test_format_next_arg_invalid() {
-    parse_format_flags_str(&["od", "--format", "-v"]).unwrap_err();
-    parse_format_flags_str(&["od", "--format"]).unwrap_err();
-    parse_format_flags_str(&["od", "-t", "-v"]).unwrap_err();
-    parse_format_flags_str(&["od", "-t"]).unwrap_err();
+#[test]
+fn test_format_next_arg_invalid() {
+    parse_format_flags_str(&["od", "--format", "-v"]).unwrap_err();
+    parse_format_flags_str(&["od", "--format"]).unwrap_err();
+    parse_format_flags_str(&["od", "-t", "-v"]).unwrap_err();
+    parse_format_flags_str(&["od", "-t"]).unwrap_err();
 }
 
-#[test]
-fn test_mixed_formats() {
+#[test]
+fn test_mixed_formats() {
     assert_eq!(
-        parse_format_flags(&[
-            "od".to_string(),
-            "--skip-bytes=2".to_string(),
-            "-vItu1z".to_string(),
-            "-N".to_string(),
-            "1000".to_string(),
-            "-xt".to_string(),
-            "acdx1".to_string(),
-            "--format=u2c".to_string(),
-            "--format".to_string(),
-            "f".to_string(),
-            "-xAx".to_string(),
-            "--".to_string(),
-            "-h".to_string(),
-            "--format=f8".to_string(),
+        parse_format_flags(&[
+            "od".to_string(),
+            "--skip-bytes=2".to_string(),
+            "-vItu1z".to_string(),
+            "-N".to_string(),
+            "1000".to_string(),
+            "-xt".to_string(),
+            "acdx1".to_string(),
+            "--format=u2c".to_string(),
+            "--format".to_string(),
+            "f".to_string(),
+            "-xAx".to_string(),
+            "--".to_string(),
+            "-h".to_string(),
+            "--format=f8".to_string(),
         ])
-        .unwrap(),
+        .unwrap(),
         vec![
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_DEC64S, false), // I
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_DEC8U, true),   // tu1z
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_HEX16, false),  // x
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_A, false),      // ta
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_C, false),      // tc
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_DEC32S, false), // td
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_HEX8, false),   // tx1
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_DEC16U, false), // tu2
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_C, false),      // tc
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_F32, false),    // tf
-            ParsedFormatterItemInfo::new(FORMAT_ITEM_HEX16, false),  // x
-        ]
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_DEC64S, false), // I
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_DEC8U, true),   // tu1z
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_HEX16, false),  // x
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_A, false),      // ta
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_C, false),      // tc
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_DEC32S, false), // td
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_HEX8, false),   // tx1
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_DEC16U, false), // tu2
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_C, false),      // tc
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_F32, false),    // tf
+            ParsedFormatterItemInfo::new(FORMAT_ITEM_HEX16, false),  // x
+        ]
     );
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/parse_inputs.rs.html b/dev/src/uu_od/parse_inputs.rs.html index 3f655f19b..5b0fff133 100644 --- a/dev/src/uu_od/parse_inputs.rs.html +++ b/dev/src/uu_od/parse_inputs.rs.html @@ -1,4 +1,4 @@ -parse_inputs.rs - source
1
+parse_inputs.rs - source
1
 2
 3
 4
@@ -367,81 +367,81 @@
 367
 368
 369
-
use super::options;
-use clap::ArgMatches;
+
use super::options;
+use clap::ArgMatches;
 
-/// Abstraction for getopts
-pub trait CommandLineOpts {
-    /// returns all command line parameters which do not belong to an option.
-    fn inputs(&self) -> Vec<&str>;
-    /// tests if any of the specified options is present.
-    fn opts_present(&self, _: &[&str]) -> bool;
+/// Abstraction for getopts
+pub trait CommandLineOpts {
+    /// returns all command line parameters which do not belong to an option.
+    fn inputs(&self) -> Vec<&str>;
+    /// tests if any of the specified options is present.
+    fn opts_present(&self, _: &[&str]) -> bool;
 }
 
-/// Implementation for `getopts`
-impl CommandLineOpts for ArgMatches {
-    fn inputs(&self) -> Vec<&str> {
-        self.get_many::<String>(options::FILENAME)
-            .map(|values| values.map(|s| s.as_str()).collect())
-            .unwrap_or_default()
+/// Implementation for `getopts`
+impl CommandLineOpts for ArgMatches {
+    fn inputs(&self) -> Vec<&str> {
+        self.get_many::<String>(options::FILENAME)
+            .map(|values| values.map(|s| s.as_str()).collect())
+            .unwrap_or_default()
     }
 
-    fn opts_present(&self, opts: &[&str]) -> bool {
-        opts.iter()
-            .any(|opt| self.value_source(opt) == Some(clap::parser::ValueSource::CommandLine))
+    fn opts_present(&self, opts: &[&str]) -> bool {
+        opts.iter()
+            .any(|opt| self.value_source(opt) == Some(clap::parser::ValueSource::CommandLine))
     }
 }
 
-/// Contains the Input filename(s) with an optional offset.
-///
-/// `FileNames` is used for one or more file inputs ("-" = stdin)
-/// `FileAndOffset` is used for a single file input, with an offset
-/// and an optional label. Offset and label are specified in bytes.
-/// `FileAndOffset` will be only used if an offset is specified,
-/// but it might be 0.
-#[derive(PartialEq, Eq, Debug)]
-pub enum CommandLineInputs {
-    FileNames(Vec<String>),
-    FileAndOffset((String, u64, Option<u64>)),
+/// Contains the Input filename(s) with an optional offset.
+///
+/// `FileNames` is used for one or more file inputs ("-" = stdin)
+/// `FileAndOffset` is used for a single file input, with an offset
+/// and an optional label. Offset and label are specified in bytes.
+/// `FileAndOffset` will be only used if an offset is specified,
+/// but it might be 0.
+#[derive(PartialEq, Eq, Debug)]
+pub enum CommandLineInputs {
+    FileNames(Vec<String>),
+    FileAndOffset((String, u64, Option<u64>)),
 }
 
-/// Interprets the command line inputs of od.
-///
-/// Returns either an unspecified number of filenames.
-/// Or it will return a single filename, with an offset and optional label.
-/// Offset and label are specified in bytes.
-/// '-' is used as filename if stdin is meant. This is also returned if
-/// there is no input, as stdin is the default input.
-pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result<CommandLineInputs, String> {
-    let mut input_strings = matches.inputs();
+/// Interprets the command line inputs of od.
+///
+/// Returns either an unspecified number of filenames.
+/// Or it will return a single filename, with an offset and optional label.
+/// Offset and label are specified in bytes.
+/// '-' is used as filename if stdin is meant. This is also returned if
+/// there is no input, as stdin is the default input.
+pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result<CommandLineInputs, String> {
+    let mut input_strings = matches.inputs();
 
-    if matches.opts_present(&["traditional"]) {
-        return parse_inputs_traditional(&input_strings);
+    if matches.opts_present(&["traditional"]) {
+        return parse_inputs_traditional(&input_strings);
     }
 
-    // test if command line contains: [file] <offset>
-    // fall-through if no (valid) offset is found
-    if input_strings.len() == 1 || input_strings.len() == 2 {
-        // if any of the options -A, -j, -N, -t, -v or -w are present there is no offset
-        if !matches.opts_present(&[
-            options::ADDRESS_RADIX,
-            options::READ_BYTES,
-            options::SKIP_BYTES,
-            options::FORMAT,
-            options::OUTPUT_DUPLICATES,
-            options::WIDTH,
+    // test if command line contains: [file] <offset>
+    // fall-through if no (valid) offset is found
+    if input_strings.len() == 1 || input_strings.len() == 2 {
+        // if any of the options -A, -j, -N, -t, -v or -w are present there is no offset
+        if !matches.opts_present(&[
+            options::ADDRESS_RADIX,
+            options::READ_BYTES,
+            options::SKIP_BYTES,
+            options::FORMAT,
+            options::OUTPUT_DUPLICATES,
+            options::WIDTH,
         ]) {
-            // test if the last input can be parsed as an offset.
-            let offset = parse_offset_operand(input_strings[input_strings.len() - 1]);
-            if let Ok(n) = offset {
-                // if there is just 1 input (stdin), an offset must start with '+'
-                if input_strings.len() == 1 && input_strings[0].starts_with('+') {
-                    return Ok(CommandLineInputs::FileAndOffset(("-".to_string(), n, None)));
+            // test if the last input can be parsed as an offset.
+            let offset = parse_offset_operand(input_strings[input_strings.len() - 1]);
+            if let Ok(n) = offset {
+                // if there is just 1 input (stdin), an offset must start with '+'
+                if input_strings.len() == 1 && input_strings[0].starts_with('+') {
+                    return Ok(CommandLineInputs::FileAndOffset(("-".to_string(), n, None)));
                 }
-                if input_strings.len() == 2 {
-                    return Ok(CommandLineInputs::FileAndOffset((
-                        input_strings[0].to_string(),
-                        n,
+                if input_strings.len() == 2 {
+                    return Ok(CommandLineInputs::FileAndOffset((
+                        input_strings[0].to_string(),
+                        n,
                         None,
                     )));
                 }
@@ -449,249 +449,249 @@
         }
     }
 
-    if input_strings.is_empty() {
-        input_strings.push("-");
+    if input_strings.is_empty() {
+        input_strings.push("-");
     }
-    Ok(CommandLineInputs::FileNames(
-        input_strings.iter().map(|&s| s.to_string()).collect(),
+    Ok(CommandLineInputs::FileNames(
+        input_strings.iter().map(|&s| s.to_string()).collect(),
     ))
 }
 
-/// interprets inputs when --traditional is on the command line
-///
-/// normally returns CommandLineInputs::FileAndOffset, but if no offset is found,
-/// it returns CommandLineInputs::FileNames (also to differentiate from the offset == 0)
-pub fn parse_inputs_traditional(input_strings: &[&str]) -> Result<CommandLineInputs, String> {
-    match input_strings.len() {
-        0 => Ok(CommandLineInputs::FileNames(vec!["-".to_string()])),
-        1 => {
-            let offset0 = parse_offset_operand(input_strings[0]);
-            Ok(match offset0 {
-                Ok(n) => CommandLineInputs::FileAndOffset(("-".to_string(), n, None)),
-                _ => CommandLineInputs::FileNames(
-                    input_strings.iter().map(|&s| s.to_string()).collect(),
+/// interprets inputs when --traditional is on the command line
+///
+/// normally returns CommandLineInputs::FileAndOffset, but if no offset is found,
+/// it returns CommandLineInputs::FileNames (also to differentiate from the offset == 0)
+pub fn parse_inputs_traditional(input_strings: &[&str]) -> Result<CommandLineInputs, String> {
+    match input_strings.len() {
+        0 => Ok(CommandLineInputs::FileNames(vec!["-".to_string()])),
+        1 => {
+            let offset0 = parse_offset_operand(input_strings[0]);
+            Ok(match offset0 {
+                Ok(n) => CommandLineInputs::FileAndOffset(("-".to_string(), n, None)),
+                _ => CommandLineInputs::FileNames(
+                    input_strings.iter().map(|&s| s.to_string()).collect(),
                 ),
             })
         }
-        2 => {
-            let offset0 = parse_offset_operand(input_strings[0]);
-            let offset1 = parse_offset_operand(input_strings[1]);
-            match (offset0, offset1) {
-                (Ok(n), Ok(m)) => Ok(CommandLineInputs::FileAndOffset((
-                    "-".to_string(),
-                    n,
-                    Some(m),
+        2 => {
+            let offset0 = parse_offset_operand(input_strings[0]);
+            let offset1 = parse_offset_operand(input_strings[1]);
+            match (offset0, offset1) {
+                (Ok(n), Ok(m)) => Ok(CommandLineInputs::FileAndOffset((
+                    "-".to_string(),
+                    n,
+                    Some(m),
                 ))),
-                (_, Ok(m)) => Ok(CommandLineInputs::FileAndOffset((
-                    input_strings[0].to_string(),
-                    m,
+                (_, Ok(m)) => Ok(CommandLineInputs::FileAndOffset((
+                    input_strings[0].to_string(),
+                    m,
                     None,
                 ))),
-                _ => Err(format!("invalid offset: {}", input_strings[1])),
+                _ => Err(format!("invalid offset: {}", input_strings[1])),
             }
         }
-        3 => {
-            let offset = parse_offset_operand(input_strings[1]);
-            let label = parse_offset_operand(input_strings[2]);
-            match (offset, label) {
-                (Ok(n), Ok(m)) => Ok(CommandLineInputs::FileAndOffset((
-                    input_strings[0].to_string(),
-                    n,
-                    Some(m),
+        3 => {
+            let offset = parse_offset_operand(input_strings[1]);
+            let label = parse_offset_operand(input_strings[2]);
+            match (offset, label) {
+                (Ok(n), Ok(m)) => Ok(CommandLineInputs::FileAndOffset((
+                    input_strings[0].to_string(),
+                    n,
+                    Some(m),
                 ))),
-                (Err(_), _) => Err(format!("invalid offset: {}", input_strings[1])),
-                (_, Err(_)) => Err(format!("invalid label: {}", input_strings[2])),
+                (Err(_), _) => Err(format!("invalid offset: {}", input_strings[1])),
+                (_, Err(_)) => Err(format!("invalid label: {}", input_strings[2])),
             }
         }
-        _ => Err(format!(
+        _ => Err(format!(
             "too many inputs after --traditional: {}",
-            input_strings[3]
+            input_strings[3]
         )),
     }
 }
 
-/// parses format used by offset and label on the command line
-pub fn parse_offset_operand(s: &str) -> Result<u64, &'static str> {
-    let mut start = 0;
-    let mut len = s.len();
-    let mut radix = 8;
-    let mut multiply = 1;
+/// parses format used by offset and label on the command line
+pub fn parse_offset_operand(s: &str) -> Result<u64, &'static str> {
+    let mut start = 0;
+    let mut len = s.len();
+    let mut radix = 8;
+    let mut multiply = 1;
 
-    if s.starts_with('+') {
-        start += 1;
+    if s.starts_with('+') {
+        start += 1;
     }
 
-    if s[start..len].starts_with("0x") || s[start..len].starts_with("0X") {
-        start += 2;
-        radix = 16;
-    } else {
-        if s[start..len].ends_with('b') {
-            len -= 1;
-            multiply = 512;
+    if s[start..len].starts_with("0x") || s[start..len].starts_with("0X") {
+        start += 2;
+        radix = 16;
+    } else {
+        if s[start..len].ends_with('b') {
+            len -= 1;
+            multiply = 512;
         }
-        if s[start..len].ends_with('.') {
-            len -= 1;
-            radix = 10;
+        if s[start..len].ends_with('.') {
+            len -= 1;
+            radix = 10;
         }
     }
-    match u64::from_str_radix(&s[start..len], radix) {
-        Ok(i) => Ok(i * multiply),
+    match u64::from_str_radix(&s[start..len], radix) {
+        Ok(i) => Ok(i * multiply),
         Err(_) => Err("parse failed"),
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use crate::uu_app;
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::uu_app;
 
-    #[test]
-    fn test_parse_inputs_normal() {
+    #[test]
+    fn test_parse_inputs_normal() {
         assert_eq!(
-            CommandLineInputs::FileNames(vec!["-".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od"])).unwrap()
+            CommandLineInputs::FileNames(vec!["-".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od"])).unwrap()
         );
 
         assert_eq!(
-            CommandLineInputs::FileNames(vec!["-".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "-"])).unwrap()
+            CommandLineInputs::FileNames(vec!["-".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "-"])).unwrap()
         );
 
         assert_eq!(
-            CommandLineInputs::FileNames(vec!["file1".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1"])).unwrap()
+            CommandLineInputs::FileNames(vec!["file1".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1"])).unwrap()
         );
 
         assert_eq!(
-            CommandLineInputs::FileNames(vec!["file1".to_string(), "file2".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1", "file2"])).unwrap()
+            CommandLineInputs::FileNames(vec!["file1".to_string(), "file2".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1", "file2"])).unwrap()
         );
 
         assert_eq!(
-            CommandLineInputs::FileNames(vec![
-                "-".to_string(),
-                "file1".to_string(),
-                "file2".to_string(),
+            CommandLineInputs::FileNames(vec![
+                "-".to_string(),
+                "file1".to_string(),
+                "file2".to_string(),
             ]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "-", "file1", "file2"])).unwrap()
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "-", "file1", "file2"])).unwrap()
         );
     }
 
-    #[test]
-    fn test_parse_inputs_with_offset() {
-        // offset is found without filename, so stdin will be used.
-        assert_eq!(
-            CommandLineInputs::FileAndOffset(("-".to_string(), 8, None)),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "+10"])).unwrap()
+    #[test]
+    fn test_parse_inputs_with_offset() {
+        // offset is found without filename, so stdin will be used.
+        assert_eq!(
+            CommandLineInputs::FileAndOffset(("-".to_string(), 8, None)),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "+10"])).unwrap()
         );
 
-        // offset must start with "+" if no input is specified.
-        assert_eq!(
-            CommandLineInputs::FileNames(vec!["10".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "10"])).unwrap()
+        // offset must start with "+" if no input is specified.
+        assert_eq!(
+            CommandLineInputs::FileNames(vec!["10".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "10"])).unwrap()
         );
 
-        // offset is not valid, so it is considered a filename.
-        assert_eq!(
-            CommandLineInputs::FileNames(vec!["+10a".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "+10a"])).unwrap()
+        // offset is not valid, so it is considered a filename.
+        assert_eq!(
+            CommandLineInputs::FileNames(vec!["+10a".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "+10a"])).unwrap()
         );
 
-        // if -j is included in the command line, there cannot be an offset.
-        assert_eq!(
-            CommandLineInputs::FileNames(vec!["+10".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "-j10", "+10"])).unwrap()
+        // if -j is included in the command line, there cannot be an offset.
+        assert_eq!(
+            CommandLineInputs::FileNames(vec!["+10".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "-j10", "+10"])).unwrap()
         );
 
-        // if -v is included in the command line, there cannot be an offset.
-        assert_eq!(
-            CommandLineInputs::FileNames(vec!["+10".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "-o", "-v", "+10"])).unwrap()
+        // if -v is included in the command line, there cannot be an offset.
+        assert_eq!(
+            CommandLineInputs::FileNames(vec!["+10".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "-o", "-v", "+10"])).unwrap()
         );
 
         assert_eq!(
-            CommandLineInputs::FileAndOffset(("file1".to_string(), 8, None)),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1", "+10"])).unwrap()
+            CommandLineInputs::FileAndOffset(("file1".to_string(), 8, None)),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1", "+10"])).unwrap()
         );
 
-        // offset does not need to start with "+" if a filename is included.
-        assert_eq!(
-            CommandLineInputs::FileAndOffset(("file1".to_string(), 8, None)),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1", "10"])).unwrap()
+        // offset does not need to start with "+" if a filename is included.
+        assert_eq!(
+            CommandLineInputs::FileAndOffset(("file1".to_string(), 8, None)),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1", "10"])).unwrap()
         );
 
         assert_eq!(
-            CommandLineInputs::FileNames(vec!["file1".to_string(), "+10a".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1", "+10a"])).unwrap()
+            CommandLineInputs::FileNames(vec!["file1".to_string(), "+10a".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "file1", "+10a"])).unwrap()
         );
 
         assert_eq!(
-            CommandLineInputs::FileNames(vec!["file1".to_string(), "+10".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "-j10", "file1", "+10"])).unwrap()
+            CommandLineInputs::FileNames(vec!["file1".to_string(), "+10".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "-j10", "file1", "+10"])).unwrap()
         );
 
-        // offset must be last on the command line
-        assert_eq!(
-            CommandLineInputs::FileNames(vec!["+10".to_string(), "file1".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "+10", "file1"])).unwrap()
+        // offset must be last on the command line
+        assert_eq!(
+            CommandLineInputs::FileNames(vec!["+10".to_string(), "file1".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "+10", "file1"])).unwrap()
         );
     }
 
-    #[test]
-    fn test_parse_inputs_traditional() {
-        // it should not return FileAndOffset to signal no offset was entered on the command line.
-        assert_eq!(
-            CommandLineInputs::FileNames(vec!["-".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional"])).unwrap()
+    #[test]
+    fn test_parse_inputs_traditional() {
+        // it should not return FileAndOffset to signal no offset was entered on the command line.
+        assert_eq!(
+            CommandLineInputs::FileNames(vec!["-".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional"])).unwrap()
         );
 
         assert_eq!(
-            CommandLineInputs::FileNames(vec!["file1".to_string()]),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "file1"])).unwrap()
+            CommandLineInputs::FileNames(vec!["file1".to_string()]),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "file1"])).unwrap()
         );
 
-        // offset does not need to start with a +
-        assert_eq!(
-            CommandLineInputs::FileAndOffset(("-".to_string(), 8, None)),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10"])).unwrap()
+        // offset does not need to start with a +
+        assert_eq!(
+            CommandLineInputs::FileAndOffset(("-".to_string(), 8, None)),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10"])).unwrap()
         );
 
-        // valid offset and valid label
-        assert_eq!(
-            CommandLineInputs::FileAndOffset(("-".to_string(), 8, Some(8))),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10", "10"]))
-                .unwrap()
+        // valid offset and valid label
+        assert_eq!(
+            CommandLineInputs::FileAndOffset(("-".to_string(), 8, Some(8))),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10", "10"]))
+                .unwrap()
         );
 
         assert_eq!(
-            CommandLineInputs::FileAndOffset(("file1".to_string(), 8, None)),
-            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "file1", "10"]))
-                .unwrap()
+            CommandLineInputs::FileAndOffset(("file1".to_string(), 8, None)),
+            parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "file1", "10"]))
+                .unwrap()
         );
 
-        // only one file is allowed, it must be the first
-        parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10", "file1"]))
-            .unwrap_err();
+        // only one file is allowed, it must be the first
+        parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10", "file1"]))
+            .unwrap_err();
 
         assert_eq!(
-            CommandLineInputs::FileAndOffset(("file1".to_string(), 8, Some(8))),
-            parse_inputs(&uu_app().get_matches_from(vec![
+            CommandLineInputs::FileAndOffset(("file1".to_string(), 8, Some(8))),
+            parse_inputs(&uu_app().get_matches_from(vec![
                 "od",
                 "--traditional",
                 "file1",
                 "10",
-                "10"
-            ]))
-            .unwrap()
+                "10"
+            ]))
+            .unwrap()
         );
 
-        parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10", "file1", "10"]))
-            .unwrap_err();
+        parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10", "file1", "10"]))
+            .unwrap_err();
 
-        parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10", "10", "file1"]))
-            .unwrap_err();
+        parse_inputs(&uu_app().get_matches_from(vec!["od", "--traditional", "10", "10", "file1"]))
+            .unwrap_err();
 
-        parse_inputs(&uu_app().get_matches_from(vec![
+        parse_inputs(&uu_app().get_matches_from(vec![
             "od",
             "--traditional",
             "10",
@@ -699,42 +699,42 @@
             "10",
             "10",
         ]))
-        .unwrap_err();
+        .unwrap_err();
     }
 
-    fn parse_offset_operand_str(s: &str) -> Result<u64, &'static str> {
-        parse_offset_operand(&String::from(s))
+    fn parse_offset_operand_str(s: &str) -> Result<u64, &'static str> {
+        parse_offset_operand(&String::from(s))
     }
 
-    #[test]
-    fn test_parse_offset_operand_invalid() {
-        parse_offset_operand_str("").unwrap_err();
-        parse_offset_operand_str("a").unwrap_err();
-        parse_offset_operand_str("+").unwrap_err();
-        parse_offset_operand_str("+b").unwrap_err();
-        parse_offset_operand_str("0x1.").unwrap_err();
-        parse_offset_operand_str("0x1.b").unwrap_err();
-        parse_offset_operand_str("-").unwrap_err();
-        parse_offset_operand_str("-1").unwrap_err();
-        parse_offset_operand_str("1e10").unwrap_err();
+    #[test]
+    fn test_parse_offset_operand_invalid() {
+        parse_offset_operand_str("").unwrap_err();
+        parse_offset_operand_str("a").unwrap_err();
+        parse_offset_operand_str("+").unwrap_err();
+        parse_offset_operand_str("+b").unwrap_err();
+        parse_offset_operand_str("0x1.").unwrap_err();
+        parse_offset_operand_str("0x1.b").unwrap_err();
+        parse_offset_operand_str("-").unwrap_err();
+        parse_offset_operand_str("-1").unwrap_err();
+        parse_offset_operand_str("1e10").unwrap_err();
     }
 
-    #[test]
-    fn test_parse_offset_operand() {
-        assert_eq!(8, parse_offset_operand_str("10").unwrap()); // default octal
-        assert_eq!(0, parse_offset_operand_str("0").unwrap());
-        assert_eq!(8, parse_offset_operand_str("+10").unwrap()); // optional leading '+'
-        assert_eq!(16, parse_offset_operand_str("0x10").unwrap()); // hex
-        assert_eq!(16, parse_offset_operand_str("0X10").unwrap()); // hex
-        assert_eq!(16, parse_offset_operand_str("+0X10").unwrap()); // hex
-        assert_eq!(10, parse_offset_operand_str("10.").unwrap()); // decimal
-        assert_eq!(10, parse_offset_operand_str("+10.").unwrap()); // decimal
-        assert_eq!(4096, parse_offset_operand_str("10b").unwrap()); // b suffix = *512
-        assert_eq!(4096, parse_offset_operand_str("+10b").unwrap()); // b suffix = *512
-        assert_eq!(5120, parse_offset_operand_str("10.b").unwrap()); // b suffix = *512
-        assert_eq!(5120, parse_offset_operand_str("+10.b").unwrap()); // b suffix = *512
-        assert_eq!(267, parse_offset_operand_str("0x10b").unwrap()); // hex
-    }
+    #[test]
+    fn test_parse_offset_operand() {
+        assert_eq!(8, parse_offset_operand_str("10").unwrap()); // default octal
+        assert_eq!(0, parse_offset_operand_str("0").unwrap());
+        assert_eq!(8, parse_offset_operand_str("+10").unwrap()); // optional leading '+'
+        assert_eq!(16, parse_offset_operand_str("0x10").unwrap()); // hex
+        assert_eq!(16, parse_offset_operand_str("0X10").unwrap()); // hex
+        assert_eq!(16, parse_offset_operand_str("+0X10").unwrap()); // hex
+        assert_eq!(10, parse_offset_operand_str("10.").unwrap()); // decimal
+        assert_eq!(10, parse_offset_operand_str("+10.").unwrap()); // decimal
+        assert_eq!(4096, parse_offset_operand_str("10b").unwrap()); // b suffix = *512
+        assert_eq!(4096, parse_offset_operand_str("+10b").unwrap()); // b suffix = *512
+        assert_eq!(5120, parse_offset_operand_str("10.b").unwrap()); // b suffix = *512
+        assert_eq!(5120, parse_offset_operand_str("+10.b").unwrap()); // b suffix = *512
+        assert_eq!(267, parse_offset_operand_str("0x10b").unwrap()); // hex
+    }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/parse_nrofbytes.rs.html b/dev/src/uu_od/parse_nrofbytes.rs.html index 44a4bbd0b..b75680191 100644 --- a/dev/src/uu_od/parse_nrofbytes.rs.html +++ b/dev/src/uu_od/parse_nrofbytes.rs.html @@ -1,4 +1,4 @@ -parse_nrofbytes.rs - source
1
+parse_nrofbytes.rs - source
1
 2
 3
 4
@@ -89,96 +89,96 @@
 89
 90
 91
-
use uucore::parse_size::{parse_size, ParseSizeError};
+
use uucore::parse_size::{parse_size, ParseSizeError};
 
-pub fn parse_number_of_bytes(s: &str) -> Result<u64, ParseSizeError> {
-    let mut start = 0;
-    let mut len = s.len();
-    let mut radix = 16;
-    let mut multiply = 1;
+pub fn parse_number_of_bytes(s: &str) -> Result<u64, ParseSizeError> {
+    let mut start = 0;
+    let mut len = s.len();
+    let mut radix = 16;
+    let mut multiply = 1;
 
-    if s.starts_with("0x") || s.starts_with("0X") {
-        start = 2;
-    } else if s.starts_with('0') {
-        radix = 8;
-    } else {
-        return parse_size(&s[start..]);
+    if s.starts_with("0x") || s.starts_with("0X") {
+        start = 2;
+    } else if s.starts_with('0') {
+        radix = 8;
+    } else {
+        return parse_size(&s[start..]);
     }
 
-    let mut ends_with = s.chars().rev();
-    match ends_with.next() {
-        Some('b') if radix != 16 => {
-            multiply = 512;
-            len -= 1;
+    let mut ends_with = s.chars().rev();
+    match ends_with.next() {
+        Some('b') if radix != 16 => {
+            multiply = 512;
+            len -= 1;
         }
-        Some('k') | Some('K') => {
-            multiply = 1024;
-            len -= 1;
+        Some('k') | Some('K') => {
+            multiply = 1024;
+            len -= 1;
         }
-        Some('m') | Some('M') => {
-            multiply = 1024 * 1024;
-            len -= 1;
+        Some('m') | Some('M') => {
+            multiply = 1024 * 1024;
+            len -= 1;
         }
         Some('G') => {
-            multiply = 1024 * 1024 * 1024;
-            len -= 1;
+            multiply = 1024 * 1024 * 1024;
+            len -= 1;
         }
-        #[cfg(target_pointer_width = "64")]
-        Some('T') => {
-            multiply = 1024 * 1024 * 1024 * 1024;
-            len -= 1;
+        #[cfg(target_pointer_width = "64")]
+        Some('T') => {
+            multiply = 1024 * 1024 * 1024 * 1024;
+            len -= 1;
         }
-        #[cfg(target_pointer_width = "64")]
-        Some('P') => {
-            multiply = 1024 * 1024 * 1024 * 1024 * 1024;
-            len -= 1;
+        #[cfg(target_pointer_width = "64")]
+        Some('P') => {
+            multiply = 1024 * 1024 * 1024 * 1024 * 1024;
+            len -= 1;
         }
-        #[cfg(target_pointer_width = "64")]
-        Some('E') => {
-            multiply = 1024 * 1024 * 1024 * 1024 * 1024 * 1024;
-            len -= 1;
+        #[cfg(target_pointer_width = "64")]
+        Some('E') => {
+            multiply = 1024 * 1024 * 1024 * 1024 * 1024 * 1024;
+            len -= 1;
         }
-        Some('B') if radix != 16 => {
-            len -= 2;
-            multiply = match ends_with.next() {
-                Some('k') | Some('K') => 1000,
-                Some('m') | Some('M') => 1000 * 1000,
-                Some('G') => 1000 * 1000 * 1000,
-                #[cfg(target_pointer_width = "64")]
-                Some('T') => 1000 * 1000 * 1000 * 1000,
-                #[cfg(target_pointer_width = "64")]
-                Some('P') => 1000 * 1000 * 1000 * 1000 * 1000,
-                #[cfg(target_pointer_width = "64")]
-                Some('E') => 1000 * 1000 * 1000 * 1000 * 1000 * 1000,
-                _ => return Err(ParseSizeError::ParseFailure(s.to_string())),
+        Some('B') if radix != 16 => {
+            len -= 2;
+            multiply = match ends_with.next() {
+                Some('k') | Some('K') => 1000,
+                Some('m') | Some('M') => 1000 * 1000,
+                Some('G') => 1000 * 1000 * 1000,
+                #[cfg(target_pointer_width = "64")]
+                Some('T') => 1000 * 1000 * 1000 * 1000,
+                #[cfg(target_pointer_width = "64")]
+                Some('P') => 1000 * 1000 * 1000 * 1000 * 1000,
+                #[cfg(target_pointer_width = "64")]
+                Some('E') => 1000 * 1000 * 1000 * 1000 * 1000 * 1000,
+                _ => return Err(ParseSizeError::ParseFailure(s.to_string())),
             }
         }
-        _ => {}
+        _ => {}
     }
 
-    let factor = match u64::from_str_radix(&s[start..len], radix) {
-        Ok(f) => f,
-        Err(e) => return Err(ParseSizeError::ParseFailure(e.to_string())),
+    let factor = match u64::from_str_radix(&s[start..len], radix) {
+        Ok(f) => f,
+        Err(e) => return Err(ParseSizeError::ParseFailure(e.to_string())),
     };
-    factor
-        .checked_mul(multiply)
-        .ok_or_else(|| ParseSizeError::SizeTooBig(s.to_string()))
+    factor
+        .checked_mul(multiply)
+        .ok_or_else(|| ParseSizeError::SizeTooBig(s.to_string()))
 }
 
-#[test]
-fn test_parse_number_of_bytes() {
-    // octal input
-    assert_eq!(8, parse_number_of_bytes("010").unwrap());
-    assert_eq!(8 * 512, parse_number_of_bytes("010b").unwrap());
-    assert_eq!(8 * 1024, parse_number_of_bytes("010k").unwrap());
-    assert_eq!(8 * 1_048_576, parse_number_of_bytes("010m").unwrap());
+#[test]
+fn test_parse_number_of_bytes() {
+    // octal input
+    assert_eq!(8, parse_number_of_bytes("010").unwrap());
+    assert_eq!(8 * 512, parse_number_of_bytes("010b").unwrap());
+    assert_eq!(8 * 1024, parse_number_of_bytes("010k").unwrap());
+    assert_eq!(8 * 1_048_576, parse_number_of_bytes("010m").unwrap());
 
-    // hex input
-    assert_eq!(15, parse_number_of_bytes("0xf").unwrap());
-    assert_eq!(15, parse_number_of_bytes("0XF").unwrap());
-    assert_eq!(27, parse_number_of_bytes("0x1b").unwrap());
-    assert_eq!(16 * 1024, parse_number_of_bytes("0x10k").unwrap());
-    assert_eq!(16 * 1_048_576, parse_number_of_bytes("0x10m").unwrap());
+    // hex input
+    assert_eq!(15, parse_number_of_bytes("0xf").unwrap());
+    assert_eq!(15, parse_number_of_bytes("0XF").unwrap());
+    assert_eq!(27, parse_number_of_bytes("0x1b").unwrap());
+    assert_eq!(16 * 1024, parse_number_of_bytes("0x10k").unwrap());
+    assert_eq!(16 * 1_048_576, parse_number_of_bytes("0x10m").unwrap());
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/partialreader.rs.html b/dev/src/uu_od/partialreader.rs.html index 3cb5d32f3..978796b52 100644 --- a/dev/src/uu_od/partialreader.rs.html +++ b/dev/src/uu_od/partialreader.rs.html @@ -1,4 +1,4 @@ -partialreader.rs - source
1
+partialreader.rs - source
1
 2
 3
 4
@@ -212,71 +212,71 @@
 212
 213
 214
-
// spell-checker:ignore mockstream abcdefgh bcdefgh
+
// spell-checker:ignore mockstream abcdefgh bcdefgh
 
-use std::cmp;
-use std::io;
-use std::io::Read;
+use std::cmp;
+use std::io;
+use std::io::Read;
 
-use crate::multifilereader::HasError;
+use crate::multifilereader::HasError;
 
-/// When a large number of bytes must be skipped, it will be read into a
-/// dynamically allocated buffer. The buffer will be limited to this size.
-const MAX_SKIP_BUFFER: usize = 16 * 1024;
+/// When a large number of bytes must be skipped, it will be read into a
+/// dynamically allocated buffer. The buffer will be limited to this size.
+const MAX_SKIP_BUFFER: usize = 16 * 1024;
 
-/// Wrapper for `std::io::Read` which can skip bytes at the beginning
-/// of the input, and it can limit the returned bytes to a particular
-/// number of bytes.
-pub struct PartialReader<R> {
-    inner: R,
-    skip: u64,
-    limit: Option<u64>,
+/// Wrapper for `std::io::Read` which can skip bytes at the beginning
+/// of the input, and it can limit the returned bytes to a particular
+/// number of bytes.
+pub struct PartialReader<R> {
+    inner: R,
+    skip: u64,
+    limit: Option<u64>,
 }
 
-impl<R> PartialReader<R> {
-    /// Create a new `PartialReader` wrapping `inner`, which will skip
-    /// `skip` bytes, and limits the output to `limit` bytes. Set `limit`
-    /// to `None` if there should be no limit.
-    pub fn new(inner: R, skip: u64, limit: Option<u64>) -> Self {
-        Self { inner, skip, limit }
+impl<R> PartialReader<R> {
+    /// Create a new `PartialReader` wrapping `inner`, which will skip
+    /// `skip` bytes, and limits the output to `limit` bytes. Set `limit`
+    /// to `None` if there should be no limit.
+    pub fn new(inner: R, skip: u64, limit: Option<u64>) -> Self {
+        Self { inner, skip, limit }
     }
 }
 
-impl<R: Read> Read for PartialReader<R> {
-    fn read(&mut self, out: &mut [u8]) -> io::Result<usize> {
-        if self.skip > 0 {
-            let mut bytes = [0; MAX_SKIP_BUFFER];
+impl<R: Read> Read for PartialReader<R> {
+    fn read(&mut self, out: &mut [u8]) -> io::Result<usize> {
+        if self.skip > 0 {
+            let mut bytes = [0; MAX_SKIP_BUFFER];
 
-            while self.skip > 0 {
-                let skip_count: usize = cmp::min(self.skip as usize, MAX_SKIP_BUFFER);
+            while self.skip > 0 {
+                let skip_count: usize = cmp::min(self.skip as usize, MAX_SKIP_BUFFER);
 
-                match self.inner.read(&mut bytes[..skip_count])? {
-                    0 => {
-                        // this is an error as we still have more to skip
-                        return Err(io::Error::new(
-                            io::ErrorKind::UnexpectedEof,
+                match self.inner.read(&mut bytes[..skip_count])? {
+                    0 => {
+                        // this is an error as we still have more to skip
+                        return Err(io::Error::new(
+                            io::ErrorKind::UnexpectedEof,
                             "tried to skip past end of input",
                         ));
                     }
-                    n => self.skip -= n as u64,
+                    n => self.skip -= n as u64,
                 }
             }
         }
 
-        match self.limit {
-            None => self.inner.read(out),
+        match self.limit {
+            None => self.inner.read(out),
             Some(0) => Ok(0),
-            Some(ref mut limit) => {
-                let slice = if *limit > (out.len() as u64) {
-                    out
-                } else {
-                    &mut out[0..(*limit as usize)]
+            Some(ref mut limit) => {
+                let slice = if *limit > (out.len() as u64) {
+                    out
+                } else {
+                    &mut out[0..(*limit as usize)]
                 };
-                match self.inner.read(slice) {
-                    Err(e) => Err(e),
-                    Ok(r) => {
-                        *limit -= r as u64;
-                        Ok(r)
+                match self.inner.read(slice) {
+                    Err(e) => Err(e),
+                    Ok(r) => {
+                        *limit -= r as u64;
+                        Ok(r)
                     }
                 }
             }
@@ -284,147 +284,147 @@
     }
 }
 
-impl<R: HasError> HasError for PartialReader<R> {
-    fn has_error(&self) -> bool {
-        self.inner.has_error()
+impl<R: HasError> HasError for PartialReader<R> {
+    fn has_error(&self) -> bool {
+        self.inner.has_error()
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use crate::mockstream::*;
-    use std::io::{Cursor, ErrorKind, Read};
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::mockstream::*;
+    use std::io::{Cursor, ErrorKind, Read};
 
-    #[test]
-    fn test_read_without_limits() {
-        let mut v = [0; 10];
-        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, None);
+    #[test]
+    fn test_read_without_limits() {
+        let mut v = [0; 10];
+        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, None);
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 8);
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 8);
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0]);
     }
 
-    #[test]
-    fn test_read_without_limits_with_error() {
-        let mut v = [0; 10];
-        let f = FailingMockStream::new(ErrorKind::PermissionDenied, "No access", 3);
-        let mut sut = PartialReader::new(f, 0, None);
+    #[test]
+    fn test_read_without_limits_with_error() {
+        let mut v = [0; 10];
+        let f = FailingMockStream::new(ErrorKind::PermissionDenied, "No access", 3);
+        let mut sut = PartialReader::new(f, 0, None);
 
-        let error = sut.read(v.as_mut()).unwrap_err();
-        assert_eq!(error.kind(), ErrorKind::PermissionDenied);
-        assert_eq!(error.to_string(), "No access");
+        let error = sut.read(v.as_mut()).unwrap_err();
+        assert_eq!(error.kind(), ErrorKind::PermissionDenied);
+        assert_eq!(error.to_string(), "No access");
     }
 
-    #[test]
-    fn test_read_skipping_bytes() {
-        let mut v = [0; 10];
-        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 2, None);
+    #[test]
+    fn test_read_skipping_bytes() {
+        let mut v = [0; 10];
+        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 2, None);
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 6);
-        assert_eq!(v, [0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0, 0, 0]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 6);
+        assert_eq!(v, [0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0, 0, 0]);
     }
 
-    #[test]
-    fn test_read_skipping_all() {
-        let mut v = [0; 10];
-        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 20, None);
+    #[test]
+    fn test_read_skipping_all() {
+        let mut v = [0; 10];
+        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 20, None);
 
-        let error = sut.read(v.as_mut()).unwrap_err();
-        assert_eq!(error.kind(), ErrorKind::UnexpectedEof);
+        let error = sut.read(v.as_mut()).unwrap_err();
+        assert_eq!(error.kind(), ErrorKind::UnexpectedEof);
     }
 
-    #[test]
-    fn test_read_skipping_with_error() {
-        let mut v = [0; 10];
-        let f = FailingMockStream::new(ErrorKind::PermissionDenied, "No access", 3);
-        let mut sut = PartialReader::new(f, 2, None);
+    #[test]
+    fn test_read_skipping_with_error() {
+        let mut v = [0; 10];
+        let f = FailingMockStream::new(ErrorKind::PermissionDenied, "No access", 3);
+        let mut sut = PartialReader::new(f, 2, None);
 
-        let error = sut.read(v.as_mut()).unwrap_err();
-        assert_eq!(error.kind(), ErrorKind::PermissionDenied);
-        assert_eq!(error.to_string(), "No access");
+        let error = sut.read(v.as_mut()).unwrap_err();
+        assert_eq!(error.kind(), ErrorKind::PermissionDenied);
+        assert_eq!(error.to_string(), "No access");
     }
 
-    #[test]
-    fn test_read_skipping_with_two_reads_during_skip() {
-        let mut v = [0; 10];
-        let c = Cursor::new(&b"a"[..]).chain(Cursor::new(&b"bcdefgh"[..]));
-        let mut sut = PartialReader::new(c, 2, None);
+    #[test]
+    fn test_read_skipping_with_two_reads_during_skip() {
+        let mut v = [0; 10];
+        let c = Cursor::new(&b"a"[..]).chain(Cursor::new(&b"bcdefgh"[..]));
+        let mut sut = PartialReader::new(c, 2, None);
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 6);
-        assert_eq!(v, [0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0, 0, 0]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 6);
+        assert_eq!(v, [0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0, 0, 0]);
     }
 
-    #[test]
-    fn test_read_skipping_huge_number() {
-        let mut v = [0; 10];
-        // test if it does not eat all memory....
-        let mut sut = PartialReader::new(
-            Cursor::new(&b"abcdefgh"[..]),
-            usize::max_value() as u64,
+    #[test]
+    fn test_read_skipping_huge_number() {
+        let mut v = [0; 10];
+        // test if it does not eat all memory....
+        let mut sut = PartialReader::new(
+            Cursor::new(&b"abcdefgh"[..]),
+            usize::max_value() as u64,
             None,
         );
 
-        sut.read(v.as_mut()).unwrap_err();
+        sut.read(v.as_mut()).unwrap_err();
     }
 
-    #[test]
-    fn test_read_limiting_all() {
-        let mut v = [0; 10];
-        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(0));
+    #[test]
+    fn test_read_limiting_all() {
+        let mut v = [0; 10];
+        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(0));
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 0);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 0);
     }
 
-    #[test]
-    fn test_read_limiting() {
-        let mut v = [0; 10];
-        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(6));
+    #[test]
+    fn test_read_limiting() {
+        let mut v = [0; 10];
+        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(6));
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 6);
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0, 0, 0, 0]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 6);
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0, 0, 0, 0]);
     }
 
-    #[test]
-    fn test_read_limiting_with_error() {
-        let mut v = [0; 10];
-        let f = FailingMockStream::new(ErrorKind::PermissionDenied, "No access", 3);
-        let mut sut = PartialReader::new(f, 0, Some(6));
+    #[test]
+    fn test_read_limiting_with_error() {
+        let mut v = [0; 10];
+        let f = FailingMockStream::new(ErrorKind::PermissionDenied, "No access", 3);
+        let mut sut = PartialReader::new(f, 0, Some(6));
 
-        let error = sut.read(v.as_mut()).unwrap_err();
-        assert_eq!(error.kind(), ErrorKind::PermissionDenied);
-        assert_eq!(error.to_string(), "No access");
+        let error = sut.read(v.as_mut()).unwrap_err();
+        assert_eq!(error.kind(), ErrorKind::PermissionDenied);
+        assert_eq!(error.to_string(), "No access");
     }
 
-    #[test]
-    fn test_read_limiting_with_large_limit() {
-        let mut v = [0; 10];
-        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(20));
+    #[test]
+    fn test_read_limiting_with_large_limit() {
+        let mut v = [0; 10];
+        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(20));
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 8);
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 8);
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0]);
     }
 
-    #[test]
-    fn test_read_limiting_with_multiple_reads() {
-        let mut v = [0; 3];
-        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(6));
+    #[test]
+    fn test_read_limiting_with_multiple_reads() {
+        let mut v = [0; 3];
+        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(6));
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
-        assert_eq!(v, [0x61, 0x62, 0x63]);
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
-        assert_eq!(v, [0x64, 0x65, 0x66]);
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 0);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
+        assert_eq!(v, [0x61, 0x62, 0x63]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 3);
+        assert_eq!(v, [0x64, 0x65, 0x66]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 0);
     }
 
-    #[test]
-    fn test_read_skipping_and_limiting() {
-        let mut v = [0; 10];
-        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 2, Some(4));
+    #[test]
+    fn test_read_skipping_and_limiting() {
+        let mut v = [0; 10];
+        let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 2, Some(4));
 
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 4);
-        assert_eq!(v, [0x63, 0x64, 0x65, 0x66, 0, 0, 0, 0, 0, 0]);
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 4);
+        assert_eq!(v, [0x63, 0x64, 0x65, 0x66, 0, 0, 0, 0, 0, 0]);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/peekreader.rs.html b/dev/src/uu_od/peekreader.rs.html index a7777e2ba..98262dfe5 100644 --- a/dev/src/uu_od/peekreader.rs.html +++ b/dev/src/uu_od/peekreader.rs.html @@ -1,4 +1,4 @@ -peekreader.rs - source
1
+peekreader.rs - source
1
 2
 3
 4
@@ -213,220 +213,220 @@
 213
 214
 215
-
// spell-checker:ignore (ToDO) tempbuffer abcdefgh abcdefghij
+
// spell-checker:ignore (ToDO) tempbuffer abcdefgh abcdefghij
 
-//! Contains the trait `PeekRead` and type `PeekReader` implementing it.
+//! Contains the trait `PeekRead` and type `PeekReader` implementing it.
 
-use std::io;
-use std::io::{Read, Write};
+use std::io;
+use std::io::{Read, Write};
 
-use crate::multifilereader::HasError;
+use crate::multifilereader::HasError;
 
-/// A trait which supplies a function to peek into a stream without
-/// actually reading it.
-///
-/// Like `std::io::Read`, it allows to read data from a stream, with
-/// the additional possibility to reserve a part of the returned data
-/// with the data which will be read in subsequent calls.
-///
-pub trait PeekRead {
-    /// Reads data into a buffer.
-    ///
-    /// Fills `out` with data. The last `peek_size` bytes of `out` are
-    /// used for data which keeps available on subsequent calls.
-    /// `peek_size` must be smaller or equal to the size of `out`.
-    ///
-    /// Returns a tuple where the first number is the number of bytes
-    /// read from the stream, and the second number is the number of
-    /// bytes additionally read. Any of the numbers might be zero.
-    /// It can also return an error.
-    ///
-    /// A type implementing this trait, will typically also implement
-    /// `std::io::Read`.
-    ///
-    /// # Panics
-    /// Might panic if `peek_size` is larger then the size of `out`
-    fn peek_read(&mut self, out: &mut [u8], peek_size: usize) -> io::Result<(usize, usize)>;
+/// A trait which supplies a function to peek into a stream without
+/// actually reading it.
+///
+/// Like `std::io::Read`, it allows to read data from a stream, with
+/// the additional possibility to reserve a part of the returned data
+/// with the data which will be read in subsequent calls.
+///
+pub trait PeekRead {
+    /// Reads data into a buffer.
+    ///
+    /// Fills `out` with data. The last `peek_size` bytes of `out` are
+    /// used for data which keeps available on subsequent calls.
+    /// `peek_size` must be smaller or equal to the size of `out`.
+    ///
+    /// Returns a tuple where the first number is the number of bytes
+    /// read from the stream, and the second number is the number of
+    /// bytes additionally read. Any of the numbers might be zero.
+    /// It can also return an error.
+    ///
+    /// A type implementing this trait, will typically also implement
+    /// `std::io::Read`.
+    ///
+    /// # Panics
+    /// Might panic if `peek_size` is larger then the size of `out`
+    fn peek_read(&mut self, out: &mut [u8], peek_size: usize) -> io::Result<(usize, usize)>;
 }
 
-/// Wrapper for `std::io::Read` allowing to peek into the data to be read.
-pub struct PeekReader<R> {
-    inner: R,
-    temp_buffer: Vec<u8>,
+/// Wrapper for `std::io::Read` allowing to peek into the data to be read.
+pub struct PeekReader<R> {
+    inner: R,
+    temp_buffer: Vec<u8>,
 }
 
-impl<R> PeekReader<R> {
-    /// Create a new `PeekReader` wrapping `inner`
-    pub fn new(inner: R) -> Self {
-        Self {
-            inner,
-            temp_buffer: Vec::new(),
+impl<R> PeekReader<R> {
+    /// Create a new `PeekReader` wrapping `inner`
+    pub fn new(inner: R) -> Self {
+        Self {
+            inner,
+            temp_buffer: Vec::new(),
         }
     }
 }
 
-impl<R: Read> PeekReader<R> {
-    fn read_from_tempbuffer(&mut self, mut out: &mut [u8]) -> usize {
-        match out.write(self.temp_buffer.as_mut_slice()) {
-            Ok(n) => {
-                self.temp_buffer.drain(..n);
-                n
+impl<R: Read> PeekReader<R> {
+    fn read_from_tempbuffer(&mut self, mut out: &mut [u8]) -> usize {
+        match out.write(self.temp_buffer.as_mut_slice()) {
+            Ok(n) => {
+                self.temp_buffer.drain(..n);
+                n
             }
             Err(_) => 0,
         }
     }
 
-    fn write_to_tempbuffer(&mut self, bytes: &[u8]) {
-        // if temp_buffer is not empty, data has to be inserted in front
-        let org_buffer: Vec<_> = self.temp_buffer.drain(..).collect();
-        self.temp_buffer.write_all(bytes).unwrap();
-        self.temp_buffer.extend(org_buffer);
+    fn write_to_tempbuffer(&mut self, bytes: &[u8]) {
+        // if temp_buffer is not empty, data has to be inserted in front
+        let org_buffer: Vec<_> = self.temp_buffer.drain(..).collect();
+        self.temp_buffer.write_all(bytes).unwrap();
+        self.temp_buffer.extend(org_buffer);
     }
 }
 
-impl<R: Read> Read for PeekReader<R> {
-    fn read(&mut self, out: &mut [u8]) -> io::Result<usize> {
-        let start_pos = self.read_from_tempbuffer(out);
-        match self.inner.read(&mut out[start_pos..]) {
-            Err(e) => Err(e),
-            Ok(n) => Ok(n + start_pos),
+impl<R: Read> Read for PeekReader<R> {
+    fn read(&mut self, out: &mut [u8]) -> io::Result<usize> {
+        let start_pos = self.read_from_tempbuffer(out);
+        match self.inner.read(&mut out[start_pos..]) {
+            Err(e) => Err(e),
+            Ok(n) => Ok(n + start_pos),
         }
     }
 }
 
-impl<R: Read> PeekRead for PeekReader<R> {
-    /// Reads data into a buffer.
-    ///
-    /// See `PeekRead::peek_read`.
-    ///
-    /// # Panics
-    /// If `peek_size` is larger then the size of `out`
-    fn peek_read(&mut self, out: &mut [u8], peek_size: usize) -> io::Result<(usize, usize)> {
-        assert!(out.len() >= peek_size);
-        match self.read(out) {
-            Err(e) => Err(e),
-            Ok(bytes_in_buffer) => {
-                let unused = out.len() - bytes_in_buffer;
-                if peek_size <= unused {
-                    Ok((bytes_in_buffer, 0))
-                } else {
-                    let actual_peek_size = peek_size - unused;
-                    let real_size = bytes_in_buffer - actual_peek_size;
-                    self.write_to_tempbuffer(&out[real_size..bytes_in_buffer]);
-                    Ok((real_size, actual_peek_size))
+impl<R: Read> PeekRead for PeekReader<R> {
+    /// Reads data into a buffer.
+    ///
+    /// See `PeekRead::peek_read`.
+    ///
+    /// # Panics
+    /// If `peek_size` is larger then the size of `out`
+    fn peek_read(&mut self, out: &mut [u8], peek_size: usize) -> io::Result<(usize, usize)> {
+        assert!(out.len() >= peek_size);
+        match self.read(out) {
+            Err(e) => Err(e),
+            Ok(bytes_in_buffer) => {
+                let unused = out.len() - bytes_in_buffer;
+                if peek_size <= unused {
+                    Ok((bytes_in_buffer, 0))
+                } else {
+                    let actual_peek_size = peek_size - unused;
+                    let real_size = bytes_in_buffer - actual_peek_size;
+                    self.write_to_tempbuffer(&out[real_size..bytes_in_buffer]);
+                    Ok((real_size, actual_peek_size))
                 }
             }
         }
     }
 }
 
-impl<R: HasError> HasError for PeekReader<R> {
-    fn has_error(&self) -> bool {
-        self.inner.has_error()
+impl<R: HasError> HasError for PeekReader<R> {
+    fn has_error(&self) -> bool {
+        self.inner.has_error()
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use std::io::{Cursor, Read};
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use std::io::{Cursor, Read};
 
-    #[test]
-    fn test_read_normal() {
-        let mut sut = PeekReader::new(Cursor::new(&b"abcdefgh"[..]));
+    #[test]
+    fn test_read_normal() {
+        let mut sut = PeekReader::new(Cursor::new(&b"abcdefgh"[..]));
 
-        let mut v = [0; 10];
-        assert_eq!(sut.read(v.as_mut()).unwrap(), 8);
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0]);
+        let mut v = [0; 10];
+        assert_eq!(sut.read(v.as_mut()).unwrap(), 8);
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0]);
     }
 
-    #[test]
-    fn test_peek_read_without_buffer() {
-        let mut sut = PeekReader::new(Cursor::new(&b"abcdefgh"[..]));
+    #[test]
+    fn test_peek_read_without_buffer() {
+        let mut sut = PeekReader::new(Cursor::new(&b"abcdefgh"[..]));
 
-        let mut v = [0; 10];
-        assert_eq!(sut.peek_read(v.as_mut(), 0).unwrap(), (8, 0));
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0]);
+        let mut v = [0; 10];
+        assert_eq!(sut.peek_read(v.as_mut(), 0).unwrap(), (8, 0));
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0, 0]);
     }
 
-    #[test]
-    fn test_peek_read_and_read() {
-        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
+    #[test]
+    fn test_peek_read_and_read() {
+        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
 
-        let mut v = [0; 8];
-        assert_eq!(sut.peek_read(v.as_mut(), 4).unwrap(), (4, 4));
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
+        let mut v = [0; 8];
+        assert_eq!(sut.peek_read(v.as_mut(), 4).unwrap(), (4, 4));
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
 
-        let mut v2 = [0; 8];
-        assert_eq!(sut.read(v2.as_mut()).unwrap(), 6);
-        assert_eq!(v2, [0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0, 0]);
+        let mut v2 = [0; 8];
+        assert_eq!(sut.read(v2.as_mut()).unwrap(), 6);
+        assert_eq!(v2, [0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0, 0]);
     }
 
-    #[test]
-    fn test_peek_read_multiple_times() {
-        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
+    #[test]
+    fn test_peek_read_multiple_times() {
+        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
 
-        let mut s1 = [0; 8];
-        assert_eq!(sut.peek_read(s1.as_mut(), 4).unwrap(), (4, 4));
-        assert_eq!(s1, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
+        let mut s1 = [0; 8];
+        assert_eq!(sut.peek_read(s1.as_mut(), 4).unwrap(), (4, 4));
+        assert_eq!(s1, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
 
-        let mut s2 = [0; 8];
-        assert_eq!(sut.peek_read(s2.as_mut(), 4).unwrap(), (4, 2));
-        assert_eq!(s2, [0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0, 0]);
+        let mut s2 = [0; 8];
+        assert_eq!(sut.peek_read(s2.as_mut(), 4).unwrap(), (4, 2));
+        assert_eq!(s2, [0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0, 0]);
 
-        let mut s3 = [0; 8];
-        assert_eq!(sut.peek_read(s3.as_mut(), 4).unwrap(), (2, 0));
-        assert_eq!(s3, [0x69, 0x6a, 0, 0, 0, 0, 0, 0]);
+        let mut s3 = [0; 8];
+        assert_eq!(sut.peek_read(s3.as_mut(), 4).unwrap(), (2, 0));
+        assert_eq!(s3, [0x69, 0x6a, 0, 0, 0, 0, 0, 0]);
     }
 
-    #[test]
-    fn test_peek_read_and_read_with_small_buffer() {
-        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
+    #[test]
+    fn test_peek_read_and_read_with_small_buffer() {
+        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
 
-        let mut v = [0; 8];
-        assert_eq!(sut.peek_read(v.as_mut(), 4).unwrap(), (4, 4));
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
+        let mut v = [0; 8];
+        assert_eq!(sut.peek_read(v.as_mut(), 4).unwrap(), (4, 4));
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
 
-        let mut v2 = [0; 2];
-        assert_eq!(sut.read(v2.as_mut()).unwrap(), 2);
-        assert_eq!(v2, [0x65, 0x66]);
-        assert_eq!(sut.read(v2.as_mut()).unwrap(), 2);
-        assert_eq!(v2, [0x67, 0x68]);
-        assert_eq!(sut.read(v2.as_mut()).unwrap(), 2);
-        assert_eq!(v2, [0x69, 0x6a]);
+        let mut v2 = [0; 2];
+        assert_eq!(sut.read(v2.as_mut()).unwrap(), 2);
+        assert_eq!(v2, [0x65, 0x66]);
+        assert_eq!(sut.read(v2.as_mut()).unwrap(), 2);
+        assert_eq!(v2, [0x67, 0x68]);
+        assert_eq!(sut.read(v2.as_mut()).unwrap(), 2);
+        assert_eq!(v2, [0x69, 0x6a]);
     }
 
-    #[test]
-    fn test_peek_read_with_smaller_buffer() {
-        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
+    #[test]
+    fn test_peek_read_with_smaller_buffer() {
+        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
 
-        let mut v = [0; 8];
-        assert_eq!(sut.peek_read(v.as_mut(), 4).unwrap(), (4, 4));
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
+        let mut v = [0; 8];
+        assert_eq!(sut.peek_read(v.as_mut(), 4).unwrap(), (4, 4));
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
 
-        let mut v2 = [0; 2];
-        assert_eq!(sut.peek_read(v2.as_mut(), 2).unwrap(), (0, 2));
-        assert_eq!(v2, [0x65, 0x66]);
-        assert_eq!(sut.peek_read(v2.as_mut(), 0).unwrap(), (2, 0));
-        assert_eq!(v2, [0x65, 0x66]);
-        assert_eq!(sut.peek_read(v2.as_mut(), 0).unwrap(), (2, 0));
-        assert_eq!(v2, [0x67, 0x68]);
-        assert_eq!(sut.peek_read(v2.as_mut(), 0).unwrap(), (2, 0));
-        assert_eq!(v2, [0x69, 0x6a]);
+        let mut v2 = [0; 2];
+        assert_eq!(sut.peek_read(v2.as_mut(), 2).unwrap(), (0, 2));
+        assert_eq!(v2, [0x65, 0x66]);
+        assert_eq!(sut.peek_read(v2.as_mut(), 0).unwrap(), (2, 0));
+        assert_eq!(v2, [0x65, 0x66]);
+        assert_eq!(sut.peek_read(v2.as_mut(), 0).unwrap(), (2, 0));
+        assert_eq!(v2, [0x67, 0x68]);
+        assert_eq!(sut.peek_read(v2.as_mut(), 0).unwrap(), (2, 0));
+        assert_eq!(v2, [0x69, 0x6a]);
     }
 
-    #[test]
-    fn test_peek_read_peek_with_larger_peek_buffer() {
-        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
+    #[test]
+    fn test_peek_read_peek_with_larger_peek_buffer() {
+        let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));
 
-        let mut v = [0; 8];
-        assert_eq!(sut.peek_read(v.as_mut(), 4).unwrap(), (4, 4));
-        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
+        let mut v = [0; 8];
+        assert_eq!(sut.peek_read(v.as_mut(), 4).unwrap(), (4, 4));
+        assert_eq!(v, [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68]);
 
-        let mut v2 = [0; 8];
-        assert_eq!(sut.peek_read(v2.as_mut(), 8).unwrap(), (0, 6));
-        assert_eq!(v2, [0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0, 0]);
+        let mut v2 = [0; 8];
+        assert_eq!(sut.peek_read(v2.as_mut(), 8).unwrap(), (0, 6));
+        assert_eq!(v2, [0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0, 0]);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/prn_char.rs.html b/dev/src/uu_od/prn_char.rs.html index 9bcee3db4..ae52708a6 100644 --- a/dev/src/uu_od/prn_char.rs.html +++ b/dev/src/uu_od/prn_char.rs.html @@ -1,4 +1,4 @@ -prn_char.rs - source
1
+prn_char.rs - source
1
 2
 3
 4
@@ -153,23 +153,23 @@
 153
 154
 155
-
use std::str::from_utf8;
+
use std::str::from_utf8;
 
-use crate::formatteriteminfo::*;
+use crate::formatteriteminfo::*;
 
-pub static FORMAT_ITEM_A: FormatterItemInfo = FormatterItemInfo {
-    byte_size: 1,
-    print_width: 4,
-    formatter: FormatWriter::IntWriter(format_item_a),
+pub static FORMAT_ITEM_A: FormatterItemInfo = FormatterItemInfo {
+    byte_size: 1,
+    print_width: 4,
+    formatter: FormatWriter::IntWriter(format_item_a),
 };
 
-pub static FORMAT_ITEM_C: FormatterItemInfo = FormatterItemInfo {
-    byte_size: 1,
-    print_width: 4,
-    formatter: FormatWriter::MultibyteWriter(format_item_c),
+pub static FORMAT_ITEM_C: FormatterItemInfo = FormatterItemInfo {
+    byte_size: 1,
+    print_width: 4,
+    formatter: FormatWriter::MultibyteWriter(format_item_c),
 };
 
-static A_CHARS: [&str; 128] = [
+static A_CHARS: [&str; 128] = [
     "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs", "ht", "nl", "vt", "ff", "cr",
     "so", "si", "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc",
     "fs", "gs", "rs", "us", "sp", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-",
@@ -180,13 +180,13 @@
     "z", "{", "|", "}", "~", "del",
 ];
 
-fn format_item_a(p: u64) -> String {
-    // item-bytes == 1
-    let b = (p & 0x7f) as u8;
-    format!("{:>4}", A_CHARS.get(b as usize).unwrap_or(&"??"))
+fn format_item_a(p: u64) -> String {
+    // item-bytes == 1
+    let b = (p & 0x7f) as u8;
+    format!("{:>4}", A_CHARS.get(b as usize).unwrap_or(&"??"))
 }
 
-static C_CHARS: [&str; 128] = [
+static C_CHARS: [&str; 128] = [
     "\\0", "001", "002", "003", "004", "005", "006", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f",
     "\\r", "016", "017", "020", "021", "022", "023", "024", "025", "026", "027", "030", "031",
     "032", "033", "034", "035", "036", "037", " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")",
@@ -197,116 +197,116 @@
     "v", "w", "x", "y", "z", "{", "|", "}", "~", "177",
 ];
 
-fn format_item_c(bytes: &[u8]) -> String {
-    // item-bytes == 1
-    let b = bytes[0];
+fn format_item_c(bytes: &[u8]) -> String {
+    // item-bytes == 1
+    let b = bytes[0];
 
-    if b & 0x80 == 0x00 {
-        match C_CHARS.get(b as usize) {
-            Some(s) => format!("{:>4}", s),
-            None => format!("{:>4}", b),
+    if b & 0x80 == 0x00 {
+        match C_CHARS.get(b as usize) {
+            Some(s) => format!("{:>4}", s),
+            None => format!("{:>4}", b),
         }
-    } else if (b & 0xc0) == 0x80 {
-        // second or subsequent octet of an utf-8 sequence
-        String::from("  **")
-    } else if ((b & 0xe0) == 0xc0) && (bytes.len() >= 2) {
-        // start of a 2 octet utf-8 sequence
-        match from_utf8(&bytes[0..2]) {
-            Ok(s) => format!("{:>4}", s),
-            Err(_) => format!(" {:03o}", b),
+    } else if (b & 0xc0) == 0x80 {
+        // second or subsequent octet of an utf-8 sequence
+        String::from("  **")
+    } else if ((b & 0xe0) == 0xc0) && (bytes.len() >= 2) {
+        // start of a 2 octet utf-8 sequence
+        match from_utf8(&bytes[0..2]) {
+            Ok(s) => format!("{:>4}", s),
+            Err(_) => format!(" {:03o}", b),
         }
-    } else if ((b & 0xf0) == 0xe0) && (bytes.len() >= 3) {
-        // start of a 3 octet utf-8 sequence
-        match from_utf8(&bytes[0..3]) {
-            Ok(s) => format!("{:>4}", s),
-            Err(_) => format!(" {:03o}", b),
+    } else if ((b & 0xf0) == 0xe0) && (bytes.len() >= 3) {
+        // start of a 3 octet utf-8 sequence
+        match from_utf8(&bytes[0..3]) {
+            Ok(s) => format!("{:>4}", s),
+            Err(_) => format!(" {:03o}", b),
         }
-    } else if ((b & 0xf8) == 0xf0) && (bytes.len() >= 4) {
-        // start of a 4 octet utf-8 sequence
-        match from_utf8(&bytes[0..4]) {
-            Ok(s) => format!("{:>4}", s),
-            Err(_) => format!(" {:03o}", b),
+    } else if ((b & 0xf8) == 0xf0) && (bytes.len() >= 4) {
+        // start of a 4 octet utf-8 sequence
+        match from_utf8(&bytes[0..4]) {
+            Ok(s) => format!("{:>4}", s),
+            Err(_) => format!(" {:03o}", b),
         }
-    } else {
-        // invalid utf-8
-        format!(" {:03o}", b)
+    } else {
+        // invalid utf-8
+        format!(" {:03o}", b)
     }
 }
 
-pub fn format_ascii_dump(bytes: &[u8]) -> String {
-    let mut result = String::new();
+pub fn format_ascii_dump(bytes: &[u8]) -> String {
+    let mut result = String::new();
 
-    result.push('>');
-    for c in bytes.iter() {
-        if *c >= 0x20 && *c <= 0x7e {
-            result.push_str(C_CHARS[*c as usize]);
-        } else {
-            result.push('.');
+    result.push('>');
+    for c in bytes.iter() {
+        if *c >= 0x20 && *c <= 0x7e {
+            result.push_str(C_CHARS[*c as usize]);
+        } else {
+            result.push('.');
         }
     }
-    result.push('<');
+    result.push('<');
 
-    result
+    result
 }
 
-#[test]
-fn test_format_item_a() {
-    assert_eq!(" nul", format_item_a(0x00));
-    assert_eq!(" soh", format_item_a(0x01));
-    assert_eq!("  sp", format_item_a(0x20));
-    assert_eq!("   A", format_item_a(0x41));
-    assert_eq!("   ~", format_item_a(0x7e));
-    assert_eq!(" del", format_item_a(0x7f));
+#[test]
+fn test_format_item_a() {
+    assert_eq!(" nul", format_item_a(0x00));
+    assert_eq!(" soh", format_item_a(0x01));
+    assert_eq!("  sp", format_item_a(0x20));
+    assert_eq!("   A", format_item_a(0x41));
+    assert_eq!("   ~", format_item_a(0x7e));
+    assert_eq!(" del", format_item_a(0x7f));
 
-    assert_eq!(" nul", format_item_a(0x80));
-    assert_eq!("   A", format_item_a(0xc1));
-    assert_eq!("   ~", format_item_a(0xfe));
-    assert_eq!(" del", format_item_a(0xff));
+    assert_eq!(" nul", format_item_a(0x80));
+    assert_eq!("   A", format_item_a(0xc1));
+    assert_eq!("   ~", format_item_a(0xfe));
+    assert_eq!(" del", format_item_a(0xff));
 }
 
-#[test]
-fn test_format_item_c() {
-    assert_eq!("  \\0", format_item_c(&[0x00]));
-    assert_eq!(" 001", format_item_c(&[0x01]));
-    assert_eq!("    ", format_item_c(&[0x20]));
-    assert_eq!("   A", format_item_c(&[0x41]));
-    assert_eq!("   ~", format_item_c(&[0x7e]));
-    assert_eq!(" 177", format_item_c(&[0x7f]));
-    assert_eq!("   A", format_item_c(&[0x41, 0x21]));
+#[test]
+fn test_format_item_c() {
+    assert_eq!("  \\0", format_item_c(&[0x00]));
+    assert_eq!(" 001", format_item_c(&[0x01]));
+    assert_eq!("    ", format_item_c(&[0x20]));
+    assert_eq!("   A", format_item_c(&[0x41]));
+    assert_eq!("   ~", format_item_c(&[0x7e]));
+    assert_eq!(" 177", format_item_c(&[0x7f]));
+    assert_eq!("   A", format_item_c(&[0x41, 0x21]));
 
-    assert_eq!("  **", format_item_c(&[0x80]));
-    assert_eq!("  **", format_item_c(&[0x9f]));
+    assert_eq!("  **", format_item_c(&[0x80]));
+    assert_eq!("  **", format_item_c(&[0x9f]));
 
-    assert_eq!("   ß", format_item_c(&[0xc3, 0x9f]));
-    assert_eq!("   ß", format_item_c(&[0xc3, 0x9f, 0x21]));
+    assert_eq!("   ß", format_item_c(&[0xc3, 0x9f]));
+    assert_eq!("   ß", format_item_c(&[0xc3, 0x9f, 0x21]));
 
-    assert_eq!("   \u{1000}", format_item_c(&[0xe1, 0x80, 0x80]));
-    assert_eq!("   \u{1000}", format_item_c(&[0xe1, 0x80, 0x80, 0x21]));
+    assert_eq!("   \u{1000}", format_item_c(&[0xe1, 0x80, 0x80]));
+    assert_eq!("   \u{1000}", format_item_c(&[0xe1, 0x80, 0x80, 0x21]));
 
-    assert_eq!("   \u{1f496}", format_item_c(&[0xf0, 0x9f, 0x92, 0x96]));
+    assert_eq!("   \u{1f496}", format_item_c(&[0xf0, 0x9f, 0x92, 0x96]));
     assert_eq!(
         "   \u{1f496}",
-        format_item_c(&[0xf0, 0x9f, 0x92, 0x96, 0x21])
+        format_item_c(&[0xf0, 0x9f, 0x92, 0x96, 0x21])
     );
 
-    assert_eq!(" 300", format_item_c(&[0xc0, 0x80])); // invalid utf-8 (UTF-8 null)
-    assert_eq!(" 301", format_item_c(&[0xc1, 0xa1])); // invalid utf-8
-    assert_eq!(" 303", format_item_c(&[0xc3, 0xc3])); // invalid utf-8
-    assert_eq!(" 360", format_item_c(&[0xf0, 0x82, 0x82, 0xac])); // invalid utf-8 (overlong)
-    assert_eq!(" 360", format_item_c(&[0xf0, 0x9f, 0x92])); // invalid utf-8 (missing octet)
-    assert_eq!("   \u{10FFFD}", format_item_c(&[0xf4, 0x8f, 0xbf, 0xbd])); // largest valid utf-8   // spell-checker:ignore 10FFFD FFFD
-    assert_eq!(" 364", format_item_c(&[0xf4, 0x90, 0x00, 0x00])); // invalid utf-8
-    assert_eq!(" 365", format_item_c(&[0xf5, 0x80, 0x80, 0x80])); // invalid utf-8
-    assert_eq!(" 377", format_item_c(&[0xff])); // invalid utf-8
-}
+    assert_eq!(" 300", format_item_c(&[0xc0, 0x80])); // invalid utf-8 (UTF-8 null)
+    assert_eq!(" 301", format_item_c(&[0xc1, 0xa1])); // invalid utf-8
+    assert_eq!(" 303", format_item_c(&[0xc3, 0xc3])); // invalid utf-8
+    assert_eq!(" 360", format_item_c(&[0xf0, 0x82, 0x82, 0xac])); // invalid utf-8 (overlong)
+    assert_eq!(" 360", format_item_c(&[0xf0, 0x9f, 0x92])); // invalid utf-8 (missing octet)
+    assert_eq!("   \u{10FFFD}", format_item_c(&[0xf4, 0x8f, 0xbf, 0xbd])); // largest valid utf-8   // spell-checker:ignore 10FFFD FFFD
+    assert_eq!(" 364", format_item_c(&[0xf4, 0x90, 0x00, 0x00])); // invalid utf-8
+    assert_eq!(" 365", format_item_c(&[0xf5, 0x80, 0x80, 0x80])); // invalid utf-8
+    assert_eq!(" 377", format_item_c(&[0xff])); // invalid utf-8
+}
 
-#[test]
-fn test_format_ascii_dump() {
-    assert_eq!(">.<", format_ascii_dump(&[0x00]));
+#[test]
+fn test_format_ascii_dump() {
+    assert_eq!(">.<", format_ascii_dump(&[0x00]));
     assert_eq!(
         ">. A~.<",
-        format_ascii_dump(&[0x1f, 0x20, 0x41, 0x7e, 0x7f])
+        format_ascii_dump(&[0x1f, 0x20, 0x41, 0x7e, 0x7f])
     );
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/prn_float.rs.html b/dev/src/uu_od/prn_float.rs.html index 10f2bdb84..6819b0384 100644 --- a/dev/src/uu_od/prn_float.rs.html +++ b/dev/src/uu_od/prn_float.rs.html @@ -1,4 +1,4 @@ -prn_float.rs - source
1
+prn_float.rs - source
1
 2
 3
 4
@@ -220,227 +220,227 @@
 220
 221
 222
-
use half::f16;
-use std::f32;
-use std::f64;
-use std::num::FpCategory;
+
use half::f16;
+use std::f32;
+use std::f64;
+use std::num::FpCategory;
 
-use crate::formatteriteminfo::*;
+use crate::formatteriteminfo::*;
 
-pub static FORMAT_ITEM_F16: FormatterItemInfo = FormatterItemInfo {
-    byte_size: 2,
-    print_width: 10,
-    formatter: FormatWriter::FloatWriter(format_item_flo16),
+pub static FORMAT_ITEM_F16: FormatterItemInfo = FormatterItemInfo {
+    byte_size: 2,
+    print_width: 10,
+    formatter: FormatWriter::FloatWriter(format_item_flo16),
 };
 
-pub static FORMAT_ITEM_F32: FormatterItemInfo = FormatterItemInfo {
-    byte_size: 4,
-    print_width: 15,
-    formatter: FormatWriter::FloatWriter(format_item_flo32),
+pub static FORMAT_ITEM_F32: FormatterItemInfo = FormatterItemInfo {
+    byte_size: 4,
+    print_width: 15,
+    formatter: FormatWriter::FloatWriter(format_item_flo32),
 };
 
-pub static FORMAT_ITEM_F64: FormatterItemInfo = FormatterItemInfo {
-    byte_size: 8,
-    print_width: 25,
-    formatter: FormatWriter::FloatWriter(format_item_flo64),
+pub static FORMAT_ITEM_F64: FormatterItemInfo = FormatterItemInfo {
+    byte_size: 8,
+    print_width: 25,
+    formatter: FormatWriter::FloatWriter(format_item_flo64),
 };
 
-pub fn format_item_flo16(f: f64) -> String {
-    format!(" {}", format_flo16(f16::from_f64(f)))
+pub fn format_item_flo16(f: f64) -> String {
+    format!(" {}", format_flo16(f16::from_f64(f)))
 }
 
-pub fn format_item_flo32(f: f64) -> String {
-    format!(" {}", format_flo32(f as f32))
+pub fn format_item_flo32(f: f64) -> String {
+    format!(" {}", format_flo32(f as f32))
 }
 
-pub fn format_item_flo64(f: f64) -> String {
-    format!(" {}", format_flo64(f))
+pub fn format_item_flo64(f: f64) -> String {
+    format!(" {}", format_flo64(f))
 }
 
-fn format_flo16(f: f16) -> String {
-    format_float(f64::from(f), 9, 4)
+fn format_flo16(f: f16) -> String {
+    format_float(f64::from(f), 9, 4)
 }
 
-// formats float with 8 significant digits, eg 12345678 or -1.2345678e+12
-// always returns a string of 14 characters
-fn format_flo32(f: f32) -> String {
-    let width: usize = 14;
-    let precision: usize = 8;
+// formats float with 8 significant digits, eg 12345678 or -1.2345678e+12
+// always returns a string of 14 characters
+fn format_flo32(f: f32) -> String {
+    let width: usize = 14;
+    let precision: usize = 8;
 
-    if f.classify() == FpCategory::Subnormal {
-        // subnormal numbers will be normal as f64, so will print with a wrong precision
-        format!("{:width$e}", f, width = width) // subnormal numbers
-    } else {
-        format_float(f64::from(f), width, precision)
+    if f.classify() == FpCategory::Subnormal {
+        // subnormal numbers will be normal as f64, so will print with a wrong precision
+        format!("{:width$e}", f, width = width) // subnormal numbers
+    } else {
+        format_float(f64::from(f), width, precision)
     }
 }
 
-fn format_flo64(f: f64) -> String {
-    format_float(f, 24, 17)
+fn format_flo64(f: f64) -> String {
+    format_float(f, 24, 17)
 }
 
-fn format_float(f: f64, width: usize, precision: usize) -> String {
-    if !f.is_normal() {
-        if f == -0.0 && f.is_sign_negative() {
-            return format!("{:>width$}", "-0", width = width);
+fn format_float(f: f64, width: usize, precision: usize) -> String {
+    if !f.is_normal() {
+        if f == -0.0 && f.is_sign_negative() {
+            return format!("{:>width$}", "-0", width = width);
         }
-        if f == 0.0 || !f.is_finite() {
-            return format!("{:width$}", f, width = width);
+        if f == 0.0 || !f.is_finite() {
+            return format!("{:width$}", f, width = width);
         }
-        return format!("{:width$e}", f, width = width); // subnormal numbers
+        return format!("{:width$e}", f, width = width); // subnormal numbers
+    }
+
+    let mut l = f.abs().log10().floor() as i32;
+
+    let r = 10f64.powi(l);
+    if (f > 0.0 && r > f) || (f < 0.0 && -r < f) {
+        // fix precision error
+        l -= 1;
     }
 
-    let mut l = f.abs().log10().floor() as i32;
-
-    let r = 10f64.powi(l);
-    if (f > 0.0 && r > f) || (f < 0.0 && -r < f) {
-        // fix precision error
-        l -= 1;
-    }
-
-    if l >= 0 && l <= (precision as i32 - 1) {
+    if l >= 0 && l <= (precision as i32 - 1) {
         format!(
             "{:width$.dec$}",
-            f,
-            width = width,
-            dec = (precision - 1) - l as usize
+            f,
+            width = width,
+            dec = (precision - 1) - l as usize
         )
-    } else if l == -1 {
-        format!("{:width$.dec$}", f, width = width, dec = precision)
-    } else {
-        format!("{:width$.dec$e}", f, width = width, dec = precision - 1)
+    } else if l == -1 {
+        format!("{:width$.dec$}", f, width = width, dec = precision)
+    } else {
+        format!("{:width$.dec$e}", f, width = width, dec = precision - 1)
     }
 }
 
-#[test]
-#[allow(clippy::excessive_precision)]
-fn test_format_flo32() {
-    assert_eq!(format_flo32(1.0), "     1.0000000");
-    assert_eq!(format_flo32(9.9999990), "     9.9999990");
-    assert_eq!(format_flo32(10.0), "     10.000000");
-    assert_eq!(format_flo32(99.999977), "     99.999977");
-    assert_eq!(format_flo32(99.999992), "     99.999992");
-    assert_eq!(format_flo32(100.0), "     100.00000");
-    assert_eq!(format_flo32(999.99994), "     999.99994");
-    assert_eq!(format_flo32(1000.0), "     1000.0000");
-    assert_eq!(format_flo32(9999.9990), "     9999.9990");
-    assert_eq!(format_flo32(10000.0), "     10000.000");
-    assert_eq!(format_flo32(99999.992), "     99999.992");
-    assert_eq!(format_flo32(100000.0), "     100000.00");
-    assert_eq!(format_flo32(999999.94), "     999999.94");
-    assert_eq!(format_flo32(1000000.0), "     1000000.0");
-    assert_eq!(format_flo32(9999999.0), "     9999999.0");
-    assert_eq!(format_flo32(10000000.0), "      10000000");
-    assert_eq!(format_flo32(99999992.0), "      99999992");
-    assert_eq!(format_flo32(100000000.0), "   1.0000000e8");
-    assert_eq!(format_flo32(9.9999994e8), "   9.9999994e8");
-    assert_eq!(format_flo32(1.0e9), "   1.0000000e9");
-    assert_eq!(format_flo32(9.9999990e9), "   9.9999990e9");
-    assert_eq!(format_flo32(1.0e10), "  1.0000000e10");
+#[test]
+#[allow(clippy::excessive_precision)]
+fn test_format_flo32() {
+    assert_eq!(format_flo32(1.0), "     1.0000000");
+    assert_eq!(format_flo32(9.9999990), "     9.9999990");
+    assert_eq!(format_flo32(10.0), "     10.000000");
+    assert_eq!(format_flo32(99.999977), "     99.999977");
+    assert_eq!(format_flo32(99.999992), "     99.999992");
+    assert_eq!(format_flo32(100.0), "     100.00000");
+    assert_eq!(format_flo32(999.99994), "     999.99994");
+    assert_eq!(format_flo32(1000.0), "     1000.0000");
+    assert_eq!(format_flo32(9999.9990), "     9999.9990");
+    assert_eq!(format_flo32(10000.0), "     10000.000");
+    assert_eq!(format_flo32(99999.992), "     99999.992");
+    assert_eq!(format_flo32(100000.0), "     100000.00");
+    assert_eq!(format_flo32(999999.94), "     999999.94");
+    assert_eq!(format_flo32(1000000.0), "     1000000.0");
+    assert_eq!(format_flo32(9999999.0), "     9999999.0");
+    assert_eq!(format_flo32(10000000.0), "      10000000");
+    assert_eq!(format_flo32(99999992.0), "      99999992");
+    assert_eq!(format_flo32(100000000.0), "   1.0000000e8");
+    assert_eq!(format_flo32(9.9999994e8), "   9.9999994e8");
+    assert_eq!(format_flo32(1.0e9), "   1.0000000e9");
+    assert_eq!(format_flo32(9.9999990e9), "   9.9999990e9");
+    assert_eq!(format_flo32(1.0e10), "  1.0000000e10");
 
-    assert_eq!(format_flo32(0.1), "    0.10000000");
-    assert_eq!(format_flo32(0.99999994), "    0.99999994");
-    assert_eq!(format_flo32(0.010000001), "  1.0000001e-2");
-    assert_eq!(format_flo32(0.099999994), "  9.9999994e-2");
-    assert_eq!(format_flo32(0.001), "  1.0000000e-3");
-    assert_eq!(format_flo32(0.0099999998), "  9.9999998e-3");
+    assert_eq!(format_flo32(0.1), "    0.10000000");
+    assert_eq!(format_flo32(0.99999994), "    0.99999994");
+    assert_eq!(format_flo32(0.010000001), "  1.0000001e-2");
+    assert_eq!(format_flo32(0.099999994), "  9.9999994e-2");
+    assert_eq!(format_flo32(0.001), "  1.0000000e-3");
+    assert_eq!(format_flo32(0.0099999998), "  9.9999998e-3");
 
-    assert_eq!(format_flo32(-1.0), "    -1.0000000");
-    assert_eq!(format_flo32(-9.9999990), "    -9.9999990");
-    assert_eq!(format_flo32(-10.0), "    -10.000000");
-    assert_eq!(format_flo32(-99.999977), "    -99.999977");
-    assert_eq!(format_flo32(-99.999992), "    -99.999992");
-    assert_eq!(format_flo32(-100.0), "    -100.00000");
-    assert_eq!(format_flo32(-999.99994), "    -999.99994");
-    assert_eq!(format_flo32(-1000.0), "    -1000.0000");
-    assert_eq!(format_flo32(-9999.9990), "    -9999.9990");
-    assert_eq!(format_flo32(-10000.0), "    -10000.000");
-    assert_eq!(format_flo32(-99999.992), "    -99999.992");
-    assert_eq!(format_flo32(-100000.0), "    -100000.00");
-    assert_eq!(format_flo32(-999999.94), "    -999999.94");
-    assert_eq!(format_flo32(-1000000.0), "    -1000000.0");
-    assert_eq!(format_flo32(-9999999.0), "    -9999999.0");
-    assert_eq!(format_flo32(-10000000.0), "     -10000000");
-    assert_eq!(format_flo32(-99999992.0), "     -99999992");
-    assert_eq!(format_flo32(-100000000.0), "  -1.0000000e8");
-    assert_eq!(format_flo32(-9.9999994e8), "  -9.9999994e8");
-    assert_eq!(format_flo32(-1.0e9), "  -1.0000000e9");
-    assert_eq!(format_flo32(-9.9999990e9), "  -9.9999990e9");
-    assert_eq!(format_flo32(-1.0e10), " -1.0000000e10");
+    assert_eq!(format_flo32(-1.0), "    -1.0000000");
+    assert_eq!(format_flo32(-9.9999990), "    -9.9999990");
+    assert_eq!(format_flo32(-10.0), "    -10.000000");
+    assert_eq!(format_flo32(-99.999977), "    -99.999977");
+    assert_eq!(format_flo32(-99.999992), "    -99.999992");
+    assert_eq!(format_flo32(-100.0), "    -100.00000");
+    assert_eq!(format_flo32(-999.99994), "    -999.99994");
+    assert_eq!(format_flo32(-1000.0), "    -1000.0000");
+    assert_eq!(format_flo32(-9999.9990), "    -9999.9990");
+    assert_eq!(format_flo32(-10000.0), "    -10000.000");
+    assert_eq!(format_flo32(-99999.992), "    -99999.992");
+    assert_eq!(format_flo32(-100000.0), "    -100000.00");
+    assert_eq!(format_flo32(-999999.94), "    -999999.94");
+    assert_eq!(format_flo32(-1000000.0), "    -1000000.0");
+    assert_eq!(format_flo32(-9999999.0), "    -9999999.0");
+    assert_eq!(format_flo32(-10000000.0), "     -10000000");
+    assert_eq!(format_flo32(-99999992.0), "     -99999992");
+    assert_eq!(format_flo32(-100000000.0), "  -1.0000000e8");
+    assert_eq!(format_flo32(-9.9999994e8), "  -9.9999994e8");
+    assert_eq!(format_flo32(-1.0e9), "  -1.0000000e9");
+    assert_eq!(format_flo32(-9.9999990e9), "  -9.9999990e9");
+    assert_eq!(format_flo32(-1.0e10), " -1.0000000e10");
 
-    assert_eq!(format_flo32(-0.1), "   -0.10000000");
-    assert_eq!(format_flo32(-0.99999994), "   -0.99999994");
-    assert_eq!(format_flo32(-0.010000001), " -1.0000001e-2");
-    assert_eq!(format_flo32(-0.099999994), " -9.9999994e-2");
-    assert_eq!(format_flo32(-0.001), " -1.0000000e-3");
-    assert_eq!(format_flo32(-0.0099999998), " -9.9999998e-3");
+    assert_eq!(format_flo32(-0.1), "   -0.10000000");
+    assert_eq!(format_flo32(-0.99999994), "   -0.99999994");
+    assert_eq!(format_flo32(-0.010000001), " -1.0000001e-2");
+    assert_eq!(format_flo32(-0.099999994), " -9.9999994e-2");
+    assert_eq!(format_flo32(-0.001), " -1.0000000e-3");
+    assert_eq!(format_flo32(-0.0099999998), " -9.9999998e-3");
 
-    assert_eq!(format_flo32(3.4028233e38), "  3.4028233e38");
-    assert_eq!(format_flo32(-3.4028233e38), " -3.4028233e38");
-    assert_eq!(format_flo32(-1.1663108e-38), "-1.1663108e-38");
-    assert_eq!(format_flo32(-4.7019771e-38), "-4.7019771e-38");
-    assert_eq!(format_flo32(1e-45), "         1e-45");
+    assert_eq!(format_flo32(3.4028233e38), "  3.4028233e38");
+    assert_eq!(format_flo32(-3.4028233e38), " -3.4028233e38");
+    assert_eq!(format_flo32(-1.1663108e-38), "-1.1663108e-38");
+    assert_eq!(format_flo32(-4.7019771e-38), "-4.7019771e-38");
+    assert_eq!(format_flo32(1e-45), "         1e-45");
 
-    assert_eq!(format_flo32(-3.402823466e+38), " -3.4028235e38");
-    assert_eq!(format_flo32(f32::NAN), "           NaN");
-    assert_eq!(format_flo32(f32::INFINITY), "           inf");
-    assert_eq!(format_flo32(f32::NEG_INFINITY), "          -inf");
-    assert_eq!(format_flo32(-0.0), "            -0");
-    assert_eq!(format_flo32(0.0), "             0");
+    assert_eq!(format_flo32(-3.402823466e+38), " -3.4028235e38");
+    assert_eq!(format_flo32(f32::NAN), "           NaN");
+    assert_eq!(format_flo32(f32::INFINITY), "           inf");
+    assert_eq!(format_flo32(f32::NEG_INFINITY), "          -inf");
+    assert_eq!(format_flo32(-0.0), "            -0");
+    assert_eq!(format_flo32(0.0), "             0");
 }
 
-#[test]
-fn test_format_flo64() {
-    assert_eq!(format_flo64(1.0), "      1.0000000000000000");
-    assert_eq!(format_flo64(10.0), "      10.000000000000000");
-    assert_eq!(format_flo64(1000000000000000.0), "      1000000000000000.0");
+#[test]
+fn test_format_flo64() {
+    assert_eq!(format_flo64(1.0), "      1.0000000000000000");
+    assert_eq!(format_flo64(10.0), "      10.000000000000000");
+    assert_eq!(format_flo64(1000000000000000.0), "      1000000000000000.0");
     assert_eq!(
-        format_flo64(10000000000000000.0),
-        "       10000000000000000"
-    );
+        format_flo64(10000000000000000.0),
+        "       10000000000000000"
+    );
     assert_eq!(
-        format_flo64(100000000000000000.0),
-        "   1.0000000000000000e17"
-    );
+        format_flo64(100000000000000000.0),
+        "   1.0000000000000000e17"
+    );
 
-    assert_eq!(format_flo64(-0.1), "    -0.10000000000000001");
-    assert_eq!(format_flo64(-0.01), "  -1.0000000000000000e-2");
+    assert_eq!(format_flo64(-0.1), "    -0.10000000000000001");
+    assert_eq!(format_flo64(-0.01), "  -1.0000000000000000e-2");
 
     assert_eq!(
-        format_flo64(-2.2250738585072014e-308),
-        "-2.2250738585072014e-308"
-    );
-    assert_eq!(format_flo64(4e-320), "                  4e-320");
-    assert_eq!(format_flo64(f64::NAN), "                     NaN");
-    assert_eq!(format_flo64(f64::INFINITY), "                     inf");
-    assert_eq!(format_flo64(f64::NEG_INFINITY), "                    -inf");
-    assert_eq!(format_flo64(-0.0), "                      -0");
-    assert_eq!(format_flo64(0.0), "                       0");
+        format_flo64(-2.2250738585072014e-308),
+        "-2.2250738585072014e-308"
+    );
+    assert_eq!(format_flo64(4e-320), "                  4e-320");
+    assert_eq!(format_flo64(f64::NAN), "                     NaN");
+    assert_eq!(format_flo64(f64::INFINITY), "                     inf");
+    assert_eq!(format_flo64(f64::NEG_INFINITY), "                    -inf");
+    assert_eq!(format_flo64(-0.0), "                      -0");
+    assert_eq!(format_flo64(0.0), "                       0");
 }
 
-#[test]
-fn test_format_flo16() {
-    assert_eq!(format_flo16(f16::from_bits(0x8400u16)), "-6.104e-5");
-    assert_eq!(format_flo16(f16::from_bits(0x8401u16)), "-6.109e-5");
-    assert_eq!(format_flo16(f16::from_bits(0x8402u16)), "-6.115e-5");
-    assert_eq!(format_flo16(f16::from_bits(0x8403u16)), "-6.121e-5");
+#[test]
+fn test_format_flo16() {
+    assert_eq!(format_flo16(f16::from_bits(0x8400u16)), "-6.104e-5");
+    assert_eq!(format_flo16(f16::from_bits(0x8401u16)), "-6.109e-5");
+    assert_eq!(format_flo16(f16::from_bits(0x8402u16)), "-6.115e-5");
+    assert_eq!(format_flo16(f16::from_bits(0x8403u16)), "-6.121e-5");
 
-    assert_eq!(format_flo16(f16::from_f32(1.0)), "    1.000");
-    assert_eq!(format_flo16(f16::from_f32(10.0)), "    10.00");
-    assert_eq!(format_flo16(f16::from_f32(100.0)), "    100.0");
-    assert_eq!(format_flo16(f16::from_f32(1000.0)), "     1000");
-    assert_eq!(format_flo16(f16::from_f32(10000.0)), "  1.000e4");
+    assert_eq!(format_flo16(f16::from_f32(1.0)), "    1.000");
+    assert_eq!(format_flo16(f16::from_f32(10.0)), "    10.00");
+    assert_eq!(format_flo16(f16::from_f32(100.0)), "    100.0");
+    assert_eq!(format_flo16(f16::from_f32(1000.0)), "     1000");
+    assert_eq!(format_flo16(f16::from_f32(10000.0)), "  1.000e4");
 
-    assert_eq!(format_flo16(f16::from_f32(-0.2)), "  -0.2000");
-    assert_eq!(format_flo16(f16::from_f32(-0.02)), "-2.000e-2");
+    assert_eq!(format_flo16(f16::from_f32(-0.2)), "  -0.2000");
+    assert_eq!(format_flo16(f16::from_f32(-0.02)), "-2.000e-2");
 
-    assert_eq!(format_flo16(f16::MIN_POSITIVE_SUBNORMAL), " 5.960e-8");
-    assert_eq!(format_flo16(f16::MIN), " -6.550e4");
-    assert_eq!(format_flo16(f16::NAN), "      NaN");
-    assert_eq!(format_flo16(f16::INFINITY), "      inf");
-    assert_eq!(format_flo16(f16::NEG_INFINITY), "     -inf");
-    assert_eq!(format_flo16(f16::NEG_ZERO), "       -0");
-    assert_eq!(format_flo16(f16::ZERO), "        0");
+    assert_eq!(format_flo16(f16::MIN_POSITIVE_SUBNORMAL), " 5.960e-8");
+    assert_eq!(format_flo16(f16::MIN), " -6.550e4");
+    assert_eq!(format_flo16(f16::NAN), "      NaN");
+    assert_eq!(format_flo16(f16::INFINITY), "      inf");
+    assert_eq!(format_flo16(f16::NEG_INFINITY), "     -inf");
+    assert_eq!(format_flo16(f16::NEG_ZERO), "       -0");
+    assert_eq!(format_flo16(f16::ZERO), "        0");
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_od/prn_int.rs.html b/dev/src/uu_od/prn_int.rs.html index c5fa9da1c..068bb8a74 100644 --- a/dev/src/uu_od/prn_int.rs.html +++ b/dev/src/uu_od/prn_int.rs.html @@ -1,4 +1,4 @@ -prn_int.rs - source
1
+prn_int.rs - source
1
 2
 3
 4
@@ -195,202 +195,202 @@
 195
 196
 197
-
use crate::formatteriteminfo::*;
+
use crate::formatteriteminfo::*;
 
-/// format string to print octal using `int_writer_unsigned`
-macro_rules! OCT {
+/// format string to print octal using `int_writer_unsigned`
+macro_rules! OCT {
     () => {
-        " {:0width$o}"
-    };
+        " {:0width$o}"
+    };
 }
-/// format string to print hexadecimal using `int_writer_unsigned`
-macro_rules! HEX {
+/// format string to print hexadecimal using `int_writer_unsigned`
+macro_rules! HEX {
     () => {
-        " {:0width$x}"
-    };
+        " {:0width$x}"
+    };
 }
-/// format string to print decimal using `int_writer_unsigned` or `int_writer_signed`
-macro_rules! DEC {
+/// format string to print decimal using `int_writer_unsigned` or `int_writer_signed`
+macro_rules! DEC {
     () => {
-        " {:width$}"
-    };
+        " {:width$}"
+    };
 }
 
-/// defines a static struct of type `FormatterItemInfo` called `$NAME`
-///
-/// Used to format unsigned integer types with help of a function called `$function`
-/// `$byte_size` is the size of the type, `$print_width` is the maximum width in
-/// human-readable format. `$format_str` is one of OCT, HEX or DEC
-macro_rules! int_writer_unsigned {
-    ($NAME:ident, $byte_size:expr, $print_width:expr, $function:ident, $format_str:expr) => {
-        fn $function(p: u64) -> String {
-            format!($format_str, p, width = $print_width - 1)
+/// defines a static struct of type `FormatterItemInfo` called `$NAME`
+///
+/// Used to format unsigned integer types with help of a function called `$function`
+/// `$byte_size` is the size of the type, `$print_width` is the maximum width in
+/// human-readable format. `$format_str` is one of OCT, HEX or DEC
+macro_rules! int_writer_unsigned {
+    ($NAME:ident, $byte_size:expr, $print_width:expr, $function:ident, $format_str:expr) => {
+        fn $function(p: u64) -> String {
+            format!($format_str, p, width = $print_width - 1)
         }
 
-        pub static $NAME: FormatterItemInfo = FormatterItemInfo {
-            byte_size: $byte_size,
-            print_width: $print_width,
-            formatter: FormatWriter::IntWriter($function),
+        pub static $NAME: FormatterItemInfo = FormatterItemInfo {
+            byte_size: $byte_size,
+            print_width: $print_width,
+            formatter: FormatWriter::IntWriter($function),
         };
     };
 }
 
-/// defines a static struct of type `FormatterItemInfo` called `$NAME`
-///
-/// Used to format signed integer types with help of a function called `$function`
-/// `$byte_size` is the size of the type, `$print_width` is the maximum width in
-/// human-readable format. `$format_str` should be DEC
-macro_rules! int_writer_signed {
-    ($NAME:ident, $byte_size:expr, $print_width:expr, $function:ident, $format_str:expr) => {
-        fn $function(p: u64) -> String {
-            let s = sign_extend(p, $byte_size);
-            format!($format_str, s, width = $print_width - 1)
+/// defines a static struct of type `FormatterItemInfo` called `$NAME`
+///
+/// Used to format signed integer types with help of a function called `$function`
+/// `$byte_size` is the size of the type, `$print_width` is the maximum width in
+/// human-readable format. `$format_str` should be DEC
+macro_rules! int_writer_signed {
+    ($NAME:ident, $byte_size:expr, $print_width:expr, $function:ident, $format_str:expr) => {
+        fn $function(p: u64) -> String {
+            let s = sign_extend(p, $byte_size);
+            format!($format_str, s, width = $print_width - 1)
         }
 
-        pub static $NAME: FormatterItemInfo = FormatterItemInfo {
-            byte_size: $byte_size,
-            print_width: $print_width,
-            formatter: FormatWriter::IntWriter($function),
+        pub static $NAME: FormatterItemInfo = FormatterItemInfo {
+            byte_size: $byte_size,
+            print_width: $print_width,
+            formatter: FormatWriter::IntWriter($function),
         };
     };
 }
 
-/// Extends a signed number in `item` of `item_bytes` bytes into a (signed) i64
-fn sign_extend(item: u64, item_bytes: usize) -> i64 {
-    let shift = 64 - item_bytes * 8;
-    (item << shift) as i64 >> shift
+/// Extends a signed number in `item` of `item_bytes` bytes into a (signed) i64
+fn sign_extend(item: u64, item_bytes: usize) -> i64 {
+    let shift = 64 - item_bytes * 8;
+    (item << shift) as i64 >> shift
 }
 
-int_writer_unsigned!(FORMAT_ITEM_OCT8, 1, 4, format_item_oct8, OCT!()); // max: 377
-int_writer_unsigned!(FORMAT_ITEM_OCT16, 2, 7, format_item_oct16, OCT!()); // max: 177777
-int_writer_unsigned!(FORMAT_ITEM_OCT32, 4, 12, format_item_oct32, OCT!()); // max: 37777777777
-int_writer_unsigned!(FORMAT_ITEM_OCT64, 8, 23, format_item_oct64, OCT!()); // max: 1777777777777777777777
+int_writer_unsigned!(FORMAT_ITEM_OCT8, 1, 4, format_item_oct8, OCT!()); // max: 377
+int_writer_unsigned!(FORMAT_ITEM_OCT16, 2, 7, format_item_oct16, OCT!()); // max: 177777
+int_writer_unsigned!(FORMAT_ITEM_OCT32, 4, 12, format_item_oct32, OCT!()); // max: 37777777777
+int_writer_unsigned!(FORMAT_ITEM_OCT64, 8, 23, format_item_oct64, OCT!()); // max: 1777777777777777777777
 
-int_writer_unsigned!(FORMAT_ITEM_HEX8, 1, 3, format_item_hex8, HEX!()); // max: ff
-int_writer_unsigned!(FORMAT_ITEM_HEX16, 2, 5, format_item_hex16, HEX!()); // max: ffff
-int_writer_unsigned!(FORMAT_ITEM_HEX32, 4, 9, format_item_hex32, HEX!()); // max: ffffffff
-int_writer_unsigned!(FORMAT_ITEM_HEX64, 8, 17, format_item_hex64, HEX!()); // max: ffffffffffffffff
+int_writer_unsigned!(FORMAT_ITEM_HEX8, 1, 3, format_item_hex8, HEX!()); // max: ff
+int_writer_unsigned!(FORMAT_ITEM_HEX16, 2, 5, format_item_hex16, HEX!()); // max: ffff
+int_writer_unsigned!(FORMAT_ITEM_HEX32, 4, 9, format_item_hex32, HEX!()); // max: ffffffff
+int_writer_unsigned!(FORMAT_ITEM_HEX64, 8, 17, format_item_hex64, HEX!()); // max: ffffffffffffffff
 
-int_writer_unsigned!(FORMAT_ITEM_DEC8U, 1, 4, format_item_dec_u8, DEC!()); // max: 255
-int_writer_unsigned!(FORMAT_ITEM_DEC16U, 2, 6, format_item_dec_u16, DEC!()); // max: 65535
-int_writer_unsigned!(FORMAT_ITEM_DEC32U, 4, 11, format_item_dec_u32, DEC!()); // max: 4294967295
-int_writer_unsigned!(FORMAT_ITEM_DEC64U, 8, 21, format_item_dec_u64, DEC!()); // max: 18446744073709551615
+int_writer_unsigned!(FORMAT_ITEM_DEC8U, 1, 4, format_item_dec_u8, DEC!()); // max: 255
+int_writer_unsigned!(FORMAT_ITEM_DEC16U, 2, 6, format_item_dec_u16, DEC!()); // max: 65535
+int_writer_unsigned!(FORMAT_ITEM_DEC32U, 4, 11, format_item_dec_u32, DEC!()); // max: 4294967295
+int_writer_unsigned!(FORMAT_ITEM_DEC64U, 8, 21, format_item_dec_u64, DEC!()); // max: 18446744073709551615
 
-int_writer_signed!(FORMAT_ITEM_DEC8S, 1, 5, format_item_dec_s8, DEC!()); // max: -128
-int_writer_signed!(FORMAT_ITEM_DEC16S, 2, 7, format_item_dec_s16, DEC!()); // max: -32768
-int_writer_signed!(FORMAT_ITEM_DEC32S, 4, 12, format_item_dec_s32, DEC!()); // max: -2147483648
-int_writer_signed!(FORMAT_ITEM_DEC64S, 8, 21, format_item_dec_s64, DEC!()); // max: -9223372036854775808
+int_writer_signed!(FORMAT_ITEM_DEC8S, 1, 5, format_item_dec_s8, DEC!()); // max: -128
+int_writer_signed!(FORMAT_ITEM_DEC16S, 2, 7, format_item_dec_s16, DEC!()); // max: -32768
+int_writer_signed!(FORMAT_ITEM_DEC32S, 4, 12, format_item_dec_s32, DEC!()); // max: -2147483648
+int_writer_signed!(FORMAT_ITEM_DEC64S, 8, 21, format_item_dec_s64, DEC!()); // max: -9223372036854775808
 
-#[test]
-fn test_sign_extend() {
+#[test]
+fn test_sign_extend() {
     assert_eq!(
-        0xffff_ffff_ffff_ff80u64 as i64,
-        sign_extend(0x0000_0000_0000_0080, 1)
+        0xffff_ffff_ffff_ff80u64 as i64,
+        sign_extend(0x0000_0000_0000_0080, 1)
     );
     assert_eq!(
-        0xffff_ffff_ffff_8000u64 as i64,
-        sign_extend(0x0000_0000_0000_8000, 2)
+        0xffff_ffff_ffff_8000u64 as i64,
+        sign_extend(0x0000_0000_0000_8000, 2)
     );
     assert_eq!(
-        0xffff_ffff_ff80_0000u64 as i64,
-        sign_extend(0x0000_0000_0080_0000, 3)
+        0xffff_ffff_ff80_0000u64 as i64,
+        sign_extend(0x0000_0000_0080_0000, 3)
     );
     assert_eq!(
-        0xffff_ffff_8000_0000u64 as i64,
-        sign_extend(0x0000_0000_8000_0000, 4)
+        0xffff_ffff_8000_0000u64 as i64,
+        sign_extend(0x0000_0000_8000_0000, 4)
     );
     assert_eq!(
-        0xffff_ff80_0000_0000u64 as i64,
-        sign_extend(0x0000_0080_0000_0000, 5)
+        0xffff_ff80_0000_0000u64 as i64,
+        sign_extend(0x0000_0080_0000_0000, 5)
     );
     assert_eq!(
-        0xffff_8000_0000_0000u64 as i64,
-        sign_extend(0x0000_8000_0000_0000, 6)
+        0xffff_8000_0000_0000u64 as i64,
+        sign_extend(0x0000_8000_0000_0000, 6)
     );
     assert_eq!(
-        0xff80_0000_0000_0000u64 as i64,
-        sign_extend(0x0080_0000_0000_0000, 7)
+        0xff80_0000_0000_0000u64 as i64,
+        sign_extend(0x0080_0000_0000_0000, 7)
     );
     assert_eq!(
-        0x8000_0000_0000_0000u64 as i64,
-        sign_extend(0x8000_0000_0000_0000, 8)
+        0x8000_0000_0000_0000u64 as i64,
+        sign_extend(0x8000_0000_0000_0000, 8)
     );
 
-    assert_eq!(0x0000_0000_0000_007f, sign_extend(0x0000_0000_0000_007f, 1));
-    assert_eq!(0x0000_0000_0000_7fff, sign_extend(0x0000_0000_0000_7fff, 2));
-    assert_eq!(0x0000_0000_007f_ffff, sign_extend(0x0000_0000_007f_ffff, 3));
-    assert_eq!(0x0000_0000_7fff_ffff, sign_extend(0x0000_0000_7fff_ffff, 4));
-    assert_eq!(0x0000_007f_ffff_ffff, sign_extend(0x0000_007f_ffff_ffff, 5));
-    assert_eq!(0x0000_7fff_ffff_ffff, sign_extend(0x0000_7fff_ffff_ffff, 6));
-    assert_eq!(0x007f_ffff_ffff_ffff, sign_extend(0x007f_ffff_ffff_ffff, 7));
-    assert_eq!(0x7fff_ffff_ffff_ffff, sign_extend(0x7fff_ffff_ffff_ffff, 8));
+    assert_eq!(0x0000_0000_0000_007f, sign_extend(0x0000_0000_0000_007f, 1));
+    assert_eq!(0x0000_0000_0000_7fff, sign_extend(0x0000_0000_0000_7fff, 2));
+    assert_eq!(0x0000_0000_007f_ffff, sign_extend(0x0000_0000_007f_ffff, 3));
+    assert_eq!(0x0000_0000_7fff_ffff, sign_extend(0x0000_0000_7fff_ffff, 4));
+    assert_eq!(0x0000_007f_ffff_ffff, sign_extend(0x0000_007f_ffff_ffff, 5));
+    assert_eq!(0x0000_7fff_ffff_ffff, sign_extend(0x0000_7fff_ffff_ffff, 6));
+    assert_eq!(0x007f_ffff_ffff_ffff, sign_extend(0x007f_ffff_ffff_ffff, 7));
+    assert_eq!(0x7fff_ffff_ffff_ffff, sign_extend(0x7fff_ffff_ffff_ffff, 8));
 }
 
-#[test]
-fn test_format_item_oct() {
-    assert_eq!(" 000", format_item_oct8(0));
-    assert_eq!(" 377", format_item_oct8(0xff));
-    assert_eq!(" 000000", format_item_oct16(0));
-    assert_eq!(" 177777", format_item_oct16(0xffff));
-    assert_eq!(" 00000000000", format_item_oct32(0));
-    assert_eq!(" 37777777777", format_item_oct32(0xffff_ffff));
-    assert_eq!(" 0000000000000000000000", format_item_oct64(0));
+#[test]
+fn test_format_item_oct() {
+    assert_eq!(" 000", format_item_oct8(0));
+    assert_eq!(" 377", format_item_oct8(0xff));
+    assert_eq!(" 000000", format_item_oct16(0));
+    assert_eq!(" 177777", format_item_oct16(0xffff));
+    assert_eq!(" 00000000000", format_item_oct32(0));
+    assert_eq!(" 37777777777", format_item_oct32(0xffff_ffff));
+    assert_eq!(" 0000000000000000000000", format_item_oct64(0));
     assert_eq!(
         " 1777777777777777777777",
-        format_item_oct64(0xffff_ffff_ffff_ffff)
+        format_item_oct64(0xffff_ffff_ffff_ffff)
     );
 }
 
-#[test]
-fn test_format_item_hex() {
-    assert_eq!(" 00", format_item_hex8(0));
-    assert_eq!(" ff", format_item_hex8(0xff));
-    assert_eq!(" 0000", format_item_hex16(0));
-    assert_eq!(" ffff", format_item_hex16(0xffff));
-    assert_eq!(" 00000000", format_item_hex32(0));
-    assert_eq!(" ffffffff", format_item_hex32(0xffff_ffff));
-    assert_eq!(" 0000000000000000", format_item_hex64(0));
+#[test]
+fn test_format_item_hex() {
+    assert_eq!(" 00", format_item_hex8(0));
+    assert_eq!(" ff", format_item_hex8(0xff));
+    assert_eq!(" 0000", format_item_hex16(0));
+    assert_eq!(" ffff", format_item_hex16(0xffff));
+    assert_eq!(" 00000000", format_item_hex32(0));
+    assert_eq!(" ffffffff", format_item_hex32(0xffff_ffff));
+    assert_eq!(" 0000000000000000", format_item_hex64(0));
     assert_eq!(
         " ffffffffffffffff",
-        format_item_hex64(0xffff_ffff_ffff_ffff)
+        format_item_hex64(0xffff_ffff_ffff_ffff)
     );
 }
 
-#[test]
-fn test_format_item_dec_u() {
-    assert_eq!("   0", format_item_dec_u8(0));
-    assert_eq!(" 255", format_item_dec_u8(0xff));
-    assert_eq!("     0", format_item_dec_u16(0));
-    assert_eq!(" 65535", format_item_dec_u16(0xffff));
-    assert_eq!("          0", format_item_dec_u32(0));
-    assert_eq!(" 4294967295", format_item_dec_u32(0xffff_ffff));
-    assert_eq!("                    0", format_item_dec_u64(0));
+#[test]
+fn test_format_item_dec_u() {
+    assert_eq!("   0", format_item_dec_u8(0));
+    assert_eq!(" 255", format_item_dec_u8(0xff));
+    assert_eq!("     0", format_item_dec_u16(0));
+    assert_eq!(" 65535", format_item_dec_u16(0xffff));
+    assert_eq!("          0", format_item_dec_u32(0));
+    assert_eq!(" 4294967295", format_item_dec_u32(0xffff_ffff));
+    assert_eq!("                    0", format_item_dec_u64(0));
     assert_eq!(
         " 18446744073709551615",
-        format_item_dec_u64(0xffff_ffff_ffff_ffff)
+        format_item_dec_u64(0xffff_ffff_ffff_ffff)
     );
 }
 
-#[test]
-fn test_format_item_dec_s() {
-    assert_eq!("    0", format_item_dec_s8(0));
-    assert_eq!("  127", format_item_dec_s8(0x7f));
-    assert_eq!(" -128", format_item_dec_s8(0x80));
-    assert_eq!("      0", format_item_dec_s16(0));
-    assert_eq!("  32767", format_item_dec_s16(0x7fff));
-    assert_eq!(" -32768", format_item_dec_s16(0x8000));
-    assert_eq!("           0", format_item_dec_s32(0));
-    assert_eq!("  2147483647", format_item_dec_s32(0x7fff_ffff));
-    assert_eq!(" -2147483648", format_item_dec_s32(0x8000_0000));
-    assert_eq!("                    0", format_item_dec_s64(0));
+#[test]
+fn test_format_item_dec_s() {
+    assert_eq!("    0", format_item_dec_s8(0));
+    assert_eq!("  127", format_item_dec_s8(0x7f));
+    assert_eq!(" -128", format_item_dec_s8(0x80));
+    assert_eq!("      0", format_item_dec_s16(0));
+    assert_eq!("  32767", format_item_dec_s16(0x7fff));
+    assert_eq!(" -32768", format_item_dec_s16(0x8000));
+    assert_eq!("           0", format_item_dec_s32(0));
+    assert_eq!("  2147483647", format_item_dec_s32(0x7fff_ffff));
+    assert_eq!(" -2147483648", format_item_dec_s32(0x8000_0000));
+    assert_eq!("                    0", format_item_dec_s64(0));
     assert_eq!(
         "  9223372036854775807",
-        format_item_dec_s64(0x7fff_ffff_ffff_ffff)
+        format_item_dec_s64(0x7fff_ffff_ffff_ffff)
     );
     assert_eq!(
         " -9223372036854775808",
-        format_item_dec_s64(0x8000_0000_0000_0000)
+        format_item_dec_s64(0x8000_0000_0000_0000)
     );
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_paste/paste.rs.html b/dev/src/uu_paste/paste.rs.html index 56259b8aa..2099872b8 100644 --- a/dev/src/uu_paste/paste.rs.html +++ b/dev/src/uu_paste/paste.rs.html @@ -1,4 +1,4 @@ -paste.rs - source
1
+paste.rs - source
1
 2
 3
 4
@@ -227,234 +227,234 @@
 227
 228
 229
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) delim
+// spell-checker:ignore (ToDO) delim
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fmt::Display;
-use std::fs::File;
-use std::io::{stdin, stdout, BufRead, BufReader, Read, Write};
-use std::path::Path;
-use uucore::error::{FromIo, UResult};
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fmt::Display;
+use std::fs::File;
+use std::io::{stdin, stdout, BufRead, BufReader, Read, Write};
+use std::path::Path;
+use uucore::error::{FromIo, UResult};
 
-static ABOUT: &str = "Write lines consisting of the sequentially corresponding lines from each
+static ABOUT: &str = "Write lines consisting of the sequentially corresponding lines from each
 FILE, separated by TABs, to standard output.";
 
-mod options {
-    pub const DELIMITER: &str = "delimiters";
-    pub const SERIAL: &str = "serial";
-    pub const FILE: &str = "file";
-    pub const ZERO_TERMINATED: &str = "zero-terminated";
+mod options {
+    pub const DELIMITER: &str = "delimiters";
+    pub const SERIAL: &str = "serial";
+    pub const FILE: &str = "file";
+    pub const ZERO_TERMINATED: &str = "zero-terminated";
 }
 
-#[repr(u8)]
-#[derive(Clone, Copy)]
-enum LineEnding {
-    Newline = b'\n',
-    Nul = 0,
+#[repr(u8)]
+#[derive(Clone, Copy)]
+enum LineEnding {
+    Newline = b'\n',
+    Nul = 0,
 }
 
-impl Display for LineEnding {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::Newline => writeln!(f),
-            Self::Nul => write!(f, "\0"),
+impl Display for LineEnding {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::Newline => writeln!(f),
+            Self::Nul => write!(f, "\0"),
         }
     }
 }
 
-// Wraps BufReader and stdin
-fn read_until<R: Read>(
-    reader: Option<&mut BufReader<R>>,
-    byte: u8,
-    buf: &mut Vec<u8>,
-) -> std::io::Result<usize> {
-    match reader {
-        Some(reader) => reader.read_until(byte, buf),
-        None => stdin().lock().read_until(byte, buf),
+// Wraps BufReader and stdin
+fn read_until<R: Read>(
+    reader: Option<&mut BufReader<R>>,
+    byte: u8,
+    buf: &mut Vec<u8>,
+) -> std::io::Result<usize> {
+    match reader {
+        Some(reader) => reader.read_until(byte, buf),
+        None => stdin().lock().read_until(byte, buf),
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let serial = matches.get_flag(options::SERIAL);
-    let delimiters = matches.get_one::<String>(options::DELIMITER).unwrap();
-    let files = matches
-        .get_many::<String>(options::FILE)
-        .unwrap()
-        .map(|s| s.to_owned())
-        .collect();
-    let line_ending = if matches.get_flag(options::ZERO_TERMINATED) {
-        LineEnding::Nul
-    } else {
-        LineEnding::Newline
+    let serial = matches.get_flag(options::SERIAL);
+    let delimiters = matches.get_one::<String>(options::DELIMITER).unwrap();
+    let files = matches
+        .get_many::<String>(options::FILE)
+        .unwrap()
+        .map(|s| s.to_owned())
+        .collect();
+    let line_ending = if matches.get_flag(options::ZERO_TERMINATED) {
+        LineEnding::Nul
+    } else {
+        LineEnding::Newline
     };
 
-    paste(files, serial, delimiters, line_ending)
+    paste(files, serial, delimiters, line_ending)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::SERIAL)
-                .long(options::SERIAL)
-                .short('s')
-                .help("paste one file at a time instead of in parallel")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::SERIAL)
+                .long(options::SERIAL)
+                .short('s')
+                .help("paste one file at a time instead of in parallel")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DELIMITER)
-                .long(options::DELIMITER)
-                .short('d')
-                .help("reuse characters from LIST instead of TABs")
-                .value_name("LIST")
-                .default_value("\t")
-                .hide_default_value(true),
+        .arg(
+            Arg::new(options::DELIMITER)
+                .long(options::DELIMITER)
+                .short('d')
+                .help("reuse characters from LIST instead of TABs")
+                .value_name("LIST")
+                .default_value("\t")
+                .hide_default_value(true),
         )
-        .arg(
-            Arg::new(options::FILE)
-                .value_name("FILE")
-                .action(ArgAction::Append)
-                .default_value("-")
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILE)
+                .value_name("FILE")
+                .action(ArgAction::Append)
+                .default_value("-")
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::ZERO_TERMINATED)
-                .long(options::ZERO_TERMINATED)
-                .short('z')
-                .help("line delimiter is NUL, not newline")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO_TERMINATED)
+                .long(options::ZERO_TERMINATED)
+                .short('z')
+                .help("line delimiter is NUL, not newline")
+                .action(ArgAction::SetTrue),
         )
 }
 
-fn paste(
-    filenames: Vec<String>,
-    serial: bool,
-    delimiters: &str,
-    line_ending: LineEnding,
-) -> UResult<()> {
-    let mut files = Vec::with_capacity(filenames.len());
-    for name in filenames {
-        let file = if name == "-" {
-            None
-        } else {
-            let path = Path::new(&name);
-            let r = File::open(path).map_err_context(String::new)?;
-            Some(BufReader::new(r))
+fn paste(
+    filenames: Vec<String>,
+    serial: bool,
+    delimiters: &str,
+    line_ending: LineEnding,
+) -> UResult<()> {
+    let mut files = Vec::with_capacity(filenames.len());
+    for name in filenames {
+        let file = if name == "-" {
+            None
+        } else {
+            let path = Path::new(&name);
+            let r = File::open(path).map_err_context(String::new)?;
+            Some(BufReader::new(r))
         };
-        files.push(file);
+        files.push(file);
     }
 
-    let delimiters: Vec<char> = unescape(delimiters).chars().collect();
-    let mut delim_count = 0;
-    let mut delim_length = 1;
-    let stdout = stdout();
-    let mut stdout = stdout.lock();
+    let delimiters: Vec<char> = unescape(delimiters).chars().collect();
+    let mut delim_count = 0;
+    let mut delim_length = 1;
+    let stdout = stdout();
+    let mut stdout = stdout.lock();
 
-    let mut output = Vec::new();
-    if serial {
-        for file in &mut files {
-            output.clear();
-            loop {
-                match read_until(file.as_mut(), line_ending as u8, &mut output) {
+    let mut output = Vec::new();
+    if serial {
+        for file in &mut files {
+            output.clear();
+            loop {
+                match read_until(file.as_mut(), line_ending as u8, &mut output) {
                     Ok(0) => break,
                     Ok(_) => {
-                        if output.ends_with(&[line_ending as u8]) {
-                            output.pop();
+                        if output.ends_with(&[line_ending as u8]) {
+                            output.pop();
                         }
-                        // a buffer of length four is large enough to encode any char
-                        let mut buffer = [0; 4];
-                        let ch =
-                            delimiters[delim_count % delimiters.len()].encode_utf8(&mut buffer);
-                        delim_length = ch.len();
+                        // a buffer of length four is large enough to encode any char
+                        let mut buffer = [0; 4];
+                        let ch =
+                            delimiters[delim_count % delimiters.len()].encode_utf8(&mut buffer);
+                        delim_length = ch.len();
 
-                        for byte in buffer.iter().take(delim_length) {
-                            output.push(*byte);
+                        for byte in buffer.iter().take(delim_length) {
+                            output.push(*byte);
                         }
                     }
-                    Err(e) => return Err(e.map_err_context(String::new)),
+                    Err(e) => return Err(e.map_err_context(String::new)),
                 }
-                delim_count += 1;
+                delim_count += 1;
             }
-            // remove final delimiter
-            output.truncate(output.len() - delim_length);
+            // remove final delimiter
+            output.truncate(output.len() - delim_length);
 
             write!(
-                stdout,
+                stdout,
                 "{}{}",
-                String::from_utf8_lossy(&output),
-                line_ending
+                String::from_utf8_lossy(&output),
+                line_ending
             )?;
         }
-    } else {
-        let mut eof = vec![false; files.len()];
-        loop {
-            output.clear();
-            let mut eof_count = 0;
-            for (i, file) in files.iter_mut().enumerate() {
-                if eof[i] {
-                    eof_count += 1;
-                } else {
-                    match read_until(file.as_mut(), line_ending as u8, &mut output) {
+    } else {
+        let mut eof = vec![false; files.len()];
+        loop {
+            output.clear();
+            let mut eof_count = 0;
+            for (i, file) in files.iter_mut().enumerate() {
+                if eof[i] {
+                    eof_count += 1;
+                } else {
+                    match read_until(file.as_mut(), line_ending as u8, &mut output) {
                         Ok(0) => {
-                            eof[i] = true;
-                            eof_count += 1;
+                            eof[i] = true;
+                            eof_count += 1;
                         }
                         Ok(_) => {
-                            if output.ends_with(&[line_ending as u8]) {
-                                output.pop();
+                            if output.ends_with(&[line_ending as u8]) {
+                                output.pop();
                             }
                         }
-                        Err(e) => return Err(e.map_err_context(String::new)),
+                        Err(e) => return Err(e.map_err_context(String::new)),
                     }
                 }
-                // a buffer of length four is large enough to encode any char
-                let mut buffer = [0; 4];
-                let ch = delimiters[delim_count % delimiters.len()].encode_utf8(&mut buffer);
-                delim_length = ch.len();
+                // a buffer of length four is large enough to encode any char
+                let mut buffer = [0; 4];
+                let ch = delimiters[delim_count % delimiters.len()].encode_utf8(&mut buffer);
+                delim_length = ch.len();
 
-                for byte in buffer.iter().take(delim_length) {
-                    output.push(*byte);
+                for byte in buffer.iter().take(delim_length) {
+                    output.push(*byte);
                 }
 
-                delim_count += 1;
+                delim_count += 1;
             }
-            if files.len() == eof_count {
+            if files.len() == eof_count {
                 break;
             }
-            // Remove final delimiter
-            output.truncate(output.len() - delim_length);
+            // Remove final delimiter
+            output.truncate(output.len() - delim_length);
 
             write!(
-                stdout,
+                stdout,
                 "{}{}",
-                String::from_utf8_lossy(&output),
-                line_ending
+                String::from_utf8_lossy(&output),
+                line_ending
             )?;
-            delim_count = 0;
+            delim_count = 0;
         }
     }
     Ok(())
 }
 
-// Unescape all special characters
-// TODO: this will need work to conform to GNU implementation
-fn unescape(s: &str) -> String {
-    s.replace("\\n", "\n")
-        .replace("\\t", "\t")
-        .replace("\\\\", "\\")
-        .replace('\\', "")
+// Unescape all special characters
+// TODO: this will need work to conform to GNU implementation
+fn unescape(s: &str) -> String {
+    s.replace("\\n", "\n")
+        .replace("\\t", "\t")
+        .replace("\\\\", "\\")
+        .replace('\\', "")
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_pathchk/pathchk.rs.html b/dev/src/uu_pathchk/pathchk.rs.html index e5e5e8b37..70183fa6c 100644 --- a/dev/src/uu_pathchk/pathchk.rs.html +++ b/dev/src/uu_pathchk/pathchk.rs.html @@ -1,4 +1,4 @@ -pathchk.rs - source
1
+pathchk.rs - source
1
 2
 3
 4
@@ -250,257 +250,257 @@
 250
 251
 252
-
#![allow(unused_must_use)] // because we of writeln!
+
#![allow(unused_must_use)] // because we of writeln!
 
-//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Inokentiy Babushkin <inokentiy.babushkin@googlemail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE file
-//  * that was distributed with this source code.
+//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Inokentiy Babushkin <inokentiy.babushkin@googlemail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE file
+//  * that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) lstat
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fs;
-use std::io::{ErrorKind, Write};
-use uucore::display::Quotable;
-use uucore::error::{set_exit_code, UResult, UUsageError};
-use uucore::format_usage;
+// spell-checker:ignore (ToDO) lstat
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fs;
+use std::io::{ErrorKind, Write};
+use uucore::display::Quotable;
+use uucore::error::{set_exit_code, UResult, UUsageError};
+use uucore::format_usage;
 
-// operating mode
-enum Mode {
-    Default, // use filesystem to determine information and limits
-    Basic,   // check basic compatibility with POSIX
-    Extra,   // check for leading dashes and empty names
-    Both,    // a combination of `Basic` and `Extra`
+// operating mode
+enum Mode {
+    Default, // use filesystem to determine information and limits
+    Basic,   // check basic compatibility with POSIX
+    Extra,   // check for leading dashes and empty names
+    Both,    // a combination of `Basic` and `Extra`
+}
+
+static ABOUT: &str = "Check whether file names are valid or portable";
+const USAGE: &str = "{} [OPTION]... NAME...";
+
+mod options {
+    pub const POSIX: &str = "posix";
+    pub const POSIX_SPECIAL: &str = "posix-special";
+    pub const PORTABILITY: &str = "portability";
+    pub const PATH: &str = "path";
 }
 
-static ABOUT: &str = "Check whether file names are valid or portable";
-const USAGE: &str = "{} [OPTION]... NAME...";
+// a few global constants as used in the GNU implementation
+const POSIX_PATH_MAX: usize = 256;
+const POSIX_NAME_MAX: usize = 14;
 
-mod options {
-    pub const POSIX: &str = "posix";
-    pub const POSIX_SPECIAL: &str = "posix-special";
-    pub const PORTABILITY: &str = "portability";
-    pub const PATH: &str = "path";
-}
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-// a few global constants as used in the GNU implementation
-const POSIX_PATH_MAX: usize = 256;
-const POSIX_NAME_MAX: usize = 14;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+    // set working mode
+    let is_posix = matches.get_flag(options::POSIX);
+    let is_posix_special = matches.get_flag(options::POSIX_SPECIAL);
+    let is_portability = matches.get_flag(options::PORTABILITY);
 
-    let matches = uu_app().try_get_matches_from(args)?;
-
-    // set working mode
-    let is_posix = matches.get_flag(options::POSIX);
-    let is_posix_special = matches.get_flag(options::POSIX_SPECIAL);
-    let is_portability = matches.get_flag(options::PORTABILITY);
-
-    let mode = if (is_posix && is_posix_special) || is_portability {
-        Mode::Both
-    } else if is_posix {
-        Mode::Basic
-    } else if is_posix_special {
-        Mode::Extra
-    } else {
-        Mode::Default
+    let mode = if (is_posix && is_posix_special) || is_portability {
+        Mode::Both
+    } else if is_posix {
+        Mode::Basic
+    } else if is_posix_special {
+        Mode::Extra
+    } else {
+        Mode::Default
     };
 
-    // take necessary actions
-    let paths = matches.get_many::<String>(options::PATH);
-    if paths.is_none() {
-        return Err(UUsageError::new(1, "missing operand"));
+    // take necessary actions
+    let paths = matches.get_many::<String>(options::PATH);
+    if paths.is_none() {
+        return Err(UUsageError::new(1, "missing operand"));
     }
 
-    // free strings are path operands
-    // FIXME: TCS, seems inefficient and overly verbose (?)
-    let mut res = true;
-    for p in paths.unwrap() {
-        let mut path = Vec::new();
-        for path_segment in p.split('/') {
-            path.push(path_segment.to_string());
+    // free strings are path operands
+    // FIXME: TCS, seems inefficient and overly verbose (?)
+    let mut res = true;
+    for p in paths.unwrap() {
+        let mut path = Vec::new();
+        for path_segment in p.split('/') {
+            path.push(path_segment.to_string());
         }
-        res &= check_path(&mode, &path);
+        res &= check_path(&mode, &path);
     }
 
-    // determine error code
-    if !res {
-        set_exit_code(1);
+    // determine error code
+    if !res {
+        set_exit_code(1);
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::POSIX)
-                .short('p')
-                .help("check for most POSIX systems")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::POSIX)
+                .short('p')
+                .help("check for most POSIX systems")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::POSIX_SPECIAL)
-                .short('P')
-                .help(r#"check for empty names and leading "-""#)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::POSIX_SPECIAL)
+                .short('P')
+                .help(r#"check for empty names and leading "-""#)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PORTABILITY)
-                .long(options::PORTABILITY)
-                .help("check for all POSIX systems (equivalent to -p -P)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PORTABILITY)
+                .long(options::PORTABILITY)
+                .help("check for all POSIX systems (equivalent to -p -P)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PATH)
-                .hide(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(options::PATH)
+                .hide(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-// check a path, given as a slice of it's components and an operating mode
-fn check_path(mode: &Mode, path: &[String]) -> bool {
-    match *mode {
-        Mode::Basic => check_basic(path),
-        Mode::Extra => check_default(path) && check_extra(path),
-        Mode::Both => check_basic(path) && check_extra(path),
-        _ => check_default(path),
+// check a path, given as a slice of it's components and an operating mode
+fn check_path(mode: &Mode, path: &[String]) -> bool {
+    match *mode {
+        Mode::Basic => check_basic(path),
+        Mode::Extra => check_default(path) && check_extra(path),
+        Mode::Both => check_basic(path) && check_extra(path),
+        _ => check_default(path),
     }
 }
 
-// check a path in basic compatibility mode
-fn check_basic(path: &[String]) -> bool {
-    let joined_path = path.join("/");
-    let total_len = joined_path.len();
-    // path length
-    if total_len > POSIX_PATH_MAX {
+// check a path in basic compatibility mode
+fn check_basic(path: &[String]) -> bool {
+    let joined_path = path.join("/");
+    let total_len = joined_path.len();
+    // path length
+    if total_len > POSIX_PATH_MAX {
         writeln!(
-            std::io::stderr(),
+            std::io::stderr(),
             "limit {} exceeded by length {} of file name {}",
-            POSIX_PATH_MAX,
-            total_len,
-            joined_path
+            POSIX_PATH_MAX,
+            total_len,
+            joined_path
         );
-        return false;
-    } else if total_len == 0 {
-        writeln!(std::io::stderr(), "empty file name");
-        return false;
+        return false;
+    } else if total_len == 0 {
+        writeln!(std::io::stderr(), "empty file name");
+        return false;
     }
-    // components: character portability and length
-    for p in path {
-        let component_len = p.len();
-        if component_len > POSIX_NAME_MAX {
+    // components: character portability and length
+    for p in path {
+        let component_len = p.len();
+        if component_len > POSIX_NAME_MAX {
             writeln!(
-                std::io::stderr(),
+                std::io::stderr(),
                 "limit {} exceeded by length {} of file name component {}",
-                POSIX_NAME_MAX,
-                component_len,
-                p.quote()
+                POSIX_NAME_MAX,
+                component_len,
+                p.quote()
             );
-            return false;
+            return false;
         }
-        if !check_portable_chars(p) {
-            return false;
+        if !check_portable_chars(p) {
+            return false;
         }
     }
-    // permission checks
-    check_searchable(&joined_path)
+    // permission checks
+    check_searchable(&joined_path)
 }
 
-// check a path in extra compatibility mode
-fn check_extra(path: &[String]) -> bool {
-    // components: leading hyphens
-    for p in path {
-        if p.starts_with('-') {
+// check a path in extra compatibility mode
+fn check_extra(path: &[String]) -> bool {
+    // components: leading hyphens
+    for p in path {
+        if p.starts_with('-') {
             writeln!(
-                std::io::stderr(),
+                std::io::stderr(),
                 "leading hyphen in file name component {}",
-                p.quote()
+                p.quote()
             );
-            return false;
+            return false;
         }
     }
-    // path length
-    if path.join("/").is_empty() {
-        writeln!(std::io::stderr(), "empty file name");
-        return false;
+    // path length
+    if path.join("/").is_empty() {
+        writeln!(std::io::stderr(), "empty file name");
+        return false;
     }
-    true
-}
+    true
+}
 
-// check a path in default mode (using the file system)
-fn check_default(path: &[String]) -> bool {
-    let joined_path = path.join("/");
-    let total_len = joined_path.len();
-    // path length
-    if total_len > libc::PATH_MAX as usize {
+// check a path in default mode (using the file system)
+fn check_default(path: &[String]) -> bool {
+    let joined_path = path.join("/");
+    let total_len = joined_path.len();
+    // path length
+    if total_len > libc::PATH_MAX as usize {
         writeln!(
-            std::io::stderr(),
+            std::io::stderr(),
             "limit {} exceeded by length {} of file name {}",
-            libc::PATH_MAX,
-            total_len,
-            joined_path.quote()
+            libc::PATH_MAX,
+            total_len,
+            joined_path.quote()
         );
-        return false;
+        return false;
     }
-    // components: length
-    for p in path {
-        let component_len = p.len();
-        if component_len > libc::FILENAME_MAX as usize {
+    // components: length
+    for p in path {
+        let component_len = p.len();
+        if component_len > libc::FILENAME_MAX as usize {
             writeln!(
-                std::io::stderr(),
+                std::io::stderr(),
                 "limit {} exceeded by length {} of file name component {}",
-                libc::FILENAME_MAX,
-                component_len,
-                p.quote()
+                libc::FILENAME_MAX,
+                component_len,
+                p.quote()
             );
-            return false;
+            return false;
         }
     }
-    // permission checks
-    check_searchable(&joined_path)
+    // permission checks
+    check_searchable(&joined_path)
 }
 
-// check whether a path is or if other problems arise
-fn check_searchable(path: &str) -> bool {
-    // we use lstat, just like the original implementation
-    match fs::symlink_metadata(path) {
+// check whether a path is or if other problems arise
+fn check_searchable(path: &str) -> bool {
+    // we use lstat, just like the original implementation
+    match fs::symlink_metadata(path) {
         Ok(_) => true,
-        Err(e) => {
-            if e.kind() == ErrorKind::NotFound {
-                true
-            } else {
-                writeln!(std::io::stderr(), "{}", e);
-                false
-            }
+        Err(e) => {
+            if e.kind() == ErrorKind::NotFound {
+                true
+            } else {
+                writeln!(std::io::stderr(), "{}", e);
+                false
+            }
         }
     }
 }
 
-// check whether a path segment contains only valid (read: portable) characters
-fn check_portable_chars(path_segment: &str) -> bool {
-    const VALID_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-";
-    for (i, ch) in path_segment.as_bytes().iter().enumerate() {
-        if !VALID_CHARS.contains(ch) {
-            let invalid = path_segment[i..].chars().next().unwrap();
+// check whether a path segment contains only valid (read: portable) characters
+fn check_portable_chars(path_segment: &str) -> bool {
+    const VALID_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-";
+    for (i, ch) in path_segment.as_bytes().iter().enumerate() {
+        if !VALID_CHARS.contains(ch) {
+            let invalid = path_segment[i..].chars().next().unwrap();
             writeln!(
-                std::io::stderr(),
+                std::io::stderr(),
                 "nonportable character '{}' in file name component {}",
-                invalid,
-                path_segment.quote()
+                invalid,
+                path_segment.quote()
             );
-            return false;
+            return false;
         }
     }
-    true
-}
+    true
+}
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_pinky/pinky.rs.html b/dev/src/uu_pinky/pinky.rs.html index c16b5f0d5..39ea51852 100644 --- a/dev/src/uu_pinky/pinky.rs.html +++ b/dev/src/uu_pinky/pinky.rs.html @@ -1,4 +1,4 @@ -pinky.rs - source
1
+pinky.rs - source
1
 2
 3
 4
@@ -402,409 +402,409 @@
 402
 403
 404
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) BUFSIZE gecos fullname, mesg iobuf
+// spell-checker:ignore (ToDO) BUFSIZE gecos fullname, mesg iobuf
 
-use uucore::entries::{Locate, Passwd};
-use uucore::error::{FromIo, UResult};
-use uucore::libc::S_IWGRP;
-use uucore::utmpx::{self, time, Utmpx};
+use uucore::entries::{Locate, Passwd};
+use uucore::error::{FromIo, UResult};
+use uucore::libc::S_IWGRP;
+use uucore::utmpx::{self, time, Utmpx};
 
-use std::io::prelude::*;
-use std::io::BufReader;
+use std::io::prelude::*;
+use std::io::BufReader;
 
-use std::fs::File;
-use std::os::unix::fs::MetadataExt;
+use std::fs::File;
+use std::os::unix::fs::MetadataExt;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::path::PathBuf;
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::path::PathBuf;
+use uucore::format_usage;
 
-static ABOUT: &str = "lightweight finger";
-const USAGE: &str = "{} [OPTION]... [USER]...";
+static ABOUT: &str = "lightweight finger";
+const USAGE: &str = "{} [OPTION]... [USER]...";
 
-mod options {
-    pub const LONG_FORMAT: &str = "long_format";
-    pub const OMIT_HOME_DIR: &str = "omit_home_dir";
-    pub const OMIT_PROJECT_FILE: &str = "omit_project_file";
-    pub const OMIT_PLAN_FILE: &str = "omit_plan_file";
-    pub const SHORT_FORMAT: &str = "short_format";
-    pub const OMIT_HEADINGS: &str = "omit_headings";
-    pub const OMIT_NAME: &str = "omit_name";
-    pub const OMIT_NAME_HOST: &str = "omit_name_host";
-    pub const OMIT_NAME_HOST_TIME: &str = "omit_name_host_time";
-    pub const USER: &str = "user";
-    pub const HELP: &str = "help";
+mod options {
+    pub const LONG_FORMAT: &str = "long_format";
+    pub const OMIT_HOME_DIR: &str = "omit_home_dir";
+    pub const OMIT_PROJECT_FILE: &str = "omit_project_file";
+    pub const OMIT_PLAN_FILE: &str = "omit_plan_file";
+    pub const SHORT_FORMAT: &str = "short_format";
+    pub const OMIT_HEADINGS: &str = "omit_headings";
+    pub const OMIT_NAME: &str = "omit_name";
+    pub const OMIT_NAME_HOST: &str = "omit_name_host";
+    pub const OMIT_NAME_HOST_TIME: &str = "omit_name_host_time";
+    pub const USER: &str = "user";
+    pub const HELP: &str = "help";
 }
 
-fn get_long_usage() -> String {
+fn get_long_usage() -> String {
     format!(
         "A lightweight 'finger' program;  print user information.\n\
          The utmp file will be {}.",
-        utmpx::DEFAULT_FILE
+        utmpx::DEFAULT_FILE
     )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)?;
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)?;
 
-    let users: Vec<String> = matches
-        .get_many::<String>(options::USER)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let users: Vec<String> = matches
+        .get_many::<String>(options::USER)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    // If true, display the hours:minutes since each user has touched
-    // the keyboard, or blank if within the last minute, or days followed
-    // by a 'd' if not within the last day.
-    let mut include_idle = true;
+    // If true, display the hours:minutes since each user has touched
+    // the keyboard, or blank if within the last minute, or days followed
+    // by a 'd' if not within the last day.
+    let mut include_idle = true;
 
-    // If true, display a line at the top describing each field.
-    let include_heading = !matches.get_flag(options::OMIT_HEADINGS);
+    // If true, display a line at the top describing each field.
+    let include_heading = !matches.get_flag(options::OMIT_HEADINGS);
 
-    // if true, display the user's full name from pw_gecos.
-    let mut include_fullname = true;
+    // if true, display the user's full name from pw_gecos.
+    let mut include_fullname = true;
 
-    // if true, display the user's ~/.project file when doing long format.
-    let include_project = !matches.get_flag(options::OMIT_PROJECT_FILE);
+    // if true, display the user's ~/.project file when doing long format.
+    let include_project = !matches.get_flag(options::OMIT_PROJECT_FILE);
 
-    // if true, display the user's ~/.plan file when doing long format.
-    let include_plan = !matches.get_flag(options::OMIT_PLAN_FILE);
+    // if true, display the user's ~/.plan file when doing long format.
+    let include_plan = !matches.get_flag(options::OMIT_PLAN_FILE);
 
-    // if true, display the user's home directory and shell
-    // when doing long format.
-    let include_home_and_shell = !matches.get_flag(options::OMIT_HOME_DIR);
+    // if true, display the user's home directory and shell
+    // when doing long format.
+    let include_home_and_shell = !matches.get_flag(options::OMIT_HOME_DIR);
 
-    // if true, use the "short" output format.
-    let do_short_format = !matches.get_flag(options::LONG_FORMAT);
+    // if true, use the "short" output format.
+    let do_short_format = !matches.get_flag(options::LONG_FORMAT);
 
-    /* if true, display the ut_host field. */
-    let mut include_where = true;
+    /* if true, display the ut_host field. */
+    let mut include_where = true;
 
-    if matches.get_flag(options::OMIT_NAME) {
-        include_fullname = false;
+    if matches.get_flag(options::OMIT_NAME) {
+        include_fullname = false;
     }
-    if matches.get_flag(options::OMIT_NAME_HOST) {
-        include_fullname = false;
-        include_where = false;
+    if matches.get_flag(options::OMIT_NAME_HOST) {
+        include_fullname = false;
+        include_where = false;
     }
-    if matches.get_flag(options::OMIT_NAME_HOST_TIME) {
-        include_fullname = false;
-        include_idle = false;
-        include_where = false;
+    if matches.get_flag(options::OMIT_NAME_HOST_TIME) {
+        include_fullname = false;
+        include_idle = false;
+        include_where = false;
     }
 
-    let pk = Pinky {
-        include_idle,
-        include_heading,
-        include_fullname,
-        include_project,
-        include_plan,
-        include_home_and_shell,
-        include_where,
-        names: users,
+    let pk = Pinky {
+        include_idle,
+        include_heading,
+        include_fullname,
+        include_project,
+        include_plan,
+        include_home_and_shell,
+        include_where,
+        names: users,
     };
 
-    if do_short_format {
-        match pk.short_pinky() {
+    if do_short_format {
+        match pk.short_pinky() {
             Ok(_) => Ok(()),
-            Err(e) => Err(e.map_err_context(String::new)),
+            Err(e) => Err(e.map_err_context(String::new)),
         }
-    } else {
-        pk.long_pinky();
+    } else {
+        pk.long_pinky();
         Ok(())
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::LONG_FORMAT)
-                .short('l')
-                .requires(options::USER)
-                .help("produce long format output for the specified USERs")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::LONG_FORMAT)
+                .short('l')
+                .requires(options::USER)
+                .help("produce long format output for the specified USERs")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OMIT_HOME_DIR)
-                .short('b')
-                .help("omit the user's home directory and shell in long format")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OMIT_HOME_DIR)
+                .short('b')
+                .help("omit the user's home directory and shell in long format")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OMIT_PROJECT_FILE)
-                .short('h')
-                .help("omit the user's project file in long format")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OMIT_PROJECT_FILE)
+                .short('h')
+                .help("omit the user's project file in long format")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OMIT_PLAN_FILE)
-                .short('p')
-                .help("omit the user's plan file in long format")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OMIT_PLAN_FILE)
+                .short('p')
+                .help("omit the user's plan file in long format")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SHORT_FORMAT)
-                .short('s')
-                .help("do short format output, this is the default")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SHORT_FORMAT)
+                .short('s')
+                .help("do short format output, this is the default")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OMIT_HEADINGS)
-                .short('f')
-                .help("omit the line of column headings in short format")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OMIT_HEADINGS)
+                .short('f')
+                .help("omit the line of column headings in short format")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OMIT_NAME)
-                .short('w')
-                .help("omit the user's full name in short format")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OMIT_NAME)
+                .short('w')
+                .help("omit the user's full name in short format")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OMIT_NAME_HOST)
-                .short('i')
-                .help("omit the user's full name and remote host in short format")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OMIT_NAME_HOST)
+                .short('i')
+                .help("omit the user's full name and remote host in short format")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OMIT_NAME_HOST_TIME)
-                .short('q')
-                .help("omit the user's full name, remote host and idle time in short format")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OMIT_NAME_HOST_TIME)
+                .short('q')
+                .help("omit the user's full name, remote host and idle time in short format")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::USER)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::Username),
+        .arg(
+            Arg::new(options::USER)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::Username),
         )
-        .arg(
-            // Redefine the help argument to not include the short flag
-            // since that conflicts with omit_project_file.
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information")
-                .action(ArgAction::Help),
+        .arg(
+            // Redefine the help argument to not include the short flag
+            // since that conflicts with omit_project_file.
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information")
+                .action(ArgAction::Help),
         )
 }
 
-struct Pinky {
-    include_idle: bool,
-    include_heading: bool,
-    include_fullname: bool,
-    include_project: bool,
-    include_plan: bool,
-    include_where: bool,
-    include_home_and_shell: bool,
-    names: Vec<String>,
+struct Pinky {
+    include_idle: bool,
+    include_heading: bool,
+    include_fullname: bool,
+    include_project: bool,
+    include_plan: bool,
+    include_where: bool,
+    include_home_and_shell: bool,
+    names: Vec<String>,
 }
 
-pub trait Capitalize {
-    fn capitalize(&self) -> String;
+pub trait Capitalize {
+    fn capitalize(&self) -> String;
 }
 
-impl Capitalize for str {
-    fn capitalize(&self) -> String {
-        self.char_indices()
-            .fold(String::with_capacity(self.len()), |mut acc, x| {
-                if x.0 != 0 {
-                    acc.push(x.1);
-                } else {
-                    acc.push(x.1.to_ascii_uppercase());
+impl Capitalize for str {
+    fn capitalize(&self) -> String {
+        self.char_indices()
+            .fold(String::with_capacity(self.len()), |mut acc, x| {
+                if x.0 != 0 {
+                    acc.push(x.1);
+                } else {
+                    acc.push(x.1.to_ascii_uppercase());
                 }
-                acc
+                acc
             })
     }
 }
 
-fn idle_string(when: i64) -> String {
-    thread_local! {
-        static NOW: time::OffsetDateTime = time::OffsetDateTime::now_local().unwrap();
+fn idle_string(when: i64) -> String {
+    thread_local! {
+        static NOW: time::OffsetDateTime = time::OffsetDateTime::now_local().unwrap();
     }
-    NOW.with(|n| {
-        let duration = n.unix_timestamp() - when;
-        if duration < 60 {
-            // less than 1min
-            "     ".to_owned()
-        } else if duration < 24 * 3600 {
-            // less than 1day
-            let hours = duration / (60 * 60);
-            let minutes = (duration % (60 * 60)) / 60;
-            format!("{:02}:{:02}", hours, minutes)
-        } else {
-            // more than 1day
-            let days = duration / (24 * 3600);
-            format!("{}d", days)
+    NOW.with(|n| {
+        let duration = n.unix_timestamp() - when;
+        if duration < 60 {
+            // less than 1min
+            "     ".to_owned()
+        } else if duration < 24 * 3600 {
+            // less than 1day
+            let hours = duration / (60 * 60);
+            let minutes = (duration % (60 * 60)) / 60;
+            format!("{:02}:{:02}", hours, minutes)
+        } else {
+            // more than 1day
+            let days = duration / (24 * 3600);
+            format!("{}d", days)
         }
     })
 }
 
-fn time_string(ut: &Utmpx) -> String {
-    // "%b %e %H:%M"
-    let time_format: Vec<time::format_description::FormatItem> =
-        time::format_description::parse("[month repr:short] [day padding:space] [hour]:[minute]")
-            .unwrap();
-    ut.login_time().format(&time_format).unwrap() // LC_ALL=C
-}
+fn time_string(ut: &Utmpx) -> String {
+    // "%b %e %H:%M"
+    let time_format: Vec<time::format_description::FormatItem> =
+        time::format_description::parse("[month repr:short] [day padding:space] [hour]:[minute]")
+            .unwrap();
+    ut.login_time().format(&time_format).unwrap() // LC_ALL=C
+}
 
-fn gecos_to_fullname(pw: &Passwd) -> Option<String> {
-    let mut gecos = if let Some(gecos) = &pw.user_info {
-        gecos.clone()
-    } else {
-        return None;
+fn gecos_to_fullname(pw: &Passwd) -> Option<String> {
+    let mut gecos = if let Some(gecos) = &pw.user_info {
+        gecos.clone()
+    } else {
+        return None;
     };
-    if let Some(n) = gecos.find(',') {
-        gecos.truncate(n);
+    if let Some(n) = gecos.find(',') {
+        gecos.truncate(n);
     }
-    Some(gecos.replace('&', &pw.name.capitalize()))
+    Some(gecos.replace('&', &pw.name.capitalize()))
 }
 
-impl Pinky {
-    fn print_entry(&self, ut: &Utmpx) -> std::io::Result<()> {
-        let mut pts_path = PathBuf::from("/dev");
-        pts_path.push(ut.tty_device().as_str());
+impl Pinky {
+    fn print_entry(&self, ut: &Utmpx) -> std::io::Result<()> {
+        let mut pts_path = PathBuf::from("/dev");
+        pts_path.push(ut.tty_device().as_str());
 
-        let mesg;
-        let last_change;
-        match pts_path.metadata() {
-            Ok(meta) => {
-                mesg = if meta.mode() & (S_IWGRP as u32) != 0 {
-                    ' '
-                } else {
-                    '*'
-                };
-                last_change = meta.atime();
+        let mesg;
+        let last_change;
+        match pts_path.metadata() {
+            Ok(meta) => {
+                mesg = if meta.mode() & (S_IWGRP as u32) != 0 {
+                    ' '
+                } else {
+                    '*'
+                };
+                last_change = meta.atime();
             }
-            _ => {
-                mesg = '?';
-                last_change = 0;
+            _ => {
+                mesg = '?';
+                last_change = 0;
             }
         }
 
-        print!("{1:<8.0$}", utmpx::UT_NAMESIZE, ut.user());
+        print!("{1:<8.0$}", utmpx::UT_NAMESIZE, ut.user());
 
-        if self.include_fullname {
-            let fullname = if let Ok(pw) = Passwd::locate(ut.user().as_ref()) {
-                gecos_to_fullname(&pw)
-            } else {
-                None
-            };
-            if let Some(fullname) = fullname {
-                print!(" {:<19.19}", fullname);
-            } else {
+        if self.include_fullname {
+            let fullname = if let Ok(pw) = Passwd::locate(ut.user().as_ref()) {
+                gecos_to_fullname(&pw)
+            } else {
+                None
+            };
+            if let Some(fullname) = fullname {
+                print!(" {:<19.19}", fullname);
+            } else {
                 print!(" {:19}", "        ???");
             }
         }
 
-        print!(" {}{:<8.*}", mesg, utmpx::UT_LINESIZE, ut.tty_device());
+        print!(" {}{:<8.*}", mesg, utmpx::UT_LINESIZE, ut.tty_device());
 
-        if self.include_idle {
-            if last_change != 0 {
-                print!(" {:<6}", idle_string(last_change));
-            } else {
+        if self.include_idle {
+            if last_change != 0 {
+                print!(" {:<6}", idle_string(last_change));
+            } else {
                 print!(" {:<6}", "?????");
             }
         }
 
-        print!(" {}", time_string(ut));
+        print!(" {}", time_string(ut));
 
-        let mut s = ut.host();
-        if self.include_where && !s.is_empty() {
-            s = ut.canon_host()?;
-            print!(" {}", s);
+        let mut s = ut.host();
+        if self.include_where && !s.is_empty() {
+            s = ut.canon_host()?;
+            print!(" {}", s);
         }
 
         println!();
         Ok(())
     }
 
-    fn print_heading(&self) {
+    fn print_heading(&self) {
         print!("{:<8}", "Login");
-        if self.include_fullname {
+        if self.include_fullname {
             print!(" {:<19}", "Name");
         }
         print!(" {:<9}", " TTY");
-        if self.include_idle {
+        if self.include_idle {
             print!(" {:<6}", "Idle");
         }
         print!(" {:<16}", "When");
-        if self.include_where {
+        if self.include_where {
             print!(" Where");
         }
         println!();
     }
 
-    fn short_pinky(&self) -> std::io::Result<()> {
-        if self.include_heading {
-            self.print_heading();
+    fn short_pinky(&self) -> std::io::Result<()> {
+        if self.include_heading {
+            self.print_heading();
         }
-        for ut in Utmpx::iter_all_records() {
-            if ut.is_user_process()
-                && (self.names.is_empty() || self.names.iter().any(|n| n.as_str() == ut.user()))
+        for ut in Utmpx::iter_all_records() {
+            if ut.is_user_process()
+                && (self.names.is_empty() || self.names.iter().any(|n| n.as_str() == ut.user()))
             {
-                self.print_entry(&ut)?;
+                self.print_entry(&ut)?;
             }
         }
         Ok(())
     }
 
-    fn long_pinky(&self) {
-        for u in &self.names {
-            print!("Login name: {:<28}In real life: ", u);
-            if let Ok(pw) = Passwd::locate(u.as_str()) {
-                let fullname = gecos_to_fullname(&pw).unwrap_or_default();
-                let user_dir = pw.user_dir.unwrap_or_default();
-                let user_shell = pw.user_shell.unwrap_or_default();
-                println!(" {}", fullname);
-                if self.include_home_and_shell {
-                    print!("Directory: {:<29}", user_dir);
-                    println!("Shell:  {}", user_shell);
+    fn long_pinky(&self) {
+        for u in &self.names {
+            print!("Login name: {:<28}In real life: ", u);
+            if let Ok(pw) = Passwd::locate(u.as_str()) {
+                let fullname = gecos_to_fullname(&pw).unwrap_or_default();
+                let user_dir = pw.user_dir.unwrap_or_default();
+                let user_shell = pw.user_shell.unwrap_or_default();
+                println!(" {}", fullname);
+                if self.include_home_and_shell {
+                    print!("Directory: {:<29}", user_dir);
+                    println!("Shell:  {}", user_shell);
                 }
-                if self.include_project {
-                    let mut p = PathBuf::from(&user_dir);
-                    p.push(".project");
-                    if let Ok(f) = File::open(p) {
+                if self.include_project {
+                    let mut p = PathBuf::from(&user_dir);
+                    p.push(".project");
+                    if let Ok(f) = File::open(p) {
                         print!("Project: ");
-                        read_to_console(f);
+                        read_to_console(f);
                     }
                 }
-                if self.include_plan {
-                    let mut p = PathBuf::from(&user_dir);
-                    p.push(".plan");
-                    if let Ok(f) = File::open(p) {
+                if self.include_plan {
+                    let mut p = PathBuf::from(&user_dir);
+                    p.push(".plan");
+                    if let Ok(f) = File::open(p) {
                         println!("Plan:");
-                        read_to_console(f);
+                        read_to_console(f);
                     }
                 }
                 println!();
-            } else {
+            } else {
                 println!(" ???");
             }
         }
     }
 }
 
-fn read_to_console<F: Read>(f: F) {
-    let mut reader = BufReader::new(f);
-    let mut iobuf = Vec::new();
-    if reader.read_to_end(&mut iobuf).is_ok() {
-        print!("{}", String::from_utf8_lossy(&iobuf));
+fn read_to_console<F: Read>(f: F) {
+    let mut reader = BufReader::new(f);
+    let mut iobuf = Vec::new();
+    if reader.read_to_end(&mut iobuf).is_ok() {
+        print!("{}", String::from_utf8_lossy(&iobuf));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_pr/pr.rs.html b/dev/src/uu_pr/pr.rs.html index b44a6d32f..eaab712c9 100644 --- a/dev/src/uu_pr/pr.rs.html +++ b/dev/src/uu_pr/pr.rs.html @@ -1,4 +1,4 @@ -pr.rs - source
1
+pr.rs - source
1
 2
 3
 4
@@ -1294,35 +1294,35 @@
 1294
 1295
 1296
-
// This file is part of the uutils coreutils package.
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
-//
+
// This file is part of the uutils coreutils package.
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
+//
 
-// spell-checker:ignore (ToDO) adFfmprt, kmerge
+// spell-checker:ignore (ToDO) adFfmprt, kmerge
 
-#[macro_use]
-extern crate quick_error;
+#[macro_use]
+extern crate quick_error;
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use itertools::Itertools;
-use quick_error::ResultExt;
-use regex::Regex;
-use std::convert::From;
-use std::fs::{metadata, File};
-use std::io::{stdin, stdout, BufRead, BufReader, Lines, Read, Write};
-#[cfg(unix)]
-use std::os::unix::fs::FileTypeExt;
-use time::macros::format_description;
-use time::OffsetDateTime;
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use itertools::Itertools;
+use quick_error::ResultExt;
+use regex::Regex;
+use std::convert::From;
+use std::fs::{metadata, File};
+use std::io::{stdin, stdout, BufRead, BufReader, Lines, Read, Write};
+#[cfg(unix)]
+use std::os::unix::fs::FileTypeExt;
+use time::macros::format_description;
+use time::OffsetDateTime;
 
-use uucore::display::Quotable;
-use uucore::error::UResult;
+use uucore::display::Quotable;
+use uucore::error::UResult;
 
-const ABOUT: &str =
+const ABOUT: &str =
     "Write content of given file or standard input to standard output with pagination filter";
-const AFTER_HELP: &str =
+const AFTER_HELP: &str =
     "    +PAGE\n            Begin output at page number page of the formatted input.
     -COLUMN\n            Produce multi-column output. See --column
 
@@ -1346,187 +1346,187 @@ are of equal width.  By default text columns
 are separated by at least one <blank>.  Input lines
 that do not fit into a text column are truncated.
 Lines are not truncated under single column output.";
-const TAB: char = '\t';
-const LINES_PER_PAGE: usize = 66;
-const LINES_PER_PAGE_FOR_FORM_FEED: usize = 63;
-const HEADER_LINES_PER_PAGE: usize = 5;
-const TRAILER_LINES_PER_PAGE: usize = 5;
-const FILE_STDIN: &str = "-";
-const READ_BUFFER_SIZE: usize = 1024 * 64;
-const DEFAULT_COLUMN_WIDTH: usize = 72;
-const DEFAULT_COLUMN_WIDTH_WITH_S_OPTION: usize = 512;
-const DEFAULT_COLUMN_SEPARATOR: &char = &TAB;
-const FF: u8 = 0x0C_u8;
-const DATE_TIME_FORMAT: &[time::format_description::FormatItem] =
+const TAB: char = '\t';
+const LINES_PER_PAGE: usize = 66;
+const LINES_PER_PAGE_FOR_FORM_FEED: usize = 63;
+const HEADER_LINES_PER_PAGE: usize = 5;
+const TRAILER_LINES_PER_PAGE: usize = 5;
+const FILE_STDIN: &str = "-";
+const READ_BUFFER_SIZE: usize = 1024 * 64;
+const DEFAULT_COLUMN_WIDTH: usize = 72;
+const DEFAULT_COLUMN_WIDTH_WITH_S_OPTION: usize = 512;
+const DEFAULT_COLUMN_SEPARATOR: &char = &TAB;
+const FF: u8 = 0x0C_u8;
+const DATE_TIME_FORMAT: &[time::format_description::FormatItem] =
     format_description!("[month repr:short] [day] [hour]:[minute] [year]");
 
-mod options {
-    pub const HEADER: &str = "header";
-    pub const DOUBLE_SPACE: &str = "double-space";
-    pub const NUMBER_LINES: &str = "number-lines";
-    pub const FIRST_LINE_NUMBER: &str = "first-line-number";
-    pub const PAGES: &str = "pages";
-    pub const OMIT_HEADER: &str = "omit-header";
-    pub const PAGE_LENGTH: &str = "length";
-    pub const NO_FILE_WARNINGS: &str = "no-file-warnings";
-    pub const FORM_FEED: &str = "form-feed";
-    pub const COLUMN_WIDTH: &str = "width";
-    pub const PAGE_WIDTH: &str = "page-width";
-    pub const ACROSS: &str = "across";
-    pub const COLUMN: &str = "column";
-    pub const COLUMN_CHAR_SEPARATOR: &str = "separator";
-    pub const COLUMN_STRING_SEPARATOR: &str = "sep-string";
-    pub const MERGE: &str = "merge";
-    pub const INDENT: &str = "indent";
-    pub const JOIN_LINES: &str = "join-lines";
-    pub const HELP: &str = "help";
-    pub const FILES: &str = "files";
+mod options {
+    pub const HEADER: &str = "header";
+    pub const DOUBLE_SPACE: &str = "double-space";
+    pub const NUMBER_LINES: &str = "number-lines";
+    pub const FIRST_LINE_NUMBER: &str = "first-line-number";
+    pub const PAGES: &str = "pages";
+    pub const OMIT_HEADER: &str = "omit-header";
+    pub const PAGE_LENGTH: &str = "length";
+    pub const NO_FILE_WARNINGS: &str = "no-file-warnings";
+    pub const FORM_FEED: &str = "form-feed";
+    pub const COLUMN_WIDTH: &str = "width";
+    pub const PAGE_WIDTH: &str = "page-width";
+    pub const ACROSS: &str = "across";
+    pub const COLUMN: &str = "column";
+    pub const COLUMN_CHAR_SEPARATOR: &str = "separator";
+    pub const COLUMN_STRING_SEPARATOR: &str = "sep-string";
+    pub const MERGE: &str = "merge";
+    pub const INDENT: &str = "indent";
+    pub const JOIN_LINES: &str = "join-lines";
+    pub const HELP: &str = "help";
+    pub const FILES: &str = "files";
 }
 
-struct OutputOptions {
-    /// Line numbering mode
-    number: Option<NumberingMode>,
-    header: String,
-    double_space: bool,
-    line_separator: String,
-    content_line_separator: String,
-    last_modified_time: String,
-    start_page: usize,
-    end_page: Option<usize>,
-    display_header_and_trailer: bool,
-    content_lines_per_page: usize,
-    page_separator_char: String,
-    column_mode_options: Option<ColumnModeOptions>,
-    merge_files_print: Option<usize>,
-    offset_spaces: String,
-    form_feed_used: bool,
-    join_lines: bool,
-    col_sep_for_printing: String,
-    line_width: Option<usize>,
+struct OutputOptions {
+    /// Line numbering mode
+    number: Option<NumberingMode>,
+    header: String,
+    double_space: bool,
+    line_separator: String,
+    content_line_separator: String,
+    last_modified_time: String,
+    start_page: usize,
+    end_page: Option<usize>,
+    display_header_and_trailer: bool,
+    content_lines_per_page: usize,
+    page_separator_char: String,
+    column_mode_options: Option<ColumnModeOptions>,
+    merge_files_print: Option<usize>,
+    offset_spaces: String,
+    form_feed_used: bool,
+    join_lines: bool,
+    col_sep_for_printing: String,
+    line_width: Option<usize>,
 }
 
-struct FileLine {
-    file_id: usize,
-    line_number: usize,
-    page_number: usize,
-    group_key: usize,
-    line_content: Result<String, std::io::Error>,
-    form_feeds_after: usize,
+struct FileLine {
+    file_id: usize,
+    line_number: usize,
+    page_number: usize,
+    group_key: usize,
+    line_content: Result<String, std::io::Error>,
+    form_feeds_after: usize,
 }
 
-struct ColumnModeOptions {
-    width: usize,
-    columns: usize,
-    column_separator: String,
-    across_mode: bool,
+struct ColumnModeOptions {
+    width: usize,
+    columns: usize,
+    column_separator: String,
+    across_mode: bool,
 }
 
-/// Line numbering mode
-struct NumberingMode {
-    width: usize,
-    separator: String,
-    first_number: usize,
+/// Line numbering mode
+struct NumberingMode {
+    width: usize,
+    separator: String,
+    first_number: usize,
 }
 
-impl Default for NumberingMode {
-    fn default() -> Self {
-        Self {
-            width: 5,
-            separator: TAB.to_string(),
-            first_number: 1,
+impl Default for NumberingMode {
+    fn default() -> Self {
+        Self {
+            width: 5,
+            separator: TAB.to_string(),
+            first_number: 1,
         }
     }
 }
 
-impl Default for FileLine {
-    fn default() -> Self {
-        Self {
-            file_id: 0,
-            line_number: 0,
-            page_number: 0,
-            group_key: 0,
-            line_content: Ok(String::new()),
-            form_feeds_after: 0,
+impl Default for FileLine {
+    fn default() -> Self {
+        Self {
+            file_id: 0,
+            line_number: 0,
+            page_number: 0,
+            group_key: 0,
+            line_content: Ok(String::new()),
+            form_feeds_after: 0,
         }
     }
 }
 
-impl From<std::io::Error> for PrError {
-    fn from(err: std::io::Error) -> Self {
-        Self::EncounteredErrors(err.to_string())
+impl From<std::io::Error> for PrError {
+    fn from(err: std::io::Error) -> Self {
+        Self::EncounteredErrors(err.to_string())
     }
 }
 
-quick_error! {
-    #[derive(Debug)]
-    enum PrError {
-        Input(err: std::io::Error, path: String) {
-            context(path: &'a str, err: std::io::Error) -> (err, path.to_owned())
-            display("pr: Reading from input {0} gave error", path)
-            source(err)
+quick_error! {
+    #[derive(Debug)]
+    enum PrError {
+        Input(err: std::io::Error, path: String) {
+            context(path: &'a str, err: std::io::Error) -> (err, path.to_owned())
+            display("pr: Reading from input {0} gave error", path)
+            source(err)
         }
 
-        UnknownFiletype(path: String) {
-            display("pr: {0}: unknown filetype", path)
+        UnknownFiletype(path: String) {
+            display("pr: {0}: unknown filetype", path)
         }
 
-        EncounteredErrors(msg: String) {
-            display("pr: {0}", msg)
+        EncounteredErrors(msg: String) {
+            display("pr: {0}", msg)
         }
 
-        IsDirectory(path: String) {
-            display("pr: {0}: Is a directory", path)
+        IsDirectory(path: String) {
+            display("pr: {0}: Is a directory", path)
         }
 
-        IsSocket(path: String) {
-            display("pr: cannot open {}, Operation not supported on socket", path)
+        IsSocket(path: String) {
+            display("pr: cannot open {}, Operation not supported on socket", path)
         }
 
-        NotExists(path: String) {
-            display("pr: cannot open {}, No such file or directory", path)
+        NotExists(path: String) {
+            display("pr: cannot open {}, No such file or directory", path)
         }
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(AFTER_HELP)
-        .infer_long_args(true)
-        .args_override_self(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::PAGES)
-                .long(options::PAGES)
-                .help("Begin and stop printing with page FIRST_PAGE[:LAST_PAGE]")
-                .value_name("FIRST_PAGE[:LAST_PAGE]"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(AFTER_HELP)
+        .infer_long_args(true)
+        .args_override_self(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::PAGES)
+                .long(options::PAGES)
+                .help("Begin and stop printing with page FIRST_PAGE[:LAST_PAGE]")
+                .value_name("FIRST_PAGE[:LAST_PAGE]"),
         )
-        .arg(
-            Arg::new(options::HEADER)
-                .short('h')
-                .long(options::HEADER)
-                .help(
+        .arg(
+            Arg::new(options::HEADER)
+                .short('h')
+                .long(options::HEADER)
+                .help(
                     "Use the string header to replace the file name \
                     in the header line.",
                 )
-                .value_name("STRING"),
+                .value_name("STRING"),
         )
-        .arg(
-            Arg::new(options::DOUBLE_SPACE)
-                .short('d')
-                .long(options::DOUBLE_SPACE)
-                .help(
+        .arg(
+            Arg::new(options::DOUBLE_SPACE)
+                .short('d')
+                .long(options::DOUBLE_SPACE)
+                .help(
                     "Produce output that is double spaced. An extra <newline> \
                 character is output following every <newline> found in the input.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NUMBER_LINES)
-                .short('n')
-                .long(options::NUMBER_LINES)
-                .help(
+        .arg(
+            Arg::new(options::NUMBER_LINES)
+                .short('n')
+                .long(options::NUMBER_LINES)
+                .help(
                     "Provide width digit line numbering.  The default for width, \
                 if not specified, is 5.  The number occupies the first width column \
                 positions of each text column or each line of -m output.  If char \
@@ -1534,97 +1534,97 @@ Lines are not truncated under single column output.";
                 to separate it from whatever follows.  The default for char is a <tab>. \
                 Line numbers longer than width columns are truncated.",
                 )
-                .allow_hyphen_values(true)
-                .value_name("[char][width]"),
+                .allow_hyphen_values(true)
+                .value_name("[char][width]"),
         )
-        .arg(
-            Arg::new(options::FIRST_LINE_NUMBER)
-                .short('N')
-                .long(options::FIRST_LINE_NUMBER)
-                .help("start counting with NUMBER at 1st line of first page printed")
-                .value_name("NUMBER"),
+        .arg(
+            Arg::new(options::FIRST_LINE_NUMBER)
+                .short('N')
+                .long(options::FIRST_LINE_NUMBER)
+                .help("start counting with NUMBER at 1st line of first page printed")
+                .value_name("NUMBER"),
         )
-        .arg(
-            Arg::new(options::OMIT_HEADER)
-                .short('t')
-                .long(options::OMIT_HEADER)
-                .help(
+        .arg(
+            Arg::new(options::OMIT_HEADER)
+                .short('t')
+                .long(options::OMIT_HEADER)
+                .help(
                     "Write neither the five-line identifying header nor the five-line \
                 trailer usually supplied for each page. Quit writing after the last line \
                  of each file without spacing to the end of the page.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PAGE_LENGTH)
-                .short('l')
-                .long(options::PAGE_LENGTH)
-                .help(
+        .arg(
+            Arg::new(options::PAGE_LENGTH)
+                .short('l')
+                .long(options::PAGE_LENGTH)
+                .help(
                     "Override the 66-line default (default number of lines of text 56, \
                     and with -F 63) and reset the page length to lines.  If lines is not \
                     greater than the sum  of  both the  header  and trailer depths (in lines), \
                     the pr utility shall suppress both the header and trailer, as if the -t \
                     option were in effect. ",
                 )
-                .value_name("PAGE_LENGTH"),
+                .value_name("PAGE_LENGTH"),
         )
-        .arg(
-            Arg::new(options::NO_FILE_WARNINGS)
-                .short('r')
-                .long(options::NO_FILE_WARNINGS)
-                .help("omit warning when a file cannot be opened")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_FILE_WARNINGS)
+                .short('r')
+                .long(options::NO_FILE_WARNINGS)
+                .help("omit warning when a file cannot be opened")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FORM_FEED)
-                .short('F')
-                .short_alias('f')
-                .long(options::FORM_FEED)
-                .help(
+        .arg(
+            Arg::new(options::FORM_FEED)
+                .short('F')
+                .short_alias('f')
+                .long(options::FORM_FEED)
+                .help(
                     "Use a <form-feed> for new pages, instead of the default behavior that \
                 uses a sequence of <newline>s.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::COLUMN_WIDTH)
-                .short('w')
-                .long(options::COLUMN_WIDTH)
-                .help(
+        .arg(
+            Arg::new(options::COLUMN_WIDTH)
+                .short('w')
+                .long(options::COLUMN_WIDTH)
+                .help(
                     "Set the width of the line to width column positions for multiple \
                 text-column output only. If the -w option is not specified and the -s option \
                 is not specified, the default width shall be 72. If the -w option is not specified \
                 and the -s option is specified, the default width shall be 512.",
                 )
-                .value_name("width"),
+                .value_name("width"),
         )
-        .arg(
-            Arg::new(options::PAGE_WIDTH)
-                .short('W')
-                .long(options::PAGE_WIDTH)
-                .help(
+        .arg(
+            Arg::new(options::PAGE_WIDTH)
+                .short('W')
+                .long(options::PAGE_WIDTH)
+                .help(
                     "set page width to PAGE_WIDTH (72) characters always,
                 truncate lines, except -J option is set, no interference
                 with -S or -s",
                 )
-                .value_name("width"),
+                .value_name("width"),
         )
-        .arg(
-            Arg::new(options::ACROSS)
-                .short('a')
-                .long(options::ACROSS)
-                .help(
+        .arg(
+            Arg::new(options::ACROSS)
+                .short('a')
+                .long(options::ACROSS)
+                .help(
                     "Modify the effect of the - column option so that the columns are filled \
                 across the page in a  round-robin  order (for example, when column is 2, the \
                 first input line heads column 1, the second heads column 2, the third is the \
                 second line in column 1, and so on).",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::COLUMN)
-                .long(options::COLUMN)
-                .help(
+        .arg(
+            Arg::new(options::COLUMN)
+                .long(options::COLUMN)
+                .help(
                     "Produce multi-column output that is arranged in column columns \
                 (the default shall be 1) and is written down each column  in  the order in which \
                 the text is received from the input file. This option should not be used with -m. \
@@ -1633,962 +1633,962 @@ Lines are not truncated under single column output.";
                 but a text column shall never exceed the length of the page (see the -l option). \
                 When used with -t, use the minimum number of lines to write the output.",
                 )
-                .value_name("column"),
+                .value_name("column"),
         )
-        .arg(
-            Arg::new(options::COLUMN_CHAR_SEPARATOR)
-                .short('s')
-                .long(options::COLUMN_CHAR_SEPARATOR)
-                .help(
+        .arg(
+            Arg::new(options::COLUMN_CHAR_SEPARATOR)
+                .short('s')
+                .long(options::COLUMN_CHAR_SEPARATOR)
+                .help(
                     "Separate text columns by the single character char instead of by the \
                 appropriate number of <space>s (default for char is the <tab> character).",
                 )
-                .value_name("char"),
+                .value_name("char"),
         )
-        .arg(
-            Arg::new(options::COLUMN_STRING_SEPARATOR)
-                .short('S')
-                .long(options::COLUMN_STRING_SEPARATOR)
-                .help(
+        .arg(
+            Arg::new(options::COLUMN_STRING_SEPARATOR)
+                .short('S')
+                .long(options::COLUMN_STRING_SEPARATOR)
+                .help(
                     "separate columns by STRING, \
                 without -S: Default separator <TAB> with -J and <space> \
                 otherwise (same as -S\" \"), no effect on column options",
                 )
-                .value_name("string"),
+                .value_name("string"),
         )
-        .arg(
-            Arg::new(options::MERGE)
-                .short('m')
-                .long(options::MERGE)
-                .help(
+        .arg(
+            Arg::new(options::MERGE)
+                .short('m')
+                .long(options::MERGE)
+                .help(
                     "Merge files. Standard output shall be formatted so the pr utility \
                 writes one line from each file specified by a file operand, side by side \
                 into text columns of equal fixed widths, in terms of the number of column \
                 positions. Implementations shall support merging of at least nine file operands.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::INDENT)
-                .short('o')
-                .long(options::INDENT)
-                .help(
+        .arg(
+            Arg::new(options::INDENT)
+                .short('o')
+                .long(options::INDENT)
+                .help(
                     "Each line of output shall be preceded by offset <space>s. If the -o \
                 option is not specified, the default offset shall be zero. The space taken is \
                 in addition to the output line width (see the -w option below).",
                 )
-                .value_name("margin"),
+                .value_name("margin"),
         )
-        .arg(
-            Arg::new(options::JOIN_LINES)
-                .short('J')
-                .help(
+        .arg(
+            Arg::new(options::JOIN_LINES)
+                .short('J')
+                .help(
                     "merge full lines, turns off -W line truncation, no column
                 alignment, --sep-string[=STRING] sets separators",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information")
-                .action(ArgAction::Help),
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new(options::FILES)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILES)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let opt_args = recreate_arguments(&args);
+    let opt_args = recreate_arguments(&args);
 
-    let mut command = uu_app();
-    let matches = match command.try_get_matches_from_mut(opt_args) {
-        Ok(m) => m,
-        Err(e) => {
-            e.print()?;
-            return Ok(());
+    let mut command = uu_app();
+    let matches = match command.try_get_matches_from_mut(opt_args) {
+        Ok(m) => m,
+        Err(e) => {
+            e.print()?;
+            return Ok(());
         }
     };
 
-    let mut files = matches
-        .get_many::<String>(options::FILES)
-        .map(|v| v.map(|s| s.as_str()).collect::<Vec<_>>())
-        .unwrap_or_default()
-        .clone();
-    if files.is_empty() {
-        files.insert(0, FILE_STDIN);
+    let mut files = matches
+        .get_many::<String>(options::FILES)
+        .map(|v| v.map(|s| s.as_str()).collect::<Vec<_>>())
+        .unwrap_or_default()
+        .clone();
+    if files.is_empty() {
+        files.insert(0, FILE_STDIN);
     }
 
-    let file_groups: Vec<_> = if matches.get_flag(options::MERGE) {
-        vec![files]
-    } else {
-        files.into_iter().map(|i| vec![i]).collect()
+    let file_groups: Vec<_> = if matches.get_flag(options::MERGE) {
+        vec![files]
+    } else {
+        files.into_iter().map(|i| vec![i]).collect()
     };
 
-    for file_group in file_groups {
-        let result_options = build_options(&matches, &file_group, &args.join(" "));
-        let options = match result_options {
-            Ok(options) => options,
-            Err(err) => {
-                print_error(&matches, &err);
-                return Err(1.into());
+    for file_group in file_groups {
+        let result_options = build_options(&matches, &file_group, &args.join(" "));
+        let options = match result_options {
+            Ok(options) => options,
+            Err(err) => {
+                print_error(&matches, &err);
+                return Err(1.into());
             }
         };
 
-        let cmd_result = if let Ok(group) = file_group.iter().exactly_one() {
-            pr(group, &options)
-        } else {
-            mpr(&file_group, &options)
+        let cmd_result = if let Ok(group) = file_group.iter().exactly_one() {
+            pr(group, &options)
+        } else {
+            mpr(&file_group, &options)
         };
 
-        let status = match cmd_result {
-            Err(error) => {
-                print_error(&matches, &error);
-                1
-            }
-            _ => 0,
+        let status = match cmd_result {
+            Err(error) => {
+                print_error(&matches, &error);
+                1
+            }
+            _ => 0,
         };
-        if status != 0 {
-            return Err(status.into());
+        if status != 0 {
+            return Err(status.into());
         }
     }
     Ok(())
 }
 
-/// Returns re-written arguments which are passed to the program.
-/// Removes -column and +page option as getopts cannot parse things like -3 etc
-/// # Arguments
-/// * `args` - Command line arguments
-fn recreate_arguments(args: &[String]) -> Vec<String> {
-    let column_page_option = Regex::new(r"^[-+]\d+.*").unwrap();
-    let num_regex = Regex::new(r"^[^-]\d*$").unwrap();
-    //let a_file: Regex = Regex::new(r"^[^-+].*").unwrap();
-    let n_regex = Regex::new(r"^-n\s*$").unwrap();
-    let mut arguments = args.to_owned();
-    let num_option = args.iter().find_position(|x| n_regex.is_match(x.trim()));
-    if let Some((pos, _value)) = num_option {
-        if let Some(num_val_opt) = args.get(pos + 1) {
-            if !num_regex.is_match(num_val_opt) {
-                let could_be_file = arguments.remove(pos + 1);
-                arguments.insert(pos + 1, format!("{}", NumberingMode::default().width));
-                arguments.insert(pos + 2, could_be_file);
+/// Returns re-written arguments which are passed to the program.
+/// Removes -column and +page option as getopts cannot parse things like -3 etc
+/// # Arguments
+/// * `args` - Command line arguments
+fn recreate_arguments(args: &[String]) -> Vec<String> {
+    let column_page_option = Regex::new(r"^[-+]\d+.*").unwrap();
+    let num_regex = Regex::new(r"^[^-]\d*$").unwrap();
+    //let a_file: Regex = Regex::new(r"^[^-+].*").unwrap();
+    let n_regex = Regex::new(r"^-n\s*$").unwrap();
+    let mut arguments = args.to_owned();
+    let num_option = args.iter().find_position(|x| n_regex.is_match(x.trim()));
+    if let Some((pos, _value)) = num_option {
+        if let Some(num_val_opt) = args.get(pos + 1) {
+            if !num_regex.is_match(num_val_opt) {
+                let could_be_file = arguments.remove(pos + 1);
+                arguments.insert(pos + 1, format!("{}", NumberingMode::default().width));
+                arguments.insert(pos + 2, could_be_file);
             }
         }
     }
 
-    arguments
-        .into_iter()
-        .filter(|i| !column_page_option.is_match(i))
-        .collect()
+    arguments
+        .into_iter()
+        .filter(|i| !column_page_option.is_match(i))
+        .collect()
 }
 
-fn print_error(matches: &ArgMatches, err: &PrError) {
-    if !matches.get_flag(options::NO_FILE_WARNINGS) {
-        eprintln!("{}", err);
+fn print_error(matches: &ArgMatches, err: &PrError) {
+    if !matches.get_flag(options::NO_FILE_WARNINGS) {
+        eprintln!("{}", err);
     }
 }
 
-fn parse_usize(matches: &ArgMatches, opt: &str) -> Option<Result<usize, PrError>> {
-    let from_parse_error_to_pr_error = |value_to_parse: (String, String)| {
-        let i = value_to_parse.0;
-        let option = value_to_parse.1;
-        i.parse().map_err(|_e| {
-            PrError::EncounteredErrors(format!("invalid {} argument {}", option, i.quote()))
+fn parse_usize(matches: &ArgMatches, opt: &str) -> Option<Result<usize, PrError>> {
+    let from_parse_error_to_pr_error = |value_to_parse: (String, String)| {
+        let i = value_to_parse.0;
+        let option = value_to_parse.1;
+        i.parse().map_err(|_e| {
+            PrError::EncounteredErrors(format!("invalid {} argument {}", option, i.quote()))
         })
     };
-    matches
-        .get_one::<String>(opt)
-        .map(|i| (i.to_string(), format!("-{}", opt)))
-        .map(from_parse_error_to_pr_error)
+    matches
+        .get_one::<String>(opt)
+        .map(|i| (i.to_string(), format!("-{}", opt)))
+        .map(from_parse_error_to_pr_error)
 }
 
-fn build_options(
-    matches: &ArgMatches,
-    paths: &[&str],
-    free_args: &str,
-) -> Result<OutputOptions, PrError> {
-    let form_feed_used = matches.get_flag(options::FORM_FEED);
+fn build_options(
+    matches: &ArgMatches,
+    paths: &[&str],
+    free_args: &str,
+) -> Result<OutputOptions, PrError> {
+    let form_feed_used = matches.get_flag(options::FORM_FEED);
 
-    let is_merge_mode = matches.get_flag(options::MERGE);
+    let is_merge_mode = matches.get_flag(options::MERGE);
 
-    if is_merge_mode && matches.contains_id(options::COLUMN) {
-        let err_msg = String::from("cannot specify number of columns when printing in parallel");
-        return Err(PrError::EncounteredErrors(err_msg));
+    if is_merge_mode && matches.contains_id(options::COLUMN) {
+        let err_msg = String::from("cannot specify number of columns when printing in parallel");
+        return Err(PrError::EncounteredErrors(err_msg));
     }
 
-    if is_merge_mode && matches.get_flag(options::ACROSS) {
-        let err_msg = String::from("cannot specify both printing across and printing in parallel");
-        return Err(PrError::EncounteredErrors(err_msg));
+    if is_merge_mode && matches.get_flag(options::ACROSS) {
+        let err_msg = String::from("cannot specify both printing across and printing in parallel");
+        return Err(PrError::EncounteredErrors(err_msg));
     }
 
-    let merge_files_print = if matches.get_flag(options::MERGE) {
-        Some(paths.len())
-    } else {
-        None
-    };
+    let merge_files_print = if matches.get_flag(options::MERGE) {
+        Some(paths.len())
+    } else {
+        None
+    };
 
-    let header = matches
-        .get_one::<String>(options::HEADER)
-        .map(|s| s.as_str())
-        .unwrap_or(if is_merge_mode || paths[0] == FILE_STDIN {
-            ""
-        } else {
-            paths[0]
+    let header = matches
+        .get_one::<String>(options::HEADER)
+        .map(|s| s.as_str())
+        .unwrap_or(if is_merge_mode || paths[0] == FILE_STDIN {
+            ""
+        } else {
+            paths[0]
         })
-        .to_string();
+        .to_string();
 
-    let default_first_number = NumberingMode::default().first_number;
-    let first_number =
-        parse_usize(matches, options::FIRST_LINE_NUMBER).unwrap_or(Ok(default_first_number))?;
+    let default_first_number = NumberingMode::default().first_number;
+    let first_number =
+        parse_usize(matches, options::FIRST_LINE_NUMBER).unwrap_or(Ok(default_first_number))?;
 
-    let number = matches
-        .get_one::<String>(options::NUMBER_LINES)
-        .map(|i| {
-            let parse_result = i.parse::<usize>();
+    let number = matches
+        .get_one::<String>(options::NUMBER_LINES)
+        .map(|i| {
+            let parse_result = i.parse::<usize>();
 
-            let separator = if parse_result.is_err() {
-                i[0..1].to_string()
-            } else {
-                NumberingMode::default().separator
+            let separator = if parse_result.is_err() {
+                i[0..1].to_string()
+            } else {
+                NumberingMode::default().separator
             };
 
-            let width = match parse_result {
-                Ok(res) => res,
-                Err(_) => i[1..]
-                    .parse::<usize>()
-                    .unwrap_or(NumberingMode::default().width),
+            let width = match parse_result {
+                Ok(res) => res,
+                Err(_) => i[1..]
+                    .parse::<usize>()
+                    .unwrap_or(NumberingMode::default().width),
             };
 
-            NumberingMode {
-                width,
-                separator,
-                first_number,
+            NumberingMode {
+                width,
+                separator,
+                first_number,
             }
         })
-        .or_else(|| {
-            if matches.contains_id(options::NUMBER_LINES) {
-                Some(NumberingMode::default())
-            } else {
-                None
-            }
+        .or_else(|| {
+            if matches.contains_id(options::NUMBER_LINES) {
+                Some(NumberingMode::default())
+            } else {
+                None
+            }
         });
 
-    let double_space = matches.get_flag(options::DOUBLE_SPACE);
+    let double_space = matches.get_flag(options::DOUBLE_SPACE);
 
-    let content_line_separator = if double_space {
-        "\n".repeat(2)
-    } else {
-        "\n".to_string()
+    let content_line_separator = if double_space {
+        "\n".repeat(2)
+    } else {
+        "\n".to_string()
     };
 
-    let line_separator = "\n".to_string();
+    let line_separator = "\n".to_string();
 
-    let last_modified_time = if is_merge_mode || paths[0].eq(FILE_STDIN) {
-        // let date_time = Local::now();
-        // date_time.format("%b %d %H:%M %Y").to_string()
-        let date_time = OffsetDateTime::now_local().unwrap();
-        date_time.format(&DATE_TIME_FORMAT).unwrap()
-    } else {
-        file_last_modified_time(paths.first().unwrap())
+    let last_modified_time = if is_merge_mode || paths[0].eq(FILE_STDIN) {
+        // let date_time = Local::now();
+        // date_time.format("%b %d %H:%M %Y").to_string()
+        let date_time = OffsetDateTime::now_local().unwrap();
+        date_time.format(&DATE_TIME_FORMAT).unwrap()
+    } else {
+        file_last_modified_time(paths.first().unwrap())
     };
 
-    // +page option is less priority than --pages
-    let page_plus_re = Regex::new(r"\s*\+(\d+:*\d*)\s*").unwrap();
-    let start_page_in_plus_option = match page_plus_re.captures(free_args).map(|i| {
-        let unparsed_num = i.get(1).unwrap().as_str().trim();
-        let x: Vec<_> = unparsed_num.split(':').collect();
-        x[0].to_string().parse::<usize>().map_err(|_e| {
-            PrError::EncounteredErrors(format!("invalid {} argument {}", "+", unparsed_num.quote()))
+    // +page option is less priority than --pages
+    let page_plus_re = Regex::new(r"\s*\+(\d+:*\d*)\s*").unwrap();
+    let start_page_in_plus_option = match page_plus_re.captures(free_args).map(|i| {
+        let unparsed_num = i.get(1).unwrap().as_str().trim();
+        let x: Vec<_> = unparsed_num.split(':').collect();
+        x[0].to_string().parse::<usize>().map_err(|_e| {
+            PrError::EncounteredErrors(format!("invalid {} argument {}", "+", unparsed_num.quote()))
         })
     }) {
-        Some(res) => res?,
-        None => 1,
+        Some(res) => res?,
+        None => 1,
     };
 
-    let end_page_in_plus_option = match page_plus_re
-        .captures(free_args)
-        .map(|i| i.get(1).unwrap().as_str().trim())
-        .filter(|i| i.contains(':'))
-        .map(|unparsed_num| {
-            let x: Vec<_> = unparsed_num.split(':').collect();
-            x[1].to_string().parse::<usize>().map_err(|_e| {
-                PrError::EncounteredErrors(format!(
+    let end_page_in_plus_option = match page_plus_re
+        .captures(free_args)
+        .map(|i| i.get(1).unwrap().as_str().trim())
+        .filter(|i| i.contains(':'))
+        .map(|unparsed_num| {
+            let x: Vec<_> = unparsed_num.split(':').collect();
+            x[1].to_string().parse::<usize>().map_err(|_e| {
+                PrError::EncounteredErrors(format!(
                     "invalid {} argument {}",
                     "+",
-                    unparsed_num.quote()
+                    unparsed_num.quote()
                 ))
             })
         }) {
-        Some(res) => Some(res?),
-        None => None,
+        Some(res) => Some(res?),
+        None => None,
     };
 
-    let invalid_pages_map = |i: String| {
-        let unparsed_value = matches.get_one::<String>(options::PAGES).unwrap();
-        i.parse::<usize>().map_err(|_e| {
-            PrError::EncounteredErrors(format!(
+    let invalid_pages_map = |i: String| {
+        let unparsed_value = matches.get_one::<String>(options::PAGES).unwrap();
+        i.parse::<usize>().map_err(|_e| {
+            PrError::EncounteredErrors(format!(
                 "invalid --pages argument {}",
-                unparsed_value.quote()
+                unparsed_value.quote()
             ))
         })
     };
 
-    let start_page = match matches
-        .get_one::<String>(options::PAGES)
-        .map(|i| {
-            let x: Vec<_> = i.split(':').collect();
-            x[0].to_string()
+    let start_page = match matches
+        .get_one::<String>(options::PAGES)
+        .map(|i| {
+            let x: Vec<_> = i.split(':').collect();
+            x[0].to_string()
         })
-        .map(invalid_pages_map)
+        .map(invalid_pages_map)
     {
-        Some(res) => res?,
-        None => start_page_in_plus_option,
+        Some(res) => res?,
+        None => start_page_in_plus_option,
     };
 
-    let end_page = match matches
-        .get_one::<String>(options::PAGES)
-        .filter(|i| i.contains(':'))
-        .map(|i| {
-            let x: Vec<_> = i.split(':').collect();
-            x[1].to_string()
+    let end_page = match matches
+        .get_one::<String>(options::PAGES)
+        .filter(|i| i.contains(':'))
+        .map(|i| {
+            let x: Vec<_> = i.split(':').collect();
+            x[1].to_string()
         })
-        .map(invalid_pages_map)
+        .map(invalid_pages_map)
     {
-        Some(res) => Some(res?),
-        None => end_page_in_plus_option,
+        Some(res) => Some(res?),
+        None => end_page_in_plus_option,
     };
 
-    if let Some(end_page) = end_page {
-        if start_page > end_page {
-            return Err(PrError::EncounteredErrors(format!(
+    if let Some(end_page) = end_page {
+        if start_page > end_page {
+            return Err(PrError::EncounteredErrors(format!(
                 "invalid --pages argument '{}:{}'",
-                start_page, end_page
+                start_page, end_page
             )));
         }
     }
 
-    let default_lines_per_page = if form_feed_used {
-        LINES_PER_PAGE_FOR_FORM_FEED
-    } else {
-        LINES_PER_PAGE
+    let default_lines_per_page = if form_feed_used {
+        LINES_PER_PAGE_FOR_FORM_FEED
+    } else {
+        LINES_PER_PAGE
     };
 
-    let page_length =
-        parse_usize(matches, options::PAGE_LENGTH).unwrap_or(Ok(default_lines_per_page))?;
+    let page_length =
+        parse_usize(matches, options::PAGE_LENGTH).unwrap_or(Ok(default_lines_per_page))?;
 
-    let page_length_le_ht = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE);
+    let page_length_le_ht = page_length < (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE);
 
-    let display_header_and_trailer =
-        !(page_length_le_ht) && !matches.get_flag(options::OMIT_HEADER);
+    let display_header_and_trailer =
+        !(page_length_le_ht) && !matches.get_flag(options::OMIT_HEADER);
 
-    let content_lines_per_page = if page_length_le_ht {
-        page_length
-    } else {
-        page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE)
+    let content_lines_per_page = if page_length_le_ht {
+        page_length
+    } else {
+        page_length - (HEADER_LINES_PER_PAGE + TRAILER_LINES_PER_PAGE)
     };
 
-    let page_separator_char = if matches.get_flag(options::FORM_FEED) {
-        let bytes = vec![FF];
-        String::from_utf8(bytes).unwrap()
-    } else {
-        "\n".to_string()
+    let page_separator_char = if matches.get_flag(options::FORM_FEED) {
+        let bytes = vec![FF];
+        String::from_utf8(bytes).unwrap()
+    } else {
+        "\n".to_string()
     };
 
-    let across_mode = matches.get_flag(options::ACROSS);
+    let across_mode = matches.get_flag(options::ACROSS);
 
-    let column_separator = match matches.get_one::<String>(options::COLUMN_STRING_SEPARATOR) {
-        Some(x) => Some(x),
-        None => matches.get_one::<String>(options::COLUMN_CHAR_SEPARATOR),
+    let column_separator = match matches.get_one::<String>(options::COLUMN_STRING_SEPARATOR) {
+        Some(x) => Some(x),
+        None => matches.get_one::<String>(options::COLUMN_CHAR_SEPARATOR),
     }
-    .map(ToString::to_string)
-    .unwrap_or_else(|| DEFAULT_COLUMN_SEPARATOR.to_string());
+    .map(ToString::to_string)
+    .unwrap_or_else(|| DEFAULT_COLUMN_SEPARATOR.to_string());
 
-    let default_column_width = if matches.contains_id(options::COLUMN_WIDTH)
-        && matches.contains_id(options::COLUMN_CHAR_SEPARATOR)
+    let default_column_width = if matches.contains_id(options::COLUMN_WIDTH)
+        && matches.contains_id(options::COLUMN_CHAR_SEPARATOR)
     {
-        DEFAULT_COLUMN_WIDTH_WITH_S_OPTION
-    } else {
-        DEFAULT_COLUMN_WIDTH
+        DEFAULT_COLUMN_WIDTH_WITH_S_OPTION
+    } else {
+        DEFAULT_COLUMN_WIDTH
     };
 
-    let column_width =
-        parse_usize(matches, options::COLUMN_WIDTH).unwrap_or(Ok(default_column_width))?;
+    let column_width =
+        parse_usize(matches, options::COLUMN_WIDTH).unwrap_or(Ok(default_column_width))?;
 
-    let page_width = if matches.get_flag(options::JOIN_LINES) {
-        None
-    } else {
-        match parse_usize(matches, options::PAGE_WIDTH) {
-            Some(res) => Some(res?),
-            None => None,
+    let page_width = if matches.get_flag(options::JOIN_LINES) {
+        None
+    } else {
+        match parse_usize(matches, options::PAGE_WIDTH) {
+            Some(res) => Some(res?),
+            None => None,
         }
     };
 
-    let re_col = Regex::new(r"\s*-(\d+)\s*").unwrap();
+    let re_col = Regex::new(r"\s*-(\d+)\s*").unwrap();
 
-    let start_column_option = match re_col.captures(free_args).map(|i| {
-        let unparsed_num = i.get(1).unwrap().as_str().trim();
-        unparsed_num.parse::<usize>().map_err(|_e| {
-            PrError::EncounteredErrors(format!("invalid {} argument {}", "-", unparsed_num.quote()))
+    let start_column_option = match re_col.captures(free_args).map(|i| {
+        let unparsed_num = i.get(1).unwrap().as_str().trim();
+        unparsed_num.parse::<usize>().map_err(|_e| {
+            PrError::EncounteredErrors(format!("invalid {} argument {}", "-", unparsed_num.quote()))
         })
     }) {
-        Some(res) => Some(res?),
-        None => None,
+        Some(res) => Some(res?),
+        None => None,
     };
 
-    // --column has more priority than -column
+    // --column has more priority than -column
 
-    let column_option_value = match parse_usize(matches, options::COLUMN) {
-        Some(res) => Some(res?),
-        None => start_column_option,
+    let column_option_value = match parse_usize(matches, options::COLUMN) {
+        Some(res) => Some(res?),
+        None => start_column_option,
     };
 
-    let column_mode_options = column_option_value.map(|columns| ColumnModeOptions {
-        columns,
-        width: column_width,
-        column_separator,
-        across_mode,
+    let column_mode_options = column_option_value.map(|columns| ColumnModeOptions {
+        columns,
+        width: column_width,
+        column_separator,
+        across_mode,
     });
 
-    let offset_spaces = " ".repeat(parse_usize(matches, options::INDENT).unwrap_or(Ok(0))?);
-    let join_lines = matches.get_flag(options::JOIN_LINES);
+    let offset_spaces = " ".repeat(parse_usize(matches, options::INDENT).unwrap_or(Ok(0))?);
+    let join_lines = matches.get_flag(options::JOIN_LINES);
 
-    let col_sep_for_printing = column_mode_options
-        .as_ref()
-        .map(|i| i.column_separator.clone())
-        .unwrap_or_else(|| {
-            merge_files_print
-                .map(|_k| DEFAULT_COLUMN_SEPARATOR.to_string())
-                .unwrap_or_default()
+    let col_sep_for_printing = column_mode_options
+        .as_ref()
+        .map(|i| i.column_separator.clone())
+        .unwrap_or_else(|| {
+            merge_files_print
+                .map(|_k| DEFAULT_COLUMN_SEPARATOR.to_string())
+                .unwrap_or_default()
         });
 
-    let columns_to_print = merge_files_print
-        .unwrap_or_else(|| column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1));
+    let columns_to_print = merge_files_print
+        .unwrap_or_else(|| column_mode_options.as_ref().map(|i| i.columns).unwrap_or(1));
 
-    let line_width = if join_lines {
-        None
-    } else if columns_to_print > 1 {
+    let line_width = if join_lines {
+        None
+    } else if columns_to_print > 1 {
         Some(
-            column_mode_options
-                .as_ref()
-                .map(|i| i.width)
-                .unwrap_or(DEFAULT_COLUMN_WIDTH),
+            column_mode_options
+                .as_ref()
+                .map(|i| i.width)
+                .unwrap_or(DEFAULT_COLUMN_WIDTH),
         )
-    } else {
-        page_width
+    } else {
+        page_width
     };
 
-    Ok(OutputOptions {
-        number,
-        header,
-        double_space,
-        line_separator,
-        content_line_separator,
-        last_modified_time,
-        start_page,
-        end_page,
-        display_header_and_trailer,
-        content_lines_per_page,
-        page_separator_char,
-        column_mode_options,
-        merge_files_print,
-        offset_spaces,
-        form_feed_used,
-        join_lines,
-        col_sep_for_printing,
-        line_width,
+    Ok(OutputOptions {
+        number,
+        header,
+        double_space,
+        line_separator,
+        content_line_separator,
+        last_modified_time,
+        start_page,
+        end_page,
+        display_header_and_trailer,
+        content_lines_per_page,
+        page_separator_char,
+        column_mode_options,
+        merge_files_print,
+        offset_spaces,
+        form_feed_used,
+        join_lines,
+        col_sep_for_printing,
+        line_width,
     })
 }
 
-fn open(path: &str) -> Result<Box<dyn Read>, PrError> {
-    if path == FILE_STDIN {
-        let stdin = stdin();
-        return Ok(Box::new(stdin) as Box<dyn Read>);
+fn open(path: &str) -> Result<Box<dyn Read>, PrError> {
+    if path == FILE_STDIN {
+        let stdin = stdin();
+        return Ok(Box::new(stdin) as Box<dyn Read>);
     }
 
-    metadata(path)
-        .map(|i| {
-            let path_string = path.to_string();
-            match i.file_type() {
-                #[cfg(unix)]
-                ft if ft.is_block_device() => Err(PrError::UnknownFiletype(path_string)),
-                #[cfg(unix)]
-                ft if ft.is_char_device() => Err(PrError::UnknownFiletype(path_string)),
-                #[cfg(unix)]
-                ft if ft.is_fifo() => Err(PrError::UnknownFiletype(path_string)),
-                #[cfg(unix)]
-                ft if ft.is_socket() => Err(PrError::IsSocket(path_string)),
-                ft if ft.is_dir() => Err(PrError::IsDirectory(path_string)),
-                ft if ft.is_file() || ft.is_symlink() => {
-                    Ok(Box::new(File::open(path).context(path)?) as Box<dyn Read>)
+    metadata(path)
+        .map(|i| {
+            let path_string = path.to_string();
+            match i.file_type() {
+                #[cfg(unix)]
+                ft if ft.is_block_device() => Err(PrError::UnknownFiletype(path_string)),
+                #[cfg(unix)]
+                ft if ft.is_char_device() => Err(PrError::UnknownFiletype(path_string)),
+                #[cfg(unix)]
+                ft if ft.is_fifo() => Err(PrError::UnknownFiletype(path_string)),
+                #[cfg(unix)]
+                ft if ft.is_socket() => Err(PrError::IsSocket(path_string)),
+                ft if ft.is_dir() => Err(PrError::IsDirectory(path_string)),
+                ft if ft.is_file() || ft.is_symlink() => {
+                    Ok(Box::new(File::open(path).context(path)?) as Box<dyn Read>)
                 }
-                _ => Err(PrError::UnknownFiletype(path_string)),
+                _ => Err(PrError::UnknownFiletype(path_string)),
             }
         })
-        .unwrap_or_else(|_| Err(PrError::NotExists(path.to_string())))
+        .unwrap_or_else(|_| Err(PrError::NotExists(path.to_string())))
 }
 
-fn split_lines_if_form_feed(file_content: Result<String, std::io::Error>) -> Vec<FileLine> {
-    file_content
-        .map(|content| {
-            let mut lines = Vec::new();
-            let mut f_occurred = 0;
-            let mut chunk = Vec::new();
-            for byte in content.as_bytes() {
-                if byte == &FF {
-                    f_occurred += 1;
-                } else {
-                    if f_occurred != 0 {
-                        // First time byte occurred in the scan
-                        lines.push(FileLine {
-                            line_content: Ok(String::from_utf8(chunk.clone()).unwrap()),
-                            form_feeds_after: f_occurred,
-                            ..FileLine::default()
+fn split_lines_if_form_feed(file_content: Result<String, std::io::Error>) -> Vec<FileLine> {
+    file_content
+        .map(|content| {
+            let mut lines = Vec::new();
+            let mut f_occurred = 0;
+            let mut chunk = Vec::new();
+            for byte in content.as_bytes() {
+                if byte == &FF {
+                    f_occurred += 1;
+                } else {
+                    if f_occurred != 0 {
+                        // First time byte occurred in the scan
+                        lines.push(FileLine {
+                            line_content: Ok(String::from_utf8(chunk.clone()).unwrap()),
+                            form_feeds_after: f_occurred,
+                            ..FileLine::default()
                         });
-                        chunk.clear();
+                        chunk.clear();
                     }
-                    chunk.push(*byte);
-                    f_occurred = 0;
+                    chunk.push(*byte);
+                    f_occurred = 0;
                 }
             }
 
-            lines.push(FileLine {
-                line_content: Ok(String::from_utf8(chunk).unwrap()),
-                form_feeds_after: f_occurred,
-                ..FileLine::default()
+            lines.push(FileLine {
+                line_content: Ok(String::from_utf8(chunk).unwrap()),
+                form_feeds_after: f_occurred,
+                ..FileLine::default()
             });
 
-            lines
+            lines
         })
-        .unwrap_or_else(|e| {
-            vec![FileLine {
-                line_content: Err(e),
-                ..FileLine::default()
+        .unwrap_or_else(|e| {
+            vec![FileLine {
+                line_content: Err(e),
+                ..FileLine::default()
             }]
         })
 }
 
-fn pr(path: &str, options: &OutputOptions) -> Result<i32, PrError> {
-    let lines = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines();
+fn pr(path: &str, options: &OutputOptions) -> Result<i32, PrError> {
+    let lines = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?).lines();
 
-    let pages = read_stream_and_create_pages(options, lines, 0);
+    let pages = read_stream_and_create_pages(options, lines, 0);
 
-    for page_with_page_number in pages {
-        let page_number = page_with_page_number.0 + 1;
-        let page = page_with_page_number.1;
-        print_page(&page, options, page_number)?;
+    for page_with_page_number in pages {
+        let page_number = page_with_page_number.0 + 1;
+        let page = page_with_page_number.1;
+        print_page(&page, options, page_number)?;
     }
 
     Ok(0)
 }
 
-fn read_stream_and_create_pages(
-    options: &OutputOptions,
-    lines: Lines<BufReader<Box<dyn Read>>>,
-    file_id: usize,
-) -> Box<dyn Iterator<Item = (usize, Vec<FileLine>)>> {
-    let start_page = options.start_page;
-    let start_line_number = get_start_line_number(options);
-    let last_page = options.end_page;
-    let lines_needed_per_page = lines_to_read_for_page(options);
+fn read_stream_and_create_pages(
+    options: &OutputOptions,
+    lines: Lines<BufReader<Box<dyn Read>>>,
+    file_id: usize,
+) -> Box<dyn Iterator<Item = (usize, Vec<FileLine>)>> {
+    let start_page = options.start_page;
+    let start_line_number = get_start_line_number(options);
+    let last_page = options.end_page;
+    let lines_needed_per_page = lines_to_read_for_page(options);
 
-    Box::new(
-        lines
-            .flat_map(split_lines_if_form_feed)
-            .enumerate()
-            .map(move |(i, line)| FileLine {
-                line_number: i + start_line_number,
-                file_id,
-                ..line
-            }) // Add line number and file_id
-            .batching(move |it| {
-                let mut first_page = Vec::new();
-                let mut page_with_lines = Vec::new();
-                for line in it {
-                    let form_feeds_after = line.form_feeds_after;
-                    first_page.push(line);
+    Box::new(
+        lines
+            .flat_map(split_lines_if_form_feed)
+            .enumerate()
+            .map(move |(i, line)| FileLine {
+                line_number: i + start_line_number,
+                file_id,
+                ..line
+            }) // Add line number and file_id
+            .batching(move |it| {
+                let mut first_page = Vec::new();
+                let mut page_with_lines = Vec::new();
+                for line in it {
+                    let form_feeds_after = line.form_feeds_after;
+                    first_page.push(line);
 
-                    if form_feeds_after > 1 {
-                        // insert empty pages
-                        page_with_lines.push(first_page);
-                        for _i in 1..form_feeds_after {
-                            page_with_lines.push(vec![]);
+                    if form_feeds_after > 1 {
+                        // insert empty pages
+                        page_with_lines.push(first_page);
+                        for _i in 1..form_feeds_after {
+                            page_with_lines.push(vec![]);
                         }
-                        return Some(page_with_lines);
+                        return Some(page_with_lines);
                     }
 
-                    if first_page.len() == lines_needed_per_page || form_feeds_after == 1 {
+                    if first_page.len() == lines_needed_per_page || form_feeds_after == 1 {
                         break;
                     }
                 }
 
-                if first_page.is_empty() {
-                    return None;
+                if first_page.is_empty() {
+                    return None;
                 }
-                page_with_lines.push(first_page);
-                Some(page_with_lines)
-            }) // Create set of pages as form feeds could lead to empty pages
-            .flatten() // Flatten to pages from page sets
-            .enumerate() // Assign page number
-            .skip_while(move |(x, _)| {
-                // Skip the not needed pages
-                let current_page = x + 1;
-                current_page < start_page
+                page_with_lines.push(first_page);
+                Some(page_with_lines)
+            }) // Create set of pages as form feeds could lead to empty pages
+            .flatten() // Flatten to pages from page sets
+            .enumerate() // Assign page number
+            .skip_while(move |(x, _)| {
+                // Skip the not needed pages
+                let current_page = x + 1;
+                current_page < start_page
             })
-            .take_while(move |(x, _)| {
-                // Take only the required pages
-                let current_page = x + 1;
+            .take_while(move |(x, _)| {
+                // Take only the required pages
+                let current_page = x + 1;
 
-                current_page >= start_page
-                    && last_page.map_or(true, |last_page| current_page <= last_page)
+                current_page >= start_page
+                    && last_page.map_or(true, |last_page| current_page <= last_page)
             }),
     )
 }
 
-fn mpr(paths: &[&str], options: &OutputOptions) -> Result<i32, PrError> {
-    let n_files = paths.len();
+fn mpr(paths: &[&str], options: &OutputOptions) -> Result<i32, PrError> {
+    let n_files = paths.len();
 
-    // Check if files exists
-    for path in paths {
-        open(path)?;
+    // Check if files exists
+    for path in paths {
+        open(path)?;
     }
 
-    let file_line_groups = paths
-        .iter()
-        .enumerate()
-        .map(|(i, path)| {
-            let lines = BufReader::with_capacity(READ_BUFFER_SIZE, open(path).unwrap()).lines();
+    let file_line_groups = paths
+        .iter()
+        .enumerate()
+        .map(|(i, path)| {
+            let lines = BufReader::with_capacity(READ_BUFFER_SIZE, open(path).unwrap()).lines();
 
-            read_stream_and_create_pages(options, lines, i).flat_map(move |(x, line)| {
-                let file_line = line;
-                let page_number = x + 1;
-                file_line
-                    .into_iter()
-                    .map(|fl| FileLine {
-                        page_number,
-                        group_key: page_number * n_files + fl.file_id,
-                        ..fl
+            read_stream_and_create_pages(options, lines, i).flat_map(move |(x, line)| {
+                let file_line = line;
+                let page_number = x + 1;
+                file_line
+                    .into_iter()
+                    .map(|fl| FileLine {
+                        page_number,
+                        group_key: page_number * n_files + fl.file_id,
+                        ..fl
                     })
-                    .collect::<Vec<_>>()
+                    .collect::<Vec<_>>()
             })
         })
-        .kmerge_by(|a, b| {
-            if a.group_key == b.group_key {
-                a.line_number < b.line_number
-            } else {
-                a.group_key < b.group_key
+        .kmerge_by(|a, b| {
+            if a.group_key == b.group_key {
+                a.line_number < b.line_number
+            } else {
+                a.group_key < b.group_key
             }
         })
-        .group_by(|file_line| file_line.group_key);
+        .group_by(|file_line| file_line.group_key);
 
-    let start_page = options.start_page;
-    let mut lines = Vec::new();
-    let mut page_counter = start_page;
+    let start_page = options.start_page;
+    let mut lines = Vec::new();
+    let mut page_counter = start_page;
 
-    for (_key, file_line_group) in &file_line_groups {
-        for file_line in file_line_group {
-            if let Err(e) = file_line.line_content {
-                return Err(e.into());
+    for (_key, file_line_group) in &file_line_groups {
+        for file_line in file_line_group {
+            if let Err(e) = file_line.line_content {
+                return Err(e.into());
             }
-            let new_page_number = file_line.page_number;
-            if page_counter != new_page_number {
-                print_page(&lines, options, page_counter)?;
-                lines = Vec::new();
-                page_counter = new_page_number;
+            let new_page_number = file_line.page_number;
+            if page_counter != new_page_number {
+                print_page(&lines, options, page_counter)?;
+                lines = Vec::new();
+                page_counter = new_page_number;
             }
-            lines.push(file_line);
+            lines.push(file_line);
         }
     }
 
-    print_page(&lines, options, page_counter)?;
+    print_page(&lines, options, page_counter)?;
 
     Ok(0)
 }
 
-fn print_page(
-    lines: &[FileLine],
-    options: &OutputOptions,
-    page: usize,
-) -> Result<usize, std::io::Error> {
-    let line_separator = options.line_separator.as_bytes();
-    let page_separator = options.page_separator_char.as_bytes();
+fn print_page(
+    lines: &[FileLine],
+    options: &OutputOptions,
+    page: usize,
+) -> Result<usize, std::io::Error> {
+    let line_separator = options.line_separator.as_bytes();
+    let page_separator = options.page_separator_char.as_bytes();
 
-    let header = header_content(options, page);
-    let trailer_content = trailer_content(options);
+    let header = header_content(options, page);
+    let trailer_content = trailer_content(options);
 
-    let out = stdout();
-    let mut out = out.lock();
+    let out = stdout();
+    let mut out = out.lock();
 
-    for x in header {
-        out.write_all(x.as_bytes())?;
-        out.write_all(line_separator)?;
+    for x in header {
+        out.write_all(x.as_bytes())?;
+        out.write_all(line_separator)?;
     }
 
-    let lines_written = write_columns(lines, options, &mut out)?;
+    let lines_written = write_columns(lines, options, &mut out)?;
 
-    for (index, x) in trailer_content.iter().enumerate() {
-        out.write_all(x.as_bytes())?;
-        if index + 1 != trailer_content.len() {
-            out.write_all(line_separator)?;
+    for (index, x) in trailer_content.iter().enumerate() {
+        out.write_all(x.as_bytes())?;
+        if index + 1 != trailer_content.len() {
+            out.write_all(line_separator)?;
         }
     }
-    out.write_all(page_separator)?;
-    out.flush()?;
-    Ok(lines_written)
+    out.write_all(page_separator)?;
+    out.flush()?;
+    Ok(lines_written)
 }
 
-fn write_columns(
-    lines: &[FileLine],
-    options: &OutputOptions,
-    out: &mut impl Write,
-) -> Result<usize, std::io::Error> {
-    let line_separator = options.content_line_separator.as_bytes();
+fn write_columns(
+    lines: &[FileLine],
+    options: &OutputOptions,
+    out: &mut impl Write,
+) -> Result<usize, std::io::Error> {
+    let line_separator = options.content_line_separator.as_bytes();
 
-    let content_lines_per_page = if options.double_space {
-        options.content_lines_per_page / 2
-    } else {
-        options.content_lines_per_page
+    let content_lines_per_page = if options.double_space {
+        options.content_lines_per_page / 2
+    } else {
+        options.content_lines_per_page
     };
 
-    let columns = options
-        .merge_files_print
-        .unwrap_or_else(|| get_columns(options));
-    let line_width = options.line_width;
-    let mut lines_printed = 0;
-    let feed_line_present = options.form_feed_used;
-    let mut not_found_break = false;
+    let columns = options
+        .merge_files_print
+        .unwrap_or_else(|| get_columns(options));
+    let line_width = options.line_width;
+    let mut lines_printed = 0;
+    let feed_line_present = options.form_feed_used;
+    let mut not_found_break = false;
 
-    let across_mode = options
-        .column_mode_options
-        .as_ref()
-        .map(|i| i.across_mode)
-        .unwrap_or(false);
+    let across_mode = options
+        .column_mode_options
+        .as_ref()
+        .map(|i| i.across_mode)
+        .unwrap_or(false);
 
-    let mut filled_lines = Vec::new();
-    if options.merge_files_print.is_some() {
-        let mut offset = 0;
-        for col in 0..columns {
-            let mut inserted = 0;
-            for line in &lines[offset..] {
-                if line.file_id != col {
+    let mut filled_lines = Vec::new();
+    if options.merge_files_print.is_some() {
+        let mut offset = 0;
+        for col in 0..columns {
+            let mut inserted = 0;
+            for line in &lines[offset..] {
+                if line.file_id != col {
                     break;
                 }
-                filled_lines.push(Some(line));
-                inserted += 1;
+                filled_lines.push(Some(line));
+                inserted += 1;
             }
-            offset += inserted;
+            offset += inserted;
 
-            for _i in inserted..content_lines_per_page {
-                filled_lines.push(None);
+            for _i in inserted..content_lines_per_page {
+                filled_lines.push(None);
             }
         }
     }
 
-    let table: Vec<Vec<_>> = (0..content_lines_per_page)
-        .map(move |a| {
-            (0..columns)
-                .map(|i| {
-                    if across_mode {
-                        lines.get(a * columns + i)
-                    } else if options.merge_files_print.is_some() {
-                        *filled_lines
-                            .get(content_lines_per_page * i + a)
-                            .unwrap_or(&None)
-                    } else {
-                        lines.get(content_lines_per_page * i + a)
+    let table: Vec<Vec<_>> = (0..content_lines_per_page)
+        .map(move |a| {
+            (0..columns)
+                .map(|i| {
+                    if across_mode {
+                        lines.get(a * columns + i)
+                    } else if options.merge_files_print.is_some() {
+                        *filled_lines
+                            .get(content_lines_per_page * i + a)
+                            .unwrap_or(&None)
+                    } else {
+                        lines.get(content_lines_per_page * i + a)
                     }
                 })
-                .collect()
+                .collect()
         })
-        .collect();
+        .collect();
 
-    let blank_line = FileLine::default();
-    for row in table {
-        let indexes = row.len();
-        for (i, cell) in row.iter().enumerate() {
-            if cell.is_none() && options.merge_files_print.is_some() {
-                out.write_all(
-                    get_line_for_printing(options, &blank_line, columns, i, &line_width, indexes)
-                        .as_bytes(),
+    let blank_line = FileLine::default();
+    for row in table {
+        let indexes = row.len();
+        for (i, cell) in row.iter().enumerate() {
+            if cell.is_none() && options.merge_files_print.is_some() {
+                out.write_all(
+                    get_line_for_printing(options, &blank_line, columns, i, &line_width, indexes)
+                        .as_bytes(),
                 )?;
-            } else if cell.is_none() {
-                not_found_break = true;
+            } else if cell.is_none() {
+                not_found_break = true;
                 break;
-            } else if cell.is_some() {
-                let file_line = cell.unwrap();
+            } else if cell.is_some() {
+                let file_line = cell.unwrap();
 
-                out.write_all(
-                    get_line_for_printing(options, file_line, columns, i, &line_width, indexes)
-                        .as_bytes(),
+                out.write_all(
+                    get_line_for_printing(options, file_line, columns, i, &line_width, indexes)
+                        .as_bytes(),
                 )?;
-                lines_printed += 1;
+                lines_printed += 1;
             }
         }
-        if not_found_break && feed_line_present {
+        if not_found_break && feed_line_present {
             break;
-        } else {
-            out.write_all(line_separator)?;
+        } else {
+            out.write_all(line_separator)?;
         }
     }
 
-    Ok(lines_printed)
+    Ok(lines_printed)
 }
 
-fn get_line_for_printing(
-    options: &OutputOptions,
-    file_line: &FileLine,
-    columns: usize,
-    index: usize,
-    line_width: &Option<usize>,
-    indexes: usize,
-) -> String {
-    let blank_line = String::new();
-    let formatted_line_number = get_formatted_line_number(options, file_line.line_number, index);
+fn get_line_for_printing(
+    options: &OutputOptions,
+    file_line: &FileLine,
+    columns: usize,
+    index: usize,
+    line_width: &Option<usize>,
+    indexes: usize,
+) -> String {
+    let blank_line = String::new();
+    let formatted_line_number = get_formatted_line_number(options, file_line.line_number, index);
 
-    let mut complete_line = format!(
+    let mut complete_line = format!(
         "{}{}",
-        formatted_line_number,
-        file_line.line_content.as_ref().unwrap()
+        formatted_line_number,
+        file_line.line_content.as_ref().unwrap()
     );
 
-    let offset_spaces = &options.offset_spaces;
+    let offset_spaces = &options.offset_spaces;
 
-    let tab_count = complete_line.chars().filter(|i| i == &TAB).count();
+    let tab_count = complete_line.chars().filter(|i| i == &TAB).count();
 
-    let display_length = complete_line.len() + (tab_count * 7);
+    let display_length = complete_line.len() + (tab_count * 7);
 
-    let sep = if (index + 1) != indexes && !options.join_lines {
-        &options.col_sep_for_printing
-    } else {
-        &blank_line
+    let sep = if (index + 1) != indexes && !options.join_lines {
+        &options.col_sep_for_printing
+    } else {
+        &blank_line
     };
 
     format!(
         "{}{}{}",
-        offset_spaces,
-        line_width
-            .map(|i| {
-                let min_width = (i - (columns - 1)) / columns;
-                if display_length < min_width {
-                    for _i in 0..(min_width - display_length) {
-                        complete_line.push(' ');
+        offset_spaces,
+        line_width
+            .map(|i| {
+                let min_width = (i - (columns - 1)) / columns;
+                if display_length < min_width {
+                    for _i in 0..(min_width - display_length) {
+                        complete_line.push(' ');
                     }
                 }
 
-                complete_line.chars().take(min_width).collect()
+                complete_line.chars().take(min_width).collect()
             })
-            .unwrap_or(complete_line),
-        sep
+            .unwrap_or(complete_line),
+        sep
     )
 }
 
-fn get_formatted_line_number(opts: &OutputOptions, line_number: usize, index: usize) -> String {
-    let should_show_line_number =
-        opts.number.is_some() && (opts.merge_files_print.is_none() || index == 0);
-    if should_show_line_number && line_number != 0 {
-        let line_str = line_number.to_string();
-        let num_opt = opts.number.as_ref().unwrap();
-        let width = num_opt.width;
-        let separator = &num_opt.separator;
-        if line_str.len() >= width {
+fn get_formatted_line_number(opts: &OutputOptions, line_number: usize, index: usize) -> String {
+    let should_show_line_number =
+        opts.number.is_some() && (opts.merge_files_print.is_none() || index == 0);
+    if should_show_line_number && line_number != 0 {
+        let line_str = line_number.to_string();
+        let num_opt = opts.number.as_ref().unwrap();
+        let width = num_opt.width;
+        let separator = &num_opt.separator;
+        if line_str.len() >= width {
             format!(
                 "{:>width$}{}",
-                &line_str[line_str.len() - width..],
-                separator,
-                width = width
+                &line_str[line_str.len() - width..],
+                separator,
+                width = width
             )
-        } else {
-            format!("{:>width$}{}", line_str, separator, width = width)
+        } else {
+            format!("{:>width$}{}", line_str, separator, width = width)
         }
-    } else {
-        String::new()
+    } else {
+        String::new()
     }
 }
 
-/// Returns a five line header content if displaying header is not disabled by
-/// using `NO_HEADER_TRAILER_OPTION` option.
-fn header_content(options: &OutputOptions, page: usize) -> Vec<String> {
-    if options.display_header_and_trailer {
-        let first_line = format!(
+/// Returns a five line header content if displaying header is not disabled by
+/// using `NO_HEADER_TRAILER_OPTION` option.
+fn header_content(options: &OutputOptions, page: usize) -> Vec<String> {
+    if options.display_header_and_trailer {
+        let first_line = format!(
             "{} {} Page {}",
-            options.last_modified_time, options.header, page
+            options.last_modified_time, options.header, page
         );
         vec![
-            String::new(),
-            String::new(),
-            first_line,
-            String::new(),
-            String::new(),
+            String::new(),
+            String::new(),
+            first_line,
+            String::new(),
+            String::new(),
         ]
-    } else {
-        Vec::new()
+    } else {
+        Vec::new()
     }
 }
 
-fn file_last_modified_time(path: &str) -> String {
-    metadata(path)
-        .map(|i| {
-            i.modified()
-                .map(|x| {
-                    let date_time: OffsetDateTime = x.into();
-                    let offset = OffsetDateTime::now_local().unwrap().offset();
-                    date_time
-                        .to_offset(offset)
-                        .format(&DATE_TIME_FORMAT)
-                        .unwrap()
+fn file_last_modified_time(path: &str) -> String {
+    metadata(path)
+        .map(|i| {
+            i.modified()
+                .map(|x| {
+                    let date_time: OffsetDateTime = x.into();
+                    let offset = OffsetDateTime::now_local().unwrap().offset();
+                    date_time
+                        .to_offset(offset)
+                        .format(&DATE_TIME_FORMAT)
+                        .unwrap()
                 })
-                .unwrap_or_default()
+                .unwrap_or_default()
         })
-        .unwrap_or_default()
+        .unwrap_or_default()
 }
 
-/// Returns five empty lines as trailer content if displaying trailer
-/// is not disabled by using `NO_HEADER_TRAILER_OPTION`option.
-fn trailer_content(options: &OutputOptions) -> Vec<String> {
-    if options.display_header_and_trailer && !options.form_feed_used {
+/// Returns five empty lines as trailer content if displaying trailer
+/// is not disabled by using `NO_HEADER_TRAILER_OPTION`option.
+fn trailer_content(options: &OutputOptions) -> Vec<String> {
+    if options.display_header_and_trailer && !options.form_feed_used {
         vec![
-            String::new(),
-            String::new(),
-            String::new(),
-            String::new(),
-            String::new(),
+            String::new(),
+            String::new(),
+            String::new(),
+            String::new(),
+            String::new(),
         ]
-    } else {
-        Vec::new()
+    } else {
+        Vec::new()
     }
 }
 
-/// Returns starting line number for the file to be printed.
-/// If -N is specified the first line number changes otherwise
-/// default is 1.
-fn get_start_line_number(opts: &OutputOptions) -> usize {
-    opts.number.as_ref().map(|i| i.first_number).unwrap_or(1)
+/// Returns starting line number for the file to be printed.
+/// If -N is specified the first line number changes otherwise
+/// default is 1.
+fn get_start_line_number(opts: &OutputOptions) -> usize {
+    opts.number.as_ref().map(|i| i.first_number).unwrap_or(1)
 }
 
-/// Returns number of lines to read from input for constructing one page of pr output.
-/// If double space -d is used lines are halved.
-/// If columns --columns is used the lines are multiplied by the value.
-fn lines_to_read_for_page(opts: &OutputOptions) -> usize {
-    let content_lines_per_page = opts.content_lines_per_page;
-    let columns = get_columns(opts);
-    if opts.double_space {
-        (content_lines_per_page / 2) * columns
-    } else {
-        content_lines_per_page * columns
+/// Returns number of lines to read from input for constructing one page of pr output.
+/// If double space -d is used lines are halved.
+/// If columns --columns is used the lines are multiplied by the value.
+fn lines_to_read_for_page(opts: &OutputOptions) -> usize {
+    let content_lines_per_page = opts.content_lines_per_page;
+    let columns = get_columns(opts);
+    if opts.double_space {
+        (content_lines_per_page / 2) * columns
+    } else {
+        content_lines_per_page * columns
     }
 }
 
-/// Returns number of columns to output
-fn get_columns(opts: &OutputOptions) -> usize {
-    opts.column_mode_options
-        .as_ref()
-        .map(|i| i.columns)
-        .unwrap_or(1)
+/// Returns number of columns to output
+fn get_columns(opts: &OutputOptions) -> usize {
+    opts.column_mode_options
+        .as_ref()
+        .map(|i| i.columns)
+        .unwrap_or(1)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_printenv/printenv.rs.html b/dev/src/uu_printenv/printenv.rs.html index 9a0ad3007..ad2bdfb2e 100644 --- a/dev/src/uu_printenv/printenv.rs.html +++ b/dev/src/uu_printenv/printenv.rs.html @@ -1,4 +1,4 @@ -printenv.rs - source
1
+printenv.rs - source
1
 2
 3
 4
@@ -75,82 +75,82 @@
 75
 76
 77
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Jordi Boggiano <j.boggiano@seld.be>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Jordi Boggiano <j.boggiano@seld.be>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-/* last synced with: printenv (GNU coreutils) 8.13 */
+/* last synced with: printenv (GNU coreutils) 8.13 */
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::env;
-use uucore::{error::UResult, format_usage};
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::env;
+use uucore::{error::UResult, format_usage};
 
-static ABOUT: &str = "Display the values of the specified environment VARIABLE(s), or (with no VARIABLE) display name and value pairs for them all.";
-const USAGE: &str = "{} [VARIABLE]... [OPTION]...";
+static ABOUT: &str = "Display the values of the specified environment VARIABLE(s), or (with no VARIABLE) display name and value pairs for them all.";
+const USAGE: &str = "{} [VARIABLE]... [OPTION]...";
 
-static OPT_NULL: &str = "null";
+static OPT_NULL: &str = "null";
 
-static ARG_VARIABLES: &str = "variables";
+static ARG_VARIABLES: &str = "variables";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().get_matches_from(args);
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().get_matches_from(args);
 
-    let variables: Vec<String> = matches
-        .get_many::<String>(ARG_VARIABLES)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let variables: Vec<String> = matches
+        .get_many::<String>(ARG_VARIABLES)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    let separator = if matches.get_flag(OPT_NULL) {
-        "\x00"
-    } else {
-        "\n"
-    };
+    let separator = if matches.get_flag(OPT_NULL) {
+        "\x00"
+    } else {
+        "\n"
+    };
 
-    if variables.is_empty() {
-        for (env_var, value) in env::vars() {
-            print!("{}={}{}", env_var, value, separator);
+    if variables.is_empty() {
+        for (env_var, value) in env::vars() {
+            print!("{}={}{}", env_var, value, separator);
         }
-        return Ok(());
+        return Ok(());
     }
 
-    let mut not_found = false;
-    for env_var in variables {
-        if let Ok(var) = env::var(env_var) {
-            print!("{}{}", var, separator);
-        } else {
-            not_found = true;
+    let mut not_found = false;
+    for env_var in variables {
+        if let Ok(var) = env::var(env_var) {
+            print!("{}{}", var, separator);
+        } else {
+            not_found = true;
         }
     }
 
-    if not_found {
-        Err(1.into())
-    } else {
+    if not_found {
+        Err(1.into())
+    } else {
         Ok(())
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_NULL)
-                .short('0')
-                .long(OPT_NULL)
-                .help("end each output line with 0 byte rather than newline")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_NULL)
+                .short('0')
+                .long(OPT_NULL)
+                .help("end each output line with 0 byte rather than newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_VARIABLES)
-                .action(ArgAction::Append)
-                .num_args(1..),
+        .arg(
+            Arg::new(ARG_VARIABLES)
+                .action(ArgAction::Append)
+                .num_args(1..),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_printf/printf.rs.html b/dev/src/uu_printf/printf.rs.html index c06181e15..3cb4c6fd3 100644 --- a/dev/src/uu_printf/printf.rs.html +++ b/dev/src/uu_printf/printf.rs.html @@ -1,4 +1,4 @@ -printf.rs - source
1
+printf.rs - source
1
 2
 3
 4
@@ -309,19 +309,19 @@
 309
 310
 311
-
#![allow(dead_code)]
-// spell-checker:ignore (change!) each's
-// spell-checker:ignore (ToDO) LONGHELP FORMATSTRING templating parameterizing formatstr
+
#![allow(dead_code)]
+// spell-checker:ignore (change!) each's
+// spell-checker:ignore (ToDO) LONGHELP FORMATSTRING templating parameterizing formatstr
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use uucore::error::{UResult, UUsageError};
-use uucore::{format_usage, memo};
+use clap::{crate_version, Arg, ArgAction, Command};
+use uucore::error::{UResult, UUsageError};
+use uucore::{format_usage, memo};
 
-const VERSION: &str = "version";
-const HELP: &str = "help";
-const USAGE: &str = "{} FORMATSTRING [ARGUMENT]...";
-const ABOUT: &str = "Print output based off of the format string and proceeding arguments.";
-const AFTER_HELP: &str = "
+const VERSION: &str = "version";
+const HELP: &str = "help";
+const USAGE: &str = "{} FORMATSTRING [ARGUMENT]...";
+const ABOUT: &str = "Print output based off of the format string and proceeding arguments.";
+const AFTER_HELP: &str = "
 basic anonymous string templating:
 
 prints format string at least once, repeating as long as there are remaining arguments
@@ -574,51 +574,51 @@ COPYRIGHT :
 
 ";
 
-mod options {
-    pub const FORMATSTRING: &str = "FORMATSTRING";
-    pub const ARGUMENT: &str = "ARGUMENT";
+mod options {
+    pub const FORMATSTRING: &str = "FORMATSTRING";
+    pub const ARGUMENT: &str = "ARGUMENT";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
-    let matches = uu_app().get_matches_from(args);
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
+    let matches = uu_app().get_matches_from(args);
 
-    let format_string = matches
-        .get_one::<String>(options::FORMATSTRING)
-        .ok_or_else(|| UUsageError::new(1, "missing operand"))?;
-    let values: Vec<String> = match matches.get_many::<String>(options::ARGUMENT) {
-        Some(s) => s.map(|s| s.to_string()).collect(),
-        None => vec![],
+    let format_string = matches
+        .get_one::<String>(options::FORMATSTRING)
+        .ok_or_else(|| UUsageError::new(1, "missing operand"))?;
+    let values: Vec<String> = match matches.get_many::<String>(options::ARGUMENT) {
+        Some(s) => s.map(|s| s.to_string()).collect(),
+        None => vec![],
     };
 
-    memo::Memo::run_all(format_string, &values[..])?;
+    memo::Memo::run_all(format_string, &values[..])?;
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .allow_hyphen_values(true)
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(AFTER_HELP)
-        .override_usage(format_usage(USAGE))
-        .disable_help_flag(true)
-        .disable_version_flag(true)
-        .arg(
-            Arg::new(HELP)
-                .long(HELP)
-                .help("Print help information")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .allow_hyphen_values(true)
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(AFTER_HELP)
+        .override_usage(format_usage(USAGE))
+        .disable_help_flag(true)
+        .disable_version_flag(true)
+        .arg(
+            Arg::new(HELP)
+                .long(HELP)
+                .help("Print help information")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new(VERSION)
-                .long(VERSION)
-                .help("Print version information")
-                .action(ArgAction::Version),
+        .arg(
+            Arg::new(VERSION)
+                .long(VERSION)
+                .help("Print version information")
+                .action(ArgAction::Version),
         )
-        .arg(Arg::new(options::FORMATSTRING))
-        .arg(Arg::new(options::ARGUMENT).action(ArgAction::Append))
+        .arg(Arg::new(options::FORMATSTRING))
+        .arg(Arg::new(options::ARGUMENT).action(ArgAction::Append))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_ptx/ptx.rs.html b/dev/src/uu_ptx/ptx.rs.html index e8f8d235a..c47b711ea 100644 --- a/dev/src/uu_ptx/ptx.rs.html +++ b/dev/src/uu_ptx/ptx.rs.html @@ -1,4 +1,4 @@ -ptx.rs - source
1
+ptx.rs - source
1
 2
 3
 4
@@ -875,882 +875,882 @@
 875
 876
 877
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Dorota Kapturkiewicz <dokaptur@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Dorota Kapturkiewicz <dokaptur@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDOs) corasick memchr Roff trunc oset iset CHARCLASS
+// spell-checker:ignore (ToDOs) corasick memchr Roff trunc oset iset CHARCLASS
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use regex::Regex;
-use std::cmp;
-use std::collections::{BTreeSet, HashMap, HashSet};
-use std::default::Default;
-use std::error::Error;
-use std::fmt::{Display, Formatter, Write as FmtWrite};
-use std::fs::File;
-use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
-use std::num::ParseIntError;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UError, UResult};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use regex::Regex;
+use std::cmp;
+use std::collections::{BTreeSet, HashMap, HashSet};
+use std::default::Default;
+use std::error::Error;
+use std::fmt::{Display, Formatter, Write as FmtWrite};
+use std::fs::File;
+use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
+use std::num::ParseIntError;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UError, UResult};
+use uucore::format_usage;
 
-static NAME: &str = "ptx";
-const USAGE: &str = "\
+static NAME: &str = "ptx";
+const USAGE: &str = "\
     {} [OPTION]... [INPUT]...
     {} -G [OPTION]... [INPUT [OUTPUT]]";
 
-const ABOUT: &str = "\
+const ABOUT: &str = "\
     Output a permuted index, including context, of the words in the input files. \n\n\
     Mandatory arguments to long options are mandatory for short options too.\n\
     With no FILE, or when FILE is -, read standard input. Default is '-F /'.";
 
-const REGEX_CHARCLASS: &str = "^-]\\";
+const REGEX_CHARCLASS: &str = "^-]\\";
 
-#[derive(Debug)]
-enum OutFormat {
-    Dumb,
-    Roff,
-    Tex,
+#[derive(Debug)]
+enum OutFormat {
+    Dumb,
+    Roff,
+    Tex,
 }
 
-#[derive(Debug)]
-struct Config {
-    format: OutFormat,
-    gnu_ext: bool,
-    auto_ref: bool,
-    input_ref: bool,
-    right_ref: bool,
-    ignore_case: bool,
-    macro_name: String,
-    trunc_str: String,
-    context_regex: String,
-    line_width: usize,
-    gap_size: usize,
+#[derive(Debug)]
+struct Config {
+    format: OutFormat,
+    gnu_ext: bool,
+    auto_ref: bool,
+    input_ref: bool,
+    right_ref: bool,
+    ignore_case: bool,
+    macro_name: String,
+    trunc_str: String,
+    context_regex: String,
+    line_width: usize,
+    gap_size: usize,
 }
 
-impl Default for Config {
-    fn default() -> Self {
-        Self {
-            format: OutFormat::Dumb,
-            gnu_ext: true,
-            auto_ref: false,
-            input_ref: false,
-            right_ref: false,
-            ignore_case: false,
-            macro_name: "xx".to_owned(),
-            trunc_str: "/".to_owned(),
-            context_regex: "\\w+".to_owned(),
-            line_width: 72,
-            gap_size: 3,
+impl Default for Config {
+    fn default() -> Self {
+        Self {
+            format: OutFormat::Dumb,
+            gnu_ext: true,
+            auto_ref: false,
+            input_ref: false,
+            right_ref: false,
+            ignore_case: false,
+            macro_name: "xx".to_owned(),
+            trunc_str: "/".to_owned(),
+            context_regex: "\\w+".to_owned(),
+            line_width: 72,
+            gap_size: 3,
         }
     }
 }
 
-fn read_word_filter_file(
-    matches: &clap::ArgMatches,
-    option: &str,
-) -> std::io::Result<HashSet<String>> {
-    let filename = matches
-        .get_one::<String>(option)
-        .expect("parsing options failed!")
-        .to_string();
-    let file = File::open(filename)?;
-    let reader = BufReader::new(file);
-    let mut words: HashSet<String> = HashSet::new();
-    for word in reader.lines() {
-        words.insert(word?);
+fn read_word_filter_file(
+    matches: &clap::ArgMatches,
+    option: &str,
+) -> std::io::Result<HashSet<String>> {
+    let filename = matches
+        .get_one::<String>(option)
+        .expect("parsing options failed!")
+        .to_string();
+    let file = File::open(filename)?;
+    let reader = BufReader::new(file);
+    let mut words: HashSet<String> = HashSet::new();
+    for word in reader.lines() {
+        words.insert(word?);
     }
-    Ok(words)
+    Ok(words)
 }
 
-/// reads contents of file as unique set of characters to be used with the break-file option
-fn read_char_filter_file(
-    matches: &clap::ArgMatches,
-    option: &str,
-) -> std::io::Result<HashSet<char>> {
-    let filename = matches
-        .get_one::<String>(option)
-        .expect("parsing options failed!");
-    let mut reader = File::open(filename)?;
-    let mut buffer = String::new();
-    reader.read_to_string(&mut buffer)?;
-    Ok(buffer.chars().collect())
+/// reads contents of file as unique set of characters to be used with the break-file option
+fn read_char_filter_file(
+    matches: &clap::ArgMatches,
+    option: &str,
+) -> std::io::Result<HashSet<char>> {
+    let filename = matches
+        .get_one::<String>(option)
+        .expect("parsing options failed!");
+    let mut reader = File::open(filename)?;
+    let mut buffer = String::new();
+    reader.read_to_string(&mut buffer)?;
+    Ok(buffer.chars().collect())
 }
 
-#[derive(Debug)]
-struct WordFilter {
-    only_specified: bool,
-    ignore_specified: bool,
-    only_set: HashSet<String>,
-    ignore_set: HashSet<String>,
-    word_regex: String,
+#[derive(Debug)]
+struct WordFilter {
+    only_specified: bool,
+    ignore_specified: bool,
+    only_set: HashSet<String>,
+    ignore_set: HashSet<String>,
+    word_regex: String,
 }
 
-impl WordFilter {
-    fn new(matches: &clap::ArgMatches, config: &Config) -> UResult<Self> {
-        let (o, oset): (bool, HashSet<String>) = if matches.contains_id(options::ONLY_FILE) {
-            let words =
-                read_word_filter_file(matches, options::ONLY_FILE).map_err_context(String::new)?;
-            (true, words)
-        } else {
-            (false, HashSet::new())
+impl WordFilter {
+    fn new(matches: &clap::ArgMatches, config: &Config) -> UResult<Self> {
+        let (o, oset): (bool, HashSet<String>) = if matches.contains_id(options::ONLY_FILE) {
+            let words =
+                read_word_filter_file(matches, options::ONLY_FILE).map_err_context(String::new)?;
+            (true, words)
+        } else {
+            (false, HashSet::new())
         };
-        let (i, iset): (bool, HashSet<String>) = if matches.contains_id(options::IGNORE_FILE) {
-            let words = read_word_filter_file(matches, options::IGNORE_FILE)
-                .map_err_context(String::new)?;
-            (true, words)
-        } else {
-            (false, HashSet::new())
+        let (i, iset): (bool, HashSet<String>) = if matches.contains_id(options::IGNORE_FILE) {
+            let words = read_word_filter_file(matches, options::IGNORE_FILE)
+                .map_err_context(String::new)?;
+            (true, words)
+        } else {
+            (false, HashSet::new())
         };
-        let break_set: Option<HashSet<char>> = if matches.contains_id(options::BREAK_FILE)
-            && !matches.contains_id(options::WORD_REGEXP)
+        let break_set: Option<HashSet<char>> = if matches.contains_id(options::BREAK_FILE)
+            && !matches.contains_id(options::WORD_REGEXP)
         {
-            let chars =
-                read_char_filter_file(matches, options::BREAK_FILE).map_err_context(String::new)?;
-            let mut hs: HashSet<char> = if config.gnu_ext {
-                HashSet::new() // really only chars found in file
-            } else {
-                // GNU off means at least these are considered
-                [' ', '\t', '\n'].iter().cloned().collect()
+            let chars =
+                read_char_filter_file(matches, options::BREAK_FILE).map_err_context(String::new)?;
+            let mut hs: HashSet<char> = if config.gnu_ext {
+                HashSet::new() // really only chars found in file
+            } else {
+                // GNU off means at least these are considered
+                [' ', '\t', '\n'].iter().cloned().collect()
             };
-            hs.extend(chars);
-            Some(hs)
-        } else {
-            // if -W takes precedence or default
-            None
-        };
-        // Ignore empty string regex from cmd-line-args
-        let arg_reg: Option<String> = if matches.contains_id(options::WORD_REGEXP) {
-            match matches.get_one::<String>(options::WORD_REGEXP) {
-                Some(v) => {
-                    if v.is_empty() {
-                        None
-                    } else {
-                        Some(v.to_string())
+            hs.extend(chars);
+            Some(hs)
+        } else {
+            // if -W takes precedence or default
+            None
+        };
+        // Ignore empty string regex from cmd-line-args
+        let arg_reg: Option<String> = if matches.contains_id(options::WORD_REGEXP) {
+            match matches.get_one::<String>(options::WORD_REGEXP) {
+                Some(v) => {
+                    if v.is_empty() {
+                        None
+                    } else {
+                        Some(v.to_string())
                     }
                 }
-                None => None,
+                None => None,
             }
-        } else {
-            None
-        };
-        let reg = match arg_reg {
-            Some(arg_reg) => arg_reg,
-            None => {
-                if break_set.is_some() {
+        } else {
+            None
+        };
+        let reg = match arg_reg {
+            Some(arg_reg) => arg_reg,
+            None => {
+                if break_set.is_some() {
                     format!(
                         "[^{}]+",
-                        break_set
-                            .unwrap()
-                            .into_iter()
-                            .map(|c| if REGEX_CHARCLASS.contains(c) {
-                                format!("\\{}", c)
-                            } else {
-                                c.to_string()
+                        break_set
+                            .unwrap()
+                            .into_iter()
+                            .map(|c| if REGEX_CHARCLASS.contains(c) {
+                                format!("\\{}", c)
+                            } else {
+                                c.to_string()
                             })
-                            .collect::<Vec<String>>()
-                            .join("")
+                            .collect::<Vec<String>>()
+                            .join("")
                     )
-                } else if config.gnu_ext {
-                    "\\w+".to_owned()
-                } else {
-                    "[^ \t\n]+".to_owned()
+                } else if config.gnu_ext {
+                    "\\w+".to_owned()
+                } else {
+                    "[^ \t\n]+".to_owned()
                 }
             }
         };
-        Ok(Self {
-            only_specified: o,
-            ignore_specified: i,
-            only_set: oset,
-            ignore_set: iset,
-            word_regex: reg,
+        Ok(Self {
+            only_specified: o,
+            ignore_specified: i,
+            only_set: oset,
+            ignore_set: iset,
+            word_regex: reg,
         })
     }
 }
 
-#[derive(Debug, PartialOrd, PartialEq, Eq, Ord)]
-struct WordRef {
-    word: String,
-    global_line_nr: usize,
-    local_line_nr: usize,
-    position: usize,
-    position_end: usize,
-    filename: String,
+#[derive(Debug, PartialOrd, PartialEq, Eq, Ord)]
+struct WordRef {
+    word: String,
+    global_line_nr: usize,
+    local_line_nr: usize,
+    position: usize,
+    position_end: usize,
+    filename: String,
 }
 
-#[derive(Debug)]
-enum PtxError {
-    DumbFormat,
-    NotImplemented(&'static str),
-    ParseError(ParseIntError),
+#[derive(Debug)]
+enum PtxError {
+    DumbFormat,
+    NotImplemented(&'static str),
+    ParseError(ParseIntError),
 }
 
-impl Error for PtxError {}
-impl UError for PtxError {}
+impl Error for PtxError {}
+impl UError for PtxError {}
 
-impl Display for PtxError {
-    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
-        match self {
-            Self::DumbFormat => {
-                write!(f, "There is no dumb format with GNU extensions disabled")
+impl Display for PtxError {
+    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
+        match self {
+            Self::DumbFormat => {
+                write!(f, "There is no dumb format with GNU extensions disabled")
             }
-            Self::NotImplemented(s) => write!(f, "{} not implemented yet", s),
-            Self::ParseError(e) => e.fmt(f),
+            Self::NotImplemented(s) => write!(f, "{} not implemented yet", s),
+            Self::ParseError(e) => e.fmt(f),
         }
     }
 }
 
-fn get_config(matches: &clap::ArgMatches) -> UResult<Config> {
-    let mut config: Config = Default::default();
-    let err_msg = "parsing options failed";
-    if matches.get_flag(options::TRADITIONAL) {
-        config.gnu_ext = false;
-        config.format = OutFormat::Roff;
-        config.context_regex = "[^ \t\n]+".to_owned();
-    } else {
-        return Err(PtxError::NotImplemented("GNU extensions").into());
+fn get_config(matches: &clap::ArgMatches) -> UResult<Config> {
+    let mut config: Config = Default::default();
+    let err_msg = "parsing options failed";
+    if matches.get_flag(options::TRADITIONAL) {
+        config.gnu_ext = false;
+        config.format = OutFormat::Roff;
+        config.context_regex = "[^ \t\n]+".to_owned();
+    } else {
+        return Err(PtxError::NotImplemented("GNU extensions").into());
     }
-    if matches.contains_id(options::SENTENCE_REGEXP) {
-        return Err(PtxError::NotImplemented("-S").into());
+    if matches.contains_id(options::SENTENCE_REGEXP) {
+        return Err(PtxError::NotImplemented("-S").into());
     }
-    config.auto_ref = matches.get_flag(options::AUTO_REFERENCE);
-    config.input_ref = matches.get_flag(options::REFERENCES);
-    config.right_ref &= matches.get_flag(options::RIGHT_SIDE_REFS);
-    config.ignore_case = matches.get_flag(options::IGNORE_CASE);
-    if matches.contains_id(options::MACRO_NAME) {
-        config.macro_name = matches
-            .get_one::<String>(options::MACRO_NAME)
-            .expect(err_msg)
-            .to_string();
+    config.auto_ref = matches.get_flag(options::AUTO_REFERENCE);
+    config.input_ref = matches.get_flag(options::REFERENCES);
+    config.right_ref &= matches.get_flag(options::RIGHT_SIDE_REFS);
+    config.ignore_case = matches.get_flag(options::IGNORE_CASE);
+    if matches.contains_id(options::MACRO_NAME) {
+        config.macro_name = matches
+            .get_one::<String>(options::MACRO_NAME)
+            .expect(err_msg)
+            .to_string();
     }
-    if matches.contains_id(options::FLAG_TRUNCATION) {
-        config.trunc_str = matches
-            .get_one::<String>(options::FLAG_TRUNCATION)
-            .expect(err_msg)
-            .to_string();
+    if matches.contains_id(options::FLAG_TRUNCATION) {
+        config.trunc_str = matches
+            .get_one::<String>(options::FLAG_TRUNCATION)
+            .expect(err_msg)
+            .to_string();
     }
-    if matches.contains_id(options::WIDTH) {
-        config.line_width = matches
-            .get_one::<String>(options::WIDTH)
-            .expect(err_msg)
-            .parse()
-            .map_err(PtxError::ParseError)?;
+    if matches.contains_id(options::WIDTH) {
+        config.line_width = matches
+            .get_one::<String>(options::WIDTH)
+            .expect(err_msg)
+            .parse()
+            .map_err(PtxError::ParseError)?;
     }
-    if matches.contains_id(options::GAP_SIZE) {
-        config.gap_size = matches
-            .get_one::<String>(options::GAP_SIZE)
-            .expect(err_msg)
-            .parse()
-            .map_err(PtxError::ParseError)?;
+    if matches.contains_id(options::GAP_SIZE) {
+        config.gap_size = matches
+            .get_one::<String>(options::GAP_SIZE)
+            .expect(err_msg)
+            .parse()
+            .map_err(PtxError::ParseError)?;
     }
-    if matches.get_flag(options::FORMAT_ROFF) {
-        config.format = OutFormat::Roff;
+    if matches.get_flag(options::FORMAT_ROFF) {
+        config.format = OutFormat::Roff;
     }
-    if matches.get_flag(options::FORMAT_TEX) {
-        config.format = OutFormat::Tex;
+    if matches.get_flag(options::FORMAT_TEX) {
+        config.format = OutFormat::Tex;
     }
-    Ok(config)
+    Ok(config)
 }
 
-struct FileContent {
-    lines: Vec<String>,
-    chars_lines: Vec<Vec<char>>,
-    offset: usize,
+struct FileContent {
+    lines: Vec<String>,
+    chars_lines: Vec<Vec<char>>,
+    offset: usize,
 }
 
-type FileMap = HashMap<String, FileContent>;
+type FileMap = HashMap<String, FileContent>;
 
-fn read_input(input_files: &[String], config: &Config) -> std::io::Result<FileMap> {
-    let mut file_map: FileMap = HashMap::new();
-    let mut files = Vec::new();
-    if input_files.is_empty() {
-        files.push("-");
-    } else if config.gnu_ext {
-        for file in input_files {
-            files.push(file);
+fn read_input(input_files: &[String], config: &Config) -> std::io::Result<FileMap> {
+    let mut file_map: FileMap = HashMap::new();
+    let mut files = Vec::new();
+    if input_files.is_empty() {
+        files.push("-");
+    } else if config.gnu_ext {
+        for file in input_files {
+            files.push(file);
         }
-    } else {
-        files.push(&input_files[0]);
+    } else {
+        files.push(&input_files[0]);
     }
-    let mut offset: usize = 0;
-    for filename in files {
-        let reader: BufReader<Box<dyn Read>> = BufReader::new(if filename == "-" {
-            Box::new(stdin())
-        } else {
-            let file = File::open(filename)?;
-            Box::new(file)
+    let mut offset: usize = 0;
+    for filename in files {
+        let reader: BufReader<Box<dyn Read>> = BufReader::new(if filename == "-" {
+            Box::new(stdin())
+        } else {
+            let file = File::open(filename)?;
+            Box::new(file)
         });
-        let lines: Vec<String> = reader.lines().collect::<std::io::Result<Vec<String>>>()?;
+        let lines: Vec<String> = reader.lines().collect::<std::io::Result<Vec<String>>>()?;
 
-        // Indexing UTF-8 string requires walking from the beginning, which can hurts performance badly when the line is long.
-        // Since we will be jumping around the line a lot, we dump the content into a Vec<char>, which can be indexed in constant time.
-        let chars_lines: Vec<Vec<char>> = lines.iter().map(|x| x.chars().collect()).collect();
-        let size = lines.len();
-        file_map.insert(
-            filename.to_owned(),
-            FileContent {
-                lines,
-                chars_lines,
-                offset,
+        // Indexing UTF-8 string requires walking from the beginning, which can hurts performance badly when the line is long.
+        // Since we will be jumping around the line a lot, we dump the content into a Vec<char>, which can be indexed in constant time.
+        let chars_lines: Vec<Vec<char>> = lines.iter().map(|x| x.chars().collect()).collect();
+        let size = lines.len();
+        file_map.insert(
+            filename.to_owned(),
+            FileContent {
+                lines,
+                chars_lines,
+                offset,
             },
         );
-        offset += size;
+        offset += size;
     }
-    Ok(file_map)
+    Ok(file_map)
 }
 
-/// Go through every lines in the input files and record each match occurrence as a `WordRef`.
-fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> BTreeSet<WordRef> {
-    let reg = Regex::new(&filter.word_regex).unwrap();
-    let ref_reg = Regex::new(&config.context_regex).unwrap();
-    let mut word_set: BTreeSet<WordRef> = BTreeSet::new();
-    for (file, lines) in file_map.iter() {
-        let mut count: usize = 0;
-        let offs = lines.offset;
-        for line in &lines.lines {
-            // if -r, exclude reference from word set
-            let (ref_beg, ref_end) = match ref_reg.find(line) {
-                Some(x) => (x.start(), x.end()),
-                None => (0, 0),
+/// Go through every lines in the input files and record each match occurrence as a `WordRef`.
+fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> BTreeSet<WordRef> {
+    let reg = Regex::new(&filter.word_regex).unwrap();
+    let ref_reg = Regex::new(&config.context_regex).unwrap();
+    let mut word_set: BTreeSet<WordRef> = BTreeSet::new();
+    for (file, lines) in file_map.iter() {
+        let mut count: usize = 0;
+        let offs = lines.offset;
+        for line in &lines.lines {
+            // if -r, exclude reference from word set
+            let (ref_beg, ref_end) = match ref_reg.find(line) {
+                Some(x) => (x.start(), x.end()),
+                None => (0, 0),
             };
-            // match words with given regex
-            for mat in reg.find_iter(line) {
-                let (beg, end) = (mat.start(), mat.end());
-                if config.input_ref && ((beg, end) == (ref_beg, ref_end)) {
+            // match words with given regex
+            for mat in reg.find_iter(line) {
+                let (beg, end) = (mat.start(), mat.end());
+                if config.input_ref && ((beg, end) == (ref_beg, ref_end)) {
                     continue;
                 }
-                let mut word = line[beg..end].to_owned();
-                if filter.only_specified && !(filter.only_set.contains(&word)) {
+                let mut word = line[beg..end].to_owned();
+                if filter.only_specified && !(filter.only_set.contains(&word)) {
                     continue;
                 }
-                if filter.ignore_specified && filter.ignore_set.contains(&word) {
+                if filter.ignore_specified && filter.ignore_set.contains(&word) {
                     continue;
                 }
-                if config.ignore_case {
-                    word = word.to_lowercase();
+                if config.ignore_case {
+                    word = word.to_lowercase();
                 }
-                word_set.insert(WordRef {
-                    word,
-                    filename: file.clone(),
-                    global_line_nr: offs + count,
-                    local_line_nr: count,
-                    position: beg,
-                    position_end: end,
+                word_set.insert(WordRef {
+                    word,
+                    filename: file.clone(),
+                    global_line_nr: offs + count,
+                    local_line_nr: count,
+                    position: beg,
+                    position_end: end,
                 });
             }
-            count += 1;
+            count += 1;
         }
     }
-    word_set
+    word_set
 }
 
-fn get_reference(config: &Config, word_ref: &WordRef, line: &str, context_reg: &Regex) -> String {
-    if config.auto_ref {
+fn get_reference(config: &Config, word_ref: &WordRef, line: &str, context_reg: &Regex) -> String {
+    if config.auto_ref {
         format!(
             "{}:{}",
-            word_ref.filename.maybe_quote(),
-            word_ref.local_line_nr + 1
-        )
-    } else if config.input_ref {
-        let (beg, end) = match context_reg.find(line) {
-            Some(x) => (x.start(), x.end()),
-            None => (0, 0),
+            word_ref.filename.maybe_quote(),
+            word_ref.local_line_nr + 1
+        )
+    } else if config.input_ref {
+        let (beg, end) = match context_reg.find(line) {
+            Some(x) => (x.start(), x.end()),
+            None => (0, 0),
         };
-        line[beg..end].to_string()
-    } else {
-        String::new()
+        line[beg..end].to_string()
+    } else {
+        String::new()
     }
 }
 
-fn assert_str_integrity(s: &[char], beg: usize, end: usize) {
-    assert!(beg <= end);
-    assert!(end <= s.len());
+fn assert_str_integrity(s: &[char], beg: usize, end: usize) {
+    assert!(beg <= end);
+    assert!(end <= s.len());
 }
 
-fn trim_broken_word_left(s: &[char], beg: usize, end: usize) -> usize {
-    assert_str_integrity(s, beg, end);
-    if beg == end || beg == 0 || s[beg].is_whitespace() || s[beg - 1].is_whitespace() {
-        return beg;
+fn trim_broken_word_left(s: &[char], beg: usize, end: usize) -> usize {
+    assert_str_integrity(s, beg, end);
+    if beg == end || beg == 0 || s[beg].is_whitespace() || s[beg - 1].is_whitespace() {
+        return beg;
     }
-    let mut b = beg;
-    while b < end && !s[b].is_whitespace() {
-        b += 1;
+    let mut b = beg;
+    while b < end && !s[b].is_whitespace() {
+        b += 1;
     }
-    b
+    b
 }
 
-fn trim_broken_word_right(s: &[char], beg: usize, end: usize) -> usize {
-    assert_str_integrity(s, beg, end);
-    if beg == end || end == s.len() || s[end - 1].is_whitespace() || s[end].is_whitespace() {
-        return end;
+fn trim_broken_word_right(s: &[char], beg: usize, end: usize) -> usize {
+    assert_str_integrity(s, beg, end);
+    if beg == end || end == s.len() || s[end - 1].is_whitespace() || s[end].is_whitespace() {
+        return end;
     }
-    let mut e = end;
-    while beg < e && !s[e - 1].is_whitespace() {
-        e -= 1;
+    let mut e = end;
+    while beg < e && !s[e - 1].is_whitespace() {
+        e -= 1;
     }
-    e
+    e
 }
 
-fn trim_idx(s: &[char], beg: usize, end: usize) -> (usize, usize) {
-    assert_str_integrity(s, beg, end);
-    let mut b = beg;
-    let mut e = end;
-    while b < e && s[b].is_whitespace() {
-        b += 1;
+fn trim_idx(s: &[char], beg: usize, end: usize) -> (usize, usize) {
+    assert_str_integrity(s, beg, end);
+    let mut b = beg;
+    let mut e = end;
+    while b < e && s[b].is_whitespace() {
+        b += 1;
     }
-    while b < e && s[e - 1].is_whitespace() {
-        e -= 1;
+    while b < e && s[e - 1].is_whitespace() {
+        e -= 1;
     }
-    (b, e)
+    (b, e)
 }
 
-fn get_output_chunks(
-    all_before: &[char],
-    keyword: &str,
-    all_after: &[char],
-    config: &Config,
-) -> (String, String, String, String) {
-    // Chunk size logics are mostly copied from the GNU ptx source.
-    // https://github.com/MaiZure/coreutils-8.3/blob/master/src/ptx.c#L1234
-    let half_line_size = (config.line_width / 2) as usize;
-    let max_before_size = cmp::max(half_line_size as isize - config.gap_size as isize, 0) as usize;
-    let max_after_size = cmp::max(
-        half_line_size as isize
-            - (2 * config.trunc_str.len()) as isize
-            - keyword.len() as isize
-            - 1,
+fn get_output_chunks(
+    all_before: &[char],
+    keyword: &str,
+    all_after: &[char],
+    config: &Config,
+) -> (String, String, String, String) {
+    // Chunk size logics are mostly copied from the GNU ptx source.
+    // https://github.com/MaiZure/coreutils-8.3/blob/master/src/ptx.c#L1234
+    let half_line_size = (config.line_width / 2) as usize;
+    let max_before_size = cmp::max(half_line_size as isize - config.gap_size as isize, 0) as usize;
+    let max_after_size = cmp::max(
+        half_line_size as isize
+            - (2 * config.trunc_str.len()) as isize
+            - keyword.len() as isize
+            - 1,
         0,
-    ) as usize;
+    ) as usize;
 
-    // Allocate plenty space for all the chunks.
-    let mut head = String::with_capacity(half_line_size);
-    let mut before = String::with_capacity(half_line_size);
-    let mut after = String::with_capacity(half_line_size);
-    let mut tail = String::with_capacity(half_line_size);
+    // Allocate plenty space for all the chunks.
+    let mut head = String::with_capacity(half_line_size);
+    let mut before = String::with_capacity(half_line_size);
+    let mut after = String::with_capacity(half_line_size);
+    let mut tail = String::with_capacity(half_line_size);
 
-    // the before chunk
+    // the before chunk
 
-    // trim whitespace away from all_before to get the index where the before chunk should end.
-    let (_, before_end) = trim_idx(all_before, 0, all_before.len());
+    // trim whitespace away from all_before to get the index where the before chunk should end.
+    let (_, before_end) = trim_idx(all_before, 0, all_before.len());
 
-    // the minimum possible begin index of the before_chunk is the end index minus the length.
-    let before_beg = cmp::max(before_end as isize - max_before_size as isize, 0) as usize;
-    // in case that falls in the middle of a word, trim away the word.
-    let before_beg = trim_broken_word_left(all_before, before_beg, before_end);
+    // the minimum possible begin index of the before_chunk is the end index minus the length.
+    let before_beg = cmp::max(before_end as isize - max_before_size as isize, 0) as usize;
+    // in case that falls in the middle of a word, trim away the word.
+    let before_beg = trim_broken_word_left(all_before, before_beg, before_end);
 
-    // trim away white space.
-    let (before_beg, before_end) = trim_idx(all_before, before_beg, before_end);
+    // trim away white space.
+    let (before_beg, before_end) = trim_idx(all_before, before_beg, before_end);
 
-    // and get the string.
-    let before_str: String = all_before[before_beg..before_end].iter().collect();
-    before.push_str(&before_str);
-    assert!(max_before_size >= before.len());
+    // and get the string.
+    let before_str: String = all_before[before_beg..before_end].iter().collect();
+    before.push_str(&before_str);
+    assert!(max_before_size >= before.len());
 
-    // the after chunk
+    // the after chunk
 
-    // must be no longer than the minimum between the max size and the total available string.
-    let after_end = cmp::min(max_after_size, all_after.len());
-    // in case that falls in the middle of a word, trim away the word.
-    let after_end = trim_broken_word_right(all_after, 0, after_end);
+    // must be no longer than the minimum between the max size and the total available string.
+    let after_end = cmp::min(max_after_size, all_after.len());
+    // in case that falls in the middle of a word, trim away the word.
+    let after_end = trim_broken_word_right(all_after, 0, after_end);
 
-    // trim away white space.
-    let (_, after_end) = trim_idx(all_after, 0, after_end);
+    // trim away white space.
+    let (_, after_end) = trim_idx(all_after, 0, after_end);
 
-    // and get the string
-    let after_str: String = all_after[0..after_end].iter().collect();
-    after.push_str(&after_str);
-    assert!(max_after_size >= after.len());
+    // and get the string
+    let after_str: String = all_after[0..after_end].iter().collect();
+    after.push_str(&after_str);
+    assert!(max_after_size >= after.len());
 
-    // the tail chunk
+    // the tail chunk
 
-    // max size of the tail chunk = max size of left half - space taken by before chunk - gap size.
-    let max_tail_size = cmp::max(
-        max_before_size as isize - before.len() as isize - config.gap_size as isize,
+    // max size of the tail chunk = max size of left half - space taken by before chunk - gap size.
+    let max_tail_size = cmp::max(
+        max_before_size as isize - before.len() as isize - config.gap_size as isize,
         0,
-    ) as usize;
+    ) as usize;
 
-    // the tail chunk takes text starting from where the after chunk ends (with whitespace trimmed).
-    let (tail_beg, _) = trim_idx(all_after, after_end, all_after.len());
+    // the tail chunk takes text starting from where the after chunk ends (with whitespace trimmed).
+    let (tail_beg, _) = trim_idx(all_after, after_end, all_after.len());
 
-    // end = begin + max length
-    let tail_end = cmp::min(all_after.len(), tail_beg + max_tail_size) as usize;
-    // in case that falls in the middle of a word, trim away the word.
-    let tail_end = trim_broken_word_right(all_after, tail_beg, tail_end);
+    // end = begin + max length
+    let tail_end = cmp::min(all_after.len(), tail_beg + max_tail_size) as usize;
+    // in case that falls in the middle of a word, trim away the word.
+    let tail_end = trim_broken_word_right(all_after, tail_beg, tail_end);
 
-    // trim away whitespace again.
-    let (tail_beg, tail_end) = trim_idx(all_after, tail_beg, tail_end);
+    // trim away whitespace again.
+    let (tail_beg, tail_end) = trim_idx(all_after, tail_beg, tail_end);
 
-    // and get the string
-    let tail_str: String = all_after[tail_beg..tail_end].iter().collect();
-    tail.push_str(&tail_str);
+    // and get the string
+    let tail_str: String = all_after[tail_beg..tail_end].iter().collect();
+    tail.push_str(&tail_str);
 
-    // the head chunk
+    // the head chunk
 
-    // max size of the head chunk = max size of right half - space taken by after chunk - gap size.
-    let max_head_size = cmp::max(
-        max_after_size as isize - after.len() as isize - config.gap_size as isize,
+    // max size of the head chunk = max size of right half - space taken by after chunk - gap size.
+    let max_head_size = cmp::max(
+        max_after_size as isize - after.len() as isize - config.gap_size as isize,
         0,
-    ) as usize;
+    ) as usize;
 
-    // the head chunk takes text from before the before chunk
-    let (_, head_end) = trim_idx(all_before, 0, before_beg);
+    // the head chunk takes text from before the before chunk
+    let (_, head_end) = trim_idx(all_before, 0, before_beg);
 
-    // begin = end - max length
-    let head_beg = cmp::max(head_end as isize - max_head_size as isize, 0) as usize;
-    // in case that falls in the middle of a word, trim away the word.
-    let head_beg = trim_broken_word_left(all_before, head_beg, head_end);
+    // begin = end - max length
+    let head_beg = cmp::max(head_end as isize - max_head_size as isize, 0) as usize;
+    // in case that falls in the middle of a word, trim away the word.
+    let head_beg = trim_broken_word_left(all_before, head_beg, head_end);
 
-    // trim away white space again.
-    let (head_beg, head_end) = trim_idx(all_before, head_beg, head_end);
+    // trim away white space again.
+    let (head_beg, head_end) = trim_idx(all_before, head_beg, head_end);
 
-    // and get the string.
-    let head_str: String = all_before[head_beg..head_end].iter().collect();
-    head.push_str(&head_str);
+    // and get the string.
+    let head_str: String = all_before[head_beg..head_end].iter().collect();
+    head.push_str(&head_str);
 
-    // put right context truncation string if needed
-    if after_end != all_after.len() && tail_beg == tail_end {
-        after.push_str(&config.trunc_str);
-    } else if after_end != all_after.len() && tail_end != all_after.len() {
-        tail.push_str(&config.trunc_str);
+    // put right context truncation string if needed
+    if after_end != all_after.len() && tail_beg == tail_end {
+        after.push_str(&config.trunc_str);
+    } else if after_end != all_after.len() && tail_end != all_after.len() {
+        tail.push_str(&config.trunc_str);
     }
 
-    // put left context truncation string if needed
-    if before_beg != 0 && head_beg == head_end {
-        before = format!("{}{}", config.trunc_str, before);
-    } else if before_beg != 0 && head_beg != 0 {
-        head = format!("{}{}", config.trunc_str, head);
+    // put left context truncation string if needed
+    if before_beg != 0 && head_beg == head_end {
+        before = format!("{}{}", config.trunc_str, before);
+    } else if before_beg != 0 && head_beg != 0 {
+        head = format!("{}{}", config.trunc_str, head);
     }
 
-    (tail, before, after, head)
+    (tail, before, after, head)
 }
 
-fn tex_mapper(x: char) -> String {
-    match x {
-        '\\' => "\\backslash{}".to_owned(),
-        '$' | '%' | '#' | '&' | '_' => format!("\\{}", x),
-        '}' | '{' => format!("$\\{}$", x),
-        _ => x.to_string(),
+fn tex_mapper(x: char) -> String {
+    match x {
+        '\\' => "\\backslash{}".to_owned(),
+        '$' | '%' | '#' | '&' | '_' => format!("\\{}", x),
+        '}' | '{' => format!("$\\{}$", x),
+        _ => x.to_string(),
     }
 }
 
-/// Escape special characters for TeX.
-fn format_tex_field(s: &str) -> String {
-    let mapped_chunks: Vec<String> = s.chars().map(tex_mapper).collect();
-    mapped_chunks.join("")
+/// Escape special characters for TeX.
+fn format_tex_field(s: &str) -> String {
+    let mapped_chunks: Vec<String> = s.chars().map(tex_mapper).collect();
+    mapped_chunks.join("")
 }
 
-fn format_tex_line(
-    config: &Config,
-    word_ref: &WordRef,
-    line: &str,
-    chars_line: &[char],
-    reference: &str,
-) -> String {
-    let mut output = String::new();
-    write!(output, "\\{} ", config.macro_name).unwrap();
-    let all_before = if config.input_ref {
-        let before = &line[0..word_ref.position];
-        let before_start_trim_offset =
-            word_ref.position - before.trim_start_matches(reference).trim_start().len();
-        let before_end_index = before.len();
-        &chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)]
-    } else {
-        let before_chars_trim_idx = (0, word_ref.position);
-        &chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]
+fn format_tex_line(
+    config: &Config,
+    word_ref: &WordRef,
+    line: &str,
+    chars_line: &[char],
+    reference: &str,
+) -> String {
+    let mut output = String::new();
+    write!(output, "\\{} ", config.macro_name).unwrap();
+    let all_before = if config.input_ref {
+        let before = &line[0..word_ref.position];
+        let before_start_trim_offset =
+            word_ref.position - before.trim_start_matches(reference).trim_start().len();
+        let before_end_index = before.len();
+        &chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)]
+    } else {
+        let before_chars_trim_idx = (0, word_ref.position);
+        &chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]
     };
-    let keyword = &line[word_ref.position..word_ref.position_end];
-    let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
-    let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
-    let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
+    let keyword = &line[word_ref.position..word_ref.position_end];
+    let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
+    let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
+    let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
     write!(
-        output,
+        output,
         "{{{0}}}{{{1}}}{{{2}}}{{{3}}}{{{4}}}",
-        format_tex_field(&tail),
-        format_tex_field(&before),
-        format_tex_field(keyword),
-        format_tex_field(&after),
-        format_tex_field(&head),
+        format_tex_field(&tail),
+        format_tex_field(&before),
+        format_tex_field(keyword),
+        format_tex_field(&after),
+        format_tex_field(&head),
     )
-    .unwrap();
-    if config.auto_ref || config.input_ref {
-        write!(output, "{{{}}}", format_tex_field(reference)).unwrap();
+    .unwrap();
+    if config.auto_ref || config.input_ref {
+        write!(output, "{{{}}}", format_tex_field(reference)).unwrap();
     }
-    output
+    output
 }
 
-fn format_roff_field(s: &str) -> String {
-    s.replace('\"', "\"\"")
+fn format_roff_field(s: &str) -> String {
+    s.replace('\"', "\"\"")
 }
 
-fn format_roff_line(
-    config: &Config,
-    word_ref: &WordRef,
-    line: &str,
-    chars_line: &[char],
-    reference: &str,
-) -> String {
-    let mut output = String::new();
-    write!(output, ".{}", config.macro_name).unwrap();
-    let all_before = if config.input_ref {
-        let before = &line[0..word_ref.position];
-        let before_start_trim_offset =
-            word_ref.position - before.trim_start_matches(reference).trim_start().len();
-        let before_end_index = before.len();
-        &chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)]
-    } else {
-        let before_chars_trim_idx = (0, word_ref.position);
-        &chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]
+fn format_roff_line(
+    config: &Config,
+    word_ref: &WordRef,
+    line: &str,
+    chars_line: &[char],
+    reference: &str,
+) -> String {
+    let mut output = String::new();
+    write!(output, ".{}", config.macro_name).unwrap();
+    let all_before = if config.input_ref {
+        let before = &line[0..word_ref.position];
+        let before_start_trim_offset =
+            word_ref.position - before.trim_start_matches(reference).trim_start().len();
+        let before_end_index = before.len();
+        &chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)]
+    } else {
+        let before_chars_trim_idx = (0, word_ref.position);
+        &chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]
     };
-    let keyword = &line[word_ref.position..word_ref.position_end];
-    let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
-    let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
-    let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
+    let keyword = &line[word_ref.position..word_ref.position_end];
+    let after_chars_trim_idx = (word_ref.position_end, chars_line.len());
+    let all_after = &chars_line[after_chars_trim_idx.0..after_chars_trim_idx.1];
+    let (tail, before, after, head) = get_output_chunks(all_before, keyword, all_after, config);
     write!(
-        output,
+        output,
         " \"{}\" \"{}\" \"{}{}\" \"{}\"",
-        format_roff_field(&tail),
-        format_roff_field(&before),
-        format_roff_field(keyword),
-        format_roff_field(&after),
-        format_roff_field(&head)
+        format_roff_field(&tail),
+        format_roff_field(&before),
+        format_roff_field(keyword),
+        format_roff_field(&after),
+        format_roff_field(&head)
     )
-    .unwrap();
-    if config.auto_ref || config.input_ref {
-        write!(output, " \"{}\"", format_roff_field(reference)).unwrap();
+    .unwrap();
+    if config.auto_ref || config.input_ref {
+        write!(output, " \"{}\"", format_roff_field(reference)).unwrap();
     }
-    output
+    output
 }
 
-fn write_traditional_output(
-    config: &Config,
-    file_map: &FileMap,
-    words: &BTreeSet<WordRef>,
-    output_filename: &str,
-) -> UResult<()> {
-    let mut writer: BufWriter<Box<dyn Write>> = BufWriter::new(if output_filename == "-" {
-        Box::new(stdout())
-    } else {
-        let file = File::create(output_filename).map_err_context(String::new)?;
-        Box::new(file)
+fn write_traditional_output(
+    config: &Config,
+    file_map: &FileMap,
+    words: &BTreeSet<WordRef>,
+    output_filename: &str,
+) -> UResult<()> {
+    let mut writer: BufWriter<Box<dyn Write>> = BufWriter::new(if output_filename == "-" {
+        Box::new(stdout())
+    } else {
+        let file = File::create(output_filename).map_err_context(String::new)?;
+        Box::new(file)
     });
 
-    let context_reg = Regex::new(&config.context_regex).unwrap();
+    let context_reg = Regex::new(&config.context_regex).unwrap();
 
-    for word_ref in words.iter() {
-        let file_map_value: &FileContent = file_map
-            .get(&(word_ref.filename))
-            .expect("Missing file in file map");
-        let FileContent {
-            ref lines,
-            ref chars_lines,
-            offset: _,
-        } = *(file_map_value);
-        let reference = get_reference(
-            config,
-            word_ref,
-            &lines[word_ref.local_line_nr],
-            &context_reg,
+    for word_ref in words.iter() {
+        let file_map_value: &FileContent = file_map
+            .get(&(word_ref.filename))
+            .expect("Missing file in file map");
+        let FileContent {
+            ref lines,
+            ref chars_lines,
+            offset: _,
+        } = *(file_map_value);
+        let reference = get_reference(
+            config,
+            word_ref,
+            &lines[word_ref.local_line_nr],
+            &context_reg,
         );
-        let output_line: String = match config.format {
-            OutFormat::Tex => format_tex_line(
-                config,
-                word_ref,
-                &lines[word_ref.local_line_nr],
-                &chars_lines[word_ref.local_line_nr],
-                &reference,
+        let output_line: String = match config.format {
+            OutFormat::Tex => format_tex_line(
+                config,
+                word_ref,
+                &lines[word_ref.local_line_nr],
+                &chars_lines[word_ref.local_line_nr],
+                &reference,
             ),
-            OutFormat::Roff => format_roff_line(
-                config,
-                word_ref,
-                &lines[word_ref.local_line_nr],
-                &chars_lines[word_ref.local_line_nr],
-                &reference,
+            OutFormat::Roff => format_roff_line(
+                config,
+                word_ref,
+                &lines[word_ref.local_line_nr],
+                &chars_lines[word_ref.local_line_nr],
+                &reference,
             ),
-            OutFormat::Dumb => {
-                return Err(PtxError::DumbFormat.into());
+            OutFormat::Dumb => {
+                return Err(PtxError::DumbFormat.into());
             }
         };
-        writeln!(writer, "{}", output_line).map_err_context(String::new)?;
+        writeln!(writer, "{}", output_line).map_err_context(String::new)?;
     }
     Ok(())
 }
 
-mod options {
-    pub static FILE: &str = "file";
-    pub static AUTO_REFERENCE: &str = "auto-reference";
-    pub static TRADITIONAL: &str = "traditional";
-    pub static FLAG_TRUNCATION: &str = "flag-truncation";
-    pub static MACRO_NAME: &str = "macro-name";
-    pub static FORMAT_ROFF: &str = "format=roff";
-    pub static RIGHT_SIDE_REFS: &str = "right-side-refs";
-    pub static SENTENCE_REGEXP: &str = "sentence-regexp";
-    pub static FORMAT_TEX: &str = "format=tex";
-    pub static WORD_REGEXP: &str = "word-regexp";
-    pub static BREAK_FILE: &str = "break-file";
-    pub static IGNORE_CASE: &str = "ignore-case";
-    pub static GAP_SIZE: &str = "gap-size";
-    pub static IGNORE_FILE: &str = "ignore-file";
-    pub static ONLY_FILE: &str = "only-file";
-    pub static REFERENCES: &str = "references";
-    pub static WIDTH: &str = "width";
+mod options {
+    pub static FILE: &str = "file";
+    pub static AUTO_REFERENCE: &str = "auto-reference";
+    pub static TRADITIONAL: &str = "traditional";
+    pub static FLAG_TRUNCATION: &str = "flag-truncation";
+    pub static MACRO_NAME: &str = "macro-name";
+    pub static FORMAT_ROFF: &str = "format=roff";
+    pub static RIGHT_SIDE_REFS: &str = "right-side-refs";
+    pub static SENTENCE_REGEXP: &str = "sentence-regexp";
+    pub static FORMAT_TEX: &str = "format=tex";
+    pub static WORD_REGEXP: &str = "word-regexp";
+    pub static BREAK_FILE: &str = "break-file";
+    pub static IGNORE_CASE: &str = "ignore-case";
+    pub static GAP_SIZE: &str = "gap-size";
+    pub static IGNORE_FILE: &str = "ignore-file";
+    pub static ONLY_FILE: &str = "only-file";
+    pub static REFERENCES: &str = "references";
+    pub static WIDTH: &str = "width";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let mut input_files: Vec<String> = match &matches.get_many::<String>(options::FILE) {
-        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
-        None => vec!["-".to_string()],
+    let mut input_files: Vec<String> = match &matches.get_many::<String>(options::FILE) {
+        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
+        None => vec!["-".to_string()],
     };
 
-    let config = get_config(&matches)?;
-    let word_filter = WordFilter::new(&matches, &config)?;
-    let file_map = read_input(&input_files, &config).map_err_context(String::new)?;
-    let word_set = create_word_set(&config, &word_filter, &file_map);
-    let output_file = if !config.gnu_ext && input_files.len() == 2 {
-        input_files.pop().unwrap()
-    } else {
-        "-".to_string()
+    let config = get_config(&matches)?;
+    let word_filter = WordFilter::new(&matches, &config)?;
+    let file_map = read_input(&input_files, &config).map_err_context(String::new)?;
+    let word_set = create_word_set(&config, &word_filter, &file_map);
+    let output_file = if !config.gnu_ext && input_files.len() == 2 {
+        input_files.pop().unwrap()
+    } else {
+        "-".to_string()
     };
-    write_traditional_output(&config, &file_map, &word_set, &output_file)
+    write_traditional_output(&config, &file_map, &word_set, &output_file)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .about(ABOUT)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .about(ABOUT)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::AUTO_REFERENCE)
-                .short('A')
-                .long(options::AUTO_REFERENCE)
-                .help("output automatically generated references")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::AUTO_REFERENCE)
+                .short('A')
+                .long(options::AUTO_REFERENCE)
+                .help("output automatically generated references")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::TRADITIONAL)
-                .short('G')
-                .long(options::TRADITIONAL)
-                .help("behave more like System V 'ptx'")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::TRADITIONAL)
+                .short('G')
+                .long(options::TRADITIONAL)
+                .help("behave more like System V 'ptx'")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FLAG_TRUNCATION)
-                .short('F')
-                .long(options::FLAG_TRUNCATION)
-                .help("use STRING for flagging line truncations")
-                .value_name("STRING"),
+        .arg(
+            Arg::new(options::FLAG_TRUNCATION)
+                .short('F')
+                .long(options::FLAG_TRUNCATION)
+                .help("use STRING for flagging line truncations")
+                .value_name("STRING"),
         )
-        .arg(
-            Arg::new(options::MACRO_NAME)
-                .short('M')
-                .long(options::MACRO_NAME)
-                .help("macro name to use instead of 'xx'")
-                .value_name("STRING"),
+        .arg(
+            Arg::new(options::MACRO_NAME)
+                .short('M')
+                .long(options::MACRO_NAME)
+                .help("macro name to use instead of 'xx'")
+                .value_name("STRING"),
         )
-        .arg(
-            Arg::new(options::FORMAT_ROFF)
-                .short('O')
-                .long(options::FORMAT_ROFF)
-                .help("generate output as roff directives")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::FORMAT_ROFF)
+                .short('O')
+                .long(options::FORMAT_ROFF)
+                .help("generate output as roff directives")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::RIGHT_SIDE_REFS)
-                .short('R')
-                .long(options::RIGHT_SIDE_REFS)
-                .help("put references at right, not counted in -w")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RIGHT_SIDE_REFS)
+                .short('R')
+                .long(options::RIGHT_SIDE_REFS)
+                .help("put references at right, not counted in -w")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SENTENCE_REGEXP)
-                .short('S')
-                .long(options::SENTENCE_REGEXP)
-                .help("for end of lines or end of sentences")
-                .value_name("REGEXP"),
+        .arg(
+            Arg::new(options::SENTENCE_REGEXP)
+                .short('S')
+                .long(options::SENTENCE_REGEXP)
+                .help("for end of lines or end of sentences")
+                .value_name("REGEXP"),
         )
-        .arg(
-            Arg::new(options::FORMAT_TEX)
-                .short('T')
-                .long(options::FORMAT_TEX)
-                .help("generate output as TeX directives")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::FORMAT_TEX)
+                .short('T')
+                .long(options::FORMAT_TEX)
+                .help("generate output as TeX directives")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::WORD_REGEXP)
-                .short('W')
-                .long(options::WORD_REGEXP)
-                .help("use REGEXP to match each keyword")
-                .value_name("REGEXP"),
+        .arg(
+            Arg::new(options::WORD_REGEXP)
+                .short('W')
+                .long(options::WORD_REGEXP)
+                .help("use REGEXP to match each keyword")
+                .value_name("REGEXP"),
         )
-        .arg(
-            Arg::new(options::BREAK_FILE)
-                .short('b')
-                .long(options::BREAK_FILE)
-                .help("word break characters in this FILE")
-                .value_name("FILE")
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::BREAK_FILE)
+                .short('b')
+                .long(options::BREAK_FILE)
+                .help("word break characters in this FILE")
+                .value_name("FILE")
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::IGNORE_CASE)
-                .short('f')
-                .long(options::IGNORE_CASE)
-                .help("fold lower case to upper case for sorting")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::IGNORE_CASE)
+                .short('f')
+                .long(options::IGNORE_CASE)
+                .help("fold lower case to upper case for sorting")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::GAP_SIZE)
-                .short('g')
-                .long(options::GAP_SIZE)
-                .help("gap size in columns between output fields")
-                .value_name("NUMBER"),
+        .arg(
+            Arg::new(options::GAP_SIZE)
+                .short('g')
+                .long(options::GAP_SIZE)
+                .help("gap size in columns between output fields")
+                .value_name("NUMBER"),
         )
-        .arg(
-            Arg::new(options::IGNORE_FILE)
-                .short('i')
-                .long(options::IGNORE_FILE)
-                .help("read ignore word list from FILE")
-                .value_name("FILE")
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::IGNORE_FILE)
+                .short('i')
+                .long(options::IGNORE_FILE)
+                .help("read ignore word list from FILE")
+                .value_name("FILE")
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::ONLY_FILE)
-                .short('o')
-                .long(options::ONLY_FILE)
-                .help("read only word list from this FILE")
-                .value_name("FILE")
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::ONLY_FILE)
+                .short('o')
+                .long(options::ONLY_FILE)
+                .help("read only word list from this FILE")
+                .value_name("FILE")
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::REFERENCES)
-                .short('r')
-                .long(options::REFERENCES)
-                .help("first field of each line is a reference")
-                .value_name("FILE")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::REFERENCES)
+                .short('r')
+                .long(options::REFERENCES)
+                .help("first field of each line is a reference")
+                .value_name("FILE")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::WIDTH)
-                .short('w')
-                .long(options::WIDTH)
-                .help("output width in columns, reference excluded")
-                .value_name("NUMBER"),
+        .arg(
+            Arg::new(options::WIDTH)
+                .short('w')
+                .long(options::WIDTH)
+                .help("output width in columns, reference excluded")
+                .value_name("NUMBER"),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_pwd/pwd.rs.html b/dev/src/uu_pwd/pwd.rs.html index a1d6bf5f9..20919b194 100644 --- a/dev/src/uu_pwd/pwd.rs.html +++ b/dev/src/uu_pwd/pwd.rs.html @@ -1,4 +1,4 @@ -pwd.rs - source
1
+pwd.rs - source
1
 2
 3
 4
@@ -174,181 +174,181 @@
 174
 175
 176
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Derek Chiang <derekchiang93@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Derek Chiang <derekchiang93@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-use clap::ArgAction;
-use clap::{crate_version, Arg, Command};
-use std::env;
-use std::io;
-use std::path::PathBuf;
-use uucore::format_usage;
+use clap::ArgAction;
+use clap::{crate_version, Arg, Command};
+use std::env;
+use std::io;
+use std::path::PathBuf;
+use uucore::format_usage;
 
-use uucore::display::println_verbatim;
-use uucore::error::{FromIo, UResult};
+use uucore::display::println_verbatim;
+use uucore::error::{FromIo, UResult};
 
-static ABOUT: &str = "Display the full filename of the current working directory.";
-const USAGE: &str = "{} [OPTION]... FILE...";
-static OPT_LOGICAL: &str = "logical";
-static OPT_PHYSICAL: &str = "physical";
+static ABOUT: &str = "Display the full filename of the current working directory.";
+const USAGE: &str = "{} [OPTION]... FILE...";
+static OPT_LOGICAL: &str = "logical";
+static OPT_PHYSICAL: &str = "physical";
 
-fn physical_path() -> io::Result<PathBuf> {
-    // std::env::current_dir() is a thin wrapper around libc::getcwd().
+fn physical_path() -> io::Result<PathBuf> {
+    // std::env::current_dir() is a thin wrapper around libc::getcwd().
 
-    // On Unix, getcwd() must return the physical path:
-    // https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html
-    #[cfg(unix)]
-    {
-        env::current_dir()
+    // On Unix, getcwd() must return the physical path:
+    // https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html
+    #[cfg(unix)]
+    {
+        env::current_dir()
     }
 
-    // On Windows we have to resolve it.
-    // On other systems we also resolve it, just in case.
-    #[cfg(not(unix))]
-    {
-        env::current_dir().and_then(|path| path.canonicalize())
+    // On Windows we have to resolve it.
+    // On other systems we also resolve it, just in case.
+    #[cfg(not(unix))]
+    {
+        env::current_dir().and_then(|path| path.canonicalize())
     }
 }
 
-fn logical_path() -> io::Result<PathBuf> {
-    // getcwd() on Windows seems to include symlinks, so this is easy.
-    #[cfg(windows)]
-    {
-        env::current_dir()
+fn logical_path() -> io::Result<PathBuf> {
+    // getcwd() on Windows seems to include symlinks, so this is easy.
+    #[cfg(windows)]
+    {
+        env::current_dir()
     }
 
-    // If we're not on Windows we do things Unix-style.
-    //
-    // Typical Unix-like kernels don't actually keep track of the logical working
-    // directory. They know the precise directory a process is in, and the getcwd()
-    // syscall reconstructs a path from that.
-    //
-    // The logical working directory is maintained by the shell, in the $PWD
-    // environment variable. So we check carefully if that variable looks
-    // reasonable, and if not then we fall back to the physical path.
-    //
-    // POSIX: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pwd.html
-    #[cfg(not(windows))]
-    {
-        use std::path::Path;
-        fn looks_reasonable(path: &Path) -> bool {
-            // First, check if it's an absolute path.
-            if !path.has_root() {
-                return false;
+    // If we're not on Windows we do things Unix-style.
+    //
+    // Typical Unix-like kernels don't actually keep track of the logical working
+    // directory. They know the precise directory a process is in, and the getcwd()
+    // syscall reconstructs a path from that.
+    //
+    // The logical working directory is maintained by the shell, in the $PWD
+    // environment variable. So we check carefully if that variable looks
+    // reasonable, and if not then we fall back to the physical path.
+    //
+    // POSIX: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pwd.html
+    #[cfg(not(windows))]
+    {
+        use std::path::Path;
+        fn looks_reasonable(path: &Path) -> bool {
+            // First, check if it's an absolute path.
+            if !path.has_root() {
+                return false;
             }
 
-            // Then, make sure there are no . or .. components.
-            // Path::components() isn't useful here, it normalizes those out.
+            // Then, make sure there are no . or .. components.
+            // Path::components() isn't useful here, it normalizes those out.
 
-            // to_string_lossy() may allocate, but that's fine, we call this
-            // only once per run. It may also lose information, but not any
-            // information that we need for this check.
-            if path
-                .to_string_lossy()
-                .split(std::path::is_separator)
-                .any(|piece| piece == "." || piece == "..")
+            // to_string_lossy() may allocate, but that's fine, we call this
+            // only once per run. It may also lose information, but not any
+            // information that we need for this check.
+            if path
+                .to_string_lossy()
+                .split(std::path::is_separator)
+                .any(|piece| piece == "." || piece == "..")
             {
-                return false;
+                return false;
             }
 
-            // Finally, check if it matches the directory we're in.
-            #[cfg(unix)]
-            {
-                use std::fs::metadata;
-                use std::os::unix::fs::MetadataExt;
-                let path_info = match metadata(path) {
-                    Ok(info) => info,
-                    Err(_) => return false,
+            // Finally, check if it matches the directory we're in.
+            #[cfg(unix)]
+            {
+                use std::fs::metadata;
+                use std::os::unix::fs::MetadataExt;
+                let path_info = match metadata(path) {
+                    Ok(info) => info,
+                    Err(_) => return false,
                 };
-                let real_info = match metadata(".") {
-                    Ok(info) => info,
-                    Err(_) => return false,
+                let real_info = match metadata(".") {
+                    Ok(info) => info,
+                    Err(_) => return false,
                 };
-                if path_info.dev() != real_info.dev() || path_info.ino() != real_info.ino() {
-                    return false;
+                if path_info.dev() != real_info.dev() || path_info.ino() != real_info.ino() {
+                    return false;
                 }
             }
 
-            #[cfg(not(unix))]
-            {
-                use std::fs::canonicalize;
-                let canon_path = match canonicalize(path) {
-                    Ok(path) => path,
-                    Err(_) => return false,
+            #[cfg(not(unix))]
+            {
+                use std::fs::canonicalize;
+                let canon_path = match canonicalize(path) {
+                    Ok(path) => path,
+                    Err(_) => return false,
                 };
-                let real_path = match canonicalize(".") {
-                    Ok(path) => path,
-                    Err(_) => return false,
+                let real_path = match canonicalize(".") {
+                    Ok(path) => path,
+                    Err(_) => return false,
                 };
-                if canon_path != real_path {
-                    return false;
+                if canon_path != real_path {
+                    return false;
                 }
             }
 
-            true
-        }
+            true
+        }
 
-        match env::var_os("PWD").map(PathBuf::from) {
-            Some(value) if looks_reasonable(&value) => Ok(value),
-            _ => env::current_dir(),
+        match env::var_os("PWD").map(PathBuf::from) {
+            Some(value) if looks_reasonable(&value) => Ok(value),
+            _ => env::current_dir(),
         }
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
-    // if POSIXLY_CORRECT is set, we want to a logical resolution.
-    // This produces a different output when doing mkdir -p a/b && ln -s a/b c && cd c && pwd
-    // We should get c in this case instead of a/b at the end of the path
-    let cwd = if matches.get_flag(OPT_LOGICAL) || env::var("POSIXLY_CORRECT").is_ok() {
-        logical_path()
-    } else {
-        physical_path()
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
+    // if POSIXLY_CORRECT is set, we want to a logical resolution.
+    // This produces a different output when doing mkdir -p a/b && ln -s a/b c && cd c && pwd
+    // We should get c in this case instead of a/b at the end of the path
+    let cwd = if matches.get_flag(OPT_LOGICAL) || env::var("POSIXLY_CORRECT").is_ok() {
+        logical_path()
+    } else {
+        physical_path()
     }
-    .map_err_context(|| "failed to get current directory".to_owned())?;
+    .map_err_context(|| "failed to get current directory".to_owned())?;
 
-    // \\?\ is a prefix Windows gives to paths under certain circumstances,
-    // including when canonicalizing them.
-    // With the right extension trait we can remove it non-lossily, but
-    // we print it lossily anyway, so no reason to bother.
-    #[cfg(windows)]
-    let cwd = cwd
-        .to_string_lossy()
-        .strip_prefix(r"\\?\")
-        .map(Into::into)
-        .unwrap_or(cwd);
+    // \\?\ is a prefix Windows gives to paths under certain circumstances,
+    // including when canonicalizing them.
+    // With the right extension trait we can remove it non-lossily, but
+    // we print it lossily anyway, so no reason to bother.
+    #[cfg(windows)]
+    let cwd = cwd
+        .to_string_lossy()
+        .strip_prefix(r"\\?\")
+        .map(Into::into)
+        .unwrap_or(cwd);
 
-    println_verbatim(&cwd).map_err_context(|| "failed to print current directory".to_owned())?;
+    println_verbatim(&cwd).map_err_context(|| "failed to print current directory".to_owned())?;
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_LOGICAL)
-                .short('L')
-                .long(OPT_LOGICAL)
-                .help("use PWD from environment, even if it contains symlinks")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_LOGICAL)
+                .short('L')
+                .long(OPT_LOGICAL)
+                .help("use PWD from environment, even if it contains symlinks")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_PHYSICAL)
-                .short('P')
-                .long(OPT_PHYSICAL)
-                .overrides_with(OPT_LOGICAL)
-                .help("avoid all symlinks")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_PHYSICAL)
+                .short('P')
+                .long(OPT_PHYSICAL)
+                .overrides_with(OPT_LOGICAL)
+                .help("avoid all symlinks")
+                .action(ArgAction::SetTrue),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_readlink/readlink.rs.html b/dev/src/uu_readlink/readlink.rs.html index 61499e743..8dafcc3ff 100644 --- a/dev/src/uu_readlink/readlink.rs.html +++ b/dev/src/uu_readlink/readlink.rs.html @@ -1,4 +1,4 @@ -readlink.rs - source
1
+readlink.rs - source
1
 2
 3
 4
@@ -187,99 +187,99 @@
 187
 188
 189
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Haitao Li <lihaitao@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Haitao Li <lihaitao@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) errno
+// spell-checker:ignore (ToDO) errno
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fs;
-use std::io::{stdout, Write};
-use std::path::{Path, PathBuf};
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
-use uucore::fs::{canonicalize, MissingHandling, ResolveMode};
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fs;
+use std::io::{stdout, Write};
+use std::path::{Path, PathBuf};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
+use uucore::fs::{canonicalize, MissingHandling, ResolveMode};
 
-const ABOUT: &str = "Print value of a symbolic link or canonical file name.";
-const USAGE: &str = "{} [OPTION]... [FILE]...";
-const OPT_CANONICALIZE: &str = "canonicalize";
-const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
-const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
-const OPT_NO_NEWLINE: &str = "no-newline";
-const OPT_QUIET: &str = "quiet";
-const OPT_SILENT: &str = "silent";
-const OPT_VERBOSE: &str = "verbose";
-const OPT_ZERO: &str = "zero";
+const ABOUT: &str = "Print value of a symbolic link or canonical file name.";
+const USAGE: &str = "{} [OPTION]... [FILE]...";
+const OPT_CANONICALIZE: &str = "canonicalize";
+const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
+const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
+const OPT_NO_NEWLINE: &str = "no-newline";
+const OPT_QUIET: &str = "quiet";
+const OPT_SILENT: &str = "silent";
+const OPT_VERBOSE: &str = "verbose";
+const OPT_ZERO: &str = "zero";
 
-const ARG_FILES: &str = "files";
+const ARG_FILES: &str = "files";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let mut no_trailing_delimiter = matches.get_flag(OPT_NO_NEWLINE);
-    let use_zero = matches.get_flag(OPT_ZERO);
-    let silent = matches.get_flag(OPT_SILENT) || matches.get_flag(OPT_QUIET);
-    let verbose = matches.get_flag(OPT_VERBOSE);
+    let mut no_trailing_delimiter = matches.get_flag(OPT_NO_NEWLINE);
+    let use_zero = matches.get_flag(OPT_ZERO);
+    let silent = matches.get_flag(OPT_SILENT) || matches.get_flag(OPT_QUIET);
+    let verbose = matches.get_flag(OPT_VERBOSE);
 
-    let res_mode = if matches.get_flag(OPT_CANONICALIZE)
-        || matches.get_flag(OPT_CANONICALIZE_EXISTING)
-        || matches.get_flag(OPT_CANONICALIZE_MISSING)
+    let res_mode = if matches.get_flag(OPT_CANONICALIZE)
+        || matches.get_flag(OPT_CANONICALIZE_EXISTING)
+        || matches.get_flag(OPT_CANONICALIZE_MISSING)
     {
-        ResolveMode::Logical
-    } else {
-        ResolveMode::None
+        ResolveMode::Logical
+    } else {
+        ResolveMode::None
     };
 
-    let can_mode = if matches.get_flag(OPT_CANONICALIZE_EXISTING) {
-        MissingHandling::Existing
-    } else if matches.get_flag(OPT_CANONICALIZE_MISSING) {
-        MissingHandling::Missing
-    } else {
-        MissingHandling::Normal
+    let can_mode = if matches.get_flag(OPT_CANONICALIZE_EXISTING) {
+        MissingHandling::Existing
+    } else if matches.get_flag(OPT_CANONICALIZE_MISSING) {
+        MissingHandling::Missing
+    } else {
+        MissingHandling::Normal
     };
 
-    let files: Vec<String> = matches
-        .get_many::<String>(ARG_FILES)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
-    if files.is_empty() {
-        return Err(UUsageError::new(1, "missing operand"));
+    let files: Vec<String> = matches
+        .get_many::<String>(ARG_FILES)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
+    if files.is_empty() {
+        return Err(UUsageError::new(1, "missing operand"));
     }
 
-    if no_trailing_delimiter && files.len() > 1 && !silent {
+    if no_trailing_delimiter && files.len() > 1 && !silent {
         show_error!("ignoring --no-newline with multiple arguments");
-        no_trailing_delimiter = false;
+        no_trailing_delimiter = false;
     }
 
-    for f in &files {
-        let p = PathBuf::from(f);
-        let path_result = if res_mode == ResolveMode::None {
-            fs::read_link(&p)
-        } else {
-            canonicalize(&p, can_mode, res_mode)
+    for f in &files {
+        let p = PathBuf::from(f);
+        let path_result = if res_mode == ResolveMode::None {
+            fs::read_link(&p)
+        } else {
+            canonicalize(&p, can_mode, res_mode)
         };
-        match path_result {
-            Ok(path) => {
-                show(&path, no_trailing_delimiter, use_zero).map_err_context(String::new)?;
+        match path_result {
+            Ok(path) => {
+                show(&path, no_trailing_delimiter, use_zero).map_err_context(String::new)?;
             }
-            Err(err) => {
-                if verbose {
-                    return Err(USimpleError::new(
+            Err(err) => {
+                if verbose {
+                    return Err(USimpleError::new(
                         1,
-                        err.map_err_context(move || f.maybe_quote().to_string())
-                            .to_string(),
+                        err.map_err_context(move || f.maybe_quote().to_string())
+                            .to_string(),
                     ));
-                } else {
-                    return Err(1.into());
+                } else {
+                    return Err(1.into());
                 }
             }
         }
@@ -287,94 +287,94 @@
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_help(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_CANONICALIZE)
-                .short('f')
-                .long(OPT_CANONICALIZE)
-                .help(
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_help(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_CANONICALIZE)
+                .short('f')
+                .long(OPT_CANONICALIZE)
+                .help(
                     "canonicalize by following every symlink in every component of the \
                      given name recursively; all but the last component must exist",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_CANONICALIZE_EXISTING)
-                .short('e')
-                .long("canonicalize-existing")
-                .help(
+        .arg(
+            Arg::new(OPT_CANONICALIZE_EXISTING)
+                .short('e')
+                .long("canonicalize-existing")
+                .help(
                     "canonicalize by following every symlink in every component of the \
                      given name recursively, all components must exist",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_CANONICALIZE_MISSING)
-                .short('m')
-                .long(OPT_CANONICALIZE_MISSING)
-                .help(
+        .arg(
+            Arg::new(OPT_CANONICALIZE_MISSING)
+                .short('m')
+                .long(OPT_CANONICALIZE_MISSING)
+                .help(
                     "canonicalize by following every symlink in every component of the \
                      given name recursively, without requirements on components existence",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_NO_NEWLINE)
-                .short('n')
-                .long(OPT_NO_NEWLINE)
-                .help("do not output the trailing delimiter")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_NO_NEWLINE)
+                .short('n')
+                .long(OPT_NO_NEWLINE)
+                .help("do not output the trailing delimiter")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_QUIET)
-                .short('q')
-                .long(OPT_QUIET)
-                .help("suppress most error messages")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_QUIET)
+                .short('q')
+                .long(OPT_QUIET)
+                .help("suppress most error messages")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_SILENT)
-                .short('s')
-                .long(OPT_SILENT)
-                .help("suppress most error messages")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_SILENT)
+                .short('s')
+                .long(OPT_SILENT)
+                .help("suppress most error messages")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_VERBOSE)
-                .short('v')
-                .long(OPT_VERBOSE)
-                .help("report error message")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_VERBOSE)
+                .short('v')
+                .long(OPT_VERBOSE)
+                .help("report error message")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_ZERO)
-                .short('z')
-                .long(OPT_ZERO)
-                .help("separate output with NUL rather than newline")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_ZERO)
+                .short('z')
+                .long(OPT_ZERO)
+                .help("separate output with NUL rather than newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-fn show(path: &Path, no_trailing_delimiter: bool, use_zero: bool) -> std::io::Result<()> {
-    let path = path.to_str().unwrap();
-    if no_trailing_delimiter {
-        print!("{}", path);
-    } else if use_zero {
-        print!("{}\0", path);
-    } else {
-        println!("{}", path);
+fn show(path: &Path, no_trailing_delimiter: bool, use_zero: bool) -> std::io::Result<()> {
+    let path = path.to_str().unwrap();
+    if no_trailing_delimiter {
+        print!("{}", path);
+    } else if use_zero {
+        print!("{}\0", path);
+    } else {
+        println!("{}", path);
     }
-    stdout().flush()
+    stdout().flush()
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_realpath/realpath.rs.html b/dev/src/uu_realpath/realpath.rs.html index cca1d1a58..f723bd1f2 100644 --- a/dev/src/uu_realpath/realpath.rs.html +++ b/dev/src/uu_realpath/realpath.rs.html @@ -1,4 +1,4 @@ -realpath.rs - source
1
+realpath.rs - source
1
 2
 3
 4
@@ -295,302 +295,302 @@
 295
 296
 297
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) 2014 Vsevolod Velichko <torkvemada@sorokdva.net>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) 2014 Vsevolod Velichko <torkvemada@sorokdva.net>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) retcode
+// spell-checker:ignore (ToDO) retcode
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{
-    builder::NonEmptyStringValueParser, crate_version, Arg, ArgAction, ArgMatches, Command,
+use clap::{
+    builder::NonEmptyStringValueParser, crate_version, Arg, ArgAction, ArgMatches, Command,
 };
-use std::{
-    io::{stdout, Write},
-    path::{Path, PathBuf},
+use std::{
+    io::{stdout, Write},
+    path::{Path, PathBuf},
 };
-use uucore::error::UClapError;
-use uucore::fs::make_path_relative_to;
-use uucore::{
-    display::{print_verbatim, Quotable},
-    error::{FromIo, UResult},
-    format_usage,
-    fs::{canonicalize, MissingHandling, ResolveMode},
+use uucore::error::UClapError;
+use uucore::fs::make_path_relative_to;
+use uucore::{
+    display::{print_verbatim, Quotable},
+    error::{FromIo, UResult},
+    format_usage,
+    fs::{canonicalize, MissingHandling, ResolveMode},
 };
 
-static ABOUT: &str = "print the resolved path";
-const USAGE: &str = "{} [OPTION]... FILE...";
+static ABOUT: &str = "print the resolved path";
+const USAGE: &str = "{} [OPTION]... FILE...";
 
-static OPT_QUIET: &str = "quiet";
-static OPT_STRIP: &str = "strip";
-static OPT_ZERO: &str = "zero";
-static OPT_PHYSICAL: &str = "physical";
-static OPT_LOGICAL: &str = "logical";
-const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
-const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
-const OPT_RELATIVE_TO: &str = "relative-to";
-const OPT_RELATIVE_BASE: &str = "relative-base";
+static OPT_QUIET: &str = "quiet";
+static OPT_STRIP: &str = "strip";
+static OPT_ZERO: &str = "zero";
+static OPT_PHYSICAL: &str = "physical";
+static OPT_LOGICAL: &str = "logical";
+const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing";
+const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing";
+const OPT_RELATIVE_TO: &str = "relative-to";
+const OPT_RELATIVE_BASE: &str = "relative-base";
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args).with_exit_code(1)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args).with_exit_code(1)?;
 
-    /*  the list of files */
+    /*  the list of files */
 
-    let paths: Vec<PathBuf> = matches
-        .get_many::<String>(ARG_FILES)
-        .unwrap()
-        .map(PathBuf::from)
-        .collect();
+    let paths: Vec<PathBuf> = matches
+        .get_many::<String>(ARG_FILES)
+        .unwrap()
+        .map(PathBuf::from)
+        .collect();
 
-    let strip = matches.get_flag(OPT_STRIP);
-    let zero = matches.get_flag(OPT_ZERO);
-    let quiet = matches.get_flag(OPT_QUIET);
-    let logical = matches.get_flag(OPT_LOGICAL);
-    let can_mode = if matches.get_flag(OPT_CANONICALIZE_EXISTING) {
-        MissingHandling::Existing
-    } else if matches.get_flag(OPT_CANONICALIZE_MISSING) {
-        MissingHandling::Missing
-    } else {
-        MissingHandling::Normal
+    let strip = matches.get_flag(OPT_STRIP);
+    let zero = matches.get_flag(OPT_ZERO);
+    let quiet = matches.get_flag(OPT_QUIET);
+    let logical = matches.get_flag(OPT_LOGICAL);
+    let can_mode = if matches.get_flag(OPT_CANONICALIZE_EXISTING) {
+        MissingHandling::Existing
+    } else if matches.get_flag(OPT_CANONICALIZE_MISSING) {
+        MissingHandling::Missing
+    } else {
+        MissingHandling::Normal
     };
-    let resolve_mode = if strip {
-        ResolveMode::None
-    } else if logical {
-        ResolveMode::Logical
-    } else {
-        ResolveMode::Physical
+    let resolve_mode = if strip {
+        ResolveMode::None
+    } else if logical {
+        ResolveMode::Logical
+    } else {
+        ResolveMode::Physical
     };
-    let (relative_to, relative_base) = prepare_relative_options(&matches, can_mode, resolve_mode)?;
-    for path in &paths {
-        let result = resolve_path(
-            path,
-            zero,
-            resolve_mode,
-            can_mode,
-            relative_to.as_deref(),
-            relative_base.as_deref(),
+    let (relative_to, relative_base) = prepare_relative_options(&matches, can_mode, resolve_mode)?;
+    for path in &paths {
+        let result = resolve_path(
+            path,
+            zero,
+            resolve_mode,
+            can_mode,
+            relative_to.as_deref(),
+            relative_base.as_deref(),
         );
-        if !quiet {
-            show_if_err!(result.map_err_context(|| path.maybe_quote().to_string()));
+        if !quiet {
+            show_if_err!(result.map_err_context(|| path.maybe_quote().to_string()));
         }
     }
-    // Although we return `Ok`, it is possible that a call to
-    // `show!()` above has set the exit code for the program to a
-    // non-zero integer.
-    Ok(())
+    // Although we return `Ok`, it is possible that a call to
+    // `show!()` above has set the exit code for the program to a
+    // non-zero integer.
+    Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_QUIET)
-                .short('q')
-                .long(OPT_QUIET)
-                .help("Do not print warnings for invalid paths")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_QUIET)
+                .short('q')
+                .long(OPT_QUIET)
+                .help("Do not print warnings for invalid paths")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_STRIP)
-                .short('s')
-                .long(OPT_STRIP)
-                .visible_alias("no-symlinks")
-                .help("Only strip '.' and '..' components, but don't resolve symbolic links")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_STRIP)
+                .short('s')
+                .long(OPT_STRIP)
+                .visible_alias("no-symlinks")
+                .help("Only strip '.' and '..' components, but don't resolve symbolic links")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_ZERO)
-                .short('z')
-                .long(OPT_ZERO)
-                .help("Separate output filenames with \\0 rather than newline")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_ZERO)
+                .short('z')
+                .long(OPT_ZERO)
+                .help("Separate output filenames with \\0 rather than newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_LOGICAL)
-                .short('L')
-                .long(OPT_LOGICAL)
-                .help("resolve '..' components before symlinks")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_LOGICAL)
+                .short('L')
+                .long(OPT_LOGICAL)
+                .help("resolve '..' components before symlinks")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_PHYSICAL)
-                .short('P')
-                .long(OPT_PHYSICAL)
-                .overrides_with_all([OPT_STRIP, OPT_LOGICAL])
-                .help("resolve symlinks as encountered (default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_PHYSICAL)
+                .short('P')
+                .long(OPT_PHYSICAL)
+                .overrides_with_all([OPT_STRIP, OPT_LOGICAL])
+                .help("resolve symlinks as encountered (default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_CANONICALIZE_EXISTING)
-                .short('e')
-                .long(OPT_CANONICALIZE_EXISTING)
-                .help(
+        .arg(
+            Arg::new(OPT_CANONICALIZE_EXISTING)
+                .short('e')
+                .long(OPT_CANONICALIZE_EXISTING)
+                .help(
                     "canonicalize by following every symlink in every component of the \
                      given name recursively, all components must exist",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_CANONICALIZE_MISSING)
-                .short('m')
-                .long(OPT_CANONICALIZE_MISSING)
-                .help(
+        .arg(
+            Arg::new(OPT_CANONICALIZE_MISSING)
+                .short('m')
+                .long(OPT_CANONICALIZE_MISSING)
+                .help(
                     "canonicalize by following every symlink in every component of the \
                      given name recursively, without requirements on components existence",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_RELATIVE_TO)
-                .long(OPT_RELATIVE_TO)
-                .value_name("DIR")
-                .value_parser(NonEmptyStringValueParser::new())
-                .help("print the resolved path relative to DIR"),
+        .arg(
+            Arg::new(OPT_RELATIVE_TO)
+                .long(OPT_RELATIVE_TO)
+                .value_name("DIR")
+                .value_parser(NonEmptyStringValueParser::new())
+                .help("print the resolved path relative to DIR"),
         )
-        .arg(
-            Arg::new(OPT_RELATIVE_BASE)
-                .long(OPT_RELATIVE_BASE)
-                .value_name("DIR")
-                .value_parser(NonEmptyStringValueParser::new())
-                .help("print absolute paths unless paths below DIR"),
+        .arg(
+            Arg::new(OPT_RELATIVE_BASE)
+                .long(OPT_RELATIVE_BASE)
+                .value_name("DIR")
+                .value_parser(NonEmptyStringValueParser::new())
+                .help("print absolute paths unless paths below DIR"),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .required(true)
-                .value_parser(NonEmptyStringValueParser::new())
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .required(true)
+                .value_parser(NonEmptyStringValueParser::new())
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-/// Prepare `--relative-to` and `--relative-base` options.
-/// Convert them to their absolute values.
-/// Check if `--relative-to` is a descendant of `--relative-base`,
-/// otherwise nullify their value.
-fn prepare_relative_options(
-    matches: &ArgMatches,
-    can_mode: MissingHandling,
-    resolve_mode: ResolveMode,
-) -> UResult<(Option<PathBuf>, Option<PathBuf>)> {
-    let relative_to = matches
-        .get_one::<String>(OPT_RELATIVE_TO)
-        .map(PathBuf::from);
-    let relative_base = matches
-        .get_one::<String>(OPT_RELATIVE_BASE)
-        .map(PathBuf::from);
-    let relative_to = canonicalize_relative_option(relative_to, can_mode, resolve_mode)?;
-    let relative_base = canonicalize_relative_option(relative_base, can_mode, resolve_mode)?;
-    if let (Some(base), Some(to)) = (relative_base.as_deref(), relative_to.as_deref()) {
-        if !to.starts_with(base) {
-            return Ok((None, None));
+/// Prepare `--relative-to` and `--relative-base` options.
+/// Convert them to their absolute values.
+/// Check if `--relative-to` is a descendant of `--relative-base`,
+/// otherwise nullify their value.
+fn prepare_relative_options(
+    matches: &ArgMatches,
+    can_mode: MissingHandling,
+    resolve_mode: ResolveMode,
+) -> UResult<(Option<PathBuf>, Option<PathBuf>)> {
+    let relative_to = matches
+        .get_one::<String>(OPT_RELATIVE_TO)
+        .map(PathBuf::from);
+    let relative_base = matches
+        .get_one::<String>(OPT_RELATIVE_BASE)
+        .map(PathBuf::from);
+    let relative_to = canonicalize_relative_option(relative_to, can_mode, resolve_mode)?;
+    let relative_base = canonicalize_relative_option(relative_base, can_mode, resolve_mode)?;
+    if let (Some(base), Some(to)) = (relative_base.as_deref(), relative_to.as_deref()) {
+        if !to.starts_with(base) {
+            return Ok((None, None));
         }
     }
-    Ok((relative_to, relative_base))
+    Ok((relative_to, relative_base))
 }
 
-/// Prepare single `relative-*` option.
-fn canonicalize_relative_option(
-    relative: Option<PathBuf>,
-    can_mode: MissingHandling,
-    resolve_mode: ResolveMode,
-) -> UResult<Option<PathBuf>> {
-    Ok(match relative {
-        None => None,
-        Some(p) => Some(
-            canonicalize_relative(&p, can_mode, resolve_mode)
-                .map_err_context(|| p.maybe_quote().to_string())?,
+/// Prepare single `relative-*` option.
+fn canonicalize_relative_option(
+    relative: Option<PathBuf>,
+    can_mode: MissingHandling,
+    resolve_mode: ResolveMode,
+) -> UResult<Option<PathBuf>> {
+    Ok(match relative {
+        None => None,
+        Some(p) => Some(
+            canonicalize_relative(&p, can_mode, resolve_mode)
+                .map_err_context(|| p.maybe_quote().to_string())?,
         ),
     })
 }
 
-/// Make `relative-to` or `relative-base` path values absolute.
-///
-/// # Errors
-///
-/// If the given path is not a directory the function returns an error.
-/// If some parts of the file don't exist, or symlinks make loops, or
-/// some other IO error happens, the function returns error, too.
-fn canonicalize_relative(
-    r: &Path,
-    can_mode: MissingHandling,
-    resolve: ResolveMode,
-) -> std::io::Result<PathBuf> {
-    let abs = canonicalize(r, can_mode, resolve)?;
-    if can_mode == MissingHandling::Existing && !abs.is_dir() {
-        abs.read_dir()?; // raise not a directory error
-    }
-    Ok(abs)
+/// Make `relative-to` or `relative-base` path values absolute.
+///
+/// # Errors
+///
+/// If the given path is not a directory the function returns an error.
+/// If some parts of the file don't exist, or symlinks make loops, or
+/// some other IO error happens, the function returns error, too.
+fn canonicalize_relative(
+    r: &Path,
+    can_mode: MissingHandling,
+    resolve: ResolveMode,
+) -> std::io::Result<PathBuf> {
+    let abs = canonicalize(r, can_mode, resolve)?;
+    if can_mode == MissingHandling::Existing && !abs.is_dir() {
+        abs.read_dir()?; // raise not a directory error
+    }
+    Ok(abs)
 }
 
-/// Resolve a path to an absolute form and print it.
-///
-/// If `relative_to` and/or `relative_base` is given
-/// the path is printed in a relative form to one of this options.
-/// See the details in `process_relative` function.
-/// If `zero` is `true`, then this function
-/// prints the path followed by the null byte (`'\0'`) instead of a
-/// newline character (`'\n'`).
-///
-/// # Errors
-///
-/// This function returns an error if there is a problem resolving
-/// symbolic links.
-fn resolve_path(
-    p: &Path,
-    zero: bool,
-    resolve: ResolveMode,
-    can_mode: MissingHandling,
-    relative_to: Option<&Path>,
-    relative_base: Option<&Path>,
-) -> std::io::Result<()> {
-    let abs = canonicalize(p, can_mode, resolve)?;
-    let line_ending = if zero { b'\0' } else { b'\n' };
+/// Resolve a path to an absolute form and print it.
+///
+/// If `relative_to` and/or `relative_base` is given
+/// the path is printed in a relative form to one of this options.
+/// See the details in `process_relative` function.
+/// If `zero` is `true`, then this function
+/// prints the path followed by the null byte (`'\0'`) instead of a
+/// newline character (`'\n'`).
+///
+/// # Errors
+///
+/// This function returns an error if there is a problem resolving
+/// symbolic links.
+fn resolve_path(
+    p: &Path,
+    zero: bool,
+    resolve: ResolveMode,
+    can_mode: MissingHandling,
+    relative_to: Option<&Path>,
+    relative_base: Option<&Path>,
+) -> std::io::Result<()> {
+    let abs = canonicalize(p, can_mode, resolve)?;
+    let line_ending = if zero { b'\0' } else { b'\n' };
 
-    let abs = process_relative(abs, relative_base, relative_to);
+    let abs = process_relative(abs, relative_base, relative_to);
 
-    print_verbatim(&abs)?;
-    stdout().write_all(&[line_ending])?;
+    print_verbatim(&abs)?;
+    stdout().write_all(&[line_ending])?;
     Ok(())
 }
 
-/// Conditionally converts an absolute path to a relative form,
-/// according to the rules:
-/// 1. if only `relative_to` is given, the result is relative to `relative_to`
-/// 1. if only `relative_base` is given, it checks whether given `path` is a descendant
-/// of `relative_base`, on success the result is relative to `relative_base`, otherwise
-/// the result is the given `path`
-/// 1. if both `relative_to` and `relative_base` are given, the result is relative to `relative_to`
-/// if `path` is a descendant of `relative_base`, otherwise the result is `path`
-///
-/// For more information see
-/// <https://www.gnu.org/software/coreutils/manual/html_node/Realpath-usage-examples.html>
-fn process_relative(
-    path: PathBuf,
-    relative_base: Option<&Path>,
-    relative_to: Option<&Path>,
-) -> PathBuf {
-    if let Some(base) = relative_base {
-        if path.starts_with(base) {
-            make_path_relative_to(path, relative_to.unwrap_or(base))
-        } else {
-            path
+/// Conditionally converts an absolute path to a relative form,
+/// according to the rules:
+/// 1. if only `relative_to` is given, the result is relative to `relative_to`
+/// 1. if only `relative_base` is given, it checks whether given `path` is a descendant
+/// of `relative_base`, on success the result is relative to `relative_base`, otherwise
+/// the result is the given `path`
+/// 1. if both `relative_to` and `relative_base` are given, the result is relative to `relative_to`
+/// if `path` is a descendant of `relative_base`, otherwise the result is `path`
+///
+/// For more information see
+/// <https://www.gnu.org/software/coreutils/manual/html_node/Realpath-usage-examples.html>
+fn process_relative(
+    path: PathBuf,
+    relative_base: Option<&Path>,
+    relative_to: Option<&Path>,
+) -> PathBuf {
+    if let Some(base) = relative_base {
+        if path.starts_with(base) {
+            make_path_relative_to(path, relative_to.unwrap_or(base))
+        } else {
+            path
         }
-    } else if let Some(to) = relative_to {
-        make_path_relative_to(path, to)
-    } else {
-        path
+    } else if let Some(to) = relative_to {
+        make_path_relative_to(path, to)
+    } else {
+        path
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_relpath/relpath.rs.html b/dev/src/uu_relpath/relpath.rs.html index b40f3876b..50a457a35 100644 --- a/dev/src/uu_relpath/relpath.rs.html +++ b/dev/src/uu_relpath/relpath.rs.html @@ -1,4 +1,4 @@ -relpath.rs - source
1
+relpath.rs - source
1
 2
 3
 4
@@ -88,95 +88,95 @@
 88
 89
 90
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) 2014 Vsevolod Velichko <torkvemada@sorokdva.net>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) 2014 Vsevolod Velichko <torkvemada@sorokdva.net>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) subpath absto absfrom absbase
+// spell-checker:ignore (ToDO) subpath absto absfrom absbase
 
-use clap::{crate_version, Arg, Command};
-use std::env;
-use std::path::{Path, PathBuf};
-use uucore::display::println_verbatim;
-use uucore::error::{FromIo, UResult};
-use uucore::format_usage;
-use uucore::fs::{canonicalize, MissingHandling, ResolveMode};
+use clap::{crate_version, Arg, Command};
+use std::env;
+use std::path::{Path, PathBuf};
+use uucore::display::println_verbatim;
+use uucore::error::{FromIo, UResult};
+use uucore::format_usage;
+use uucore::fs::{canonicalize, MissingHandling, ResolveMode};
 
-static ABOUT: &str = "Convert TO destination to the relative path from the FROM dir.
+static ABOUT: &str = "Convert TO destination to the relative path from the FROM dir.
 If FROM path is omitted, current working dir will be used.";
-const USAGE: &str = "{} [-d DIR] TO [FROM]";
+const USAGE: &str = "{} [-d DIR] TO [FROM]";
 
-mod options {
-    pub const DIR: &str = "DIR";
-    pub const TO: &str = "TO";
-    pub const FROM: &str = "FROM";
+mod options {
+    pub const DIR: &str = "DIR";
+    pub const TO: &str = "TO";
+    pub const FROM: &str = "FROM";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().get_matches_from(args);
+    let matches = uu_app().get_matches_from(args);
 
-    let to = Path::new(matches.get_one::<String>(options::TO).unwrap()).to_path_buf(); // required
-    let from = match matches.get_one::<String>(options::FROM) {
-        Some(p) => Path::new(p).to_path_buf(),
-        None => env::current_dir().unwrap(),
+    let to = Path::new(matches.get_one::<String>(options::TO).unwrap()).to_path_buf(); // required
+    let from = match matches.get_one::<String>(options::FROM) {
+        Some(p) => Path::new(p).to_path_buf(),
+        None => env::current_dir().unwrap(),
     };
-    let absto = canonicalize(to, MissingHandling::Normal, ResolveMode::Logical)
-        .map_err_context(String::new)?;
-    let absfrom = canonicalize(from, MissingHandling::Normal, ResolveMode::Logical)
-        .map_err_context(String::new)?;
+    let absto = canonicalize(to, MissingHandling::Normal, ResolveMode::Logical)
+        .map_err_context(String::new)?;
+    let absfrom = canonicalize(from, MissingHandling::Normal, ResolveMode::Logical)
+        .map_err_context(String::new)?;
 
-    if matches.contains_id(options::DIR) {
-        let base = Path::new(&matches.get_one::<String>(options::DIR).unwrap()).to_path_buf();
-        let absbase = canonicalize(base, MissingHandling::Normal, ResolveMode::Logical)
-            .map_err_context(String::new)?;
-        if !absto.as_path().starts_with(absbase.as_path())
-            || !absfrom.as_path().starts_with(absbase.as_path())
+    if matches.contains_id(options::DIR) {
+        let base = Path::new(&matches.get_one::<String>(options::DIR).unwrap()).to_path_buf();
+        let absbase = canonicalize(base, MissingHandling::Normal, ResolveMode::Logical)
+            .map_err_context(String::new)?;
+        if !absto.as_path().starts_with(absbase.as_path())
+            || !absfrom.as_path().starts_with(absbase.as_path())
         {
-            return println_verbatim(absto).map_err_context(String::new);
+            return println_verbatim(absto).map_err_context(String::new);
         }
     }
 
-    let mut suffix_pos = 0;
-    for (f, t) in absfrom.components().zip(absto.components()) {
-        if f == t {
-            suffix_pos += 1;
-        } else {
+    let mut suffix_pos = 0;
+    for (f, t) in absfrom.components().zip(absto.components()) {
+        if f == t {
+            suffix_pos += 1;
+        } else {
             break;
         }
     }
 
-    let mut result = PathBuf::new();
-    absfrom
-        .components()
-        .skip(suffix_pos)
-        .map(|_| result.push(".."))
-        .last();
-    absto
-        .components()
-        .skip(suffix_pos)
-        .map(|x| result.push(x.as_os_str()))
-        .last();
+    let mut result = PathBuf::new();
+    absfrom
+        .components()
+        .skip(suffix_pos)
+        .map(|_| result.push(".."))
+        .last();
+    absto
+        .components()
+        .skip(suffix_pos)
+        .map(|x| result.push(x.as_os_str()))
+        .last();
 
-    println_verbatim(result).map_err_context(String::new)
+    println_verbatim(result).map_err_context(String::new)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(Arg::new(options::DIR).short('d').help(
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(Arg::new(options::DIR).short('d').help(
             "If any of FROM and TO is not subpath of DIR, output absolute path instead of relative",
         ))
-        .arg(Arg::new(options::TO).value_hint(clap::ValueHint::AnyPath))
-        .arg(Arg::new(options::FROM).value_hint(clap::ValueHint::AnyPath))
+        .arg(Arg::new(options::TO).value_hint(clap::ValueHint::AnyPath))
+        .arg(Arg::new(options::FROM).value_hint(clap::ValueHint::AnyPath))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_rm/rm.rs.html b/dev/src/uu_rm/rm.rs.html index a8908314b..4e2ba42c2 100644 --- a/dev/src/uu_rm/rm.rs.html +++ b/dev/src/uu_rm/rm.rs.html @@ -1,4 +1,4 @@ -rm.rs - source
1
+rm.rs - source
1
 2
 3
 4
@@ -612,67 +612,67 @@
 612
 613
 614
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (path) eacces
+// spell-checker:ignore (path) eacces
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, parser::ValueSource, Arg, ArgAction, Command};
-use remove_dir_all::remove_dir_all;
-use std::collections::VecDeque;
-use std::fs::{self, File, Metadata};
-use std::io::{stderr, stdin, BufRead, ErrorKind, Write};
-use std::ops::BitOr;
-use std::path::{Path, PathBuf};
-use uucore::display::Quotable;
-use uucore::error::{UResult, USimpleError, UUsageError};
-use uucore::format_usage;
-use walkdir::{DirEntry, WalkDir};
+use clap::{crate_version, parser::ValueSource, Arg, ArgAction, Command};
+use remove_dir_all::remove_dir_all;
+use std::collections::VecDeque;
+use std::fs::{self, File, Metadata};
+use std::io::{stderr, stdin, BufRead, ErrorKind, Write};
+use std::ops::BitOr;
+use std::path::{Path, PathBuf};
+use uucore::display::Quotable;
+use uucore::error::{UResult, USimpleError, UUsageError};
+use uucore::format_usage;
+use walkdir::{DirEntry, WalkDir};
 
-#[derive(Eq, PartialEq, Clone, Copy)]
-enum InteractiveMode {
-    Never,
-    Once,
-    Always,
-    PromptProtected,
+#[derive(Eq, PartialEq, Clone, Copy)]
+enum InteractiveMode {
+    Never,
+    Once,
+    Always,
+    PromptProtected,
 }
 
-struct Options {
-    force: bool,
-    interactive: InteractiveMode,
-    #[allow(dead_code)]
-    one_fs: bool,
-    preserve_root: bool,
-    recursive: bool,
-    dir: bool,
-    verbose: bool,
+struct Options {
+    force: bool,
+    interactive: InteractiveMode,
+    #[allow(dead_code)]
+    one_fs: bool,
+    preserve_root: bool,
+    recursive: bool,
+    dir: bool,
+    verbose: bool,
 }
 
-static ABOUT: &str = "Remove (unlink) the FILE(s)";
-const USAGE: &str = "{} [OPTION]... FILE...";
-static OPT_DIR: &str = "dir";
-static OPT_INTERACTIVE: &str = "interactive";
-static OPT_FORCE: &str = "force";
-static OPT_NO_PRESERVE_ROOT: &str = "no-preserve-root";
-static OPT_ONE_FILE_SYSTEM: &str = "one-file-system";
-static OPT_PRESERVE_ROOT: &str = "preserve-root";
-static OPT_PROMPT: &str = "prompt";
-static OPT_PROMPT_MORE: &str = "prompt-more";
-static OPT_RECURSIVE: &str = "recursive";
-static OPT_VERBOSE: &str = "verbose";
-static PRESUME_INPUT_TTY: &str = "-presume-input-tty";
+static ABOUT: &str = "Remove (unlink) the FILE(s)";
+const USAGE: &str = "{} [OPTION]... FILE...";
+static OPT_DIR: &str = "dir";
+static OPT_INTERACTIVE: &str = "interactive";
+static OPT_FORCE: &str = "force";
+static OPT_NO_PRESERVE_ROOT: &str = "no-preserve-root";
+static OPT_ONE_FILE_SYSTEM: &str = "one-file-system";
+static OPT_PRESERVE_ROOT: &str = "preserve-root";
+static OPT_PROMPT: &str = "prompt";
+static OPT_PROMPT_MORE: &str = "prompt-more";
+static OPT_RECURSIVE: &str = "recursive";
+static OPT_VERBOSE: &str = "verbose";
+static PRESUME_INPUT_TTY: &str = "-presume-input-tty";
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-fn get_long_usage() -> String {
-    String::from(
+fn get_long_usage() -> String {
+    String::from(
         "By default, rm does not remove directories.  Use the --recursive (-r or -R)
         option to remove each listed directory, too, along with all of its contents
 
@@ -688,543 +688,543 @@
     )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)?;
 
-    let files: Vec<String> = matches
-        .get_many::<String>(ARG_FILES)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let files: Vec<String> = matches
+        .get_many::<String>(ARG_FILES)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    let force_flag = matches.get_flag(OPT_FORCE);
+    let force_flag = matches.get_flag(OPT_FORCE);
 
-    // If -f(--force) is before any -i (or variants) we want prompts else no prompts
-    let force_prompt_never: bool = force_flag && {
-        let force_index = matches.index_of(OPT_FORCE).unwrap_or(0);
-        ![OPT_PROMPT, OPT_PROMPT_MORE, OPT_INTERACTIVE]
-            .iter()
-            .any(|flag| {
-                matches.value_source(flag) == Some(ValueSource::CommandLine)
-                    && matches.index_of(flag).unwrap_or(0) > force_index
+    // If -f(--force) is before any -i (or variants) we want prompts else no prompts
+    let force_prompt_never: bool = force_flag && {
+        let force_index = matches.index_of(OPT_FORCE).unwrap_or(0);
+        ![OPT_PROMPT, OPT_PROMPT_MORE, OPT_INTERACTIVE]
+            .iter()
+            .any(|flag| {
+                matches.value_source(flag) == Some(ValueSource::CommandLine)
+                    && matches.index_of(flag).unwrap_or(0) > force_index
             })
     };
 
-    if files.is_empty() && !force_flag {
-        // Still check by hand and not use clap
-        // Because "rm -f" is a thing
-        return Err(UUsageError::new(1, "missing operand"));
-    } else {
-        let options = Options {
-            force: force_flag,
-            interactive: {
-                if force_prompt_never {
-                    InteractiveMode::Never
-                } else if matches.get_flag(OPT_PROMPT) {
-                    InteractiveMode::Always
-                } else if matches.get_flag(OPT_PROMPT_MORE) {
-                    InteractiveMode::Once
-                } else if matches.contains_id(OPT_INTERACTIVE) {
-                    match matches.get_one::<String>(OPT_INTERACTIVE).unwrap().as_str() {
-                        "never" => InteractiveMode::Never,
-                        "once" => InteractiveMode::Once,
-                        "always" => InteractiveMode::Always,
-                        val => {
-                            return Err(USimpleError::new(
+    if files.is_empty() && !force_flag {
+        // Still check by hand and not use clap
+        // Because "rm -f" is a thing
+        return Err(UUsageError::new(1, "missing operand"));
+    } else {
+        let options = Options {
+            force: force_flag,
+            interactive: {
+                if force_prompt_never {
+                    InteractiveMode::Never
+                } else if matches.get_flag(OPT_PROMPT) {
+                    InteractiveMode::Always
+                } else if matches.get_flag(OPT_PROMPT_MORE) {
+                    InteractiveMode::Once
+                } else if matches.contains_id(OPT_INTERACTIVE) {
+                    match matches.get_one::<String>(OPT_INTERACTIVE).unwrap().as_str() {
+                        "never" => InteractiveMode::Never,
+                        "once" => InteractiveMode::Once,
+                        "always" => InteractiveMode::Always,
+                        val => {
+                            return Err(USimpleError::new(
                                 1,
-                                format!("Invalid argument to interactive ({})", val),
+                                format!("Invalid argument to interactive ({})", val),
                             ))
                         }
                     }
-                } else {
-                    InteractiveMode::PromptProtected
+                } else {
+                    InteractiveMode::PromptProtected
                 }
             },
-            one_fs: matches.get_flag(OPT_ONE_FILE_SYSTEM),
-            preserve_root: !matches.get_flag(OPT_NO_PRESERVE_ROOT),
-            recursive: matches.get_flag(OPT_RECURSIVE),
-            dir: matches.get_flag(OPT_DIR),
-            verbose: matches.get_flag(OPT_VERBOSE),
+            one_fs: matches.get_flag(OPT_ONE_FILE_SYSTEM),
+            preserve_root: !matches.get_flag(OPT_NO_PRESERVE_ROOT),
+            recursive: matches.get_flag(OPT_RECURSIVE),
+            dir: matches.get_flag(OPT_DIR),
+            verbose: matches.get_flag(OPT_VERBOSE),
         };
-        if options.interactive == InteractiveMode::Once && (options.recursive || files.len() > 3) {
-            let msg = if options.recursive {
-                "Remove all arguments recursively? "
-            } else {
-                "Remove all arguments? "
-            };
-            if !prompt(msg) {
-                return Ok(());
+        if options.interactive == InteractiveMode::Once && (options.recursive || files.len() > 3) {
+            let msg = if options.recursive {
+                "Remove all arguments recursively? "
+            } else {
+                "Remove all arguments? "
+            };
+            if !prompt(msg) {
+                return Ok(());
             }
         }
 
-        if remove(&files, &options) {
-            return Err(1.into());
+        if remove(&files, &options) {
+            return Err(1.into());
         }
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .args_override_self(true)
-        .arg(
-            Arg::new(OPT_FORCE)
-                .short('f')
-                .long(OPT_FORCE)
-                .help("ignore nonexistent files and arguments, never prompt")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .args_override_self(true)
+        .arg(
+            Arg::new(OPT_FORCE)
+                .short('f')
+                .long(OPT_FORCE)
+                .help("ignore nonexistent files and arguments, never prompt")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_PROMPT)
-                .short('i')
-                .help("prompt before every removal")
-                .overrides_with_all(&[OPT_PROMPT_MORE, OPT_INTERACTIVE])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_PROMPT)
+                .short('i')
+                .help("prompt before every removal")
+                .overrides_with_all(&[OPT_PROMPT_MORE, OPT_INTERACTIVE])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_PROMPT_MORE)
-                .short('I')
-                .help("prompt once before removing more than three files, or when removing recursively. \
+        .arg(
+            Arg::new(OPT_PROMPT_MORE)
+                .short('I')
+                .help("prompt once before removing more than three files, or when removing recursively. \
                 Less intrusive than -i, while still giving some protection against most mistakes")
-                .overrides_with_all(&[OPT_PROMPT, OPT_INTERACTIVE])
-                .action(ArgAction::SetTrue),
+                .overrides_with_all(&[OPT_PROMPT, OPT_INTERACTIVE])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_INTERACTIVE)
-                .long(OPT_INTERACTIVE)
-                .help(
+        .arg(
+            Arg::new(OPT_INTERACTIVE)
+                .long(OPT_INTERACTIVE)
+                .help(
                     "prompt according to WHEN: never, once (-I), or always (-i). Without WHEN, \
                     prompts always",
                 )
-                .value_name("WHEN")
-                .overrides_with_all(&[OPT_PROMPT, OPT_PROMPT_MORE]),
+                .value_name("WHEN")
+                .overrides_with_all(&[OPT_PROMPT, OPT_PROMPT_MORE]),
         )
-        .arg(
-            Arg::new(OPT_ONE_FILE_SYSTEM)
-                .long(OPT_ONE_FILE_SYSTEM)
-                .help(
+        .arg(
+            Arg::new(OPT_ONE_FILE_SYSTEM)
+                .long(OPT_ONE_FILE_SYSTEM)
+                .help(
                     "when removing a hierarchy recursively, skip any directory that is on a file \
                     system different from that of the corresponding command line argument (NOT \
                     IMPLEMENTED)",
-                ).action(ArgAction::SetTrue),
+                ).action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_NO_PRESERVE_ROOT)
-                .long(OPT_NO_PRESERVE_ROOT)
-                .help("do not treat '/' specially")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_NO_PRESERVE_ROOT)
+                .long(OPT_NO_PRESERVE_ROOT)
+                .help("do not treat '/' specially")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_PRESERVE_ROOT)
-                .long(OPT_PRESERVE_ROOT)
-                .help("do not remove '/' (default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_PRESERVE_ROOT)
+                .long(OPT_PRESERVE_ROOT)
+                .help("do not remove '/' (default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_RECURSIVE)
-                .short('r')
-                .visible_short_alias('R')
-                .long(OPT_RECURSIVE)
-                .help("remove directories and their contents recursively")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_RECURSIVE)
+                .short('r')
+                .visible_short_alias('R')
+                .long(OPT_RECURSIVE)
+                .help("remove directories and their contents recursively")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_DIR)
-                .short('d')
-                .long(OPT_DIR)
-                .help("remove empty directories")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_DIR)
+                .short('d')
+                .long(OPT_DIR)
+                .help("remove empty directories")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_VERBOSE)
-                .short('v')
-                .long(OPT_VERBOSE)
-                .help("explain what is being done")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_VERBOSE)
+                .short('v')
+                .long(OPT_VERBOSE)
+                .help("explain what is being done")
+                .action(ArgAction::SetTrue),
         )
-        // From the GNU source code:
-        // This is solely for testing.
-        // Do not document.
-        // It is relatively difficult to ensure that there is a tty on stdin.
-        // Since rm acts differently depending on that, without this option,
-        // it'd be harder to test the parts of rm that depend on that setting.
-        // In contrast with Arg::long, Arg::alias does not strip leading
-        // hyphens. Therefore it supports 3 leading hyphens.
-        .arg(
-            Arg::new(PRESUME_INPUT_TTY)
-                .long("presume-input-tty")
-                .alias(PRESUME_INPUT_TTY)
-                .hide(true)
-                .action(ArgAction::SetTrue),
+        // From the GNU source code:
+        // This is solely for testing.
+        // Do not document.
+        // It is relatively difficult to ensure that there is a tty on stdin.
+        // Since rm acts differently depending on that, without this option,
+        // it'd be harder to test the parts of rm that depend on that setting.
+        // In contrast with Arg::long, Arg::alias does not strip leading
+        // hyphens. Therefore it supports 3 leading hyphens.
+        .arg(
+            Arg::new(PRESUME_INPUT_TTY)
+                .long("presume-input-tty")
+                .alias(PRESUME_INPUT_TTY)
+                .hide(true)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .num_args(1..)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .num_args(1..)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-// TODO: implement one-file-system (this may get partially implemented in walkdir)
-fn remove(files: &[String], options: &Options) -> bool {
-    let mut had_err = false;
+// TODO: implement one-file-system (this may get partially implemented in walkdir)
+fn remove(files: &[String], options: &Options) -> bool {
+    let mut had_err = false;
 
-    for filename in files {
-        let file = Path::new(filename);
-        had_err = match file.symlink_metadata() {
-            Ok(metadata) => {
-                if metadata.is_dir() {
-                    handle_dir(file, options)
-                } else if is_symlink_dir(&metadata) {
-                    remove_dir(file, options)
-                } else {
-                    remove_file(file, options)
+    for filename in files {
+        let file = Path::new(filename);
+        had_err = match file.symlink_metadata() {
+            Ok(metadata) => {
+                if metadata.is_dir() {
+                    handle_dir(file, options)
+                } else if is_symlink_dir(&metadata) {
+                    remove_dir(file, options)
+                } else {
+                    remove_file(file, options)
                 }
             }
-            Err(_e) => {
-                // TODO: actually print out the specific error
-                // TODO: When the error is not about missing files
-                // (e.g., permission), even rm -f should fail with
-                // outputting the error, but there's no easy eay.
-                if !options.force {
+            Err(_e) => {
+                // TODO: actually print out the specific error
+                // TODO: When the error is not about missing files
+                // (e.g., permission), even rm -f should fail with
+                // outputting the error, but there's no easy eay.
+                if !options.force {
                     show_error!(
                         "cannot remove {}: No such file or directory",
-                        filename.quote()
+                        filename.quote()
                     );
-                    true
-                } else {
-                    false
-                }
+                    true
+                } else {
+                    false
+                }
             }
         }
-        .bitor(had_err);
+        .bitor(had_err);
     }
 
-    had_err
+    had_err
 }
 
-fn handle_dir(path: &Path, options: &Options) -> bool {
-    let mut had_err = false;
+fn handle_dir(path: &Path, options: &Options) -> bool {
+    let mut had_err = false;
 
-    let is_root = path.has_root() && path.parent().is_none();
-    if options.recursive && (!is_root || !options.preserve_root) {
-        if options.interactive != InteractiveMode::Always && !options.verbose {
-            // we need the extra crate because apparently fs::remove_dir_all() does not function
-            // correctly on Windows
-            if let Err(e) = remove_dir_all(path) {
-                had_err = true;
-                if e.kind() == std::io::ErrorKind::PermissionDenied {
-                    // GNU compatibility (rm/fail-eacces.sh)
-                    // here, GNU doesn't use some kind of remove_dir_all
-                    // It will show directory+file
-                    show_error!("cannot remove {}: {}", path.quote(), "Permission denied");
-                } else {
-                    show_error!("cannot remove {}: {}", path.quote(), e);
+    let is_root = path.has_root() && path.parent().is_none();
+    if options.recursive && (!is_root || !options.preserve_root) {
+        if options.interactive != InteractiveMode::Always && !options.verbose {
+            // we need the extra crate because apparently fs::remove_dir_all() does not function
+            // correctly on Windows
+            if let Err(e) = remove_dir_all(path) {
+                had_err = true;
+                if e.kind() == std::io::ErrorKind::PermissionDenied {
+                    // GNU compatibility (rm/fail-eacces.sh)
+                    // here, GNU doesn't use some kind of remove_dir_all
+                    // It will show directory+file
+                    show_error!("cannot remove {}: {}", path.quote(), "Permission denied");
+                } else {
+                    show_error!("cannot remove {}: {}", path.quote(), e);
                 }
             }
-        } else {
-            let mut dirs: VecDeque<DirEntry> = VecDeque::new();
-            // The Paths to not descend into. We need to this because WalkDir doesn't have a way, afaik, to not descend into a directory
-            // So we have to just ignore paths as they come up if they start with a path we aren't descending into
-            let mut not_descended: Vec<PathBuf> = Vec::new();
+        } else {
+            let mut dirs: VecDeque<DirEntry> = VecDeque::new();
+            // The Paths to not descend into. We need to this because WalkDir doesn't have a way, afaik, to not descend into a directory
+            // So we have to just ignore paths as they come up if they start with a path we aren't descending into
+            let mut not_descended: Vec<PathBuf> = Vec::new();
 
-            'outer: for entry in WalkDir::new(path) {
-                match entry {
-                    Ok(entry) => {
-                        if options.interactive == InteractiveMode::Always {
-                            for not_descend in &not_descended {
-                                if entry.path().starts_with(not_descend) {
-                                    // We don't need to continue the rest of code in this loop if we are in a directory we don't want to descend into
-                                    continue 'outer;
+            'outer: for entry in WalkDir::new(path) {
+                match entry {
+                    Ok(entry) => {
+                        if options.interactive == InteractiveMode::Always {
+                            for not_descend in &not_descended {
+                                if entry.path().starts_with(not_descend) {
+                                    // We don't need to continue the rest of code in this loop if we are in a directory we don't want to descend into
+                                    continue 'outer;
                                 }
                             }
                         }
-                        let file_type = entry.file_type();
-                        if file_type.is_dir() {
-                            // If we are in Interactive Mode Always and the directory isn't empty we ask if we should descend else we push this directory onto dirs vector
-                            if options.interactive == InteractiveMode::Always
-                                && fs::read_dir(entry.path()).unwrap().count() != 0
-                            {
-                                // If we don't descend we push this directory onto our not_descended vector else we push this directory onto dirs vector
-                                if prompt_descend(entry.path()) {
-                                    dirs.push_back(entry);
-                                } else {
-                                    not_descended.push(entry.path().to_path_buf());
+                        let file_type = entry.file_type();
+                        if file_type.is_dir() {
+                            // If we are in Interactive Mode Always and the directory isn't empty we ask if we should descend else we push this directory onto dirs vector
+                            if options.interactive == InteractiveMode::Always
+                                && fs::read_dir(entry.path()).unwrap().count() != 0
+                            {
+                                // If we don't descend we push this directory onto our not_descended vector else we push this directory onto dirs vector
+                                if prompt_descend(entry.path()) {
+                                    dirs.push_back(entry);
+                                } else {
+                                    not_descended.push(entry.path().to_path_buf());
                                 }
-                            } else {
-                                dirs.push_back(entry);
+                            } else {
+                                dirs.push_back(entry);
                             }
-                        } else {
-                            had_err = remove_file(entry.path(), options).bitor(had_err);
+                        } else {
+                            had_err = remove_file(entry.path(), options).bitor(had_err);
                         }
                     }
-                    Err(e) => {
-                        had_err = true;
-                        show_error!("recursing in {}: {}", path.quote(), e);
+                    Err(e) => {
+                        had_err = true;
+                        show_error!("recursing in {}: {}", path.quote(), e);
                     }
                 }
             }
 
-            for dir in dirs.iter().rev() {
-                had_err = remove_dir(dir.path(), options).bitor(had_err);
+            for dir in dirs.iter().rev() {
+                had_err = remove_dir(dir.path(), options).bitor(had_err);
             }
         }
-    } else if options.dir && (!is_root || !options.preserve_root) {
-        had_err = remove_dir(path, options).bitor(had_err);
-    } else if options.recursive {
-        show_error!("could not remove directory {}", path.quote());
-        had_err = true;
-    } else {
+    } else if options.dir && (!is_root || !options.preserve_root) {
+        had_err = remove_dir(path, options).bitor(had_err);
+    } else if options.recursive {
+        show_error!("could not remove directory {}", path.quote());
+        had_err = true;
+    } else {
         show_error!(
-            "cannot remove {}: Is a directory", // GNU's rm error message does not include help
-            path.quote()
+            "cannot remove {}: Is a directory", // GNU's rm error message does not include help
+            path.quote()
         );
-        had_err = true;
+        had_err = true;
     }
 
-    had_err
+    had_err
 }
 
-fn remove_dir(path: &Path, options: &Options) -> bool {
-    if prompt_file(path, options, true) {
-        if let Ok(mut read_dir) = fs::read_dir(path) {
-            if options.dir || options.recursive {
-                if read_dir.next().is_none() {
-                    match fs::remove_dir(path) {
+fn remove_dir(path: &Path, options: &Options) -> bool {
+    if prompt_file(path, options, true) {
+        if let Ok(mut read_dir) = fs::read_dir(path) {
+            if options.dir || options.recursive {
+                if read_dir.next().is_none() {
+                    match fs::remove_dir(path) {
                         Ok(_) => {
-                            if options.verbose {
-                                println!("removed directory {}", normalize(path).quote());
+                            if options.verbose {
+                                println!("removed directory {}", normalize(path).quote());
                             }
                         }
-                        Err(e) => {
-                            if e.kind() == std::io::ErrorKind::PermissionDenied {
-                                // GNU compatibility (rm/fail-eacces.sh)
-                                show_error!(
+                        Err(e) => {
+                            if e.kind() == std::io::ErrorKind::PermissionDenied {
+                                // GNU compatibility (rm/fail-eacces.sh)
+                                show_error!(
                                     "cannot remove {}: {}",
-                                    path.quote(),
-                                    "Permission denied"
-                                );
-                            } else {
-                                show_error!("cannot remove {}: {}", path.quote(), e);
+                                    path.quote(),
+                                    "Permission denied"
+                                );
+                            } else {
+                                show_error!("cannot remove {}: {}", path.quote(), e);
                             }
-                            return true;
+                            return true;
                         }
                     }
-                } else {
-                    // directory can be read but is not empty
-                    show_error!("cannot remove {}: Directory not empty", path.quote());
-                    return true;
+                } else {
+                    // directory can be read but is not empty
+                    show_error!("cannot remove {}: Directory not empty", path.quote());
+                    return true;
                 }
-            } else {
-                // called to remove a symlink_dir (windows) without "-r"/"-R" or "-d"
-                show_error!("cannot remove {}: Is a directory", path.quote());
-                return true;
+            } else {
+                // called to remove a symlink_dir (windows) without "-r"/"-R" or "-d"
+                show_error!("cannot remove {}: Is a directory", path.quote());
+                return true;
             }
-        } else {
-            // GNU's rm shows this message if directory is empty but not readable
-            show_error!("cannot remove {}: Directory not empty", path.quote());
-            return true;
+        } else {
+            // GNU's rm shows this message if directory is empty but not readable
+            show_error!("cannot remove {}: Directory not empty", path.quote());
+            return true;
         }
     }
 
-    false
-}
+    false
+}
 
-fn remove_file(path: &Path, options: &Options) -> bool {
-    if prompt_file(path, options, false) {
-        match fs::remove_file(path) {
+fn remove_file(path: &Path, options: &Options) -> bool {
+    if prompt_file(path, options, false) {
+        match fs::remove_file(path) {
             Ok(_) => {
-                if options.verbose {
-                    println!("removed {}", normalize(path).quote());
+                if options.verbose {
+                    println!("removed {}", normalize(path).quote());
                 }
             }
-            Err(e) => {
-                if e.kind() == std::io::ErrorKind::PermissionDenied {
-                    // GNU compatibility (rm/fail-eacces.sh)
-                    show_error!("cannot remove {}: {}", path.quote(), "Permission denied");
-                } else {
-                    show_error!("cannot remove {}: {}", path.quote(), e);
+            Err(e) => {
+                if e.kind() == std::io::ErrorKind::PermissionDenied {
+                    // GNU compatibility (rm/fail-eacces.sh)
+                    show_error!("cannot remove {}: {}", path.quote(), "Permission denied");
+                } else {
+                    show_error!("cannot remove {}: {}", path.quote(), e);
                 }
-                return true;
+                return true;
             }
         }
     }
 
-    false
-}
+    false
+}
 
-fn prompt_file(path: &Path, options: &Options, is_dir: bool) -> bool {
-    // If interactive is Never we never want to send prompts
-    if options.interactive == InteractiveMode::Never {
-        return true;
+fn prompt_file(path: &Path, options: &Options, is_dir: bool) -> bool {
+    // If interactive is Never we never want to send prompts
+    if options.interactive == InteractiveMode::Never {
+        return true;
     }
-    // If interactive is Always we want to check if the file is symlink to prompt the right message
-    if options.interactive == InteractiveMode::Always {
-        if let Ok(metadata) = fs::symlink_metadata(path) {
-            if metadata.is_symlink() {
-                return prompt(&(format!("remove symbolic link {}? ", path.quote())));
+    // If interactive is Always we want to check if the file is symlink to prompt the right message
+    if options.interactive == InteractiveMode::Always {
+        if let Ok(metadata) = fs::symlink_metadata(path) {
+            if metadata.is_symlink() {
+                return prompt(&(format!("remove symbolic link {}? ", path.quote())));
             }
         }
     }
-    if is_dir {
-        // We can't use metadata.permissions.readonly for directories because it only works on files
-        // So we have to handle wether a directory is writable on not manually
-        if let Ok(metadata) = fs::metadata(path) {
-            handle_writable_directory(path, options, &metadata)
-        } else {
-            true
-        }
-    } else {
-        // File::open(path) doesn't open the file in write mode so we need to use file options to open it in also write mode to check if it can written too
-        match File::options().read(true).write(true).open(path) {
-            Ok(file) => {
-                if let Ok(metadata) = file.metadata() {
-                    if metadata.permissions().readonly() {
-                        if metadata.len() == 0 {
-                            prompt(
+    if is_dir {
+        // We can't use metadata.permissions.readonly for directories because it only works on files
+        // So we have to handle wether a directory is writable on not manually
+        if let Ok(metadata) = fs::metadata(path) {
+            handle_writable_directory(path, options, &metadata)
+        } else {
+            true
+        }
+    } else {
+        // File::open(path) doesn't open the file in write mode so we need to use file options to open it in also write mode to check if it can written too
+        match File::options().read(true).write(true).open(path) {
+            Ok(file) => {
+                if let Ok(metadata) = file.metadata() {
+                    if metadata.permissions().readonly() {
+                        if metadata.len() == 0 {
+                            prompt(
                                 &(format!(
                                     "remove write-protected regular empty file {}? ",
-                                    path.quote()
+                                    path.quote()
                                 )),
                             )
-                        } else {
-                            prompt(
+                        } else {
+                            prompt(
                                 &(format!(
                                     "remove write-protected regular file {}? ",
-                                    path.quote()
+                                    path.quote()
                                 )),
                             )
                         }
-                    } else if options.interactive == InteractiveMode::Always {
-                        if metadata.len() == 0 {
-                            prompt(&(format!("remove regular empty file {}? ", path.quote())))
-                        } else {
-                            prompt(&(format!("remove file {}? ", path.quote())))
+                    } else if options.interactive == InteractiveMode::Always {
+                        if metadata.len() == 0 {
+                            prompt(&(format!("remove regular empty file {}? ", path.quote())))
+                        } else {
+                            prompt(&(format!("remove file {}? ", path.quote())))
                         }
-                    } else {
-                        true
-                    }
-                } else {
-                    true
-                }
+                    } else {
+                        true
+                    }
+                } else {
+                    true
+                }
             }
-            Err(err) => {
-                if err.kind() == ErrorKind::PermissionDenied {
-                    if let Ok(metadata) = fs::metadata(path) {
-                        if metadata.len() == 0 {
-                            prompt(
+            Err(err) => {
+                if err.kind() == ErrorKind::PermissionDenied {
+                    if let Ok(metadata) = fs::metadata(path) {
+                        if metadata.len() == 0 {
+                            prompt(
                                 &(format!(
                                     "remove write-protected regular empty file {}? ",
-                                    path.quote()
+                                    path.quote()
                                 )),
                             )
-                        } else {
-                            prompt(
+                        } else {
+                            prompt(
                                 &(format!(
                                     "remove write-protected regular file {}? ",
-                                    path.quote()
+                                    path.quote()
                                 )),
                             )
                         }
-                    } else {
-                        prompt(&(format!("remove write-protected regular file {}? ", path.quote())))
+                    } else {
+                        prompt(&(format!("remove write-protected regular file {}? ", path.quote())))
                     }
-                } else {
-                    true
-                }
+                } else {
+                    true
+                }
             }
         }
     }
 }
 
-// For directories finding if they are writable or not is a hassle. In Unix we can use the built-in rust crate to to check mode bits. But other os don't have something similar afaik
-// Most cases are covered by keep eye out for edge cases
-#[cfg(unix)]
-fn handle_writable_directory(path: &Path, options: &Options, metadata: &Metadata) -> bool {
-    use std::os::unix::fs::PermissionsExt;
-    let mode = metadata.permissions().mode();
-    // Check if directory has user write permissions
-    // Why is S_IWUSR showing up as a u16 on macos?
-    let user_writable = (mode & (libc::S_IWUSR as u32)) != 0;
-    if !user_writable {
-        prompt(&(format!("remove write-protected directory {}? ", path.quote())))
-    } else if options.interactive == InteractiveMode::Always {
-        prompt(&(format!("remove directory {}? ", path.quote())))
-    } else {
-        true
+// For directories finding if they are writable or not is a hassle. In Unix we can use the built-in rust crate to to check mode bits. But other os don't have something similar afaik
+// Most cases are covered by keep eye out for edge cases
+#[cfg(unix)]
+fn handle_writable_directory(path: &Path, options: &Options, metadata: &Metadata) -> bool {
+    use std::os::unix::fs::PermissionsExt;
+    let mode = metadata.permissions().mode();
+    // Check if directory has user write permissions
+    // Why is S_IWUSR showing up as a u16 on macos?
+    let user_writable = (mode & (libc::S_IWUSR as u32)) != 0;
+    if !user_writable {
+        prompt(&(format!("remove write-protected directory {}? ", path.quote())))
+    } else if options.interactive == InteractiveMode::Always {
+        prompt(&(format!("remove directory {}? ", path.quote())))
+    } else {
+        true
+    }
+}
+
+// For windows we can use windows metadata trait and file attributes to see if a directory is readonly
+#[cfg(windows)]
+fn handle_writable_directory(path: &Path, options: &Options, metadata: &Metadata) -> bool {
+    use std::os::windows::prelude::MetadataExt;
+    use windows_sys::Win32::Storage::FileSystem::FILE_ATTRIBUTE_READONLY;
+    let not_user_writable = (metadata.file_attributes() & FILE_ATTRIBUTE_READONLY) != 0;
+    if not_user_writable {
+        prompt(&(format!("remove write-protected directory {}? ", path.quote())))
+    } else if options.interactive == InteractiveMode::Always {
+        prompt(&(format!("remove directory {}? ", path.quote())))
+    } else {
+        true
+    }
+}
+
+// I have this here for completeness but it will always return "remove directory {}" because metadata.permissions().readonly() only works for file not directories
+#[cfg(not(windows))]
+#[cfg(not(unix))]
+fn handle_writable_directory(path: &Path, options: &Options, metadata: &Metadata) -> bool {
+    if options.interactive == InteractiveMode::Always {
+        prompt(&(format!("remove directory {}? ", path.quote())))
+    } else {
+        true
+    }
+}
+
+fn prompt_descend(path: &Path) -> bool {
+    prompt(&(format!("descend into directory {}? ", path.quote())))
+}
+
+fn normalize(path: &Path) -> PathBuf {
+    // copied from https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90
+    // both projects are MIT https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT
+    // for std impl progress see rfc https://github.com/rust-lang/rfcs/issues/2208
+    // TODO: replace this once that lands
+    uucore::fs::normalize_path(path)
+}
+
+fn prompt(msg: &str) -> bool {
+    let _ = stderr().write_all(format!("{}: {}", uucore::util_name(), msg).as_bytes());
+    let _ = stderr().flush();
+
+    let mut buf = Vec::new();
+    let stdin = stdin();
+    let mut stdin = stdin.lock();
+    let read = stdin.read_until(b'\n', &mut buf);
+    match read {
+        Ok(x) if x > 0 => matches!(buf[0], b'y' | b'Y'),
+        _ => false,
     }
 }
 
-// For windows we can use windows metadata trait and file attributes to see if a directory is readonly
-#[cfg(windows)]
-fn handle_writable_directory(path: &Path, options: &Options, metadata: &Metadata) -> bool {
-    use std::os::windows::prelude::MetadataExt;
-    use windows_sys::Win32::Storage::FileSystem::FILE_ATTRIBUTE_READONLY;
-    let not_user_writable = (metadata.file_attributes() & FILE_ATTRIBUTE_READONLY) != 0;
-    if not_user_writable {
-        prompt(&(format!("remove write-protected directory {}? ", path.quote())))
-    } else if options.interactive == InteractiveMode::Always {
-        prompt(&(format!("remove directory {}? ", path.quote())))
-    } else {
-        true
-    }
-}
+#[cfg(not(windows))]
+fn is_symlink_dir(_metadata: &Metadata) -> bool {
+    false
+}
 
-// I have this here for completeness but it will always return "remove directory {}" because metadata.permissions().readonly() only works for file not directories
-#[cfg(not(windows))]
-#[cfg(not(unix))]
-fn handle_writable_directory(path: &Path, options: &Options, metadata: &Metadata) -> bool {
-    if options.interactive == InteractiveMode::Always {
-        prompt(&(format!("remove directory {}? ", path.quote())))
-    } else {
-        true
-    }
-}
+#[cfg(windows)]
+fn is_symlink_dir(metadata: &Metadata) -> bool {
+    use std::os::windows::prelude::MetadataExt;
+    use windows_sys::Win32::Storage::FileSystem::FILE_ATTRIBUTE_DIRECTORY;
 
-fn prompt_descend(path: &Path) -> bool {
-    prompt(&(format!("descend into directory {}? ", path.quote())))
-}
-
-fn normalize(path: &Path) -> PathBuf {
-    // copied from https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90
-    // both projects are MIT https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT
-    // for std impl progress see rfc https://github.com/rust-lang/rfcs/issues/2208
-    // TODO: replace this once that lands
-    uucore::fs::normalize_path(path)
-}
-
-fn prompt(msg: &str) -> bool {
-    let _ = stderr().write_all(format!("{}: {}", uucore::util_name(), msg).as_bytes());
-    let _ = stderr().flush();
-
-    let mut buf = Vec::new();
-    let stdin = stdin();
-    let mut stdin = stdin.lock();
-    let read = stdin.read_until(b'\n', &mut buf);
-    match read {
-        Ok(x) if x > 0 => matches!(buf[0], b'y' | b'Y'),
-        _ => false,
-    }
-}
-
-#[cfg(not(windows))]
-fn is_symlink_dir(_metadata: &Metadata) -> bool {
-    false
-}
-
-#[cfg(windows)]
-fn is_symlink_dir(metadata: &Metadata) -> bool {
-    use std::os::windows::prelude::MetadataExt;
-    use windows_sys::Win32::Storage::FileSystem::FILE_ATTRIBUTE_DIRECTORY;
-
-    metadata.file_type().is_symlink()
-        && ((metadata.file_attributes() & FILE_ATTRIBUTE_DIRECTORY) != 0)
+    metadata.file_type().is_symlink()
+        && ((metadata.file_attributes() & FILE_ATTRIBUTE_DIRECTORY) != 0)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_rmdir/rmdir.rs.html b/dev/src/uu_rmdir/rmdir.rs.html index 7242a74c3..c4507f95b 100644 --- a/dev/src/uu_rmdir/rmdir.rs.html +++ b/dev/src/uu_rmdir/rmdir.rs.html @@ -1,4 +1,4 @@ -rmdir.rs - source
1
+rmdir.rs - source
1
 2
 3
 4
@@ -204,211 +204,211 @@
 204
 205
 206
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) ENOTDIR
+// spell-checker:ignore (ToDO) ENOTDIR
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::builder::ValueParser;
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::ffi::OsString;
-use std::fs::{read_dir, remove_dir};
-use std::io;
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{set_exit_code, strip_errno, UResult};
+use clap::builder::ValueParser;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::ffi::OsString;
+use std::fs::{read_dir, remove_dir};
+use std::io;
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{set_exit_code, strip_errno, UResult};
 
-use uucore::{format_usage, util_name};
+use uucore::{format_usage, util_name};
 
-static ABOUT: &str = "Remove the DIRECTORY(ies), if they are empty.";
-const USAGE: &str = "{} [OPTION]... DIRECTORY...";
-static OPT_IGNORE_FAIL_NON_EMPTY: &str = "ignore-fail-on-non-empty";
-static OPT_PARENTS: &str = "parents";
-static OPT_VERBOSE: &str = "verbose";
+static ABOUT: &str = "Remove the DIRECTORY(ies), if they are empty.";
+const USAGE: &str = "{} [OPTION]... DIRECTORY...";
+static OPT_IGNORE_FAIL_NON_EMPTY: &str = "ignore-fail-on-non-empty";
+static OPT_PARENTS: &str = "parents";
+static OPT_VERBOSE: &str = "verbose";
 
-static ARG_DIRS: &str = "dirs";
+static ARG_DIRS: &str = "dirs";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let opts = Opts {
-        ignore: matches.get_flag(OPT_IGNORE_FAIL_NON_EMPTY),
-        parents: matches.get_flag(OPT_PARENTS),
-        verbose: matches.get_flag(OPT_VERBOSE),
+    let opts = Opts {
+        ignore: matches.get_flag(OPT_IGNORE_FAIL_NON_EMPTY),
+        parents: matches.get_flag(OPT_PARENTS),
+        verbose: matches.get_flag(OPT_VERBOSE),
     };
 
-    for path in matches
-        .get_many::<OsString>(ARG_DIRS)
-        .unwrap_or_default()
-        .map(Path::new)
+    for path in matches
+        .get_many::<OsString>(ARG_DIRS)
+        .unwrap_or_default()
+        .map(Path::new)
     {
-        if let Err(error) = remove(path, opts) {
-            let Error { error, path } = error;
+        if let Err(error) = remove(path, opts) {
+            let Error { error, path } = error;
 
-            if opts.ignore && dir_not_empty(&error, path) {
+            if opts.ignore && dir_not_empty(&error, path) {
                 continue;
             }
 
-            set_exit_code(1);
+            set_exit_code(1);
 
-            // If `foo` is a symlink to a directory then `rmdir foo/` may give
-            // a "not a directory" error. This is confusing as `rm foo/` says
-            // "is a directory".
-            // This differs from system to system. Some don't give an error.
-            // Windows simply allows calling RemoveDirectory on symlinks so we
-            // don't need to worry about it here.
-            // GNU rmdir seems to print "Symbolic link not followed" if:
-            // - It has a trailing slash
-            // - It's a symlink
-            // - It either points to a directory or dangles
-            #[cfg(unix)]
-            {
-                use std::ffi::OsStr;
-                use std::os::unix::ffi::OsStrExt;
+            // If `foo` is a symlink to a directory then `rmdir foo/` may give
+            // a "not a directory" error. This is confusing as `rm foo/` says
+            // "is a directory".
+            // This differs from system to system. Some don't give an error.
+            // Windows simply allows calling RemoveDirectory on symlinks so we
+            // don't need to worry about it here.
+            // GNU rmdir seems to print "Symbolic link not followed" if:
+            // - It has a trailing slash
+            // - It's a symlink
+            // - It either points to a directory or dangles
+            #[cfg(unix)]
+            {
+                use std::ffi::OsStr;
+                use std::os::unix::ffi::OsStrExt;
 
-                fn points_to_directory(path: &Path) -> io::Result<bool> {
-                    Ok(path.metadata()?.file_type().is_dir())
+                fn points_to_directory(path: &Path) -> io::Result<bool> {
+                    Ok(path.metadata()?.file_type().is_dir())
                 }
 
-                let bytes = path.as_os_str().as_bytes();
-                if error.raw_os_error() == Some(libc::ENOTDIR) && bytes.ends_with(b"/") {
-                    // Strip the trailing slash or .symlink_metadata() will follow the symlink
-                    let no_slash: &Path = OsStr::from_bytes(&bytes[..bytes.len() - 1]).as_ref();
-                    if no_slash.is_symlink() && points_to_directory(no_slash).unwrap_or(true) {
+                let bytes = path.as_os_str().as_bytes();
+                if error.raw_os_error() == Some(libc::ENOTDIR) && bytes.ends_with(b"/") {
+                    // Strip the trailing slash or .symlink_metadata() will follow the symlink
+                    let no_slash: &Path = OsStr::from_bytes(&bytes[..bytes.len() - 1]).as_ref();
+                    if no_slash.is_symlink() && points_to_directory(no_slash).unwrap_or(true) {
                         show_error!(
                             "failed to remove {}: Symbolic link not followed",
-                            path.quote()
+                            path.quote()
                         );
                         continue;
                     }
                 }
             }
 
-            show_error!("failed to remove {}: {}", path.quote(), strip_errno(&error));
+            show_error!("failed to remove {}: {}", path.quote(), strip_errno(&error));
         }
     }
 
     Ok(())
 }
 
-struct Error<'a> {
-    error: io::Error,
-    path: &'a Path,
+struct Error<'a> {
+    error: io::Error,
+    path: &'a Path,
 }
 
-fn remove(mut path: &Path, opts: Opts) -> Result<(), Error<'_>> {
-    remove_single(path, opts)?;
-    if opts.parents {
-        while let Some(new) = path.parent() {
-            path = new;
-            if path.as_os_str() == "" {
+fn remove(mut path: &Path, opts: Opts) -> Result<(), Error<'_>> {
+    remove_single(path, opts)?;
+    if opts.parents {
+        while let Some(new) = path.parent() {
+            path = new;
+            if path.as_os_str() == "" {
                 break;
             }
-            remove_single(path, opts)?;
+            remove_single(path, opts)?;
         }
     }
     Ok(())
 }
 
-fn remove_single(path: &Path, opts: Opts) -> Result<(), Error<'_>> {
-    if opts.verbose {
-        println!("{}: removing directory, {}", util_name(), path.quote());
+fn remove_single(path: &Path, opts: Opts) -> Result<(), Error<'_>> {
+    if opts.verbose {
+        println!("{}: removing directory, {}", util_name(), path.quote());
     }
-    remove_dir(path).map_err(|error| Error { error, path })
+    remove_dir(path).map_err(|error| Error { error, path })
 }
 
-// POSIX: https://pubs.opengroup.org/onlinepubs/009696799/functions/rmdir.html
-#[cfg(not(windows))]
-const NOT_EMPTY_CODES: &[i32] = &[libc::ENOTEMPTY, libc::EEXIST];
+// POSIX: https://pubs.opengroup.org/onlinepubs/009696799/functions/rmdir.html
+#[cfg(not(windows))]
+const NOT_EMPTY_CODES: &[i32] = &[libc::ENOTEMPTY, libc::EEXIST];
 
-// 145 is ERROR_DIR_NOT_EMPTY, determined experimentally.
-#[cfg(windows)]
-const NOT_EMPTY_CODES: &[i32] = &[145];
+// 145 is ERROR_DIR_NOT_EMPTY, determined experimentally.
+#[cfg(windows)]
+const NOT_EMPTY_CODES: &[i32] = &[145];
 
-// Other error codes you might get for directories that could be found and are
-// not empty.
-// This is a subset of the error codes listed in rmdir(2) from the Linux man-pages
-// project. Maybe other systems have additional codes that apply?
-#[cfg(not(windows))]
-const PERHAPS_EMPTY_CODES: &[i32] = &[libc::EACCES, libc::EBUSY, libc::EPERM, libc::EROFS];
+// Other error codes you might get for directories that could be found and are
+// not empty.
+// This is a subset of the error codes listed in rmdir(2) from the Linux man-pages
+// project. Maybe other systems have additional codes that apply?
+#[cfg(not(windows))]
+const PERHAPS_EMPTY_CODES: &[i32] = &[libc::EACCES, libc::EBUSY, libc::EPERM, libc::EROFS];
 
-// Probably incomplete, I can't find a list of possible errors for
-// RemoveDirectory anywhere.
-#[cfg(windows)]
-const PERHAPS_EMPTY_CODES: &[i32] = &[
-    5, // ERROR_ACCESS_DENIED, found experimentally.
-];
+// Probably incomplete, I can't find a list of possible errors for
+// RemoveDirectory anywhere.
+#[cfg(windows)]
+const PERHAPS_EMPTY_CODES: &[i32] = &[
+    5, // ERROR_ACCESS_DENIED, found experimentally.
+];
 
-fn dir_not_empty(error: &io::Error, path: &Path) -> bool {
-    if let Some(code) = error.raw_os_error() {
-        if NOT_EMPTY_CODES.contains(&code) {
-            return true;
+fn dir_not_empty(error: &io::Error, path: &Path) -> bool {
+    if let Some(code) = error.raw_os_error() {
+        if NOT_EMPTY_CODES.contains(&code) {
+            return true;
         }
-        // If --ignore-fail-on-non-empty is used then we want to ignore all errors
-        // for non-empty directories, even if the error was e.g. because there's
-        // no permission. So we do an additional check.
-        if PERHAPS_EMPTY_CODES.contains(&code) {
-            if let Ok(mut iterator) = read_dir(path) {
-                if iterator.next().is_some() {
-                    return true;
+        // If --ignore-fail-on-non-empty is used then we want to ignore all errors
+        // for non-empty directories, even if the error was e.g. because there's
+        // no permission. So we do an additional check.
+        if PERHAPS_EMPTY_CODES.contains(&code) {
+            if let Ok(mut iterator) = read_dir(path) {
+                if iterator.next().is_some() {
+                    return true;
                 }
             }
         }
     }
-    false
+    false
+}
+
+#[derive(Clone, Copy, Debug)]
+struct Opts {
+    ignore: bool,
+    parents: bool,
+    verbose: bool,
 }
 
-#[derive(Clone, Copy, Debug)]
-struct Opts {
-    ignore: bool,
-    parents: bool,
-    verbose: bool,
-}
-
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_IGNORE_FAIL_NON_EMPTY)
-                .long(OPT_IGNORE_FAIL_NON_EMPTY)
-                .help("ignore each failure that is solely because a directory is non-empty")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_IGNORE_FAIL_NON_EMPTY)
+                .long(OPT_IGNORE_FAIL_NON_EMPTY)
+                .help("ignore each failure that is solely because a directory is non-empty")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_PARENTS)
-                .short('p')
-                .long(OPT_PARENTS)
-                .help(
+        .arg(
+            Arg::new(OPT_PARENTS)
+                .short('p')
+                .long(OPT_PARENTS)
+                .help(
                     "remove DIRECTORY and its ancestors; e.g.,
                   'rmdir -p a/b/c' is similar to rmdir a/b/c a/b a",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_VERBOSE)
-                .short('v')
-                .long(OPT_VERBOSE)
-                .help("output a diagnostic for every directory processed")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_VERBOSE)
+                .short('v')
+                .long(OPT_VERBOSE)
+                .help("output a diagnostic for every directory processed")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_DIRS)
-                .action(ArgAction::Append)
-                .num_args(1..)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::DirPath),
+        .arg(
+            Arg::new(ARG_DIRS)
+                .action(ArgAction::Append)
+                .num_args(1..)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::DirPath),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_runcon/errors.rs.html b/dev/src/uu_runcon/errors.rs.html index 547b7a068..3de2b25e6 100644 --- a/dev/src/uu_runcon/errors.rs.html +++ b/dev/src/uu_runcon/errors.rs.html @@ -1,4 +1,4 @@ -errors.rs - source
1
+errors.rs - source
1
 2
 3
 4
@@ -114,121 +114,121 @@
 114
 115
 116
-
use std::ffi::OsString;
-use std::fmt::{Display, Formatter, Write};
-use std::io;
-use std::str::Utf8Error;
+
use std::ffi::OsString;
+use std::fmt::{Display, Formatter, Write};
+use std::io;
+use std::str::Utf8Error;
 
-use uucore::display::Quotable;
-use uucore::error::UError;
+use uucore::display::Quotable;
+use uucore::error::UError;
 
-pub(crate) type Result<T> = std::result::Result<T, Error>;
+pub(crate) type Result<T> = std::result::Result<T, Error>;
 
-// This list is NOT exhaustive. This command might perform an `execvp()` to run
-// a different program. When that happens successfully, the exit status of this
-// process will be the exit status of that program.
-pub(crate) mod error_exit_status {
-    pub const NOT_FOUND: i32 = 127;
-    pub const COULD_NOT_EXECUTE: i32 = 126;
-    pub const ANOTHER_ERROR: i32 = libc::EXIT_FAILURE;
+// This list is NOT exhaustive. This command might perform an `execvp()` to run
+// a different program. When that happens successfully, the exit status of this
+// process will be the exit status of that program.
+pub(crate) mod error_exit_status {
+    pub const NOT_FOUND: i32 = 127;
+    pub const COULD_NOT_EXECUTE: i32 = 126;
+    pub const ANOTHER_ERROR: i32 = libc::EXIT_FAILURE;
 }
 
-#[derive(thiserror::Error, Debug)]
-pub(crate) enum Error {
-    #[error("No command is specified")]
-    MissingCommand,
+#[derive(thiserror::Error, Debug)]
+pub(crate) enum Error {
+    #[error("No command is specified")]
+    MissingCommand,
 
-    #[error("SELinux is not enabled")]
-    SELinuxNotEnabled,
+    #[error("SELinux is not enabled")]
+    SELinuxNotEnabled,
 
-    #[error(transparent)]
-    NotUTF8(#[from] Utf8Error),
+    #[error(transparent)]
+    NotUTF8(#[from] Utf8Error),
 
-    #[error(transparent)]
-    CommandLine(#[from] clap::Error),
+    #[error(transparent)]
+    CommandLine(#[from] clap::Error),
 
-    #[error("{operation} failed")]
-    SELinux {
-        operation: &'static str,
-        source: selinux::errors::Error,
+    #[error("{operation} failed")]
+    SELinux {
+        operation: &'static str,
+        source: selinux::errors::Error,
     },
 
-    #[error("{operation} failed")]
-    Io {
-        operation: &'static str,
-        source: io::Error,
+    #[error("{operation} failed")]
+    Io {
+        operation: &'static str,
+        source: io::Error,
     },
 
-    #[error("{operation} failed on {}", .operand1.quote())]
-    Io1 {
-        operation: &'static str,
-        operand1: OsString,
-        source: io::Error,
+    #[error("{operation} failed on {}", .operand1.quote())]
+    Io1 {
+        operation: &'static str,
+        operand1: OsString,
+        source: io::Error,
     },
 }
 
-impl Error {
-    pub(crate) fn from_io(operation: &'static str, source: io::Error) -> Self {
-        Self::Io { operation, source }
+impl Error {
+    pub(crate) fn from_io(operation: &'static str, source: io::Error) -> Self {
+        Self::Io { operation, source }
     }
 
-    pub(crate) fn from_io1(
-        operation: &'static str,
-        operand1: impl Into<OsString>,
-        source: io::Error,
-    ) -> Self {
-        Self::Io1 {
-            operation,
-            operand1: operand1.into(),
-            source,
+    pub(crate) fn from_io1(
+        operation: &'static str,
+        operand1: impl Into<OsString>,
+        source: io::Error,
+    ) -> Self {
+        Self::Io1 {
+            operation,
+            operand1: operand1.into(),
+            source,
         }
     }
 
-    pub(crate) fn from_selinux(operation: &'static str, source: selinux::errors::Error) -> Self {
-        Self::SELinux { operation, source }
+    pub(crate) fn from_selinux(operation: &'static str, source: selinux::errors::Error) -> Self {
+        Self::SELinux { operation, source }
     }
 }
 
-pub(crate) fn write_full_error<W>(writer: &mut W, err: &dyn std::error::Error) -> std::fmt::Result
-where
-    W: Write,
+pub(crate) fn write_full_error<W>(writer: &mut W, err: &dyn std::error::Error) -> std::fmt::Result
+where
+    W: Write,
 {
-    write!(writer, "{}", err)?;
-    let mut err = err;
-    while let Some(source) = err.source() {
-        err = source;
-        write!(writer, ": {}", err)?;
+    write!(writer, "{}", err)?;
+    let mut err = err;
+    while let Some(source) = err.source() {
+        err = source;
+        write!(writer, ": {}", err)?;
     }
-    write!(writer, ".")?;
+    write!(writer, ".")?;
     Ok(())
 }
 
-#[derive(Debug)]
-pub(crate) struct RunconError {
-    inner: Error,
-    code: i32,
+#[derive(Debug)]
+pub(crate) struct RunconError {
+    inner: Error,
+    code: i32,
 }
 
-impl RunconError {
-    pub(crate) fn new(e: Error) -> Self {
-        Self::with_code(error_exit_status::ANOTHER_ERROR, e)
+impl RunconError {
+    pub(crate) fn new(e: Error) -> Self {
+        Self::with_code(error_exit_status::ANOTHER_ERROR, e)
     }
 
-    pub(crate) fn with_code(code: i32, e: Error) -> Self {
-        Self { inner: e, code }
+    pub(crate) fn with_code(code: i32, e: Error) -> Self {
+        Self { inner: e, code }
     }
 }
 
-impl std::error::Error for RunconError {}
-impl UError for RunconError {
-    fn code(&self) -> i32 {
-        self.code
+impl std::error::Error for RunconError {}
+impl UError for RunconError {
+    fn code(&self) -> i32 {
+        self.code
     }
 }
-impl Display for RunconError {
-    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
-        write_full_error(f, &self.inner)
+impl Display for RunconError {
+    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
+        write_full_error(f, &self.inner)
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_runcon/runcon.rs.html b/dev/src/uu_runcon/runcon.rs.html index 5796eea09..40dbe2909 100644 --- a/dev/src/uu_runcon/runcon.rs.html +++ b/dev/src/uu_runcon/runcon.rs.html @@ -1,4 +1,4 @@ -runcon.rs - source
1
+runcon.rs - source
1
 2
 3
 4
@@ -418,32 +418,32 @@
 418
 419
 420
-
// spell-checker:ignore (vars) RFILE
+
// spell-checker:ignore (vars) RFILE
 
-use clap::builder::ValueParser;
-use uucore::error::{UResult, UUsageError};
+use clap::builder::ValueParser;
+use uucore::error::{UResult, UUsageError};
 
-use clap::{Arg, ArgAction, Command};
-use selinux::{OpaqueSecurityContext, SecurityClass, SecurityContext};
-use uucore::format_usage;
+use clap::{Arg, ArgAction, Command};
+use selinux::{OpaqueSecurityContext, SecurityClass, SecurityContext};
+use uucore::format_usage;
 
-use std::borrow::Cow;
-use std::ffi::{CStr, CString, OsStr, OsString};
-use std::os::raw::c_char;
-use std::os::unix::ffi::OsStrExt;
-use std::{io, ptr};
+use std::borrow::Cow;
+use std::ffi::{CStr, CString, OsStr, OsString};
+use std::os::raw::c_char;
+use std::os::unix::ffi::OsStrExt;
+use std::{io, ptr};
 
-mod errors;
+mod errors;
 
-use errors::error_exit_status;
-use errors::{Error, Result, RunconError};
+use errors::error_exit_status;
+use errors::{Error, Result, RunconError};
 
-const VERSION: &str = env!("CARGO_PKG_VERSION");
-const ABOUT: &str = "Run command with specified security context.";
-const USAGE: &str = "\
+const VERSION: &str = env!("CARGO_PKG_VERSION");
+const ABOUT: &str = "Run command with specified security context.";
+const USAGE: &str = "\
     {} [CONTEXT COMMAND [ARG...]]
     {} [-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] COMMAND [ARG...]";
-const DESCRIPTION: &str = "Run COMMAND with completely-specified CONTEXT, or with current or \
+const DESCRIPTION: &str = "Run COMMAND with completely-specified CONTEXT, or with current or \
                       transitioned security context modified by one or more of \
                       LEVEL, ROLE, TYPE, and USER.\n\n\
                       If none of --compute, --type, --user, --role or --range is specified, \
@@ -452,391 +452,391 @@
                       With neither CONTEXT nor COMMAND are specified, \
                       then this prints the current security context.";
 
-pub mod options {
-    pub const COMPUTE: &str = "compute";
+pub mod options {
+    pub const COMPUTE: &str = "compute";
 
-    pub const USER: &str = "user";
-    pub const ROLE: &str = "role";
-    pub const TYPE: &str = "type";
-    pub const RANGE: &str = "range";
+    pub const USER: &str = "user";
+    pub const ROLE: &str = "role";
+    pub const TYPE: &str = "type";
+    pub const RANGE: &str = "range";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let config = uu_app();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let config = uu_app();
 
-    let options = match parse_command_line(config, args) {
-        Ok(r) => r,
-        Err(r) => {
-            if let Error::CommandLine(ref r) = r {
-                match r.kind() {
-                    clap::error::ErrorKind::DisplayHelp
-                    | clap::error::ErrorKind::DisplayVersion => {
-                        println!("{}", r);
-                        return Ok(());
+    let options = match parse_command_line(config, args) {
+        Ok(r) => r,
+        Err(r) => {
+            if let Error::CommandLine(ref r) = r {
+                match r.kind() {
+                    clap::error::ErrorKind::DisplayHelp
+                    | clap::error::ErrorKind::DisplayVersion => {
+                        println!("{}", r);
+                        return Ok(());
                     }
-                    _ => {}
+                    _ => {}
                 }
             }
-            return Err(UUsageError::new(
-                error_exit_status::ANOTHER_ERROR,
-                format!("{}", r),
+            return Err(UUsageError::new(
+                error_exit_status::ANOTHER_ERROR,
+                format!("{}", r),
             ));
         }
     };
 
-    match &options.mode {
-        CommandLineMode::Print => print_current_context().map_err(|e| RunconError::new(e).into()),
-        CommandLineMode::PlainContext { context, command } => {
-            get_plain_context(context)
-                .and_then(|ctx| set_next_exec_context(&ctx))
-                .map_err(RunconError::new)?;
-            // On successful execution, the following call never returns,
-            // and this process image is replaced.
-            execute_command(command, &options.arguments)
+    match &options.mode {
+        CommandLineMode::Print => print_current_context().map_err(|e| RunconError::new(e).into()),
+        CommandLineMode::PlainContext { context, command } => {
+            get_plain_context(context)
+                .and_then(|ctx| set_next_exec_context(&ctx))
+                .map_err(RunconError::new)?;
+            // On successful execution, the following call never returns,
+            // and this process image is replaced.
+            execute_command(command, &options.arguments)
         }
-        CommandLineMode::CustomContext {
-            compute_transition_context,
-            user,
-            role,
-            the_type,
-            range,
-            command,
+        CommandLineMode::CustomContext {
+            compute_transition_context,
+            user,
+            role,
+            the_type,
+            range,
+            command,
         } => {
-            match command {
-                Some(command) => {
-                    get_custom_context(
-                        *compute_transition_context,
-                        user.as_deref(),
-                        role.as_deref(),
-                        the_type.as_deref(),
-                        range.as_deref(),
-                        command,
+            match command {
+                Some(command) => {
+                    get_custom_context(
+                        *compute_transition_context,
+                        user.as_deref(),
+                        role.as_deref(),
+                        the_type.as_deref(),
+                        range.as_deref(),
+                        command,
                     )
-                    .and_then(|ctx| set_next_exec_context(&ctx))
-                    .map_err(RunconError::new)?;
-                    // On successful execution, the following call never returns,
-                    // and this process image is replaced.
-                    execute_command(command, &options.arguments)
+                    .and_then(|ctx| set_next_exec_context(&ctx))
+                    .map_err(RunconError::new)?;
+                    // On successful execution, the following call never returns,
+                    // and this process image is replaced.
+                    execute_command(command, &options.arguments)
                 }
-                None => print_current_context().map_err(|e| RunconError::new(e).into()),
+                None => print_current_context().map_err(|e| RunconError::new(e).into()),
             }
         }
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(VERSION)
-        .about(ABOUT)
-        .after_help(DESCRIPTION)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::COMPUTE)
-                .short('c')
-                .long(options::COMPUTE)
-                .help("Compute process transition context before modifying.")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(VERSION)
+        .about(ABOUT)
+        .after_help(DESCRIPTION)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::COMPUTE)
+                .short('c')
+                .long(options::COMPUTE)
+                .help("Compute process transition context before modifying.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::USER)
-                .short('u')
-                .long(options::USER)
-                .value_name("USER")
-                .help("Set user USER in the target security context.")
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new(options::USER)
+                .short('u')
+                .long(options::USER)
+                .value_name("USER")
+                .help("Set user USER in the target security context.")
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(options::ROLE)
-                .short('r')
-                .long(options::ROLE)
-                .value_name("ROLE")
-                .help("Set role ROLE in the target security context.")
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new(options::ROLE)
+                .short('r')
+                .long(options::ROLE)
+                .value_name("ROLE")
+                .help("Set role ROLE in the target security context.")
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(options::TYPE)
-                .short('t')
-                .long(options::TYPE)
-                .value_name("TYPE")
-                .help("Set type TYPE in the target security context.")
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new(options::TYPE)
+                .short('t')
+                .long(options::TYPE)
+                .value_name("TYPE")
+                .help("Set type TYPE in the target security context.")
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(options::RANGE)
-                .short('l')
-                .long(options::RANGE)
-                .value_name("RANGE")
-                .help("Set range RANGE in the target security context.")
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new(options::RANGE)
+                .short('l')
+                .long(options::RANGE)
+                .value_name("RANGE")
+                .help("Set range RANGE in the target security context.")
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new("ARG")
-                .action(ArgAction::Append)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::CommandName),
+        .arg(
+            Arg::new("ARG")
+                .action(ArgAction::Append)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::CommandName),
         )
-        // Once "ARG" is parsed, everything after that belongs to it.
-        //
-        // This is not how POSIX does things, but this is how the GNU implementation
-        // parses its command line.
-        .trailing_var_arg(true)
+        // Once "ARG" is parsed, everything after that belongs to it.
+        //
+        // This is not how POSIX does things, but this is how the GNU implementation
+        // parses its command line.
+        .trailing_var_arg(true)
 }
 
-#[derive(Debug)]
-enum CommandLineMode {
-    Print,
+#[derive(Debug)]
+enum CommandLineMode {
+    Print,
 
-    PlainContext {
-        context: OsString,
-        command: OsString,
+    PlainContext {
+        context: OsString,
+        command: OsString,
     },
 
-    CustomContext {
-        /// Compute process transition context before modifying.
-        compute_transition_context: bool,
+    CustomContext {
+        /// Compute process transition context before modifying.
+        compute_transition_context: bool,
 
-        /// Use the current context with the specified user.
-        user: Option<OsString>,
+        /// Use the current context with the specified user.
+        user: Option<OsString>,
 
-        /// Use the current context with the specified role.
-        role: Option<OsString>,
+        /// Use the current context with the specified role.
+        role: Option<OsString>,
 
-        /// Use the current context with the specified type.
-        the_type: Option<OsString>,
+        /// Use the current context with the specified type.
+        the_type: Option<OsString>,
 
-        /// Use the current context with the specified range.
-        range: Option<OsString>,
+        /// Use the current context with the specified range.
+        range: Option<OsString>,
 
-        // `command` can be `None`, in which case we're dealing with this syntax:
-        // runcon [-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE]
-        //
-        // This syntax is undocumented, but it is accepted by the GNU implementation,
-        // so we do the same for compatibility.
-        command: Option<OsString>,
+        // `command` can be `None`, in which case we're dealing with this syntax:
+        // runcon [-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE]
+        //
+        // This syntax is undocumented, but it is accepted by the GNU implementation,
+        // so we do the same for compatibility.
+        command: Option<OsString>,
     },
 }
 
-#[derive(Debug)]
-struct Options {
-    mode: CommandLineMode,
-    arguments: Vec<OsString>,
+#[derive(Debug)]
+struct Options {
+    mode: CommandLineMode,
+    arguments: Vec<OsString>,
 }
 
-fn parse_command_line(config: Command, args: impl uucore::Args) -> Result<Options> {
-    let matches = config.try_get_matches_from(args)?;
+fn parse_command_line(config: Command, args: impl uucore::Args) -> Result<Options> {
+    let matches = config.try_get_matches_from(args)?;
 
-    let compute_transition_context = matches.get_flag(options::COMPUTE);
+    let compute_transition_context = matches.get_flag(options::COMPUTE);
 
-    let mut args = matches
-        .get_many::<OsString>("ARG")
-        .unwrap_or_default()
-        .map(OsString::from);
+    let mut args = matches
+        .get_many::<OsString>("ARG")
+        .unwrap_or_default()
+        .map(OsString::from);
 
-    if compute_transition_context
-        || matches.contains_id(options::USER)
-        || matches.contains_id(options::ROLE)
-        || matches.contains_id(options::TYPE)
-        || matches.contains_id(options::RANGE)
+    if compute_transition_context
+        || matches.contains_id(options::USER)
+        || matches.contains_id(options::ROLE)
+        || matches.contains_id(options::TYPE)
+        || matches.contains_id(options::RANGE)
     {
-        // runcon [-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] [COMMAND [args]]
+        // runcon [-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] [COMMAND [args]]
 
-        let mode = CommandLineMode::CustomContext {
-            compute_transition_context,
-            user: matches.get_one::<OsString>(options::USER).map(Into::into),
-            role: matches.get_one::<OsString>(options::ROLE).map(Into::into),
-            the_type: matches.get_one::<OsString>(options::TYPE).map(Into::into),
-            range: matches.get_one::<OsString>(options::RANGE).map(Into::into),
-            command: args.next(),
+        let mode = CommandLineMode::CustomContext {
+            compute_transition_context,
+            user: matches.get_one::<OsString>(options::USER).map(Into::into),
+            role: matches.get_one::<OsString>(options::ROLE).map(Into::into),
+            the_type: matches.get_one::<OsString>(options::TYPE).map(Into::into),
+            range: matches.get_one::<OsString>(options::RANGE).map(Into::into),
+            command: args.next(),
         };
 
-        Ok(Options {
-            mode,
-            arguments: args.collect(),
+        Ok(Options {
+            mode,
+            arguments: args.collect(),
         })
-    } else if let Some(context) = args.next() {
-        // runcon CONTEXT COMMAND [args]
+    } else if let Some(context) = args.next() {
+        // runcon CONTEXT COMMAND [args]
 
-        args.next()
-            .ok_or(Error::MissingCommand)
-            .map(move |command| Options {
-                mode: CommandLineMode::PlainContext { context, command },
-                arguments: args.collect(),
+        args.next()
+            .ok_or(Error::MissingCommand)
+            .map(move |command| Options {
+                mode: CommandLineMode::PlainContext { context, command },
+                arguments: args.collect(),
             })
-    } else {
-        // runcon
+    } else {
+        // runcon
 
-        Ok(Options {
-            mode: CommandLineMode::Print,
-            arguments: Vec::default(),
+        Ok(Options {
+            mode: CommandLineMode::Print,
+            arguments: Vec::default(),
         })
     }
 }
 
-fn print_current_context() -> Result<()> {
-    let op = "Getting security context of the current process";
-    let context = SecurityContext::current(false).map_err(|r| Error::from_selinux(op, r))?;
+fn print_current_context() -> Result<()> {
+    let op = "Getting security context of the current process";
+    let context = SecurityContext::current(false).map_err(|r| Error::from_selinux(op, r))?;
 
-    let context = context
-        .to_c_string()
-        .map_err(|r| Error::from_selinux(op, r))?;
+    let context = context
+        .to_c_string()
+        .map_err(|r| Error::from_selinux(op, r))?;
 
-    if let Some(context) = context {
-        let context = context.as_ref().to_str()?;
-        println!("{}", context);
-    } else {
+    if let Some(context) = context {
+        let context = context.as_ref().to_str()?;
+        println!("{}", context);
+    } else {
         println!();
     }
     Ok(())
 }
 
-fn set_next_exec_context(context: &OpaqueSecurityContext) -> Result<()> {
-    let c_context = context
-        .to_c_string()
-        .map_err(|r| Error::from_selinux("Creating new context", r))?;
+fn set_next_exec_context(context: &OpaqueSecurityContext) -> Result<()> {
+    let c_context = context
+        .to_c_string()
+        .map_err(|r| Error::from_selinux("Creating new context", r))?;
 
-    let sc = SecurityContext::from_c_str(&c_context, false);
+    let sc = SecurityContext::from_c_str(&c_context, false);
 
-    if sc.check() != Some(true) {
-        let ctx = OsStr::from_bytes(c_context.as_bytes());
-        let err = io::ErrorKind::InvalidInput.into();
-        return Err(Error::from_io1("Checking security context", ctx, err));
+    if sc.check() != Some(true) {
+        let ctx = OsStr::from_bytes(c_context.as_bytes());
+        let err = io::ErrorKind::InvalidInput.into();
+        return Err(Error::from_io1("Checking security context", ctx, err));
     }
 
-    sc.set_for_next_exec()
-        .map_err(|r| Error::from_selinux("Setting new security context", r))
+    sc.set_for_next_exec()
+        .map_err(|r| Error::from_selinux("Setting new security context", r))
 }
 
-fn get_plain_context(context: &OsStr) -> Result<OpaqueSecurityContext> {
-    if selinux::kernel_support() == selinux::KernelSupport::Unsupported {
-        return Err(Error::SELinuxNotEnabled);
+fn get_plain_context(context: &OsStr) -> Result<OpaqueSecurityContext> {
+    if selinux::kernel_support() == selinux::KernelSupport::Unsupported {
+        return Err(Error::SELinuxNotEnabled);
     }
 
-    let c_context = os_str_to_c_string(context)?;
+    let c_context = os_str_to_c_string(context)?;
 
-    OpaqueSecurityContext::from_c_str(&c_context)
-        .map_err(|r| Error::from_selinux("Creating new context", r))
+    OpaqueSecurityContext::from_c_str(&c_context)
+        .map_err(|r| Error::from_selinux("Creating new context", r))
 }
 
-fn get_transition_context(command: &OsStr) -> Result<SecurityContext> {
-    // Generate context based on process transition.
-    let sec_class = SecurityClass::from_name("process")
-        .map_err(|r| Error::from_selinux("Getting process security class", r))?;
+fn get_transition_context(command: &OsStr) -> Result<SecurityContext> {
+    // Generate context based on process transition.
+    let sec_class = SecurityClass::from_name("process")
+        .map_err(|r| Error::from_selinux("Getting process security class", r))?;
 
-    // Get context of file to be executed.
-    let file_context = match SecurityContext::of_path(command, true, false) {
-        Ok(Some(context)) => context,
+    // Get context of file to be executed.
+    let file_context = match SecurityContext::of_path(command, true, false) {
+        Ok(Some(context)) => context,
 
         Ok(None) => {
-            let err = io::Error::from_raw_os_error(libc::ENODATA);
-            return Err(Error::from_io1("getfilecon", command, err));
+            let err = io::Error::from_raw_os_error(libc::ENODATA);
+            return Err(Error::from_io1("getfilecon", command, err));
         }
 
-        Err(r) => {
-            let op = "Getting security context of command file";
-            return Err(Error::from_selinux(op, r));
+        Err(r) => {
+            let op = "Getting security context of command file";
+            return Err(Error::from_selinux(op, r));
         }
     };
 
-    let process_context = SecurityContext::current(false)
-        .map_err(|r| Error::from_selinux("Getting security context of the current process", r))?;
+    let process_context = SecurityContext::current(false)
+        .map_err(|r| Error::from_selinux("Getting security context of the current process", r))?;
 
-    // Compute result of process transition.
-    process_context
-        .of_labeling_decision(&file_context, sec_class, "")
-        .map_err(|r| Error::from_selinux("Computing result of process transition", r))
+    // Compute result of process transition.
+    process_context
+        .of_labeling_decision(&file_context, sec_class, "")
+        .map_err(|r| Error::from_selinux("Computing result of process transition", r))
 }
 
-fn get_initial_custom_opaque_context(
-    compute_transition_context: bool,
-    command: &OsStr,
-) -> Result<OpaqueSecurityContext> {
-    let context = if compute_transition_context {
-        get_transition_context(command)?
-    } else {
-        SecurityContext::current(false).map_err(|r| {
-            Error::from_selinux("Getting security context of the current process", r)
-        })?
-    };
+fn get_initial_custom_opaque_context(
+    compute_transition_context: bool,
+    command: &OsStr,
+) -> Result<OpaqueSecurityContext> {
+    let context = if compute_transition_context {
+        get_transition_context(command)?
+    } else {
+        SecurityContext::current(false).map_err(|r| {
+            Error::from_selinux("Getting security context of the current process", r)
+        })?
+    };
 
-    let c_context = context
-        .to_c_string()
-        .map_err(|r| Error::from_selinux("Getting security context", r))?
-        .unwrap_or_else(|| Cow::Owned(CString::default()));
+    let c_context = context
+        .to_c_string()
+        .map_err(|r| Error::from_selinux("Getting security context", r))?
+        .unwrap_or_else(|| Cow::Owned(CString::default()));
 
-    OpaqueSecurityContext::from_c_str(c_context.as_ref())
-        .map_err(|r| Error::from_selinux("Creating new context", r))
+    OpaqueSecurityContext::from_c_str(c_context.as_ref())
+        .map_err(|r| Error::from_selinux("Creating new context", r))
 }
 
-fn get_custom_context(
-    compute_transition_context: bool,
-    user: Option<&OsStr>,
-    role: Option<&OsStr>,
-    the_type: Option<&OsStr>,
-    range: Option<&OsStr>,
-    command: &OsStr,
-) -> Result<OpaqueSecurityContext> {
-    use OpaqueSecurityContext as OSC;
-    type SetNewValueProc = fn(&OSC, &CStr) -> selinux::errors::Result<()>;
+fn get_custom_context(
+    compute_transition_context: bool,
+    user: Option<&OsStr>,
+    role: Option<&OsStr>,
+    the_type: Option<&OsStr>,
+    range: Option<&OsStr>,
+    command: &OsStr,
+) -> Result<OpaqueSecurityContext> {
+    use OpaqueSecurityContext as OSC;
+    type SetNewValueProc = fn(&OSC, &CStr) -> selinux::errors::Result<()>;
 
-    if selinux::kernel_support() == selinux::KernelSupport::Unsupported {
-        return Err(Error::SELinuxNotEnabled);
+    if selinux::kernel_support() == selinux::KernelSupport::Unsupported {
+        return Err(Error::SELinuxNotEnabled);
     }
 
-    let osc = get_initial_custom_opaque_context(compute_transition_context, command)?;
+    let osc = get_initial_custom_opaque_context(compute_transition_context, command)?;
 
-    let list: &[(Option<&OsStr>, SetNewValueProc, &'static str)] = &[
-        (user, OSC::set_user, "Setting security context user"),
-        (role, OSC::set_role, "Setting security context role"),
-        (the_type, OSC::set_type, "Setting security context type"),
-        (range, OSC::set_range, "Setting security context range"),
+    let list: &[(Option<&OsStr>, SetNewValueProc, &'static str)] = &[
+        (user, OSC::set_user, "Setting security context user"),
+        (role, OSC::set_role, "Setting security context role"),
+        (the_type, OSC::set_type, "Setting security context type"),
+        (range, OSC::set_range, "Setting security context range"),
     ];
 
-    for &(new_value, method, op) in list {
-        if let Some(new_value) = new_value {
-            let c_new_value = os_str_to_c_string(new_value)?;
-            method(&osc, &c_new_value).map_err(|r| Error::from_selinux(op, r))?;
+    for &(new_value, method, op) in list {
+        if let Some(new_value) = new_value {
+            let c_new_value = os_str_to_c_string(new_value)?;
+            method(&osc, &c_new_value).map_err(|r| Error::from_selinux(op, r))?;
         }
     }
-    Ok(osc)
+    Ok(osc)
 }
 
-/// The actual return type of this function should be `UResult<!>`.
-/// However, until the *never* type is stabilized, one way to indicate to the
-/// compiler the only valid return type is to say "if this returns, it will
-/// always return an error".
-fn execute_command(command: &OsStr, arguments: &[OsString]) -> UResult<()> {
-    let c_command = os_str_to_c_string(command).map_err(RunconError::new)?;
+/// The actual return type of this function should be `UResult<!>`.
+/// However, until the *never* type is stabilized, one way to indicate to the
+/// compiler the only valid return type is to say "if this returns, it will
+/// always return an error".
+fn execute_command(command: &OsStr, arguments: &[OsString]) -> UResult<()> {
+    let c_command = os_str_to_c_string(command).map_err(RunconError::new)?;
 
-    let argv_storage: Vec<CString> = arguments
-        .iter()
-        .map(AsRef::as_ref)
-        .map(os_str_to_c_string)
-        .collect::<Result<_>>()
-        .map_err(RunconError::new)?;
+    let argv_storage: Vec<CString> = arguments
+        .iter()
+        .map(AsRef::as_ref)
+        .map(os_str_to_c_string)
+        .collect::<Result<_>>()
+        .map_err(RunconError::new)?;
 
-    let mut argv: Vec<*const c_char> = Vec::with_capacity(arguments.len().saturating_add(2));
-    argv.push(c_command.as_ptr());
-    argv.extend(argv_storage.iter().map(AsRef::as_ref).map(CStr::as_ptr));
-    argv.push(ptr::null());
+    let mut argv: Vec<*const c_char> = Vec::with_capacity(arguments.len().saturating_add(2));
+    argv.push(c_command.as_ptr());
+    argv.extend(argv_storage.iter().map(AsRef::as_ref).map(CStr::as_ptr));
+    argv.push(ptr::null());
 
-    unsafe { libc::execvp(c_command.as_ptr(), argv.as_ptr()) };
+    unsafe { libc::execvp(c_command.as_ptr(), argv.as_ptr()) };
 
-    let err = io::Error::last_os_error();
-    let exit_status = if err.kind() == io::ErrorKind::NotFound {
-        error_exit_status::NOT_FOUND
-    } else {
-        error_exit_status::COULD_NOT_EXECUTE
+    let err = io::Error::last_os_error();
+    let exit_status = if err.kind() == io::ErrorKind::NotFound {
+        error_exit_status::NOT_FOUND
+    } else {
+        error_exit_status::COULD_NOT_EXECUTE
     };
 
-    let err = Error::from_io1("Executing command", command, err);
-    Err(RunconError::with_code(exit_status, err).into())
+    let err = Error::from_io1("Executing command", command, err);
+    Err(RunconError::with_code(exit_status, err).into())
 }
 
-fn os_str_to_c_string(s: &OsStr) -> Result<CString> {
-    CString::new(s.as_bytes())
-        .map_err(|_r| Error::from_io("CString::new()", io::ErrorKind::InvalidInput.into()))
+fn os_str_to_c_string(s: &OsStr) -> Result<CString> {
+    CString::new(s.as_bytes())
+        .map_err(|_r| Error::from_io("CString::new()", io::ErrorKind::InvalidInput.into()))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_seq/error.rs.html b/dev/src/uu_seq/error.rs.html index afe9d165d..414ad5fe4 100644 --- a/dev/src/uu_seq/error.rs.html +++ b/dev/src/uu_seq/error.rs.html @@ -1,4 +1,4 @@ -error.rs - source
1
+error.rs - source
1
 2
 3
 4
@@ -66,73 +66,73 @@
 66
 67
 68
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore numberparse argtype
-//! Errors returned by seq.
-use std::error::Error;
-use std::fmt::Display;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore numberparse argtype
+//! Errors returned by seq.
+use std::error::Error;
+use std::fmt::Display;
 
-use uucore::display::Quotable;
-use uucore::error::UError;
+use uucore::display::Quotable;
+use uucore::error::UError;
 
-use crate::numberparse::ParseNumberError;
+use crate::numberparse::ParseNumberError;
 
-#[derive(Debug)]
-pub enum SeqError {
-    /// An error parsing the input arguments.
-    ///
-    /// The parameters are the [`String`] argument as read from the
-    /// command line and the underlying parsing error itself.
-    ParseError(String, ParseNumberError),
+#[derive(Debug)]
+pub enum SeqError {
+    /// An error parsing the input arguments.
+    ///
+    /// The parameters are the [`String`] argument as read from the
+    /// command line and the underlying parsing error itself.
+    ParseError(String, ParseNumberError),
 
-    /// The increment argument was zero, which is not allowed.
-    ///
-    /// The parameter is the increment argument as a [`String`] as read
-    /// from the command line.
-    ZeroIncrement(String),
+    /// The increment argument was zero, which is not allowed.
+    ///
+    /// The parameter is the increment argument as a [`String`] as read
+    /// from the command line.
+    ZeroIncrement(String),
 }
 
-impl SeqError {
-    /// The [`String`] argument as read from the command-line.
-    fn arg(&self) -> &str {
-        match self {
-            Self::ParseError(s, _) => s,
-            Self::ZeroIncrement(s) => s,
+impl SeqError {
+    /// The [`String`] argument as read from the command-line.
+    fn arg(&self) -> &str {
+        match self {
+            Self::ParseError(s, _) => s,
+            Self::ZeroIncrement(s) => s,
         }
     }
 
-    /// The type of argument that is causing the error.
-    fn argtype(&self) -> &str {
-        match self {
-            Self::ParseError(_, e) => match e {
-                ParseNumberError::Float => "floating point argument",
-                ParseNumberError::Nan => "'not-a-number' argument",
-                ParseNumberError::Hex => "hexadecimal argument",
+    /// The type of argument that is causing the error.
+    fn argtype(&self) -> &str {
+        match self {
+            Self::ParseError(_, e) => match e {
+                ParseNumberError::Float => "floating point argument",
+                ParseNumberError::Nan => "'not-a-number' argument",
+                ParseNumberError::Hex => "hexadecimal argument",
             },
-            Self::ZeroIncrement(_) => "Zero increment value",
+            Self::ZeroIncrement(_) => "Zero increment value",
         }
     }
 }
-impl UError for SeqError {
-    /// Always return 1.
-    fn code(&self) -> i32 {
-        1
-    }
+impl UError for SeqError {
+    /// Always return 1.
+    fn code(&self) -> i32 {
+        1
+    }
 
-    fn usage(&self) -> bool {
-        true
-    }
+    fn usage(&self) -> bool {
+        true
+    }
 }
 
-impl Error for SeqError {}
+impl Error for SeqError {}
 
-impl Display for SeqError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        write!(f, "invalid {}: {}", self.argtype(), self.arg().quote())
+impl Display for SeqError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        write!(f, "invalid {}: {}", self.argtype(), self.arg().quote())
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_seq/extendedbigdecimal.rs.html b/dev/src/uu_seq/extendedbigdecimal.rs.html index 5b19994f2..eee06afb0 100644 --- a/dev/src/uu_seq/extendedbigdecimal.rs.html +++ b/dev/src/uu_seq/extendedbigdecimal.rs.html @@ -1,4 +1,4 @@ -extendedbigdecimal.rs - source
1
+extendedbigdecimal.rs - source
1
 2
 3
 4
@@ -276,283 +276,283 @@
 276
 277
 278
-
// spell-checker:ignore bigdecimal extendedbigdecimal extendedbigint
-//! An arbitrary precision float that can also represent infinity, NaN, etc.
-//!
-//! The finite values are stored as [`BigDecimal`] instances. Because
-//! the `bigdecimal` library does not represent infinity, NaN, etc., we
-//! need to represent them explicitly ourselves. The
-//! [`ExtendedBigDecimal`] enumeration does that.
-//!
-//! # Examples
-//!
-//! Addition works for [`ExtendedBigDecimal`] as it does for floats. For
-//! example, adding infinity to any finite value results in infinity:
-//!
-//! ```rust,ignore
-//! let summand1 = ExtendedBigDecimal::BigDecimal(BigDecimal::zero());
-//! let summand2 = ExtendedBigDecimal::Infinity;
-//! assert_eq!(summand1 + summand2, ExtendedBigDecimal::Infinity);
-//! ```
-use std::cmp::Ordering;
-use std::fmt::Display;
-use std::ops::Add;
+
// spell-checker:ignore bigdecimal extendedbigdecimal extendedbigint
+//! An arbitrary precision float that can also represent infinity, NaN, etc.
+//!
+//! The finite values are stored as [`BigDecimal`] instances. Because
+//! the `bigdecimal` library does not represent infinity, NaN, etc., we
+//! need to represent them explicitly ourselves. The
+//! [`ExtendedBigDecimal`] enumeration does that.
+//!
+//! # Examples
+//!
+//! Addition works for [`ExtendedBigDecimal`] as it does for floats. For
+//! example, adding infinity to any finite value results in infinity:
+//!
+//! ```rust,ignore
+//! let summand1 = ExtendedBigDecimal::BigDecimal(BigDecimal::zero());
+//! let summand2 = ExtendedBigDecimal::Infinity;
+//! assert_eq!(summand1 + summand2, ExtendedBigDecimal::Infinity);
+//! ```
+use std::cmp::Ordering;
+use std::fmt::Display;
+use std::ops::Add;
 
-use bigdecimal::BigDecimal;
-use num_bigint::BigInt;
-use num_bigint::ToBigInt;
-use num_traits::One;
-use num_traits::Zero;
+use bigdecimal::BigDecimal;
+use num_bigint::BigInt;
+use num_bigint::ToBigInt;
+use num_traits::One;
+use num_traits::Zero;
 
-use crate::extendedbigint::ExtendedBigInt;
+use crate::extendedbigint::ExtendedBigInt;
 
-#[derive(Debug, Clone)]
-pub enum ExtendedBigDecimal {
-    /// Arbitrary precision floating point number.
-    BigDecimal(BigDecimal),
+#[derive(Debug, Clone)]
+pub enum ExtendedBigDecimal {
+    /// Arbitrary precision floating point number.
+    BigDecimal(BigDecimal),
 
-    /// Floating point positive infinity.
-    ///
-    /// This is represented as its own enumeration member instead of as
-    /// a [`BigDecimal`] because the `bigdecimal` library does not
-    /// support infinity, see [here][0].
-    ///
-    /// [0]: https://github.com/akubera/bigdecimal-rs/issues/67
-    Infinity,
+    /// Floating point positive infinity.
+    ///
+    /// This is represented as its own enumeration member instead of as
+    /// a [`BigDecimal`] because the `bigdecimal` library does not
+    /// support infinity, see [here][0].
+    ///
+    /// [0]: https://github.com/akubera/bigdecimal-rs/issues/67
+    Infinity,
 
-    /// Floating point negative infinity.
-    ///
-    /// This is represented as its own enumeration member instead of as
-    /// a [`BigDecimal`] because the `bigdecimal` library does not
-    /// support infinity, see [here][0].
-    ///
-    /// [0]: https://github.com/akubera/bigdecimal-rs/issues/67
-    MinusInfinity,
+    /// Floating point negative infinity.
+    ///
+    /// This is represented as its own enumeration member instead of as
+    /// a [`BigDecimal`] because the `bigdecimal` library does not
+    /// support infinity, see [here][0].
+    ///
+    /// [0]: https://github.com/akubera/bigdecimal-rs/issues/67
+    MinusInfinity,
 
-    /// Floating point negative zero.
-    ///
-    /// This is represented as its own enumeration member instead of as
-    /// a [`BigDecimal`] because the `bigdecimal` library does not
-    /// support negative zero.
-    MinusZero,
+    /// Floating point negative zero.
+    ///
+    /// This is represented as its own enumeration member instead of as
+    /// a [`BigDecimal`] because the `bigdecimal` library does not
+    /// support negative zero.
+    MinusZero,
 
-    /// Floating point NaN.
-    ///
-    /// This is represented as its own enumeration member instead of as
-    /// a [`BigDecimal`] because the `bigdecimal` library does not
-    /// support NaN, see [here][0].
-    ///
-    /// [0]: https://github.com/akubera/bigdecimal-rs/issues/67
-    Nan,
+    /// Floating point NaN.
+    ///
+    /// This is represented as its own enumeration member instead of as
+    /// a [`BigDecimal`] because the `bigdecimal` library does not
+    /// support NaN, see [here][0].
+    ///
+    /// [0]: https://github.com/akubera/bigdecimal-rs/issues/67
+    Nan,
 }
 
-/// The smallest integer greater than or equal to this number.
-fn ceil(x: BigDecimal) -> BigInt {
-    if x.is_integer() {
-        // Unwrapping the Option because it always returns Some
-        x.to_bigint().unwrap()
-    } else {
-        (x + BigDecimal::one().half()).round(0).to_bigint().unwrap()
+/// The smallest integer greater than or equal to this number.
+fn ceil(x: BigDecimal) -> BigInt {
+    if x.is_integer() {
+        // Unwrapping the Option because it always returns Some
+        x.to_bigint().unwrap()
+    } else {
+        (x + BigDecimal::one().half()).round(0).to_bigint().unwrap()
     }
 }
 
-/// The largest integer less than or equal to this number.
-fn floor(x: BigDecimal) -> BigInt {
-    if x.is_integer() {
-        // Unwrapping the Option because it always returns Some
-        x.to_bigint().unwrap()
-    } else {
-        (x - BigDecimal::one().half()).round(0).to_bigint().unwrap()
+/// The largest integer less than or equal to this number.
+fn floor(x: BigDecimal) -> BigInt {
+    if x.is_integer() {
+        // Unwrapping the Option because it always returns Some
+        x.to_bigint().unwrap()
+    } else {
+        (x - BigDecimal::one().half()).round(0).to_bigint().unwrap()
     }
 }
 
-impl ExtendedBigDecimal {
-    /// The smallest integer greater than or equal to this number.
-    pub fn ceil(self) -> ExtendedBigInt {
-        match self {
-            Self::BigDecimal(x) => ExtendedBigInt::BigInt(ceil(x)),
-            other => From::from(other),
+impl ExtendedBigDecimal {
+    /// The smallest integer greater than or equal to this number.
+    pub fn ceil(self) -> ExtendedBigInt {
+        match self {
+            Self::BigDecimal(x) => ExtendedBigInt::BigInt(ceil(x)),
+            other => From::from(other),
         }
     }
 
-    /// The largest integer less than or equal to this number.
-    pub fn floor(self) -> ExtendedBigInt {
-        match self {
-            Self::BigDecimal(x) => ExtendedBigInt::BigInt(floor(x)),
-            other => From::from(other),
+    /// The largest integer less than or equal to this number.
+    pub fn floor(self) -> ExtendedBigInt {
+        match self {
+            Self::BigDecimal(x) => ExtendedBigInt::BigInt(floor(x)),
+            other => From::from(other),
         }
     }
 }
 
-impl From<ExtendedBigInt> for ExtendedBigDecimal {
-    fn from(big_int: ExtendedBigInt) -> Self {
-        match big_int {
-            ExtendedBigInt::BigInt(n) => Self::BigDecimal(BigDecimal::from(n)),
-            ExtendedBigInt::Infinity => Self::Infinity,
-            ExtendedBigInt::MinusInfinity => Self::MinusInfinity,
-            ExtendedBigInt::MinusZero => Self::MinusZero,
-            ExtendedBigInt::Nan => Self::Nan,
+impl From<ExtendedBigInt> for ExtendedBigDecimal {
+    fn from(big_int: ExtendedBigInt) -> Self {
+        match big_int {
+            ExtendedBigInt::BigInt(n) => Self::BigDecimal(BigDecimal::from(n)),
+            ExtendedBigInt::Infinity => Self::Infinity,
+            ExtendedBigInt::MinusInfinity => Self::MinusInfinity,
+            ExtendedBigInt::MinusZero => Self::MinusZero,
+            ExtendedBigInt::Nan => Self::Nan,
         }
     }
 }
 
-impl Display for ExtendedBigDecimal {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::BigDecimal(x) => {
-                let (n, p) = x.as_bigint_and_exponent();
-                match p {
-                    0 => Self::BigDecimal(BigDecimal::new(n * 10, 1)).fmt(f),
-                    _ => x.fmt(f),
+impl Display for ExtendedBigDecimal {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::BigDecimal(x) => {
+                let (n, p) = x.as_bigint_and_exponent();
+                match p {
+                    0 => Self::BigDecimal(BigDecimal::new(n * 10, 1)).fmt(f),
+                    _ => x.fmt(f),
                 }
             }
-            Self::Infinity => f32::INFINITY.fmt(f),
-            Self::MinusInfinity => f32::NEG_INFINITY.fmt(f),
-            Self::MinusZero => (-0.0f32).fmt(f),
-            Self::Nan => "nan".fmt(f),
+            Self::Infinity => f32::INFINITY.fmt(f),
+            Self::MinusInfinity => f32::NEG_INFINITY.fmt(f),
+            Self::MinusZero => (-0.0f32).fmt(f),
+            Self::Nan => "nan".fmt(f),
         }
     }
 }
 
-impl Zero for ExtendedBigDecimal {
-    fn zero() -> Self {
-        Self::BigDecimal(BigDecimal::zero())
+impl Zero for ExtendedBigDecimal {
+    fn zero() -> Self {
+        Self::BigDecimal(BigDecimal::zero())
     }
-    fn is_zero(&self) -> bool {
-        match self {
-            Self::BigDecimal(n) => n.is_zero(),
-            Self::MinusZero => true,
-            _ => false,
+    fn is_zero(&self) -> bool {
+        match self {
+            Self::BigDecimal(n) => n.is_zero(),
+            Self::MinusZero => true,
+            _ => false,
         }
     }
 }
 
-impl Add for ExtendedBigDecimal {
-    type Output = Self;
+impl Add for ExtendedBigDecimal {
+    type Output = Self;
 
-    fn add(self, other: Self) -> Self {
-        match (self, other) {
-            (Self::BigDecimal(m), Self::BigDecimal(n)) => Self::BigDecimal(m.add(n)),
-            (Self::BigDecimal(_), Self::MinusInfinity) => Self::MinusInfinity,
-            (Self::BigDecimal(_), Self::Infinity) => Self::Infinity,
-            (Self::BigDecimal(_), Self::Nan) => Self::Nan,
-            (Self::BigDecimal(m), Self::MinusZero) => Self::BigDecimal(m),
-            (Self::Infinity, Self::BigDecimal(_)) => Self::Infinity,
-            (Self::Infinity, Self::Infinity) => Self::Infinity,
-            (Self::Infinity, Self::MinusZero) => Self::Infinity,
-            (Self::Infinity, Self::MinusInfinity) => Self::Nan,
-            (Self::Infinity, Self::Nan) => Self::Nan,
-            (Self::MinusInfinity, Self::BigDecimal(_)) => Self::MinusInfinity,
-            (Self::MinusInfinity, Self::MinusInfinity) => Self::MinusInfinity,
-            (Self::MinusInfinity, Self::MinusZero) => Self::MinusInfinity,
-            (Self::MinusInfinity, Self::Infinity) => Self::Nan,
-            (Self::MinusInfinity, Self::Nan) => Self::Nan,
-            (Self::Nan, _) => Self::Nan,
-            (Self::MinusZero, other) => other,
+    fn add(self, other: Self) -> Self {
+        match (self, other) {
+            (Self::BigDecimal(m), Self::BigDecimal(n)) => Self::BigDecimal(m.add(n)),
+            (Self::BigDecimal(_), Self::MinusInfinity) => Self::MinusInfinity,
+            (Self::BigDecimal(_), Self::Infinity) => Self::Infinity,
+            (Self::BigDecimal(_), Self::Nan) => Self::Nan,
+            (Self::BigDecimal(m), Self::MinusZero) => Self::BigDecimal(m),
+            (Self::Infinity, Self::BigDecimal(_)) => Self::Infinity,
+            (Self::Infinity, Self::Infinity) => Self::Infinity,
+            (Self::Infinity, Self::MinusZero) => Self::Infinity,
+            (Self::Infinity, Self::MinusInfinity) => Self::Nan,
+            (Self::Infinity, Self::Nan) => Self::Nan,
+            (Self::MinusInfinity, Self::BigDecimal(_)) => Self::MinusInfinity,
+            (Self::MinusInfinity, Self::MinusInfinity) => Self::MinusInfinity,
+            (Self::MinusInfinity, Self::MinusZero) => Self::MinusInfinity,
+            (Self::MinusInfinity, Self::Infinity) => Self::Nan,
+            (Self::MinusInfinity, Self::Nan) => Self::Nan,
+            (Self::Nan, _) => Self::Nan,
+            (Self::MinusZero, other) => other,
         }
     }
 }
 
-impl PartialEq for ExtendedBigDecimal {
-    fn eq(&self, other: &Self) -> bool {
-        match (self, other) {
-            (Self::BigDecimal(m), Self::BigDecimal(n)) => m.eq(n),
-            (Self::BigDecimal(_), Self::MinusInfinity) => false,
-            (Self::BigDecimal(_), Self::Infinity) => false,
-            (Self::BigDecimal(_), Self::Nan) => false,
-            (Self::BigDecimal(_), Self::MinusZero) => false,
-            (Self::Infinity, Self::BigDecimal(_)) => false,
-            (Self::Infinity, Self::Infinity) => true,
-            (Self::Infinity, Self::MinusZero) => false,
-            (Self::Infinity, Self::MinusInfinity) => false,
-            (Self::Infinity, Self::Nan) => false,
-            (Self::MinusInfinity, Self::BigDecimal(_)) => false,
-            (Self::MinusInfinity, Self::Infinity) => false,
-            (Self::MinusInfinity, Self::MinusZero) => false,
-            (Self::MinusInfinity, Self::MinusInfinity) => true,
-            (Self::MinusInfinity, Self::Nan) => false,
-            (Self::Nan, _) => false,
-            (Self::MinusZero, Self::BigDecimal(_)) => false,
-            (Self::MinusZero, Self::Infinity) => false,
-            (Self::MinusZero, Self::MinusZero) => true,
-            (Self::MinusZero, Self::MinusInfinity) => false,
-            (Self::MinusZero, Self::Nan) => false,
+impl PartialEq for ExtendedBigDecimal {
+    fn eq(&self, other: &Self) -> bool {
+        match (self, other) {
+            (Self::BigDecimal(m), Self::BigDecimal(n)) => m.eq(n),
+            (Self::BigDecimal(_), Self::MinusInfinity) => false,
+            (Self::BigDecimal(_), Self::Infinity) => false,
+            (Self::BigDecimal(_), Self::Nan) => false,
+            (Self::BigDecimal(_), Self::MinusZero) => false,
+            (Self::Infinity, Self::BigDecimal(_)) => false,
+            (Self::Infinity, Self::Infinity) => true,
+            (Self::Infinity, Self::MinusZero) => false,
+            (Self::Infinity, Self::MinusInfinity) => false,
+            (Self::Infinity, Self::Nan) => false,
+            (Self::MinusInfinity, Self::BigDecimal(_)) => false,
+            (Self::MinusInfinity, Self::Infinity) => false,
+            (Self::MinusInfinity, Self::MinusZero) => false,
+            (Self::MinusInfinity, Self::MinusInfinity) => true,
+            (Self::MinusInfinity, Self::Nan) => false,
+            (Self::Nan, _) => false,
+            (Self::MinusZero, Self::BigDecimal(_)) => false,
+            (Self::MinusZero, Self::Infinity) => false,
+            (Self::MinusZero, Self::MinusZero) => true,
+            (Self::MinusZero, Self::MinusInfinity) => false,
+            (Self::MinusZero, Self::Nan) => false,
         }
     }
 }
 
-impl PartialOrd for ExtendedBigDecimal {
-    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
-        match (self, other) {
-            (Self::BigDecimal(m), Self::BigDecimal(n)) => m.partial_cmp(n),
-            (Self::BigDecimal(_), Self::MinusInfinity) => Some(Ordering::Greater),
-            (Self::BigDecimal(_), Self::Infinity) => Some(Ordering::Less),
-            (Self::BigDecimal(_), Self::Nan) => None,
-            (Self::BigDecimal(m), Self::MinusZero) => m.partial_cmp(&BigDecimal::zero()),
-            (Self::Infinity, Self::BigDecimal(_)) => Some(Ordering::Greater),
-            (Self::Infinity, Self::Infinity) => Some(Ordering::Equal),
-            (Self::Infinity, Self::MinusZero) => Some(Ordering::Greater),
-            (Self::Infinity, Self::MinusInfinity) => Some(Ordering::Greater),
-            (Self::Infinity, Self::Nan) => None,
-            (Self::MinusInfinity, Self::BigDecimal(_)) => Some(Ordering::Less),
-            (Self::MinusInfinity, Self::Infinity) => Some(Ordering::Less),
-            (Self::MinusInfinity, Self::MinusZero) => Some(Ordering::Less),
-            (Self::MinusInfinity, Self::MinusInfinity) => Some(Ordering::Equal),
-            (Self::MinusInfinity, Self::Nan) => None,
-            (Self::Nan, _) => None,
-            (Self::MinusZero, Self::BigDecimal(n)) => BigDecimal::zero().partial_cmp(n),
-            (Self::MinusZero, Self::Infinity) => Some(Ordering::Less),
-            (Self::MinusZero, Self::MinusZero) => Some(Ordering::Equal),
-            (Self::MinusZero, Self::MinusInfinity) => Some(Ordering::Greater),
-            (Self::MinusZero, Self::Nan) => None,
+impl PartialOrd for ExtendedBigDecimal {
+    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+        match (self, other) {
+            (Self::BigDecimal(m), Self::BigDecimal(n)) => m.partial_cmp(n),
+            (Self::BigDecimal(_), Self::MinusInfinity) => Some(Ordering::Greater),
+            (Self::BigDecimal(_), Self::Infinity) => Some(Ordering::Less),
+            (Self::BigDecimal(_), Self::Nan) => None,
+            (Self::BigDecimal(m), Self::MinusZero) => m.partial_cmp(&BigDecimal::zero()),
+            (Self::Infinity, Self::BigDecimal(_)) => Some(Ordering::Greater),
+            (Self::Infinity, Self::Infinity) => Some(Ordering::Equal),
+            (Self::Infinity, Self::MinusZero) => Some(Ordering::Greater),
+            (Self::Infinity, Self::MinusInfinity) => Some(Ordering::Greater),
+            (Self::Infinity, Self::Nan) => None,
+            (Self::MinusInfinity, Self::BigDecimal(_)) => Some(Ordering::Less),
+            (Self::MinusInfinity, Self::Infinity) => Some(Ordering::Less),
+            (Self::MinusInfinity, Self::MinusZero) => Some(Ordering::Less),
+            (Self::MinusInfinity, Self::MinusInfinity) => Some(Ordering::Equal),
+            (Self::MinusInfinity, Self::Nan) => None,
+            (Self::Nan, _) => None,
+            (Self::MinusZero, Self::BigDecimal(n)) => BigDecimal::zero().partial_cmp(n),
+            (Self::MinusZero, Self::Infinity) => Some(Ordering::Less),
+            (Self::MinusZero, Self::MinusZero) => Some(Ordering::Equal),
+            (Self::MinusZero, Self::MinusInfinity) => Some(Ordering::Greater),
+            (Self::MinusZero, Self::Nan) => None,
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use bigdecimal::BigDecimal;
-    use num_traits::Zero;
+    use bigdecimal::BigDecimal;
+    use num_traits::Zero;
 
-    use crate::extendedbigdecimal::ExtendedBigDecimal;
+    use crate::extendedbigdecimal::ExtendedBigDecimal;
 
-    #[test]
-    fn test_addition_infinity() {
-        let summand1 = ExtendedBigDecimal::BigDecimal(BigDecimal::zero());
-        let summand2 = ExtendedBigDecimal::Infinity;
-        assert_eq!(summand1 + summand2, ExtendedBigDecimal::Infinity);
+    #[test]
+    fn test_addition_infinity() {
+        let summand1 = ExtendedBigDecimal::BigDecimal(BigDecimal::zero());
+        let summand2 = ExtendedBigDecimal::Infinity;
+        assert_eq!(summand1 + summand2, ExtendedBigDecimal::Infinity);
     }
 
-    #[test]
-    fn test_addition_minus_infinity() {
-        let summand1 = ExtendedBigDecimal::BigDecimal(BigDecimal::zero());
-        let summand2 = ExtendedBigDecimal::MinusInfinity;
-        assert_eq!(summand1 + summand2, ExtendedBigDecimal::MinusInfinity);
+    #[test]
+    fn test_addition_minus_infinity() {
+        let summand1 = ExtendedBigDecimal::BigDecimal(BigDecimal::zero());
+        let summand2 = ExtendedBigDecimal::MinusInfinity;
+        assert_eq!(summand1 + summand2, ExtendedBigDecimal::MinusInfinity);
     }
 
-    #[test]
-    fn test_addition_nan() {
-        let summand1 = ExtendedBigDecimal::BigDecimal(BigDecimal::zero());
-        let summand2 = ExtendedBigDecimal::Nan;
-        let sum = summand1 + summand2;
-        match sum {
-            ExtendedBigDecimal::Nan => (),
-            _ => unreachable!(),
+    #[test]
+    fn test_addition_nan() {
+        let summand1 = ExtendedBigDecimal::BigDecimal(BigDecimal::zero());
+        let summand2 = ExtendedBigDecimal::Nan;
+        let sum = summand1 + summand2;
+        match sum {
+            ExtendedBigDecimal::Nan => (),
+            _ => unreachable!(),
         }
     }
 
-    #[test]
-    fn test_display() {
+    #[test]
+    fn test_display() {
         assert_eq!(
-            format!("{}", ExtendedBigDecimal::BigDecimal(BigDecimal::zero())),
-            "0.0"
-        );
-        assert_eq!(format!("{}", ExtendedBigDecimal::Infinity), "inf");
-        assert_eq!(format!("{}", ExtendedBigDecimal::MinusInfinity), "-inf");
-        assert_eq!(format!("{}", ExtendedBigDecimal::Nan), "nan");
-        assert_eq!(format!("{}", ExtendedBigDecimal::MinusZero), "-0");
+            format!("{}", ExtendedBigDecimal::BigDecimal(BigDecimal::zero())),
+            "0.0"
+        );
+        assert_eq!(format!("{}", ExtendedBigDecimal::Infinity), "inf");
+        assert_eq!(format!("{}", ExtendedBigDecimal::MinusInfinity), "-inf");
+        assert_eq!(format!("{}", ExtendedBigDecimal::Nan), "nan");
+        assert_eq!(format!("{}", ExtendedBigDecimal::MinusZero), "-0");
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_seq/extendedbigint.rs.html b/dev/src/uu_seq/extendedbigint.rs.html index c52ff77ae..573d3a1c4 100644 --- a/dev/src/uu_seq/extendedbigint.rs.html +++ b/dev/src/uu_seq/extendedbigint.rs.html @@ -1,4 +1,4 @@ -extendedbigint.rs - source
1
+extendedbigint.rs - source
1
 2
 3
 4
@@ -216,223 +216,223 @@
 216
 217
 218
-
// spell-checker:ignore bigint extendedbigint extendedbigdecimal
-//! An arbitrary precision integer that can also represent infinity, NaN, etc.
-//!
-//! Usually infinity, NaN, and negative zero are only represented for
-//! floating point numbers. The [`ExtendedBigInt`] enumeration provides
-//! a representation of those things with the set of integers. The
-//! finite values are stored as [`BigInt`] instances.
-//!
-//! # Examples
-//!
-//! Addition works for [`ExtendedBigInt`] as it does for floats. For
-//! example, adding infinity to any finite value results in infinity:
-//!
-//! ```rust,ignore
-//! let summand1 = ExtendedBigInt::BigInt(BigInt::zero());
-//! let summand2 = ExtendedBigInt::Infinity;
-//! assert_eq!(summand1 + summand2, ExtendedBigInt::Infinity);
-//! ```
-use std::cmp::Ordering;
-use std::fmt::Display;
-use std::ops::Add;
+
// spell-checker:ignore bigint extendedbigint extendedbigdecimal
+//! An arbitrary precision integer that can also represent infinity, NaN, etc.
+//!
+//! Usually infinity, NaN, and negative zero are only represented for
+//! floating point numbers. The [`ExtendedBigInt`] enumeration provides
+//! a representation of those things with the set of integers. The
+//! finite values are stored as [`BigInt`] instances.
+//!
+//! # Examples
+//!
+//! Addition works for [`ExtendedBigInt`] as it does for floats. For
+//! example, adding infinity to any finite value results in infinity:
+//!
+//! ```rust,ignore
+//! let summand1 = ExtendedBigInt::BigInt(BigInt::zero());
+//! let summand2 = ExtendedBigInt::Infinity;
+//! assert_eq!(summand1 + summand2, ExtendedBigInt::Infinity);
+//! ```
+use std::cmp::Ordering;
+use std::fmt::Display;
+use std::ops::Add;
 
-use num_bigint::BigInt;
-use num_bigint::ToBigInt;
-use num_traits::One;
-use num_traits::Zero;
+use num_bigint::BigInt;
+use num_bigint::ToBigInt;
+use num_traits::One;
+use num_traits::Zero;
 
-use crate::extendedbigdecimal::ExtendedBigDecimal;
+use crate::extendedbigdecimal::ExtendedBigDecimal;
 
-#[derive(Debug, Clone)]
-pub enum ExtendedBigInt {
-    BigInt(BigInt),
-    Infinity,
-    MinusInfinity,
-    MinusZero,
-    Nan,
+#[derive(Debug, Clone)]
+pub enum ExtendedBigInt {
+    BigInt(BigInt),
+    Infinity,
+    MinusInfinity,
+    MinusZero,
+    Nan,
 }
 
-impl ExtendedBigInt {
-    /// The integer number one.
-    pub fn one() -> Self {
-        // We would like to implement `num_traits::One`, but it requires
-        // a multiplication implementation, and we don't want to
-        // implement that here.
-        Self::BigInt(BigInt::one())
+impl ExtendedBigInt {
+    /// The integer number one.
+    pub fn one() -> Self {
+        // We would like to implement `num_traits::One`, but it requires
+        // a multiplication implementation, and we don't want to
+        // implement that here.
+        Self::BigInt(BigInt::one())
     }
 }
 
-impl From<ExtendedBigDecimal> for ExtendedBigInt {
-    fn from(big_decimal: ExtendedBigDecimal) -> Self {
-        match big_decimal {
-            // TODO When can this fail?
-            ExtendedBigDecimal::BigDecimal(x) => Self::BigInt(x.to_bigint().unwrap()),
-            ExtendedBigDecimal::Infinity => Self::Infinity,
-            ExtendedBigDecimal::MinusInfinity => Self::MinusInfinity,
-            ExtendedBigDecimal::MinusZero => Self::MinusZero,
-            ExtendedBigDecimal::Nan => Self::Nan,
+impl From<ExtendedBigDecimal> for ExtendedBigInt {
+    fn from(big_decimal: ExtendedBigDecimal) -> Self {
+        match big_decimal {
+            // TODO When can this fail?
+            ExtendedBigDecimal::BigDecimal(x) => Self::BigInt(x.to_bigint().unwrap()),
+            ExtendedBigDecimal::Infinity => Self::Infinity,
+            ExtendedBigDecimal::MinusInfinity => Self::MinusInfinity,
+            ExtendedBigDecimal::MinusZero => Self::MinusZero,
+            ExtendedBigDecimal::Nan => Self::Nan,
         }
     }
 }
 
-impl Display for ExtendedBigInt {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::BigInt(n) => n.fmt(f),
-            Self::Infinity => f32::INFINITY.fmt(f),
-            Self::MinusInfinity => f32::NEG_INFINITY.fmt(f),
-            Self::MinusZero => {
-                // FIXME Come up with a way of formatting this with a
-                // "-" prefix.
-                0.fmt(f)
+impl Display for ExtendedBigInt {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::BigInt(n) => n.fmt(f),
+            Self::Infinity => f32::INFINITY.fmt(f),
+            Self::MinusInfinity => f32::NEG_INFINITY.fmt(f),
+            Self::MinusZero => {
+                // FIXME Come up with a way of formatting this with a
+                // "-" prefix.
+                0.fmt(f)
             }
-            Self::Nan => "nan".fmt(f),
+            Self::Nan => "nan".fmt(f),
         }
     }
 }
 
-impl Zero for ExtendedBigInt {
-    fn zero() -> Self {
-        Self::BigInt(BigInt::zero())
+impl Zero for ExtendedBigInt {
+    fn zero() -> Self {
+        Self::BigInt(BigInt::zero())
     }
-    fn is_zero(&self) -> bool {
-        match self {
-            Self::BigInt(n) => n.is_zero(),
-            Self::MinusZero => true,
-            _ => false,
+    fn is_zero(&self) -> bool {
+        match self {
+            Self::BigInt(n) => n.is_zero(),
+            Self::MinusZero => true,
+            _ => false,
         }
     }
 }
 
-impl Add for ExtendedBigInt {
-    type Output = Self;
+impl Add for ExtendedBigInt {
+    type Output = Self;
 
-    fn add(self, other: Self) -> Self {
-        match (self, other) {
-            (Self::BigInt(m), Self::BigInt(n)) => Self::BigInt(m.add(n)),
-            (Self::BigInt(_), Self::MinusInfinity) => Self::MinusInfinity,
-            (Self::BigInt(_), Self::Infinity) => Self::Infinity,
-            (Self::BigInt(_), Self::Nan) => Self::Nan,
-            (Self::BigInt(m), Self::MinusZero) => Self::BigInt(m),
-            (Self::Infinity, Self::BigInt(_)) => Self::Infinity,
-            (Self::Infinity, Self::Infinity) => Self::Infinity,
-            (Self::Infinity, Self::MinusZero) => Self::Infinity,
-            (Self::Infinity, Self::MinusInfinity) => Self::Nan,
-            (Self::Infinity, Self::Nan) => Self::Nan,
-            (Self::MinusInfinity, Self::BigInt(_)) => Self::MinusInfinity,
-            (Self::MinusInfinity, Self::MinusInfinity) => Self::MinusInfinity,
-            (Self::MinusInfinity, Self::MinusZero) => Self::MinusInfinity,
-            (Self::MinusInfinity, Self::Infinity) => Self::Nan,
-            (Self::MinusInfinity, Self::Nan) => Self::Nan,
-            (Self::Nan, _) => Self::Nan,
-            (Self::MinusZero, other) => other,
+    fn add(self, other: Self) -> Self {
+        match (self, other) {
+            (Self::BigInt(m), Self::BigInt(n)) => Self::BigInt(m.add(n)),
+            (Self::BigInt(_), Self::MinusInfinity) => Self::MinusInfinity,
+            (Self::BigInt(_), Self::Infinity) => Self::Infinity,
+            (Self::BigInt(_), Self::Nan) => Self::Nan,
+            (Self::BigInt(m), Self::MinusZero) => Self::BigInt(m),
+            (Self::Infinity, Self::BigInt(_)) => Self::Infinity,
+            (Self::Infinity, Self::Infinity) => Self::Infinity,
+            (Self::Infinity, Self::MinusZero) => Self::Infinity,
+            (Self::Infinity, Self::MinusInfinity) => Self::Nan,
+            (Self::Infinity, Self::Nan) => Self::Nan,
+            (Self::MinusInfinity, Self::BigInt(_)) => Self::MinusInfinity,
+            (Self::MinusInfinity, Self::MinusInfinity) => Self::MinusInfinity,
+            (Self::MinusInfinity, Self::MinusZero) => Self::MinusInfinity,
+            (Self::MinusInfinity, Self::Infinity) => Self::Nan,
+            (Self::MinusInfinity, Self::Nan) => Self::Nan,
+            (Self::Nan, _) => Self::Nan,
+            (Self::MinusZero, other) => other,
         }
     }
 }
 
-impl PartialEq for ExtendedBigInt {
-    fn eq(&self, other: &Self) -> bool {
-        match (self, other) {
-            (Self::BigInt(m), Self::BigInt(n)) => m.eq(n),
-            (Self::BigInt(_), Self::MinusInfinity) => false,
-            (Self::BigInt(_), Self::Infinity) => false,
-            (Self::BigInt(_), Self::Nan) => false,
-            (Self::BigInt(_), Self::MinusZero) => false,
-            (Self::Infinity, Self::BigInt(_)) => false,
-            (Self::Infinity, Self::Infinity) => true,
-            (Self::Infinity, Self::MinusZero) => false,
-            (Self::Infinity, Self::MinusInfinity) => false,
-            (Self::Infinity, Self::Nan) => false,
-            (Self::MinusInfinity, Self::BigInt(_)) => false,
-            (Self::MinusInfinity, Self::Infinity) => false,
-            (Self::MinusInfinity, Self::MinusZero) => false,
-            (Self::MinusInfinity, Self::MinusInfinity) => true,
-            (Self::MinusInfinity, Self::Nan) => false,
-            (Self::Nan, _) => false,
-            (Self::MinusZero, Self::BigInt(_)) => false,
-            (Self::MinusZero, Self::Infinity) => false,
-            (Self::MinusZero, Self::MinusZero) => true,
-            (Self::MinusZero, Self::MinusInfinity) => false,
-            (Self::MinusZero, Self::Nan) => false,
+impl PartialEq for ExtendedBigInt {
+    fn eq(&self, other: &Self) -> bool {
+        match (self, other) {
+            (Self::BigInt(m), Self::BigInt(n)) => m.eq(n),
+            (Self::BigInt(_), Self::MinusInfinity) => false,
+            (Self::BigInt(_), Self::Infinity) => false,
+            (Self::BigInt(_), Self::Nan) => false,
+            (Self::BigInt(_), Self::MinusZero) => false,
+            (Self::Infinity, Self::BigInt(_)) => false,
+            (Self::Infinity, Self::Infinity) => true,
+            (Self::Infinity, Self::MinusZero) => false,
+            (Self::Infinity, Self::MinusInfinity) => false,
+            (Self::Infinity, Self::Nan) => false,
+            (Self::MinusInfinity, Self::BigInt(_)) => false,
+            (Self::MinusInfinity, Self::Infinity) => false,
+            (Self::MinusInfinity, Self::MinusZero) => false,
+            (Self::MinusInfinity, Self::MinusInfinity) => true,
+            (Self::MinusInfinity, Self::Nan) => false,
+            (Self::Nan, _) => false,
+            (Self::MinusZero, Self::BigInt(_)) => false,
+            (Self::MinusZero, Self::Infinity) => false,
+            (Self::MinusZero, Self::MinusZero) => true,
+            (Self::MinusZero, Self::MinusInfinity) => false,
+            (Self::MinusZero, Self::Nan) => false,
         }
     }
 }
 
-impl PartialOrd for ExtendedBigInt {
-    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
-        match (self, other) {
-            (Self::BigInt(m), Self::BigInt(n)) => m.partial_cmp(n),
-            (Self::BigInt(_), Self::MinusInfinity) => Some(Ordering::Greater),
-            (Self::BigInt(_), Self::Infinity) => Some(Ordering::Less),
-            (Self::BigInt(_), Self::Nan) => None,
-            (Self::BigInt(m), Self::MinusZero) => m.partial_cmp(&BigInt::zero()),
-            (Self::Infinity, Self::BigInt(_)) => Some(Ordering::Greater),
-            (Self::Infinity, Self::Infinity) => Some(Ordering::Equal),
-            (Self::Infinity, Self::MinusZero) => Some(Ordering::Greater),
-            (Self::Infinity, Self::MinusInfinity) => Some(Ordering::Greater),
-            (Self::Infinity, Self::Nan) => None,
-            (Self::MinusInfinity, Self::BigInt(_)) => Some(Ordering::Less),
-            (Self::MinusInfinity, Self::Infinity) => Some(Ordering::Less),
-            (Self::MinusInfinity, Self::MinusZero) => Some(Ordering::Less),
-            (Self::MinusInfinity, Self::MinusInfinity) => Some(Ordering::Equal),
-            (Self::MinusInfinity, Self::Nan) => None,
-            (Self::Nan, _) => None,
-            (Self::MinusZero, Self::BigInt(n)) => BigInt::zero().partial_cmp(n),
-            (Self::MinusZero, Self::Infinity) => Some(Ordering::Less),
-            (Self::MinusZero, Self::MinusZero) => Some(Ordering::Equal),
-            (Self::MinusZero, Self::MinusInfinity) => Some(Ordering::Greater),
-            (Self::MinusZero, Self::Nan) => None,
+impl PartialOrd for ExtendedBigInt {
+    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+        match (self, other) {
+            (Self::BigInt(m), Self::BigInt(n)) => m.partial_cmp(n),
+            (Self::BigInt(_), Self::MinusInfinity) => Some(Ordering::Greater),
+            (Self::BigInt(_), Self::Infinity) => Some(Ordering::Less),
+            (Self::BigInt(_), Self::Nan) => None,
+            (Self::BigInt(m), Self::MinusZero) => m.partial_cmp(&BigInt::zero()),
+            (Self::Infinity, Self::BigInt(_)) => Some(Ordering::Greater),
+            (Self::Infinity, Self::Infinity) => Some(Ordering::Equal),
+            (Self::Infinity, Self::MinusZero) => Some(Ordering::Greater),
+            (Self::Infinity, Self::MinusInfinity) => Some(Ordering::Greater),
+            (Self::Infinity, Self::Nan) => None,
+            (Self::MinusInfinity, Self::BigInt(_)) => Some(Ordering::Less),
+            (Self::MinusInfinity, Self::Infinity) => Some(Ordering::Less),
+            (Self::MinusInfinity, Self::MinusZero) => Some(Ordering::Less),
+            (Self::MinusInfinity, Self::MinusInfinity) => Some(Ordering::Equal),
+            (Self::MinusInfinity, Self::Nan) => None,
+            (Self::Nan, _) => None,
+            (Self::MinusZero, Self::BigInt(n)) => BigInt::zero().partial_cmp(n),
+            (Self::MinusZero, Self::Infinity) => Some(Ordering::Less),
+            (Self::MinusZero, Self::MinusZero) => Some(Ordering::Equal),
+            (Self::MinusZero, Self::MinusInfinity) => Some(Ordering::Greater),
+            (Self::MinusZero, Self::Nan) => None,
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use num_bigint::BigInt;
-    use num_traits::Zero;
+    use num_bigint::BigInt;
+    use num_traits::Zero;
 
-    use crate::extendedbigint::ExtendedBigInt;
+    use crate::extendedbigint::ExtendedBigInt;
 
-    #[test]
-    fn test_addition_infinity() {
-        let summand1 = ExtendedBigInt::BigInt(BigInt::zero());
-        let summand2 = ExtendedBigInt::Infinity;
-        assert_eq!(summand1 + summand2, ExtendedBigInt::Infinity);
+    #[test]
+    fn test_addition_infinity() {
+        let summand1 = ExtendedBigInt::BigInt(BigInt::zero());
+        let summand2 = ExtendedBigInt::Infinity;
+        assert_eq!(summand1 + summand2, ExtendedBigInt::Infinity);
     }
 
-    #[test]
-    fn test_addition_minus_infinity() {
-        let summand1 = ExtendedBigInt::BigInt(BigInt::zero());
-        let summand2 = ExtendedBigInt::MinusInfinity;
-        assert_eq!(summand1 + summand2, ExtendedBigInt::MinusInfinity);
+    #[test]
+    fn test_addition_minus_infinity() {
+        let summand1 = ExtendedBigInt::BigInt(BigInt::zero());
+        let summand2 = ExtendedBigInt::MinusInfinity;
+        assert_eq!(summand1 + summand2, ExtendedBigInt::MinusInfinity);
     }
 
-    #[test]
-    fn test_addition_nan() {
-        let summand1 = ExtendedBigInt::BigInt(BigInt::zero());
-        let summand2 = ExtendedBigInt::Nan;
-        let sum = summand1 + summand2;
-        match sum {
-            ExtendedBigInt::Nan => (),
-            _ => unreachable!(),
+    #[test]
+    fn test_addition_nan() {
+        let summand1 = ExtendedBigInt::BigInt(BigInt::zero());
+        let summand2 = ExtendedBigInt::Nan;
+        let sum = summand1 + summand2;
+        match sum {
+            ExtendedBigInt::Nan => (),
+            _ => unreachable!(),
         }
     }
 
-    #[test]
-    fn test_display() {
-        assert_eq!(format!("{}", ExtendedBigInt::BigInt(BigInt::zero())), "0");
-        assert_eq!(format!("{}", ExtendedBigInt::Infinity), "inf");
-        assert_eq!(format!("{}", ExtendedBigInt::MinusInfinity), "-inf");
-        assert_eq!(format!("{}", ExtendedBigInt::Nan), "nan");
-        // FIXME Come up with a way of displaying negative zero as
-        // "-0". Currently it displays as just "0".
-        //
-        //     assert_eq!(format!("{}", ExtendedBigInt::MinusZero), "-0");
-        //
-    }
+    #[test]
+    fn test_display() {
+        assert_eq!(format!("{}", ExtendedBigInt::BigInt(BigInt::zero())), "0");
+        assert_eq!(format!("{}", ExtendedBigInt::Infinity), "inf");
+        assert_eq!(format!("{}", ExtendedBigInt::MinusInfinity), "-inf");
+        assert_eq!(format!("{}", ExtendedBigInt::Nan), "nan");
+        // FIXME Come up with a way of displaying negative zero as
+        // "-0". Currently it displays as just "0".
+        //
+        //     assert_eq!(format!("{}", ExtendedBigInt::MinusZero), "-0");
+        //
+    }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_seq/number.rs.html b/dev/src/uu_seq/number.rs.html index d3f73cbd0..6b7a9848a 100644 --- a/dev/src/uu_seq/number.rs.html +++ b/dev/src/uu_seq/number.rs.html @@ -1,4 +1,4 @@ -number.rs - source
1
+number.rs - source
1
 2
 3
 4
@@ -113,120 +113,120 @@
 113
 114
 115
-
// spell-checker:ignore extendedbigdecimal extendedbigint
-//! A type to represent the possible start, increment, and end values for seq.
-//!
-//! The [`Number`] enumeration represents the possible values for the
-//! start, increment, and end values for `seq`. These may be integers,
-//! floating point numbers, negative zero, etc. A [`Number`] can be
-//! parsed from a string by calling [`str::parse`].
-use num_traits::Zero;
+
// spell-checker:ignore extendedbigdecimal extendedbigint
+//! A type to represent the possible start, increment, and end values for seq.
+//!
+//! The [`Number`] enumeration represents the possible values for the
+//! start, increment, and end values for `seq`. These may be integers,
+//! floating point numbers, negative zero, etc. A [`Number`] can be
+//! parsed from a string by calling [`str::parse`].
+use num_traits::Zero;
 
-use crate::extendedbigdecimal::ExtendedBigDecimal;
-use crate::extendedbigint::ExtendedBigInt;
+use crate::extendedbigdecimal::ExtendedBigDecimal;
+use crate::extendedbigint::ExtendedBigInt;
 
-/// An integral or floating point number.
-#[derive(Debug, PartialEq)]
-pub enum Number {
-    Int(ExtendedBigInt),
-    Float(ExtendedBigDecimal),
+/// An integral or floating point number.
+#[derive(Debug, PartialEq)]
+pub enum Number {
+    Int(ExtendedBigInt),
+    Float(ExtendedBigDecimal),
 }
 
-impl Number {
-    /// Decide whether this number is zero (either positive or negative).
-    pub fn is_zero(&self) -> bool {
-        // We would like to implement `num_traits::Zero`, but it
-        // requires an addition implementation, and we don't want to
-        // implement that here.
-        match self {
-            Self::Int(n) => n.is_zero(),
-            Self::Float(x) => x.is_zero(),
+impl Number {
+    /// Decide whether this number is zero (either positive or negative).
+    pub fn is_zero(&self) -> bool {
+        // We would like to implement `num_traits::Zero`, but it
+        // requires an addition implementation, and we don't want to
+        // implement that here.
+        match self {
+            Self::Int(n) => n.is_zero(),
+            Self::Float(x) => x.is_zero(),
         }
     }
 
-    /// Convert this number into an `ExtendedBigDecimal`.
-    pub fn into_extended_big_decimal(self) -> ExtendedBigDecimal {
-        match self {
-            Self::Int(n) => ExtendedBigDecimal::from(n),
-            Self::Float(x) => x,
+    /// Convert this number into an `ExtendedBigDecimal`.
+    pub fn into_extended_big_decimal(self) -> ExtendedBigDecimal {
+        match self {
+            Self::Int(n) => ExtendedBigDecimal::from(n),
+            Self::Float(x) => x,
         }
     }
 
-    /// The integer number one.
-    pub fn one() -> Self {
-        // We would like to implement `num_traits::One`, but it requires
-        // a multiplication implementation, and we don't want to
-        // implement that here.
-        Self::Int(ExtendedBigInt::one())
+    /// The integer number one.
+    pub fn one() -> Self {
+        // We would like to implement `num_traits::One`, but it requires
+        // a multiplication implementation, and we don't want to
+        // implement that here.
+        Self::Int(ExtendedBigInt::one())
     }
 
-    /// Round this number towards the given other number.
-    ///
-    /// If `other` is greater, then round up. If `other` is smaller,
-    /// then round down.
-    pub fn round_towards(self, other: &ExtendedBigInt) -> ExtendedBigInt {
-        match self {
-            // If this number is already an integer, it is already
-            // rounded to the nearest integer in the direction of
-            // `other`.
-            Self::Int(num) => num,
-            // Otherwise, if this number is a float, we need to decide
-            // whether `other` is larger or smaller than it, and thus
-            // whether to round up or round down, respectively.
-            Self::Float(num) => {
-                let other: ExtendedBigDecimal = From::from(other.clone());
-                if other > num {
-                    num.ceil()
-                } else {
-                    // If they are equal, then `self` is already an
-                    // integer, so calling `floor()` does no harm and
-                    // will just return that integer anyway.
-                    num.floor()
+    /// Round this number towards the given other number.
+    ///
+    /// If `other` is greater, then round up. If `other` is smaller,
+    /// then round down.
+    pub fn round_towards(self, other: &ExtendedBigInt) -> ExtendedBigInt {
+        match self {
+            // If this number is already an integer, it is already
+            // rounded to the nearest integer in the direction of
+            // `other`.
+            Self::Int(num) => num,
+            // Otherwise, if this number is a float, we need to decide
+            // whether `other` is larger or smaller than it, and thus
+            // whether to round up or round down, respectively.
+            Self::Float(num) => {
+                let other: ExtendedBigDecimal = From::from(other.clone());
+                if other > num {
+                    num.ceil()
+                } else {
+                    // If they are equal, then `self` is already an
+                    // integer, so calling `floor()` does no harm and
+                    // will just return that integer anyway.
+                    num.floor()
                 }
             }
         }
     }
 }
 
-/// A number with a specified number of integer and fractional digits.
-///
-/// This struct can be used to represent a number along with information
-/// on how many significant digits to use when displaying the number.
-/// The [`PreciseNumber::num_integral_digits`] field also includes the width needed to
-/// display the "-" character for a negative number.
-///
-/// You can get an instance of this struct by calling [`str::parse`].
-#[derive(Debug)]
-pub struct PreciseNumber {
-    pub number: Number,
-    pub num_integral_digits: usize,
-    pub num_fractional_digits: usize,
+/// A number with a specified number of integer and fractional digits.
+///
+/// This struct can be used to represent a number along with information
+/// on how many significant digits to use when displaying the number.
+/// The [`PreciseNumber::num_integral_digits`] field also includes the width needed to
+/// display the "-" character for a negative number.
+///
+/// You can get an instance of this struct by calling [`str::parse`].
+#[derive(Debug)]
+pub struct PreciseNumber {
+    pub number: Number,
+    pub num_integral_digits: usize,
+    pub num_fractional_digits: usize,
 }
 
-impl PreciseNumber {
-    pub fn new(number: Number, num_integral_digits: usize, num_fractional_digits: usize) -> Self {
-        Self {
-            number,
-            num_integral_digits,
-            num_fractional_digits,
+impl PreciseNumber {
+    pub fn new(number: Number, num_integral_digits: usize, num_fractional_digits: usize) -> Self {
+        Self {
+            number,
+            num_integral_digits,
+            num_fractional_digits,
         }
     }
 
-    /// The integer number one.
-    pub fn one() -> Self {
-        // We would like to implement `num_traits::One`, but it requires
-        // a multiplication implementation, and we don't want to
-        // implement that here.
-        Self::new(Number::one(), 1, 0)
+    /// The integer number one.
+    pub fn one() -> Self {
+        // We would like to implement `num_traits::One`, but it requires
+        // a multiplication implementation, and we don't want to
+        // implement that here.
+        Self::new(Number::one(), 1, 0)
     }
 
-    /// Decide whether this number is zero (either positive or negative).
-    pub fn is_zero(&self) -> bool {
-        // We would like to implement `num_traits::Zero`, but it
-        // requires an addition implementation, and we don't want to
-        // implement that here.
-        self.number.is_zero()
+    /// Decide whether this number is zero (either positive or negative).
+    pub fn is_zero(&self) -> bool {
+        // We would like to implement `num_traits::Zero`, but it
+        // requires an addition implementation, and we don't want to
+        // implement that here.
+        self.number.is_zero()
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_seq/numberparse.rs.html b/dev/src/uu_seq/numberparse.rs.html index 8c2ed080d..001aaae6e 100644 --- a/dev/src/uu_seq/numberparse.rs.html +++ b/dev/src/uu_seq/numberparse.rs.html @@ -1,4 +1,4 @@ -numberparse.rs - source
1
+numberparse.rs - source
1
 2
 3
 4
@@ -615,622 +615,622 @@
 615
 616
 617
-
// spell-checker:ignore extendedbigdecimal extendedbigint bigdecimal numberparse
-//! Parsing numbers for use in `seq`.
-//!
-//! This module provides an implementation of [`FromStr`] for the
-//! [`PreciseNumber`] struct.
-use std::str::FromStr;
+
// spell-checker:ignore extendedbigdecimal extendedbigint bigdecimal numberparse
+//! Parsing numbers for use in `seq`.
+//!
+//! This module provides an implementation of [`FromStr`] for the
+//! [`PreciseNumber`] struct.
+use std::str::FromStr;
 
-use bigdecimal::BigDecimal;
-use num_bigint::BigInt;
-use num_bigint::Sign;
-use num_traits::Num;
-use num_traits::Zero;
+use bigdecimal::BigDecimal;
+use num_bigint::BigInt;
+use num_bigint::Sign;
+use num_traits::Num;
+use num_traits::Zero;
 
-use crate::extendedbigdecimal::ExtendedBigDecimal;
-use crate::extendedbigint::ExtendedBigInt;
-use crate::number::Number;
-use crate::number::PreciseNumber;
+use crate::extendedbigdecimal::ExtendedBigDecimal;
+use crate::extendedbigint::ExtendedBigInt;
+use crate::number::Number;
+use crate::number::PreciseNumber;
 
-/// An error returned when parsing a number fails.
-#[derive(Debug, PartialEq, Eq)]
-pub enum ParseNumberError {
-    Float,
-    Nan,
-    Hex,
+/// An error returned when parsing a number fails.
+#[derive(Debug, PartialEq, Eq)]
+pub enum ParseNumberError {
+    Float,
+    Nan,
+    Hex,
 }
 
-/// Decide whether a given string and its parsed `BigInt` is negative zero.
-fn is_minus_zero_int(s: &str, n: &BigInt) -> bool {
-    s.starts_with('-') && n == &BigInt::zero()
+/// Decide whether a given string and its parsed `BigInt` is negative zero.
+fn is_minus_zero_int(s: &str, n: &BigInt) -> bool {
+    s.starts_with('-') && n == &BigInt::zero()
 }
 
-/// Decide whether a given string and its parsed `BigDecimal` is negative zero.
-fn is_minus_zero_float(s: &str, x: &BigDecimal) -> bool {
-    s.starts_with('-') && x == &BigDecimal::zero()
+/// Decide whether a given string and its parsed `BigDecimal` is negative zero.
+fn is_minus_zero_float(s: &str, x: &BigDecimal) -> bool {
+    s.starts_with('-') && x == &BigDecimal::zero()
 }
 
-/// Parse a number with neither a decimal point nor an exponent.
-///
-/// # Errors
-///
-/// This function returns an error if the input string is a variant of
-/// "NaN" or if no [`BigInt`] could be parsed from the string.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// let actual = "0".parse::<Number>().unwrap().number;
-/// let expected = Number::BigInt(BigInt::zero());
-/// assert_eq!(actual, expected);
-/// ```
-fn parse_no_decimal_no_exponent(s: &str) -> Result<PreciseNumber, ParseNumberError> {
-    match s.parse::<BigInt>() {
-        Ok(n) => {
-            // If `s` is '-0', then `parse()` returns `BigInt::zero()`,
-            // but we need to return `Number::MinusZeroInt` instead.
-            if is_minus_zero_int(s, &n) {
-                Ok(PreciseNumber::new(
-                    Number::Int(ExtendedBigInt::MinusZero),
-                    s.len(),
+/// Parse a number with neither a decimal point nor an exponent.
+///
+/// # Errors
+///
+/// This function returns an error if the input string is a variant of
+/// "NaN" or if no [`BigInt`] could be parsed from the string.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// let actual = "0".parse::<Number>().unwrap().number;
+/// let expected = Number::BigInt(BigInt::zero());
+/// assert_eq!(actual, expected);
+/// ```
+fn parse_no_decimal_no_exponent(s: &str) -> Result<PreciseNumber, ParseNumberError> {
+    match s.parse::<BigInt>() {
+        Ok(n) => {
+            // If `s` is '-0', then `parse()` returns `BigInt::zero()`,
+            // but we need to return `Number::MinusZeroInt` instead.
+            if is_minus_zero_int(s, &n) {
+                Ok(PreciseNumber::new(
+                    Number::Int(ExtendedBigInt::MinusZero),
+                    s.len(),
                     0,
                 ))
-            } else {
-                Ok(PreciseNumber::new(
-                    Number::Int(ExtendedBigInt::BigInt(n)),
-                    s.len(),
+            } else {
+                Ok(PreciseNumber::new(
+                    Number::Int(ExtendedBigInt::BigInt(n)),
+                    s.len(),
                     0,
                 ))
             }
         }
         Err(_) => {
-            // Possibly "NaN" or "inf".
-            //
-            // TODO In Rust v1.53.0, this change
-            // https://github.com/rust-lang/rust/pull/78618 improves the
-            // parsing of floats to include being able to parse "NaN"
-            // and "inf". So when the minimum version of this crate is
-            // increased to 1.53.0, we should just use the built-in
-            // `f32` parsing instead.
-            if s.eq_ignore_ascii_case("inf") {
-                Ok(PreciseNumber::new(
-                    Number::Float(ExtendedBigDecimal::Infinity),
+            // Possibly "NaN" or "inf".
+            //
+            // TODO In Rust v1.53.0, this change
+            // https://github.com/rust-lang/rust/pull/78618 improves the
+            // parsing of floats to include being able to parse "NaN"
+            // and "inf". So when the minimum version of this crate is
+            // increased to 1.53.0, we should just use the built-in
+            // `f32` parsing instead.
+            if s.eq_ignore_ascii_case("inf") {
+                Ok(PreciseNumber::new(
+                    Number::Float(ExtendedBigDecimal::Infinity),
                     0,
                     0,
                 ))
-            } else if s.eq_ignore_ascii_case("-inf") {
-                Ok(PreciseNumber::new(
-                    Number::Float(ExtendedBigDecimal::MinusInfinity),
+            } else if s.eq_ignore_ascii_case("-inf") {
+                Ok(PreciseNumber::new(
+                    Number::Float(ExtendedBigDecimal::MinusInfinity),
                     0,
                     0,
                 ))
-            } else if s.eq_ignore_ascii_case("nan") || s.eq_ignore_ascii_case("-nan") {
-                Err(ParseNumberError::Nan)
-            } else {
-                Err(ParseNumberError::Float)
+            } else if s.eq_ignore_ascii_case("nan") || s.eq_ignore_ascii_case("-nan") {
+                Err(ParseNumberError::Nan)
+            } else {
+                Err(ParseNumberError::Float)
             }
         }
     }
 }
 
-/// Parse a number with an exponent but no decimal point.
-///
-/// # Errors
-///
-/// This function returns an error if `s` is not a valid number.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// let actual = "1e2".parse::<Number>().unwrap().number;
-/// let expected = "100".parse::<BigInt>().unwrap();
-/// assert_eq!(actual, expected);
-/// ```
-fn parse_exponent_no_decimal(s: &str, j: usize) -> Result<PreciseNumber, ParseNumberError> {
-    let exponent: i64 = s[j + 1..].parse().map_err(|_| ParseNumberError::Float)?;
-    // If the exponent is strictly less than zero, then the number
-    // should be treated as a floating point number that will be
-    // displayed in decimal notation. For example, "1e-2" will be
-    // displayed as "0.01", but "1e2" will be displayed as "100",
-    // without a decimal point.
-    let x: BigDecimal = s.parse().map_err(|_| ParseNumberError::Float)?;
-    let num_integral_digits = if is_minus_zero_float(s, &x) {
-        2
-    } else {
-        let total = j as i64 + exponent;
-        let result = if total < 1 {
-            1
-        } else {
-            total.try_into().unwrap()
+/// Parse a number with an exponent but no decimal point.
+///
+/// # Errors
+///
+/// This function returns an error if `s` is not a valid number.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// let actual = "1e2".parse::<Number>().unwrap().number;
+/// let expected = "100".parse::<BigInt>().unwrap();
+/// assert_eq!(actual, expected);
+/// ```
+fn parse_exponent_no_decimal(s: &str, j: usize) -> Result<PreciseNumber, ParseNumberError> {
+    let exponent: i64 = s[j + 1..].parse().map_err(|_| ParseNumberError::Float)?;
+    // If the exponent is strictly less than zero, then the number
+    // should be treated as a floating point number that will be
+    // displayed in decimal notation. For example, "1e-2" will be
+    // displayed as "0.01", but "1e2" will be displayed as "100",
+    // without a decimal point.
+    let x: BigDecimal = s.parse().map_err(|_| ParseNumberError::Float)?;
+    let num_integral_digits = if is_minus_zero_float(s, &x) {
+        2
+    } else {
+        let total = j as i64 + exponent;
+        let result = if total < 1 {
+            1
+        } else {
+            total.try_into().unwrap()
         };
-        if x.sign() == Sign::Minus {
-            result + 1
-        } else {
-            result
+        if x.sign() == Sign::Minus {
+            result + 1
+        } else {
+            result
         }
     };
-    let num_fractional_digits = if exponent < 0 { -exponent as usize } else { 0 };
+    let num_fractional_digits = if exponent < 0 { -exponent as usize } else { 0 };
 
-    if exponent < 0 {
-        if is_minus_zero_float(s, &x) {
-            Ok(PreciseNumber::new(
-                Number::Float(ExtendedBigDecimal::MinusZero),
-                num_integral_digits,
-                num_fractional_digits,
+    if exponent < 0 {
+        if is_minus_zero_float(s, &x) {
+            Ok(PreciseNumber::new(
+                Number::Float(ExtendedBigDecimal::MinusZero),
+                num_integral_digits,
+                num_fractional_digits,
             ))
-        } else {
-            Ok(PreciseNumber::new(
-                Number::Float(ExtendedBigDecimal::BigDecimal(x)),
-                num_integral_digits,
-                num_fractional_digits,
+        } else {
+            Ok(PreciseNumber::new(
+                Number::Float(ExtendedBigDecimal::BigDecimal(x)),
+                num_integral_digits,
+                num_fractional_digits,
             ))
         }
-    } else {
-        let zeros = "0".repeat(exponent.try_into().unwrap());
-        let expanded = [&s[0..j], &zeros].concat();
-        parse_no_decimal_no_exponent(&expanded)
+    } else {
+        let zeros = "0".repeat(exponent.try_into().unwrap());
+        let expanded = [&s[0..j], &zeros].concat();
+        parse_no_decimal_no_exponent(&expanded)
     }
 }
 
-/// Parse a number with a decimal point but no exponent.
-///
-/// # Errors
-///
-/// This function returns an error if `s` is not a valid number.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// let actual = "1.2".parse::<Number>().unwrap().number;
-/// let expected = "1.2".parse::<BigDecimal>().unwrap();
-/// assert_eq!(actual, expected);
-/// ```
-fn parse_decimal_no_exponent(s: &str, i: usize) -> Result<PreciseNumber, ParseNumberError> {
-    let x: BigDecimal = s.parse().map_err(|_| ParseNumberError::Float)?;
+/// Parse a number with a decimal point but no exponent.
+///
+/// # Errors
+///
+/// This function returns an error if `s` is not a valid number.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// let actual = "1.2".parse::<Number>().unwrap().number;
+/// let expected = "1.2".parse::<BigDecimal>().unwrap();
+/// assert_eq!(actual, expected);
+/// ```
+fn parse_decimal_no_exponent(s: &str, i: usize) -> Result<PreciseNumber, ParseNumberError> {
+    let x: BigDecimal = s.parse().map_err(|_| ParseNumberError::Float)?;
 
-    // The number of integral digits is the number of chars until the period.
-    //
-    // This includes the negative sign if there is one. Also, it is
-    // possible that a number is expressed as "-.123" instead of
-    // "-0.123", but when we display the number we want it to include
-    // the leading 0.
-    let num_integral_digits = if s.starts_with("-.") { i + 1 } else { i };
-    let num_fractional_digits = s.len() - (i + 1);
-    if is_minus_zero_float(s, &x) {
-        Ok(PreciseNumber::new(
-            Number::Float(ExtendedBigDecimal::MinusZero),
-            num_integral_digits,
-            num_fractional_digits,
+    // The number of integral digits is the number of chars until the period.
+    //
+    // This includes the negative sign if there is one. Also, it is
+    // possible that a number is expressed as "-.123" instead of
+    // "-0.123", but when we display the number we want it to include
+    // the leading 0.
+    let num_integral_digits = if s.starts_with("-.") { i + 1 } else { i };
+    let num_fractional_digits = s.len() - (i + 1);
+    if is_minus_zero_float(s, &x) {
+        Ok(PreciseNumber::new(
+            Number::Float(ExtendedBigDecimal::MinusZero),
+            num_integral_digits,
+            num_fractional_digits,
         ))
-    } else {
-        Ok(PreciseNumber::new(
-            Number::Float(ExtendedBigDecimal::BigDecimal(x)),
-            num_integral_digits,
-            num_fractional_digits,
+    } else {
+        Ok(PreciseNumber::new(
+            Number::Float(ExtendedBigDecimal::BigDecimal(x)),
+            num_integral_digits,
+            num_fractional_digits,
         ))
     }
 }
 
-/// Parse a number with both a decimal point and an exponent.
-///
-/// # Errors
-///
-/// This function returns an error if `s` is not a valid number.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// let actual = "1.2e3".parse::<Number>().unwrap().number;
-/// let expected = "1200".parse::<BigInt>().unwrap();
-/// assert_eq!(actual, expected);
-/// ```
-fn parse_decimal_and_exponent(
-    s: &str,
-    i: usize,
-    j: usize,
-) -> Result<PreciseNumber, ParseNumberError> {
-    // Because of the match guard, this subtraction will not underflow.
-    let num_digits_between_decimal_point_and_e = (j - (i + 1)) as i64;
-    let exponent: i64 = s[j + 1..].parse().map_err(|_| ParseNumberError::Float)?;
-    let val: BigDecimal = s.parse().map_err(|_| ParseNumberError::Float)?;
+/// Parse a number with both a decimal point and an exponent.
+///
+/// # Errors
+///
+/// This function returns an error if `s` is not a valid number.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// let actual = "1.2e3".parse::<Number>().unwrap().number;
+/// let expected = "1200".parse::<BigInt>().unwrap();
+/// assert_eq!(actual, expected);
+/// ```
+fn parse_decimal_and_exponent(
+    s: &str,
+    i: usize,
+    j: usize,
+) -> Result<PreciseNumber, ParseNumberError> {
+    // Because of the match guard, this subtraction will not underflow.
+    let num_digits_between_decimal_point_and_e = (j - (i + 1)) as i64;
+    let exponent: i64 = s[j + 1..].parse().map_err(|_| ParseNumberError::Float)?;
+    let val: BigDecimal = s.parse().map_err(|_| ParseNumberError::Float)?;
 
-    let num_integral_digits = {
-        let minimum: usize = {
-            let integral_part: f64 = s[..j].parse().map_err(|_| ParseNumberError::Float)?;
-            if integral_part.is_sign_negative() {
-                2
-            } else {
-                1
-            }
+    let num_integral_digits = {
+        let minimum: usize = {
+            let integral_part: f64 = s[..j].parse().map_err(|_| ParseNumberError::Float)?;
+            if integral_part.is_sign_negative() {
+                2
+            } else {
+                1
+            }
         };
-        // Special case: if the string is "-.1e2", we need to treat it
-        // as if it were "-0.1e2".
-        let total = if s.starts_with("-.") {
-            i as i64 + exponent + 1
-        } else {
-            i as i64 + exponent
+        // Special case: if the string is "-.1e2", we need to treat it
+        // as if it were "-0.1e2".
+        let total = if s.starts_with("-.") {
+            i as i64 + exponent + 1
+        } else {
+            i as i64 + exponent
         };
-        if total < minimum as i64 {
-            minimum
-        } else {
-            total.try_into().unwrap()
+        if total < minimum as i64 {
+            minimum
+        } else {
+            total.try_into().unwrap()
         }
     };
 
-    let num_fractional_digits = if num_digits_between_decimal_point_and_e < exponent {
-        0
-    } else {
-        (num_digits_between_decimal_point_and_e - exponent)
-            .try_into()
-            .unwrap()
+    let num_fractional_digits = if num_digits_between_decimal_point_and_e < exponent {
+        0
+    } else {
+        (num_digits_between_decimal_point_and_e - exponent)
+            .try_into()
+            .unwrap()
     };
 
-    if num_digits_between_decimal_point_and_e <= exponent {
-        if is_minus_zero_float(s, &val) {
-            Ok(PreciseNumber::new(
-                Number::Int(ExtendedBigInt::MinusZero),
-                num_integral_digits,
-                num_fractional_digits,
+    if num_digits_between_decimal_point_and_e <= exponent {
+        if is_minus_zero_float(s, &val) {
+            Ok(PreciseNumber::new(
+                Number::Int(ExtendedBigInt::MinusZero),
+                num_integral_digits,
+                num_fractional_digits,
             ))
-        } else {
-            let zeros: String = "0".repeat(
-                (exponent - num_digits_between_decimal_point_and_e)
-                    .try_into()
-                    .unwrap(),
+        } else {
+            let zeros: String = "0".repeat(
+                (exponent - num_digits_between_decimal_point_and_e)
+                    .try_into()
+                    .unwrap(),
             );
-            let expanded = [&s[0..i], &s[i + 1..j], &zeros].concat();
-            let n = expanded
-                .parse::<BigInt>()
-                .map_err(|_| ParseNumberError::Float)?;
-            Ok(PreciseNumber::new(
-                Number::Int(ExtendedBigInt::BigInt(n)),
-                num_integral_digits,
-                num_fractional_digits,
+            let expanded = [&s[0..i], &s[i + 1..j], &zeros].concat();
+            let n = expanded
+                .parse::<BigInt>()
+                .map_err(|_| ParseNumberError::Float)?;
+            Ok(PreciseNumber::new(
+                Number::Int(ExtendedBigInt::BigInt(n)),
+                num_integral_digits,
+                num_fractional_digits,
             ))
         }
-    } else if is_minus_zero_float(s, &val) {
-        Ok(PreciseNumber::new(
-            Number::Float(ExtendedBigDecimal::MinusZero),
-            num_integral_digits,
-            num_fractional_digits,
+    } else if is_minus_zero_float(s, &val) {
+        Ok(PreciseNumber::new(
+            Number::Float(ExtendedBigDecimal::MinusZero),
+            num_integral_digits,
+            num_fractional_digits,
         ))
-    } else {
-        Ok(PreciseNumber::new(
-            Number::Float(ExtendedBigDecimal::BigDecimal(val)),
-            num_integral_digits,
-            num_fractional_digits,
+    } else {
+        Ok(PreciseNumber::new(
+            Number::Float(ExtendedBigDecimal::BigDecimal(val)),
+            num_integral_digits,
+            num_fractional_digits,
         ))
     }
 }
 
-/// Parse a hexadecimal integer from a string.
-///
-/// # Errors
-///
-/// This function returns an error if no [`BigInt`] could be parsed from
-/// the string.
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// let actual = "0x0".parse::<Number>().unwrap().number;
-/// let expected = Number::BigInt(BigInt::zero());
-/// assert_eq!(actual, expected);
-/// ```
-fn parse_hexadecimal(s: &str) -> Result<PreciseNumber, ParseNumberError> {
-    let (is_neg, s) = if s.starts_with('-') {
-        (true, &s[3..])
-    } else {
-        (false, &s[2..])
+/// Parse a hexadecimal integer from a string.
+///
+/// # Errors
+///
+/// This function returns an error if no [`BigInt`] could be parsed from
+/// the string.
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// let actual = "0x0".parse::<Number>().unwrap().number;
+/// let expected = Number::BigInt(BigInt::zero());
+/// assert_eq!(actual, expected);
+/// ```
+fn parse_hexadecimal(s: &str) -> Result<PreciseNumber, ParseNumberError> {
+    let (is_neg, s) = if s.starts_with('-') {
+        (true, &s[3..])
+    } else {
+        (false, &s[2..])
     };
 
-    if s.starts_with('-') || s.starts_with('+') {
-        // Even though this is more like an invalid hexadecimal number,
-        // GNU reports this as an invalid floating point number, so we
-        // use `ParseNumberError::Float` to match that behavior.
-        return Err(ParseNumberError::Float);
+    if s.starts_with('-') || s.starts_with('+') {
+        // Even though this is more like an invalid hexadecimal number,
+        // GNU reports this as an invalid floating point number, so we
+        // use `ParseNumberError::Float` to match that behavior.
+        return Err(ParseNumberError::Float);
     }
 
-    let num = BigInt::from_str_radix(s, 16).map_err(|_| ParseNumberError::Hex)?;
+    let num = BigInt::from_str_radix(s, 16).map_err(|_| ParseNumberError::Hex)?;
 
-    match (is_neg, num == BigInt::zero()) {
-        (true, true) => Ok(PreciseNumber::new(
-            Number::Int(ExtendedBigInt::MinusZero),
+    match (is_neg, num == BigInt::zero()) {
+        (true, true) => Ok(PreciseNumber::new(
+            Number::Int(ExtendedBigInt::MinusZero),
             2,
             0,
         )),
-        (true, false) => Ok(PreciseNumber::new(
-            Number::Int(ExtendedBigInt::BigInt(-num)),
+        (true, false) => Ok(PreciseNumber::new(
+            Number::Int(ExtendedBigInt::BigInt(-num)),
             0,
             0,
         )),
-        (false, _) => Ok(PreciseNumber::new(
-            Number::Int(ExtendedBigInt::BigInt(num)),
+        (false, _) => Ok(PreciseNumber::new(
+            Number::Int(ExtendedBigInt::BigInt(num)),
             0,
             0,
         )),
     }
 }
 
-impl FromStr for PreciseNumber {
-    type Err = ParseNumberError;
-    fn from_str(mut s: &str) -> Result<Self, Self::Err> {
-        // Trim leading whitespace.
-        s = s.trim_start();
+impl FromStr for PreciseNumber {
+    type Err = ParseNumberError;
+    fn from_str(mut s: &str) -> Result<Self, Self::Err> {
+        // Trim leading whitespace.
+        s = s.trim_start();
 
-        // Trim a single leading "+" character.
-        if s.starts_with('+') {
-            s = &s[1..];
+        // Trim a single leading "+" character.
+        if s.starts_with('+') {
+            s = &s[1..];
         }
 
-        // Check if the string seems to be in hexadecimal format.
-        //
-        // May be 0x123 or -0x123, so the index `i` may be either 0 or 1.
-        if let Some(i) = s.to_lowercase().find("0x") {
-            if i <= 1 {
-                return parse_hexadecimal(s);
+        // Check if the string seems to be in hexadecimal format.
+        //
+        // May be 0x123 or -0x123, so the index `i` may be either 0 or 1.
+        if let Some(i) = s.to_lowercase().find("0x") {
+            if i <= 1 {
+                return parse_hexadecimal(s);
             }
         }
 
-        // Find the decimal point and the exponent symbol. Parse the
-        // number differently depending on its form. This is important
-        // because the form of the input dictates how the output will be
-        // presented.
-        match (s.find('.'), s.find('e')) {
-            // For example, "123456" or "inf".
-            (None, None) => parse_no_decimal_no_exponent(s),
-            // For example, "123e456" or "1e-2".
-            (None, Some(j)) => parse_exponent_no_decimal(s, j),
-            // For example, "123.456".
-            (Some(i), None) => parse_decimal_no_exponent(s, i),
-            // For example, "123.456e789".
-            (Some(i), Some(j)) if i < j => parse_decimal_and_exponent(s, i, j),
-            // For example, "1e2.3" or "1.2.3".
-            _ => Err(ParseNumberError::Float),
+        // Find the decimal point and the exponent symbol. Parse the
+        // number differently depending on its form. This is important
+        // because the form of the input dictates how the output will be
+        // presented.
+        match (s.find('.'), s.find('e')) {
+            // For example, "123456" or "inf".
+            (None, None) => parse_no_decimal_no_exponent(s),
+            // For example, "123e456" or "1e-2".
+            (None, Some(j)) => parse_exponent_no_decimal(s, j),
+            // For example, "123.456".
+            (Some(i), None) => parse_decimal_no_exponent(s, i),
+            // For example, "123.456e789".
+            (Some(i), Some(j)) if i < j => parse_decimal_and_exponent(s, i, j),
+            // For example, "1e2.3" or "1.2.3".
+            _ => Err(ParseNumberError::Float),
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use bigdecimal::BigDecimal;
-    use num_bigint::BigInt;
-    use num_traits::Zero;
+    use bigdecimal::BigDecimal;
+    use num_bigint::BigInt;
+    use num_traits::Zero;
 
-    use crate::extendedbigdecimal::ExtendedBigDecimal;
-    use crate::extendedbigint::ExtendedBigInt;
-    use crate::number::Number;
-    use crate::number::PreciseNumber;
-    use crate::numberparse::ParseNumberError;
+    use crate::extendedbigdecimal::ExtendedBigDecimal;
+    use crate::extendedbigint::ExtendedBigInt;
+    use crate::number::Number;
+    use crate::number::PreciseNumber;
+    use crate::numberparse::ParseNumberError;
 
-    /// Convenience function for parsing a [`Number`] and unwrapping.
-    fn parse(s: &str) -> Number {
-        s.parse::<PreciseNumber>().unwrap().number
+    /// Convenience function for parsing a [`Number`] and unwrapping.
+    fn parse(s: &str) -> Number {
+        s.parse::<PreciseNumber>().unwrap().number
     }
 
-    /// Convenience function for getting the number of integral digits.
-    fn num_integral_digits(s: &str) -> usize {
-        s.parse::<PreciseNumber>().unwrap().num_integral_digits
+    /// Convenience function for getting the number of integral digits.
+    fn num_integral_digits(s: &str) -> usize {
+        s.parse::<PreciseNumber>().unwrap().num_integral_digits
     }
 
-    /// Convenience function for getting the number of fractional digits.
-    fn num_fractional_digits(s: &str) -> usize {
-        s.parse::<PreciseNumber>().unwrap().num_fractional_digits
+    /// Convenience function for getting the number of fractional digits.
+    fn num_fractional_digits(s: &str) -> usize {
+        s.parse::<PreciseNumber>().unwrap().num_fractional_digits
     }
 
-    #[test]
-    fn test_parse_minus_zero_int() {
-        assert_eq!(parse("-0e0"), Number::Int(ExtendedBigInt::MinusZero));
-        assert_eq!(parse("-0e-0"), Number::Int(ExtendedBigInt::MinusZero));
-        assert_eq!(parse("-0e1"), Number::Int(ExtendedBigInt::MinusZero));
-        assert_eq!(parse("-0e+1"), Number::Int(ExtendedBigInt::MinusZero));
-        assert_eq!(parse("-0.0e1"), Number::Int(ExtendedBigInt::MinusZero));
-        assert_eq!(parse("-0x0"), Number::Int(ExtendedBigInt::MinusZero));
+    #[test]
+    fn test_parse_minus_zero_int() {
+        assert_eq!(parse("-0e0"), Number::Int(ExtendedBigInt::MinusZero));
+        assert_eq!(parse("-0e-0"), Number::Int(ExtendedBigInt::MinusZero));
+        assert_eq!(parse("-0e1"), Number::Int(ExtendedBigInt::MinusZero));
+        assert_eq!(parse("-0e+1"), Number::Int(ExtendedBigInt::MinusZero));
+        assert_eq!(parse("-0.0e1"), Number::Int(ExtendedBigInt::MinusZero));
+        assert_eq!(parse("-0x0"), Number::Int(ExtendedBigInt::MinusZero));
     }
 
-    #[test]
-    fn test_parse_minus_zero_float() {
-        assert_eq!(parse("-0.0"), Number::Float(ExtendedBigDecimal::MinusZero));
-        assert_eq!(parse("-0e-1"), Number::Float(ExtendedBigDecimal::MinusZero));
+    #[test]
+    fn test_parse_minus_zero_float() {
+        assert_eq!(parse("-0.0"), Number::Float(ExtendedBigDecimal::MinusZero));
+        assert_eq!(parse("-0e-1"), Number::Float(ExtendedBigDecimal::MinusZero));
         assert_eq!(
-            parse("-0.0e-1"),
-            Number::Float(ExtendedBigDecimal::MinusZero)
+            parse("-0.0e-1"),
+            Number::Float(ExtendedBigDecimal::MinusZero)
         );
     }
 
-    #[test]
-    fn test_parse_big_int() {
-        assert_eq!(parse("0"), Number::Int(ExtendedBigInt::zero()));
-        assert_eq!(parse("0.1e1"), Number::Int(ExtendedBigInt::one()));
+    #[test]
+    fn test_parse_big_int() {
+        assert_eq!(parse("0"), Number::Int(ExtendedBigInt::zero()));
+        assert_eq!(parse("0.1e1"), Number::Int(ExtendedBigInt::one()));
         assert_eq!(
-            parse("1.0e1"),
-            Number::Int(ExtendedBigInt::BigInt("10".parse::<BigInt>().unwrap()))
+            parse("1.0e1"),
+            Number::Int(ExtendedBigInt::BigInt("10".parse::<BigInt>().unwrap()))
         );
     }
 
-    #[test]
-    fn test_parse_hexadecimal_big_int() {
-        assert_eq!(parse("0x0"), Number::Int(ExtendedBigInt::zero()));
+    #[test]
+    fn test_parse_hexadecimal_big_int() {
+        assert_eq!(parse("0x0"), Number::Int(ExtendedBigInt::zero()));
         assert_eq!(
-            parse("0x10"),
-            Number::Int(ExtendedBigInt::BigInt("16".parse::<BigInt>().unwrap()))
+            parse("0x10"),
+            Number::Int(ExtendedBigInt::BigInt("16".parse::<BigInt>().unwrap()))
         );
     }
 
-    #[test]
-    fn test_parse_big_decimal() {
+    #[test]
+    fn test_parse_big_decimal() {
         assert_eq!(
-            parse("0.0"),
-            Number::Float(ExtendedBigDecimal::BigDecimal(
-                "0.0".parse::<BigDecimal>().unwrap()
+            parse("0.0"),
+            Number::Float(ExtendedBigDecimal::BigDecimal(
+                "0.0".parse::<BigDecimal>().unwrap()
             ))
         );
         assert_eq!(
-            parse(".0"),
-            Number::Float(ExtendedBigDecimal::BigDecimal(
-                "0.0".parse::<BigDecimal>().unwrap()
+            parse(".0"),
+            Number::Float(ExtendedBigDecimal::BigDecimal(
+                "0.0".parse::<BigDecimal>().unwrap()
             ))
         );
         assert_eq!(
-            parse("1.0"),
-            Number::Float(ExtendedBigDecimal::BigDecimal(
-                "1.0".parse::<BigDecimal>().unwrap()
+            parse("1.0"),
+            Number::Float(ExtendedBigDecimal::BigDecimal(
+                "1.0".parse::<BigDecimal>().unwrap()
             ))
         );
         assert_eq!(
-            parse("10e-1"),
-            Number::Float(ExtendedBigDecimal::BigDecimal(
-                "1.0".parse::<BigDecimal>().unwrap()
+            parse("10e-1"),
+            Number::Float(ExtendedBigDecimal::BigDecimal(
+                "1.0".parse::<BigDecimal>().unwrap()
             ))
         );
         assert_eq!(
-            parse("-1e-3"),
-            Number::Float(ExtendedBigDecimal::BigDecimal(
-                "-0.001".parse::<BigDecimal>().unwrap()
+            parse("-1e-3"),
+            Number::Float(ExtendedBigDecimal::BigDecimal(
+                "-0.001".parse::<BigDecimal>().unwrap()
             ))
         );
     }
 
-    #[test]
-    fn test_parse_inf() {
-        assert_eq!(parse("inf"), Number::Float(ExtendedBigDecimal::Infinity));
-        assert_eq!(parse("+inf"), Number::Float(ExtendedBigDecimal::Infinity));
+    #[test]
+    fn test_parse_inf() {
+        assert_eq!(parse("inf"), Number::Float(ExtendedBigDecimal::Infinity));
+        assert_eq!(parse("+inf"), Number::Float(ExtendedBigDecimal::Infinity));
         assert_eq!(
-            parse("-inf"),
-            Number::Float(ExtendedBigDecimal::MinusInfinity)
+            parse("-inf"),
+            Number::Float(ExtendedBigDecimal::MinusInfinity)
         );
     }
 
-    #[test]
-    fn test_parse_invalid_float() {
+    #[test]
+    fn test_parse_invalid_float() {
         assert_eq!(
-            "1.2.3".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Float
+            "1.2.3".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Float
         );
         assert_eq!(
-            "1e2e3".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Float
+            "1e2e3".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Float
         );
         assert_eq!(
-            "1e2.3".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Float
+            "1e2.3".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Float
         );
         assert_eq!(
-            "-+-1".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Float
+            "-+-1".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Float
         );
     }
 
-    #[test]
-    fn test_parse_invalid_hex() {
+    #[test]
+    fn test_parse_invalid_hex() {
         assert_eq!(
-            "0xg".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Hex
+            "0xg".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Hex
         );
     }
 
-    #[test]
-    fn test_parse_invalid_nan() {
+    #[test]
+    fn test_parse_invalid_nan() {
         assert_eq!(
-            "nan".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Nan
+            "nan".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Nan
         );
         assert_eq!(
-            "NAN".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Nan
+            "NAN".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Nan
         );
         assert_eq!(
-            "NaN".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Nan
+            "NaN".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Nan
         );
         assert_eq!(
-            "nAn".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Nan
+            "nAn".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Nan
         );
         assert_eq!(
-            "-nan".parse::<PreciseNumber>().unwrap_err(),
-            ParseNumberError::Nan
+            "-nan".parse::<PreciseNumber>().unwrap_err(),
+            ParseNumberError::Nan
         );
     }
 
-    #[test]
-    fn test_num_integral_digits() {
-        // no decimal, no exponent
-        assert_eq!(num_integral_digits("123"), 3);
-        // decimal, no exponent
-        assert_eq!(num_integral_digits("123.45"), 3);
-        assert_eq!(num_integral_digits("-0.1"), 2);
-        assert_eq!(num_integral_digits("-.1"), 2);
-        // exponent, no decimal
-        assert_eq!(num_integral_digits("123e4"), 3 + 4);
-        assert_eq!(num_integral_digits("123e-4"), 1);
-        assert_eq!(num_integral_digits("-1e-3"), 2);
-        // decimal and exponent
-        assert_eq!(num_integral_digits("123.45e6"), 3 + 6);
-        assert_eq!(num_integral_digits("123.45e-6"), 1);
-        assert_eq!(num_integral_digits("123.45e-1"), 2);
-        assert_eq!(num_integral_digits("-0.1e0"), 2);
-        assert_eq!(num_integral_digits("-0.1e2"), 4);
-        assert_eq!(num_integral_digits("-.1e0"), 2);
-        assert_eq!(num_integral_digits("-.1e2"), 4);
-        assert_eq!(num_integral_digits("-1.e-3"), 2);
-        assert_eq!(num_integral_digits("-1.0e-4"), 2);
-        // minus zero int
-        assert_eq!(num_integral_digits("-0e0"), 2);
-        assert_eq!(num_integral_digits("-0e-0"), 2);
-        assert_eq!(num_integral_digits("-0e1"), 3);
-        assert_eq!(num_integral_digits("-0e+1"), 3);
-        assert_eq!(num_integral_digits("-0.0e1"), 3);
-        // minus zero float
-        assert_eq!(num_integral_digits("-0.0"), 2);
-        assert_eq!(num_integral_digits("-0e-1"), 2);
-        assert_eq!(num_integral_digits("-0.0e-1"), 2);
+    #[test]
+    fn test_num_integral_digits() {
+        // no decimal, no exponent
+        assert_eq!(num_integral_digits("123"), 3);
+        // decimal, no exponent
+        assert_eq!(num_integral_digits("123.45"), 3);
+        assert_eq!(num_integral_digits("-0.1"), 2);
+        assert_eq!(num_integral_digits("-.1"), 2);
+        // exponent, no decimal
+        assert_eq!(num_integral_digits("123e4"), 3 + 4);
+        assert_eq!(num_integral_digits("123e-4"), 1);
+        assert_eq!(num_integral_digits("-1e-3"), 2);
+        // decimal and exponent
+        assert_eq!(num_integral_digits("123.45e6"), 3 + 6);
+        assert_eq!(num_integral_digits("123.45e-6"), 1);
+        assert_eq!(num_integral_digits("123.45e-1"), 2);
+        assert_eq!(num_integral_digits("-0.1e0"), 2);
+        assert_eq!(num_integral_digits("-0.1e2"), 4);
+        assert_eq!(num_integral_digits("-.1e0"), 2);
+        assert_eq!(num_integral_digits("-.1e2"), 4);
+        assert_eq!(num_integral_digits("-1.e-3"), 2);
+        assert_eq!(num_integral_digits("-1.0e-4"), 2);
+        // minus zero int
+        assert_eq!(num_integral_digits("-0e0"), 2);
+        assert_eq!(num_integral_digits("-0e-0"), 2);
+        assert_eq!(num_integral_digits("-0e1"), 3);
+        assert_eq!(num_integral_digits("-0e+1"), 3);
+        assert_eq!(num_integral_digits("-0.0e1"), 3);
+        // minus zero float
+        assert_eq!(num_integral_digits("-0.0"), 2);
+        assert_eq!(num_integral_digits("-0e-1"), 2);
+        assert_eq!(num_integral_digits("-0.0e-1"), 2);
 
-        // TODO In GNU `seq`, the `-w` option does not seem to work with
-        // hexadecimal arguments. In order to match that behavior, we
-        // report the number of integral digits as zero for hexadecimal
-        // inputs.
-        assert_eq!(num_integral_digits("0xff"), 0);
+        // TODO In GNU `seq`, the `-w` option does not seem to work with
+        // hexadecimal arguments. In order to match that behavior, we
+        // report the number of integral digits as zero for hexadecimal
+        // inputs.
+        assert_eq!(num_integral_digits("0xff"), 0);
     }
 
-    #[test]
-    fn test_num_fractional_digits() {
-        // no decimal, no exponent
-        assert_eq!(num_fractional_digits("123"), 0);
-        assert_eq!(num_fractional_digits("0xff"), 0);
-        // decimal, no exponent
-        assert_eq!(num_fractional_digits("123.45"), 2);
-        assert_eq!(num_fractional_digits("-0.1"), 1);
-        assert_eq!(num_fractional_digits("-.1"), 1);
-        // exponent, no decimal
-        assert_eq!(num_fractional_digits("123e4"), 0);
-        assert_eq!(num_fractional_digits("123e-4"), 4);
-        assert_eq!(num_fractional_digits("123e-1"), 1);
-        assert_eq!(num_fractional_digits("-1e-3"), 3);
-        // decimal and exponent
-        assert_eq!(num_fractional_digits("123.45e6"), 0);
-        assert_eq!(num_fractional_digits("123.45e1"), 1);
-        assert_eq!(num_fractional_digits("123.45e-6"), 8);
-        assert_eq!(num_fractional_digits("123.45e-1"), 3);
-        assert_eq!(num_fractional_digits("-0.1e0"), 1);
-        assert_eq!(num_fractional_digits("-0.1e2"), 0);
-        assert_eq!(num_fractional_digits("-.1e0"), 1);
-        assert_eq!(num_fractional_digits("-.1e2"), 0);
-        assert_eq!(num_fractional_digits("-1.e-3"), 3);
-        assert_eq!(num_fractional_digits("-1.0e-4"), 5);
-        // minus zero int
-        assert_eq!(num_fractional_digits("-0e0"), 0);
-        assert_eq!(num_fractional_digits("-0e-0"), 0);
-        assert_eq!(num_fractional_digits("-0e1"), 0);
-        assert_eq!(num_fractional_digits("-0e+1"), 0);
-        assert_eq!(num_fractional_digits("-0.0e1"), 0);
-        // minus zero float
-        assert_eq!(num_fractional_digits("-0.0"), 1);
-        assert_eq!(num_fractional_digits("-0e-1"), 1);
-        assert_eq!(num_fractional_digits("-0.0e-1"), 2);
+    #[test]
+    fn test_num_fractional_digits() {
+        // no decimal, no exponent
+        assert_eq!(num_fractional_digits("123"), 0);
+        assert_eq!(num_fractional_digits("0xff"), 0);
+        // decimal, no exponent
+        assert_eq!(num_fractional_digits("123.45"), 2);
+        assert_eq!(num_fractional_digits("-0.1"), 1);
+        assert_eq!(num_fractional_digits("-.1"), 1);
+        // exponent, no decimal
+        assert_eq!(num_fractional_digits("123e4"), 0);
+        assert_eq!(num_fractional_digits("123e-4"), 4);
+        assert_eq!(num_fractional_digits("123e-1"), 1);
+        assert_eq!(num_fractional_digits("-1e-3"), 3);
+        // decimal and exponent
+        assert_eq!(num_fractional_digits("123.45e6"), 0);
+        assert_eq!(num_fractional_digits("123.45e1"), 1);
+        assert_eq!(num_fractional_digits("123.45e-6"), 8);
+        assert_eq!(num_fractional_digits("123.45e-1"), 3);
+        assert_eq!(num_fractional_digits("-0.1e0"), 1);
+        assert_eq!(num_fractional_digits("-0.1e2"), 0);
+        assert_eq!(num_fractional_digits("-.1e0"), 1);
+        assert_eq!(num_fractional_digits("-.1e2"), 0);
+        assert_eq!(num_fractional_digits("-1.e-3"), 3);
+        assert_eq!(num_fractional_digits("-1.0e-4"), 5);
+        // minus zero int
+        assert_eq!(num_fractional_digits("-0e0"), 0);
+        assert_eq!(num_fractional_digits("-0e-0"), 0);
+        assert_eq!(num_fractional_digits("-0e1"), 0);
+        assert_eq!(num_fractional_digits("-0e+1"), 0);
+        assert_eq!(num_fractional_digits("-0.0e1"), 0);
+        // minus zero float
+        assert_eq!(num_fractional_digits("-0.0"), 1);
+        assert_eq!(num_fractional_digits("-0e-1"), 1);
+        assert_eq!(num_fractional_digits("-0.0e-1"), 2);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_seq/seq.rs.html b/dev/src/uu_seq/seq.rs.html index d761a19b4..e74306caf 100644 --- a/dev/src/uu_seq/seq.rs.html +++ b/dev/src/uu_seq/seq.rs.html @@ -1,4 +1,4 @@ -seq.rs - source
1
+seq.rs - source
1
 2
 3
 4
@@ -372,379 +372,379 @@
 372
 373
 374
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// TODO: Support -f flag
-// spell-checker:ignore (ToDO) istr chiter argptr ilen extendedbigdecimal extendedbigint numberparse
-use std::io::{stdout, ErrorKind, Write};
-use std::process::exit;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// TODO: Support -f flag
+// spell-checker:ignore (ToDO) istr chiter argptr ilen extendedbigdecimal extendedbigint numberparse
+use std::io::{stdout, ErrorKind, Write};
+use std::process::exit;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use num_traits::Zero;
+use clap::{crate_version, Arg, ArgAction, Command};
+use num_traits::Zero;
 
-use uucore::error::FromIo;
-use uucore::error::UResult;
-use uucore::format_usage;
-use uucore::memo::Memo;
-use uucore::show;
+use uucore::error::FromIo;
+use uucore::error::UResult;
+use uucore::format_usage;
+use uucore::memo::Memo;
+use uucore::show;
 
-mod error;
-mod extendedbigdecimal;
-mod extendedbigint;
-mod number;
-mod numberparse;
-use crate::error::SeqError;
-use crate::extendedbigdecimal::ExtendedBigDecimal;
-use crate::extendedbigint::ExtendedBigInt;
-use crate::number::Number;
-use crate::number::PreciseNumber;
+mod error;
+mod extendedbigdecimal;
+mod extendedbigint;
+mod number;
+mod numberparse;
+use crate::error::SeqError;
+use crate::extendedbigdecimal::ExtendedBigDecimal;
+use crate::extendedbigint::ExtendedBigInt;
+use crate::number::Number;
+use crate::number::PreciseNumber;
 
-static ABOUT: &str = "Display numbers from FIRST to LAST, in steps of INCREMENT.";
-const USAGE: &str = "\
+static ABOUT: &str = "Display numbers from FIRST to LAST, in steps of INCREMENT.";
+const USAGE: &str = "\
     {} [OPTION]... LAST
     {} [OPTION]... FIRST LAST
     {} [OPTION]... FIRST INCREMENT LAST";
-static OPT_SEPARATOR: &str = "separator";
-static OPT_TERMINATOR: &str = "terminator";
-static OPT_WIDTHS: &str = "widths";
-static OPT_FORMAT: &str = "format";
+static OPT_SEPARATOR: &str = "separator";
+static OPT_TERMINATOR: &str = "terminator";
+static OPT_WIDTHS: &str = "widths";
+static OPT_FORMAT: &str = "format";
 
-static ARG_NUMBERS: &str = "numbers";
+static ARG_NUMBERS: &str = "numbers";
 
-#[derive(Clone)]
-struct SeqOptions<'a> {
-    separator: String,
-    terminator: String,
-    widths: bool,
-    format: Option<&'a str>,
+#[derive(Clone)]
+struct SeqOptions<'a> {
+    separator: String,
+    terminator: String,
+    widths: bool,
+    format: Option<&'a str>,
 }
 
-/// A range of integers.
-///
-/// The elements are (first, increment, last).
-type RangeInt = (ExtendedBigInt, ExtendedBigInt, ExtendedBigInt);
+/// A range of integers.
+///
+/// The elements are (first, increment, last).
+type RangeInt = (ExtendedBigInt, ExtendedBigInt, ExtendedBigInt);
 
-/// A range of floats.
-///
-/// The elements are (first, increment, last).
-type RangeFloat = (ExtendedBigDecimal, ExtendedBigDecimal, ExtendedBigDecimal);
+/// A range of floats.
+///
+/// The elements are (first, increment, last).
+type RangeFloat = (ExtendedBigDecimal, ExtendedBigDecimal, ExtendedBigDecimal);
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let numbers = matches
-        .get_many::<String>(ARG_NUMBERS)
-        .unwrap()
-        .collect::<Vec<_>>();
+    let numbers = matches
+        .get_many::<String>(ARG_NUMBERS)
+        .unwrap()
+        .collect::<Vec<_>>();
 
-    let options = SeqOptions {
-        separator: matches
-            .get_one::<String>(OPT_SEPARATOR)
-            .map(|s| s.as_str())
-            .unwrap_or("\n")
-            .to_string(),
-        terminator: matches
-            .get_one::<String>(OPT_TERMINATOR)
-            .map(|s| s.as_str())
-            .unwrap_or("\n")
-            .to_string(),
-        widths: matches.get_flag(OPT_WIDTHS),
-        format: matches.get_one::<String>(OPT_FORMAT).map(|s| s.as_str()),
+    let options = SeqOptions {
+        separator: matches
+            .get_one::<String>(OPT_SEPARATOR)
+            .map(|s| s.as_str())
+            .unwrap_or("\n")
+            .to_string(),
+        terminator: matches
+            .get_one::<String>(OPT_TERMINATOR)
+            .map(|s| s.as_str())
+            .unwrap_or("\n")
+            .to_string(),
+        widths: matches.get_flag(OPT_WIDTHS),
+        format: matches.get_one::<String>(OPT_FORMAT).map(|s| s.as_str()),
     };
 
-    let first = if numbers.len() > 1 {
-        match numbers[0].parse() {
-            Ok(num) => num,
-            Err(e) => return Err(SeqError::ParseError(numbers[0].to_string(), e).into()),
+    let first = if numbers.len() > 1 {
+        match numbers[0].parse() {
+            Ok(num) => num,
+            Err(e) => return Err(SeqError::ParseError(numbers[0].to_string(), e).into()),
         }
-    } else {
-        PreciseNumber::one()
+    } else {
+        PreciseNumber::one()
     };
-    let increment = if numbers.len() > 2 {
-        match numbers[1].parse() {
-            Ok(num) => num,
-            Err(e) => return Err(SeqError::ParseError(numbers[1].to_string(), e).into()),
+    let increment = if numbers.len() > 2 {
+        match numbers[1].parse() {
+            Ok(num) => num,
+            Err(e) => return Err(SeqError::ParseError(numbers[1].to_string(), e).into()),
         }
-    } else {
-        PreciseNumber::one()
+    } else {
+        PreciseNumber::one()
     };
-    if increment.is_zero() {
-        return Err(SeqError::ZeroIncrement(numbers[1].to_string()).into());
+    if increment.is_zero() {
+        return Err(SeqError::ZeroIncrement(numbers[1].to_string()).into());
     }
-    let last: PreciseNumber = {
-        // We are guaranteed that `numbers.len()` is greater than zero
-        // and at most three because of the argument specification in
-        // `uu_app()`.
-        let n: usize = numbers.len();
-        match numbers[n - 1].parse() {
-            Ok(num) => num,
-            Err(e) => return Err(SeqError::ParseError(numbers[n - 1].to_string(), e).into()),
+    let last: PreciseNumber = {
+        // We are guaranteed that `numbers.len()` is greater than zero
+        // and at most three because of the argument specification in
+        // `uu_app()`.
+        let n: usize = numbers.len();
+        match numbers[n - 1].parse() {
+            Ok(num) => num,
+            Err(e) => return Err(SeqError::ParseError(numbers[n - 1].to_string(), e).into()),
         }
     };
 
-    let padding = first
-        .num_integral_digits
-        .max(increment.num_integral_digits)
-        .max(last.num_integral_digits);
-    let largest_dec = first
-        .num_fractional_digits
-        .max(increment.num_fractional_digits);
+    let padding = first
+        .num_integral_digits
+        .max(increment.num_integral_digits)
+        .max(last.num_integral_digits);
+    let largest_dec = first
+        .num_fractional_digits
+        .max(increment.num_fractional_digits);
 
-    let result = match (first.number, increment.number, last.number) {
-        (Number::Int(first), Number::Int(increment), last) => {
-            let last = last.round_towards(&first);
-            print_seq_integers(
-                (first, increment, last),
-                &options.separator,
-                &options.terminator,
-                options.widths,
-                padding,
-                options.format,
+    let result = match (first.number, increment.number, last.number) {
+        (Number::Int(first), Number::Int(increment), last) => {
+            let last = last.round_towards(&first);
+            print_seq_integers(
+                (first, increment, last),
+                &options.separator,
+                &options.terminator,
+                options.widths,
+                padding,
+                options.format,
             )
         }
-        (first, increment, last) => print_seq(
+        (first, increment, last) => print_seq(
             (
-                first.into_extended_big_decimal(),
-                increment.into_extended_big_decimal(),
-                last.into_extended_big_decimal(),
+                first.into_extended_big_decimal(),
+                increment.into_extended_big_decimal(),
+                last.into_extended_big_decimal(),
             ),
-            largest_dec,
-            &options.separator,
-            &options.terminator,
-            options.widths,
-            padding,
-            options.format,
+            largest_dec,
+            &options.separator,
+            &options.terminator,
+            options.widths,
+            padding,
+            options.format,
         ),
     };
-    match result {
+    match result {
         Ok(_) => Ok(()),
-        Err(err) if err.kind() == ErrorKind::BrokenPipe => Ok(()),
-        Err(e) => Err(e.map_err_context(|| "write error".into())),
+        Err(err) if err.kind() == ErrorKind::BrokenPipe => Ok(()),
+        Err(e) => Err(e.map_err_context(|| "write error".into())),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .trailing_var_arg(true)
-        .allow_negative_numbers(true)
-        .infer_long_args(true)
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .arg(
-            Arg::new(OPT_SEPARATOR)
-                .short('s')
-                .long("separator")
-                .help("Separator character (defaults to \\n)"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .trailing_var_arg(true)
+        .allow_negative_numbers(true)
+        .infer_long_args(true)
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .arg(
+            Arg::new(OPT_SEPARATOR)
+                .short('s')
+                .long("separator")
+                .help("Separator character (defaults to \\n)"),
         )
-        .arg(
-            Arg::new(OPT_TERMINATOR)
-                .short('t')
-                .long("terminator")
-                .help("Terminator character (defaults to \\n)"),
+        .arg(
+            Arg::new(OPT_TERMINATOR)
+                .short('t')
+                .long("terminator")
+                .help("Terminator character (defaults to \\n)"),
         )
-        .arg(
-            Arg::new(OPT_WIDTHS)
-                .short('w')
-                .long("widths")
-                .help("Equalize widths of all numbers by padding with zeros")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_WIDTHS)
+                .short('w')
+                .long("widths")
+                .help("Equalize widths of all numbers by padding with zeros")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_FORMAT)
-                .short('f')
-                .long(OPT_FORMAT)
-                .help("use printf style floating-point FORMAT"),
+        .arg(
+            Arg::new(OPT_FORMAT)
+                .short('f')
+                .long(OPT_FORMAT)
+                .help("use printf style floating-point FORMAT"),
         )
-        .arg(
-            Arg::new(ARG_NUMBERS)
-                .action(ArgAction::Append)
-                .num_args(1..=3),
+        .arg(
+            Arg::new(ARG_NUMBERS)
+                .action(ArgAction::Append)
+                .num_args(1..=3),
         )
 }
 
-fn done_printing<T: Zero + PartialOrd>(next: &T, increment: &T, last: &T) -> bool {
-    if increment >= &T::zero() {
-        next > last
-    } else {
-        next < last
+fn done_printing<T: Zero + PartialOrd>(next: &T, increment: &T, last: &T) -> bool {
+    if increment >= &T::zero() {
+        next > last
+    } else {
+        next < last
     }
 }
 
-/// Write a big decimal formatted according to the given parameters.
-fn write_value_float(
-    writer: &mut impl Write,
-    value: &ExtendedBigDecimal,
-    width: usize,
-    precision: usize,
-    _is_first_iteration: bool,
-) -> std::io::Result<()> {
-    let value_as_str =
-        if *value == ExtendedBigDecimal::Infinity || *value == ExtendedBigDecimal::MinusInfinity {
+/// Write a big decimal formatted according to the given parameters.
+fn write_value_float(
+    writer: &mut impl Write,
+    value: &ExtendedBigDecimal,
+    width: usize,
+    precision: usize,
+    _is_first_iteration: bool,
+) -> std::io::Result<()> {
+    let value_as_str =
+        if *value == ExtendedBigDecimal::Infinity || *value == ExtendedBigDecimal::MinusInfinity {
             format!(
                 "{value:>width$.precision$}",
-                value = value,
-                width = width,
-                precision = precision,
+                value = value,
+                width = width,
+                precision = precision,
             )
-        } else {
+        } else {
             format!(
                 "{value:>0width$.precision$}",
-                value = value,
-                width = width,
-                precision = precision,
+                value = value,
+                width = width,
+                precision = precision,
             )
         };
-    write!(writer, "{}", value_as_str)
+    write!(writer, "{}", value_as_str)
 }
 
-/// Write a big int formatted according to the given parameters.
-fn write_value_int(
-    writer: &mut impl Write,
-    value: &ExtendedBigInt,
-    width: usize,
-    pad: bool,
-    is_first_iteration: bool,
-) -> std::io::Result<()> {
-    let value_as_str = if pad {
-        if *value == ExtendedBigInt::MinusZero && is_first_iteration {
-            format!("-{value:>0width$}", value = value, width = width - 1,)
-        } else {
-            format!("{value:>0width$}", value = value, width = width,)
+/// Write a big int formatted according to the given parameters.
+fn write_value_int(
+    writer: &mut impl Write,
+    value: &ExtendedBigInt,
+    width: usize,
+    pad: bool,
+    is_first_iteration: bool,
+) -> std::io::Result<()> {
+    let value_as_str = if pad {
+        if *value == ExtendedBigInt::MinusZero && is_first_iteration {
+            format!("-{value:>0width$}", value = value, width = width - 1,)
+        } else {
+            format!("{value:>0width$}", value = value, width = width,)
         }
-    } else if *value == ExtendedBigInt::MinusZero && is_first_iteration {
-        format!("-{}", value)
-    } else {
-        format!("{}", value)
+    } else if *value == ExtendedBigInt::MinusZero && is_first_iteration {
+        format!("-{}", value)
+    } else {
+        format!("{}", value)
     };
-    write!(writer, "{}", value_as_str)
+    write!(writer, "{}", value_as_str)
 }
 
-// TODO `print_seq()` and `print_seq_integers()` are nearly identical,
-// they could be refactored into a single more general function.
+// TODO `print_seq()` and `print_seq_integers()` are nearly identical,
+// they could be refactored into a single more general function.
 
-/// Floating point based code path
-fn print_seq(
-    range: RangeFloat,
-    largest_dec: usize,
-    separator: &str,
-    terminator: &str,
-    pad: bool,
-    padding: usize,
-    format: Option<&str>,
-) -> std::io::Result<()> {
-    let stdout = stdout();
-    let mut stdout = stdout.lock();
-    let (first, increment, last) = range;
-    let mut value = first;
-    let padding = if pad { padding + 1 + largest_dec } else { 0 };
-    let mut is_first_iteration = true;
-    while !done_printing(&value, &increment, &last) {
-        if !is_first_iteration {
-            write!(stdout, "{}", separator)?;
+/// Floating point based code path
+fn print_seq(
+    range: RangeFloat,
+    largest_dec: usize,
+    separator: &str,
+    terminator: &str,
+    pad: bool,
+    padding: usize,
+    format: Option<&str>,
+) -> std::io::Result<()> {
+    let stdout = stdout();
+    let mut stdout = stdout.lock();
+    let (first, increment, last) = range;
+    let mut value = first;
+    let padding = if pad { padding + 1 + largest_dec } else { 0 };
+    let mut is_first_iteration = true;
+    while !done_printing(&value, &increment, &last) {
+        if !is_first_iteration {
+            write!(stdout, "{}", separator)?;
         }
-        // If there was an argument `-f FORMAT`, then use that format
-        // template instead of the default formatting strategy.
-        //
-        // The `Memo::run_all()` function takes in the template and
-        // the current value and writes the result to `stdout`.
-        //
-        // TODO The `run_all()` method takes a string as its second
-        // parameter but we have an `ExtendedBigDecimal`. In order to
-        // satisfy the signature of the function, we convert the
-        // `ExtendedBigDecimal` into a string. The `Memo::run_all()`
-        // logic will subsequently parse that string into something
-        // similar to an `ExtendedBigDecimal` again before rendering
-        // it as a string and ultimately writing to `stdout`. We
-        // shouldn't have to do so much converting back and forth via
-        // strings.
-        match format {
-            Some(f) => {
-                let s = format!("{}", value);
-                if let Err(x) = Memo::run_all(f, &[s]) {
-                    show!(x);
-                    exit(1);
+        // If there was an argument `-f FORMAT`, then use that format
+        // template instead of the default formatting strategy.
+        //
+        // The `Memo::run_all()` function takes in the template and
+        // the current value and writes the result to `stdout`.
+        //
+        // TODO The `run_all()` method takes a string as its second
+        // parameter but we have an `ExtendedBigDecimal`. In order to
+        // satisfy the signature of the function, we convert the
+        // `ExtendedBigDecimal` into a string. The `Memo::run_all()`
+        // logic will subsequently parse that string into something
+        // similar to an `ExtendedBigDecimal` again before rendering
+        // it as a string and ultimately writing to `stdout`. We
+        // shouldn't have to do so much converting back and forth via
+        // strings.
+        match format {
+            Some(f) => {
+                let s = format!("{}", value);
+                if let Err(x) = Memo::run_all(f, &[s]) {
+                    show!(x);
+                    exit(1);
                 }
             }
-            None => write_value_float(
-                &mut stdout,
-                &value,
-                padding,
-                largest_dec,
-                is_first_iteration,
+            None => write_value_float(
+                &mut stdout,
+                &value,
+                padding,
+                largest_dec,
+                is_first_iteration,
             )?,
         }
-        // TODO Implement augmenting addition.
-        value = value + increment.clone();
-        is_first_iteration = false;
+        // TODO Implement augmenting addition.
+        value = value + increment.clone();
+        is_first_iteration = false;
     }
-    if !is_first_iteration {
-        write!(stdout, "{}", terminator)?;
+    if !is_first_iteration {
+        write!(stdout, "{}", terminator)?;
     }
-    stdout.flush()?;
+    stdout.flush()?;
     Ok(())
 }
 
-/// Print an integer sequence.
-///
-/// This function prints a sequence of integers defined by `range`,
-/// which defines the first integer, last integer, and increment of the
-/// range. The `separator` is inserted between each integer and
-/// `terminator` is inserted at the end.
-///
-/// The `pad` parameter indicates whether to pad numbers to the width
-/// given in `padding`.
-///
-/// If `is_first_minus_zero` is `true`, then the `first` parameter is
-/// printed as if it were negative zero, even though no such number
-/// exists as an integer (negative zero only exists for floating point
-/// numbers). Only set this to `true` if `first` is actually zero.
-fn print_seq_integers(
-    range: RangeInt,
-    separator: &str,
-    terminator: &str,
-    pad: bool,
-    padding: usize,
-    format: Option<&str>,
-) -> std::io::Result<()> {
-    let stdout = stdout();
-    let mut stdout = stdout.lock();
-    let (first, increment, last) = range;
-    let mut value = first;
-    let mut is_first_iteration = true;
-    while !done_printing(&value, &increment, &last) {
-        if !is_first_iteration {
-            write!(stdout, "{}", separator)?;
+/// Print an integer sequence.
+///
+/// This function prints a sequence of integers defined by `range`,
+/// which defines the first integer, last integer, and increment of the
+/// range. The `separator` is inserted between each integer and
+/// `terminator` is inserted at the end.
+///
+/// The `pad` parameter indicates whether to pad numbers to the width
+/// given in `padding`.
+///
+/// If `is_first_minus_zero` is `true`, then the `first` parameter is
+/// printed as if it were negative zero, even though no such number
+/// exists as an integer (negative zero only exists for floating point
+/// numbers). Only set this to `true` if `first` is actually zero.
+fn print_seq_integers(
+    range: RangeInt,
+    separator: &str,
+    terminator: &str,
+    pad: bool,
+    padding: usize,
+    format: Option<&str>,
+) -> std::io::Result<()> {
+    let stdout = stdout();
+    let mut stdout = stdout.lock();
+    let (first, increment, last) = range;
+    let mut value = first;
+    let mut is_first_iteration = true;
+    while !done_printing(&value, &increment, &last) {
+        if !is_first_iteration {
+            write!(stdout, "{}", separator)?;
         }
-        // If there was an argument `-f FORMAT`, then use that format
-        // template instead of the default formatting strategy.
-        //
-        // The `Memo::run_all()` function takes in the template and
-        // the current value and writes the result to `stdout`.
-        //
-        // TODO See similar comment about formatting in `print_seq()`.
-        match format {
-            Some(f) => {
-                let s = format!("{}", value);
-                if let Err(x) = Memo::run_all(f, &[s]) {
-                    show!(x);
-                    exit(1);
+        // If there was an argument `-f FORMAT`, then use that format
+        // template instead of the default formatting strategy.
+        //
+        // The `Memo::run_all()` function takes in the template and
+        // the current value and writes the result to `stdout`.
+        //
+        // TODO See similar comment about formatting in `print_seq()`.
+        match format {
+            Some(f) => {
+                let s = format!("{}", value);
+                if let Err(x) = Memo::run_all(f, &[s]) {
+                    show!(x);
+                    exit(1);
                 }
             }
-            None => write_value_int(&mut stdout, &value, padding, pad, is_first_iteration)?,
+            None => write_value_int(&mut stdout, &value, padding, pad, is_first_iteration)?,
         }
-        // TODO Implement augmenting addition.
-        value = value + increment.clone();
-        is_first_iteration = false;
+        // TODO Implement augmenting addition.
+        value = value + increment.clone();
+        is_first_iteration = false;
     }
 
-    if !is_first_iteration {
-        write!(stdout, "{}", terminator)?;
+    if !is_first_iteration {
+        write!(stdout, "{}", terminator)?;
     }
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_shred/shred.rs.html b/dev/src/uu_shred/shred.rs.html index 91a7dcbdb..7d703c292 100644 --- a/dev/src/uu_shred/shred.rs.html +++ b/dev/src/uu_shred/shred.rs.html @@ -1,4 +1,4 @@ -shred.rs - source
1
+shred.rs - source
1
 2
 3
 4
@@ -654,38 +654,38 @@
 654
 655
 656
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) Michael Rosenberg <42micro@gmail.com>
-// * (c) Fort <forticulous@gmail.com>
-// *
-// * For the full copyright and license information, please view the LICENSE
-// * file that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) Michael Rosenberg <42micro@gmail.com>
+// * (c) Fort <forticulous@gmail.com>
+// *
+// * For the full copyright and license information, please view the LICENSE
+// * file that was distributed with this source code.
 
-// spell-checker:ignore (words) writeback wipesync
+// spell-checker:ignore (words) writeback wipesync
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use rand::prelude::SliceRandom;
-use rand::Rng;
-use std::cell::{Cell, RefCell};
-use std::fs;
-use std::fs::{File, OpenOptions};
-use std::io;
-use std::io::prelude::*;
-use std::io::SeekFrom;
-use std::path::{Path, PathBuf};
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
-use uucore::{format_usage, util_name};
+use clap::{crate_version, Arg, ArgAction, Command};
+use rand::prelude::SliceRandom;
+use rand::Rng;
+use std::cell::{Cell, RefCell};
+use std::fs;
+use std::fs::{File, OpenOptions};
+use std::io;
+use std::io::prelude::*;
+use std::io::SeekFrom;
+use std::path::{Path, PathBuf};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
+use uucore::{format_usage, util_name};
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-const BLOCK_SIZE: usize = 512;
-const NAME_CHARSET: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
+const BLOCK_SIZE: usize = 512;
+const NAME_CHARSET: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
 
-// Patterns as shown in the GNU coreutils shred implementation
-const PATTERNS: [&[u8]; 22] = [
+// Patterns as shown in the GNU coreutils shred implementation
+const PATTERNS: [&[u8]; 22] = [
     b"\x00",
     b"\xFF",
     b"\x55",
@@ -710,169 +710,169 @@
     b"\xEE",
 ];
 
-#[derive(Clone, Copy)]
-enum PassType<'a> {
-    Pattern(&'a [u8]),
-    Random,
+#[derive(Clone, Copy)]
+enum PassType<'a> {
+    Pattern(&'a [u8]),
+    Random,
 }
 
-// Used to generate all possible filenames of a certain length using NAME_CHARSET as an alphabet
-struct FilenameGenerator {
-    name_len: usize,
-    name_charset_indices: RefCell<Vec<usize>>, // Store the indices of the letters of our filename in NAME_CHARSET
-    exhausted: Cell<bool>,
+// Used to generate all possible filenames of a certain length using NAME_CHARSET as an alphabet
+struct FilenameGenerator {
+    name_len: usize,
+    name_charset_indices: RefCell<Vec<usize>>, // Store the indices of the letters of our filename in NAME_CHARSET
+    exhausted: Cell<bool>,
 }
 
-impl FilenameGenerator {
-    fn new(name_len: usize) -> Self {
-        let indices: Vec<usize> = vec![0; name_len];
-        Self {
-            name_len,
-            name_charset_indices: RefCell::new(indices),
-            exhausted: Cell::new(false),
+impl FilenameGenerator {
+    fn new(name_len: usize) -> Self {
+        let indices: Vec<usize> = vec![0; name_len];
+        Self {
+            name_len,
+            name_charset_indices: RefCell::new(indices),
+            exhausted: Cell::new(false),
         }
     }
 }
 
-impl Iterator for FilenameGenerator {
-    type Item = String;
+impl Iterator for FilenameGenerator {
+    type Item = String;
 
-    fn next(&mut self) -> Option<String> {
-        if self.exhausted.get() {
-            return None;
+    fn next(&mut self) -> Option<String> {
+        if self.exhausted.get() {
+            return None;
         }
 
-        let mut name_charset_indices = self.name_charset_indices.borrow_mut();
+        let mut name_charset_indices = self.name_charset_indices.borrow_mut();
 
-        // Make the return value, then increment
-        let mut ret = String::new();
-        for i in name_charset_indices.iter() {
-            let c = char::from(NAME_CHARSET[*i]);
-            ret.push(c);
+        // Make the return value, then increment
+        let mut ret = String::new();
+        for i in name_charset_indices.iter() {
+            let c = char::from(NAME_CHARSET[*i]);
+            ret.push(c);
         }
 
-        if name_charset_indices[0] == NAME_CHARSET.len() - 1 {
-            self.exhausted.set(true);
+        if name_charset_indices[0] == NAME_CHARSET.len() - 1 {
+            self.exhausted.set(true);
         }
-        // Now increment the least significant index
-        for i in (0..self.name_len).rev() {
-            if name_charset_indices[i] == NAME_CHARSET.len() - 1 {
-                name_charset_indices[i] = 0; // Carry the 1
-                continue;
-            } else {
-                name_charset_indices[i] += 1;
+        // Now increment the least significant index
+        for i in (0..self.name_len).rev() {
+            if name_charset_indices[i] == NAME_CHARSET.len() - 1 {
+                name_charset_indices[i] = 0; // Carry the 1
+                continue;
+            } else {
+                name_charset_indices[i] += 1;
                 break;
             }
         }
 
-        Some(ret)
+        Some(ret)
     }
 }
 
-// Used to generate blocks of bytes of size <= BLOCK_SIZE based on either a give pattern
-// or randomness
-struct BytesGenerator<'a> {
-    total_bytes: u64,
-    bytes_generated: Cell<u64>,
-    block_size: usize,
-    exact: bool, // if false, every block's size is block_size
-    gen_type: PassType<'a>,
-    rng: Option<RefCell<rand::rngs::ThreadRng>>,
-    bytes: [u8; BLOCK_SIZE],
+// Used to generate blocks of bytes of size <= BLOCK_SIZE based on either a give pattern
+// or randomness
+struct BytesGenerator<'a> {
+    total_bytes: u64,
+    bytes_generated: Cell<u64>,
+    block_size: usize,
+    exact: bool, // if false, every block's size is block_size
+    gen_type: PassType<'a>,
+    rng: Option<RefCell<rand::rngs::ThreadRng>>,
+    bytes: [u8; BLOCK_SIZE],
 }
 
-impl<'a> BytesGenerator<'a> {
-    fn new(total_bytes: u64, gen_type: PassType<'a>, exact: bool) -> BytesGenerator {
-        let rng = match gen_type {
-            PassType::Random => Some(RefCell::new(rand::thread_rng())),
-            _ => None,
+impl<'a> BytesGenerator<'a> {
+    fn new(total_bytes: u64, gen_type: PassType<'a>, exact: bool) -> BytesGenerator {
+        let rng = match gen_type {
+            PassType::Random => Some(RefCell::new(rand::thread_rng())),
+            _ => None,
         };
 
-        let bytes = [0; BLOCK_SIZE];
+        let bytes = [0; BLOCK_SIZE];
 
-        BytesGenerator {
-            total_bytes,
-            bytes_generated: Cell::new(0u64),
-            block_size: BLOCK_SIZE,
-            exact,
-            gen_type,
-            rng,
-            bytes,
+        BytesGenerator {
+            total_bytes,
+            bytes_generated: Cell::new(0u64),
+            block_size: BLOCK_SIZE,
+            exact,
+            gen_type,
+            rng,
+            bytes,
         }
     }
 
-    pub fn reset(&mut self, total_bytes: u64, gen_type: PassType<'a>) {
-        if let PassType::Random = gen_type {
-            if self.rng.is_none() {
-                self.rng = Some(RefCell::new(rand::thread_rng()));
+    pub fn reset(&mut self, total_bytes: u64, gen_type: PassType<'a>) {
+        if let PassType::Random = gen_type {
+            if self.rng.is_none() {
+                self.rng = Some(RefCell::new(rand::thread_rng()));
             }
         }
 
-        self.total_bytes = total_bytes;
-        self.gen_type = gen_type;
+        self.total_bytes = total_bytes;
+        self.gen_type = gen_type;
 
-        self.bytes_generated.set(0);
+        self.bytes_generated.set(0);
     }
 
-    pub fn next(&mut self) -> Option<&[u8]> {
-        // We go over the total_bytes limit when !self.exact and total_bytes isn't a multiple
-        // of self.block_size
-        if self.bytes_generated.get() >= self.total_bytes {
-            return None;
+    pub fn next(&mut self) -> Option<&[u8]> {
+        // We go over the total_bytes limit when !self.exact and total_bytes isn't a multiple
+        // of self.block_size
+        if self.bytes_generated.get() >= self.total_bytes {
+            return None;
         }
 
-        let this_block_size = if !self.exact {
-            self.block_size
-        } else {
-            let bytes_left = self.total_bytes - self.bytes_generated.get();
-            if bytes_left >= self.block_size as u64 {
-                self.block_size
-            } else {
-                (bytes_left % self.block_size as u64) as usize
+        let this_block_size = if !self.exact {
+            self.block_size
+        } else {
+            let bytes_left = self.total_bytes - self.bytes_generated.get();
+            if bytes_left >= self.block_size as u64 {
+                self.block_size
+            } else {
+                (bytes_left % self.block_size as u64) as usize
             }
         };
 
-        let bytes = &mut self.bytes[..this_block_size];
+        let bytes = &mut self.bytes[..this_block_size];
 
-        match self.gen_type {
-            PassType::Random => {
-                let mut rng = self.rng.as_ref().unwrap().borrow_mut();
-                rng.fill(bytes);
+        match self.gen_type {
+            PassType::Random => {
+                let mut rng = self.rng.as_ref().unwrap().borrow_mut();
+                rng.fill(bytes);
             }
-            PassType::Pattern(pattern) => {
-                let skip = if self.bytes_generated.get() == 0 {
-                    0
-                } else {
-                    (pattern.len() as u64 % self.bytes_generated.get()) as usize
+            PassType::Pattern(pattern) => {
+                let skip = if self.bytes_generated.get() == 0 {
+                    0
+                } else {
+                    (pattern.len() as u64 % self.bytes_generated.get()) as usize
                 };
 
-                // Copy the pattern in chunks rather than simply one byte at a time
-                let mut i = 0;
-                while i < this_block_size {
-                    let start = (i + skip) % pattern.len();
-                    let end = (this_block_size - i).min(pattern.len());
-                    let len = end - start;
+                // Copy the pattern in chunks rather than simply one byte at a time
+                let mut i = 0;
+                while i < this_block_size {
+                    let start = (i + skip) % pattern.len();
+                    let end = (this_block_size - i).min(pattern.len());
+                    let len = end - start;
 
-                    bytes[i..i + len].copy_from_slice(&pattern[start..end]);
+                    bytes[i..i + len].copy_from_slice(&pattern[start..end]);
 
-                    i += len;
+                    i += len;
                 }
             }
         };
 
-        let new_bytes_generated = self.bytes_generated.get() + this_block_size as u64;
-        self.bytes_generated.set(new_bytes_generated);
+        let new_bytes_generated = self.bytes_generated.get() + this_block_size as u64;
+        self.bytes_generated.set(new_bytes_generated);
 
-        Some(bytes)
+        Some(bytes)
     }
 }
 
-static ABOUT: &str = "Overwrite the specified FILE(s) repeatedly, in order to make it harder\n\
+static ABOUT: &str = "Overwrite the specified FILE(s) repeatedly, in order to make it harder\n\
 for even very expensive hardware probing to recover the data.
 ";
-const USAGE: &str = "{} [OPTION]... FILE...";
+const USAGE: &str = "{} [OPTION]... FILE...";
 
-static AFTER_HELP: &str =
+static AFTER_HELP: &str =
     "Delete FILE(s) if --remove (-u) is specified.  The default is not to remove\n\
      the files because it is common to operate on device files like /dev/hda,\n\
      and those files usually should not be removed.\n\
@@ -909,406 +909,406 @@ for even very expensive hardware probing to recover the data.
      to be recovered later.\n\
      ";
 
-pub mod options {
-    pub const FORCE: &str = "force";
-    pub const FILE: &str = "file";
-    pub const ITERATIONS: &str = "iterations";
-    pub const SIZE: &str = "size";
-    pub const REMOVE: &str = "remove";
-    pub const VERBOSE: &str = "verbose";
-    pub const EXACT: &str = "exact";
-    pub const ZERO: &str = "zero";
+pub mod options {
+    pub const FORCE: &str = "force";
+    pub const FILE: &str = "file";
+    pub const ITERATIONS: &str = "iterations";
+    pub const SIZE: &str = "size";
+    pub const REMOVE: &str = "remove";
+    pub const VERBOSE: &str = "verbose";
+    pub const EXACT: &str = "exact";
+    pub const ZERO: &str = "zero";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    if !matches.contains_id(options::FILE) {
-        return Err(UUsageError::new(1, "missing file operand"));
+    if !matches.contains_id(options::FILE) {
+        return Err(UUsageError::new(1, "missing file operand"));
     }
 
-    let iterations = match matches.get_one::<String>(options::ITERATIONS) {
-        Some(s) => match s.parse::<usize>() {
-            Ok(u) => u,
+    let iterations = match matches.get_one::<String>(options::ITERATIONS) {
+        Some(s) => match s.parse::<usize>() {
+            Ok(u) => u,
             Err(_) => {
-                return Err(USimpleError::new(
+                return Err(USimpleError::new(
                     1,
-                    format!("invalid number of passes: {}", s.quote()),
+                    format!("invalid number of passes: {}", s.quote()),
                 ))
             }
         },
-        None => unreachable!(),
+        None => unreachable!(),
     };
 
-    // TODO: implement --remove HOW
-    //       The optional HOW parameter indicates how to remove a directory entry:
-    //         - 'unlink' => use a standard unlink call.
-    //         - 'wipe' => also first obfuscate bytes in the name.
-    //         - 'wipesync' => also sync each obfuscated byte to disk.
-    //       The default mode is 'wipesync', but note it can be expensive.
+    // TODO: implement --remove HOW
+    //       The optional HOW parameter indicates how to remove a directory entry:
+    //         - 'unlink' => use a standard unlink call.
+    //         - 'wipe' => also first obfuscate bytes in the name.
+    //         - 'wipesync' => also sync each obfuscated byte to disk.
+    //       The default mode is 'wipesync', but note it can be expensive.
 
-    // TODO: implement --random-source
+    // TODO: implement --random-source
 
-    let force = matches.get_flag(options::FORCE);
-    let remove = matches.get_flag(options::REMOVE);
-    let size_arg = matches
-        .get_one::<String>(options::SIZE)
-        .map(|s| s.to_string());
-    let size = get_size(size_arg);
-    let exact = matches.get_flag(options::EXACT) && size.is_none(); // if -s is given, ignore -x
-    let zero = matches.get_flag(options::ZERO);
-    let verbose = matches.get_flag(options::VERBOSE);
+    let force = matches.get_flag(options::FORCE);
+    let remove = matches.get_flag(options::REMOVE);
+    let size_arg = matches
+        .get_one::<String>(options::SIZE)
+        .map(|s| s.to_string());
+    let size = get_size(size_arg);
+    let exact = matches.get_flag(options::EXACT) && size.is_none(); // if -s is given, ignore -x
+    let zero = matches.get_flag(options::ZERO);
+    let verbose = matches.get_flag(options::VERBOSE);
 
-    for path_str in matches.get_many::<String>(options::FILE).unwrap() {
-        show_if_err!(wipe_file(
-            path_str, iterations, remove, size, exact, zero, verbose, force,
+    for path_str in matches.get_many::<String>(options::FILE).unwrap() {
+        show_if_err!(wipe_file(
+            path_str, iterations, remove, size, exact, zero, verbose, force,
         ));
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(AFTER_HELP)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::FORCE)
-                .long(options::FORCE)
-                .short('f')
-                .help("change permissions to allow writing if necessary")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(AFTER_HELP)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::FORCE)
+                .long(options::FORCE)
+                .short('f')
+                .help("change permissions to allow writing if necessary")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ITERATIONS)
-                .long(options::ITERATIONS)
-                .short('n')
-                .help("overwrite N times instead of the default (3)")
-                .value_name("NUMBER")
-                .default_value("3"),
+        .arg(
+            Arg::new(options::ITERATIONS)
+                .long(options::ITERATIONS)
+                .short('n')
+                .help("overwrite N times instead of the default (3)")
+                .value_name("NUMBER")
+                .default_value("3"),
         )
-        .arg(
-            Arg::new(options::SIZE)
-                .long(options::SIZE)
-                .short('s')
-                .value_name("N")
-                .help("shred this many bytes (suffixes like K, M, G accepted)"),
+        .arg(
+            Arg::new(options::SIZE)
+                .long(options::SIZE)
+                .short('s')
+                .value_name("N")
+                .help("shred this many bytes (suffixes like K, M, G accepted)"),
         )
-        .arg(
-            Arg::new(options::REMOVE)
-                .short('u')
-                .long(options::REMOVE)
-                .help("truncate and remove file after overwriting;  See below")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::REMOVE)
+                .short('u')
+                .long(options::REMOVE)
+                .help("truncate and remove file after overwriting;  See below")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::VERBOSE)
-                .long(options::VERBOSE)
-                .short('v')
-                .help("show progress")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::VERBOSE)
+                .long(options::VERBOSE)
+                .short('v')
+                .help("show progress")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::EXACT)
-                .long(options::EXACT)
-                .short('x')
-                .help(
+        .arg(
+            Arg::new(options::EXACT)
+                .long(options::EXACT)
+                .short('x')
+                .help(
                     "do not round file sizes up to the next full block;\n\
                      this is the default for non-regular files",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ZERO)
-                .long(options::ZERO)
-                .short('z')
-                .help("add a final overwrite with zeros to hide shredding")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO)
+                .long(options::ZERO)
+                .short('z')
+                .help("add a final overwrite with zeros to hide shredding")
+                .action(ArgAction::SetTrue),
         )
-        // Positional arguments
-        .arg(
-            Arg::new(options::FILE)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        // Positional arguments
+        .arg(
+            Arg::new(options::FILE)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-// TODO: Add support for all postfixes here up to and including EiB
-//       http://www.gnu.org/software/coreutils/manual/coreutils.html#Block-size
-fn get_size(size_str_opt: Option<String>) -> Option<u64> {
-    size_str_opt.as_ref()?;
+// TODO: Add support for all postfixes here up to and including EiB
+//       http://www.gnu.org/software/coreutils/manual/coreutils.html#Block-size
+fn get_size(size_str_opt: Option<String>) -> Option<u64> {
+    size_str_opt.as_ref()?;
 
-    let mut size_str = size_str_opt.as_ref().unwrap().clone();
-    // Immutably look at last character of size string
-    let unit = match size_str.chars().last().unwrap() {
-        'K' => {
-            size_str.pop();
-            1024u64
+    let mut size_str = size_str_opt.as_ref().unwrap().clone();
+    // Immutably look at last character of size string
+    let unit = match size_str.chars().last().unwrap() {
+        'K' => {
+            size_str.pop();
+            1024u64
+        }
+        'M' => {
+            size_str.pop();
+            (1024 * 1024) as u64
         }
-        'M' => {
-            size_str.pop();
-            (1024 * 1024) as u64
+        'G' => {
+            size_str.pop();
+            (1024 * 1024 * 1024) as u64
         }
-        'G' => {
-            size_str.pop();
-            (1024 * 1024 * 1024) as u64
-        }
-        _ => 1u64,
+        _ => 1u64,
     };
 
-    let coefficient = match size_str.parse::<u64>() {
-        Ok(u) => u,
+    let coefficient = match size_str.parse::<u64>() {
+        Ok(u) => u,
         Err(_) => {
             println!(
                 "{}: {}: Invalid file size",
-                util_name(),
-                size_str_opt.unwrap().maybe_quote()
+                util_name(),
+                size_str_opt.unwrap().maybe_quote()
             );
-            std::process::exit(1);
+            std::process::exit(1);
         }
     };
 
-    Some(coefficient * unit)
+    Some(coefficient * unit)
 }
 
-fn pass_name(pass_type: PassType) -> String {
-    match pass_type {
-        PassType::Random => String::from("random"),
-        PassType::Pattern(bytes) => {
-            let mut s: String = String::new();
-            while s.len() < 6 {
-                for b in bytes {
-                    let readable: String = format!("{:x}", b);
-                    s.push_str(&readable);
+fn pass_name(pass_type: PassType) -> String {
+    match pass_type {
+        PassType::Random => String::from("random"),
+        PassType::Pattern(bytes) => {
+            let mut s: String = String::new();
+            while s.len() < 6 {
+                for b in bytes {
+                    let readable: String = format!("{:x}", b);
+                    s.push_str(&readable);
                 }
             }
-            s
+            s
         }
     }
 }
 
-#[allow(clippy::too_many_arguments)]
-fn wipe_file(
-    path_str: &str,
-    n_passes: usize,
-    remove: bool,
-    size: Option<u64>,
-    exact: bool,
-    zero: bool,
-    verbose: bool,
-    force: bool,
-) -> UResult<()> {
-    // Get these potential errors out of the way first
-    let path: &Path = Path::new(path_str);
-    if !path.exists() {
-        return Err(USimpleError::new(
+#[allow(clippy::too_many_arguments)]
+fn wipe_file(
+    path_str: &str,
+    n_passes: usize,
+    remove: bool,
+    size: Option<u64>,
+    exact: bool,
+    zero: bool,
+    verbose: bool,
+    force: bool,
+) -> UResult<()> {
+    // Get these potential errors out of the way first
+    let path: &Path = Path::new(path_str);
+    if !path.exists() {
+        return Err(USimpleError::new(
             1,
-            format!("{}: No such file or directory", path.maybe_quote()),
+            format!("{}: No such file or directory", path.maybe_quote()),
         ));
     }
-    if !path.is_file() {
-        return Err(USimpleError::new(
+    if !path.is_file() {
+        return Err(USimpleError::new(
             1,
-            format!("{}: Not a file", path.maybe_quote()),
+            format!("{}: Not a file", path.maybe_quote()),
         ));
     }
 
-    // If force is true, set file permissions to not-readonly.
-    if force {
-        let metadata = fs::metadata(path).map_err_context(String::new)?;
-        let mut perms = metadata.permissions();
-        perms.set_readonly(false);
-        fs::set_permissions(path, perms).map_err_context(String::new)?;
+    // If force is true, set file permissions to not-readonly.
+    if force {
+        let metadata = fs::metadata(path).map_err_context(String::new)?;
+        let mut perms = metadata.permissions();
+        perms.set_readonly(false);
+        fs::set_permissions(path, perms).map_err_context(String::new)?;
     }
 
-    // Fill up our pass sequence
-    let mut pass_sequence: Vec<PassType> = Vec::new();
+    // Fill up our pass sequence
+    let mut pass_sequence: Vec<PassType> = Vec::new();
 
-    if n_passes <= 3 {
-        // Only random passes if n_passes <= 3
-        for _ in 0..n_passes {
-            pass_sequence.push(PassType::Random);
+    if n_passes <= 3 {
+        // Only random passes if n_passes <= 3
+        for _ in 0..n_passes {
+            pass_sequence.push(PassType::Random);
         }
     }
-    // First fill it with Patterns, shuffle it, then evenly distribute Random
-    else {
-        let n_full_arrays = n_passes / PATTERNS.len(); // How many times can we go through all the patterns?
-        let remainder = n_passes % PATTERNS.len(); // How many do we get through on our last time through?
+    // First fill it with Patterns, shuffle it, then evenly distribute Random
+    else {
+        let n_full_arrays = n_passes / PATTERNS.len(); // How many times can we go through all the patterns?
+        let remainder = n_passes % PATTERNS.len(); // How many do we get through on our last time through?
 
-        for _ in 0..n_full_arrays {
-            for p in &PATTERNS {
-                pass_sequence.push(PassType::Pattern(p));
+        for _ in 0..n_full_arrays {
+            for p in &PATTERNS {
+                pass_sequence.push(PassType::Pattern(p));
             }
         }
-        for pattern in PATTERNS.iter().take(remainder) {
-            pass_sequence.push(PassType::Pattern(pattern));
+        for pattern in PATTERNS.iter().take(remainder) {
+            pass_sequence.push(PassType::Pattern(pattern));
         }
-        let mut rng = rand::thread_rng();
-        pass_sequence.shuffle(&mut rng); // randomize the order of application
+        let mut rng = rand::thread_rng();
+        pass_sequence.shuffle(&mut rng); // randomize the order of application
 
-        let n_random = 3 + n_passes / 10; // Minimum 3 random passes; ratio of 10 after
-                                          // Evenly space random passes; ensures one at the beginning and end
-        for i in 0..n_random {
-            pass_sequence[i * (n_passes - 1) / (n_random - 1)] = PassType::Random;
+        let n_random = 3 + n_passes / 10; // Minimum 3 random passes; ratio of 10 after
+                                          // Evenly space random passes; ensures one at the beginning and end
+        for i in 0..n_random {
+            pass_sequence[i * (n_passes - 1) / (n_random - 1)] = PassType::Random;
         }
     }
 
-    // --zero specifies whether we want one final pass of 0x00 on our file
-    if zero {
-        pass_sequence.push(PassType::Pattern(b"\x00"));
+    // --zero specifies whether we want one final pass of 0x00 on our file
+    if zero {
+        pass_sequence.push(PassType::Pattern(b"\x00"));
     }
 
     {
-        let total_passes: usize = pass_sequence.len();
-        let mut file: File = OpenOptions::new()
-            .write(true)
-            .truncate(false)
-            .open(path)
-            .map_err_context(|| format!("{}: failed to open for writing", path.maybe_quote()))?;
+        let total_passes: usize = pass_sequence.len();
+        let mut file: File = OpenOptions::new()
+            .write(true)
+            .truncate(false)
+            .open(path)
+            .map_err_context(|| format!("{}: failed to open for writing", path.maybe_quote()))?;
 
-        // NOTE: it does not really matter what we set for total_bytes and gen_type here, so just
-        //       use bogus values
-        let mut generator = BytesGenerator::new(0, PassType::Pattern(&[]), exact);
+        // NOTE: it does not really matter what we set for total_bytes and gen_type here, so just
+        //       use bogus values
+        let mut generator = BytesGenerator::new(0, PassType::Pattern(&[]), exact);
 
-        for (i, pass_type) in pass_sequence.iter().enumerate() {
-            if verbose {
-                let pass_name: String = pass_name(*pass_type);
-                if total_passes.to_string().len() == 1 {
+        for (i, pass_type) in pass_sequence.iter().enumerate() {
+            if verbose {
+                let pass_name: String = pass_name(*pass_type);
+                if total_passes.to_string().len() == 1 {
                     println!(
                         "{}: {}: pass {}/{} ({})... ",
-                        util_name(),
-                        path.maybe_quote(),
-                        i + 1,
-                        total_passes,
-                        pass_name
+                        util_name(),
+                        path.maybe_quote(),
+                        i + 1,
+                        total_passes,
+                        pass_name
                     );
-                } else {
+                } else {
                     println!(
                         "{}: {}: pass {:2.0}/{:2.0} ({})... ",
-                        util_name(),
-                        path.maybe_quote(),
-                        i + 1,
-                        total_passes,
-                        pass_name
+                        util_name(),
+                        path.maybe_quote(),
+                        i + 1,
+                        total_passes,
+                        pass_name
                     );
                 }
             }
-            // size is an optional argument for exactly how many bytes we want to shred
-            show_if_err!(do_pass(&mut file, path, &mut generator, *pass_type, size)
-                .map_err_context(|| format!("{}: File write pass failed", path.maybe_quote())));
-            // Ignore failed writes; just keep trying
-        }
+            // size is an optional argument for exactly how many bytes we want to shred
+            show_if_err!(do_pass(&mut file, path, &mut generator, *pass_type, size)
+                .map_err_context(|| format!("{}: File write pass failed", path.maybe_quote())));
+            // Ignore failed writes; just keep trying
+        }
     }
 
-    if remove {
-        do_remove(path, path_str, verbose)
-            .map_err_context(|| format!("{}: failed to remove file", path.maybe_quote()))?;
+    if remove {
+        do_remove(path, path_str, verbose)
+            .map_err_context(|| format!("{}: failed to remove file", path.maybe_quote()))?;
     }
     Ok(())
 }
 
-fn do_pass<'a>(
-    file: &mut File,
-    path: &Path,
-    generator: &mut BytesGenerator<'a>,
-    generator_type: PassType<'a>,
-    given_file_size: Option<u64>,
-) -> Result<(), io::Error> {
-    file.seek(SeekFrom::Start(0))?;
+fn do_pass<'a>(
+    file: &mut File,
+    path: &Path,
+    generator: &mut BytesGenerator<'a>,
+    generator_type: PassType<'a>,
+    given_file_size: Option<u64>,
+) -> Result<(), io::Error> {
+    file.seek(SeekFrom::Start(0))?;
 
-    // Use the given size or the whole file if not specified
-    let size: u64 = given_file_size.unwrap_or(get_file_size(path)?);
+    // Use the given size or the whole file if not specified
+    let size: u64 = given_file_size.unwrap_or(get_file_size(path)?);
 
-    generator.reset(size, generator_type);
+    generator.reset(size, generator_type);
 
-    while let Some(block) = generator.next() {
-        file.write_all(block)?;
+    while let Some(block) = generator.next() {
+        file.write_all(block)?;
     }
 
-    file.sync_data()?;
+    file.sync_data()?;
 
     Ok(())
 }
 
-fn get_file_size(path: &Path) -> Result<u64, io::Error> {
-    let size: u64 = fs::metadata(path)?.len();
+fn get_file_size(path: &Path) -> Result<u64, io::Error> {
+    let size: u64 = fs::metadata(path)?.len();
 
-    Ok(size)
+    Ok(size)
 }
 
-// Repeatedly renames the file with strings of decreasing length (most likely all 0s)
-// Return the path of the file after its last renaming or None if error
-fn wipe_name(orig_path: &Path, verbose: bool) -> Option<PathBuf> {
-    let file_name_len: usize = orig_path.file_name().unwrap().to_str().unwrap().len();
+// Repeatedly renames the file with strings of decreasing length (most likely all 0s)
+// Return the path of the file after its last renaming or None if error
+fn wipe_name(orig_path: &Path, verbose: bool) -> Option<PathBuf> {
+    let file_name_len: usize = orig_path.file_name().unwrap().to_str().unwrap().len();
 
-    let mut last_path: PathBuf = PathBuf::from(orig_path);
+    let mut last_path: PathBuf = PathBuf::from(orig_path);
 
-    for length in (1..=file_name_len).rev() {
-        for name in FilenameGenerator::new(length) {
-            let new_path: PathBuf = orig_path.with_file_name(name);
-            // We don't want the filename to already exist (don't overwrite)
-            // If it does, find another name that doesn't
-            if new_path.exists() {
+    for length in (1..=file_name_len).rev() {
+        for name in FilenameGenerator::new(length) {
+            let new_path: PathBuf = orig_path.with_file_name(name);
+            // We don't want the filename to already exist (don't overwrite)
+            // If it does, find another name that doesn't
+            if new_path.exists() {
                 continue;
             }
-            match fs::rename(&last_path, &new_path) {
+            match fs::rename(&last_path, &new_path) {
                 Ok(()) => {
-                    if verbose {
+                    if verbose {
                         println!(
                             "{}: {}: renamed to {}",
-                            util_name(),
-                            last_path.maybe_quote(),
-                            new_path.quote()
+                            util_name(),
+                            last_path.maybe_quote(),
+                            new_path.quote()
                         );
                     }
 
-                    // Sync every file rename
-                    {
-                        let new_file: File = File::open(new_path.clone())
-                            .expect("Failed to open renamed file for syncing");
-                        new_file.sync_all().expect("Failed to sync renamed file");
+                    // Sync every file rename
+                    {
+                        let new_file: File = File::open(new_path.clone())
+                            .expect("Failed to open renamed file for syncing");
+                        new_file.sync_all().expect("Failed to sync renamed file");
                     }
 
-                    last_path = new_path;
+                    last_path = new_path;
                     break;
                 }
-                Err(e) => {
+                Err(e) => {
                     println!(
                         "{}: {}: Couldn't rename to {}: {}",
-                        util_name(),
-                        last_path.maybe_quote(),
-                        new_path.quote(),
-                        e
+                        util_name(),
+                        last_path.maybe_quote(),
+                        new_path.quote(),
+                        e
                     );
-                    return None;
+                    return None;
                 }
             }
-        } // If every possible filename already exists, just reduce the length and try again
-    }
+        } // If every possible filename already exists, just reduce the length and try again
+    }
 
-    Some(last_path)
+    Some(last_path)
 }
 
-fn do_remove(path: &Path, orig_filename: &str, verbose: bool) -> Result<(), io::Error> {
-    if verbose {
-        println!("{}: {}: removing", util_name(), orig_filename.maybe_quote());
+fn do_remove(path: &Path, orig_filename: &str, verbose: bool) -> Result<(), io::Error> {
+    if verbose {
+        println!("{}: {}: removing", util_name(), orig_filename.maybe_quote());
     }
 
-    let renamed_path: Option<PathBuf> = wipe_name(path, verbose);
-    if let Some(rp) = renamed_path {
-        fs::remove_file(rp)?;
+    let renamed_path: Option<PathBuf> = wipe_name(path, verbose);
+    if let Some(rp) = renamed_path {
+        fs::remove_file(rp)?;
     }
 
-    if verbose {
-        println!("{}: {}: removed", util_name(), orig_filename.maybe_quote());
+    if verbose {
+        println!("{}: {}: removed", util_name(), orig_filename.maybe_quote());
     }
 
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_shuf/rand_read_adapter.rs.html b/dev/src/uu_shuf/rand_read_adapter.rs.html index 4974643e5..34c29b1c0 100644 --- a/dev/src/uu_shuf/rand_read_adapter.rs.html +++ b/dev/src/uu_shuf/rand_read_adapter.rs.html @@ -1,4 +1,4 @@ -rand_read_adapter.rs - source
1
+rand_read_adapter.rs - source
1
 2
 3
 4
@@ -142,149 +142,149 @@
 142
 143
 144
-
// Copyright 2018 Developers of the Rand project.
-// Copyright 2013 The Rust Project Developers.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
+
// Copyright 2018 Developers of the Rand project.
+// Copyright 2013 The Rust Project Developers.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
 
-//! A wrapper around any Read to treat it as an RNG.
+//! A wrapper around any Read to treat it as an RNG.
 
-use std::fmt;
-use std::io::Read;
+use std::fmt;
+use std::io::Read;
 
-use rand_core::{impls, Error, RngCore};
+use rand_core::{impls, Error, RngCore};
 
-/// An RNG that reads random bytes straight from any type supporting
-/// [`std::io::Read`], for example files.
-///
-/// This will work best with an infinite reader, but that is not required.
-///
-/// This can be used with `/dev/urandom` on Unix but it is recommended to use
-/// [`OsRng`] instead.
-///
-/// # Panics
-///
-/// `ReadRng` uses [`std::io::Read::read_exact`], which retries on interrupts.
-/// All other errors from the underlying reader, including when it does not
-/// have enough data, will only be reported through [`try_fill_bytes`].
-/// The other [`RngCore`] methods will panic in case of an error.
-///
-/// [`OsRng`]: rand::rngs::OsRng
-/// [`try_fill_bytes`]: RngCore::try_fill_bytes
-#[derive(Debug)]
-pub struct ReadRng<R> {
-    reader: R,
+/// An RNG that reads random bytes straight from any type supporting
+/// [`std::io::Read`], for example files.
+///
+/// This will work best with an infinite reader, but that is not required.
+///
+/// This can be used with `/dev/urandom` on Unix but it is recommended to use
+/// [`OsRng`] instead.
+///
+/// # Panics
+///
+/// `ReadRng` uses [`std::io::Read::read_exact`], which retries on interrupts.
+/// All other errors from the underlying reader, including when it does not
+/// have enough data, will only be reported through [`try_fill_bytes`].
+/// The other [`RngCore`] methods will panic in case of an error.
+///
+/// [`OsRng`]: rand::rngs::OsRng
+/// [`try_fill_bytes`]: RngCore::try_fill_bytes
+#[derive(Debug)]
+pub struct ReadRng<R> {
+    reader: R,
 }
 
-impl<R: Read> ReadRng<R> {
-    /// Create a new `ReadRng` from a `Read`.
-    pub fn new(r: R) -> Self {
-        Self { reader: r }
+impl<R: Read> ReadRng<R> {
+    /// Create a new `ReadRng` from a `Read`.
+    pub fn new(r: R) -> Self {
+        Self { reader: r }
     }
 }
 
-impl<R: Read> RngCore for ReadRng<R> {
-    fn next_u32(&mut self) -> u32 {
-        impls::next_u32_via_fill(self)
+impl<R: Read> RngCore for ReadRng<R> {
+    fn next_u32(&mut self) -> u32 {
+        impls::next_u32_via_fill(self)
     }
 
-    fn next_u64(&mut self) -> u64 {
-        impls::next_u64_via_fill(self)
+    fn next_u64(&mut self) -> u64 {
+        impls::next_u64_via_fill(self)
     }
 
-    fn fill_bytes(&mut self, dest: &mut [u8]) {
-        self.try_fill_bytes(dest).unwrap_or_else(|err| {
+    fn fill_bytes(&mut self, dest: &mut [u8]) {
+        self.try_fill_bytes(dest).unwrap_or_else(|err| {
             panic!(
                 "reading random bytes from Read implementation failed; error: {}",
-                err
+                err
             );
         });
     }
 
-    fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
-        if dest.is_empty() {
-            return Ok(());
+    fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
+        if dest.is_empty() {
+            return Ok(());
         }
-        // Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`.
-        self.reader
-            .read_exact(dest)
-            .map_err(|e| Error::new(ReadError(e)))
+        // Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`.
+        self.reader
+            .read_exact(dest)
+            .map_err(|e| Error::new(ReadError(e)))
     }
 }
 
-/// `ReadRng` error type
-#[derive(Debug)]
-pub struct ReadError(std::io::Error);
+/// `ReadRng` error type
+#[derive(Debug)]
+pub struct ReadError(std::io::Error);
 
-impl fmt::Display for ReadError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "ReadError: {}", self.0)
+impl fmt::Display for ReadError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "ReadError: {}", self.0)
     }
 }
 
-impl std::error::Error for ReadError {
-    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
+impl std::error::Error for ReadError {
+    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
         Some(&self.0)
     }
 }
 
-#[cfg(test)]
-mod test {
-    use std::println;
+#[cfg(test)]
+mod test {
+    use std::println;
 
-    use super::ReadRng;
-    use rand::RngCore;
+    use super::ReadRng;
+    use rand::RngCore;
 
-    #[test]
-    fn test_reader_rng_u64() {
-        // transmute from the target to avoid endianness concerns.
-        #[rustfmt::skip]
-        let v = [0u8, 0, 0, 0, 0, 0, 0, 1,
+    #[test]
+    fn test_reader_rng_u64() {
+        // transmute from the target to avoid endianness concerns.
+        #[rustfmt::skip]
+        let v = [0u8, 0, 0, 0, 0, 0, 0, 1,
                  0,   4, 0, 0, 3, 0, 0, 2,
                  5,   0, 0, 0, 0, 0, 0, 0];
-        let mut rng = ReadRng::new(&v[..]);
+        let mut rng = ReadRng::new(&v[..]);
 
-        assert_eq!(rng.next_u64(), 1 << 56);
-        assert_eq!(rng.next_u64(), (2 << 56) + (3 << 32) + (4 << 8));
-        assert_eq!(rng.next_u64(), 5);
+        assert_eq!(rng.next_u64(), 1 << 56);
+        assert_eq!(rng.next_u64(), (2 << 56) + (3 << 32) + (4 << 8));
+        assert_eq!(rng.next_u64(), 5);
     }
 
-    #[test]
-    fn test_reader_rng_u32() {
-        let v = [0u8, 0, 0, 1, 0, 0, 2, 0, 3, 0, 0, 0];
-        let mut rng = ReadRng::new(&v[..]);
+    #[test]
+    fn test_reader_rng_u32() {
+        let v = [0u8, 0, 0, 1, 0, 0, 2, 0, 3, 0, 0, 0];
+        let mut rng = ReadRng::new(&v[..]);
 
-        assert_eq!(rng.next_u32(), 1 << 24);
-        assert_eq!(rng.next_u32(), 2 << 16);
-        assert_eq!(rng.next_u32(), 3);
+        assert_eq!(rng.next_u32(), 1 << 24);
+        assert_eq!(rng.next_u32(), 2 << 16);
+        assert_eq!(rng.next_u32(), 3);
     }
 
-    #[test]
-    fn test_reader_rng_fill_bytes() {
-        let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
-        let mut w = [0u8; 8];
+    #[test]
+    fn test_reader_rng_fill_bytes() {
+        let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
+        let mut w = [0u8; 8];
 
-        let mut rng = ReadRng::new(&v[..]);
-        rng.fill_bytes(&mut w);
+        let mut rng = ReadRng::new(&v[..]);
+        rng.fill_bytes(&mut w);
 
-        assert!(v == w);
+        assert!(v == w);
     }
 
-    #[test]
-    fn test_reader_rng_insufficient_bytes() {
-        let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
-        let mut w = [0u8; 9];
+    #[test]
+    fn test_reader_rng_insufficient_bytes() {
+        let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
+        let mut w = [0u8; 9];
 
-        let mut rng = ReadRng::new(&v[..]);
+        let mut rng = ReadRng::new(&v[..]);
 
-        let result = rng.try_fill_bytes(&mut w);
-        assert!(result.is_err());
-        println!("Error: {}", result.unwrap_err());
+        let result = rng.try_fill_bytes(&mut w);
+        assert!(result.is_err());
+        println!("Error: {}", result.unwrap_err());
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_shuf/shuf.rs.html b/dev/src/uu_shuf/shuf.rs.html index 91350af08..3fe57c18e 100644 --- a/dev/src/uu_shuf/shuf.rs.html +++ b/dev/src/uu_shuf/shuf.rs.html @@ -1,4 +1,4 @@ -shuf.rs - source
1
+shuf.rs - source
1
 2
 3
 4
@@ -341,348 +341,348 @@
 341
 342
 343
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) cmdline evec seps rvec fdata
+// spell-checker:ignore (ToDO) cmdline evec seps rvec fdata
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use memchr::memchr_iter;
-use rand::prelude::SliceRandom;
-use rand::RngCore;
-use std::fs::File;
-use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use memchr::memchr_iter;
+use rand::prelude::SliceRandom;
+use rand::RngCore;
+use std::fs::File;
+use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError};
+use uucore::format_usage;
 
-mod rand_read_adapter;
+mod rand_read_adapter;
 
-enum Mode {
-    Default(String),
-    Echo(Vec<String>),
-    InputRange((usize, usize)),
+enum Mode {
+    Default(String),
+    Echo(Vec<String>),
+    InputRange((usize, usize)),
 }
 
-static NAME: &str = "shuf";
-static USAGE: &str = "\
+static NAME: &str = "shuf";
+static USAGE: &str = "\
     {} [OPTION]... [FILE]
     {} -e [OPTION]... [ARG]...
     {} -i LO-HI [OPTION]...";
-static ABOUT: &str = "\
+static ABOUT: &str = "\
     Shuffle the input by outputting a random permutation of input lines. \
     Each output permutation is equally likely. \
     With no FILE, or when FILE is -, read standard input.";
 
-struct Options {
-    head_count: usize,
-    output: Option<String>,
-    random_source: Option<String>,
-    repeat: bool,
-    sep: u8,
+struct Options {
+    head_count: usize,
+    output: Option<String>,
+    random_source: Option<String>,
+    repeat: bool,
+    sep: u8,
 }
 
-mod options {
-    pub static ECHO: &str = "echo";
-    pub static INPUT_RANGE: &str = "input-range";
-    pub static HEAD_COUNT: &str = "head-count";
-    pub static OUTPUT: &str = "output";
-    pub static RANDOM_SOURCE: &str = "random-source";
-    pub static REPEAT: &str = "repeat";
-    pub static ZERO_TERMINATED: &str = "zero-terminated";
-    pub static FILE: &str = "file";
+mod options {
+    pub static ECHO: &str = "echo";
+    pub static INPUT_RANGE: &str = "input-range";
+    pub static HEAD_COUNT: &str = "head-count";
+    pub static OUTPUT: &str = "output";
+    pub static RANDOM_SOURCE: &str = "random-source";
+    pub static REPEAT: &str = "repeat";
+    pub static ZERO_TERMINATED: &str = "zero-terminated";
+    pub static FILE: &str = "file";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let mode = if let Some(args) = matches.get_many::<String>(options::ECHO) {
-        Mode::Echo(args.map(String::from).collect())
-    } else if let Some(range) = matches.get_one::<String>(options::INPUT_RANGE) {
-        match parse_range(range) {
-            Ok(m) => Mode::InputRange(m),
-            Err(msg) => {
-                return Err(USimpleError::new(1, msg));
+    let mode = if let Some(args) = matches.get_many::<String>(options::ECHO) {
+        Mode::Echo(args.map(String::from).collect())
+    } else if let Some(range) = matches.get_one::<String>(options::INPUT_RANGE) {
+        match parse_range(range) {
+            Ok(m) => Mode::InputRange(m),
+            Err(msg) => {
+                return Err(USimpleError::new(1, msg));
             }
         }
-    } else {
-        Mode::Default(
-            matches
-                .get_one::<String>(options::FILE)
-                .map(|s| s.as_str())
-                .unwrap_or("-")
-                .to_string(),
+    } else {
+        Mode::Default(
+            matches
+                .get_one::<String>(options::FILE)
+                .map(|s| s.as_str())
+                .unwrap_or("-")
+                .to_string(),
         )
     };
 
-    let options = Options {
-        head_count: {
-            let headcounts = matches
-                .get_many::<String>(options::HEAD_COUNT)
-                .unwrap_or_default()
-                .map(|s| s.to_owned())
-                .collect();
-            match parse_head_count(headcounts) {
-                Ok(val) => val,
-                Err(msg) => return Err(USimpleError::new(1, msg)),
+    let options = Options {
+        head_count: {
+            let headcounts = matches
+                .get_many::<String>(options::HEAD_COUNT)
+                .unwrap_or_default()
+                .map(|s| s.to_owned())
+                .collect();
+            match parse_head_count(headcounts) {
+                Ok(val) => val,
+                Err(msg) => return Err(USimpleError::new(1, msg)),
             }
         },
-        output: matches.get_one::<String>(options::OUTPUT).map(String::from),
-        random_source: matches
-            .get_one::<String>(options::RANDOM_SOURCE)
-            .map(String::from),
-        repeat: matches.get_flag(options::REPEAT),
-        sep: if matches.get_flag(options::ZERO_TERMINATED) {
-            0x00_u8
-        } else {
-            0x0a_u8
-        },
+        output: matches.get_one::<String>(options::OUTPUT).map(String::from),
+        random_source: matches
+            .get_one::<String>(options::RANDOM_SOURCE)
+            .map(String::from),
+        repeat: matches.get_flag(options::REPEAT),
+        sep: if matches.get_flag(options::ZERO_TERMINATED) {
+            0x00_u8
+        } else {
+            0x0a_u8
+        },
     };
 
-    match mode {
-        Mode::Echo(args) => {
-            let mut evec = args.iter().map(String::as_bytes).collect::<Vec<_>>();
-            find_seps(&mut evec, options.sep);
-            shuf_bytes(&mut evec, options)?;
+    match mode {
+        Mode::Echo(args) => {
+            let mut evec = args.iter().map(String::as_bytes).collect::<Vec<_>>();
+            find_seps(&mut evec, options.sep);
+            shuf_bytes(&mut evec, options)?;
         }
-        Mode::InputRange((b, e)) => {
-            let rvec = (b..e).map(|x| format!("{}", x)).collect::<Vec<String>>();
-            let mut rvec = rvec.iter().map(String::as_bytes).collect::<Vec<&[u8]>>();
-            shuf_bytes(&mut rvec, options)?;
+        Mode::InputRange((b, e)) => {
+            let rvec = (b..e).map(|x| format!("{}", x)).collect::<Vec<String>>();
+            let mut rvec = rvec.iter().map(String::as_bytes).collect::<Vec<&[u8]>>();
+            shuf_bytes(&mut rvec, options)?;
         }
-        Mode::Default(filename) => {
-            let fdata = read_input_file(&filename)?;
-            let mut fdata = vec![&fdata[..]];
-            find_seps(&mut fdata, options.sep);
-            shuf_bytes(&mut fdata, options)?;
+        Mode::Default(filename) => {
+            let fdata = read_input_file(&filename)?;
+            let mut fdata = vec![&fdata[..]];
+            find_seps(&mut fdata, options.sep);
+            shuf_bytes(&mut fdata, options)?;
         }
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .about(ABOUT)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .args_override_self(true)
-        .arg(
-            Arg::new(options::ECHO)
-                .short('e')
-                .long(options::ECHO)
-                .value_name("ARG")
-                .help("treat each ARG as an input line")
-                .use_value_delimiter(false)
-                .num_args(0..)
-                .conflicts_with(options::INPUT_RANGE),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .about(ABOUT)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .args_override_self(true)
+        .arg(
+            Arg::new(options::ECHO)
+                .short('e')
+                .long(options::ECHO)
+                .value_name("ARG")
+                .help("treat each ARG as an input line")
+                .use_value_delimiter(false)
+                .num_args(0..)
+                .conflicts_with(options::INPUT_RANGE),
         )
-        .arg(
-            Arg::new(options::INPUT_RANGE)
-                .short('i')
-                .long(options::INPUT_RANGE)
-                .value_name("LO-HI")
-                .help("treat each number LO through HI as an input line")
-                .conflicts_with(options::FILE),
+        .arg(
+            Arg::new(options::INPUT_RANGE)
+                .short('i')
+                .long(options::INPUT_RANGE)
+                .value_name("LO-HI")
+                .help("treat each number LO through HI as an input line")
+                .conflicts_with(options::FILE),
         )
-        .arg(
-            Arg::new(options::HEAD_COUNT)
-                .short('n')
-                .long(options::HEAD_COUNT)
-                .value_name("COUNT")
-                .help("output at most COUNT lines"),
+        .arg(
+            Arg::new(options::HEAD_COUNT)
+                .short('n')
+                .long(options::HEAD_COUNT)
+                .value_name("COUNT")
+                .help("output at most COUNT lines"),
         )
-        .arg(
-            Arg::new(options::OUTPUT)
-                .short('o')
-                .long(options::OUTPUT)
-                .value_name("FILE")
-                .help("write result to FILE instead of standard output")
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::OUTPUT)
+                .short('o')
+                .long(options::OUTPUT)
+                .value_name("FILE")
+                .help("write result to FILE instead of standard output")
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::RANDOM_SOURCE)
-                .long(options::RANDOM_SOURCE)
-                .value_name("FILE")
-                .help("get random bytes from FILE")
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::RANDOM_SOURCE)
+                .long(options::RANDOM_SOURCE)
+                .value_name("FILE")
+                .help("get random bytes from FILE")
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::REPEAT)
-                .short('r')
-                .long(options::REPEAT)
-                .help("output lines can be repeated")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::REPEAT)
+                .short('r')
+                .long(options::REPEAT)
+                .help("output lines can be repeated")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ZERO_TERMINATED)
-                .short('z')
-                .long(options::ZERO_TERMINATED)
-                .help("line delimiter is NUL, not newline")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO_TERMINATED)
+                .short('z')
+                .long(options::ZERO_TERMINATED)
+                .help("line delimiter is NUL, not newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(Arg::new(options::FILE).value_hint(clap::ValueHint::FilePath))
+        .arg(Arg::new(options::FILE).value_hint(clap::ValueHint::FilePath))
 }
 
-fn read_input_file(filename: &str) -> UResult<Vec<u8>> {
-    let mut file = BufReader::new(if filename == "-" {
-        Box::new(stdin()) as Box<dyn Read>
-    } else {
-        let file = File::open(filename)
-            .map_err_context(|| format!("failed to open {}", filename.quote()))?;
-        Box::new(file) as Box<dyn Read>
+fn read_input_file(filename: &str) -> UResult<Vec<u8>> {
+    let mut file = BufReader::new(if filename == "-" {
+        Box::new(stdin()) as Box<dyn Read>
+    } else {
+        let file = File::open(filename)
+            .map_err_context(|| format!("failed to open {}", filename.quote()))?;
+        Box::new(file) as Box<dyn Read>
     });
 
-    let mut data = Vec::new();
-    file.read_to_end(&mut data)
-        .map_err_context(|| format!("failed reading {}", filename.quote()))?;
+    let mut data = Vec::new();
+    file.read_to_end(&mut data)
+        .map_err_context(|| format!("failed reading {}", filename.quote()))?;
 
-    Ok(data)
+    Ok(data)
 }
 
-fn find_seps(data: &mut Vec<&[u8]>, sep: u8) {
-    // need to use for loop so we don't borrow the vector as we modify it in place
-    // basic idea:
-    // * We don't care about the order of the result. This lets us slice the slices
-    //   without making a new vector.
-    // * Starting from the end of the vector, we examine each element.
-    // * If that element contains the separator, we remove it from the vector,
-    //   and then sub-slice it into slices that do not contain the separator.
-    // * We maintain the invariant throughout that each element in the vector past
-    //   the ith element does not have any separators remaining.
-    for i in (0..data.len()).rev() {
-        if data[i].contains(&sep) {
-            let this = data.swap_remove(i);
-            let mut p = 0;
-            for i in memchr_iter(sep, this) {
-                data.push(&this[p..i]);
-                p = i + 1;
+fn find_seps(data: &mut Vec<&[u8]>, sep: u8) {
+    // need to use for loop so we don't borrow the vector as we modify it in place
+    // basic idea:
+    // * We don't care about the order of the result. This lets us slice the slices
+    //   without making a new vector.
+    // * Starting from the end of the vector, we examine each element.
+    // * If that element contains the separator, we remove it from the vector,
+    //   and then sub-slice it into slices that do not contain the separator.
+    // * We maintain the invariant throughout that each element in the vector past
+    //   the ith element does not have any separators remaining.
+    for i in (0..data.len()).rev() {
+        if data[i].contains(&sep) {
+            let this = data.swap_remove(i);
+            let mut p = 0;
+            for i in memchr_iter(sep, this) {
+                data.push(&this[p..i]);
+                p = i + 1;
             }
-            if p < this.len() {
-                data.push(&this[p..]);
+            if p < this.len() {
+                data.push(&this[p..]);
             }
         }
     }
 }
 
-fn shuf_bytes(input: &mut Vec<&[u8]>, opts: Options) -> UResult<()> {
-    let mut output = BufWriter::new(match opts.output {
-        None => Box::new(stdout()) as Box<dyn Write>,
-        Some(s) => {
-            let file = File::create(&s[..])
-                .map_err_context(|| format!("failed to open {} for writing", s.quote()))?;
-            Box::new(file) as Box<dyn Write>
+fn shuf_bytes(input: &mut Vec<&[u8]>, opts: Options) -> UResult<()> {
+    let mut output = BufWriter::new(match opts.output {
+        None => Box::new(stdout()) as Box<dyn Write>,
+        Some(s) => {
+            let file = File::create(&s[..])
+                .map_err_context(|| format!("failed to open {} for writing", s.quote()))?;
+            Box::new(file) as Box<dyn Write>
         }
     });
 
-    let mut rng = match opts.random_source {
-        Some(r) => {
-            let file = File::open(&r[..])
-                .map_err_context(|| format!("failed to open random source {}", r.quote()))?;
-            WrappedRng::RngFile(rand_read_adapter::ReadRng::new(file))
+    let mut rng = match opts.random_source {
+        Some(r) => {
+            let file = File::open(&r[..])
+                .map_err_context(|| format!("failed to open random source {}", r.quote()))?;
+            WrappedRng::RngFile(rand_read_adapter::ReadRng::new(file))
         }
-        None => WrappedRng::RngDefault(rand::thread_rng()),
+        None => WrappedRng::RngDefault(rand::thread_rng()),
     };
 
-    if input.is_empty() {
-        return Ok(());
+    if input.is_empty() {
+        return Ok(());
     }
 
-    if opts.repeat {
-        for _ in 0..opts.head_count {
-            // Returns None is the slice is empty. We checked this before, so
-            // this is safe.
-            let r = input.choose(&mut rng).unwrap();
+    if opts.repeat {
+        for _ in 0..opts.head_count {
+            // Returns None is the slice is empty. We checked this before, so
+            // this is safe.
+            let r = input.choose(&mut rng).unwrap();
 
-            output
-                .write_all(r)
-                .map_err_context(|| "write failed".to_string())?;
-            output
-                .write_all(&[opts.sep])
-                .map_err_context(|| "write failed".to_string())?;
+            output
+                .write_all(r)
+                .map_err_context(|| "write failed".to_string())?;
+            output
+                .write_all(&[opts.sep])
+                .map_err_context(|| "write failed".to_string())?;
         }
-    } else {
-        let (shuffled, _) = input.partial_shuffle(&mut rng, opts.head_count);
-        for r in shuffled {
-            output
-                .write_all(r)
-                .map_err_context(|| "write failed".to_string())?;
-            output
-                .write_all(&[opts.sep])
-                .map_err_context(|| "write failed".to_string())?;
+    } else {
+        let (shuffled, _) = input.partial_shuffle(&mut rng, opts.head_count);
+        for r in shuffled {
+            output
+                .write_all(r)
+                .map_err_context(|| "write failed".to_string())?;
+            output
+                .write_all(&[opts.sep])
+                .map_err_context(|| "write failed".to_string())?;
         }
     }
 
     Ok(())
 }
 
-fn parse_range(input_range: &str) -> Result<(usize, usize), String> {
-    if let Some((from, to)) = input_range.split_once('-') {
-        let begin = from
-            .parse::<usize>()
-            .map_err(|_| format!("invalid input range: {}", from.quote()))?;
-        let end = to
-            .parse::<usize>()
-            .map_err(|_| format!("invalid input range: {}", to.quote()))?;
-        Ok((begin, end + 1))
-    } else {
-        Err(format!("invalid input range: {}", input_range.quote()))
+fn parse_range(input_range: &str) -> Result<(usize, usize), String> {
+    if let Some((from, to)) = input_range.split_once('-') {
+        let begin = from
+            .parse::<usize>()
+            .map_err(|_| format!("invalid input range: {}", from.quote()))?;
+        let end = to
+            .parse::<usize>()
+            .map_err(|_| format!("invalid input range: {}", to.quote()))?;
+        Ok((begin, end + 1))
+    } else {
+        Err(format!("invalid input range: {}", input_range.quote()))
     }
 }
 
-fn parse_head_count(headcounts: Vec<String>) -> Result<usize, String> {
-    let mut result = std::usize::MAX;
-    for count in headcounts {
-        match count.parse::<usize>() {
-            Ok(pv) => result = std::cmp::min(result, pv),
-            Err(_) => return Err(format!("invalid line count: {}", count.quote())),
+fn parse_head_count(headcounts: Vec<String>) -> Result<usize, String> {
+    let mut result = std::usize::MAX;
+    for count in headcounts {
+        match count.parse::<usize>() {
+            Ok(pv) => result = std::cmp::min(result, pv),
+            Err(_) => return Err(format!("invalid line count: {}", count.quote())),
         }
     }
-    Ok(result)
+    Ok(result)
 }
 
-enum WrappedRng {
-    RngFile(rand_read_adapter::ReadRng<File>),
-    RngDefault(rand::rngs::ThreadRng),
+enum WrappedRng {
+    RngFile(rand_read_adapter::ReadRng<File>),
+    RngDefault(rand::rngs::ThreadRng),
 }
 
-impl RngCore for WrappedRng {
-    fn next_u32(&mut self) -> u32 {
-        match self {
-            Self::RngFile(r) => r.next_u32(),
-            Self::RngDefault(r) => r.next_u32(),
+impl RngCore for WrappedRng {
+    fn next_u32(&mut self) -> u32 {
+        match self {
+            Self::RngFile(r) => r.next_u32(),
+            Self::RngDefault(r) => r.next_u32(),
         }
     }
 
-    fn next_u64(&mut self) -> u64 {
-        match self {
-            Self::RngFile(r) => r.next_u64(),
-            Self::RngDefault(r) => r.next_u64(),
+    fn next_u64(&mut self) -> u64 {
+        match self {
+            Self::RngFile(r) => r.next_u64(),
+            Self::RngDefault(r) => r.next_u64(),
         }
     }
 
-    fn fill_bytes(&mut self, dest: &mut [u8]) {
-        match self {
-            Self::RngFile(r) => r.fill_bytes(dest),
-            Self::RngDefault(r) => r.fill_bytes(dest),
+    fn fill_bytes(&mut self, dest: &mut [u8]) {
+        match self {
+            Self::RngFile(r) => r.fill_bytes(dest),
+            Self::RngDefault(r) => r.fill_bytes(dest),
         }
     }
 
-    fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> {
-        match self {
-            Self::RngFile(r) => r.try_fill_bytes(dest),
-            Self::RngDefault(r) => r.try_fill_bytes(dest),
+    fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> {
+        match self {
+            Self::RngFile(r) => r.try_fill_bytes(dest),
+            Self::RngDefault(r) => r.try_fill_bytes(dest),
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sleep/sleep.rs.html b/dev/src/uu_sleep/sleep.rs.html index ce3d8be50..1fabbf9c2 100644 --- a/dev/src/uu_sleep/sleep.rs.html +++ b/dev/src/uu_sleep/sleep.rs.html @@ -1,4 +1,4 @@ -sleep.rs - source
1
+sleep.rs - source
1
 2
 3
 4
@@ -69,76 +69,76 @@
 69
 70
 71
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-use std::thread;
-use std::time::Duration;
+use std::thread;
+use std::time::Duration;
 
-use uucore::{
-    error::{UResult, UUsageError},
-    format_usage,
+use uucore::{
+    error::{UResult, UUsageError},
+    format_usage,
 };
 
-use clap::{crate_version, Arg, ArgAction, Command};
+use clap::{crate_version, Arg, ArgAction, Command};
 
-static ABOUT: &str = "Pause for NUMBER seconds.";
-const USAGE: &str = "\
+static ABOUT: &str = "Pause for NUMBER seconds.";
+const USAGE: &str = "\
     {} NUMBER[SUFFIX]...
     {} OPTION";
-static LONG_HELP: &str = "Pause for NUMBER seconds.  SUFFIX may be 's' for seconds (the default),
+static LONG_HELP: &str = "Pause for NUMBER seconds.  SUFFIX may be 's' for seconds (the default),
 'm' for minutes, 'h' for hours or 'd' for days.  Unlike most implementations
 that require NUMBER be an integer, here NUMBER may be an arbitrary floating
 point number.  Given two or more arguments, pause for the amount of time
 specified by the sum of their values.";
 
-mod options {
-    pub const NUMBER: &str = "NUMBER";
+mod options {
+    pub const NUMBER: &str = "NUMBER";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    if let Some(values) = matches.get_many::<String>(options::NUMBER) {
-        let numbers = values.map(|s| s.as_str()).collect::<Vec<_>>();
-        return sleep(&numbers);
+    if let Some(values) = matches.get_many::<String>(options::NUMBER) {
+        let numbers = values.map(|s| s.as_str()).collect::<Vec<_>>();
+        return sleep(&numbers);
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(LONG_HELP)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::NUMBER)
-                .help("pause for NUMBER seconds")
-                .value_name(options::NUMBER)
-                .action(ArgAction::Append)
-                .required(true),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(LONG_HELP)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::NUMBER)
+                .help("pause for NUMBER seconds")
+                .value_name(options::NUMBER)
+                .action(ArgAction::Append)
+                .required(true),
         )
 }
 
-fn sleep(args: &[&str]) -> UResult<()> {
-    let sleep_dur =
-        args.iter().try_fold(
-            Duration::new(0, 0),
-            |result, arg| match uucore::parse_time::from_str(&arg[..]) {
-                Ok(m) => Ok(m.saturating_add(result)),
-                Err(f) => Err(UUsageError::new(1, f)),
+fn sleep(args: &[&str]) -> UResult<()> {
+    let sleep_dur =
+        args.iter().try_fold(
+            Duration::new(0, 0),
+            |result, arg| match uucore::parse_time::from_str(&arg[..]) {
+                Ok(m) => Ok(m.saturating_add(result)),
+                Err(f) => Err(UUsageError::new(1, f)),
             },
         )?;
-    thread::sleep(sleep_dur);
+    thread::sleep(sleep_dur);
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sort/check.rs.html b/dev/src/uu_sort/check.rs.html index 0327eaecd..55aefb1e5 100644 --- a/dev/src/uu_sort/check.rs.html +++ b/dev/src/uu_sort/check.rs.html @@ -1,4 +1,4 @@ -check.rs - source
1
+check.rs - source
1
 2
 3
 4
@@ -128,135 +128,135 @@
 128
 129
 130
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-//! Check if a file is ordered
+//! Check if a file is ordered
 
-use crate::{
-    chunks::{self, Chunk, RecycledChunk},
-    compare_by, open, GlobalSettings, SortError,
+use crate::{
+    chunks::{self, Chunk, RecycledChunk},
+    compare_by, open, GlobalSettings, SortError,
 };
-use itertools::Itertools;
-use std::{
-    cmp::Ordering,
-    ffi::OsStr,
-    io::Read,
-    iter,
-    sync::mpsc::{sync_channel, Receiver, SyncSender},
-    thread,
+use itertools::Itertools;
+use std::{
+    cmp::Ordering,
+    ffi::OsStr,
+    io::Read,
+    iter,
+    sync::mpsc::{sync_channel, Receiver, SyncSender},
+    thread,
 };
-use uucore::error::UResult;
+use uucore::error::UResult;
 
-/// Check if the file at `path` is ordered.
-///
-/// # Returns
-///
-/// The code we should exit with.
-pub fn check(path: &OsStr, settings: &GlobalSettings) -> UResult<()> {
-    let max_allowed_cmp = if settings.unique {
-        // If `unique` is enabled, the previous line must compare _less_ to the next one.
-        Ordering::Less
-    } else {
-        // Otherwise, the line previous line must compare _less or equal_ to the next one.
-        Ordering::Equal
+/// Check if the file at `path` is ordered.
+///
+/// # Returns
+///
+/// The code we should exit with.
+pub fn check(path: &OsStr, settings: &GlobalSettings) -> UResult<()> {
+    let max_allowed_cmp = if settings.unique {
+        // If `unique` is enabled, the previous line must compare _less_ to the next one.
+        Ordering::Less
+    } else {
+        // Otherwise, the line previous line must compare _less or equal_ to the next one.
+        Ordering::Equal
     };
-    let file = open(path)?;
-    let (recycled_sender, recycled_receiver) = sync_channel(2);
-    let (loaded_sender, loaded_receiver) = sync_channel(2);
-    thread::spawn({
-        let settings = settings.clone();
-        move || reader(file, &recycled_receiver, &loaded_sender, &settings)
+    let file = open(path)?;
+    let (recycled_sender, recycled_receiver) = sync_channel(2);
+    let (loaded_sender, loaded_receiver) = sync_channel(2);
+    thread::spawn({
+        let settings = settings.clone();
+        move || reader(file, &recycled_receiver, &loaded_sender, &settings)
     });
-    for _ in 0..2 {
-        let _ = recycled_sender.send(RecycledChunk::new(if settings.buffer_size < 100 * 1024 {
-            // when the buffer size is smaller than 100KiB we choose it instead of the default.
-            // this improves testability.
-            settings.buffer_size
-        } else {
-            100 * 1024
-        }));
+    for _ in 0..2 {
+        let _ = recycled_sender.send(RecycledChunk::new(if settings.buffer_size < 100 * 1024 {
+            // when the buffer size is smaller than 100KiB we choose it instead of the default.
+            // this improves testability.
+            settings.buffer_size
+        } else {
+            100 * 1024
+        }));
     }
 
-    let mut prev_chunk: Option<Chunk> = None;
-    let mut line_idx = 0;
-    for chunk in loaded_receiver.iter() {
-        line_idx += 1;
-        if let Some(prev_chunk) = prev_chunk.take() {
-            // Check if the first element of the new chunk is greater than the last
-            // element from the previous chunk
-            let prev_last = prev_chunk.lines().last().unwrap();
-            let new_first = chunk.lines().first().unwrap();
+    let mut prev_chunk: Option<Chunk> = None;
+    let mut line_idx = 0;
+    for chunk in loaded_receiver.iter() {
+        line_idx += 1;
+        if let Some(prev_chunk) = prev_chunk.take() {
+            // Check if the first element of the new chunk is greater than the last
+            // element from the previous chunk
+            let prev_last = prev_chunk.lines().last().unwrap();
+            let new_first = chunk.lines().first().unwrap();
 
-            if compare_by(
-                prev_last,
-                new_first,
-                settings,
-                prev_chunk.line_data(),
-                chunk.line_data(),
-            ) > max_allowed_cmp
+            if compare_by(
+                prev_last,
+                new_first,
+                settings,
+                prev_chunk.line_data(),
+                chunk.line_data(),
+            ) > max_allowed_cmp
             {
-                return Err(SortError::Disorder {
-                    file: path.to_owned(),
-                    line_number: line_idx,
-                    line: new_first.line.to_owned(),
-                    silent: settings.check_silent,
+                return Err(SortError::Disorder {
+                    file: path.to_owned(),
+                    line_number: line_idx,
+                    line: new_first.line.to_owned(),
+                    silent: settings.check_silent,
                 }
-                .into());
+                .into());
             }
-            let _ = recycled_sender.send(prev_chunk.recycle());
+            let _ = recycled_sender.send(prev_chunk.recycle());
         }
 
-        for (a, b) in chunk.lines().iter().tuple_windows() {
-            line_idx += 1;
-            if compare_by(a, b, settings, chunk.line_data(), chunk.line_data()) > max_allowed_cmp {
-                return Err(SortError::Disorder {
-                    file: path.to_owned(),
-                    line_number: line_idx,
-                    line: b.line.to_owned(),
-                    silent: settings.check_silent,
+        for (a, b) in chunk.lines().iter().tuple_windows() {
+            line_idx += 1;
+            if compare_by(a, b, settings, chunk.line_data(), chunk.line_data()) > max_allowed_cmp {
+                return Err(SortError::Disorder {
+                    file: path.to_owned(),
+                    line_number: line_idx,
+                    line: b.line.to_owned(),
+                    silent: settings.check_silent,
                 }
-                .into());
+                .into());
             }
         }
 
-        prev_chunk = Some(chunk);
+        prev_chunk = Some(chunk);
     }
     Ok(())
 }
 
-/// The function running on the reader thread.
-fn reader(
-    mut file: Box<dyn Read + Send>,
-    receiver: &Receiver<RecycledChunk>,
-    sender: &SyncSender<Chunk>,
-    settings: &GlobalSettings,
-) -> UResult<()> {
-    let mut carry_over = vec![];
-    for recycled_chunk in receiver.iter() {
-        let should_continue = chunks::read(
-            sender,
-            recycled_chunk,
+/// The function running on the reader thread.
+fn reader(
+    mut file: Box<dyn Read + Send>,
+    receiver: &Receiver<RecycledChunk>,
+    sender: &SyncSender<Chunk>,
+    settings: &GlobalSettings,
+) -> UResult<()> {
+    let mut carry_over = vec![];
+    for recycled_chunk in receiver.iter() {
+        let should_continue = chunks::read(
+            sender,
+            recycled_chunk,
             None,
-            &mut carry_over,
-            &mut file,
-            &mut iter::empty(),
-            if settings.zero_terminated {
-                b'\0'
-            } else {
-                b'\n'
-            },
-            settings,
+            &mut carry_over,
+            &mut file,
+            &mut iter::empty(),
+            if settings.zero_terminated {
+                b'\0'
+            } else {
+                b'\n'
+            },
+            settings,
         )?;
-        if !should_continue {
+        if !should_continue {
             break;
         }
     }
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sort/chunks.rs.html b/dev/src/uu_sort/chunks.rs.html index f523714d1..a9fae5e08 100644 --- a/dev/src/uu_sort/chunks.rs.html +++ b/dev/src/uu_sort/chunks.rs.html @@ -1,4 +1,4 @@ -chunks.rs - source
1
+chunks.rs - source
1
 2
 3
 4
@@ -319,326 +319,326 @@
 319
 320
 321
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-//! Utilities for reading files as chunks.
+//! Utilities for reading files as chunks.
 
-#![allow(dead_code)]
-// Ignores non-used warning for `borrow_buffer` in `Chunk`
+#![allow(dead_code)]
+// Ignores non-used warning for `borrow_buffer` in `Chunk`
 
-use std::{
-    io::{ErrorKind, Read},
-    sync::mpsc::SyncSender,
+use std::{
+    io::{ErrorKind, Read},
+    sync::mpsc::SyncSender,
 };
 
-use memchr::memchr_iter;
-use ouroboros::self_referencing;
-use uucore::error::{UResult, USimpleError};
+use memchr::memchr_iter;
+use ouroboros::self_referencing;
+use uucore::error::{UResult, USimpleError};
 
-use crate::{numeric_str_cmp::NumInfo, GeneralF64ParseResult, GlobalSettings, Line, SortError};
+use crate::{numeric_str_cmp::NumInfo, GeneralF64ParseResult, GlobalSettings, Line, SortError};
 
-/// The chunk that is passed around between threads.
-/// `lines` consist of slices into `buffer`.
-#[self_referencing(pub_extras)]
-#[derive(Debug)]
-pub struct Chunk {
-    pub buffer: Vec<u8>,
-    #[borrows(buffer)]
-    #[covariant]
-    pub contents: ChunkContents<'this>,
+/// The chunk that is passed around between threads.
+/// `lines` consist of slices into `buffer`.
+#[self_referencing(pub_extras)]
+#[derive(Debug)]
+pub struct Chunk {
+    pub buffer: Vec<u8>,
+    #[borrows(buffer)]
+    #[covariant]
+    pub contents: ChunkContents<'this>,
 }
 
-#[derive(Debug)]
-pub struct ChunkContents<'a> {
-    pub lines: Vec<Line<'a>>,
-    pub line_data: LineData<'a>,
+#[derive(Debug)]
+pub struct ChunkContents<'a> {
+    pub lines: Vec<Line<'a>>,
+    pub line_data: LineData<'a>,
 }
 
-#[derive(Debug)]
-pub struct LineData<'a> {
-    pub selections: Vec<&'a str>,
-    pub num_infos: Vec<NumInfo>,
-    pub parsed_floats: Vec<GeneralF64ParseResult>,
+#[derive(Debug)]
+pub struct LineData<'a> {
+    pub selections: Vec<&'a str>,
+    pub num_infos: Vec<NumInfo>,
+    pub parsed_floats: Vec<GeneralF64ParseResult>,
 }
 
-impl Chunk {
-    /// Destroy this chunk and return its components to be reused.
-    pub fn recycle(mut self) -> RecycledChunk {
-        let recycled_contents = self.with_contents_mut(|contents| {
-            contents.lines.clear();
-            contents.line_data.selections.clear();
-            contents.line_data.num_infos.clear();
-            contents.line_data.parsed_floats.clear();
-            let lines = unsafe {
-                // SAFETY: It is safe to (temporarily) transmute to a vector of lines with a longer lifetime,
-                // because the vector is empty.
-                // Transmuting is necessary to make recycling possible. See https://github.com/rust-lang/rfcs/pull/2802
-                // for a rfc to make this unnecessary. Its example is similar to the code here.
-                std::mem::transmute::<Vec<Line<'_>>, Vec<Line<'static>>>(std::mem::take(
-                    &mut contents.lines,
+impl Chunk {
+    /// Destroy this chunk and return its components to be reused.
+    pub fn recycle(mut self) -> RecycledChunk {
+        let recycled_contents = self.with_contents_mut(|contents| {
+            contents.lines.clear();
+            contents.line_data.selections.clear();
+            contents.line_data.num_infos.clear();
+            contents.line_data.parsed_floats.clear();
+            let lines = unsafe {
+                // SAFETY: It is safe to (temporarily) transmute to a vector of lines with a longer lifetime,
+                // because the vector is empty.
+                // Transmuting is necessary to make recycling possible. See https://github.com/rust-lang/rfcs/pull/2802
+                // for a rfc to make this unnecessary. Its example is similar to the code here.
+                std::mem::transmute::<Vec<Line<'_>>, Vec<Line<'static>>>(std::mem::take(
+                    &mut contents.lines,
                 ))
             };
-            let selections = unsafe {
-                // SAFETY: (same as above) It is safe to (temporarily) transmute to a vector of &str with a longer lifetime,
-                // because the vector is empty.
-                std::mem::transmute::<Vec<&'_ str>, Vec<&'static str>>(std::mem::take(
-                    &mut contents.line_data.selections,
+            let selections = unsafe {
+                // SAFETY: (same as above) It is safe to (temporarily) transmute to a vector of &str with a longer lifetime,
+                // because the vector is empty.
+                std::mem::transmute::<Vec<&'_ str>, Vec<&'static str>>(std::mem::take(
+                    &mut contents.line_data.selections,
                 ))
             };
             (
-                lines,
-                selections,
-                std::mem::take(&mut contents.line_data.num_infos),
-                std::mem::take(&mut contents.line_data.parsed_floats),
+                lines,
+                selections,
+                std::mem::take(&mut contents.line_data.num_infos),
+                std::mem::take(&mut contents.line_data.parsed_floats),
             )
         });
-        RecycledChunk {
-            lines: recycled_contents.0,
-            selections: recycled_contents.1,
-            num_infos: recycled_contents.2,
-            parsed_floats: recycled_contents.3,
-            buffer: self.into_heads().buffer,
+        RecycledChunk {
+            lines: recycled_contents.0,
+            selections: recycled_contents.1,
+            num_infos: recycled_contents.2,
+            parsed_floats: recycled_contents.3,
+            buffer: self.into_heads().buffer,
         }
     }
 
-    pub fn lines(&self) -> &Vec<Line> {
-        &self.borrow_contents().lines
+    pub fn lines(&self) -> &Vec<Line> {
+        &self.borrow_contents().lines
     }
-    pub fn line_data(&self) -> &LineData {
-        &self.borrow_contents().line_data
+    pub fn line_data(&self) -> &LineData {
+        &self.borrow_contents().line_data
     }
 }
 
-pub struct RecycledChunk {
-    lines: Vec<Line<'static>>,
-    selections: Vec<&'static str>,
-    num_infos: Vec<NumInfo>,
-    parsed_floats: Vec<GeneralF64ParseResult>,
-    buffer: Vec<u8>,
+pub struct RecycledChunk {
+    lines: Vec<Line<'static>>,
+    selections: Vec<&'static str>,
+    num_infos: Vec<NumInfo>,
+    parsed_floats: Vec<GeneralF64ParseResult>,
+    buffer: Vec<u8>,
 }
 
-impl RecycledChunk {
-    pub fn new(capacity: usize) -> Self {
-        Self {
-            lines: Vec::new(),
-            selections: Vec::new(),
-            num_infos: Vec::new(),
-            parsed_floats: Vec::new(),
-            buffer: vec![0; capacity],
+impl RecycledChunk {
+    pub fn new(capacity: usize) -> Self {
+        Self {
+            lines: Vec::new(),
+            selections: Vec::new(),
+            num_infos: Vec::new(),
+            parsed_floats: Vec::new(),
+            buffer: vec![0; capacity],
         }
     }
 }
 
-/// Read a chunk, parse lines and send them.
-///
-/// No empty chunk will be sent. If we reach the end of the input, `false` is returned.
-/// However, if this function returns `true`, it is not guaranteed that there is still
-/// input left: If the input fits _exactly_ into a buffer, we will only notice that there's
-/// nothing more to read at the next invocation. In case there is no input left, nothing will
-/// be sent.
-///
-/// # Arguments
-///
-/// (see also `read_to_chunk` for a more detailed documentation)
-///
-/// * `sender`: The sender to send the lines to the sorter.
-/// * `recycled_chunk`: The recycled chunk, as returned by `Chunk::recycle`.
-///   (i.e. `buffer.len()` should be equal to `buffer.capacity()`)
-/// * `max_buffer_size`: How big `buffer` can be.
-/// * `carry_over`: The bytes that must be carried over in between invocations.
-/// * `file`: The current file.
-/// * `next_files`: What `file` should be updated to next.
-/// * `separator`: The line separator.
-/// * `settings`: The global settings.
-#[allow(clippy::too_many_arguments)]
-pub fn read<T: Read>(
-    sender: &SyncSender<Chunk>,
-    recycled_chunk: RecycledChunk,
-    max_buffer_size: Option<usize>,
-    carry_over: &mut Vec<u8>,
-    file: &mut T,
-    next_files: &mut impl Iterator<Item = UResult<T>>,
-    separator: u8,
-    settings: &GlobalSettings,
-) -> UResult<bool> {
-    let RecycledChunk {
-        lines,
-        selections,
-        num_infos,
-        parsed_floats,
-        mut buffer,
-    } = recycled_chunk;
-    if buffer.len() < carry_over.len() {
-        buffer.resize(carry_over.len() + 10 * 1024, 0);
+/// Read a chunk, parse lines and send them.
+///
+/// No empty chunk will be sent. If we reach the end of the input, `false` is returned.
+/// However, if this function returns `true`, it is not guaranteed that there is still
+/// input left: If the input fits _exactly_ into a buffer, we will only notice that there's
+/// nothing more to read at the next invocation. In case there is no input left, nothing will
+/// be sent.
+///
+/// # Arguments
+///
+/// (see also `read_to_chunk` for a more detailed documentation)
+///
+/// * `sender`: The sender to send the lines to the sorter.
+/// * `recycled_chunk`: The recycled chunk, as returned by `Chunk::recycle`.
+///   (i.e. `buffer.len()` should be equal to `buffer.capacity()`)
+/// * `max_buffer_size`: How big `buffer` can be.
+/// * `carry_over`: The bytes that must be carried over in between invocations.
+/// * `file`: The current file.
+/// * `next_files`: What `file` should be updated to next.
+/// * `separator`: The line separator.
+/// * `settings`: The global settings.
+#[allow(clippy::too_many_arguments)]
+pub fn read<T: Read>(
+    sender: &SyncSender<Chunk>,
+    recycled_chunk: RecycledChunk,
+    max_buffer_size: Option<usize>,
+    carry_over: &mut Vec<u8>,
+    file: &mut T,
+    next_files: &mut impl Iterator<Item = UResult<T>>,
+    separator: u8,
+    settings: &GlobalSettings,
+) -> UResult<bool> {
+    let RecycledChunk {
+        lines,
+        selections,
+        num_infos,
+        parsed_floats,
+        mut buffer,
+    } = recycled_chunk;
+    if buffer.len() < carry_over.len() {
+        buffer.resize(carry_over.len() + 10 * 1024, 0);
     }
-    buffer[..carry_over.len()].copy_from_slice(carry_over);
-    let (read, should_continue) = read_to_buffer(
-        file,
-        next_files,
-        &mut buffer,
-        max_buffer_size,
-        carry_over.len(),
-        separator,
+    buffer[..carry_over.len()].copy_from_slice(carry_over);
+    let (read, should_continue) = read_to_buffer(
+        file,
+        next_files,
+        &mut buffer,
+        max_buffer_size,
+        carry_over.len(),
+        separator,
     )?;
-    carry_over.clear();
-    carry_over.extend_from_slice(&buffer[read..]);
+    carry_over.clear();
+    carry_over.extend_from_slice(&buffer[read..]);
 
-    if read != 0 {
-        let payload: UResult<Chunk> = Chunk::try_new(buffer, |buffer| {
-            let selections = unsafe {
-                // SAFETY: It is safe to transmute to an empty vector of selections with shorter lifetime.
-                // It was only temporarily transmuted to a Vec<Line<'static>> to make recycling possible.
-                std::mem::transmute::<Vec<&'static str>, Vec<&'_ str>>(selections)
+    if read != 0 {
+        let payload: UResult<Chunk> = Chunk::try_new(buffer, |buffer| {
+            let selections = unsafe {
+                // SAFETY: It is safe to transmute to an empty vector of selections with shorter lifetime.
+                // It was only temporarily transmuted to a Vec<Line<'static>> to make recycling possible.
+                std::mem::transmute::<Vec<&'static str>, Vec<&'_ str>>(selections)
             };
-            let mut lines = unsafe {
-                // SAFETY: (same as above) It is safe to transmute to a vector of lines with shorter lifetime,
-                // because it was only temporarily transmuted to a Vec<Line<'static>> to make recycling possible.
-                std::mem::transmute::<Vec<Line<'static>>, Vec<Line<'_>>>(lines)
+            let mut lines = unsafe {
+                // SAFETY: (same as above) It is safe to transmute to a vector of lines with shorter lifetime,
+                // because it was only temporarily transmuted to a Vec<Line<'static>> to make recycling possible.
+                std::mem::transmute::<Vec<Line<'static>>, Vec<Line<'_>>>(lines)
             };
-            let read = std::str::from_utf8(&buffer[..read])
-                .map_err(|error| SortError::Uft8Error { error })?;
-            let mut line_data = LineData {
-                selections,
-                num_infos,
-                parsed_floats,
+            let read = std::str::from_utf8(&buffer[..read])
+                .map_err(|error| SortError::Uft8Error { error })?;
+            let mut line_data = LineData {
+                selections,
+                num_infos,
+                parsed_floats,
             };
-            parse_lines(read, &mut lines, &mut line_data, separator, settings);
-            Ok(ChunkContents { lines, line_data })
+            parse_lines(read, &mut lines, &mut line_data, separator, settings);
+            Ok(ChunkContents { lines, line_data })
         });
-        sender.send(payload?).unwrap();
+        sender.send(payload?).unwrap();
     }
-    Ok(should_continue)
+    Ok(should_continue)
 }
 
-/// Split `read` into `Line`s, and add them to `lines`.
-fn parse_lines<'a>(
-    read: &'a str,
-    lines: &mut Vec<Line<'a>>,
-    line_data: &mut LineData<'a>,
-    separator: u8,
-    settings: &GlobalSettings,
+/// Split `read` into `Line`s, and add them to `lines`.
+fn parse_lines<'a>(
+    read: &'a str,
+    lines: &mut Vec<Line<'a>>,
+    line_data: &mut LineData<'a>,
+    separator: u8,
+    settings: &GlobalSettings,
 ) {
-    let read = read.strip_suffix(separator as char).unwrap_or(read);
+    let read = read.strip_suffix(separator as char).unwrap_or(read);
 
-    assert!(lines.is_empty());
-    assert!(line_data.selections.is_empty());
-    assert!(line_data.num_infos.is_empty());
-    assert!(line_data.parsed_floats.is_empty());
-    let mut token_buffer = vec![];
-    lines.extend(
-        read.split(separator as char)
-            .enumerate()
-            .map(|(index, line)| Line::create(line, index, line_data, &mut token_buffer, settings)),
+    assert!(lines.is_empty());
+    assert!(line_data.selections.is_empty());
+    assert!(line_data.num_infos.is_empty());
+    assert!(line_data.parsed_floats.is_empty());
+    let mut token_buffer = vec![];
+    lines.extend(
+        read.split(separator as char)
+            .enumerate()
+            .map(|(index, line)| Line::create(line, index, line_data, &mut token_buffer, settings)),
     );
 }
 
-/// Read from `file` into `buffer`.
-///
-/// This function makes sure that at least two lines are read (unless we reach EOF and there's no next file),
-/// growing the buffer if necessary.
-/// The last line is likely to not have been fully read into the buffer. Its bytes must be copied to
-/// the front of the buffer for the next invocation so that it can be continued to be read
-/// (see the return values and `start_offset`).
-///
-/// # Arguments
-///
-/// * `file`: The file to start reading from.
-/// * `next_files`: When `file` reaches EOF, it is updated to `next_files.next()` if that is `Some`,
-///    and this function continues reading.
-/// * `buffer`: The buffer that is filled with bytes. Its contents will mostly be overwritten (see `start_offset`
-///   as well). It will be grown up to `max_buffer_size` if necessary, but it will always grow to read at least two lines.
-/// * `max_buffer_size`: Grow the buffer to at most this length. If None, the buffer will not grow, unless needed to read at least two lines.
-/// * `start_offset`: The amount of bytes at the start of `buffer` that were carried over
-///    from the previous read and should not be overwritten.
-/// * `separator`: The byte that separates lines.
-///
-/// # Returns
-///
-/// * The amount of bytes in `buffer` that can now be interpreted as lines.
-///   The remaining bytes must be copied to the start of the buffer for the next invocation,
-///   if another invocation is necessary, which is determined by the other return value.
-/// * Whether this function should be called again.
-fn read_to_buffer<T: Read>(
-    file: &mut T,
-    next_files: &mut impl Iterator<Item = UResult<T>>,
-    buffer: &mut Vec<u8>,
-    max_buffer_size: Option<usize>,
-    start_offset: usize,
-    separator: u8,
-) -> UResult<(usize, bool)> {
-    let mut read_target = &mut buffer[start_offset..];
-    let mut last_file_target_size = read_target.len();
-    loop {
-        match file.read(read_target) {
+/// Read from `file` into `buffer`.
+///
+/// This function makes sure that at least two lines are read (unless we reach EOF and there's no next file),
+/// growing the buffer if necessary.
+/// The last line is likely to not have been fully read into the buffer. Its bytes must be copied to
+/// the front of the buffer for the next invocation so that it can be continued to be read
+/// (see the return values and `start_offset`).
+///
+/// # Arguments
+///
+/// * `file`: The file to start reading from.
+/// * `next_files`: When `file` reaches EOF, it is updated to `next_files.next()` if that is `Some`,
+///    and this function continues reading.
+/// * `buffer`: The buffer that is filled with bytes. Its contents will mostly be overwritten (see `start_offset`
+///   as well). It will be grown up to `max_buffer_size` if necessary, but it will always grow to read at least two lines.
+/// * `max_buffer_size`: Grow the buffer to at most this length. If None, the buffer will not grow, unless needed to read at least two lines.
+/// * `start_offset`: The amount of bytes at the start of `buffer` that were carried over
+///    from the previous read and should not be overwritten.
+/// * `separator`: The byte that separates lines.
+///
+/// # Returns
+///
+/// * The amount of bytes in `buffer` that can now be interpreted as lines.
+///   The remaining bytes must be copied to the start of the buffer for the next invocation,
+///   if another invocation is necessary, which is determined by the other return value.
+/// * Whether this function should be called again.
+fn read_to_buffer<T: Read>(
+    file: &mut T,
+    next_files: &mut impl Iterator<Item = UResult<T>>,
+    buffer: &mut Vec<u8>,
+    max_buffer_size: Option<usize>,
+    start_offset: usize,
+    separator: u8,
+) -> UResult<(usize, bool)> {
+    let mut read_target = &mut buffer[start_offset..];
+    let mut last_file_target_size = read_target.len();
+    loop {
+        match file.read(read_target) {
             Ok(0) => {
-                if read_target.is_empty() {
-                    // chunk is full
-                    if let Some(max_buffer_size) = max_buffer_size {
-                        if max_buffer_size > buffer.len() {
-                            // we can grow the buffer
-                            let prev_len = buffer.len();
-                            if buffer.len() < max_buffer_size / 2 {
-                                buffer.resize(buffer.len() * 2, 0);
-                            } else {
-                                buffer.resize(max_buffer_size, 0);
+                if read_target.is_empty() {
+                    // chunk is full
+                    if let Some(max_buffer_size) = max_buffer_size {
+                        if max_buffer_size > buffer.len() {
+                            // we can grow the buffer
+                            let prev_len = buffer.len();
+                            if buffer.len() < max_buffer_size / 2 {
+                                buffer.resize(buffer.len() * 2, 0);
+                            } else {
+                                buffer.resize(max_buffer_size, 0);
                             }
-                            read_target = &mut buffer[prev_len..];
+                            read_target = &mut buffer[prev_len..];
                             continue;
                         }
                     }
-                    let mut sep_iter = memchr_iter(separator, buffer).rev();
-                    let last_line_end = sep_iter.next();
-                    if sep_iter.next().is_some() {
-                        // We read enough lines.
-                        let end = last_line_end.unwrap();
-                        // We want to include the separator here, because it shouldn't be carried over.
-                        return Ok((end + 1, true));
-                    } else {
-                        // We need to read more lines
-                        let len = buffer.len();
-                        // resize the vector to 10 KB more
-                        buffer.resize(len + 1024 * 10, 0);
-                        read_target = &mut buffer[len..];
+                    let mut sep_iter = memchr_iter(separator, buffer).rev();
+                    let last_line_end = sep_iter.next();
+                    if sep_iter.next().is_some() {
+                        // We read enough lines.
+                        let end = last_line_end.unwrap();
+                        // We want to include the separator here, because it shouldn't be carried over.
+                        return Ok((end + 1, true));
+                    } else {
+                        // We need to read more lines
+                        let len = buffer.len();
+                        // resize the vector to 10 KB more
+                        buffer.resize(len + 1024 * 10, 0);
+                        read_target = &mut buffer[len..];
                     }
-                } else {
-                    // This file has been fully read.
-                    let mut leftover_len = read_target.len();
-                    if last_file_target_size != leftover_len {
-                        // The file was not empty.
-                        let read_len = buffer.len() - leftover_len;
-                        if buffer[read_len - 1] != separator {
-                            // The file did not end with a separator. We have to insert one.
-                            buffer[read_len] = separator;
-                            leftover_len -= 1;
+                } else {
+                    // This file has been fully read.
+                    let mut leftover_len = read_target.len();
+                    if last_file_target_size != leftover_len {
+                        // The file was not empty.
+                        let read_len = buffer.len() - leftover_len;
+                        if buffer[read_len - 1] != separator {
+                            // The file did not end with a separator. We have to insert one.
+                            buffer[read_len] = separator;
+                            leftover_len -= 1;
                         }
-                        let read_len = buffer.len() - leftover_len;
-                        read_target = &mut buffer[read_len..];
+                        let read_len = buffer.len() - leftover_len;
+                        read_target = &mut buffer[read_len..];
                     }
-                    if let Some(next_file) = next_files.next() {
-                        // There is another file.
-                        last_file_target_size = leftover_len;
-                        *file = next_file?;
-                    } else {
-                        // This was the last file.
-                        let read_len = buffer.len() - leftover_len;
-                        return Ok((read_len, false));
+                    if let Some(next_file) = next_files.next() {
+                        // There is another file.
+                        last_file_target_size = leftover_len;
+                        *file = next_file?;
+                    } else {
+                        // This was the last file.
+                        let read_len = buffer.len() - leftover_len;
+                        return Ok((read_len, false));
                     }
                 }
             }
-            Ok(n) => {
-                read_target = &mut read_target[n..];
+            Ok(n) => {
+                read_target = &mut read_target[n..];
             }
-            Err(e) if e.kind() == ErrorKind::Interrupted => {
-                // retry
-            }
-            Err(e) => return Err(USimpleError::new(2, e.to_string())),
+            Err(e) if e.kind() == ErrorKind::Interrupted => {
+                // retry
+            }
+            Err(e) => return Err(USimpleError::new(2, e.to_string())),
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sort/custom_str_cmp.rs.html b/dev/src/uu_sort/custom_str_cmp.rs.html index 956c78543..bbe6be0f1 100644 --- a/dev/src/uu_sort/custom_str_cmp.rs.html +++ b/dev/src/uu_sort/custom_str_cmp.rs.html @@ -1,4 +1,4 @@ -custom_str_cmp.rs - source
1
+custom_str_cmp.rs - source
1
 2
 3
 4
@@ -62,69 +62,69 @@
 62
 63
 64
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-//! Custom string comparisons.
-//!
-//! The goal is to compare strings without transforming them first (i.e. not allocating new strings)
+//! Custom string comparisons.
+//!
+//! The goal is to compare strings without transforming them first (i.e. not allocating new strings)
 
-use std::cmp::Ordering;
+use std::cmp::Ordering;
 
-fn filter_char(c: char, ignore_non_printing: bool, ignore_non_dictionary: bool) -> bool {
-    if ignore_non_dictionary && !(c.is_ascii_alphanumeric() || c.is_ascii_whitespace()) {
-        return false;
+fn filter_char(c: char, ignore_non_printing: bool, ignore_non_dictionary: bool) -> bool {
+    if ignore_non_dictionary && !(c.is_ascii_alphanumeric() || c.is_ascii_whitespace()) {
+        return false;
     }
-    if ignore_non_printing && (c.is_ascii_control() || !c.is_ascii()) {
-        return false;
+    if ignore_non_printing && (c.is_ascii_control() || !c.is_ascii()) {
+        return false;
     }
-    true
-}
+    true
+}
 
-fn cmp_chars(a: char, b: char, ignore_case: bool) -> Ordering {
-    if ignore_case {
-        a.to_ascii_uppercase().cmp(&b.to_ascii_uppercase())
-    } else {
-        a.cmp(&b)
+fn cmp_chars(a: char, b: char, ignore_case: bool) -> Ordering {
+    if ignore_case {
+        a.to_ascii_uppercase().cmp(&b.to_ascii_uppercase())
+    } else {
+        a.cmp(&b)
     }
 }
 
-pub fn custom_str_cmp(
-    a: &str,
-    b: &str,
-    ignore_non_printing: bool,
-    ignore_non_dictionary: bool,
-    ignore_case: bool,
-) -> Ordering {
-    if !(ignore_case || ignore_non_dictionary || ignore_non_printing) {
-        // There are no custom settings. Fall back to the default strcmp, which is faster.
-        return a.cmp(b);
+pub fn custom_str_cmp(
+    a: &str,
+    b: &str,
+    ignore_non_printing: bool,
+    ignore_non_dictionary: bool,
+    ignore_case: bool,
+) -> Ordering {
+    if !(ignore_case || ignore_non_dictionary || ignore_non_printing) {
+        // There are no custom settings. Fall back to the default strcmp, which is faster.
+        return a.cmp(b);
     }
-    let mut a_chars = a
-        .chars()
-        .filter(|&c| filter_char(c, ignore_non_printing, ignore_non_dictionary));
-    let mut b_chars = b
-        .chars()
-        .filter(|&c| filter_char(c, ignore_non_printing, ignore_non_dictionary));
-    loop {
-        let a_char = a_chars.next();
-        let b_char = b_chars.next();
-        match (a_char, b_char) {
-            (None, None) => return Ordering::Equal,
-            (Some(_), None) => return Ordering::Greater,
-            (None, Some(_)) => return Ordering::Less,
-            (Some(a_char), Some(b_char)) => {
-                let ordering = cmp_chars(a_char, b_char, ignore_case);
-                if ordering != Ordering::Equal {
-                    return ordering;
+    let mut a_chars = a
+        .chars()
+        .filter(|&c| filter_char(c, ignore_non_printing, ignore_non_dictionary));
+    let mut b_chars = b
+        .chars()
+        .filter(|&c| filter_char(c, ignore_non_printing, ignore_non_dictionary));
+    loop {
+        let a_char = a_chars.next();
+        let b_char = b_chars.next();
+        match (a_char, b_char) {
+            (None, None) => return Ordering::Equal,
+            (Some(_), None) => return Ordering::Greater,
+            (None, Some(_)) => return Ordering::Less,
+            (Some(a_char), Some(b_char)) => {
+                let ordering = cmp_chars(a_char, b_char, ignore_case);
+                if ordering != Ordering::Equal {
+                    return ordering;
                 }
             }
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sort/ext_sort.rs.html b/dev/src/uu_sort/ext_sort.rs.html index f13ffca9c..3076be425 100644 --- a/dev/src/uu_sort/ext_sort.rs.html +++ b/dev/src/uu_sort/ext_sort.rs.html @@ -1,4 +1,4 @@ -ext_sort.rs - source
1
+ext_sort.rs - source
1
 2
 3
 4
@@ -284,291 +284,291 @@
 284
 285
 286
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-//! Sort big files by using auxiliary files for storing intermediate chunks.
-//!
-//! Files are read into chunks of memory which are then sorted individually and
-//! written to temporary files. There are two threads: One sorter, and one reader/writer.
-//! The buffers for the individual chunks are recycled. There are two buffers.
+//! Sort big files by using auxiliary files for storing intermediate chunks.
+//!
+//! Files are read into chunks of memory which are then sorted individually and
+//! written to temporary files. There are two threads: One sorter, and one reader/writer.
+//! The buffers for the individual chunks are recycled. There are two buffers.
 
-use std::cmp::Ordering;
-use std::fs::File;
-use std::io::Write;
-use std::path::PathBuf;
-use std::{
-    io::Read,
-    sync::mpsc::{Receiver, SyncSender},
-    thread,
+use std::cmp::Ordering;
+use std::fs::File;
+use std::io::Write;
+use std::path::PathBuf;
+use std::{
+    io::Read,
+    sync::mpsc::{Receiver, SyncSender},
+    thread,
 };
 
-use itertools::Itertools;
-use uucore::error::UResult;
+use itertools::Itertools;
+use uucore::error::UResult;
 
-use crate::chunks::RecycledChunk;
-use crate::merge::ClosedTmpFile;
-use crate::merge::WriteableCompressedTmpFile;
-use crate::merge::WriteablePlainTmpFile;
-use crate::merge::WriteableTmpFile;
-use crate::tmp_dir::TmpDirWrapper;
-use crate::Output;
-use crate::{
-    chunks::{self, Chunk},
-    compare_by, merge, sort_by, GlobalSettings,
+use crate::chunks::RecycledChunk;
+use crate::merge::ClosedTmpFile;
+use crate::merge::WriteableCompressedTmpFile;
+use crate::merge::WriteablePlainTmpFile;
+use crate::merge::WriteableTmpFile;
+use crate::tmp_dir::TmpDirWrapper;
+use crate::Output;
+use crate::{
+    chunks::{self, Chunk},
+    compare_by, merge, sort_by, GlobalSettings,
 };
-use crate::{print_sorted, Line};
+use crate::{print_sorted, Line};
 
-const START_BUFFER_SIZE: usize = 8_000;
+const START_BUFFER_SIZE: usize = 8_000;
 
-/// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result.
-pub fn ext_sort(
-    files: &mut impl Iterator<Item = UResult<Box<dyn Read + Send>>>,
-    settings: &GlobalSettings,
-    output: Output,
-    tmp_dir: &mut TmpDirWrapper,
-) -> UResult<()> {
-    let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1);
-    let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1);
-    thread::spawn({
-        let settings = settings.clone();
-        move || sorter(&recycled_receiver, &sorted_sender, &settings)
+/// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result.
+pub fn ext_sort(
+    files: &mut impl Iterator<Item = UResult<Box<dyn Read + Send>>>,
+    settings: &GlobalSettings,
+    output: Output,
+    tmp_dir: &mut TmpDirWrapper,
+) -> UResult<()> {
+    let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1);
+    let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1);
+    thread::spawn({
+        let settings = settings.clone();
+        move || sorter(&recycled_receiver, &sorted_sender, &settings)
     });
-    if settings.compress_prog.is_some() {
-        reader_writer::<_, WriteableCompressedTmpFile>(
-            files,
-            settings,
-            &sorted_receiver,
-            recycled_sender,
-            output,
-            tmp_dir,
+    if settings.compress_prog.is_some() {
+        reader_writer::<_, WriteableCompressedTmpFile>(
+            files,
+            settings,
+            &sorted_receiver,
+            recycled_sender,
+            output,
+            tmp_dir,
         )
-    } else {
-        reader_writer::<_, WriteablePlainTmpFile>(
-            files,
-            settings,
-            &sorted_receiver,
-            recycled_sender,
-            output,
-            tmp_dir,
+    } else {
+        reader_writer::<_, WriteablePlainTmpFile>(
+            files,
+            settings,
+            &sorted_receiver,
+            recycled_sender,
+            output,
+            tmp_dir,
         )
     }
 }
 
-fn reader_writer<
-    F: Iterator<Item = UResult<Box<dyn Read + Send>>>,
-    Tmp: WriteableTmpFile + 'static,
->(
-    files: F,
-    settings: &GlobalSettings,
-    receiver: &Receiver<Chunk>,
-    sender: SyncSender<Chunk>,
-    output: Output,
-    tmp_dir: &mut TmpDirWrapper,
-) -> UResult<()> {
-    let separator = if settings.zero_terminated {
-        b'\0'
-    } else {
-        b'\n'
-    };
+fn reader_writer<
+    F: Iterator<Item = UResult<Box<dyn Read + Send>>>,
+    Tmp: WriteableTmpFile + 'static,
+>(
+    files: F,
+    settings: &GlobalSettings,
+    receiver: &Receiver<Chunk>,
+    sender: SyncSender<Chunk>,
+    output: Output,
+    tmp_dir: &mut TmpDirWrapper,
+) -> UResult<()> {
+    let separator = if settings.zero_terminated {
+        b'\0'
+    } else {
+        b'\n'
+    };
 
-    // Heuristically chosen: Dividing by 10 seems to keep our memory usage roughly
-    // around settings.buffer_size as a whole.
-    let buffer_size = settings.buffer_size / 10;
-    let read_result: ReadResult<Tmp> = read_write_loop(
-        files,
-        tmp_dir,
-        separator,
-        buffer_size,
-        settings,
-        receiver,
-        sender,
+    // Heuristically chosen: Dividing by 10 seems to keep our memory usage roughly
+    // around settings.buffer_size as a whole.
+    let buffer_size = settings.buffer_size / 10;
+    let read_result: ReadResult<Tmp> = read_write_loop(
+        files,
+        tmp_dir,
+        separator,
+        buffer_size,
+        settings,
+        receiver,
+        sender,
     )?;
-    match read_result {
-        ReadResult::WroteChunksToFile { tmp_files } => {
-            let merger = merge::merge_with_file_limit::<_, _, Tmp>(
-                tmp_files.into_iter().map(|c| c.reopen()),
-                settings,
-                tmp_dir,
+    match read_result {
+        ReadResult::WroteChunksToFile { tmp_files } => {
+            let merger = merge::merge_with_file_limit::<_, _, Tmp>(
+                tmp_files.into_iter().map(|c| c.reopen()),
+                settings,
+                tmp_dir,
             )?;
-            merger.write_all(settings, output)?;
+            merger.write_all(settings, output)?;
         }
-        ReadResult::SortedSingleChunk(chunk) => {
-            if settings.unique {
-                print_sorted(
-                    chunk.lines().iter().dedup_by(|a, b| {
-                        compare_by(a, b, settings, chunk.line_data(), chunk.line_data())
-                            == Ordering::Equal
+        ReadResult::SortedSingleChunk(chunk) => {
+            if settings.unique {
+                print_sorted(
+                    chunk.lines().iter().dedup_by(|a, b| {
+                        compare_by(a, b, settings, chunk.line_data(), chunk.line_data())
+                            == Ordering::Equal
                     }),
-                    settings,
-                    output,
+                    settings,
+                    output,
                 );
-            } else {
-                print_sorted(chunk.lines().iter(), settings, output);
+            } else {
+                print_sorted(chunk.lines().iter(), settings, output);
             }
         }
-        ReadResult::SortedTwoChunks([a, b]) => {
-            let merged_iter = a.lines().iter().map(|line| (line, &a)).merge_by(
-                b.lines().iter().map(|line| (line, &b)),
-                |(line_a, a), (line_b, b)| {
-                    compare_by(line_a, line_b, settings, a.line_data(), b.line_data())
-                        != Ordering::Greater
+        ReadResult::SortedTwoChunks([a, b]) => {
+            let merged_iter = a.lines().iter().map(|line| (line, &a)).merge_by(
+                b.lines().iter().map(|line| (line, &b)),
+                |(line_a, a), (line_b, b)| {
+                    compare_by(line_a, line_b, settings, a.line_data(), b.line_data())
+                        != Ordering::Greater
                 },
             );
-            if settings.unique {
-                print_sorted(
-                    merged_iter
-                        .dedup_by(|(line_a, a), (line_b, b)| {
-                            compare_by(line_a, line_b, settings, a.line_data(), b.line_data())
-                                == Ordering::Equal
+            if settings.unique {
+                print_sorted(
+                    merged_iter
+                        .dedup_by(|(line_a, a), (line_b, b)| {
+                            compare_by(line_a, line_b, settings, a.line_data(), b.line_data())
+                                == Ordering::Equal
                         })
-                        .map(|(line, _)| line),
-                    settings,
-                    output,
+                        .map(|(line, _)| line),
+                    settings,
+                    output,
                 );
-            } else {
-                print_sorted(merged_iter.map(|(line, _)| line), settings, output);
+            } else {
+                print_sorted(merged_iter.map(|(line, _)| line), settings, output);
             }
         }
-        ReadResult::EmptyInput => {
-            // don't output anything
-        }
+        ReadResult::EmptyInput => {
+            // don't output anything
+        }
     }
     Ok(())
 }
 
-/// The function that is executed on the sorter thread.
-fn sorter(receiver: &Receiver<Chunk>, sender: &SyncSender<Chunk>, settings: &GlobalSettings) {
-    while let Ok(mut payload) = receiver.recv() {
-        payload.with_contents_mut(|contents| {
-            sort_by(&mut contents.lines, settings, &contents.line_data);
+/// The function that is executed on the sorter thread.
+fn sorter(receiver: &Receiver<Chunk>, sender: &SyncSender<Chunk>, settings: &GlobalSettings) {
+    while let Ok(mut payload) = receiver.recv() {
+        payload.with_contents_mut(|contents| {
+            sort_by(&mut contents.lines, settings, &contents.line_data);
         });
-        if sender.send(payload).is_err() {
-            // The receiver has gone away, likely because the other thread hit an error.
-            // We stop silently because the actual error is printed by the other thread.
-            return;
+        if sender.send(payload).is_err() {
+            // The receiver has gone away, likely because the other thread hit an error.
+            // We stop silently because the actual error is printed by the other thread.
+            return;
         }
     }
 }
 
-/// Describes how we read the chunks from the input.
-enum ReadResult<I: WriteableTmpFile> {
-    /// The input was empty. Nothing was read.
-    EmptyInput,
-    /// The input fits into a single Chunk, which was kept in memory.
-    SortedSingleChunk(Chunk),
-    /// The input fits into two chunks, which were kept in memory.
-    SortedTwoChunks([Chunk; 2]),
-    /// The input was read into multiple chunks, which were written to auxiliary files.
-    WroteChunksToFile { tmp_files: Vec<I::Closed> },
+/// Describes how we read the chunks from the input.
+enum ReadResult<I: WriteableTmpFile> {
+    /// The input was empty. Nothing was read.
+    EmptyInput,
+    /// The input fits into a single Chunk, which was kept in memory.
+    SortedSingleChunk(Chunk),
+    /// The input fits into two chunks, which were kept in memory.
+    SortedTwoChunks([Chunk; 2]),
+    /// The input was read into multiple chunks, which were written to auxiliary files.
+    WroteChunksToFile { tmp_files: Vec<I::Closed> },
 }
-/// The function that is executed on the reader/writer thread.
-fn read_write_loop<I: WriteableTmpFile>(
-    mut files: impl Iterator<Item = UResult<Box<dyn Read + Send>>>,
-    tmp_dir: &mut TmpDirWrapper,
-    separator: u8,
-    buffer_size: usize,
-    settings: &GlobalSettings,
-    receiver: &Receiver<Chunk>,
-    sender: SyncSender<Chunk>,
-) -> UResult<ReadResult<I>> {
-    let mut file = files.next().unwrap()?;
+/// The function that is executed on the reader/writer thread.
+fn read_write_loop<I: WriteableTmpFile>(
+    mut files: impl Iterator<Item = UResult<Box<dyn Read + Send>>>,
+    tmp_dir: &mut TmpDirWrapper,
+    separator: u8,
+    buffer_size: usize,
+    settings: &GlobalSettings,
+    receiver: &Receiver<Chunk>,
+    sender: SyncSender<Chunk>,
+) -> UResult<ReadResult<I>> {
+    let mut file = files.next().unwrap()?;
 
-    let mut carry_over = vec![];
-    // kick things off with two reads
-    for _ in 0..2 {
-        let should_continue = chunks::read(
-            &sender,
-            RecycledChunk::new(if START_BUFFER_SIZE < buffer_size {
-                START_BUFFER_SIZE
-            } else {
-                buffer_size
+    let mut carry_over = vec![];
+    // kick things off with two reads
+    for _ in 0..2 {
+        let should_continue = chunks::read(
+            &sender,
+            RecycledChunk::new(if START_BUFFER_SIZE < buffer_size {
+                START_BUFFER_SIZE
+            } else {
+                buffer_size
             }),
-            Some(buffer_size),
-            &mut carry_over,
-            &mut file,
-            &mut files,
-            separator,
-            settings,
+            Some(buffer_size),
+            &mut carry_over,
+            &mut file,
+            &mut files,
+            separator,
+            settings,
         )?;
 
-        if !should_continue {
-            drop(sender);
-            // We have already read the whole input. Since we are in our first two reads,
-            // this means that we can fit the whole input into memory. Bypass writing below and
-            // handle this case in a more straightforward way.
-            return Ok(if let Ok(first_chunk) = receiver.recv() {
-                if let Ok(second_chunk) = receiver.recv() {
-                    ReadResult::SortedTwoChunks([first_chunk, second_chunk])
-                } else {
-                    ReadResult::SortedSingleChunk(first_chunk)
+        if !should_continue {
+            drop(sender);
+            // We have already read the whole input. Since we are in our first two reads,
+            // this means that we can fit the whole input into memory. Bypass writing below and
+            // handle this case in a more straightforward way.
+            return Ok(if let Ok(first_chunk) = receiver.recv() {
+                if let Ok(second_chunk) = receiver.recv() {
+                    ReadResult::SortedTwoChunks([first_chunk, second_chunk])
+                } else {
+                    ReadResult::SortedSingleChunk(first_chunk)
                 }
-            } else {
-                ReadResult::EmptyInput
+            } else {
+                ReadResult::EmptyInput
             });
         }
     }
 
-    let mut sender_option = Some(sender);
-    let mut tmp_files = vec![];
-    loop {
-        let mut chunk = match receiver.recv() {
-            Ok(it) => it,
-            _ => {
-                return Ok(ReadResult::WroteChunksToFile { tmp_files });
+    let mut sender_option = Some(sender);
+    let mut tmp_files = vec![];
+    loop {
+        let mut chunk = match receiver.recv() {
+            Ok(it) => it,
+            _ => {
+                return Ok(ReadResult::WroteChunksToFile { tmp_files });
             }
         };
 
-        let tmp_file = write::<I>(
-            &mut chunk,
-            tmp_dir.next_file()?,
-            settings.compress_prog.as_deref(),
-            separator,
+        let tmp_file = write::<I>(
+            &mut chunk,
+            tmp_dir.next_file()?,
+            settings.compress_prog.as_deref(),
+            separator,
         )?;
-        tmp_files.push(tmp_file);
+        tmp_files.push(tmp_file);
 
-        let recycled_chunk = chunk.recycle();
+        let recycled_chunk = chunk.recycle();
 
-        if let Some(sender) = &sender_option {
-            let should_continue = chunks::read(
-                sender,
-                recycled_chunk,
+        if let Some(sender) = &sender_option {
+            let should_continue = chunks::read(
+                sender,
+                recycled_chunk,
                 None,
-                &mut carry_over,
-                &mut file,
-                &mut files,
-                separator,
-                settings,
+                &mut carry_over,
+                &mut file,
+                &mut files,
+                separator,
+                settings,
             )?;
-            if !should_continue {
-                sender_option = None;
+            if !should_continue {
+                sender_option = None;
             }
         }
     }
 }
 
-/// Write the lines in `chunk` to `file`, separated by `separator`.
-/// `compress_prog` is used to optionally compress file contents.
-fn write<I: WriteableTmpFile>(
-    chunk: &mut Chunk,
-    file: (File, PathBuf),
-    compress_prog: Option<&str>,
-    separator: u8,
-) -> UResult<I::Closed> {
-    let mut tmp_file = I::create(file, compress_prog)?;
-    write_lines(chunk.lines(), tmp_file.as_write(), separator);
-    tmp_file.finished_writing()
+/// Write the lines in `chunk` to `file`, separated by `separator`.
+/// `compress_prog` is used to optionally compress file contents.
+fn write<I: WriteableTmpFile>(
+    chunk: &mut Chunk,
+    file: (File, PathBuf),
+    compress_prog: Option<&str>,
+    separator: u8,
+) -> UResult<I::Closed> {
+    let mut tmp_file = I::create(file, compress_prog)?;
+    write_lines(chunk.lines(), tmp_file.as_write(), separator);
+    tmp_file.finished_writing()
 }
 
-fn write_lines<'a, T: Write>(lines: &[Line<'a>], writer: &mut T, separator: u8) {
-    for s in lines {
-        writer.write_all(s.line.as_bytes()).unwrap();
-        writer.write_all(&[separator]).unwrap();
+fn write_lines<'a, T: Write>(lines: &[Line<'a>], writer: &mut T, separator: u8) {
+    for s in lines {
+        writer.write_all(s.line.as_bytes()).unwrap();
+        writer.write_all(&[separator]).unwrap();
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sort/merge.rs.html b/dev/src/uu_sort/merge.rs.html index b21588776..ff11b3071 100644 --- a/dev/src/uu_sort/merge.rs.html +++ b/dev/src/uu_sort/merge.rs.html @@ -1,4 +1,4 @@ -merge.rs - source
1
+merge.rs - source
1
 2
 3
 4
@@ -553,59 +553,59 @@
 553
 554
 555
-
//! Merge already sorted files.
-//!
-//! We achieve performance by splitting the tasks of sorting and writing, and reading and parsing between two threads.
-//! The threads communicate over channels. There's one channel per file in the direction reader -> sorter, but only
-//! one channel from the sorter back to the reader. The channels to the sorter are used to send the read chunks.
-//! The sorter reads the next chunk from the channel whenever it needs the next chunk after running out of lines
-//! from the previous read of the file. The channel back from the sorter to the reader has two purposes: To allow the reader
-//! to reuse memory allocations and to tell the reader which file to read from next.
+
//! Merge already sorted files.
+//!
+//! We achieve performance by splitting the tasks of sorting and writing, and reading and parsing between two threads.
+//! The threads communicate over channels. There's one channel per file in the direction reader -> sorter, but only
+//! one channel from the sorter back to the reader. The channels to the sorter are used to send the read chunks.
+//! The sorter reads the next chunk from the channel whenever it needs the next chunk after running out of lines
+//! from the previous read of the file. The channel back from the sorter to the reader has two purposes: To allow the reader
+//! to reuse memory allocations and to tell the reader which file to read from next.
 
-use std::{
-    cmp::Ordering,
-    ffi::OsString,
-    fs::{self, File},
-    io::{BufWriter, Read, Write},
-    iter,
-    path::{Path, PathBuf},
-    process::{Child, ChildStdin, ChildStdout, Command, Stdio},
-    rc::Rc,
-    sync::mpsc::{channel, sync_channel, Receiver, Sender, SyncSender},
-    thread::{self, JoinHandle},
+use std::{
+    cmp::Ordering,
+    ffi::OsString,
+    fs::{self, File},
+    io::{BufWriter, Read, Write},
+    iter,
+    path::{Path, PathBuf},
+    process::{Child, ChildStdin, ChildStdout, Command, Stdio},
+    rc::Rc,
+    sync::mpsc::{channel, sync_channel, Receiver, Sender, SyncSender},
+    thread::{self, JoinHandle},
 };
 
-use compare::Compare;
-use itertools::Itertools;
-use uucore::error::UResult;
+use compare::Compare;
+use itertools::Itertools;
+use uucore::error::UResult;
 
-use crate::{
-    chunks::{self, Chunk, RecycledChunk},
-    compare_by, open,
-    tmp_dir::TmpDirWrapper,
-    GlobalSettings, Output, SortError,
+use crate::{
+    chunks::{self, Chunk, RecycledChunk},
+    compare_by, open,
+    tmp_dir::TmpDirWrapper,
+    GlobalSettings, Output, SortError,
 };
 
-/// If the output file occurs in the input files as well, copy the contents of the output file
-/// and replace its occurrences in the inputs with that copy.
-fn replace_output_file_in_input_files(
-    files: &mut [OsString],
-    output: Option<&str>,
-    tmp_dir: &mut TmpDirWrapper,
-) -> UResult<()> {
-    let mut copy: Option<PathBuf> = None;
-    if let Some(Ok(output_path)) = output.map(|path| Path::new(path).canonicalize()) {
-        for file in files {
-            if let Ok(file_path) = Path::new(file).canonicalize() {
-                if file_path == output_path {
-                    if let Some(copy) = &copy {
-                        *file = copy.clone().into_os_string();
-                    } else {
-                        let (_file, copy_path) = tmp_dir.next_file()?;
-                        std::fs::copy(file_path, &copy_path)
-                            .map_err(|error| SortError::OpenTmpFileFailed { error })?;
-                        *file = copy_path.clone().into_os_string();
-                        copy = Some(copy_path);
+/// If the output file occurs in the input files as well, copy the contents of the output file
+/// and replace its occurrences in the inputs with that copy.
+fn replace_output_file_in_input_files(
+    files: &mut [OsString],
+    output: Option<&str>,
+    tmp_dir: &mut TmpDirWrapper,
+) -> UResult<()> {
+    let mut copy: Option<PathBuf> = None;
+    if let Some(Ok(output_path)) = output.map(|path| Path::new(path).canonicalize()) {
+        for file in files {
+            if let Ok(file_path) = Path::new(file).canonicalize() {
+                if file_path == output_path {
+                    if let Some(copy) = &copy {
+                        *file = copy.clone().into_os_string();
+                    } else {
+                        let (_file, copy_path) = tmp_dir.next_file()?;
+                        std::fs::copy(file_path, &copy_path)
+                            .map_err(|error| SortError::OpenTmpFileFailed { error })?;
+                        *file = copy_path.clone().into_os_string();
+                        copy = Some(copy_path);
                     }
                 }
             }
@@ -614,499 +614,499 @@
     Ok(())
 }
 
-/// Merge pre-sorted `Box<dyn Read>`s.
-///
-/// If `settings.merge_batch_size` is greater than the length of `files`, intermediate files will be used.
-/// If `settings.compress_prog` is `Some`, intermediate files will be compressed with it.
-pub fn merge<'a>(
-    files: &mut [OsString],
-    settings: &'a GlobalSettings,
-    output: Option<&str>,
-    tmp_dir: &mut TmpDirWrapper,
-) -> UResult<FileMerger<'a>> {
-    replace_output_file_in_input_files(files, output, tmp_dir)?;
-    if settings.compress_prog.is_none() {
-        merge_with_file_limit::<_, _, WriteablePlainTmpFile>(
-            files
-                .iter()
-                .map(|file| open(file).map(|file| PlainMergeInput { inner: file })),
-            settings,
-            tmp_dir,
+/// Merge pre-sorted `Box<dyn Read>`s.
+///
+/// If `settings.merge_batch_size` is greater than the length of `files`, intermediate files will be used.
+/// If `settings.compress_prog` is `Some`, intermediate files will be compressed with it.
+pub fn merge<'a>(
+    files: &mut [OsString],
+    settings: &'a GlobalSettings,
+    output: Option<&str>,
+    tmp_dir: &mut TmpDirWrapper,
+) -> UResult<FileMerger<'a>> {
+    replace_output_file_in_input_files(files, output, tmp_dir)?;
+    if settings.compress_prog.is_none() {
+        merge_with_file_limit::<_, _, WriteablePlainTmpFile>(
+            files
+                .iter()
+                .map(|file| open(file).map(|file| PlainMergeInput { inner: file })),
+            settings,
+            tmp_dir,
         )
-    } else {
-        merge_with_file_limit::<_, _, WriteableCompressedTmpFile>(
-            files
-                .iter()
-                .map(|file| open(file).map(|file| PlainMergeInput { inner: file })),
-            settings,
-            tmp_dir,
+    } else {
+        merge_with_file_limit::<_, _, WriteableCompressedTmpFile>(
+            files
+                .iter()
+                .map(|file| open(file).map(|file| PlainMergeInput { inner: file })),
+            settings,
+            tmp_dir,
         )
     }
 }
 
-// Merge already sorted `MergeInput`s.
-pub fn merge_with_file_limit<
+// Merge already sorted `MergeInput`s.
+pub fn merge_with_file_limit<
     'a,
-    M: MergeInput + 'static,
-    F: ExactSizeIterator<Item = UResult<M>>,
-    Tmp: WriteableTmpFile + 'static,
->(
-    files: F,
-    settings: &'a GlobalSettings,
-    tmp_dir: &mut TmpDirWrapper,
-) -> UResult<FileMerger<'a>> {
-    if files.len() > settings.merge_batch_size {
-        let mut remaining_files = files.len();
-        let batches = files.chunks(settings.merge_batch_size);
-        let mut batches = batches.into_iter();
-        let mut temporary_files = vec![];
-        while remaining_files != 0 {
-            // Work around the fact that `Chunks` is not an `ExactSizeIterator`.
-            remaining_files = remaining_files.saturating_sub(settings.merge_batch_size);
-            let merger = merge_without_limit(batches.next().unwrap(), settings)?;
-            let mut tmp_file =
-                Tmp::create(tmp_dir.next_file()?, settings.compress_prog.as_deref())?;
-            merger.write_all_to(settings, tmp_file.as_write())?;
-            temporary_files.push(tmp_file.finished_writing()?);
+    M: MergeInput + 'static,
+    F: ExactSizeIterator<Item = UResult<M>>,
+    Tmp: WriteableTmpFile + 'static,
+>(
+    files: F,
+    settings: &'a GlobalSettings,
+    tmp_dir: &mut TmpDirWrapper,
+) -> UResult<FileMerger<'a>> {
+    if files.len() > settings.merge_batch_size {
+        let mut remaining_files = files.len();
+        let batches = files.chunks(settings.merge_batch_size);
+        let mut batches = batches.into_iter();
+        let mut temporary_files = vec![];
+        while remaining_files != 0 {
+            // Work around the fact that `Chunks` is not an `ExactSizeIterator`.
+            remaining_files = remaining_files.saturating_sub(settings.merge_batch_size);
+            let merger = merge_without_limit(batches.next().unwrap(), settings)?;
+            let mut tmp_file =
+                Tmp::create(tmp_dir.next_file()?, settings.compress_prog.as_deref())?;
+            merger.write_all_to(settings, tmp_file.as_write())?;
+            temporary_files.push(tmp_file.finished_writing()?);
         }
-        assert!(batches.next().is_none());
-        merge_with_file_limit::<_, _, Tmp>(
-            temporary_files
-                .into_iter()
-                .map(Box::new(|c: Tmp::Closed| c.reopen())
-                    as Box<
-                        dyn FnMut(Tmp::Closed) -> UResult<<Tmp::Closed as ClosedTmpFile>::Reopened>,
-                    >),
-            settings,
-            tmp_dir,
+        assert!(batches.next().is_none());
+        merge_with_file_limit::<_, _, Tmp>(
+            temporary_files
+                .into_iter()
+                .map(Box::new(|c: Tmp::Closed| c.reopen())
+                    as Box<
+                        dyn FnMut(Tmp::Closed) -> UResult<<Tmp::Closed as ClosedTmpFile>::Reopened>,
+                    >),
+            settings,
+            tmp_dir,
         )
-    } else {
-        merge_without_limit(files, settings)
+    } else {
+        merge_without_limit(files, settings)
     }
 }
 
-/// Merge files without limiting how many files are concurrently open.
-///
-/// It is the responsibility of the caller to ensure that `files` yields only
-/// as many files as we are allowed to open concurrently.
-fn merge_without_limit<M: MergeInput + 'static, F: Iterator<Item = UResult<M>>>(
-    files: F,
-    settings: &GlobalSettings,
-) -> UResult<FileMerger> {
-    let (request_sender, request_receiver) = channel();
-    let mut reader_files = Vec::with_capacity(files.size_hint().0);
-    let mut loaded_receivers = Vec::with_capacity(files.size_hint().0);
-    for (file_number, file) in files.enumerate() {
-        let (sender, receiver) = sync_channel(2);
-        loaded_receivers.push(receiver);
-        reader_files.push(Some(ReaderFile {
-            file: file?,
-            sender,
-            carry_over: vec![],
+/// Merge files without limiting how many files are concurrently open.
+///
+/// It is the responsibility of the caller to ensure that `files` yields only
+/// as many files as we are allowed to open concurrently.
+fn merge_without_limit<M: MergeInput + 'static, F: Iterator<Item = UResult<M>>>(
+    files: F,
+    settings: &GlobalSettings,
+) -> UResult<FileMerger> {
+    let (request_sender, request_receiver) = channel();
+    let mut reader_files = Vec::with_capacity(files.size_hint().0);
+    let mut loaded_receivers = Vec::with_capacity(files.size_hint().0);
+    for (file_number, file) in files.enumerate() {
+        let (sender, receiver) = sync_channel(2);
+        loaded_receivers.push(receiver);
+        reader_files.push(Some(ReaderFile {
+            file: file?,
+            sender,
+            carry_over: vec![],
         }));
-        // Send the initial chunk to trigger a read for each file
-        request_sender
-            .send((file_number, RecycledChunk::new(8 * 1024)))
-            .unwrap();
+        // Send the initial chunk to trigger a read for each file
+        request_sender
+            .send((file_number, RecycledChunk::new(8 * 1024)))
+            .unwrap();
     }
 
-    // Send the second chunk for each file
-    for file_number in 0..reader_files.len() {
-        request_sender
-            .send((file_number, RecycledChunk::new(8 * 1024)))
-            .unwrap();
+    // Send the second chunk for each file
+    for file_number in 0..reader_files.len() {
+        request_sender
+            .send((file_number, RecycledChunk::new(8 * 1024)))
+            .unwrap();
     }
 
-    let reader_join_handle = thread::spawn({
-        let settings = settings.clone();
-        move || {
-            reader(
-                &request_receiver,
-                &mut reader_files,
-                &settings,
-                if settings.zero_terminated {
-                    b'\0'
-                } else {
-                    b'\n'
-                },
+    let reader_join_handle = thread::spawn({
+        let settings = settings.clone();
+        move || {
+            reader(
+                &request_receiver,
+                &mut reader_files,
+                &settings,
+                if settings.zero_terminated {
+                    b'\0'
+                } else {
+                    b'\n'
+                },
             )
         }
     });
 
-    let mut mergeable_files = vec![];
+    let mut mergeable_files = vec![];
 
-    for (file_number, receiver) in loaded_receivers.into_iter().enumerate() {
-        if let Ok(chunk) = receiver.recv() {
-            mergeable_files.push(MergeableFile {
-                current_chunk: Rc::new(chunk),
-                file_number,
-                line_idx: 0,
-                receiver,
+    for (file_number, receiver) in loaded_receivers.into_iter().enumerate() {
+        if let Ok(chunk) = receiver.recv() {
+            mergeable_files.push(MergeableFile {
+                current_chunk: Rc::new(chunk),
+                file_number,
+                line_idx: 0,
+                receiver,
             });
         }
     }
 
-    Ok(FileMerger {
-        heap: binary_heap_plus::BinaryHeap::from_vec_cmp(
-            mergeable_files,
-            FileComparator { settings },
+    Ok(FileMerger {
+        heap: binary_heap_plus::BinaryHeap::from_vec_cmp(
+            mergeable_files,
+            FileComparator { settings },
         ),
-        request_sender,
-        prev: None,
-        reader_join_handle,
+        request_sender,
+        prev: None,
+        reader_join_handle,
     })
 }
-/// The struct on the reader thread representing an input file
-struct ReaderFile<M: MergeInput> {
-    file: M,
-    sender: SyncSender<Chunk>,
-    carry_over: Vec<u8>,
+/// The struct on the reader thread representing an input file
+struct ReaderFile<M: MergeInput> {
+    file: M,
+    sender: SyncSender<Chunk>,
+    carry_over: Vec<u8>,
 }
 
-/// The function running on the reader thread.
-fn reader(
-    recycled_receiver: &Receiver<(usize, RecycledChunk)>,
-    files: &mut [Option<ReaderFile<impl MergeInput>>],
-    settings: &GlobalSettings,
-    separator: u8,
-) -> UResult<()> {
-    for (file_idx, recycled_chunk) in recycled_receiver.iter() {
-        if let Some(ReaderFile {
-            file,
-            sender,
-            carry_over,
-        }) = &mut files[file_idx]
+/// The function running on the reader thread.
+fn reader(
+    recycled_receiver: &Receiver<(usize, RecycledChunk)>,
+    files: &mut [Option<ReaderFile<impl MergeInput>>],
+    settings: &GlobalSettings,
+    separator: u8,
+) -> UResult<()> {
+    for (file_idx, recycled_chunk) in recycled_receiver.iter() {
+        if let Some(ReaderFile {
+            file,
+            sender,
+            carry_over,
+        }) = &mut files[file_idx]
         {
-            let should_continue = chunks::read(
-                sender,
-                recycled_chunk,
+            let should_continue = chunks::read(
+                sender,
+                recycled_chunk,
                 None,
-                carry_over,
-                file.as_read(),
-                &mut iter::empty(),
-                separator,
-                settings,
+                carry_over,
+                file.as_read(),
+                &mut iter::empty(),
+                separator,
+                settings,
             )?;
-            if !should_continue {
-                // Remove the file from the list by replacing it with `None`.
-                let ReaderFile { file, .. } = files[file_idx].take().unwrap();
-                // Depending on the kind of the `MergeInput`, this may delete the file:
-                file.finished_reading()?;
+            if !should_continue {
+                // Remove the file from the list by replacing it with `None`.
+                let ReaderFile { file, .. } = files[file_idx].take().unwrap();
+                // Depending on the kind of the `MergeInput`, this may delete the file:
+                file.finished_reading()?;
             }
         }
     }
     Ok(())
 }
-/// The struct on the main thread representing an input file
-pub struct MergeableFile {
-    current_chunk: Rc<Chunk>,
-    line_idx: usize,
-    receiver: Receiver<Chunk>,
-    file_number: usize,
+/// The struct on the main thread representing an input file
+pub struct MergeableFile {
+    current_chunk: Rc<Chunk>,
+    line_idx: usize,
+    receiver: Receiver<Chunk>,
+    file_number: usize,
 }
 
-/// A struct to keep track of the previous line we encountered.
-///
-/// This is required for deduplication purposes.
-struct PreviousLine {
-    chunk: Rc<Chunk>,
-    line_idx: usize,
-    file_number: usize,
+/// A struct to keep track of the previous line we encountered.
+///
+/// This is required for deduplication purposes.
+struct PreviousLine {
+    chunk: Rc<Chunk>,
+    line_idx: usize,
+    file_number: usize,
 }
 
-/// Merges files together. This is **not** an iterator because of lifetime problems.
-pub struct FileMerger<'a> {
-    heap: binary_heap_plus::BinaryHeap<MergeableFile, FileComparator<'a>>,
-    request_sender: Sender<(usize, RecycledChunk)>,
-    prev: Option<PreviousLine>,
-    reader_join_handle: JoinHandle<UResult<()>>,
+/// Merges files together. This is **not** an iterator because of lifetime problems.
+pub struct FileMerger<'a> {
+    heap: binary_heap_plus::BinaryHeap<MergeableFile, FileComparator<'a>>,
+    request_sender: Sender<(usize, RecycledChunk)>,
+    prev: Option<PreviousLine>,
+    reader_join_handle: JoinHandle<UResult<()>>,
 }
 
-impl<'a> FileMerger<'a> {
-    /// Write the merged contents to the output file.
-    pub fn write_all(self, settings: &GlobalSettings, output: Output) -> UResult<()> {
-        let mut out = output.into_write();
-        self.write_all_to(settings, &mut out)
+impl<'a> FileMerger<'a> {
+    /// Write the merged contents to the output file.
+    pub fn write_all(self, settings: &GlobalSettings, output: Output) -> UResult<()> {
+        let mut out = output.into_write();
+        self.write_all_to(settings, &mut out)
     }
 
-    pub fn write_all_to(mut self, settings: &GlobalSettings, out: &mut impl Write) -> UResult<()> {
-        while self.write_next(settings, out) {}
-        drop(self.request_sender);
-        self.reader_join_handle.join().unwrap()
+    pub fn write_all_to(mut self, settings: &GlobalSettings, out: &mut impl Write) -> UResult<()> {
+        while self.write_next(settings, out) {}
+        drop(self.request_sender);
+        self.reader_join_handle.join().unwrap()
     }
 
-    fn write_next(&mut self, settings: &GlobalSettings, out: &mut impl Write) -> bool {
-        if let Some(file) = self.heap.peek() {
-            let prev = self.prev.replace(PreviousLine {
-                chunk: file.current_chunk.clone(),
-                line_idx: file.line_idx,
-                file_number: file.file_number,
+    fn write_next(&mut self, settings: &GlobalSettings, out: &mut impl Write) -> bool {
+        if let Some(file) = self.heap.peek() {
+            let prev = self.prev.replace(PreviousLine {
+                chunk: file.current_chunk.clone(),
+                line_idx: file.line_idx,
+                file_number: file.file_number,
             });
 
-            file.current_chunk.with_contents(|contents| {
-                let current_line = &contents.lines[file.line_idx];
-                if settings.unique {
-                    if let Some(prev) = &prev {
-                        let cmp = compare_by(
-                            &prev.chunk.lines()[prev.line_idx],
-                            current_line,
-                            settings,
-                            prev.chunk.line_data(),
-                            file.current_chunk.line_data(),
+            file.current_chunk.with_contents(|contents| {
+                let current_line = &contents.lines[file.line_idx];
+                if settings.unique {
+                    if let Some(prev) = &prev {
+                        let cmp = compare_by(
+                            &prev.chunk.lines()[prev.line_idx],
+                            current_line,
+                            settings,
+                            prev.chunk.line_data(),
+                            file.current_chunk.line_data(),
                         );
-                        if cmp == Ordering::Equal {
+                        if cmp == Ordering::Equal {
                             return;
                         }
                     }
                 }
-                current_line.print(out, settings);
+                current_line.print(out, settings);
             });
 
-            let was_last_line_for_file = file.current_chunk.lines().len() == file.line_idx + 1;
+            let was_last_line_for_file = file.current_chunk.lines().len() == file.line_idx + 1;
 
-            if was_last_line_for_file {
-                if let Ok(next_chunk) = file.receiver.recv() {
-                    let mut file = self.heap.peek_mut().unwrap();
-                    file.current_chunk = Rc::new(next_chunk);
-                    file.line_idx = 0;
-                } else {
-                    self.heap.pop();
+            if was_last_line_for_file {
+                if let Ok(next_chunk) = file.receiver.recv() {
+                    let mut file = self.heap.peek_mut().unwrap();
+                    file.current_chunk = Rc::new(next_chunk);
+                    file.line_idx = 0;
+                } else {
+                    self.heap.pop();
                 }
-            } else {
-                // This will cause the comparison to use a different line and the heap to readjust.
-                self.heap.peek_mut().unwrap().line_idx += 1;
+            } else {
+                // This will cause the comparison to use a different line and the heap to readjust.
+                self.heap.peek_mut().unwrap().line_idx += 1;
             }
 
-            if let Some(prev) = prev {
-                if let Ok(prev_chunk) = Rc::try_unwrap(prev.chunk) {
-                    // If nothing is referencing the previous chunk anymore, this means that the previous line
-                    // was the last line of the chunk. We can recycle the chunk.
-                    self.request_sender
-                        .send((prev.file_number, prev_chunk.recycle()))
-                        .ok();
+            if let Some(prev) = prev {
+                if let Ok(prev_chunk) = Rc::try_unwrap(prev.chunk) {
+                    // If nothing is referencing the previous chunk anymore, this means that the previous line
+                    // was the last line of the chunk. We can recycle the chunk.
+                    self.request_sender
+                        .send((prev.file_number, prev_chunk.recycle()))
+                        .ok();
                 }
             }
         }
-        !self.heap.is_empty()
+        !self.heap.is_empty()
     }
 }
 
-/// Compares files by their current line.
-struct FileComparator<'a> {
-    settings: &'a GlobalSettings,
+/// Compares files by their current line.
+struct FileComparator<'a> {
+    settings: &'a GlobalSettings,
 }
 
-impl<'a> Compare<MergeableFile> for FileComparator<'a> {
-    fn compare(&self, a: &MergeableFile, b: &MergeableFile) -> Ordering {
-        let mut cmp = compare_by(
-            &a.current_chunk.lines()[a.line_idx],
-            &b.current_chunk.lines()[b.line_idx],
-            self.settings,
-            a.current_chunk.line_data(),
-            b.current_chunk.line_data(),
+impl<'a> Compare<MergeableFile> for FileComparator<'a> {
+    fn compare(&self, a: &MergeableFile, b: &MergeableFile) -> Ordering {
+        let mut cmp = compare_by(
+            &a.current_chunk.lines()[a.line_idx],
+            &b.current_chunk.lines()[b.line_idx],
+            self.settings,
+            a.current_chunk.line_data(),
+            b.current_chunk.line_data(),
         );
-        if cmp == Ordering::Equal {
-            // To make sorting stable, we need to consider the file number as well,
-            // as lines from a file with a lower number are to be considered "earlier".
-            cmp = a.file_number.cmp(&b.file_number);
+        if cmp == Ordering::Equal {
+            // To make sorting stable, we need to consider the file number as well,
+            // as lines from a file with a lower number are to be considered "earlier".
+            cmp = a.file_number.cmp(&b.file_number);
         }
-        // BinaryHeap is a max heap. We use it as a min heap, so we need to reverse the ordering.
-        cmp.reverse()
+        // BinaryHeap is a max heap. We use it as a min heap, so we need to reverse the ordering.
+        cmp.reverse()
     }
 }
 
-// Wait for the child to exit and check its exit code.
-fn check_child_success(mut child: Child, program: &str) -> UResult<()> {
-    if !matches!(
-        child.wait().map(|e| e.code()),
-        Ok(Some(0)) | Ok(None) | Err(_)
+// Wait for the child to exit and check its exit code.
+fn check_child_success(mut child: Child, program: &str) -> UResult<()> {
+    if !matches!(
+        child.wait().map(|e| e.code()),
+        Ok(Some(0)) | Ok(None) | Err(_)
     ) {
-        Err(SortError::CompressProgTerminatedAbnormally {
-            prog: program.to_owned(),
+        Err(SortError::CompressProgTerminatedAbnormally {
+            prog: program.to_owned(),
         }
-        .into())
-    } else {
+        .into())
+    } else {
         Ok(())
     }
 }
 
-/// A temporary file that can be written to.
-pub trait WriteableTmpFile: Sized {
-    type Closed: ClosedTmpFile;
-    type InnerWrite: Write;
-    fn create(file: (File, PathBuf), compress_prog: Option<&str>) -> UResult<Self>;
-    /// Closes the temporary file.
-    fn finished_writing(self) -> UResult<Self::Closed>;
-    fn as_write(&mut self) -> &mut Self::InnerWrite;
+/// A temporary file that can be written to.
+pub trait WriteableTmpFile: Sized {
+    type Closed: ClosedTmpFile;
+    type InnerWrite: Write;
+    fn create(file: (File, PathBuf), compress_prog: Option<&str>) -> UResult<Self>;
+    /// Closes the temporary file.
+    fn finished_writing(self) -> UResult<Self::Closed>;
+    fn as_write(&mut self) -> &mut Self::InnerWrite;
 }
-/// A temporary file that is (temporarily) closed, but can be reopened.
-pub trait ClosedTmpFile {
-    type Reopened: MergeInput;
-    /// Reopens the temporary file.
-    fn reopen(self) -> UResult<Self::Reopened>;
+/// A temporary file that is (temporarily) closed, but can be reopened.
+pub trait ClosedTmpFile {
+    type Reopened: MergeInput;
+    /// Reopens the temporary file.
+    fn reopen(self) -> UResult<Self::Reopened>;
 }
-/// A pre-sorted input for merging.
-pub trait MergeInput: Send {
-    type InnerRead: Read;
-    /// Cleans this `MergeInput` up.
-    /// Implementations may delete the backing file.
-    fn finished_reading(self) -> UResult<()>;
-    fn as_read(&mut self) -> &mut Self::InnerRead;
+/// A pre-sorted input for merging.
+pub trait MergeInput: Send {
+    type InnerRead: Read;
+    /// Cleans this `MergeInput` up.
+    /// Implementations may delete the backing file.
+    fn finished_reading(self) -> UResult<()>;
+    fn as_read(&mut self) -> &mut Self::InnerRead;
 }
 
-pub struct WriteablePlainTmpFile {
-    path: PathBuf,
-    file: BufWriter<File>,
+pub struct WriteablePlainTmpFile {
+    path: PathBuf,
+    file: BufWriter<File>,
 }
-pub struct ClosedPlainTmpFile {
-    path: PathBuf,
+pub struct ClosedPlainTmpFile {
+    path: PathBuf,
 }
-pub struct PlainTmpMergeInput {
-    path: PathBuf,
-    file: File,
+pub struct PlainTmpMergeInput {
+    path: PathBuf,
+    file: File,
 }
-impl WriteableTmpFile for WriteablePlainTmpFile {
-    type Closed = ClosedPlainTmpFile;
-    type InnerWrite = BufWriter<File>;
+impl WriteableTmpFile for WriteablePlainTmpFile {
+    type Closed = ClosedPlainTmpFile;
+    type InnerWrite = BufWriter<File>;
 
-    fn create((file, path): (File, PathBuf), _: Option<&str>) -> UResult<Self> {
-        Ok(Self {
-            file: BufWriter::new(file),
-            path,
+    fn create((file, path): (File, PathBuf), _: Option<&str>) -> UResult<Self> {
+        Ok(Self {
+            file: BufWriter::new(file),
+            path,
         })
     }
 
-    fn finished_writing(self) -> UResult<Self::Closed> {
-        Ok(ClosedPlainTmpFile { path: self.path })
+    fn finished_writing(self) -> UResult<Self::Closed> {
+        Ok(ClosedPlainTmpFile { path: self.path })
     }
 
-    fn as_write(&mut self) -> &mut Self::InnerWrite {
-        &mut self.file
+    fn as_write(&mut self) -> &mut Self::InnerWrite {
+        &mut self.file
     }
 }
-impl ClosedTmpFile for ClosedPlainTmpFile {
-    type Reopened = PlainTmpMergeInput;
-    fn reopen(self) -> UResult<Self::Reopened> {
-        Ok(PlainTmpMergeInput {
-            file: File::open(&self.path).map_err(|error| SortError::OpenTmpFileFailed { error })?,
-            path: self.path,
+impl ClosedTmpFile for ClosedPlainTmpFile {
+    type Reopened = PlainTmpMergeInput;
+    fn reopen(self) -> UResult<Self::Reopened> {
+        Ok(PlainTmpMergeInput {
+            file: File::open(&self.path).map_err(|error| SortError::OpenTmpFileFailed { error })?,
+            path: self.path,
         })
     }
 }
-impl MergeInput for PlainTmpMergeInput {
-    type InnerRead = File;
+impl MergeInput for PlainTmpMergeInput {
+    type InnerRead = File;
 
-    fn finished_reading(self) -> UResult<()> {
-        // we ignore failures to delete the temporary file,
-        // because there is a race at the end of the execution and the whole
-        // temporary directory might already be gone.
-        let _ = fs::remove_file(self.path);
+    fn finished_reading(self) -> UResult<()> {
+        // we ignore failures to delete the temporary file,
+        // because there is a race at the end of the execution and the whole
+        // temporary directory might already be gone.
+        let _ = fs::remove_file(self.path);
         Ok(())
     }
 
-    fn as_read(&mut self) -> &mut Self::InnerRead {
-        &mut self.file
+    fn as_read(&mut self) -> &mut Self::InnerRead {
+        &mut self.file
     }
 }
 
-pub struct WriteableCompressedTmpFile {
-    path: PathBuf,
-    compress_prog: String,
-    child: Child,
-    child_stdin: BufWriter<ChildStdin>,
+pub struct WriteableCompressedTmpFile {
+    path: PathBuf,
+    compress_prog: String,
+    child: Child,
+    child_stdin: BufWriter<ChildStdin>,
 }
-pub struct ClosedCompressedTmpFile {
-    path: PathBuf,
-    compress_prog: String,
+pub struct ClosedCompressedTmpFile {
+    path: PathBuf,
+    compress_prog: String,
 }
-pub struct CompressedTmpMergeInput {
-    path: PathBuf,
-    compress_prog: String,
-    child: Child,
-    child_stdout: ChildStdout,
+pub struct CompressedTmpMergeInput {
+    path: PathBuf,
+    compress_prog: String,
+    child: Child,
+    child_stdout: ChildStdout,
 }
-impl WriteableTmpFile for WriteableCompressedTmpFile {
-    type Closed = ClosedCompressedTmpFile;
-    type InnerWrite = BufWriter<ChildStdin>;
+impl WriteableTmpFile for WriteableCompressedTmpFile {
+    type Closed = ClosedCompressedTmpFile;
+    type InnerWrite = BufWriter<ChildStdin>;
 
-    fn create((file, path): (File, PathBuf), compress_prog: Option<&str>) -> UResult<Self> {
-        let compress_prog = compress_prog.unwrap();
-        let mut command = Command::new(compress_prog);
-        command.stdin(Stdio::piped()).stdout(file);
-        let mut child = command
-            .spawn()
-            .map_err(|err| SortError::CompressProgExecutionFailed {
-                code: err.raw_os_error().unwrap(),
+    fn create((file, path): (File, PathBuf), compress_prog: Option<&str>) -> UResult<Self> {
+        let compress_prog = compress_prog.unwrap();
+        let mut command = Command::new(compress_prog);
+        command.stdin(Stdio::piped()).stdout(file);
+        let mut child = command
+            .spawn()
+            .map_err(|err| SortError::CompressProgExecutionFailed {
+                code: err.raw_os_error().unwrap(),
             })?;
-        let child_stdin = child.stdin.take().unwrap();
-        Ok(Self {
-            path,
-            compress_prog: compress_prog.to_owned(),
-            child,
-            child_stdin: BufWriter::new(child_stdin),
+        let child_stdin = child.stdin.take().unwrap();
+        Ok(Self {
+            path,
+            compress_prog: compress_prog.to_owned(),
+            child,
+            child_stdin: BufWriter::new(child_stdin),
         })
     }
 
-    fn finished_writing(self) -> UResult<Self::Closed> {
-        drop(self.child_stdin);
-        check_child_success(self.child, &self.compress_prog)?;
-        Ok(ClosedCompressedTmpFile {
-            path: self.path,
-            compress_prog: self.compress_prog,
+    fn finished_writing(self) -> UResult<Self::Closed> {
+        drop(self.child_stdin);
+        check_child_success(self.child, &self.compress_prog)?;
+        Ok(ClosedCompressedTmpFile {
+            path: self.path,
+            compress_prog: self.compress_prog,
         })
     }
 
-    fn as_write(&mut self) -> &mut Self::InnerWrite {
-        &mut self.child_stdin
+    fn as_write(&mut self) -> &mut Self::InnerWrite {
+        &mut self.child_stdin
     }
 }
-impl ClosedTmpFile for ClosedCompressedTmpFile {
-    type Reopened = CompressedTmpMergeInput;
+impl ClosedTmpFile for ClosedCompressedTmpFile {
+    type Reopened = CompressedTmpMergeInput;
 
-    fn reopen(self) -> UResult<Self::Reopened> {
-        let mut command = Command::new(&self.compress_prog);
-        let file = File::open(&self.path).unwrap();
-        command.stdin(file).stdout(Stdio::piped()).arg("-d");
-        let mut child = command
-            .spawn()
-            .map_err(|err| SortError::CompressProgExecutionFailed {
-                code: err.raw_os_error().unwrap(),
+    fn reopen(self) -> UResult<Self::Reopened> {
+        let mut command = Command::new(&self.compress_prog);
+        let file = File::open(&self.path).unwrap();
+        command.stdin(file).stdout(Stdio::piped()).arg("-d");
+        let mut child = command
+            .spawn()
+            .map_err(|err| SortError::CompressProgExecutionFailed {
+                code: err.raw_os_error().unwrap(),
             })?;
-        let child_stdout = child.stdout.take().unwrap();
-        Ok(CompressedTmpMergeInput {
-            path: self.path,
-            compress_prog: self.compress_prog,
-            child,
-            child_stdout,
+        let child_stdout = child.stdout.take().unwrap();
+        Ok(CompressedTmpMergeInput {
+            path: self.path,
+            compress_prog: self.compress_prog,
+            child,
+            child_stdout,
         })
     }
 }
-impl MergeInput for CompressedTmpMergeInput {
-    type InnerRead = ChildStdout;
+impl MergeInput for CompressedTmpMergeInput {
+    type InnerRead = ChildStdout;
 
-    fn finished_reading(self) -> UResult<()> {
-        drop(self.child_stdout);
-        check_child_success(self.child, &self.compress_prog)?;
-        let _ = fs::remove_file(self.path);
+    fn finished_reading(self) -> UResult<()> {
+        drop(self.child_stdout);
+        check_child_success(self.child, &self.compress_prog)?;
+        let _ = fs::remove_file(self.path);
         Ok(())
     }
 
-    fn as_read(&mut self) -> &mut Self::InnerRead {
-        &mut self.child_stdout
+    fn as_read(&mut self) -> &mut Self::InnerRead {
+        &mut self.child_stdout
     }
 }
 
-pub struct PlainMergeInput<R: Read + Send> {
-    inner: R,
+pub struct PlainMergeInput<R: Read + Send> {
+    inner: R,
 }
-impl<R: Read + Send> MergeInput for PlainMergeInput<R> {
-    type InnerRead = R;
-    fn finished_reading(self) -> UResult<()> {
+impl<R: Read + Send> MergeInput for PlainMergeInput<R> {
+    type InnerRead = R;
+    fn finished_reading(self) -> UResult<()> {
         Ok(())
     }
-    fn as_read(&mut self) -> &mut Self::InnerRead {
-        &mut self.inner
+    fn as_read(&mut self) -> &mut Self::InnerRead {
+        &mut self.inner
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sort/numeric_str_cmp.rs.html b/dev/src/uu_sort/numeric_str_cmp.rs.html index 94bb0b77e..3acb89f16 100644 --- a/dev/src/uu_sort/numeric_str_cmp.rs.html +++ b/dev/src/uu_sort/numeric_str_cmp.rs.html @@ -1,4 +1,4 @@ -numeric_str_cmp.rs - source
1
+numeric_str_cmp.rs - source
1
 2
 3
 4
@@ -503,510 +503,510 @@
 503
 504
 505
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-//! Fast comparison for strings representing a base 10 number without precision loss.
-//!
-//! To be able to short-circuit when comparing, [NumInfo] must be passed along with each number
-//! to [numeric_str_cmp]. [NumInfo] is generally obtained by calling [NumInfo::parse] and should be cached.
-//! It is allowed to arbitrarily modify the exponent afterwards, which is equivalent to shifting the decimal point.
-//!
-//! More specifically, exponent can be understood so that the original number is in (1..10)*10^exponent.
-//! From that follows the constraints of this algorithm: It is able to compare numbers in ±(1*10^[i64::MIN]..10*10^[i64::MAX]).
+//! Fast comparison for strings representing a base 10 number without precision loss.
+//!
+//! To be able to short-circuit when comparing, [NumInfo] must be passed along with each number
+//! to [numeric_str_cmp]. [NumInfo] is generally obtained by calling [NumInfo::parse] and should be cached.
+//! It is allowed to arbitrarily modify the exponent afterwards, which is equivalent to shifting the decimal point.
+//!
+//! More specifically, exponent can be understood so that the original number is in (1..10)*10^exponent.
+//! From that follows the constraints of this algorithm: It is able to compare numbers in ±(1*10^[i64::MIN]..10*10^[i64::MAX]).
 
-use std::{cmp::Ordering, ops::Range};
+use std::{cmp::Ordering, ops::Range};
 
-#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
-enum Sign {
-    Negative,
-    Positive,
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
+enum Sign {
+    Negative,
+    Positive,
 }
 
-#[derive(Debug, PartialEq, Eq, Clone)]
-pub struct NumInfo {
-    exponent: i64,
-    sign: Sign,
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub struct NumInfo {
+    exponent: i64,
+    sign: Sign,
 }
-#[derive(Debug, PartialEq, Eq, Clone)]
-pub struct NumInfoParseSettings {
-    pub accept_si_units: bool,
-    pub thousands_separator: Option<char>,
-    pub decimal_pt: Option<char>,
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub struct NumInfoParseSettings {
+    pub accept_si_units: bool,
+    pub thousands_separator: Option<char>,
+    pub decimal_pt: Option<char>,
 }
 
-impl Default for NumInfoParseSettings {
-    fn default() -> Self {
-        Self {
-            accept_si_units: false,
-            thousands_separator: None,
-            decimal_pt: Some('.'),
+impl Default for NumInfoParseSettings {
+    fn default() -> Self {
+        Self {
+            accept_si_units: false,
+            thousands_separator: None,
+            decimal_pt: Some('.'),
         }
     }
 }
 
-impl NumInfo {
-    /// Parse NumInfo for this number.
-    /// Also returns the range of num that should be passed to numeric_str_cmp later.
-    ///
-    /// Leading zeros will be excluded from the returned range. If the number consists of only zeros,
-    /// an empty range (idx..idx) is returned so that idx is the char after the last zero.
-    /// If the input is not a number (which has to be treated as zero), the returned empty range
-    /// will be 0..0.
-    pub fn parse(num: &str, parse_settings: &NumInfoParseSettings) -> (Self, Range<usize>) {
-        let mut exponent = -1;
-        let mut had_decimal_pt = false;
-        let mut had_digit = false;
-        let mut start = None;
-        let mut sign = Sign::Positive;
+impl NumInfo {
+    /// Parse NumInfo for this number.
+    /// Also returns the range of num that should be passed to numeric_str_cmp later.
+    ///
+    /// Leading zeros will be excluded from the returned range. If the number consists of only zeros,
+    /// an empty range (idx..idx) is returned so that idx is the char after the last zero.
+    /// If the input is not a number (which has to be treated as zero), the returned empty range
+    /// will be 0..0.
+    pub fn parse(num: &str, parse_settings: &NumInfoParseSettings) -> (Self, Range<usize>) {
+        let mut exponent = -1;
+        let mut had_decimal_pt = false;
+        let mut had_digit = false;
+        let mut start = None;
+        let mut sign = Sign::Positive;
 
-        let mut first_char = true;
+        let mut first_char = true;
 
-        for (idx, char) in num.char_indices() {
-            if first_char && char.is_whitespace() {
+        for (idx, char) in num.char_indices() {
+            if first_char && char.is_whitespace() {
                 continue;
             }
 
-            if first_char && char == '-' {
-                sign = Sign::Negative;
-                first_char = false;
+            if first_char && char == '-' {
+                sign = Sign::Negative;
+                first_char = false;
                 continue;
             }
-            first_char = false;
+            first_char = false;
 
-            if matches!(
-                parse_settings.thousands_separator,
-                Some(c) if c == char
+            if matches!(
+                parse_settings.thousands_separator,
+                Some(c) if c == char
             ) {
                 continue;
             }
 
-            if Self::is_invalid_char(char, &mut had_decimal_pt, parse_settings) {
-                return if let Some(start) = start {
-                    let has_si_unit = parse_settings.accept_si_units
-                        && matches!(char, 'K' | 'k' | 'M' | 'G' | 'T' | 'P' | 'E' | 'Z' | 'Y');
+            if Self::is_invalid_char(char, &mut had_decimal_pt, parse_settings) {
+                return if let Some(start) = start {
+                    let has_si_unit = parse_settings.accept_si_units
+                        && matches!(char, 'K' | 'k' | 'M' | 'G' | 'T' | 'P' | 'E' | 'Z' | 'Y');
                     (
-                        Self { exponent, sign },
-                        start..if has_si_unit { idx + 1 } else { idx },
+                        Self { exponent, sign },
+                        start..if has_si_unit { idx + 1 } else { idx },
                     )
-                } else {
+                } else {
                     (
-                        Self {
-                            sign: Sign::Positive,
-                            exponent: 0,
-                        },
-                        if had_digit {
-                            // In this case there were only zeroes.
-                            // For debug output to work properly, we have to match the character after the last zero.
-                            idx..idx
-                        } else {
-                            // This was no number at all.
-                            // For debug output to work properly, we have to match 0..0.
-                            0..0
+                        Self {
+                            sign: Sign::Positive,
+                            exponent: 0,
                         },
+                        if had_digit {
+                            // In this case there were only zeroes.
+                            // For debug output to work properly, we have to match the character after the last zero.
+                            idx..idx
+                        } else {
+                            // This was no number at all.
+                            // For debug output to work properly, we have to match 0..0.
+                            0..0
+                        },
                     )
                 };
             }
-            if Some(char) == parse_settings.decimal_pt {
+            if Some(char) == parse_settings.decimal_pt {
                 continue;
             }
-            had_digit = true;
-            if start.is_none() && char == '0' {
-                if had_decimal_pt {
-                    // We're parsing a number whose first nonzero digit is after the decimal point.
-                    exponent -= 1;
-                } else {
-                    // Skip leading zeroes
-                    continue;
+            had_digit = true;
+            if start.is_none() && char == '0' {
+                if had_decimal_pt {
+                    // We're parsing a number whose first nonzero digit is after the decimal point.
+                    exponent -= 1;
+                } else {
+                    // Skip leading zeroes
+                    continue;
                 }
             }
-            if !had_decimal_pt {
-                exponent += 1;
+            if !had_decimal_pt {
+                exponent += 1;
             }
-            if start.is_none() && char != '0' {
-                start = Some(idx);
+            if start.is_none() && char != '0' {
+                start = Some(idx);
             }
         }
-        if let Some(start) = start {
-            (Self { exponent, sign }, start..num.len())
-        } else {
+        if let Some(start) = start {
+            (Self { exponent, sign }, start..num.len())
+        } else {
             (
-                Self {
-                    sign: Sign::Positive,
-                    exponent: 0,
-                },
-                if had_digit {
-                    // In this case there were only zeroes.
-                    // For debug output to work properly, we have to claim to match the end of the number.
-                    num.len()..num.len()
-                } else {
-                    // This was no number at all.
-                    // For debug output to work properly, we have to claim to match the start of the number.
-                    0..0
+                Self {
+                    sign: Sign::Positive,
+                    exponent: 0,
                 },
+                if had_digit {
+                    // In this case there were only zeroes.
+                    // For debug output to work properly, we have to claim to match the end of the number.
+                    num.len()..num.len()
+                } else {
+                    // This was no number at all.
+                    // For debug output to work properly, we have to claim to match the start of the number.
+                    0..0
+                },
             )
         }
     }
 
-    fn is_invalid_char(
-        c: char,
-        had_decimal_pt: &mut bool,
-        parse_settings: &NumInfoParseSettings,
-    ) -> bool {
-        if Some(c) == parse_settings.decimal_pt {
-            if *had_decimal_pt {
-                // this is a decimal pt but we already had one, so it is invalid
-                true
-            } else {
-                *had_decimal_pt = true;
-                false
-            }
-        } else {
-            !c.is_ascii_digit()
+    fn is_invalid_char(
+        c: char,
+        had_decimal_pt: &mut bool,
+        parse_settings: &NumInfoParseSettings,
+    ) -> bool {
+        if Some(c) == parse_settings.decimal_pt {
+            if *had_decimal_pt {
+                // this is a decimal pt but we already had one, so it is invalid
+                true
+            } else {
+                *had_decimal_pt = true;
+                false
+            }
+        } else {
+            !c.is_ascii_digit()
         }
     }
 }
 
-fn get_unit(unit: Option<char>) -> u8 {
-    if let Some(unit) = unit {
-        match unit {
-            'K' | 'k' => 1,
-            'M' => 2,
-            'G' => 3,
-            'T' => 4,
-            'P' => 5,
-            'E' => 6,
-            'Z' => 7,
-            'Y' => 8,
-            _ => 0,
+fn get_unit(unit: Option<char>) -> u8 {
+    if let Some(unit) = unit {
+        match unit {
+            'K' | 'k' => 1,
+            'M' => 2,
+            'G' => 3,
+            'T' => 4,
+            'P' => 5,
+            'E' => 6,
+            'Z' => 7,
+            'Y' => 8,
+            _ => 0,
         }
-    } else {
-        0
+    } else {
+        0
+    }
+}
+
+/// Compare two numbers according to the rules of human numeric comparison.
+/// The SI-Unit takes precedence over the actual value (i.e. 2000M < 1G).
+pub fn human_numeric_str_cmp(
+    (a, a_info): (&str, &NumInfo),
+    (b, b_info): (&str, &NumInfo),
+) -> Ordering {
+    // 1. Sign
+    if a_info.sign != b_info.sign {
+        return a_info.sign.cmp(&b_info.sign);
+    }
+    // 2. Unit
+    let a_unit = get_unit(a.chars().next_back());
+    let b_unit = get_unit(b.chars().next_back());
+    let ordering = a_unit.cmp(&b_unit);
+    if ordering != Ordering::Equal {
+        if a_info.sign == Sign::Negative {
+            ordering.reverse()
+        } else {
+            ordering
+        }
+    } else {
+        // 3. Number
+        numeric_str_cmp((a, a_info), (b, b_info))
     }
 }
 
-/// Compare two numbers according to the rules of human numeric comparison.
-/// The SI-Unit takes precedence over the actual value (i.e. 2000M < 1G).
-pub fn human_numeric_str_cmp(
-    (a, a_info): (&str, &NumInfo),
-    (b, b_info): (&str, &NumInfo),
-) -> Ordering {
-    // 1. Sign
-    if a_info.sign != b_info.sign {
-        return a_info.sign.cmp(&b_info.sign);
-    }
-    // 2. Unit
-    let a_unit = get_unit(a.chars().next_back());
-    let b_unit = get_unit(b.chars().next_back());
-    let ordering = a_unit.cmp(&b_unit);
-    if ordering != Ordering::Equal {
-        if a_info.sign == Sign::Negative {
-            ordering.reverse()
-        } else {
-            ordering
-        }
-    } else {
-        // 3. Number
-        numeric_str_cmp((a, a_info), (b, b_info))
-    }
-}
-
-/// Compare two numbers as strings without parsing them as a number first. This should be more performant and can handle numbers more precisely.
-/// NumInfo is needed to provide a fast path for most numbers.
-#[inline(always)]
-pub fn numeric_str_cmp((a, a_info): (&str, &NumInfo), (b, b_info): (&str, &NumInfo)) -> Ordering {
-    // check for a difference in the sign
-    if a_info.sign != b_info.sign {
-        return a_info.sign.cmp(&b_info.sign);
+/// Compare two numbers as strings without parsing them as a number first. This should be more performant and can handle numbers more precisely.
+/// NumInfo is needed to provide a fast path for most numbers.
+#[inline(always)]
+pub fn numeric_str_cmp((a, a_info): (&str, &NumInfo), (b, b_info): (&str, &NumInfo)) -> Ordering {
+    // check for a difference in the sign
+    if a_info.sign != b_info.sign {
+        return a_info.sign.cmp(&b_info.sign);
     }
 
-    // check for a difference in the exponent
-    let ordering = if a_info.exponent != b_info.exponent && !a.is_empty() && !b.is_empty() {
-        a_info.exponent.cmp(&b_info.exponent)
-    } else {
-        // walk the characters from the front until we find a difference
-        let mut a_chars = a.chars().filter(|c| c.is_ascii_digit());
-        let mut b_chars = b.chars().filter(|c| c.is_ascii_digit());
-        loop {
-            let a_next = a_chars.next();
-            let b_next = b_chars.next();
-            match (a_next, b_next) {
-                (None, None) => break Ordering::Equal,
-                (Some(c), None) => {
-                    break if c == '0' && a_chars.all(|c| c == '0') {
-                        Ordering::Equal
-                    } else {
-                        Ordering::Greater
+    // check for a difference in the exponent
+    let ordering = if a_info.exponent != b_info.exponent && !a.is_empty() && !b.is_empty() {
+        a_info.exponent.cmp(&b_info.exponent)
+    } else {
+        // walk the characters from the front until we find a difference
+        let mut a_chars = a.chars().filter(|c| c.is_ascii_digit());
+        let mut b_chars = b.chars().filter(|c| c.is_ascii_digit());
+        loop {
+            let a_next = a_chars.next();
+            let b_next = b_chars.next();
+            match (a_next, b_next) {
+                (None, None) => break Ordering::Equal,
+                (Some(c), None) => {
+                    break if c == '0' && a_chars.all(|c| c == '0') {
+                        Ordering::Equal
+                    } else {
+                        Ordering::Greater
                     }
                 }
-                (None, Some(c)) => {
-                    break if c == '0' && b_chars.all(|c| c == '0') {
-                        Ordering::Equal
-                    } else {
-                        Ordering::Less
+                (None, Some(c)) => {
+                    break if c == '0' && b_chars.all(|c| c == '0') {
+                        Ordering::Equal
+                    } else {
+                        Ordering::Less
                     }
                 }
-                (Some(a_char), Some(b_char)) => {
-                    let ord = a_char.cmp(&b_char);
-                    if ord != Ordering::Equal {
-                        break ord;
+                (Some(a_char), Some(b_char)) => {
+                    let ord = a_char.cmp(&b_char);
+                    if ord != Ordering::Equal {
+                        break ord;
                     }
                 }
             }
         }
     };
 
-    if a_info.sign == Sign::Negative {
-        ordering.reverse()
-    } else {
-        ordering
+    if a_info.sign == Sign::Negative {
+        ordering.reverse()
+    } else {
+        ordering
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
+#[cfg(test)]
+mod tests {
+    use super::*;
 
-    #[test]
-    fn parses_exp() {
-        let n = "1";
+    #[test]
+    fn parses_exp() {
+        let n = "1";
         assert_eq!(
-            NumInfo::parse(n, &Default::default()),
+            NumInfo::parse(n, &Default::default()),
             (
-                NumInfo {
-                    exponent: 0,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: 0,
+                    sign: Sign::Positive
                 },
-                0..1
-            )
+                0..1
+            )
         );
-        let n = "100";
+        let n = "100";
         assert_eq!(
-            NumInfo::parse(n, &Default::default()),
+            NumInfo::parse(n, &Default::default()),
             (
-                NumInfo {
-                    exponent: 2,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: 2,
+                    sign: Sign::Positive
                 },
-                0..3
-            )
+                0..3
+            )
         );
-        let n = "1,000";
+        let n = "1,000";
         assert_eq!(
-            NumInfo::parse(
-                n,
-                &NumInfoParseSettings {
-                    thousands_separator: Some(','),
-                    ..Default::default()
+            NumInfo::parse(
+                n,
+                &NumInfoParseSettings {
+                    thousands_separator: Some(','),
+                    ..Default::default()
                 }
             ),
             (
-                NumInfo {
-                    exponent: 3,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: 3,
+                    sign: Sign::Positive
                 },
-                0..5
-            )
+                0..5
+            )
         );
-        let n = "1,000";
+        let n = "1,000";
         assert_eq!(
-            NumInfo::parse(n, &Default::default()),
+            NumInfo::parse(n, &Default::default()),
             (
-                NumInfo {
-                    exponent: 0,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: 0,
+                    sign: Sign::Positive
                 },
-                0..1
-            )
+                0..1
+            )
         );
-        let n = "1000.00";
+        let n = "1000.00";
         assert_eq!(
-            NumInfo::parse(n, &Default::default()),
+            NumInfo::parse(n, &Default::default()),
             (
-                NumInfo {
-                    exponent: 3,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: 3,
+                    sign: Sign::Positive
                 },
-                0..7
-            )
+                0..7
+            )
         );
     }
-    #[test]
-    fn parses_negative_exp() {
-        let n = "0.00005";
+    #[test]
+    fn parses_negative_exp() {
+        let n = "0.00005";
         assert_eq!(
-            NumInfo::parse(n, &Default::default()),
+            NumInfo::parse(n, &Default::default()),
             (
-                NumInfo {
-                    exponent: -5,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: -5,
+                    sign: Sign::Positive
                 },
-                6..7
-            )
+                6..7
+            )
         );
-        let n = "00000.00005";
+        let n = "00000.00005";
         assert_eq!(
-            NumInfo::parse(n, &Default::default()),
+            NumInfo::parse(n, &Default::default()),
             (
-                NumInfo {
-                    exponent: -5,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: -5,
+                    sign: Sign::Positive
                 },
-                10..11
-            )
+                10..11
+            )
         );
     }
 
-    #[test]
-    fn parses_sign() {
-        let n = "5";
+    #[test]
+    fn parses_sign() {
+        let n = "5";
         assert_eq!(
-            NumInfo::parse(n, &Default::default()),
+            NumInfo::parse(n, &Default::default()),
             (
-                NumInfo {
-                    exponent: 0,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: 0,
+                    sign: Sign::Positive
                 },
-                0..1
-            )
+                0..1
+            )
         );
-        let n = "-5";
+        let n = "-5";
         assert_eq!(
-            NumInfo::parse(n, &Default::default()),
+            NumInfo::parse(n, &Default::default()),
             (
-                NumInfo {
-                    exponent: 0,
-                    sign: Sign::Negative
+                NumInfo {
+                    exponent: 0,
+                    sign: Sign::Negative
                 },
-                1..2
-            )
+                1..2
+            )
         );
-        let n = "    -5";
+        let n = "    -5";
         assert_eq!(
-            NumInfo::parse(n, &Default::default()),
+            NumInfo::parse(n, &Default::default()),
             (
-                NumInfo {
-                    exponent: 0,
-                    sign: Sign::Negative
+                NumInfo {
+                    exponent: 0,
+                    sign: Sign::Negative
                 },
-                5..6
-            )
+                5..6
+            )
         );
     }
 
-    fn test_helper(a: &str, b: &str, expected: Ordering) {
-        let (a_info, a_range) = NumInfo::parse(a, &Default::default());
-        let (b_info, b_range) = NumInfo::parse(b, &Default::default());
-        let ordering = numeric_str_cmp(
-            (&a[a_range.to_owned()], &a_info),
-            (&b[b_range.to_owned()], &b_info),
+    fn test_helper(a: &str, b: &str, expected: Ordering) {
+        let (a_info, a_range) = NumInfo::parse(a, &Default::default());
+        let (b_info, b_range) = NumInfo::parse(b, &Default::default());
+        let ordering = numeric_str_cmp(
+            (&a[a_range.to_owned()], &a_info),
+            (&b[b_range.to_owned()], &b_info),
         );
-        assert_eq!(ordering, expected);
-        let ordering = numeric_str_cmp((&b[b_range], &b_info), (&a[a_range], &a_info));
-        assert_eq!(ordering, expected.reverse());
+        assert_eq!(ordering, expected);
+        let ordering = numeric_str_cmp((&b[b_range], &b_info), (&a[a_range], &a_info));
+        assert_eq!(ordering, expected.reverse());
     }
-    #[test]
-    fn test_single_digit() {
-        test_helper("1", "2", Ordering::Less);
-        test_helper("0", "0", Ordering::Equal);
+    #[test]
+    fn test_single_digit() {
+        test_helper("1", "2", Ordering::Less);
+        test_helper("0", "0", Ordering::Equal);
     }
-    #[test]
-    fn test_minus() {
-        test_helper("-1", "-2", Ordering::Greater);
-        test_helper("-0", "-0", Ordering::Equal);
+    #[test]
+    fn test_minus() {
+        test_helper("-1", "-2", Ordering::Greater);
+        test_helper("-0", "-0", Ordering::Equal);
     }
-    #[test]
-    fn test_different_len() {
-        test_helper("-20", "-100", Ordering::Greater);
-        test_helper("10.0", "2.000000", Ordering::Greater);
+    #[test]
+    fn test_different_len() {
+        test_helper("-20", "-100", Ordering::Greater);
+        test_helper("10.0", "2.000000", Ordering::Greater);
     }
-    #[test]
-    fn test_decimal_digits() {
-        test_helper("20.1", "20.2", Ordering::Less);
-        test_helper("20.1", "20.15", Ordering::Less);
-        test_helper("-20.1", "+20.15", Ordering::Less);
-        test_helper("-20.1", "-20", Ordering::Less);
+    #[test]
+    fn test_decimal_digits() {
+        test_helper("20.1", "20.2", Ordering::Less);
+        test_helper("20.1", "20.15", Ordering::Less);
+        test_helper("-20.1", "+20.15", Ordering::Less);
+        test_helper("-20.1", "-20", Ordering::Less);
     }
-    #[test]
-    fn test_trailing_zeroes() {
-        test_helper("20.00000", "20.1", Ordering::Less);
-        test_helper("20.00000", "20.0", Ordering::Equal);
+    #[test]
+    fn test_trailing_zeroes() {
+        test_helper("20.00000", "20.1", Ordering::Less);
+        test_helper("20.00000", "20.0", Ordering::Equal);
     }
-    #[test]
-    fn test_invalid_digits() {
-        test_helper("foo", "bar", Ordering::Equal);
-        test_helper("20.1", "a", Ordering::Greater);
-        test_helper("-20.1", "a", Ordering::Less);
-        test_helper("a", "0.15", Ordering::Less);
+    #[test]
+    fn test_invalid_digits() {
+        test_helper("foo", "bar", Ordering::Equal);
+        test_helper("20.1", "a", Ordering::Greater);
+        test_helper("-20.1", "a", Ordering::Less);
+        test_helper("a", "0.15", Ordering::Less);
     }
-    #[test]
-    fn test_multiple_decimal_pts() {
-        test_helper("10.0.0", "50.0.0", Ordering::Less);
-        test_helper("0.1.", "0.2.0", Ordering::Less);
-        test_helper("1.1.", "0", Ordering::Greater);
-        test_helper("1.1.", "-0", Ordering::Greater);
+    #[test]
+    fn test_multiple_decimal_pts() {
+        test_helper("10.0.0", "50.0.0", Ordering::Less);
+        test_helper("0.1.", "0.2.0", Ordering::Less);
+        test_helper("1.1.", "0", Ordering::Greater);
+        test_helper("1.1.", "-0", Ordering::Greater);
     }
-    #[test]
-    fn test_leading_decimal_pts() {
-        test_helper(".0", ".0", Ordering::Equal);
-        test_helper(".1", ".0", Ordering::Greater);
-        test_helper(".02", "0", Ordering::Greater);
+    #[test]
+    fn test_leading_decimal_pts() {
+        test_helper(".0", ".0", Ordering::Equal);
+        test_helper(".1", ".0", Ordering::Greater);
+        test_helper(".02", "0", Ordering::Greater);
     }
-    #[test]
-    fn test_leading_zeroes() {
-        test_helper("000000.0", ".0", Ordering::Equal);
-        test_helper("0.1", "0000000000000.0", Ordering::Greater);
-        test_helper("-01", "-2", Ordering::Greater);
+    #[test]
+    fn test_leading_zeroes() {
+        test_helper("000000.0", ".0", Ordering::Equal);
+        test_helper("0.1", "0000000000000.0", Ordering::Greater);
+        test_helper("-01", "-2", Ordering::Greater);
     }
 
-    #[test]
-    fn minus_zero() {
-        // This matches GNU sort behavior.
-        test_helper("-0", "0", Ordering::Equal);
-        test_helper("-0x", "0", Ordering::Equal);
+    #[test]
+    fn minus_zero() {
+        // This matches GNU sort behavior.
+        test_helper("-0", "0", Ordering::Equal);
+        test_helper("-0x", "0", Ordering::Equal);
     }
-    #[test]
-    fn double_minus() {
-        test_helper("--1", "0", Ordering::Equal);
+    #[test]
+    fn double_minus() {
+        test_helper("--1", "0", Ordering::Equal);
     }
-    #[test]
-    fn single_minus() {
-        let info = NumInfo::parse("-", &Default::default());
+    #[test]
+    fn single_minus() {
+        let info = NumInfo::parse("-", &Default::default());
         assert_eq!(
-            info,
+            info,
             (
-                NumInfo {
-                    exponent: 0,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: 0,
+                    sign: Sign::Positive
                 },
-                0..0
-            )
+                0..0
+            )
         );
     }
-    #[test]
-    fn invalid_with_unit() {
-        let info = NumInfo::parse(
+    #[test]
+    fn invalid_with_unit() {
+        let info = NumInfo::parse(
             "-K",
-            &NumInfoParseSettings {
-                accept_si_units: true,
-                ..Default::default()
+            &NumInfoParseSettings {
+                accept_si_units: true,
+                ..Default::default()
             },
         );
         assert_eq!(
-            info,
+            info,
             (
-                NumInfo {
-                    exponent: 0,
-                    sign: Sign::Positive
+                NumInfo {
+                    exponent: 0,
+                    sign: Sign::Positive
                 },
-                0..0
-            )
+                0..0
+            )
         );
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sort/sort.rs.html b/dev/src/uu_sort/sort.rs.html index 92406b031..b7fbe3bc9 100644 --- a/dev/src/uu_sort/sort.rs.html +++ b/dev/src/uu_sort/sort.rs.html @@ -1,4 +1,4 @@ -sort.rs - source
1
+sort.rs - source
1
 2
 3
 4
@@ -2025,68 +2025,68 @@
 2025
 2026
 2027
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Michael Yin <mikeyin@mikeyin.org>
-//  * (c) Robert Swinford <robert.swinford..AT..gmail.com>
-//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Michael Yin <mikeyin@mikeyin.org>
+//  * (c) Robert Swinford <robert.swinford..AT..gmail.com>
+//  * (c) Michael Debertol <michael.debertol..AT..gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// Although these links don't always seem to describe reality, check out the POSIX and GNU specs:
-// https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html
-// https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html
+// Although these links don't always seem to describe reality, check out the POSIX and GNU specs:
+// https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html
+// https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html
 
-// spell-checker:ignore (misc) HFKJFK Mbdfhn
+// spell-checker:ignore (misc) HFKJFK Mbdfhn
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-mod check;
-mod chunks;
-mod custom_str_cmp;
-mod ext_sort;
-mod merge;
-mod numeric_str_cmp;
-mod tmp_dir;
+mod check;
+mod chunks;
+mod custom_str_cmp;
+mod ext_sort;
+mod merge;
+mod numeric_str_cmp;
+mod tmp_dir;
 
-use chunks::LineData;
-use clap::builder::ValueParser;
-use clap::{crate_version, Arg, ArgAction, Command};
-use custom_str_cmp::custom_str_cmp;
-use ext_sort::ext_sort;
-use fnv::FnvHasher;
-use numeric_str_cmp::{human_numeric_str_cmp, numeric_str_cmp, NumInfo, NumInfoParseSettings};
-use rand::{thread_rng, Rng};
-use rayon::prelude::*;
-use std::cmp::Ordering;
-use std::env;
-use std::error::Error;
-use std::ffi::{OsStr, OsString};
-use std::fmt::Display;
-use std::fs::{File, OpenOptions};
-use std::hash::{Hash, Hasher};
-use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
-use std::ops::Range;
-use std::path::Path;
-use std::path::PathBuf;
-use std::str::Utf8Error;
-use unicode_width::UnicodeWidthStr;
-use uucore::display::Quotable;
-use uucore::error::{set_exit_code, strip_errno, UError, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
-use uucore::parse_size::{parse_size, ParseSizeError};
-use uucore::version_cmp::version_cmp;
+use chunks::LineData;
+use clap::builder::ValueParser;
+use clap::{crate_version, Arg, ArgAction, Command};
+use custom_str_cmp::custom_str_cmp;
+use ext_sort::ext_sort;
+use fnv::FnvHasher;
+use numeric_str_cmp::{human_numeric_str_cmp, numeric_str_cmp, NumInfo, NumInfoParseSettings};
+use rand::{thread_rng, Rng};
+use rayon::prelude::*;
+use std::cmp::Ordering;
+use std::env;
+use std::error::Error;
+use std::ffi::{OsStr, OsString};
+use std::fmt::Display;
+use std::fs::{File, OpenOptions};
+use std::hash::{Hash, Hasher};
+use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
+use std::ops::Range;
+use std::path::Path;
+use std::path::PathBuf;
+use std::str::Utf8Error;
+use unicode_width::UnicodeWidthStr;
+use uucore::display::Quotable;
+use uucore::error::{set_exit_code, strip_errno, UError, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
+use uucore::parse_size::{parse_size, ParseSizeError};
+use uucore::version_cmp::version_cmp;
 
-use crate::tmp_dir::TmpDirWrapper;
+use crate::tmp_dir::TmpDirWrapper;
 
-const ABOUT: &str = "\
+const ABOUT: &str = "\
     Display sorted concatenation of all FILE(s). \
     With no FILE, or when FILE is -, read standard input.";
-const USAGE: &str = "{} [OPTION]... [FILE]...";
+const USAGE: &str = "{} [OPTION]... [FILE]...";
 
-const LONG_HELP_KEYS: &str = "The key format is FIELD[.CHAR][OPTIONS][,FIELD[.CHAR]][OPTIONS].
+const LONG_HELP_KEYS: &str = "The key format is FIELD[.CHAR][OPTIONS][,FIELD[.CHAR]][OPTIONS].
 
 Fields by default are separated by the first whitespace after a non-whitespace character. Use -t to specify a custom separator.
 In the default case, whitespace is appended at the beginning of each field. Custom separators however are not included in fields.
@@ -2096,636 +2096,636 @@ If CHAR is set 0, it means the end of the field. CHAR defaults to 1 for the star
 
 Valid options are: MbdfhnRrV. They override the global options for this key.";
 
-mod options {
-    pub mod modes {
-        pub const SORT: &str = "sort";
+mod options {
+    pub mod modes {
+        pub const SORT: &str = "sort";
 
-        pub const HUMAN_NUMERIC: &str = "human-numeric-sort";
-        pub const MONTH: &str = "month-sort";
-        pub const NUMERIC: &str = "numeric-sort";
-        pub const GENERAL_NUMERIC: &str = "general-numeric-sort";
-        pub const VERSION: &str = "version-sort";
-        pub const RANDOM: &str = "random-sort";
+        pub const HUMAN_NUMERIC: &str = "human-numeric-sort";
+        pub const MONTH: &str = "month-sort";
+        pub const NUMERIC: &str = "numeric-sort";
+        pub const GENERAL_NUMERIC: &str = "general-numeric-sort";
+        pub const VERSION: &str = "version-sort";
+        pub const RANDOM: &str = "random-sort";
 
-        pub const ALL_SORT_MODES: [&str; 6] = [
-            GENERAL_NUMERIC,
-            HUMAN_NUMERIC,
-            MONTH,
-            NUMERIC,
-            VERSION,
-            RANDOM,
+        pub const ALL_SORT_MODES: [&str; 6] = [
+            GENERAL_NUMERIC,
+            HUMAN_NUMERIC,
+            MONTH,
+            NUMERIC,
+            VERSION,
+            RANDOM,
         ];
     }
 
-    pub mod check {
-        pub const CHECK: &str = "check";
-        pub const CHECK_SILENT: &str = "check-silent";
-        pub const SILENT: &str = "silent";
-        pub const QUIET: &str = "quiet";
-        pub const DIAGNOSE_FIRST: &str = "diagnose-first";
+    pub mod check {
+        pub const CHECK: &str = "check";
+        pub const CHECK_SILENT: &str = "check-silent";
+        pub const SILENT: &str = "silent";
+        pub const QUIET: &str = "quiet";
+        pub const DIAGNOSE_FIRST: &str = "diagnose-first";
     }
 
-    pub const HELP: &str = "help";
-    pub const VERSION: &str = "version";
-    pub const DICTIONARY_ORDER: &str = "dictionary-order";
-    pub const MERGE: &str = "merge";
-    pub const DEBUG: &str = "debug";
-    pub const IGNORE_CASE: &str = "ignore-case";
-    pub const IGNORE_LEADING_BLANKS: &str = "ignore-leading-blanks";
-    pub const IGNORE_NONPRINTING: &str = "ignore-nonprinting";
-    pub const OUTPUT: &str = "output";
-    pub const REVERSE: &str = "reverse";
-    pub const STABLE: &str = "stable";
-    pub const UNIQUE: &str = "unique";
-    pub const KEY: &str = "key";
-    pub const SEPARATOR: &str = "field-separator";
-    pub const ZERO_TERMINATED: &str = "zero-terminated";
-    pub const PARALLEL: &str = "parallel";
-    pub const FILES0_FROM: &str = "files0-from";
-    pub const BUF_SIZE: &str = "buffer-size";
-    pub const TMP_DIR: &str = "temporary-directory";
-    pub const COMPRESS_PROG: &str = "compress-program";
-    pub const BATCH_SIZE: &str = "batch-size";
+    pub const HELP: &str = "help";
+    pub const VERSION: &str = "version";
+    pub const DICTIONARY_ORDER: &str = "dictionary-order";
+    pub const MERGE: &str = "merge";
+    pub const DEBUG: &str = "debug";
+    pub const IGNORE_CASE: &str = "ignore-case";
+    pub const IGNORE_LEADING_BLANKS: &str = "ignore-leading-blanks";
+    pub const IGNORE_NONPRINTING: &str = "ignore-nonprinting";
+    pub const OUTPUT: &str = "output";
+    pub const REVERSE: &str = "reverse";
+    pub const STABLE: &str = "stable";
+    pub const UNIQUE: &str = "unique";
+    pub const KEY: &str = "key";
+    pub const SEPARATOR: &str = "field-separator";
+    pub const ZERO_TERMINATED: &str = "zero-terminated";
+    pub const PARALLEL: &str = "parallel";
+    pub const FILES0_FROM: &str = "files0-from";
+    pub const BUF_SIZE: &str = "buffer-size";
+    pub const TMP_DIR: &str = "temporary-directory";
+    pub const COMPRESS_PROG: &str = "compress-program";
+    pub const BATCH_SIZE: &str = "batch-size";
 
-    pub const FILES: &str = "files";
+    pub const FILES: &str = "files";
 }
 
-const DECIMAL_PT: char = '.';
+const DECIMAL_PT: char = '.';
 
-const NEGATIVE: char = '-';
-const POSITIVE: char = '+';
+const NEGATIVE: char = '-';
+const POSITIVE: char = '+';
 
-// Choosing a higher buffer size does not result in performance improvements
-// (at least not on my machine). TODO: In the future, we should also take the amount of
-// available memory into consideration, instead of relying on this constant only.
-const DEFAULT_BUF_SIZE: usize = 1_000_000_000; // 1 GB
+// Choosing a higher buffer size does not result in performance improvements
+// (at least not on my machine). TODO: In the future, we should also take the amount of
+// available memory into consideration, instead of relying on this constant only.
+const DEFAULT_BUF_SIZE: usize = 1_000_000_000; // 1 GB
 
-#[derive(Debug)]
-enum SortError {
-    Disorder {
-        file: OsString,
-        line_number: usize,
-        line: String,
-        silent: bool,
+#[derive(Debug)]
+enum SortError {
+    Disorder {
+        file: OsString,
+        line_number: usize,
+        line: String,
+        silent: bool,
     },
-    OpenFailed {
-        path: String,
-        error: std::io::Error,
+    OpenFailed {
+        path: String,
+        error: std::io::Error,
     },
-    ReadFailed {
-        path: PathBuf,
-        error: std::io::Error,
+    ReadFailed {
+        path: PathBuf,
+        error: std::io::Error,
     },
-    ParseKeyError {
-        key: String,
-        msg: String,
+    ParseKeyError {
+        key: String,
+        msg: String,
     },
-    OpenTmpFileFailed {
-        error: std::io::Error,
+    OpenTmpFileFailed {
+        error: std::io::Error,
     },
-    CompressProgExecutionFailed {
-        code: i32,
+    CompressProgExecutionFailed {
+        code: i32,
     },
-    CompressProgTerminatedAbnormally {
-        prog: String,
+    CompressProgTerminatedAbnormally {
+        prog: String,
     },
-    TmpDirCreationFailed,
-    Uft8Error {
-        error: Utf8Error,
+    TmpDirCreationFailed,
+    Uft8Error {
+        error: Utf8Error,
     },
 }
 
-impl Error for SortError {}
+impl Error for SortError {}
 
-impl UError for SortError {
-    fn code(&self) -> i32 {
-        match self {
-            Self::Disorder { .. } => 1,
-            _ => 2,
+impl UError for SortError {
+    fn code(&self) -> i32 {
+        match self {
+            Self::Disorder { .. } => 1,
+            _ => 2,
         }
     }
 }
 
-impl Display for SortError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::Disorder {
-                file,
-                line_number,
-                line,
-                silent,
+impl Display for SortError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::Disorder {
+                file,
+                line_number,
+                line,
+                silent,
             } => {
-                if !silent {
+                if !silent {
                     write!(
-                        f,
+                        f,
                         "{}:{}: disorder: {}",
-                        file.maybe_quote(),
-                        line_number,
-                        line
+                        file.maybe_quote(),
+                        line_number,
+                        line
                     )
-                } else {
+                } else {
                     Ok(())
                 }
             }
-            Self::OpenFailed { path, error } => {
+            Self::OpenFailed { path, error } => {
                 write!(
-                    f,
+                    f,
                     "open failed: {}: {}",
-                    path.maybe_quote(),
-                    strip_errno(error)
+                    path.maybe_quote(),
+                    strip_errno(error)
                 )
             }
-            Self::ParseKeyError { key, msg } => {
-                write!(f, "failed to parse key {}: {}", key.quote(), msg)
+            Self::ParseKeyError { key, msg } => {
+                write!(f, "failed to parse key {}: {}", key.quote(), msg)
             }
-            Self::ReadFailed { path, error } => {
+            Self::ReadFailed { path, error } => {
                 write!(
-                    f,
+                    f,
                     "cannot read: {}: {}",
-                    path.maybe_quote(),
-                    strip_errno(error)
+                    path.maybe_quote(),
+                    strip_errno(error)
                 )
             }
-            Self::OpenTmpFileFailed { error } => {
-                write!(f, "failed to open temporary file: {}", strip_errno(error))
+            Self::OpenTmpFileFailed { error } => {
+                write!(f, "failed to open temporary file: {}", strip_errno(error))
             }
-            Self::CompressProgExecutionFailed { code } => {
-                write!(f, "couldn't execute compress program: errno {}", code)
+            Self::CompressProgExecutionFailed { code } => {
+                write!(f, "couldn't execute compress program: errno {}", code)
             }
-            Self::CompressProgTerminatedAbnormally { prog } => {
-                write!(f, "{} terminated abnormally", prog.quote())
+            Self::CompressProgTerminatedAbnormally { prog } => {
+                write!(f, "{} terminated abnormally", prog.quote())
             }
-            Self::TmpDirCreationFailed => write!(f, "could not create temporary directory"),
-            Self::Uft8Error { error } => write!(f, "{}", error),
+            Self::TmpDirCreationFailed => write!(f, "could not create temporary directory"),
+            Self::Uft8Error { error } => write!(f, "{}", error),
         }
     }
 }
 
-#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy, Debug)]
-enum SortMode {
-    Numeric,
-    HumanNumeric,
-    GeneralNumeric,
-    Month,
-    Version,
-    Random,
-    Default,
+#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy, Debug)]
+enum SortMode {
+    Numeric,
+    HumanNumeric,
+    GeneralNumeric,
+    Month,
+    Version,
+    Random,
+    Default,
 }
 
-impl SortMode {
-    fn get_short_name(&self) -> Option<char> {
-        match self {
-            Self::Numeric => Some('n'),
-            Self::HumanNumeric => Some('h'),
-            Self::GeneralNumeric => Some('g'),
-            Self::Month => Some('M'),
-            Self::Version => Some('V'),
-            Self::Random => Some('R'),
-            Self::Default => None,
+impl SortMode {
+    fn get_short_name(&self) -> Option<char> {
+        match self {
+            Self::Numeric => Some('n'),
+            Self::HumanNumeric => Some('h'),
+            Self::GeneralNumeric => Some('g'),
+            Self::Month => Some('M'),
+            Self::Version => Some('V'),
+            Self::Random => Some('R'),
+            Self::Default => None,
         }
     }
 }
 
-pub struct Output {
-    file: Option<(String, File)>,
+pub struct Output {
+    file: Option<(String, File)>,
 }
 
-impl Output {
-    fn new(name: Option<&str>) -> UResult<Self> {
-        let file = if let Some(name) = name {
-            // This is different from `File::create()` because we don't truncate the output yet.
-            // This allows using the output file as an input file.
-            let file = OpenOptions::new()
-                .write(true)
-                .create(true)
-                .open(name)
-                .map_err(|e| SortError::OpenFailed {
-                    path: name.to_owned(),
-                    error: e,
+impl Output {
+    fn new(name: Option<&str>) -> UResult<Self> {
+        let file = if let Some(name) = name {
+            // This is different from `File::create()` because we don't truncate the output yet.
+            // This allows using the output file as an input file.
+            let file = OpenOptions::new()
+                .write(true)
+                .create(true)
+                .open(name)
+                .map_err(|e| SortError::OpenFailed {
+                    path: name.to_owned(),
+                    error: e,
                 })?;
-            Some((name.to_owned(), file))
-        } else {
-            None
-        };
-        Ok(Self { file })
+            Some((name.to_owned(), file))
+        } else {
+            None
+        };
+        Ok(Self { file })
     }
 
-    fn into_write(self) -> BufWriter<Box<dyn Write>> {
-        BufWriter::new(match self.file {
-            Some((_name, file)) => {
-                // truncate the file
-                let _ = file.set_len(0);
-                Box::new(file)
+    fn into_write(self) -> BufWriter<Box<dyn Write>> {
+        BufWriter::new(match self.file {
+            Some((_name, file)) => {
+                // truncate the file
+                let _ = file.set_len(0);
+                Box::new(file)
             }
-            None => Box::new(stdout()),
+            None => Box::new(stdout()),
         })
     }
 
-    fn as_output_name(&self) -> Option<&str> {
-        match &self.file {
-            Some((name, _file)) => Some(name),
-            None => None,
+    fn as_output_name(&self) -> Option<&str> {
+        match &self.file {
+            Some((name, _file)) => Some(name),
+            None => None,
         }
     }
 }
 
-#[derive(Clone)]
-pub struct GlobalSettings {
-    mode: SortMode,
-    debug: bool,
-    ignore_leading_blanks: bool,
-    ignore_case: bool,
-    dictionary_order: bool,
-    ignore_non_printing: bool,
-    merge: bool,
-    reverse: bool,
-    stable: bool,
-    unique: bool,
-    check: bool,
-    check_silent: bool,
-    salt: Option<[u8; 16]>,
-    selectors: Vec<FieldSelector>,
-    separator: Option<char>,
-    threads: String,
-    zero_terminated: bool,
-    buffer_size: usize,
-    compress_prog: Option<String>,
-    merge_batch_size: usize,
-    precomputed: Precomputed,
+#[derive(Clone)]
+pub struct GlobalSettings {
+    mode: SortMode,
+    debug: bool,
+    ignore_leading_blanks: bool,
+    ignore_case: bool,
+    dictionary_order: bool,
+    ignore_non_printing: bool,
+    merge: bool,
+    reverse: bool,
+    stable: bool,
+    unique: bool,
+    check: bool,
+    check_silent: bool,
+    salt: Option<[u8; 16]>,
+    selectors: Vec<FieldSelector>,
+    separator: Option<char>,
+    threads: String,
+    zero_terminated: bool,
+    buffer_size: usize,
+    compress_prog: Option<String>,
+    merge_batch_size: usize,
+    precomputed: Precomputed,
 }
 
-/// Data needed for sorting. Should be computed once before starting to sort
-/// by calling `GlobalSettings::init_precomputed`.
-#[derive(Clone, Debug, Default)]
-struct Precomputed {
-    needs_tokens: bool,
-    num_infos_per_line: usize,
-    floats_per_line: usize,
-    selections_per_line: usize,
+/// Data needed for sorting. Should be computed once before starting to sort
+/// by calling `GlobalSettings::init_precomputed`.
+#[derive(Clone, Debug, Default)]
+struct Precomputed {
+    needs_tokens: bool,
+    num_infos_per_line: usize,
+    floats_per_line: usize,
+    selections_per_line: usize,
 }
 
-impl GlobalSettings {
-    /// Parse a SIZE string into a number of bytes.
-    /// A size string comprises an integer and an optional unit.
-    /// The unit may be k, K, m, M, g, G, t, T, P, E, Z, Y (powers of 1024), or b which is 1.
-    /// Default is K.
-    fn parse_byte_count(input: &str) -> Result<usize, ParseSizeError> {
-        // GNU sort (8.32)   valid: 1b,        k, K, m, M, g, G, t, T, P, E, Z, Y
-        // GNU sort (8.32) invalid:  b, B, 1B,                         p, e, z, y
-        const ALLOW_LIST: &[char] = &[
+impl GlobalSettings {
+    /// Parse a SIZE string into a number of bytes.
+    /// A size string comprises an integer and an optional unit.
+    /// The unit may be k, K, m, M, g, G, t, T, P, E, Z, Y (powers of 1024), or b which is 1.
+    /// Default is K.
+    fn parse_byte_count(input: &str) -> Result<usize, ParseSizeError> {
+        // GNU sort (8.32)   valid: 1b,        k, K, m, M, g, G, t, T, P, E, Z, Y
+        // GNU sort (8.32) invalid:  b, B, 1B,                         p, e, z, y
+        const ALLOW_LIST: &[char] = &[
             'b', 'k', 'K', 'm', 'M', 'g', 'G', 't', 'T', 'P', 'E', 'Z', 'Y',
         ];
-        let mut size_string = input.trim().to_string();
+        let mut size_string = input.trim().to_string();
 
-        if size_string.ends_with(|c: char| ALLOW_LIST.contains(&c) || c.is_ascii_digit()) {
-            // b 1, K 1024 (default)
-            if size_string.ends_with(|c: char| c.is_ascii_digit()) {
-                size_string.push('K');
-            } else if size_string.ends_with('b') {
-                size_string.pop();
+        if size_string.ends_with(|c: char| ALLOW_LIST.contains(&c) || c.is_ascii_digit()) {
+            // b 1, K 1024 (default)
+            if size_string.ends_with(|c: char| c.is_ascii_digit()) {
+                size_string.push('K');
+            } else if size_string.ends_with('b') {
+                size_string.pop();
             }
-            let size = parse_size(&size_string)?;
-            usize::try_from(size).map_err(|_| {
-                ParseSizeError::SizeTooBig(format!(
+            let size = parse_size(&size_string)?;
+            usize::try_from(size).map_err(|_| {
+                ParseSizeError::SizeTooBig(format!(
                     "Buffer size {} does not fit in address space",
-                    size
+                    size
                 ))
             })
-        } else if size_string.starts_with(|c: char| c.is_ascii_digit()) {
-            Err(ParseSizeError::InvalidSuffix("invalid suffix".to_string()))
-        } else {
-            Err(ParseSizeError::ParseFailure("parse failure".to_string()))
+        } else if size_string.starts_with(|c: char| c.is_ascii_digit()) {
+            Err(ParseSizeError::InvalidSuffix("invalid suffix".to_string()))
+        } else {
+            Err(ParseSizeError::ParseFailure("parse failure".to_string()))
         }
     }
 
-    /// Precompute some data needed for sorting.
-    /// This function **must** be called before starting to sort, and `GlobalSettings` may not be altered
-    /// afterwards.
-    fn init_precomputed(&mut self) {
-        self.precomputed.needs_tokens = self.selectors.iter().any(|s| s.needs_tokens);
-        self.precomputed.selections_per_line =
-            self.selectors.iter().filter(|s| s.needs_selection).count();
-        self.precomputed.num_infos_per_line = self
-            .selectors
-            .iter()
-            .filter(|s| matches!(s.settings.mode, SortMode::Numeric | SortMode::HumanNumeric))
-            .count();
-        self.precomputed.floats_per_line = self
-            .selectors
-            .iter()
-            .filter(|s| matches!(s.settings.mode, SortMode::GeneralNumeric))
-            .count();
+    /// Precompute some data needed for sorting.
+    /// This function **must** be called before starting to sort, and `GlobalSettings` may not be altered
+    /// afterwards.
+    fn init_precomputed(&mut self) {
+        self.precomputed.needs_tokens = self.selectors.iter().any(|s| s.needs_tokens);
+        self.precomputed.selections_per_line =
+            self.selectors.iter().filter(|s| s.needs_selection).count();
+        self.precomputed.num_infos_per_line = self
+            .selectors
+            .iter()
+            .filter(|s| matches!(s.settings.mode, SortMode::Numeric | SortMode::HumanNumeric))
+            .count();
+        self.precomputed.floats_per_line = self
+            .selectors
+            .iter()
+            .filter(|s| matches!(s.settings.mode, SortMode::GeneralNumeric))
+            .count();
     }
 }
 
-impl Default for GlobalSettings {
-    fn default() -> Self {
-        Self {
-            mode: SortMode::Default,
-            debug: false,
-            ignore_leading_blanks: false,
-            ignore_case: false,
-            dictionary_order: false,
-            ignore_non_printing: false,
-            merge: false,
-            reverse: false,
-            stable: false,
-            unique: false,
-            check: false,
-            check_silent: false,
-            salt: None,
-            selectors: vec![],
-            separator: None,
-            threads: String::new(),
-            zero_terminated: false,
-            buffer_size: DEFAULT_BUF_SIZE,
-            compress_prog: None,
-            merge_batch_size: 32,
-            precomputed: Precomputed::default(),
+impl Default for GlobalSettings {
+    fn default() -> Self {
+        Self {
+            mode: SortMode::Default,
+            debug: false,
+            ignore_leading_blanks: false,
+            ignore_case: false,
+            dictionary_order: false,
+            ignore_non_printing: false,
+            merge: false,
+            reverse: false,
+            stable: false,
+            unique: false,
+            check: false,
+            check_silent: false,
+            salt: None,
+            selectors: vec![],
+            separator: None,
+            threads: String::new(),
+            zero_terminated: false,
+            buffer_size: DEFAULT_BUF_SIZE,
+            compress_prog: None,
+            merge_batch_size: 32,
+            precomputed: Precomputed::default(),
         }
     }
 }
 
-#[derive(Clone, PartialEq, Debug)]
-struct KeySettings {
-    mode: SortMode,
-    ignore_blanks: bool,
-    ignore_case: bool,
-    dictionary_order: bool,
-    ignore_non_printing: bool,
-    reverse: bool,
+#[derive(Clone, PartialEq, Debug)]
+struct KeySettings {
+    mode: SortMode,
+    ignore_blanks: bool,
+    ignore_case: bool,
+    dictionary_order: bool,
+    ignore_non_printing: bool,
+    reverse: bool,
 }
 
-impl KeySettings {
-    /// Checks if the supplied combination of `mode`, `ignore_non_printing` and `dictionary_order` is allowed.
-    fn check_compatibility(
-        mode: SortMode,
-        ignore_non_printing: bool,
-        dictionary_order: bool,
-    ) -> Result<(), String> {
-        if matches!(
-            mode,
-            SortMode::Numeric | SortMode::HumanNumeric | SortMode::GeneralNumeric | SortMode::Month
+impl KeySettings {
+    /// Checks if the supplied combination of `mode`, `ignore_non_printing` and `dictionary_order` is allowed.
+    fn check_compatibility(
+        mode: SortMode,
+        ignore_non_printing: bool,
+        dictionary_order: bool,
+    ) -> Result<(), String> {
+        if matches!(
+            mode,
+            SortMode::Numeric | SortMode::HumanNumeric | SortMode::GeneralNumeric | SortMode::Month
         ) {
-            if dictionary_order {
-                return Err(format!(
+            if dictionary_order {
+                return Err(format!(
                     "options '-{}{}' are incompatible",
                     'd',
-                    mode.get_short_name().unwrap()
+                    mode.get_short_name().unwrap()
                 ));
-            } else if ignore_non_printing {
-                return Err(format!(
+            } else if ignore_non_printing {
+                return Err(format!(
                     "options '-{}{}' are incompatible",
                     'i',
-                    mode.get_short_name().unwrap()
+                    mode.get_short_name().unwrap()
                 ));
             }
         }
         Ok(())
     }
 
-    fn set_sort_mode(&mut self, mode: SortMode) -> Result<(), String> {
-        if self.mode != SortMode::Default {
-            return Err(format!(
+    fn set_sort_mode(&mut self, mode: SortMode) -> Result<(), String> {
+        if self.mode != SortMode::Default {
+            return Err(format!(
                 "options '-{}{}' are incompatible",
-                self.mode.get_short_name().unwrap(),
-                mode.get_short_name().unwrap()
+                self.mode.get_short_name().unwrap(),
+                mode.get_short_name().unwrap()
             ));
         }
-        Self::check_compatibility(mode, self.ignore_non_printing, self.dictionary_order)?;
-        self.mode = mode;
+        Self::check_compatibility(mode, self.ignore_non_printing, self.dictionary_order)?;
+        self.mode = mode;
         Ok(())
     }
 
-    fn set_dictionary_order(&mut self) -> Result<(), String> {
-        Self::check_compatibility(self.mode, self.ignore_non_printing, true)?;
-        self.dictionary_order = true;
+    fn set_dictionary_order(&mut self) -> Result<(), String> {
+        Self::check_compatibility(self.mode, self.ignore_non_printing, true)?;
+        self.dictionary_order = true;
         Ok(())
     }
 
-    fn set_ignore_non_printing(&mut self) -> Result<(), String> {
-        Self::check_compatibility(self.mode, true, self.dictionary_order)?;
-        self.ignore_non_printing = true;
+    fn set_ignore_non_printing(&mut self) -> Result<(), String> {
+        Self::check_compatibility(self.mode, true, self.dictionary_order)?;
+        self.ignore_non_printing = true;
         Ok(())
     }
 }
 
-impl From<&GlobalSettings> for KeySettings {
-    fn from(settings: &GlobalSettings) -> Self {
-        Self {
-            mode: settings.mode,
-            ignore_blanks: settings.ignore_leading_blanks,
-            ignore_case: settings.ignore_case,
-            ignore_non_printing: settings.ignore_non_printing,
-            reverse: settings.reverse,
-            dictionary_order: settings.dictionary_order,
+impl From<&GlobalSettings> for KeySettings {
+    fn from(settings: &GlobalSettings) -> Self {
+        Self {
+            mode: settings.mode,
+            ignore_blanks: settings.ignore_leading_blanks,
+            ignore_case: settings.ignore_case,
+            ignore_non_printing: settings.ignore_non_printing,
+            reverse: settings.reverse,
+            dictionary_order: settings.dictionary_order,
         }
     }
 }
 
-impl Default for KeySettings {
-    fn default() -> Self {
-        Self::from(&GlobalSettings::default())
+impl Default for KeySettings {
+    fn default() -> Self {
+        Self::from(&GlobalSettings::default())
     }
 }
-enum Selection<'a> {
-    AsF64(GeneralF64ParseResult),
-    WithNumInfo(&'a str, NumInfo),
-    Str(&'a str),
+enum Selection<'a> {
+    AsF64(GeneralF64ParseResult),
+    WithNumInfo(&'a str, NumInfo),
+    Str(&'a str),
 }
 
-type Field = Range<usize>;
+type Field = Range<usize>;
 
-#[derive(Clone, Debug)]
-pub struct Line<'a> {
-    line: &'a str,
-    index: usize,
+#[derive(Clone, Debug)]
+pub struct Line<'a> {
+    line: &'a str,
+    index: usize,
 }
 
-impl<'a> Line<'a> {
-    /// Creates a new `Line`.
-    ///
-    /// If additional data is needed for sorting it is added to `line_data`.
-    /// `token_buffer` allows to reuse the allocation for tokens.
-    fn create(
-        line: &'a str,
-        index: usize,
-        line_data: &mut LineData<'a>,
-        token_buffer: &mut Vec<Field>,
-        settings: &GlobalSettings,
-    ) -> Self {
-        token_buffer.clear();
-        if settings.precomputed.needs_tokens {
-            tokenize(line, settings.separator, token_buffer);
+impl<'a> Line<'a> {
+    /// Creates a new `Line`.
+    ///
+    /// If additional data is needed for sorting it is added to `line_data`.
+    /// `token_buffer` allows to reuse the allocation for tokens.
+    fn create(
+        line: &'a str,
+        index: usize,
+        line_data: &mut LineData<'a>,
+        token_buffer: &mut Vec<Field>,
+        settings: &GlobalSettings,
+    ) -> Self {
+        token_buffer.clear();
+        if settings.precomputed.needs_tokens {
+            tokenize(line, settings.separator, token_buffer);
         }
-        for (selector, selection) in settings
-            .selectors
-            .iter()
-            .map(|selector| (selector, selector.get_selection(line, token_buffer)))
+        for (selector, selection) in settings
+            .selectors
+            .iter()
+            .map(|selector| (selector, selector.get_selection(line, token_buffer)))
         {
-            match selection {
-                Selection::AsF64(parsed_float) => line_data.parsed_floats.push(parsed_float),
-                Selection::WithNumInfo(str, num_info) => {
-                    line_data.num_infos.push(num_info);
-                    line_data.selections.push(str);
+            match selection {
+                Selection::AsF64(parsed_float) => line_data.parsed_floats.push(parsed_float),
+                Selection::WithNumInfo(str, num_info) => {
+                    line_data.num_infos.push(num_info);
+                    line_data.selections.push(str);
                 }
-                Selection::Str(str) => {
-                    if selector.needs_selection {
-                        line_data.selections.push(str);
+                Selection::Str(str) => {
+                    if selector.needs_selection {
+                        line_data.selections.push(str);
                     }
                 }
             }
         }
-        Self { line, index }
+        Self { line, index }
     }
 
-    fn print(&self, writer: &mut impl Write, settings: &GlobalSettings) {
-        if settings.zero_terminated && !settings.debug {
-            writer.write_all(self.line.as_bytes()).unwrap();
-            writer.write_all(b"\0").unwrap();
-        } else if !settings.debug {
-            writer.write_all(self.line.as_bytes()).unwrap();
-            writer.write_all(b"\n").unwrap();
-        } else {
-            self.print_debug(settings, writer).unwrap();
+    fn print(&self, writer: &mut impl Write, settings: &GlobalSettings) {
+        if settings.zero_terminated && !settings.debug {
+            writer.write_all(self.line.as_bytes()).unwrap();
+            writer.write_all(b"\0").unwrap();
+        } else if !settings.debug {
+            writer.write_all(self.line.as_bytes()).unwrap();
+            writer.write_all(b"\n").unwrap();
+        } else {
+            self.print_debug(settings, writer).unwrap();
         }
     }
 
-    /// Writes indicators for the selections this line matched. The original line content is NOT expected
-    /// to be already printed.
-    fn print_debug(
+    /// Writes indicators for the selections this line matched. The original line content is NOT expected
+    /// to be already printed.
+    fn print_debug(
         &self,
-        settings: &GlobalSettings,
-        writer: &mut impl Write,
-    ) -> std::io::Result<()> {
-        // We do not consider this function performance critical, as debug output is only useful for small files,
-        // which are not a performance problem in any case. Therefore there aren't any special performance
-        // optimizations here.
+        settings: &GlobalSettings,
+        writer: &mut impl Write,
+    ) -> std::io::Result<()> {
+        // We do not consider this function performance critical, as debug output is only useful for small files,
+        // which are not a performance problem in any case. Therefore there aren't any special performance
+        // optimizations here.
 
-        let line = self.line.replace('\t', ">");
-        writeln!(writer, "{}", line)?;
+        let line = self.line.replace('\t', ">");
+        writeln!(writer, "{}", line)?;
 
-        let mut fields = vec![];
-        tokenize(self.line, settings.separator, &mut fields);
-        for selector in &settings.selectors {
-            let mut selection = selector.get_range(self.line, Some(&fields));
-            match selector.settings.mode {
-                SortMode::Numeric | SortMode::HumanNumeric => {
-                    // find out which range is used for numeric comparisons
-                    let (_, num_range) = NumInfo::parse(
-                        &self.line[selection.clone()],
-                        &NumInfoParseSettings {
-                            accept_si_units: selector.settings.mode == SortMode::HumanNumeric,
-                            ..Default::default()
+        let mut fields = vec![];
+        tokenize(self.line, settings.separator, &mut fields);
+        for selector in &settings.selectors {
+            let mut selection = selector.get_range(self.line, Some(&fields));
+            match selector.settings.mode {
+                SortMode::Numeric | SortMode::HumanNumeric => {
+                    // find out which range is used for numeric comparisons
+                    let (_, num_range) = NumInfo::parse(
+                        &self.line[selection.clone()],
+                        &NumInfoParseSettings {
+                            accept_si_units: selector.settings.mode == SortMode::HumanNumeric,
+                            ..Default::default()
                         },
                     );
-                    let initial_selection = selection.clone();
+                    let initial_selection = selection.clone();
 
-                    // Shorten selection to num_range.
-                    selection.start += num_range.start;
-                    selection.end = selection.start + num_range.len();
+                    // Shorten selection to num_range.
+                    selection.start += num_range.start;
+                    selection.end = selection.start + num_range.len();
 
-                    if num_range != (0..0) {
-                        // include a trailing si unit
-                        if selector.settings.mode == SortMode::HumanNumeric
-                            && self.line[selection.end..initial_selection.end]
-                                .starts_with(&['k', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'][..])
+                    if num_range != (0..0) {
+                        // include a trailing si unit
+                        if selector.settings.mode == SortMode::HumanNumeric
+                            && self.line[selection.end..initial_selection.end]
+                                .starts_with(&['k', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'][..])
                         {
-                            selection.end += 1;
+                            selection.end += 1;
                         }
 
-                        // include leading zeroes, a leading minus or a leading decimal point
-                        while self.line[initial_selection.start..selection.start]
-                            .ends_with(&['-', '0', '.'][..])
+                        // include leading zeroes, a leading minus or a leading decimal point
+                        while self.line[initial_selection.start..selection.start]
+                            .ends_with(&['-', '0', '.'][..])
                         {
-                            selection.start -= 1;
+                            selection.start -= 1;
                         }
-                    } else {
-                        // This was not a valid number.
-                        // Report no match at the first non-whitespace character.
-                        let leading_whitespace = self.line[selection.clone()]
-                            .find(|c: char| !c.is_whitespace())
-                            .unwrap_or(0);
-                        selection.start += leading_whitespace;
-                        selection.end += leading_whitespace;
+                    } else {
+                        // This was not a valid number.
+                        // Report no match at the first non-whitespace character.
+                        let leading_whitespace = self.line[selection.clone()]
+                            .find(|c: char| !c.is_whitespace())
+                            .unwrap_or(0);
+                        selection.start += leading_whitespace;
+                        selection.end += leading_whitespace;
                     }
                 }
-                SortMode::GeneralNumeric => {
-                    let initial_selection = &self.line[selection.clone()];
+                SortMode::GeneralNumeric => {
+                    let initial_selection = &self.line[selection.clone()];
 
-                    let leading = get_leading_gen(initial_selection);
+                    let leading = get_leading_gen(initial_selection);
 
-                    // Shorten selection to leading.
-                    selection.start += leading.start;
-                    selection.end = selection.start + leading.len();
+                    // Shorten selection to leading.
+                    selection.start += leading.start;
+                    selection.end = selection.start + leading.len();
                 }
-                SortMode::Month => {
-                    let initial_selection = &self.line[selection.clone()];
+                SortMode::Month => {
+                    let initial_selection = &self.line[selection.clone()];
 
-                    let mut month_chars = initial_selection
-                        .char_indices()
-                        .skip_while(|(_, c)| c.is_whitespace());
+                    let mut month_chars = initial_selection
+                        .char_indices()
+                        .skip_while(|(_, c)| c.is_whitespace());
 
-                    let month = if month_parse(initial_selection) == Month::Unknown {
-                        // We failed to parse a month, which is equivalent to matching nothing.
-                        // Add the "no match for key" marker to the first non-whitespace character.
-                        let first_non_whitespace = month_chars.next();
-                        first_non_whitespace.map_or(
-                            initial_selection.len()..initial_selection.len(),
-                            |(idx, _)| idx..idx,
+                    let month = if month_parse(initial_selection) == Month::Unknown {
+                        // We failed to parse a month, which is equivalent to matching nothing.
+                        // Add the "no match for key" marker to the first non-whitespace character.
+                        let first_non_whitespace = month_chars.next();
+                        first_non_whitespace.map_or(
+                            initial_selection.len()..initial_selection.len(),
+                            |(idx, _)| idx..idx,
                         )
-                    } else {
-                        // We parsed a month. Match the first three non-whitespace characters, which must be the month we parsed.
-                        month_chars.next().unwrap().0
-                            ..month_chars
-                                .nth(2)
-                                .map_or(initial_selection.len(), |(idx, _)| idx)
+                    } else {
+                        // We parsed a month. Match the first three non-whitespace characters, which must be the month we parsed.
+                        month_chars.next().unwrap().0
+                            ..month_chars
+                                .nth(2)
+                                .map_or(initial_selection.len(), |(idx, _)| idx)
                     };
 
-                    // Shorten selection to month.
-                    selection.start += month.start;
-                    selection.end = selection.start + month.len();
+                    // Shorten selection to month.
+                    selection.start += month.start;
+                    selection.end = selection.start + month.len();
                 }
-                _ => {}
+                _ => {}
             }
 
             write!(
-                writer,
+                writer,
                 "{}",
-                " ".repeat(UnicodeWidthStr::width(&line[..selection.start]))
+                " ".repeat(UnicodeWidthStr::width(&line[..selection.start]))
             )?;
 
-            if selection.is_empty() {
-                writeln!(writer, "^ no match for key")?;
-            } else {
+            if selection.is_empty() {
+                writeln!(writer, "^ no match for key")?;
+            } else {
                 writeln!(
-                    writer,
+                    writer,
                     "{}",
-                    "_".repeat(UnicodeWidthStr::width(&line[selection]))
+                    "_".repeat(UnicodeWidthStr::width(&line[selection]))
                 )?;
             }
         }
-        if settings.mode != SortMode::Random
-            && !settings.stable
-            && !settings.unique
-            && (settings.dictionary_order
-                || settings.ignore_leading_blanks
-                || settings.ignore_case
-                || settings.ignore_non_printing
-                || settings.mode != SortMode::Default
-                || settings
-                    .selectors
-                    .last()
-                    .map_or(true, |selector| selector != &Default::default()))
+        if settings.mode != SortMode::Random
+            && !settings.stable
+            && !settings.unique
+            && (settings.dictionary_order
+                || settings.ignore_leading_blanks
+                || settings.ignore_case
+                || settings.ignore_non_printing
+                || settings.mode != SortMode::Default
+                || settings
+                    .selectors
+                    .last()
+                    .map_or(true, |selector| selector != &Default::default()))
         {
-            // A last resort comparator is in use, underline the whole line.
-            if self.line.is_empty() {
-                writeln!(writer, "^ no match for key")?;
-            } else {
+            // A last resort comparator is in use, underline the whole line.
+            if self.line.is_empty() {
+                writeln!(writer, "^ no match for key")?;
+            } else {
                 writeln!(
-                    writer,
+                    writer,
                     "{}",
-                    "_".repeat(UnicodeWidthStr::width(line.as_str()))
+                    "_".repeat(UnicodeWidthStr::width(line.as_str()))
                 )?;
             }
         }
@@ -2733,629 +2733,629 @@ Valid options are: MbdfhnRrV. They override the global options for this key.&quo
     }
 }
 
-/// Tokenize a line into fields. The result is stored into `token_buffer`.
-fn tokenize(line: &str, separator: Option<char>, token_buffer: &mut Vec<Field>) {
-    assert!(token_buffer.is_empty());
-    if let Some(separator) = separator {
-        tokenize_with_separator(line, separator, token_buffer);
-    } else {
-        tokenize_default(line, token_buffer);
+/// Tokenize a line into fields. The result is stored into `token_buffer`.
+fn tokenize(line: &str, separator: Option<char>, token_buffer: &mut Vec<Field>) {
+    assert!(token_buffer.is_empty());
+    if let Some(separator) = separator {
+        tokenize_with_separator(line, separator, token_buffer);
+    } else {
+        tokenize_default(line, token_buffer);
     }
 }
 
-/// By default fields are separated by the first whitespace after non-whitespace.
-/// Whitespace is included in fields at the start.
-/// The result is stored into `token_buffer`.
-fn tokenize_default(line: &str, token_buffer: &mut Vec<Field>) {
-    token_buffer.push(0..0);
-    // pretend that there was whitespace in front of the line
-    let mut previous_was_whitespace = true;
-    for (idx, char) in line.char_indices() {
-        if char.is_whitespace() {
-            if !previous_was_whitespace {
-                token_buffer.last_mut().unwrap().end = idx;
-                token_buffer.push(idx..0);
+/// By default fields are separated by the first whitespace after non-whitespace.
+/// Whitespace is included in fields at the start.
+/// The result is stored into `token_buffer`.
+fn tokenize_default(line: &str, token_buffer: &mut Vec<Field>) {
+    token_buffer.push(0..0);
+    // pretend that there was whitespace in front of the line
+    let mut previous_was_whitespace = true;
+    for (idx, char) in line.char_indices() {
+        if char.is_whitespace() {
+            if !previous_was_whitespace {
+                token_buffer.last_mut().unwrap().end = idx;
+                token_buffer.push(idx..0);
             }
-            previous_was_whitespace = true;
-        } else {
-            previous_was_whitespace = false;
+            previous_was_whitespace = true;
+        } else {
+            previous_was_whitespace = false;
         }
     }
-    token_buffer.last_mut().unwrap().end = line.len();
+    token_buffer.last_mut().unwrap().end = line.len();
 }
 
-/// Split between separators. These separators are not included in fields.
-/// The result is stored into `token_buffer`.
-fn tokenize_with_separator(line: &str, separator: char, token_buffer: &mut Vec<Field>) {
-    let separator_indices =
-        line.char_indices()
-            .filter_map(|(i, c)| if c == separator { Some(i) } else { None });
-    let mut start = 0;
-    for sep_idx in separator_indices {
-        token_buffer.push(start..sep_idx);
-        start = sep_idx + 1;
+/// Split between separators. These separators are not included in fields.
+/// The result is stored into `token_buffer`.
+fn tokenize_with_separator(line: &str, separator: char, token_buffer: &mut Vec<Field>) {
+    let separator_indices =
+        line.char_indices()
+            .filter_map(|(i, c)| if c == separator { Some(i) } else { None });
+    let mut start = 0;
+    for sep_idx in separator_indices {
+        token_buffer.push(start..sep_idx);
+        start = sep_idx + 1;
     }
-    if start < line.len() {
-        token_buffer.push(start..line.len());
+    if start < line.len() {
+        token_buffer.push(start..line.len());
     }
 }
 
-#[derive(Clone, PartialEq, Debug)]
-struct KeyPosition {
-    /// 1-indexed, 0 is invalid.
-    field: usize,
-    /// 1-indexed, 0 is end of field.
-    char: usize,
-    ignore_blanks: bool,
+#[derive(Clone, PartialEq, Debug)]
+struct KeyPosition {
+    /// 1-indexed, 0 is invalid.
+    field: usize,
+    /// 1-indexed, 0 is end of field.
+    char: usize,
+    ignore_blanks: bool,
 }
 
-impl KeyPosition {
-    fn new(key: &str, default_char_index: usize, ignore_blanks: bool) -> Result<Self, String> {
-        let mut field_and_char = key.split('.');
+impl KeyPosition {
+    fn new(key: &str, default_char_index: usize, ignore_blanks: bool) -> Result<Self, String> {
+        let mut field_and_char = key.split('.');
 
-        let field = field_and_char
-            .next()
-            .ok_or_else(|| format!("invalid key {}", key.quote()))?;
-        let char = field_and_char.next();
+        let field = field_and_char
+            .next()
+            .ok_or_else(|| format!("invalid key {}", key.quote()))?;
+        let char = field_and_char.next();
 
-        let field = field
-            .parse()
-            .map_err(|e| format!("failed to parse field index {}: {}", field.quote(), e))?;
-        if field == 0 {
-            return Err("field index can not be 0".to_string());
+        let field = field
+            .parse()
+            .map_err(|e| format!("failed to parse field index {}: {}", field.quote(), e))?;
+        if field == 0 {
+            return Err("field index can not be 0".to_string());
         }
 
-        let char = char.map_or(Ok(default_char_index), |char| {
-            char.parse()
-                .map_err(|e| format!("failed to parse character index {}: {}", char.quote(), e))
+        let char = char.map_or(Ok(default_char_index), |char| {
+            char.parse()
+                .map_err(|e| format!("failed to parse character index {}: {}", char.quote(), e))
         })?;
 
-        Ok(Self {
-            field,
-            char,
-            ignore_blanks,
+        Ok(Self {
+            field,
+            char,
+            ignore_blanks,
         })
     }
 }
 
-impl Default for KeyPosition {
-    fn default() -> Self {
-        Self {
-            field: 1,
-            char: 1,
-            ignore_blanks: false,
+impl Default for KeyPosition {
+    fn default() -> Self {
+        Self {
+            field: 1,
+            char: 1,
+            ignore_blanks: false,
         }
     }
 }
 
-#[derive(Clone, PartialEq, Debug, Default)]
-struct FieldSelector {
-    from: KeyPosition,
-    to: Option<KeyPosition>,
-    settings: KeySettings,
-    needs_tokens: bool,
-    // Whether this selector operates on a sub-slice of a line.
-    // Selections are therefore not needed when this selector matches the whole line
-    // or the sort mode is general-numeric.
-    needs_selection: bool,
+#[derive(Clone, PartialEq, Debug, Default)]
+struct FieldSelector {
+    from: KeyPosition,
+    to: Option<KeyPosition>,
+    settings: KeySettings,
+    needs_tokens: bool,
+    // Whether this selector operates on a sub-slice of a line.
+    // Selections are therefore not needed when this selector matches the whole line
+    // or the sort mode is general-numeric.
+    needs_selection: bool,
 }
 
-impl FieldSelector {
-    /// Splits this position into the actual position and the attached options.
-    fn split_key_options(position: &str) -> (&str, &str) {
-        if let Some((options_start, _)) = position.char_indices().find(|(_, c)| c.is_alphabetic()) {
-            position.split_at(options_start)
-        } else {
-            (position, "")
+impl FieldSelector {
+    /// Splits this position into the actual position and the attached options.
+    fn split_key_options(position: &str) -> (&str, &str) {
+        if let Some((options_start, _)) = position.char_indices().find(|(_, c)| c.is_alphabetic()) {
+            position.split_at(options_start)
+        } else {
+            (position, "")
         }
     }
 
-    fn parse(key: &str, global_settings: &GlobalSettings) -> UResult<Self> {
-        let mut from_to = key.split(',');
-        let (from, from_options) = Self::split_key_options(from_to.next().unwrap());
-        let to = from_to.next().map(Self::split_key_options);
-        let options_are_empty = from_options.is_empty() && matches!(to, None | Some((_, "")));
+    fn parse(key: &str, global_settings: &GlobalSettings) -> UResult<Self> {
+        let mut from_to = key.split(',');
+        let (from, from_options) = Self::split_key_options(from_to.next().unwrap());
+        let to = from_to.next().map(Self::split_key_options);
+        let options_are_empty = from_options.is_empty() && matches!(to, None | Some((_, "")));
 
-        if options_are_empty {
-            // Inherit the global settings if there are no options attached to this key.
-            (|| {
-                // This would be ideal for a try block, I think. In the meantime this closure allows
-                // to use the `?` operator here.
-                Self::new(
-                    KeyPosition::new(from, 1, global_settings.ignore_leading_blanks)?,
-                    to.map(|(to, _)| {
-                        KeyPosition::new(to, 0, global_settings.ignore_leading_blanks)
+        if options_are_empty {
+            // Inherit the global settings if there are no options attached to this key.
+            (|| {
+                // This would be ideal for a try block, I think. In the meantime this closure allows
+                // to use the `?` operator here.
+                Self::new(
+                    KeyPosition::new(from, 1, global_settings.ignore_leading_blanks)?,
+                    to.map(|(to, _)| {
+                        KeyPosition::new(to, 0, global_settings.ignore_leading_blanks)
                     })
-                    .transpose()?,
-                    KeySettings::from(global_settings),
+                    .transpose()?,
+                    KeySettings::from(global_settings),
                 )
             })()
-        } else {
-            // Do not inherit from `global_settings`, as there are options attached to this key.
-            Self::parse_with_options((from, from_options), to)
+        } else {
+            // Do not inherit from `global_settings`, as there are options attached to this key.
+            Self::parse_with_options((from, from_options), to)
         }
-        .map_err(|msg| {
-            SortError::ParseKeyError {
-                key: key.to_owned(),
-                msg,
+        .map_err(|msg| {
+            SortError::ParseKeyError {
+                key: key.to_owned(),
+                msg,
             }
-            .into()
+            .into()
         })
     }
 
-    fn parse_with_options(
-        (from, from_options): (&str, &str),
-        to: Option<(&str, &str)>,
-    ) -> Result<Self, String> {
-        /// Applies `options` to `key_settings`, returning if the 'b'-flag (ignore blanks) was present.
-        fn parse_key_settings(
-            options: &str,
-            key_settings: &mut KeySettings,
-        ) -> Result<bool, String> {
-            let mut ignore_blanks = false;
-            for option in options.chars() {
-                match option {
-                    'M' => key_settings.set_sort_mode(SortMode::Month)?,
-                    'b' => ignore_blanks = true,
-                    'd' => key_settings.set_dictionary_order()?,
-                    'f' => key_settings.ignore_case = true,
-                    'g' => key_settings.set_sort_mode(SortMode::GeneralNumeric)?,
-                    'h' => key_settings.set_sort_mode(SortMode::HumanNumeric)?,
-                    'i' => key_settings.set_ignore_non_printing()?,
-                    'n' => key_settings.set_sort_mode(SortMode::Numeric)?,
-                    'R' => key_settings.set_sort_mode(SortMode::Random)?,
-                    'r' => key_settings.reverse = true,
-                    'V' => key_settings.set_sort_mode(SortMode::Version)?,
-                    c => return Err(format!("invalid option: '{}'", c)),
+    fn parse_with_options(
+        (from, from_options): (&str, &str),
+        to: Option<(&str, &str)>,
+    ) -> Result<Self, String> {
+        /// Applies `options` to `key_settings`, returning if the 'b'-flag (ignore blanks) was present.
+        fn parse_key_settings(
+            options: &str,
+            key_settings: &mut KeySettings,
+        ) -> Result<bool, String> {
+            let mut ignore_blanks = false;
+            for option in options.chars() {
+                match option {
+                    'M' => key_settings.set_sort_mode(SortMode::Month)?,
+                    'b' => ignore_blanks = true,
+                    'd' => key_settings.set_dictionary_order()?,
+                    'f' => key_settings.ignore_case = true,
+                    'g' => key_settings.set_sort_mode(SortMode::GeneralNumeric)?,
+                    'h' => key_settings.set_sort_mode(SortMode::HumanNumeric)?,
+                    'i' => key_settings.set_ignore_non_printing()?,
+                    'n' => key_settings.set_sort_mode(SortMode::Numeric)?,
+                    'R' => key_settings.set_sort_mode(SortMode::Random)?,
+                    'r' => key_settings.reverse = true,
+                    'V' => key_settings.set_sort_mode(SortMode::Version)?,
+                    c => return Err(format!("invalid option: '{}'", c)),
                 }
             }
-            Ok(ignore_blanks)
+            Ok(ignore_blanks)
         }
 
-        let mut key_settings = KeySettings::default();
-        let from = parse_key_settings(from_options, &mut key_settings)
-            .map(|ignore_blanks| KeyPosition::new(from, 1, ignore_blanks))??;
-        let to = if let Some((to, to_options)) = to {
+        let mut key_settings = KeySettings::default();
+        let from = parse_key_settings(from_options, &mut key_settings)
+            .map(|ignore_blanks| KeyPosition::new(from, 1, ignore_blanks))??;
+        let to = if let Some((to, to_options)) = to {
             Some(
-                parse_key_settings(to_options, &mut key_settings)
-                    .map(|ignore_blanks| KeyPosition::new(to, 0, ignore_blanks))??,
+                parse_key_settings(to_options, &mut key_settings)
+                    .map(|ignore_blanks| KeyPosition::new(to, 0, ignore_blanks))??,
             )
-        } else {
-            None
-        };
-        Self::new(from, to, key_settings)
+        } else {
+            None
+        };
+        Self::new(from, to, key_settings)
     }
 
-    fn new(
-        from: KeyPosition,
-        to: Option<KeyPosition>,
-        settings: KeySettings,
-    ) -> Result<Self, String> {
-        if from.char == 0 {
-            Err("invalid character index 0 for the start position of a field".to_string())
-        } else {
-            Ok(Self {
-                needs_selection: (from.field != 1
-                    || from.char != 1
-                    || to.is_some()
-                    || matches!(settings.mode, SortMode::Numeric | SortMode::HumanNumeric)
-                    || from.ignore_blanks)
-                    && !matches!(settings.mode, SortMode::GeneralNumeric),
-                needs_tokens: from.field != 1 || from.char == 0 || to.is_some(),
-                from,
-                to,
-                settings,
+    fn new(
+        from: KeyPosition,
+        to: Option<KeyPosition>,
+        settings: KeySettings,
+    ) -> Result<Self, String> {
+        if from.char == 0 {
+            Err("invalid character index 0 for the start position of a field".to_string())
+        } else {
+            Ok(Self {
+                needs_selection: (from.field != 1
+                    || from.char != 1
+                    || to.is_some()
+                    || matches!(settings.mode, SortMode::Numeric | SortMode::HumanNumeric)
+                    || from.ignore_blanks)
+                    && !matches!(settings.mode, SortMode::GeneralNumeric),
+                needs_tokens: from.field != 1 || from.char == 0 || to.is_some(),
+                from,
+                to,
+                settings,
             })
         }
     }
 
-    /// Get the selection that corresponds to this selector for the line.
-    /// If needs_fields returned false, tokens may be empty.
-    fn get_selection<'a>(&self, line: &'a str, tokens: &[Field]) -> Selection<'a> {
-        // `get_range` expects `None` when we don't need tokens and would get confused by an empty vector.
-        let tokens = if self.needs_tokens {
-            Some(tokens)
-        } else {
-            None
-        };
-        let mut range = &line[self.get_range(line, tokens)];
-        if self.settings.mode == SortMode::Numeric || self.settings.mode == SortMode::HumanNumeric {
-            // Parse NumInfo for this number.
-            let (info, num_range) = NumInfo::parse(
-                range,
-                &NumInfoParseSettings {
-                    accept_si_units: self.settings.mode == SortMode::HumanNumeric,
-                    ..Default::default()
+    /// Get the selection that corresponds to this selector for the line.
+    /// If needs_fields returned false, tokens may be empty.
+    fn get_selection<'a>(&self, line: &'a str, tokens: &[Field]) -> Selection<'a> {
+        // `get_range` expects `None` when we don't need tokens and would get confused by an empty vector.
+        let tokens = if self.needs_tokens {
+            Some(tokens)
+        } else {
+            None
+        };
+        let mut range = &line[self.get_range(line, tokens)];
+        if self.settings.mode == SortMode::Numeric || self.settings.mode == SortMode::HumanNumeric {
+            // Parse NumInfo for this number.
+            let (info, num_range) = NumInfo::parse(
+                range,
+                &NumInfoParseSettings {
+                    accept_si_units: self.settings.mode == SortMode::HumanNumeric,
+                    ..Default::default()
                 },
             );
-            // Shorten the range to what we need to pass to numeric_str_cmp later.
-            range = &range[num_range];
-            Selection::WithNumInfo(range, info)
-        } else if self.settings.mode == SortMode::GeneralNumeric {
-            // Parse this number as f64, as this is the requirement for general numeric sorting.
-            Selection::AsF64(general_f64_parse(&range[get_leading_gen(range)]))
-        } else {
-            // This is not a numeric sort, so we don't need a NumCache.
-            Selection::Str(range)
+            // Shorten the range to what we need to pass to numeric_str_cmp later.
+            range = &range[num_range];
+            Selection::WithNumInfo(range, info)
+        } else if self.settings.mode == SortMode::GeneralNumeric {
+            // Parse this number as f64, as this is the requirement for general numeric sorting.
+            Selection::AsF64(general_f64_parse(&range[get_leading_gen(range)]))
+        } else {
+            // This is not a numeric sort, so we don't need a NumCache.
+            Selection::Str(range)
         }
     }
 
-    /// Look up the range in the line that corresponds to this selector.
-    /// If needs_fields returned false, tokens must be None.
-    fn get_range<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Range<usize> {
-        enum Resolution {
-            // The start index of the resolved character, inclusive
-            StartOfChar(usize),
-            // The end index of the resolved character, exclusive.
-            // This is only returned if the character index is 0.
-            EndOfChar(usize),
-            // The resolved character would be in front of the first character
-            TooLow,
-            // The resolved character would be after the last character
-            TooHigh,
+    /// Look up the range in the line that corresponds to this selector.
+    /// If needs_fields returned false, tokens must be None.
+    fn get_range<'a>(&self, line: &'a str, tokens: Option<&[Field]>) -> Range<usize> {
+        enum Resolution {
+            // The start index of the resolved character, inclusive
+            StartOfChar(usize),
+            // The end index of the resolved character, exclusive.
+            // This is only returned if the character index is 0.
+            EndOfChar(usize),
+            // The resolved character would be in front of the first character
+            TooLow,
+            // The resolved character would be after the last character
+            TooHigh,
         }
 
-        // Get the index for this line given the KeyPosition
-        fn resolve_index(
-            line: &str,
-            tokens: Option<&[Field]>,
-            position: &KeyPosition,
-        ) -> Resolution {
-            if matches!(tokens, Some(tokens) if tokens.len() < position.field) {
-                Resolution::TooHigh
-            } else if position.char == 0 {
-                let end = tokens.unwrap()[position.field - 1].end;
-                if end == 0 {
-                    Resolution::TooLow
-                } else {
-                    Resolution::EndOfChar(end)
+        // Get the index for this line given the KeyPosition
+        fn resolve_index(
+            line: &str,
+            tokens: Option<&[Field]>,
+            position: &KeyPosition,
+        ) -> Resolution {
+            if matches!(tokens, Some(tokens) if tokens.len() < position.field) {
+                Resolution::TooHigh
+            } else if position.char == 0 {
+                let end = tokens.unwrap()[position.field - 1].end;
+                if end == 0 {
+                    Resolution::TooLow
+                } else {
+                    Resolution::EndOfChar(end)
                 }
-            } else {
-                let mut idx = if position.field == 1 {
-                    // The first field always starts at 0.
-                    // We don't need tokens for this case.
-                    0
-                } else {
-                    tokens.unwrap()[position.field - 1].start
+            } else {
+                let mut idx = if position.field == 1 {
+                    // The first field always starts at 0.
+                    // We don't need tokens for this case.
+                    0
+                } else {
+                    tokens.unwrap()[position.field - 1].start
                 };
-                // strip blanks if needed
-                if position.ignore_blanks {
-                    idx += line[idx..]
-                        .char_indices()
-                        .find(|(_, c)| !c.is_whitespace())
-                        .map_or(line[idx..].len(), |(idx, _)| idx);
+                // strip blanks if needed
+                if position.ignore_blanks {
+                    idx += line[idx..]
+                        .char_indices()
+                        .find(|(_, c)| !c.is_whitespace())
+                        .map_or(line[idx..].len(), |(idx, _)| idx);
                 }
-                // apply the character index
-                idx += line[idx..]
-                    .char_indices()
-                    .nth(position.char - 1)
-                    .map_or(line[idx..].len(), |(idx, _)| idx);
-                if idx >= line.len() {
-                    Resolution::TooHigh
-                } else {
-                    Resolution::StartOfChar(idx)
+                // apply the character index
+                idx += line[idx..]
+                    .char_indices()
+                    .nth(position.char - 1)
+                    .map_or(line[idx..].len(), |(idx, _)| idx);
+                if idx >= line.len() {
+                    Resolution::TooHigh
+                } else {
+                    Resolution::StartOfChar(idx)
                 }
             }
         }
 
-        match resolve_index(line, tokens, &self.from) {
-            Resolution::StartOfChar(from) => {
-                let to = self.to.as_ref().map(|to| resolve_index(line, tokens, to));
+        match resolve_index(line, tokens, &self.from) {
+            Resolution::StartOfChar(from) => {
+                let to = self.to.as_ref().map(|to| resolve_index(line, tokens, to));
 
-                let mut range = match to {
-                    Some(Resolution::StartOfChar(mut to)) => {
-                        // We need to include the character at `to`.
-                        to += line[to..].chars().next().map_or(1, |c| c.len_utf8());
-                        from..to
+                let mut range = match to {
+                    Some(Resolution::StartOfChar(mut to)) => {
+                        // We need to include the character at `to`.
+                        to += line[to..].chars().next().map_or(1, |c| c.len_utf8());
+                        from..to
                     }
-                    Some(Resolution::EndOfChar(to)) => from..to,
-                    // If `to` was not given or the match would be after the end of the line,
-                    // match everything until the end of the line.
-                    None | Some(Resolution::TooHigh) => from..line.len(),
-                    // If `to` is before the start of the line, report no match.
-                    // This can happen if the line starts with a separator.
-                    Some(Resolution::TooLow) => 0..0,
+                    Some(Resolution::EndOfChar(to)) => from..to,
+                    // If `to` was not given or the match would be after the end of the line,
+                    // match everything until the end of the line.
+                    None | Some(Resolution::TooHigh) => from..line.len(),
+                    // If `to` is before the start of the line, report no match.
+                    // This can happen if the line starts with a separator.
+                    Some(Resolution::TooLow) => 0..0,
                 };
-                if range.start > range.end {
-                    range.end = range.start;
+                if range.start > range.end {
+                    range.end = range.start;
                 }
-                range
+                range
             }
-            Resolution::TooLow | Resolution::EndOfChar(_) => {
+            Resolution::TooLow | Resolution::EndOfChar(_) => {
                 unreachable!("This should only happen if the field start index is 0, but that should already have caused an error.")
             }
-            // While for comparisons it's only important that this is an empty slice,
-            // to produce accurate debug output we need to match an empty slice at the end of the line.
-            Resolution::TooHigh => line.len()..line.len(),
+            // While for comparisons it's only important that this is an empty slice,
+            // to produce accurate debug output we need to match an empty slice at the end of the line.
+            Resolution::TooHigh => line.len()..line.len(),
         }
     }
 }
 
-/// Creates an `Arg` that conflicts with all other sort modes.
-fn make_sort_mode_arg(mode: &'static str, short: char, help: &'static str) -> Arg {
-    let mut arg = Arg::new(mode)
-        .short(short)
-        .long(mode)
-        .help(help)
-        .action(ArgAction::SetTrue);
-    for possible_mode in &options::modes::ALL_SORT_MODES {
-        if *possible_mode != mode {
-            arg = arg.conflicts_with(possible_mode);
+/// Creates an `Arg` that conflicts with all other sort modes.
+fn make_sort_mode_arg(mode: &'static str, short: char, help: &'static str) -> Arg {
+    let mut arg = Arg::new(mode)
+        .short(short)
+        .long(mode)
+        .help(help)
+        .action(ArgAction::SetTrue);
+    for possible_mode in &options::modes::ALL_SORT_MODES {
+        if *possible_mode != mode {
+            arg = arg.conflicts_with(possible_mode);
         }
     }
-    arg
+    arg
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
-    let mut settings: GlobalSettings = Default::default();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
+    let mut settings: GlobalSettings = Default::default();
 
-    let matches = match uu_app().try_get_matches_from(args) {
-        Ok(t) => t,
-        Err(e) => {
-            // not all clap "Errors" are because of a failure to parse arguments.
-            // "--version" also causes an Error to be returned, but we should not print to stderr
-            // nor return with a non-zero exit code in this case (we should print to stdout and return 0).
-            // This logic is similar to the code in clap, but we return 2 as the exit code in case of real failure
-            // (clap returns 1).
-            e.print().unwrap();
-            if e.use_stderr() {
-                set_exit_code(2);
+    let matches = match uu_app().try_get_matches_from(args) {
+        Ok(t) => t,
+        Err(e) => {
+            // not all clap "Errors" are because of a failure to parse arguments.
+            // "--version" also causes an Error to be returned, but we should not print to stderr
+            // nor return with a non-zero exit code in this case (we should print to stdout and return 0).
+            // This logic is similar to the code in clap, but we return 2 as the exit code in case of real failure
+            // (clap returns 1).
+            e.print().unwrap();
+            if e.use_stderr() {
+                set_exit_code(2);
             }
-            return Ok(());
+            return Ok(());
         }
     };
 
-    settings.debug = matches.get_flag(options::DEBUG);
+    settings.debug = matches.get_flag(options::DEBUG);
 
-    // check whether user specified a zero terminated list of files for input, otherwise read files from args
-    let mut files: Vec<OsString> = if matches.contains_id(options::FILES0_FROM) {
-        let files0_from: Vec<OsString> = matches
-            .get_many::<OsString>(options::FILES0_FROM)
-            .map(|v| v.map(ToOwned::to_owned).collect())
-            .unwrap_or_default();
+    // check whether user specified a zero terminated list of files for input, otherwise read files from args
+    let mut files: Vec<OsString> = if matches.contains_id(options::FILES0_FROM) {
+        let files0_from: Vec<OsString> = matches
+            .get_many::<OsString>(options::FILES0_FROM)
+            .map(|v| v.map(ToOwned::to_owned).collect())
+            .unwrap_or_default();
 
-        let mut files = Vec::new();
-        for path in &files0_from {
-            let reader = open(path)?;
-            let buf_reader = BufReader::new(reader);
-            for line in buf_reader.split(b'\0').flatten() {
-                files.push(OsString::from(
-                    std::str::from_utf8(&line)
-                        .expect("Could not parse string from zero terminated input."),
+        let mut files = Vec::new();
+        for path in &files0_from {
+            let reader = open(path)?;
+            let buf_reader = BufReader::new(reader);
+            for line in buf_reader.split(b'\0').flatten() {
+                files.push(OsString::from(
+                    std::str::from_utf8(&line)
+                        .expect("Could not parse string from zero terminated input."),
                 ));
             }
         }
-        files
-    } else {
-        matches
-            .get_many::<OsString>(options::FILES)
-            .map(|v| v.map(ToOwned::to_owned).collect())
-            .unwrap_or_default()
+        files
+    } else {
+        matches
+            .get_many::<OsString>(options::FILES)
+            .map(|v| v.map(ToOwned::to_owned).collect())
+            .unwrap_or_default()
     };
 
-    settings.mode = if matches.get_flag(options::modes::HUMAN_NUMERIC)
-        || matches
-            .get_one::<String>(options::modes::SORT)
-            .map(|s| s.as_str())
-            == Some("human-numeric")
+    settings.mode = if matches.get_flag(options::modes::HUMAN_NUMERIC)
+        || matches
+            .get_one::<String>(options::modes::SORT)
+            .map(|s| s.as_str())
+            == Some("human-numeric")
     {
-        SortMode::HumanNumeric
-    } else if matches.get_flag(options::modes::MONTH)
-        || matches
-            .get_one::<String>(options::modes::SORT)
-            .map(|s| s.as_str())
-            == Some("month")
+        SortMode::HumanNumeric
+    } else if matches.get_flag(options::modes::MONTH)
+        || matches
+            .get_one::<String>(options::modes::SORT)
+            .map(|s| s.as_str())
+            == Some("month")
     {
-        SortMode::Month
-    } else if matches.get_flag(options::modes::GENERAL_NUMERIC)
-        || matches
-            .get_one::<String>(options::modes::SORT)
-            .map(|s| s.as_str())
-            == Some("general-numeric")
+        SortMode::Month
+    } else if matches.get_flag(options::modes::GENERAL_NUMERIC)
+        || matches
+            .get_one::<String>(options::modes::SORT)
+            .map(|s| s.as_str())
+            == Some("general-numeric")
     {
-        SortMode::GeneralNumeric
-    } else if matches.get_flag(options::modes::NUMERIC)
-        || matches
-            .get_one::<String>(options::modes::SORT)
-            .map(|s| s.as_str())
-            == Some("numeric")
+        SortMode::GeneralNumeric
+    } else if matches.get_flag(options::modes::NUMERIC)
+        || matches
+            .get_one::<String>(options::modes::SORT)
+            .map(|s| s.as_str())
+            == Some("numeric")
     {
-        SortMode::Numeric
-    } else if matches.get_flag(options::modes::VERSION)
-        || matches
-            .get_one::<String>(options::modes::SORT)
-            .map(|s| s.as_str())
-            == Some("version")
+        SortMode::Numeric
+    } else if matches.get_flag(options::modes::VERSION)
+        || matches
+            .get_one::<String>(options::modes::SORT)
+            .map(|s| s.as_str())
+            == Some("version")
     {
-        SortMode::Version
-    } else if matches.get_flag(options::modes::RANDOM)
-        || matches
-            .get_one::<String>(options::modes::SORT)
-            .map(|s| s.as_str())
-            == Some("random")
+        SortMode::Version
+    } else if matches.get_flag(options::modes::RANDOM)
+        || matches
+            .get_one::<String>(options::modes::SORT)
+            .map(|s| s.as_str())
+            == Some("random")
     {
-        settings.salt = Some(get_rand_string());
-        SortMode::Random
-    } else {
-        SortMode::Default
+        settings.salt = Some(get_rand_string());
+        SortMode::Random
+    } else {
+        SortMode::Default
     };
 
-    settings.dictionary_order = matches.get_flag(options::DICTIONARY_ORDER);
-    settings.ignore_non_printing = matches.get_flag(options::IGNORE_NONPRINTING);
-    if matches.contains_id(options::PARALLEL) {
-        // "0" is default - threads = num of cores
-        settings.threads = matches
-            .get_one::<String>(options::PARALLEL)
-            .map(String::from)
-            .unwrap_or_else(|| "0".to_string());
-        env::set_var("RAYON_NUM_THREADS", &settings.threads);
+    settings.dictionary_order = matches.get_flag(options::DICTIONARY_ORDER);
+    settings.ignore_non_printing = matches.get_flag(options::IGNORE_NONPRINTING);
+    if matches.contains_id(options::PARALLEL) {
+        // "0" is default - threads = num of cores
+        settings.threads = matches
+            .get_one::<String>(options::PARALLEL)
+            .map(String::from)
+            .unwrap_or_else(|| "0".to_string());
+        env::set_var("RAYON_NUM_THREADS", &settings.threads);
     }
 
-    settings.buffer_size =
-        matches
-            .get_one::<String>(options::BUF_SIZE)
-            .map_or(Ok(DEFAULT_BUF_SIZE), |s| {
-                GlobalSettings::parse_byte_count(s).map_err(|e| {
-                    USimpleError::new(2, format_error_message(&e, s, options::BUF_SIZE))
+    settings.buffer_size =
+        matches
+            .get_one::<String>(options::BUF_SIZE)
+            .map_or(Ok(DEFAULT_BUF_SIZE), |s| {
+                GlobalSettings::parse_byte_count(s).map_err(|e| {
+                    USimpleError::new(2, format_error_message(&e, s, options::BUF_SIZE))
                 })
             })?;
 
-    let mut tmp_dir = TmpDirWrapper::new(
-        matches
-            .get_one::<String>(options::TMP_DIR)
-            .map(PathBuf::from)
-            .unwrap_or_else(env::temp_dir),
+    let mut tmp_dir = TmpDirWrapper::new(
+        matches
+            .get_one::<String>(options::TMP_DIR)
+            .map(PathBuf::from)
+            .unwrap_or_else(env::temp_dir),
     );
 
-    settings.compress_prog = matches
-        .get_one::<String>(options::COMPRESS_PROG)
-        .map(String::from);
+    settings.compress_prog = matches
+        .get_one::<String>(options::COMPRESS_PROG)
+        .map(String::from);
 
-    if let Some(n_merge) = matches.get_one::<String>(options::BATCH_SIZE) {
-        settings.merge_batch_size = n_merge.parse().map_err(|_| {
-            UUsageError::new(
+    if let Some(n_merge) = matches.get_one::<String>(options::BATCH_SIZE) {
+        settings.merge_batch_size = n_merge.parse().map_err(|_| {
+            UUsageError::new(
                 2,
-                format!("invalid --batch-size argument {}", n_merge.quote()),
+                format!("invalid --batch-size argument {}", n_merge.quote()),
             )
         })?;
     }
 
-    settings.zero_terminated = matches.get_flag(options::ZERO_TERMINATED);
-    settings.merge = matches.get_flag(options::MERGE);
+    settings.zero_terminated = matches.get_flag(options::ZERO_TERMINATED);
+    settings.merge = matches.get_flag(options::MERGE);
 
-    settings.check = matches.contains_id(options::check::CHECK);
-    if matches.get_flag(options::check::CHECK_SILENT)
-        || matches!(
-            matches
-                .get_one::<String>(options::check::CHECK)
-                .map(|s| s.as_str()),
-            Some(options::check::SILENT) | Some(options::check::QUIET)
+    settings.check = matches.contains_id(options::check::CHECK);
+    if matches.get_flag(options::check::CHECK_SILENT)
+        || matches!(
+            matches
+                .get_one::<String>(options::check::CHECK)
+                .map(|s| s.as_str()),
+            Some(options::check::SILENT) | Some(options::check::QUIET)
         )
     {
-        settings.check_silent = true;
-        settings.check = true;
+        settings.check_silent = true;
+        settings.check = true;
     };
 
-    settings.ignore_case = matches.get_flag(options::IGNORE_CASE);
+    settings.ignore_case = matches.get_flag(options::IGNORE_CASE);
 
-    settings.ignore_leading_blanks = matches.get_flag(options::IGNORE_LEADING_BLANKS);
+    settings.ignore_leading_blanks = matches.get_flag(options::IGNORE_LEADING_BLANKS);
 
-    settings.reverse = matches.get_flag(options::REVERSE);
-    settings.stable = matches.get_flag(options::STABLE);
-    settings.unique = matches.get_flag(options::UNIQUE);
+    settings.reverse = matches.get_flag(options::REVERSE);
+    settings.stable = matches.get_flag(options::STABLE);
+    settings.unique = matches.get_flag(options::UNIQUE);
 
-    if files.is_empty() {
-        /* if no file, default to stdin */
-        files.push("-".to_string().into());
-    } else if settings.check && files.len() != 1 {
-        return Err(UUsageError::new(
+    if files.is_empty() {
+        /* if no file, default to stdin */
+        files.push("-".to_string().into());
+    } else if settings.check && files.len() != 1 {
+        return Err(UUsageError::new(
             2,
-            format!("extra operand {} not allowed with -c", files[1].quote()),
+            format!("extra operand {} not allowed with -c", files[1].quote()),
         ));
     }
 
-    if let Some(arg) = matches.get_one::<OsString>(options::SEPARATOR) {
-        let mut separator = arg.to_str().ok_or_else(|| {
-            UUsageError::new(
+    if let Some(arg) = matches.get_one::<OsString>(options::SEPARATOR) {
+        let mut separator = arg.to_str().ok_or_else(|| {
+            UUsageError::new(
                 2,
-                format!("separator is not valid unicode: {}", arg.quote()),
+                format!("separator is not valid unicode: {}", arg.quote()),
             )
         })?;
-        if separator == "\\0" {
-            separator = "\0";
+        if separator == "\\0" {
+            separator = "\0";
         }
-        // This rejects non-ASCII codepoints, but perhaps we don't have to.
-        // On the other hand GNU accepts any single byte, valid unicode or not.
-        // (Supporting multi-byte chars would require changes in tokenize_with_separator().)
-        if separator.len() != 1 {
-            return Err(UUsageError::new(
+        // This rejects non-ASCII codepoints, but perhaps we don't have to.
+        // On the other hand GNU accepts any single byte, valid unicode or not.
+        // (Supporting multi-byte chars would require changes in tokenize_with_separator().)
+        if separator.len() != 1 {
+            return Err(UUsageError::new(
                 2,
                 format!(
                     "separator must be exactly one character long: {}",
-                    separator.quote()
+                    separator.quote()
                 ),
             ));
         }
-        settings.separator = Some(separator.chars().next().unwrap());
+        settings.separator = Some(separator.chars().next().unwrap());
     }
 
-    if let Some(values) = matches.get_many::<String>(options::KEY) {
-        for value in values {
-            let selector = FieldSelector::parse(value, &settings)?;
-            if selector.settings.mode == SortMode::Random && settings.salt.is_none() {
-                settings.salt = Some(get_rand_string());
+    if let Some(values) = matches.get_many::<String>(options::KEY) {
+        for value in values {
+            let selector = FieldSelector::parse(value, &settings)?;
+            if selector.settings.mode == SortMode::Random && settings.salt.is_none() {
+                settings.salt = Some(get_rand_string());
             }
-            settings.selectors.push(selector);
+            settings.selectors.push(selector);
         }
     }
 
-    if !matches.contains_id(options::KEY) {
-        // add a default selector matching the whole line
-        let key_settings = KeySettings::from(&settings);
-        settings.selectors.push(
-            FieldSelector::new(
-                KeyPosition {
-                    field: 1,
-                    char: 1,
-                    ignore_blanks: key_settings.ignore_blanks,
+    if !matches.contains_id(options::KEY) {
+        // add a default selector matching the whole line
+        let key_settings = KeySettings::from(&settings);
+        settings.selectors.push(
+            FieldSelector::new(
+                KeyPosition {
+                    field: 1,
+                    char: 1,
+                    ignore_blanks: key_settings.ignore_blanks,
                 },
                 None,
-                key_settings,
+                key_settings,
             )
-            .unwrap(),
+            .unwrap(),
         );
     }
 
-    // Verify that we can open all input files.
-    // It is the correct behavior to close all files afterwards,
-    // and to reopen them at a later point. This is different from how the output file is handled,
-    // probably to prevent running out of file descriptors.
-    for file in &files {
-        open(file)?;
+    // Verify that we can open all input files.
+    // It is the correct behavior to close all files afterwards,
+    // and to reopen them at a later point. This is different from how the output file is handled,
+    // probably to prevent running out of file descriptors.
+    for file in &files {
+        open(file)?;
     }
 
-    let output = Output::new(
-        matches
-            .get_one::<String>(options::OUTPUT)
-            .map(|s| s.as_str()),
+    let output = Output::new(
+        matches
+            .get_one::<String>(options::OUTPUT)
+            .map(|s| s.as_str()),
     )?;
 
-    settings.init_precomputed();
+    settings.init_precomputed();
 
-    let result = exec(&mut files, &settings, output, &mut tmp_dir);
-    // Wait here if `SIGINT` was received,
-    // for signal handler to do its work and terminate the program.
-    tmp_dir.wait_if_signal();
-    result
+    let result = exec(&mut files, &settings, output, &mut tmp_dir);
+    // Wait here if `SIGINT` was received,
+    // for signal handler to do its work and terminate the program.
+    tmp_dir.wait_if_signal();
+    result
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(LONG_HELP_KEYS)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .disable_version_flag(true)
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(LONG_HELP_KEYS)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .disable_version_flag(true)
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new(options::VERSION)
-                .long(options::VERSION)
-                .help("Print version information.")
-                .action(ArgAction::Version),
+        .arg(
+            Arg::new(options::VERSION)
+                .long(options::VERSION)
+                .help("Print version information.")
+                .action(ArgAction::Version),
         )
-        .arg(
-            Arg::new(options::modes::SORT)
-                .long(options::modes::SORT)
-                .value_parser([
+        .arg(
+            Arg::new(options::modes::SORT)
+                .long(options::modes::SORT)
+                .value_parser([
                     "general-numeric",
                     "human-numeric",
                     "month",
@@ -3363,694 +3363,694 @@ Valid options are: MbdfhnRrV. They override the global options for this key.&quo
                     "version",
                     "random",
                 ])
-                .conflicts_with_all(options::modes::ALL_SORT_MODES),
+                .conflicts_with_all(options::modes::ALL_SORT_MODES),
         )
-        .arg(make_sort_mode_arg(
-            options::modes::HUMAN_NUMERIC,
+        .arg(make_sort_mode_arg(
+            options::modes::HUMAN_NUMERIC,
             'h',
             "compare according to human readable sizes, eg 1M > 100k",
         ))
-        .arg(make_sort_mode_arg(
-            options::modes::MONTH,
+        .arg(make_sort_mode_arg(
+            options::modes::MONTH,
             'M',
             "compare according to month name abbreviation",
         ))
-        .arg(make_sort_mode_arg(
-            options::modes::NUMERIC,
+        .arg(make_sort_mode_arg(
+            options::modes::NUMERIC,
             'n',
             "compare according to string numerical value",
         ))
-        .arg(make_sort_mode_arg(
-            options::modes::GENERAL_NUMERIC,
+        .arg(make_sort_mode_arg(
+            options::modes::GENERAL_NUMERIC,
             'g',
             "compare according to string general numerical value",
         ))
-        .arg(make_sort_mode_arg(
-            options::modes::VERSION,
+        .arg(make_sort_mode_arg(
+            options::modes::VERSION,
             'V',
             "Sort by SemVer version number, eg 1.12.2 > 1.1.2",
         ))
-        .arg(make_sort_mode_arg(
-            options::modes::RANDOM,
+        .arg(make_sort_mode_arg(
+            options::modes::RANDOM,
             'R',
             "shuffle in random order",
         ))
-        .arg(
-            Arg::new(options::DICTIONARY_ORDER)
-                .short('d')
-                .long(options::DICTIONARY_ORDER)
-                .help("consider only blanks and alphanumeric characters")
-                .conflicts_with_all([
-                    options::modes::NUMERIC,
-                    options::modes::GENERAL_NUMERIC,
-                    options::modes::HUMAN_NUMERIC,
-                    options::modes::MONTH,
+        .arg(
+            Arg::new(options::DICTIONARY_ORDER)
+                .short('d')
+                .long(options::DICTIONARY_ORDER)
+                .help("consider only blanks and alphanumeric characters")
+                .conflicts_with_all([
+                    options::modes::NUMERIC,
+                    options::modes::GENERAL_NUMERIC,
+                    options::modes::HUMAN_NUMERIC,
+                    options::modes::MONTH,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::MERGE)
-                .short('m')
-                .long(options::MERGE)
-                .help("merge already sorted files; do not sort")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::MERGE)
+                .short('m')
+                .long(options::MERGE)
+                .help("merge already sorted files; do not sort")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::check::CHECK)
-                .short('c')
-                .long(options::check::CHECK)
-                .require_equals(true)
-                .num_args(0..)
-                .value_parser([
-                    options::check::SILENT,
-                    options::check::QUIET,
-                    options::check::DIAGNOSE_FIRST,
+        .arg(
+            Arg::new(options::check::CHECK)
+                .short('c')
+                .long(options::check::CHECK)
+                .require_equals(true)
+                .num_args(0..)
+                .value_parser([
+                    options::check::SILENT,
+                    options::check::QUIET,
+                    options::check::DIAGNOSE_FIRST,
                 ])
-                .conflicts_with(options::OUTPUT)
-                .help("check for sorted input; do not sort"),
+                .conflicts_with(options::OUTPUT)
+                .help("check for sorted input; do not sort"),
         )
-        .arg(
-            Arg::new(options::check::CHECK_SILENT)
-                .short('C')
-                .long(options::check::CHECK_SILENT)
-                .conflicts_with(options::OUTPUT)
-                .help(
+        .arg(
+            Arg::new(options::check::CHECK_SILENT)
+                .short('C')
+                .long(options::check::CHECK_SILENT)
+                .conflicts_with(options::OUTPUT)
+                .help(
                     "exit successfully if the given file is already sorted, \
                 and exit with status 1 otherwise.",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::IGNORE_CASE)
-                .short('f')
-                .long(options::IGNORE_CASE)
-                .help("fold lower case to upper case characters")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::IGNORE_CASE)
+                .short('f')
+                .long(options::IGNORE_CASE)
+                .help("fold lower case to upper case characters")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::IGNORE_NONPRINTING)
-                .short('i')
-                .long(options::IGNORE_NONPRINTING)
-                .help("ignore nonprinting characters")
-                .conflicts_with_all([
-                    options::modes::NUMERIC,
-                    options::modes::GENERAL_NUMERIC,
-                    options::modes::HUMAN_NUMERIC,
-                    options::modes::MONTH,
+        .arg(
+            Arg::new(options::IGNORE_NONPRINTING)
+                .short('i')
+                .long(options::IGNORE_NONPRINTING)
+                .help("ignore nonprinting characters")
+                .conflicts_with_all([
+                    options::modes::NUMERIC,
+                    options::modes::GENERAL_NUMERIC,
+                    options::modes::HUMAN_NUMERIC,
+                    options::modes::MONTH,
                 ])
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::IGNORE_LEADING_BLANKS)
-                .short('b')
-                .long(options::IGNORE_LEADING_BLANKS)
-                .help("ignore leading blanks when finding sort keys in each line")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::IGNORE_LEADING_BLANKS)
+                .short('b')
+                .long(options::IGNORE_LEADING_BLANKS)
+                .help("ignore leading blanks when finding sort keys in each line")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OUTPUT)
-                .short('o')
-                .long(options::OUTPUT)
-                .help("write output to FILENAME instead of stdout")
-                .value_name("FILENAME")
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::OUTPUT)
+                .short('o')
+                .long(options::OUTPUT)
+                .help("write output to FILENAME instead of stdout")
+                .value_name("FILENAME")
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::REVERSE)
-                .short('r')
-                .long(options::REVERSE)
-                .help("reverse the output")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::REVERSE)
+                .short('r')
+                .long(options::REVERSE)
+                .help("reverse the output")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::STABLE)
-                .short('s')
-                .long(options::STABLE)
-                .help("stabilize sort by disabling last-resort comparison")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::STABLE)
+                .short('s')
+                .long(options::STABLE)
+                .help("stabilize sort by disabling last-resort comparison")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::UNIQUE)
-                .short('u')
-                .long(options::UNIQUE)
-                .help("output only the first of an equal run")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::UNIQUE)
+                .short('u')
+                .long(options::UNIQUE)
+                .help("output only the first of an equal run")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::KEY)
-                .short('k')
-                .long(options::KEY)
-                .help("sort by a key")
-                .action(ArgAction::Append)
-                .num_args(1),
+        .arg(
+            Arg::new(options::KEY)
+                .short('k')
+                .long(options::KEY)
+                .help("sort by a key")
+                .action(ArgAction::Append)
+                .num_args(1),
         )
-        .arg(
-            Arg::new(options::SEPARATOR)
-                .short('t')
-                .long(options::SEPARATOR)
-                .help("custom separator for -k")
-                .value_parser(ValueParser::os_string()),
+        .arg(
+            Arg::new(options::SEPARATOR)
+                .short('t')
+                .long(options::SEPARATOR)
+                .help("custom separator for -k")
+                .value_parser(ValueParser::os_string()),
         )
-        .arg(
-            Arg::new(options::ZERO_TERMINATED)
-                .short('z')
-                .long(options::ZERO_TERMINATED)
-                .help("line delimiter is NUL, not newline")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO_TERMINATED)
+                .short('z')
+                .long(options::ZERO_TERMINATED)
+                .help("line delimiter is NUL, not newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PARALLEL)
-                .long(options::PARALLEL)
-                .help("change the number of threads running concurrently to NUM_THREADS")
-                .value_name("NUM_THREADS"),
+        .arg(
+            Arg::new(options::PARALLEL)
+                .long(options::PARALLEL)
+                .help("change the number of threads running concurrently to NUM_THREADS")
+                .value_name("NUM_THREADS"),
         )
-        .arg(
-            Arg::new(options::BUF_SIZE)
-                .short('S')
-                .long(options::BUF_SIZE)
-                .help("sets the maximum SIZE of each segment in number of sorted items")
-                .value_name("SIZE"),
+        .arg(
+            Arg::new(options::BUF_SIZE)
+                .short('S')
+                .long(options::BUF_SIZE)
+                .help("sets the maximum SIZE of each segment in number of sorted items")
+                .value_name("SIZE"),
         )
-        .arg(
-            Arg::new(options::TMP_DIR)
-                .short('T')
-                .long(options::TMP_DIR)
-                .help("use DIR for temporaries, not $TMPDIR or /tmp")
-                .value_name("DIR")
-                .value_hint(clap::ValueHint::DirPath),
+        .arg(
+            Arg::new(options::TMP_DIR)
+                .short('T')
+                .long(options::TMP_DIR)
+                .help("use DIR for temporaries, not $TMPDIR or /tmp")
+                .value_name("DIR")
+                .value_hint(clap::ValueHint::DirPath),
         )
-        .arg(
-            Arg::new(options::COMPRESS_PROG)
-                .long(options::COMPRESS_PROG)
-                .help("compress temporary files with PROG, decompress with PROG -d; PROG has to take input from stdin and output to stdout")
-                .value_name("PROG")
-                .value_hint(clap::ValueHint::CommandName),
+        .arg(
+            Arg::new(options::COMPRESS_PROG)
+                .long(options::COMPRESS_PROG)
+                .help("compress temporary files with PROG, decompress with PROG -d; PROG has to take input from stdin and output to stdout")
+                .value_name("PROG")
+                .value_hint(clap::ValueHint::CommandName),
         )
-        .arg(
-            Arg::new(options::BATCH_SIZE)
-                .long(options::BATCH_SIZE)
-                .help("Merge at most N_MERGE inputs at once.")
-                .value_name("N_MERGE"),
+        .arg(
+            Arg::new(options::BATCH_SIZE)
+                .long(options::BATCH_SIZE)
+                .help("Merge at most N_MERGE inputs at once.")
+                .value_name("N_MERGE"),
         )
-        .arg(
-            Arg::new(options::FILES0_FROM)
-                .long(options::FILES0_FROM)
-                .help("read input from the files specified by NUL-terminated NUL_FILES")
-                .value_name("NUL_FILES")
-                .action(ArgAction::Append)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILES0_FROM)
+                .long(options::FILES0_FROM)
+                .help("read input from the files specified by NUL-terminated NUL_FILES")
+                .value_name("NUL_FILES")
+                .action(ArgAction::Append)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::DEBUG)
-                .long(options::DEBUG)
-                .help("underline the parts of the line that are actually used for sorting")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::DEBUG)
+                .long(options::DEBUG)
+                .help("underline the parts of the line that are actually used for sorting")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILES)
-                .action(ArgAction::Append)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILES)
+                .action(ArgAction::Append)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-fn exec(
-    files: &mut [OsString],
-    settings: &GlobalSettings,
-    output: Output,
-    tmp_dir: &mut TmpDirWrapper,
-) -> UResult<()> {
-    if settings.merge {
-        let file_merger = merge::merge(files, settings, output.as_output_name(), tmp_dir)?;
-        file_merger.write_all(settings, output)
-    } else if settings.check {
-        if files.len() > 1 {
-            Err(UUsageError::new(2, "only one file allowed with -c"))
-        } else {
-            check::check(files.first().unwrap(), settings)
+fn exec(
+    files: &mut [OsString],
+    settings: &GlobalSettings,
+    output: Output,
+    tmp_dir: &mut TmpDirWrapper,
+) -> UResult<()> {
+    if settings.merge {
+        let file_merger = merge::merge(files, settings, output.as_output_name(), tmp_dir)?;
+        file_merger.write_all(settings, output)
+    } else if settings.check {
+        if files.len() > 1 {
+            Err(UUsageError::new(2, "only one file allowed with -c"))
+        } else {
+            check::check(files.first().unwrap(), settings)
         }
-    } else {
-        let mut lines = files.iter().map(open);
-        ext_sort(&mut lines, settings, output, tmp_dir)
+    } else {
+        let mut lines = files.iter().map(open);
+        ext_sort(&mut lines, settings, output, tmp_dir)
     }
 }
 
-fn sort_by<'a>(unsorted: &mut Vec<Line<'a>>, settings: &GlobalSettings, line_data: &LineData<'a>) {
-    if settings.stable || settings.unique {
-        unsorted.par_sort_by(|a, b| compare_by(a, b, settings, line_data, line_data));
-    } else {
-        unsorted.par_sort_unstable_by(|a, b| compare_by(a, b, settings, line_data, line_data));
+fn sort_by<'a>(unsorted: &mut Vec<Line<'a>>, settings: &GlobalSettings, line_data: &LineData<'a>) {
+    if settings.stable || settings.unique {
+        unsorted.par_sort_by(|a, b| compare_by(a, b, settings, line_data, line_data));
+    } else {
+        unsorted.par_sort_unstable_by(|a, b| compare_by(a, b, settings, line_data, line_data));
     }
 }
 
-fn compare_by<'a>(
-    a: &Line<'a>,
-    b: &Line<'a>,
-    global_settings: &GlobalSettings,
-    a_line_data: &LineData<'a>,
-    b_line_data: &LineData<'a>,
-) -> Ordering {
-    let mut selection_index = 0;
-    let mut num_info_index = 0;
-    let mut parsed_float_index = 0;
-    for selector in &global_settings.selectors {
-        let (a_str, b_str) = if !selector.needs_selection {
-            // We can select the whole line.
-            (a.line, b.line)
-        } else {
-            let selections = (
-                a_line_data.selections
-                    [a.index * global_settings.precomputed.selections_per_line + selection_index],
-                b_line_data.selections
-                    [b.index * global_settings.precomputed.selections_per_line + selection_index],
+fn compare_by<'a>(
+    a: &Line<'a>,
+    b: &Line<'a>,
+    global_settings: &GlobalSettings,
+    a_line_data: &LineData<'a>,
+    b_line_data: &LineData<'a>,
+) -> Ordering {
+    let mut selection_index = 0;
+    let mut num_info_index = 0;
+    let mut parsed_float_index = 0;
+    for selector in &global_settings.selectors {
+        let (a_str, b_str) = if !selector.needs_selection {
+            // We can select the whole line.
+            (a.line, b.line)
+        } else {
+            let selections = (
+                a_line_data.selections
+                    [a.index * global_settings.precomputed.selections_per_line + selection_index],
+                b_line_data.selections
+                    [b.index * global_settings.precomputed.selections_per_line + selection_index],
             );
-            selection_index += 1;
-            selections
+            selection_index += 1;
+            selections
         };
 
-        let settings = &selector.settings;
+        let settings = &selector.settings;
 
-        let cmp: Ordering = match settings.mode {
-            SortMode::Random => {
-                // check if the two strings are equal
-                if custom_str_cmp(
-                    a_str,
-                    b_str,
-                    settings.ignore_non_printing,
-                    settings.dictionary_order,
-                    settings.ignore_case,
-                ) == Ordering::Equal
+        let cmp: Ordering = match settings.mode {
+            SortMode::Random => {
+                // check if the two strings are equal
+                if custom_str_cmp(
+                    a_str,
+                    b_str,
+                    settings.ignore_non_printing,
+                    settings.dictionary_order,
+                    settings.ignore_case,
+                ) == Ordering::Equal
                 {
-                    Ordering::Equal
-                } else {
-                    // Only if they are not equal compare by the hash
-                    random_shuffle(a_str, b_str, &global_settings.salt.unwrap())
+                    Ordering::Equal
+                } else {
+                    // Only if they are not equal compare by the hash
+                    random_shuffle(a_str, b_str, &global_settings.salt.unwrap())
                 }
             }
-            SortMode::Numeric => {
-                let a_num_info = &a_line_data.num_infos
-                    [a.index * global_settings.precomputed.num_infos_per_line + num_info_index];
-                let b_num_info = &b_line_data.num_infos
-                    [b.index * global_settings.precomputed.num_infos_per_line + num_info_index];
-                num_info_index += 1;
-                numeric_str_cmp((a_str, a_num_info), (b_str, b_num_info))
+            SortMode::Numeric => {
+                let a_num_info = &a_line_data.num_infos
+                    [a.index * global_settings.precomputed.num_infos_per_line + num_info_index];
+                let b_num_info = &b_line_data.num_infos
+                    [b.index * global_settings.precomputed.num_infos_per_line + num_info_index];
+                num_info_index += 1;
+                numeric_str_cmp((a_str, a_num_info), (b_str, b_num_info))
             }
-            SortMode::HumanNumeric => {
-                let a_num_info = &a_line_data.num_infos
-                    [a.index * global_settings.precomputed.num_infos_per_line + num_info_index];
-                let b_num_info = &b_line_data.num_infos
-                    [b.index * global_settings.precomputed.num_infos_per_line + num_info_index];
-                num_info_index += 1;
-                human_numeric_str_cmp((a_str, a_num_info), (b_str, b_num_info))
+            SortMode::HumanNumeric => {
+                let a_num_info = &a_line_data.num_infos
+                    [a.index * global_settings.precomputed.num_infos_per_line + num_info_index];
+                let b_num_info = &b_line_data.num_infos
+                    [b.index * global_settings.precomputed.num_infos_per_line + num_info_index];
+                num_info_index += 1;
+                human_numeric_str_cmp((a_str, a_num_info), (b_str, b_num_info))
             }
-            SortMode::GeneralNumeric => {
-                let a_float = &a_line_data.parsed_floats
-                    [a.index * global_settings.precomputed.floats_per_line + parsed_float_index];
-                let b_float = &b_line_data.parsed_floats
-                    [b.index * global_settings.precomputed.floats_per_line + parsed_float_index];
-                parsed_float_index += 1;
-                general_numeric_compare(a_float, b_float)
+            SortMode::GeneralNumeric => {
+                let a_float = &a_line_data.parsed_floats
+                    [a.index * global_settings.precomputed.floats_per_line + parsed_float_index];
+                let b_float = &b_line_data.parsed_floats
+                    [b.index * global_settings.precomputed.floats_per_line + parsed_float_index];
+                parsed_float_index += 1;
+                general_numeric_compare(a_float, b_float)
             }
-            SortMode::Month => month_compare(a_str, b_str),
-            SortMode::Version => version_cmp(a_str, b_str),
-            SortMode::Default => custom_str_cmp(
-                a_str,
-                b_str,
-                settings.ignore_non_printing,
-                settings.dictionary_order,
-                settings.ignore_case,
+            SortMode::Month => month_compare(a_str, b_str),
+            SortMode::Version => version_cmp(a_str, b_str),
+            SortMode::Default => custom_str_cmp(
+                a_str,
+                b_str,
+                settings.ignore_non_printing,
+                settings.dictionary_order,
+                settings.ignore_case,
             ),
         };
-        if cmp != Ordering::Equal {
-            return if settings.reverse { cmp.reverse() } else { cmp };
+        if cmp != Ordering::Equal {
+            return if settings.reverse { cmp.reverse() } else { cmp };
         }
     }
 
-    // Call "last resort compare" if all selectors returned Equal
-    let cmp = if global_settings.mode == SortMode::Random
-        || global_settings.stable
-        || global_settings.unique
+    // Call "last resort compare" if all selectors returned Equal
+    let cmp = if global_settings.mode == SortMode::Random
+        || global_settings.stable
+        || global_settings.unique
     {
-        Ordering::Equal
-    } else {
-        a.line.cmp(b.line)
+        Ordering::Equal
+    } else {
+        a.line.cmp(b.line)
     };
 
-    if global_settings.reverse {
-        cmp.reverse()
-    } else {
-        cmp
+    if global_settings.reverse {
+        cmp.reverse()
+    } else {
+        cmp
     }
 }
 
-// This function cleans up the initial comparison done by leading_num_common for a general numeric compare.
-// In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and
-// scientific notation, so we strip those lines only after the end of the following numeric string.
-// For example, 5e10KFD would be 5e10 or 5x10^10 and +10000HFKJFK would become 10000.
-fn get_leading_gen(input: &str) -> Range<usize> {
-    let trimmed = input.trim_start();
-    let leading_whitespace_len = input.len() - trimmed.len();
+// This function cleans up the initial comparison done by leading_num_common for a general numeric compare.
+// In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and
+// scientific notation, so we strip those lines only after the end of the following numeric string.
+// For example, 5e10KFD would be 5e10 or 5x10^10 and +10000HFKJFK would become 10000.
+fn get_leading_gen(input: &str) -> Range<usize> {
+    let trimmed = input.trim_start();
+    let leading_whitespace_len = input.len() - trimmed.len();
 
-    // check for inf, -inf and nan
-    for allowed_prefix in ["inf", "-inf", "nan"] {
-        if trimmed.is_char_boundary(allowed_prefix.len())
-            && trimmed[..allowed_prefix.len()].eq_ignore_ascii_case(allowed_prefix)
+    // check for inf, -inf and nan
+    for allowed_prefix in ["inf", "-inf", "nan"] {
+        if trimmed.is_char_boundary(allowed_prefix.len())
+            && trimmed[..allowed_prefix.len()].eq_ignore_ascii_case(allowed_prefix)
         {
-            return leading_whitespace_len..(leading_whitespace_len + allowed_prefix.len());
+            return leading_whitespace_len..(leading_whitespace_len + allowed_prefix.len());
         }
     }
-    // Make this iter peekable to see if next char is numeric
-    let mut char_indices = itertools::peek_nth(trimmed.char_indices());
+    // Make this iter peekable to see if next char is numeric
+    let mut char_indices = itertools::peek_nth(trimmed.char_indices());
 
-    let first = char_indices.peek();
+    let first = char_indices.peek();
 
-    if matches!(first, Some((_, NEGATIVE)) | Some((_, POSITIVE))) {
-        char_indices.next();
+    if matches!(first, Some((_, NEGATIVE)) | Some((_, POSITIVE))) {
+        char_indices.next();
     }
 
-    let mut had_e_notation = false;
-    let mut had_decimal_pt = false;
-    while let Some((idx, c)) = char_indices.next() {
-        if c.is_ascii_digit() {
+    let mut had_e_notation = false;
+    let mut had_decimal_pt = false;
+    while let Some((idx, c)) = char_indices.next() {
+        if c.is_ascii_digit() {
             continue;
         }
-        if c == DECIMAL_PT && !had_decimal_pt && !had_e_notation {
-            had_decimal_pt = true;
+        if c == DECIMAL_PT && !had_decimal_pt && !had_e_notation {
+            had_decimal_pt = true;
             continue;
         }
-        if (c == 'e' || c == 'E') && !had_e_notation {
-            // we can only consume the 'e' if what follow is either a digit, or a sign followed by a digit.
-            if let Some(&(_, next_char)) = char_indices.peek() {
-                if (next_char == '+' || next_char == '-')
-                    && matches!(
-                        char_indices.peek_nth(2),
-                        Some((_, c)) if c.is_ascii_digit()
+        if (c == 'e' || c == 'E') && !had_e_notation {
+            // we can only consume the 'e' if what follow is either a digit, or a sign followed by a digit.
+            if let Some(&(_, next_char)) = char_indices.peek() {
+                if (next_char == '+' || next_char == '-')
+                    && matches!(
+                        char_indices.peek_nth(2),
+                        Some((_, c)) if c.is_ascii_digit()
                     )
                 {
-                    // Consume the sign. The following digits will be consumed by the main loop.
-                    char_indices.next();
-                    had_e_notation = true;
+                    // Consume the sign. The following digits will be consumed by the main loop.
+                    char_indices.next();
+                    had_e_notation = true;
                     continue;
                 }
-                if next_char.is_ascii_digit() {
-                    had_e_notation = true;
+                if next_char.is_ascii_digit() {
+                    had_e_notation = true;
                     continue;
                 }
             }
         }
-        return leading_whitespace_len..(leading_whitespace_len + idx);
+        return leading_whitespace_len..(leading_whitespace_len + idx);
     }
-    leading_whitespace_len..input.len()
+    leading_whitespace_len..input.len()
 }
 
-#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
-pub enum GeneralF64ParseResult {
-    Invalid,
-    NaN,
-    NegInfinity,
-    Number(f64),
-    Infinity,
+#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
+pub enum GeneralF64ParseResult {
+    Invalid,
+    NaN,
+    NegInfinity,
+    Number(f64),
+    Infinity,
 }
 
-/// Parse the beginning string into a GeneralF64ParseResult.
-/// Using a GeneralF64ParseResult instead of f64 is necessary to correctly order floats.
-#[inline(always)]
-fn general_f64_parse(a: &str) -> GeneralF64ParseResult {
-    // The actual behavior here relies on Rust's implementation of parsing floating points.
-    // For example "nan", "inf" (ignoring the case) and "infinity" are only parsed to floats starting from 1.53.
-    // TODO: Once our minimum supported Rust version is 1.53 or above, we should add tests for those cases.
-    match a.parse::<f64>() {
-        Ok(a) if a.is_nan() => GeneralF64ParseResult::NaN,
-        Ok(a) if a == std::f64::NEG_INFINITY => GeneralF64ParseResult::NegInfinity,
-        Ok(a) if a == std::f64::INFINITY => GeneralF64ParseResult::Infinity,
-        Ok(a) => GeneralF64ParseResult::Number(a),
-        Err(_) => GeneralF64ParseResult::Invalid,
+/// Parse the beginning string into a GeneralF64ParseResult.
+/// Using a GeneralF64ParseResult instead of f64 is necessary to correctly order floats.
+#[inline(always)]
+fn general_f64_parse(a: &str) -> GeneralF64ParseResult {
+    // The actual behavior here relies on Rust's implementation of parsing floating points.
+    // For example "nan", "inf" (ignoring the case) and "infinity" are only parsed to floats starting from 1.53.
+    // TODO: Once our minimum supported Rust version is 1.53 or above, we should add tests for those cases.
+    match a.parse::<f64>() {
+        Ok(a) if a.is_nan() => GeneralF64ParseResult::NaN,
+        Ok(a) if a == std::f64::NEG_INFINITY => GeneralF64ParseResult::NegInfinity,
+        Ok(a) if a == std::f64::INFINITY => GeneralF64ParseResult::Infinity,
+        Ok(a) => GeneralF64ParseResult::Number(a),
+        Err(_) => GeneralF64ParseResult::Invalid,
     }
 }
 
-/// Compares two floats, with errors and non-numerics assumed to be -inf.
-/// Stops coercing at the first non-numeric char.
-/// We explicitly need to convert to f64 in this case.
-fn general_numeric_compare(a: &GeneralF64ParseResult, b: &GeneralF64ParseResult) -> Ordering {
-    a.partial_cmp(b).unwrap()
+/// Compares two floats, with errors and non-numerics assumed to be -inf.
+/// Stops coercing at the first non-numeric char.
+/// We explicitly need to convert to f64 in this case.
+fn general_numeric_compare(a: &GeneralF64ParseResult, b: &GeneralF64ParseResult) -> Ordering {
+    a.partial_cmp(b).unwrap()
 }
 
-fn get_rand_string() -> [u8; 16] {
-    thread_rng().sample(rand::distributions::Standard)
+fn get_rand_string() -> [u8; 16] {
+    thread_rng().sample(rand::distributions::Standard)
 }
 
-fn get_hash<T: Hash>(t: &T) -> u64 {
-    let mut s: FnvHasher = Default::default();
-    t.hash(&mut s);
-    s.finish()
+fn get_hash<T: Hash>(t: &T) -> u64 {
+    let mut s: FnvHasher = Default::default();
+    t.hash(&mut s);
+    s.finish()
 }
 
-fn random_shuffle(a: &str, b: &str, salt: &[u8]) -> Ordering {
-    let da = get_hash(&(a, salt));
-    let db = get_hash(&(b, salt));
-    da.cmp(&db)
+fn random_shuffle(a: &str, b: &str, salt: &[u8]) -> Ordering {
+    let da = get_hash(&(a, salt));
+    let db = get_hash(&(b, salt));
+    da.cmp(&db)
 }
 
-#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)]
-enum Month {
-    Unknown,
-    January,
-    February,
-    March,
-    April,
-    May,
-    June,
-    July,
-    August,
-    September,
-    October,
-    November,
-    December,
+#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Copy)]
+enum Month {
+    Unknown,
+    January,
+    February,
+    March,
+    April,
+    May,
+    June,
+    July,
+    August,
+    September,
+    October,
+    November,
+    December,
 }
 
-/// Parse the beginning string into a Month, returning Month::Unknown on errors.
-fn month_parse(line: &str) -> Month {
-    let line = line.trim();
+/// Parse the beginning string into a Month, returning Month::Unknown on errors.
+fn month_parse(line: &str) -> Month {
+    let line = line.trim();
 
-    const MONTHS: [(&str, Month); 12] = [
-        ("JAN", Month::January),
-        ("FEB", Month::February),
-        ("MAR", Month::March),
-        ("APR", Month::April),
-        ("MAY", Month::May),
-        ("JUN", Month::June),
-        ("JUL", Month::July),
-        ("AUG", Month::August),
-        ("SEP", Month::September),
-        ("OCT", Month::October),
-        ("NOV", Month::November),
-        ("DEC", Month::December),
+    const MONTHS: [(&str, Month); 12] = [
+        ("JAN", Month::January),
+        ("FEB", Month::February),
+        ("MAR", Month::March),
+        ("APR", Month::April),
+        ("MAY", Month::May),
+        ("JUN", Month::June),
+        ("JUL", Month::July),
+        ("AUG", Month::August),
+        ("SEP", Month::September),
+        ("OCT", Month::October),
+        ("NOV", Month::November),
+        ("DEC", Month::December),
     ];
 
-    for (month_str, month) in &MONTHS {
-        if line.is_char_boundary(month_str.len())
-            && line[..month_str.len()].eq_ignore_ascii_case(month_str)
+    for (month_str, month) in &MONTHS {
+        if line.is_char_boundary(month_str.len())
+            && line[..month_str.len()].eq_ignore_ascii_case(month_str)
         {
-            return *month;
+            return *month;
         }
     }
 
-    Month::Unknown
+    Month::Unknown
 }
 
-fn month_compare(a: &str, b: &str) -> Ordering {
-    #![allow(clippy::comparison_chain)]
-    let ma = month_parse(a);
-    let mb = month_parse(b);
+fn month_compare(a: &str, b: &str) -> Ordering {
+    #![allow(clippy::comparison_chain)]
+    let ma = month_parse(a);
+    let mb = month_parse(b);
 
-    if ma > mb {
-        Ordering::Greater
-    } else if ma < mb {
-        Ordering::Less
-    } else {
-        Ordering::Equal
+    if ma > mb {
+        Ordering::Greater
+    } else if ma < mb {
+        Ordering::Less
+    } else {
+        Ordering::Equal
     }
 }
 
-fn print_sorted<'a, T: Iterator<Item = &'a Line<'a>>>(
-    iter: T,
-    settings: &GlobalSettings,
-    output: Output,
+fn print_sorted<'a, T: Iterator<Item = &'a Line<'a>>>(
+    iter: T,
+    settings: &GlobalSettings,
+    output: Output,
 ) {
-    let mut writer = output.into_write();
-    for line in iter {
-        line.print(&mut writer, settings);
+    let mut writer = output.into_write();
+    for line in iter {
+        line.print(&mut writer, settings);
     }
 }
 
-fn open(path: impl AsRef<OsStr>) -> UResult<Box<dyn Read + Send>> {
-    let path = path.as_ref();
-    if path == "-" {
-        let stdin = stdin();
-        return Ok(Box::new(stdin) as Box<dyn Read + Send>);
+fn open(path: impl AsRef<OsStr>) -> UResult<Box<dyn Read + Send>> {
+    let path = path.as_ref();
+    if path == "-" {
+        let stdin = stdin();
+        return Ok(Box::new(stdin) as Box<dyn Read + Send>);
     }
 
-    let path = Path::new(path);
+    let path = Path::new(path);
 
-    match File::open(path) {
-        Ok(f) => Ok(Box::new(f) as Box<dyn Read + Send>),
-        Err(error) => Err(SortError::ReadFailed {
-            path: path.to_owned(),
-            error,
+    match File::open(path) {
+        Ok(f) => Ok(Box::new(f) as Box<dyn Read + Send>),
+        Err(error) => Err(SortError::ReadFailed {
+            path: path.to_owned(),
+            error,
         }
-        .into()),
+        .into()),
     }
 }
 
-fn format_error_message(error: &ParseSizeError, s: &str, option: &str) -> String {
-    // NOTE:
-    // GNU's sort echos affected flag, -S or --buffer-size, depending user's selection
-    match error {
-        ParseSizeError::InvalidSuffix(_) => {
-            format!("invalid suffix in --{} argument {}", option, s.quote())
+fn format_error_message(error: &ParseSizeError, s: &str, option: &str) -> String {
+    // NOTE:
+    // GNU's sort echos affected flag, -S or --buffer-size, depending user's selection
+    match error {
+        ParseSizeError::InvalidSuffix(_) => {
+            format!("invalid suffix in --{} argument {}", option, s.quote())
         }
-        ParseSizeError::ParseFailure(_) => format!("invalid --{} argument {}", option, s.quote()),
-        ParseSizeError::SizeTooBig(_) => format!("--{} argument {} too large", option, s.quote()),
+        ParseSizeError::ParseFailure(_) => format!("invalid --{} argument {}", option, s.quote()),
+        ParseSizeError::SizeTooBig(_) => format!("--{} argument {} too large", option, s.quote()),
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use super::*;
+    use super::*;
 
-    fn tokenize_helper(line: &str, separator: Option<char>) -> Vec<Field> {
-        let mut buffer = vec![];
-        tokenize(line, separator, &mut buffer);
-        buffer
+    fn tokenize_helper(line: &str, separator: Option<char>) -> Vec<Field> {
+        let mut buffer = vec![];
+        tokenize(line, separator, &mut buffer);
+        buffer
     }
 
-    #[test]
-    fn test_get_hash() {
-        let a = "Ted".to_string();
+    #[test]
+    fn test_get_hash() {
+        let a = "Ted".to_string();
 
-        assert_eq!(2_646_829_031_758_483_623, get_hash(&a));
+        assert_eq!(2_646_829_031_758_483_623, get_hash(&a));
     }
 
-    #[test]
-    fn test_random_shuffle() {
-        let a = "Ted";
-        let b = "Ted";
-        let c = get_rand_string();
+    #[test]
+    fn test_random_shuffle() {
+        let a = "Ted";
+        let b = "Ted";
+        let c = get_rand_string();
 
-        assert_eq!(Ordering::Equal, random_shuffle(a, b, &c));
+        assert_eq!(Ordering::Equal, random_shuffle(a, b, &c));
     }
 
-    #[test]
-    fn test_month_compare() {
-        let a = "JaN";
-        let b = "OCt";
+    #[test]
+    fn test_month_compare() {
+        let a = "JaN";
+        let b = "OCt";
 
-        assert_eq!(Ordering::Less, month_compare(a, b));
+        assert_eq!(Ordering::Less, month_compare(a, b));
     }
-    #[test]
-    fn test_version_compare() {
-        let a = "1.2.3-alpha2";
-        let b = "1.4.0";
+    #[test]
+    fn test_version_compare() {
+        let a = "1.2.3-alpha2";
+        let b = "1.4.0";
 
-        assert_eq!(Ordering::Less, version_cmp(a, b));
+        assert_eq!(Ordering::Less, version_cmp(a, b));
     }
 
-    #[test]
-    fn test_random_compare() {
-        let a = "9";
-        let b = "9";
-        let c = get_rand_string();
+    #[test]
+    fn test_random_compare() {
+        let a = "9";
+        let b = "9";
+        let c = get_rand_string();
 
-        assert_eq!(Ordering::Equal, random_shuffle(a, b, &c));
+        assert_eq!(Ordering::Equal, random_shuffle(a, b, &c));
     }
 
-    #[test]
-    fn test_tokenize_fields() {
-        let line = "foo bar b    x";
-        assert_eq!(tokenize_helper(line, None), vec![0..3, 3..7, 7..9, 9..14,],);
+    #[test]
+    fn test_tokenize_fields() {
+        let line = "foo bar b    x";
+        assert_eq!(tokenize_helper(line, None), vec![0..3, 3..7, 7..9, 9..14,],);
     }
 
-    #[test]
-    fn test_tokenize_fields_leading_whitespace() {
-        let line = "    foo bar b    x";
+    #[test]
+    fn test_tokenize_fields_leading_whitespace() {
+        let line = "    foo bar b    x";
         assert_eq!(
-            tokenize_helper(line, None),
+            tokenize_helper(line, None),
             vec![0..7, 7..11, 11..13, 13..18,]
         );
     }
 
-    #[test]
-    fn test_tokenize_fields_custom_separator() {
-        let line = "aaa foo bar b    x";
+    #[test]
+    fn test_tokenize_fields_custom_separator() {
+        let line = "aaa foo bar b    x";
         assert_eq!(
-            tokenize_helper(line, Some('a')),
+            tokenize_helper(line, Some('a')),
             vec![0..0, 1..1, 2..2, 3..9, 10..18,]
         );
     }
 
-    #[test]
-    fn test_tokenize_fields_trailing_custom_separator() {
-        let line = "a";
-        assert_eq!(tokenize_helper(line, Some('a')), vec![0..0]);
-        let line = "aa";
-        assert_eq!(tokenize_helper(line, Some('a')), vec![0..0, 1..1]);
-        let line = "..a..a";
-        assert_eq!(tokenize_helper(line, Some('a')), vec![0..2, 3..5]);
+    #[test]
+    fn test_tokenize_fields_trailing_custom_separator() {
+        let line = "a";
+        assert_eq!(tokenize_helper(line, Some('a')), vec![0..0]);
+        let line = "aa";
+        assert_eq!(tokenize_helper(line, Some('a')), vec![0..0, 1..1]);
+        let line = "..a..a";
+        assert_eq!(tokenize_helper(line, Some('a')), vec![0..2, 3..5]);
     }
 
-    #[test]
-    #[cfg(target_pointer_width = "64")]
-    fn test_line_size() {
-        // We should make sure to not regress the size of the Line struct because
-        // it is unconditional overhead for every line we sort.
-        assert_eq!(std::mem::size_of::<Line>(), 24);
+    #[test]
+    #[cfg(target_pointer_width = "64")]
+    fn test_line_size() {
+        // We should make sure to not regress the size of the Line struct because
+        // it is unconditional overhead for every line we sort.
+        assert_eq!(std::mem::size_of::<Line>(), 24);
     }
 
-    #[test]
-    fn test_parse_byte_count() {
-        let valid_input = [
+    #[test]
+    fn test_parse_byte_count() {
+        let valid_input = [
             ("0", 0),
-            ("50K", 50 * 1024),
-            ("50k", 50 * 1024),
-            ("1M", 1024 * 1024),
-            ("100M", 100 * 1024 * 1024),
-            #[cfg(not(target_pointer_width = "32"))]
-            ("1000G", 1000 * 1024 * 1024 * 1024),
-            #[cfg(not(target_pointer_width = "32"))]
-            ("10T", 10 * 1024 * 1024 * 1024 * 1024),
+            ("50K", 50 * 1024),
+            ("50k", 50 * 1024),
+            ("1M", 1024 * 1024),
+            ("100M", 100 * 1024 * 1024),
+            #[cfg(not(target_pointer_width = "32"))]
+            ("1000G", 1000 * 1024 * 1024 * 1024),
+            #[cfg(not(target_pointer_width = "32"))]
+            ("10T", 10 * 1024 * 1024 * 1024 * 1024),
             ("1b", 1),
             ("1024b", 1024),
-            ("1024Mb", 1024 * 1024 * 1024), // NOTE: This might not be how GNU `sort` behaves for 'Mb'
-            ("1", 1024),                    // K is default
-            ("50", 50 * 1024),
+            ("1024Mb", 1024 * 1024 * 1024), // NOTE: This might not be how GNU `sort` behaves for 'Mb'
+            ("1", 1024),                    // K is default
+            ("50", 50 * 1024),
             ("K", 1024),
             ("k", 1024),
-            ("m", 1024 * 1024),
-            #[cfg(not(target_pointer_width = "32"))]
-            ("E", 1024 * 1024 * 1024 * 1024 * 1024 * 1024),
+            ("m", 1024 * 1024),
+            #[cfg(not(target_pointer_width = "32"))]
+            ("E", 1024 * 1024 * 1024 * 1024 * 1024 * 1024),
         ];
-        for (input, expected_output) in &valid_input {
+        for (input, expected_output) in &valid_input {
             assert_eq!(
-                GlobalSettings::parse_byte_count(input),
-                Ok(*expected_output)
+                GlobalSettings::parse_byte_count(input),
+                Ok(*expected_output)
             );
         }
 
-        // SizeTooBig
-        let invalid_input = ["500E", "1Y"];
-        for input in &invalid_input {
-            #[cfg(not(target_pointer_width = "128"))]
-            assert!(GlobalSettings::parse_byte_count(input).is_err());
+        // SizeTooBig
+        let invalid_input = ["500E", "1Y"];
+        for input in &invalid_input {
+            #[cfg(not(target_pointer_width = "128"))]
+            assert!(GlobalSettings::parse_byte_count(input).is_err());
         }
 
-        // ParseFailure
-        let invalid_input = ["nonsense", "1B", "B", "b", "p", "e", "z", "y"];
-        for input in &invalid_input {
-            assert!(GlobalSettings::parse_byte_count(input).is_err());
+        // ParseFailure
+        let invalid_input = ["nonsense", "1B", "B", "b", "p", "e", "z", "y"];
+        for input in &invalid_input {
+            assert!(GlobalSettings::parse_byte_count(input).is_err());
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sort/tmp_dir.rs.html b/dev/src/uu_sort/tmp_dir.rs.html index 285dbe366..8eb625473 100644 --- a/dev/src/uu_sort/tmp_dir.rs.html +++ b/dev/src/uu_sort/tmp_dir.rs.html @@ -1,4 +1,4 @@ -tmp_dir.rs - source
1
+tmp_dir.rs - source
1
 2
 3
 4
@@ -89,96 +89,96 @@
 89
 90
 91
-
use std::{
-    fs::File,
-    path::{Path, PathBuf},
-    sync::{Arc, Mutex},
+
use std::{
+    fs::File,
+    path::{Path, PathBuf},
+    sync::{Arc, Mutex},
 };
 
-use tempfile::TempDir;
-use uucore::error::{UResult, USimpleError};
+use tempfile::TempDir;
+use uucore::error::{UResult, USimpleError};
 
-use crate::SortError;
+use crate::SortError;
 
-/// A wrapper around TempDir that may only exist once in a process.
-///
-/// `TmpDirWrapper` handles the allocation of new temporary files in this temporary directory and
-/// deleting the whole directory when `SIGINT` is received. Creating a second `TmpDirWrapper` will
-/// fail because `ctrlc::set_handler()` fails when there's already a handler.
-/// The directory is only created once the first file is requested.
-pub struct TmpDirWrapper {
-    temp_dir: Option<TempDir>,
-    parent_path: PathBuf,
-    size: usize,
-    lock: Arc<Mutex<()>>,
+/// A wrapper around TempDir that may only exist once in a process.
+///
+/// `TmpDirWrapper` handles the allocation of new temporary files in this temporary directory and
+/// deleting the whole directory when `SIGINT` is received. Creating a second `TmpDirWrapper` will
+/// fail because `ctrlc::set_handler()` fails when there's already a handler.
+/// The directory is only created once the first file is requested.
+pub struct TmpDirWrapper {
+    temp_dir: Option<TempDir>,
+    parent_path: PathBuf,
+    size: usize,
+    lock: Arc<Mutex<()>>,
 }
 
-impl TmpDirWrapper {
-    pub fn new(path: PathBuf) -> Self {
-        Self {
-            parent_path: path,
-            size: 0,
-            temp_dir: None,
-            lock: Default::default(),
+impl TmpDirWrapper {
+    pub fn new(path: PathBuf) -> Self {
+        Self {
+            parent_path: path,
+            size: 0,
+            temp_dir: None,
+            lock: Default::default(),
         }
     }
 
-    fn init_tmp_dir(&mut self) -> UResult<()> {
-        assert!(self.temp_dir.is_none());
-        assert_eq!(self.size, 0);
-        self.temp_dir = Some(
-            tempfile::Builder::new()
-                .prefix("uutils_sort")
-                .tempdir_in(&self.parent_path)
-                .map_err(|_| SortError::TmpDirCreationFailed)?,
+    fn init_tmp_dir(&mut self) -> UResult<()> {
+        assert!(self.temp_dir.is_none());
+        assert_eq!(self.size, 0);
+        self.temp_dir = Some(
+            tempfile::Builder::new()
+                .prefix("uutils_sort")
+                .tempdir_in(&self.parent_path)
+                .map_err(|_| SortError::TmpDirCreationFailed)?,
         );
 
-        let path = self.temp_dir.as_ref().unwrap().path().to_owned();
-        let lock = self.lock.clone();
-        ctrlc::set_handler(move || {
-            // Take the lock so that `next_file_path` returns no new file path,
-            // and the program doesn't terminate before the handler has finished
-            let _lock = lock.lock().unwrap();
-            if let Err(e) = remove_tmp_dir(&path) {
-                show_error!("failed to delete temporary directory: {}", e);
+        let path = self.temp_dir.as_ref().unwrap().path().to_owned();
+        let lock = self.lock.clone();
+        ctrlc::set_handler(move || {
+            // Take the lock so that `next_file_path` returns no new file path,
+            // and the program doesn't terminate before the handler has finished
+            let _lock = lock.lock().unwrap();
+            if let Err(e) = remove_tmp_dir(&path) {
+                show_error!("failed to delete temporary directory: {}", e);
             }
-            std::process::exit(2)
+            std::process::exit(2)
         })
-        .map_err(|e| USimpleError::new(2, format!("failed to set up signal handler: {}", e)))
+        .map_err(|e| USimpleError::new(2, format!("failed to set up signal handler: {}", e)))
     }
 
-    pub fn next_file(&mut self) -> UResult<(File, PathBuf)> {
-        if self.temp_dir.is_none() {
-            self.init_tmp_dir()?;
+    pub fn next_file(&mut self) -> UResult<(File, PathBuf)> {
+        if self.temp_dir.is_none() {
+            self.init_tmp_dir()?;
         }
 
-        let _lock = self.lock.lock().unwrap();
-        let file_name = self.size.to_string();
-        self.size += 1;
-        let path = self.temp_dir.as_ref().unwrap().path().join(file_name);
+        let _lock = self.lock.lock().unwrap();
+        let file_name = self.size.to_string();
+        self.size += 1;
+        let path = self.temp_dir.as_ref().unwrap().path().join(file_name);
         Ok((
-            File::create(&path).map_err(|error| SortError::OpenTmpFileFailed { error })?,
-            path,
+            File::create(&path).map_err(|error| SortError::OpenTmpFileFailed { error })?,
+            path,
         ))
     }
 
-    /// Function just waits if signal handler was called
-    pub fn wait_if_signal(&self) {
-        let _lock = self.lock.lock().unwrap();
+    /// Function just waits if signal handler was called
+    pub fn wait_if_signal(&self) {
+        let _lock = self.lock.lock().unwrap();
     }
 }
 
-/// Remove the directory at `path` by deleting its child files and then itself.
-/// Errors while deleting child files are ignored.
-fn remove_tmp_dir(path: &Path) -> std::io::Result<()> {
-    if let Ok(read_dir) = std::fs::read_dir(path) {
-        for file in read_dir.flatten() {
-            // if we fail to delete the file here it was probably deleted by another thread
-            // in the meantime, but that's ok.
-            let _ = std::fs::remove_file(file.path());
+/// Remove the directory at `path` by deleting its child files and then itself.
+/// Errors while deleting child files are ignored.
+fn remove_tmp_dir(path: &Path) -> std::io::Result<()> {
+    if let Ok(read_dir) = std::fs::read_dir(path) {
+        for file in read_dir.flatten() {
+            // if we fail to delete the file here it was probably deleted by another thread
+            // in the meantime, but that's ok.
+            let _ = std::fs::remove_file(file.path());
         }
     }
-    std::fs::remove_dir(path)
+    std::fs::remove_dir(path)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_split/filenames.rs.html b/dev/src/uu_split/filenames.rs.html index f34cb292f..2aa330541 100644 --- a/dev/src/uu_split/filenames.rs.html +++ b/dev/src/uu_split/filenames.rs.html @@ -1,4 +1,4 @@ -filenames.rs - source
1
+filenames.rs - source
1
 2
 3
 4
@@ -254,137 +254,137 @@
 254
 255
 256
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore zaaa zaab
-//! Compute filenames from a given index.
-//!
-//! The [`FilenameIterator`] yields filenames for use with ``split``.
-//!
-//! # Examples
-//!
-//! Create filenames of the form `chunk_??.txt`:
-//!
-//! ```rust,ignore
-//! use crate::filenames::FilenameIterator;
-//! use crate::filenames::SuffixType;
-//!
-//! let prefix = "chunk_".to_string();
-//! let suffix = ".txt".to_string();
-//! let width = 2;
-//! let suffix_type = SuffixType::Alphabetic;
-//! let it = FilenameIterator::new(prefix, suffix, width, suffix_type);
-//!
-//! assert_eq!(it.next().unwrap(), "chunk_aa.txt");
-//! assert_eq!(it.next().unwrap(), "chunk_ab.txt");
-//! assert_eq!(it.next().unwrap(), "chunk_ac.txt");
-//! ```
-use crate::number::DynamicWidthNumber;
-use crate::number::FixedWidthNumber;
-use crate::number::Number;
-use uucore::error::{UResult, USimpleError};
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore zaaa zaab
+//! Compute filenames from a given index.
+//!
+//! The [`FilenameIterator`] yields filenames for use with ``split``.
+//!
+//! # Examples
+//!
+//! Create filenames of the form `chunk_??.txt`:
+//!
+//! ```rust,ignore
+//! use crate::filenames::FilenameIterator;
+//! use crate::filenames::SuffixType;
+//!
+//! let prefix = "chunk_".to_string();
+//! let suffix = ".txt".to_string();
+//! let width = 2;
+//! let suffix_type = SuffixType::Alphabetic;
+//! let it = FilenameIterator::new(prefix, suffix, width, suffix_type);
+//!
+//! assert_eq!(it.next().unwrap(), "chunk_aa.txt");
+//! assert_eq!(it.next().unwrap(), "chunk_ab.txt");
+//! assert_eq!(it.next().unwrap(), "chunk_ac.txt");
+//! ```
+use crate::number::DynamicWidthNumber;
+use crate::number::FixedWidthNumber;
+use crate::number::Number;
+use uucore::error::{UResult, USimpleError};
 
-/// The format to use for suffixes in the filename for each output chunk.
-#[derive(Clone, Copy)]
-pub enum SuffixType {
-    /// Lowercase ASCII alphabetic characters.
-    Alphabetic,
+/// The format to use for suffixes in the filename for each output chunk.
+#[derive(Clone, Copy)]
+pub enum SuffixType {
+    /// Lowercase ASCII alphabetic characters.
+    Alphabetic,
 
-    /// Decimal numbers.
-    Decimal,
+    /// Decimal numbers.
+    Decimal,
 
-    /// Hexadecimal numbers.
-    Hexadecimal,
+    /// Hexadecimal numbers.
+    Hexadecimal,
 }
 
-impl SuffixType {
-    /// The radix to use when representing the suffix string as digits.
-    pub fn radix(&self) -> u8 {
-        match self {
-            Self::Alphabetic => 26,
-            Self::Decimal => 10,
-            Self::Hexadecimal => 16,
+impl SuffixType {
+    /// The radix to use when representing the suffix string as digits.
+    pub fn radix(&self) -> u8 {
+        match self {
+            Self::Alphabetic => 26,
+            Self::Decimal => 10,
+            Self::Hexadecimal => 16,
         }
     }
 }
 
-/// Compute filenames from a given index.
-///
-/// This iterator yields filenames for use with ``split``.
-///
-/// The `prefix` is prepended to each filename and the
-/// `additional_suffix1 is appended to each filename.
-///
-/// If `suffix_length` is 0, then the variable portion of the filename
-/// that identifies the current chunk will have a dynamically
-/// increasing width. If `suffix_length` is greater than zero, then
-/// the variable portion of the filename will always be exactly that
-/// width in characters. In that case, after the iterator yields each
-/// string of that width, the iterator is exhausted.
-///
-/// Finally, `suffix_type` controls which type of suffix to produce,
-/// alphabetic or numeric.
-///
-/// # Examples
-///
-/// Create filenames of the form `chunk_??.txt`, where the `?`
-/// characters are lowercase ASCII alphabetic characters:
-///
-/// ```rust,ignore
-/// use crate::filenames::FilenameIterator;
-/// use crate::filenames::SuffixType;
-///
-/// let prefix = "chunk_".to_string();
-/// let suffix = ".txt".to_string();
-/// let width = 2;
-/// let suffix_type = SuffixType::Alphabetic;
-/// let it = FilenameIterator::new(prefix, suffix, width, suffix_type);
-///
-/// assert_eq!(it.next().unwrap(), "chunk_aa.txt");
-/// assert_eq!(it.next().unwrap(), "chunk_ab.txt");
-/// assert_eq!(it.next().unwrap(), "chunk_ac.txt");
-/// ```
-///
-/// For decimal numeric filenames, use `SuffixType::Decimal`:
-///
-/// ```rust,ignore
-/// use crate::filenames::FilenameIterator;
-/// use crate::filenames::SuffixType;
-///
-/// let prefix = "chunk_".to_string();
-/// let suffix = ".txt".to_string();
-/// let width = 2;
-/// let suffix_type = SuffixType::Decimal;
-/// let it = FilenameIterator::new(prefix, suffix, width, suffix_type);
-///
-/// assert_eq!(it.next().unwrap(), "chunk_00.txt");
-/// assert_eq!(it.next().unwrap(), "chunk_01.txt");
-/// assert_eq!(it.next().unwrap(), "chunk_02.txt");
-/// ```
-pub struct FilenameIterator<'a> {
-    additional_suffix: &'a str,
-    prefix: &'a str,
-    number: Number,
-    first_iteration: bool,
+/// Compute filenames from a given index.
+///
+/// This iterator yields filenames for use with ``split``.
+///
+/// The `prefix` is prepended to each filename and the
+/// `additional_suffix1 is appended to each filename.
+///
+/// If `suffix_length` is 0, then the variable portion of the filename
+/// that identifies the current chunk will have a dynamically
+/// increasing width. If `suffix_length` is greater than zero, then
+/// the variable portion of the filename will always be exactly that
+/// width in characters. In that case, after the iterator yields each
+/// string of that width, the iterator is exhausted.
+///
+/// Finally, `suffix_type` controls which type of suffix to produce,
+/// alphabetic or numeric.
+///
+/// # Examples
+///
+/// Create filenames of the form `chunk_??.txt`, where the `?`
+/// characters are lowercase ASCII alphabetic characters:
+///
+/// ```rust,ignore
+/// use crate::filenames::FilenameIterator;
+/// use crate::filenames::SuffixType;
+///
+/// let prefix = "chunk_".to_string();
+/// let suffix = ".txt".to_string();
+/// let width = 2;
+/// let suffix_type = SuffixType::Alphabetic;
+/// let it = FilenameIterator::new(prefix, suffix, width, suffix_type);
+///
+/// assert_eq!(it.next().unwrap(), "chunk_aa.txt");
+/// assert_eq!(it.next().unwrap(), "chunk_ab.txt");
+/// assert_eq!(it.next().unwrap(), "chunk_ac.txt");
+/// ```
+///
+/// For decimal numeric filenames, use `SuffixType::Decimal`:
+///
+/// ```rust,ignore
+/// use crate::filenames::FilenameIterator;
+/// use crate::filenames::SuffixType;
+///
+/// let prefix = "chunk_".to_string();
+/// let suffix = ".txt".to_string();
+/// let width = 2;
+/// let suffix_type = SuffixType::Decimal;
+/// let it = FilenameIterator::new(prefix, suffix, width, suffix_type);
+///
+/// assert_eq!(it.next().unwrap(), "chunk_00.txt");
+/// assert_eq!(it.next().unwrap(), "chunk_01.txt");
+/// assert_eq!(it.next().unwrap(), "chunk_02.txt");
+/// ```
+pub struct FilenameIterator<'a> {
+    additional_suffix: &'a str,
+    prefix: &'a str,
+    number: Number,
+    first_iteration: bool,
 }
 
-impl<'a> FilenameIterator<'a> {
-    pub fn new(
-        prefix: &'a str,
-        additional_suffix: &'a str,
-        suffix_length: usize,
-        suffix_type: SuffixType,
-        suffix_start: usize,
-    ) -> UResult<FilenameIterator<'a>> {
-        let radix = suffix_type.radix();
-        let number = if suffix_length == 0 {
-            Number::DynamicWidth(DynamicWidthNumber::new(radix, suffix_start))
-        } else {
-            Number::FixedWidth(
-                FixedWidthNumber::new(radix, suffix_length, suffix_start).map_err(|_| {
-                    USimpleError::new(
+impl<'a> FilenameIterator<'a> {
+    pub fn new(
+        prefix: &'a str,
+        additional_suffix: &'a str,
+        suffix_length: usize,
+        suffix_type: SuffixType,
+        suffix_start: usize,
+    ) -> UResult<FilenameIterator<'a>> {
+        let radix = suffix_type.radix();
+        let number = if suffix_length == 0 {
+            Number::DynamicWidth(DynamicWidthNumber::new(radix, suffix_start))
+        } else {
+            Number::FixedWidth(
+                FixedWidthNumber::new(radix, suffix_length, suffix_start).map_err(|_| {
+                    USimpleError::new(
                         1,
                         "numerical suffix start value is too large for the suffix length",
                     )
@@ -392,123 +392,123 @@
             )
         };
 
-        Ok(FilenameIterator {
-            prefix,
-            additional_suffix,
-            number,
-            first_iteration: true,
+        Ok(FilenameIterator {
+            prefix,
+            additional_suffix,
+            number,
+            first_iteration: true,
         })
     }
 }
 
-impl<'a> Iterator for FilenameIterator<'a> {
-    type Item = String;
+impl<'a> Iterator for FilenameIterator<'a> {
+    type Item = String;
 
-    fn next(&mut self) -> Option<Self::Item> {
-        if self.first_iteration {
-            self.first_iteration = false;
-        } else {
-            self.number.increment().ok()?;
+    fn next(&mut self) -> Option<Self::Item> {
+        if self.first_iteration {
+            self.first_iteration = false;
+        } else {
+            self.number.increment().ok()?;
         }
-        // The first and third parts are just taken directly from the
-        // struct parameters unchanged.
-        Some(format!(
+        // The first and third parts are just taken directly from the
+        // struct parameters unchanged.
+        Some(format!(
             "{}{}{}",
-            self.prefix, self.number, self.additional_suffix
+            self.prefix, self.number, self.additional_suffix
         ))
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use crate::filenames::FilenameIterator;
-    use crate::filenames::SuffixType;
+    use crate::filenames::FilenameIterator;
+    use crate::filenames::SuffixType;
 
-    #[test]
-    fn test_filename_iterator_alphabetic_fixed_width() {
-        let mut it = FilenameIterator::new("chunk_", ".txt", 2, SuffixType::Alphabetic, 0).unwrap();
-        assert_eq!(it.next().unwrap(), "chunk_aa.txt");
-        assert_eq!(it.next().unwrap(), "chunk_ab.txt");
-        assert_eq!(it.next().unwrap(), "chunk_ac.txt");
+    #[test]
+    fn test_filename_iterator_alphabetic_fixed_width() {
+        let mut it = FilenameIterator::new("chunk_", ".txt", 2, SuffixType::Alphabetic, 0).unwrap();
+        assert_eq!(it.next().unwrap(), "chunk_aa.txt");
+        assert_eq!(it.next().unwrap(), "chunk_ab.txt");
+        assert_eq!(it.next().unwrap(), "chunk_ac.txt");
 
-        let mut it = FilenameIterator::new("chunk_", ".txt", 2, SuffixType::Alphabetic, 0).unwrap();
-        assert_eq!(it.nth(26 * 26 - 1).unwrap(), "chunk_zz.txt");
-        assert_eq!(it.next(), None);
+        let mut it = FilenameIterator::new("chunk_", ".txt", 2, SuffixType::Alphabetic, 0).unwrap();
+        assert_eq!(it.nth(26 * 26 - 1).unwrap(), "chunk_zz.txt");
+        assert_eq!(it.next(), None);
     }
 
-    #[test]
-    fn test_filename_iterator_numeric_fixed_width() {
-        let mut it = FilenameIterator::new("chunk_", ".txt", 2, SuffixType::Decimal, 0).unwrap();
-        assert_eq!(it.next().unwrap(), "chunk_00.txt");
-        assert_eq!(it.next().unwrap(), "chunk_01.txt");
-        assert_eq!(it.next().unwrap(), "chunk_02.txt");
+    #[test]
+    fn test_filename_iterator_numeric_fixed_width() {
+        let mut it = FilenameIterator::new("chunk_", ".txt", 2, SuffixType::Decimal, 0).unwrap();
+        assert_eq!(it.next().unwrap(), "chunk_00.txt");
+        assert_eq!(it.next().unwrap(), "chunk_01.txt");
+        assert_eq!(it.next().unwrap(), "chunk_02.txt");
 
-        let mut it = FilenameIterator::new("chunk_", ".txt", 2, SuffixType::Decimal, 0).unwrap();
-        assert_eq!(it.nth(10 * 10 - 1).unwrap(), "chunk_99.txt");
-        assert_eq!(it.next(), None);
+        let mut it = FilenameIterator::new("chunk_", ".txt", 2, SuffixType::Decimal, 0).unwrap();
+        assert_eq!(it.nth(10 * 10 - 1).unwrap(), "chunk_99.txt");
+        assert_eq!(it.next(), None);
     }
 
-    #[test]
-    fn test_filename_iterator_alphabetic_dynamic_width() {
-        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Alphabetic, 0).unwrap();
-        assert_eq!(it.next().unwrap(), "chunk_aa.txt");
-        assert_eq!(it.next().unwrap(), "chunk_ab.txt");
-        assert_eq!(it.next().unwrap(), "chunk_ac.txt");
+    #[test]
+    fn test_filename_iterator_alphabetic_dynamic_width() {
+        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Alphabetic, 0).unwrap();
+        assert_eq!(it.next().unwrap(), "chunk_aa.txt");
+        assert_eq!(it.next().unwrap(), "chunk_ab.txt");
+        assert_eq!(it.next().unwrap(), "chunk_ac.txt");
 
-        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Alphabetic, 0).unwrap();
-        assert_eq!(it.nth(26 * 25 - 1).unwrap(), "chunk_yz.txt");
-        assert_eq!(it.next().unwrap(), "chunk_zaaa.txt");
-        assert_eq!(it.next().unwrap(), "chunk_zaab.txt");
+        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Alphabetic, 0).unwrap();
+        assert_eq!(it.nth(26 * 25 - 1).unwrap(), "chunk_yz.txt");
+        assert_eq!(it.next().unwrap(), "chunk_zaaa.txt");
+        assert_eq!(it.next().unwrap(), "chunk_zaab.txt");
     }
 
-    #[test]
-    fn test_filename_iterator_numeric_dynamic_width() {
-        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Decimal, 0).unwrap();
-        assert_eq!(it.next().unwrap(), "chunk_00.txt");
-        assert_eq!(it.next().unwrap(), "chunk_01.txt");
-        assert_eq!(it.next().unwrap(), "chunk_02.txt");
+    #[test]
+    fn test_filename_iterator_numeric_dynamic_width() {
+        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Decimal, 0).unwrap();
+        assert_eq!(it.next().unwrap(), "chunk_00.txt");
+        assert_eq!(it.next().unwrap(), "chunk_01.txt");
+        assert_eq!(it.next().unwrap(), "chunk_02.txt");
 
-        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Decimal, 0).unwrap();
-        assert_eq!(it.nth(10 * 9 - 1).unwrap(), "chunk_89.txt");
-        assert_eq!(it.next().unwrap(), "chunk_9000.txt");
-        assert_eq!(it.next().unwrap(), "chunk_9001.txt");
+        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Decimal, 0).unwrap();
+        assert_eq!(it.nth(10 * 9 - 1).unwrap(), "chunk_89.txt");
+        assert_eq!(it.next().unwrap(), "chunk_9000.txt");
+        assert_eq!(it.next().unwrap(), "chunk_9001.txt");
     }
 
-    #[test]
-    fn test_filename_iterator_numeric_suffix_decimal() {
-        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Decimal, 5).unwrap();
-        assert_eq!(it.next().unwrap(), "chunk_05.txt");
-        assert_eq!(it.next().unwrap(), "chunk_06.txt");
-        assert_eq!(it.next().unwrap(), "chunk_07.txt");
+    #[test]
+    fn test_filename_iterator_numeric_suffix_decimal() {
+        let mut it = FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Decimal, 5).unwrap();
+        assert_eq!(it.next().unwrap(), "chunk_05.txt");
+        assert_eq!(it.next().unwrap(), "chunk_06.txt");
+        assert_eq!(it.next().unwrap(), "chunk_07.txt");
     }
 
-    #[test]
-    fn test_filename_iterator_numeric_suffix_hex() {
-        let mut it =
-            FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Hexadecimal, 9).unwrap();
-        assert_eq!(it.next().unwrap(), "chunk_09.txt");
-        assert_eq!(it.next().unwrap(), "chunk_0a.txt");
-        assert_eq!(it.next().unwrap(), "chunk_0b.txt");
+    #[test]
+    fn test_filename_iterator_numeric_suffix_hex() {
+        let mut it =
+            FilenameIterator::new("chunk_", ".txt", 0, SuffixType::Hexadecimal, 9).unwrap();
+        assert_eq!(it.next().unwrap(), "chunk_09.txt");
+        assert_eq!(it.next().unwrap(), "chunk_0a.txt");
+        assert_eq!(it.next().unwrap(), "chunk_0b.txt");
     }
 
-    #[test]
-    fn test_filename_iterator_numeric_suffix_err() {
-        let mut it = FilenameIterator::new("chunk_", ".txt", 3, SuffixType::Decimal, 999).unwrap();
-        assert_eq!(it.next().unwrap(), "chunk_999.txt");
-        assert!(it.next().is_none());
+    #[test]
+    fn test_filename_iterator_numeric_suffix_err() {
+        let mut it = FilenameIterator::new("chunk_", ".txt", 3, SuffixType::Decimal, 999).unwrap();
+        assert_eq!(it.next().unwrap(), "chunk_999.txt");
+        assert!(it.next().is_none());
 
-        let it = FilenameIterator::new("chunk_", ".txt", 3, SuffixType::Decimal, 1000);
-        assert!(it.is_err());
+        let it = FilenameIterator::new("chunk_", ".txt", 3, SuffixType::Decimal, 1000);
+        assert!(it.is_err());
 
-        let mut it =
-            FilenameIterator::new("chunk_", ".txt", 3, SuffixType::Hexadecimal, 0xfff).unwrap();
-        assert_eq!(it.next().unwrap(), "chunk_fff.txt");
-        assert!(it.next().is_none());
+        let mut it =
+            FilenameIterator::new("chunk_", ".txt", 3, SuffixType::Hexadecimal, 0xfff).unwrap();
+        assert_eq!(it.next().unwrap(), "chunk_fff.txt");
+        assert!(it.next().is_none());
 
-        let it = FilenameIterator::new("chunk_", ".txt", 3, SuffixType::Hexadecimal, 0x1000);
-        assert!(it.is_err());
+        let it = FilenameIterator::new("chunk_", ".txt", 3, SuffixType::Hexadecimal, 0x1000);
+        assert!(it.is_err());
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_split/number.rs.html b/dev/src/uu_split/number.rs.html index baa3a5e81..8c971f413 100644 --- a/dev/src/uu_split/number.rs.html +++ b/dev/src/uu_split/number.rs.html @@ -1,4 +1,4 @@ -number.rs - source
1
+number.rs - source
1
 2
 3
 4
@@ -580,587 +580,587 @@
 580
 581
 582
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore zaaa zaab
-//! A number in arbitrary radix expressed in a positional notation.
-//!
-//! Use the [`Number`] enum to represent an arbitrary number in an
-//! arbitrary radix. A number can be incremented and can be
-//! displayed. See the [`Number`] documentation for more information.
-//!
-//! See the Wikipedia articles on [radix] and [positional notation]
-//! for more background information on those topics.
-//!
-//! [radix]: https://en.wikipedia.org/wiki/Radix
-//! [positional notation]: https://en.wikipedia.org/wiki/Positional_notation
-use std::error::Error;
-use std::fmt::{self, Display, Formatter};
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore zaaa zaab
+//! A number in arbitrary radix expressed in a positional notation.
+//!
+//! Use the [`Number`] enum to represent an arbitrary number in an
+//! arbitrary radix. A number can be incremented and can be
+//! displayed. See the [`Number`] documentation for more information.
+//!
+//! See the Wikipedia articles on [radix] and [positional notation]
+//! for more background information on those topics.
+//!
+//! [radix]: https://en.wikipedia.org/wiki/Radix
+//! [positional notation]: https://en.wikipedia.org/wiki/Positional_notation
+use std::error::Error;
+use std::fmt::{self, Display, Formatter};
 
-/// An overflow due to incrementing a number beyond its representable limit.
-#[derive(Debug)]
-pub struct Overflow;
+/// An overflow due to incrementing a number beyond its representable limit.
+#[derive(Debug)]
+pub struct Overflow;
 
-impl fmt::Display for Overflow {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "Overflow")
+impl fmt::Display for Overflow {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "Overflow")
     }
 }
 
-impl Error for Overflow {}
+impl Error for Overflow {}
 
-/// A number in arbitrary radix expressed in a positional notation.
-///
-/// Use the [`Number`] enum to represent an arbitrary number in an
-/// arbitrary radix. A number can be incremented with
-/// [`Number::increment`].  The [`FixedWidthNumber`] overflows when
-/// attempting to increment it beyond the maximum number that can be
-/// represented in the specified width. The [`DynamicWidthNumber`]
-/// follows a non-standard incrementing procedure that is used
-/// specifically for the `split` program. See the
-/// [`DynamicWidthNumber`] documentation for more information.
-///
-/// Numbers of radix
-///
-/// * 10 are displayable and rendered as decimal numbers (for example,
-///   "00" or "917"),
-/// * 16 are displayable and rendered as hexadecimal numbers (for example,
-///   "00" or "e7f"),
-/// * 26 are displayable and rendered as lowercase ASCII alphabetic
-///   characters (for example, "aa" or "zax").
-///
-/// Numbers of other radices cannot be displayed. The display of a
-/// [`DynamicWidthNumber`] includes a prefix whose length depends on
-/// the width of the number. See the [`DynamicWidthNumber`]
-/// documentation for more information.
-///
-/// The digits of a number are accessible via the [`Number::digits`]
-/// method. The digits are represented as a [`Vec<u8>`] with the most
-/// significant digit on the left and the least significant digit on
-/// the right. Each digit is a nonnegative integer less than the
-/// radix. For example, if the radix is 3, then `vec![1, 0, 2]`
-/// represents the decimal number 11:
-///
-/// ```ignore
-/// 1 * 3^2 + 0 * 3^1 + 2 * 3^0 = 9 + 0 + 2 = 11
-/// ```
-///
-/// For the [`DynamicWidthNumber`], the digits are not unique in the
-/// sense that repeatedly incrementing the number will eventually
-/// yield `vec![0, 0]`, `vec![0, 0, 0], `vec![0, 0, 0, 0]`, etc.
-/// That's okay because each of these numbers will be displayed
-/// differently and we only intend to use these numbers for display
-/// purposes and not for mathematical purposes.
-#[derive(Clone)]
-pub enum Number {
-    /// A fixed-width representation of a number.
-    FixedWidth(FixedWidthNumber),
+/// A number in arbitrary radix expressed in a positional notation.
+///
+/// Use the [`Number`] enum to represent an arbitrary number in an
+/// arbitrary radix. A number can be incremented with
+/// [`Number::increment`].  The [`FixedWidthNumber`] overflows when
+/// attempting to increment it beyond the maximum number that can be
+/// represented in the specified width. The [`DynamicWidthNumber`]
+/// follows a non-standard incrementing procedure that is used
+/// specifically for the `split` program. See the
+/// [`DynamicWidthNumber`] documentation for more information.
+///
+/// Numbers of radix
+///
+/// * 10 are displayable and rendered as decimal numbers (for example,
+///   "00" or "917"),
+/// * 16 are displayable and rendered as hexadecimal numbers (for example,
+///   "00" or "e7f"),
+/// * 26 are displayable and rendered as lowercase ASCII alphabetic
+///   characters (for example, "aa" or "zax").
+///
+/// Numbers of other radices cannot be displayed. The display of a
+/// [`DynamicWidthNumber`] includes a prefix whose length depends on
+/// the width of the number. See the [`DynamicWidthNumber`]
+/// documentation for more information.
+///
+/// The digits of a number are accessible via the [`Number::digits`]
+/// method. The digits are represented as a [`Vec<u8>`] with the most
+/// significant digit on the left and the least significant digit on
+/// the right. Each digit is a nonnegative integer less than the
+/// radix. For example, if the radix is 3, then `vec![1, 0, 2]`
+/// represents the decimal number 11:
+///
+/// ```ignore
+/// 1 * 3^2 + 0 * 3^1 + 2 * 3^0 = 9 + 0 + 2 = 11
+/// ```
+///
+/// For the [`DynamicWidthNumber`], the digits are not unique in the
+/// sense that repeatedly incrementing the number will eventually
+/// yield `vec![0, 0]`, `vec![0, 0, 0], `vec![0, 0, 0, 0]`, etc.
+/// That's okay because each of these numbers will be displayed
+/// differently and we only intend to use these numbers for display
+/// purposes and not for mathematical purposes.
+#[derive(Clone)]
+pub enum Number {
+    /// A fixed-width representation of a number.
+    FixedWidth(FixedWidthNumber),
 
-    /// A representation of a number with a dynamically growing width.
-    DynamicWidth(DynamicWidthNumber),
+    /// A representation of a number with a dynamically growing width.
+    DynamicWidth(DynamicWidthNumber),
 }
 
-impl Number {
-    /// The digits of this number in decreasing order of significance.
-    ///
-    /// The digits are represented as a [`Vec<u8>`] with the most
-    /// significant digit on the left and the least significant digit
-    /// on the right. Each digit is a nonnegative integer less than
-    /// the radix. For example, if the radix is 3, then `vec![1, 0,
-    /// 2]` represents the decimal number 11:
-    ///
-    /// ```ignore
-    /// 1 * 3^2 + 0 * 3^1 + 2 * 3^0 = 9 + 0 + 2 = 11
-    /// ```
-    ///
-    /// For the [`DynamicWidthNumber`], the digits are not unique in the
-    /// sense that repeatedly incrementing the number will eventually
-    /// yield `vec![0, 0]`, `vec![0, 0, 0], `vec![0, 0, 0, 0]`, etc.
-    /// That's okay because each of these numbers will be displayed
-    /// differently and we only intend to use these numbers for display
-    /// purposes and not for mathematical purposes.
-    #[allow(dead_code)]
-    fn digits(&self) -> Vec<u8> {
-        match self {
-            Self::FixedWidth(number) => number.digits.clone(),
-            Self::DynamicWidth(number) => number.digits(),
+impl Number {
+    /// The digits of this number in decreasing order of significance.
+    ///
+    /// The digits are represented as a [`Vec<u8>`] with the most
+    /// significant digit on the left and the least significant digit
+    /// on the right. Each digit is a nonnegative integer less than
+    /// the radix. For example, if the radix is 3, then `vec![1, 0,
+    /// 2]` represents the decimal number 11:
+    ///
+    /// ```ignore
+    /// 1 * 3^2 + 0 * 3^1 + 2 * 3^0 = 9 + 0 + 2 = 11
+    /// ```
+    ///
+    /// For the [`DynamicWidthNumber`], the digits are not unique in the
+    /// sense that repeatedly incrementing the number will eventually
+    /// yield `vec![0, 0]`, `vec![0, 0, 0], `vec![0, 0, 0, 0]`, etc.
+    /// That's okay because each of these numbers will be displayed
+    /// differently and we only intend to use these numbers for display
+    /// purposes and not for mathematical purposes.
+    #[allow(dead_code)]
+    fn digits(&self) -> Vec<u8> {
+        match self {
+            Self::FixedWidth(number) => number.digits.clone(),
+            Self::DynamicWidth(number) => number.digits(),
         }
     }
 
-    /// Increment this number to its successor.
-    ///
-    /// If incrementing this number would result in an overflow beyond
-    /// the maximum representable number, then return
-    /// [`Err(Overflow)`]. The [`FixedWidthNumber`] overflows, but
-    /// [`DynamicWidthNumber`] does not.
-    ///
-    /// The [`DynamicWidthNumber`] follows a non-standard incrementing
-    /// procedure that is used specifically for the `split` program.
-    /// See the [`DynamicWidthNumber`] documentation for more
-    /// information.
-    ///
-    /// # Errors
-    ///
-    /// This method returns [`Err(Overflow)`] when attempting to
-    /// increment beyond the largest representable number.
-    ///
-    /// # Examples
-    ///
-    /// Overflowing:
-    ///
-    /// ```rust,ignore
-    ///
-    /// use crate::number::FixedWidthNumber;
-    /// use crate::number::Number;
-    /// use crate::number::Overflow;
-    ///
-    /// // Radix 3, width of 1 digit.
-    /// let mut number = Number::FixedWidth(FixedWidthNumber::new(3, 1));
-    /// number.increment().unwrap();  // from 0 to 1
-    /// number.increment().unwrap();  // from 1 to 2
-    /// assert!(number.increment().is_err());
-    /// ```
-    pub fn increment(&mut self) -> Result<(), Overflow> {
-        match self {
-            Self::FixedWidth(number) => number.increment(),
-            Self::DynamicWidth(number) => number.increment(),
+    /// Increment this number to its successor.
+    ///
+    /// If incrementing this number would result in an overflow beyond
+    /// the maximum representable number, then return
+    /// [`Err(Overflow)`]. The [`FixedWidthNumber`] overflows, but
+    /// [`DynamicWidthNumber`] does not.
+    ///
+    /// The [`DynamicWidthNumber`] follows a non-standard incrementing
+    /// procedure that is used specifically for the `split` program.
+    /// See the [`DynamicWidthNumber`] documentation for more
+    /// information.
+    ///
+    /// # Errors
+    ///
+    /// This method returns [`Err(Overflow)`] when attempting to
+    /// increment beyond the largest representable number.
+    ///
+    /// # Examples
+    ///
+    /// Overflowing:
+    ///
+    /// ```rust,ignore
+    ///
+    /// use crate::number::FixedWidthNumber;
+    /// use crate::number::Number;
+    /// use crate::number::Overflow;
+    ///
+    /// // Radix 3, width of 1 digit.
+    /// let mut number = Number::FixedWidth(FixedWidthNumber::new(3, 1));
+    /// number.increment().unwrap();  // from 0 to 1
+    /// number.increment().unwrap();  // from 1 to 2
+    /// assert!(number.increment().is_err());
+    /// ```
+    pub fn increment(&mut self) -> Result<(), Overflow> {
+        match self {
+            Self::FixedWidth(number) => number.increment(),
+            Self::DynamicWidth(number) => number.increment(),
         }
     }
 }
 
-impl Display for Number {
-    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
-        match self {
-            Self::FixedWidth(number) => number.fmt(f),
-            Self::DynamicWidth(number) => number.fmt(f),
+impl Display for Number {
+    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+        match self {
+            Self::FixedWidth(number) => number.fmt(f),
+            Self::DynamicWidth(number) => number.fmt(f),
         }
     }
 }
 
-/// A positional notation representation of a fixed-width number.
-///
-/// The digits are represented as a [`Vec<u8>`] with the most
-/// significant digit on the left and the least significant digit on
-/// the right. Each digit is a nonnegative integer less than the
-/// radix.
-///
-/// # Incrementing
-///
-/// This number starts at `vec![0; width]`, representing the number 0
-/// width the specified number of digits. Incrementing this number
-/// with [`Number::increment`] causes it to increase its value by 1 in
-/// the usual sense. If the digits are `vec![radix - 1; width]`, then
-/// an overflow would occur and the [`Number::increment`] method
-/// returns an error.
-///
-/// # Displaying
-///
-/// This number is only displayable if `radix` is 10, 16, or 26. If
-/// `radix` is 10 or 16, then the digits are concatenated and
-/// displayed as a fixed-width decimal or hexadecimal number,
-/// respectively. If `radix` is 26, then each digit is translated to
-/// the corresponding lowercase ASCII alphabetic character (that is,
-/// 'a', 'b', 'c', etc.) and concatenated.
-#[derive(Clone)]
-pub struct FixedWidthNumber {
-    radix: u8,
-    digits: Vec<u8>,
+/// A positional notation representation of a fixed-width number.
+///
+/// The digits are represented as a [`Vec<u8>`] with the most
+/// significant digit on the left and the least significant digit on
+/// the right. Each digit is a nonnegative integer less than the
+/// radix.
+///
+/// # Incrementing
+///
+/// This number starts at `vec![0; width]`, representing the number 0
+/// width the specified number of digits. Incrementing this number
+/// with [`Number::increment`] causes it to increase its value by 1 in
+/// the usual sense. If the digits are `vec![radix - 1; width]`, then
+/// an overflow would occur and the [`Number::increment`] method
+/// returns an error.
+///
+/// # Displaying
+///
+/// This number is only displayable if `radix` is 10, 16, or 26. If
+/// `radix` is 10 or 16, then the digits are concatenated and
+/// displayed as a fixed-width decimal or hexadecimal number,
+/// respectively. If `radix` is 26, then each digit is translated to
+/// the corresponding lowercase ASCII alphabetic character (that is,
+/// 'a', 'b', 'c', etc.) and concatenated.
+#[derive(Clone)]
+pub struct FixedWidthNumber {
+    radix: u8,
+    digits: Vec<u8>,
 }
 
-impl FixedWidthNumber {
-    /// Instantiate a number of the given radix and width.
-    pub fn new(radix: u8, width: usize, mut suffix_start: usize) -> Result<Self, Overflow> {
-        let mut digits = vec![0_u8; width];
+impl FixedWidthNumber {
+    /// Instantiate a number of the given radix and width.
+    pub fn new(radix: u8, width: usize, mut suffix_start: usize) -> Result<Self, Overflow> {
+        let mut digits = vec![0_u8; width];
 
-        for i in (0..digits.len()).rev() {
-            let remainder = (suffix_start % (radix as usize)) as u8;
-            suffix_start /= radix as usize;
-            digits[i] = remainder;
-            if suffix_start == 0 {
+        for i in (0..digits.len()).rev() {
+            let remainder = (suffix_start % (radix as usize)) as u8;
+            suffix_start /= radix as usize;
+            digits[i] = remainder;
+            if suffix_start == 0 {
                 break;
             }
         }
-        if suffix_start != 0 {
-            Err(Overflow)
-        } else {
-            Ok(Self { radix, digits })
+        if suffix_start != 0 {
+            Err(Overflow)
+        } else {
+            Ok(Self { radix, digits })
         }
     }
 
-    /// Increment this number.
-    ///
-    /// This method adds one to this number. If incrementing this
-    /// number would require more digits than are available with the
-    /// specified width, then this method returns [`Err(Overflow)`].
-    fn increment(&mut self) -> Result<(), Overflow> {
-        for i in (0..self.digits.len()).rev() {
-            // Increment the current digit.
-            self.digits[i] += 1;
+    /// Increment this number.
+    ///
+    /// This method adds one to this number. If incrementing this
+    /// number would require more digits than are available with the
+    /// specified width, then this method returns [`Err(Overflow)`].
+    fn increment(&mut self) -> Result<(), Overflow> {
+        for i in (0..self.digits.len()).rev() {
+            // Increment the current digit.
+            self.digits[i] += 1;
 
-            // If the digit overflows, then set it to 0 and continue
-            // to the next iteration to increment the next most
-            // significant digit. Otherwise, terminate the loop, since
-            // there will be no further changes to any higher order
-            // digits.
-            if self.digits[i] == self.radix {
-                self.digits[i] = 0;
-            } else {
+            // If the digit overflows, then set it to 0 and continue
+            // to the next iteration to increment the next most
+            // significant digit. Otherwise, terminate the loop, since
+            // there will be no further changes to any higher order
+            // digits.
+            if self.digits[i] == self.radix {
+                self.digits[i] = 0;
+            } else {
                 break;
             }
         }
 
-        // Return an error on overflow, which is signified by all zeros.
-        if self.digits == vec![0; self.digits.len()] {
-            Err(Overflow)
-        } else {
+        // Return an error on overflow, which is signified by all zeros.
+        if self.digits == vec![0; self.digits.len()] {
+            Err(Overflow)
+        } else {
             Ok(())
         }
     }
 }
 
-impl Display for FixedWidthNumber {
-    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
-        let digits: String = self
-            .digits
-            .iter()
-            .map(|d| map_digit(self.radix, *d))
-            .collect();
-        write!(f, "{}", digits)
+impl Display for FixedWidthNumber {
+    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+        let digits: String = self
+            .digits
+            .iter()
+            .map(|d| map_digit(self.radix, *d))
+            .collect();
+        write!(f, "{}", digits)
     }
 }
 
-/// A positional notation representation of a number of dynamically growing width.
-///
-/// The digits are represented as a [`Vec<u8>`] with the most
-/// significant digit on the left and the least significant digit on
-/// the right. Each digit is a nonnegative integer less than the
-/// radix.
-///
-/// # Incrementing
-///
-/// This number starts at `vec![0, 0]`, representing the number 0 with
-/// a width of 2 digits. Incrementing this number with
-/// [`Number::increment`] causes it to increase its value by 1. When
-/// incrementing the number would have caused it to change from
-/// `vec![radix - 2, radix - 1]` to `vec![radix - 1, 0]`, it instead
-/// increases its width by one and resets its value to 0. For example,
-/// if the radix were 3, the digits were `vec![1, 2]`, and we called
-/// [`Number::increment`], then the digits would become `vec![0, 0,
-/// 0]`. In this way, the width grows by one each time the most
-/// significant digit would have achieved its maximum value.
-///
-/// This notion of "incrementing" here does not match the notion of
-/// incrementing the *value* of the number, it is just an abstract way
-/// of updating the representation of the number in a way that is only
-/// useful for the purposes of the `split` program.
-///
-/// # Displaying
-///
-/// This number is only displayable if `radix` is 10, 16, or 26. If
-/// `radix` is 10 or 16, then the digits are concatenated and
-/// displayed as a fixed-width decimal or hexadecimal number,
-/// respectively, with a prefix of `n - 2` instances of the character
-/// '9' of 'f', respectively, where `n` is the number of digits.  If
-/// `radix` is 26, then each digit is translated to the corresponding
-/// lowercase ASCII alphabetic character (that is, 'a', 'b', 'c',
-/// etc.) and concatenated with a prefix of `n - 2` instances of the
-/// character 'z'.
-///
-/// This notion of displaying the number is specific to the `split`
-/// program.
-#[derive(Clone)]
-pub struct DynamicWidthNumber {
-    radix: u8,
-    current: usize,
+/// A positional notation representation of a number of dynamically growing width.
+///
+/// The digits are represented as a [`Vec<u8>`] with the most
+/// significant digit on the left and the least significant digit on
+/// the right. Each digit is a nonnegative integer less than the
+/// radix.
+///
+/// # Incrementing
+///
+/// This number starts at `vec![0, 0]`, representing the number 0 with
+/// a width of 2 digits. Incrementing this number with
+/// [`Number::increment`] causes it to increase its value by 1. When
+/// incrementing the number would have caused it to change from
+/// `vec![radix - 2, radix - 1]` to `vec![radix - 1, 0]`, it instead
+/// increases its width by one and resets its value to 0. For example,
+/// if the radix were 3, the digits were `vec![1, 2]`, and we called
+/// [`Number::increment`], then the digits would become `vec![0, 0,
+/// 0]`. In this way, the width grows by one each time the most
+/// significant digit would have achieved its maximum value.
+///
+/// This notion of "incrementing" here does not match the notion of
+/// incrementing the *value* of the number, it is just an abstract way
+/// of updating the representation of the number in a way that is only
+/// useful for the purposes of the `split` program.
+///
+/// # Displaying
+///
+/// This number is only displayable if `radix` is 10, 16, or 26. If
+/// `radix` is 10 or 16, then the digits are concatenated and
+/// displayed as a fixed-width decimal or hexadecimal number,
+/// respectively, with a prefix of `n - 2` instances of the character
+/// '9' of 'f', respectively, where `n` is the number of digits.  If
+/// `radix` is 26, then each digit is translated to the corresponding
+/// lowercase ASCII alphabetic character (that is, 'a', 'b', 'c',
+/// etc.) and concatenated with a prefix of `n - 2` instances of the
+/// character 'z'.
+///
+/// This notion of displaying the number is specific to the `split`
+/// program.
+#[derive(Clone)]
+pub struct DynamicWidthNumber {
+    radix: u8,
+    current: usize,
 }
 
-impl DynamicWidthNumber {
-    pub fn new(radix: u8, suffix_start: usize) -> Self {
-        Self {
-            radix,
-            current: suffix_start,
+impl DynamicWidthNumber {
+    pub fn new(radix: u8, suffix_start: usize) -> Self {
+        Self {
+            radix,
+            current: suffix_start,
         }
     }
 
-    fn increment(&mut self) -> Result<(), Overflow> {
-        self.current += 1;
+    fn increment(&mut self) -> Result<(), Overflow> {
+        self.current += 1;
         Ok(())
     }
 
-    fn digits(&self) -> Vec<u8> {
-        let radix = self.radix as usize;
-        let mut remaining = self.current;
-        let mut sub_value = (radix - 1) * radix;
-        let mut num_fill_chars = 2;
+    fn digits(&self) -> Vec<u8> {
+        let radix = self.radix as usize;
+        let mut remaining = self.current;
+        let mut sub_value = (radix - 1) * radix;
+        let mut num_fill_chars = 2;
 
-        // Convert the number into "num_fill_chars" and "remaining"
-        while remaining >= sub_value {
-            remaining -= sub_value;
-            sub_value *= radix;
-            num_fill_chars += 1;
+        // Convert the number into "num_fill_chars" and "remaining"
+        while remaining >= sub_value {
+            remaining -= sub_value;
+            sub_value *= radix;
+            num_fill_chars += 1;
         }
 
-        // Convert the "remainder" to digits
-        let mut digits = Vec::new();
-        while remaining > 0 {
-            digits.push((remaining % radix) as u8);
-            remaining /= radix;
+        // Convert the "remainder" to digits
+        let mut digits = Vec::new();
+        while remaining > 0 {
+            digits.push((remaining % radix) as u8);
+            remaining /= radix;
         }
-        // Left pad the vec
-        digits.resize(num_fill_chars, 0);
-        digits.reverse();
-        digits
+        // Left pad the vec
+        digits.resize(num_fill_chars, 0);
+        digits.reverse();
+        digits
     }
 }
 
-fn map_digit(radix: u8, d: u8) -> char {
-    (match radix {
-        10 => b'0' + d,
-        16 => {
-            if d < 10 {
-                b'0' + d
-            } else {
-                b'a' + (d - 10)
+fn map_digit(radix: u8, d: u8) -> char {
+    (match radix {
+        10 => b'0' + d,
+        16 => {
+            if d < 10 {
+                b'0' + d
+            } else {
+                b'a' + (d - 10)
             }
         }
-        26 => b'a' + d,
-        _ => 0,
-    }) as char
+        26 => b'a' + d,
+        _ => 0,
+    }) as char
 }
 
-impl Display for DynamicWidthNumber {
-    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
-        let digits: String = self
-            .digits()
-            .iter()
-            .map(|d| map_digit(self.radix, *d))
-            .collect();
-        let fill: String = (0..digits.len() - 2)
-            .map(|_| map_digit(self.radix, self.radix - 1))
-            .collect();
-        write!(f, "{fill}{digits}")
+impl Display for DynamicWidthNumber {
+    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+        let digits: String = self
+            .digits()
+            .iter()
+            .map(|d| map_digit(self.radix, *d))
+            .collect();
+        let fill: String = (0..digits.len() - 2)
+            .map(|_| map_digit(self.radix, self.radix - 1))
+            .collect();
+        write!(f, "{fill}{digits}")
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::number::DynamicWidthNumber;
-    use crate::number::FixedWidthNumber;
-    use crate::number::Number;
-    use crate::number::Overflow;
+#[cfg(test)]
+mod tests {
+    use crate::number::DynamicWidthNumber;
+    use crate::number::FixedWidthNumber;
+    use crate::number::Number;
+    use crate::number::Overflow;
 
-    #[test]
-    fn test_dynamic_width_number_increment() {
+    #[test]
+    fn test_dynamic_width_number_increment() {
         println!("Here");
-        let mut n = Number::DynamicWidth(DynamicWidthNumber::new(3, 0));
-        assert_eq!(n.digits(), vec![0, 0]);
+        let mut n = Number::DynamicWidth(DynamicWidthNumber::new(3, 0));
+        assert_eq!(n.digits(), vec![0, 0]);
 
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![0, 1]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![0, 1]);
 
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![0, 2]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![0, 2]);
 
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![1, 0]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![1, 0]);
 
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![1, 1]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![1, 1]);
 
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![1, 2]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![1, 2]);
 
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![0, 0, 0]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![0, 0, 0]);
 
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![0, 0, 1]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![0, 0, 1]);
     }
 
-    #[test]
-    fn test_dynamic_width_number_display_alphabetic() {
-        fn num(n: usize) -> Number {
-            let mut number = Number::DynamicWidth(DynamicWidthNumber::new(26, 0));
-            for _ in 0..n {
-                number.increment().unwrap();
+    #[test]
+    fn test_dynamic_width_number_display_alphabetic() {
+        fn num(n: usize) -> Number {
+            let mut number = Number::DynamicWidth(DynamicWidthNumber::new(26, 0));
+            for _ in 0..n {
+                number.increment().unwrap();
             }
-            number
+            number
         }
 
-        assert_eq!(format!("{}", num(0)), "aa");
-        assert_eq!(format!("{}", num(1)), "ab");
-        assert_eq!(format!("{}", num(2)), "ac");
-        assert_eq!(format!("{}", num(25)), "az");
-        assert_eq!(format!("{}", num(26)), "ba");
-        assert_eq!(format!("{}", num(27)), "bb");
-        assert_eq!(format!("{}", num(28)), "bc");
-        assert_eq!(format!("{}", num(26 + 25)), "bz");
-        assert_eq!(format!("{}", num(26 + 26)), "ca");
-        assert_eq!(format!("{}", num(26 * 25 - 1)), "yz");
-        assert_eq!(format!("{}", num(26 * 25)), "zaaa");
-        assert_eq!(format!("{}", num(26 * 25 + 1)), "zaab");
+        assert_eq!(format!("{}", num(0)), "aa");
+        assert_eq!(format!("{}", num(1)), "ab");
+        assert_eq!(format!("{}", num(2)), "ac");
+        assert_eq!(format!("{}", num(25)), "az");
+        assert_eq!(format!("{}", num(26)), "ba");
+        assert_eq!(format!("{}", num(27)), "bb");
+        assert_eq!(format!("{}", num(28)), "bc");
+        assert_eq!(format!("{}", num(26 + 25)), "bz");
+        assert_eq!(format!("{}", num(26 + 26)), "ca");
+        assert_eq!(format!("{}", num(26 * 25 - 1)), "yz");
+        assert_eq!(format!("{}", num(26 * 25)), "zaaa");
+        assert_eq!(format!("{}", num(26 * 25 + 1)), "zaab");
     }
 
-    #[test]
-    fn test_dynamic_width_number_display_numeric_decimal() {
-        fn num(n: usize) -> Number {
-            let mut number = Number::DynamicWidth(DynamicWidthNumber::new(10, 0));
-            for _ in 0..n {
-                number.increment().unwrap();
+    #[test]
+    fn test_dynamic_width_number_display_numeric_decimal() {
+        fn num(n: usize) -> Number {
+            let mut number = Number::DynamicWidth(DynamicWidthNumber::new(10, 0));
+            for _ in 0..n {
+                number.increment().unwrap();
             }
-            number
+            number
         }
 
-        assert_eq!(format!("{}", num(0)), "00");
-        assert_eq!(format!("{}", num(9)), "09");
-        assert_eq!(format!("{}", num(17)), "17");
-        assert_eq!(format!("{}", num(10 * 9 - 1)), "89");
-        assert_eq!(format!("{}", num(10 * 9)), "9000");
-        assert_eq!(format!("{}", num(10 * 9 + 1)), "9001");
-        assert_eq!(format!("{}", num(10 * 99 - 1)), "9899");
-        assert_eq!(format!("{}", num(10 * 99)), "990000");
-        assert_eq!(format!("{}", num(10 * 99 + 1)), "990001");
+        assert_eq!(format!("{}", num(0)), "00");
+        assert_eq!(format!("{}", num(9)), "09");
+        assert_eq!(format!("{}", num(17)), "17");
+        assert_eq!(format!("{}", num(10 * 9 - 1)), "89");
+        assert_eq!(format!("{}", num(10 * 9)), "9000");
+        assert_eq!(format!("{}", num(10 * 9 + 1)), "9001");
+        assert_eq!(format!("{}", num(10 * 99 - 1)), "9899");
+        assert_eq!(format!("{}", num(10 * 99)), "990000");
+        assert_eq!(format!("{}", num(10 * 99 + 1)), "990001");
     }
 
-    #[test]
-    fn test_dynamic_width_number_display_numeric_hexadecimal() {
-        fn num(n: usize) -> Number {
-            let mut number = Number::DynamicWidth(DynamicWidthNumber::new(16, 0));
-            for _ in 0..n {
-                number.increment().unwrap();
+    #[test]
+    fn test_dynamic_width_number_display_numeric_hexadecimal() {
+        fn num(n: usize) -> Number {
+            let mut number = Number::DynamicWidth(DynamicWidthNumber::new(16, 0));
+            for _ in 0..n {
+                number.increment().unwrap();
             }
-            number
+            number
         }
 
-        assert_eq!(format!("{}", num(0)), "00");
-        assert_eq!(format!("{}", num(15)), "0f");
-        assert_eq!(format!("{}", num(16)), "10");
-        assert_eq!(format!("{}", num(17)), "11");
-        assert_eq!(format!("{}", num(18)), "12");
+        assert_eq!(format!("{}", num(0)), "00");
+        assert_eq!(format!("{}", num(15)), "0f");
+        assert_eq!(format!("{}", num(16)), "10");
+        assert_eq!(format!("{}", num(17)), "11");
+        assert_eq!(format!("{}", num(18)), "12");
 
-        assert_eq!(format!("{}", num(16 * 15 - 1)), "ef");
-        assert_eq!(format!("{}", num(16 * 15)), "f000");
-        assert_eq!(format!("{}", num(16 * 15 + 1)), "f001");
-        assert_eq!(format!("{}", num(16 * 255 - 1)), "feff");
-        assert_eq!(format!("{}", num(16 * 255)), "ff0000");
-        assert_eq!(format!("{}", num(16 * 255 + 1)), "ff0001");
+        assert_eq!(format!("{}", num(16 * 15 - 1)), "ef");
+        assert_eq!(format!("{}", num(16 * 15)), "f000");
+        assert_eq!(format!("{}", num(16 * 15 + 1)), "f001");
+        assert_eq!(format!("{}", num(16 * 255 - 1)), "feff");
+        assert_eq!(format!("{}", num(16 * 255)), "ff0000");
+        assert_eq!(format!("{}", num(16 * 255 + 1)), "ff0001");
     }
 
-    #[test]
-    fn test_fixed_width_number_increment() {
-        let mut n = Number::FixedWidth(FixedWidthNumber::new(3, 2, 0).unwrap());
-        assert_eq!(n.digits(), vec![0, 0]);
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![0, 1]);
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![0, 2]);
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![1, 0]);
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![1, 1]);
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![1, 2]);
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![2, 0]);
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![2, 1]);
-        n.increment().unwrap();
-        assert_eq!(n.digits(), vec![2, 2]);
-        assert!(n.increment().is_err());
+    #[test]
+    fn test_fixed_width_number_increment() {
+        let mut n = Number::FixedWidth(FixedWidthNumber::new(3, 2, 0).unwrap());
+        assert_eq!(n.digits(), vec![0, 0]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![0, 1]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![0, 2]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![1, 0]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![1, 1]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![1, 2]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![2, 0]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![2, 1]);
+        n.increment().unwrap();
+        assert_eq!(n.digits(), vec![2, 2]);
+        assert!(n.increment().is_err());
     }
 
-    #[test]
-    fn test_fixed_width_number_display_alphabetic() {
-        fn num(n: usize) -> Result<Number, Overflow> {
-            let mut number = Number::FixedWidth(FixedWidthNumber::new(26, 2, 0).unwrap());
-            for _ in 0..n {
-                number.increment()?;
+    #[test]
+    fn test_fixed_width_number_display_alphabetic() {
+        fn num(n: usize) -> Result<Number, Overflow> {
+            let mut number = Number::FixedWidth(FixedWidthNumber::new(26, 2, 0).unwrap());
+            for _ in 0..n {
+                number.increment()?;
             }
-            Ok(number)
+            Ok(number)
         }
 
-        assert_eq!(format!("{}", num(0).unwrap()), "aa");
-        assert_eq!(format!("{}", num(1).unwrap()), "ab");
-        assert_eq!(format!("{}", num(2).unwrap()), "ac");
-        assert_eq!(format!("{}", num(25).unwrap()), "az");
-        assert_eq!(format!("{}", num(26).unwrap()), "ba");
-        assert_eq!(format!("{}", num(27).unwrap()), "bb");
-        assert_eq!(format!("{}", num(28).unwrap()), "bc");
-        assert_eq!(format!("{}", num(26 + 25).unwrap()), "bz");
-        assert_eq!(format!("{}", num(26 + 26).unwrap()), "ca");
-        assert_eq!(format!("{}", num(26 * 25 - 1).unwrap()), "yz");
-        assert_eq!(format!("{}", num(26 * 25).unwrap()), "za");
-        assert_eq!(format!("{}", num(26 * 26 - 1).unwrap()), "zz");
-        assert!(num(26 * 26).is_err());
+        assert_eq!(format!("{}", num(0).unwrap()), "aa");
+        assert_eq!(format!("{}", num(1).unwrap()), "ab");
+        assert_eq!(format!("{}", num(2).unwrap()), "ac");
+        assert_eq!(format!("{}", num(25).unwrap()), "az");
+        assert_eq!(format!("{}", num(26).unwrap()), "ba");
+        assert_eq!(format!("{}", num(27).unwrap()), "bb");
+        assert_eq!(format!("{}", num(28).unwrap()), "bc");
+        assert_eq!(format!("{}", num(26 + 25).unwrap()), "bz");
+        assert_eq!(format!("{}", num(26 + 26).unwrap()), "ca");
+        assert_eq!(format!("{}", num(26 * 25 - 1).unwrap()), "yz");
+        assert_eq!(format!("{}", num(26 * 25).unwrap()), "za");
+        assert_eq!(format!("{}", num(26 * 26 - 1).unwrap()), "zz");
+        assert!(num(26 * 26).is_err());
     }
 
-    #[test]
-    fn test_fixed_width_number_display_numeric_decimal() {
-        fn num(n: usize) -> Result<Number, Overflow> {
-            let mut number = Number::FixedWidth(FixedWidthNumber::new(10, 2, 0).unwrap());
-            for _ in 0..n {
-                number.increment()?;
+    #[test]
+    fn test_fixed_width_number_display_numeric_decimal() {
+        fn num(n: usize) -> Result<Number, Overflow> {
+            let mut number = Number::FixedWidth(FixedWidthNumber::new(10, 2, 0).unwrap());
+            for _ in 0..n {
+                number.increment()?;
             }
-            Ok(number)
+            Ok(number)
         }
 
-        assert_eq!(format!("{}", num(0).unwrap()), "00");
-        assert_eq!(format!("{}", num(9).unwrap()), "09");
-        assert_eq!(format!("{}", num(17).unwrap()), "17");
-        assert_eq!(format!("{}", num(10 * 9 - 1).unwrap()), "89");
-        assert_eq!(format!("{}", num(10 * 9).unwrap()), "90");
-        assert_eq!(format!("{}", num(10 * 10 - 1).unwrap()), "99");
-        assert!(num(10 * 10).is_err());
+        assert_eq!(format!("{}", num(0).unwrap()), "00");
+        assert_eq!(format!("{}", num(9).unwrap()), "09");
+        assert_eq!(format!("{}", num(17).unwrap()), "17");
+        assert_eq!(format!("{}", num(10 * 9 - 1).unwrap()), "89");
+        assert_eq!(format!("{}", num(10 * 9).unwrap()), "90");
+        assert_eq!(format!("{}", num(10 * 10 - 1).unwrap()), "99");
+        assert!(num(10 * 10).is_err());
     }
 
-    #[test]
-    fn test_fixed_width_number_display_numeric_hexadecimal() {
-        fn num(n: usize) -> Result<Number, Overflow> {
-            let mut number = Number::FixedWidth(FixedWidthNumber::new(16, 2, 0).unwrap());
-            for _ in 0..n {
-                number.increment()?;
+    #[test]
+    fn test_fixed_width_number_display_numeric_hexadecimal() {
+        fn num(n: usize) -> Result<Number, Overflow> {
+            let mut number = Number::FixedWidth(FixedWidthNumber::new(16, 2, 0).unwrap());
+            for _ in 0..n {
+                number.increment()?;
             }
-            Ok(number)
+            Ok(number)
         }
 
-        assert_eq!(format!("{}", num(0).unwrap()), "00");
-        assert_eq!(format!("{}", num(15).unwrap()), "0f");
-        assert_eq!(format!("{}", num(17).unwrap()), "11");
-        assert_eq!(format!("{}", num(16 * 15 - 1).unwrap()), "ef");
-        assert_eq!(format!("{}", num(16 * 15).unwrap()), "f0");
-        assert_eq!(format!("{}", num(16 * 16 - 1).unwrap()), "ff");
-        assert!(num(16 * 16).is_err());
+        assert_eq!(format!("{}", num(0).unwrap()), "00");
+        assert_eq!(format!("{}", num(15).unwrap()), "0f");
+        assert_eq!(format!("{}", num(17).unwrap()), "11");
+        assert_eq!(format!("{}", num(16 * 15 - 1).unwrap()), "ef");
+        assert_eq!(format!("{}", num(16 * 15).unwrap()), "f0");
+        assert_eq!(format!("{}", num(16 * 16 - 1).unwrap()), "ff");
+        assert!(num(16 * 16).is_err());
     }
 
-    #[test]
-    fn test_fixed_width_number_start_suffix() {
-        fn num(n: usize) -> Result<Number, Overflow> {
-            let mut number = Number::FixedWidth(FixedWidthNumber::new(16, 2, 0x14)?);
-            for _ in 0..n {
-                number.increment()?;
+    #[test]
+    fn test_fixed_width_number_start_suffix() {
+        fn num(n: usize) -> Result<Number, Overflow> {
+            let mut number = Number::FixedWidth(FixedWidthNumber::new(16, 2, 0x14)?);
+            for _ in 0..n {
+                number.increment()?;
             }
-            Ok(number)
+            Ok(number)
         }
 
-        assert_eq!(format!("{}", num(0).unwrap()), "14");
-        assert_eq!(format!("{}", num(0xf).unwrap()), "23");
+        assert_eq!(format!("{}", num(0).unwrap()), "14");
+        assert_eq!(format!("{}", num(0xf).unwrap()), "23");
     }
 
-    #[test]
-    fn test_dynamic_width_number_start_suffix() {
-        fn num(n: usize) -> Result<Number, Overflow> {
-            let mut number = Number::DynamicWidth(DynamicWidthNumber::new(10, 8));
-            for _ in 0..n {
-                number.increment()?;
+    #[test]
+    fn test_dynamic_width_number_start_suffix() {
+        fn num(n: usize) -> Result<Number, Overflow> {
+            let mut number = Number::DynamicWidth(DynamicWidthNumber::new(10, 8));
+            for _ in 0..n {
+                number.increment()?;
             }
-            Ok(number)
+            Ok(number)
         }
 
-        assert_eq!(format!("{}", num(0).unwrap()), "08");
-        assert_eq!(format!("{}", num(8).unwrap()), "16");
+        assert_eq!(format!("{}", num(0).unwrap()), "08");
+        assert_eq!(format!("{}", num(8).unwrap()), "16");
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_split/platform/mod.rs.html b/dev/src/uu_split/platform/mod.rs.html index c74db877e..344f2991c 100644 --- a/dev/src/uu_split/platform/mod.rs.html +++ b/dev/src/uu_split/platform/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
@@ -13,20 +13,20 @@
 13
 14
 15
-
#[cfg(unix)]
-pub use self::unix::instantiate_current_writer;
-#[cfg(unix)]
-pub use self::unix::paths_refer_to_same_file;
+
#[cfg(unix)]
+pub use self::unix::instantiate_current_writer;
+#[cfg(unix)]
+pub use self::unix::paths_refer_to_same_file;
 
-#[cfg(windows)]
-pub use self::windows::instantiate_current_writer;
-#[cfg(windows)]
-pub use self::windows::paths_refer_to_same_file;
+#[cfg(windows)]
+pub use self::windows::instantiate_current_writer;
+#[cfg(windows)]
+pub use self::windows::paths_refer_to_same_file;
 
-#[cfg(unix)]
-mod unix;
+#[cfg(unix)]
+mod unix;
 
-#[cfg(windows)]
-mod windows;
+#[cfg(windows)]
+mod windows;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_split/platform/unix.rs.html b/dev/src/uu_split/platform/unix.rs.html index 8175c53b8..dacad7efa 100644 --- a/dev/src/uu_split/platform/unix.rs.html +++ b/dev/src/uu_split/platform/unix.rs.html @@ -1,4 +1,4 @@ -unix.rs - source
1
+unix.rs - source
1
 2
 3
 4
@@ -141,148 +141,148 @@
 141
 142
 143
-
use std::env;
-use std::io::Write;
-use std::io::{BufWriter, Error, ErrorKind, Result};
-use std::path::Path;
-use std::process::{Child, Command, Stdio};
-use uucore::crash;
-use uucore::fs;
-use uucore::fs::FileInformation;
+
use std::env;
+use std::io::Write;
+use std::io::{BufWriter, Error, ErrorKind, Result};
+use std::path::Path;
+use std::process::{Child, Command, Stdio};
+use uucore::crash;
+use uucore::fs;
+use uucore::fs::FileInformation;
 
-/// A writer that writes to a shell_process' stdin
-///
-/// We use a shell process (not directly calling a sub-process) so we can forward the name of the
-/// corresponding output file (xaa, xab, xac… ). This is the way it was implemented in GNU split.
-struct FilterWriter {
-    /// Running shell process
-    shell_process: Child,
+/// A writer that writes to a shell_process' stdin
+///
+/// We use a shell process (not directly calling a sub-process) so we can forward the name of the
+/// corresponding output file (xaa, xab, xac… ). This is the way it was implemented in GNU split.
+struct FilterWriter {
+    /// Running shell process
+    shell_process: Child,
 }
 
-impl Write for FilterWriter {
-    fn write(&mut self, buf: &[u8]) -> Result<usize> {
-        self.shell_process
-            .stdin
-            .as_mut()
-            .expect("failed to get shell stdin")
-            .write(buf)
+impl Write for FilterWriter {
+    fn write(&mut self, buf: &[u8]) -> Result<usize> {
+        self.shell_process
+            .stdin
+            .as_mut()
+            .expect("failed to get shell stdin")
+            .write(buf)
     }
-    fn flush(&mut self) -> Result<()> {
-        self.shell_process
-            .stdin
-            .as_mut()
-            .expect("failed to get shell stdin")
-            .flush()
+    fn flush(&mut self) -> Result<()> {
+        self.shell_process
+            .stdin
+            .as_mut()
+            .expect("failed to get shell stdin")
+            .flush()
     }
 }
 
-/// Have an environment variable set at a value during this lifetime
-struct WithEnvVarSet {
-    /// Env var key
-    _previous_var_key: String,
-    /// Previous value set to this key
-    _previous_var_value: std::result::Result<String, env::VarError>,
+/// Have an environment variable set at a value during this lifetime
+struct WithEnvVarSet {
+    /// Env var key
+    _previous_var_key: String,
+    /// Previous value set to this key
+    _previous_var_value: std::result::Result<String, env::VarError>,
 }
-impl WithEnvVarSet {
-    /// Save previous value assigned to key, set key=value
-    fn new(key: &str, value: &str) -> Self {
-        let previous_env_value = env::var(key);
-        env::set_var(key, value);
-        Self {
-            _previous_var_key: String::from(key),
-            _previous_var_value: previous_env_value,
+impl WithEnvVarSet {
+    /// Save previous value assigned to key, set key=value
+    fn new(key: &str, value: &str) -> Self {
+        let previous_env_value = env::var(key);
+        env::set_var(key, value);
+        Self {
+            _previous_var_key: String::from(key),
+            _previous_var_value: previous_env_value,
         }
     }
 }
 
-impl Drop for WithEnvVarSet {
-    /// Restore previous value now that this is being dropped by context
-    fn drop(&mut self) {
-        if let Ok(ref prev_value) = self._previous_var_value {
-            env::set_var(&self._previous_var_key, prev_value);
-        } else {
-            env::remove_var(&self._previous_var_key);
+impl Drop for WithEnvVarSet {
+    /// Restore previous value now that this is being dropped by context
+    fn drop(&mut self) {
+        if let Ok(ref prev_value) = self._previous_var_value {
+            env::set_var(&self._previous_var_key, prev_value);
+        } else {
+            env::remove_var(&self._previous_var_key);
         }
     }
 }
-impl FilterWriter {
-    /// Create a new filter running a command with $FILE pointing at the output name
-    ///
-    /// #Arguments
-    ///
-    /// * `command` - The shell command to execute
-    /// * `filepath` - Path of the output file (forwarded to command as $FILE)
-    fn new(command: &str, filepath: &str) -> Result<Self> {
-        // set $FILE, save previous value (if there was one)
-        let _with_env_var_set = WithEnvVarSet::new("FILE", filepath);
+impl FilterWriter {
+    /// Create a new filter running a command with $FILE pointing at the output name
+    ///
+    /// #Arguments
+    ///
+    /// * `command` - The shell command to execute
+    /// * `filepath` - Path of the output file (forwarded to command as $FILE)
+    fn new(command: &str, filepath: &str) -> Result<Self> {
+        // set $FILE, save previous value (if there was one)
+        let _with_env_var_set = WithEnvVarSet::new("FILE", filepath);
 
-        let shell_process =
-            Command::new(env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_owned()))
-                .arg("-c")
-                .arg(command)
-                .stdin(Stdio::piped())
-                .spawn()?;
+        let shell_process =
+            Command::new(env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_owned()))
+                .arg("-c")
+                .arg(command)
+                .stdin(Stdio::piped())
+                .spawn()?;
 
-        Ok(Self { shell_process })
+        Ok(Self { shell_process })
     }
 }
 
-impl Drop for FilterWriter {
-    /// flush stdin, close it and wait on `shell_process` before dropping self
-    fn drop(&mut self) {
+impl Drop for FilterWriter {
+    /// flush stdin, close it and wait on `shell_process` before dropping self
+    fn drop(&mut self) {
         {
-            // close stdin by dropping it
-            let _stdin = self.shell_process.stdin.as_mut();
+            // close stdin by dropping it
+            let _stdin = self.shell_process.stdin.as_mut();
         }
-        let exit_status = self
-            .shell_process
-            .wait()
-            .expect("Couldn't wait for child process");
-        if let Some(return_code) = exit_status.code() {
-            if return_code != 0 {
-                crash!(1, "Shell process returned {}", return_code);
+        let exit_status = self
+            .shell_process
+            .wait()
+            .expect("Couldn't wait for child process");
+        if let Some(return_code) = exit_status.code() {
+            if return_code != 0 {
+                crash!(1, "Shell process returned {}", return_code);
             }
-        } else {
+        } else {
             crash!(1, "Shell process terminated by signal")
         }
     }
 }
 
-/// Instantiate either a file writer or a "write to shell process's stdin" writer
-pub fn instantiate_current_writer(
-    filter: &Option<String>,
-    filename: &str,
-) -> Result<BufWriter<Box<dyn Write>>> {
-    match filter {
-        None => Ok(BufWriter::new(Box::new(
-            // write to the next file
-            std::fs::OpenOptions::new()
-                .write(true)
-                .create(true)
-                .truncate(true)
-                .open(std::path::Path::new(&filename))
-                .map_err(|_| {
-                    Error::new(
-                        ErrorKind::Other,
-                        format!("unable to open '{}'; aborting", filename),
+/// Instantiate either a file writer or a "write to shell process's stdin" writer
+pub fn instantiate_current_writer(
+    filter: &Option<String>,
+    filename: &str,
+) -> Result<BufWriter<Box<dyn Write>>> {
+    match filter {
+        None => Ok(BufWriter::new(Box::new(
+            // write to the next file
+            std::fs::OpenOptions::new()
+                .write(true)
+                .create(true)
+                .truncate(true)
+                .open(std::path::Path::new(&filename))
+                .map_err(|_| {
+                    Error::new(
+                        ErrorKind::Other,
+                        format!("unable to open '{}'; aborting", filename),
                     )
                 })?,
-        ) as Box<dyn Write>)),
-        Some(ref filter_command) => Ok(BufWriter::new(Box::new(
-            // spawn a shell command and write to it
-            FilterWriter::new(filter_command, filename)?,
-        ) as Box<dyn Write>)),
+        ) as Box<dyn Write>)),
+        Some(ref filter_command) => Ok(BufWriter::new(Box::new(
+            // spawn a shell command and write to it
+            FilterWriter::new(filter_command, filename)?,
+        ) as Box<dyn Write>)),
     }
 }
 
-pub fn paths_refer_to_same_file(p1: &str, p2: &str) -> bool {
-    // We have to take symlinks and relative paths into account.
-    let p1 = if p1 == "-" {
-        FileInformation::from_file(&std::io::stdin())
-    } else {
-        FileInformation::from_path(Path::new(&p1), true)
+pub fn paths_refer_to_same_file(p1: &str, p2: &str) -> bool {
+    // We have to take symlinks and relative paths into account.
+    let p1 = if p1 == "-" {
+        FileInformation::from_file(&std::io::stdin())
+    } else {
+        FileInformation::from_path(Path::new(&p1), true)
     };
-    fs::infos_refer_to_same_file(p1, FileInformation::from_path(Path::new(p2), true))
+    fs::infos_refer_to_same_file(p1, FileInformation::from_path(Path::new(p2), true))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_split/split.rs.html b/dev/src/uu_split/split.rs.html index 3b38e7263..d3900c4b5 100644 --- a/dev/src/uu_split/split.rs.html +++ b/dev/src/uu_split/split.rs.html @@ -1,4 +1,4 @@ -split.rs - source
1
+split.rs - source
1
 2
 3
 4
@@ -1435,1222 +1435,1222 @@
 1435
 1436
 1437
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Akira Hayakawa <ruby.wktk@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Akira Hayakawa <ruby.wktk@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) PREFIXaa PREFIXab nbbbb ncccc
+// spell-checker:ignore (ToDO) PREFIXaa PREFIXab nbbbb ncccc
 
-mod filenames;
-mod number;
-mod platform;
+mod filenames;
+mod number;
+mod platform;
 
-use crate::filenames::FilenameIterator;
-use crate::filenames::SuffixType;
-use clap::ArgAction;
-use clap::{crate_version, parser::ValueSource, Arg, ArgMatches, Command};
-use std::env;
-use std::fmt;
-use std::fs::{metadata, File};
-use std::io;
-use std::io::{stdin, BufRead, BufReader, BufWriter, ErrorKind, Read, Write};
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UIoError, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
-use uucore::parse_size::{parse_size, ParseSizeError};
-use uucore::uio_error;
+use crate::filenames::FilenameIterator;
+use crate::filenames::SuffixType;
+use clap::ArgAction;
+use clap::{crate_version, parser::ValueSource, Arg, ArgMatches, Command};
+use std::env;
+use std::fmt;
+use std::fs::{metadata, File};
+use std::io;
+use std::io::{stdin, BufRead, BufReader, BufWriter, ErrorKind, Read, Write};
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UIoError, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
+use uucore::parse_size::{parse_size, ParseSizeError};
+use uucore::uio_error;
 
-static OPT_BYTES: &str = "bytes";
-static OPT_LINE_BYTES: &str = "line-bytes";
-static OPT_LINES: &str = "lines";
-static OPT_ADDITIONAL_SUFFIX: &str = "additional-suffix";
-static OPT_FILTER: &str = "filter";
-static OPT_NUMBER: &str = "number";
-static OPT_NUMERIC_SUFFIXES: &str = "numeric-suffixes";
-static OPT_HEX_SUFFIXES: &str = "hex-suffixes";
-static OPT_SUFFIX_LENGTH: &str = "suffix-length";
-static OPT_DEFAULT_SUFFIX_LENGTH: &str = "0";
-static OPT_VERBOSE: &str = "verbose";
-//The ---io and ---io-blksize parameters are consumed and ignored.
-//The parameter is included to make GNU coreutils tests pass.
-static OPT_IO: &str = "-io";
-static OPT_IO_BLKSIZE: &str = "-io-blksize";
-static OPT_ELIDE_EMPTY_FILES: &str = "elide-empty-files";
+static OPT_BYTES: &str = "bytes";
+static OPT_LINE_BYTES: &str = "line-bytes";
+static OPT_LINES: &str = "lines";
+static OPT_ADDITIONAL_SUFFIX: &str = "additional-suffix";
+static OPT_FILTER: &str = "filter";
+static OPT_NUMBER: &str = "number";
+static OPT_NUMERIC_SUFFIXES: &str = "numeric-suffixes";
+static OPT_HEX_SUFFIXES: &str = "hex-suffixes";
+static OPT_SUFFIX_LENGTH: &str = "suffix-length";
+static OPT_DEFAULT_SUFFIX_LENGTH: &str = "0";
+static OPT_VERBOSE: &str = "verbose";
+//The ---io and ---io-blksize parameters are consumed and ignored.
+//The parameter is included to make GNU coreutils tests pass.
+static OPT_IO: &str = "-io";
+static OPT_IO_BLKSIZE: &str = "-io-blksize";
+static OPT_ELIDE_EMPTY_FILES: &str = "elide-empty-files";
 
-static ARG_INPUT: &str = "input";
-static ARG_PREFIX: &str = "prefix";
+static ARG_INPUT: &str = "input";
+static ARG_PREFIX: &str = "prefix";
 
-const USAGE: &str = "{} [OPTION]... [INPUT [PREFIX]]";
-const AFTER_HELP: &str = "\
+const USAGE: &str = "{} [OPTION]... [INPUT [PREFIX]]";
+const AFTER_HELP: &str = "\
     Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default \
     size is 1000, and default PREFIX is 'x'. With no INPUT, or when INPUT is \
     -, read standard input.";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
-    match Settings::from(&matches) {
-        Ok(settings) => split(&settings),
-        Err(e) if e.requires_usage() => Err(UUsageError::new(1, format!("{}", e))),
-        Err(e) => Err(USimpleError::new(1, format!("{}", e))),
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
+    match Settings::from(&matches) {
+        Ok(settings) => split(&settings),
+        Err(e) if e.requires_usage() => Err(UUsageError::new(1, format!("{}", e))),
+        Err(e) => Err(USimpleError::new(1, format!("{}", e))),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about("Create output files containing consecutive or interleaved sections of input")
-        .after_help(AFTER_HELP)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        // strategy (mutually exclusive)
-        .arg(
-            Arg::new(OPT_BYTES)
-                .short('b')
-                .long(OPT_BYTES)
-                .value_name("SIZE")
-                .help("put SIZE bytes per output file"),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about("Create output files containing consecutive or interleaved sections of input")
+        .after_help(AFTER_HELP)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        // strategy (mutually exclusive)
+        .arg(
+            Arg::new(OPT_BYTES)
+                .short('b')
+                .long(OPT_BYTES)
+                .value_name("SIZE")
+                .help("put SIZE bytes per output file"),
         )
-        .arg(
-            Arg::new(OPT_LINE_BYTES)
-                .short('C')
-                .long(OPT_LINE_BYTES)
-                .value_name("SIZE")
-                .default_value("2")
-                .help("put at most SIZE bytes of lines per output file"),
+        .arg(
+            Arg::new(OPT_LINE_BYTES)
+                .short('C')
+                .long(OPT_LINE_BYTES)
+                .value_name("SIZE")
+                .default_value("2")
+                .help("put at most SIZE bytes of lines per output file"),
         )
-        .arg(
-            Arg::new(OPT_LINES)
-                .short('l')
-                .long(OPT_LINES)
-                .value_name("NUMBER")
-                .default_value("1000")
-                .help("put NUMBER lines/records per output file"),
+        .arg(
+            Arg::new(OPT_LINES)
+                .short('l')
+                .long(OPT_LINES)
+                .value_name("NUMBER")
+                .default_value("1000")
+                .help("put NUMBER lines/records per output file"),
         )
-        .arg(
-            Arg::new(OPT_NUMBER)
-                .short('n')
-                .long(OPT_NUMBER)
-                .value_name("CHUNKS")
-                .help("generate CHUNKS output files; see explanation below"),
+        .arg(
+            Arg::new(OPT_NUMBER)
+                .short('n')
+                .long(OPT_NUMBER)
+                .value_name("CHUNKS")
+                .help("generate CHUNKS output files; see explanation below"),
         )
-        // rest of the arguments
-        .arg(
-            Arg::new(OPT_ADDITIONAL_SUFFIX)
-                .long(OPT_ADDITIONAL_SUFFIX)
-                .value_name("SUFFIX")
-                .default_value("")
-                .help("additional SUFFIX to append to output file names"),
+        // rest of the arguments
+        .arg(
+            Arg::new(OPT_ADDITIONAL_SUFFIX)
+                .long(OPT_ADDITIONAL_SUFFIX)
+                .value_name("SUFFIX")
+                .default_value("")
+                .help("additional SUFFIX to append to output file names"),
         )
-        .arg(
-            Arg::new(OPT_FILTER)
-                .long(OPT_FILTER)
-                .value_name("COMMAND")
-                .value_hint(clap::ValueHint::CommandName)
-                .help(
+        .arg(
+            Arg::new(OPT_FILTER)
+                .long(OPT_FILTER)
+                .value_name("COMMAND")
+                .value_hint(clap::ValueHint::CommandName)
+                .help(
                     "write to shell COMMAND; file name is $FILE (Currently not implemented for Windows)",
                 ),
         )
-        .arg(
-            Arg::new(OPT_ELIDE_EMPTY_FILES)
-                .long(OPT_ELIDE_EMPTY_FILES)
-                .short('e')
-                .help("do not generate empty output files with '-n'")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_ELIDE_EMPTY_FILES)
+                .long(OPT_ELIDE_EMPTY_FILES)
+                .short('e')
+                .help("do not generate empty output files with '-n'")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_NUMERIC_SUFFIXES)
-                .short('d')
-                .long(OPT_NUMERIC_SUFFIXES)
-                .default_missing_value("0")
-                .num_args(0..=1)
-                .help("use numeric suffixes instead of alphabetic"),
+        .arg(
+            Arg::new(OPT_NUMERIC_SUFFIXES)
+                .short('d')
+                .long(OPT_NUMERIC_SUFFIXES)
+                .default_missing_value("0")
+                .num_args(0..=1)
+                .help("use numeric suffixes instead of alphabetic"),
         )
-        .arg(
-            Arg::new(OPT_SUFFIX_LENGTH)
-                .short('a')
-                .long(OPT_SUFFIX_LENGTH)
-                .value_name("N")
-                .default_value(OPT_DEFAULT_SUFFIX_LENGTH)
-                .help("use suffixes of fixed length N. 0 implies dynamic length."),
+        .arg(
+            Arg::new(OPT_SUFFIX_LENGTH)
+                .short('a')
+                .long(OPT_SUFFIX_LENGTH)
+                .value_name("N")
+                .default_value(OPT_DEFAULT_SUFFIX_LENGTH)
+                .help("use suffixes of fixed length N. 0 implies dynamic length."),
         )
-        .arg(
-            Arg::new(OPT_HEX_SUFFIXES)
-                .short('x')
-                .long(OPT_HEX_SUFFIXES)
-                .default_missing_value("0")
-                .num_args(0..=1)
-                .help("use hex suffixes instead of alphabetic"),
+        .arg(
+            Arg::new(OPT_HEX_SUFFIXES)
+                .short('x')
+                .long(OPT_HEX_SUFFIXES)
+                .default_missing_value("0")
+                .num_args(0..=1)
+                .help("use hex suffixes instead of alphabetic"),
         )
-        .arg(
-            Arg::new(OPT_VERBOSE)
-                .long(OPT_VERBOSE)
-                .help("print a diagnostic just before each output file is opened")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(OPT_VERBOSE)
+                .long(OPT_VERBOSE)
+                .help("print a diagnostic just before each output file is opened")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(OPT_IO)
-                .long("io")
-                .alias(OPT_IO)
-                .hide(true),
+        .arg(
+            Arg::new(OPT_IO)
+                .long("io")
+                .alias(OPT_IO)
+                .hide(true),
         )
-        .arg(
-            Arg::new(OPT_IO_BLKSIZE)
-                .long("io-blksize")
-                .alias(OPT_IO_BLKSIZE)
-                .hide(true),
+        .arg(
+            Arg::new(OPT_IO_BLKSIZE)
+                .long("io-blksize")
+                .alias(OPT_IO_BLKSIZE)
+                .hide(true),
         )
-        .arg(
-            Arg::new(ARG_INPUT)
-                .default_value("-")
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(ARG_INPUT)
+                .default_value("-")
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(ARG_PREFIX)
-                .default_value("x")
+        .arg(
+            Arg::new(ARG_PREFIX)
+                .default_value("x")
         )
 }
 
-/// Sub-strategy to use when splitting a file into a specific number of chunks.
-#[derive(Debug, PartialEq)]
-enum NumberType {
-    /// Split into a specific number of chunks by byte.
-    Bytes(u64),
+/// Sub-strategy to use when splitting a file into a specific number of chunks.
+#[derive(Debug, PartialEq)]
+enum NumberType {
+    /// Split into a specific number of chunks by byte.
+    Bytes(u64),
 
-    /// Split into a specific number of chunks by line (approximately).
-    Lines(u64),
+    /// Split into a specific number of chunks by line (approximately).
+    Lines(u64),
 
-    /// Split into a specific number of chunks by line
-    /// (approximately), but output only the *k*th chunk.
-    KthLines(u64, u64),
+    /// Split into a specific number of chunks by line
+    /// (approximately), but output only the *k*th chunk.
+    KthLines(u64, u64),
 
-    /// Assign lines via round-robin to the specified number of output chunks.
-    RoundRobin(u64),
+    /// Assign lines via round-robin to the specified number of output chunks.
+    RoundRobin(u64),
 
-    /// Assign lines via round-robin to the specified number of output
-    /// chunks, but output only the *k*th chunk.
-    KthRoundRobin(u64, u64),
+    /// Assign lines via round-robin to the specified number of output
+    /// chunks, but output only the *k*th chunk.
+    KthRoundRobin(u64, u64),
 }
 
-impl NumberType {
-    /// The number of chunks for this number type.
-    fn num_chunks(&self) -> u64 {
-        match self {
-            Self::Bytes(n) => *n,
-            Self::Lines(n) => *n,
-            Self::KthLines(_, n) => *n,
-            Self::RoundRobin(n) => *n,
-            Self::KthRoundRobin(_, n) => *n,
+impl NumberType {
+    /// The number of chunks for this number type.
+    fn num_chunks(&self) -> u64 {
+        match self {
+            Self::Bytes(n) => *n,
+            Self::Lines(n) => *n,
+            Self::KthLines(_, n) => *n,
+            Self::RoundRobin(n) => *n,
+            Self::KthRoundRobin(_, n) => *n,
         }
     }
 }
 
-/// An error due to an invalid parameter to the `-n` command-line option.
-#[derive(Debug, PartialEq)]
-enum NumberTypeError {
-    /// The number of chunks was invalid.
-    ///
-    /// This can happen if the value of `N` in any of the following
-    /// command-line options is not a positive integer:
-    ///
-    /// ```ignore
-    /// -n N
-    /// -n l/N
-    /// -n l/K/N
-    /// -n r/N
-    /// -n r/K/N
-    /// ```
-    NumberOfChunks(String),
+/// An error due to an invalid parameter to the `-n` command-line option.
+#[derive(Debug, PartialEq)]
+enum NumberTypeError {
+    /// The number of chunks was invalid.
+    ///
+    /// This can happen if the value of `N` in any of the following
+    /// command-line options is not a positive integer:
+    ///
+    /// ```ignore
+    /// -n N
+    /// -n l/N
+    /// -n l/K/N
+    /// -n r/N
+    /// -n r/K/N
+    /// ```
+    NumberOfChunks(String),
 
-    /// The chunk number was invalid.
-    ///
-    /// This can happen if the value of `K` in any of the following
-    /// command-line options is not a positive integer:
-    ///
-    /// ```ignore
-    /// -n l/K/N
-    /// -n r/K/N
-    /// ```
-    ChunkNumber(String),
+    /// The chunk number was invalid.
+    ///
+    /// This can happen if the value of `K` in any of the following
+    /// command-line options is not a positive integer:
+    ///
+    /// ```ignore
+    /// -n l/K/N
+    /// -n r/K/N
+    /// ```
+    ChunkNumber(String),
 }
 
-impl NumberType {
-    /// Parse a `NumberType` from a string.
-    ///
-    /// The following strings are valid arguments:
-    ///
-    /// ```ignore
-    /// "N"
-    /// "l/N"
-    /// "l/K/N"
-    /// "r/N"
-    /// "r/K/N"
-    /// ```
-    ///
-    /// The `N` represents the number of chunks and the `K` represents
-    /// a chunk number.
-    ///
-    /// # Errors
-    ///
-    /// If the string is not one of the valid number types, if `K` is
-    /// not a nonnegative integer, or if `N` is not a positive
-    /// integer, then this function returns [`NumberTypeError`].
-    fn from(s: &str) -> Result<Self, NumberTypeError> {
-        let parts: Vec<&str> = s.split('/').collect();
-        match &parts[..] {
-            [n_str] => {
-                let num_chunks = n_str
-                    .parse()
-                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
-                Ok(Self::Bytes(num_chunks))
+impl NumberType {
+    /// Parse a `NumberType` from a string.
+    ///
+    /// The following strings are valid arguments:
+    ///
+    /// ```ignore
+    /// "N"
+    /// "l/N"
+    /// "l/K/N"
+    /// "r/N"
+    /// "r/K/N"
+    /// ```
+    ///
+    /// The `N` represents the number of chunks and the `K` represents
+    /// a chunk number.
+    ///
+    /// # Errors
+    ///
+    /// If the string is not one of the valid number types, if `K` is
+    /// not a nonnegative integer, or if `N` is not a positive
+    /// integer, then this function returns [`NumberTypeError`].
+    fn from(s: &str) -> Result<Self, NumberTypeError> {
+        let parts: Vec<&str> = s.split('/').collect();
+        match &parts[..] {
+            [n_str] => {
+                let num_chunks = n_str
+                    .parse()
+                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
+                Ok(Self::Bytes(num_chunks))
             }
-            ["l", n_str] => {
-                let num_chunks = n_str
-                    .parse()
-                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
-                Ok(Self::Lines(num_chunks))
+            ["l", n_str] => {
+                let num_chunks = n_str
+                    .parse()
+                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
+                Ok(Self::Lines(num_chunks))
             }
-            ["l", k_str, n_str] => {
-                let num_chunks = n_str
-                    .parse()
-                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
-                let chunk_number = k_str
-                    .parse()
-                    .map_err(|_| NumberTypeError::ChunkNumber(k_str.to_string()))?;
-                Ok(Self::KthLines(chunk_number, num_chunks))
+            ["l", k_str, n_str] => {
+                let num_chunks = n_str
+                    .parse()
+                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
+                let chunk_number = k_str
+                    .parse()
+                    .map_err(|_| NumberTypeError::ChunkNumber(k_str.to_string()))?;
+                Ok(Self::KthLines(chunk_number, num_chunks))
             }
-            ["r", n_str] => {
-                let num_chunks = n_str
-                    .parse()
-                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
-                Ok(Self::RoundRobin(num_chunks))
+            ["r", n_str] => {
+                let num_chunks = n_str
+                    .parse()
+                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
+                Ok(Self::RoundRobin(num_chunks))
             }
-            ["r", k_str, n_str] => {
-                let num_chunks = n_str
-                    .parse()
-                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
-                let chunk_number = k_str
-                    .parse()
-                    .map_err(|_| NumberTypeError::ChunkNumber(k_str.to_string()))?;
-                Ok(Self::KthRoundRobin(chunk_number, num_chunks))
+            ["r", k_str, n_str] => {
+                let num_chunks = n_str
+                    .parse()
+                    .map_err(|_| NumberTypeError::NumberOfChunks(n_str.to_string()))?;
+                let chunk_number = k_str
+                    .parse()
+                    .map_err(|_| NumberTypeError::ChunkNumber(k_str.to_string()))?;
+                Ok(Self::KthRoundRobin(chunk_number, num_chunks))
             }
-            _ => Err(NumberTypeError::NumberOfChunks(s.to_string())),
+            _ => Err(NumberTypeError::NumberOfChunks(s.to_string())),
         }
     }
 }
 
-/// The strategy for breaking up the input file into chunks.
-enum Strategy {
-    /// Each chunk has the specified number of lines.
-    Lines(u64),
+/// The strategy for breaking up the input file into chunks.
+enum Strategy {
+    /// Each chunk has the specified number of lines.
+    Lines(u64),
 
-    /// Each chunk has the specified number of bytes.
-    Bytes(u64),
+    /// Each chunk has the specified number of bytes.
+    Bytes(u64),
 
-    /// Each chunk has as many lines as possible without exceeding the
-    /// specified number of bytes.
-    LineBytes(u64),
+    /// Each chunk has as many lines as possible without exceeding the
+    /// specified number of bytes.
+    LineBytes(u64),
 
-    /// Split the file into this many chunks.
-    ///
-    /// There are several sub-strategies available, as defined by
-    /// [`NumberType`].
-    Number(NumberType),
+    /// Split the file into this many chunks.
+    ///
+    /// There are several sub-strategies available, as defined by
+    /// [`NumberType`].
+    Number(NumberType),
 }
 
-/// An error when parsing a chunking strategy from command-line arguments.
-enum StrategyError {
-    /// Invalid number of lines.
-    Lines(ParseSizeError),
+/// An error when parsing a chunking strategy from command-line arguments.
+enum StrategyError {
+    /// Invalid number of lines.
+    Lines(ParseSizeError),
 
-    /// Invalid number of bytes.
-    Bytes(ParseSizeError),
+    /// Invalid number of bytes.
+    Bytes(ParseSizeError),
 
-    /// Invalid number type.
-    NumberType(NumberTypeError),
+    /// Invalid number type.
+    NumberType(NumberTypeError),
 
-    /// Multiple chunking strategies were specified (but only one should be).
-    MultipleWays,
+    /// Multiple chunking strategies were specified (but only one should be).
+    MultipleWays,
 }
 
-impl fmt::Display for StrategyError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match self {
-            Self::Lines(e) => write!(f, "invalid number of lines: {}", e),
-            Self::Bytes(e) => write!(f, "invalid number of bytes: {}", e),
-            Self::NumberType(NumberTypeError::NumberOfChunks(s)) => {
-                write!(f, "invalid number of chunks: {}", s)
+impl fmt::Display for StrategyError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            Self::Lines(e) => write!(f, "invalid number of lines: {}", e),
+            Self::Bytes(e) => write!(f, "invalid number of bytes: {}", e),
+            Self::NumberType(NumberTypeError::NumberOfChunks(s)) => {
+                write!(f, "invalid number of chunks: {}", s)
             }
-            Self::NumberType(NumberTypeError::ChunkNumber(s)) => {
-                write!(f, "invalid chunk number: {}", s)
+            Self::NumberType(NumberTypeError::ChunkNumber(s)) => {
+                write!(f, "invalid chunk number: {}", s)
             }
-            Self::MultipleWays => write!(f, "cannot split in more than one way"),
+            Self::MultipleWays => write!(f, "cannot split in more than one way"),
         }
     }
 }
 
-impl Strategy {
-    /// Parse a strategy from the command-line arguments.
-    fn from(matches: &ArgMatches) -> Result<Self, StrategyError> {
-        // Check that the user is not specifying more than one strategy.
-        //
-        // Note: right now, this exact behavior cannot be handled by
-        // `ArgGroup` since `ArgGroup` considers a default value `Arg`
-        // as "defined".
-        match (
-            matches.value_source(OPT_LINES) == Some(ValueSource::CommandLine),
-            matches.value_source(OPT_BYTES) == Some(ValueSource::CommandLine),
-            matches.value_source(OPT_LINE_BYTES) == Some(ValueSource::CommandLine),
-            matches.value_source(OPT_NUMBER) == Some(ValueSource::CommandLine),
+impl Strategy {
+    /// Parse a strategy from the command-line arguments.
+    fn from(matches: &ArgMatches) -> Result<Self, StrategyError> {
+        // Check that the user is not specifying more than one strategy.
+        //
+        // Note: right now, this exact behavior cannot be handled by
+        // `ArgGroup` since `ArgGroup` considers a default value `Arg`
+        // as "defined".
+        match (
+            matches.value_source(OPT_LINES) == Some(ValueSource::CommandLine),
+            matches.value_source(OPT_BYTES) == Some(ValueSource::CommandLine),
+            matches.value_source(OPT_LINE_BYTES) == Some(ValueSource::CommandLine),
+            matches.value_source(OPT_NUMBER) == Some(ValueSource::CommandLine),
         ) {
-            (false, false, false, false) => Ok(Self::Lines(1000)),
+            (false, false, false, false) => Ok(Self::Lines(1000)),
             (true, false, false, false) => {
-                let s = matches.get_one::<String>(OPT_LINES).unwrap();
-                let n = parse_size(s).map_err(StrategyError::Lines)?;
-                Ok(Self::Lines(n))
+                let s = matches.get_one::<String>(OPT_LINES).unwrap();
+                let n = parse_size(s).map_err(StrategyError::Lines)?;
+                Ok(Self::Lines(n))
             }
             (false, true, false, false) => {
-                let s = matches.get_one::<String>(OPT_BYTES).unwrap();
-                let n = parse_size(s).map_err(StrategyError::Bytes)?;
-                Ok(Self::Bytes(n))
+                let s = matches.get_one::<String>(OPT_BYTES).unwrap();
+                let n = parse_size(s).map_err(StrategyError::Bytes)?;
+                Ok(Self::Bytes(n))
             }
             (false, false, true, false) => {
-                let s = matches.get_one::<String>(OPT_LINE_BYTES).unwrap();
-                let n = parse_size(s).map_err(StrategyError::Bytes)?;
-                Ok(Self::LineBytes(n))
+                let s = matches.get_one::<String>(OPT_LINE_BYTES).unwrap();
+                let n = parse_size(s).map_err(StrategyError::Bytes)?;
+                Ok(Self::LineBytes(n))
             }
             (false, false, false, true) => {
-                let s = matches.get_one::<String>(OPT_NUMBER).unwrap();
-                let number_type = NumberType::from(s).map_err(StrategyError::NumberType)?;
-                Ok(Self::Number(number_type))
+                let s = matches.get_one::<String>(OPT_NUMBER).unwrap();
+                let number_type = NumberType::from(s).map_err(StrategyError::NumberType)?;
+                Ok(Self::Number(number_type))
             }
-            _ => Err(StrategyError::MultipleWays),
+            _ => Err(StrategyError::MultipleWays),
         }
     }
 }
 
-/// Parse the suffix type from the command-line arguments.
-fn suffix_type_from(matches: &ArgMatches) -> Result<(SuffixType, usize), SettingsError> {
-    if matches.value_source(OPT_NUMERIC_SUFFIXES) == Some(ValueSource::CommandLine) {
-        let suffix_start = matches.get_one::<String>(OPT_NUMERIC_SUFFIXES);
-        let suffix_start = suffix_start.ok_or(SettingsError::SuffixNotParsable(String::new()))?;
-        let suffix_start = suffix_start
-            .parse()
-            .map_err(|_| SettingsError::SuffixNotParsable(suffix_start.to_string()))?;
-        Ok((SuffixType::Decimal, suffix_start))
-    } else if matches.value_source(OPT_HEX_SUFFIXES) == Some(ValueSource::CommandLine) {
-        let suffix_start = matches.get_one::<String>(OPT_HEX_SUFFIXES);
-        let suffix_start = suffix_start.ok_or(SettingsError::SuffixNotParsable(String::new()))?;
-        let suffix_start = usize::from_str_radix(suffix_start, 16)
-            .map_err(|_| SettingsError::SuffixNotParsable(suffix_start.to_string()))?;
-        Ok((SuffixType::Hexadecimal, suffix_start))
-    } else {
-        // no numeric/hex suffix
-        Ok((SuffixType::Alphabetic, 0))
+/// Parse the suffix type from the command-line arguments.
+fn suffix_type_from(matches: &ArgMatches) -> Result<(SuffixType, usize), SettingsError> {
+    if matches.value_source(OPT_NUMERIC_SUFFIXES) == Some(ValueSource::CommandLine) {
+        let suffix_start = matches.get_one::<String>(OPT_NUMERIC_SUFFIXES);
+        let suffix_start = suffix_start.ok_or(SettingsError::SuffixNotParsable(String::new()))?;
+        let suffix_start = suffix_start
+            .parse()
+            .map_err(|_| SettingsError::SuffixNotParsable(suffix_start.to_string()))?;
+        Ok((SuffixType::Decimal, suffix_start))
+    } else if matches.value_source(OPT_HEX_SUFFIXES) == Some(ValueSource::CommandLine) {
+        let suffix_start = matches.get_one::<String>(OPT_HEX_SUFFIXES);
+        let suffix_start = suffix_start.ok_or(SettingsError::SuffixNotParsable(String::new()))?;
+        let suffix_start = usize::from_str_radix(suffix_start, 16)
+            .map_err(|_| SettingsError::SuffixNotParsable(suffix_start.to_string()))?;
+        Ok((SuffixType::Hexadecimal, suffix_start))
+    } else {
+        // no numeric/hex suffix
+        Ok((SuffixType::Alphabetic, 0))
     }
 }
 
-/// Parameters that control how a file gets split.
-///
-/// You can convert an [`ArgMatches`] instance into a [`Settings`]
-/// instance by calling [`Settings::from`].
-struct Settings {
-    prefix: String,
-    suffix_type: SuffixType,
-    suffix_length: usize,
-    suffix_start: usize,
-    additional_suffix: String,
-    input: String,
-    /// When supplied, a shell command to output to instead of xaa, xab …
-    filter: Option<String>,
-    strategy: Strategy,
-    verbose: bool,
+/// Parameters that control how a file gets split.
+///
+/// You can convert an [`ArgMatches`] instance into a [`Settings`]
+/// instance by calling [`Settings::from`].
+struct Settings {
+    prefix: String,
+    suffix_type: SuffixType,
+    suffix_length: usize,
+    suffix_start: usize,
+    additional_suffix: String,
+    input: String,
+    /// When supplied, a shell command to output to instead of xaa, xab …
+    filter: Option<String>,
+    strategy: Strategy,
+    verbose: bool,
 
-    /// Whether to *not* produce empty files when using `-n`.
-    ///
-    /// The `-n` command-line argument gives a specific number of
-    /// chunks into which the input files will be split. If the number
-    /// of chunks is greater than the number of bytes, and this is
-    /// `false`, then empty files will be created for the excess
-    /// chunks. If this is `false`, then empty files will not be
-    /// created.
-    elide_empty_files: bool,
+    /// Whether to *not* produce empty files when using `-n`.
+    ///
+    /// The `-n` command-line argument gives a specific number of
+    /// chunks into which the input files will be split. If the number
+    /// of chunks is greater than the number of bytes, and this is
+    /// `false`, then empty files will be created for the excess
+    /// chunks. If this is `false`, then empty files will not be
+    /// created.
+    elide_empty_files: bool,
 }
 
-/// An error when parsing settings from command-line arguments.
-enum SettingsError {
-    /// Invalid chunking strategy.
-    Strategy(StrategyError),
+/// An error when parsing settings from command-line arguments.
+enum SettingsError {
+    /// Invalid chunking strategy.
+    Strategy(StrategyError),
 
-    /// Invalid suffix length parameter.
-    SuffixNotParsable(String),
+    /// Invalid suffix length parameter.
+    SuffixNotParsable(String),
 
-    /// Suffix contains a directory separator, which is not allowed.
-    SuffixContainsSeparator(String),
+    /// Suffix contains a directory separator, which is not allowed.
+    SuffixContainsSeparator(String),
 
-    /// Suffix is not large enough to split into specified chunks
-    SuffixTooSmall(usize),
+    /// Suffix is not large enough to split into specified chunks
+    SuffixTooSmall(usize),
 
-    /// The `--filter` option is not supported on Windows.
-    #[cfg(windows)]
-    NotSupported,
+    /// The `--filter` option is not supported on Windows.
+    #[cfg(windows)]
+    NotSupported,
 }
 
-impl SettingsError {
-    /// Whether the error demands a usage message.
-    fn requires_usage(&self) -> bool {
+impl SettingsError {
+    /// Whether the error demands a usage message.
+    fn requires_usage(&self) -> bool {
         matches!(
             self,
-            Self::Strategy(StrategyError::MultipleWays) | Self::SuffixContainsSeparator(_)
+            Self::Strategy(StrategyError::MultipleWays) | Self::SuffixContainsSeparator(_)
         )
     }
 }
 
-impl fmt::Display for SettingsError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match self {
-            Self::Strategy(e) => e.fmt(f),
-            Self::SuffixNotParsable(s) => write!(f, "invalid suffix length: {}", s.quote()),
-            Self::SuffixTooSmall(i) => write!(f, "the suffix length needs to be at least {}", i),
-            Self::SuffixContainsSeparator(s) => write!(
-                f,
+impl fmt::Display for SettingsError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            Self::Strategy(e) => e.fmt(f),
+            Self::SuffixNotParsable(s) => write!(f, "invalid suffix length: {}", s.quote()),
+            Self::SuffixTooSmall(i) => write!(f, "the suffix length needs to be at least {}", i),
+            Self::SuffixContainsSeparator(s) => write!(
+                f,
                 "invalid suffix {}, contains directory separator",
-                s.quote()
+                s.quote()
             ),
-            #[cfg(windows)]
-            Self::NotSupported => write!(
-                f,
+            #[cfg(windows)]
+            Self::NotSupported => write!(
+                f,
                 "{} is currently not supported in this platform",
-                OPT_FILTER
+                OPT_FILTER
             ),
         }
     }
 }
 
-impl Settings {
-    /// Parse a strategy from the command-line arguments.
-    fn from(matches: &ArgMatches) -> Result<Self, SettingsError> {
-        let additional_suffix = matches
-            .get_one::<String>(OPT_ADDITIONAL_SUFFIX)
-            .unwrap()
-            .to_string();
-        if additional_suffix.contains('/') {
-            return Err(SettingsError::SuffixContainsSeparator(additional_suffix));
+impl Settings {
+    /// Parse a strategy from the command-line arguments.
+    fn from(matches: &ArgMatches) -> Result<Self, SettingsError> {
+        let additional_suffix = matches
+            .get_one::<String>(OPT_ADDITIONAL_SUFFIX)
+            .unwrap()
+            .to_string();
+        if additional_suffix.contains('/') {
+            return Err(SettingsError::SuffixContainsSeparator(additional_suffix));
         }
-        let strategy = Strategy::from(matches).map_err(SettingsError::Strategy)?;
-        let (suffix_type, suffix_start) = suffix_type_from(matches)?;
-        let suffix_length_str = matches.get_one::<String>(OPT_SUFFIX_LENGTH).unwrap();
-        let suffix_length: usize = suffix_length_str
-            .parse()
-            .map_err(|_| SettingsError::SuffixNotParsable(suffix_length_str.to_string()))?;
-        if let Strategy::Number(ref number_type) = strategy {
-            let chunks = number_type.num_chunks();
-            if suffix_length != 0 {
-                let required_suffix_length =
-                    (chunks as f64).log(suffix_type.radix() as f64).ceil() as usize;
-                if suffix_length < required_suffix_length {
-                    return Err(SettingsError::SuffixTooSmall(required_suffix_length));
+        let strategy = Strategy::from(matches).map_err(SettingsError::Strategy)?;
+        let (suffix_type, suffix_start) = suffix_type_from(matches)?;
+        let suffix_length_str = matches.get_one::<String>(OPT_SUFFIX_LENGTH).unwrap();
+        let suffix_length: usize = suffix_length_str
+            .parse()
+            .map_err(|_| SettingsError::SuffixNotParsable(suffix_length_str.to_string()))?;
+        if let Strategy::Number(ref number_type) = strategy {
+            let chunks = number_type.num_chunks();
+            if suffix_length != 0 {
+                let required_suffix_length =
+                    (chunks as f64).log(suffix_type.radix() as f64).ceil() as usize;
+                if suffix_length < required_suffix_length {
+                    return Err(SettingsError::SuffixTooSmall(required_suffix_length));
                 }
             }
         }
-        let result = Self {
-            suffix_length: suffix_length_str
-                .parse()
-                .map_err(|_| SettingsError::SuffixNotParsable(suffix_length_str.to_string()))?,
-            suffix_type,
-            suffix_start,
-            additional_suffix,
-            verbose: matches.value_source("verbose") == Some(ValueSource::CommandLine),
-            strategy,
-            input: matches.get_one::<String>(ARG_INPUT).unwrap().to_owned(),
-            prefix: matches.get_one::<String>(ARG_PREFIX).unwrap().to_owned(),
-            filter: matches.get_one::<String>(OPT_FILTER).map(|s| s.to_owned()),
-            elide_empty_files: matches.get_flag(OPT_ELIDE_EMPTY_FILES),
+        let result = Self {
+            suffix_length: suffix_length_str
+                .parse()
+                .map_err(|_| SettingsError::SuffixNotParsable(suffix_length_str.to_string()))?,
+            suffix_type,
+            suffix_start,
+            additional_suffix,
+            verbose: matches.value_source("verbose") == Some(ValueSource::CommandLine),
+            strategy,
+            input: matches.get_one::<String>(ARG_INPUT).unwrap().to_owned(),
+            prefix: matches.get_one::<String>(ARG_PREFIX).unwrap().to_owned(),
+            filter: matches.get_one::<String>(OPT_FILTER).map(|s| s.to_owned()),
+            elide_empty_files: matches.get_flag(OPT_ELIDE_EMPTY_FILES),
         };
-        #[cfg(windows)]
-        if result.filter.is_some() {
-            // see https://github.com/rust-lang/rust/issues/29494
-            return Err(SettingsError::NotSupported);
+        #[cfg(windows)]
+        if result.filter.is_some() {
+            // see https://github.com/rust-lang/rust/issues/29494
+            return Err(SettingsError::NotSupported);
         }
 
-        Ok(result)
+        Ok(result)
     }
 
-    fn instantiate_current_writer(&self, filename: &str) -> io::Result<BufWriter<Box<dyn Write>>> {
-        if platform::paths_refer_to_same_file(&self.input, filename) {
-            return Err(io::Error::new(
-                ErrorKind::Other,
-                format!("'{}' would overwrite input; aborting", filename),
+    fn instantiate_current_writer(&self, filename: &str) -> io::Result<BufWriter<Box<dyn Write>>> {
+        if platform::paths_refer_to_same_file(&self.input, filename) {
+            return Err(io::Error::new(
+                ErrorKind::Other,
+                format!("'{}' would overwrite input; aborting", filename),
             ));
         }
 
-        platform::instantiate_current_writer(&self.filter, filename)
+        platform::instantiate_current_writer(&self.filter, filename)
     }
 }
 
-/// Write a certain number of bytes to one file, then move on to another one.
-///
-/// This struct maintains an underlying writer representing the
-/// current chunk of the output. If a call to [`write`] would cause
-/// the underlying writer to write more than the allowed number of
-/// bytes, a new writer is created and the excess bytes are written to
-/// that one instead. As many new underlying writers are created as
-/// needed to write all the bytes in the input buffer.
-struct ByteChunkWriter<'a> {
-    /// Parameters for creating the underlying writer for each new chunk.
-    settings: &'a Settings,
+/// Write a certain number of bytes to one file, then move on to another one.
+///
+/// This struct maintains an underlying writer representing the
+/// current chunk of the output. If a call to [`write`] would cause
+/// the underlying writer to write more than the allowed number of
+/// bytes, a new writer is created and the excess bytes are written to
+/// that one instead. As many new underlying writers are created as
+/// needed to write all the bytes in the input buffer.
+struct ByteChunkWriter<'a> {
+    /// Parameters for creating the underlying writer for each new chunk.
+    settings: &'a Settings,
 
-    /// The maximum number of bytes allowed for a single chunk of output.
-    chunk_size: u64,
+    /// The maximum number of bytes allowed for a single chunk of output.
+    chunk_size: u64,
 
-    /// Running total of number of chunks that have been completed.
-    num_chunks_written: u64,
+    /// Running total of number of chunks that have been completed.
+    num_chunks_written: u64,
 
-    /// Remaining capacity in number of bytes in the current chunk.
-    ///
-    /// This number starts at `chunk_size` and decreases as bytes are
-    /// written. Once it reaches zero, a writer for a new chunk is
-    /// initialized and this number gets reset to `chunk_size`.
-    num_bytes_remaining_in_current_chunk: u64,
+    /// Remaining capacity in number of bytes in the current chunk.
+    ///
+    /// This number starts at `chunk_size` and decreases as bytes are
+    /// written. Once it reaches zero, a writer for a new chunk is
+    /// initialized and this number gets reset to `chunk_size`.
+    num_bytes_remaining_in_current_chunk: u64,
 
-    /// The underlying writer for the current chunk.
-    ///
-    /// Once the number of bytes written to this writer exceeds
-    /// `chunk_size`, a new writer is initialized and assigned to this
-    /// field.
-    inner: BufWriter<Box<dyn Write>>,
+    /// The underlying writer for the current chunk.
+    ///
+    /// Once the number of bytes written to this writer exceeds
+    /// `chunk_size`, a new writer is initialized and assigned to this
+    /// field.
+    inner: BufWriter<Box<dyn Write>>,
 
-    /// Iterator that yields filenames for each chunk.
-    filename_iterator: FilenameIterator<'a>,
+    /// Iterator that yields filenames for each chunk.
+    filename_iterator: FilenameIterator<'a>,
 }
 
-impl<'a> ByteChunkWriter<'a> {
-    fn new(chunk_size: u64, settings: &'a Settings) -> UResult<ByteChunkWriter<'a>> {
-        let mut filename_iterator = FilenameIterator::new(
-            &settings.prefix,
-            &settings.additional_suffix,
-            settings.suffix_length,
-            settings.suffix_type,
-            settings.suffix_start,
+impl<'a> ByteChunkWriter<'a> {
+    fn new(chunk_size: u64, settings: &'a Settings) -> UResult<ByteChunkWriter<'a>> {
+        let mut filename_iterator = FilenameIterator::new(
+            &settings.prefix,
+            &settings.additional_suffix,
+            settings.suffix_length,
+            settings.suffix_type,
+            settings.suffix_start,
         )?;
-        let filename = filename_iterator
-            .next()
-            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
-        if settings.verbose {
-            println!("creating file {}", filename.quote());
+        let filename = filename_iterator
+            .next()
+            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
+        if settings.verbose {
+            println!("creating file {}", filename.quote());
         }
-        let inner = settings.instantiate_current_writer(&filename)?;
-        Ok(ByteChunkWriter {
-            settings,
-            chunk_size,
-            num_bytes_remaining_in_current_chunk: chunk_size,
-            num_chunks_written: 0,
-            inner,
-            filename_iterator,
+        let inner = settings.instantiate_current_writer(&filename)?;
+        Ok(ByteChunkWriter {
+            settings,
+            chunk_size,
+            num_bytes_remaining_in_current_chunk: chunk_size,
+            num_chunks_written: 0,
+            inner,
+            filename_iterator,
         })
     }
 }
 
-impl<'a> Write for ByteChunkWriter<'a> {
-    fn write(&mut self, mut buf: &[u8]) -> std::io::Result<usize> {
-        // If the length of `buf` exceeds the number of bytes remaining
-        // in the current chunk, we will need to write to multiple
-        // different underlying writers. In that case, each iteration of
-        // this loop writes to the underlying writer that corresponds to
-        // the current chunk number.
-        let mut carryover_bytes_written: usize = 0;
-        loop {
-            if buf.is_empty() {
-                return Ok(carryover_bytes_written);
+impl<'a> Write for ByteChunkWriter<'a> {
+    fn write(&mut self, mut buf: &[u8]) -> std::io::Result<usize> {
+        // If the length of `buf` exceeds the number of bytes remaining
+        // in the current chunk, we will need to write to multiple
+        // different underlying writers. In that case, each iteration of
+        // this loop writes to the underlying writer that corresponds to
+        // the current chunk number.
+        let mut carryover_bytes_written: usize = 0;
+        loop {
+            if buf.is_empty() {
+                return Ok(carryover_bytes_written);
             }
 
-            if self.num_bytes_remaining_in_current_chunk == 0 {
-                // Increment the chunk number, reset the number of bytes remaining, and instantiate the new underlying writer.
-                self.num_chunks_written += 1;
-                self.num_bytes_remaining_in_current_chunk = self.chunk_size;
+            if self.num_bytes_remaining_in_current_chunk == 0 {
+                // Increment the chunk number, reset the number of bytes remaining, and instantiate the new underlying writer.
+                self.num_chunks_written += 1;
+                self.num_bytes_remaining_in_current_chunk = self.chunk_size;
 
-                // Allocate the new file, since at this point we know there are bytes to be written to it.
-                let filename = self.filename_iterator.next().ok_or_else(|| {
-                    std::io::Error::new(ErrorKind::Other, "output file suffixes exhausted")
+                // Allocate the new file, since at this point we know there are bytes to be written to it.
+                let filename = self.filename_iterator.next().ok_or_else(|| {
+                    std::io::Error::new(ErrorKind::Other, "output file suffixes exhausted")
                 })?;
-                if self.settings.verbose {
-                    println!("creating file {}", filename.quote());
+                if self.settings.verbose {
+                    println!("creating file {}", filename.quote());
                 }
-                self.inner = self.settings.instantiate_current_writer(&filename)?;
+                self.inner = self.settings.instantiate_current_writer(&filename)?;
             }
 
-            // If the capacity of this chunk is greater than the number of
-            // bytes in `buf`, then write all the bytes in `buf`. Otherwise,
-            // write enough bytes to fill the current chunk, then increment
-            // the chunk number and repeat.
-            let n = buf.len();
-            if (n as u64) < self.num_bytes_remaining_in_current_chunk {
-                let num_bytes_written = self.inner.write(buf)?;
-                self.num_bytes_remaining_in_current_chunk -= num_bytes_written as u64;
-                return Ok(carryover_bytes_written + num_bytes_written);
-            } else {
-                // Write enough bytes to fill the current chunk.
-                //
-                // Conversion to usize is safe because we checked that
-                // self.num_bytes_remaining_in_current_chunk is lower than
-                // n, which is already usize.
-                let i = self.num_bytes_remaining_in_current_chunk as usize;
-                let num_bytes_written = self.inner.write(&buf[..i])?;
-                self.num_bytes_remaining_in_current_chunk -= num_bytes_written as u64;
+            // If the capacity of this chunk is greater than the number of
+            // bytes in `buf`, then write all the bytes in `buf`. Otherwise,
+            // write enough bytes to fill the current chunk, then increment
+            // the chunk number and repeat.
+            let n = buf.len();
+            if (n as u64) < self.num_bytes_remaining_in_current_chunk {
+                let num_bytes_written = self.inner.write(buf)?;
+                self.num_bytes_remaining_in_current_chunk -= num_bytes_written as u64;
+                return Ok(carryover_bytes_written + num_bytes_written);
+            } else {
+                // Write enough bytes to fill the current chunk.
+                //
+                // Conversion to usize is safe because we checked that
+                // self.num_bytes_remaining_in_current_chunk is lower than
+                // n, which is already usize.
+                let i = self.num_bytes_remaining_in_current_chunk as usize;
+                let num_bytes_written = self.inner.write(&buf[..i])?;
+                self.num_bytes_remaining_in_current_chunk -= num_bytes_written as u64;
 
-                // It's possible that the underlying writer did not
-                // write all the bytes.
-                if num_bytes_written < i {
-                    return Ok(carryover_bytes_written + num_bytes_written);
-                } else {
-                    // Move the window to look at only the remaining bytes.
-                    buf = &buf[i..];
+                // It's possible that the underlying writer did not
+                // write all the bytes.
+                if num_bytes_written < i {
+                    return Ok(carryover_bytes_written + num_bytes_written);
+                } else {
+                    // Move the window to look at only the remaining bytes.
+                    buf = &buf[i..];
 
-                    // Remember for the next iteration that we wrote these bytes.
-                    carryover_bytes_written += num_bytes_written;
+                    // Remember for the next iteration that we wrote these bytes.
+                    carryover_bytes_written += num_bytes_written;
                 }
             }
         }
     }
-    fn flush(&mut self) -> std::io::Result<()> {
-        self.inner.flush()
+    fn flush(&mut self) -> std::io::Result<()> {
+        self.inner.flush()
     }
 }
 
-/// Write a certain number of lines to one file, then move on to another one.
-///
-/// This struct maintains an underlying writer representing the
-/// current chunk of the output. If a call to [`write`] would cause
-/// the underlying writer to write more than the allowed number of
-/// lines, a new writer is created and the excess lines are written to
-/// that one instead. As many new underlying writers are created as
-/// needed to write all the lines in the input buffer.
-struct LineChunkWriter<'a> {
-    /// Parameters for creating the underlying writer for each new chunk.
-    settings: &'a Settings,
+/// Write a certain number of lines to one file, then move on to another one.
+///
+/// This struct maintains an underlying writer representing the
+/// current chunk of the output. If a call to [`write`] would cause
+/// the underlying writer to write more than the allowed number of
+/// lines, a new writer is created and the excess lines are written to
+/// that one instead. As many new underlying writers are created as
+/// needed to write all the lines in the input buffer.
+struct LineChunkWriter<'a> {
+    /// Parameters for creating the underlying writer for each new chunk.
+    settings: &'a Settings,
 
-    /// The maximum number of lines allowed for a single chunk of output.
-    chunk_size: u64,
+    /// The maximum number of lines allowed for a single chunk of output.
+    chunk_size: u64,
 
-    /// Running total of number of chunks that have been completed.
-    num_chunks_written: u64,
+    /// Running total of number of chunks that have been completed.
+    num_chunks_written: u64,
 
-    /// Remaining capacity in number of lines in the current chunk.
-    ///
-    /// This number starts at `chunk_size` and decreases as lines are
-    /// written. Once it reaches zero, a writer for a new chunk is
-    /// initialized and this number gets reset to `chunk_size`.
-    num_lines_remaining_in_current_chunk: u64,
+    /// Remaining capacity in number of lines in the current chunk.
+    ///
+    /// This number starts at `chunk_size` and decreases as lines are
+    /// written. Once it reaches zero, a writer for a new chunk is
+    /// initialized and this number gets reset to `chunk_size`.
+    num_lines_remaining_in_current_chunk: u64,
 
-    /// The underlying writer for the current chunk.
-    ///
-    /// Once the number of lines written to this writer exceeds
-    /// `chunk_size`, a new writer is initialized and assigned to this
-    /// field.
-    inner: BufWriter<Box<dyn Write>>,
+    /// The underlying writer for the current chunk.
+    ///
+    /// Once the number of lines written to this writer exceeds
+    /// `chunk_size`, a new writer is initialized and assigned to this
+    /// field.
+    inner: BufWriter<Box<dyn Write>>,
 
-    /// Iterator that yields filenames for each chunk.
-    filename_iterator: FilenameIterator<'a>,
+    /// Iterator that yields filenames for each chunk.
+    filename_iterator: FilenameIterator<'a>,
 }
 
-impl<'a> LineChunkWriter<'a> {
-    fn new(chunk_size: u64, settings: &'a Settings) -> UResult<LineChunkWriter<'a>> {
-        let mut filename_iterator = FilenameIterator::new(
-            &settings.prefix,
-            &settings.additional_suffix,
-            settings.suffix_length,
-            settings.suffix_type,
-            settings.suffix_start,
+impl<'a> LineChunkWriter<'a> {
+    fn new(chunk_size: u64, settings: &'a Settings) -> UResult<LineChunkWriter<'a>> {
+        let mut filename_iterator = FilenameIterator::new(
+            &settings.prefix,
+            &settings.additional_suffix,
+            settings.suffix_length,
+            settings.suffix_type,
+            settings.suffix_start,
         )?;
-        let filename = filename_iterator
-            .next()
-            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
-        if settings.verbose {
-            println!("creating file {}", filename.quote());
+        let filename = filename_iterator
+            .next()
+            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
+        if settings.verbose {
+            println!("creating file {}", filename.quote());
         }
-        let inner = settings.instantiate_current_writer(&filename)?;
-        Ok(LineChunkWriter {
-            settings,
-            chunk_size,
-            num_lines_remaining_in_current_chunk: chunk_size,
-            num_chunks_written: 0,
-            inner,
-            filename_iterator,
+        let inner = settings.instantiate_current_writer(&filename)?;
+        Ok(LineChunkWriter {
+            settings,
+            chunk_size,
+            num_lines_remaining_in_current_chunk: chunk_size,
+            num_chunks_written: 0,
+            inner,
+            filename_iterator,
         })
     }
 }
 
-impl<'a> Write for LineChunkWriter<'a> {
-    fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
-        // If the number of lines in `buf` exceeds the number of lines
-        // remaining in the current chunk, we will need to write to
-        // multiple different underlying writers. In that case, each
-        // iteration of this loop writes to the underlying writer that
-        // corresponds to the current chunk number.
-        let mut prev = 0;
-        let mut total_bytes_written = 0;
-        for i in memchr::memchr_iter(b'\n', buf) {
-            // If we have exceeded the number of lines to write in the
-            // current chunk, then start a new chunk and its
-            // corresponding writer.
-            if self.num_lines_remaining_in_current_chunk == 0 {
-                self.num_chunks_written += 1;
-                let filename = self.filename_iterator.next().ok_or_else(|| {
-                    std::io::Error::new(ErrorKind::Other, "output file suffixes exhausted")
+impl<'a> Write for LineChunkWriter<'a> {
+    fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
+        // If the number of lines in `buf` exceeds the number of lines
+        // remaining in the current chunk, we will need to write to
+        // multiple different underlying writers. In that case, each
+        // iteration of this loop writes to the underlying writer that
+        // corresponds to the current chunk number.
+        let mut prev = 0;
+        let mut total_bytes_written = 0;
+        for i in memchr::memchr_iter(b'\n', buf) {
+            // If we have exceeded the number of lines to write in the
+            // current chunk, then start a new chunk and its
+            // corresponding writer.
+            if self.num_lines_remaining_in_current_chunk == 0 {
+                self.num_chunks_written += 1;
+                let filename = self.filename_iterator.next().ok_or_else(|| {
+                    std::io::Error::new(ErrorKind::Other, "output file suffixes exhausted")
                 })?;
-                if self.settings.verbose {
-                    println!("creating file {}", filename.quote());
+                if self.settings.verbose {
+                    println!("creating file {}", filename.quote());
                 }
-                self.inner = self.settings.instantiate_current_writer(&filename)?;
-                self.num_lines_remaining_in_current_chunk = self.chunk_size;
+                self.inner = self.settings.instantiate_current_writer(&filename)?;
+                self.num_lines_remaining_in_current_chunk = self.chunk_size;
             }
 
-            // Write the line, starting from *after* the previous
-            // newline character and ending *after* the current
-            // newline character.
-            let n = self.inner.write(&buf[prev..i + 1])?;
-            total_bytes_written += n;
-            prev = i + 1;
-            self.num_lines_remaining_in_current_chunk -= 1;
+            // Write the line, starting from *after* the previous
+            // newline character and ending *after* the current
+            // newline character.
+            let n = self.inner.write(&buf[prev..i + 1])?;
+            total_bytes_written += n;
+            prev = i + 1;
+            self.num_lines_remaining_in_current_chunk -= 1;
         }
 
-        let n = self.inner.write(&buf[prev..buf.len()])?;
-        total_bytes_written += n;
-        Ok(total_bytes_written)
+        let n = self.inner.write(&buf[prev..buf.len()])?;
+        total_bytes_written += n;
+        Ok(total_bytes_written)
     }
 
-    fn flush(&mut self) -> std::io::Result<()> {
-        self.inner.flush()
+    fn flush(&mut self) -> std::io::Result<()> {
+        self.inner.flush()
     }
 }
 
-/// Write lines to each sequential output files, limited by bytes.
-///
-/// This struct maintains an underlying writer representing the
-/// current chunk of the output. On each call to [`write`], it writes
-/// as many lines as possible to the current chunk without exceeding
-/// the specified byte limit. If a single line has more bytes than the
-/// limit, then fill an entire single chunk with those bytes and
-/// handle the remainder of the line as if it were its own distinct
-/// line. As many new underlying writers are created as needed to
-/// write all the data in the input buffer.
-struct LineBytesChunkWriter<'a> {
-    /// Parameters for creating the underlying writer for each new chunk.
-    settings: &'a Settings,
+/// Write lines to each sequential output files, limited by bytes.
+///
+/// This struct maintains an underlying writer representing the
+/// current chunk of the output. On each call to [`write`], it writes
+/// as many lines as possible to the current chunk without exceeding
+/// the specified byte limit. If a single line has more bytes than the
+/// limit, then fill an entire single chunk with those bytes and
+/// handle the remainder of the line as if it were its own distinct
+/// line. As many new underlying writers are created as needed to
+/// write all the data in the input buffer.
+struct LineBytesChunkWriter<'a> {
+    /// Parameters for creating the underlying writer for each new chunk.
+    settings: &'a Settings,
 
-    /// The maximum number of bytes allowed for a single chunk of output.
-    chunk_size: u64,
+    /// The maximum number of bytes allowed for a single chunk of output.
+    chunk_size: u64,
 
-    /// Running total of number of chunks that have been completed.
-    num_chunks_written: usize,
+    /// Running total of number of chunks that have been completed.
+    num_chunks_written: usize,
 
-    /// Remaining capacity in number of bytes in the current chunk.
-    ///
-    /// This number starts at `chunk_size` and decreases as lines are
-    /// written. Once it reaches zero, a writer for a new chunk is
-    /// initialized and this number gets reset to `chunk_size`.
-    num_bytes_remaining_in_current_chunk: usize,
+    /// Remaining capacity in number of bytes in the current chunk.
+    ///
+    /// This number starts at `chunk_size` and decreases as lines are
+    /// written. Once it reaches zero, a writer for a new chunk is
+    /// initialized and this number gets reset to `chunk_size`.
+    num_bytes_remaining_in_current_chunk: usize,
 
-    /// The underlying writer for the current chunk.
-    ///
-    /// Once the number of bytes written to this writer exceeds
-    /// `chunk_size`, a new writer is initialized and assigned to this
-    /// field.
-    inner: BufWriter<Box<dyn Write>>,
+    /// The underlying writer for the current chunk.
+    ///
+    /// Once the number of bytes written to this writer exceeds
+    /// `chunk_size`, a new writer is initialized and assigned to this
+    /// field.
+    inner: BufWriter<Box<dyn Write>>,
 
-    /// Iterator that yields filenames for each chunk.
-    filename_iterator: FilenameIterator<'a>,
+    /// Iterator that yields filenames for each chunk.
+    filename_iterator: FilenameIterator<'a>,
 }
 
-impl<'a> LineBytesChunkWriter<'a> {
-    fn new(chunk_size: u64, settings: &'a Settings) -> UResult<LineBytesChunkWriter<'a>> {
-        let mut filename_iterator = FilenameIterator::new(
-            &settings.prefix,
-            &settings.additional_suffix,
-            settings.suffix_length,
-            settings.suffix_type,
-            settings.suffix_start,
+impl<'a> LineBytesChunkWriter<'a> {
+    fn new(chunk_size: u64, settings: &'a Settings) -> UResult<LineBytesChunkWriter<'a>> {
+        let mut filename_iterator = FilenameIterator::new(
+            &settings.prefix,
+            &settings.additional_suffix,
+            settings.suffix_length,
+            settings.suffix_type,
+            settings.suffix_start,
         )?;
-        let filename = filename_iterator
-            .next()
-            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
-        if settings.verbose {
-            println!("creating file {}", filename.quote());
+        let filename = filename_iterator
+            .next()
+            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
+        if settings.verbose {
+            println!("creating file {}", filename.quote());
         }
-        let inner = settings.instantiate_current_writer(&filename)?;
-        Ok(LineBytesChunkWriter {
-            settings,
-            chunk_size,
-            num_bytes_remaining_in_current_chunk: usize::try_from(chunk_size).unwrap(),
-            num_chunks_written: 0,
-            inner,
-            filename_iterator,
+        let inner = settings.instantiate_current_writer(&filename)?;
+        Ok(LineBytesChunkWriter {
+            settings,
+            chunk_size,
+            num_bytes_remaining_in_current_chunk: usize::try_from(chunk_size).unwrap(),
+            num_chunks_written: 0,
+            inner,
+            filename_iterator,
         })
     }
 }
 
-impl<'a> Write for LineBytesChunkWriter<'a> {
-    /// Write as many lines to a chunk as possible without
-    /// exceeding the byte limit. If a single line has more bytes
-    /// than the limit, then fill an entire single chunk with those
-    /// bytes and handle the remainder of the line as if it were
-    /// its own distinct line.
-    ///
-    /// For example: if the `chunk_size` is 8 and the input is:
-    ///
-    /// ```text
-    /// aaaaaaaaa\nbbbb\ncccc\ndd\nee\n
-    /// ```
-    ///
-    /// then the output gets broken into chunks like this:
-    ///
-    /// ```text
-    /// chunk 0    chunk 1    chunk 2    chunk 3
-    ///
-    /// 0            1             2
-    /// 01234567  89 01234   56789 012   345 6
-    /// |------|  |-------|  |--------|  |---|
-    /// aaaaaaaa  a\nbbbb\n  cccc\ndd\n  ee\n
-    /// ```
-    fn write(&mut self, mut buf: &[u8]) -> std::io::Result<usize> {
-        // The total number of bytes written during the loop below.
-        //
-        // It is necessary to keep this running total because we may
-        // be making multiple calls to `write()` on multiple different
-        // underlying writers and we want the final reported number of
-        // bytes written to reflect the total number of bytes written
-        // to all of the underlying writers.
-        let mut total_bytes_written = 0;
+impl<'a> Write for LineBytesChunkWriter<'a> {
+    /// Write as many lines to a chunk as possible without
+    /// exceeding the byte limit. If a single line has more bytes
+    /// than the limit, then fill an entire single chunk with those
+    /// bytes and handle the remainder of the line as if it were
+    /// its own distinct line.
+    ///
+    /// For example: if the `chunk_size` is 8 and the input is:
+    ///
+    /// ```text
+    /// aaaaaaaaa\nbbbb\ncccc\ndd\nee\n
+    /// ```
+    ///
+    /// then the output gets broken into chunks like this:
+    ///
+    /// ```text
+    /// chunk 0    chunk 1    chunk 2    chunk 3
+    ///
+    /// 0            1             2
+    /// 01234567  89 01234   56789 012   345 6
+    /// |------|  |-------|  |--------|  |---|
+    /// aaaaaaaa  a\nbbbb\n  cccc\ndd\n  ee\n
+    /// ```
+    fn write(&mut self, mut buf: &[u8]) -> std::io::Result<usize> {
+        // The total number of bytes written during the loop below.
+        //
+        // It is necessary to keep this running total because we may
+        // be making multiple calls to `write()` on multiple different
+        // underlying writers and we want the final reported number of
+        // bytes written to reflect the total number of bytes written
+        // to all of the underlying writers.
+        let mut total_bytes_written = 0;
 
-        // Loop until we have written all bytes in the input buffer
-        // (or an IO error occurs).
-        loop {
-            // If the buffer is empty, then we are done writing.
-            if buf.is_empty() {
-                return Ok(total_bytes_written);
+        // Loop until we have written all bytes in the input buffer
+        // (or an IO error occurs).
+        loop {
+            // If the buffer is empty, then we are done writing.
+            if buf.is_empty() {
+                return Ok(total_bytes_written);
             }
 
-            // If we have filled the current chunk with bytes, then
-            // start a new chunk and initialize its corresponding
-            // writer.
-            if self.num_bytes_remaining_in_current_chunk == 0 {
-                self.num_chunks_written += 1;
-                let filename = self.filename_iterator.next().ok_or_else(|| {
-                    std::io::Error::new(ErrorKind::Other, "output file suffixes exhausted")
+            // If we have filled the current chunk with bytes, then
+            // start a new chunk and initialize its corresponding
+            // writer.
+            if self.num_bytes_remaining_in_current_chunk == 0 {
+                self.num_chunks_written += 1;
+                let filename = self.filename_iterator.next().ok_or_else(|| {
+                    std::io::Error::new(ErrorKind::Other, "output file suffixes exhausted")
                 })?;
-                if self.settings.verbose {
-                    println!("creating file {}", filename.quote());
+                if self.settings.verbose {
+                    println!("creating file {}", filename.quote());
                 }
-                self.inner = self.settings.instantiate_current_writer(&filename)?;
-                self.num_bytes_remaining_in_current_chunk = self.chunk_size.try_into().unwrap();
+                self.inner = self.settings.instantiate_current_writer(&filename)?;
+                self.num_bytes_remaining_in_current_chunk = self.chunk_size.try_into().unwrap();
             }
 
-            // Find the first newline character in the buffer.
-            match memchr::memchr(b'\n', buf) {
-                // If there is no newline character and the buffer is
-                // not empty, then write as many bytes as we can and
-                // then move on to the next chunk if necessary.
-                None => {
-                    let end = self.num_bytes_remaining_in_current_chunk;
+            // Find the first newline character in the buffer.
+            match memchr::memchr(b'\n', buf) {
+                // If there is no newline character and the buffer is
+                // not empty, then write as many bytes as we can and
+                // then move on to the next chunk if necessary.
+                None => {
+                    let end = self.num_bytes_remaining_in_current_chunk;
 
-                    // This is ugly but here to match GNU behavior. If the input
-                    // doesn't end with a \n, pretend that it does for handling
-                    // the second to last segment chunk. See `line-bytes.sh`.
-                    if end == buf.len()
-                        && self.num_bytes_remaining_in_current_chunk
-                            < self.chunk_size.try_into().unwrap()
-                        && buf[buf.len() - 1] != b'\n'
-                    {
-                        self.num_bytes_remaining_in_current_chunk = 0;
-                    } else {
-                        let num_bytes_written = self.inner.write(&buf[..end.min(buf.len())])?;
-                        self.num_bytes_remaining_in_current_chunk -= num_bytes_written;
-                        total_bytes_written += num_bytes_written;
-                        buf = &buf[num_bytes_written..];
+                    // This is ugly but here to match GNU behavior. If the input
+                    // doesn't end with a \n, pretend that it does for handling
+                    // the second to last segment chunk. See `line-bytes.sh`.
+                    if end == buf.len()
+                        && self.num_bytes_remaining_in_current_chunk
+                            < self.chunk_size.try_into().unwrap()
+                        && buf[buf.len() - 1] != b'\n'
+                    {
+                        self.num_bytes_remaining_in_current_chunk = 0;
+                    } else {
+                        let num_bytes_written = self.inner.write(&buf[..end.min(buf.len())])?;
+                        self.num_bytes_remaining_in_current_chunk -= num_bytes_written;
+                        total_bytes_written += num_bytes_written;
+                        buf = &buf[num_bytes_written..];
                     }
                 }
 
-                // If there is a newline character and the line
-                // (including the newline character) will fit in the
-                // current chunk, then write the entire line and
-                // continue to the next iteration. (See chunk 1 in the
-                // example comment above.)
-                Some(i) if i < self.num_bytes_remaining_in_current_chunk => {
-                    let num_bytes_written = self.inner.write(&buf[..i + 1])?;
-                    self.num_bytes_remaining_in_current_chunk -= num_bytes_written;
-                    total_bytes_written += num_bytes_written;
-                    buf = &buf[num_bytes_written..];
+                // If there is a newline character and the line
+                // (including the newline character) will fit in the
+                // current chunk, then write the entire line and
+                // continue to the next iteration. (See chunk 1 in the
+                // example comment above.)
+                Some(i) if i < self.num_bytes_remaining_in_current_chunk => {
+                    let num_bytes_written = self.inner.write(&buf[..i + 1])?;
+                    self.num_bytes_remaining_in_current_chunk -= num_bytes_written;
+                    total_bytes_written += num_bytes_written;
+                    buf = &buf[num_bytes_written..];
                 }
 
-                // If there is a newline character, the line
-                // (including the newline character) will not fit in
-                // the current chunk, *and* no other lines have been
-                // written to the current chunk, then write as many
-                // bytes as we can and continue to the next
-                // iteration. (See chunk 0 in the example comment
-                // above.)
-                Some(_)
-                    if self.num_bytes_remaining_in_current_chunk
-                        == self.chunk_size.try_into().unwrap() =>
+                // If there is a newline character, the line
+                // (including the newline character) will not fit in
+                // the current chunk, *and* no other lines have been
+                // written to the current chunk, then write as many
+                // bytes as we can and continue to the next
+                // iteration. (See chunk 0 in the example comment
+                // above.)
+                Some(_)
+                    if self.num_bytes_remaining_in_current_chunk
+                        == self.chunk_size.try_into().unwrap() =>
                 {
-                    let end = self.num_bytes_remaining_in_current_chunk;
-                    let num_bytes_written = self.inner.write(&buf[..end])?;
-                    self.num_bytes_remaining_in_current_chunk -= num_bytes_written;
-                    total_bytes_written += num_bytes_written;
-                    buf = &buf[num_bytes_written..];
+                    let end = self.num_bytes_remaining_in_current_chunk;
+                    let num_bytes_written = self.inner.write(&buf[..end])?;
+                    self.num_bytes_remaining_in_current_chunk -= num_bytes_written;
+                    total_bytes_written += num_bytes_written;
+                    buf = &buf[num_bytes_written..];
                 }
 
-                // If there is a newline character, the line
-                // (including the newline character) will not fit in
-                // the current chunk, and at least one other line has
-                // been written to the current chunk, then signal to
-                // the next iteration that a new chunk needs to be
-                // created and continue to the next iteration of the
-                // loop to try writing the line there.
-                Some(_) => {
-                    self.num_bytes_remaining_in_current_chunk = 0;
+                // If there is a newline character, the line
+                // (including the newline character) will not fit in
+                // the current chunk, and at least one other line has
+                // been written to the current chunk, then signal to
+                // the next iteration that a new chunk needs to be
+                // created and continue to the next iteration of the
+                // loop to try writing the line there.
+                Some(_) => {
+                    self.num_bytes_remaining_in_current_chunk = 0;
                 }
             }
         }
     }
 
-    fn flush(&mut self) -> std::io::Result<()> {
-        self.inner.flush()
+    fn flush(&mut self) -> std::io::Result<()> {
+        self.inner.flush()
     }
 }
 
-/// Split a file into a specific number of chunks by byte.
-///
-/// This function always creates one output file for each chunk, even
-/// if there is an error reading or writing one of the chunks or if
-/// the input file is truncated. However, if the `filter` option is
-/// being used, then no files are created.
-///
-/// # Errors
-///
-/// This function returns an error if there is a problem reading from
-/// `reader` or writing to one of the output files.
-fn split_into_n_chunks_by_byte<R>(
-    settings: &Settings,
-    reader: &mut R,
-    num_chunks: u64,
-) -> UResult<()>
-where
-    R: Read,
+/// Split a file into a specific number of chunks by byte.
+///
+/// This function always creates one output file for each chunk, even
+/// if there is an error reading or writing one of the chunks or if
+/// the input file is truncated. However, if the `filter` option is
+/// being used, then no files are created.
+///
+/// # Errors
+///
+/// This function returns an error if there is a problem reading from
+/// `reader` or writing to one of the output files.
+fn split_into_n_chunks_by_byte<R>(
+    settings: &Settings,
+    reader: &mut R,
+    num_chunks: u64,
+) -> UResult<()>
+where
+    R: Read,
 {
-    // Get the size of the input file in bytes and compute the number
-    // of bytes per chunk.
-    //
-    // If the requested number of chunks exceeds the number of bytes
-    // in the file *and* the `elide_empty_files` parameter is enabled,
-    // then behave as if the number of chunks was set to the number of
-    // bytes in the file. This ensures that we don't write empty
-    // files. Otherwise, just write the `num_chunks - num_bytes` empty
-    // files.
-    let metadata = metadata(&settings.input).map_err(|_| {
-        USimpleError::new(1, format!("{}: cannot determine file size", settings.input))
+    // Get the size of the input file in bytes and compute the number
+    // of bytes per chunk.
+    //
+    // If the requested number of chunks exceeds the number of bytes
+    // in the file *and* the `elide_empty_files` parameter is enabled,
+    // then behave as if the number of chunks was set to the number of
+    // bytes in the file. This ensures that we don't write empty
+    // files. Otherwise, just write the `num_chunks - num_bytes` empty
+    // files.
+    let metadata = metadata(&settings.input).map_err(|_| {
+        USimpleError::new(1, format!("{}: cannot determine file size", settings.input))
     })?;
 
-    let num_bytes = metadata.len();
-    let will_have_empty_files = settings.elide_empty_files && num_chunks > num_bytes;
-    let (num_chunks, chunk_size) = if will_have_empty_files {
-        let num_chunks = num_bytes;
-        let chunk_size = 1;
-        (num_chunks, chunk_size)
-    } else {
-        let chunk_size = (num_bytes / (num_chunks)).max(1);
-        (num_chunks, chunk_size)
+    let num_bytes = metadata.len();
+    let will_have_empty_files = settings.elide_empty_files && num_chunks > num_bytes;
+    let (num_chunks, chunk_size) = if will_have_empty_files {
+        let num_chunks = num_bytes;
+        let chunk_size = 1;
+        (num_chunks, chunk_size)
+    } else {
+        let chunk_size = (num_bytes / (num_chunks)).max(1);
+        (num_chunks, chunk_size)
     };
 
-    // If we would have written zero chunks of output, then terminate
-    // immediately. This happens on `split -e -n 3 /dev/null`, for
-    // example.
-    if num_chunks == 0 {
-        return Ok(());
+    // If we would have written zero chunks of output, then terminate
+    // immediately. This happens on `split -e -n 3 /dev/null`, for
+    // example.
+    if num_chunks == 0 {
+        return Ok(());
     }
 
-    let num_chunks: usize = num_chunks
-        .try_into()
-        .map_err(|_| USimpleError::new(1, "Number of chunks too big"))?;
+    let num_chunks: usize = num_chunks
+        .try_into()
+        .map_err(|_| USimpleError::new(1, "Number of chunks too big"))?;
 
-    // This object is responsible for creating the filename for each chunk.
-    let mut filename_iterator = FilenameIterator::new(
-        &settings.prefix,
-        &settings.additional_suffix,
-        settings.suffix_length,
-        settings.suffix_type,
-        settings.suffix_start,
+    // This object is responsible for creating the filename for each chunk.
+    let mut filename_iterator = FilenameIterator::new(
+        &settings.prefix,
+        &settings.additional_suffix,
+        settings.suffix_length,
+        settings.suffix_type,
+        settings.suffix_start,
     )?;
 
-    // Create one writer for each chunk. This will create each
-    // of the underlying files (if not in `--filter` mode).
-    let mut writers = vec![];
-    for _ in 0..num_chunks {
-        let filename = filename_iterator
-            .next()
-            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
-        let writer = settings.instantiate_current_writer(filename.as_str())?;
-        writers.push(writer);
+    // Create one writer for each chunk. This will create each
+    // of the underlying files (if not in `--filter` mode).
+    let mut writers = vec![];
+    for _ in 0..num_chunks {
+        let filename = filename_iterator
+            .next()
+            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
+        let writer = settings.instantiate_current_writer(filename.as_str())?;
+        writers.push(writer);
     }
 
-    // Capture the result of the `std::io::copy()` calls to check for
-    // `BrokenPipe`.
-    let result: std::io::Result<()> = {
-        // Write `chunk_size` bytes from the reader into each writer
-        // except the last.
-        //
-        // The last writer gets all remaining bytes so that if the number
-        // of bytes in the input file was not evenly divisible by
-        // `num_chunks`, we don't leave any bytes behind.
-        for writer in writers.iter_mut().take(num_chunks - 1) {
-            io::copy(&mut reader.by_ref().take(chunk_size), writer)?;
+    // Capture the result of the `std::io::copy()` calls to check for
+    // `BrokenPipe`.
+    let result: std::io::Result<()> = {
+        // Write `chunk_size` bytes from the reader into each writer
+        // except the last.
+        //
+        // The last writer gets all remaining bytes so that if the number
+        // of bytes in the input file was not evenly divisible by
+        // `num_chunks`, we don't leave any bytes behind.
+        for writer in writers.iter_mut().take(num_chunks - 1) {
+            io::copy(&mut reader.by_ref().take(chunk_size), writer)?;
         }
 
-        // Write all the remaining bytes to the last chunk.
-        let i = num_chunks - 1;
-        let last_chunk_size = num_bytes - (chunk_size * (num_chunks as u64 - 1));
-        io::copy(&mut reader.by_ref().take(last_chunk_size), &mut writers[i])?;
+        // Write all the remaining bytes to the last chunk.
+        let i = num_chunks - 1;
+        let last_chunk_size = num_bytes - (chunk_size * (num_chunks as u64 - 1));
+        io::copy(&mut reader.by_ref().take(last_chunk_size), &mut writers[i])?;
 
         Ok(())
     };
-    match result {
+    match result {
         Ok(_) => Ok(()),
-        Err(e) if e.kind() == ErrorKind::BrokenPipe => Ok(()),
-        Err(e) => Err(uio_error!(e, "input/output error")),
+        Err(e) if e.kind() == ErrorKind::BrokenPipe => Ok(()),
+        Err(e) => Err(uio_error!(e, "input/output error")),
     }
 }
 
-/// Split a file into a specific number of chunks by line.
-///
-/// This function always creates one output file for each chunk, even
-/// if there is an error reading or writing one of the chunks or if
-/// the input file is truncated. However, if the `filter` option is
-/// being used, then no files are created.
-///
-/// # Errors
-///
-/// This function returns an error if there is a problem reading from
-/// `reader` or writing to one of the output files.
-///
-/// # See also
-///
-/// * [`kth_chunk_by_line`], which splits its input in the same way,
-///   but writes only one specified chunk to stdout.
-fn split_into_n_chunks_by_line<R>(
-    settings: &Settings,
-    reader: &mut R,
-    num_chunks: u64,
-) -> UResult<()>
-where
-    R: BufRead,
+/// Split a file into a specific number of chunks by line.
+///
+/// This function always creates one output file for each chunk, even
+/// if there is an error reading or writing one of the chunks or if
+/// the input file is truncated. However, if the `filter` option is
+/// being used, then no files are created.
+///
+/// # Errors
+///
+/// This function returns an error if there is a problem reading from
+/// `reader` or writing to one of the output files.
+///
+/// # See also
+///
+/// * [`kth_chunk_by_line`], which splits its input in the same way,
+///   but writes only one specified chunk to stdout.
+fn split_into_n_chunks_by_line<R>(
+    settings: &Settings,
+    reader: &mut R,
+    num_chunks: u64,
+) -> UResult<()>
+where
+    R: BufRead,
 {
-    // Get the size of the input file in bytes and compute the number
-    // of bytes per chunk.
-    let metadata = metadata(&settings.input).unwrap();
-    let num_bytes = metadata.len();
-    let chunk_size = (num_bytes / (num_chunks as u64)) as usize;
+    // Get the size of the input file in bytes and compute the number
+    // of bytes per chunk.
+    let metadata = metadata(&settings.input).unwrap();
+    let num_bytes = metadata.len();
+    let chunk_size = (num_bytes / (num_chunks as u64)) as usize;
 
-    // This object is responsible for creating the filename for each chunk.
-    let mut filename_iterator = FilenameIterator::new(
-        &settings.prefix,
-        &settings.additional_suffix,
-        settings.suffix_length,
-        settings.suffix_type,
-        settings.suffix_start,
+    // This object is responsible for creating the filename for each chunk.
+    let mut filename_iterator = FilenameIterator::new(
+        &settings.prefix,
+        &settings.additional_suffix,
+        settings.suffix_length,
+        settings.suffix_type,
+        settings.suffix_start,
     )?;
 
-    // Create one writer for each chunk. This will create each
-    // of the underlying files (if not in `--filter` mode).
-    let mut writers = vec![];
-    for _ in 0..num_chunks {
-        let filename = filename_iterator
-            .next()
-            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
-        let writer = settings.instantiate_current_writer(filename.as_str())?;
-        writers.push(writer);
+    // Create one writer for each chunk. This will create each
+    // of the underlying files (if not in `--filter` mode).
+    let mut writers = vec![];
+    for _ in 0..num_chunks {
+        let filename = filename_iterator
+            .next()
+            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
+        let writer = settings.instantiate_current_writer(filename.as_str())?;
+        writers.push(writer);
     }
 
-    let mut num_bytes_remaining_in_current_chunk = chunk_size;
-    let mut i = 0;
-    for line_result in reader.lines() {
-        let line = line_result.unwrap();
-        let maybe_writer = writers.get_mut(i);
-        let writer = maybe_writer.unwrap();
-        let bytes = line.as_bytes();
-        writer.write_all(bytes)?;
-        writer.write_all(b"\n")?;
+    let mut num_bytes_remaining_in_current_chunk = chunk_size;
+    let mut i = 0;
+    for line_result in reader.lines() {
+        let line = line_result.unwrap();
+        let maybe_writer = writers.get_mut(i);
+        let writer = maybe_writer.unwrap();
+        let bytes = line.as_bytes();
+        writer.write_all(bytes)?;
+        writer.write_all(b"\n")?;
 
-        // Add one byte for the newline character.
-        let num_bytes = bytes.len() + 1;
-        if num_bytes > num_bytes_remaining_in_current_chunk {
-            num_bytes_remaining_in_current_chunk = chunk_size;
-            i += 1;
-        } else {
-            num_bytes_remaining_in_current_chunk -= num_bytes;
+        // Add one byte for the newline character.
+        let num_bytes = bytes.len() + 1;
+        if num_bytes > num_bytes_remaining_in_current_chunk {
+            num_bytes_remaining_in_current_chunk = chunk_size;
+            i += 1;
+        } else {
+            num_bytes_remaining_in_current_chunk -= num_bytes;
         }
     }
 
     Ok(())
 }
 
-/// Print the k-th chunk of a file, splitting by line.
-///
-/// This function is like [`split_into_n_chunks_by_line`], but instead
-/// of writing each chunk to its own file, it only writes to stdout
-/// the contents of the chunk identified by `chunk_number`.
-///
-/// # Errors
-///
-/// This function returns an error if there is a problem reading from
-/// `reader` or writing to one of the output files.
-///
-/// # See also
-///
-/// * [`split_into_n_chunks_by_line`], which splits its input in the
-///   same way, but writes each chunk to its own file.
-fn kth_chunk_by_line<R>(
-    settings: &Settings,
-    reader: &mut R,
-    chunk_number: u64,
-    num_chunks: u64,
-) -> UResult<()>
-where
-    R: BufRead,
+/// Print the k-th chunk of a file, splitting by line.
+///
+/// This function is like [`split_into_n_chunks_by_line`], but instead
+/// of writing each chunk to its own file, it only writes to stdout
+/// the contents of the chunk identified by `chunk_number`.
+///
+/// # Errors
+///
+/// This function returns an error if there is a problem reading from
+/// `reader` or writing to one of the output files.
+///
+/// # See also
+///
+/// * [`split_into_n_chunks_by_line`], which splits its input in the
+///   same way, but writes each chunk to its own file.
+fn kth_chunk_by_line<R>(
+    settings: &Settings,
+    reader: &mut R,
+    chunk_number: u64,
+    num_chunks: u64,
+) -> UResult<()>
+where
+    R: BufRead,
 {
-    // Get the size of the input file in bytes and compute the number
-    // of bytes per chunk.
-    let metadata = metadata(&settings.input).unwrap();
-    let num_bytes = metadata.len();
-    let chunk_size = (num_bytes / (num_chunks as u64)) as usize;
+    // Get the size of the input file in bytes and compute the number
+    // of bytes per chunk.
+    let metadata = metadata(&settings.input).unwrap();
+    let num_bytes = metadata.len();
+    let chunk_size = (num_bytes / (num_chunks as u64)) as usize;
 
-    // Write to stdout instead of to a file.
-    let stdout = std::io::stdout();
-    let mut writer = stdout.lock();
+    // Write to stdout instead of to a file.
+    let stdout = std::io::stdout();
+    let mut writer = stdout.lock();
 
-    let mut num_bytes_remaining_in_current_chunk = chunk_size;
-    let mut i = 0;
-    for line_result in reader.lines() {
-        let line = line_result?;
-        let bytes = line.as_bytes();
-        if i == chunk_number {
-            writer.write_all(bytes)?;
-            writer.write_all(b"\n")?;
+    let mut num_bytes_remaining_in_current_chunk = chunk_size;
+    let mut i = 0;
+    for line_result in reader.lines() {
+        let line = line_result?;
+        let bytes = line.as_bytes();
+        if i == chunk_number {
+            writer.write_all(bytes)?;
+            writer.write_all(b"\n")?;
         }
 
-        // Add one byte for the newline character.
-        let num_bytes = bytes.len() + 1;
-        if num_bytes >= num_bytes_remaining_in_current_chunk {
-            num_bytes_remaining_in_current_chunk = chunk_size;
-            i += 1;
-        } else {
-            num_bytes_remaining_in_current_chunk -= num_bytes;
+        // Add one byte for the newline character.
+        let num_bytes = bytes.len() + 1;
+        if num_bytes >= num_bytes_remaining_in_current_chunk {
+            num_bytes_remaining_in_current_chunk = chunk_size;
+            i += 1;
+        } else {
+            num_bytes_remaining_in_current_chunk -= num_bytes;
         }
 
-        if i > chunk_number {
+        if i > chunk_number {
             break;
         }
     }
@@ -2658,219 +2658,219 @@
     Ok(())
 }
 
-fn split_into_n_chunks_by_line_round_robin<R>(
-    settings: &Settings,
-    reader: &mut R,
-    num_chunks: u64,
-) -> UResult<()>
-where
-    R: BufRead,
+fn split_into_n_chunks_by_line_round_robin<R>(
+    settings: &Settings,
+    reader: &mut R,
+    num_chunks: u64,
+) -> UResult<()>
+where
+    R: BufRead,
 {
-    // This object is responsible for creating the filename for each chunk.
-    let mut filename_iterator = FilenameIterator::new(
-        &settings.prefix,
-        &settings.additional_suffix,
-        settings.suffix_length,
-        settings.suffix_type,
-        settings.suffix_start,
+    // This object is responsible for creating the filename for each chunk.
+    let mut filename_iterator = FilenameIterator::new(
+        &settings.prefix,
+        &settings.additional_suffix,
+        settings.suffix_length,
+        settings.suffix_type,
+        settings.suffix_start,
     )?;
 
-    // Create one writer for each chunk. This will create each
-    // of the underlying files (if not in `--filter` mode).
-    let mut writers = vec![];
-    for _ in 0..num_chunks {
-        let filename = filename_iterator
-            .next()
-            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
-        let writer = settings.instantiate_current_writer(filename.as_str())?;
-        writers.push(writer);
+    // Create one writer for each chunk. This will create each
+    // of the underlying files (if not in `--filter` mode).
+    let mut writers = vec![];
+    for _ in 0..num_chunks {
+        let filename = filename_iterator
+            .next()
+            .ok_or_else(|| USimpleError::new(1, "output file suffixes exhausted"))?;
+        let writer = settings.instantiate_current_writer(filename.as_str())?;
+        writers.push(writer);
     }
 
-    let num_chunks: usize = num_chunks.try_into().unwrap();
-    for (i, line_result) in reader.lines().enumerate() {
-        let line = line_result.unwrap();
-        let maybe_writer = writers.get_mut(i % num_chunks);
-        let writer = maybe_writer.unwrap();
-        let bytes = line.as_bytes();
-        writer.write_all(bytes)?;
-        writer.write_all(b"\n")?;
+    let num_chunks: usize = num_chunks.try_into().unwrap();
+    for (i, line_result) in reader.lines().enumerate() {
+        let line = line_result.unwrap();
+        let maybe_writer = writers.get_mut(i % num_chunks);
+        let writer = maybe_writer.unwrap();
+        let bytes = line.as_bytes();
+        writer.write_all(bytes)?;
+        writer.write_all(b"\n")?;
     }
 
     Ok(())
 }
 
-fn split(settings: &Settings) -> UResult<()> {
-    let mut reader = BufReader::new(if settings.input == "-" {
-        Box::new(stdin()) as Box<dyn Read>
-    } else {
-        let r = File::open(Path::new(&settings.input)).map_err_context(|| {
+fn split(settings: &Settings) -> UResult<()> {
+    let mut reader = BufReader::new(if settings.input == "-" {
+        Box::new(stdin()) as Box<dyn Read>
+    } else {
+        let r = File::open(Path::new(&settings.input)).map_err_context(|| {
             format!(
                 "cannot open {} for reading: No such file or directory",
-                settings.input.quote()
+                settings.input.quote()
             )
         })?;
-        Box::new(r) as Box<dyn Read>
+        Box::new(r) as Box<dyn Read>
     });
 
-    match settings.strategy {
-        Strategy::Number(NumberType::Bytes(num_chunks)) => {
-            split_into_n_chunks_by_byte(settings, &mut reader, num_chunks)
+    match settings.strategy {
+        Strategy::Number(NumberType::Bytes(num_chunks)) => {
+            split_into_n_chunks_by_byte(settings, &mut reader, num_chunks)
         }
-        Strategy::Number(NumberType::Lines(num_chunks)) => {
-            split_into_n_chunks_by_line(settings, &mut reader, num_chunks)
+        Strategy::Number(NumberType::Lines(num_chunks)) => {
+            split_into_n_chunks_by_line(settings, &mut reader, num_chunks)
         }
-        Strategy::Number(NumberType::KthLines(chunk_number, num_chunks)) => {
-            // The chunk number is given as a 1-indexed number, but it
-            // is a little easier to deal with a 0-indexed number.
-            let chunk_number = chunk_number - 1;
-            kth_chunk_by_line(settings, &mut reader, chunk_number, num_chunks)
+        Strategy::Number(NumberType::KthLines(chunk_number, num_chunks)) => {
+            // The chunk number is given as a 1-indexed number, but it
+            // is a little easier to deal with a 0-indexed number.
+            let chunk_number = chunk_number - 1;
+            kth_chunk_by_line(settings, &mut reader, chunk_number, num_chunks)
         }
-        Strategy::Number(NumberType::RoundRobin(num_chunks)) => {
-            split_into_n_chunks_by_line_round_robin(settings, &mut reader, num_chunks)
+        Strategy::Number(NumberType::RoundRobin(num_chunks)) => {
+            split_into_n_chunks_by_line_round_robin(settings, &mut reader, num_chunks)
         }
-        Strategy::Number(_) => Err(USimpleError::new(1, "-n mode not yet fully implemented")),
-        Strategy::Lines(chunk_size) => {
-            let mut writer = LineChunkWriter::new(chunk_size, settings)?;
-            match std::io::copy(&mut reader, &mut writer) {
+        Strategy::Number(_) => Err(USimpleError::new(1, "-n mode not yet fully implemented")),
+        Strategy::Lines(chunk_size) => {
+            let mut writer = LineChunkWriter::new(chunk_size, settings)?;
+            match std::io::copy(&mut reader, &mut writer) {
                 Ok(_) => Ok(()),
-                Err(e) => match e.kind() {
-                    // TODO Since the writer object controls the creation of
-                    // new files, we need to rely on the `std::io::Result`
-                    // returned by its `write()` method to communicate any
-                    // errors to this calling scope. If a new file cannot be
-                    // created because we have exceeded the number of
-                    // allowable filenames, we use `ErrorKind::Other` to
-                    // indicate that. A special error message needs to be
-                    // printed in that case.
-                    ErrorKind::Other => Err(USimpleError::new(1, format!("{}", e))),
-                    ErrorKind::BrokenPipe => Ok(()),
-                    _ => Err(uio_error!(e, "input/output error")),
+                Err(e) => match e.kind() {
+                    // TODO Since the writer object controls the creation of
+                    // new files, we need to rely on the `std::io::Result`
+                    // returned by its `write()` method to communicate any
+                    // errors to this calling scope. If a new file cannot be
+                    // created because we have exceeded the number of
+                    // allowable filenames, we use `ErrorKind::Other` to
+                    // indicate that. A special error message needs to be
+                    // printed in that case.
+                    ErrorKind::Other => Err(USimpleError::new(1, format!("{}", e))),
+                    ErrorKind::BrokenPipe => Ok(()),
+                    _ => Err(uio_error!(e, "input/output error")),
                 },
             }
         }
-        Strategy::Bytes(chunk_size) => {
-            let mut writer = ByteChunkWriter::new(chunk_size, settings)?;
-            match std::io::copy(&mut reader, &mut writer) {
+        Strategy::Bytes(chunk_size) => {
+            let mut writer = ByteChunkWriter::new(chunk_size, settings)?;
+            match std::io::copy(&mut reader, &mut writer) {
                 Ok(_) => Ok(()),
-                Err(e) => match e.kind() {
-                    // TODO Since the writer object controls the creation of
-                    // new files, we need to rely on the `std::io::Result`
-                    // returned by its `write()` method to communicate any
-                    // errors to this calling scope. If a new file cannot be
-                    // created because we have exceeded the number of
-                    // allowable filenames, we use `ErrorKind::Other` to
-                    // indicate that. A special error message needs to be
-                    // printed in that case.
-                    ErrorKind::Other => Err(USimpleError::new(1, format!("{}", e))),
-                    ErrorKind::BrokenPipe => Ok(()),
-                    _ => Err(uio_error!(e, "input/output error")),
+                Err(e) => match e.kind() {
+                    // TODO Since the writer object controls the creation of
+                    // new files, we need to rely on the `std::io::Result`
+                    // returned by its `write()` method to communicate any
+                    // errors to this calling scope. If a new file cannot be
+                    // created because we have exceeded the number of
+                    // allowable filenames, we use `ErrorKind::Other` to
+                    // indicate that. A special error message needs to be
+                    // printed in that case.
+                    ErrorKind::Other => Err(USimpleError::new(1, format!("{}", e))),
+                    ErrorKind::BrokenPipe => Ok(()),
+                    _ => Err(uio_error!(e, "input/output error")),
                 },
             }
         }
-        Strategy::LineBytes(chunk_size) => {
-            let mut writer = LineBytesChunkWriter::new(chunk_size, settings)?;
-            match std::io::copy(&mut reader, &mut writer) {
+        Strategy::LineBytes(chunk_size) => {
+            let mut writer = LineBytesChunkWriter::new(chunk_size, settings)?;
+            match std::io::copy(&mut reader, &mut writer) {
                 Ok(_) => Ok(()),
-                Err(e) => match e.kind() {
-                    // TODO Since the writer object controls the creation of
-                    // new files, we need to rely on the `std::io::Result`
-                    // returned by its `write()` method to communicate any
-                    // errors to this calling scope. If a new file cannot be
-                    // created because we have exceeded the number of
-                    // allowable filenames, we use `ErrorKind::Other` to
-                    // indicate that. A special error message needs to be
-                    // printed in that case.
-                    ErrorKind::Other => Err(USimpleError::new(1, format!("{}", e))),
-                    ErrorKind::BrokenPipe => Ok(()),
-                    _ => Err(uio_error!(e, "input/output error")),
+                Err(e) => match e.kind() {
+                    // TODO Since the writer object controls the creation of
+                    // new files, we need to rely on the `std::io::Result`
+                    // returned by its `write()` method to communicate any
+                    // errors to this calling scope. If a new file cannot be
+                    // created because we have exceeded the number of
+                    // allowable filenames, we use `ErrorKind::Other` to
+                    // indicate that. A special error message needs to be
+                    // printed in that case.
+                    ErrorKind::Other => Err(USimpleError::new(1, format!("{}", e))),
+                    ErrorKind::BrokenPipe => Ok(()),
+                    _ => Err(uio_error!(e, "input/output error")),
                 },
             }
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use crate::NumberType;
-    use crate::NumberTypeError;
+    use crate::NumberType;
+    use crate::NumberTypeError;
 
-    #[test]
-    fn test_number_type_from() {
-        assert_eq!(NumberType::from("123").unwrap(), NumberType::Bytes(123));
-        assert_eq!(NumberType::from("l/123").unwrap(), NumberType::Lines(123));
+    #[test]
+    fn test_number_type_from() {
+        assert_eq!(NumberType::from("123").unwrap(), NumberType::Bytes(123));
+        assert_eq!(NumberType::from("l/123").unwrap(), NumberType::Lines(123));
         assert_eq!(
-            NumberType::from("l/123/456").unwrap(),
-            NumberType::KthLines(123, 456)
+            NumberType::from("l/123/456").unwrap(),
+            NumberType::KthLines(123, 456)
         );
         assert_eq!(
-            NumberType::from("r/123").unwrap(),
-            NumberType::RoundRobin(123)
+            NumberType::from("r/123").unwrap(),
+            NumberType::RoundRobin(123)
         );
         assert_eq!(
-            NumberType::from("r/123/456").unwrap(),
-            NumberType::KthRoundRobin(123, 456)
+            NumberType::from("r/123/456").unwrap(),
+            NumberType::KthRoundRobin(123, 456)
         );
     }
 
-    #[test]
-    fn test_number_type_from_error() {
+    #[test]
+    fn test_number_type_from_error() {
         assert_eq!(
-            NumberType::from("xyz").unwrap_err(),
-            NumberTypeError::NumberOfChunks("xyz".to_string())
+            NumberType::from("xyz").unwrap_err(),
+            NumberTypeError::NumberOfChunks("xyz".to_string())
         );
         assert_eq!(
-            NumberType::from("l/xyz").unwrap_err(),
-            NumberTypeError::NumberOfChunks("xyz".to_string())
+            NumberType::from("l/xyz").unwrap_err(),
+            NumberTypeError::NumberOfChunks("xyz".to_string())
         );
         assert_eq!(
-            NumberType::from("l/123/xyz").unwrap_err(),
-            NumberTypeError::NumberOfChunks("xyz".to_string())
+            NumberType::from("l/123/xyz").unwrap_err(),
+            NumberTypeError::NumberOfChunks("xyz".to_string())
         );
         assert_eq!(
-            NumberType::from("l/abc/456").unwrap_err(),
-            NumberTypeError::ChunkNumber("abc".to_string())
+            NumberType::from("l/abc/456").unwrap_err(),
+            NumberTypeError::ChunkNumber("abc".to_string())
         );
-        // In GNU split, the number of chunks get precedence:
-        //
-        //     $ split -n l/abc/xyz
-        //     split: invalid number of chunks: ‘xyz’
-        //
-        assert_eq!(
-            NumberType::from("l/abc/xyz").unwrap_err(),
-            NumberTypeError::NumberOfChunks("xyz".to_string())
+        // In GNU split, the number of chunks get precedence:
+        //
+        //     $ split -n l/abc/xyz
+        //     split: invalid number of chunks: ‘xyz’
+        //
+        assert_eq!(
+            NumberType::from("l/abc/xyz").unwrap_err(),
+            NumberTypeError::NumberOfChunks("xyz".to_string())
         );
         assert_eq!(
-            NumberType::from("r/xyz").unwrap_err(),
-            NumberTypeError::NumberOfChunks("xyz".to_string())
+            NumberType::from("r/xyz").unwrap_err(),
+            NumberTypeError::NumberOfChunks("xyz".to_string())
         );
         assert_eq!(
-            NumberType::from("r/123/xyz").unwrap_err(),
-            NumberTypeError::NumberOfChunks("xyz".to_string())
+            NumberType::from("r/123/xyz").unwrap_err(),
+            NumberTypeError::NumberOfChunks("xyz".to_string())
         );
         assert_eq!(
-            NumberType::from("r/abc/456").unwrap_err(),
-            NumberTypeError::ChunkNumber("abc".to_string())
+            NumberType::from("r/abc/456").unwrap_err(),
+            NumberTypeError::ChunkNumber("abc".to_string())
         );
-        // In GNU split, the number of chunks get precedence:
-        //
-        //     $ split -n r/abc/xyz
-        //     split: invalid number of chunks: ‘xyz’
-        //
-        assert_eq!(
-            NumberType::from("r/abc/xyz").unwrap_err(),
-            NumberTypeError::NumberOfChunks("xyz".to_string())
+        // In GNU split, the number of chunks get precedence:
+        //
+        //     $ split -n r/abc/xyz
+        //     split: invalid number of chunks: ‘xyz’
+        //
+        assert_eq!(
+            NumberType::from("r/abc/xyz").unwrap_err(),
+            NumberTypeError::NumberOfChunks("xyz".to_string())
         );
     }
 
-    #[test]
-    fn test_number_type_num_chunks() {
-        assert_eq!(NumberType::from("123").unwrap().num_chunks(), 123);
-        assert_eq!(NumberType::from("l/123").unwrap().num_chunks(), 123);
-        assert_eq!(NumberType::from("l/123/456").unwrap().num_chunks(), 456);
-        assert_eq!(NumberType::from("r/123").unwrap().num_chunks(), 123);
-        assert_eq!(NumberType::from("r/123/456").unwrap().num_chunks(), 456);
+    #[test]
+    fn test_number_type_num_chunks() {
+        assert_eq!(NumberType::from("123").unwrap().num_chunks(), 123);
+        assert_eq!(NumberType::from("l/123").unwrap().num_chunks(), 123);
+        assert_eq!(NumberType::from("l/123/456").unwrap().num_chunks(), 456);
+        assert_eq!(NumberType::from("r/123").unwrap().num_chunks(), 123);
+        assert_eq!(NumberType::from("r/123/456").unwrap().num_chunks(), 456);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_stat/stat.rs.html b/dev/src/uu_stat/stat.rs.html index 142a73e35..1a35fdbca 100644 --- a/dev/src/uu_stat/stat.rs.html +++ b/dev/src/uu_stat/stat.rs.html @@ -1,4 +1,4 @@ -stat.rs - source
1
+stat.rs - source
1
 2
 3
 4
@@ -1085,968 +1085,968 @@
 1085
 1086
 1087
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-#[macro_use]
-extern crate uucore;
-use clap::builder::ValueParser;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError};
-use uucore::fs::display_permissions;
-use uucore::fsext::{
-    pretty_filetype, pretty_fstype, pretty_time, read_fs_list, statfs, BirthTime, FsMeta,
+#[macro_use]
+extern crate uucore;
+use clap::builder::ValueParser;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError};
+use uucore::fs::display_permissions;
+use uucore::fsext::{
+    pretty_filetype, pretty_fstype, pretty_time, read_fs_list, statfs, BirthTime, FsMeta,
 };
-use uucore::libc::mode_t;
-use uucore::{entries, format_usage};
+use uucore::libc::mode_t;
+use uucore::{entries, format_usage};
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use std::borrow::Cow;
-use std::convert::AsRef;
-use std::ffi::{OsStr, OsString};
-use std::os::unix::fs::{FileTypeExt, MetadataExt};
-use std::os::unix::prelude::OsStrExt;
-use std::path::Path;
-use std::{cmp, fs, iter};
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use std::borrow::Cow;
+use std::convert::AsRef;
+use std::ffi::{OsStr, OsString};
+use std::os::unix::fs::{FileTypeExt, MetadataExt};
+use std::os::unix::prelude::OsStrExt;
+use std::path::Path;
+use std::{cmp, fs, iter};
 
-static ABOUT: &str = "Display file or file system status.";
-const USAGE: &str = "{} [OPTION]... FILE...";
+static ABOUT: &str = "Display file or file system status.";
+const USAGE: &str = "{} [OPTION]... FILE...";
 
-pub mod options {
-    pub static DEREFERENCE: &str = "dereference";
-    pub static FILE_SYSTEM: &str = "file-system";
-    pub static FORMAT: &str = "format";
-    pub static PRINTF: &str = "printf";
-    pub static TERSE: &str = "terse";
+pub mod options {
+    pub static DEREFERENCE: &str = "dereference";
+    pub static FILE_SYSTEM: &str = "file-system";
+    pub static FORMAT: &str = "format";
+    pub static PRINTF: &str = "printf";
+    pub static TERSE: &str = "terse";
 }
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-pub const F_ALTER: u8 = 1;
-pub const F_ZERO: u8 = 1 << 1;
-pub const F_LEFT: u8 = 1 << 2;
-pub const F_SPACE: u8 = 1 << 3;
-pub const F_SIGN: u8 = 1 << 4;
-// unused at present
-pub const F_GROUP: u8 = 1 << 5;
+pub const F_ALTER: u8 = 1;
+pub const F_ZERO: u8 = 1 << 1;
+pub const F_LEFT: u8 = 1 << 2;
+pub const F_SPACE: u8 = 1 << 3;
+pub const F_SIGN: u8 = 1 << 4;
+// unused at present
+pub const F_GROUP: u8 = 1 << 5;
 
-/// checks if the string is within the specified bound,
-/// if it gets out of bound, error out by printing sub-string from index `beg` to`end`,
-/// where `beg` & `end` is the beginning and end index of sub-string, respectively
-///
-fn check_bound(slice: &str, bound: usize, beg: usize, end: usize) -> UResult<()> {
-    if end >= bound {
-        return Err(USimpleError::new(
+/// checks if the string is within the specified bound,
+/// if it gets out of bound, error out by printing sub-string from index `beg` to`end`,
+/// where `beg` & `end` is the beginning and end index of sub-string, respectively
+///
+fn check_bound(slice: &str, bound: usize, beg: usize, end: usize) -> UResult<()> {
+    if end >= bound {
+        return Err(USimpleError::new(
             1,
-            format!("{}: invalid directive", slice[beg..end].quote()),
+            format!("{}: invalid directive", slice[beg..end].quote()),
         ));
     }
     Ok(())
 }
 
-/// pads the string with zeroes if supplied min is greater
-/// then the length of the string, else returns the original string
-///
-fn extend_digits(string: &str, min: usize) -> Cow<'_, str> {
-    if min > string.len() {
-        let mut pad = String::with_capacity(min);
-        iter::repeat('0')
-            .take(min - string.len())
-            .map(|_| pad.push('0'))
-            .all(|_| true);
-        pad.push_str(string);
-        pad.into()
-    } else {
-        string.into()
+/// pads the string with zeroes if supplied min is greater
+/// then the length of the string, else returns the original string
+///
+fn extend_digits(string: &str, min: usize) -> Cow<'_, str> {
+    if min > string.len() {
+        let mut pad = String::with_capacity(min);
+        iter::repeat('0')
+            .take(min - string.len())
+            .map(|_| pad.push('0'))
+            .all(|_| true);
+        pad.push_str(string);
+        pad.into()
+    } else {
+        string.into()
     }
 }
 
-enum Padding {
-    Zero,
-    Space,
+enum Padding {
+    Zero,
+    Space,
 }
 
-/// pads the string with zeroes or spaces and prints it
-///
-/// # Example
-/// ```ignore
-/// uu_stat::pad_and_print("1", false, 5, Padding::Zero) == "00001";
-/// ```
-/// currently only supports '0' & ' ' as the padding character
-/// because the format specification of print! does not support general
-/// fill characters
-///
-fn pad_and_print(result: &str, left: bool, width: usize, padding: Padding) {
-    match (left, padding) {
-        (false, Padding::Zero) => print!("{result:0>width$}"),
-        (false, Padding::Space) => print!("{result:>width$}"),
-        (true, Padding::Zero) => print!("{result:0<width$}"),
-        (true, Padding::Space) => print!("{result:<width$}"),
+/// pads the string with zeroes or spaces and prints it
+///
+/// # Example
+/// ```ignore
+/// uu_stat::pad_and_print("1", false, 5, Padding::Zero) == "00001";
+/// ```
+/// currently only supports '0' & ' ' as the padding character
+/// because the format specification of print! does not support general
+/// fill characters
+///
+fn pad_and_print(result: &str, left: bool, width: usize, padding: Padding) {
+    match (left, padding) {
+        (false, Padding::Zero) => print!("{result:0>width$}"),
+        (false, Padding::Space) => print!("{result:>width$}"),
+        (true, Padding::Zero) => print!("{result:0<width$}"),
+        (true, Padding::Space) => print!("{result:<width$}"),
     };
 }
 
-/// prints the adjusted string after padding
-/// `left` flag specifies the type of alignment of the string
-/// `width` is the supplied padding width of the string needed
-/// `prefix` & `need_prefix` are Optional, which adjusts the `field_width` accordingly, where
-/// `field_width` is the max of supplied `width` and size of string
-/// `padding`, specifies type of padding, which is '0' or ' ' in this case.
-fn print_adjusted(
-    s: &str,
-    left: bool,
-    need_prefix: Option<bool>,
-    prefix: Option<&str>,
-    width: usize,
-    padding: Padding,
+/// prints the adjusted string after padding
+/// `left` flag specifies the type of alignment of the string
+/// `width` is the supplied padding width of the string needed
+/// `prefix` & `need_prefix` are Optional, which adjusts the `field_width` accordingly, where
+/// `field_width` is the max of supplied `width` and size of string
+/// `padding`, specifies type of padding, which is '0' or ' ' in this case.
+fn print_adjusted(
+    s: &str,
+    left: bool,
+    need_prefix: Option<bool>,
+    prefix: Option<&str>,
+    width: usize,
+    padding: Padding,
 ) {
-    let mut field_width = cmp::max(width, s.len());
-    if let Some(p) = prefix {
-        if let Some(prefix_flag) = need_prefix {
-            if prefix_flag {
-                field_width -= p.len();
+    let mut field_width = cmp::max(width, s.len());
+    if let Some(p) = prefix {
+        if let Some(prefix_flag) = need_prefix {
+            if prefix_flag {
+                field_width -= p.len();
             }
         }
-        pad_and_print(s, left, field_width, padding);
-    } else {
-        pad_and_print(s, left, field_width, padding);
+        pad_and_print(s, left, field_width, padding);
+    } else {
+        pad_and_print(s, left, field_width, padding);
     }
 }
-#[derive(Debug, PartialEq, Eq)]
-pub enum OutputType {
-    Str,
-    Integer,
-    Unsigned,
-    UnsignedHex,
-    UnsignedOct,
-    Unknown,
+#[derive(Debug, PartialEq, Eq)]
+pub enum OutputType {
+    Str,
+    Integer,
+    Unsigned,
+    UnsignedHex,
+    UnsignedOct,
+    Unknown,
 }
 
-#[derive(Debug, PartialEq, Eq)]
-pub enum Token {
-    Char(char),
-    Directive {
-        flag: u8,
-        width: usize,
-        precision: i32,
-        format: char,
+#[derive(Debug, PartialEq, Eq)]
+pub enum Token {
+    Char(char),
+    Directive {
+        flag: u8,
+        width: usize,
+        precision: i32,
+        format: char,
     },
 }
 
-pub trait ScanUtil {
-    fn scan_num<F>(&self) -> Option<(F, usize)>
-    where
-        F: std::str::FromStr;
-    fn scan_char(&self, radix: u32) -> Option<(char, usize)>;
+pub trait ScanUtil {
+    fn scan_num<F>(&self) -> Option<(F, usize)>
+    where
+        F: std::str::FromStr;
+    fn scan_char(&self, radix: u32) -> Option<(char, usize)>;
 }
 
-impl ScanUtil for str {
-    fn scan_num<F>(&self) -> Option<(F, usize)>
-    where
-        F: std::str::FromStr,
+impl ScanUtil for str {
+    fn scan_num<F>(&self) -> Option<(F, usize)>
+    where
+        F: std::str::FromStr,
     {
-        let mut chars = self.chars();
-        let mut i = 0;
-        match chars.next() {
-            Some('-') | Some('+') | Some('0'..='9') => i += 1,
-            _ => return None,
+        let mut chars = self.chars();
+        let mut i = 0;
+        match chars.next() {
+            Some('-') | Some('+') | Some('0'..='9') => i += 1,
+            _ => return None,
         }
-        for c in chars {
-            match c {
-                '0'..='9' => i += 1,
-                _ => break,
+        for c in chars {
+            match c {
+                '0'..='9' => i += 1,
+                _ => break,
             }
         }
-        if i > 0 {
-            F::from_str(&self[..i]).ok().map(|x| (x, i))
-        } else {
-            None
-        }
+        if i > 0 {
+            F::from_str(&self[..i]).ok().map(|x| (x, i))
+        } else {
+            None
+        }
     }
 
-    fn scan_char(&self, radix: u32) -> Option<(char, usize)> {
-        let count = match radix {
-            8 => 3_usize,
-            16 => 2,
-            _ => return None,
+    fn scan_char(&self, radix: u32) -> Option<(char, usize)> {
+        let count = match radix {
+            8 => 3_usize,
+            16 => 2,
+            _ => return None,
         };
-        let chars = self.chars().enumerate();
-        let mut res = 0_u32;
-        let mut offset = 0_usize;
-        for (i, c) in chars {
-            if i >= count {
+        let chars = self.chars().enumerate();
+        let mut res = 0_u32;
+        let mut offset = 0_usize;
+        for (i, c) in chars {
+            if i >= count {
                 break;
             }
-            match c.to_digit(radix) {
-                Some(digit) => {
-                    let tmp = res * radix + digit;
-                    if tmp < 256 {
-                        res = tmp;
-                    } else {
+            match c.to_digit(radix) {
+                Some(digit) => {
+                    let tmp = res * radix + digit;
+                    if tmp < 256 {
+                        res = tmp;
+                    } else {
                         break;
                     }
                 }
-                None => break,
+                None => break,
             }
-            offset = i + 1;
-        }
-        if offset > 0 {
-            Some((res as u8 as char, offset))
-        } else {
-            None
+            offset = i + 1;
         }
+        if offset > 0 {
+            Some((res as u8 as char, offset))
+        } else {
+            None
+        }
     }
 }
 
-pub fn group_num(s: &str) -> Cow<str> {
-    let is_negative = s.starts_with('-');
-    assert!(is_negative || s.chars().take(1).all(|c| c.is_ascii_digit()));
-    assert!(s.chars().skip(1).all(|c| c.is_ascii_digit()));
-    if s.len() < 4 {
-        return s.into();
+pub fn group_num(s: &str) -> Cow<str> {
+    let is_negative = s.starts_with('-');
+    assert!(is_negative || s.chars().take(1).all(|c| c.is_ascii_digit()));
+    assert!(s.chars().skip(1).all(|c| c.is_ascii_digit()));
+    if s.len() < 4 {
+        return s.into();
     }
-    let mut res = String::with_capacity((s.len() - 1) / 3);
-    let s = if is_negative {
-        res.push('-');
-        &s[1..]
-    } else {
-        s
+    let mut res = String::with_capacity((s.len() - 1) / 3);
+    let s = if is_negative {
+        res.push('-');
+        &s[1..]
+    } else {
+        s
     };
-    let mut alone = (s.len() - 1) % 3 + 1;
-    res.push_str(&s[..alone]);
-    while alone != s.len() {
-        res.push(',');
-        res.push_str(&s[alone..alone + 3]);
-        alone += 3;
+    let mut alone = (s.len() - 1) % 3 + 1;
+    res.push_str(&s[..alone]);
+    while alone != s.len() {
+        res.push(',');
+        res.push_str(&s[alone..alone + 3]);
+        alone += 3;
     }
-    res.into()
+    res.into()
 }
 
-pub struct Stater {
-    follow: bool,
-    show_fs: bool,
-    from_user: bool,
-    files: Vec<OsString>,
-    mount_list: Option<Vec<String>>,
-    default_tokens: Vec<Token>,
-    default_dev_tokens: Vec<Token>,
+pub struct Stater {
+    follow: bool,
+    show_fs: bool,
+    from_user: bool,
+    files: Vec<OsString>,
+    mount_list: Option<Vec<String>>,
+    default_tokens: Vec<Token>,
+    default_dev_tokens: Vec<Token>,
 }
 
-#[allow(clippy::cognitive_complexity)]
-fn print_it(arg: &str, output_type: &OutputType, flag: u8, width: usize, precision: i32) {
-    // If the precision is given as just '.', the precision is taken to be zero.
-    // A negative precision is taken as if the precision were omitted.
-    // This gives the minimum number of digits to appear for d, i, o, u, x, and X conversions,
-    // the maximum number of characters to be printed from a string for s and S conversions.
+#[allow(clippy::cognitive_complexity)]
+fn print_it(arg: &str, output_type: &OutputType, flag: u8, width: usize, precision: i32) {
+    // If the precision is given as just '.', the precision is taken to be zero.
+    // A negative precision is taken as if the precision were omitted.
+    // This gives the minimum number of digits to appear for d, i, o, u, x, and X conversions,
+    // the maximum number of characters to be printed from a string for s and S conversions.
 
-    // #
-    // The value should be converted to an "alternate form".
-    // For o conversions, the first character of the output string  is made  zero  (by  prefixing  a 0 if it was not zero already).
-    // For x and X conversions, a nonzero result has the string "0x" (or "0X" for X conversions) prepended to it.
+    // #
+    // The value should be converted to an "alternate form".
+    // For o conversions, the first character of the output string  is made  zero  (by  prefixing  a 0 if it was not zero already).
+    // For x and X conversions, a nonzero result has the string "0x" (or "0X" for X conversions) prepended to it.
 
-    // 0
-    // The value should be zero padded.
-    // For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, the converted value is padded on the left with zeros rather than blanks.
-    // If the 0 and - flags both appear, the 0 flag is ignored.
-    // If a precision  is  given with a numeric conversion (d, i, o, u, x, and X), the 0 flag is ignored.
-    // For other conversions, the behavior is undefined.
+    // 0
+    // The value should be zero padded.
+    // For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, the converted value is padded on the left with zeros rather than blanks.
+    // If the 0 and - flags both appear, the 0 flag is ignored.
+    // If a precision  is  given with a numeric conversion (d, i, o, u, x, and X), the 0 flag is ignored.
+    // For other conversions, the behavior is undefined.
 
-    // -
-    // The converted value is to be left adjusted on the field boundary.  (The default is right justification.)
-    // The  converted  value  is padded on the right with blanks, rather than on the left with blanks or zeros.
-    // A - overrides a 0 if both are given.
+    // -
+    // The converted value is to be left adjusted on the field boundary.  (The default is right justification.)
+    // The  converted  value  is padded on the right with blanks, rather than on the left with blanks or zeros.
+    // A - overrides a 0 if both are given.
 
-    // ' ' (a space)
-    // A blank should be left before a positive number (or empty string) produced by a signed conversion.
+    // ' ' (a space)
+    // A blank should be left before a positive number (or empty string) produced by a signed conversion.
 
-    // +
-    // A sign (+ or -) should always be placed before a number produced by a signed conversion.
-    // By default, a sign  is  used only for negative numbers.
-    // A + overrides a space if both are used.
+    // +
+    // A sign (+ or -) should always be placed before a number produced by a signed conversion.
+    // By default, a sign  is  used only for negative numbers.
+    // A + overrides a space if both are used.
 
-    if output_type == &OutputType::Unknown {
-        return print!("?");
+    if output_type == &OutputType::Unknown {
+        return print!("?");
     }
 
-    let left_align = has!(flag, F_LEFT);
-    let padding_char: Padding = if has!(flag, F_ZERO) && !left_align && precision == -1 {
-        Padding::Zero
-    } else {
-        Padding::Space
+    let left_align = has!(flag, F_LEFT);
+    let padding_char: Padding = if has!(flag, F_ZERO) && !left_align && precision == -1 {
+        Padding::Zero
+    } else {
+        Padding::Space
     };
 
-    let has_sign = has!(flag, F_SIGN) || has!(flag, F_SPACE);
+    let has_sign = has!(flag, F_SIGN) || has!(flag, F_SPACE);
 
-    let should_alter = has!(flag, F_ALTER);
-    let prefix = match output_type {
-        OutputType::UnsignedOct => "0",
-        OutputType::UnsignedHex => "0x",
-        OutputType::Integer => {
-            if has!(flag, F_SIGN) {
-                "+"
-            } else {
-                " "
-            }
+    let should_alter = has!(flag, F_ALTER);
+    let prefix = match output_type {
+        OutputType::UnsignedOct => "0",
+        OutputType::UnsignedHex => "0x",
+        OutputType::Integer => {
+            if has!(flag, F_SIGN) {
+                "+"
+            } else {
+                " "
+            }
         }
-        _ => "",
+        _ => "",
     };
 
-    match output_type {
-        OutputType::Str => {
-            let limit = cmp::min(precision, arg.len() as i32);
-            let s: &str = if limit >= 0 {
-                &arg[..limit as usize]
-            } else {
-                arg
+    match output_type {
+        OutputType::Str => {
+            let limit = cmp::min(precision, arg.len() as i32);
+            let s: &str = if limit >= 0 {
+                &arg[..limit as usize]
+            } else {
+                arg
             };
-            print_adjusted(s, left_align, None, None, width, Padding::Space);
+            print_adjusted(s, left_align, None, None, width, Padding::Space);
         }
-        OutputType::Integer => {
-            let arg = if has!(flag, F_GROUP) {
-                group_num(arg)
-            } else {
-                Cow::Borrowed(arg)
+        OutputType::Integer => {
+            let arg = if has!(flag, F_GROUP) {
+                group_num(arg)
+            } else {
+                Cow::Borrowed(arg)
             };
-            let min_digits = cmp::max(precision, arg.len() as i32) as usize;
-            let extended: Cow<str> = extend_digits(arg.as_ref(), min_digits);
-            print_adjusted(
-                extended.as_ref(),
-                left_align,
-                Some(has_sign),
-                Some(prefix),
-                width,
-                padding_char,
+            let min_digits = cmp::max(precision, arg.len() as i32) as usize;
+            let extended: Cow<str> = extend_digits(arg.as_ref(), min_digits);
+            print_adjusted(
+                extended.as_ref(),
+                left_align,
+                Some(has_sign),
+                Some(prefix),
+                width,
+                padding_char,
             );
         }
-        OutputType::Unsigned => {
-            let arg = if has!(flag, F_GROUP) {
-                group_num(arg)
-            } else {
-                Cow::Borrowed(arg)
+        OutputType::Unsigned => {
+            let arg = if has!(flag, F_GROUP) {
+                group_num(arg)
+            } else {
+                Cow::Borrowed(arg)
             };
-            let min_digits = cmp::max(precision, arg.len() as i32) as usize;
-            let extended: Cow<str> = extend_digits(arg.as_ref(), min_digits);
-            print_adjusted(
-                extended.as_ref(),
-                left_align,
+            let min_digits = cmp::max(precision, arg.len() as i32) as usize;
+            let extended: Cow<str> = extend_digits(arg.as_ref(), min_digits);
+            print_adjusted(
+                extended.as_ref(),
+                left_align,
                 None,
                 None,
-                width,
-                padding_char,
+                width,
+                padding_char,
             );
         }
-        OutputType::UnsignedOct => {
-            let min_digits = cmp::max(precision, arg.len() as i32) as usize;
-            let extended: Cow<str> = extend_digits(arg, min_digits);
-            print_adjusted(
-                extended.as_ref(),
-                left_align,
-                Some(should_alter),
-                Some(prefix),
-                width,
-                padding_char,
+        OutputType::UnsignedOct => {
+            let min_digits = cmp::max(precision, arg.len() as i32) as usize;
+            let extended: Cow<str> = extend_digits(arg, min_digits);
+            print_adjusted(
+                extended.as_ref(),
+                left_align,
+                Some(should_alter),
+                Some(prefix),
+                width,
+                padding_char,
             );
         }
-        OutputType::UnsignedHex => {
-            let min_digits = cmp::max(precision, arg.len() as i32) as usize;
-            let extended: Cow<str> = extend_digits(arg, min_digits);
-            print_adjusted(
-                extended.as_ref(),
-                left_align,
-                Some(should_alter),
-                Some(prefix),
-                width,
-                padding_char,
+        OutputType::UnsignedHex => {
+            let min_digits = cmp::max(precision, arg.len() as i32) as usize;
+            let extended: Cow<str> = extend_digits(arg, min_digits);
+            print_adjusted(
+                extended.as_ref(),
+                left_align,
+                Some(should_alter),
+                Some(prefix),
+                width,
+                padding_char,
             );
         }
-        _ => unreachable!(),
+        _ => unreachable!(),
     }
 }
 
-impl Stater {
-    pub fn generate_tokens(format_str: &str, use_printf: bool) -> UResult<Vec<Token>> {
-        let mut tokens = Vec::new();
-        let bound = format_str.len();
-        let chars = format_str.chars().collect::<Vec<char>>();
-        let mut i = 0_usize;
-        while i < bound {
-            match chars[i] {
-                '%' => {
-                    let old = i;
+impl Stater {
+    pub fn generate_tokens(format_str: &str, use_printf: bool) -> UResult<Vec<Token>> {
+        let mut tokens = Vec::new();
+        let bound = format_str.len();
+        let chars = format_str.chars().collect::<Vec<char>>();
+        let mut i = 0_usize;
+        while i < bound {
+            match chars[i] {
+                '%' => {
+                    let old = i;
 
-                    i += 1;
-                    if i >= bound {
-                        tokens.push(Token::Char('%'));
+                    i += 1;
+                    if i >= bound {
+                        tokens.push(Token::Char('%'));
                         continue;
                     }
-                    if chars[i] == '%' {
-                        tokens.push(Token::Char('%'));
-                        i += 1;
+                    if chars[i] == '%' {
+                        tokens.push(Token::Char('%'));
+                        i += 1;
                         continue;
                     }
 
-                    let mut flag: u8 = 0;
+                    let mut flag: u8 = 0;
 
-                    while i < bound {
-                        match chars[i] {
-                            '#' => flag |= F_ALTER,
-                            '0' => flag |= F_ZERO,
-                            '-' => flag |= F_LEFT,
-                            ' ' => flag |= F_SPACE,
-                            '+' => flag |= F_SIGN,
-                            '\'' => flag |= F_GROUP,
-                            'I' => unimplemented!(),
-                            _ => break,
+                    while i < bound {
+                        match chars[i] {
+                            '#' => flag |= F_ALTER,
+                            '0' => flag |= F_ZERO,
+                            '-' => flag |= F_LEFT,
+                            ' ' => flag |= F_SPACE,
+                            '+' => flag |= F_SIGN,
+                            '\'' => flag |= F_GROUP,
+                            'I' => unimplemented!(),
+                            _ => break,
                         }
-                        i += 1;
+                        i += 1;
                     }
-                    check_bound(format_str, bound, old, i)?;
+                    check_bound(format_str, bound, old, i)?;
 
-                    let mut width = 0_usize;
-                    let mut precision = -1_i32;
-                    let mut j = i;
+                    let mut width = 0_usize;
+                    let mut precision = -1_i32;
+                    let mut j = i;
 
-                    if let Some((field_width, offset)) = format_str[j..].scan_num::<usize>() {
-                        width = field_width;
-                        j += offset;
+                    if let Some((field_width, offset)) = format_str[j..].scan_num::<usize>() {
+                        width = field_width;
+                        j += offset;
                     }
-                    check_bound(format_str, bound, old, j)?;
+                    check_bound(format_str, bound, old, j)?;
 
-                    if chars[j] == '.' {
-                        j += 1;
-                        check_bound(format_str, bound, old, j)?;
+                    if chars[j] == '.' {
+                        j += 1;
+                        check_bound(format_str, bound, old, j)?;
 
-                        match format_str[j..].scan_num::<i32>() {
-                            Some((value, offset)) => {
-                                if value >= 0 {
-                                    precision = value;
+                        match format_str[j..].scan_num::<i32>() {
+                            Some((value, offset)) => {
+                                if value >= 0 {
+                                    precision = value;
                                 }
-                                j += offset;
+                                j += offset;
                             }
-                            None => precision = 0,
+                            None => precision = 0,
                         }
-                        check_bound(format_str, bound, old, j)?;
+                        check_bound(format_str, bound, old, j)?;
                     }
 
-                    i = j;
-                    tokens.push(Token::Directive {
-                        width,
-                        flag,
-                        precision,
-                        format: chars[i],
+                    i = j;
+                    tokens.push(Token::Directive {
+                        width,
+                        flag,
+                        precision,
+                        format: chars[i],
                     });
                 }
-                '\\' => {
-                    if !use_printf {
-                        tokens.push(Token::Char('\\'));
-                    } else {
-                        i += 1;
-                        if i >= bound {
+                '\\' => {
+                    if !use_printf {
+                        tokens.push(Token::Char('\\'));
+                    } else {
+                        i += 1;
+                        if i >= bound {
                             show_warning!("backslash at end of format");
-                            tokens.push(Token::Char('\\'));
+                            tokens.push(Token::Char('\\'));
                             continue;
                         }
-                        match chars[i] {
-                            'x' if i + 1 < bound => {
-                                if let Some((c, offset)) = format_str[i + 1..].scan_char(16) {
-                                    tokens.push(Token::Char(c));
-                                    i += offset;
-                                } else {
+                        match chars[i] {
+                            'x' if i + 1 < bound => {
+                                if let Some((c, offset)) = format_str[i + 1..].scan_char(16) {
+                                    tokens.push(Token::Char(c));
+                                    i += offset;
+                                } else {
                                     show_warning!("unrecognized escape '\\x'");
-                                    tokens.push(Token::Char('x'));
+                                    tokens.push(Token::Char('x'));
                                 }
                             }
-                            '0'..='7' => {
-                                let (c, offset) = format_str[i..].scan_char(8).unwrap();
-                                tokens.push(Token::Char(c));
-                                i += offset - 1;
+                            '0'..='7' => {
+                                let (c, offset) = format_str[i..].scan_char(8).unwrap();
+                                tokens.push(Token::Char(c));
+                                i += offset - 1;
                             }
-                            '"' => tokens.push(Token::Char('"')),
-                            '\\' => tokens.push(Token::Char('\\')),
-                            'a' => tokens.push(Token::Char('\x07')),
-                            'b' => tokens.push(Token::Char('\x08')),
-                            'e' => tokens.push(Token::Char('\x1B')),
-                            'f' => tokens.push(Token::Char('\x0C')),
-                            'n' => tokens.push(Token::Char('\n')),
-                            'r' => tokens.push(Token::Char('\r')),
-                            't' => tokens.push(Token::Char('\t')),
-                            'v' => tokens.push(Token::Char('\x0B')),
-                            c => {
-                                show_warning!("unrecognized escape '\\{}'", c);
-                                tokens.push(Token::Char(c));
+                            '"' => tokens.push(Token::Char('"')),
+                            '\\' => tokens.push(Token::Char('\\')),
+                            'a' => tokens.push(Token::Char('\x07')),
+                            'b' => tokens.push(Token::Char('\x08')),
+                            'e' => tokens.push(Token::Char('\x1B')),
+                            'f' => tokens.push(Token::Char('\x0C')),
+                            'n' => tokens.push(Token::Char('\n')),
+                            'r' => tokens.push(Token::Char('\r')),
+                            't' => tokens.push(Token::Char('\t')),
+                            'v' => tokens.push(Token::Char('\x0B')),
+                            c => {
+                                show_warning!("unrecognized escape '\\{}'", c);
+                                tokens.push(Token::Char(c));
                             }
                         }
                     }
                 }
 
-                c => tokens.push(Token::Char(c)),
+                c => tokens.push(Token::Char(c)),
             }
-            i += 1;
+            i += 1;
         }
-        if !use_printf && !format_str.ends_with('\n') {
-            tokens.push(Token::Char('\n'));
+        if !use_printf && !format_str.ends_with('\n') {
+            tokens.push(Token::Char('\n'));
         }
-        Ok(tokens)
+        Ok(tokens)
     }
 
-    fn new(matches: &ArgMatches) -> UResult<Self> {
-        let files = matches
-            .get_many::<OsString>(ARG_FILES)
-            .map(|v| v.map(OsString::from).collect())
-            .unwrap_or_default();
-        let format_str = if matches.contains_id(options::PRINTF) {
-            matches
-                .get_one::<String>(options::PRINTF)
-                .expect("Invalid format string")
-        } else {
-            matches
-                .get_one::<String>(options::FORMAT)
-                .map(|s| s.as_str())
-                .unwrap_or("")
+    fn new(matches: &ArgMatches) -> UResult<Self> {
+        let files = matches
+            .get_many::<OsString>(ARG_FILES)
+            .map(|v| v.map(OsString::from).collect())
+            .unwrap_or_default();
+        let format_str = if matches.contains_id(options::PRINTF) {
+            matches
+                .get_one::<String>(options::PRINTF)
+                .expect("Invalid format string")
+        } else {
+            matches
+                .get_one::<String>(options::FORMAT)
+                .map(|s| s.as_str())
+                .unwrap_or("")
         };
 
-        let use_printf = matches.contains_id(options::PRINTF);
-        let terse = matches.get_flag(options::TERSE);
-        let show_fs = matches.get_flag(options::FILE_SYSTEM);
+        let use_printf = matches.contains_id(options::PRINTF);
+        let terse = matches.get_flag(options::TERSE);
+        let show_fs = matches.get_flag(options::FILE_SYSTEM);
 
-        let default_tokens = if format_str.is_empty() {
-            Self::generate_tokens(&Self::default_format(show_fs, terse, false), use_printf)?
-        } else {
-            Self::generate_tokens(format_str, use_printf)?
-        };
-        let default_dev_tokens =
-            Self::generate_tokens(&Self::default_format(show_fs, terse, true), use_printf)?;
+        let default_tokens = if format_str.is_empty() {
+            Self::generate_tokens(&Self::default_format(show_fs, terse, false), use_printf)?
+        } else {
+            Self::generate_tokens(format_str, use_printf)?
+        };
+        let default_dev_tokens =
+            Self::generate_tokens(&Self::default_format(show_fs, terse, true), use_printf)?;
 
-        let mount_list = if show_fs {
-            // mount points aren't displayed when showing filesystem information
-            None
-        } else {
-            let mut mount_list = read_fs_list()
-                .map_err_context(|| "cannot read table of mounted file systems".into())?
-                .iter()
-                .map(|mi| mi.mount_dir.clone())
-                .collect::<Vec<String>>();
-            // Reverse sort. The longer comes first.
-            mount_list.sort();
-            mount_list.reverse();
-            Some(mount_list)
+        let mount_list = if show_fs {
+            // mount points aren't displayed when showing filesystem information
+            None
+        } else {
+            let mut mount_list = read_fs_list()
+                .map_err_context(|| "cannot read table of mounted file systems".into())?
+                .iter()
+                .map(|mi| mi.mount_dir.clone())
+                .collect::<Vec<String>>();
+            // Reverse sort. The longer comes first.
+            mount_list.sort();
+            mount_list.reverse();
+            Some(mount_list)
         };
 
-        Ok(Self {
-            follow: matches.get_flag(options::DEREFERENCE),
-            show_fs,
-            from_user: !format_str.is_empty(),
-            files,
-            default_tokens,
-            default_dev_tokens,
-            mount_list,
+        Ok(Self {
+            follow: matches.get_flag(options::DEREFERENCE),
+            show_fs,
+            from_user: !format_str.is_empty(),
+            files,
+            default_tokens,
+            default_dev_tokens,
+            mount_list,
         })
     }
 
-    fn find_mount_point<P: AsRef<Path>>(&self, p: P) -> Option<String> {
-        let path = match p.as_ref().canonicalize() {
-            Ok(s) => s,
-            Err(_) => return None,
+    fn find_mount_point<P: AsRef<Path>>(&self, p: P) -> Option<String> {
+        let path = match p.as_ref().canonicalize() {
+            Ok(s) => s,
+            Err(_) => return None,
         };
-        if let Some(ref mount_list) = self.mount_list {
-            for root in mount_list.iter() {
-                if path.starts_with(root) {
-                    return Some(root.clone());
+        if let Some(ref mount_list) = self.mount_list {
+            for root in mount_list.iter() {
+                if path.starts_with(root) {
+                    return Some(root.clone());
                 }
             }
         }
-        None
-    }
+        None
+    }
 
-    fn exec(&self) -> i32 {
-        let mut stdin_is_fifo = false;
-        if cfg!(unix) {
-            if let Ok(md) = fs::metadata("/dev/stdin") {
-                stdin_is_fifo = md.file_type().is_fifo();
+    fn exec(&self) -> i32 {
+        let mut stdin_is_fifo = false;
+        if cfg!(unix) {
+            if let Ok(md) = fs::metadata("/dev/stdin") {
+                stdin_is_fifo = md.file_type().is_fifo();
             }
         }
 
-        let mut ret = 0;
-        for f in &self.files {
-            ret |= self.do_stat(f, stdin_is_fifo);
+        let mut ret = 0;
+        for f in &self.files {
+            ret |= self.do_stat(f, stdin_is_fifo);
         }
-        ret
+        ret
     }
 
-    fn do_stat(&self, file: &OsStr, stdin_is_fifo: bool) -> i32 {
-        let display_name = file.to_string_lossy();
-        let file: OsString = if cfg!(unix) && display_name.eq("-") {
-            if let Ok(p) = Path::new("/dev/stdin").canonicalize() {
-                p.into_os_string()
-            } else {
-                OsString::from("/dev/stdin")
+    fn do_stat(&self, file: &OsStr, stdin_is_fifo: bool) -> i32 {
+        let display_name = file.to_string_lossy();
+        let file: OsString = if cfg!(unix) && display_name.eq("-") {
+            if let Ok(p) = Path::new("/dev/stdin").canonicalize() {
+                p.into_os_string()
+            } else {
+                OsString::from("/dev/stdin")
             }
-        } else {
-            OsString::from(file)
+        } else {
+            OsString::from(file)
         };
 
-        if !self.show_fs {
-            let result = if self.follow || stdin_is_fifo && display_name.eq("-") {
-                fs::metadata(&file)
-            } else {
-                fs::symlink_metadata(&file)
+        if !self.show_fs {
+            let result = if self.follow || stdin_is_fifo && display_name.eq("-") {
+                fs::metadata(&file)
+            } else {
+                fs::symlink_metadata(&file)
             };
-            match result {
-                Ok(meta) => {
-                    let file_type = meta.file_type();
-                    let tokens = if self.from_user
-                        || !(file_type.is_char_device() || file_type.is_block_device())
+            match result {
+                Ok(meta) => {
+                    let file_type = meta.file_type();
+                    let tokens = if self.from_user
+                        || !(file_type.is_char_device() || file_type.is_block_device())
                     {
-                        &self.default_tokens
-                    } else {
-                        &self.default_dev_tokens
+                        &self.default_tokens
+                    } else {
+                        &self.default_dev_tokens
                     };
 
-                    for t in tokens.iter() {
-                        match *t {
-                            Token::Char(c) => print!("{}", c),
-                            Token::Directive {
-                                flag,
-                                width,
-                                precision,
-                                format,
+                    for t in tokens.iter() {
+                        match *t {
+                            Token::Char(c) => print!("{}", c),
+                            Token::Directive {
+                                flag,
+                                width,
+                                precision,
+                                format,
                             } => {
-                                let arg: String;
-                                let output_type: OutputType;
+                                let arg: String;
+                                let output_type: OutputType;
 
-                                match format {
-                                    // access rights in octal
-                                    'a' => {
-                                        arg = format!("{:o}", 0o7777 & meta.mode());
-                                        output_type = OutputType::UnsignedOct;
+                                match format {
+                                    // access rights in octal
+                                    'a' => {
+                                        arg = format!("{:o}", 0o7777 & meta.mode());
+                                        output_type = OutputType::UnsignedOct;
                                     }
-                                    // access rights in human readable form
-                                    'A' => {
-                                        arg = display_permissions(&meta, true);
-                                        output_type = OutputType::Str;
+                                    // access rights in human readable form
+                                    'A' => {
+                                        arg = display_permissions(&meta, true);
+                                        output_type = OutputType::Str;
                                     }
-                                    // number of blocks allocated (see %B)
-                                    'b' => {
-                                        arg = format!("{}", meta.blocks());
-                                        output_type = OutputType::Unsigned;
+                                    // number of blocks allocated (see %B)
+                                    'b' => {
+                                        arg = format!("{}", meta.blocks());
+                                        output_type = OutputType::Unsigned;
                                     }
 
-                                    // the size in bytes of each block reported by %b
-                                    // FIXME: blocksize differs on various platform
-                                    // See coreutils/gnulib/lib/stat-size.h ST_NBLOCKSIZE // spell-checker:disable-line
-                                    'B' => {
-                                        // the size in bytes of each block reported by %b
-                                        arg = format!("{}", 512);
-                                        output_type = OutputType::Unsigned;
+                                    // the size in bytes of each block reported by %b
+                                    // FIXME: blocksize differs on various platform
+                                    // See coreutils/gnulib/lib/stat-size.h ST_NBLOCKSIZE // spell-checker:disable-line
+                                    'B' => {
+                                        // the size in bytes of each block reported by %b
+                                        arg = format!("{}", 512);
+                                        output_type = OutputType::Unsigned;
                                     }
 
-                                    // device number in decimal
-                                    'd' => {
-                                        arg = format!("{}", meta.dev());
-                                        output_type = OutputType::Unsigned;
+                                    // device number in decimal
+                                    'd' => {
+                                        arg = format!("{}", meta.dev());
+                                        output_type = OutputType::Unsigned;
                                     }
-                                    // device number in hex
-                                    'D' => {
-                                        arg = format!("{:x}", meta.dev());
-                                        output_type = OutputType::UnsignedHex;
+                                    // device number in hex
+                                    'D' => {
+                                        arg = format!("{:x}", meta.dev());
+                                        output_type = OutputType::UnsignedHex;
                                     }
-                                    // raw mode in hex
-                                    'f' => {
-                                        arg = format!("{:x}", meta.mode());
-                                        output_type = OutputType::UnsignedHex;
+                                    // raw mode in hex
+                                    'f' => {
+                                        arg = format!("{:x}", meta.mode());
+                                        output_type = OutputType::UnsignedHex;
                                     }
-                                    // file type
-                                    'F' => {
-                                        arg = pretty_filetype(meta.mode() as mode_t, meta.len())
-                                            .to_owned();
-                                        output_type = OutputType::Str;
+                                    // file type
+                                    'F' => {
+                                        arg = pretty_filetype(meta.mode() as mode_t, meta.len())
+                                            .to_owned();
+                                        output_type = OutputType::Str;
                                     }
-                                    // group ID of owner
-                                    'g' => {
-                                        arg = format!("{}", meta.gid());
-                                        output_type = OutputType::Unsigned;
+                                    // group ID of owner
+                                    'g' => {
+                                        arg = format!("{}", meta.gid());
+                                        output_type = OutputType::Unsigned;
                                     }
-                                    // group name of owner
-                                    'G' => {
-                                        arg = entries::gid2grp(meta.gid())
-                                            .unwrap_or_else(|_| "UNKNOWN".to_owned());
-                                        output_type = OutputType::Str;
+                                    // group name of owner
+                                    'G' => {
+                                        arg = entries::gid2grp(meta.gid())
+                                            .unwrap_or_else(|_| "UNKNOWN".to_owned());
+                                        output_type = OutputType::Str;
                                     }
-                                    // number of hard links
-                                    'h' => {
-                                        arg = format!("{}", meta.nlink());
-                                        output_type = OutputType::Unsigned;
+                                    // number of hard links
+                                    'h' => {
+                                        arg = format!("{}", meta.nlink());
+                                        output_type = OutputType::Unsigned;
                                     }
-                                    // inode number
-                                    'i' => {
-                                        arg = format!("{}", meta.ino());
-                                        output_type = OutputType::Unsigned;
+                                    // inode number
+                                    'i' => {
+                                        arg = format!("{}", meta.ino());
+                                        output_type = OutputType::Unsigned;
                                     }
 
-                                    // mount point
-                                    'm' => {
-                                        arg = self.find_mount_point(&file).unwrap();
-                                        output_type = OutputType::Str;
+                                    // mount point
+                                    'm' => {
+                                        arg = self.find_mount_point(&file).unwrap();
+                                        output_type = OutputType::Str;
                                     }
 
-                                    // file name
-                                    'n' => {
-                                        arg = display_name.to_string();
-                                        output_type = OutputType::Str;
+                                    // file name
+                                    'n' => {
+                                        arg = display_name.to_string();
+                                        output_type = OutputType::Str;
                                     }
-                                    // quoted file name with dereference if symbolic link
-                                    'N' => {
-                                        if file_type.is_symlink() {
-                                            let dst = match fs::read_link(&file) {
-                                                Ok(path) => path,
-                                                Err(e) => {
-                                                    println!("{}", e);
-                                                    return 1;
+                                    // quoted file name with dereference if symbolic link
+                                    'N' => {
+                                        if file_type.is_symlink() {
+                                            let dst = match fs::read_link(&file) {
+                                                Ok(path) => path,
+                                                Err(e) => {
+                                                    println!("{}", e);
+                                                    return 1;
                                                 }
                                             };
-                                            arg = format!(
+                                            arg = format!(
                                                 "{} -> {}",
-                                                display_name.quote(),
-                                                dst.quote()
+                                                display_name.quote(),
+                                                dst.quote()
                                             );
-                                        } else {
-                                            arg = display_name.to_string();
+                                        } else {
+                                            arg = display_name.to_string();
                                         }
-                                        output_type = OutputType::Str;
+                                        output_type = OutputType::Str;
                                     }
-                                    // optimal I/O transfer size hint
-                                    'o' => {
-                                        arg = format!("{}", meta.blksize());
-                                        output_type = OutputType::Unsigned;
+                                    // optimal I/O transfer size hint
+                                    'o' => {
+                                        arg = format!("{}", meta.blksize());
+                                        output_type = OutputType::Unsigned;
                                     }
-                                    // total size, in bytes
-                                    's' => {
-                                        arg = format!("{}", meta.len());
-                                        output_type = OutputType::Integer;
+                                    // total size, in bytes
+                                    's' => {
+                                        arg = format!("{}", meta.len());
+                                        output_type = OutputType::Integer;
                                     }
-                                    // major device type in hex, for character/block device special
-                                    // files
-                                    't' => {
-                                        arg = format!("{:x}", meta.rdev() >> 8);
-                                        output_type = OutputType::UnsignedHex;
+                                    // major device type in hex, for character/block device special
+                                    // files
+                                    't' => {
+                                        arg = format!("{:x}", meta.rdev() >> 8);
+                                        output_type = OutputType::UnsignedHex;
                                     }
-                                    // minor device type in hex, for character/block device special
-                                    // files
-                                    'T' => {
-                                        arg = format!("{:x}", meta.rdev() & 0xff);
-                                        output_type = OutputType::UnsignedHex;
+                                    // minor device type in hex, for character/block device special
+                                    // files
+                                    'T' => {
+                                        arg = format!("{:x}", meta.rdev() & 0xff);
+                                        output_type = OutputType::UnsignedHex;
                                     }
-                                    // user ID of owner
-                                    'u' => {
-                                        arg = format!("{}", meta.uid());
-                                        output_type = OutputType::Unsigned;
+                                    // user ID of owner
+                                    'u' => {
+                                        arg = format!("{}", meta.uid());
+                                        output_type = OutputType::Unsigned;
                                     }
-                                    // user name of owner
-                                    'U' => {
-                                        arg = entries::uid2usr(meta.uid())
-                                            .unwrap_or_else(|_| "UNKNOWN".to_owned());
-                                        output_type = OutputType::Str;
+                                    // user name of owner
+                                    'U' => {
+                                        arg = entries::uid2usr(meta.uid())
+                                            .unwrap_or_else(|_| "UNKNOWN".to_owned());
+                                        output_type = OutputType::Str;
                                     }
 
-                                    // time of file birth, human-readable; - if unknown
-                                    'w' => {
-                                        arg = meta.pretty_birth();
-                                        output_type = OutputType::Str;
+                                    // time of file birth, human-readable; - if unknown
+                                    'w' => {
+                                        arg = meta.pretty_birth();
+                                        output_type = OutputType::Str;
                                     }
 
-                                    // time of file birth, seconds since Epoch; 0 if unknown
-                                    'W' => {
-                                        arg = meta.birth();
-                                        output_type = OutputType::Integer;
+                                    // time of file birth, seconds since Epoch; 0 if unknown
+                                    'W' => {
+                                        arg = meta.birth();
+                                        output_type = OutputType::Integer;
                                     }
 
-                                    // time of last access, human-readable
-                                    'x' => {
-                                        arg = pretty_time(meta.atime(), meta.atime_nsec());
-                                        output_type = OutputType::Str;
+                                    // time of last access, human-readable
+                                    'x' => {
+                                        arg = pretty_time(meta.atime(), meta.atime_nsec());
+                                        output_type = OutputType::Str;
                                     }
-                                    // time of last access, seconds since Epoch
-                                    'X' => {
-                                        arg = format!("{}", meta.atime());
-                                        output_type = OutputType::Integer;
+                                    // time of last access, seconds since Epoch
+                                    'X' => {
+                                        arg = format!("{}", meta.atime());
+                                        output_type = OutputType::Integer;
                                     }
-                                    // time of last data modification, human-readable
-                                    'y' => {
-                                        arg = pretty_time(meta.mtime(), meta.mtime_nsec());
-                                        output_type = OutputType::Str;
+                                    // time of last data modification, human-readable
+                                    'y' => {
+                                        arg = pretty_time(meta.mtime(), meta.mtime_nsec());
+                                        output_type = OutputType::Str;
                                     }
-                                    // time of last data modification, seconds since Epoch
-                                    'Y' => {
-                                        arg = format!("{}", meta.mtime());
-                                        output_type = OutputType::Str;
+                                    // time of last data modification, seconds since Epoch
+                                    'Y' => {
+                                        arg = format!("{}", meta.mtime());
+                                        output_type = OutputType::Str;
                                     }
-                                    // time of last status change, human-readable
-                                    'z' => {
-                                        arg = pretty_time(meta.ctime(), meta.ctime_nsec());
-                                        output_type = OutputType::Str;
+                                    // time of last status change, human-readable
+                                    'z' => {
+                                        arg = pretty_time(meta.ctime(), meta.ctime_nsec());
+                                        output_type = OutputType::Str;
                                     }
-                                    // time of last status change, seconds since Epoch
-                                    'Z' => {
-                                        arg = format!("{}", meta.ctime());
-                                        output_type = OutputType::Integer;
+                                    // time of last status change, seconds since Epoch
+                                    'Z' => {
+                                        arg = format!("{}", meta.ctime());
+                                        output_type = OutputType::Integer;
                                     }
 
-                                    _ => {
-                                        arg = "?".to_owned();
-                                        output_type = OutputType::Unknown;
+                                    _ => {
+                                        arg = "?".to_owned();
+                                        output_type = OutputType::Unknown;
                                     }
                                 }
-                                print_it(&arg, &output_type, flag, width, precision);
+                                print_it(&arg, &output_type, flag, width, precision);
                             }
                         }
                     }
                 }
-                Err(e) => {
-                    show_error!("cannot stat {}: {}", display_name.quote(), e);
-                    return 1;
+                Err(e) => {
+                    show_error!("cannot stat {}: {}", display_name.quote(), e);
+                    return 1;
                 }
             }
-        } else {
-            #[cfg(unix)]
-            let p = file.as_bytes();
-            #[cfg(not(unix))]
-            let p = file.into_string().unwrap();
-            match statfs(p) {
-                Ok(meta) => {
-                    let tokens = &self.default_tokens;
+        } else {
+            #[cfg(unix)]
+            let p = file.as_bytes();
+            #[cfg(not(unix))]
+            let p = file.into_string().unwrap();
+            match statfs(p) {
+                Ok(meta) => {
+                    let tokens = &self.default_tokens;
 
-                    for t in tokens.iter() {
-                        match *t {
-                            Token::Char(c) => print!("{}", c),
-                            Token::Directive {
-                                flag,
-                                width,
-                                precision,
-                                format,
+                    for t in tokens.iter() {
+                        match *t {
+                            Token::Char(c) => print!("{}", c),
+                            Token::Directive {
+                                flag,
+                                width,
+                                precision,
+                                format,
                             } => {
-                                let arg: String;
-                                let output_type: OutputType;
-                                match format {
-                                    // free blocks available to non-superuser
-                                    'a' => {
-                                        arg = format!("{}", meta.avail_blocks());
-                                        output_type = OutputType::Integer;
+                                let arg: String;
+                                let output_type: OutputType;
+                                match format {
+                                    // free blocks available to non-superuser
+                                    'a' => {
+                                        arg = format!("{}", meta.avail_blocks());
+                                        output_type = OutputType::Integer;
                                     }
-                                    // total data blocks in file system
-                                    'b' => {
-                                        arg = format!("{}", meta.total_blocks());
-                                        output_type = OutputType::Integer;
+                                    // total data blocks in file system
+                                    'b' => {
+                                        arg = format!("{}", meta.total_blocks());
+                                        output_type = OutputType::Integer;
                                     }
-                                    // total file nodes in file system
-                                    'c' => {
-                                        arg = format!("{}", meta.total_file_nodes());
-                                        output_type = OutputType::Unsigned;
+                                    // total file nodes in file system
+                                    'c' => {
+                                        arg = format!("{}", meta.total_file_nodes());
+                                        output_type = OutputType::Unsigned;
                                     }
-                                    // free file nodes in file system
-                                    'd' => {
-                                        arg = format!("{}", meta.free_file_nodes());
-                                        output_type = OutputType::Integer;
+                                    // free file nodes in file system
+                                    'd' => {
+                                        arg = format!("{}", meta.free_file_nodes());
+                                        output_type = OutputType::Integer;
                                     }
-                                    // free blocks in file system
-                                    'f' => {
-                                        arg = format!("{}", meta.free_blocks());
-                                        output_type = OutputType::Integer;
+                                    // free blocks in file system
+                                    'f' => {
+                                        arg = format!("{}", meta.free_blocks());
+                                        output_type = OutputType::Integer;
                                     }
-                                    // file system ID in hex
-                                    'i' => {
-                                        arg = format!("{:x}", meta.fsid());
-                                        output_type = OutputType::UnsignedHex;
+                                    // file system ID in hex
+                                    'i' => {
+                                        arg = format!("{:x}", meta.fsid());
+                                        output_type = OutputType::UnsignedHex;
                                     }
-                                    // maximum length of filenames
-                                    'l' => {
-                                        arg = format!("{}", meta.namelen());
-                                        output_type = OutputType::Unsigned;
+                                    // maximum length of filenames
+                                    'l' => {
+                                        arg = format!("{}", meta.namelen());
+                                        output_type = OutputType::Unsigned;
                                     }
-                                    // file name
-                                    'n' => {
-                                        arg = display_name.to_string();
-                                        output_type = OutputType::Str;
+                                    // file name
+                                    'n' => {
+                                        arg = display_name.to_string();
+                                        output_type = OutputType::Str;
                                     }
-                                    // block size (for faster transfers)
-                                    's' => {
-                                        arg = format!("{}", meta.io_size());
-                                        output_type = OutputType::Unsigned;
+                                    // block size (for faster transfers)
+                                    's' => {
+                                        arg = format!("{}", meta.io_size());
+                                        output_type = OutputType::Unsigned;
                                     }
-                                    // fundamental block size (for block counts)
-                                    'S' => {
-                                        arg = format!("{}", meta.block_size());
-                                        output_type = OutputType::Unsigned;
+                                    // fundamental block size (for block counts)
+                                    'S' => {
+                                        arg = format!("{}", meta.block_size());
+                                        output_type = OutputType::Unsigned;
                                     }
-                                    // file system type in hex
-                                    't' => {
-                                        arg = format!("{:x}", meta.fs_type());
-                                        output_type = OutputType::UnsignedHex;
+                                    // file system type in hex
+                                    't' => {
+                                        arg = format!("{:x}", meta.fs_type());
+                                        output_type = OutputType::UnsignedHex;
                                     }
-                                    // file system type in human readable form
-                                    'T' => {
-                                        arg = pretty_fstype(meta.fs_type()).into_owned();
-                                        output_type = OutputType::Str;
+                                    // file system type in human readable form
+                                    'T' => {
+                                        arg = pretty_fstype(meta.fs_type()).into_owned();
+                                        output_type = OutputType::Str;
                                     }
-                                    _ => {
-                                        arg = "?".to_owned();
-                                        output_type = OutputType::Unknown;
+                                    _ => {
+                                        arg = "?".to_owned();
+                                        output_type = OutputType::Unknown;
                                     }
                                 }
 
-                                print_it(&arg, &output_type, flag, width, precision);
+                                print_it(&arg, &output_type, flag, width, precision);
                             }
                         }
                     }
                 }
-                Err(e) => {
+                Err(e) => {
                     show_error!(
                         "cannot read file system information for {}: {}",
-                        display_name.quote(),
-                        e
+                        display_name.quote(),
+                        e
                     );
-                    return 1;
+                    return 1;
                 }
             }
         }
-        0
-    }
+        0
+    }
 
-    fn default_format(show_fs: bool, terse: bool, show_dev_type: bool) -> String {
-        // SELinux related format is *ignored*
+    fn default_format(show_fs: bool, terse: bool, show_dev_type: bool) -> String {
+        // SELinux related format is *ignored*
 
-        let mut format_str = String::with_capacity(36);
-        if show_fs {
-            if terse {
-                format_str.push_str("%n %i %l %t %s %S %b %f %a %c %d\n");
-            } else {
-                format_str.push_str(
+        let mut format_str = String::with_capacity(36);
+        if show_fs {
+            if terse {
+                format_str.push_str("%n %i %l %t %s %S %b %f %a %c %d\n");
+            } else {
+                format_str.push_str(
                     "  File: \"%n\"\n    ID: %-8i Namelen: %-7l Type: %T\nBlock \
                      size: %-10s Fundamental block size: %S\nBlocks: Total: %-10b \
                      Free: %-10f Available: %a\nInodes: Total: %-10c Free: %d\n",
                 );
             }
-        } else if terse {
-            format_str.push_str("%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o\n");
-        } else {
-            format_str.push_str("  File: %N\n  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n");
-            if show_dev_type {
-                format_str
-                    .push_str("Device: %Dh/%dd\tInode: %-10i  Links: %-5h Device type: %t,%T\n");
-            } else {
-                format_str.push_str("Device: %Dh/%dd\tInode: %-10i  Links: %h\n");
+        } else if terse {
+            format_str.push_str("%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %W %o\n");
+        } else {
+            format_str.push_str("  File: %N\n  Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n");
+            if show_dev_type {
+                format_str
+                    .push_str("Device: %Dh/%dd\tInode: %-10i  Links: %-5h Device type: %t,%T\n");
+            } else {
+                format_str.push_str("Device: %Dh/%dd\tInode: %-10i  Links: %h\n");
             }
-            format_str.push_str("Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n");
-            format_str.push_str("Access: %x\nModify: %y\nChange: %z\n Birth: %w\n");
+            format_str.push_str("Access: (%04a/%10.10A)  Uid: (%5u/%8U)   Gid: (%5g/%8G)\n");
+            format_str.push_str("Access: %x\nModify: %y\nChange: %z\n Birth: %w\n");
         }
-        format_str
+        format_str
     }
 }
 
-fn get_long_usage() -> String {
-    String::from(
+fn get_long_usage() -> String {
+    String::from(
         "
 The valid format sequences for files (without --file-system):
 
@@ -2103,74 +2103,74 @@ for details about the options it supports.
     )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)?;
 
-    let stater = Stater::new(&matches)?;
-    let exit_status = stater.exec();
-    if exit_status == 0 {
+    let stater = Stater::new(&matches)?;
+    let exit_status = stater.exec();
+    if exit_status == 0 {
         Ok(())
-    } else {
-        Err(exit_status.into())
+    } else {
+        Err(exit_status.into())
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::DEREFERENCE)
-                .short('L')
-                .long(options::DEREFERENCE)
-                .help("follow links")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::DEREFERENCE)
+                .short('L')
+                .long(options::DEREFERENCE)
+                .help("follow links")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILE_SYSTEM)
-                .short('f')
-                .long(options::FILE_SYSTEM)
-                .help("display file system status instead of file status")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::FILE_SYSTEM)
+                .short('f')
+                .long(options::FILE_SYSTEM)
+                .help("display file system status instead of file status")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::TERSE)
-                .short('t')
-                .long(options::TERSE)
-                .help("print the information in terse form")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::TERSE)
+                .short('t')
+                .long(options::TERSE)
+                .help("print the information in terse form")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FORMAT)
-                .short('c')
-                .long(options::FORMAT)
-                .help(
+        .arg(
+            Arg::new(options::FORMAT)
+                .short('c')
+                .long(options::FORMAT)
+                .help(
                     "use the specified FORMAT instead of the default;
  output a newline after each use of FORMAT",
                 )
-                .value_name("FORMAT"),
+                .value_name("FORMAT"),
         )
-        .arg(
-            Arg::new(options::PRINTF)
-                .long(options::PRINTF)
-                .value_name("FORMAT")
-                .help(
+        .arg(
+            Arg::new(options::PRINTF)
+                .long(options::PRINTF)
+                .value_name("FORMAT")
+                .help(
                     "like --format, but interpret backslash escapes,
             and do not output a mandatory trailing newline;
             if you want a newline, include \n in FORMAT",
                 ),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_stdbuf/stdbuf.rs.html b/dev/src/uu_stdbuf/stdbuf.rs.html index 9bd8c4c73..ac9aff7c0 100644 --- a/dev/src/uu_stdbuf/stdbuf.rs.html +++ b/dev/src/uu_stdbuf/stdbuf.rs.html @@ -1,4 +1,4 @@ -stdbuf.rs - source
1
+stdbuf.rs - source
1
 2
 3
 4
@@ -233,35 +233,35 @@
 233
 234
 235
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) Dorota Kapturkiewicz <dokaptur@gmail.com>
-// *
-// * For the full copyright and license information, please view the LICENSE
-// * file that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) Dorota Kapturkiewicz <dokaptur@gmail.com>
+// *
+// * For the full copyright and license information, please view the LICENSE
+// * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) tempdir dyld dylib dragonflybsd optgrps libstdbuf
+// spell-checker:ignore (ToDO) tempdir dyld dylib dragonflybsd optgrps libstdbuf
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use std::fs::File;
-use std::io::{self, Write};
-use std::os::unix::process::ExitStatusExt;
-use std::path::PathBuf;
-use std::process;
-use tempfile::tempdir;
-use tempfile::TempDir;
-use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
-use uucore::parse_size::parse_size;
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use std::fs::File;
+use std::io::{self, Write};
+use std::os::unix::process::ExitStatusExt;
+use std::path::PathBuf;
+use std::process;
+use tempfile::tempdir;
+use tempfile::TempDir;
+use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
+use uucore::parse_size::parse_size;
 
-static ABOUT: &str =
+static ABOUT: &str =
     "Run COMMAND, with modified buffering operations for its standard streams.\n\n\
      Mandatory arguments to long options are mandatory for short options too.";
-const USAGE: &str = "{} OPTION... COMMAND";
-static LONG_HELP: &str = "If MODE is 'L' the corresponding stream will be line buffered.\n\
+const USAGE: &str = "{} OPTION... COMMAND";
+static LONG_HELP: &str = "If MODE is 'L' the corresponding stream will be line buffered.\n\
      This option is invalid with standard input.\n\n\
      If MODE is '0' the corresponding stream will be unbuffered.\n\n\
      Otherwise MODE is a number which may be followed by one of the following:\n\n\
@@ -273,200 +273,200 @@
      Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, \
      and are thus unaffected by 'stdbuf' settings.\n";
 
-mod options {
-    pub const INPUT: &str = "input";
-    pub const INPUT_SHORT: char = 'i';
-    pub const OUTPUT: &str = "output";
-    pub const OUTPUT_SHORT: char = 'o';
-    pub const ERROR: &str = "error";
-    pub const ERROR_SHORT: char = 'e';
-    pub const COMMAND: &str = "command";
+mod options {
+    pub const INPUT: &str = "input";
+    pub const INPUT_SHORT: char = 'i';
+    pub const OUTPUT: &str = "output";
+    pub const OUTPUT_SHORT: char = 'o';
+    pub const ERROR: &str = "error";
+    pub const ERROR_SHORT: char = 'e';
+    pub const COMMAND: &str = "command";
 }
 
-const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so"));
+const STDBUF_INJECT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/libstdbuf.so"));
 
-enum BufferType {
-    Default,
-    Line,
-    Size(usize),
+enum BufferType {
+    Default,
+    Line,
+    Size(usize),
 }
 
-struct ProgramOptions {
-    stdin: BufferType,
-    stdout: BufferType,
-    stderr: BufferType,
+struct ProgramOptions {
+    stdin: BufferType,
+    stdout: BufferType,
+    stderr: BufferType,
 }
 
-impl TryFrom<&ArgMatches> for ProgramOptions {
-    type Error = ProgramOptionsError;
+impl TryFrom<&ArgMatches> for ProgramOptions {
+    type Error = ProgramOptionsError;
 
-    fn try_from(matches: &ArgMatches) -> Result<Self, Self::Error> {
-        Ok(Self {
-            stdin: check_option(matches, options::INPUT)?,
-            stdout: check_option(matches, options::OUTPUT)?,
-            stderr: check_option(matches, options::ERROR)?,
+    fn try_from(matches: &ArgMatches) -> Result<Self, Self::Error> {
+        Ok(Self {
+            stdin: check_option(matches, options::INPUT)?,
+            stdout: check_option(matches, options::OUTPUT)?,
+            stderr: check_option(matches, options::ERROR)?,
         })
     }
 }
 
-struct ProgramOptionsError(String);
+struct ProgramOptionsError(String);
 
-#[cfg(any(
-    target_os = "linux",
-    target_os = "android",
-    target_os = "freebsd",
-    target_os = "netbsd",
-    target_os = "dragonflybsd"
-))]
-fn preload_strings() -> (&'static str, &'static str) {
+#[cfg(any(
+    target_os = "linux",
+    target_os = "android",
+    target_os = "freebsd",
+    target_os = "netbsd",
+    target_os = "dragonflybsd"
+))]
+fn preload_strings() -> (&'static str, &'static str) {
     ("LD_PRELOAD", "so")
 }
 
-#[cfg(target_vendor = "apple")]
-fn preload_strings() -> (&'static str, &'static str) {
+#[cfg(target_vendor = "apple")]
+fn preload_strings() -> (&'static str, &'static str) {
     ("DYLD_LIBRARY_PATH", "dylib")
 }
 
-#[cfg(not(any(
-    target_os = "linux",
-    target_os = "android",
-    target_os = "freebsd",
-    target_os = "netbsd",
-    target_os = "dragonflybsd",
-    target_vendor = "apple"
-)))]
-fn preload_strings() -> (&'static str, &'static str) {
+#[cfg(not(any(
+    target_os = "linux",
+    target_os = "android",
+    target_os = "freebsd",
+    target_os = "netbsd",
+    target_os = "dragonflybsd",
+    target_vendor = "apple"
+)))]
+fn preload_strings() -> (&'static str, &'static str) {
     crash!(1, "Command not supported for this operating system!")
 }
 
-fn check_option(matches: &ArgMatches, name: &str) -> Result<BufferType, ProgramOptionsError> {
-    match matches.get_one::<String>(name) {
-        Some(value) => match value.as_str() {
-            "L" => {
-                if name == options::INPUT {
-                    Err(ProgramOptionsError(
-                        "line buffering stdin is meaningless".to_string(),
+fn check_option(matches: &ArgMatches, name: &str) -> Result<BufferType, ProgramOptionsError> {
+    match matches.get_one::<String>(name) {
+        Some(value) => match value.as_str() {
+            "L" => {
+                if name == options::INPUT {
+                    Err(ProgramOptionsError(
+                        "line buffering stdin is meaningless".to_string(),
                     ))
-                } else {
-                    Ok(BufferType::Line)
+                } else {
+                    Ok(BufferType::Line)
                 }
             }
-            x => parse_size(x).map_or_else(
-                |e| crash!(125, "invalid mode {}", e),
-                |m| {
-                    Ok(BufferType::Size(m.try_into().map_err(|_| {
-                        ProgramOptionsError(format!(
+            x => parse_size(x).map_or_else(
+                |e| crash!(125, "invalid mode {}", e),
+                |m| {
+                    Ok(BufferType::Size(m.try_into().map_err(|_| {
+                        ProgramOptionsError(format!(
                             "invalid mode '{}': Value too large for defined data type",
-                            x
+                            x
                         ))
                     })?))
                 },
             ),
         },
-        None => Ok(BufferType::Default),
+        None => Ok(BufferType::Default),
     }
 }
 
-fn set_command_env(command: &mut process::Command, buffer_name: &str, buffer_type: &BufferType) {
-    match buffer_type {
-        BufferType::Size(m) => {
-            command.env(buffer_name, m.to_string());
+fn set_command_env(command: &mut process::Command, buffer_name: &str, buffer_type: &BufferType) {
+    match buffer_type {
+        BufferType::Size(m) => {
+            command.env(buffer_name, m.to_string());
         }
-        BufferType::Line => {
-            command.env(buffer_name, "L");
+        BufferType::Line => {
+            command.env(buffer_name, "L");
         }
-        BufferType::Default => {}
+        BufferType::Default => {}
     }
 }
 
-fn get_preload_env(tmp_dir: &mut TempDir) -> io::Result<(String, PathBuf)> {
-    let (preload, extension) = preload_strings();
-    let inject_path = tmp_dir.path().join("libstdbuf").with_extension(extension);
+fn get_preload_env(tmp_dir: &mut TempDir) -> io::Result<(String, PathBuf)> {
+    let (preload, extension) = preload_strings();
+    let inject_path = tmp_dir.path().join("libstdbuf").with_extension(extension);
 
-    let mut file = File::create(&inject_path)?;
-    file.write_all(STDBUF_INJECT)?;
+    let mut file = File::create(&inject_path)?;
+    file.write_all(STDBUF_INJECT)?;
 
-    Ok((preload.to_owned(), inject_path))
+    Ok((preload.to_owned(), inject_path))
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let options = ProgramOptions::try_from(&matches).map_err(|e| UUsageError::new(125, e.0))?;
+    let options = ProgramOptions::try_from(&matches).map_err(|e| UUsageError::new(125, e.0))?;
 
-    let mut command_values = matches.get_many::<String>(options::COMMAND).unwrap();
-    let mut command = process::Command::new(command_values.next().unwrap());
-    let command_params: Vec<&str> = command_values.map(|s| s.as_ref()).collect();
+    let mut command_values = matches.get_many::<String>(options::COMMAND).unwrap();
+    let mut command = process::Command::new(command_values.next().unwrap());
+    let command_params: Vec<&str> = command_values.map(|s| s.as_ref()).collect();
 
-    let mut tmp_dir = tempdir().unwrap();
-    let (preload_env, libstdbuf) = get_preload_env(&mut tmp_dir).map_err_context(String::new)?;
-    command.env(preload_env, libstdbuf);
-    set_command_env(&mut command, "_STDBUF_I", &options.stdin);
-    set_command_env(&mut command, "_STDBUF_O", &options.stdout);
-    set_command_env(&mut command, "_STDBUF_E", &options.stderr);
-    command.args(command_params);
+    let mut tmp_dir = tempdir().unwrap();
+    let (preload_env, libstdbuf) = get_preload_env(&mut tmp_dir).map_err_context(String::new)?;
+    command.env(preload_env, libstdbuf);
+    set_command_env(&mut command, "_STDBUF_I", &options.stdin);
+    set_command_env(&mut command, "_STDBUF_O", &options.stdout);
+    set_command_env(&mut command, "_STDBUF_E", &options.stderr);
+    command.args(command_params);
 
-    let mut process = command
-        .spawn()
-        .map_err_context(|| "failed to execute process".to_string())?;
-    let status = process.wait().map_err_context(String::new)?;
-    match status.code() {
-        Some(i) => {
-            if i == 0 {
+    let mut process = command
+        .spawn()
+        .map_err_context(|| "failed to execute process".to_string())?;
+    let status = process.wait().map_err_context(String::new)?;
+    match status.code() {
+        Some(i) => {
+            if i == 0 {
                 Ok(())
-            } else {
-                Err(i.into())
+            } else {
+                Err(i.into())
             }
         }
-        None => Err(USimpleError::new(
+        None => Err(USimpleError::new(
             1,
-            format!("process killed by signal {}", status.signal().unwrap()),
+            format!("process killed by signal {}", status.signal().unwrap()),
         )),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .after_help(LONG_HELP)
-        .override_usage(format_usage(USAGE))
-        .trailing_var_arg(true)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::INPUT)
-                .long(options::INPUT)
-                .short(options::INPUT_SHORT)
-                .help("adjust standard input stream buffering")
-                .value_name("MODE")
-                .required_unless_present_any([options::OUTPUT, options::ERROR]),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .after_help(LONG_HELP)
+        .override_usage(format_usage(USAGE))
+        .trailing_var_arg(true)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::INPUT)
+                .long(options::INPUT)
+                .short(options::INPUT_SHORT)
+                .help("adjust standard input stream buffering")
+                .value_name("MODE")
+                .required_unless_present_any([options::OUTPUT, options::ERROR]),
         )
-        .arg(
-            Arg::new(options::OUTPUT)
-                .long(options::OUTPUT)
-                .short(options::OUTPUT_SHORT)
-                .help("adjust standard output stream buffering")
-                .value_name("MODE")
-                .required_unless_present_any([options::INPUT, options::ERROR]),
+        .arg(
+            Arg::new(options::OUTPUT)
+                .long(options::OUTPUT)
+                .short(options::OUTPUT_SHORT)
+                .help("adjust standard output stream buffering")
+                .value_name("MODE")
+                .required_unless_present_any([options::INPUT, options::ERROR]),
         )
-        .arg(
-            Arg::new(options::ERROR)
-                .long(options::ERROR)
-                .short(options::ERROR_SHORT)
-                .help("adjust standard error stream buffering")
-                .value_name("MODE")
-                .required_unless_present_any([options::INPUT, options::OUTPUT]),
+        .arg(
+            Arg::new(options::ERROR)
+                .long(options::ERROR)
+                .short(options::ERROR_SHORT)
+                .help("adjust standard error stream buffering")
+                .value_name("MODE")
+                .required_unless_present_any([options::INPUT, options::OUTPUT]),
         )
-        .arg(
-            Arg::new(options::COMMAND)
-                .action(ArgAction::Append)
-                .hide(true)
-                .required(true)
-                .value_hint(clap::ValueHint::CommandName),
+        .arg(
+            Arg::new(options::COMMAND)
+                .action(ArgAction::Append)
+                .hide(true)
+                .required(true)
+                .value_hint(clap::ValueHint::CommandName),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_stty/flags.rs.html b/dev/src/uu_stty/flags.rs.html index 7ccab254d..07f4b9796 100644 --- a/dev/src/uu_stty/flags.rs.html +++ b/dev/src/uu_stty/flags.rs.html @@ -1,4 +1,4 @@ -flags.rs - source
1
+flags.rs - source
1
 2
 3
 4
@@ -313,320 +313,320 @@
 313
 314
 315
-
// * This file is part of the uutils coreutils package.
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-// spell-checker:ignore parenb parodd cmspar hupcl cstopb cread clocal crtscts CSIZE
-// spell-checker:ignore ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl ixoff ixon iuclc ixany imaxbel iutf
-// spell-checker:ignore opost olcuc ocrnl onlcr onocr onlret ofill ofdel nldly crdly tabdly bsdly vtdly ffdly
-// spell-checker:ignore isig icanon iexten echoe crterase echok echonl noflsh xcase tostop echoprt prterase echoctl ctlecho echoke crtkill flusho extproc
+// spell-checker:ignore parenb parodd cmspar hupcl cstopb cread clocal crtscts CSIZE
+// spell-checker:ignore ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl ixoff ixon iuclc ixany imaxbel iutf
+// spell-checker:ignore opost olcuc ocrnl onlcr onocr onlret ofill ofdel nldly crdly tabdly bsdly vtdly ffdly
+// spell-checker:ignore isig icanon iexten echoe crterase echok echonl noflsh xcase tostop echoprt prterase echoctl ctlecho echoke crtkill flusho extproc
 
-use crate::Flag;
+use crate::Flag;
 
-#[cfg(not(any(
-    target_os = "freebsd",
-    target_os = "dragonfly",
-    target_os = "ios",
-    target_os = "macos",
-    target_os = "netbsd",
-    target_os = "openbsd"
-)))]
-use nix::sys::termios::BaudRate;
-use nix::sys::termios::{ControlFlags as C, InputFlags as I, LocalFlags as L, OutputFlags as O};
+#[cfg(not(any(
+    target_os = "freebsd",
+    target_os = "dragonfly",
+    target_os = "ios",
+    target_os = "macos",
+    target_os = "netbsd",
+    target_os = "openbsd"
+)))]
+use nix::sys::termios::BaudRate;
+use nix::sys::termios::{ControlFlags as C, InputFlags as I, LocalFlags as L, OutputFlags as O};
 
-pub const CONTROL_FLAGS: &[Flag<C>] = &[
-    Flag::new("parenb", C::PARENB),
-    Flag::new("parodd", C::PARODD),
-    #[cfg(any(
-        target_os = "android",
-        all(target_os = "linux", not(target_arch = "mips"))
-    ))]
-    Flag::new("cmspar", C::CMSPAR),
-    Flag::new_grouped("cs5", C::CS5, C::CSIZE),
-    Flag::new_grouped("cs6", C::CS6, C::CSIZE),
-    Flag::new_grouped("cs7", C::CS7, C::CSIZE),
-    Flag::new_grouped("cs8", C::CS8, C::CSIZE).sane(),
-    Flag::new("hupcl", C::HUPCL),
-    Flag::new("cstopb", C::CSTOPB),
-    Flag::new("cread", C::CREAD).sane(),
-    Flag::new("clocal", C::CLOCAL),
-    Flag::new("crtscts", C::CRTSCTS),
+pub const CONTROL_FLAGS: &[Flag<C>] = &[
+    Flag::new("parenb", C::PARENB),
+    Flag::new("parodd", C::PARODD),
+    #[cfg(any(
+        target_os = "android",
+        all(target_os = "linux", not(target_arch = "mips"))
+    ))]
+    Flag::new("cmspar", C::CMSPAR),
+    Flag::new_grouped("cs5", C::CS5, C::CSIZE),
+    Flag::new_grouped("cs6", C::CS6, C::CSIZE),
+    Flag::new_grouped("cs7", C::CS7, C::CSIZE),
+    Flag::new_grouped("cs8", C::CS8, C::CSIZE).sane(),
+    Flag::new("hupcl", C::HUPCL),
+    Flag::new("cstopb", C::CSTOPB),
+    Flag::new("cread", C::CREAD).sane(),
+    Flag::new("clocal", C::CLOCAL),
+    Flag::new("crtscts", C::CRTSCTS),
 ];
 
-pub const INPUT_FLAGS: &[Flag<I>] = &[
-    Flag::new("ignbrk", I::IGNBRK),
-    Flag::new("brkint", I::BRKINT).sane(),
-    Flag::new("ignpar", I::IGNPAR),
-    Flag::new("parmrk", I::PARMRK),
-    Flag::new("inpck", I::INPCK),
-    Flag::new("istrip", I::ISTRIP),
-    Flag::new("inlcr", I::INLCR),
-    Flag::new("igncr", I::IGNCR),
-    Flag::new("icrnl", I::ICRNL).sane(),
-    Flag::new("ixoff", I::IXOFF),
-    Flag::new("tandem", I::IXOFF),
-    Flag::new("ixon", I::IXON),
-    // not supported by nix
-    // Flag::new("iuclc", I::IUCLC),
-    Flag::new("ixany", I::IXANY),
-    Flag::new("imaxbel", I::IMAXBEL).sane(),
-    #[cfg(any(target_os = "android", target_os = "linux", target_os = "macos"))]
-    Flag::new("iutf8", I::IUTF8),
+pub const INPUT_FLAGS: &[Flag<I>] = &[
+    Flag::new("ignbrk", I::IGNBRK),
+    Flag::new("brkint", I::BRKINT).sane(),
+    Flag::new("ignpar", I::IGNPAR),
+    Flag::new("parmrk", I::PARMRK),
+    Flag::new("inpck", I::INPCK),
+    Flag::new("istrip", I::ISTRIP),
+    Flag::new("inlcr", I::INLCR),
+    Flag::new("igncr", I::IGNCR),
+    Flag::new("icrnl", I::ICRNL).sane(),
+    Flag::new("ixoff", I::IXOFF),
+    Flag::new("tandem", I::IXOFF),
+    Flag::new("ixon", I::IXON),
+    // not supported by nix
+    // Flag::new("iuclc", I::IUCLC),
+    Flag::new("ixany", I::IXANY),
+    Flag::new("imaxbel", I::IMAXBEL).sane(),
+    #[cfg(any(target_os = "android", target_os = "linux", target_os = "macos"))]
+    Flag::new("iutf8", I::IUTF8),
 ];
 
-pub const OUTPUT_FLAGS: &[Flag<O>] = &[
-    Flag::new("opost", O::OPOST).sane(),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "linux",
-        target_os = "openbsd"
-    ))]
-    Flag::new("olcuc", O::OLCUC),
-    Flag::new("ocrnl", O::OCRNL),
-    Flag::new("onlcr", O::ONLCR).sane(),
-    Flag::new("onocr", O::ONOCR),
-    Flag::new("onlret", O::ONLRET),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new("ofill", O::OFILL),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new("ofdel", O::OFDEL),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("nl0", O::NL0, O::NLDLY).sane(),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("nl1", O::NL1, O::NLDLY),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("cr0", O::CR0, O::CRDLY).sane(),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("cr1", O::CR1, O::CRDLY),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("cr2", O::CR2, O::CRDLY),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("cr3", O::CR3, O::CRDLY),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("tab0", O::TAB0, O::TABDLY).sane(),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("tab1", O::TAB1, O::TABDLY),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("tab2", O::TAB2, O::TABDLY),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("tab3", O::TAB3, O::TABDLY),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("bs0", O::BS0, O::BSDLY).sane(),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("bs1", O::BS1, O::BSDLY),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("vt0", O::VT0, O::VTDLY).sane(),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("vt1", O::VT1, O::VTDLY),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("ff0", O::FF0, O::FFDLY).sane(),
-    #[cfg(any(
-        target_os = "android",
-        target_os = "haiku",
-        target_os = "ios",
-        target_os = "linux",
-        target_os = "macos"
-    ))]
-    Flag::new_grouped("ff1", O::FF1, O::FFDLY),
+pub const OUTPUT_FLAGS: &[Flag<O>] = &[
+    Flag::new("opost", O::OPOST).sane(),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "linux",
+        target_os = "openbsd"
+    ))]
+    Flag::new("olcuc", O::OLCUC),
+    Flag::new("ocrnl", O::OCRNL),
+    Flag::new("onlcr", O::ONLCR).sane(),
+    Flag::new("onocr", O::ONOCR),
+    Flag::new("onlret", O::ONLRET),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new("ofill", O::OFILL),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new("ofdel", O::OFDEL),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("nl0", O::NL0, O::NLDLY).sane(),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("nl1", O::NL1, O::NLDLY),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("cr0", O::CR0, O::CRDLY).sane(),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("cr1", O::CR1, O::CRDLY),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("cr2", O::CR2, O::CRDLY),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("cr3", O::CR3, O::CRDLY),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("tab0", O::TAB0, O::TABDLY).sane(),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("tab1", O::TAB1, O::TABDLY),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("tab2", O::TAB2, O::TABDLY),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("tab3", O::TAB3, O::TABDLY),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("bs0", O::BS0, O::BSDLY).sane(),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("bs1", O::BS1, O::BSDLY),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("vt0", O::VT0, O::VTDLY).sane(),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("vt1", O::VT1, O::VTDLY),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("ff0", O::FF0, O::FFDLY).sane(),
+    #[cfg(any(
+        target_os = "android",
+        target_os = "haiku",
+        target_os = "ios",
+        target_os = "linux",
+        target_os = "macos"
+    ))]
+    Flag::new_grouped("ff1", O::FF1, O::FFDLY),
 ];
 
-pub const LOCAL_FLAGS: &[Flag<L>] = &[
-    Flag::new("isig", L::ISIG).sane(),
-    Flag::new("icanon", L::ICANON).sane(),
-    Flag::new("iexten", L::IEXTEN).sane(),
-    Flag::new("echo", L::ECHO).sane(),
-    Flag::new("echoe", L::ECHOE).sane(),
-    Flag::new("crterase", L::ECHOE).hidden().sane(),
-    Flag::new("echok", L::ECHOK).sane(),
-    Flag::new("echonl", L::ECHONL),
-    Flag::new("noflsh", L::NOFLSH),
-    // Not supported by nix
-    // Flag::new("xcase", L::XCASE),
-    Flag::new("tostop", L::TOSTOP),
-    Flag::new("echoprt", L::ECHOPRT),
-    Flag::new("prterase", L::ECHOPRT).hidden(),
-    Flag::new("echoctl", L::ECHOCTL).sane(),
-    Flag::new("ctlecho", L::ECHOCTL).sane().hidden(),
-    Flag::new("echoke", L::ECHOKE).sane(),
-    Flag::new("crtkill", L::ECHOKE).sane().hidden(),
-    Flag::new("flusho", L::FLUSHO),
-    Flag::new("extproc", L::EXTPROC),
+pub const LOCAL_FLAGS: &[Flag<L>] = &[
+    Flag::new("isig", L::ISIG).sane(),
+    Flag::new("icanon", L::ICANON).sane(),
+    Flag::new("iexten", L::IEXTEN).sane(),
+    Flag::new("echo", L::ECHO).sane(),
+    Flag::new("echoe", L::ECHOE).sane(),
+    Flag::new("crterase", L::ECHOE).hidden().sane(),
+    Flag::new("echok", L::ECHOK).sane(),
+    Flag::new("echonl", L::ECHONL),
+    Flag::new("noflsh", L::NOFLSH),
+    // Not supported by nix
+    // Flag::new("xcase", L::XCASE),
+    Flag::new("tostop", L::TOSTOP),
+    Flag::new("echoprt", L::ECHOPRT),
+    Flag::new("prterase", L::ECHOPRT).hidden(),
+    Flag::new("echoctl", L::ECHOCTL).sane(),
+    Flag::new("ctlecho", L::ECHOCTL).sane().hidden(),
+    Flag::new("echoke", L::ECHOKE).sane(),
+    Flag::new("crtkill", L::ECHOKE).sane().hidden(),
+    Flag::new("flusho", L::FLUSHO),
+    Flag::new("extproc", L::EXTPROC),
 ];
 
-// BSD's use u32 as baud rate, to using the enum is unnecessary.
-#[cfg(not(any(
-    target_os = "freebsd",
-    target_os = "dragonfly",
-    target_os = "ios",
-    target_os = "macos",
-    target_os = "netbsd",
-    target_os = "openbsd"
-)))]
-pub const BAUD_RATES: &[(&str, BaudRate)] = &[
-    ("0", BaudRate::B0),
-    ("50", BaudRate::B50),
-    ("75", BaudRate::B75),
-    ("110", BaudRate::B110),
-    ("134", BaudRate::B134),
-    ("150", BaudRate::B150),
-    ("200", BaudRate::B200),
-    ("300", BaudRate::B300),
-    ("600", BaudRate::B600),
-    ("1200", BaudRate::B1200),
-    ("1800", BaudRate::B1800),
-    ("2400", BaudRate::B2400),
-    ("9600", BaudRate::B9600),
-    ("19200", BaudRate::B19200),
-    ("38400", BaudRate::B38400),
-    ("57600", BaudRate::B57600),
-    ("115200", BaudRate::B115200),
-    ("230400", BaudRate::B230400),
-    #[cfg(any(target_os = "android", target_os = "linux"))]
-    ("500000", BaudRate::B500000),
-    #[cfg(any(target_os = "android", target_os = "linux"))]
-    ("576000", BaudRate::B576000),
-    #[cfg(any(target_os = "android", target_os = "linux",))]
-    ("921600", BaudRate::B921600),
-    #[cfg(any(target_os = "android", target_os = "linux"))]
-    ("1000000", BaudRate::B1000000),
-    #[cfg(any(target_os = "android", target_os = "linux"))]
-    ("1152000", BaudRate::B1152000),
-    #[cfg(any(target_os = "android", target_os = "linux"))]
-    ("1500000", BaudRate::B1500000),
-    #[cfg(any(target_os = "android", target_os = "linux"))]
-    ("2000000", BaudRate::B2000000),
-    #[cfg(any(
-        target_os = "android",
-        all(target_os = "linux", not(target_arch = "sparc64"))
-    ))]
-    ("2500000", BaudRate::B2500000),
-    #[cfg(any(
-        target_os = "android",
-        all(target_os = "linux", not(target_arch = "sparc64"))
-    ))]
-    ("3000000", BaudRate::B3000000),
-    #[cfg(any(
-        target_os = "android",
-        all(target_os = "linux", not(target_arch = "sparc64"))
-    ))]
-    ("3500000", BaudRate::B3500000),
-    #[cfg(any(
-        target_os = "android",
-        all(target_os = "linux", not(target_arch = "sparc64"))
-    ))]
-    ("4000000", BaudRate::B4000000),
+// BSD's use u32 as baud rate, to using the enum is unnecessary.
+#[cfg(not(any(
+    target_os = "freebsd",
+    target_os = "dragonfly",
+    target_os = "ios",
+    target_os = "macos",
+    target_os = "netbsd",
+    target_os = "openbsd"
+)))]
+pub const BAUD_RATES: &[(&str, BaudRate)] = &[
+    ("0", BaudRate::B0),
+    ("50", BaudRate::B50),
+    ("75", BaudRate::B75),
+    ("110", BaudRate::B110),
+    ("134", BaudRate::B134),
+    ("150", BaudRate::B150),
+    ("200", BaudRate::B200),
+    ("300", BaudRate::B300),
+    ("600", BaudRate::B600),
+    ("1200", BaudRate::B1200),
+    ("1800", BaudRate::B1800),
+    ("2400", BaudRate::B2400),
+    ("9600", BaudRate::B9600),
+    ("19200", BaudRate::B19200),
+    ("38400", BaudRate::B38400),
+    ("57600", BaudRate::B57600),
+    ("115200", BaudRate::B115200),
+    ("230400", BaudRate::B230400),
+    #[cfg(any(target_os = "android", target_os = "linux"))]
+    ("500000", BaudRate::B500000),
+    #[cfg(any(target_os = "android", target_os = "linux"))]
+    ("576000", BaudRate::B576000),
+    #[cfg(any(target_os = "android", target_os = "linux",))]
+    ("921600", BaudRate::B921600),
+    #[cfg(any(target_os = "android", target_os = "linux"))]
+    ("1000000", BaudRate::B1000000),
+    #[cfg(any(target_os = "android", target_os = "linux"))]
+    ("1152000", BaudRate::B1152000),
+    #[cfg(any(target_os = "android", target_os = "linux"))]
+    ("1500000", BaudRate::B1500000),
+    #[cfg(any(target_os = "android", target_os = "linux"))]
+    ("2000000", BaudRate::B2000000),
+    #[cfg(any(
+        target_os = "android",
+        all(target_os = "linux", not(target_arch = "sparc64"))
+    ))]
+    ("2500000", BaudRate::B2500000),
+    #[cfg(any(
+        target_os = "android",
+        all(target_os = "linux", not(target_arch = "sparc64"))
+    ))]
+    ("3000000", BaudRate::B3000000),
+    #[cfg(any(
+        target_os = "android",
+        all(target_os = "linux", not(target_arch = "sparc64"))
+    ))]
+    ("3500000", BaudRate::B3500000),
+    #[cfg(any(
+        target_os = "android",
+        all(target_os = "linux", not(target_arch = "sparc64"))
+    ))]
+    ("4000000", BaudRate::B4000000),
 ];
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_stty/stty.rs.html b/dev/src/uu_stty/stty.rs.html index aa4647082..f95bd84f4 100644 --- a/dev/src/uu_stty/stty.rs.html +++ b/dev/src/uu_stty/stty.rs.html @@ -1,4 +1,4 @@ -stty.rs - source
1
+stty.rs - source
1
 2
 3
 4
@@ -401,408 +401,408 @@
 401
 402
 403
-
// * This file is part of the uutils coreutils package.
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-// spell-checker:ignore tcgetattr tcsetattr tcsanow tiocgwinsz tiocswinsz cfgetospeed ushort
+// spell-checker:ignore tcgetattr tcsetattr tcsanow tiocgwinsz tiocswinsz cfgetospeed ushort
 
-mod flags;
+mod flags;
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use nix::libc::{c_ushort, TIOCGWINSZ, TIOCSWINSZ};
-use nix::sys::termios::{
-    cfgetospeed, tcgetattr, tcsetattr, ControlFlags, InputFlags, LocalFlags, OutputFlags, Termios,
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use nix::libc::{c_ushort, TIOCGWINSZ, TIOCSWINSZ};
+use nix::sys::termios::{
+    cfgetospeed, tcgetattr, tcsetattr, ControlFlags, InputFlags, LocalFlags, OutputFlags, Termios,
 };
-use nix::{ioctl_read_bad, ioctl_write_ptr_bad};
-use std::io::{self, stdout};
-use std::ops::ControlFlow;
-use std::os::unix::io::{AsRawFd, RawFd};
-use uucore::error::{UResult, USimpleError};
-use uucore::format_usage;
+use nix::{ioctl_read_bad, ioctl_write_ptr_bad};
+use std::io::{self, stdout};
+use std::ops::ControlFlow;
+use std::os::unix::io::{AsRawFd, RawFd};
+use uucore::error::{UResult, USimpleError};
+use uucore::format_usage;
 
-#[cfg(not(any(
-    target_os = "freebsd",
-    target_os = "dragonfly",
-    target_os = "ios",
-    target_os = "macos",
-    target_os = "netbsd",
-    target_os = "openbsd"
-)))]
-use flags::BAUD_RATES;
-use flags::{CONTROL_FLAGS, INPUT_FLAGS, LOCAL_FLAGS, OUTPUT_FLAGS};
+#[cfg(not(any(
+    target_os = "freebsd",
+    target_os = "dragonfly",
+    target_os = "ios",
+    target_os = "macos",
+    target_os = "netbsd",
+    target_os = "openbsd"
+)))]
+use flags::BAUD_RATES;
+use flags::{CONTROL_FLAGS, INPUT_FLAGS, LOCAL_FLAGS, OUTPUT_FLAGS};
 
-const NAME: &str = "stty";
-const USAGE: &str = "\
+const NAME: &str = "stty";
+const USAGE: &str = "\
     {} [-F DEVICE | --file=DEVICE] [SETTING]...
     {} [-F DEVICE | --file=DEVICE] [-a|--all]
     {} [-F DEVICE | --file=DEVICE] [-g|--save]";
-const SUMMARY: &str = "Print or change terminal characteristics.";
+const SUMMARY: &str = "Print or change terminal characteristics.";
 
-#[derive(Clone, Copy, Debug)]
-pub struct Flag<T> {
-    name: &'static str,
-    flag: T,
-    show: bool,
-    sane: bool,
-    group: Option<T>,
+#[derive(Clone, Copy, Debug)]
+pub struct Flag<T> {
+    name: &'static str,
+    flag: T,
+    show: bool,
+    sane: bool,
+    group: Option<T>,
 }
 
-impl<T> Flag<T> {
-    pub const fn new(name: &'static str, flag: T) -> Self {
-        Self {
-            name,
-            flag,
-            show: true,
-            sane: false,
-            group: None,
+impl<T> Flag<T> {
+    pub const fn new(name: &'static str, flag: T) -> Self {
+        Self {
+            name,
+            flag,
+            show: true,
+            sane: false,
+            group: None,
         }
     }
 
-    pub const fn new_grouped(name: &'static str, flag: T, group: T) -> Self {
-        Self {
-            name,
-            flag,
-            show: true,
-            sane: false,
-            group: Some(group),
+    pub const fn new_grouped(name: &'static str, flag: T, group: T) -> Self {
+        Self {
+            name,
+            flag,
+            show: true,
+            sane: false,
+            group: Some(group),
         }
     }
 
-    pub const fn hidden(mut self) -> Self {
-        self.show = false;
-        self
-    }
+    pub const fn hidden(mut self) -> Self {
+        self.show = false;
+        self
+    }
 
-    pub const fn sane(mut self) -> Self {
-        self.sane = true;
-        self
-    }
+    pub const fn sane(mut self) -> Self {
+        self.sane = true;
+        self
+    }
 }
 
-trait TermiosFlag: Copy {
-    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool;
-    fn apply(&self, termios: &mut Termios, val: bool);
+trait TermiosFlag: Copy {
+    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool;
+    fn apply(&self, termios: &mut Termios, val: bool);
 }
 
-mod options {
-    pub const ALL: &str = "all";
-    pub const SAVE: &str = "save";
-    pub const FILE: &str = "file";
-    pub const SETTINGS: &str = "settings";
+mod options {
+    pub const ALL: &str = "all";
+    pub const SAVE: &str = "save";
+    pub const FILE: &str = "file";
+    pub const SETTINGS: &str = "settings";
 }
 
-struct Options<'a> {
-    all: bool,
-    save: bool,
-    file: RawFd,
-    settings: Option<Vec<&'a str>>,
+struct Options<'a> {
+    all: bool,
+    save: bool,
+    file: RawFd,
+    settings: Option<Vec<&'a str>>,
 }
 
-impl<'a> Options<'a> {
-    fn from(matches: &'a ArgMatches) -> io::Result<Self> {
-        Ok(Self {
-            all: matches.get_flag(options::ALL),
-            save: matches.get_flag(options::SAVE),
-            file: match matches.get_one::<String>(options::FILE) {
-                Some(_f) => todo!(),
-                None => stdout().as_raw_fd(),
+impl<'a> Options<'a> {
+    fn from(matches: &'a ArgMatches) -> io::Result<Self> {
+        Ok(Self {
+            all: matches.get_flag(options::ALL),
+            save: matches.get_flag(options::SAVE),
+            file: match matches.get_one::<String>(options::FILE) {
+                Some(_f) => todo!(),
+                None => stdout().as_raw_fd(),
             },
-            settings: matches
-                .get_many::<String>(options::SETTINGS)
-                .map(|v| v.map(|s| s.as_ref()).collect()),
+            settings: matches
+                .get_many::<String>(options::SETTINGS)
+                .map(|v| v.map(|s| s.as_ref()).collect()),
         })
     }
 }
 
-// Needs to be repr(C) because we pass it to the ioctl calls.
-#[repr(C)]
-#[derive(Default, Debug)]
-pub struct TermSize {
-    rows: c_ushort,
-    columns: c_ushort,
-    x: c_ushort,
-    y: c_ushort,
+// Needs to be repr(C) because we pass it to the ioctl calls.
+#[repr(C)]
+#[derive(Default, Debug)]
+pub struct TermSize {
+    rows: c_ushort,
+    columns: c_ushort,
+    x: c_ushort,
+    y: c_ushort,
 }
 
 ioctl_read_bad!(
-    /// Get terminal window size
-    tiocgwinsz,
-    TIOCGWINSZ,
-    TermSize
+    /// Get terminal window size
+    tiocgwinsz,
+    TIOCGWINSZ,
+    TermSize
 );
 
 ioctl_write_ptr_bad!(
-    /// Set terminal window size
-    tiocswinsz,
-    TIOCSWINSZ,
-    TermSize
+    /// Set terminal window size
+    tiocswinsz,
+    TIOCSWINSZ,
+    TermSize
 );
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let opts = Options::from(&matches)?;
+    let opts = Options::from(&matches)?;
 
-    stty(&opts)
+    stty(&opts)
 }
 
-fn stty(opts: &Options) -> UResult<()> {
-    if opts.save && opts.all {
-        return Err(USimpleError::new(
+fn stty(opts: &Options) -> UResult<()> {
+    if opts.save && opts.all {
+        return Err(USimpleError::new(
             1,
             "the options for verbose and stty-readable output styles are mutually exclusive",
         ));
     }
 
-    if opts.settings.is_some() && (opts.save || opts.all) {
-        return Err(USimpleError::new(
+    if opts.settings.is_some() && (opts.save || opts.all) {
+        return Err(USimpleError::new(
             1,
             "when specifying an output style, modes may not be set",
         ));
     }
 
-    // TODO: Figure out the right error message for when tcgetattr fails
-    let mut termios = tcgetattr(opts.file).expect("Could not get terminal attributes");
+    // TODO: Figure out the right error message for when tcgetattr fails
+    let mut termios = tcgetattr(opts.file).expect("Could not get terminal attributes");
 
-    if let Some(settings) = &opts.settings {
-        for setting in settings {
-            if let ControlFlow::Break(false) = apply_setting(&mut termios, setting) {
-                return Err(USimpleError::new(
+    if let Some(settings) = &opts.settings {
+        for setting in settings {
+            if let ControlFlow::Break(false) = apply_setting(&mut termios, setting) {
+                return Err(USimpleError::new(
                     1,
-                    format!("invalid argument '{}'", setting),
+                    format!("invalid argument '{}'", setting),
                 ));
             }
         }
 
-        tcsetattr(opts.file, nix::sys::termios::SetArg::TCSANOW, &termios)
-            .expect("Could not write terminal attributes");
-    } else {
-        print_settings(&termios, opts).expect("TODO: make proper error here from nix error");
+        tcsetattr(opts.file, nix::sys::termios::SetArg::TCSANOW, &termios)
+            .expect("Could not write terminal attributes");
+    } else {
+        print_settings(&termios, opts).expect("TODO: make proper error here from nix error");
     }
     Ok(())
 }
 
-fn print_terminal_size(termios: &Termios, opts: &Options) -> nix::Result<()> {
-    let speed = cfgetospeed(termios);
+fn print_terminal_size(termios: &Termios, opts: &Options) -> nix::Result<()> {
+    let speed = cfgetospeed(termios);
 
-    // BSDs use a u32 for the baud rate, so we can simply print it.
-    #[cfg(any(
-        target_os = "freebsd",
-        target_os = "dragonfly",
-        target_os = "ios",
-        target_os = "macos",
-        target_os = "netbsd",
-        target_os = "openbsd"
-    ))]
-    print!("speed {} baud; ", speed);
+    // BSDs use a u32 for the baud rate, so we can simply print it.
+    #[cfg(any(
+        target_os = "freebsd",
+        target_os = "dragonfly",
+        target_os = "ios",
+        target_os = "macos",
+        target_os = "netbsd",
+        target_os = "openbsd"
+    ))]
+    print!("speed {} baud; ", speed);
 
-    // Other platforms need to use the baud rate enum, so printing the right value
-    // becomes slightly more complicated.
-    #[cfg(not(any(
-        target_os = "freebsd",
-        target_os = "dragonfly",
-        target_os = "ios",
-        target_os = "macos",
-        target_os = "netbsd",
-        target_os = "openbsd"
-    )))]
-    for (text, baud_rate) in BAUD_RATES {
-        if *baud_rate == speed {
-            print!("speed {} baud; ", text);
+    // Other platforms need to use the baud rate enum, so printing the right value
+    // becomes slightly more complicated.
+    #[cfg(not(any(
+        target_os = "freebsd",
+        target_os = "dragonfly",
+        target_os = "ios",
+        target_os = "macos",
+        target_os = "netbsd",
+        target_os = "openbsd"
+    )))]
+    for (text, baud_rate) in BAUD_RATES {
+        if *baud_rate == speed {
+            print!("speed {} baud; ", text);
             break;
         }
     }
 
-    if opts.all {
-        let mut size = TermSize::default();
-        unsafe { tiocgwinsz(opts.file, &mut size as *mut _)? };
-        print!("rows {}; columns {}; ", size.rows, size.columns);
+    if opts.all {
+        let mut size = TermSize::default();
+        unsafe { tiocgwinsz(opts.file, &mut size as *mut _)? };
+        print!("rows {}; columns {}; ", size.rows, size.columns);
     }
 
-    #[cfg(any(target_os = "linux", target_os = "redox"))]
-    {
-        // For some reason the normal nix Termios struct does not expose the line,
-        // so we get the underlying libc::termios struct to get that information.
-        let libc_termios: nix::libc::termios = termios.clone().into();
-        let line = libc_termios.c_line;
-        print!("line = {};", line);
+    #[cfg(any(target_os = "linux", target_os = "redox"))]
+    {
+        // For some reason the normal nix Termios struct does not expose the line,
+        // so we get the underlying libc::termios struct to get that information.
+        let libc_termios: nix::libc::termios = termios.clone().into();
+        let line = libc_termios.c_line;
+        print!("line = {};", line);
     }
 
     println!();
     Ok(())
 }
 
-fn print_settings(termios: &Termios, opts: &Options) -> nix::Result<()> {
-    print_terminal_size(termios, opts)?;
-    print_flags(termios, opts, CONTROL_FLAGS);
-    print_flags(termios, opts, INPUT_FLAGS);
-    print_flags(termios, opts, OUTPUT_FLAGS);
-    print_flags(termios, opts, LOCAL_FLAGS);
+fn print_settings(termios: &Termios, opts: &Options) -> nix::Result<()> {
+    print_terminal_size(termios, opts)?;
+    print_flags(termios, opts, CONTROL_FLAGS);
+    print_flags(termios, opts, INPUT_FLAGS);
+    print_flags(termios, opts, OUTPUT_FLAGS);
+    print_flags(termios, opts, LOCAL_FLAGS);
     Ok(())
 }
 
-fn print_flags<T: TermiosFlag>(termios: &Termios, opts: &Options, flags: &[Flag<T>]) {
-    let mut printed = false;
-    for &Flag {
-        name,
-        flag,
-        show,
-        sane,
-        group,
-    } in flags
+fn print_flags<T: TermiosFlag>(termios: &Termios, opts: &Options, flags: &[Flag<T>]) {
+    let mut printed = false;
+    for &Flag {
+        name,
+        flag,
+        show,
+        sane,
+        group,
+    } in flags
     {
-        if !show {
+        if !show {
             continue;
         }
-        let val = flag.is_in(termios, group);
-        if group.is_some() {
-            if val && (!sane || opts.all) {
-                print!("{} ", name);
-                printed = true;
+        let val = flag.is_in(termios, group);
+        if group.is_some() {
+            if val && (!sane || opts.all) {
+                print!("{} ", name);
+                printed = true;
             }
-        } else if opts.all || val != sane {
-            if !val {
+        } else if opts.all || val != sane {
+            if !val {
                 print!("-");
             }
-            print!("{} ", name);
-            printed = true;
+            print!("{} ", name);
+            printed = true;
         }
     }
-    if printed {
+    if printed {
         println!();
     }
 }
 
-/// Apply a single setting
-///
-/// The value inside the `Break` variant of the `ControlFlow` indicates whether
-/// the setting has been applied.
-fn apply_setting(termios: &mut Termios, s: &str) -> ControlFlow<bool> {
-    let (remove, name) = match s.strip_prefix('-') {
-        Some(s) => (true, s),
-        None => (false, s),
+/// Apply a single setting
+///
+/// The value inside the `Break` variant of the `ControlFlow` indicates whether
+/// the setting has been applied.
+fn apply_setting(termios: &mut Termios, s: &str) -> ControlFlow<bool> {
+    let (remove, name) = match s.strip_prefix('-') {
+        Some(s) => (true, s),
+        None => (false, s),
     };
-    apply_flag(termios, CONTROL_FLAGS, name, remove)?;
-    apply_flag(termios, INPUT_FLAGS, name, remove)?;
-    apply_flag(termios, OUTPUT_FLAGS, name, remove)?;
-    apply_flag(termios, LOCAL_FLAGS, name, remove)?;
-    ControlFlow::Break(false)
+    apply_flag(termios, CONTROL_FLAGS, name, remove)?;
+    apply_flag(termios, INPUT_FLAGS, name, remove)?;
+    apply_flag(termios, OUTPUT_FLAGS, name, remove)?;
+    apply_flag(termios, LOCAL_FLAGS, name, remove)?;
+    ControlFlow::Break(false)
 }
 
-/// Apply a flag to a slice of flags
-///
-/// The value inside the `Break` variant of the `ControlFlow` indicates whether
-/// the setting has been applied.
-fn apply_flag<T: TermiosFlag>(
-    termios: &mut Termios,
-    flags: &[Flag<T>],
-    input: &str,
-    remove: bool,
-) -> ControlFlow<bool> {
-    for Flag {
-        name, flag, group, ..
-    } in flags
+/// Apply a flag to a slice of flags
+///
+/// The value inside the `Break` variant of the `ControlFlow` indicates whether
+/// the setting has been applied.
+fn apply_flag<T: TermiosFlag>(
+    termios: &mut Termios,
+    flags: &[Flag<T>],
+    input: &str,
+    remove: bool,
+) -> ControlFlow<bool> {
+    for Flag {
+        name, flag, group, ..
+    } in flags
     {
-        if input == *name {
-            // Flags with groups cannot be removed
-            // Since the name matches, we can short circuit and don't have to check the other flags.
-            if remove && group.is_some() {
-                return ControlFlow::Break(false);
+        if input == *name {
+            // Flags with groups cannot be removed
+            // Since the name matches, we can short circuit and don't have to check the other flags.
+            if remove && group.is_some() {
+                return ControlFlow::Break(false);
             }
-            // If there is a group, the bits for that group should be cleared before applying the flag
-            if let Some(group) = group {
-                group.apply(termios, false);
+            // If there is a group, the bits for that group should be cleared before applying the flag
+            if let Some(group) = group {
+                group.apply(termios, false);
             }
-            flag.apply(termios, !remove);
-            return ControlFlow::Break(true);
+            flag.apply(termios, !remove);
+            return ControlFlow::Break(true);
         }
     }
-    ControlFlow::Continue(())
+    ControlFlow::Continue(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(SUMMARY)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::ALL)
-                .short('a')
-                .long(options::ALL)
-                .help("print all current settings in human-readable form")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(SUMMARY)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::ALL)
+                .short('a')
+                .long(options::ALL)
+                .help("print all current settings in human-readable form")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SAVE)
-                .short('g')
-                .long(options::SAVE)
-                .help("print all current settings in a stty-readable form")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SAVE)
+                .short('g')
+                .long(options::SAVE)
+                .help("print all current settings in a stty-readable form")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILE)
-                .short('F')
-                .long(options::FILE)
-                .value_hint(clap::ValueHint::FilePath)
-                .value_name("DEVICE")
-                .help("open and use the specified DEVICE instead of stdin"),
+        .arg(
+            Arg::new(options::FILE)
+                .short('F')
+                .long(options::FILE)
+                .value_hint(clap::ValueHint::FilePath)
+                .value_name("DEVICE")
+                .help("open and use the specified DEVICE instead of stdin"),
         )
-        .arg(
-            Arg::new(options::SETTINGS)
-                .action(ArgAction::Append)
-                .help("settings to change"),
+        .arg(
+            Arg::new(options::SETTINGS)
+                .action(ArgAction::Append)
+                .help("settings to change"),
         )
 }
 
-impl TermiosFlag for ControlFlags {
-    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
-        termios.control_flags.contains(*self)
-            && group.map_or(true, |g| !termios.control_flags.intersects(g - *self))
+impl TermiosFlag for ControlFlags {
+    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
+        termios.control_flags.contains(*self)
+            && group.map_or(true, |g| !termios.control_flags.intersects(g - *self))
     }
 
-    fn apply(&self, termios: &mut Termios, val: bool) {
-        termios.control_flags.set(*self, val);
+    fn apply(&self, termios: &mut Termios, val: bool) {
+        termios.control_flags.set(*self, val);
     }
 }
 
-impl TermiosFlag for InputFlags {
-    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
-        termios.input_flags.contains(*self)
-            && group.map_or(true, |g| !termios.input_flags.intersects(g - *self))
+impl TermiosFlag for InputFlags {
+    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
+        termios.input_flags.contains(*self)
+            && group.map_or(true, |g| !termios.input_flags.intersects(g - *self))
     }
 
-    fn apply(&self, termios: &mut Termios, val: bool) {
-        termios.input_flags.set(*self, val);
+    fn apply(&self, termios: &mut Termios, val: bool) {
+        termios.input_flags.set(*self, val);
     }
 }
 
-impl TermiosFlag for OutputFlags {
-    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
-        termios.output_flags.contains(*self)
-            && group.map_or(true, |g| !termios.output_flags.intersects(g - *self))
+impl TermiosFlag for OutputFlags {
+    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
+        termios.output_flags.contains(*self)
+            && group.map_or(true, |g| !termios.output_flags.intersects(g - *self))
     }
 
-    fn apply(&self, termios: &mut Termios, val: bool) {
-        termios.output_flags.set(*self, val);
+    fn apply(&self, termios: &mut Termios, val: bool) {
+        termios.output_flags.set(*self, val);
     }
 }
 
-impl TermiosFlag for LocalFlags {
-    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
-        termios.local_flags.contains(*self)
-            && group.map_or(true, |g| !termios.local_flags.intersects(g - *self))
+impl TermiosFlag for LocalFlags {
+    fn is_in(&self, termios: &Termios, group: Option<Self>) -> bool {
+        termios.local_flags.contains(*self)
+            && group.map_or(true, |g| !termios.local_flags.intersects(g - *self))
     }
 
-    fn apply(&self, termios: &mut Termios, val: bool) {
-        termios.local_flags.set(*self, val);
+    fn apply(&self, termios: &mut Termios, val: bool) {
+        termios.local_flags.set(*self, val);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sum/sum.rs.html b/dev/src/uu_sum/sum.rs.html index 64f314277..518005a81 100644 --- a/dev/src/uu_sum/sum.rs.html +++ b/dev/src/uu_sum/sum.rs.html @@ -1,4 +1,4 @@ -sum.rs - source
1
+sum.rs - source
1
 2
 3
 4
@@ -176,183 +176,183 @@
 176
 177
 178
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) T. Jameson Little <t.jameson.little@gmail.com>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) T. Jameson Little <t.jameson.little@gmail.com>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) sysv
+// spell-checker:ignore (ToDO) sysv
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fs::File;
-use std::io::{stdin, Read};
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fs::File;
+use std::io::{stdin, Read};
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError};
+use uucore::format_usage;
 
-static NAME: &str = "sum";
-static USAGE: &str = "{} [OPTION]... [FILE]...";
-static ABOUT: &str = r#"Checksum and count the blocks in a file.
+static NAME: &str = "sum";
+static USAGE: &str = "{} [OPTION]... [FILE]...";
+static ABOUT: &str = r#"Checksum and count the blocks in a file.
                         With no FILE, or when  FILE is -, read standard input."#;
 
-// This can be replaced with usize::div_ceil once it is stabilized.
-// This implementation approach is optimized for when `b` is a constant,
-// particularly a power of two.
-const fn div_ceil(a: usize, b: usize) -> usize {
-    (a + b - 1) / b
+// This can be replaced with usize::div_ceil once it is stabilized.
+// This implementation approach is optimized for when `b` is a constant,
+// particularly a power of two.
+const fn div_ceil(a: usize, b: usize) -> usize {
+    (a + b - 1) / b
 }
 
-fn bsd_sum(mut reader: Box<dyn Read>) -> (usize, u16) {
-    let mut buf = [0; 4096];
-    let mut bytes_read = 0;
-    let mut checksum: u16 = 0;
-    loop {
-        match reader.read(&mut buf) {
-            Ok(n) if n != 0 => {
-                bytes_read += n;
-                for &byte in buf[..n].iter() {
-                    checksum = (checksum >> 1) + ((checksum & 1) << 15);
-                    checksum = checksum.wrapping_add(u16::from(byte));
+fn bsd_sum(mut reader: Box<dyn Read>) -> (usize, u16) {
+    let mut buf = [0; 4096];
+    let mut bytes_read = 0;
+    let mut checksum: u16 = 0;
+    loop {
+        match reader.read(&mut buf) {
+            Ok(n) if n != 0 => {
+                bytes_read += n;
+                for &byte in buf[..n].iter() {
+                    checksum = (checksum >> 1) + ((checksum & 1) << 15);
+                    checksum = checksum.wrapping_add(u16::from(byte));
                 }
             }
-            _ => break,
+            _ => break,
         }
     }
 
-    // Report blocks read in terms of 1024-byte blocks.
-    let blocks_read = div_ceil(bytes_read, 1024);
-    (blocks_read, checksum)
+    // Report blocks read in terms of 1024-byte blocks.
+    let blocks_read = div_ceil(bytes_read, 1024);
+    (blocks_read, checksum)
 }
 
-fn sysv_sum(mut reader: Box<dyn Read>) -> (usize, u16) {
-    let mut buf = [0; 4096];
-    let mut bytes_read = 0;
-    let mut ret = 0u32;
+fn sysv_sum(mut reader: Box<dyn Read>) -> (usize, u16) {
+    let mut buf = [0; 4096];
+    let mut bytes_read = 0;
+    let mut ret = 0u32;
 
-    loop {
-        match reader.read(&mut buf) {
-            Ok(n) if n != 0 => {
-                bytes_read += n;
-                for &byte in buf[..n].iter() {
-                    ret = ret.wrapping_add(u32::from(byte));
+    loop {
+        match reader.read(&mut buf) {
+            Ok(n) if n != 0 => {
+                bytes_read += n;
+                for &byte in buf[..n].iter() {
+                    ret = ret.wrapping_add(u32::from(byte));
                 }
             }
-            _ => break,
+            _ => break,
         }
     }
 
-    ret = (ret & 0xffff) + (ret >> 16);
-    ret = (ret & 0xffff) + (ret >> 16);
+    ret = (ret & 0xffff) + (ret >> 16);
+    ret = (ret & 0xffff) + (ret >> 16);
 
-    // Report blocks read in terms of 512-byte blocks.
-    let blocks_read = div_ceil(bytes_read, 512);
-    (blocks_read, ret as u16)
+    // Report blocks read in terms of 512-byte blocks.
+    let blocks_read = div_ceil(bytes_read, 512);
+    (blocks_read, ret as u16)
 }
 
-fn open(name: &str) -> UResult<Box<dyn Read>> {
-    match name {
-        "-" => Ok(Box::new(stdin()) as Box<dyn Read>),
-        _ => {
-            let path = &Path::new(name);
-            if path.is_dir() {
-                return Err(USimpleError::new(
+fn open(name: &str) -> UResult<Box<dyn Read>> {
+    match name {
+        "-" => Ok(Box::new(stdin()) as Box<dyn Read>),
+        _ => {
+            let path = &Path::new(name);
+            if path.is_dir() {
+                return Err(USimpleError::new(
                     2,
-                    format!("{}: Is a directory", name.maybe_quote()),
+                    format!("{}: Is a directory", name.maybe_quote()),
                 ));
             };
-            // Silent the warning as we want to the error message
-            if path.metadata().is_err() {
-                return Err(USimpleError::new(
+            // Silent the warning as we want to the error message
+            if path.metadata().is_err() {
+                return Err(USimpleError::new(
                     2,
-                    format!("{}: No such file or directory", name.maybe_quote()),
+                    format!("{}: No such file or directory", name.maybe_quote()),
                 ));
             };
-            let f = File::open(path).map_err_context(String::new)?;
-            Ok(Box::new(f) as Box<dyn Read>)
+            let f = File::open(path).map_err_context(String::new)?;
+            Ok(Box::new(f) as Box<dyn Read>)
         }
     }
 }
 
-mod options {
-    pub static FILE: &str = "file";
-    pub static BSD_COMPATIBLE: &str = "r";
-    pub static SYSTEM_V_COMPATIBLE: &str = "sysv";
+mod options {
+    pub static FILE: &str = "file";
+    pub static BSD_COMPATIBLE: &str = "r";
+    pub static SYSTEM_V_COMPATIBLE: &str = "sysv";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let files: Vec<String> = match matches.get_many::<String>(options::FILE) {
-        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
-        None => vec!["-".to_owned()],
+    let files: Vec<String> = match matches.get_many::<String>(options::FILE) {
+        Some(v) => v.clone().map(|v| v.to_owned()).collect(),
+        None => vec!["-".to_owned()],
     };
 
-    let sysv = matches.get_flag(options::SYSTEM_V_COMPATIBLE);
+    let sysv = matches.get_flag(options::SYSTEM_V_COMPATIBLE);
 
-    let print_names = if sysv {
-        files.len() > 1 || files[0] != "-"
-    } else {
-        files.len() > 1
-    };
+    let print_names = if sysv {
+        files.len() > 1 || files[0] != "-"
+    } else {
+        files.len() > 1
+    };
 
-    for file in &files {
-        let reader = match open(file) {
-            Ok(f) => f,
-            Err(error) => {
-                show!(error);
+    for file in &files {
+        let reader = match open(file) {
+            Ok(f) => f,
+            Err(error) => {
+                show!(error);
                 continue;
             }
         };
-        let (blocks, sum) = if sysv {
-            sysv_sum(reader)
-        } else {
-            bsd_sum(reader)
+        let (blocks, sum) = if sysv {
+            sysv_sum(reader)
+        } else {
+            bsd_sum(reader)
         };
 
-        if print_names {
-            println!("{} {} {}", sum, blocks, file);
-        } else {
-            println!("{} {}", sum, blocks);
+        if print_names {
+            println!("{} {} {}", sum, blocks, file);
+        } else {
+            println!("{} {}", sum, blocks);
         }
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::FILE)
-                .action(ArgAction::Append)
-                .hide(true)
-                .value_hint(clap::ValueHint::FilePath),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::FILE)
+                .action(ArgAction::Append)
+                .hide(true)
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::BSD_COMPATIBLE)
-                .short('r')
-                .help("use the BSD sum algorithm, use 1K blocks (default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::BSD_COMPATIBLE)
+                .short('r')
+                .help("use the BSD sum algorithm, use 1K blocks (default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SYSTEM_V_COMPATIBLE)
-                .short('s')
-                .long(options::SYSTEM_V_COMPATIBLE)
-                .help("use System V sum algorithm, use 512 bytes blocks")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SYSTEM_V_COMPATIBLE)
+                .short('s')
+                .long(options::SYSTEM_V_COMPATIBLE)
+                .help("use System V sum algorithm, use 512 bytes blocks")
+                .action(ArgAction::SetTrue),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_sync/sync.rs.html b/dev/src/uu_sync/sync.rs.html index c47f2e7a0..3e4cfd23f 100644 --- a/dev/src/uu_sync/sync.rs.html +++ b/dev/src/uu_sync/sync.rs.html @@ -1,4 +1,4 @@ -sync.rs - source
1
+sync.rs - source
1
 2
 3
 4
@@ -259,266 +259,266 @@
 259
 260
 261
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alexander Fomin <xander.fomin@ya.ru>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alexander Fomin <xander.fomin@ya.ru>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-/* Last synced with: sync (GNU coreutils) 8.13 */
+/* Last synced with: sync (GNU coreutils) 8.13 */
 
-extern crate libc;
+extern crate libc;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use nix::errno::Errno;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use nix::fcntl::{open, OFlag};
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use nix::sys::stat::Mode;
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{UResult, USimpleError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use nix::errno::Errno;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use nix::fcntl::{open, OFlag};
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use nix::sys::stat::Mode;
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{UResult, USimpleError};
+use uucore::format_usage;
 
-static ABOUT: &str = "Synchronize cached writes to persistent storage";
-const USAGE: &str = "{} [OPTION]... FILE...";
-pub mod options {
-    pub static FILE_SYSTEM: &str = "file-system";
-    pub static DATA: &str = "data";
+static ABOUT: &str = "Synchronize cached writes to persistent storage";
+const USAGE: &str = "{} [OPTION]... FILE...";
+pub mod options {
+    pub static FILE_SYSTEM: &str = "file-system";
+    pub static DATA: &str = "data";
 }
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-#[cfg(unix)]
-mod platform {
-    use super::libc;
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    use std::fs::File;
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    use std::os::unix::io::AsRawFd;
+#[cfg(unix)]
+mod platform {
+    use super::libc;
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    use std::fs::File;
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    use std::os::unix::io::AsRawFd;
 
-    pub unsafe fn do_sync() -> isize {
-        // see https://github.com/rust-lang/libc/pull/2161
-        #[cfg(target_os = "android")]
-        libc::syscall(libc::SYS_sync);
-        #[cfg(not(target_os = "android"))]
-        libc::sync();
-        0
-    }
+    pub unsafe fn do_sync() -> isize {
+        // see https://github.com/rust-lang/libc/pull/2161
+        #[cfg(target_os = "android")]
+        libc::syscall(libc::SYS_sync);
+        #[cfg(not(target_os = "android"))]
+        libc::sync();
+        0
+    }
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    pub unsafe fn do_syncfs(files: Vec<String>) -> isize {
-        for path in files {
-            let f = File::open(&path).unwrap();
-            let fd = f.as_raw_fd();
-            libc::syscall(libc::SYS_syncfs, fd);
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    pub unsafe fn do_syncfs(files: Vec<String>) -> isize {
+        for path in files {
+            let f = File::open(&path).unwrap();
+            let fd = f.as_raw_fd();
+            libc::syscall(libc::SYS_syncfs, fd);
         }
-        0
-    }
+        0
+    }
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    pub unsafe fn do_fdatasync(files: Vec<String>) -> isize {
-        for path in files {
-            let f = File::open(&path).unwrap();
-            let fd = f.as_raw_fd();
-            libc::syscall(libc::SYS_fdatasync, fd);
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    pub unsafe fn do_fdatasync(files: Vec<String>) -> isize {
+        for path in files {
+            let f = File::open(&path).unwrap();
+            let fd = f.as_raw_fd();
+            libc::syscall(libc::SYS_fdatasync, fd);
         }
-        0
-    }
+        0
+    }
 }
 
-#[cfg(windows)]
-mod platform {
-    use std::fs::OpenOptions;
-    use std::os::windows::prelude::*;
-    use std::path::Path;
-    use uucore::crash;
-    use uucore::wide::{FromWide, ToWide};
-    use windows_sys::Win32::Foundation::{
-        GetLastError, ERROR_NO_MORE_FILES, HANDLE, INVALID_HANDLE_VALUE, MAX_PATH,
+#[cfg(windows)]
+mod platform {
+    use std::fs::OpenOptions;
+    use std::os::windows::prelude::*;
+    use std::path::Path;
+    use uucore::crash;
+    use uucore::wide::{FromWide, ToWide};
+    use windows_sys::Win32::Foundation::{
+        GetLastError, ERROR_NO_MORE_FILES, HANDLE, INVALID_HANDLE_VALUE, MAX_PATH,
     };
-    use windows_sys::Win32::Storage::FileSystem::{
-        FindFirstVolumeW, FindNextVolumeW, FindVolumeClose, FlushFileBuffers, GetDriveTypeW,
+    use windows_sys::Win32::Storage::FileSystem::{
+        FindFirstVolumeW, FindNextVolumeW, FindVolumeClose, FlushFileBuffers, GetDriveTypeW,
     };
-    use windows_sys::Win32::System::WindowsProgramming::DRIVE_FIXED;
+    use windows_sys::Win32::System::WindowsProgramming::DRIVE_FIXED;
 
-    unsafe fn flush_volume(name: &str) {
-        let name_wide = name.to_wide_null();
-        if GetDriveTypeW(name_wide.as_ptr()) == DRIVE_FIXED {
-            let sliced_name = &name[..name.len() - 1]; // eliminate trailing backslash
-            match OpenOptions::new().write(true).open(sliced_name) {
-                Ok(file) => {
-                    if FlushFileBuffers(file.as_raw_handle() as HANDLE) == 0 {
-                        crash!(GetLastError() as i32, "failed to flush file buffer");
+    unsafe fn flush_volume(name: &str) {
+        let name_wide = name.to_wide_null();
+        if GetDriveTypeW(name_wide.as_ptr()) == DRIVE_FIXED {
+            let sliced_name = &name[..name.len() - 1]; // eliminate trailing backslash
+            match OpenOptions::new().write(true).open(sliced_name) {
+                Ok(file) => {
+                    if FlushFileBuffers(file.as_raw_handle() as HANDLE) == 0 {
+                        crash!(GetLastError() as i32, "failed to flush file buffer");
                     }
                 }
-                Err(e) => crash!(
-                    e.raw_os_error().unwrap_or(1),
-                    "failed to create volume handle"
-                ),
+                Err(e) => crash!(
+                    e.raw_os_error().unwrap_or(1),
+                    "failed to create volume handle"
+                ),
             }
         }
     }
 
-    unsafe fn find_first_volume() -> (String, HANDLE) {
-        let mut name: [u16; MAX_PATH as usize] = [0; MAX_PATH as usize];
-        let handle = FindFirstVolumeW(name.as_mut_ptr(), name.len() as u32);
-        if handle == INVALID_HANDLE_VALUE {
-            crash!(GetLastError() as i32, "failed to find first volume");
+    unsafe fn find_first_volume() -> (String, HANDLE) {
+        let mut name: [u16; MAX_PATH as usize] = [0; MAX_PATH as usize];
+        let handle = FindFirstVolumeW(name.as_mut_ptr(), name.len() as u32);
+        if handle == INVALID_HANDLE_VALUE {
+            crash!(GetLastError() as i32, "failed to find first volume");
         }
-        (String::from_wide_null(&name), handle)
+        (String::from_wide_null(&name), handle)
     }
 
-    unsafe fn find_all_volumes() -> Vec<String> {
-        let (first_volume, next_volume_handle) = find_first_volume();
-        let mut volumes = vec![first_volume];
-        loop {
-            let mut name: [u16; MAX_PATH as usize] = [0; MAX_PATH as usize];
-            if FindNextVolumeW(next_volume_handle, name.as_mut_ptr(), name.len() as u32) == 0 {
-                match GetLastError() {
-                    ERROR_NO_MORE_FILES => {
-                        FindVolumeClose(next_volume_handle);
-                        return volumes;
+    unsafe fn find_all_volumes() -> Vec<String> {
+        let (first_volume, next_volume_handle) = find_first_volume();
+        let mut volumes = vec![first_volume];
+        loop {
+            let mut name: [u16; MAX_PATH as usize] = [0; MAX_PATH as usize];
+            if FindNextVolumeW(next_volume_handle, name.as_mut_ptr(), name.len() as u32) == 0 {
+                match GetLastError() {
+                    ERROR_NO_MORE_FILES => {
+                        FindVolumeClose(next_volume_handle);
+                        return volumes;
                     }
-                    err => crash!(err as i32, "failed to find next volume"),
+                    err => crash!(err as i32, "failed to find next volume"),
                 }
-            } else {
-                volumes.push(String::from_wide_null(&name));
+            } else {
+                volumes.push(String::from_wide_null(&name));
             }
         }
     }
 
-    pub unsafe fn do_sync() -> isize {
-        let volumes = find_all_volumes();
-        for vol in &volumes {
-            flush_volume(vol);
+    pub unsafe fn do_sync() -> isize {
+        let volumes = find_all_volumes();
+        for vol in &volumes {
+            flush_volume(vol);
         }
-        0
-    }
+        0
+    }
 
-    pub unsafe fn do_syncfs(files: Vec<String>) -> isize {
-        for path in files {
-            flush_volume(
-                Path::new(&path)
-                    .components()
-                    .next()
-                    .unwrap()
-                    .as_os_str()
-                    .to_str()
-                    .unwrap(),
+    pub unsafe fn do_syncfs(files: Vec<String>) -> isize {
+        for path in files {
+            flush_volume(
+                Path::new(&path)
+                    .components()
+                    .next()
+                    .unwrap()
+                    .as_os_str()
+                    .to_str()
+                    .unwrap(),
             );
         }
-        0
-    }
+        0
+    }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let files: Vec<String> = matches
-        .get_many::<String>(ARG_FILES)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let files: Vec<String> = matches
+        .get_many::<String>(ARG_FILES)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    if matches.get_flag(options::DATA) && files.is_empty() {
-        return Err(USimpleError::new(1, "--data needs at least one argument"));
+    if matches.get_flag(options::DATA) && files.is_empty() {
+        return Err(USimpleError::new(1, "--data needs at least one argument"));
     }
 
-    for f in &files {
-        // Use the Nix open to be able to set the NONBLOCK flags for fifo files
-        #[cfg(any(target_os = "linux", target_os = "android"))]
-        {
-            match open(Path::new(&f), OFlag::O_NONBLOCK, Mode::empty()) {
+    for f in &files {
+        // Use the Nix open to be able to set the NONBLOCK flags for fifo files
+        #[cfg(any(target_os = "linux", target_os = "android"))]
+        {
+            match open(Path::new(&f), OFlag::O_NONBLOCK, Mode::empty()) {
                 Ok(_) => {}
-                Err(e) => {
-                    if e == Errno::ENOENT {
-                        return Err(USimpleError::new(
+                Err(e) => {
+                    if e == Errno::ENOENT {
+                        return Err(USimpleError::new(
                             1,
-                            format!("cannot stat {}: No such file or directory", f.quote()),
+                            format!("cannot stat {}: No such file or directory", f.quote()),
                         ));
                     }
-                    if e == Errno::EACCES {
-                        if Path::new(&f).is_dir() {
-                            return Err(USimpleError::new(
+                    if e == Errno::EACCES {
+                        if Path::new(&f).is_dir() {
+                            return Err(USimpleError::new(
                                 1,
-                                format!("error opening {}: Permission denied", f.quote()),
+                                format!("error opening {}: Permission denied", f.quote()),
                             ));
-                        } else {
-                            // ignore the issue
-                            // ./target/debug/coreutils sync --data file
-                        }
+                        } else {
+                            // ignore the issue
+                            // ./target/debug/coreutils sync --data file
+                        }
                     }
                 }
             }
         }
-        #[cfg(not(any(target_os = "linux", target_os = "android")))]
-        {
-            if !Path::new(&f).exists() {
-                return Err(USimpleError::new(
+        #[cfg(not(any(target_os = "linux", target_os = "android")))]
+        {
+            if !Path::new(&f).exists() {
+                return Err(USimpleError::new(
                     1,
-                    format!("cannot stat {}: No such file or directory", f.quote()),
+                    format!("cannot stat {}: No such file or directory", f.quote()),
                 ));
             }
         }
     }
 
-    #[allow(clippy::if_same_then_else)]
-    if matches.get_flag(options::FILE_SYSTEM) {
-        #[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
-        syncfs(files);
-    } else if matches.get_flag(options::DATA) {
-        #[cfg(any(target_os = "linux", target_os = "android"))]
-        fdatasync(files);
-    } else {
-        sync();
+    #[allow(clippy::if_same_then_else)]
+    if matches.get_flag(options::FILE_SYSTEM) {
+        #[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
+        syncfs(files);
+    } else if matches.get_flag(options::DATA) {
+        #[cfg(any(target_os = "linux", target_os = "android"))]
+        fdatasync(files);
+    } else {
+        sync();
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::FILE_SYSTEM)
-                .short('f')
-                .long(options::FILE_SYSTEM)
-                .conflicts_with(options::DATA)
-                .help("sync the file systems that contain the files (Linux and Windows only)")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::FILE_SYSTEM)
+                .short('f')
+                .long(options::FILE_SYSTEM)
+                .conflicts_with(options::DATA)
+                .help("sync the file systems that contain the files (Linux and Windows only)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DATA)
-                .short('d')
-                .long(options::DATA)
-                .conflicts_with(options::FILE_SYSTEM)
-                .help("sync only file data, no unneeded metadata (Linux only)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::DATA)
+                .short('d')
+                .long(options::DATA)
+                .conflicts_with(options::FILE_SYSTEM)
+                .help("sync only file data, no unneeded metadata (Linux only)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-fn sync() -> isize {
-    unsafe { platform::do_sync() }
+fn sync() -> isize {
+    unsafe { platform::do_sync() }
 }
 
-#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
-fn syncfs(files: Vec<String>) -> isize {
-    unsafe { platform::do_syncfs(files) }
+#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))]
+fn syncfs(files: Vec<String>) -> isize {
+    unsafe { platform::do_syncfs(files) }
 }
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-fn fdatasync(files: Vec<String>) -> isize {
-    unsafe { platform::do_fdatasync(files) }
+#[cfg(any(target_os = "linux", target_os = "android"))]
+fn fdatasync(files: Vec<String>) -> isize {
+    unsafe { platform::do_fdatasync(files) }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tac/error.rs.html b/dev/src/uu_tac/error.rs.html index 20d961122..dee4e3176 100644 --- a/dev/src/uu_tac/error.rs.html +++ b/dev/src/uu_tac/error.rs.html @@ -1,4 +1,4 @@ -error.rs - source
1
+error.rs - source
1
 2
 3
 4
@@ -58,65 +58,65 @@
 58
 59
 60
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-//! Errors returned by tac during processing of a file.
-use std::error::Error;
-use std::fmt::Display;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+//! Errors returned by tac during processing of a file.
+use std::error::Error;
+use std::fmt::Display;
 
-use uucore::display::Quotable;
-use uucore::error::UError;
+use uucore::display::Quotable;
+use uucore::error::UError;
 
-#[derive(Debug)]
-pub enum TacError {
-    /// A regular expression given by the user is invalid.
-    InvalidRegex(regex::Error),
+#[derive(Debug)]
+pub enum TacError {
+    /// A regular expression given by the user is invalid.
+    InvalidRegex(regex::Error),
 
-    /// An argument to tac is invalid.
-    InvalidArgument(String),
+    /// An argument to tac is invalid.
+    InvalidArgument(String),
 
-    /// The specified file is not found on the filesystem.
-    FileNotFound(String),
+    /// The specified file is not found on the filesystem.
+    FileNotFound(String),
 
-    /// An error reading the contents of a file or stdin.
-    ///
-    /// The parameters are the name of the file and the underlying
-    /// [`std::io::Error`] that caused this error.
-    ReadError(String, std::io::Error),
+    /// An error reading the contents of a file or stdin.
+    ///
+    /// The parameters are the name of the file and the underlying
+    /// [`std::io::Error`] that caused this error.
+    ReadError(String, std::io::Error),
 
-    /// An error writing the (reversed) contents of a file or stdin.
-    ///
-    /// The parameter is the underlying [`std::io::Error`] that caused
-    /// this error.
-    WriteError(std::io::Error),
+    /// An error writing the (reversed) contents of a file or stdin.
+    ///
+    /// The parameter is the underlying [`std::io::Error`] that caused
+    /// this error.
+    WriteError(std::io::Error),
 }
 
-impl UError for TacError {
-    fn code(&self) -> i32 {
-        1
-    }
+impl UError for TacError {
+    fn code(&self) -> i32 {
+        1
+    }
 }
 
-impl Error for TacError {}
+impl Error for TacError {}
 
-impl Display for TacError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::InvalidRegex(e) => write!(f, "invalid regular expression: {}", e),
-            Self::InvalidArgument(s) => {
-                write!(f, "{}: read error: Invalid argument", s.maybe_quote())
+impl Display for TacError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::InvalidRegex(e) => write!(f, "invalid regular expression: {}", e),
+            Self::InvalidArgument(s) => {
+                write!(f, "{}: read error: Invalid argument", s.maybe_quote())
             }
-            Self::FileNotFound(s) => write!(
-                f,
+            Self::FileNotFound(s) => write!(
+                f,
                 "failed to open {} for reading: No such file or directory",
-                s.quote()
+                s.quote()
             ),
-            Self::ReadError(s, e) => write!(f, "failed to read from {}: {}", s, e),
-            Self::WriteError(e) => write!(f, "failed to write to stdout: {}", e),
+            Self::ReadError(s, e) => write!(f, "failed to read from {}: {}", s, e),
+            Self::WriteError(e) => write!(f, "failed to write to stdout: {}", e),
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tac/tac.rs.html b/dev/src/uu_tac/tac.rs.html index 71911d86e..05815a23e 100644 --- a/dev/src/uu_tac/tac.rs.html +++ b/dev/src/uu_tac/tac.rs.html @@ -1,4 +1,4 @@ -tac.rs - source
1
+tac.rs - source
1
 2
 3
 4
@@ -316,323 +316,323 @@
 316
 317
 318
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) sbytes slen dlen memmem memmap Mmap mmap SIGBUS
-mod error;
+// spell-checker:ignore (ToDO) sbytes slen dlen memmem memmap Mmap mmap SIGBUS
+mod error;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use memchr::memmem;
-use memmap2::Mmap;
-use std::io::{stdin, stdout, BufWriter, Read, Write};
-use std::{
-    fs::{read, File},
-    path::Path,
+use clap::{crate_version, Arg, ArgAction, Command};
+use memchr::memmem;
+use memmap2::Mmap;
+use std::io::{stdin, stdout, BufWriter, Read, Write};
+use std::{
+    fs::{read, File},
+    path::Path,
 };
-use uucore::display::Quotable;
-use uucore::error::UError;
-use uucore::error::UResult;
-use uucore::{format_usage, show};
+use uucore::display::Quotable;
+use uucore::error::UError;
+use uucore::error::UResult;
+use uucore::{format_usage, show};
 
-use crate::error::TacError;
+use crate::error::TacError;
 
-static NAME: &str = "tac";
-static USAGE: &str = "{} [OPTION]... [FILE]...";
-static ABOUT: &str = "Write each file to standard output, last line first.";
+static NAME: &str = "tac";
+static USAGE: &str = "{} [OPTION]... [FILE]...";
+static ABOUT: &str = "Write each file to standard output, last line first.";
 
-mod options {
-    pub static BEFORE: &str = "before";
-    pub static REGEX: &str = "regex";
-    pub static SEPARATOR: &str = "separator";
-    pub static FILE: &str = "file";
+mod options {
+    pub static BEFORE: &str = "before";
+    pub static REGEX: &str = "regex";
+    pub static SEPARATOR: &str = "separator";
+    pub static FILE: &str = "file";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let before = matches.get_flag(options::BEFORE);
-    let regex = matches.get_flag(options::REGEX);
-    let raw_separator = matches
-        .get_one::<String>(options::SEPARATOR)
-        .map(|s| s.as_str())
-        .unwrap_or("\n");
-    let separator = if raw_separator.is_empty() {
-        "\0"
-    } else {
-        raw_separator
+    let before = matches.get_flag(options::BEFORE);
+    let regex = matches.get_flag(options::REGEX);
+    let raw_separator = matches
+        .get_one::<String>(options::SEPARATOR)
+        .map(|s| s.as_str())
+        .unwrap_or("\n");
+    let separator = if raw_separator.is_empty() {
+        "\0"
+    } else {
+        raw_separator
     };
 
-    let files: Vec<&str> = match matches.get_many::<String>(options::FILE) {
-        Some(v) => v.map(|s| s.as_str()).collect(),
-        None => vec!["-"],
+    let files: Vec<&str> = match matches.get_many::<String>(options::FILE) {
+        Some(v) => v.map(|s| s.as_str()).collect(),
+        None => vec!["-"],
     };
 
-    tac(&files, before, regex, separator)
+    tac(&files, before, regex, separator)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::BEFORE)
-                .short('b')
-                .long(options::BEFORE)
-                .help("attach the separator before instead of after")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::BEFORE)
+                .short('b')
+                .long(options::BEFORE)
+                .help("attach the separator before instead of after")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REGEX)
-                .short('r')
-                .long(options::REGEX)
-                .help("interpret the sequence as a regular expression")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::REGEX)
+                .short('r')
+                .long(options::REGEX)
+                .help("interpret the sequence as a regular expression")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SEPARATOR)
-                .short('s')
-                .long(options::SEPARATOR)
-                .help("use STRING as the separator instead of newline")
-                .value_name("STRING"),
+        .arg(
+            Arg::new(options::SEPARATOR)
+                .short('s')
+                .long(options::SEPARATOR)
+                .help("use STRING as the separator instead of newline")
+                .value_name("STRING"),
         )
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-/// Print lines of a buffer in reverse, with line separator given as a regex.
-///
-/// `data` contains the bytes of the file.
-///
-/// `pattern` is the regular expression given as a
-/// [`regex::bytes::Regex`] (not a [`regex::Regex`], since the input is
-/// given as a slice of bytes). If `before` is `true`, then each match
-/// of this pattern in `data` is interpreted as the start of a line. If
-/// `before` is `false`, then each match of this pattern is interpreted
-/// as the end of a line.
-///
-/// This function writes each line in `data` to [`std::io::Stdout`] in
-/// reverse.
-///
-/// # Errors
-///
-/// If there is a problem writing to `stdout`, then this function
-/// returns [`std::io::Error`].
-fn buffer_tac_regex(
-    data: &[u8],
-    pattern: &regex::bytes::Regex,
-    before: bool,
-) -> std::io::Result<()> {
-    let out = stdout();
-    let mut out = BufWriter::new(out.lock());
+/// Print lines of a buffer in reverse, with line separator given as a regex.
+///
+/// `data` contains the bytes of the file.
+///
+/// `pattern` is the regular expression given as a
+/// [`regex::bytes::Regex`] (not a [`regex::Regex`], since the input is
+/// given as a slice of bytes). If `before` is `true`, then each match
+/// of this pattern in `data` is interpreted as the start of a line. If
+/// `before` is `false`, then each match of this pattern is interpreted
+/// as the end of a line.
+///
+/// This function writes each line in `data` to [`std::io::Stdout`] in
+/// reverse.
+///
+/// # Errors
+///
+/// If there is a problem writing to `stdout`, then this function
+/// returns [`std::io::Error`].
+fn buffer_tac_regex(
+    data: &[u8],
+    pattern: &regex::bytes::Regex,
+    before: bool,
+) -> std::io::Result<()> {
+    let out = stdout();
+    let mut out = BufWriter::new(out.lock());
 
-    // The index of the line separator for the current line.
-    //
-    // As we scan through the `data` from right to left, we update this
-    // variable each time we find a new line separator. We restrict our
-    // regular expression search to only those bytes up to the line
-    // separator.
-    let mut this_line_end = data.len();
+    // The index of the line separator for the current line.
+    //
+    // As we scan through the `data` from right to left, we update this
+    // variable each time we find a new line separator. We restrict our
+    // regular expression search to only those bytes up to the line
+    // separator.
+    let mut this_line_end = data.len();
 
-    // The index of the start of the next line in the `data`.
-    //
-    // As we scan through the `data` from right to left, we update this
-    // variable each time we find a new line.
-    //
-    // If `before` is `true`, then each line starts immediately before
-    // the line separator. Otherwise, each line starts immediately after
-    // the line separator.
-    let mut following_line_start = data.len();
+    // The index of the start of the next line in the `data`.
+    //
+    // As we scan through the `data` from right to left, we update this
+    // variable each time we find a new line.
+    //
+    // If `before` is `true`, then each line starts immediately before
+    // the line separator. Otherwise, each line starts immediately after
+    // the line separator.
+    let mut following_line_start = data.len();
 
-    // Iterate over each byte in the buffer in reverse. When we find a
-    // line separator, write the line to stdout.
-    //
-    // The `before` flag controls whether the line separator appears at
-    // the end of the line (as in "abc\ndef\n") or at the beginning of
-    // the line (as in "/abc/def").
-    for i in (0..data.len()).rev() {
-        // Determine if there is a match for `pattern` starting at index
-        // `i` in `data`. Only search up to the line ending that was
-        // found previously.
-        if let Some(match_) = pattern.find_at(&data[..this_line_end], i) {
-            // Record this index as the ending of the current line.
-            this_line_end = i;
+    // Iterate over each byte in the buffer in reverse. When we find a
+    // line separator, write the line to stdout.
+    //
+    // The `before` flag controls whether the line separator appears at
+    // the end of the line (as in "abc\ndef\n") or at the beginning of
+    // the line (as in "/abc/def").
+    for i in (0..data.len()).rev() {
+        // Determine if there is a match for `pattern` starting at index
+        // `i` in `data`. Only search up to the line ending that was
+        // found previously.
+        if let Some(match_) = pattern.find_at(&data[..this_line_end], i) {
+            // Record this index as the ending of the current line.
+            this_line_end = i;
 
-            // The length of the match (that is, the line separator), in bytes.
-            let slen = match_.end() - match_.start();
+            // The length of the match (that is, the line separator), in bytes.
+            let slen = match_.end() - match_.start();
 
-            if before {
-                out.write_all(&data[i..following_line_start])?;
-                following_line_start = i;
-            } else {
-                out.write_all(&data[i + slen..following_line_start])?;
-                following_line_start = i + slen;
+            if before {
+                out.write_all(&data[i..following_line_start])?;
+                following_line_start = i;
+            } else {
+                out.write_all(&data[i + slen..following_line_start])?;
+                following_line_start = i + slen;
             }
         }
     }
 
-    // After the loop terminates, write whatever bytes are remaining at
-    // the beginning of the buffer.
-    out.write_all(&data[0..following_line_start])?;
+    // After the loop terminates, write whatever bytes are remaining at
+    // the beginning of the buffer.
+    out.write_all(&data[0..following_line_start])?;
     Ok(())
 }
 
-/// Write lines from `data` to stdout in reverse.
-///
-/// This function writes to [`stdout`] each line appearing in `data`,
-/// starting with the last line and ending with the first line. The
-/// `separator` parameter defines what characters to use as a line
-/// separator.
-///
-/// If `before` is `false`, then this function assumes that the
-/// `separator` appears at the end of each line, as in `"abc\ndef\n"`.
-/// If `before` is `true`, then this function assumes that the
-/// `separator` appears at the beginning of each line, as in
-/// `"/abc/def"`.
-fn buffer_tac(data: &[u8], before: bool, separator: &str) -> std::io::Result<()> {
-    let out = stdout();
-    let mut out = BufWriter::new(out.lock());
+/// Write lines from `data` to stdout in reverse.
+///
+/// This function writes to [`stdout`] each line appearing in `data`,
+/// starting with the last line and ending with the first line. The
+/// `separator` parameter defines what characters to use as a line
+/// separator.
+///
+/// If `before` is `false`, then this function assumes that the
+/// `separator` appears at the end of each line, as in `"abc\ndef\n"`.
+/// If `before` is `true`, then this function assumes that the
+/// `separator` appears at the beginning of each line, as in
+/// `"/abc/def"`.
+fn buffer_tac(data: &[u8], before: bool, separator: &str) -> std::io::Result<()> {
+    let out = stdout();
+    let mut out = BufWriter::new(out.lock());
 
-    // The number of bytes in the line separator.
-    let slen = separator.as_bytes().len();
+    // The number of bytes in the line separator.
+    let slen = separator.as_bytes().len();
 
-    // The index of the start of the next line in the `data`.
-    //
-    // As we scan through the `data` from right to left, we update this
-    // variable each time we find a new line.
-    //
-    // If `before` is `true`, then each line starts immediately before
-    // the line separator. Otherwise, each line starts immediately after
-    // the line separator.
-    let mut following_line_start = data.len();
+    // The index of the start of the next line in the `data`.
+    //
+    // As we scan through the `data` from right to left, we update this
+    // variable each time we find a new line.
+    //
+    // If `before` is `true`, then each line starts immediately before
+    // the line separator. Otherwise, each line starts immediately after
+    // the line separator.
+    let mut following_line_start = data.len();
 
-    // Iterate over each byte in the buffer in reverse. When we find a
-    // line separator, write the line to stdout.
-    //
-    // The `before` flag controls whether the line separator appears at
-    // the end of the line (as in "abc\ndef\n") or at the beginning of
-    // the line (as in "/abc/def").
-    for i in memmem::rfind_iter(data, separator) {
-        if before {
-            out.write_all(&data[i..following_line_start])?;
-            following_line_start = i;
-        } else {
-            out.write_all(&data[i + slen..following_line_start])?;
-            following_line_start = i + slen;
+    // Iterate over each byte in the buffer in reverse. When we find a
+    // line separator, write the line to stdout.
+    //
+    // The `before` flag controls whether the line separator appears at
+    // the end of the line (as in "abc\ndef\n") or at the beginning of
+    // the line (as in "/abc/def").
+    for i in memmem::rfind_iter(data, separator) {
+        if before {
+            out.write_all(&data[i..following_line_start])?;
+            following_line_start = i;
+        } else {
+            out.write_all(&data[i + slen..following_line_start])?;
+            following_line_start = i + slen;
         }
     }
 
-    // After the loop terminates, write whatever bytes are remaining at
-    // the beginning of the buffer.
-    out.write_all(&data[0..following_line_start])?;
+    // After the loop terminates, write whatever bytes are remaining at
+    // the beginning of the buffer.
+    out.write_all(&data[0..following_line_start])?;
     Ok(())
 }
 
-fn tac(filenames: &[&str], before: bool, regex: bool, separator: &str) -> UResult<()> {
-    // Compile the regular expression pattern if it is provided.
-    let maybe_pattern = if regex {
-        match regex::bytes::Regex::new(separator) {
-            Ok(p) => Some(p),
-            Err(e) => return Err(TacError::InvalidRegex(e).into()),
+fn tac(filenames: &[&str], before: bool, regex: bool, separator: &str) -> UResult<()> {
+    // Compile the regular expression pattern if it is provided.
+    let maybe_pattern = if regex {
+        match regex::bytes::Regex::new(separator) {
+            Ok(p) => Some(p),
+            Err(e) => return Err(TacError::InvalidRegex(e).into()),
         }
-    } else {
-        None
-    };
+    } else {
+        None
+    };
 
-    for &filename in filenames {
-        let mmap;
-        let buf;
+    for &filename in filenames {
+        let mmap;
+        let buf;
 
-        let data: &[u8] = if filename == "-" {
-            if let Some(mmap1) = try_mmap_stdin() {
-                mmap = mmap1;
-                &mmap
-            } else {
-                let mut buf1 = Vec::new();
-                if let Err(e) = stdin().read_to_end(&mut buf1) {
-                    let e: Box<dyn UError> = TacError::ReadError("stdin".to_string(), e).into();
-                    show!(e);
+        let data: &[u8] = if filename == "-" {
+            if let Some(mmap1) = try_mmap_stdin() {
+                mmap = mmap1;
+                &mmap
+            } else {
+                let mut buf1 = Vec::new();
+                if let Err(e) = stdin().read_to_end(&mut buf1) {
+                    let e: Box<dyn UError> = TacError::ReadError("stdin".to_string(), e).into();
+                    show!(e);
                     continue;
                 }
-                buf = buf1;
-                &buf
+                buf = buf1;
+                &buf
             }
-        } else {
-            let path = Path::new(filename);
-            if path.is_dir() {
-                let e: Box<dyn UError> = TacError::InvalidArgument(String::from(filename)).into();
-                show!(e);
+        } else {
+            let path = Path::new(filename);
+            if path.is_dir() {
+                let e: Box<dyn UError> = TacError::InvalidArgument(String::from(filename)).into();
+                show!(e);
                 continue;
             }
 
-            if path.metadata().is_err() {
-                let e: Box<dyn UError> = TacError::FileNotFound(String::from(filename)).into();
-                show!(e);
+            if path.metadata().is_err() {
+                let e: Box<dyn UError> = TacError::FileNotFound(String::from(filename)).into();
+                show!(e);
                 continue;
             }
 
-            if let Some(mmap1) = try_mmap_path(path) {
-                mmap = mmap1;
-                &mmap
-            } else {
-                match read(path) {
-                    Ok(buf1) => {
-                        buf = buf1;
-                        &buf
+            if let Some(mmap1) = try_mmap_path(path) {
+                mmap = mmap1;
+                &mmap
+            } else {
+                match read(path) {
+                    Ok(buf1) => {
+                        buf = buf1;
+                        &buf
                     }
-                    Err(e) => {
-                        let s = format!("{}", filename.quote());
-                        let e: Box<dyn UError> = TacError::ReadError(s.to_string(), e).into();
-                        show!(e);
+                    Err(e) => {
+                        let s = format!("{}", filename.quote());
+                        let e: Box<dyn UError> = TacError::ReadError(s.to_string(), e).into();
+                        show!(e);
                         continue;
                     }
                 }
             }
         };
 
-        // Select the appropriate `tac` algorithm based on whether the
-        // separator is given as a regular expression or a fixed string.
-        let result = match maybe_pattern {
-            Some(ref pattern) => buffer_tac_regex(data, pattern, before),
-            None => buffer_tac(data, before, separator),
+        // Select the appropriate `tac` algorithm based on whether the
+        // separator is given as a regular expression or a fixed string.
+        let result = match maybe_pattern {
+            Some(ref pattern) => buffer_tac_regex(data, pattern, before),
+            None => buffer_tac(data, before, separator),
         };
 
-        // If there is any error in writing the output, terminate immediately.
-        if let Err(e) = result {
-            return Err(TacError::WriteError(e).into());
+        // If there is any error in writing the output, terminate immediately.
+        if let Err(e) = result {
+            return Err(TacError::WriteError(e).into());
         }
     }
     Ok(())
 }
 
-fn try_mmap_stdin() -> Option<Mmap> {
-    // SAFETY: If the file is truncated while we map it, SIGBUS will be raised
-    // and our process will be terminated, thus preventing access of invalid memory.
-    unsafe { Mmap::map(&stdin()).ok() }
+fn try_mmap_stdin() -> Option<Mmap> {
+    // SAFETY: If the file is truncated while we map it, SIGBUS will be raised
+    // and our process will be terminated, thus preventing access of invalid memory.
+    unsafe { Mmap::map(&stdin()).ok() }
 }
 
-fn try_mmap_path(path: &Path) -> Option<Mmap> {
-    let file = File::open(path).ok()?;
+fn try_mmap_path(path: &Path) -> Option<Mmap> {
+    let file = File::open(path).ok()?;
 
-    // SAFETY: If the file is truncated while we map it, SIGBUS will be raised
-    // and our process will be terminated, thus preventing access of invalid memory.
-    let mmap = unsafe { Mmap::map(&file).ok()? };
+    // SAFETY: If the file is truncated while we map it, SIGBUS will be raised
+    // and our process will be terminated, thus preventing access of invalid memory.
+    let mmap = unsafe { Mmap::map(&file).ok()? };
 
-    Some(mmap)
+    Some(mmap)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/args.rs.html b/dev/src/uu_tail/args.rs.html index d31e33ab1..5cf7c583b 100644 --- a/dev/src/uu_tail/args.rs.html +++ b/dev/src/uu_tail/args.rs.html @@ -1,4 +1,4 @@ -args.rs - source
1
+args.rs - source
1
 2
 3
 4
@@ -473,480 +473,480 @@
 473
 474
 475
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) kqueue Signum
+// spell-checker:ignore (ToDO) kqueue Signum
 
-use crate::paths::Input;
-use crate::{parse, platform, Quotable};
-use clap::{parser::ValueSource, Arg, ArgAction, ArgMatches, Command};
-use std::collections::VecDeque;
-use std::ffi::OsString;
-use std::time::Duration;
-use uucore::error::{UResult, USimpleError, UUsageError};
-use uucore::format_usage;
-use uucore::parse_size::{parse_size, ParseSizeError};
+use crate::paths::Input;
+use crate::{parse, platform, Quotable};
+use clap::{parser::ValueSource, Arg, ArgAction, ArgMatches, Command};
+use std::collections::VecDeque;
+use std::ffi::OsString;
+use std::time::Duration;
+use uucore::error::{UResult, USimpleError, UUsageError};
+use uucore::format_usage;
+use uucore::parse_size::{parse_size, ParseSizeError};
 
-const ABOUT: &str = "\
+const ABOUT: &str = "\
     Print the last 10 lines of each FILE to standard output.\n\
     With more than one FILE, precede each with a header giving the file name.\n\
     With no FILE, or when FILE is -, read standard input.\n\
     \n\
     Mandatory arguments to long flags are mandatory for short flags too.\
     ";
-const USAGE: &str = "{} [FLAG]... [FILE]...";
+const USAGE: &str = "{} [FLAG]... [FILE]...";
 
-pub mod options {
-    pub mod verbosity {
-        pub static QUIET: &str = "quiet";
-        pub static VERBOSE: &str = "verbose";
+pub mod options {
+    pub mod verbosity {
+        pub static QUIET: &str = "quiet";
+        pub static VERBOSE: &str = "verbose";
     }
-    pub static BYTES: &str = "bytes";
-    pub static FOLLOW: &str = "follow";
-    pub static LINES: &str = "lines";
-    pub static PID: &str = "pid";
-    pub static SLEEP_INT: &str = "sleep-interval";
-    pub static ZERO_TERM: &str = "zero-terminated";
-    pub static DISABLE_INOTIFY_TERM: &str = "-disable-inotify"; // NOTE: three hyphens is correct
-    pub static USE_POLLING: &str = "use-polling";
-    pub static RETRY: &str = "retry";
-    pub static FOLLOW_RETRY: &str = "F";
-    pub static MAX_UNCHANGED_STATS: &str = "max-unchanged-stats";
-    pub static ARG_FILES: &str = "files";
-    pub static PRESUME_INPUT_PIPE: &str = "-presume-input-pipe"; // NOTE: three hyphens is correct
+    pub static BYTES: &str = "bytes";
+    pub static FOLLOW: &str = "follow";
+    pub static LINES: &str = "lines";
+    pub static PID: &str = "pid";
+    pub static SLEEP_INT: &str = "sleep-interval";
+    pub static ZERO_TERM: &str = "zero-terminated";
+    pub static DISABLE_INOTIFY_TERM: &str = "-disable-inotify"; // NOTE: three hyphens is correct
+    pub static USE_POLLING: &str = "use-polling";
+    pub static RETRY: &str = "retry";
+    pub static FOLLOW_RETRY: &str = "F";
+    pub static MAX_UNCHANGED_STATS: &str = "max-unchanged-stats";
+    pub static ARG_FILES: &str = "files";
+    pub static PRESUME_INPUT_PIPE: &str = "-presume-input-pipe"; // NOTE: three hyphens is correct
+}
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum Signum {
+    Negative(u64),
+    Positive(u64),
+    PlusZero,
+    MinusZero,
 }
 
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum Signum {
-    Negative(u64),
-    Positive(u64),
-    PlusZero,
-    MinusZero,
+#[derive(Debug, PartialEq, Eq)]
+pub enum FilterMode {
+    Bytes(Signum),
+
+    /// Mode for lines delimited by delimiter as u8
+    Lines(Signum, u8),
 }
 
-#[derive(Debug, PartialEq, Eq)]
-pub enum FilterMode {
-    Bytes(Signum),
-
-    /// Mode for lines delimited by delimiter as u8
-    Lines(Signum, u8),
-}
-
-impl FilterMode {
-    fn from(matches: &ArgMatches) -> UResult<Self> {
-        let zero_term = matches.get_flag(options::ZERO_TERM);
-        let mode = if let Some(arg) = matches.get_one::<String>(options::BYTES) {
-            match parse_num(arg) {
-                Ok(signum) => Self::Bytes(signum),
-                Err(e) => {
-                    return Err(UUsageError::new(
+impl FilterMode {
+    fn from(matches: &ArgMatches) -> UResult<Self> {
+        let zero_term = matches.get_flag(options::ZERO_TERM);
+        let mode = if let Some(arg) = matches.get_one::<String>(options::BYTES) {
+            match parse_num(arg) {
+                Ok(signum) => Self::Bytes(signum),
+                Err(e) => {
+                    return Err(UUsageError::new(
                         1,
-                        format!("invalid number of bytes: {}", e),
+                        format!("invalid number of bytes: {}", e),
                     ))
                 }
             }
-        } else if let Some(arg) = matches.get_one::<String>(options::LINES) {
-            match parse_num(arg) {
-                Ok(signum) => {
-                    let delimiter = if zero_term { 0 } else { b'\n' };
-                    Self::Lines(signum, delimiter)
+        } else if let Some(arg) = matches.get_one::<String>(options::LINES) {
+            match parse_num(arg) {
+                Ok(signum) => {
+                    let delimiter = if zero_term { 0 } else { b'\n' };
+                    Self::Lines(signum, delimiter)
                 }
-                Err(e) => {
-                    return Err(UUsageError::new(
+                Err(e) => {
+                    return Err(UUsageError::new(
                         1,
-                        format!("invalid number of lines: {}", e),
+                        format!("invalid number of lines: {}", e),
                     ))
                 }
             }
-        } else if zero_term {
-            Self::default_zero()
-        } else {
-            Self::default()
+        } else if zero_term {
+            Self::default_zero()
+        } else {
+            Self::default()
         };
 
-        Ok(mode)
+        Ok(mode)
     }
 
-    fn default_zero() -> Self {
-        Self::Lines(Signum::Negative(10), 0)
+    fn default_zero() -> Self {
+        Self::Lines(Signum::Negative(10), 0)
     }
 }
 
-impl Default for FilterMode {
-    fn default() -> Self {
-        Self::Lines(Signum::Negative(10), b'\n')
+impl Default for FilterMode {
+    fn default() -> Self {
+        Self::Lines(Signum::Negative(10), b'\n')
     }
 }
 
-#[derive(Debug, PartialEq, Eq, Clone, Copy)]
-pub enum FollowMode {
-    Descriptor,
-    Name,
+#[derive(Debug, PartialEq, Eq, Clone, Copy)]
+pub enum FollowMode {
+    Descriptor,
+    Name,
 }
 
-#[derive(Debug, Default)]
-pub struct Settings {
-    pub follow: Option<FollowMode>,
-    pub max_unchanged_stats: u32,
-    pub mode: FilterMode,
-    pub pid: platform::Pid,
-    pub retry: bool,
-    pub sleep_sec: Duration,
-    pub use_polling: bool,
-    pub verbose: bool,
-    pub presume_input_pipe: bool,
-    pub inputs: VecDeque<Input>,
+#[derive(Debug, Default)]
+pub struct Settings {
+    pub follow: Option<FollowMode>,
+    pub max_unchanged_stats: u32,
+    pub mode: FilterMode,
+    pub pid: platform::Pid,
+    pub retry: bool,
+    pub sleep_sec: Duration,
+    pub use_polling: bool,
+    pub verbose: bool,
+    pub presume_input_pipe: bool,
+    pub inputs: VecDeque<Input>,
 }
 
-impl Settings {
-    pub fn from(matches: &clap::ArgMatches) -> UResult<Self> {
-        let mut settings: Self = Self {
-            sleep_sec: Duration::from_secs_f32(1.0),
-            max_unchanged_stats: 5,
-            ..Default::default()
+impl Settings {
+    pub fn from(matches: &clap::ArgMatches) -> UResult<Self> {
+        let mut settings: Self = Self {
+            sleep_sec: Duration::from_secs_f32(1.0),
+            max_unchanged_stats: 5,
+            ..Default::default()
         };
 
-        settings.follow = if matches.get_flag(options::FOLLOW_RETRY) {
-            Some(FollowMode::Name)
-        } else if matches.value_source(options::FOLLOW) != Some(ValueSource::CommandLine) {
-            None
-        } else if matches.get_one::<String>(options::FOLLOW) == Some(String::from("name")).as_ref()
+        settings.follow = if matches.get_flag(options::FOLLOW_RETRY) {
+            Some(FollowMode::Name)
+        } else if matches.value_source(options::FOLLOW) != Some(ValueSource::CommandLine) {
+            None
+        } else if matches.get_one::<String>(options::FOLLOW) == Some(String::from("name")).as_ref()
         {
-            Some(FollowMode::Name)
-        } else {
-            Some(FollowMode::Descriptor)
+            Some(FollowMode::Name)
+        } else {
+            Some(FollowMode::Descriptor)
         };
 
-        settings.retry =
-            matches.get_flag(options::RETRY) || matches.get_flag(options::FOLLOW_RETRY);
+        settings.retry =
+            matches.get_flag(options::RETRY) || matches.get_flag(options::FOLLOW_RETRY);
 
-        if settings.retry && settings.follow.is_none() {
+        if settings.retry && settings.follow.is_none() {
             show_warning!("--retry ignored; --retry is useful only when following");
         }
 
-        if let Some(s) = matches.get_one::<String>(options::SLEEP_INT) {
-            settings.sleep_sec = match s.parse::<f32>() {
-                Ok(s) => Duration::from_secs_f32(s),
+        if let Some(s) = matches.get_one::<String>(options::SLEEP_INT) {
+            settings.sleep_sec = match s.parse::<f32>() {
+                Ok(s) => Duration::from_secs_f32(s),
                 Err(_) => {
-                    return Err(UUsageError::new(
+                    return Err(UUsageError::new(
                         1,
-                        format!("invalid number of seconds: {}", s.quote()),
+                        format!("invalid number of seconds: {}", s.quote()),
                     ))
                 }
             }
         }
 
-        settings.use_polling = matches.get_flag(options::USE_POLLING);
+        settings.use_polling = matches.get_flag(options::USE_POLLING);
 
-        if let Some(s) = matches.get_one::<String>(options::MAX_UNCHANGED_STATS) {
-            settings.max_unchanged_stats = match s.parse::<u32>() {
-                Ok(s) => s,
+        if let Some(s) = matches.get_one::<String>(options::MAX_UNCHANGED_STATS) {
+            settings.max_unchanged_stats = match s.parse::<u32>() {
+                Ok(s) => s,
                 Err(_) => {
-                    return Err(UUsageError::new(
+                    return Err(UUsageError::new(
                         1,
                         format!(
                             "invalid maximum number of unchanged stats between opens: {}",
-                            s.quote()
+                            s.quote()
                         ),
                     ));
                 }
             }
         }
 
-        if let Some(pid_str) = matches.get_one::<String>(options::PID) {
-            match pid_str.parse() {
-                Ok(pid) => {
-                    // NOTE: on unix platform::Pid is i32, on windows platform::Pid is u32
-                    #[cfg(unix)]
-                    if pid < 0 {
-                        // NOTE: tail only accepts an unsigned pid
-                        return Err(USimpleError::new(
+        if let Some(pid_str) = matches.get_one::<String>(options::PID) {
+            match pid_str.parse() {
+                Ok(pid) => {
+                    // NOTE: on unix platform::Pid is i32, on windows platform::Pid is u32
+                    #[cfg(unix)]
+                    if pid < 0 {
+                        // NOTE: tail only accepts an unsigned pid
+                        return Err(USimpleError::new(
                             1,
-                            format!("invalid PID: {}", pid_str.quote()),
+                            format!("invalid PID: {}", pid_str.quote()),
                         ));
                     }
-                    settings.pid = pid;
-                    if settings.follow.is_none() {
+                    settings.pid = pid;
+                    if settings.follow.is_none() {
                         show_warning!("PID ignored; --pid=PID is useful only when following");
                     }
-                    if !platform::supports_pid_checks(settings.pid) {
+                    if !platform::supports_pid_checks(settings.pid) {
                         show_warning!("--pid=PID is not supported on this system");
-                        settings.pid = 0;
+                        settings.pid = 0;
                     }
                 }
-                Err(e) => {
-                    return Err(USimpleError::new(
+                Err(e) => {
+                    return Err(USimpleError::new(
                         1,
-                        format!("invalid PID: {}: {}", pid_str.quote(), e),
+                        format!("invalid PID: {}: {}", pid_str.quote(), e),
                     ));
                 }
             }
         }
 
-        settings.mode = FilterMode::from(matches)?;
+        settings.mode = FilterMode::from(matches)?;
 
-        // Mimic GNU's tail for -[nc]0 without -f and exit immediately
-        if settings.follow.is_none()
-            && matches!(
-                settings.mode,
-                FilterMode::Lines(Signum::MinusZero, _) | FilterMode::Bytes(Signum::MinusZero)
+        // Mimic GNU's tail for -[nc]0 without -f and exit immediately
+        if settings.follow.is_none()
+            && matches!(
+                settings.mode,
+                FilterMode::Lines(Signum::MinusZero, _) | FilterMode::Bytes(Signum::MinusZero)
             )
         {
-            std::process::exit(0)
+            std::process::exit(0)
         }
 
-        let mut inputs: VecDeque<Input> = matches
-            .get_many::<String>(options::ARG_FILES)
-            .map(|v| v.map(|string| Input::from(string.clone())).collect())
-            .unwrap_or_default();
+        let mut inputs: VecDeque<Input> = matches
+            .get_many::<String>(options::ARG_FILES)
+            .map(|v| v.map(|string| Input::from(string.clone())).collect())
+            .unwrap_or_default();
 
-        // apply default and add '-' to inputs if none is present
-        if inputs.is_empty() {
-            inputs.push_front(Input::default());
+        // apply default and add '-' to inputs if none is present
+        if inputs.is_empty() {
+            inputs.push_front(Input::default());
         }
 
-        settings.verbose = (matches.get_flag(options::verbosity::VERBOSE) || inputs.len() > 1)
-            && !matches.get_flag(options::verbosity::QUIET);
+        settings.verbose = (matches.get_flag(options::verbosity::VERBOSE) || inputs.len() > 1)
+            && !matches.get_flag(options::verbosity::QUIET);
 
-        settings.inputs = inputs;
+        settings.inputs = inputs;
 
-        settings.presume_input_pipe = matches.get_flag(options::PRESUME_INPUT_PIPE);
+        settings.presume_input_pipe = matches.get_flag(options::PRESUME_INPUT_PIPE);
 
-        Ok(settings)
+        Ok(settings)
     }
 }
 
-pub fn arg_iterate<'a>(
-    mut args: impl uucore::Args + 'a,
-) -> UResult<Box<dyn Iterator<Item = OsString> + 'a>> {
-    // argv[0] is always present
-    let first = args.next().unwrap();
-    if let Some(second) = args.next() {
-        if let Some(s) = second.to_str() {
-            match parse::parse_obsolete(s) {
-                Some(Ok(iter)) => Ok(Box::new(vec![first].into_iter().chain(iter).chain(args))),
-                Some(Err(e)) => Err(UUsageError::new(
+pub fn arg_iterate<'a>(
+    mut args: impl uucore::Args + 'a,
+) -> UResult<Box<dyn Iterator<Item = OsString> + 'a>> {
+    // argv[0] is always present
+    let first = args.next().unwrap();
+    if let Some(second) = args.next() {
+        if let Some(s) = second.to_str() {
+            match parse::parse_obsolete(s) {
+                Some(Ok(iter)) => Ok(Box::new(vec![first].into_iter().chain(iter).chain(args))),
+                Some(Err(e)) => Err(UUsageError::new(
                     1,
-                    match e {
-                        parse::ParseError::Syntax => format!("bad argument format: {}", s.quote()),
-                        parse::ParseError::Overflow => format!(
+                    match e {
+                        parse::ParseError::Syntax => format!("bad argument format: {}", s.quote()),
+                        parse::ParseError::Overflow => format!(
                             "invalid argument: {} Value too large for defined datatype",
-                            s.quote()
+                            s.quote()
                         ),
                     },
                 )),
-                None => Ok(Box::new(vec![first, second].into_iter().chain(args))),
+                None => Ok(Box::new(vec![first, second].into_iter().chain(args))),
             }
-        } else {
-            Err(UUsageError::new(1, "bad argument encoding".to_owned()))
+        } else {
+            Err(UUsageError::new(1, "bad argument encoding".to_owned()))
         }
-    } else {
-        Ok(Box::new(vec![first].into_iter()))
+    } else {
+        Ok(Box::new(vec![first].into_iter()))
     }
 }
 
-fn parse_num(src: &str) -> Result<Signum, ParseSizeError> {
-    let mut size_string = src.trim();
-    let mut starting_with = false;
+fn parse_num(src: &str) -> Result<Signum, ParseSizeError> {
+    let mut size_string = src.trim();
+    let mut starting_with = false;
 
-    if let Some(c) = size_string.chars().next() {
-        if c == '+' || c == '-' {
-            // tail: '-' is not documented (8.32 man pages)
-            size_string = &size_string[1..];
-            if c == '+' {
-                starting_with = true;
+    if let Some(c) = size_string.chars().next() {
+        if c == '+' || c == '-' {
+            // tail: '-' is not documented (8.32 man pages)
+            size_string = &size_string[1..];
+            if c == '+' {
+                starting_with = true;
             }
         }
-    } else {
-        return Err(ParseSizeError::ParseFailure(src.to_string()));
+    } else {
+        return Err(ParseSizeError::ParseFailure(src.to_string()));
     }
 
-    parse_size(size_string).map(|n| match (n, starting_with) {
-        (0, true) => Signum::PlusZero,
-        (0, false) => Signum::MinusZero,
-        (n, true) => Signum::Positive(n),
-        (n, false) => Signum::Negative(n),
+    parse_size(size_string).map(|n| match (n, starting_with) {
+        (0, true) => Signum::PlusZero,
+        (0, false) => Signum::MinusZero,
+        (n, true) => Signum::Positive(n),
+        (n, false) => Signum::Negative(n),
     })
 }
 
-pub fn stdin_is_pipe_or_fifo() -> bool {
-    #[cfg(unix)]
-    {
-        platform::stdin_is_pipe_or_fifo()
+pub fn stdin_is_pipe_or_fifo() -> bool {
+    #[cfg(unix)]
+    {
+        platform::stdin_is_pipe_or_fifo()
     }
-    #[cfg(windows)]
-    {
-        winapi_util::file::typ(winapi_util::HandleRef::stdin())
-            .map(|t| t.is_disk() || t.is_pipe())
-            .unwrap_or(false)
+    #[cfg(windows)]
+    {
+        winapi_util::file::typ(winapi_util::HandleRef::stdin())
+            .map(|t| t.is_disk() || t.is_pipe())
+            .unwrap_or(false)
     }
 }
 
-pub fn parse_args(args: impl uucore::Args) -> UResult<Settings> {
-    let matches = uu_app().try_get_matches_from(arg_iterate(args)?)?;
-    Settings::from(&matches)
+pub fn parse_args(args: impl uucore::Args) -> UResult<Settings> {
+    let matches = uu_app().try_get_matches_from(arg_iterate(args)?)?;
+    Settings::from(&matches)
 }
 
-pub fn uu_app() -> Command {
-    #[cfg(target_os = "linux")]
-    pub static POLLING_HELP: &str = "Disable 'inotify' support and use polling instead";
-    #[cfg(all(unix, not(target_os = "linux")))]
-    pub static POLLING_HELP: &str = "Disable 'kqueue' support and use polling instead";
-    #[cfg(target_os = "windows")]
-    pub static POLLING_HELP: &str =
+pub fn uu_app() -> Command {
+    #[cfg(target_os = "linux")]
+    pub static POLLING_HELP: &str = "Disable 'inotify' support and use polling instead";
+    #[cfg(all(unix, not(target_os = "linux")))]
+    pub static POLLING_HELP: &str = "Disable 'kqueue' support and use polling instead";
+    #[cfg(target_os = "windows")]
+    pub static POLLING_HELP: &str =
         "Disable 'ReadDirectoryChanges' support and use polling instead";
 
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::BYTES)
-                .short('c')
-                .long(options::BYTES)
-                .allow_hyphen_values(true)
-                .overrides_with_all([options::BYTES, options::LINES])
-                .help("Number of bytes to print"),
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::BYTES)
+                .short('c')
+                .long(options::BYTES)
+                .allow_hyphen_values(true)
+                .overrides_with_all([options::BYTES, options::LINES])
+                .help("Number of bytes to print"),
         )
-        .arg(
-            Arg::new(options::FOLLOW)
-                .short('f')
-                .long(options::FOLLOW)
-                .default_value("descriptor")
-                .num_args(0..=1)
-                .require_equals(true)
-                .value_parser(["descriptor", "name"])
-                .help("Print the file as it grows"),
+        .arg(
+            Arg::new(options::FOLLOW)
+                .short('f')
+                .long(options::FOLLOW)
+                .default_value("descriptor")
+                .num_args(0..=1)
+                .require_equals(true)
+                .value_parser(["descriptor", "name"])
+                .help("Print the file as it grows"),
         )
-        .arg(
-            Arg::new(options::LINES)
-                .short('n')
-                .long(options::LINES)
-                .allow_hyphen_values(true)
-                .overrides_with_all([options::BYTES, options::LINES])
-                .help("Number of lines to print"),
+        .arg(
+            Arg::new(options::LINES)
+                .short('n')
+                .long(options::LINES)
+                .allow_hyphen_values(true)
+                .overrides_with_all([options::BYTES, options::LINES])
+                .help("Number of lines to print"),
         )
-        .arg(
-            Arg::new(options::PID)
-                .long(options::PID)
-                .value_name("PID")
-                .help("With -f, terminate after process ID, PID dies"),
+        .arg(
+            Arg::new(options::PID)
+                .long(options::PID)
+                .value_name("PID")
+                .help("With -f, terminate after process ID, PID dies"),
         )
-        .arg(
-            Arg::new(options::verbosity::QUIET)
-                .short('q')
-                .long(options::verbosity::QUIET)
-                .visible_alias("silent")
-                .overrides_with_all([options::verbosity::QUIET, options::verbosity::VERBOSE])
-                .help("Never output headers giving file names")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::QUIET)
+                .short('q')
+                .long(options::verbosity::QUIET)
+                .visible_alias("silent")
+                .overrides_with_all([options::verbosity::QUIET, options::verbosity::VERBOSE])
+                .help("Never output headers giving file names")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SLEEP_INT)
-                .short('s')
-                .value_name("N")
-                .long(options::SLEEP_INT)
-                .help("Number of seconds to sleep between polling the file when running with -f"),
+        .arg(
+            Arg::new(options::SLEEP_INT)
+                .short('s')
+                .value_name("N")
+                .long(options::SLEEP_INT)
+                .help("Number of seconds to sleep between polling the file when running with -f"),
         )
-        .arg(
-            Arg::new(options::MAX_UNCHANGED_STATS)
-                .value_name("N")
-                .long(options::MAX_UNCHANGED_STATS)
-                .help(
+        .arg(
+            Arg::new(options::MAX_UNCHANGED_STATS)
+                .value_name("N")
+                .long(options::MAX_UNCHANGED_STATS)
+                .help(
                     "Reopen a FILE which has not changed size after N (default 5) iterations \
                         to see if it has been unlinked or renamed (this is the usual case of rotated \
                         log files); This option is meaningful only when polling \
                         (i.e., with --use-polling) and when --follow=name",
                 ),
         )
-        .arg(
-            Arg::new(options::verbosity::VERBOSE)
-                .short('v')
-                .long(options::verbosity::VERBOSE)
-                .overrides_with_all([options::verbosity::QUIET, options::verbosity::VERBOSE])
-                .help("Always output headers giving file names")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::verbosity::VERBOSE)
+                .short('v')
+                .long(options::verbosity::VERBOSE)
+                .overrides_with_all([options::verbosity::QUIET, options::verbosity::VERBOSE])
+                .help("Always output headers giving file names")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ZERO_TERM)
-                .short('z')
-                .long(options::ZERO_TERM)
-                .help("Line delimiter is NUL, not newline")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO_TERM)
+                .short('z')
+                .long(options::ZERO_TERM)
+                .help("Line delimiter is NUL, not newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::USE_POLLING)
-                .alias(options::DISABLE_INOTIFY_TERM) // NOTE: Used by GNU's test suite
-                .alias("dis") // NOTE: Used by GNU's test suite
-                .long(options::USE_POLLING)
-                .help(POLLING_HELP)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::USE_POLLING)
+                .alias(options::DISABLE_INOTIFY_TERM) // NOTE: Used by GNU's test suite
+                .alias("dis") // NOTE: Used by GNU's test suite
+                .long(options::USE_POLLING)
+                .help(POLLING_HELP)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::RETRY)
-                .long(options::RETRY)
-                .help("Keep trying to open a file if it is inaccessible")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RETRY)
+                .long(options::RETRY)
+                .help("Keep trying to open a file if it is inaccessible")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FOLLOW_RETRY)
-                .short('F')
-                .help("Same as --follow=name --retry")
-                .overrides_with_all([options::RETRY, options::FOLLOW])
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::FOLLOW_RETRY)
+                .short('F')
+                .help("Same as --follow=name --retry")
+                .overrides_with_all([options::RETRY, options::FOLLOW])
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PRESUME_INPUT_PIPE)
-                .long("presume-input-pipe")
-                .alias(options::PRESUME_INPUT_PIPE)
-                .hide(true)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PRESUME_INPUT_PIPE)
+                .long("presume-input-pipe")
+                .alias(options::PRESUME_INPUT_PIPE)
+                .hide(true)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ARG_FILES)
-                .action(ArgAction::Append)
-                .num_args(1..)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::ARG_FILES)
+                .action(ArgAction::Append)
+                .num_args(1..)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
+#[cfg(test)]
+mod tests {
+    use super::*;
 
-    #[test]
-    fn test_parse_num_when_sign_is_given() {
-        let result = parse_num("+0");
-        assert!(result.is_ok());
-        assert_eq!(result.unwrap(), Signum::PlusZero);
+    #[test]
+    fn test_parse_num_when_sign_is_given() {
+        let result = parse_num("+0");
+        assert!(result.is_ok());
+        assert_eq!(result.unwrap(), Signum::PlusZero);
 
-        let result = parse_num("+1");
-        assert!(result.is_ok());
-        assert_eq!(result.unwrap(), Signum::Positive(1));
+        let result = parse_num("+1");
+        assert!(result.is_ok());
+        assert_eq!(result.unwrap(), Signum::Positive(1));
 
-        let result = parse_num("-0");
-        assert!(result.is_ok());
-        assert_eq!(result.unwrap(), Signum::MinusZero);
+        let result = parse_num("-0");
+        assert!(result.is_ok());
+        assert_eq!(result.unwrap(), Signum::MinusZero);
 
-        let result = parse_num("-1");
-        assert!(result.is_ok());
-        assert_eq!(result.unwrap(), Signum::Negative(1));
+        let result = parse_num("-1");
+        assert!(result.is_ok());
+        assert_eq!(result.unwrap(), Signum::Negative(1));
     }
 
-    #[test]
-    fn test_parse_num_when_no_sign_is_given() {
-        let result = parse_num("0");
-        assert!(result.is_ok());
-        assert_eq!(result.unwrap(), Signum::MinusZero);
+    #[test]
+    fn test_parse_num_when_no_sign_is_given() {
+        let result = parse_num("0");
+        assert!(result.is_ok());
+        assert_eq!(result.unwrap(), Signum::MinusZero);
 
-        let result = parse_num("1");
-        assert!(result.is_ok());
-        assert_eq!(result.unwrap(), Signum::Negative(1));
+        let result = parse_num("1");
+        assert!(result.is_ok());
+        assert_eq!(result.unwrap(), Signum::Negative(1));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/chunks.rs.html b/dev/src/uu_tail/chunks.rs.html index e0fba5929..813ad9f73 100644 --- a/dev/src/uu_tail/chunks.rs.html +++ b/dev/src/uu_tail/chunks.rs.html @@ -1,4 +1,4 @@ -chunks.rs - source
1
+chunks.rs - source
1
 2
 3
 4
@@ -700,707 +700,707 @@
 700
 701
 702
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-//! Iterating over a file by chunks, either starting at the end of the file with [`ReverseChunks`]
-//! or at the end of piped stdin with [`LinesChunk`] or [`BytesChunk`].
-//!
-//! Use [`ReverseChunks::new`] to create a new iterator over chunks of bytes from the file.
-// spell-checker:ignore (ToDO) filehandle BUFSIZ
-use std::collections::VecDeque;
-use std::fs::File;
-use std::io::{BufRead, Read, Seek, SeekFrom, Write};
-use uucore::error::UResult;
+//! Iterating over a file by chunks, either starting at the end of the file with [`ReverseChunks`]
+//! or at the end of piped stdin with [`LinesChunk`] or [`BytesChunk`].
+//!
+//! Use [`ReverseChunks::new`] to create a new iterator over chunks of bytes from the file.
+// spell-checker:ignore (ToDO) filehandle BUFSIZ
+use std::collections::VecDeque;
+use std::fs::File;
+use std::io::{BufRead, Read, Seek, SeekFrom, Write};
+use uucore::error::UResult;
 
-/// When reading files in reverse in `bounded_tail`, this is the size of each
-/// block read at a time.
-pub const BLOCK_SIZE: u64 = 1 << 16;
+/// When reading files in reverse in `bounded_tail`, this is the size of each
+/// block read at a time.
+pub const BLOCK_SIZE: u64 = 1 << 16;
 
-/// The size of the backing buffer of a LinesChunk or BytesChunk in bytes. The value of BUFFER_SIZE
-/// originates from the BUFSIZ constant in stdio.h and the libc crate to make stream IO efficient.
-/// In the latter the value is constantly set to 8192 on all platforms, where the value in stdio.h
-/// is determined on each platform differently. Since libc chose 8192 as a reasonable default the
-/// value here is set to this value, too.
-pub const BUFFER_SIZE: usize = 8192;
+/// The size of the backing buffer of a LinesChunk or BytesChunk in bytes. The value of BUFFER_SIZE
+/// originates from the BUFSIZ constant in stdio.h and the libc crate to make stream IO efficient.
+/// In the latter the value is constantly set to 8192 on all platforms, where the value in stdio.h
+/// is determined on each platform differently. Since libc chose 8192 as a reasonable default the
+/// value here is set to this value, too.
+pub const BUFFER_SIZE: usize = 8192;
 
-/// An iterator over a file in non-overlapping chunks from the end of the file.
-///
-/// Each chunk is a [`Vec`]<[`u8`]> of size [`BLOCK_SIZE`] (except
-/// possibly the last chunk, which might be smaller). Each call to
-/// [`ReverseChunks::next`] will seek backwards through the given file.
-pub struct ReverseChunks<'a> {
-    /// The file to iterate over, by blocks, from the end to the beginning.
-    file: &'a File,
+/// An iterator over a file in non-overlapping chunks from the end of the file.
+///
+/// Each chunk is a [`Vec`]<[`u8`]> of size [`BLOCK_SIZE`] (except
+/// possibly the last chunk, which might be smaller). Each call to
+/// [`ReverseChunks::next`] will seek backwards through the given file.
+pub struct ReverseChunks<'a> {
+    /// The file to iterate over, by blocks, from the end to the beginning.
+    file: &'a File,
 
-    /// The total number of bytes in the file.
-    size: u64,
+    /// The total number of bytes in the file.
+    size: u64,
 
-    /// The total number of blocks to read.
-    max_blocks_to_read: usize,
+    /// The total number of blocks to read.
+    max_blocks_to_read: usize,
 
-    /// The index of the next block to read.
-    block_idx: usize,
+    /// The index of the next block to read.
+    block_idx: usize,
 }
 
-impl<'a> ReverseChunks<'a> {
-    pub fn new(file: &'a mut File) -> ReverseChunks<'a> {
-        let current = if cfg!(unix) {
-            file.seek(SeekFrom::Current(0)).unwrap()
-        } else {
-            0
-        };
-        let size = file.seek(SeekFrom::End(0)).unwrap() - current;
-        let max_blocks_to_read = (size as f64 / BLOCK_SIZE as f64).ceil() as usize;
-        let block_idx = 0;
-        ReverseChunks {
-            file,
-            size,
-            max_blocks_to_read,
-            block_idx,
+impl<'a> ReverseChunks<'a> {
+    pub fn new(file: &'a mut File) -> ReverseChunks<'a> {
+        let current = if cfg!(unix) {
+            file.seek(SeekFrom::Current(0)).unwrap()
+        } else {
+            0
+        };
+        let size = file.seek(SeekFrom::End(0)).unwrap() - current;
+        let max_blocks_to_read = (size as f64 / BLOCK_SIZE as f64).ceil() as usize;
+        let block_idx = 0;
+        ReverseChunks {
+            file,
+            size,
+            max_blocks_to_read,
+            block_idx,
         }
     }
 }
 
-impl<'a> Iterator for ReverseChunks<'a> {
-    type Item = Vec<u8>;
+impl<'a> Iterator for ReverseChunks<'a> {
+    type Item = Vec<u8>;
 
-    fn next(&mut self) -> Option<Self::Item> {
-        // If there are no more chunks to read, terminate the iterator.
-        if self.block_idx >= self.max_blocks_to_read {
-            return None;
+    fn next(&mut self) -> Option<Self::Item> {
+        // If there are no more chunks to read, terminate the iterator.
+        if self.block_idx >= self.max_blocks_to_read {
+            return None;
         }
 
-        // The chunk size is `BLOCK_SIZE` for all but the last chunk
-        // (that is, the chunk closest to the beginning of the file),
-        // which contains the remainder of the bytes.
-        let block_size = if self.block_idx == self.max_blocks_to_read - 1 {
-            self.size % BLOCK_SIZE
-        } else {
-            BLOCK_SIZE
+        // The chunk size is `BLOCK_SIZE` for all but the last chunk
+        // (that is, the chunk closest to the beginning of the file),
+        // which contains the remainder of the bytes.
+        let block_size = if self.block_idx == self.max_blocks_to_read - 1 {
+            self.size % BLOCK_SIZE
+        } else {
+            BLOCK_SIZE
         };
 
-        // Seek backwards by the next chunk, read the full chunk into
-        // `buf`, and then seek back to the start of the chunk again.
-        let mut buf = vec![0; BLOCK_SIZE as usize];
-        let pos = self
-            .file
-            .seek(SeekFrom::Current(-(block_size as i64)))
-            .unwrap();
-        self.file
-            .read_exact(&mut buf[0..(block_size as usize)])
-            .unwrap();
-        let pos2 = self
-            .file
-            .seek(SeekFrom::Current(-(block_size as i64)))
-            .unwrap();
-        assert_eq!(pos, pos2);
+        // Seek backwards by the next chunk, read the full chunk into
+        // `buf`, and then seek back to the start of the chunk again.
+        let mut buf = vec![0; BLOCK_SIZE as usize];
+        let pos = self
+            .file
+            .seek(SeekFrom::Current(-(block_size as i64)))
+            .unwrap();
+        self.file
+            .read_exact(&mut buf[0..(block_size as usize)])
+            .unwrap();
+        let pos2 = self
+            .file
+            .seek(SeekFrom::Current(-(block_size as i64)))
+            .unwrap();
+        assert_eq!(pos, pos2);
 
-        self.block_idx += 1;
+        self.block_idx += 1;
 
-        Some(buf[0..(block_size as usize)].to_vec())
+        Some(buf[0..(block_size as usize)].to_vec())
     }
 }
 
-/// The type of the backing buffer of [`BytesChunk`] and [`LinesChunk`] which can hold
-/// [`BUFFER_SIZE`] elements at max.
-type ChunkBuffer = [u8; BUFFER_SIZE];
+/// The type of the backing buffer of [`BytesChunk`] and [`LinesChunk`] which can hold
+/// [`BUFFER_SIZE`] elements at max.
+type ChunkBuffer = [u8; BUFFER_SIZE];
 
-/// A [`BytesChunk`] storing a fixed size number of bytes in a buffer.
-#[derive(Clone, PartialEq, Eq, Debug)]
-pub struct BytesChunk {
-    /// The [`ChunkBuffer`], an array storing the bytes, for example filled by
-    /// [`BytesChunk::fill`]
-    buffer: ChunkBuffer,
+/// A [`BytesChunk`] storing a fixed size number of bytes in a buffer.
+#[derive(Clone, PartialEq, Eq, Debug)]
+pub struct BytesChunk {
+    /// The [`ChunkBuffer`], an array storing the bytes, for example filled by
+    /// [`BytesChunk::fill`]
+    buffer: ChunkBuffer,
 
-    /// Stores the number of bytes, this buffer holds. This is not equal to buffer.len(), since the
-    /// [`BytesChunk`] may store less bytes than the internal buffer can hold. In addition
-    /// [`BytesChunk`] may be reused, what makes it necessary to track the number of stored bytes.
-    /// The choice of usize is sufficient here, since the number of bytes max value is
-    /// [`BUFFER_SIZE`], which is a usize.
-    bytes: usize,
+    /// Stores the number of bytes, this buffer holds. This is not equal to buffer.len(), since the
+    /// [`BytesChunk`] may store less bytes than the internal buffer can hold. In addition
+    /// [`BytesChunk`] may be reused, what makes it necessary to track the number of stored bytes.
+    /// The choice of usize is sufficient here, since the number of bytes max value is
+    /// [`BUFFER_SIZE`], which is a usize.
+    bytes: usize,
 }
 
-impl BytesChunk {
-    #[allow(clippy::new_without_default)]
-    pub fn new() -> Self {
-        Self {
-            buffer: [0; BUFFER_SIZE],
-            bytes: 0,
+impl BytesChunk {
+    #[allow(clippy::new_without_default)]
+    pub fn new() -> Self {
+        Self {
+            buffer: [0; BUFFER_SIZE],
+            bytes: 0,
         }
     }
 
-    /// Create a new chunk from an existing chunk. The new chunk's buffer will be copied from the
-    /// old chunk's buffer, copying the slice `[offset..old_chunk.bytes]` into the new chunk's
-    /// buffer but starting at 0 instead of offset. If the offset is larger or equal to
-    /// `chunk.lines` then a new empty `BytesChunk` is returned.
-    ///
-    /// # Arguments
-    ///
-    /// * `chunk`: The chunk to create a new `BytesChunk` chunk from
-    /// * `offset`: Start to copy the old chunk's buffer from this position. May not be larger
-    ///             than `chunk.bytes`.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// let mut chunk = BytesChunk::new();
-    /// chunk.buffer[1] = 1;
-    /// chunk.bytes = 2;
-    /// let new_chunk = BytesChunk::from_chunk(&chunk, 0);
-    /// assert_eq!(2, new_chunk.get_buffer().len());
-    /// assert_eq!(&[0, 1], new_chunk.get_buffer());
-    ///
-    /// let new_chunk = BytesChunk::from_chunk(&chunk, 1);
-    /// assert_eq!(1, new_chunk.get_buffer().len());
-    /// assert_eq!(&[1], new_chunk.get_buffer());
-    /// ```
-    fn from_chunk(chunk: &Self, offset: usize) -> Self {
-        if offset >= chunk.bytes {
-            return Self::new();
+    /// Create a new chunk from an existing chunk. The new chunk's buffer will be copied from the
+    /// old chunk's buffer, copying the slice `[offset..old_chunk.bytes]` into the new chunk's
+    /// buffer but starting at 0 instead of offset. If the offset is larger or equal to
+    /// `chunk.lines` then a new empty `BytesChunk` is returned.
+    ///
+    /// # Arguments
+    ///
+    /// * `chunk`: The chunk to create a new `BytesChunk` chunk from
+    /// * `offset`: Start to copy the old chunk's buffer from this position. May not be larger
+    ///             than `chunk.bytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// let mut chunk = BytesChunk::new();
+    /// chunk.buffer[1] = 1;
+    /// chunk.bytes = 2;
+    /// let new_chunk = BytesChunk::from_chunk(&chunk, 0);
+    /// assert_eq!(2, new_chunk.get_buffer().len());
+    /// assert_eq!(&[0, 1], new_chunk.get_buffer());
+    ///
+    /// let new_chunk = BytesChunk::from_chunk(&chunk, 1);
+    /// assert_eq!(1, new_chunk.get_buffer().len());
+    /// assert_eq!(&[1], new_chunk.get_buffer());
+    /// ```
+    fn from_chunk(chunk: &Self, offset: usize) -> Self {
+        if offset >= chunk.bytes {
+            return Self::new();
         }
 
-        let mut buffer: ChunkBuffer = [0; BUFFER_SIZE];
-        let slice = chunk.get_buffer_with(offset);
-        buffer[..slice.len()].copy_from_slice(slice);
-        Self {
-            buffer,
-            bytes: chunk.bytes - offset,
+        let mut buffer: ChunkBuffer = [0; BUFFER_SIZE];
+        let slice = chunk.get_buffer_with(offset);
+        buffer[..slice.len()].copy_from_slice(slice);
+        Self {
+            buffer,
+            bytes: chunk.bytes - offset,
         }
     }
 
-    /// Receive the internal buffer safely, so it returns a slice only containing as many bytes as
-    /// large the `self.bytes` value is.
-    ///
-    /// returns: a slice containing the bytes of the internal buffer from `[0..self.bytes]`
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// let mut chunk = BytesChunk::new();
-    /// chunk.bytes = 1;
-    /// assert_eq!(&[0], chunk.get_buffer());
-    /// ```
-    pub fn get_buffer(&self) -> &[u8] {
-        &self.buffer[..self.bytes]
+    /// Receive the internal buffer safely, so it returns a slice only containing as many bytes as
+    /// large the `self.bytes` value is.
+    ///
+    /// returns: a slice containing the bytes of the internal buffer from `[0..self.bytes]`
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// let mut chunk = BytesChunk::new();
+    /// chunk.bytes = 1;
+    /// assert_eq!(&[0], chunk.get_buffer());
+    /// ```
+    pub fn get_buffer(&self) -> &[u8] {
+        &self.buffer[..self.bytes]
     }
 
-    /// Like [`BytesChunk::get_buffer`], but returning a slice from `[offset.self.bytes]`.
-    ///
-    /// returns: a slice containing the bytes of the internal buffer from `[offset..self.bytes]`
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// let mut chunk = BytesChunk::new();
-    /// chunk.bytes = 2;
-    /// assert_eq!(&[0], chunk.get_buffer_with(1));
-    /// ```
-    pub fn get_buffer_with(&self, offset: usize) -> &[u8] {
-        &self.buffer[offset..self.bytes]
+    /// Like [`BytesChunk::get_buffer`], but returning a slice from `[offset.self.bytes]`.
+    ///
+    /// returns: a slice containing the bytes of the internal buffer from `[offset..self.bytes]`
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// let mut chunk = BytesChunk::new();
+    /// chunk.bytes = 2;
+    /// assert_eq!(&[0], chunk.get_buffer_with(1));
+    /// ```
+    pub fn get_buffer_with(&self, offset: usize) -> &[u8] {
+        &self.buffer[offset..self.bytes]
     }
 
-    pub fn has_data(&self) -> bool {
-        self.bytes > 0
-    }
+    pub fn has_data(&self) -> bool {
+        self.bytes > 0
+    }
 
-    /// Fills `self.buffer` with maximal [`BUFFER_SIZE`] number of bytes, draining the reader by
-    /// that number of bytes. If EOF is reached (so 0 bytes are read), then returns
-    /// [`UResult<None>`] or else the result with [`Some(bytes)`] where bytes is the number of bytes
-    /// read from the source.
-    pub fn fill(&mut self, filehandle: &mut impl BufRead) -> UResult<Option<usize>> {
-        let num_bytes = filehandle.read(&mut self.buffer)?;
-        self.bytes = num_bytes;
-        if num_bytes == 0 {
-            return Ok(None);
+    /// Fills `self.buffer` with maximal [`BUFFER_SIZE`] number of bytes, draining the reader by
+    /// that number of bytes. If EOF is reached (so 0 bytes are read), then returns
+    /// [`UResult<None>`] or else the result with [`Some(bytes)`] where bytes is the number of bytes
+    /// read from the source.
+    pub fn fill(&mut self, filehandle: &mut impl BufRead) -> UResult<Option<usize>> {
+        let num_bytes = filehandle.read(&mut self.buffer)?;
+        self.bytes = num_bytes;
+        if num_bytes == 0 {
+            return Ok(None);
         }
 
-        Ok(Some(self.bytes))
+        Ok(Some(self.bytes))
     }
 }
 
-/// An abstraction layer on top of [`BytesChunk`] mainly to simplify filling only the needed amount
-/// of chunks. See also [`Self::fill`].
-pub struct BytesChunkBuffer {
-    /// The number of bytes to print
-    num_print: u64,
-    /// The current number of bytes summed over all stored chunks in [`Self::chunks`]. Use u64 here
-    /// to support files > 4GB on 32-bit systems. Note, this differs from `BytesChunk::bytes` which
-    /// is a usize. The choice of u64 is based on `tail::FilterMode::Bytes`.
-    bytes: u64,
-    /// The buffer to store [`BytesChunk`] in
-    chunks: VecDeque<Box<BytesChunk>>,
+/// An abstraction layer on top of [`BytesChunk`] mainly to simplify filling only the needed amount
+/// of chunks. See also [`Self::fill`].
+pub struct BytesChunkBuffer {
+    /// The number of bytes to print
+    num_print: u64,
+    /// The current number of bytes summed over all stored chunks in [`Self::chunks`]. Use u64 here
+    /// to support files > 4GB on 32-bit systems. Note, this differs from `BytesChunk::bytes` which
+    /// is a usize. The choice of u64 is based on `tail::FilterMode::Bytes`.
+    bytes: u64,
+    /// The buffer to store [`BytesChunk`] in
+    chunks: VecDeque<Box<BytesChunk>>,
 }
 
-impl BytesChunkBuffer {
-    /// Creates a new [`BytesChunkBuffer`].
-    ///
-    /// # Arguments
-    ///
-    /// * `num_print`: The number of bytes to print
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// let mut chunk = BytesChunk::new();
-    /// chunk.buffer[1] = 1;
-    /// chunk.bytes = 2;
-    /// let new_chunk = BytesChunk::from_chunk(&chunk, 0);
-    /// assert_eq!(2, new_chunk.get_buffer().len());
-    /// assert_eq!(&[0, 1], new_chunk.get_buffer());
-    ///
-    /// let new_chunk = BytesChunk::from_chunk(&chunk, 1);
-    /// assert_eq!(1, new_chunk.get_buffer().len());
-    /// assert_eq!(&[1], new_chunk.get_buffer());
-    /// ```
-    pub fn new(num_print: u64) -> Self {
-        Self {
-            bytes: 0,
-            num_print,
-            chunks: VecDeque::new(),
+impl BytesChunkBuffer {
+    /// Creates a new [`BytesChunkBuffer`].
+    ///
+    /// # Arguments
+    ///
+    /// * `num_print`: The number of bytes to print
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// let mut chunk = BytesChunk::new();
+    /// chunk.buffer[1] = 1;
+    /// chunk.bytes = 2;
+    /// let new_chunk = BytesChunk::from_chunk(&chunk, 0);
+    /// assert_eq!(2, new_chunk.get_buffer().len());
+    /// assert_eq!(&[0, 1], new_chunk.get_buffer());
+    ///
+    /// let new_chunk = BytesChunk::from_chunk(&chunk, 1);
+    /// assert_eq!(1, new_chunk.get_buffer().len());
+    /// assert_eq!(&[1], new_chunk.get_buffer());
+    /// ```
+    pub fn new(num_print: u64) -> Self {
+        Self {
+            bytes: 0,
+            num_print,
+            chunks: VecDeque::new(),
         }
     }
 
-    /// Fills this buffer with chunks and consumes the reader completely. This method ensures that
-    /// there are exactly as many chunks as needed to match `self.num_print` bytes, so there are
-    /// in sum exactly `self.num_print` bytes stored in all chunks. The method returns an iterator
-    /// over these chunks. If there are no chunks, for example because the piped stdin contained no
-    /// bytes, or `num_print = 0` then `iterator.next` returns None.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// use crate::chunks::BytesChunkBuffer;
-    /// use std::io::{BufReader, Cursor};
-    ///
-    /// let mut reader = BufReader::new(Cursor::new(""));
-    /// let num_print = 0;
-    /// let mut chunks = BytesChunkBuffer::new(num_print);
-    /// chunks.fill(&mut reader).unwrap();
-    ///
-    /// let mut reader = BufReader::new(Cursor::new("a"));
-    /// let num_print = 1;
-    /// let mut chunks = BytesChunkBuffer::new(num_print);
-    /// chunks.fill(&mut reader).unwrap();
-    /// ```
-    pub fn fill(&mut self, reader: &mut impl BufRead) -> UResult<()> {
-        let mut chunk = Box::new(BytesChunk::new());
+    /// Fills this buffer with chunks and consumes the reader completely. This method ensures that
+    /// there are exactly as many chunks as needed to match `self.num_print` bytes, so there are
+    /// in sum exactly `self.num_print` bytes stored in all chunks. The method returns an iterator
+    /// over these chunks. If there are no chunks, for example because the piped stdin contained no
+    /// bytes, or `num_print = 0` then `iterator.next` returns None.
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// use crate::chunks::BytesChunkBuffer;
+    /// use std::io::{BufReader, Cursor};
+    ///
+    /// let mut reader = BufReader::new(Cursor::new(""));
+    /// let num_print = 0;
+    /// let mut chunks = BytesChunkBuffer::new(num_print);
+    /// chunks.fill(&mut reader).unwrap();
+    ///
+    /// let mut reader = BufReader::new(Cursor::new("a"));
+    /// let num_print = 1;
+    /// let mut chunks = BytesChunkBuffer::new(num_print);
+    /// chunks.fill(&mut reader).unwrap();
+    /// ```
+    pub fn fill(&mut self, reader: &mut impl BufRead) -> UResult<()> {
+        let mut chunk = Box::new(BytesChunk::new());
 
-        // fill chunks with all bytes from reader and reuse already instantiated chunks if possible
-        while (chunk.fill(reader)?).is_some() {
-            self.bytes += chunk.bytes as u64;
-            self.chunks.push_back(chunk);
+        // fill chunks with all bytes from reader and reuse already instantiated chunks if possible
+        while (chunk.fill(reader)?).is_some() {
+            self.bytes += chunk.bytes as u64;
+            self.chunks.push_back(chunk);
 
-            let first = &self.chunks[0];
-            if self.bytes - first.bytes as u64 > self.num_print {
-                chunk = self.chunks.pop_front().unwrap();
-                self.bytes -= chunk.bytes as u64;
-            } else {
-                chunk = Box::new(BytesChunk::new());
+            let first = &self.chunks[0];
+            if self.bytes - first.bytes as u64 > self.num_print {
+                chunk = self.chunks.pop_front().unwrap();
+                self.bytes -= chunk.bytes as u64;
+            } else {
+                chunk = Box::new(BytesChunk::new());
             }
         }
 
-        // quit early if there are no chunks for example in case the pipe was empty
-        if self.chunks.is_empty() {
-            return Ok(());
+        // quit early if there are no chunks for example in case the pipe was empty
+        if self.chunks.is_empty() {
+            return Ok(());
         }
 
-        let chunk = self.chunks.pop_front().unwrap();
+        let chunk = self.chunks.pop_front().unwrap();
 
-        // calculate the offset in the first chunk and put the calculated chunk as first element in
-        // the self.chunks collection. The calculated offset must be in the range 0 to BUFFER_SIZE
-        // and is therefore safely convertible to a usize without losses.
-        let offset = self.bytes.saturating_sub(self.num_print) as usize;
-        self.chunks
-            .push_front(Box::new(BytesChunk::from_chunk(&chunk, offset)));
+        // calculate the offset in the first chunk and put the calculated chunk as first element in
+        // the self.chunks collection. The calculated offset must be in the range 0 to BUFFER_SIZE
+        // and is therefore safely convertible to a usize without losses.
+        let offset = self.bytes.saturating_sub(self.num_print) as usize;
+        self.chunks
+            .push_front(Box::new(BytesChunk::from_chunk(&chunk, offset)));
 
         Ok(())
     }
 
-    pub fn print(&self, mut writer: impl Write) -> UResult<()> {
-        for chunk in &self.chunks {
-            writer.write_all(chunk.get_buffer())?;
+    pub fn print(&self, mut writer: impl Write) -> UResult<()> {
+        for chunk in &self.chunks {
+            writer.write_all(chunk.get_buffer())?;
         }
         Ok(())
     }
 
-    pub fn has_data(&self) -> bool {
-        !self.chunks.is_empty()
+    pub fn has_data(&self) -> bool {
+        !self.chunks.is_empty()
     }
 }
 
-/// Works similar to a [`BytesChunk`] but also stores the number of lines encountered in the current
-/// buffer. The size of the buffer is limited to a fixed size number of bytes.
-#[derive(Debug)]
-pub struct LinesChunk {
-    /// Work on top of a [`BytesChunk`]
-    chunk: BytesChunk,
-    /// The number of lines delimited by `delimiter`. The choice of usize is sufficient here,
-    /// because lines max value is the number of bytes contained in this chunk's buffer, and the
-    /// number of bytes max value is [`BUFFER_SIZE`], which is a usize.
-    lines: usize,
-    /// The delimiter to use, to count the lines
-    delimiter: u8,
+/// Works similar to a [`BytesChunk`] but also stores the number of lines encountered in the current
+/// buffer. The size of the buffer is limited to a fixed size number of bytes.
+#[derive(Debug)]
+pub struct LinesChunk {
+    /// Work on top of a [`BytesChunk`]
+    chunk: BytesChunk,
+    /// The number of lines delimited by `delimiter`. The choice of usize is sufficient here,
+    /// because lines max value is the number of bytes contained in this chunk's buffer, and the
+    /// number of bytes max value is [`BUFFER_SIZE`], which is a usize.
+    lines: usize,
+    /// The delimiter to use, to count the lines
+    delimiter: u8,
 }
 
-impl LinesChunk {
-    pub fn new(delimiter: u8) -> Self {
-        Self {
-            chunk: BytesChunk::new(),
-            lines: 0,
-            delimiter,
+impl LinesChunk {
+    pub fn new(delimiter: u8) -> Self {
+        Self {
+            chunk: BytesChunk::new(),
+            lines: 0,
+            delimiter,
         }
     }
 
-    /// Count the number of lines delimited with [`Self::delimiter`] contained in the buffer.
-    /// Currently [`memchr`] is used because performance is better than using an iterator or for
-    /// loop.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// let mut chunk = LinesChunk::new(b'\n');
-    /// chunk.buffer[0..12].copy_from_slice("hello\nworld\n".as_bytes());
-    /// chunk.bytes = 12;
-    /// assert_eq!(2, chunk.count_lines());
-    ///
-    /// chunk.buffer[0..14].copy_from_slice("hello\r\nworld\r\n".as_bytes());
-    /// chunk.bytes = 14;
-    /// assert_eq!(2, chunk.count_lines());
-    /// ```
-    fn count_lines(&self) -> usize {
-        memchr::memchr_iter(self.delimiter, self.get_buffer()).count()
+    /// Count the number of lines delimited with [`Self::delimiter`] contained in the buffer.
+    /// Currently [`memchr`] is used because performance is better than using an iterator or for
+    /// loop.
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// let mut chunk = LinesChunk::new(b'\n');
+    /// chunk.buffer[0..12].copy_from_slice("hello\nworld\n".as_bytes());
+    /// chunk.bytes = 12;
+    /// assert_eq!(2, chunk.count_lines());
+    ///
+    /// chunk.buffer[0..14].copy_from_slice("hello\r\nworld\r\n".as_bytes());
+    /// chunk.bytes = 14;
+    /// assert_eq!(2, chunk.count_lines());
+    /// ```
+    fn count_lines(&self) -> usize {
+        memchr::memchr_iter(self.delimiter, self.get_buffer()).count()
     }
 
-    /// Creates a new [`LinesChunk`] from an existing one with an offset in lines. The new chunk
-    /// contains exactly `chunk.lines - offset` lines. The offset in bytes is calculated and applied
-    /// to the new chunk, so the new chunk contains only the bytes encountered after the offset in
-    /// number of lines and the `delimiter`. If the offset is larger than `chunk.lines` then a new
-    /// empty `LinesChunk` is returned.
-    ///
-    /// # Arguments
-    ///
-    /// * `chunk`: The chunk to create the new chunk from
-    /// * `offset`: The offset in number of lines (not bytes)
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// let mut chunk = LinesChunk::new(b'\n');
-    /// // manually filling the buffer and setting the correct values for bytes and lines
-    /// chunk.buffer[0..12].copy_from_slice("hello\nworld\n".as_bytes());
-    /// chunk.bytes = 12;
-    /// chunk.lines = 2;
-    ///
-    /// let offset = 1; // offset in number of lines
-    /// let new_chunk = LinesChunk::from(&chunk, offset);
-    /// assert_eq!("world\n".as_bytes(), new_chunk.get_buffer());
-    /// assert_eq!(6, new_chunk.bytes);
-    /// assert_eq!(1, new_chunk.lines);
-    /// ```
-    fn from_chunk(chunk: &Self, offset: usize) -> Self {
-        if offset > chunk.lines {
-            return Self::new(chunk.delimiter);
+    /// Creates a new [`LinesChunk`] from an existing one with an offset in lines. The new chunk
+    /// contains exactly `chunk.lines - offset` lines. The offset in bytes is calculated and applied
+    /// to the new chunk, so the new chunk contains only the bytes encountered after the offset in
+    /// number of lines and the `delimiter`. If the offset is larger than `chunk.lines` then a new
+    /// empty `LinesChunk` is returned.
+    ///
+    /// # Arguments
+    ///
+    /// * `chunk`: The chunk to create the new chunk from
+    /// * `offset`: The offset in number of lines (not bytes)
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// let mut chunk = LinesChunk::new(b'\n');
+    /// // manually filling the buffer and setting the correct values for bytes and lines
+    /// chunk.buffer[0..12].copy_from_slice("hello\nworld\n".as_bytes());
+    /// chunk.bytes = 12;
+    /// chunk.lines = 2;
+    ///
+    /// let offset = 1; // offset in number of lines
+    /// let new_chunk = LinesChunk::from(&chunk, offset);
+    /// assert_eq!("world\n".as_bytes(), new_chunk.get_buffer());
+    /// assert_eq!(6, new_chunk.bytes);
+    /// assert_eq!(1, new_chunk.lines);
+    /// ```
+    fn from_chunk(chunk: &Self, offset: usize) -> Self {
+        if offset > chunk.lines {
+            return Self::new(chunk.delimiter);
         }
 
-        let bytes_offset = chunk.calculate_bytes_offset_from(offset);
-        let new_chunk = BytesChunk::from_chunk(&chunk.chunk, bytes_offset);
+        let bytes_offset = chunk.calculate_bytes_offset_from(offset);
+        let new_chunk = BytesChunk::from_chunk(&chunk.chunk, bytes_offset);
 
-        Self {
-            chunk: new_chunk,
-            lines: chunk.lines - offset,
-            delimiter: chunk.delimiter,
+        Self {
+            chunk: new_chunk,
+            lines: chunk.lines - offset,
+            delimiter: chunk.delimiter,
         }
     }
 
-    /// Returns true if this buffer has stored any bytes.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// let mut chunk = LinesChunk::new(b'\n');
-    /// assert!(!chunk.has_data());
-    ///
-    /// chunk.buffer[0] = 1;
-    /// assert!(!chunk.has_data());
-    ///
-    /// chunk.bytes = 1;
-    /// assert!(chunk.has_data());
-    /// ```
-    pub fn has_data(&self) -> bool {
-        self.chunk.has_data()
+    /// Returns true if this buffer has stored any bytes.
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// let mut chunk = LinesChunk::new(b'\n');
+    /// assert!(!chunk.has_data());
+    ///
+    /// chunk.buffer[0] = 1;
+    /// assert!(!chunk.has_data());
+    ///
+    /// chunk.bytes = 1;
+    /// assert!(chunk.has_data());
+    /// ```
+    pub fn has_data(&self) -> bool {
+        self.chunk.has_data()
     }
 
-    /// Returns this buffer safely. See [`BytesChunk::get_buffer`]
-    ///
-    /// returns: &[u8] with length `self.bytes`
-    pub fn get_buffer(&self) -> &[u8] {
-        self.chunk.get_buffer()
+    /// Returns this buffer safely. See [`BytesChunk::get_buffer`]
+    ///
+    /// returns: &[u8] with length `self.bytes`
+    pub fn get_buffer(&self) -> &[u8] {
+        self.chunk.get_buffer()
     }
 
-    /// Returns this buffer safely with an offset applied. See [`BytesChunk::get_buffer_with`].
-    ///
-    /// returns: &[u8] with length `self.bytes - offset`
-    pub fn get_buffer_with(&self, offset: usize) -> &[u8] {
-        self.chunk.get_buffer_with(offset)
+    /// Returns this buffer safely with an offset applied. See [`BytesChunk::get_buffer_with`].
+    ///
+    /// returns: &[u8] with length `self.bytes - offset`
+    pub fn get_buffer_with(&self, offset: usize) -> &[u8] {
+        self.chunk.get_buffer_with(offset)
     }
 
-    /// Return the number of lines the buffer contains. `self.lines` needs to be set before the call
-    /// to this function returns the correct value. If the calculation of lines is needed then
-    /// use `self.count_lines`.
-    pub fn get_lines(&self) -> usize {
-        self.lines
+    /// Return the number of lines the buffer contains. `self.lines` needs to be set before the call
+    /// to this function returns the correct value. If the calculation of lines is needed then
+    /// use `self.count_lines`.
+    pub fn get_lines(&self) -> usize {
+        self.lines
     }
 
-    /// Fills `self.buffer` with maximal [`BUFFER_SIZE`] number of bytes, draining the reader by
-    /// that number of bytes. This function works like the [`BytesChunk::fill`] function besides
-    /// that this function also counts and stores the number of lines encountered while reading from
-    /// the `filehandle`.
-    pub fn fill(&mut self, filehandle: &mut impl BufRead) -> UResult<Option<usize>> {
-        match self.chunk.fill(filehandle)? {
-            None => {
-                self.lines = 0;
+    /// Fills `self.buffer` with maximal [`BUFFER_SIZE`] number of bytes, draining the reader by
+    /// that number of bytes. This function works like the [`BytesChunk::fill`] function besides
+    /// that this function also counts and stores the number of lines encountered while reading from
+    /// the `filehandle`.
+    pub fn fill(&mut self, filehandle: &mut impl BufRead) -> UResult<Option<usize>> {
+        match self.chunk.fill(filehandle)? {
+            None => {
+                self.lines = 0;
                 Ok(None)
             }
-            Some(bytes) => {
-                self.lines = self.count_lines();
-                Ok(Some(bytes))
+            Some(bytes) => {
+                self.lines = self.count_lines();
+                Ok(Some(bytes))
             }
         }
     }
 
-    /// Calculates the offset in bytes within this buffer from the offset in number of lines. The
-    /// resulting offset is 0-based and points to the byte after the delimiter.
-    ///
-    /// # Arguments
-    ///
-    /// * `offset`: the offset in number of lines. If offset is 0 then 0 is returned, if larger than
-    ///             the contained lines then self.bytes is returned.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore
-    /// let mut chunk = LinesChunk::new(b'\n');
-    /// chunk.buffer[0..12].copy_from_slice("hello\nworld\n".as_bytes());
-    /// chunk.bytes = 12;
-    /// chunk.lines = 2; // note that if not setting lines the result might not be what is expected
-    /// let bytes_offset = chunk.calculate_bytes_offset_from(1);
-    /// assert_eq!(6, bytes_offset);
-    /// assert_eq!(
-    ///     "world\n",
-    ///     String::from_utf8_lossy(chunk.get_buffer_with(bytes_offset)));
-    /// ```
-    fn calculate_bytes_offset_from(&self, offset: usize) -> usize {
-        let mut lines_offset = offset;
-        let mut bytes_offset = 0;
-        for byte in self.get_buffer().iter() {
-            if lines_offset == 0 {
+    /// Calculates the offset in bytes within this buffer from the offset in number of lines. The
+    /// resulting offset is 0-based and points to the byte after the delimiter.
+    ///
+    /// # Arguments
+    ///
+    /// * `offset`: the offset in number of lines. If offset is 0 then 0 is returned, if larger than
+    ///             the contained lines then self.bytes is returned.
+    ///
+    /// # Examples
+    ///
+    /// ```rust,ignore
+    /// let mut chunk = LinesChunk::new(b'\n');
+    /// chunk.buffer[0..12].copy_from_slice("hello\nworld\n".as_bytes());
+    /// chunk.bytes = 12;
+    /// chunk.lines = 2; // note that if not setting lines the result might not be what is expected
+    /// let bytes_offset = chunk.calculate_bytes_offset_from(1);
+    /// assert_eq!(6, bytes_offset);
+    /// assert_eq!(
+    ///     "world\n",
+    ///     String::from_utf8_lossy(chunk.get_buffer_with(bytes_offset)));
+    /// ```
+    fn calculate_bytes_offset_from(&self, offset: usize) -> usize {
+        let mut lines_offset = offset;
+        let mut bytes_offset = 0;
+        for byte in self.get_buffer().iter() {
+            if lines_offset == 0 {
                 break;
             }
-            if byte == &self.delimiter {
-                lines_offset -= 1;
+            if byte == &self.delimiter {
+                lines_offset -= 1;
             }
-            bytes_offset += 1;
+            bytes_offset += 1;
         }
-        bytes_offset
+        bytes_offset
     }
 
-    /// Print the bytes contained in this buffer calculated with the given offset in number of
-    /// lines.
-    ///
-    /// # Arguments
-    ///
-    /// * `writer`: must implement [`Write`]
-    /// * `offset`: An offset in number of lines.
-    pub fn print_lines(&self, writer: &mut impl Write, offset: usize) -> UResult<()> {
-        self.print_bytes(writer, self.calculate_bytes_offset_from(offset))
+    /// Print the bytes contained in this buffer calculated with the given offset in number of
+    /// lines.
+    ///
+    /// # Arguments
+    ///
+    /// * `writer`: must implement [`Write`]
+    /// * `offset`: An offset in number of lines.
+    pub fn print_lines(&self, writer: &mut impl Write, offset: usize) -> UResult<()> {
+        self.print_bytes(writer, self.calculate_bytes_offset_from(offset))
     }
 
-    /// Print the bytes contained in this buffer beginning from the given offset in number of bytes.
-    ///
-    /// # Arguments
-    ///
-    /// * `writer`: must implement [`Write`]
-    /// * `offset`: An offset in number of bytes.
-    pub fn print_bytes(&self, writer: &mut impl Write, offset: usize) -> UResult<()> {
-        writer.write_all(self.get_buffer_with(offset))?;
+    /// Print the bytes contained in this buffer beginning from the given offset in number of bytes.
+    ///
+    /// # Arguments
+    ///
+    /// * `writer`: must implement [`Write`]
+    /// * `offset`: An offset in number of bytes.
+    pub fn print_bytes(&self, writer: &mut impl Write, offset: usize) -> UResult<()> {
+        writer.write_all(self.get_buffer_with(offset))?;
         Ok(())
     }
 }
 
-/// An abstraction layer on top of [`LinesChunk`] mainly to simplify filling only the needed amount
-/// of chunks. See also [`Self::fill`]. Works similar like [`BytesChunkBuffer`], but works on top
-/// of lines delimited by `self.delimiter` instead of bytes.
-pub struct LinesChunkBuffer {
-    /// The delimiter to recognize a line. Any [`u8`] is allowed.
-    delimiter: u8,
-    /// The amount of lines occurring in all currently stored [`LinesChunk`]s. Use u64 here to
-    /// support files > 4GB on 32-bit systems. Note, this differs from [`LinesChunk::lines`] which
-    /// is a usize. The choice of u64 is based on `tail::FilterMode::Lines`.
-    lines: u64,
-    /// The amount of lines to print.
-    num_print: u64,
-    /// Stores the [`LinesChunk`]
-    chunks: VecDeque<Box<LinesChunk>>,
+/// An abstraction layer on top of [`LinesChunk`] mainly to simplify filling only the needed amount
+/// of chunks. See also [`Self::fill`]. Works similar like [`BytesChunkBuffer`], but works on top
+/// of lines delimited by `self.delimiter` instead of bytes.
+pub struct LinesChunkBuffer {
+    /// The delimiter to recognize a line. Any [`u8`] is allowed.
+    delimiter: u8,
+    /// The amount of lines occurring in all currently stored [`LinesChunk`]s. Use u64 here to
+    /// support files > 4GB on 32-bit systems. Note, this differs from [`LinesChunk::lines`] which
+    /// is a usize. The choice of u64 is based on `tail::FilterMode::Lines`.
+    lines: u64,
+    /// The amount of lines to print.
+    num_print: u64,
+    /// Stores the [`LinesChunk`]
+    chunks: VecDeque<Box<LinesChunk>>,
 }
 
-impl LinesChunkBuffer {
-    /// Create a new [`LinesChunkBuffer`]
-    pub fn new(delimiter: u8, num_print: u64) -> Self {
-        Self {
-            delimiter,
-            num_print,
-            lines: 0,
-            chunks: VecDeque::new(),
+impl LinesChunkBuffer {
+    /// Create a new [`LinesChunkBuffer`]
+    pub fn new(delimiter: u8, num_print: u64) -> Self {
+        Self {
+            delimiter,
+            num_print,
+            lines: 0,
+            chunks: VecDeque::new(),
         }
     }
 
-    /// Fills this buffer with chunks and consumes the reader completely. This method ensures that
-    /// there are exactly as many chunks as needed to match `self.num_print` lines, so there are
-    /// in sum exactly `self.num_print` lines stored in all chunks. The method returns an iterator
-    /// over these chunks. If there are no chunks, for example because the piped stdin contained no
-    /// lines, or `num_print = 0` then `iterator.next` will return None.
-    pub fn fill(&mut self, reader: &mut impl BufRead) -> UResult<()> {
-        let mut chunk = Box::new(LinesChunk::new(self.delimiter));
+    /// Fills this buffer with chunks and consumes the reader completely. This method ensures that
+    /// there are exactly as many chunks as needed to match `self.num_print` lines, so there are
+    /// in sum exactly `self.num_print` lines stored in all chunks. The method returns an iterator
+    /// over these chunks. If there are no chunks, for example because the piped stdin contained no
+    /// lines, or `num_print = 0` then `iterator.next` will return None.
+    pub fn fill(&mut self, reader: &mut impl BufRead) -> UResult<()> {
+        let mut chunk = Box::new(LinesChunk::new(self.delimiter));
 
-        while (chunk.fill(reader)?).is_some() {
-            self.lines += chunk.lines as u64;
-            self.chunks.push_back(chunk);
+        while (chunk.fill(reader)?).is_some() {
+            self.lines += chunk.lines as u64;
+            self.chunks.push_back(chunk);
 
-            let first = &self.chunks[0];
-            if self.lines - first.lines as u64 > self.num_print {
-                chunk = self.chunks.pop_front().unwrap();
+            let first = &self.chunks[0];
+            if self.lines - first.lines as u64 > self.num_print {
+                chunk = self.chunks.pop_front().unwrap();
 
-                self.lines -= chunk.lines as u64;
-            } else {
-                chunk = Box::new(LinesChunk::new(self.delimiter));
+                self.lines -= chunk.lines as u64;
+            } else {
+                chunk = Box::new(LinesChunk::new(self.delimiter));
             }
         }
 
-        if !&self.chunks.is_empty() {
-            let length = &self.chunks.len();
-            let last = &mut self.chunks[length - 1];
-            if !last.get_buffer().ends_with(&[self.delimiter]) {
-                last.lines += 1;
-                self.lines += 1;
+        if !&self.chunks.is_empty() {
+            let length = &self.chunks.len();
+            let last = &mut self.chunks[length - 1];
+            if !last.get_buffer().ends_with(&[self.delimiter]) {
+                last.lines += 1;
+                self.lines += 1;
             }
-        } else {
-            // chunks is empty when a file is empty so quitting early here
-            return Ok(());
+        } else {
+            // chunks is empty when a file is empty so quitting early here
+            return Ok(());
         }
 
-        // skip unnecessary chunks and save the first chunk which may hold some lines we have to
-        // print
-        let chunk = loop {
-            // it's safe to call unwrap here because there is at least one chunk and sorting out
-            // more chunks than exist shouldn't be possible.
-            let chunk = self.chunks.pop_front().unwrap();
+        // skip unnecessary chunks and save the first chunk which may hold some lines we have to
+        // print
+        let chunk = loop {
+            // it's safe to call unwrap here because there is at least one chunk and sorting out
+            // more chunks than exist shouldn't be possible.
+            let chunk = self.chunks.pop_front().unwrap();
 
-            // skip is true as long there are enough lines left in the other stored chunks.
-            let skip = self.lines - chunk.lines as u64 > self.num_print;
-            if skip {
-                self.lines -= chunk.lines as u64;
-            } else {
-                break chunk;
+            // skip is true as long there are enough lines left in the other stored chunks.
+            let skip = self.lines - chunk.lines as u64 > self.num_print;
+            if skip {
+                self.lines -= chunk.lines as u64;
+            } else {
+                break chunk;
             }
         };
 
-        // Calculate the number of lines to skip in the current chunk. The calculated value must be
-        // in the range 0 to BUFFER_SIZE and is therefore safely convertible to a usize without
-        // losses.
-        let skip_lines = self.lines.saturating_sub(self.num_print) as usize;
-        let chunk = LinesChunk::from_chunk(&chunk, skip_lines);
-        self.chunks.push_front(Box::new(chunk));
+        // Calculate the number of lines to skip in the current chunk. The calculated value must be
+        // in the range 0 to BUFFER_SIZE and is therefore safely convertible to a usize without
+        // losses.
+        let skip_lines = self.lines.saturating_sub(self.num_print) as usize;
+        let chunk = LinesChunk::from_chunk(&chunk, skip_lines);
+        self.chunks.push_front(Box::new(chunk));
 
         Ok(())
     }
 
-    pub fn print(&self, mut writer: impl Write) -> UResult<()> {
-        for chunk in &self.chunks {
-            chunk.print_bytes(&mut writer, 0)?;
+    pub fn print(&self, mut writer: impl Write) -> UResult<()> {
+        for chunk in &self.chunks {
+            chunk.print_bytes(&mut writer, 0)?;
         }
         Ok(())
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::chunks::{BytesChunk, BUFFER_SIZE};
+#[cfg(test)]
+mod tests {
+    use crate::chunks::{BytesChunk, BUFFER_SIZE};
 
-    #[test]
-    fn test_bytes_chunk_from_when_offset_is_zero() {
-        let mut chunk = BytesChunk::new();
-        chunk.bytes = BUFFER_SIZE;
-        chunk.buffer[1] = 1;
-        let other = BytesChunk::from_chunk(&chunk, 0);
-        assert_eq!(other, chunk);
+    #[test]
+    fn test_bytes_chunk_from_when_offset_is_zero() {
+        let mut chunk = BytesChunk::new();
+        chunk.bytes = BUFFER_SIZE;
+        chunk.buffer[1] = 1;
+        let other = BytesChunk::from_chunk(&chunk, 0);
+        assert_eq!(other, chunk);
 
-        chunk.bytes = 2;
-        let other = BytesChunk::from_chunk(&chunk, 0);
-        assert_eq!(other, chunk);
+        chunk.bytes = 2;
+        let other = BytesChunk::from_chunk(&chunk, 0);
+        assert_eq!(other, chunk);
 
-        chunk.bytes = 1;
-        let other = BytesChunk::from_chunk(&chunk, 0);
-        assert_eq!(other.buffer, [0; BUFFER_SIZE]);
-        assert_eq!(other.bytes, chunk.bytes);
+        chunk.bytes = 1;
+        let other = BytesChunk::from_chunk(&chunk, 0);
+        assert_eq!(other.buffer, [0; BUFFER_SIZE]);
+        assert_eq!(other.bytes, chunk.bytes);
 
-        chunk.bytes = BUFFER_SIZE;
-        let other = BytesChunk::from_chunk(&chunk, 2);
-        assert_eq!(other.buffer, [0; BUFFER_SIZE]);
-        assert_eq!(other.bytes, BUFFER_SIZE - 2);
+        chunk.bytes = BUFFER_SIZE;
+        let other = BytesChunk::from_chunk(&chunk, 2);
+        assert_eq!(other.buffer, [0; BUFFER_SIZE]);
+        assert_eq!(other.bytes, BUFFER_SIZE - 2);
     }
 
-    #[test]
-    fn test_bytes_chunk_from_when_offset_is_not_zero() {
-        let mut chunk = BytesChunk::new();
-        chunk.bytes = BUFFER_SIZE;
-        chunk.buffer[1] = 1;
+    #[test]
+    fn test_bytes_chunk_from_when_offset_is_not_zero() {
+        let mut chunk = BytesChunk::new();
+        chunk.bytes = BUFFER_SIZE;
+        chunk.buffer[1] = 1;
 
-        let other = BytesChunk::from_chunk(&chunk, 1);
-        let mut expected_buffer = [0; BUFFER_SIZE];
-        expected_buffer[0] = 1;
-        assert_eq!(other.buffer, expected_buffer);
-        assert_eq!(other.bytes, BUFFER_SIZE - 1);
+        let other = BytesChunk::from_chunk(&chunk, 1);
+        let mut expected_buffer = [0; BUFFER_SIZE];
+        expected_buffer[0] = 1;
+        assert_eq!(other.buffer, expected_buffer);
+        assert_eq!(other.bytes, BUFFER_SIZE - 1);
 
-        let other = BytesChunk::from_chunk(&chunk, 2);
-        assert_eq!(other.buffer, [0; BUFFER_SIZE]);
-        assert_eq!(other.bytes, BUFFER_SIZE - 2);
+        let other = BytesChunk::from_chunk(&chunk, 2);
+        assert_eq!(other.buffer, [0; BUFFER_SIZE]);
+        assert_eq!(other.bytes, BUFFER_SIZE - 2);
     }
 
-    #[test]
-    fn test_bytes_chunk_from_when_offset_is_larger_than_chunk_size_1() {
-        let mut chunk = BytesChunk::new();
-        chunk.bytes = BUFFER_SIZE;
-        let new_chunk = BytesChunk::from_chunk(&chunk, BUFFER_SIZE + 1);
-        assert_eq!(0, new_chunk.bytes);
+    #[test]
+    fn test_bytes_chunk_from_when_offset_is_larger_than_chunk_size_1() {
+        let mut chunk = BytesChunk::new();
+        chunk.bytes = BUFFER_SIZE;
+        let new_chunk = BytesChunk::from_chunk(&chunk, BUFFER_SIZE + 1);
+        assert_eq!(0, new_chunk.bytes);
     }
 
-    #[test]
-    fn test_bytes_chunk_from_when_offset_is_larger_than_chunk_size_2() {
-        let mut chunk = BytesChunk::new();
-        chunk.bytes = 0;
-        let new_chunk = BytesChunk::from_chunk(&chunk, 1);
-        assert_eq!(0, new_chunk.bytes);
+    #[test]
+    fn test_bytes_chunk_from_when_offset_is_larger_than_chunk_size_2() {
+        let mut chunk = BytesChunk::new();
+        chunk.bytes = 0;
+        let new_chunk = BytesChunk::from_chunk(&chunk, 1);
+        assert_eq!(0, new_chunk.bytes);
     }
 
-    #[test]
-    fn test_bytes_chunk_from_when_offset_is_larger_than_chunk_size_3() {
-        let mut chunk = BytesChunk::new();
-        chunk.bytes = 1;
-        let new_chunk = BytesChunk::from_chunk(&chunk, 2);
-        assert_eq!(0, new_chunk.bytes);
+    #[test]
+    fn test_bytes_chunk_from_when_offset_is_larger_than_chunk_size_3() {
+        let mut chunk = BytesChunk::new();
+        chunk.bytes = 1;
+        let new_chunk = BytesChunk::from_chunk(&chunk, 2);
+        assert_eq!(0, new_chunk.bytes);
     }
 
-    #[test]
-    fn test_bytes_chunk_from_when_offset_is_equal_to_chunk_size() {
-        let mut chunk = BytesChunk::new();
-        chunk.buffer[0] = 1;
-        chunk.bytes = 1;
-        let new_chunk = BytesChunk::from_chunk(&chunk, 1);
-        assert_eq!(0, new_chunk.bytes);
+    #[test]
+    fn test_bytes_chunk_from_when_offset_is_equal_to_chunk_size() {
+        let mut chunk = BytesChunk::new();
+        chunk.buffer[0] = 1;
+        chunk.bytes = 1;
+        let new_chunk = BytesChunk::from_chunk(&chunk, 1);
+        assert_eq!(0, new_chunk.bytes);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/follow/files.rs.html b/dev/src/uu_tail/follow/files.rs.html index f8028515a..238393dee 100644 --- a/dev/src/uu_tail/follow/files.rs.html +++ b/dev/src/uu_tail/follow/files.rs.html @@ -1,4 +1,4 @@ -files.rs - source
1
+files.rs - source
1
 2
 3
 4
@@ -209,216 +209,216 @@
 209
 210
 211
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore tailable seekable stdlib (stdlib)
+// spell-checker:ignore tailable seekable stdlib (stdlib)
 
-use crate::args::Settings;
-use crate::chunks::BytesChunkBuffer;
-use crate::paths::{HeaderPrinter, PathExtTail};
-use crate::text;
-use std::collections::hash_map::Keys;
-use std::collections::HashMap;
-use std::fs::{File, Metadata};
-use std::io::{stdout, BufRead, BufReader, BufWriter};
+use crate::args::Settings;
+use crate::chunks::BytesChunkBuffer;
+use crate::paths::{HeaderPrinter, PathExtTail};
+use crate::text;
+use std::collections::hash_map::Keys;
+use std::collections::HashMap;
+use std::fs::{File, Metadata};
+use std::io::{stdout, BufRead, BufReader, BufWriter};
 
-use std::path::{Path, PathBuf};
-use uucore::error::UResult;
+use std::path::{Path, PathBuf};
+use uucore::error::UResult;
 
-/// Data structure to keep a handle on files to follow.
-/// `last` always holds the path/key of the last file that was printed from.
-/// The keys of the HashMap can point to an existing file path (normal case),
-/// or stdin ("-"), or to a non existing path (--retry).
-/// For existing files, all keys in the HashMap are absolute Paths.
-pub struct FileHandling {
-    map: HashMap<PathBuf, PathData>,
-    last: Option<PathBuf>,
-    header_printer: HeaderPrinter,
+/// Data structure to keep a handle on files to follow.
+/// `last` always holds the path/key of the last file that was printed from.
+/// The keys of the HashMap can point to an existing file path (normal case),
+/// or stdin ("-"), or to a non existing path (--retry).
+/// For existing files, all keys in the HashMap are absolute Paths.
+pub struct FileHandling {
+    map: HashMap<PathBuf, PathData>,
+    last: Option<PathBuf>,
+    header_printer: HeaderPrinter,
 }
 
-impl FileHandling {
-    pub fn from(settings: &Settings) -> Self {
-        Self {
-            map: HashMap::with_capacity(settings.inputs.len()),
-            last: None,
-            header_printer: HeaderPrinter::new(settings.verbose, false),
+impl FileHandling {
+    pub fn from(settings: &Settings) -> Self {
+        Self {
+            map: HashMap::with_capacity(settings.inputs.len()),
+            last: None,
+            header_printer: HeaderPrinter::new(settings.verbose, false),
         }
     }
 
-    /// Wrapper for HashMap::insert using Path::canonicalize
-    pub fn insert(&mut self, k: &Path, v: PathData, update_last: bool) {
-        let k = Self::canonicalize_path(k);
-        if update_last {
-            self.last = Some(k.to_owned());
+    /// Wrapper for HashMap::insert using Path::canonicalize
+    pub fn insert(&mut self, k: &Path, v: PathData, update_last: bool) {
+        let k = Self::canonicalize_path(k);
+        if update_last {
+            self.last = Some(k.to_owned());
         }
-        let _ = self.map.insert(k, v);
+        let _ = self.map.insert(k, v);
     }
 
-    /// Wrapper for HashMap::remove using Path::canonicalize
-    pub fn remove(&mut self, k: &Path) -> PathData {
-        self.map.remove(&Self::canonicalize_path(k)).unwrap()
+    /// Wrapper for HashMap::remove using Path::canonicalize
+    pub fn remove(&mut self, k: &Path) -> PathData {
+        self.map.remove(&Self::canonicalize_path(k)).unwrap()
     }
 
-    /// Wrapper for HashMap::get using Path::canonicalize
-    pub fn get(&self, k: &Path) -> &PathData {
-        self.map.get(&Self::canonicalize_path(k)).unwrap()
+    /// Wrapper for HashMap::get using Path::canonicalize
+    pub fn get(&self, k: &Path) -> &PathData {
+        self.map.get(&Self::canonicalize_path(k)).unwrap()
     }
 
-    /// Wrapper for HashMap::get_mut using Path::canonicalize
-    pub fn get_mut(&mut self, k: &Path) -> &mut PathData {
-        self.map.get_mut(&Self::canonicalize_path(k)).unwrap()
+    /// Wrapper for HashMap::get_mut using Path::canonicalize
+    pub fn get_mut(&mut self, k: &Path) -> &mut PathData {
+        self.map.get_mut(&Self::canonicalize_path(k)).unwrap()
     }
 
-    /// Canonicalize `path` if it is not already an absolute path
-    fn canonicalize_path(path: &Path) -> PathBuf {
-        if path.is_relative() && !path.is_stdin() {
-            if let Ok(p) = path.canonicalize() {
-                return p;
+    /// Canonicalize `path` if it is not already an absolute path
+    fn canonicalize_path(path: &Path) -> PathBuf {
+        if path.is_relative() && !path.is_stdin() {
+            if let Ok(p) = path.canonicalize() {
+                return p;
             }
         }
-        path.to_owned()
+        path.to_owned()
     }
 
-    pub fn get_mut_metadata(&mut self, path: &Path) -> Option<&Metadata> {
-        self.get_mut(path).metadata.as_ref()
+    pub fn get_mut_metadata(&mut self, path: &Path) -> Option<&Metadata> {
+        self.get_mut(path).metadata.as_ref()
     }
 
-    pub fn keys(&self) -> Keys<PathBuf, PathData> {
-        self.map.keys()
+    pub fn keys(&self) -> Keys<PathBuf, PathData> {
+        self.map.keys()
     }
 
-    pub fn contains_key(&self, k: &Path) -> bool {
-        self.map.contains_key(k)
+    pub fn contains_key(&self, k: &Path) -> bool {
+        self.map.contains_key(k)
     }
 
-    pub fn get_last(&self) -> Option<&PathBuf> {
-        self.last.as_ref()
+    pub fn get_last(&self) -> Option<&PathBuf> {
+        self.last.as_ref()
     }
 
-    /// Return true if there is only stdin remaining
-    pub fn only_stdin_remaining(&self) -> bool {
-        self.map.len() == 1 && (self.map.contains_key(Path::new(text::DASH)))
+    /// Return true if there is only stdin remaining
+    pub fn only_stdin_remaining(&self) -> bool {
+        self.map.len() == 1 && (self.map.contains_key(Path::new(text::DASH)))
     }
 
-    /// Return true if there is at least one "tailable" path (or stdin) remaining
-    pub fn files_remaining(&self) -> bool {
-        for path in self.map.keys() {
-            if path.is_tailable() || path.is_stdin() {
-                return true;
+    /// Return true if there is at least one "tailable" path (or stdin) remaining
+    pub fn files_remaining(&self) -> bool {
+        for path in self.map.keys() {
+            if path.is_tailable() || path.is_stdin() {
+                return true;
             }
         }
-        false
+        false
+    }
+
+    /// Returns true if there are no files remaining
+    pub fn no_files_remaining(&self, settings: &Settings) -> bool {
+        self.map.is_empty() || !self.files_remaining() && !settings.retry
     }
 
-    /// Returns true if there are no files remaining
-    pub fn no_files_remaining(&self, settings: &Settings) -> bool {
-        self.map.is_empty() || !self.files_remaining() && !settings.retry
+    /// Set `reader` to None to indicate that `path` is not an existing file anymore.
+    pub fn reset_reader(&mut self, path: &Path) {
+        self.get_mut(path).reader = None;
     }
 
-    /// Set `reader` to None to indicate that `path` is not an existing file anymore.
-    pub fn reset_reader(&mut self, path: &Path) {
-        self.get_mut(path).reader = None;
-    }
-
-    /// Reopen the file at the monitored `path`
-    pub fn update_reader(&mut self, path: &Path) -> UResult<()> {
+    /// Reopen the file at the monitored `path`
+    pub fn update_reader(&mut self, path: &Path) -> UResult<()> {
         /*
         BUG: If it's not necessary to reopen a file, GNU's tail calls seek to offset 0.
         However we can't call seek here because `BufRead` does not implement `Seek`.
         As a workaround we always reopen the file even though this might not always
         be necessary.
-        */
-        self.get_mut(path)
-            .reader
-            .replace(Box::new(BufReader::new(File::open(path)?)));
+        */
+        self.get_mut(path)
+            .reader
+            .replace(Box::new(BufReader::new(File::open(path)?)));
         Ok(())
     }
 
-    /// Reload metadata from `path`, or `metadata`
-    pub fn update_metadata(&mut self, path: &Path, metadata: Option<Metadata>) {
-        self.get_mut(path).metadata = if metadata.is_some() {
-            metadata
-        } else {
-            path.metadata().ok()
+    /// Reload metadata from `path`, or `metadata`
+    pub fn update_metadata(&mut self, path: &Path, metadata: Option<Metadata>) {
+        self.get_mut(path).metadata = if metadata.is_some() {
+            metadata
+        } else {
+            path.metadata().ok()
         };
     }
 
-    /// Read new data from `path` and print it to stdout
-    pub fn tail_file(&mut self, path: &Path, verbose: bool) -> UResult<bool> {
-        let mut chunks = BytesChunkBuffer::new(u64::MAX);
-        if let Some(reader) = self.get_mut(path).reader.as_mut() {
-            chunks.fill(reader)?;
+    /// Read new data from `path` and print it to stdout
+    pub fn tail_file(&mut self, path: &Path, verbose: bool) -> UResult<bool> {
+        let mut chunks = BytesChunkBuffer::new(u64::MAX);
+        if let Some(reader) = self.get_mut(path).reader.as_mut() {
+            chunks.fill(reader)?;
         }
-        if chunks.has_data() {
-            if self.needs_header(path, verbose) {
-                let display_name = self.get(path).display_name.clone();
-                self.header_printer.print(display_name.as_str());
+        if chunks.has_data() {
+            if self.needs_header(path, verbose) {
+                let display_name = self.get(path).display_name.clone();
+                self.header_printer.print(display_name.as_str());
             }
 
-            let stdout = stdout();
-            let writer = BufWriter::new(stdout.lock());
-            chunks.print(writer)?;
+            let stdout = stdout();
+            let writer = BufWriter::new(stdout.lock());
+            chunks.print(writer)?;
 
-            self.last.replace(path.to_owned());
-            self.update_metadata(path, None);
+            self.last.replace(path.to_owned());
+            self.update_metadata(path, None);
             Ok(true)
-        } else {
+        } else {
             Ok(false)
         }
     }
 
-    /// Decide if printing `path` needs a header based on when it was last printed
-    pub fn needs_header(&self, path: &Path, verbose: bool) -> bool {
-        if verbose {
-            if let Some(ref last) = self.last {
-                return !last.eq(&path);
-            } else {
-                return true;
+    /// Decide if printing `path` needs a header based on when it was last printed
+    pub fn needs_header(&self, path: &Path, verbose: bool) -> bool {
+        if verbose {
+            if let Some(ref last) = self.last {
+                return !last.eq(&path);
+            } else {
+                return true;
             }
         }
-        false
-    }
+        false
+    }
 }
 
-/// Data structure to keep a handle on the BufReader, Metadata
-/// and the display_name (header_name) of files that are being followed.
-pub struct PathData {
-    pub reader: Option<Box<dyn BufRead>>,
-    pub metadata: Option<Metadata>,
-    pub display_name: String,
+/// Data structure to keep a handle on the BufReader, Metadata
+/// and the display_name (header_name) of files that are being followed.
+pub struct PathData {
+    pub reader: Option<Box<dyn BufRead>>,
+    pub metadata: Option<Metadata>,
+    pub display_name: String,
 }
 
-impl PathData {
-    pub fn new(
-        reader: Option<Box<dyn BufRead>>,
-        metadata: Option<Metadata>,
-        display_name: &str,
-    ) -> Self {
-        Self {
-            reader,
-            metadata,
-            display_name: display_name.to_owned(),
+impl PathData {
+    pub fn new(
+        reader: Option<Box<dyn BufRead>>,
+        metadata: Option<Metadata>,
+        display_name: &str,
+    ) -> Self {
+        Self {
+            reader,
+            metadata,
+            display_name: display_name.to_owned(),
         }
     }
-    pub fn from_other_with_path(data: Self, path: &Path) -> Self {
-        // Remove old reader
-        let old_reader = data.reader;
-        let reader = if old_reader.is_some() {
-            // Use old reader with the same file descriptor if there is one
-            old_reader
-        } else if let Ok(file) = File::open(path) {
-            // Open new file tail from start
-            Some(Box::new(BufReader::new(file)) as Box<dyn BufRead>)
-        } else {
-            // Probably file was renamed/moved or removed again
-            None
-        };
+    pub fn from_other_with_path(data: Self, path: &Path) -> Self {
+        // Remove old reader
+        let old_reader = data.reader;
+        let reader = if old_reader.is_some() {
+            // Use old reader with the same file descriptor if there is one
+            old_reader
+        } else if let Ok(file) = File::open(path) {
+            // Open new file tail from start
+            Some(Box::new(BufReader::new(file)) as Box<dyn BufRead>)
+        } else {
+            // Probably file was renamed/moved or removed again
+            None
+        };
 
-        Self::new(reader, path.metadata().ok(), data.display_name.as_str())
+        Self::new(reader, path.metadata().ok(), data.display_name.as_str())
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/follow/mod.rs.html b/dev/src/uu_tail/follow/mod.rs.html index 511b25279..7f9ee5d5f 100644 --- a/dev/src/uu_tail/follow/mod.rs.html +++ b/dev/src/uu_tail/follow/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
@@ -7,14 +7,14 @@
 7
 8
 9
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-mod files;
-mod watch;
+mod files;
+mod watch;
 
-pub use watch::{follow, WatcherService};
+pub use watch::{follow, WatcherService};
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/follow/watch.rs.html b/dev/src/uu_tail/follow/watch.rs.html index 06fbd3ee5..7653fba17 100644 --- a/dev/src/uu_tail/follow/watch.rs.html +++ b/dev/src/uu_tail/follow/watch.rs.html @@ -1,4 +1,4 @@ -watch.rs - source
1
+watch.rs - source
1
 2
 3
 4
@@ -593,44 +593,44 @@
 593
 594
 595
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) tailable untailable stdlib kqueue Uncategorized unwatch
+// spell-checker:ignore (ToDO) tailable untailable stdlib kqueue Uncategorized unwatch
 
-use crate::args::{FollowMode, Settings};
-use crate::follow::files::{FileHandling, PathData};
-use crate::paths::{Input, InputKind, MetadataExtTail, PathExtTail};
-use crate::{platform, text};
-use notify::{RecommendedWatcher, RecursiveMode, Watcher, WatcherKind};
-use std::collections::VecDeque;
-use std::io::BufRead;
-use std::path::{Path, PathBuf};
-use std::sync::mpsc;
-use std::sync::mpsc::{channel, Receiver};
-use uucore::display::Quotable;
-use uucore::error::{set_exit_code, UResult, USimpleError};
+use crate::args::{FollowMode, Settings};
+use crate::follow::files::{FileHandling, PathData};
+use crate::paths::{Input, InputKind, MetadataExtTail, PathExtTail};
+use crate::{platform, text};
+use notify::{RecommendedWatcher, RecursiveMode, Watcher, WatcherKind};
+use std::collections::VecDeque;
+use std::io::BufRead;
+use std::path::{Path, PathBuf};
+use std::sync::mpsc;
+use std::sync::mpsc::{channel, Receiver};
+use uucore::display::Quotable;
+use uucore::error::{set_exit_code, UResult, USimpleError};
 
-pub struct WatcherRx {
-    watcher: Box<dyn Watcher>,
-    receiver: Receiver<Result<notify::Event, notify::Error>>,
+pub struct WatcherRx {
+    watcher: Box<dyn Watcher>,
+    receiver: Receiver<Result<notify::Event, notify::Error>>,
 }
 
-impl WatcherRx {
-    fn new(
-        watcher: Box<dyn Watcher>,
-        receiver: Receiver<Result<notify::Event, notify::Error>>,
-    ) -> Self {
-        Self { watcher, receiver }
+impl WatcherRx {
+    fn new(
+        watcher: Box<dyn Watcher>,
+        receiver: Receiver<Result<notify::Event, notify::Error>>,
+    ) -> Self {
+        Self { watcher, receiver }
     }
 
-    /// Wrapper for `notify::Watcher::watch` to also add the parent directory of `path` if necessary.
-    fn watch_with_parent(&mut self, path: &Path) -> UResult<()> {
-        let mut path = path.to_owned();
-        #[cfg(target_os = "linux")]
-        if path.is_file() {
+    /// Wrapper for `notify::Watcher::watch` to also add the parent directory of `path` if necessary.
+    fn watch_with_parent(&mut self, path: &Path) -> UResult<()> {
+        let mut path = path.to_owned();
+        #[cfg(target_os = "linux")]
+        if path.is_file() {
             /*
             NOTE: Using the parent directory instead of the file is a workaround.
             This workaround follows the recommendation of the notify crate authors:
@@ -639,145 +639,145 @@
             > one may non-recursively watch the _parent_ directory as well and manage related events.
             NOTE: Adding both: file and parent results in duplicate/wrong events.
             Tested for notify::InotifyWatcher and for notify::PollWatcher.
-            */
-            if let Some(parent) = path.parent() {
-                if parent.is_dir() {
-                    path = parent.to_owned();
-                } else {
-                    path = PathBuf::from(".");
+            */
+            if let Some(parent) = path.parent() {
+                if parent.is_dir() {
+                    path = parent.to_owned();
+                } else {
+                    path = PathBuf::from(".");
                 }
-            } else {
-                return Err(USimpleError::new(
+            } else {
+                return Err(USimpleError::new(
                     1,
-                    format!("cannot watch parent directory of {}", path.display()),
+                    format!("cannot watch parent directory of {}", path.display()),
                 ));
             };
         }
-        if path.is_relative() {
-            path = path.canonicalize()?;
+        if path.is_relative() {
+            path = path.canonicalize()?;
         }
 
-        // for syscalls: 2x "inotify_add_watch" ("filename" and ".") and 1x "inotify_rm_watch"
-        self.watch(&path, RecursiveMode::NonRecursive)?;
+        // for syscalls: 2x "inotify_add_watch" ("filename" and ".") and 1x "inotify_rm_watch"
+        self.watch(&path, RecursiveMode::NonRecursive)?;
         Ok(())
     }
 
-    fn watch(&mut self, path: &Path, mode: RecursiveMode) -> UResult<()> {
-        self.watcher
-            .watch(path, mode)
-            .map_err(|err| USimpleError::new(1, err.to_string()))
+    fn watch(&mut self, path: &Path, mode: RecursiveMode) -> UResult<()> {
+        self.watcher
+            .watch(path, mode)
+            .map_err(|err| USimpleError::new(1, err.to_string()))
     }
 
-    fn unwatch(&mut self, path: &Path) -> UResult<()> {
-        self.watcher
-            .unwatch(path)
-            .map_err(|err| USimpleError::new(1, err.to_string()))
+    fn unwatch(&mut self, path: &Path) -> UResult<()> {
+        self.watcher
+            .unwatch(path)
+            .map_err(|err| USimpleError::new(1, err.to_string()))
     }
 }
 
-pub struct WatcherService {
-    /// Whether --retry was given on the command line
-    pub retry: bool,
+pub struct WatcherService {
+    /// Whether --retry was given on the command line
+    pub retry: bool,
 
-    /// The [`FollowMode`]
-    pub follow: Option<FollowMode>,
+    /// The [`FollowMode`]
+    pub follow: Option<FollowMode>,
 
-    /// Indicates whether to use the fallback `polling` method instead of the
-    /// platform specific event driven method. Since `use_polling` is subject to
-    /// change during runtime it is moved out of [`Settings`].
-    pub use_polling: bool,
-    pub watcher_rx: Option<WatcherRx>,
-    pub orphans: Vec<PathBuf>,
-    pub files: FileHandling,
+    /// Indicates whether to use the fallback `polling` method instead of the
+    /// platform specific event driven method. Since `use_polling` is subject to
+    /// change during runtime it is moved out of [`Settings`].
+    pub use_polling: bool,
+    pub watcher_rx: Option<WatcherRx>,
+    pub orphans: Vec<PathBuf>,
+    pub files: FileHandling,
 }
 
-impl WatcherService {
-    pub fn new(
-        retry: bool,
-        follow: Option<FollowMode>,
-        use_polling: bool,
-        files: FileHandling,
-    ) -> Self {
-        Self {
-            retry,
-            follow,
-            use_polling,
-            watcher_rx: None,
-            orphans: Vec::new(),
-            files,
+impl WatcherService {
+    pub fn new(
+        retry: bool,
+        follow: Option<FollowMode>,
+        use_polling: bool,
+        files: FileHandling,
+    ) -> Self {
+        Self {
+            retry,
+            follow,
+            use_polling,
+            watcher_rx: None,
+            orphans: Vec::new(),
+            files,
         }
     }
 
-    pub fn from(settings: &Settings) -> Self {
-        Self::new(
-            settings.retry,
-            settings.follow,
-            settings.use_polling,
-            FileHandling::from(settings),
+    pub fn from(settings: &Settings) -> Self {
+        Self::new(
+            settings.retry,
+            settings.follow,
+            settings.use_polling,
+            FileHandling::from(settings),
         )
     }
 
-    pub fn add_path(
-        &mut self,
-        path: &Path,
-        display_name: &str,
-        reader: Option<Box<dyn BufRead>>,
-        update_last: bool,
-    ) -> UResult<()> {
-        if self.follow.is_some() {
-            let path = if path.is_relative() {
-                std::env::current_dir()?.join(path)
-            } else {
-                path.to_owned()
+    pub fn add_path(
+        &mut self,
+        path: &Path,
+        display_name: &str,
+        reader: Option<Box<dyn BufRead>>,
+        update_last: bool,
+    ) -> UResult<()> {
+        if self.follow.is_some() {
+            let path = if path.is_relative() {
+                std::env::current_dir()?.join(path)
+            } else {
+                path.to_owned()
             };
-            let metadata = path.metadata().ok();
-            self.files.insert(
-                &path,
-                PathData::new(reader, metadata, display_name),
-                update_last,
+            let metadata = path.metadata().ok();
+            self.files.insert(
+                &path,
+                PathData::new(reader, metadata, display_name),
+                update_last,
             );
         }
 
         Ok(())
     }
 
-    pub fn add_stdin(
-        &mut self,
-        display_name: &str,
-        reader: Option<Box<dyn BufRead>>,
-        update_last: bool,
-    ) -> UResult<()> {
-        if self.follow == Some(FollowMode::Descriptor) {
-            return self.add_path(
-                &PathBuf::from(text::DEV_STDIN),
-                display_name,
-                reader,
-                update_last,
+    pub fn add_stdin(
+        &mut self,
+        display_name: &str,
+        reader: Option<Box<dyn BufRead>>,
+        update_last: bool,
+    ) -> UResult<()> {
+        if self.follow == Some(FollowMode::Descriptor) {
+            return self.add_path(
+                &PathBuf::from(text::DEV_STDIN),
+                display_name,
+                reader,
+                update_last,
             );
         }
 
         Ok(())
     }
 
-    pub fn add_bad_path(
-        &mut self,
-        path: &Path,
-        display_name: &str,
-        update_last: bool,
-    ) -> UResult<()> {
-        if self.retry && self.follow.is_some() {
-            return self.add_path(path, display_name, None, update_last);
+    pub fn add_bad_path(
+        &mut self,
+        path: &Path,
+        display_name: &str,
+        update_last: bool,
+    ) -> UResult<()> {
+        if self.retry && self.follow.is_some() {
+            return self.add_path(path, display_name, None, update_last);
         }
 
         Ok(())
     }
 
-    pub fn start(&mut self, settings: &Settings) -> UResult<()> {
-        if settings.follow.is_none() {
-            return Ok(());
+    pub fn start(&mut self, settings: &Settings) -> UResult<()> {
+        if settings.follow.is_none() {
+            return Ok(());
         }
 
-        let (tx, rx) = channel();
+        let (tx, rx) = channel();
 
         /*
         Watcher is implemented per platform using the best implementation available on that
@@ -794,90 +794,90 @@
         On macOS only `kqueue` is suitable for our use case because `FSEvents`
         waits for file close util it delivers a modify event. See:
         https://github.com/notify-rs/notify/issues/240
-        */
+        */
 
-        let watcher: Box<dyn Watcher>;
-        let watcher_config = notify::Config::default()
-            .with_poll_interval(settings.sleep_sec)
+        let watcher: Box<dyn Watcher>;
+        let watcher_config = notify::Config::default()
+            .with_poll_interval(settings.sleep_sec)
             /*
             NOTE: By enabling compare_contents, performance will be significantly impacted
             as all files will need to be read and hashed at each `poll_interval`.
             However, this is necessary to pass: "gnu/tests/tail-2/F-vs-rename.sh"
-            */
-            .with_compare_contents(true);
-        if self.use_polling || RecommendedWatcher::kind() == WatcherKind::PollWatcher {
-            self.use_polling = true; // We have to use polling because there's no supported backend
-            watcher = Box::new(notify::PollWatcher::new(tx, watcher_config).unwrap());
-        } else {
-            let tx_clone = tx.clone();
-            match notify::RecommendedWatcher::new(tx, notify::Config::default()) {
-                Ok(w) => watcher = Box::new(w),
-                Err(e) if e.to_string().starts_with("Too many open files") => {
+            */
+            .with_compare_contents(true);
+        if self.use_polling || RecommendedWatcher::kind() == WatcherKind::PollWatcher {
+            self.use_polling = true; // We have to use polling because there's no supported backend
+            watcher = Box::new(notify::PollWatcher::new(tx, watcher_config).unwrap());
+        } else {
+            let tx_clone = tx.clone();
+            match notify::RecommendedWatcher::new(tx, notify::Config::default()) {
+                Ok(w) => watcher = Box::new(w),
+                Err(e) if e.to_string().starts_with("Too many open files") => {
                     /*
                     NOTE: This ErrorKind is `Uncategorized`, but it is not recommended
                     to match an error against `Uncategorized`
                     NOTE: Could be tested with decreasing `max_user_instances`, e.g.:
                     `sudo sysctl fs.inotify.max_user_instances=64`
-                    */
-                    show_error!(
+                    */
+                    show_error!(
                         "{} cannot be used, reverting to polling: Too many open files",
-                        text::BACKEND
+                        text::BACKEND
                     );
-                    set_exit_code(1);
-                    self.use_polling = true;
-                    watcher = Box::new(notify::PollWatcher::new(tx_clone, watcher_config).unwrap());
+                    set_exit_code(1);
+                    self.use_polling = true;
+                    watcher = Box::new(notify::PollWatcher::new(tx_clone, watcher_config).unwrap());
                 }
-                Err(e) => return Err(USimpleError::new(1, e.to_string())),
+                Err(e) => return Err(USimpleError::new(1, e.to_string())),
             };
         }
 
-        self.watcher_rx = Some(WatcherRx::new(watcher, rx));
-        self.init_files(&settings.inputs)?;
+        self.watcher_rx = Some(WatcherRx::new(watcher, rx));
+        self.init_files(&settings.inputs)?;
 
         Ok(())
     }
 
-    pub fn follow_descriptor(&self) -> bool {
-        self.follow == Some(FollowMode::Descriptor)
+    pub fn follow_descriptor(&self) -> bool {
+        self.follow == Some(FollowMode::Descriptor)
     }
 
-    pub fn follow_name(&self) -> bool {
-        self.follow == Some(FollowMode::Name)
+    pub fn follow_name(&self) -> bool {
+        self.follow == Some(FollowMode::Name)
     }
 
-    pub fn follow_descriptor_retry(&self) -> bool {
-        self.follow_descriptor() && self.retry
+    pub fn follow_descriptor_retry(&self) -> bool {
+        self.follow_descriptor() && self.retry
     }
 
-    pub fn follow_name_retry(&self) -> bool {
-        self.follow_name() && self.retry
+    pub fn follow_name_retry(&self) -> bool {
+        self.follow_name() && self.retry
     }
 
-    fn init_files(&mut self, inputs: &VecDeque<Input>) -> UResult<()> {
-        if let Some(watcher_rx) = &mut self.watcher_rx {
-            for input in inputs {
-                match input.kind() {
-                    InputKind::Stdin => continue,
-                    InputKind::File(path) => {
-                        #[cfg(all(unix, not(target_os = "linux")))]
-                        if !path.is_file() {
+    fn init_files(&mut self, inputs: &VecDeque<Input>) -> UResult<()> {
+        if let Some(watcher_rx) = &mut self.watcher_rx {
+            for input in inputs {
+                match input.kind() {
+                    InputKind::Stdin => continue,
+                    InputKind::File(path) => {
+                        #[cfg(all(unix, not(target_os = "linux")))]
+                        if !path.is_file() {
                             continue;
                         }
-                        let mut path = path.to_owned();
-                        if path.is_relative() {
-                            path = std::env::current_dir()?.join(path);
+                        let mut path = path.to_owned();
+                        if path.is_relative() {
+                            path = std::env::current_dir()?.join(path);
                         }
 
-                        if path.is_tailable() {
-                            // Add existing regular files to `Watcher` (InotifyWatcher).
-                            watcher_rx.watch_with_parent(&path)?;
-                        } else if !path.is_orphan() {
-                            // If `path` is not a tailable file, add its parent to `Watcher`.
-                            watcher_rx
-                                .watch(path.parent().unwrap(), RecursiveMode::NonRecursive)?;
-                        } else {
-                            // If there is no parent, add `path` to `orphans`.
-                            self.orphans.push(path);
+                        if path.is_tailable() {
+                            // Add existing regular files to `Watcher` (InotifyWatcher).
+                            watcher_rx.watch_with_parent(&path)?;
+                        } else if !path.is_orphan() {
+                            // If `path` is not a tailable file, add its parent to `Watcher`.
+                            watcher_rx
+                                .watch(path.parent().unwrap(), RecursiveMode::NonRecursive)?;
+                        } else {
+                            // If there is no parent, add `path` to `orphans`.
+                            self.orphans.push(path);
                         }
                     }
                 }
@@ -886,122 +886,122 @@
         Ok(())
     }
 
-    fn handle_event(
-        &mut self,
-        event: &notify::Event,
-        settings: &Settings,
-    ) -> UResult<Vec<PathBuf>> {
-        use notify::event::*;
+    fn handle_event(
+        &mut self,
+        event: &notify::Event,
+        settings: &Settings,
+    ) -> UResult<Vec<PathBuf>> {
+        use notify::event::*;
 
-        let event_path = event.paths.first().unwrap();
-        let mut paths: Vec<PathBuf> = vec![];
-        let display_name = self.files.get(event_path).display_name.clone();
+        let event_path = event.paths.first().unwrap();
+        let mut paths: Vec<PathBuf> = vec![];
+        let display_name = self.files.get(event_path).display_name.clone();
 
-        match event.kind {
-            EventKind::Modify(ModifyKind::Metadata(MetadataKind::Any | MetadataKind::WriteTime))
+        match event.kind {
+            EventKind::Modify(ModifyKind::Metadata(MetadataKind::Any | MetadataKind::WriteTime))
 
-                // | EventKind::Access(AccessKind::Close(AccessMode::Write))
-                | EventKind::Create(CreateKind::File | CreateKind::Folder | CreateKind::Any)
-                | EventKind::Modify(ModifyKind::Data(DataChange::Any))
-                | EventKind::Modify(ModifyKind::Name(RenameMode::To)) => {
-                    if let Ok(new_md) = event_path.metadata() {
+                // | EventKind::Access(AccessKind::Close(AccessMode::Write))
+                | EventKind::Create(CreateKind::File | CreateKind::Folder | CreateKind::Any)
+                | EventKind::Modify(ModifyKind::Data(DataChange::Any))
+                | EventKind::Modify(ModifyKind::Name(RenameMode::To)) => {
+                    if let Ok(new_md) = event_path.metadata() {
 
-                        let is_tailable = new_md.is_tailable();
-                        let pd = self.files.get(event_path);
-                        if let Some(old_md) = &pd.metadata {
-                            if is_tailable {
-                                // We resume tracking from the start of the file,
-                                // assuming it has been truncated to 0. This mimics GNU's `tail`
-                                // behavior and is the usual truncation operation for log self.files.
-                                if !old_md.is_tailable() {
-                                    show_error!( "{} has become accessible", display_name.quote());
-                                    self.files.update_reader(event_path)?;
-                                } else if pd.reader.is_none() {
-                                    show_error!( "{} has appeared;  following new file", display_name.quote());
-                                    self.files.update_reader(event_path)?;
-                                } else if event.kind == EventKind::Modify(ModifyKind::Name(RenameMode::To))
-                                || (self.use_polling
-                                && !old_md.file_id_eq(&new_md)) {
-                                    show_error!( "{} has been replaced;  following new file", display_name.quote());
-                                    self.files.update_reader(event_path)?;
-                                } else if old_md.got_truncated(&new_md)? {
-                                    show_error!("{}: file truncated", display_name);
-                                    self.files.update_reader(event_path)?;
+                        let is_tailable = new_md.is_tailable();
+                        let pd = self.files.get(event_path);
+                        if let Some(old_md) = &pd.metadata {
+                            if is_tailable {
+                                // We resume tracking from the start of the file,
+                                // assuming it has been truncated to 0. This mimics GNU's `tail`
+                                // behavior and is the usual truncation operation for log self.files.
+                                if !old_md.is_tailable() {
+                                    show_error!( "{} has become accessible", display_name.quote());
+                                    self.files.update_reader(event_path)?;
+                                } else if pd.reader.is_none() {
+                                    show_error!( "{} has appeared;  following new file", display_name.quote());
+                                    self.files.update_reader(event_path)?;
+                                } else if event.kind == EventKind::Modify(ModifyKind::Name(RenameMode::To))
+                                || (self.use_polling
+                                && !old_md.file_id_eq(&new_md)) {
+                                    show_error!( "{} has been replaced;  following new file", display_name.quote());
+                                    self.files.update_reader(event_path)?;
+                                } else if old_md.got_truncated(&new_md)? {
+                                    show_error!("{}: file truncated", display_name);
+                                    self.files.update_reader(event_path)?;
                                 }
-                                paths.push(event_path.to_owned());
-                            } else if !is_tailable && old_md.is_tailable() {
-                                if pd.reader.is_some() {
-                                    self.files.reset_reader(event_path);
-                                } else {
+                                paths.push(event_path.to_owned());
+                            } else if !is_tailable && old_md.is_tailable() {
+                                if pd.reader.is_some() {
+                                    self.files.reset_reader(event_path);
+                                } else {
                                     show_error!(
                                         "{} has been replaced with an untailable file",
-                                        display_name.quote()
+                                        display_name.quote()
                                     );
                                 }
                             }
-                        } else if is_tailable {
-                                show_error!( "{} has appeared;  following new file", display_name.quote());
-                                self.files.update_reader(event_path)?;
-                                paths.push(event_path.to_owned());
-                            } else if settings.retry {
-                                if self.follow_descriptor() {
+                        } else if is_tailable {
+                                show_error!( "{} has appeared;  following new file", display_name.quote());
+                                self.files.update_reader(event_path)?;
+                                paths.push(event_path.to_owned());
+                            } else if settings.retry {
+                                if self.follow_descriptor() {
                                     show_error!(
                                         "{} has been replaced with an untailable file; giving up on this name",
-                                        display_name.quote()
+                                        display_name.quote()
                                     );
-                                    let _ = self.watcher_rx.as_mut().unwrap().watcher.unwatch(event_path);
-                                    self.files.remove(event_path);
-                                    if self.files.no_files_remaining(settings) {
-                                        return Err(USimpleError::new(1, text::NO_FILES_REMAINING));
+                                    let _ = self.watcher_rx.as_mut().unwrap().watcher.unwatch(event_path);
+                                    self.files.remove(event_path);
+                                    if self.files.no_files_remaining(settings) {
+                                        return Err(USimpleError::new(1, text::NO_FILES_REMAINING));
                                     }
-                                } else {
+                                } else {
                                     show_error!(
                                         "{} has been replaced with an untailable file",
-                                        display_name.quote()
+                                        display_name.quote()
                                     );
                                 }
                             }
-                        self.files.update_metadata(event_path, Some(new_md));
+                        self.files.update_metadata(event_path, Some(new_md));
                     }
                 }
-            EventKind::Remove(RemoveKind::File | RemoveKind::Any)
+            EventKind::Remove(RemoveKind::File | RemoveKind::Any)
 
-                // | EventKind::Modify(ModifyKind::Name(RenameMode::Any))
-                | EventKind::Modify(ModifyKind::Name(RenameMode::From)) => {
-                    if self.follow_name() {
-                        if settings.retry {
-                            if let Some(old_md) = self.files.get_mut_metadata(event_path) {
-                                if old_md.is_tailable() && self.files.get(event_path).reader.is_some() {
+                // | EventKind::Modify(ModifyKind::Name(RenameMode::Any))
+                | EventKind::Modify(ModifyKind::Name(RenameMode::From)) => {
+                    if self.follow_name() {
+                        if settings.retry {
+                            if let Some(old_md) = self.files.get_mut_metadata(event_path) {
+                                if old_md.is_tailable() && self.files.get(event_path).reader.is_some() {
                                     show_error!(
                                         "{} {}: {}",
-                                        display_name.quote(),
-                                        text::BECOME_INACCESSIBLE,
-                                        text::NO_SUCH_FILE
+                                        display_name.quote(),
+                                        text::BECOME_INACCESSIBLE,
+                                        text::NO_SUCH_FILE
                                     );
                                 }
                             }
-                            if event_path.is_orphan() && !self.orphans.contains(event_path) {
+                            if event_path.is_orphan() && !self.orphans.contains(event_path) {
                                 show_error!("directory containing watched file was removed");
                                 show_error!(
                                     "{} cannot be used, reverting to polling",
-                                    text::BACKEND
+                                    text::BACKEND
                                 );
-                                self.orphans.push(event_path.to_owned());
-                                let _ = self.watcher_rx.as_mut().unwrap().unwatch(event_path);
+                                self.orphans.push(event_path.to_owned());
+                                let _ = self.watcher_rx.as_mut().unwrap().unwatch(event_path);
                             }
-                        } else {
-                            show_error!("{}: {}", display_name, text::NO_SUCH_FILE);
-                            if !self.files.files_remaining() && self.use_polling {
-                                // NOTE: GNU's tail exits here for `---disable-inotify`
-                                return Err(USimpleError::new(1, text::NO_FILES_REMAINING));
+                        } else {
+                            show_error!("{}: {}", display_name, text::NO_SUCH_FILE);
+                            if !self.files.files_remaining() && self.use_polling {
+                                // NOTE: GNU's tail exits here for `---disable-inotify`
+                                return Err(USimpleError::new(1, text::NO_FILES_REMAINING));
                             }
                         }
-                        self.files.reset_reader(event_path);
-                    } else if self.follow_descriptor_retry() {
-                        // --retry only effective for the initial open
-                        let _ = self.watcher_rx.as_mut().unwrap().unwatch(event_path);
-                        self.files.remove(event_path);
-                    } else if self.use_polling && event.kind == EventKind::Remove(RemoveKind::Any) {
+                        self.files.reset_reader(event_path);
+                    } else if self.follow_descriptor_retry() {
+                        // --retry only effective for the initial open
+                        let _ = self.watcher_rx.as_mut().unwrap().unwatch(event_path);
+                        self.files.remove(event_path);
+                    } else if self.use_polling && event.kind == EventKind::Remove(RemoveKind::Any) {
                         /*
                         BUG: The watched file was removed. Since we're using Polling, this
                         could be a rename. We can't tell because `notify::PollWatcher` doesn't
@@ -1011,10 +1011,10 @@
                         we cannot seek to 0 with `BufReader::seek_relative`.
                         Also because we don't have the new name, we cannot work around this
                         by simply reopening the file.
-                        */
-                    }
+                        */
+                    }
                 }
-            EventKind::Modify(ModifyKind::Name(RenameMode::Both)) => {
+            EventKind::Modify(ModifyKind::Name(RenameMode::Both)) => {
                 /*
                 NOTE: For `tail -f a`, keep tracking additions to b after `mv a b`
                 (gnu/tests/tail-2/descriptor-vs-rename.sh)
@@ -1030,149 +1030,149 @@
                 The last append to file_a is printed, however this shouldn't be because
                 after the "mv" tail should only follow "file_b".
                 TODO: [2022-05; jhscheer] add test for this bug
-                */
+                */
 
-                if self.follow_descriptor() {
-                    let new_path = event.paths.last().unwrap();
-                    paths.push(new_path.to_owned());
+                if self.follow_descriptor() {
+                    let new_path = event.paths.last().unwrap();
+                    paths.push(new_path.to_owned());
 
-                    let new_data = PathData::from_other_with_path(self.files.remove(event_path), new_path);
-                    self.files.insert(
-                        new_path,
-                        new_data,
-                        self.files.get_last().unwrap() == event_path
+                    let new_data = PathData::from_other_with_path(self.files.remove(event_path), new_path);
+                    self.files.insert(
+                        new_path,
+                        new_data,
+                        self.files.get_last().unwrap() == event_path
                     );
 
-                    // Unwatch old path and watch new path
-                    let _ = self.watcher_rx.as_mut().unwrap().unwatch(event_path);
-                    self.watcher_rx.as_mut().unwrap().watch_with_parent(new_path)?;
+                    // Unwatch old path and watch new path
+                    let _ = self.watcher_rx.as_mut().unwrap().unwatch(event_path);
+                    self.watcher_rx.as_mut().unwrap().watch_with_parent(new_path)?;
                 }
             }
-            _ => {}
+            _ => {}
         }
-        Ok(paths)
+        Ok(paths)
     }
 }
 
-pub fn follow(mut watcher_service: WatcherService, settings: &Settings) -> UResult<()> {
-    if watcher_service.files.no_files_remaining(settings)
-        && !watcher_service.files.only_stdin_remaining()
+pub fn follow(mut watcher_service: WatcherService, settings: &Settings) -> UResult<()> {
+    if watcher_service.files.no_files_remaining(settings)
+        && !watcher_service.files.only_stdin_remaining()
     {
-        return Err(USimpleError::new(1, text::NO_FILES_REMAINING.to_string()));
+        return Err(USimpleError::new(1, text::NO_FILES_REMAINING.to_string()));
     }
 
-    let mut process = platform::ProcessChecker::new(settings.pid);
+    let mut process = platform::ProcessChecker::new(settings.pid);
 
-    let mut _event_counter = 0;
-    let mut _timeout_counter = 0;
+    let mut _event_counter = 0;
+    let mut _timeout_counter = 0;
 
-    // main follow loop
-    loop {
-        let mut _read_some = false;
+    // main follow loop
+    loop {
+        let mut _read_some = false;
 
-        // If `--pid=p`, tail checks whether process p
-        // is alive at least every `--sleep-interval=N` seconds
-        if settings.follow.is_some() && settings.pid != 0 && process.is_dead() {
-            // p is dead, tail will also terminate
-            break;
+        // If `--pid=p`, tail checks whether process p
+        // is alive at least every `--sleep-interval=N` seconds
+        if settings.follow.is_some() && settings.pid != 0 && process.is_dead() {
+            // p is dead, tail will also terminate
+            break;
         }
 
-        // For `-F` we need to poll if an orphan path becomes available during runtime.
-        // If a path becomes an orphan during runtime, it will be added to orphans.
-        // To be able to differentiate between the cases of test_retry8 and test_retry9,
-        // here paths will not be removed from orphans if the path becomes available.
-        if watcher_service.follow_name_retry() {
-            for new_path in &watcher_service.orphans {
-                if new_path.exists() {
-                    let pd = watcher_service.files.get(new_path);
-                    let md = new_path.metadata().unwrap();
-                    if md.is_tailable() && pd.reader.is_none() {
+        // For `-F` we need to poll if an orphan path becomes available during runtime.
+        // If a path becomes an orphan during runtime, it will be added to orphans.
+        // To be able to differentiate between the cases of test_retry8 and test_retry9,
+        // here paths will not be removed from orphans if the path becomes available.
+        if watcher_service.follow_name_retry() {
+            for new_path in &watcher_service.orphans {
+                if new_path.exists() {
+                    let pd = watcher_service.files.get(new_path);
+                    let md = new_path.metadata().unwrap();
+                    if md.is_tailable() && pd.reader.is_none() {
                         show_error!(
                             "{} has appeared;  following new file",
-                            pd.display_name.quote()
+                            pd.display_name.quote()
                         );
-                        watcher_service.files.update_metadata(new_path, Some(md));
-                        watcher_service.files.update_reader(new_path)?;
-                        _read_some = watcher_service
-                            .files
-                            .tail_file(new_path, settings.verbose)?;
-                        watcher_service
-                            .watcher_rx
-                            .as_mut()
-                            .unwrap()
-                            .watch_with_parent(new_path)?;
+                        watcher_service.files.update_metadata(new_path, Some(md));
+                        watcher_service.files.update_reader(new_path)?;
+                        _read_some = watcher_service
+                            .files
+                            .tail_file(new_path, settings.verbose)?;
+                        watcher_service
+                            .watcher_rx
+                            .as_mut()
+                            .unwrap()
+                            .watch_with_parent(new_path)?;
                     }
                 }
             }
         }
 
-        // With  -f, sleep for approximately N seconds (default 1.0) between iterations;
-        // We wake up if Notify sends an Event or if we wait more than `sleep_sec`.
-        let rx_result = watcher_service
-            .watcher_rx
-            .as_mut()
-            .unwrap()
-            .receiver
-            .recv_timeout(settings.sleep_sec);
-        if rx_result.is_ok() {
-            _event_counter += 1;
-            _timeout_counter = 0;
+        // With  -f, sleep for approximately N seconds (default 1.0) between iterations;
+        // We wake up if Notify sends an Event or if we wait more than `sleep_sec`.
+        let rx_result = watcher_service
+            .watcher_rx
+            .as_mut()
+            .unwrap()
+            .receiver
+            .recv_timeout(settings.sleep_sec);
+        if rx_result.is_ok() {
+            _event_counter += 1;
+            _timeout_counter = 0;
         }
 
-        let mut paths = vec![]; // Paths worth checking for new content to print
-        match rx_result {
-            Ok(Ok(event)) => {
-                if let Some(event_path) = event.paths.first() {
-                    if watcher_service.files.contains_key(event_path) {
-                        // Handle Event if it is about a path that we are monitoring
-                        paths = watcher_service.handle_event(&event, settings)?;
+        let mut paths = vec![]; // Paths worth checking for new content to print
+        match rx_result {
+            Ok(Ok(event)) => {
+                if let Some(event_path) = event.paths.first() {
+                    if watcher_service.files.contains_key(event_path) {
+                        // Handle Event if it is about a path that we are monitoring
+                        paths = watcher_service.handle_event(&event, settings)?;
                     }
                 }
             }
-            Ok(Err(notify::Error {
-                kind: notify::ErrorKind::Io(ref e),
-                paths,
-            })) if e.kind() == std::io::ErrorKind::NotFound => {
-                if let Some(event_path) = paths.first() {
-                    if watcher_service.files.contains_key(event_path) {
-                        let _ = watcher_service
-                            .watcher_rx
-                            .as_mut()
-                            .unwrap()
-                            .watcher
-                            .unwatch(event_path);
+            Ok(Err(notify::Error {
+                kind: notify::ErrorKind::Io(ref e),
+                paths,
+            })) if e.kind() == std::io::ErrorKind::NotFound => {
+                if let Some(event_path) = paths.first() {
+                    if watcher_service.files.contains_key(event_path) {
+                        let _ = watcher_service
+                            .watcher_rx
+                            .as_mut()
+                            .unwrap()
+                            .watcher
+                            .unwatch(event_path);
                     }
                 }
             }
-            Ok(Err(notify::Error {
-                kind: notify::ErrorKind::MaxFilesWatch,
+            Ok(Err(notify::Error {
+                kind: notify::ErrorKind::MaxFilesWatch,
                 ..
             })) => {
-                return Err(USimpleError::new(
+                return Err(USimpleError::new(
                     1,
-                    format!("{} resources exhausted", text::BACKEND),
+                    format!("{} resources exhausted", text::BACKEND),
                 ))
             }
-            Ok(Err(e)) => return Err(USimpleError::new(1, format!("NotifyError: {}", e))),
-            Err(mpsc::RecvTimeoutError::Timeout) => {
-                _timeout_counter += 1;
+            Ok(Err(e)) => return Err(USimpleError::new(1, format!("NotifyError: {}", e))),
+            Err(mpsc::RecvTimeoutError::Timeout) => {
+                _timeout_counter += 1;
             }
-            Err(e) => return Err(USimpleError::new(1, format!("RecvTimeoutError: {}", e))),
+            Err(e) => return Err(USimpleError::new(1, format!("RecvTimeoutError: {}", e))),
         }
 
-        if watcher_service.use_polling && settings.follow.is_some() {
-            // Consider all files to potentially have new content.
-            // This is a workaround because `Notify::PollWatcher`
-            // does not recognize the "renaming" of files.
-            paths = watcher_service.files.keys().cloned().collect::<Vec<_>>();
+        if watcher_service.use_polling && settings.follow.is_some() {
+            // Consider all files to potentially have new content.
+            // This is a workaround because `Notify::PollWatcher`
+            // does not recognize the "renaming" of files.
+            paths = watcher_service.files.keys().cloned().collect::<Vec<_>>();
         }
 
-        // main print loop
-        for path in &paths {
-            _read_some = watcher_service.files.tail_file(path, settings.verbose)?;
+        // main print loop
+        for path in &paths {
+            _read_some = watcher_service.files.tail_file(path, settings.verbose)?;
         }
 
-        if _timeout_counter == settings.max_unchanged_stats {
+        if _timeout_counter == settings.max_unchanged_stats {
             /*
             TODO: [2021-10; jhscheer] implement timeout_counter for each file.
             ‘--max-unchanged-stats=n’
@@ -1183,10 +1183,10 @@
             between when tail prints the last pre-rotation lines and when it prints the lines that
             have accumulated in the new log file. This option is meaningful only when polling
             (i.e., without inotify) and when following by name.
-            */
-        }
+            */
+        }
     }
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/parse.rs.html b/dev/src/uu_tail/parse.rs.html index ec366ee77..d0c2278c8 100644 --- a/dev/src/uu_tail/parse.rs.html +++ b/dev/src/uu_tail/parse.rs.html @@ -1,4 +1,4 @@ -parse.rs - source
1
+parse.rs - source
1
 2
 3
 4
@@ -159,166 +159,166 @@
 159
 160
 161
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-use std::ffi::OsString;
+use std::ffi::OsString;
 
-#[derive(PartialEq, Eq, Debug)]
-pub enum ParseError {
-    Syntax,
-    Overflow,
+#[derive(PartialEq, Eq, Debug)]
+pub enum ParseError {
+    Syntax,
+    Overflow,
 }
-/// Parses obsolete syntax
-/// tail -NUM\[kmzv\] // spell-checker:disable-line
-pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>, ParseError>> {
-    let mut chars = src.char_indices();
-    if let Some((_, '-')) = chars.next() {
-        let mut num_end = 0usize;
-        let mut has_num = false;
-        let mut last_char = 0 as char;
-        for (n, c) in &mut chars {
-            if c.is_ascii_digit() {
-                has_num = true;
-                num_end = n;
-            } else {
-                last_char = c;
+/// Parses obsolete syntax
+/// tail -NUM\[kmzv\] // spell-checker:disable-line
+pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>, ParseError>> {
+    let mut chars = src.char_indices();
+    if let Some((_, '-')) = chars.next() {
+        let mut num_end = 0usize;
+        let mut has_num = false;
+        let mut last_char = 0 as char;
+        for (n, c) in &mut chars {
+            if c.is_ascii_digit() {
+                has_num = true;
+                num_end = n;
+            } else {
+                last_char = c;
                 break;
             }
         }
-        if has_num {
-            match src[1..=num_end].parse::<usize>() {
-                Ok(num) => {
-                    let mut quiet = false;
-                    let mut verbose = false;
-                    let mut zero_terminated = false;
-                    let mut multiplier = None;
-                    let mut c = last_char;
-                    loop {
-                        // not that here, we only match lower case 'k', 'c', and 'm'
-                        match c {
-                            // we want to preserve order
-                            // this also saves us 1 heap allocation
-                            'q' => {
-                                quiet = true;
-                                verbose = false;
+        if has_num {
+            match src[1..=num_end].parse::<usize>() {
+                Ok(num) => {
+                    let mut quiet = false;
+                    let mut verbose = false;
+                    let mut zero_terminated = false;
+                    let mut multiplier = None;
+                    let mut c = last_char;
+                    loop {
+                        // not that here, we only match lower case 'k', 'c', and 'm'
+                        match c {
+                            // we want to preserve order
+                            // this also saves us 1 heap allocation
+                            'q' => {
+                                quiet = true;
+                                verbose = false;
                             }
-                            'v' => {
-                                verbose = true;
-                                quiet = false;
+                            'v' => {
+                                verbose = true;
+                                quiet = false;
                             }
-                            'z' => zero_terminated = true,
-                            'c' => multiplier = Some(1),
-                            'b' => multiplier = Some(512),
-                            'k' => multiplier = Some(1024),
-                            'm' => multiplier = Some(1024 * 1024),
-                            '\0' => {}
-                            _ => return Some(Err(ParseError::Syntax)),
+                            'z' => zero_terminated = true,
+                            'c' => multiplier = Some(1),
+                            'b' => multiplier = Some(512),
+                            'k' => multiplier = Some(1024),
+                            'm' => multiplier = Some(1024 * 1024),
+                            '\0' => {}
+                            _ => return Some(Err(ParseError::Syntax)),
                         }
-                        if let Some((_, next)) = chars.next() {
-                            c = next;
-                        } else {
+                        if let Some((_, next)) = chars.next() {
+                            c = next;
+                        } else {
                             break;
                         }
                     }
-                    let mut options = Vec::new();
-                    if quiet {
-                        options.push(OsString::from("-q"));
+                    let mut options = Vec::new();
+                    if quiet {
+                        options.push(OsString::from("-q"));
                     }
-                    if verbose {
-                        options.push(OsString::from("-v"));
+                    if verbose {
+                        options.push(OsString::from("-v"));
                     }
-                    if zero_terminated {
-                        options.push(OsString::from("-z"));
+                    if zero_terminated {
+                        options.push(OsString::from("-z"));
                     }
-                    if let Some(n) = multiplier {
-                        options.push(OsString::from("-c"));
-                        let num = match num.checked_mul(n) {
-                            Some(n) => n,
-                            None => return Some(Err(ParseError::Overflow)),
+                    if let Some(n) = multiplier {
+                        options.push(OsString::from("-c"));
+                        let num = match num.checked_mul(n) {
+                            Some(n) => n,
+                            None => return Some(Err(ParseError::Overflow)),
                         };
-                        options.push(OsString::from(format!("{}", num)));
-                    } else {
-                        options.push(OsString::from("-n"));
-                        options.push(OsString::from(format!("{}", num)));
+                        options.push(OsString::from(format!("{}", num)));
+                    } else {
+                        options.push(OsString::from("-n"));
+                        options.push(OsString::from(format!("{}", num)));
                     }
-                    Some(Ok(options.into_iter()))
+                    Some(Ok(options.into_iter()))
                 }
-                Err(_) => Some(Err(ParseError::Overflow)),
+                Err(_) => Some(Err(ParseError::Overflow)),
             }
-        } else {
-            None
-        }
-    } else {
-        None
-    }
+        } else {
+            None
+        }
+    } else {
+        None
+    }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    fn obsolete(src: &str) -> Option<Result<Vec<String>, ParseError>> {
-        let r = parse_obsolete(src);
-        match r {
-            Some(s) => match s {
-                Ok(v) => Some(Ok(v.map(|s| s.to_str().unwrap().to_owned()).collect())),
-                Err(e) => Some(Err(e)),
+#[cfg(test)]
+mod tests {
+    use super::*;
+    fn obsolete(src: &str) -> Option<Result<Vec<String>, ParseError>> {
+        let r = parse_obsolete(src);
+        match r {
+            Some(s) => match s {
+                Ok(v) => Some(Ok(v.map(|s| s.to_str().unwrap().to_owned()).collect())),
+                Err(e) => Some(Err(e)),
             },
-            None => None,
+            None => None,
         }
     }
-    fn obsolete_result(src: &[&str]) -> Option<Result<Vec<String>, ParseError>> {
-        Some(Ok(src.iter().map(|s| s.to_string()).collect()))
+    fn obsolete_result(src: &[&str]) -> Option<Result<Vec<String>, ParseError>> {
+        Some(Ok(src.iter().map(|s| s.to_string()).collect()))
     }
-    #[test]
-    fn test_parse_numbers_obsolete() {
-        assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"]));
-        assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"]));
-        assert_eq!(obsolete("-5m"), obsolete_result(&["-c", "5242880"]));
-        assert_eq!(obsolete("-1k"), obsolete_result(&["-c", "1024"]));
-        assert_eq!(obsolete("-2b"), obsolete_result(&["-c", "1024"]));
-        assert_eq!(obsolete("-1mmk"), obsolete_result(&["-c", "1024"]));
-        assert_eq!(obsolete("-1vz"), obsolete_result(&["-v", "-z", "-n", "1"]));
+    #[test]
+    fn test_parse_numbers_obsolete() {
+        assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"]));
+        assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"]));
+        assert_eq!(obsolete("-5m"), obsolete_result(&["-c", "5242880"]));
+        assert_eq!(obsolete("-1k"), obsolete_result(&["-c", "1024"]));
+        assert_eq!(obsolete("-2b"), obsolete_result(&["-c", "1024"]));
+        assert_eq!(obsolete("-1mmk"), obsolete_result(&["-c", "1024"]));
+        assert_eq!(obsolete("-1vz"), obsolete_result(&["-v", "-z", "-n", "1"]));
         assert_eq!(
-            obsolete("-1vzqvq"), // spell-checker:disable-line
-            obsolete_result(&["-q", "-z", "-n", "1"])
+            obsolete("-1vzqvq"), // spell-checker:disable-line
+            obsolete_result(&["-q", "-z", "-n", "1"])
         );
-        assert_eq!(obsolete("-1vzc"), obsolete_result(&["-v", "-z", "-c", "1"]));
+        assert_eq!(obsolete("-1vzc"), obsolete_result(&["-v", "-z", "-c", "1"]));
         assert_eq!(
-            obsolete("-105kzm"),
-            obsolete_result(&["-z", "-c", "110100480"])
+            obsolete("-105kzm"),
+            obsolete_result(&["-z", "-c", "110100480"])
         );
     }
-    #[test]
-    fn test_parse_errors_obsolete() {
-        assert_eq!(obsolete("-5n"), Some(Err(ParseError::Syntax)));
-        assert_eq!(obsolete("-5c5"), Some(Err(ParseError::Syntax)));
+    #[test]
+    fn test_parse_errors_obsolete() {
+        assert_eq!(obsolete("-5n"), Some(Err(ParseError::Syntax)));
+        assert_eq!(obsolete("-5c5"), Some(Err(ParseError::Syntax)));
     }
-    #[test]
-    fn test_parse_obsolete_no_match() {
-        assert_eq!(obsolete("-k"), None);
-        assert_eq!(obsolete("asd"), None);
+    #[test]
+    fn test_parse_obsolete_no_match() {
+        assert_eq!(obsolete("-k"), None);
+        assert_eq!(obsolete("asd"), None);
     }
-    #[test]
-    #[cfg(target_pointer_width = "64")]
-    fn test_parse_obsolete_overflow_x64() {
+    #[test]
+    #[cfg(target_pointer_width = "64")]
+    fn test_parse_obsolete_overflow_x64() {
         assert_eq!(
-            obsolete("-1000000000000000m"),
-            Some(Err(ParseError::Overflow))
+            obsolete("-1000000000000000m"),
+            Some(Err(ParseError::Overflow))
         );
         assert_eq!(
-            obsolete("-10000000000000000000000"),
-            Some(Err(ParseError::Overflow))
+            obsolete("-10000000000000000000000"),
+            Some(Err(ParseError::Overflow))
         );
     }
-    #[test]
-    #[cfg(target_pointer_width = "32")]
-    fn test_parse_obsolete_overflow_x32() {
-        assert_eq!(obsolete("-42949672960"), Some(Err(ParseError::Overflow)));
-        assert_eq!(obsolete("-42949672k"), Some(Err(ParseError::Overflow)));
+    #[test]
+    #[cfg(target_pointer_width = "32")]
+    fn test_parse_obsolete_overflow_x32() {
+        assert_eq!(obsolete("-42949672960"), Some(Err(ParseError::Overflow)));
+        assert_eq!(obsolete("-42949672k"), Some(Err(ParseError::Overflow)));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/paths.rs.html b/dev/src/uu_tail/paths.rs.html index 8618eef93..b5da422da 100644 --- a/dev/src/uu_tail/paths.rs.html +++ b/dev/src/uu_tail/paths.rs.html @@ -1,4 +1,4 @@ -paths.rs - source
1
+paths.rs - source
1
 2
 3
 4
@@ -280,287 +280,287 @@
 280
 281
 282
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore tailable seekable stdlib (stdlib)
+// spell-checker:ignore tailable seekable stdlib (stdlib)
 
-#[cfg(unix)]
-use std::os::unix::fs::{FileTypeExt, MetadataExt};
+#[cfg(unix)]
+use std::os::unix::fs::{FileTypeExt, MetadataExt};
 
-use std::collections::VecDeque;
-use std::fs::{File, Metadata};
-use std::io::{Seek, SeekFrom};
-use std::path::{Path, PathBuf};
+use std::collections::VecDeque;
+use std::fs::{File, Metadata};
+use std::io::{Seek, SeekFrom};
+use std::path::{Path, PathBuf};
 
-use uucore::error::UResult;
+use uucore::error::UResult;
 
-use crate::args::Settings;
-use crate::text;
+use crate::args::Settings;
+use crate::text;
 
-//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-#[derive(Debug, Clone)]
-pub enum InputKind {
-    File(PathBuf),
-    Stdin,
+#[derive(Debug, Clone)]
+pub enum InputKind {
+    File(PathBuf),
+    Stdin,
 }
 
-#[derive(Debug, Clone)]
-pub struct Input {
-    kind: InputKind,
-    pub display_name: String,
+#[derive(Debug, Clone)]
+pub struct Input {
+    kind: InputKind,
+    pub display_name: String,
 }
 
-impl Input {
-    pub fn from(string: String) -> Self {
-        let kind = if string == text::DASH {
-            InputKind::Stdin
-        } else {
-            InputKind::File(PathBuf::from(&string))
+impl Input {
+    pub fn from(string: String) -> Self {
+        let kind = if string == text::DASH {
+            InputKind::Stdin
+        } else {
+            InputKind::File(PathBuf::from(&string))
         };
 
-        let display_name = match kind {
-            InputKind::File(_) => string,
-            InputKind::Stdin => {
-                if cfg!(unix) {
-                    text::STDIN_HEADER.to_string()
-                } else {
-                    string
+        let display_name = match kind {
+            InputKind::File(_) => string,
+            InputKind::Stdin => {
+                if cfg!(unix) {
+                    text::STDIN_HEADER.to_string()
+                } else {
+                    string
                 }
             }
         };
 
-        Self { kind, display_name }
+        Self { kind, display_name }
     }
 
-    pub fn kind(&self) -> &InputKind {
-        &self.kind
+    pub fn kind(&self) -> &InputKind {
+        &self.kind
     }
 
-    pub fn is_stdin(&self) -> bool {
-        match self.kind {
-            InputKind::File(_) => false,
-            InputKind::Stdin => true,
+    pub fn is_stdin(&self) -> bool {
+        match self.kind {
+            InputKind::File(_) => false,
+            InputKind::Stdin => true,
         }
     }
 
-    pub fn resolve(&self) -> Option<PathBuf> {
-        match &self.kind {
-            InputKind::File(path) if path != &PathBuf::from(text::DEV_STDIN) => {
-                path.canonicalize().ok()
+    pub fn resolve(&self) -> Option<PathBuf> {
+        match &self.kind {
+            InputKind::File(path) if path != &PathBuf::from(text::DEV_STDIN) => {
+                path.canonicalize().ok()
             }
-            InputKind::File(_) | InputKind::Stdin => {
-                if cfg!(unix) {
-                    match PathBuf::from(text::DEV_STDIN).canonicalize().ok() {
-                        Some(path) if path != PathBuf::from(text::FD0) => Some(path),
-                        Some(_) | None => None,
+            InputKind::File(_) | InputKind::Stdin => {
+                if cfg!(unix) {
+                    match PathBuf::from(text::DEV_STDIN).canonicalize().ok() {
+                        Some(path) if path != PathBuf::from(text::FD0) => Some(path),
+                        Some(_) | None => None,
                     }
-                } else {
-                    None
-                }
+                } else {
+                    None
+                }
             }
         }
     }
 
-    pub fn is_tailable(&self) -> bool {
-        match &self.kind {
-            InputKind::File(path) => path_is_tailable(path),
-            InputKind::Stdin => self.resolve().map_or(false, |path| path_is_tailable(&path)),
+    pub fn is_tailable(&self) -> bool {
+        match &self.kind {
+            InputKind::File(path) => path_is_tailable(path),
+            InputKind::Stdin => self.resolve().map_or(false, |path| path_is_tailable(&path)),
         }
     }
 }
 
-impl Default for Input {
-    fn default() -> Self {
-        Self {
-            kind: InputKind::Stdin,
-            display_name: String::from(text::STDIN_HEADER),
+impl Default for Input {
+    fn default() -> Self {
+        Self {
+            kind: InputKind::Stdin,
+            display_name: String::from(text::STDIN_HEADER),
         }
     }
 }
 
-#[derive(Debug, Default, Clone, Copy)]
-pub struct HeaderPrinter {
-    verbose: bool,
-    first_header: bool,
+#[derive(Debug, Default, Clone, Copy)]
+pub struct HeaderPrinter {
+    verbose: bool,
+    first_header: bool,
 }
 
-impl HeaderPrinter {
-    pub fn new(verbose: bool, first_header: bool) -> Self {
-        Self {
-            verbose,
-            first_header,
+impl HeaderPrinter {
+    pub fn new(verbose: bool, first_header: bool) -> Self {
+        Self {
+            verbose,
+            first_header,
         }
     }
 
-    pub fn print_input(&mut self, input: &Input) {
-        self.print(input.display_name.as_str());
+    pub fn print_input(&mut self, input: &Input) {
+        self.print(input.display_name.as_str());
     }
 
-    pub fn print(&mut self, string: &str) {
-        if self.verbose {
+    pub fn print(&mut self, string: &str) {
+        if self.verbose {
             println!(
                 "{}==> {} <==",
-                if self.first_header { "" } else { "\n" },
-                string,
+                if self.first_header { "" } else { "\n" },
+                string,
             );
-            self.first_header = false;
+            self.first_header = false;
         }
     }
 }
 
-#[derive(Debug, Clone)]
-pub struct InputService {
-    pub inputs: VecDeque<Input>,
-    pub presume_input_pipe: bool,
-    pub header_printer: HeaderPrinter,
+#[derive(Debug, Clone)]
+pub struct InputService {
+    pub inputs: VecDeque<Input>,
+    pub presume_input_pipe: bool,
+    pub header_printer: HeaderPrinter,
 }
 
-impl InputService {
-    pub fn new(verbose: bool, presume_input_pipe: bool, inputs: VecDeque<Input>) -> Self {
-        Self {
-            inputs,
-            presume_input_pipe,
-            header_printer: HeaderPrinter::new(verbose, true),
+impl InputService {
+    pub fn new(verbose: bool, presume_input_pipe: bool, inputs: VecDeque<Input>) -> Self {
+        Self {
+            inputs,
+            presume_input_pipe,
+            header_printer: HeaderPrinter::new(verbose, true),
         }
     }
 
-    pub fn from(settings: &Settings) -> Self {
-        Self::new(
-            settings.verbose,
-            settings.presume_input_pipe,
-            settings.inputs.clone(),
+    pub fn from(settings: &Settings) -> Self {
+        Self::new(
+            settings.verbose,
+            settings.presume_input_pipe,
+            settings.inputs.clone(),
         )
     }
 
-    pub fn has_stdin(&mut self) -> bool {
-        self.inputs.iter().any(|input| input.is_stdin())
+    pub fn has_stdin(&mut self) -> bool {
+        self.inputs.iter().any(|input| input.is_stdin())
     }
 
-    pub fn has_only_stdin(&self) -> bool {
-        self.inputs.iter().all(|input| input.is_stdin())
+    pub fn has_only_stdin(&self) -> bool {
+        self.inputs.iter().all(|input| input.is_stdin())
     }
 
-    pub fn print_header(&mut self, input: &Input) {
-        self.header_printer.print_input(input);
+    pub fn print_header(&mut self, input: &Input) {
+        self.header_printer.print_input(input);
     }
 }
 
-pub trait FileExtTail {
-    #[allow(clippy::wrong_self_convention)]
-    fn is_seekable(&mut self, current_offset: u64) -> bool;
+pub trait FileExtTail {
+    #[allow(clippy::wrong_self_convention)]
+    fn is_seekable(&mut self, current_offset: u64) -> bool;
 }
 
-impl FileExtTail for File {
-    /// Test if File is seekable.
-    /// Set the current position offset to `current_offset`.
-    fn is_seekable(&mut self, current_offset: u64) -> bool {
-        self.seek(SeekFrom::Current(0)).is_ok()
-            && self.seek(SeekFrom::End(0)).is_ok()
-            && self.seek(SeekFrom::Start(current_offset)).is_ok()
+impl FileExtTail for File {
+    /// Test if File is seekable.
+    /// Set the current position offset to `current_offset`.
+    fn is_seekable(&mut self, current_offset: u64) -> bool {
+        self.seek(SeekFrom::Current(0)).is_ok()
+            && self.seek(SeekFrom::End(0)).is_ok()
+            && self.seek(SeekFrom::Start(current_offset)).is_ok()
     }
 }
 
-pub trait MetadataExtTail {
-    fn is_tailable(&self) -> bool;
-    fn got_truncated(&self, other: &Metadata) -> UResult<bool>;
-    fn get_block_size(&self) -> u64;
-    fn file_id_eq(&self, other: &Metadata) -> bool;
+pub trait MetadataExtTail {
+    fn is_tailable(&self) -> bool;
+    fn got_truncated(&self, other: &Metadata) -> UResult<bool>;
+    fn get_block_size(&self) -> u64;
+    fn file_id_eq(&self, other: &Metadata) -> bool;
 }
 
-impl MetadataExtTail for Metadata {
-    fn is_tailable(&self) -> bool {
-        let ft = self.file_type();
-        #[cfg(unix)]
-        {
-            ft.is_file() || ft.is_char_device() || ft.is_fifo()
+impl MetadataExtTail for Metadata {
+    fn is_tailable(&self) -> bool {
+        let ft = self.file_type();
+        #[cfg(unix)]
+        {
+            ft.is_file() || ft.is_char_device() || ft.is_fifo()
         }
-        #[cfg(not(unix))]
-        {
-            ft.is_file()
+        #[cfg(not(unix))]
+        {
+            ft.is_file()
         }
     }
 
-    /// Return true if the file was modified and is now shorter
-    fn got_truncated(&self, other: &Metadata) -> UResult<bool> {
-        Ok(other.len() < self.len() && other.modified()? != self.modified()?)
+    /// Return true if the file was modified and is now shorter
+    fn got_truncated(&self, other: &Metadata) -> UResult<bool> {
+        Ok(other.len() < self.len() && other.modified()? != self.modified()?)
     }
 
-    fn get_block_size(&self) -> u64 {
-        #[cfg(unix)]
-        {
-            self.blocks()
+    fn get_block_size(&self) -> u64 {
+        #[cfg(unix)]
+        {
+            self.blocks()
         }
-        #[cfg(not(unix))]
-        {
-            self.len()
+        #[cfg(not(unix))]
+        {
+            self.len()
         }
     }
 
-    fn file_id_eq(&self, _other: &Metadata) -> bool {
-        #[cfg(unix)]
-        {
-            self.ino().eq(&_other.ino())
-        }
-        #[cfg(windows)]
-        {
-            // use std::os::windows::prelude::*;
-            // if let Some(self_id) = self.file_index() {
-            //     if let Some(other_id) = other.file_index() {
-            //
-            //         return self_id.eq(&other_id);
-            //     }
-            // }
-            false
+    fn file_id_eq(&self, _other: &Metadata) -> bool {
+        #[cfg(unix)]
+        {
+            self.ino().eq(&_other.ino())
         }
+        #[cfg(windows)]
+        {
+            // use std::os::windows::prelude::*;
+            // if let Some(self_id) = self.file_index() {
+            //     if let Some(other_id) = other.file_index() {
+            //
+            //         return self_id.eq(&other_id);
+            //     }
+            // }
+            false
+        }
     }
 }
 
-pub trait PathExtTail {
-    fn is_stdin(&self) -> bool;
-    fn is_orphan(&self) -> bool;
-    fn is_tailable(&self) -> bool;
+pub trait PathExtTail {
+    fn is_stdin(&self) -> bool;
+    fn is_orphan(&self) -> bool;
+    fn is_tailable(&self) -> bool;
 }
 
-impl PathExtTail for Path {
-    fn is_stdin(&self) -> bool {
-        self.eq(Self::new(text::DASH))
-            || self.eq(Self::new(text::DEV_STDIN))
-            || self.eq(Self::new(text::STDIN_HEADER))
+impl PathExtTail for Path {
+    fn is_stdin(&self) -> bool {
+        self.eq(Self::new(text::DASH))
+            || self.eq(Self::new(text::DEV_STDIN))
+            || self.eq(Self::new(text::STDIN_HEADER))
     }
 
-    /// Return true if `path` does not have an existing parent directory
-    fn is_orphan(&self) -> bool {
-        !matches!(self.parent(), Some(parent) if parent.is_dir())
+    /// Return true if `path` does not have an existing parent directory
+    fn is_orphan(&self) -> bool {
+        !matches!(self.parent(), Some(parent) if parent.is_dir())
     }
 
-    /// Return true if `path` is is a file type that can be tailed
-    fn is_tailable(&self) -> bool {
-        path_is_tailable(self)
+    /// Return true if `path` is is a file type that can be tailed
+    fn is_tailable(&self) -> bool {
+        path_is_tailable(self)
     }
 }
 
-pub fn path_is_tailable(path: &Path) -> bool {
-    path.is_file() || path.exists() && path.metadata().map_or(false, |meta| meta.is_tailable())
+pub fn path_is_tailable(path: &Path) -> bool {
+    path.is_file() || path.exists() && path.metadata().map_or(false, |meta| meta.is_tailable())
 }
 
-#[inline]
-pub fn stdin_is_bad_fd() -> bool {
-    // FIXME : Rust's stdlib is reopening fds as /dev/null
-    // see also: https://github.com/uutils/coreutils/issues/2873
-    // (gnu/tests/tail-2/follow-stdin.sh fails because of this)
-    //#[cfg(unix)]
-    {
-        //platform::stdin_is_bad_fd()
-    }
-    //#[cfg(not(unix))]
-    false
-}
+#[inline]
+pub fn stdin_is_bad_fd() -> bool {
+    // FIXME : Rust's stdlib is reopening fds as /dev/null
+    // see also: https://github.com/uutils/coreutils/issues/2873
+    // (gnu/tests/tail-2/follow-stdin.sh fails because of this)
+    //#[cfg(unix)]
+    {
+        //platform::stdin_is_bad_fd()
+    }
+    //#[cfg(not(unix))]
+    false
+}
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/platform/mod.rs.html b/dev/src/uu_tail/platform/mod.rs.html index b9dec8009..5164fa0fa 100644 --- a/dev/src/uu_tail/platform/mod.rs.html +++ b/dev/src/uu_tail/platform/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
@@ -33,24 +33,24 @@
  *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
- */
+ */
 
-#[cfg(unix)]
-pub use self::unix::{
-    //stdin_is_bad_fd, stdin_is_pipe_or_fifo, supports_pid_checks, Pid, ProcessChecker,
-    stdin_is_pipe_or_fifo,
-    supports_pid_checks,
-    Pid,
-    ProcessChecker,
+#[cfg(unix)]
+pub use self::unix::{
+    //stdin_is_bad_fd, stdin_is_pipe_or_fifo, supports_pid_checks, Pid, ProcessChecker,
+    stdin_is_pipe_or_fifo,
+    supports_pid_checks,
+    Pid,
+    ProcessChecker,
 };
 
-#[cfg(windows)]
-pub use self::windows::{supports_pid_checks, Pid, ProcessChecker};
+#[cfg(windows)]
+pub use self::windows::{supports_pid_checks, Pid, ProcessChecker};
 
-#[cfg(unix)]
-mod unix;
+#[cfg(unix)]
+mod unix;
 
-#[cfg(windows)]
-mod windows;
+#[cfg(windows)]
+mod windows;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/platform/unix.rs.html b/dev/src/uu_tail/platform/unix.rs.html index 6315b7c01..38e41ea14 100644 --- a/dev/src/uu_tail/platform/unix.rs.html +++ b/dev/src/uu_tail/platform/unix.rs.html @@ -1,4 +1,4 @@ -unix.rs - source
1
+unix.rs - source
1
 2
 3
 4
@@ -69,60 +69,60 @@
  *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
- */
+ */
 
-// spell-checker:ignore (ToDO) stdlib, ISCHR, GETFD
-// spell-checker:ignore (options) EPERM, ENOSYS
+// spell-checker:ignore (ToDO) stdlib, ISCHR, GETFD
+// spell-checker:ignore (options) EPERM, ENOSYS
 
-use libc::S_IFCHR;
-use nix::sys::stat::fstat;
-use std::io::Error;
+use libc::S_IFCHR;
+use nix::sys::stat::fstat;
+use std::io::Error;
 
-pub type Pid = libc::pid_t;
+pub type Pid = libc::pid_t;
 
-pub struct ProcessChecker {
-    pid: self::Pid,
+pub struct ProcessChecker {
+    pid: self::Pid,
 }
 
-impl ProcessChecker {
-    pub fn new(process_id: self::Pid) -> Self {
-        Self { pid: process_id }
+impl ProcessChecker {
+    pub fn new(process_id: self::Pid) -> Self {
+        Self { pid: process_id }
     }
 
-    // Borrowing mutably to be aligned with Windows implementation
-    #[allow(clippy::wrong_self_convention)]
-    pub fn is_dead(&mut self) -> bool {
-        unsafe { libc::kill(self.pid, 0) != 0 && get_errno() != libc::EPERM }
+    // Borrowing mutably to be aligned with Windows implementation
+    #[allow(clippy::wrong_self_convention)]
+    pub fn is_dead(&mut self) -> bool {
+        unsafe { libc::kill(self.pid, 0) != 0 && get_errno() != libc::EPERM }
     }
 }
 
-impl Drop for ProcessChecker {
-    fn drop(&mut self) {}
+impl Drop for ProcessChecker {
+    fn drop(&mut self) {}
 }
 
-pub fn supports_pid_checks(pid: self::Pid) -> bool {
-    unsafe { !(libc::kill(pid, 0) != 0 && get_errno() == libc::ENOSYS) }
+pub fn supports_pid_checks(pid: self::Pid) -> bool {
+    unsafe { !(libc::kill(pid, 0) != 0 && get_errno() == libc::ENOSYS) }
 }
 
-#[inline]
-fn get_errno() -> i32 {
-    Error::last_os_error().raw_os_error().unwrap()
+#[inline]
+fn get_errno() -> i32 {
+    Error::last_os_error().raw_os_error().unwrap()
 }
-#[inline]
-pub fn stdin_is_pipe_or_fifo() -> bool {
-    // IFCHR means the file (stdin) is a character input device, which is the case of a terminal.
-    // We just need to check if stdin is not a character device here, because we are not interested
-    // in the type of stdin itself.
-    fstat(libc::STDIN_FILENO).map_or(false, |file| file.st_mode as libc::mode_t & S_IFCHR == 0)
+#[inline]
+pub fn stdin_is_pipe_or_fifo() -> bool {
+    // IFCHR means the file (stdin) is a character input device, which is the case of a terminal.
+    // We just need to check if stdin is not a character device here, because we are not interested
+    // in the type of stdin itself.
+    fstat(libc::STDIN_FILENO).map_or(false, |file| file.st_mode as libc::mode_t & S_IFCHR == 0)
 }
 
-//pub fn stdin_is_bad_fd() -> bool {
-// FIXME: Detect a closed file descriptor, e.g.: `tail <&-`
-// this is never `true`, even with `<&-` because Rust's stdlib is reopening fds as /dev/null
-// see also: https://github.com/uutils/coreutils/issues/2873
-// (gnu/tests/tail-2/follow-stdin.sh fails because of this)
-// unsafe { libc::fcntl(fd, libc::F_GETFD) == -1 && get_errno() == libc::EBADF }
-//false
-//}
-
-
\ No newline at end of file +//pub fn stdin_is_bad_fd() -> bool { +// FIXME: Detect a closed file descriptor, e.g.: `tail <&-` +// this is never `true`, even with `<&-` because Rust's stdlib is reopening fds as /dev/null +// see also: https://github.com/uutils/coreutils/issues/2873 +// (gnu/tests/tail-2/follow-stdin.sh fails because of this) +// unsafe { libc::fcntl(fd, libc::F_GETFD) == -1 && get_errno() == libc::EBADF } +//false +//} +
+
\ No newline at end of file diff --git a/dev/src/uu_tail/tail.rs.html b/dev/src/uu_tail/tail.rs.html index 059166e55..e9ed7eac3 100644 --- a/dev/src/uu_tail/tail.rs.html +++ b/dev/src/uu_tail/tail.rs.html @@ -1,4 +1,4 @@ -tail.rs - source
1
+tail.rs - source
1
 2
 3
 4
@@ -508,95 +508,95 @@
 508
 509
 510
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Morten Olsen Lysgaard <morten@lysgaard.no>
-//  * (c) Alexander Batischev <eual.jp@gmail.com>
-//  * (c) Thomas Queiroz <thomasqueirozb@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Morten Olsen Lysgaard <morten@lysgaard.no>
+//  * (c) Alexander Batischev <eual.jp@gmail.com>
+//  * (c) Thomas Queiroz <thomasqueirozb@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) seekable seek'd tail'ing ringbuffer ringbuf unwatch Uncategorized filehandle Signum
-// spell-checker:ignore (libs) kqueue
-// spell-checker:ignore (acronyms)
-// spell-checker:ignore (env/flags)
-// spell-checker:ignore (jargon) tailable untailable stdlib
-// spell-checker:ignore (names)
-// spell-checker:ignore (shell/tools)
-// spell-checker:ignore (misc)
+// spell-checker:ignore (ToDO) seekable seek'd tail'ing ringbuffer ringbuf unwatch Uncategorized filehandle Signum
+// spell-checker:ignore (libs) kqueue
+// spell-checker:ignore (acronyms)
+// spell-checker:ignore (env/flags)
+// spell-checker:ignore (jargon) tailable untailable stdlib
+// spell-checker:ignore (names)
+// spell-checker:ignore (shell/tools)
+// spell-checker:ignore (misc)
 
-#[macro_use]
-extern crate clap;
+#[macro_use]
+extern crate clap;
 
-#[macro_use]
-extern crate uucore;
-extern crate core;
+#[macro_use]
+extern crate uucore;
+extern crate core;
 
-pub mod args;
-pub mod chunks;
-mod follow;
-mod parse;
-mod paths;
-mod platform;
-pub mod text;
+pub mod args;
+pub mod chunks;
+mod follow;
+mod parse;
+mod paths;
+mod platform;
+pub mod text;
 
-use same_file::Handle;
-use std::cmp::Ordering;
-use std::fs::File;
-use std::io::{self, stdin, stdout, BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write};
-use std::path::{Path, PathBuf};
+use same_file::Handle;
+use std::cmp::Ordering;
+use std::fs::File;
+use std::io::{self, stdin, stdout, BufRead, BufReader, BufWriter, Read, Seek, SeekFrom, Write};
+use std::path::{Path, PathBuf};
 
-use uucore::display::Quotable;
-use uucore::error::{get_exit_code, set_exit_code, FromIo, UError, UResult, USimpleError};
+use uucore::display::Quotable;
+use uucore::error::{get_exit_code, set_exit_code, FromIo, UError, UResult, USimpleError};
 
-pub use args::uu_app;
-use args::{parse_args, FilterMode, Settings, Signum};
-use chunks::ReverseChunks;
-use follow::WatcherService;
-use paths::{FileExtTail, Input, InputKind, InputService, MetadataExtTail};
+pub use args::uu_app;
+use args::{parse_args, FilterMode, Settings, Signum};
+use chunks::ReverseChunks;
+use follow::WatcherService;
+use paths::{FileExtTail, Input, InputKind, InputService, MetadataExtTail};
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let settings = parse_args(args)?;
-    uu_tail(&settings)
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let settings = parse_args(args)?;
+    uu_tail(&settings)
 }
 
-fn uu_tail(settings: &Settings) -> UResult<()> {
-    // Mimic GNU's tail for `tail -F` and exit immediately
-    let mut input_service = InputService::from(settings);
-    let mut watcher_service = WatcherService::from(settings);
+fn uu_tail(settings: &Settings) -> UResult<()> {
+    // Mimic GNU's tail for `tail -F` and exit immediately
+    let mut input_service = InputService::from(settings);
+    let mut watcher_service = WatcherService::from(settings);
 
-    if input_service.has_stdin() && watcher_service.follow_name() {
-        return Err(USimpleError::new(
+    if input_service.has_stdin() && watcher_service.follow_name() {
+        return Err(USimpleError::new(
             1,
-            format!("cannot follow {} by name", text::DASH.quote()),
+            format!("cannot follow {} by name", text::DASH.quote()),
         ));
     }
 
-    watcher_service.start(settings)?;
-    // Do an initial tail print of each path's content.
-    // Add `path` and `reader` to `files` map if `--follow` is selected.
-    for input in &input_service.inputs.clone() {
-        match input.kind() {
-            InputKind::File(path) if cfg!(not(unix)) || path != &PathBuf::from(text::DEV_STDIN) => {
-                tail_file(
-                    settings,
-                    &mut input_service,
-                    input,
-                    path,
-                    &mut watcher_service,
+    watcher_service.start(settings)?;
+    // Do an initial tail print of each path's content.
+    // Add `path` and `reader` to `files` map if `--follow` is selected.
+    for input in &input_service.inputs.clone() {
+        match input.kind() {
+            InputKind::File(path) if cfg!(not(unix)) || path != &PathBuf::from(text::DEV_STDIN) => {
+                tail_file(
+                    settings,
+                    &mut input_service,
+                    input,
+                    path,
+                    &mut watcher_service,
                     0,
                 )?;
             }
-            // File points to /dev/stdin here
-            InputKind::File(_) | InputKind::Stdin => {
-                tail_stdin(settings, &mut input_service, input, &mut watcher_service)?;
+            // File points to /dev/stdin here
+            InputKind::File(_) | InputKind::Stdin => {
+                tail_stdin(settings, &mut input_service, input, &mut watcher_service)?;
             }
         }
     }
 
-    if settings.follow.is_some() {
+    if settings.follow.is_some() {
         /*
         POSIX specification regarding tail -f
         If the input file is a regular file or if the file operand specifies a FIFO, do not
@@ -605,158 +605,158 @@
         specified and standard input is a pipe or FIFO, the -f option shall be ignored. If
         the input file is not a FIFO, pipe, or regular file, it is unspecified whether or
         not the -f option shall be ignored.
-        */
+        */
 
-        if !input_service.has_only_stdin() {
-            follow::follow(watcher_service, settings)?;
+        if !input_service.has_only_stdin() {
+            follow::follow(watcher_service, settings)?;
         }
     }
 
-    if get_exit_code() > 0 && paths::stdin_is_bad_fd() {
-        show_error!("-: {}", text::BAD_FD);
+    if get_exit_code() > 0 && paths::stdin_is_bad_fd() {
+        show_error!("-: {}", text::BAD_FD);
     }
 
     Ok(())
 }
 
-fn tail_file(
-    settings: &Settings,
-    input_service: &mut InputService,
-    input: &Input,
-    path: &Path,
-    watcher_service: &mut WatcherService,
-    offset: u64,
-) -> UResult<()> {
-    if watcher_service.follow_descriptor_retry() {
+fn tail_file(
+    settings: &Settings,
+    input_service: &mut InputService,
+    input: &Input,
+    path: &Path,
+    watcher_service: &mut WatcherService,
+    offset: u64,
+) -> UResult<()> {
+    if watcher_service.follow_descriptor_retry() {
         show_warning!("--retry only effective for the initial open");
     }
 
-    if !path.exists() {
-        set_exit_code(1);
+    if !path.exists() {
+        set_exit_code(1);
         show_error!(
             "cannot open '{}' for reading: {}",
-            input.display_name,
-            text::NO_SUCH_FILE
+            input.display_name,
+            text::NO_SUCH_FILE
         );
-        watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
-    } else if path.is_dir() {
-        set_exit_code(1);
+        watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
+    } else if path.is_dir() {
+        set_exit_code(1);
 
-        input_service.print_header(input);
-        let err_msg = "Is a directory".to_string();
+        input_service.print_header(input);
+        let err_msg = "Is a directory".to_string();
 
-        show_error!("error reading '{}': {}", input.display_name, err_msg);
-        if settings.follow.is_some() {
-            let msg = if !settings.retry {
-                "; giving up on this name"
-            } else {
-                ""
-            };
+        show_error!("error reading '{}': {}", input.display_name, err_msg);
+        if settings.follow.is_some() {
+            let msg = if !settings.retry {
+                "; giving up on this name"
+            } else {
+                ""
+            };
             show_error!(
                 "{}: cannot follow end of this type of file{}",
-                input.display_name,
-                msg
+                input.display_name,
+                msg
             );
         }
-        if !(watcher_service.follow_name_retry()) {
-            // skip directory if not retry
-            return Ok(());
+        if !(watcher_service.follow_name_retry()) {
+            // skip directory if not retry
+            return Ok(());
         }
-        watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
-    } else if input.is_tailable() {
-        let metadata = path.metadata().ok();
-        match File::open(path) {
-            Ok(mut file) => {
-                input_service.print_header(input);
-                let mut reader;
-                if !settings.presume_input_pipe
-                    && file.is_seekable(if input.is_stdin() { offset } else { 0 })
-                    && metadata.as_ref().unwrap().get_block_size() > 0
-                {
-                    bounded_tail(&mut file, settings);
-                    reader = BufReader::new(file);
-                } else {
-                    reader = BufReader::new(file);
-                    unbounded_tail(&mut reader, settings)?;
+        watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
+    } else if input.is_tailable() {
+        let metadata = path.metadata().ok();
+        match File::open(path) {
+            Ok(mut file) => {
+                input_service.print_header(input);
+                let mut reader;
+                if !settings.presume_input_pipe
+                    && file.is_seekable(if input.is_stdin() { offset } else { 0 })
+                    && metadata.as_ref().unwrap().get_block_size() > 0
+                {
+                    bounded_tail(&mut file, settings);
+                    reader = BufReader::new(file);
+                } else {
+                    reader = BufReader::new(file);
+                    unbounded_tail(&mut reader, settings)?;
                 }
-                watcher_service.add_path(
-                    path,
-                    input.display_name.as_str(),
-                    Some(Box::new(reader)),
+                watcher_service.add_path(
+                    path,
+                    input.display_name.as_str(),
+                    Some(Box::new(reader)),
                     true,
                 )?;
             }
-            Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => {
-                watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
-                show!(e.map_err_context(|| {
-                    format!("cannot open '{}' for reading", input.display_name)
+            Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => {
+                watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
+                show!(e.map_err_context(|| {
+                    format!("cannot open '{}' for reading", input.display_name)
                 }));
             }
-            Err(e) => {
-                watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
-                return Err(e.map_err_context(|| {
-                    format!("cannot open '{}' for reading", input.display_name)
+            Err(e) => {
+                watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
+                return Err(e.map_err_context(|| {
+                    format!("cannot open '{}' for reading", input.display_name)
                 }));
             }
         }
-    } else {
-        watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
+    } else {
+        watcher_service.add_bad_path(path, input.display_name.as_str(), false)?;
     }
 
     Ok(())
 }
 
-fn tail_stdin(
-    settings: &Settings,
-    input_service: &mut InputService,
-    input: &Input,
-    watcher_service: &mut WatcherService,
-) -> UResult<()> {
-    match input.resolve() {
-        // fifo
-        Some(path) => {
-            let mut stdin_offset = 0;
-            if cfg!(unix) {
-                // Save the current seek position/offset of a stdin redirected file.
-                // This is needed to pass "gnu/tests/tail-2/start-middle.sh"
-                if let Ok(mut stdin_handle) = Handle::stdin() {
-                    if let Ok(offset) = stdin_handle.as_file_mut().seek(SeekFrom::Current(0)) {
-                        stdin_offset = offset;
+fn tail_stdin(
+    settings: &Settings,
+    input_service: &mut InputService,
+    input: &Input,
+    watcher_service: &mut WatcherService,
+) -> UResult<()> {
+    match input.resolve() {
+        // fifo
+        Some(path) => {
+            let mut stdin_offset = 0;
+            if cfg!(unix) {
+                // Save the current seek position/offset of a stdin redirected file.
+                // This is needed to pass "gnu/tests/tail-2/start-middle.sh"
+                if let Ok(mut stdin_handle) = Handle::stdin() {
+                    if let Ok(offset) = stdin_handle.as_file_mut().seek(SeekFrom::Current(0)) {
+                        stdin_offset = offset;
                     }
                 }
             }
-            tail_file(
-                settings,
-                input_service,
-                input,
-                &path,
-                watcher_service,
-                stdin_offset,
+            tail_file(
+                settings,
+                input_service,
+                input,
+                &path,
+                watcher_service,
+                stdin_offset,
             )?;
         }
-        // pipe
-        None => {
-            input_service.print_header(input);
-            if !paths::stdin_is_bad_fd() {
-                let mut reader = BufReader::new(stdin());
-                unbounded_tail(&mut reader, settings)?;
-                watcher_service.add_stdin(
-                    input.display_name.as_str(),
-                    Some(Box::new(reader)),
+        // pipe
+        None => {
+            input_service.print_header(input);
+            if !paths::stdin_is_bad_fd() {
+                let mut reader = BufReader::new(stdin());
+                unbounded_tail(&mut reader, settings)?;
+                watcher_service.add_stdin(
+                    input.display_name.as_str(),
+                    Some(Box::new(reader)),
                     true,
                 )?;
-            } else {
-                set_exit_code(1);
+            } else {
+                set_exit_code(1);
                 show_error!(
                     "cannot fstat {}: {}",
-                    text::STDIN_HEADER.quote(),
-                    text::BAD_FD
+                    text::STDIN_HEADER.quote(),
+                    text::BAD_FD
                 );
-                if settings.follow.is_some() {
+                if settings.follow.is_some() {
                     show_error!(
                         "error reading {}: {}",
-                        text::STDIN_HEADER.quote(),
-                        text::BAD_FD
+                        text::STDIN_HEADER.quote(),
+                        text::BAD_FD
                     );
                 }
             }
@@ -766,117 +766,117 @@
     Ok(())
 }
 
-/// Find the index after the given number of instances of a given byte.
-///
-/// This function reads through a given reader until `num_delimiters`
-/// instances of `delimiter` have been seen, returning the index of
-/// the byte immediately following that delimiter. If there are fewer
-/// than `num_delimiters` instances of `delimiter`, this returns the
-/// total number of bytes read from the `reader` until EOF.
-///
-/// # Errors
-///
-/// This function returns an error if there is an error during reading
-/// from `reader`.
-///
-/// # Examples
-///
-/// Basic usage:
-///
-/// ```rust,ignore
-/// use std::io::Cursor;
-///
-/// let mut reader = Cursor::new("a\nb\nc\nd\ne\n");
-/// let i = forwards_thru_file(&mut reader, 2, b'\n').unwrap();
-/// assert_eq!(i, 4);
-/// ```
-///
-/// If `num_delimiters` is zero, then this function always returns
-/// zero:
-///
-/// ```rust,ignore
-/// use std::io::Cursor;
-///
-/// let mut reader = Cursor::new("a\n");
-/// let i = forwards_thru_file(&mut reader, 0, b'\n').unwrap();
-/// assert_eq!(i, 0);
-/// ```
-///
-/// If there are fewer than `num_delimiters` instances of `delimiter`
-/// in the reader, then this function returns the total number of
-/// bytes read:
-///
-/// ```rust,ignore
-/// use std::io::Cursor;
-///
-/// let mut reader = Cursor::new("a\n");
-/// let i = forwards_thru_file(&mut reader, 2, b'\n').unwrap();
-/// assert_eq!(i, 2);
-/// ```
-fn forwards_thru_file<R>(
-    reader: &mut R,
-    num_delimiters: u64,
-    delimiter: u8,
-) -> std::io::Result<usize>
-where
-    R: Read,
+/// Find the index after the given number of instances of a given byte.
+///
+/// This function reads through a given reader until `num_delimiters`
+/// instances of `delimiter` have been seen, returning the index of
+/// the byte immediately following that delimiter. If there are fewer
+/// than `num_delimiters` instances of `delimiter`, this returns the
+/// total number of bytes read from the `reader` until EOF.
+///
+/// # Errors
+///
+/// This function returns an error if there is an error during reading
+/// from `reader`.
+///
+/// # Examples
+///
+/// Basic usage:
+///
+/// ```rust,ignore
+/// use std::io::Cursor;
+///
+/// let mut reader = Cursor::new("a\nb\nc\nd\ne\n");
+/// let i = forwards_thru_file(&mut reader, 2, b'\n').unwrap();
+/// assert_eq!(i, 4);
+/// ```
+///
+/// If `num_delimiters` is zero, then this function always returns
+/// zero:
+///
+/// ```rust,ignore
+/// use std::io::Cursor;
+///
+/// let mut reader = Cursor::new("a\n");
+/// let i = forwards_thru_file(&mut reader, 0, b'\n').unwrap();
+/// assert_eq!(i, 0);
+/// ```
+///
+/// If there are fewer than `num_delimiters` instances of `delimiter`
+/// in the reader, then this function returns the total number of
+/// bytes read:
+///
+/// ```rust,ignore
+/// use std::io::Cursor;
+///
+/// let mut reader = Cursor::new("a\n");
+/// let i = forwards_thru_file(&mut reader, 2, b'\n').unwrap();
+/// assert_eq!(i, 2);
+/// ```
+fn forwards_thru_file<R>(
+    reader: &mut R,
+    num_delimiters: u64,
+    delimiter: u8,
+) -> std::io::Result<usize>
+where
+    R: Read,
 {
-    let mut reader = BufReader::new(reader);
+    let mut reader = BufReader::new(reader);
 
-    let mut buf = vec![];
-    let mut total = 0;
-    for _ in 0..num_delimiters {
-        match reader.read_until(delimiter, &mut buf) {
+    let mut buf = vec![];
+    let mut total = 0;
+    for _ in 0..num_delimiters {
+        match reader.read_until(delimiter, &mut buf) {
             Ok(0) => {
-                return Ok(total);
+                return Ok(total);
             }
-            Ok(n) => {
-                total += n;
-                buf.clear();
+            Ok(n) => {
+                total += n;
+                buf.clear();
                 continue;
             }
-            Err(e) => {
-                return Err(e);
+            Err(e) => {
+                return Err(e);
             }
         }
     }
-    Ok(total)
+    Ok(total)
 }
 
-/// Iterate over bytes in the file, in reverse, until we find the
-/// `num_delimiters` instance of `delimiter`. The `file` is left seek'd to the
-/// position just after that delimiter.
-fn backwards_thru_file(file: &mut File, num_delimiters: u64, delimiter: u8) {
-    // This variable counts the number of delimiters found in the file
-    // so far (reading from the end of the file toward the beginning).
-    let mut counter = 0;
+/// Iterate over bytes in the file, in reverse, until we find the
+/// `num_delimiters` instance of `delimiter`. The `file` is left seek'd to the
+/// position just after that delimiter.
+fn backwards_thru_file(file: &mut File, num_delimiters: u64, delimiter: u8) {
+    // This variable counts the number of delimiters found in the file
+    // so far (reading from the end of the file toward the beginning).
+    let mut counter = 0;
 
-    for (block_idx, slice) in ReverseChunks::new(file).enumerate() {
-        // Iterate over each byte in the slice in reverse order.
-        let mut iter = slice.iter().enumerate().rev();
+    for (block_idx, slice) in ReverseChunks::new(file).enumerate() {
+        // Iterate over each byte in the slice in reverse order.
+        let mut iter = slice.iter().enumerate().rev();
 
-        // Ignore a trailing newline in the last block, if there is one.
-        if block_idx == 0 {
-            if let Some(c) = slice.last() {
-                if *c == delimiter {
-                    iter.next();
+        // Ignore a trailing newline in the last block, if there is one.
+        if block_idx == 0 {
+            if let Some(c) = slice.last() {
+                if *c == delimiter {
+                    iter.next();
                 }
             }
         }
 
-        // For each byte, increment the count of the number of
-        // delimiters found. If we have found more than the specified
-        // number of delimiters, terminate the search and seek to the
-        // appropriate location in the file.
-        for (i, ch) in iter {
-            if *ch == delimiter {
-                counter += 1;
-                if counter >= num_delimiters {
-                    // After each iteration of the outer loop, the
-                    // cursor in the file is at the *beginning* of the
-                    // block, so seeking forward by `i + 1` bytes puts
-                    // us right after the found delimiter.
-                    file.seek(SeekFrom::Current((i + 1) as i64)).unwrap();
+        // For each byte, increment the count of the number of
+        // delimiters found. If we have found more than the specified
+        // number of delimiters, terminate the search and seek to the
+        // appropriate location in the file.
+        for (i, ch) in iter {
+            if *ch == delimiter {
+                counter += 1;
+                if counter >= num_delimiters {
+                    // After each iteration of the outer loop, the
+                    // cursor in the file is at the *beginning* of the
+                    // block, so seeking forward by `i + 1` bytes puts
+                    // us right after the found delimiter.
+                    file.seek(SeekFrom::Current((i + 1) as i64)).unwrap();
                     return;
                 }
             }
@@ -884,139 +884,139 @@
     }
 }
 
-/// When tail'ing a file, we do not need to read the whole file from start to
-/// finish just to find the last n lines or bytes. Instead, we can seek to the
-/// end of the file, and then read the file "backwards" in blocks of size
-/// `BLOCK_SIZE` until we find the location of the first line/byte. This ends up
-/// being a nice performance win for very large files.
-fn bounded_tail(file: &mut File, settings: &Settings) {
-    debug_assert!(!settings.presume_input_pipe);
+/// When tail'ing a file, we do not need to read the whole file from start to
+/// finish just to find the last n lines or bytes. Instead, we can seek to the
+/// end of the file, and then read the file "backwards" in blocks of size
+/// `BLOCK_SIZE` until we find the location of the first line/byte. This ends up
+/// being a nice performance win for very large files.
+fn bounded_tail(file: &mut File, settings: &Settings) {
+    debug_assert!(!settings.presume_input_pipe);
 
-    // Find the position in the file to start printing from.
-    match &settings.mode {
-        FilterMode::Lines(Signum::Negative(count), delimiter) => {
-            backwards_thru_file(file, *count, *delimiter);
+    // Find the position in the file to start printing from.
+    match &settings.mode {
+        FilterMode::Lines(Signum::Negative(count), delimiter) => {
+            backwards_thru_file(file, *count, *delimiter);
         }
-        FilterMode::Lines(Signum::Positive(count), delimiter) if count > &1 => {
-            let i = forwards_thru_file(file, *count - 1, *delimiter).unwrap();
-            file.seek(SeekFrom::Start(i as u64)).unwrap();
+        FilterMode::Lines(Signum::Positive(count), delimiter) if count > &1 => {
+            let i = forwards_thru_file(file, *count - 1, *delimiter).unwrap();
+            file.seek(SeekFrom::Start(i as u64)).unwrap();
         }
-        FilterMode::Lines(Signum::MinusZero, _) => {
+        FilterMode::Lines(Signum::MinusZero, _) => {
             return;
         }
-        FilterMode::Bytes(Signum::Negative(count)) => {
-            let len = file.seek(SeekFrom::End(0)).unwrap();
-            file.seek(SeekFrom::End(-((*count).min(len) as i64)))
-                .unwrap();
+        FilterMode::Bytes(Signum::Negative(count)) => {
+            let len = file.seek(SeekFrom::End(0)).unwrap();
+            file.seek(SeekFrom::End(-((*count).min(len) as i64)))
+                .unwrap();
         }
-        FilterMode::Bytes(Signum::Positive(count)) if count > &1 => {
-            // GNU `tail` seems to index bytes and lines starting at 1, not
-            // at 0. It seems to treat `+0` and `+1` as the same thing.
-            file.seek(SeekFrom::Start(*count - 1)).unwrap();
+        FilterMode::Bytes(Signum::Positive(count)) if count > &1 => {
+            // GNU `tail` seems to index bytes and lines starting at 1, not
+            // at 0. It seems to treat `+0` and `+1` as the same thing.
+            file.seek(SeekFrom::Start(*count - 1)).unwrap();
         }
-        FilterMode::Bytes(Signum::MinusZero) => {
+        FilterMode::Bytes(Signum::MinusZero) => {
             return;
         }
-        _ => {}
+        _ => {}
     }
 
-    // Print the target section of the file.
-    let stdout = stdout();
-    let mut stdout = stdout.lock();
-    std::io::copy(file, &mut stdout).unwrap();
+    // Print the target section of the file.
+    let stdout = stdout();
+    let mut stdout = stdout.lock();
+    std::io::copy(file, &mut stdout).unwrap();
 }
 
-fn unbounded_tail<T: Read>(reader: &mut BufReader<T>, settings: &Settings) -> UResult<()> {
-    let stdout = stdout();
-    let mut writer = BufWriter::new(stdout.lock());
-    match &settings.mode {
-        FilterMode::Lines(Signum::Negative(count), sep) => {
-            let mut chunks = chunks::LinesChunkBuffer::new(*sep, *count);
-            chunks.fill(reader)?;
-            chunks.print(writer)?;
+fn unbounded_tail<T: Read>(reader: &mut BufReader<T>, settings: &Settings) -> UResult<()> {
+    let stdout = stdout();
+    let mut writer = BufWriter::new(stdout.lock());
+    match &settings.mode {
+        FilterMode::Lines(Signum::Negative(count), sep) => {
+            let mut chunks = chunks::LinesChunkBuffer::new(*sep, *count);
+            chunks.fill(reader)?;
+            chunks.print(writer)?;
         }
-        FilterMode::Lines(Signum::PlusZero | Signum::Positive(1), _) => {
-            io::copy(reader, &mut writer)?;
+        FilterMode::Lines(Signum::PlusZero | Signum::Positive(1), _) => {
+            io::copy(reader, &mut writer)?;
         }
-        FilterMode::Lines(Signum::Positive(count), sep) => {
-            let mut num_skip = *count - 1;
-            let mut chunk = chunks::LinesChunk::new(*sep);
-            while chunk.fill(reader)?.is_some() {
-                let lines = chunk.get_lines() as u64;
-                if lines < num_skip {
-                    num_skip -= lines;
-                } else {
+        FilterMode::Lines(Signum::Positive(count), sep) => {
+            let mut num_skip = *count - 1;
+            let mut chunk = chunks::LinesChunk::new(*sep);
+            while chunk.fill(reader)?.is_some() {
+                let lines = chunk.get_lines() as u64;
+                if lines < num_skip {
+                    num_skip -= lines;
+                } else {
                     break;
                 }
             }
-            if chunk.has_data() {
-                chunk.print_lines(&mut writer, num_skip as usize)?;
-                io::copy(reader, &mut writer)?;
+            if chunk.has_data() {
+                chunk.print_lines(&mut writer, num_skip as usize)?;
+                io::copy(reader, &mut writer)?;
             }
         }
-        FilterMode::Bytes(Signum::Negative(count)) => {
-            let mut chunks = chunks::BytesChunkBuffer::new(*count);
-            chunks.fill(reader)?;
-            chunks.print(writer)?;
+        FilterMode::Bytes(Signum::Negative(count)) => {
+            let mut chunks = chunks::BytesChunkBuffer::new(*count);
+            chunks.fill(reader)?;
+            chunks.print(writer)?;
         }
-        FilterMode::Bytes(Signum::PlusZero | Signum::Positive(1)) => {
-            io::copy(reader, &mut writer)?;
+        FilterMode::Bytes(Signum::PlusZero | Signum::Positive(1)) => {
+            io::copy(reader, &mut writer)?;
         }
-        FilterMode::Bytes(Signum::Positive(count)) => {
-            let mut num_skip = *count - 1;
-            let mut chunk = chunks::BytesChunk::new();
-            loop {
-                if let Some(bytes) = chunk.fill(reader)? {
-                    let bytes: u64 = bytes as u64;
-                    match bytes.cmp(&num_skip) {
-                        Ordering::Less => num_skip -= bytes,
-                        Ordering::Equal => {
+        FilterMode::Bytes(Signum::Positive(count)) => {
+            let mut num_skip = *count - 1;
+            let mut chunk = chunks::BytesChunk::new();
+            loop {
+                if let Some(bytes) = chunk.fill(reader)? {
+                    let bytes: u64 = bytes as u64;
+                    match bytes.cmp(&num_skip) {
+                        Ordering::Less => num_skip -= bytes,
+                        Ordering::Equal => {
                             break;
                         }
-                        Ordering::Greater => {
-                            writer.write_all(chunk.get_buffer_with(num_skip as usize))?;
+                        Ordering::Greater => {
+                            writer.write_all(chunk.get_buffer_with(num_skip as usize))?;
                             break;
                         }
                     }
-                } else {
-                    return Ok(());
+                } else {
+                    return Ok(());
                 }
             }
 
-            io::copy(reader, &mut writer)?;
+            io::copy(reader, &mut writer)?;
         }
-        _ => {}
+        _ => {}
     }
     Ok(())
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use crate::forwards_thru_file;
-    use std::io::Cursor;
+    use crate::forwards_thru_file;
+    use std::io::Cursor;
 
-    #[test]
-    fn test_forwards_thru_file_zero() {
-        let mut reader = Cursor::new("a\n");
-        let i = forwards_thru_file(&mut reader, 0, b'\n').unwrap();
-        assert_eq!(i, 0);
+    #[test]
+    fn test_forwards_thru_file_zero() {
+        let mut reader = Cursor::new("a\n");
+        let i = forwards_thru_file(&mut reader, 0, b'\n').unwrap();
+        assert_eq!(i, 0);
     }
 
-    #[test]
-    fn test_forwards_thru_file_basic() {
-        //                   01 23 45 67 89
-        let mut reader = Cursor::new("a\nb\nc\nd\ne\n");
-        let i = forwards_thru_file(&mut reader, 2, b'\n').unwrap();
-        assert_eq!(i, 4);
+    #[test]
+    fn test_forwards_thru_file_basic() {
+        //                   01 23 45 67 89
+        let mut reader = Cursor::new("a\nb\nc\nd\ne\n");
+        let i = forwards_thru_file(&mut reader, 2, b'\n').unwrap();
+        assert_eq!(i, 4);
     }
 
-    #[test]
-    fn test_forwards_thru_file_past_end() {
-        let mut reader = Cursor::new("x\n");
-        let i = forwards_thru_file(&mut reader, 2, b'\n').unwrap();
-        assert_eq!(i, 2);
+    #[test]
+    fn test_forwards_thru_file_past_end() {
+        let mut reader = Cursor::new("x\n");
+        let i = forwards_thru_file(&mut reader, 2, b'\n').unwrap();
+        assert_eq!(i, 2);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tail/text.rs.html b/dev/src/uu_tail/text.rs.html index 4dd522263..9b3f954c7 100644 --- a/dev/src/uu_tail/text.rs.html +++ b/dev/src/uu_tail/text.rs.html @@ -1,4 +1,4 @@ -text.rs - source
1
+text.rs - source
1
 2
 3
 4
@@ -19,26 +19,26 @@
 19
 20
 21
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) kqueue
+// spell-checker:ignore (ToDO) kqueue
 
-pub static DASH: &str = "-";
-pub static DEV_STDIN: &str = "/dev/stdin";
-pub static STDIN_HEADER: &str = "standard input";
-pub static NO_FILES_REMAINING: &str = "no files remaining";
-pub static NO_SUCH_FILE: &str = "No such file or directory";
-pub static BECOME_INACCESSIBLE: &str = "has become inaccessible";
-pub static BAD_FD: &str = "Bad file descriptor";
-#[cfg(target_os = "linux")]
-pub static BACKEND: &str = "inotify";
-#[cfg(all(unix, not(target_os = "linux")))]
-pub static BACKEND: &str = "kqueue";
-#[cfg(target_os = "windows")]
-pub static BACKEND: &str = "ReadDirectoryChanges";
-pub static FD0: &str = "/dev/fd/0";
+pub static DASH: &str = "-";
+pub static DEV_STDIN: &str = "/dev/stdin";
+pub static STDIN_HEADER: &str = "standard input";
+pub static NO_FILES_REMAINING: &str = "no files remaining";
+pub static NO_SUCH_FILE: &str = "No such file or directory";
+pub static BECOME_INACCESSIBLE: &str = "has become inaccessible";
+pub static BAD_FD: &str = "Bad file descriptor";
+#[cfg(target_os = "linux")]
+pub static BACKEND: &str = "inotify";
+#[cfg(all(unix, not(target_os = "linux")))]
+pub static BACKEND: &str = "kqueue";
+#[cfg(target_os = "windows")]
+pub static BACKEND: &str = "ReadDirectoryChanges";
+pub static FD0: &str = "/dev/fd/0";
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tee/tee.rs.html b/dev/src/uu_tee/tee.rs.html index d0d8cd822..ca1a69f36 100644 --- a/dev/src/uu_tee/tee.rs.html +++ b/dev/src/uu_tee/tee.rs.html @@ -1,4 +1,4 @@ -tee.rs - source
1
+tee.rs - source
1
 2
 3
 4
@@ -390,397 +390,397 @@
 390
 391
 392
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Aleksander Bielawski <pabzdzdzwiagief@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Aleksander Bielawski <pabzdzdzwiagief@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::{builder::PossibleValue, crate_version, Arg, ArgAction, Command};
-use retain_mut::RetainMut;
-use std::fs::OpenOptions;
-use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write};
-use std::path::PathBuf;
-use uucore::display::Quotable;
-use uucore::error::UResult;
-use uucore::format_usage;
+use clap::{builder::PossibleValue, crate_version, Arg, ArgAction, Command};
+use retain_mut::RetainMut;
+use std::fs::OpenOptions;
+use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write};
+use std::path::PathBuf;
+use uucore::display::Quotable;
+use uucore::error::UResult;
+use uucore::format_usage;
 
-// spell-checker:ignore nopipe
+// spell-checker:ignore nopipe
 
-#[cfg(unix)]
-use uucore::libc;
+#[cfg(unix)]
+use uucore::libc;
 
-static ABOUT: &str = "Copy standard input to each FILE, and also to standard output.";
-const USAGE: &str = "{} [OPTION]... [FILE]...";
+static ABOUT: &str = "Copy standard input to each FILE, and also to standard output.";
+const USAGE: &str = "{} [OPTION]... [FILE]...";
 
-mod options {
-    pub const APPEND: &str = "append";
-    pub const IGNORE_INTERRUPTS: &str = "ignore-interrupts";
-    pub const FILE: &str = "file";
-    pub const IGNORE_PIPE_ERRORS: &str = "ignore-pipe-errors";
-    pub const OUTPUT_ERROR: &str = "output-error";
+mod options {
+    pub const APPEND: &str = "append";
+    pub const IGNORE_INTERRUPTS: &str = "ignore-interrupts";
+    pub const FILE: &str = "file";
+    pub const IGNORE_PIPE_ERRORS: &str = "ignore-pipe-errors";
+    pub const OUTPUT_ERROR: &str = "output-error";
 }
 
-#[allow(dead_code)]
-struct Options {
-    append: bool,
-    ignore_interrupts: bool,
-    files: Vec<String>,
-    output_error: Option<OutputErrorMode>,
+#[allow(dead_code)]
+struct Options {
+    append: bool,
+    ignore_interrupts: bool,
+    files: Vec<String>,
+    output_error: Option<OutputErrorMode>,
 }
 
-#[derive(Clone, Debug)]
-enum OutputErrorMode {
-    Warn,
-    WarnNoPipe,
-    Exit,
-    ExitNoPipe,
+#[derive(Clone, Debug)]
+enum OutputErrorMode {
+    Warn,
+    WarnNoPipe,
+    Exit,
+    ExitNoPipe,
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let options = Options {
-        append: matches.get_flag(options::APPEND),
-        ignore_interrupts: matches.get_flag(options::IGNORE_INTERRUPTS),
-        files: matches
-            .get_many::<String>(options::FILE)
-            .map(|v| v.map(ToString::to_string).collect())
-            .unwrap_or_default(),
-        output_error: {
-            if matches.get_flag(options::IGNORE_PIPE_ERRORS) {
-                Some(OutputErrorMode::WarnNoPipe)
-            } else if matches.contains_id(options::OUTPUT_ERROR) {
-                if let Some(v) = matches.get_one::<String>(options::OUTPUT_ERROR) {
-                    match v.as_str() {
-                        "warn" => Some(OutputErrorMode::Warn),
-                        "warn-nopipe" => Some(OutputErrorMode::WarnNoPipe),
-                        "exit" => Some(OutputErrorMode::Exit),
-                        "exit-nopipe" => Some(OutputErrorMode::ExitNoPipe),
-                        _ => unreachable!(),
+    let options = Options {
+        append: matches.get_flag(options::APPEND),
+        ignore_interrupts: matches.get_flag(options::IGNORE_INTERRUPTS),
+        files: matches
+            .get_many::<String>(options::FILE)
+            .map(|v| v.map(ToString::to_string).collect())
+            .unwrap_or_default(),
+        output_error: {
+            if matches.get_flag(options::IGNORE_PIPE_ERRORS) {
+                Some(OutputErrorMode::WarnNoPipe)
+            } else if matches.contains_id(options::OUTPUT_ERROR) {
+                if let Some(v) = matches.get_one::<String>(options::OUTPUT_ERROR) {
+                    match v.as_str() {
+                        "warn" => Some(OutputErrorMode::Warn),
+                        "warn-nopipe" => Some(OutputErrorMode::WarnNoPipe),
+                        "exit" => Some(OutputErrorMode::Exit),
+                        "exit-nopipe" => Some(OutputErrorMode::ExitNoPipe),
+                        _ => unreachable!(),
                     }
-                } else {
-                    Some(OutputErrorMode::WarnNoPipe)
+                } else {
+                    Some(OutputErrorMode::WarnNoPipe)
                 }
-            } else {
-                None
-            }
+            } else {
+                None
+            }
         },
     };
 
-    match tee(&options) {
+    match tee(&options) {
         Ok(_) => Ok(()),
-        Err(_) => Err(1.into()),
+        Err(_) => Err(1.into()),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .after_help("If a FILE is -, it refers to a file named - .")
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::APPEND)
-                .long(options::APPEND)
-                .short('a')
-                .help("append to the given FILEs, do not overwrite")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .after_help("If a FILE is -, it refers to a file named - .")
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::APPEND)
+                .long(options::APPEND)
+                .short('a')
+                .help("append to the given FILEs, do not overwrite")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::IGNORE_INTERRUPTS)
-                .long(options::IGNORE_INTERRUPTS)
-                .short('i')
-                .help("ignore interrupt signals (ignored on non-Unix platforms)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::IGNORE_INTERRUPTS)
+                .long(options::IGNORE_INTERRUPTS)
+                .short('i')
+                .help("ignore interrupt signals (ignored on non-Unix platforms)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILE)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILE)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::IGNORE_PIPE_ERRORS)
-                .short('p')
-                .help("set write error behavior (ignored on non-Unix platforms)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::IGNORE_PIPE_ERRORS)
+                .short('p')
+                .help("set write error behavior (ignored on non-Unix platforms)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OUTPUT_ERROR)
-                .long(options::OUTPUT_ERROR)
-                .require_equals(true)
-                .num_args(0..=1)
-                .value_parser([
-                    PossibleValue::new("warn")
-                        .help("produce warnings for errors writing to any output"),
-                    PossibleValue::new("warn-nopipe")
-                        .help("produce warnings for errors that are not pipe errors (ignored on non-unix platforms)"),
-                    PossibleValue::new("exit").help("exit on write errors to any output"),
-                    PossibleValue::new("exit-nopipe")
-                        .help("exit on write errors to any output that are not pipe errors (equivalent to exit on non-unix platforms)"),
+        .arg(
+            Arg::new(options::OUTPUT_ERROR)
+                .long(options::OUTPUT_ERROR)
+                .require_equals(true)
+                .num_args(0..=1)
+                .value_parser([
+                    PossibleValue::new("warn")
+                        .help("produce warnings for errors writing to any output"),
+                    PossibleValue::new("warn-nopipe")
+                        .help("produce warnings for errors that are not pipe errors (ignored on non-unix platforms)"),
+                    PossibleValue::new("exit").help("exit on write errors to any output"),
+                    PossibleValue::new("exit-nopipe")
+                        .help("exit on write errors to any output that are not pipe errors (equivalent to exit on non-unix platforms)"),
                 ])
-                .help("set write error behavior")
-                .conflicts_with(options::IGNORE_PIPE_ERRORS),
+                .help("set write error behavior")
+                .conflicts_with(options::IGNORE_PIPE_ERRORS),
         )
 }
 
-#[cfg(unix)]
-fn ignore_interrupts() -> Result<()> {
-    let ret = unsafe { libc::signal(libc::SIGINT, libc::SIG_IGN) };
-    if ret == libc::SIG_ERR {
-        return Err(Error::new(ErrorKind::Other, ""));
+#[cfg(unix)]
+fn ignore_interrupts() -> Result<()> {
+    let ret = unsafe { libc::signal(libc::SIGINT, libc::SIG_IGN) };
+    if ret == libc::SIG_ERR {
+        return Err(Error::new(ErrorKind::Other, ""));
     }
     Ok(())
 }
 
-#[cfg(not(unix))]
-fn ignore_interrupts() -> Result<()> {
-    // Do nothing.
-    Ok(())
+#[cfg(not(unix))]
+fn ignore_interrupts() -> Result<()> {
+    // Do nothing.
+    Ok(())
 }
 
-#[cfg(unix)]
-fn enable_pipe_errors() -> Result<()> {
-    let ret = unsafe { libc::signal(libc::SIGPIPE, libc::SIG_DFL) };
-    if ret == libc::SIG_ERR {
-        return Err(Error::new(ErrorKind::Other, ""));
+#[cfg(unix)]
+fn enable_pipe_errors() -> Result<()> {
+    let ret = unsafe { libc::signal(libc::SIGPIPE, libc::SIG_DFL) };
+    if ret == libc::SIG_ERR {
+        return Err(Error::new(ErrorKind::Other, ""));
     }
     Ok(())
 }
 
-#[cfg(not(unix))]
-fn enable_pipe_errors() -> Result<()> {
-    // Do nothing.
-    Ok(())
+#[cfg(not(unix))]
+fn enable_pipe_errors() -> Result<()> {
+    // Do nothing.
+    Ok(())
 }
 
-fn tee(options: &Options) -> Result<()> {
-    if options.ignore_interrupts {
-        ignore_interrupts()?;
+fn tee(options: &Options) -> Result<()> {
+    if options.ignore_interrupts {
+        ignore_interrupts()?;
     }
-    if options.output_error.is_none() {
-        enable_pipe_errors()?;
+    if options.output_error.is_none() {
+        enable_pipe_errors()?;
     }
 
-    let mut writers: Vec<NamedWriter> = options
-        .files
-        .clone()
-        .into_iter()
-        .map(|file| {
-            Ok(NamedWriter {
-                name: file.clone(),
-                inner: open(file, options.append, options.output_error.as_ref())?,
+    let mut writers: Vec<NamedWriter> = options
+        .files
+        .clone()
+        .into_iter()
+        .map(|file| {
+            Ok(NamedWriter {
+                name: file.clone(),
+                inner: open(file, options.append, options.output_error.as_ref())?,
             })
         })
-        .collect::<Result<Vec<NamedWriter>>>()?;
+        .collect::<Result<Vec<NamedWriter>>>()?;
 
-    writers.insert(
+    writers.insert(
         0,
-        NamedWriter {
-            name: "'standard output'".to_owned(),
-            inner: Box::new(stdout()),
+        NamedWriter {
+            name: "'standard output'".to_owned(),
+            inner: Box::new(stdout()),
         },
     );
 
-    let mut output = MultiWriter::new(writers, options.output_error.clone());
-    let input = &mut NamedReader {
-        inner: Box::new(stdin()) as Box<dyn Read>,
+    let mut output = MultiWriter::new(writers, options.output_error.clone());
+    let input = &mut NamedReader {
+        inner: Box::new(stdin()) as Box<dyn Read>,
     };
 
-    let res = match copy(input, &mut output) {
-        // ErrorKind::Other is raised by MultiWriter when all writers
-        // have exited, so that copy will abort. It's equivalent to
-        // success of this part (if there was an error that should
-        // cause a failure from any writer, that error would have been
-        // returned instead).
-        Err(e) if e.kind() != ErrorKind::Other => Err(e),
-        _ => Ok(()),
+    let res = match copy(input, &mut output) {
+        // ErrorKind::Other is raised by MultiWriter when all writers
+        // have exited, so that copy will abort. It's equivalent to
+        // success of this part (if there was an error that should
+        // cause a failure from any writer, that error would have been
+        // returned instead).
+        Err(e) if e.kind() != ErrorKind::Other => Err(e),
+        _ => Ok(()),
     };
 
-    if res.is_err() || output.flush().is_err() || output.error_occurred() {
-        Err(Error::from(ErrorKind::Other))
-    } else {
+    if res.is_err() || output.flush().is_err() || output.error_occurred() {
+        Err(Error::from(ErrorKind::Other))
+    } else {
         Ok(())
     }
 }
 
-fn open(
-    name: String,
-    append: bool,
-    output_error: Option<&OutputErrorMode>,
-) -> Result<Box<dyn Write>> {
-    let path = PathBuf::from(name.clone());
-    let inner: Box<dyn Write> = {
-        let mut options = OpenOptions::new();
-        let mode = if append {
-            options.append(true)
-        } else {
-            options.truncate(true)
+fn open(
+    name: String,
+    append: bool,
+    output_error: Option<&OutputErrorMode>,
+) -> Result<Box<dyn Write>> {
+    let path = PathBuf::from(name.clone());
+    let inner: Box<dyn Write> = {
+        let mut options = OpenOptions::new();
+        let mode = if append {
+            options.append(true)
+        } else {
+            options.truncate(true)
         };
-        match mode.write(true).create(true).open(path.as_path()) {
-            Ok(file) => Box::new(file),
-            Err(f) => {
-                show_error!("{}: {}", name.maybe_quote(), f);
-                match output_error {
-                    Some(OutputErrorMode::Exit) | Some(OutputErrorMode::ExitNoPipe) => {
-                        return Err(f)
+        match mode.write(true).create(true).open(path.as_path()) {
+            Ok(file) => Box::new(file),
+            Err(f) => {
+                show_error!("{}: {}", name.maybe_quote(), f);
+                match output_error {
+                    Some(OutputErrorMode::Exit) | Some(OutputErrorMode::ExitNoPipe) => {
+                        return Err(f)
                     }
-                    _ => Box::new(sink()),
+                    _ => Box::new(sink()),
                 }
             }
         }
     };
-    Ok(Box::new(NamedWriter { inner, name }) as Box<dyn Write>)
+    Ok(Box::new(NamedWriter { inner, name }) as Box<dyn Write>)
 }
 
-struct MultiWriter {
-    writers: Vec<NamedWriter>,
-    output_error_mode: Option<OutputErrorMode>,
-    ignored_errors: usize,
+struct MultiWriter {
+    writers: Vec<NamedWriter>,
+    output_error_mode: Option<OutputErrorMode>,
+    ignored_errors: usize,
 }
 
-impl MultiWriter {
-    fn new(writers: Vec<NamedWriter>, output_error_mode: Option<OutputErrorMode>) -> Self {
-        Self {
-            writers,
-            output_error_mode,
-            ignored_errors: 0,
+impl MultiWriter {
+    fn new(writers: Vec<NamedWriter>, output_error_mode: Option<OutputErrorMode>) -> Self {
+        Self {
+            writers,
+            output_error_mode,
+            ignored_errors: 0,
         }
     }
 
-    fn error_occurred(&self) -> bool {
-        self.ignored_errors != 0
-    }
+    fn error_occurred(&self) -> bool {
+        self.ignored_errors != 0
+    }
 }
 
-fn process_error(
-    mode: Option<&OutputErrorMode>,
-    f: Error,
-    writer: &NamedWriter,
-    ignored_errors: &mut usize,
-) -> Result<()> {
-    match mode {
-        Some(OutputErrorMode::Warn) => {
-            show_error!("{}: {}", writer.name.maybe_quote(), f);
-            *ignored_errors += 1;
+fn process_error(
+    mode: Option<&OutputErrorMode>,
+    f: Error,
+    writer: &NamedWriter,
+    ignored_errors: &mut usize,
+) -> Result<()> {
+    match mode {
+        Some(OutputErrorMode::Warn) => {
+            show_error!("{}: {}", writer.name.maybe_quote(), f);
+            *ignored_errors += 1;
             Ok(())
         }
-        Some(OutputErrorMode::WarnNoPipe) | None => {
-            if f.kind() != ErrorKind::BrokenPipe {
-                show_error!("{}: {}", writer.name.maybe_quote(), f);
-                *ignored_errors += 1;
+        Some(OutputErrorMode::WarnNoPipe) | None => {
+            if f.kind() != ErrorKind::BrokenPipe {
+                show_error!("{}: {}", writer.name.maybe_quote(), f);
+                *ignored_errors += 1;
             }
             Ok(())
         }
-        Some(OutputErrorMode::Exit) => {
-            show_error!("{}: {}", writer.name.maybe_quote(), f);
-            Err(f)
+        Some(OutputErrorMode::Exit) => {
+            show_error!("{}: {}", writer.name.maybe_quote(), f);
+            Err(f)
         }
-        Some(OutputErrorMode::ExitNoPipe) => {
-            if f.kind() != ErrorKind::BrokenPipe {
-                show_error!("{}: {}", writer.name.maybe_quote(), f);
-                Err(f)
-            } else {
+        Some(OutputErrorMode::ExitNoPipe) => {
+            if f.kind() != ErrorKind::BrokenPipe {
+                show_error!("{}: {}", writer.name.maybe_quote(), f);
+                Err(f)
+            } else {
                 Ok(())
             }
         }
     }
 }
 
-impl Write for MultiWriter {
-    fn write(&mut self, buf: &[u8]) -> Result<usize> {
-        let mut aborted = None;
-        let mode = self.output_error_mode.clone();
-        let mut errors = 0;
-        RetainMut::retain_mut(&mut self.writers, |writer| {
-            let result = writer.write_all(buf);
-            match result {
-                Err(f) => {
-                    if let Err(e) = process_error(mode.as_ref(), f, writer, &mut errors) {
-                        if aborted.is_none() {
-                            aborted = Some(e);
+impl Write for MultiWriter {
+    fn write(&mut self, buf: &[u8]) -> Result<usize> {
+        let mut aborted = None;
+        let mode = self.output_error_mode.clone();
+        let mut errors = 0;
+        RetainMut::retain_mut(&mut self.writers, |writer| {
+            let result = writer.write_all(buf);
+            match result {
+                Err(f) => {
+                    if let Err(e) = process_error(mode.as_ref(), f, writer, &mut errors) {
+                        if aborted.is_none() {
+                            aborted = Some(e);
                         }
                     }
-                    false
-                }
-                _ => true,
+                    false
+                }
+                _ => true,
             }
         });
-        self.ignored_errors += errors;
-        if let Some(e) = aborted {
-            Err(e)
-        } else if self.writers.is_empty() {
-            // This error kind will never be raised by the standard
-            // library, so we can use it for early termination of
-            // `copy`
-            Err(Error::from(ErrorKind::Other))
-        } else {
-            Ok(buf.len())
+        self.ignored_errors += errors;
+        if let Some(e) = aborted {
+            Err(e)
+        } else if self.writers.is_empty() {
+            // This error kind will never be raised by the standard
+            // library, so we can use it for early termination of
+            // `copy`
+            Err(Error::from(ErrorKind::Other))
+        } else {
+            Ok(buf.len())
         }
     }
 
-    fn flush(&mut self) -> Result<()> {
-        let mut aborted = None;
-        let mode = self.output_error_mode.clone();
-        let mut errors = 0;
-        RetainMut::retain_mut(&mut self.writers, |writer| {
-            let result = writer.flush();
-            match result {
-                Err(f) => {
-                    if let Err(e) = process_error(mode.as_ref(), f, writer, &mut errors) {
-                        if aborted.is_none() {
-                            aborted = Some(e);
+    fn flush(&mut self) -> Result<()> {
+        let mut aborted = None;
+        let mode = self.output_error_mode.clone();
+        let mut errors = 0;
+        RetainMut::retain_mut(&mut self.writers, |writer| {
+            let result = writer.flush();
+            match result {
+                Err(f) => {
+                    if let Err(e) = process_error(mode.as_ref(), f, writer, &mut errors) {
+                        if aborted.is_none() {
+                            aborted = Some(e);
                         }
                     }
-                    false
-                }
-                _ => true,
+                    false
+                }
+                _ => true,
             }
         });
-        self.ignored_errors += errors;
-        if let Some(e) = aborted {
-            Err(e)
-        } else {
+        self.ignored_errors += errors;
+        if let Some(e) = aborted {
+            Err(e)
+        } else {
             Ok(())
         }
     }
 }
 
-struct NamedWriter {
-    inner: Box<dyn Write>,
-    pub name: String,
+struct NamedWriter {
+    inner: Box<dyn Write>,
+    pub name: String,
 }
 
-impl Write for NamedWriter {
-    fn write(&mut self, buf: &[u8]) -> Result<usize> {
-        self.inner.write(buf)
+impl Write for NamedWriter {
+    fn write(&mut self, buf: &[u8]) -> Result<usize> {
+        self.inner.write(buf)
     }
 
-    fn flush(&mut self) -> Result<()> {
-        self.inner.flush()
+    fn flush(&mut self) -> Result<()> {
+        self.inner.flush()
     }
 }
 
-struct NamedReader {
-    inner: Box<dyn Read>,
+struct NamedReader {
+    inner: Box<dyn Read>,
 }
 
-impl Read for NamedReader {
-    fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
-        match self.inner.read(buf) {
-            Err(f) => {
-                show_error!("stdin: {}", f);
-                Err(f)
+impl Read for NamedReader {
+    fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
+        match self.inner.read(buf) {
+            Err(f) => {
+                show_error!("stdin: {}", f);
+                Err(f)
             }
-            okay => okay,
+            okay => okay,
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_test/parser.rs.html b/dev/src/uu_test/parser.rs.html index 14e748ced..a93649456 100644 --- a/dev/src/uu_test/parser.rs.html +++ b/dev/src/uu_test/parser.rs.html @@ -1,4 +1,4 @@ -parser.rs - source
1
+parser.rs - source
1
 2
 3
 4
@@ -410,417 +410,417 @@
 410
 411
 412
-
// This file is part of the uutils coreutils package.
-//
-// (c) Daniel Rocco <drocco@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Daniel Rocco <drocco@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (grammar) BOOLOP STRLEN FILETEST FILEOP INTOP STRINGOP ; (vars) LParen StrlenOp
+// spell-checker:ignore (grammar) BOOLOP STRLEN FILETEST FILEOP INTOP STRINGOP ; (vars) LParen StrlenOp
 
-use std::ffi::OsString;
-use std::iter::Peekable;
+use std::ffi::OsString;
+use std::iter::Peekable;
 
-use uucore::display::Quotable;
-use uucore::show_error;
+use uucore::display::Quotable;
+use uucore::show_error;
 
-/// Represents one of the binary comparison operators for strings, integers, or files
-#[derive(Debug, PartialEq, Eq)]
-pub enum Operator {
-    String(OsString),
-    Int(OsString),
-    File(OsString),
+/// Represents one of the binary comparison operators for strings, integers, or files
+#[derive(Debug, PartialEq, Eq)]
+pub enum Operator {
+    String(OsString),
+    Int(OsString),
+    File(OsString),
 }
 
-/// Represents one of the unary test operators for strings or files
-#[derive(Debug, PartialEq, Eq)]
-pub enum UnaryOperator {
-    StrlenOp(OsString),
-    FiletestOp(OsString),
+/// Represents one of the unary test operators for strings or files
+#[derive(Debug, PartialEq, Eq)]
+pub enum UnaryOperator {
+    StrlenOp(OsString),
+    FiletestOp(OsString),
 }
 
-/// Represents a parsed token from a test expression
-#[derive(Debug, PartialEq, Eq)]
-pub enum Symbol {
-    LParen,
-    Bang,
-    BoolOp(OsString),
-    Literal(OsString),
-    Op(Operator),
-    UnaryOp(UnaryOperator),
+/// Represents a parsed token from a test expression
+#[derive(Debug, PartialEq, Eq)]
+pub enum Symbol {
+    LParen,
+    Bang,
+    BoolOp(OsString),
+    Literal(OsString),
+    Op(Operator),
+    UnaryOp(UnaryOperator),
     None,
 }
 
-impl Symbol {
-    /// Create a new Symbol from an OsString.
-    ///
-    /// Returns Symbol::None in place of None
-    fn new(token: Option<OsString>) -> Self {
-        match token {
-            Some(s) => match s.to_str() {
-                Some(t) => match t {
-                    "(" => Self::LParen,
-                    "!" => Self::Bang,
-                    "-a" | "-o" => Self::BoolOp(s),
-                    "=" | "==" | "!=" => Self::Op(Operator::String(s)),
-                    "-eq" | "-ge" | "-gt" | "-le" | "-lt" | "-ne" => Self::Op(Operator::Int(s)),
-                    "-ef" | "-nt" | "-ot" => Self::Op(Operator::File(s)),
-                    "-n" | "-z" => Self::UnaryOp(UnaryOperator::StrlenOp(s)),
-                    "-b" | "-c" | "-d" | "-e" | "-f" | "-g" | "-G" | "-h" | "-k" | "-L" | "-N"
-                    | "-O" | "-p" | "-r" | "-s" | "-S" | "-t" | "-u" | "-w" | "-x" => {
-                        Self::UnaryOp(UnaryOperator::FiletestOp(s))
+impl Symbol {
+    /// Create a new Symbol from an OsString.
+    ///
+    /// Returns Symbol::None in place of None
+    fn new(token: Option<OsString>) -> Self {
+        match token {
+            Some(s) => match s.to_str() {
+                Some(t) => match t {
+                    "(" => Self::LParen,
+                    "!" => Self::Bang,
+                    "-a" | "-o" => Self::BoolOp(s),
+                    "=" | "==" | "!=" => Self::Op(Operator::String(s)),
+                    "-eq" | "-ge" | "-gt" | "-le" | "-lt" | "-ne" => Self::Op(Operator::Int(s)),
+                    "-ef" | "-nt" | "-ot" => Self::Op(Operator::File(s)),
+                    "-n" | "-z" => Self::UnaryOp(UnaryOperator::StrlenOp(s)),
+                    "-b" | "-c" | "-d" | "-e" | "-f" | "-g" | "-G" | "-h" | "-k" | "-L" | "-N"
+                    | "-O" | "-p" | "-r" | "-s" | "-S" | "-t" | "-u" | "-w" | "-x" => {
+                        Self::UnaryOp(UnaryOperator::FiletestOp(s))
                     }
-                    _ => Self::Literal(s),
+                    _ => Self::Literal(s),
                 },
-                None => Self::Literal(s),
+                None => Self::Literal(s),
             },
-            None => Self::None,
+            None => Self::None,
         }
     }
 
-    /// Convert this Symbol into a Symbol::Literal, useful for cases where
-    /// test treats an operator as a string operand (test has no reserved
-    /// words).
-    ///
-    /// # Panics
-    ///
-    /// Panics if `self` is Symbol::None
-    fn into_literal(self) -> Self {
-        Self::Literal(match self {
-            Self::LParen => OsString::from("("),
-            Self::Bang => OsString::from("!"),
-            Self::BoolOp(s)
-            | Self::Literal(s)
-            | Self::Op(Operator::String(s))
-            | Self::Op(Operator::Int(s))
-            | Self::Op(Operator::File(s))
-            | Self::UnaryOp(UnaryOperator::StrlenOp(s))
-            | Self::UnaryOp(UnaryOperator::FiletestOp(s)) => s,
-            Self::None => panic!(),
+    /// Convert this Symbol into a Symbol::Literal, useful for cases where
+    /// test treats an operator as a string operand (test has no reserved
+    /// words).
+    ///
+    /// # Panics
+    ///
+    /// Panics if `self` is Symbol::None
+    fn into_literal(self) -> Self {
+        Self::Literal(match self {
+            Self::LParen => OsString::from("("),
+            Self::Bang => OsString::from("!"),
+            Self::BoolOp(s)
+            | Self::Literal(s)
+            | Self::Op(Operator::String(s))
+            | Self::Op(Operator::Int(s))
+            | Self::Op(Operator::File(s))
+            | Self::UnaryOp(UnaryOperator::StrlenOp(s))
+            | Self::UnaryOp(UnaryOperator::FiletestOp(s)) => s,
+            Self::None => panic!(),
         })
     }
 }
 
-/// Recursive descent parser for test, which converts a list of OsStrings
-/// (typically command line arguments) into a stack of Symbols in postfix
-/// order.
-///
-/// Grammar:
-///
-///   EXPR → TERM | EXPR BOOLOP EXPR
-///   TERM → ( EXPR )
-///   TERM → ! EXPR
-///   TERM → UOP str
-///   UOP → STRLEN | FILETEST
-///   TERM → str OP str
-///   TERM → str | 𝜖
-///   OP → STRINGOP | INTOP | FILEOP
-///   STRINGOP → = | == | !=
-///   INTOP → -eq | -ge | -gt | -le | -lt | -ne
-///   FILEOP → -ef | -nt | -ot
-///   STRLEN → -n | -z
-///   FILETEST → -b | -c | -d | -e | -f | -g | -G | -h | -k | -L | -N | -O | -p |
-///               -r | -s | -S | -t | -u | -w | -x
-///   BOOLOP → -a | -o
-///
-#[derive(Debug)]
-struct Parser {
-    tokens: Peekable<std::vec::IntoIter<OsString>>,
-    pub stack: Vec<Symbol>,
+/// Recursive descent parser for test, which converts a list of OsStrings
+/// (typically command line arguments) into a stack of Symbols in postfix
+/// order.
+///
+/// Grammar:
+///
+///   EXPR → TERM | EXPR BOOLOP EXPR
+///   TERM → ( EXPR )
+///   TERM → ! EXPR
+///   TERM → UOP str
+///   UOP → STRLEN | FILETEST
+///   TERM → str OP str
+///   TERM → str | 𝜖
+///   OP → STRINGOP | INTOP | FILEOP
+///   STRINGOP → = | == | !=
+///   INTOP → -eq | -ge | -gt | -le | -lt | -ne
+///   FILEOP → -ef | -nt | -ot
+///   STRLEN → -n | -z
+///   FILETEST → -b | -c | -d | -e | -f | -g | -G | -h | -k | -L | -N | -O | -p |
+///               -r | -s | -S | -t | -u | -w | -x
+///   BOOLOP → -a | -o
+///
+#[derive(Debug)]
+struct Parser {
+    tokens: Peekable<std::vec::IntoIter<OsString>>,
+    pub stack: Vec<Symbol>,
 }
 
-impl Parser {
-    /// Construct a new Parser from a `Vec<OsString>` of tokens.
-    fn new(tokens: Vec<OsString>) -> Self {
-        Self {
-            tokens: tokens.into_iter().peekable(),
-            stack: vec![],
+impl Parser {
+    /// Construct a new Parser from a `Vec<OsString>` of tokens.
+    fn new(tokens: Vec<OsString>) -> Self {
+        Self {
+            tokens: tokens.into_iter().peekable(),
+            stack: vec![],
         }
     }
 
-    /// Fetch the next token from the input stream as a Symbol.
-    fn next_token(&mut self) -> Symbol {
-        Symbol::new(self.tokens.next())
+    /// Fetch the next token from the input stream as a Symbol.
+    fn next_token(&mut self) -> Symbol {
+        Symbol::new(self.tokens.next())
     }
 
-    /// Consume the next token & verify that it matches the provided value.
-    ///
-    /// # Panics
-    ///
-    /// Panics if the next token does not match the provided value.
-    ///
-    /// TODO: remove panics and convert Parser to return error messages.
-    fn expect(&mut self, value: &str) {
-        match self.next_token() {
-            Symbol::Literal(s) if s == value => (),
-            _ => panic!("expected ‘{}’", value),
+    /// Consume the next token & verify that it matches the provided value.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the next token does not match the provided value.
+    ///
+    /// TODO: remove panics and convert Parser to return error messages.
+    fn expect(&mut self, value: &str) {
+        match self.next_token() {
+            Symbol::Literal(s) if s == value => (),
+            _ => panic!("expected ‘{}’", value),
         }
     }
 
-    /// Peek at the next token from the input stream, returning it as a Symbol.
-    /// The stream is unchanged and will return the same Symbol on subsequent
-    /// calls to `next()` or `peek()`.
-    fn peek(&mut self) -> Symbol {
-        Symbol::new(self.tokens.peek().map(|s| s.to_os_string()))
+    /// Peek at the next token from the input stream, returning it as a Symbol.
+    /// The stream is unchanged and will return the same Symbol on subsequent
+    /// calls to `next()` or `peek()`.
+    fn peek(&mut self) -> Symbol {
+        Symbol::new(self.tokens.peek().map(|s| s.to_os_string()))
     }
 
-    /// Test if the next token in the stream is a BOOLOP (-a or -o), without
-    /// removing the token from the stream.
-    fn peek_is_boolop(&mut self) -> bool {
-        matches!(self.peek(), Symbol::BoolOp(_))
+    /// Test if the next token in the stream is a BOOLOP (-a or -o), without
+    /// removing the token from the stream.
+    fn peek_is_boolop(&mut self) -> bool {
+        matches!(self.peek(), Symbol::BoolOp(_))
     }
 
-    /// Parse an expression.
-    ///
-    ///   EXPR → TERM | EXPR BOOLOP EXPR
-    fn expr(&mut self) {
-        if !self.peek_is_boolop() {
-            self.term();
+    /// Parse an expression.
+    ///
+    ///   EXPR → TERM | EXPR BOOLOP EXPR
+    fn expr(&mut self) {
+        if !self.peek_is_boolop() {
+            self.term();
         }
-        self.maybe_boolop();
+        self.maybe_boolop();
     }
 
-    /// Parse a term token and possible subsequent symbols: "(", "!", UOP,
-    /// literal, or None.
-    fn term(&mut self) {
-        let symbol = self.next_token();
+    /// Parse a term token and possible subsequent symbols: "(", "!", UOP,
+    /// literal, or None.
+    fn term(&mut self) {
+        let symbol = self.next_token();
 
-        match symbol {
-            Symbol::LParen => self.lparen(),
-            Symbol::Bang => self.bang(),
-            Symbol::UnaryOp(_) => self.uop(symbol),
-            Symbol::None => self.stack.push(symbol),
-            literal => self.literal(literal),
+        match symbol {
+            Symbol::LParen => self.lparen(),
+            Symbol::Bang => self.bang(),
+            Symbol::UnaryOp(_) => self.uop(symbol),
+            Symbol::None => self.stack.push(symbol),
+            literal => self.literal(literal),
         }
     }
 
-    /// Parse a (possibly) parenthesized expression.
-    ///
-    /// test has no reserved keywords, so "(" will be interpreted as a literal
-    /// in certain cases:
-    ///
-    /// * when found at the end of the token stream
-    /// * when followed by a binary operator that is not _itself_ interpreted
-    ///   as a literal
-    ///
-    fn lparen(&mut self) {
-        // Look ahead up to 3 tokens to determine if the lparen is being used
-        // as a grouping operator or should be treated as a literal string
-        let peek3: Vec<Symbol> = self
-            .tokens
-            .clone()
-            .take(3)
-            .map(|token| Symbol::new(Some(token)))
-            .collect();
+    /// Parse a (possibly) parenthesized expression.
+    ///
+    /// test has no reserved keywords, so "(" will be interpreted as a literal
+    /// in certain cases:
+    ///
+    /// * when found at the end of the token stream
+    /// * when followed by a binary operator that is not _itself_ interpreted
+    ///   as a literal
+    ///
+    fn lparen(&mut self) {
+        // Look ahead up to 3 tokens to determine if the lparen is being used
+        // as a grouping operator or should be treated as a literal string
+        let peek3: Vec<Symbol> = self
+            .tokens
+            .clone()
+            .take(3)
+            .map(|token| Symbol::new(Some(token)))
+            .collect();
 
-        match peek3.as_slice() {
-            // case 1: lparen is a literal when followed by nothing
-            [] => self.literal(Symbol::LParen.into_literal()),
+        match peek3.as_slice() {
+            // case 1: lparen is a literal when followed by nothing
+            [] => self.literal(Symbol::LParen.into_literal()),
 
-            // case 2: error if end of stream is `( <any_token>`
-            [symbol] => {
-                show_error!("missing argument after ‘{:?}’", symbol);
-                std::process::exit(2);
+            // case 2: error if end of stream is `( <any_token>`
+            [symbol] => {
+                show_error!("missing argument after ‘{:?}’", symbol);
+                std::process::exit(2);
             }
 
-            // case 3: `( uop <any_token> )` → parenthesized unary operation;
-            //         this case ensures we don’t get confused by `( -f ) )`
-            //         or `( -f ( )`, for example
-            [Symbol::UnaryOp(_), _, Symbol::Literal(s)] if s == ")" => {
-                let symbol = self.next_token();
-                self.uop(symbol);
-                self.expect(")");
+            // case 3: `( uop <any_token> )` → parenthesized unary operation;
+            //         this case ensures we don’t get confused by `( -f ) )`
+            //         or `( -f ( )`, for example
+            [Symbol::UnaryOp(_), _, Symbol::Literal(s)] if s == ")" => {
+                let symbol = self.next_token();
+                self.uop(symbol);
+                self.expect(")");
             }
 
-            // case 4: binary comparison of literal lparen, e.g. `( != )`
-            [Symbol::Op(_), Symbol::Literal(s)] | [Symbol::Op(_), Symbol::Literal(s), _]
-                if s == ")" =>
+            // case 4: binary comparison of literal lparen, e.g. `( != )`
+            [Symbol::Op(_), Symbol::Literal(s)] | [Symbol::Op(_), Symbol::Literal(s), _]
+                if s == ")" =>
             {
-                self.literal(Symbol::LParen.into_literal());
+                self.literal(Symbol::LParen.into_literal());
             }
 
-            // case 5: after handling the prior cases, any single token inside
-            //         parentheses is a literal, e.g. `( -f )`
-            [_, Symbol::Literal(s)] | [_, Symbol::Literal(s), _] if s == ")" => {
-                let symbol = self.next_token();
-                self.literal(symbol);
-                self.expect(")");
+            // case 5: after handling the prior cases, any single token inside
+            //         parentheses is a literal, e.g. `( -f )`
+            [_, Symbol::Literal(s)] | [_, Symbol::Literal(s), _] if s == ")" => {
+                let symbol = self.next_token();
+                self.literal(symbol);
+                self.expect(")");
             }
 
-            // case 6: two binary ops in a row, treat the first op as a literal
-            [Symbol::Op(_), Symbol::Op(_), _] => {
-                let symbol = self.next_token();
-                self.literal(symbol);
-                self.expect(")");
+            // case 6: two binary ops in a row, treat the first op as a literal
+            [Symbol::Op(_), Symbol::Op(_), _] => {
+                let symbol = self.next_token();
+                self.literal(symbol);
+                self.expect(")");
             }
 
-            // case 7: if earlier cases didn’t match, `( op <any_token>…`
-            //         indicates binary comparison of literal lparen with
-            //         anything _except_ ")" (case 4)
-            [Symbol::Op(_), _] | [Symbol::Op(_), _, _] => {
-                self.literal(Symbol::LParen.into_literal());
+            // case 7: if earlier cases didn’t match, `( op <any_token>…`
+            //         indicates binary comparison of literal lparen with
+            //         anything _except_ ")" (case 4)
+            [Symbol::Op(_), _] | [Symbol::Op(_), _, _] => {
+                self.literal(Symbol::LParen.into_literal());
             }
 
-            // Otherwise, lparen indicates the start of a parenthesized
-            // expression
-            _ => {
-                self.expr();
-                self.expect(")");
+            // Otherwise, lparen indicates the start of a parenthesized
+            // expression
+            _ => {
+                self.expr();
+                self.expect(")");
             }
         }
     }
 
-    /// Parse a (possibly) negated expression.
-    ///
-    /// Example cases:
-    ///
-    /// * `! =`: negate the result of the implicit string length test of `=`
-    /// * `! = foo`: compare the literal strings `!` and `foo`
-    /// * `! = = str`: negate comparison of literal `=` and `str`
-    /// * `!`: bang followed by nothing is literal
-    /// * `! EXPR`: negate the result of the expression
-    ///
-    /// Combined Boolean & negation:
-    ///
-    /// * `! ( EXPR ) [BOOLOP EXPR]`: negate the parenthesized expression only
-    /// * `! UOP str BOOLOP EXPR`: negate the unary subexpression
-    /// * `! str BOOLOP str`: negate the entire Boolean expression
-    /// * `! str BOOLOP EXPR BOOLOP EXPR`: negate the value of the first `str` term
-    ///
-    fn bang(&mut self) {
-        match self.peek() {
-            Symbol::Op(_) | Symbol::BoolOp(_) => {
-                // we need to peek ahead one more token to disambiguate the first
-                // three cases listed above
-                let peek2 = Symbol::new(self.tokens.clone().nth(1));
+    /// Parse a (possibly) negated expression.
+    ///
+    /// Example cases:
+    ///
+    /// * `! =`: negate the result of the implicit string length test of `=`
+    /// * `! = foo`: compare the literal strings `!` and `foo`
+    /// * `! = = str`: negate comparison of literal `=` and `str`
+    /// * `!`: bang followed by nothing is literal
+    /// * `! EXPR`: negate the result of the expression
+    ///
+    /// Combined Boolean & negation:
+    ///
+    /// * `! ( EXPR ) [BOOLOP EXPR]`: negate the parenthesized expression only
+    /// * `! UOP str BOOLOP EXPR`: negate the unary subexpression
+    /// * `! str BOOLOP str`: negate the entire Boolean expression
+    /// * `! str BOOLOP EXPR BOOLOP EXPR`: negate the value of the first `str` term
+    ///
+    fn bang(&mut self) {
+        match self.peek() {
+            Symbol::Op(_) | Symbol::BoolOp(_) => {
+                // we need to peek ahead one more token to disambiguate the first
+                // three cases listed above
+                let peek2 = Symbol::new(self.tokens.clone().nth(1));
 
-                match peek2 {
-                    // case 1: `! <OP as literal>`
-                    // case 3: `! = OP str`
-                    Symbol::Op(_) | Symbol::None => {
-                        // op is literal
-                        let op = self.next_token().into_literal();
-                        self.literal(op);
-                        self.stack.push(Symbol::Bang);
+                match peek2 {
+                    // case 1: `! <OP as literal>`
+                    // case 3: `! = OP str`
+                    Symbol::Op(_) | Symbol::None => {
+                        // op is literal
+                        let op = self.next_token().into_literal();
+                        self.literal(op);
+                        self.stack.push(Symbol::Bang);
                     }
-                    // case 2: `<! as literal> OP str [BOOLOP EXPR]`.
-                    _ => {
-                        // bang is literal; parsing continues with op
-                        self.literal(Symbol::Bang.into_literal());
-                        self.maybe_boolop();
+                    // case 2: `<! as literal> OP str [BOOLOP EXPR]`.
+                    _ => {
+                        // bang is literal; parsing continues with op
+                        self.literal(Symbol::Bang.into_literal());
+                        self.maybe_boolop();
                     }
                 }
             }
 
-            // bang followed by nothing is literal
-            Symbol::None => self.stack.push(Symbol::Bang.into_literal()),
+            // bang followed by nothing is literal
+            Symbol::None => self.stack.push(Symbol::Bang.into_literal()),
 
-            _ => {
-                // peek ahead up to 4 tokens to determine if we need to negate
-                // the entire expression or just the first term
-                let peek4: Vec<Symbol> = self
-                    .tokens
-                    .clone()
-                    .take(4)
-                    .map(|token| Symbol::new(Some(token)))
-                    .collect();
+            _ => {
+                // peek ahead up to 4 tokens to determine if we need to negate
+                // the entire expression or just the first term
+                let peek4: Vec<Symbol> = self
+                    .tokens
+                    .clone()
+                    .take(4)
+                    .map(|token| Symbol::new(Some(token)))
+                    .collect();
 
-                match peek4.as_slice() {
-                    // we peeked ahead 4 but there were only 3 tokens left
-                    [Symbol::Literal(_), Symbol::BoolOp(_), Symbol::Literal(_)] => {
-                        self.expr();
-                        self.stack.push(Symbol::Bang);
+                match peek4.as_slice() {
+                    // we peeked ahead 4 but there were only 3 tokens left
+                    [Symbol::Literal(_), Symbol::BoolOp(_), Symbol::Literal(_)] => {
+                        self.expr();
+                        self.stack.push(Symbol::Bang);
                     }
-                    _ => {
-                        self.term();
-                        self.stack.push(Symbol::Bang);
+                    _ => {
+                        self.term();
+                        self.stack.push(Symbol::Bang);
                     }
                 }
             }
         }
     }
 
-    /// Peek at the next token and parse it as a BOOLOP or string literal,
-    /// as appropriate.
-    fn maybe_boolop(&mut self) {
-        if self.peek_is_boolop() {
-            let symbol = self.next_token();
+    /// Peek at the next token and parse it as a BOOLOP or string literal,
+    /// as appropriate.
+    fn maybe_boolop(&mut self) {
+        if self.peek_is_boolop() {
+            let symbol = self.next_token();
 
-            // BoolOp by itself interpreted as Literal
-            if let Symbol::None = self.peek() {
-                self.literal(symbol.into_literal());
-            } else {
-                self.boolop(symbol);
-                self.maybe_boolop();
+            // BoolOp by itself interpreted as Literal
+            if let Symbol::None = self.peek() {
+                self.literal(symbol.into_literal());
+            } else {
+                self.boolop(symbol);
+                self.maybe_boolop();
             }
         }
     }
 
-    /// Parse a Boolean expression.
-    ///
-    /// Logical and (-a) has higher precedence than or (-o), so in an
-    /// expression like `foo -o '' -a ''`, the and subexpression is evaluated
-    /// first.
-    fn boolop(&mut self, op: Symbol) {
-        if op == Symbol::BoolOp(OsString::from("-a")) {
-            self.term();
-        } else {
-            self.expr();
+    /// Parse a Boolean expression.
+    ///
+    /// Logical and (-a) has higher precedence than or (-o), so in an
+    /// expression like `foo -o '' -a ''`, the and subexpression is evaluated
+    /// first.
+    fn boolop(&mut self, op: Symbol) {
+        if op == Symbol::BoolOp(OsString::from("-a")) {
+            self.term();
+        } else {
+            self.expr();
         }
-        self.stack.push(op);
+        self.stack.push(op);
     }
 
-    /// Parse a (possible) unary argument test (string length or file
-    /// attribute check).
-    ///
-    /// If a UOP is followed by nothing it is interpreted as a literal string.
-    fn uop(&mut self, op: Symbol) {
-        match self.next_token() {
-            Symbol::None => self.stack.push(op.into_literal()),
-            symbol => {
-                self.stack.push(symbol.into_literal());
-                self.stack.push(op);
+    /// Parse a (possible) unary argument test (string length or file
+    /// attribute check).
+    ///
+    /// If a UOP is followed by nothing it is interpreted as a literal string.
+    fn uop(&mut self, op: Symbol) {
+        match self.next_token() {
+            Symbol::None => self.stack.push(op.into_literal()),
+            symbol => {
+                self.stack.push(symbol.into_literal());
+                self.stack.push(op);
             }
         }
     }
 
-    /// Parse a string literal, optionally followed by a comparison operator
-    /// and a second string literal.
-    fn literal(&mut self, token: Symbol) {
-        self.stack.push(token.into_literal());
+    /// Parse a string literal, optionally followed by a comparison operator
+    /// and a second string literal.
+    fn literal(&mut self, token: Symbol) {
+        self.stack.push(token.into_literal());
 
-        // EXPR → str OP str
-        if let Symbol::Op(_) = self.peek() {
-            let op = self.next_token();
+        // EXPR → str OP str
+        if let Symbol::Op(_) = self.peek() {
+            let op = self.next_token();
 
-            match self.next_token() {
-                Symbol::None => panic!("missing argument after {:?}", op),
-                token => self.stack.push(token.into_literal()),
+            match self.next_token() {
+                Symbol::None => panic!("missing argument after {:?}", op),
+                token => self.stack.push(token.into_literal()),
             }
 
-            self.stack.push(op);
+            self.stack.push(op);
         }
     }
 
-    /// Parser entry point: parse the token stream `self.tokens`, storing the
-    /// resulting `Symbol` stack in `self.stack`.
-    fn parse(&mut self) -> Result<(), String> {
-        self.expr();
+    /// Parser entry point: parse the token stream `self.tokens`, storing the
+    /// resulting `Symbol` stack in `self.stack`.
+    fn parse(&mut self) -> Result<(), String> {
+        self.expr();
 
-        match self.tokens.next() {
-            Some(token) => Err(format!("extra argument {}", token.quote())),
-            None => Ok(()),
+        match self.tokens.next() {
+            Some(token) => Err(format!("extra argument {}", token.quote())),
+            None => Ok(()),
         }
     }
 }
 
-/// Parse the token stream `args`, returning a `Symbol` stack representing the
-/// operations to perform in postfix order.
-pub fn parse(args: Vec<OsString>) -> Result<Vec<Symbol>, String> {
-    let mut p = Parser::new(args);
-    p.parse()?;
-    Ok(p.stack)
+/// Parse the token stream `args`, returning a `Symbol` stack representing the
+/// operations to perform in postfix order.
+pub fn parse(args: Vec<OsString>) -> Result<Vec<Symbol>, String> {
+    let mut p = Parser::new(args);
+    p.parse()?;
+    Ok(p.stack)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_test/test.rs.html b/dev/src/uu_test/test.rs.html index 738044f0f..8947e3c5c 100644 --- a/dev/src/uu_test/test.rs.html +++ b/dev/src/uu_test/test.rs.html @@ -1,4 +1,4 @@ -test.rs - source
1
+test.rs - source
1
 2
 3
 4
@@ -467,37 +467,37 @@
 467
 468
 469
-
// This file is part of the uutils coreutils package.
-//
-// (c) mahkoh (ju.orth [at] gmail [dot] com)
-// (c) Daniel Rocco <drocco@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) mahkoh (ju.orth [at] gmail [dot] com)
+// (c) Daniel Rocco <drocco@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (vars) egid euid FiletestOp StrlenOp
+// spell-checker:ignore (vars) egid euid FiletestOp StrlenOp
 
-mod parser;
+mod parser;
 
-use clap::{crate_version, Command};
-use parser::{parse, Operator, Symbol, UnaryOperator};
-use std::ffi::{OsStr, OsString};
-use std::fs;
-#[cfg(unix)]
-use std::os::unix::fs::MetadataExt;
-use uucore::display::Quotable;
-use uucore::error::{UResult, USimpleError};
-use uucore::format_usage;
+use clap::{crate_version, Command};
+use parser::{parse, Operator, Symbol, UnaryOperator};
+use std::ffi::{OsStr, OsString};
+use std::fs;
+#[cfg(unix)]
+use std::os::unix::fs::MetadataExt;
+use uucore::display::Quotable;
+use uucore::error::{UResult, USimpleError};
+use uucore::format_usage;
 
-const USAGE: &str = "\
+const USAGE: &str = "\
     {} EXPRESSION
     {}
     [ EXPRESSION ]
     [ ]
     [ OPTION";
 
-// We use after_help so that this comes after the usage string (it would come before if we used about)
-const AFTER_HELP: &str = "
+// We use after_help so that this comes after the usage string (it would come before if we used about)
+const AFTER_HELP: &str = "
 Exit with the status determined by EXPRESSION.
 
 An omitted EXPRESSION defaults to false.  Otherwise,
@@ -560,381 +560,381 @@ NOTE: your shell may have its own version of test and/or [, which usually supers
 the version described here.  Please refer to your shell's documentation
 for details about the options it supports.";
 
-const ABOUT: &str = "Check file types and compare values.";
+const ABOUT: &str = "Check file types and compare values.";
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .after_help(AFTER_HELP)
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .after_help(AFTER_HELP)
 }
 
-#[uucore::main]
-pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
-    let program = args.next().unwrap_or_else(|| OsString::from("test"));
-    let binary_name = uucore::util_name();
-    let mut args: Vec<_> = args.collect();
+#[uucore::main]
+pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
+    let program = args.next().unwrap_or_else(|| OsString::from("test"));
+    let binary_name = uucore::util_name();
+    let mut args: Vec<_> = args.collect();
 
-    if binary_name.ends_with('[') {
-        // If invoked as [ we should recognize --help and --version (but not -h or -v)
-        if args.len() == 1 && (args[0] == "--help" || args[0] == "--version") {
-            // Let clap pretty-print help and version
-            Command::new(binary_name)
-                .version(crate_version!())
-                .about(ABOUT)
-                .override_usage(format_usage(USAGE))
-                .after_help(AFTER_HELP)
-                // Disable printing of -h and -v as valid alternatives for --help and --version,
-                // since we don't recognize -h and -v as help/version flags.
-                .get_matches_from(std::iter::once(program).chain(args.into_iter()));
-            return Ok(());
+    if binary_name.ends_with('[') {
+        // If invoked as [ we should recognize --help and --version (but not -h or -v)
+        if args.len() == 1 && (args[0] == "--help" || args[0] == "--version") {
+            // Let clap pretty-print help and version
+            Command::new(binary_name)
+                .version(crate_version!())
+                .about(ABOUT)
+                .override_usage(format_usage(USAGE))
+                .after_help(AFTER_HELP)
+                // Disable printing of -h and -v as valid alternatives for --help and --version,
+                // since we don't recognize -h and -v as help/version flags.
+                .get_matches_from(std::iter::once(program).chain(args.into_iter()));
+            return Ok(());
         }
-        // If invoked via name '[', matching ']' must be in the last arg
-        let last = args.pop();
-        if last.as_deref() != Some(OsStr::new("]")) {
-            return Err(USimpleError::new(2, "missing ']'"));
+        // If invoked via name '[', matching ']' must be in the last arg
+        let last = args.pop();
+        if last.as_deref() != Some(OsStr::new("]")) {
+            return Err(USimpleError::new(2, "missing ']'"));
         }
     }
 
-    let result = parse(args).and_then(|mut stack| eval(&mut stack));
+    let result = parse(args).and_then(|mut stack| eval(&mut stack));
 
-    match result {
-        Ok(result) => {
-            if result {
+    match result {
+        Ok(result) => {
+            if result {
                 Ok(())
-            } else {
-                Err(1.into())
+            } else {
+                Err(1.into())
             }
         }
-        Err(e) => Err(USimpleError::new(2, e)),
+        Err(e) => Err(USimpleError::new(2, e)),
     }
 }
 
-/// Evaluate a stack of Symbols, returning the result of the evaluation or
-/// an error message if evaluation failed.
-fn eval(stack: &mut Vec<Symbol>) -> Result<bool, String> {
-    macro_rules! pop_literal {
+/// Evaluate a stack of Symbols, returning the result of the evaluation or
+/// an error message if evaluation failed.
+fn eval(stack: &mut Vec<Symbol>) -> Result<bool, String> {
+    macro_rules! pop_literal {
         () => {
-            match stack.pop() {
-                Some(Symbol::Literal(s)) => s,
-                _ => panic!(),
+            match stack.pop() {
+                Some(Symbol::Literal(s)) => s,
+                _ => panic!(),
             }
         };
     }
 
-    let s = stack.pop();
+    let s = stack.pop();
 
-    match s {
-        Some(Symbol::Bang) => {
-            let result = eval(stack)?;
+    match s {
+        Some(Symbol::Bang) => {
+            let result = eval(stack)?;
 
-            Ok(!result)
+            Ok(!result)
         }
-        Some(Symbol::Op(Operator::String(op))) => {
-            let b = stack.pop();
-            let a = stack.pop();
-            Ok(if op == "!=" { a != b } else { a == b })
+        Some(Symbol::Op(Operator::String(op))) => {
+            let b = stack.pop();
+            let a = stack.pop();
+            Ok(if op == "!=" { a != b } else { a == b })
         }
-        Some(Symbol::Op(Operator::Int(op))) => {
-            let b = pop_literal!();
-            let a = pop_literal!();
+        Some(Symbol::Op(Operator::Int(op))) => {
+            let b = pop_literal!();
+            let a = pop_literal!();
 
-            Ok(integers(&a, &b, &op)?)
+            Ok(integers(&a, &b, &op)?)
         }
-        Some(Symbol::Op(Operator::File(op))) => {
-            let b = pop_literal!();
-            let a = pop_literal!();
-            Ok(files(&a, &b, &op)?)
+        Some(Symbol::Op(Operator::File(op))) => {
+            let b = pop_literal!();
+            let a = pop_literal!();
+            Ok(files(&a, &b, &op)?)
         }
-        Some(Symbol::UnaryOp(UnaryOperator::StrlenOp(op))) => {
-            let s = match stack.pop() {
-                Some(Symbol::Literal(s)) => s,
-                Some(Symbol::None) => OsString::from(""),
-                None => {
-                    return Ok(true);
+        Some(Symbol::UnaryOp(UnaryOperator::StrlenOp(op))) => {
+            let s = match stack.pop() {
+                Some(Symbol::Literal(s)) => s,
+                Some(Symbol::None) => OsString::from(""),
+                None => {
+                    return Ok(true);
                 }
-                _ => {
-                    return Err(format!("missing argument after '{:?}'", op));
+                _ => {
+                    return Err(format!("missing argument after '{:?}'", op));
                 }
             };
 
-            Ok(if op == "-z" {
-                s.is_empty()
-            } else {
-                !s.is_empty()
+            Ok(if op == "-z" {
+                s.is_empty()
+            } else {
+                !s.is_empty()
             })
         }
-        Some(Symbol::UnaryOp(UnaryOperator::FiletestOp(op))) => {
-            let op = op.to_str().unwrap();
+        Some(Symbol::UnaryOp(UnaryOperator::FiletestOp(op))) => {
+            let op = op.to_str().unwrap();
 
-            let f = pop_literal!();
+            let f = pop_literal!();
 
-            Ok(match op {
-                "-b" => path(&f, &PathCondition::BlockSpecial),
-                "-c" => path(&f, &PathCondition::CharacterSpecial),
-                "-d" => path(&f, &PathCondition::Directory),
-                "-e" => path(&f, &PathCondition::Exists),
-                "-f" => path(&f, &PathCondition::Regular),
-                "-g" => path(&f, &PathCondition::GroupIdFlag),
-                "-G" => path(&f, &PathCondition::GroupOwns),
-                "-h" => path(&f, &PathCondition::SymLink),
-                "-k" => path(&f, &PathCondition::Sticky),
-                "-L" => path(&f, &PathCondition::SymLink),
-                "-N" => path(&f, &PathCondition::ExistsModifiedLastRead),
-                "-O" => path(&f, &PathCondition::UserOwns),
-                "-p" => path(&f, &PathCondition::Fifo),
-                "-r" => path(&f, &PathCondition::Readable),
-                "-S" => path(&f, &PathCondition::Socket),
-                "-s" => path(&f, &PathCondition::NonEmpty),
-                "-t" => isatty(&f)?,
-                "-u" => path(&f, &PathCondition::UserIdFlag),
-                "-w" => path(&f, &PathCondition::Writable),
-                "-x" => path(&f, &PathCondition::Executable),
-                _ => panic!(),
+            Ok(match op {
+                "-b" => path(&f, &PathCondition::BlockSpecial),
+                "-c" => path(&f, &PathCondition::CharacterSpecial),
+                "-d" => path(&f, &PathCondition::Directory),
+                "-e" => path(&f, &PathCondition::Exists),
+                "-f" => path(&f, &PathCondition::Regular),
+                "-g" => path(&f, &PathCondition::GroupIdFlag),
+                "-G" => path(&f, &PathCondition::GroupOwns),
+                "-h" => path(&f, &PathCondition::SymLink),
+                "-k" => path(&f, &PathCondition::Sticky),
+                "-L" => path(&f, &PathCondition::SymLink),
+                "-N" => path(&f, &PathCondition::ExistsModifiedLastRead),
+                "-O" => path(&f, &PathCondition::UserOwns),
+                "-p" => path(&f, &PathCondition::Fifo),
+                "-r" => path(&f, &PathCondition::Readable),
+                "-S" => path(&f, &PathCondition::Socket),
+                "-s" => path(&f, &PathCondition::NonEmpty),
+                "-t" => isatty(&f)?,
+                "-u" => path(&f, &PathCondition::UserIdFlag),
+                "-w" => path(&f, &PathCondition::Writable),
+                "-x" => path(&f, &PathCondition::Executable),
+                _ => panic!(),
             })
         }
-        Some(Symbol::Literal(s)) => Ok(!s.is_empty()),
-        Some(Symbol::None) | None => Ok(false),
-        Some(Symbol::BoolOp(op)) => {
-            let b = eval(stack)?;
-            let a = eval(stack)?;
+        Some(Symbol::Literal(s)) => Ok(!s.is_empty()),
+        Some(Symbol::None) | None => Ok(false),
+        Some(Symbol::BoolOp(op)) => {
+            let b = eval(stack)?;
+            let a = eval(stack)?;
 
-            Ok(if op == "-a" { a && b } else { a || b })
+            Ok(if op == "-a" { a && b } else { a || b })
         }
-        _ => Err("expected value".to_string()),
+        _ => Err("expected value".to_string()),
     }
 }
 
-/// Operations to compare integers
-/// `a` is the left hand side
-/// `b` is the left hand side
-/// `op` the operation (ex: -eq, -lt, etc)
-fn integers(a: &OsStr, b: &OsStr, op: &OsStr) -> Result<bool, String> {
-    let format_err = |value: &OsStr| format!("invalid integer {}", value.quote());
+/// Operations to compare integers
+/// `a` is the left hand side
+/// `b` is the left hand side
+/// `op` the operation (ex: -eq, -lt, etc)
+fn integers(a: &OsStr, b: &OsStr, op: &OsStr) -> Result<bool, String> {
+    let format_err = |value: &OsStr| format!("invalid integer {}", value.quote());
 
-    // Parse the two inputs
-    let a: i128 = a
-        .to_str()
-        .and_then(|s| s.parse().ok())
-        .ok_or_else(|| format_err(a))?;
+    // Parse the two inputs
+    let a: i128 = a
+        .to_str()
+        .and_then(|s| s.parse().ok())
+        .ok_or_else(|| format_err(a))?;
 
-    let b: i128 = b
-        .to_str()
-        .and_then(|s| s.parse().ok())
-        .ok_or_else(|| format_err(b))?;
+    let b: i128 = b
+        .to_str()
+        .and_then(|s| s.parse().ok())
+        .ok_or_else(|| format_err(b))?;
 
-    // Do the maths
-    Ok(match op.to_str() {
-        Some("-eq") => a == b,
-        Some("-ne") => a != b,
-        Some("-gt") => a > b,
-        Some("-ge") => a >= b,
-        Some("-lt") => a < b,
-        Some("-le") => a <= b,
-        _ => return Err(format!("unknown operator {}", op.quote())),
+    // Do the maths
+    Ok(match op.to_str() {
+        Some("-eq") => a == b,
+        Some("-ne") => a != b,
+        Some("-gt") => a > b,
+        Some("-ge") => a >= b,
+        Some("-lt") => a < b,
+        Some("-le") => a <= b,
+        _ => return Err(format!("unknown operator {}", op.quote())),
     })
 }
 
-/// Operations to compare files metadata
-/// `a` is the left hand side
-/// `b` is the left hand side
-/// `op` the operation (ex: -ef, -nt, etc)
-fn files(a: &OsStr, b: &OsStr, op: &OsStr) -> Result<bool, String> {
-    // Don't manage the error. GNU doesn't show error when doing
-    // test foo -nt bar
-    let f_a = match fs::metadata(a) {
-        Ok(f) => f,
-        Err(_) => return Ok(false),
+/// Operations to compare files metadata
+/// `a` is the left hand side
+/// `b` is the left hand side
+/// `op` the operation (ex: -ef, -nt, etc)
+fn files(a: &OsStr, b: &OsStr, op: &OsStr) -> Result<bool, String> {
+    // Don't manage the error. GNU doesn't show error when doing
+    // test foo -nt bar
+    let f_a = match fs::metadata(a) {
+        Ok(f) => f,
+        Err(_) => return Ok(false),
     };
-    let f_b = match fs::metadata(b) {
-        Ok(f) => f,
-        Err(_) => return Ok(false),
+    let f_b = match fs::metadata(b) {
+        Ok(f) => f,
+        Err(_) => return Ok(false),
     };
 
-    Ok(match op.to_str() {
-        #[cfg(unix)]
-        Some("-ef") => f_a.ino() == f_b.ino() && f_a.dev() == f_b.dev(),
-        #[cfg(not(unix))]
-        Some("-ef") => unimplemented!(),
-        Some("-nt") => f_a.modified().unwrap() > f_b.modified().unwrap(),
-        Some("-ot") => f_a.created().unwrap() > f_b.created().unwrap(),
-        _ => return Err(format!("unknown operator {}", op.quote())),
+    Ok(match op.to_str() {
+        #[cfg(unix)]
+        Some("-ef") => f_a.ino() == f_b.ino() && f_a.dev() == f_b.dev(),
+        #[cfg(not(unix))]
+        Some("-ef") => unimplemented!(),
+        Some("-nt") => f_a.modified().unwrap() > f_b.modified().unwrap(),
+        Some("-ot") => f_a.created().unwrap() > f_b.created().unwrap(),
+        _ => return Err(format!("unknown operator {}", op.quote())),
     })
 }
 
-fn isatty(fd: &OsStr) -> Result<bool, String> {
-    fd.to_str()
-        .and_then(|s| s.parse().ok())
-        .ok_or_else(|| format!("invalid integer {}", fd.quote()))
-        .map(|i| {
-            #[cfg(not(target_os = "redox"))]
-            unsafe {
-                libc::isatty(i) == 1
-            }
-            #[cfg(target_os = "redox")]
-            syscall::dup(i, b"termios").map(syscall::close).is_ok()
+fn isatty(fd: &OsStr) -> Result<bool, String> {
+    fd.to_str()
+        .and_then(|s| s.parse().ok())
+        .ok_or_else(|| format!("invalid integer {}", fd.quote()))
+        .map(|i| {
+            #[cfg(not(target_os = "redox"))]
+            unsafe {
+                libc::isatty(i) == 1
+            }
+            #[cfg(target_os = "redox")]
+            syscall::dup(i, b"termios").map(syscall::close).is_ok()
         })
 }
 
-#[derive(Eq, PartialEq)]
-enum PathCondition {
-    BlockSpecial,
-    CharacterSpecial,
-    Directory,
-    Exists,
-    ExistsModifiedLastRead,
-    Regular,
-    GroupIdFlag,
-    GroupOwns,
-    SymLink,
-    Sticky,
-    UserOwns,
-    Fifo,
-    Readable,
-    Socket,
-    NonEmpty,
-    UserIdFlag,
-    Writable,
-    Executable,
+#[derive(Eq, PartialEq)]
+enum PathCondition {
+    BlockSpecial,
+    CharacterSpecial,
+    Directory,
+    Exists,
+    ExistsModifiedLastRead,
+    Regular,
+    GroupIdFlag,
+    GroupOwns,
+    SymLink,
+    Sticky,
+    UserOwns,
+    Fifo,
+    Readable,
+    Socket,
+    NonEmpty,
+    UserIdFlag,
+    Writable,
+    Executable,
 }
 
-#[cfg(not(windows))]
-fn path(path: &OsStr, condition: &PathCondition) -> bool {
-    use std::fs::Metadata;
-    use std::os::unix::fs::FileTypeExt;
+#[cfg(not(windows))]
+fn path(path: &OsStr, condition: &PathCondition) -> bool {
+    use std::fs::Metadata;
+    use std::os::unix::fs::FileTypeExt;
 
-    const S_ISUID: u32 = 0o4000;
-    const S_ISGID: u32 = 0o2000;
-    const S_ISVTX: u32 = 0o1000;
+    const S_ISUID: u32 = 0o4000;
+    const S_ISGID: u32 = 0o2000;
+    const S_ISVTX: u32 = 0o1000;
 
-    enum Permission {
-        Read = 0o4,
-        Write = 0o2,
-        Execute = 0o1,
+    enum Permission {
+        Read = 0o4,
+        Write = 0o2,
+        Execute = 0o1,
     }
 
-    let geteuid = || {
-        #[cfg(not(target_os = "redox"))]
-        let euid = unsafe { libc::geteuid() };
-        #[cfg(target_os = "redox")]
-        let euid = syscall::geteuid().unwrap() as u32;
+    let geteuid = || {
+        #[cfg(not(target_os = "redox"))]
+        let euid = unsafe { libc::geteuid() };
+        #[cfg(target_os = "redox")]
+        let euid = syscall::geteuid().unwrap() as u32;
 
-        euid
+        euid
     };
 
-    let getegid = || {
-        #[cfg(not(target_os = "redox"))]
-        let egid = unsafe { libc::getegid() };
-        #[cfg(target_os = "redox")]
-        let egid = syscall::getegid().unwrap() as u32;
+    let getegid = || {
+        #[cfg(not(target_os = "redox"))]
+        let egid = unsafe { libc::getegid() };
+        #[cfg(target_os = "redox")]
+        let egid = syscall::getegid().unwrap() as u32;
 
-        egid
+        egid
     };
 
-    let perm = |metadata: Metadata, p: Permission| {
-        if geteuid() == metadata.uid() {
-            metadata.mode() & ((p as u32) << 6) != 0
-        } else if getegid() == metadata.gid() {
-            metadata.mode() & ((p as u32) << 3) != 0
-        } else {
-            metadata.mode() & (p as u32) != 0
-        }
+    let perm = |metadata: Metadata, p: Permission| {
+        if geteuid() == metadata.uid() {
+            metadata.mode() & ((p as u32) << 6) != 0
+        } else if getegid() == metadata.gid() {
+            metadata.mode() & ((p as u32) << 3) != 0
+        } else {
+            metadata.mode() & (p as u32) != 0
+        }
     };
 
-    let metadata = if condition == &PathCondition::SymLink {
-        fs::symlink_metadata(path)
-    } else {
-        fs::metadata(path)
+    let metadata = if condition == &PathCondition::SymLink {
+        fs::symlink_metadata(path)
+    } else {
+        fs::metadata(path)
     };
 
-    let metadata = match metadata {
-        Ok(metadata) => metadata,
+    let metadata = match metadata {
+        Ok(metadata) => metadata,
         Err(_) => {
-            return false;
+            return false;
         }
     };
 
-    let file_type = metadata.file_type();
+    let file_type = metadata.file_type();
 
-    match condition {
-        PathCondition::BlockSpecial => file_type.is_block_device(),
-        PathCondition::CharacterSpecial => file_type.is_char_device(),
-        PathCondition::Directory => file_type.is_dir(),
-        PathCondition::Exists => true,
-        PathCondition::ExistsModifiedLastRead => {
-            metadata.accessed().unwrap() < metadata.modified().unwrap()
+    match condition {
+        PathCondition::BlockSpecial => file_type.is_block_device(),
+        PathCondition::CharacterSpecial => file_type.is_char_device(),
+        PathCondition::Directory => file_type.is_dir(),
+        PathCondition::Exists => true,
+        PathCondition::ExistsModifiedLastRead => {
+            metadata.accessed().unwrap() < metadata.modified().unwrap()
         }
-        PathCondition::Regular => file_type.is_file(),
-        PathCondition::GroupIdFlag => metadata.mode() & S_ISGID != 0,
-        PathCondition::GroupOwns => metadata.gid() == getegid(),
-        PathCondition::SymLink => metadata.file_type().is_symlink(),
-        PathCondition::Sticky => metadata.mode() & S_ISVTX != 0,
-        PathCondition::UserOwns => metadata.uid() == geteuid(),
-        PathCondition::Fifo => file_type.is_fifo(),
-        PathCondition::Readable => perm(metadata, Permission::Read),
-        PathCondition::Socket => file_type.is_socket(),
-        PathCondition::NonEmpty => metadata.size() > 0,
-        PathCondition::UserIdFlag => metadata.mode() & S_ISUID != 0,
-        PathCondition::Writable => perm(metadata, Permission::Write),
-        PathCondition::Executable => perm(metadata, Permission::Execute),
+        PathCondition::Regular => file_type.is_file(),
+        PathCondition::GroupIdFlag => metadata.mode() & S_ISGID != 0,
+        PathCondition::GroupOwns => metadata.gid() == getegid(),
+        PathCondition::SymLink => metadata.file_type().is_symlink(),
+        PathCondition::Sticky => metadata.mode() & S_ISVTX != 0,
+        PathCondition::UserOwns => metadata.uid() == geteuid(),
+        PathCondition::Fifo => file_type.is_fifo(),
+        PathCondition::Readable => perm(metadata, Permission::Read),
+        PathCondition::Socket => file_type.is_socket(),
+        PathCondition::NonEmpty => metadata.size() > 0,
+        PathCondition::UserIdFlag => metadata.mode() & S_ISUID != 0,
+        PathCondition::Writable => perm(metadata, Permission::Write),
+        PathCondition::Executable => perm(metadata, Permission::Execute),
     }
 }
 
-#[cfg(windows)]
-fn path(path: &OsStr, condition: &PathCondition) -> bool {
-    use std::fs::metadata;
+#[cfg(windows)]
+fn path(path: &OsStr, condition: &PathCondition) -> bool {
+    use std::fs::metadata;
 
-    let stat = match metadata(path) {
-        Ok(s) => s,
-        _ => return false,
+    let stat = match metadata(path) {
+        Ok(s) => s,
+        _ => return false,
     };
 
-    match condition {
-        PathCondition::BlockSpecial => false,
-        PathCondition::CharacterSpecial => false,
-        PathCondition::Directory => stat.is_dir(),
-        PathCondition::Exists => true,
-        PathCondition::ExistsModifiedLastRead => unimplemented!(),
-        PathCondition::Regular => stat.is_file(),
-        PathCondition::GroupIdFlag => false,
-        PathCondition::GroupOwns => unimplemented!(),
-        PathCondition::SymLink => false,
-        PathCondition::Sticky => false,
-        PathCondition::UserOwns => unimplemented!(),
-        PathCondition::Fifo => false,
-        PathCondition::Readable => false, // TODO
-        PathCondition::Socket => false,
-        PathCondition::NonEmpty => stat.len() > 0,
-        PathCondition::UserIdFlag => false,
-        PathCondition::Writable => false,   // TODO
-        PathCondition::Executable => false, // TODO
-    }
+    match condition {
+        PathCondition::BlockSpecial => false,
+        PathCondition::CharacterSpecial => false,
+        PathCondition::Directory => stat.is_dir(),
+        PathCondition::Exists => true,
+        PathCondition::ExistsModifiedLastRead => unimplemented!(),
+        PathCondition::Regular => stat.is_file(),
+        PathCondition::GroupIdFlag => false,
+        PathCondition::GroupOwns => unimplemented!(),
+        PathCondition::SymLink => false,
+        PathCondition::Sticky => false,
+        PathCondition::UserOwns => unimplemented!(),
+        PathCondition::Fifo => false,
+        PathCondition::Readable => false, // TODO
+        PathCondition::Socket => false,
+        PathCondition::NonEmpty => stat.len() > 0,
+        PathCondition::UserIdFlag => false,
+        PathCondition::Writable => false,   // TODO
+        PathCondition::Executable => false, // TODO
+    }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::integers;
-    use std::ffi::OsStr;
+#[cfg(test)]
+mod tests {
+    use super::integers;
+    use std::ffi::OsStr;
 
-    #[test]
-    fn test_integer_op() {
-        let a = OsStr::new("18446744073709551616");
-        let b = OsStr::new("0");
-        assert!(!integers(a, b, OsStr::new("-lt")).unwrap());
-        let a = OsStr::new("18446744073709551616");
-        let b = OsStr::new("0");
-        assert!(integers(a, b, OsStr::new("-gt")).unwrap());
-        let a = OsStr::new("-1");
-        let b = OsStr::new("0");
-        assert!(integers(a, b, OsStr::new("-lt")).unwrap());
-        let a = OsStr::new("42");
-        let b = OsStr::new("42");
-        assert!(integers(a, b, OsStr::new("-eq")).unwrap());
-        let a = OsStr::new("42");
-        let b = OsStr::new("42");
-        assert!(!integers(a, b, OsStr::new("-ne")).unwrap());
+    #[test]
+    fn test_integer_op() {
+        let a = OsStr::new("18446744073709551616");
+        let b = OsStr::new("0");
+        assert!(!integers(a, b, OsStr::new("-lt")).unwrap());
+        let a = OsStr::new("18446744073709551616");
+        let b = OsStr::new("0");
+        assert!(integers(a, b, OsStr::new("-gt")).unwrap());
+        let a = OsStr::new("-1");
+        let b = OsStr::new("0");
+        assert!(integers(a, b, OsStr::new("-lt")).unwrap());
+        let a = OsStr::new("42");
+        let b = OsStr::new("42");
+        assert!(integers(a, b, OsStr::new("-eq")).unwrap());
+        let a = OsStr::new("42");
+        let b = OsStr::new("42");
+        assert!(!integers(a, b, OsStr::new("-ne")).unwrap());
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_timeout/status.rs.html b/dev/src/uu_timeout/status.rs.html index 22deda7e0..abd0a485b 100644 --- a/dev/src/uu_timeout/status.rs.html +++ b/dev/src/uu_timeout/status.rs.html @@ -1,4 +1,4 @@ -status.rs - source
1
+status.rs - source
1
 2
 3
 4
@@ -49,56 +49,56 @@
 49
 50
 51
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-//! Exit status codes produced by `timeout`.
-use std::convert::From;
-use uucore::error::UError;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+//! Exit status codes produced by `timeout`.
+use std::convert::From;
+use uucore::error::UError;
 
-/// Enumerates the exit statuses produced by `timeout`.
-///
-/// Use [`Into::into`] (or [`From::from`]) to convert an enumeration
-/// member into a numeric status code. You can also convert into a
-/// [`UError`].
-///
-/// # Examples
-///
-/// Convert into an [`i32`]:
-///
-/// ```rust,ignore
-/// assert_eq!(i32::from(ExitStatus::CommandTimedOut), 124);
-/// ```
-pub(crate) enum ExitStatus {
-    /// When the child process times out and `--preserve-status` is not specified.
-    CommandTimedOut,
+/// Enumerates the exit statuses produced by `timeout`.
+///
+/// Use [`Into::into`] (or [`From::from`]) to convert an enumeration
+/// member into a numeric status code. You can also convert into a
+/// [`UError`].
+///
+/// # Examples
+///
+/// Convert into an [`i32`]:
+///
+/// ```rust,ignore
+/// assert_eq!(i32::from(ExitStatus::CommandTimedOut), 124);
+/// ```
+pub(crate) enum ExitStatus {
+    /// When the child process times out and `--preserve-status` is not specified.
+    CommandTimedOut,
 
-    /// When `timeout` itself fails.
-    TimeoutFailed,
+    /// When `timeout` itself fails.
+    TimeoutFailed,
 
-    /// When a signal is sent to the child process or `timeout` itself.
-    SignalSent(usize),
+    /// When a signal is sent to the child process or `timeout` itself.
+    SignalSent(usize),
 
-    /// When there is a failure while waiting for the child process to terminate.
-    WaitingFailed,
+    /// When there is a failure while waiting for the child process to terminate.
+    WaitingFailed,
 }
 
-impl From<ExitStatus> for i32 {
-    fn from(exit_status: ExitStatus) -> Self {
-        match exit_status {
-            ExitStatus::CommandTimedOut => 124,
-            ExitStatus::TimeoutFailed => 125,
-            ExitStatus::SignalSent(s) => 128 + s as Self,
-            ExitStatus::WaitingFailed => 124,
+impl From<ExitStatus> for i32 {
+    fn from(exit_status: ExitStatus) -> Self {
+        match exit_status {
+            ExitStatus::CommandTimedOut => 124,
+            ExitStatus::TimeoutFailed => 125,
+            ExitStatus::SignalSent(s) => 128 + s as Self,
+            ExitStatus::WaitingFailed => 124,
         }
     }
 }
 
-impl From<ExitStatus> for Box<dyn UError> {
-    fn from(exit_status: ExitStatus) -> Self {
-        Box::from(i32::from(exit_status))
+impl From<ExitStatus> for Box<dyn UError> {
+    fn from(exit_status: ExitStatus) -> Self {
+        Box::from(i32::from(exit_status))
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_timeout/timeout.rs.html b/dev/src/uu_timeout/timeout.rs.html index 6a25c1a79..8f493846a 100644 --- a/dev/src/uu_timeout/timeout.rs.html +++ b/dev/src/uu_timeout/timeout.rs.html @@ -1,4 +1,4 @@ -timeout.rs - source
1
+timeout.rs - source
1
 2
 3
 4
@@ -376,383 +376,383 @@
 376
 377
 378
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) tstr sigstr cmdname setpgid sigchld getpid
-mod status;
+// spell-checker:ignore (ToDO) tstr sigstr cmdname setpgid sigchld getpid
+mod status;
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-extern crate clap;
+extern crate clap;
 
-use crate::status::ExitStatus;
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::io::ErrorKind;
-use std::process::{self, Child, Stdio};
-use std::time::Duration;
-use uucore::display::Quotable;
-use uucore::error::{UClapError, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
-use uucore::process::ChildExt;
-use uucore::signals::{signal_by_name_or_value, signal_name_by_value};
+use crate::status::ExitStatus;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::io::ErrorKind;
+use std::process::{self, Child, Stdio};
+use std::time::Duration;
+use uucore::display::Quotable;
+use uucore::error::{UClapError, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
+use uucore::process::ChildExt;
+use uucore::signals::{signal_by_name_or_value, signal_name_by_value};
 
-static ABOUT: &str = "Start COMMAND, and kill it if still running after DURATION.";
-const USAGE: &str = "{} [OPTION] DURATION COMMAND...";
+static ABOUT: &str = "Start COMMAND, and kill it if still running after DURATION.";
+const USAGE: &str = "{} [OPTION] DURATION COMMAND...";
 
-pub mod options {
-    pub static FOREGROUND: &str = "foreground";
-    pub static KILL_AFTER: &str = "kill-after";
-    pub static SIGNAL: &str = "signal";
-    pub static PRESERVE_STATUS: &str = "preserve-status";
-    pub static VERBOSE: &str = "verbose";
+pub mod options {
+    pub static FOREGROUND: &str = "foreground";
+    pub static KILL_AFTER: &str = "kill-after";
+    pub static SIGNAL: &str = "signal";
+    pub static PRESERVE_STATUS: &str = "preserve-status";
+    pub static VERBOSE: &str = "verbose";
 
-    // Positional args.
-    pub static DURATION: &str = "duration";
-    pub static COMMAND: &str = "command";
+    // Positional args.
+    pub static DURATION: &str = "duration";
+    pub static COMMAND: &str = "command";
 }
 
-struct Config {
-    foreground: bool,
-    kill_after: Option<Duration>,
-    signal: usize,
-    duration: Duration,
-    preserve_status: bool,
-    verbose: bool,
+struct Config {
+    foreground: bool,
+    kill_after: Option<Duration>,
+    signal: usize,
+    duration: Duration,
+    preserve_status: bool,
+    verbose: bool,
 
-    command: Vec<String>,
+    command: Vec<String>,
 }
 
-impl Config {
-    fn from(options: &clap::ArgMatches) -> UResult<Self> {
-        let signal = match options.get_one::<String>(options::SIGNAL) {
-            Some(signal_) => {
-                let signal_result = signal_by_name_or_value(signal_);
-                match signal_result {
-                    None => {
-                        return Err(UUsageError::new(
-                            ExitStatus::TimeoutFailed.into(),
-                            format!("{}: invalid signal", signal_.quote()),
+impl Config {
+    fn from(options: &clap::ArgMatches) -> UResult<Self> {
+        let signal = match options.get_one::<String>(options::SIGNAL) {
+            Some(signal_) => {
+                let signal_result = signal_by_name_or_value(signal_);
+                match signal_result {
+                    None => {
+                        return Err(UUsageError::new(
+                            ExitStatus::TimeoutFailed.into(),
+                            format!("{}: invalid signal", signal_.quote()),
                         ))
                     }
-                    Some(signal_value) => signal_value,
+                    Some(signal_value) => signal_value,
                 }
             }
-            _ => uucore::signals::signal_by_name_or_value("TERM").unwrap(),
+            _ => uucore::signals::signal_by_name_or_value("TERM").unwrap(),
         };
 
-        let kill_after = match options.get_one::<String>(options::KILL_AFTER) {
-            None => None,
-            Some(kill_after) => match uucore::parse_time::from_str(kill_after) {
-                Ok(k) => Some(k),
-                Err(err) => return Err(UUsageError::new(ExitStatus::TimeoutFailed.into(), err)),
+        let kill_after = match options.get_one::<String>(options::KILL_AFTER) {
+            None => None,
+            Some(kill_after) => match uucore::parse_time::from_str(kill_after) {
+                Ok(k) => Some(k),
+                Err(err) => return Err(UUsageError::new(ExitStatus::TimeoutFailed.into(), err)),
             },
         };
 
-        let duration = match uucore::parse_time::from_str(
-            options.get_one::<String>(options::DURATION).unwrap(),
+        let duration = match uucore::parse_time::from_str(
+            options.get_one::<String>(options::DURATION).unwrap(),
         ) {
-            Ok(duration) => duration,
-            Err(err) => return Err(UUsageError::new(ExitStatus::TimeoutFailed.into(), err)),
+            Ok(duration) => duration,
+            Err(err) => return Err(UUsageError::new(ExitStatus::TimeoutFailed.into(), err)),
         };
 
-        let preserve_status: bool = options.get_flag(options::PRESERVE_STATUS);
-        let foreground = options.get_flag(options::FOREGROUND);
-        let verbose = options.get_flag(options::VERBOSE);
+        let preserve_status: bool = options.get_flag(options::PRESERVE_STATUS);
+        let foreground = options.get_flag(options::FOREGROUND);
+        let verbose = options.get_flag(options::VERBOSE);
 
-        let command = options
-            .get_many::<String>(options::COMMAND)
-            .unwrap()
-            .map(String::from)
-            .collect::<Vec<_>>();
+        let command = options
+            .get_many::<String>(options::COMMAND)
+            .unwrap()
+            .map(String::from)
+            .collect::<Vec<_>>();
 
-        Ok(Self {
-            foreground,
-            kill_after,
-            signal,
-            duration,
-            preserve_status,
-            verbose,
-            command,
+        Ok(Self {
+            foreground,
+            kill_after,
+            signal,
+            duration,
+            preserve_status,
+            verbose,
+            command,
         })
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
+    let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?;
 
-    let config = Config::from(&matches)?;
-    timeout(
-        &config.command,
-        config.duration,
-        config.signal,
-        config.kill_after,
-        config.foreground,
-        config.preserve_status,
-        config.verbose,
+    let config = Config::from(&matches)?;
+    timeout(
+        &config.command,
+        config.duration,
+        config.signal,
+        config.kill_after,
+        config.foreground,
+        config.preserve_status,
+        config.verbose,
     )
 }
 
-pub fn uu_app() -> Command {
-    Command::new("timeout")
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .arg(
-            Arg::new(options::FOREGROUND)
-                .long(options::FOREGROUND)
-                .help(
+pub fn uu_app() -> Command {
+    Command::new("timeout")
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .arg(
+            Arg::new(options::FOREGROUND)
+                .long(options::FOREGROUND)
+                .help(
                     "when not running timeout directly from a shell prompt, allow \
                 COMMAND to read from the TTY and get TTY signals; in this mode, \
                 children of COMMAND will not be timed out",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::KILL_AFTER)
-                .long(options::KILL_AFTER)
-                .short('k')
-                .help(
+        .arg(
+            Arg::new(options::KILL_AFTER)
+                .long(options::KILL_AFTER)
+                .short('k')
+                .help(
                     "also send a KILL signal if COMMAND is still running this long \
                 after the initial signal was sent",
                 ),
         )
-        .arg(
-            Arg::new(options::PRESERVE_STATUS)
-                .long(options::PRESERVE_STATUS)
-                .help("exit with the same status as COMMAND, even when the command times out")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PRESERVE_STATUS)
+                .long(options::PRESERVE_STATUS)
+                .help("exit with the same status as COMMAND, even when the command times out")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SIGNAL)
-                .short('s')
-                .long(options::SIGNAL)
-                .help(
+        .arg(
+            Arg::new(options::SIGNAL)
+                .short('s')
+                .long(options::SIGNAL)
+                .help(
                     "specify the signal to be sent on timeout; SIGNAL may be a name like \
                 'HUP' or a number; see 'kill -l' for a list of signals",
                 )
-                .value_name("SIGNAL"),
+                .value_name("SIGNAL"),
         )
-        .arg(
-            Arg::new(options::VERBOSE)
-                .short('v')
-                .long(options::VERBOSE)
-                .help("diagnose to stderr any signal sent upon timeout")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::VERBOSE)
+                .short('v')
+                .long(options::VERBOSE)
+                .help("diagnose to stderr any signal sent upon timeout")
+                .action(ArgAction::SetTrue),
         )
-        .arg(Arg::new(options::DURATION).required(true))
-        .arg(
-            Arg::new(options::COMMAND)
-                .required(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::CommandName),
+        .arg(Arg::new(options::DURATION).required(true))
+        .arg(
+            Arg::new(options::COMMAND)
+                .required(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::CommandName),
         )
-        .trailing_var_arg(true)
-        .infer_long_args(true)
+        .trailing_var_arg(true)
+        .infer_long_args(true)
 }
 
-/// Remove pre-existing SIGCHLD handlers that would make waiting for the child's exit code fail.
-fn unblock_sigchld() {
-    unsafe {
-        nix::sys::signal::signal(
-            nix::sys::signal::Signal::SIGCHLD,
-            nix::sys::signal::SigHandler::SigDfl,
+/// Remove pre-existing SIGCHLD handlers that would make waiting for the child's exit code fail.
+fn unblock_sigchld() {
+    unsafe {
+        nix::sys::signal::signal(
+            nix::sys::signal::Signal::SIGCHLD,
+            nix::sys::signal::SigHandler::SigDfl,
         )
-        .unwrap();
+        .unwrap();
     }
 }
 
-/// Report that a signal is being sent if the verbose flag is set.
-fn report_if_verbose(signal: usize, cmd: &str, verbose: bool) {
-    if verbose {
-        let s = signal_name_by_value(signal).unwrap();
-        show_error!("sending signal {} to command {}", s, cmd.quote());
+/// Report that a signal is being sent if the verbose flag is set.
+fn report_if_verbose(signal: usize, cmd: &str, verbose: bool) {
+    if verbose {
+        let s = signal_name_by_value(signal).unwrap();
+        show_error!("sending signal {} to command {}", s, cmd.quote());
     }
 }
 
-/// Wait for a child process and send a kill signal if it does not terminate.
-///
-/// This function waits for the child `process` for the time period
-/// given by `duration`. If the child process does not terminate
-/// within that time, we send the `SIGKILL` signal to it. If `verbose`
-/// is `true`, then a message is printed to `stderr` when that
-/// happens.
-///
-/// If the child process terminates within the given time period and
-/// `preserve_status` is `true`, then the status code of the child
-/// process is returned. If the child process terminates within the
-/// given time period and `preserve_status` is `false`, then 124 is
-/// returned. If the child does not terminate within the time period,
-/// then 137 is returned. Finally, if there is an error while waiting
-/// for the child process to terminate, then 124 is returned.
-///
-/// # Errors
-///
-/// If there is a problem sending the `SIGKILL` signal or waiting for
-/// the process after that signal is sent.
-fn wait_or_kill_process(
-    mut process: Child,
-    cmd: &str,
-    duration: Duration,
-    preserve_status: bool,
-    verbose: bool,
-) -> std::io::Result<i32> {
-    match process.wait_or_timeout(duration) {
-        Ok(Some(status)) => {
-            if preserve_status {
-                Ok(status.code().unwrap_or_else(|| status.signal().unwrap()))
-            } else {
-                Ok(ExitStatus::TimeoutFailed.into())
+/// Wait for a child process and send a kill signal if it does not terminate.
+///
+/// This function waits for the child `process` for the time period
+/// given by `duration`. If the child process does not terminate
+/// within that time, we send the `SIGKILL` signal to it. If `verbose`
+/// is `true`, then a message is printed to `stderr` when that
+/// happens.
+///
+/// If the child process terminates within the given time period and
+/// `preserve_status` is `true`, then the status code of the child
+/// process is returned. If the child process terminates within the
+/// given time period and `preserve_status` is `false`, then 124 is
+/// returned. If the child does not terminate within the time period,
+/// then 137 is returned. Finally, if there is an error while waiting
+/// for the child process to terminate, then 124 is returned.
+///
+/// # Errors
+///
+/// If there is a problem sending the `SIGKILL` signal or waiting for
+/// the process after that signal is sent.
+fn wait_or_kill_process(
+    mut process: Child,
+    cmd: &str,
+    duration: Duration,
+    preserve_status: bool,
+    verbose: bool,
+) -> std::io::Result<i32> {
+    match process.wait_or_timeout(duration) {
+        Ok(Some(status)) => {
+            if preserve_status {
+                Ok(status.code().unwrap_or_else(|| status.signal().unwrap()))
+            } else {
+                Ok(ExitStatus::TimeoutFailed.into())
             }
         }
         Ok(None) => {
-            let signal = signal_by_name_or_value("KILL").unwrap();
-            report_if_verbose(signal, cmd, verbose);
-            process.send_signal(signal)?;
-            process.wait()?;
-            Ok(ExitStatus::SignalSent(signal).into())
+            let signal = signal_by_name_or_value("KILL").unwrap();
+            report_if_verbose(signal, cmd, verbose);
+            process.send_signal(signal)?;
+            process.wait()?;
+            Ok(ExitStatus::SignalSent(signal).into())
         }
-        Err(_) => Ok(ExitStatus::WaitingFailed.into()),
+        Err(_) => Ok(ExitStatus::WaitingFailed.into()),
     }
 }
 
-#[cfg(unix)]
-fn preserve_signal_info(signal: libc::c_int) -> libc::c_int {
-    // This is needed because timeout is expected to preserve the exit
-    // status of its child. It is not the case that utilities have a
-    // single simple exit code, that's an illusion some shells
-    // provide.  Instead exit status is really two numbers:
-    //
-    //  - An exit code if the program ran to completion
-    //
-    //  - A signal number if the program was terminated by a signal
-    //
-    // The easiest way to preserve the latter seems to be to kill
-    // ourselves with whatever signal our child exited with, which is
-    // what the following is intended to accomplish.
-    unsafe {
-        libc::kill(libc::getpid(), signal);
+#[cfg(unix)]
+fn preserve_signal_info(signal: libc::c_int) -> libc::c_int {
+    // This is needed because timeout is expected to preserve the exit
+    // status of its child. It is not the case that utilities have a
+    // single simple exit code, that's an illusion some shells
+    // provide.  Instead exit status is really two numbers:
+    //
+    //  - An exit code if the program ran to completion
+    //
+    //  - A signal number if the program was terminated by a signal
+    //
+    // The easiest way to preserve the latter seems to be to kill
+    // ourselves with whatever signal our child exited with, which is
+    // what the following is intended to accomplish.
+    unsafe {
+        libc::kill(libc::getpid(), signal);
     }
-    signal
+    signal
 }
 
-#[cfg(not(unix))]
-fn preserve_signal_info(signal: libc::c_int) -> libc::c_int {
-    // Do nothing
-    signal
+#[cfg(not(unix))]
+fn preserve_signal_info(signal: libc::c_int) -> libc::c_int {
+    // Do nothing
+    signal
 }
 
-#[cfg(unix)]
-fn enable_pipe_errors() -> std::io::Result<()> {
-    let ret = unsafe { libc::signal(libc::SIGPIPE, libc::SIG_DFL) };
-    if ret == libc::SIG_ERR {
-        return Err(std::io::Error::new(std::io::ErrorKind::Other, ""));
+#[cfg(unix)]
+fn enable_pipe_errors() -> std::io::Result<()> {
+    let ret = unsafe { libc::signal(libc::SIGPIPE, libc::SIG_DFL) };
+    if ret == libc::SIG_ERR {
+        return Err(std::io::Error::new(std::io::ErrorKind::Other, ""));
     }
     Ok(())
 }
 
-#[cfg(not(unix))]
-fn enable_pipe_errors() -> std::io::Result<()> {
-    // Do nothing.
-    Ok(())
+#[cfg(not(unix))]
+fn enable_pipe_errors() -> std::io::Result<()> {
+    // Do nothing.
+    Ok(())
 }
 
-/// TODO: Improve exit codes, and make them consistent with the GNU Coreutils exit codes.
+/// TODO: Improve exit codes, and make them consistent with the GNU Coreutils exit codes.
 
-fn timeout(
-    cmd: &[String],
-    duration: Duration,
-    signal: usize,
-    kill_after: Option<Duration>,
-    foreground: bool,
-    preserve_status: bool,
-    verbose: bool,
-) -> UResult<()> {
-    if !foreground {
-        unsafe { libc::setpgid(0, 0) };
+fn timeout(
+    cmd: &[String],
+    duration: Duration,
+    signal: usize,
+    kill_after: Option<Duration>,
+    foreground: bool,
+    preserve_status: bool,
+    verbose: bool,
+) -> UResult<()> {
+    if !foreground {
+        unsafe { libc::setpgid(0, 0) };
     }
 
-    enable_pipe_errors()?;
+    enable_pipe_errors()?;
 
-    let mut process = process::Command::new(&cmd[0])
-        .args(&cmd[1..])
-        .stdin(Stdio::inherit())
-        .stdout(Stdio::inherit())
-        .stderr(Stdio::inherit())
-        .spawn()
-        .map_err(|err| {
-            let status_code = if err.kind() == ErrorKind::NotFound {
-                // FIXME: not sure which to use
-                127
-            } else {
-                // FIXME: this may not be 100% correct...
-                126
-            };
-            USimpleError::new(status_code, format!("failed to execute process: {}", err))
+    let mut process = process::Command::new(&cmd[0])
+        .args(&cmd[1..])
+        .stdin(Stdio::inherit())
+        .stdout(Stdio::inherit())
+        .stderr(Stdio::inherit())
+        .spawn()
+        .map_err(|err| {
+            let status_code = if err.kind() == ErrorKind::NotFound {
+                // FIXME: not sure which to use
+                127
+            } else {
+                // FIXME: this may not be 100% correct...
+                126
+            };
+            USimpleError::new(status_code, format!("failed to execute process: {}", err))
         })?;
-    unblock_sigchld();
-    // Wait for the child process for the specified time period.
-    //
-    // If the process exits within the specified time period (the
-    // `Ok(Some(_))` arm), then return the appropriate status code.
-    //
-    // If the process does not exit within that time (the `Ok(None)`
-    // arm) and `kill_after` is specified, then try sending `SIGKILL`.
-    //
-    // TODO The structure of this block is extremely similar to the
-    // structure of `wait_or_kill_process()`. They can probably be
-    // refactored into some common function.
-    match process.wait_or_timeout(duration) {
-        Ok(Some(status)) => Err(status
-            .code()
-            .unwrap_or_else(|| preserve_signal_info(status.signal().unwrap()))
-            .into()),
+    unblock_sigchld();
+    // Wait for the child process for the specified time period.
+    //
+    // If the process exits within the specified time period (the
+    // `Ok(Some(_))` arm), then return the appropriate status code.
+    //
+    // If the process does not exit within that time (the `Ok(None)`
+    // arm) and `kill_after` is specified, then try sending `SIGKILL`.
+    //
+    // TODO The structure of this block is extremely similar to the
+    // structure of `wait_or_kill_process()`. They can probably be
+    // refactored into some common function.
+    match process.wait_or_timeout(duration) {
+        Ok(Some(status)) => Err(status
+            .code()
+            .unwrap_or_else(|| preserve_signal_info(status.signal().unwrap()))
+            .into()),
         Ok(None) => {
-            report_if_verbose(signal, &cmd[0], verbose);
-            process.send_signal(signal)?;
-            match kill_after {
-                None => {
-                    if preserve_status {
-                        Err(ExitStatus::SignalSent(signal).into())
-                    } else {
-                        Err(ExitStatus::CommandTimedOut.into())
+            report_if_verbose(signal, &cmd[0], verbose);
+            process.send_signal(signal)?;
+            match kill_after {
+                None => {
+                    if preserve_status {
+                        Err(ExitStatus::SignalSent(signal).into())
+                    } else {
+                        Err(ExitStatus::CommandTimedOut.into())
                     }
                 }
-                Some(kill_after) => {
-                    match wait_or_kill_process(
-                        process,
-                        &cmd[0],
-                        kill_after,
-                        preserve_status,
-                        verbose,
+                Some(kill_after) => {
+                    match wait_or_kill_process(
+                        process,
+                        &cmd[0],
+                        kill_after,
+                        preserve_status,
+                        verbose,
                     ) {
-                        Ok(status) => Err(status.into()),
-                        Err(e) => Err(USimpleError::new(
-                            ExitStatus::TimeoutFailed.into(),
-                            format!("{}", e),
+                        Ok(status) => Err(status.into()),
+                        Err(e) => Err(USimpleError::new(
+                            ExitStatus::TimeoutFailed.into(),
+                            format!("{}", e),
                         )),
                     }
                 }
             }
         }
         Err(_) => {
-            // We're going to return ERR_EXIT_STATUS regardless of
-            // whether `send_signal()` succeeds or fails, so just
-            // ignore the return value.
-            process.send_signal(signal).map_err(|e| {
-                USimpleError::new(ExitStatus::TimeoutFailed.into(), format!("{}", e))
+            // We're going to return ERR_EXIT_STATUS regardless of
+            // whether `send_signal()` succeeds or fails, so just
+            // ignore the return value.
+            process.send_signal(signal).map_err(|e| {
+                USimpleError::new(ExitStatus::TimeoutFailed.into(), format!("{}", e))
             })?;
-            Err(ExitStatus::TimeoutFailed.into())
+            Err(ExitStatus::TimeoutFailed.into())
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_touch/touch.rs.html b/dev/src/uu_touch/touch.rs.html index 3b6f57c6e..a45405ab3 100644 --- a/dev/src/uu_touch/touch.rs.html +++ b/dev/src/uu_touch/touch.rs.html @@ -1,4 +1,4 @@ -touch.rs - source
1
+touch.rs - source
1
 2
 3
 4
@@ -541,548 +541,548 @@
 541
 542
 543
-
// This file is part of the uutils coreutils package.
-//
-// (c) Nick Platt <platt.nicholas@gmail.com>
-// (c) Jian Zeng <anonymousknight96 AT gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Nick Platt <platt.nicholas@gmail.com>
+// (c) Jian Zeng <anonymousknight96 AT gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMDDhhmm clapv PWSTR lpszfilepath hresult mktime YYYYMMDDHHMM YYMMDDHHMM DATETIME YYYYMMDDHHMMS subsecond
-pub extern crate filetime;
+// spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMDDhhmm clapv PWSTR lpszfilepath hresult mktime YYYYMMDDHHMM YYMMDDHHMM DATETIME YYYYMMDDHHMMS subsecond
+pub extern crate filetime;
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-use clap::builder::ValueParser;
-use clap::{crate_version, Arg, ArgAction, ArgGroup, Command};
-use filetime::*;
-use std::ffi::OsString;
-use std::fs::{self, File};
-use std::path::{Path, PathBuf};
-use time::macros::{format_description, offset, time};
-use time::Duration;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UError, UResult, USimpleError};
-use uucore::format_usage;
+use clap::builder::ValueParser;
+use clap::{crate_version, Arg, ArgAction, ArgGroup, Command};
+use filetime::*;
+use std::ffi::OsString;
+use std::fs::{self, File};
+use std::path::{Path, PathBuf};
+use time::macros::{format_description, offset, time};
+use time::Duration;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UError, UResult, USimpleError};
+use uucore::format_usage;
 
-static ABOUT: &str = "Update the access and modification times of each FILE to the current time.";
-const USAGE: &str = "{} [OPTION]... [USER]";
-pub mod options {
-    // Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup.
-    pub static SOURCES: &str = "sources";
-    pub mod sources {
-        pub static DATE: &str = "date";
-        pub static REFERENCE: &str = "reference";
-        pub static CURRENT: &str = "current";
+static ABOUT: &str = "Update the access and modification times of each FILE to the current time.";
+const USAGE: &str = "{} [OPTION]... [USER]";
+pub mod options {
+    // Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup.
+    pub static SOURCES: &str = "sources";
+    pub mod sources {
+        pub static DATE: &str = "date";
+        pub static REFERENCE: &str = "reference";
+        pub static CURRENT: &str = "current";
     }
-    pub static HELP: &str = "help";
-    pub static ACCESS: &str = "access";
-    pub static MODIFICATION: &str = "modification";
-    pub static NO_CREATE: &str = "no-create";
-    pub static NO_DEREF: &str = "no-dereference";
-    pub static TIME: &str = "time";
+    pub static HELP: &str = "help";
+    pub static ACCESS: &str = "access";
+    pub static MODIFICATION: &str = "modification";
+    pub static NO_CREATE: &str = "no-create";
+    pub static NO_DEREF: &str = "no-dereference";
+    pub static TIME: &str = "time";
 }
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-// Convert a date/time to a date with a TZ offset
-fn to_local(tm: time::PrimitiveDateTime) -> time::OffsetDateTime {
-    let offset = match time::OffsetDateTime::now_local() {
-        Ok(lo) => lo.offset(),
-        Err(e) => {
-            panic!("error: {}", e);
+// Convert a date/time to a date with a TZ offset
+fn to_local(tm: time::PrimitiveDateTime) -> time::OffsetDateTime {
+    let offset = match time::OffsetDateTime::now_local() {
+        Ok(lo) => lo.offset(),
+        Err(e) => {
+            panic!("error: {}", e);
         }
     };
-    tm.assume_offset(offset)
+    tm.assume_offset(offset)
 }
 
-// Convert a date/time with a TZ offset into a FileTime
-fn local_dt_to_filetime(dt: time::OffsetDateTime) -> FileTime {
-    FileTime::from_unix_time(dt.unix_timestamp(), dt.nanosecond())
+// Convert a date/time with a TZ offset into a FileTime
+fn local_dt_to_filetime(dt: time::OffsetDateTime) -> FileTime {
+    FileTime::from_unix_time(dt.unix_timestamp(), dt.nanosecond())
 }
 
-// Convert a date/time, considering that the input is in UTC time
-// Used for touch -d 1970-01-01 18:43:33.023456789 for example
-fn dt_to_filename(tm: time::PrimitiveDateTime) -> FileTime {
-    let dt = tm.assume_offset(offset!(UTC));
-    local_dt_to_filetime(dt)
+// Convert a date/time, considering that the input is in UTC time
+// Used for touch -d 1970-01-01 18:43:33.023456789 for example
+fn dt_to_filename(tm: time::PrimitiveDateTime) -> FileTime {
+    let dt = tm.assume_offset(offset!(UTC));
+    local_dt_to_filetime(dt)
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let files = matches.get_many::<OsString>(ARG_FILES).ok_or_else(|| {
-        USimpleError::new(
+    let files = matches.get_many::<OsString>(ARG_FILES).ok_or_else(|| {
+        USimpleError::new(
             1,
             r##"missing file operand
 Try 'touch --help' for more information."##,
         )
     })?;
-    let (mut atime, mut mtime) =
-        if let Some(reference) = matches.get_one::<OsString>(options::sources::REFERENCE) {
-            stat(Path::new(reference), !matches.get_flag(options::NO_DEREF))?
-        } else {
-            let timestamp = if let Some(date) = matches.get_one::<String>(options::sources::DATE) {
-                parse_date(date)?
-            } else if let Some(current) = matches.get_one::<String>(options::sources::CURRENT) {
-                parse_timestamp(current)?
-            } else {
-                local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap())
+    let (mut atime, mut mtime) =
+        if let Some(reference) = matches.get_one::<OsString>(options::sources::REFERENCE) {
+            stat(Path::new(reference), !matches.get_flag(options::NO_DEREF))?
+        } else {
+            let timestamp = if let Some(date) = matches.get_one::<String>(options::sources::DATE) {
+                parse_date(date)?
+            } else if let Some(current) = matches.get_one::<String>(options::sources::CURRENT) {
+                parse_timestamp(current)?
+            } else {
+                local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap())
             };
-            (timestamp, timestamp)
+            (timestamp, timestamp)
         };
 
-    for filename in files {
-        // FIXME: find a way to avoid having to clone the path
-        let pathbuf = if filename == "-" {
-            pathbuf_from_stdout()?
-        } else {
-            PathBuf::from(filename)
+    for filename in files {
+        // FIXME: find a way to avoid having to clone the path
+        let pathbuf = if filename == "-" {
+            pathbuf_from_stdout()?
+        } else {
+            PathBuf::from(filename)
         };
 
-        let path = pathbuf.as_path();
+        let path = pathbuf.as_path();
 
-        if let Err(e) = path.metadata() {
-            if e.kind() != std::io::ErrorKind::NotFound {
-                return Err(e.map_err_context(|| format!("setting times of {}", filename.quote())));
+        if let Err(e) = path.metadata() {
+            if e.kind() != std::io::ErrorKind::NotFound {
+                return Err(e.map_err_context(|| format!("setting times of {}", filename.quote())));
             }
 
-            if matches.get_flag(options::NO_CREATE) {
+            if matches.get_flag(options::NO_CREATE) {
                 continue;
             }
 
-            if matches.get_flag(options::NO_DEREF) {
-                show!(USimpleError::new(
+            if matches.get_flag(options::NO_DEREF) {
+                show!(USimpleError::new(
                     1,
                     format!(
                         "setting times of {}: No such file or directory",
-                        filename.quote()
+                        filename.quote()
                     )
                 ));
                 continue;
             }
 
-            if let Err(e) = File::create(path) {
-                show!(e.map_err_context(|| format!("cannot touch {}", path.quote())));
+            if let Err(e) = File::create(path) {
+                show!(e.map_err_context(|| format!("cannot touch {}", path.quote())));
                 continue;
             };
 
-            // Minor optimization: if no reference time was specified, we're done.
-            if !matches.contains_id(options::SOURCES) {
+            // Minor optimization: if no reference time was specified, we're done.
+            if !matches.contains_id(options::SOURCES) {
                 continue;
             }
         }
 
-        // If changing "only" atime or mtime, grab the existing value of the other.
-        // Note that "-a" and "-m" may be passed together; this is not an xor.
-        if matches.get_flag(options::ACCESS)
-            || matches.get_flag(options::MODIFICATION)
-            || matches.contains_id(options::TIME)
+        // If changing "only" atime or mtime, grab the existing value of the other.
+        // Note that "-a" and "-m" may be passed together; this is not an xor.
+        if matches.get_flag(options::ACCESS)
+            || matches.get_flag(options::MODIFICATION)
+            || matches.contains_id(options::TIME)
         {
-            let st = stat(path, !matches.get_flag(options::NO_DEREF))?;
-            let time = matches
-                .get_one::<String>(options::TIME)
-                .map(|s| s.as_str())
-                .unwrap_or("");
+            let st = stat(path, !matches.get_flag(options::NO_DEREF))?;
+            let time = matches
+                .get_one::<String>(options::TIME)
+                .map(|s| s.as_str())
+                .unwrap_or("");
 
-            if !(matches.get_flag(options::ACCESS)
-                || time.contains(&"access".to_owned())
-                || time.contains(&"atime".to_owned())
-                || time.contains(&"use".to_owned()))
+            if !(matches.get_flag(options::ACCESS)
+                || time.contains(&"access".to_owned())
+                || time.contains(&"atime".to_owned())
+                || time.contains(&"use".to_owned()))
             {
-                atime = st.0;
+                atime = st.0;
             }
 
-            if !(matches.get_flag(options::MODIFICATION)
-                || time.contains(&"modify".to_owned())
-                || time.contains(&"mtime".to_owned()))
+            if !(matches.get_flag(options::MODIFICATION)
+                || time.contains(&"modify".to_owned())
+                || time.contains(&"mtime".to_owned()))
             {
-                mtime = st.1;
+                mtime = st.1;
             }
         }
 
-        if matches.get_flag(options::NO_DEREF) {
-            set_symlink_file_times(path, atime, mtime)
-        } else {
-            filetime::set_file_times(path, atime, mtime)
+        if matches.get_flag(options::NO_DEREF) {
+            set_symlink_file_times(path, atime, mtime)
+        } else {
+            filetime::set_file_times(path, atime, mtime)
         }
-        .map_err_context(|| format!("setting times of {}", path.quote()))?;
+        .map_err_context(|| format!("setting times of {}", path.quote()))?;
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .disable_help_flag(true)
-        .arg(
-            Arg::new(options::HELP)
-                .long(options::HELP)
-                .help("Print help information.")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .disable_help_flag(true)
+        .arg(
+            Arg::new(options::HELP)
+                .long(options::HELP)
+                .help("Print help information.")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new(options::ACCESS)
-                .short('a')
-                .help("change only the access time")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ACCESS)
+                .short('a')
+                .help("change only the access time")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::sources::CURRENT)
-                .short('t')
-                .help("use [[CC]YY]MMDDhhmm[.ss] instead of the current time")
-                .value_name("STAMP"),
+        .arg(
+            Arg::new(options::sources::CURRENT)
+                .short('t')
+                .help("use [[CC]YY]MMDDhhmm[.ss] instead of the current time")
+                .value_name("STAMP"),
         )
-        .arg(
-            Arg::new(options::sources::DATE)
-                .short('d')
-                .long(options::sources::DATE)
-                .help("parse argument and use it instead of current time")
-                .value_name("STRING"),
+        .arg(
+            Arg::new(options::sources::DATE)
+                .short('d')
+                .long(options::sources::DATE)
+                .help("parse argument and use it instead of current time")
+                .value_name("STRING"),
         )
-        .arg(
-            Arg::new(options::MODIFICATION)
-                .short('m')
-                .help("change only the modification time")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::MODIFICATION)
+                .short('m')
+                .help("change only the modification time")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NO_CREATE)
-                .short('c')
-                .long(options::NO_CREATE)
-                .help("do not create any files")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_CREATE)
+                .short('c')
+                .long(options::NO_CREATE)
+                .help("do not create any files")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NO_DEREF)
-                .short('h')
-                .long(options::NO_DEREF)
-                .help(
+        .arg(
+            Arg::new(options::NO_DEREF)
+                .short('h')
+                .long(options::NO_DEREF)
+                .help(
                     "affect each symbolic link instead of any referenced file \
                      (only for systems that can change the timestamps of a symlink)",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::sources::REFERENCE)
-                .short('r')
-                .long(options::sources::REFERENCE)
-                .help("use this file's times instead of the current time")
-                .value_name("FILE")
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(options::sources::REFERENCE)
+                .short('r')
+                .long(options::sources::REFERENCE)
+                .help("use this file's times instead of the current time")
+                .value_name("FILE")
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::AnyPath),
         )
-        .arg(
-            Arg::new(options::TIME)
-                .long(options::TIME)
-                .help(
+        .arg(
+            Arg::new(options::TIME)
+                .long(options::TIME)
+                .help(
                     "change only the specified time: \"access\", \"atime\", or \
                      \"use\" are equivalent to -a; \"modify\" or \"mtime\" are \
                      equivalent to -m",
                 )
-                .value_name("WORD")
-                .value_parser(["access", "atime", "use"]),
+                .value_name("WORD")
+                .value_parser(["access", "atime", "use"]),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .num_args(1..)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::AnyPath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .num_args(1..)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::AnyPath),
         )
-        .group(ArgGroup::new(options::SOURCES).args([
-            options::sources::CURRENT,
-            options::sources::DATE,
-            options::sources::REFERENCE,
+        .group(ArgGroup::new(options::SOURCES).args([
+            options::sources::CURRENT,
+            options::sources::DATE,
+            options::sources::REFERENCE,
         ]))
 }
 
-fn stat(path: &Path, follow: bool) -> UResult<(FileTime, FileTime)> {
-    let metadata = if follow {
-        fs::symlink_metadata(path)
-    } else {
-        fs::metadata(path)
+fn stat(path: &Path, follow: bool) -> UResult<(FileTime, FileTime)> {
+    let metadata = if follow {
+        fs::symlink_metadata(path)
+    } else {
+        fs::metadata(path)
     }
-    .map_err_context(|| format!("failed to get attributes of {}", path.quote()))?;
+    .map_err_context(|| format!("failed to get attributes of {}", path.quote()))?;
 
     Ok((
-        FileTime::from_last_access_time(&metadata),
-        FileTime::from_last_modification_time(&metadata),
+        FileTime::from_last_access_time(&metadata),
+        FileTime::from_last_modification_time(&metadata),
     ))
 }
 
-const POSIX_LOCALE_FORMAT: &[time::format_description::FormatItem] = format_description!(
+const POSIX_LOCALE_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "[weekday repr:short] [month repr:short] [day padding:space] \
-    [hour]:[minute]:[second] [year]"
-);
+    [hour]:[minute]:[second] [year]"
+);
 
-const ISO_8601_FORMAT: &[time::format_description::FormatItem] =
+const ISO_8601_FORMAT: &[time::format_description::FormatItem] =
     format_description!("[year]-[month]-[day]");
 
-// "%Y%m%d%H%M.%S" 15 chars
-const YYYYMMDDHHMM_DOT_SS_FORMAT: &[time::format_description::FormatItem] = format_description!(
+// "%Y%m%d%H%M.%S" 15 chars
+const YYYYMMDDHHMM_DOT_SS_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "[year repr:full][month repr:numerical padding:zero]\
-    [day][hour][minute].[second]"
-);
+    [day][hour][minute].[second]"
+);
 
-// "%Y-%m-%d %H:%M:%S.%SS" 12 chars
-const YYYYMMDDHHMMSS_FORMAT: &[time::format_description::FormatItem] = format_description!(
+// "%Y-%m-%d %H:%M:%S.%SS" 12 chars
+const YYYYMMDDHHMMSS_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "[year repr:full]-[month repr:numerical padding:zero]-\
-    [day] [hour]:[minute]:[second].[subsecond]"
-);
+    [day] [hour]:[minute]:[second].[subsecond]"
+);
 
-// "%Y-%m-%d %H:%M:%S" 12 chars
-const YYYYMMDDHHMMS_FORMAT: &[time::format_description::FormatItem] = format_description!(
+// "%Y-%m-%d %H:%M:%S" 12 chars
+const YYYYMMDDHHMMS_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "[year repr:full]-[month repr:numerical padding:zero]-\
-    [day] [hour]:[minute]:[second]"
-);
+    [day] [hour]:[minute]:[second]"
+);
 
-// "%Y-%m-%d %H:%M" 12 chars
-// Used for example in tests/touch/no-rights.sh
-const YYYY_MM_DD_HH_MM_FORMAT: &[time::format_description::FormatItem] = format_description!(
+// "%Y-%m-%d %H:%M" 12 chars
+// Used for example in tests/touch/no-rights.sh
+const YYYY_MM_DD_HH_MM_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "[year repr:full]-[month repr:numerical padding:zero]-\
-    [day] [hour]:[minute]"
-);
+    [day] [hour]:[minute]"
+);
 
-// "%Y%m%d%H%M" 12 chars
-const YYYYMMDDHHMM_FORMAT: &[time::format_description::FormatItem] = format_description!(
+// "%Y%m%d%H%M" 12 chars
+const YYYYMMDDHHMM_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "[year repr:full][month repr:numerical padding:zero]\
-    [day][hour][minute]"
-);
+    [day][hour][minute]"
+);
 
-// "%y%m%d%H%M.%S" 13 chars
-const YYMMDDHHMM_DOT_SS_FORMAT: &[time::format_description::FormatItem] = format_description!(
+// "%y%m%d%H%M.%S" 13 chars
+const YYMMDDHHMM_DOT_SS_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "[year repr:last_two padding:none][month][day]\
-    [hour][minute].[second]"
-);
+    [hour][minute].[second]"
+);
 
-// "%y%m%d%H%M" 10 chars
-const YYMMDDHHMM_FORMAT: &[time::format_description::FormatItem] = format_description!(
+// "%y%m%d%H%M" 10 chars
+const YYMMDDHHMM_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "[year repr:last_two padding:none][month padding:zero][day padding:zero]\
-    [hour repr:24 padding:zero][minute padding:zero]"
-);
+    [hour repr:24 padding:zero][minute padding:zero]"
+);
 
-// "%Y-%m-%d %H:%M +offset"
-// Used for example in tests/touch/relative.sh
-const YYYYMMDDHHMM_OFFSET_FORMAT: &[time::format_description::FormatItem] = format_description!(
+// "%Y-%m-%d %H:%M +offset"
+// Used for example in tests/touch/relative.sh
+const YYYYMMDDHHMM_OFFSET_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "[year]-[month]-[day] [hour repr:24]:[minute] \
-    [offset_hour sign:mandatory][offset_minute]"
-);
+    [offset_hour sign:mandatory][offset_minute]"
+);
 
-fn parse_date(s: &str) -> UResult<FileTime> {
-    // This isn't actually compatible with GNU touch, but there doesn't seem to
-    // be any simple specification for what format this parameter allows and I'm
-    // not about to implement GNU parse_datetime.
-    // http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=lib/parse-datetime.y
+fn parse_date(s: &str) -> UResult<FileTime> {
+    // This isn't actually compatible with GNU touch, but there doesn't seem to
+    // be any simple specification for what format this parameter allows and I'm
+    // not about to implement GNU parse_datetime.
+    // http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=lib/parse-datetime.y
 
-    // TODO: match on char count?
+    // TODO: match on char count?
 
-    // "The preferred date and time representation for the current locale."
-    // "(In the POSIX locale this is equivalent to %a %b %e %H:%M:%S %Y.)"
-    // time 0.1.43 parsed this as 'a b e T Y'
-    // which is equivalent to the POSIX locale: %a %b %e %H:%M:%S %Y
-    // Tue Dec  3 ...
-    // ("%c", POSIX_LOCALE_FORMAT),
-    //
-    if let Ok(parsed) = time::PrimitiveDateTime::parse(s, &POSIX_LOCALE_FORMAT) {
-        return Ok(local_dt_to_filetime(to_local(parsed)));
+    // "The preferred date and time representation for the current locale."
+    // "(In the POSIX locale this is equivalent to %a %b %e %H:%M:%S %Y.)"
+    // time 0.1.43 parsed this as 'a b e T Y'
+    // which is equivalent to the POSIX locale: %a %b %e %H:%M:%S %Y
+    // Tue Dec  3 ...
+    // ("%c", POSIX_LOCALE_FORMAT),
+    //
+    if let Ok(parsed) = time::PrimitiveDateTime::parse(s, &POSIX_LOCALE_FORMAT) {
+        return Ok(local_dt_to_filetime(to_local(parsed)));
     }
 
-    // Also support other formats found in the GNU tests like
-    // in tests/misc/stat-nanoseconds.sh
-    // or tests/touch/no-rights.sh
-    for fmt in [
-        YYYYMMDDHHMMS_FORMAT,
-        YYYYMMDDHHMMSS_FORMAT,
-        YYYY_MM_DD_HH_MM_FORMAT,
-        YYYYMMDDHHMM_OFFSET_FORMAT,
+    // Also support other formats found in the GNU tests like
+    // in tests/misc/stat-nanoseconds.sh
+    // or tests/touch/no-rights.sh
+    for fmt in [
+        YYYYMMDDHHMMS_FORMAT,
+        YYYYMMDDHHMMSS_FORMAT,
+        YYYY_MM_DD_HH_MM_FORMAT,
+        YYYYMMDDHHMM_OFFSET_FORMAT,
     ] {
-        if let Ok(parsed) = time::PrimitiveDateTime::parse(s, &fmt) {
-            return Ok(dt_to_filename(parsed));
+        if let Ok(parsed) = time::PrimitiveDateTime::parse(s, &fmt) {
+            return Ok(dt_to_filename(parsed));
         }
     }
 
-    // "Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99)"
-    // ("%F", ISO_8601_FORMAT),
-    if let Ok(parsed) = time::Date::parse(s, &ISO_8601_FORMAT) {
-        return Ok(local_dt_to_filetime(to_local(
-            time::PrimitiveDateTime::new(parsed, time!(00:00)),
+    // "Equivalent to %Y-%m-%d (the ISO 8601 date format). (C99)"
+    // ("%F", ISO_8601_FORMAT),
+    if let Ok(parsed) = time::Date::parse(s, &ISO_8601_FORMAT) {
+        return Ok(local_dt_to_filetime(to_local(
+            time::PrimitiveDateTime::new(parsed, time!(00:00)),
         )));
     }
 
-    // "@%s" is "The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). (TZ) (Calculated from mktime(tm).)"
-    if s.bytes().next() == Some(b'@') {
-        if let Ok(ts) = &s[1..].parse::<i64>() {
-            // Don't convert to local time in this case - seconds since epoch are not time-zone dependent
-            return Ok(local_dt_to_filetime(
-                time::OffsetDateTime::from_unix_timestamp(*ts).unwrap(),
+    // "@%s" is "The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). (TZ) (Calculated from mktime(tm).)"
+    if s.bytes().next() == Some(b'@') {
+        if let Ok(ts) = &s[1..].parse::<i64>() {
+            // Don't convert to local time in this case - seconds since epoch are not time-zone dependent
+            return Ok(local_dt_to_filetime(
+                time::OffsetDateTime::from_unix_timestamp(*ts).unwrap(),
             ));
         }
     }
 
-    Err(USimpleError::new(1, format!("Unable to parse date: {}", s)))
+    Err(USimpleError::new(1, format!("Unable to parse date: {}", s)))
 }
 
-fn parse_timestamp(s: &str) -> UResult<FileTime> {
-    // TODO: handle error
-    let now = time::OffsetDateTime::now_utc();
+fn parse_timestamp(s: &str) -> UResult<FileTime> {
+    // TODO: handle error
+    let now = time::OffsetDateTime::now_utc();
 
-    let (mut format, mut ts) = match s.chars().count() {
-        15 => (YYYYMMDDHHMM_DOT_SS_FORMAT, s.to_owned()),
-        12 => (YYYYMMDDHHMM_FORMAT, s.to_owned()),
-        13 => (YYMMDDHHMM_DOT_SS_FORMAT, s.to_owned()),
-        10 => (YYMMDDHHMM_FORMAT, s.to_owned()),
-        11 => (YYYYMMDDHHMM_DOT_SS_FORMAT, format!("{}{}", now.year(), s)),
-        8 => (YYYYMMDDHHMM_FORMAT, format!("{}{}", now.year(), s)),
-        _ => {
-            return Err(USimpleError::new(
+    let (mut format, mut ts) = match s.chars().count() {
+        15 => (YYYYMMDDHHMM_DOT_SS_FORMAT, s.to_owned()),
+        12 => (YYYYMMDDHHMM_FORMAT, s.to_owned()),
+        13 => (YYMMDDHHMM_DOT_SS_FORMAT, s.to_owned()),
+        10 => (YYMMDDHHMM_FORMAT, s.to_owned()),
+        11 => (YYYYMMDDHHMM_DOT_SS_FORMAT, format!("{}{}", now.year(), s)),
+        8 => (YYYYMMDDHHMM_FORMAT, format!("{}{}", now.year(), s)),
+        _ => {
+            return Err(USimpleError::new(
                 1,
-                format!("invalid date format {}", s.quote()),
+                format!("invalid date format {}", s.quote()),
             ))
         }
     };
-    // workaround time returning Err(TryFromParsed(InsufficientInformation)) for year w/
-    // repr:last_two
-    // https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1ccfac7c07c5d1c7887a11decf0e1996
-    if s.chars().count() == 10 {
-        format = YYYYMMDDHHMM_FORMAT;
-        ts = "20".to_owned() + &ts;
-    } else if s.chars().count() == 13 {
-        format = YYYYMMDDHHMM_DOT_SS_FORMAT;
-        ts = "20".to_owned() + &ts;
+    // workaround time returning Err(TryFromParsed(InsufficientInformation)) for year w/
+    // repr:last_two
+    // https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1ccfac7c07c5d1c7887a11decf0e1996
+    if s.chars().count() == 10 {
+        format = YYYYMMDDHHMM_FORMAT;
+        ts = "20".to_owned() + &ts;
+    } else if s.chars().count() == 13 {
+        format = YYYYMMDDHHMM_DOT_SS_FORMAT;
+        ts = "20".to_owned() + &ts;
     }
 
-    let leap_sec = if (format == YYYYMMDDHHMM_DOT_SS_FORMAT || format == YYMMDDHHMM_DOT_SS_FORMAT)
-        && ts.ends_with(".60")
+    let leap_sec = if (format == YYYYMMDDHHMM_DOT_SS_FORMAT || format == YYMMDDHHMM_DOT_SS_FORMAT)
+        && ts.ends_with(".60")
     {
-        // Work around to disable leap seconds
-        // Used in gnu/tests/touch/60-seconds
-        ts = ts.replace(".60", ".59");
-        true
-    } else {
-        false
-    };
+        // Work around to disable leap seconds
+        // Used in gnu/tests/touch/60-seconds
+        ts = ts.replace(".60", ".59");
+        true
+    } else {
+        false
+    };
 
-    let tm = time::PrimitiveDateTime::parse(&ts, &format)
-        .map_err(|_| USimpleError::new(1, format!("invalid date ts format {}", ts.quote())))?;
-    let mut local = to_local(tm);
-    if leap_sec {
-        // We are dealing with a leap second, add it
-        local = local.saturating_add(Duration::SECOND);
+    let tm = time::PrimitiveDateTime::parse(&ts, &format)
+        .map_err(|_| USimpleError::new(1, format!("invalid date ts format {}", ts.quote())))?;
+    let mut local = to_local(tm);
+    if leap_sec {
+        // We are dealing with a leap second, add it
+        local = local.saturating_add(Duration::SECOND);
     }
-    let ft = local_dt_to_filetime(local);
+    let ft = local_dt_to_filetime(local);
 
-    // // We have to check that ft is valid time. Due to daylight saving
-    // // time switch, local time can jump from 1:59 AM to 3:00 AM,
-    // // in which case any time between 2:00 AM and 2:59 AM is not valid.
-    // // Convert back to local time and see if we got the same value back.
-    // let ts = time::Timespec {
-    //     sec: ft.unix_seconds(),
-    //     nsec: 0,
-    // };
-    // let tm2 = time::at(ts);
-    // if tm.tm_hour != tm2.tm_hour {
-    //     return Err(USimpleError::new(
-    //         1,
-    //         format!("invalid date format {}", s.quote()),
-    //     ));
-    // }
+    // // We have to check that ft is valid time. Due to daylight saving
+    // // time switch, local time can jump from 1:59 AM to 3:00 AM,
+    // // in which case any time between 2:00 AM and 2:59 AM is not valid.
+    // // Convert back to local time and see if we got the same value back.
+    // let ts = time::Timespec {
+    //     sec: ft.unix_seconds(),
+    //     nsec: 0,
+    // };
+    // let tm2 = time::at(ts);
+    // if tm.tm_hour != tm2.tm_hour {
+    //     return Err(USimpleError::new(
+    //         1,
+    //         format!("invalid date format {}", s.quote()),
+    //     ));
+    // }
 
-    Ok(ft)
+    Ok(ft)
 }
 
-// TODO: this may be a good candidate to put in fsext.rs
-/// Returns a PathBuf to stdout.
-///
-/// On Windows, uses GetFinalPathNameByHandleW to attempt to get the path
-/// from the stdout handle.
-fn pathbuf_from_stdout() -> UResult<PathBuf> {
-    #[cfg(all(unix, not(target_os = "android")))]
-    {
-        Ok(PathBuf::from("/dev/stdout"))
+// TODO: this may be a good candidate to put in fsext.rs
+/// Returns a PathBuf to stdout.
+///
+/// On Windows, uses GetFinalPathNameByHandleW to attempt to get the path
+/// from the stdout handle.
+fn pathbuf_from_stdout() -> UResult<PathBuf> {
+    #[cfg(all(unix, not(target_os = "android")))]
+    {
+        Ok(PathBuf::from("/dev/stdout"))
     }
-    #[cfg(target_os = "android")]
-    {
-        Ok(PathBuf::from("/proc/self/fd/1"))
+    #[cfg(target_os = "android")]
+    {
+        Ok(PathBuf::from("/proc/self/fd/1"))
     }
-    #[cfg(windows)]
-    {
-        use std::os::windows::prelude::AsRawHandle;
-        use windows_sys::Win32::Foundation::{
-            GetLastError, ERROR_INVALID_PARAMETER, ERROR_NOT_ENOUGH_MEMORY, ERROR_PATH_NOT_FOUND,
-            HANDLE, MAX_PATH,
+    #[cfg(windows)]
+    {
+        use std::os::windows::prelude::AsRawHandle;
+        use windows_sys::Win32::Foundation::{
+            GetLastError, ERROR_INVALID_PARAMETER, ERROR_NOT_ENOUGH_MEMORY, ERROR_PATH_NOT_FOUND,
+            HANDLE, MAX_PATH,
         };
-        use windows_sys::Win32::Storage::FileSystem::{
-            GetFinalPathNameByHandleW, FILE_NAME_OPENED,
+        use windows_sys::Win32::Storage::FileSystem::{
+            GetFinalPathNameByHandleW, FILE_NAME_OPENED,
         };
 
-        let handle = std::io::stdout().lock().as_raw_handle() as HANDLE;
-        let mut file_path_buffer: [u16; MAX_PATH as usize] = [0; MAX_PATH as usize];
+        let handle = std::io::stdout().lock().as_raw_handle() as HANDLE;
+        let mut file_path_buffer: [u16; MAX_PATH as usize] = [0; MAX_PATH as usize];
 
-        // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlea#examples
-        // SAFETY: We transmute the handle to be able to cast *mut c_void into a
-        // HANDLE (i32) so rustc will let us call GetFinalPathNameByHandleW. The
-        // reference example code for GetFinalPathNameByHandleW implies that
-        // it is safe for us to leave lpszfilepath uninitialized, so long as
-        // the buffer size is correct. We know the buffer size (MAX_PATH) at
-        // compile time. MAX_PATH is a small number (260) so we can cast it
-        // to a u32.
-        let ret = unsafe {
-            GetFinalPathNameByHandleW(
-                handle,
-                file_path_buffer.as_mut_ptr(),
-                file_path_buffer.len() as u32,
-                FILE_NAME_OPENED,
+        // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlea#examples
+        // SAFETY: We transmute the handle to be able to cast *mut c_void into a
+        // HANDLE (i32) so rustc will let us call GetFinalPathNameByHandleW. The
+        // reference example code for GetFinalPathNameByHandleW implies that
+        // it is safe for us to leave lpszfilepath uninitialized, so long as
+        // the buffer size is correct. We know the buffer size (MAX_PATH) at
+        // compile time. MAX_PATH is a small number (260) so we can cast it
+        // to a u32.
+        let ret = unsafe {
+            GetFinalPathNameByHandleW(
+                handle,
+                file_path_buffer.as_mut_ptr(),
+                file_path_buffer.len() as u32,
+                FILE_NAME_OPENED,
             )
         };
 
-        let buffer_size = match ret {
-            ERROR_PATH_NOT_FOUND | ERROR_NOT_ENOUGH_MEMORY | ERROR_INVALID_PARAMETER => {
-                return Err(USimpleError::new(
+        let buffer_size = match ret {
+            ERROR_PATH_NOT_FOUND | ERROR_NOT_ENOUGH_MEMORY | ERROR_INVALID_PARAMETER => {
+                return Err(USimpleError::new(
                     1,
-                    format!("GetFinalPathNameByHandleW failed with code {}", ret),
+                    format!("GetFinalPathNameByHandleW failed with code {}", ret),
                 ))
             }
-            e if e == 0 => {
-                return Err(USimpleError::new(
+            e if e == 0 => {
+                return Err(USimpleError::new(
                     1,
                     format!(
                         "GetFinalPathNameByHandleW failed with code {}",
-                        // SAFETY: GetLastError is thread-safe and has no documented memory unsafety.
-                        unsafe { GetLastError() }
+                        // SAFETY: GetLastError is thread-safe and has no documented memory unsafety.
+                        unsafe { GetLastError() }
                     ),
                 ));
             }
-            e => e as usize,
+            e => e as usize,
         };
 
-        // Don't include the null terminator
-        Ok(String::from_utf16(&file_path_buffer[0..buffer_size])
-            .map_err(|e| USimpleError::new(1, e.to_string()))?
-            .into())
+        // Don't include the null terminator
+        Ok(String::from_utf16(&file_path_buffer[0..buffer_size])
+            .map_err(|e| USimpleError::new(1, e.to_string()))?
+            .into())
     }
 }
 
-#[cfg(test)]
-mod tests {
-    #[cfg(windows)]
-    #[test]
-    fn test_get_pathbuf_from_stdout_fails_if_stdout_is_not_a_file() {
-        // We can trigger an error by not setting stdout to anything (will
-        // fail with code 1)
-        assert!(super::pathbuf_from_stdout()
-            .err()
-            .expect("pathbuf_from_stdout should have failed")
-            .to_string()
-            .contains("GetFinalPathNameByHandleW failed with code 1"));
+#[cfg(test)]
+mod tests {
+    #[cfg(windows)]
+    #[test]
+    fn test_get_pathbuf_from_stdout_fails_if_stdout_is_not_a_file() {
+        // We can trigger an error by not setting stdout to anything (will
+        // fail with code 1)
+        assert!(super::pathbuf_from_stdout()
+            .err()
+            .expect("pathbuf_from_stdout should have failed")
+            .to_string()
+            .contains("GetFinalPathNameByHandleW failed with code 1"));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tr/convert.rs.html b/dev/src/uu_tr/convert.rs.html index aba0ee4cd..a4102edc5 100644 --- a/dev/src/uu_tr/convert.rs.html +++ b/dev/src/uu_tr/convert.rs.html @@ -1,4 +1,4 @@ -convert.rs - source
1
+convert.rs - source
1
 2
 3
 4
@@ -34,41 +34,41 @@
 34
 35
 36
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (strings) anychar combinator
+// spell-checker:ignore (strings) anychar combinator
 
-use nom::{
-    branch::alt,
-    bytes::complete::tag,
-    character::complete::{anychar, one_of},
-    combinator::{map_opt, recognize},
-    multi::{many0, many_m_n},
-    sequence::preceded,
-    IResult,
+use nom::{
+    branch::alt,
+    bytes::complete::tag,
+    character::complete::{anychar, one_of},
+    combinator::{map_opt, recognize},
+    multi::{many0, many_m_n},
+    sequence::preceded,
+    IResult,
 };
 
-fn parse_octal(input: &str) -> IResult<&str, char> {
-    map_opt(
-        preceded(tag("\\"), recognize(many_m_n(1, 3, one_of("01234567")))),
-        |out: &str| {
-            u32::from_str_radix(out, 8)
-                .map(std::char::from_u32)
-                .ok()
-                .flatten()
+fn parse_octal(input: &str) -> IResult<&str, char> {
+    map_opt(
+        preceded(tag("\\"), recognize(many_m_n(1, 3, one_of("01234567")))),
+        |out: &str| {
+            u32::from_str_radix(out, 8)
+                .map(std::char::from_u32)
+                .ok()
+                .flatten()
         },
-    )(input)
+    )(input)
 }
 
-pub fn reduce_octal_to_char(input: &str) -> String {
-    many0(alt((parse_octal, anychar)))(input)
-        .map(|(_, r)| r)
-        .unwrap()
-        .into_iter()
-        .collect()
+pub fn reduce_octal_to_char(input: &str) -> String {
+    many0(alt((parse_octal, anychar)))(input)
+        .map(|(_, r)| r)
+        .unwrap()
+        .into_iter()
+        .collect()
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tr/operation.rs.html b/dev/src/uu_tr/operation.rs.html index 15cdb69a9..c35ea52c5 100644 --- a/dev/src/uu_tr/operation.rs.html +++ b/dev/src/uu_tr/operation.rs.html @@ -1,4 +1,4 @@ -operation.rs - source
1
+operation.rs - source
1
 2
 3
 4
@@ -551,558 +551,558 @@
 551
 552
 553
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (strings) anychar combinator Alnum Punct Xdigit alnum punct xdigit cntrl
+// spell-checker:ignore (strings) anychar combinator Alnum Punct Xdigit alnum punct xdigit cntrl
 
-use nom::{
-    branch::alt,
-    bytes::complete::tag,
-    character::complete::{anychar, digit1},
-    combinator::{map, peek, value},
-    multi::many0,
-    sequence::{delimited, preceded, separated_pair},
-    IResult,
+use nom::{
+    branch::alt,
+    bytes::complete::tag,
+    character::complete::{anychar, digit1},
+    combinator::{map, peek, value},
+    multi::many0,
+    sequence::{delimited, preceded, separated_pair},
+    IResult,
 };
-use std::{
-    collections::{HashMap, HashSet},
-    error::Error,
-    fmt::{Debug, Display},
-    io::{BufRead, Write},
+use std::{
+    collections::{HashMap, HashSet},
+    error::Error,
+    fmt::{Debug, Display},
+    io::{BufRead, Write},
 };
-use uucore::error::UError;
+use uucore::error::UError;
 
-use crate::unicode_table;
+use crate::unicode_table;
 
-#[derive(Debug, Clone)]
-pub enum BadSequence {
-    MissingCharClassName,
-    MissingEquivalentClassChar,
-    MultipleCharRepeatInSet2,
-    CharRepeatInSet1,
-    InvalidRepeatCount(String),
-    EmptySet2WhenNotTruncatingSet1,
+#[derive(Debug, Clone)]
+pub enum BadSequence {
+    MissingCharClassName,
+    MissingEquivalentClassChar,
+    MultipleCharRepeatInSet2,
+    CharRepeatInSet1,
+    InvalidRepeatCount(String),
+    EmptySet2WhenNotTruncatingSet1,
 }
 
-impl Display for BadSequence {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::MissingCharClassName => writeln!(f, "missing character class name '[::]'"),
-            Self::MissingEquivalentClassChar => {
-                writeln!(f, "missing equivalence class character '[==]'")
+impl Display for BadSequence {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::MissingCharClassName => writeln!(f, "missing character class name '[::]'"),
+            Self::MissingEquivalentClassChar => {
+                writeln!(f, "missing equivalence class character '[==]'")
             }
-            Self::MultipleCharRepeatInSet2 => {
-                writeln!(f, "only one [c*] repeat construct may appear in string2")
+            Self::MultipleCharRepeatInSet2 => {
+                writeln!(f, "only one [c*] repeat construct may appear in string2")
             }
-            Self::CharRepeatInSet1 => {
-                writeln!(f, "the [c*] repeat construct may not appear in string1")
+            Self::CharRepeatInSet1 => {
+                writeln!(f, "the [c*] repeat construct may not appear in string1")
             }
-            Self::InvalidRepeatCount(count) => {
-                writeln!(f, "invalid repeat count '{}' in [c*n] construct", count)
+            Self::InvalidRepeatCount(count) => {
+                writeln!(f, "invalid repeat count '{}' in [c*n] construct", count)
             }
-            Self::EmptySet2WhenNotTruncatingSet1 => {
-                writeln!(f, "when not truncating set1, string2 must be non-empty")
+            Self::EmptySet2WhenNotTruncatingSet1 => {
+                writeln!(f, "when not truncating set1, string2 must be non-empty")
             }
         }
     }
 }
 
-impl Error for BadSequence {}
-impl UError for BadSequence {}
+impl Error for BadSequence {}
+impl UError for BadSequence {}
 
-#[derive(Debug, Clone, Copy)]
-pub enum Sequence {
-    Char(char),
-    CharRange(u32, u32),
-    CharStar(char),
-    CharRepeat(char, usize),
-    Alnum,
-    Alpha,
-    Blank,
-    Control,
-    Digit,
-    Graph,
-    Lower,
-    Print,
-    Punct,
-    Space,
-    Upper,
-    Xdigit,
+#[derive(Debug, Clone, Copy)]
+pub enum Sequence {
+    Char(char),
+    CharRange(u32, u32),
+    CharStar(char),
+    CharRepeat(char, usize),
+    Alnum,
+    Alpha,
+    Blank,
+    Control,
+    Digit,
+    Graph,
+    Lower,
+    Print,
+    Punct,
+    Space,
+    Upper,
+    Xdigit,
 }
 
-impl Sequence {
-    pub fn flatten(&self) -> Box<dyn Iterator<Item = char>> {
-        match self {
-            Self::Char(c) => Box::new(std::iter::once(*c)),
-            Self::CharRange(l, r) => Box::new((*l..=*r).flat_map(std::char::from_u32)),
-            Self::CharStar(c) => Box::new(std::iter::repeat(*c)),
-            Self::CharRepeat(c, n) => Box::new(std::iter::repeat(*c).take(*n)),
-            Self::Alnum => Box::new(('0'..='9').chain('A'..='Z').chain('a'..='z')),
-            Self::Alpha => Box::new(('A'..='Z').chain('a'..='z')),
-            Self::Blank => Box::new(unicode_table::BLANK.iter().cloned()),
-            Self::Control => Box::new(
-                (0..=31)
-                    .chain(std::iter::once(127))
-                    .flat_map(std::char::from_u32),
+impl Sequence {
+    pub fn flatten(&self) -> Box<dyn Iterator<Item = char>> {
+        match self {
+            Self::Char(c) => Box::new(std::iter::once(*c)),
+            Self::CharRange(l, r) => Box::new((*l..=*r).flat_map(std::char::from_u32)),
+            Self::CharStar(c) => Box::new(std::iter::repeat(*c)),
+            Self::CharRepeat(c, n) => Box::new(std::iter::repeat(*c).take(*n)),
+            Self::Alnum => Box::new(('0'..='9').chain('A'..='Z').chain('a'..='z')),
+            Self::Alpha => Box::new(('A'..='Z').chain('a'..='z')),
+            Self::Blank => Box::new(unicode_table::BLANK.iter().cloned()),
+            Self::Control => Box::new(
+                (0..=31)
+                    .chain(std::iter::once(127))
+                    .flat_map(std::char::from_u32),
             ),
-            Self::Digit => Box::new('0'..='9'),
-            Self::Graph => Box::new(
-                (48..=57) // digit
-                    .chain(65..=90) // uppercase
-                    .chain(97..=122) // lowercase
-                    // punctuations
-                    .chain(33..=47)
-                    .chain(58..=64)
-                    .chain(91..=96)
-                    .chain(123..=126)
-                    .chain(std::iter::once(32)) // space
-                    .flat_map(std::char::from_u32),
+            Self::Digit => Box::new('0'..='9'),
+            Self::Graph => Box::new(
+                (48..=57) // digit
+                    .chain(65..=90) // uppercase
+                    .chain(97..=122) // lowercase
+                    // punctuations
+                    .chain(33..=47)
+                    .chain(58..=64)
+                    .chain(91..=96)
+                    .chain(123..=126)
+                    .chain(std::iter::once(32)) // space
+                    .flat_map(std::char::from_u32),
             ),
-            Self::Lower => Box::new('a'..='z'),
-            Self::Print => Box::new(
-                (48..=57) // digit
-                    .chain(65..=90) // uppercase
-                    .chain(97..=122) // lowercase
-                    // punctuations
-                    .chain(33..=47)
-                    .chain(58..=64)
-                    .chain(91..=96)
-                    .chain(123..=126)
-                    .flat_map(std::char::from_u32),
+            Self::Lower => Box::new('a'..='z'),
+            Self::Print => Box::new(
+                (48..=57) // digit
+                    .chain(65..=90) // uppercase
+                    .chain(97..=122) // lowercase
+                    // punctuations
+                    .chain(33..=47)
+                    .chain(58..=64)
+                    .chain(91..=96)
+                    .chain(123..=126)
+                    .flat_map(std::char::from_u32),
             ),
-            Self::Punct => Box::new(
-                (33..=47)
-                    .chain(58..=64)
-                    .chain(91..=96)
-                    .chain(123..=126)
-                    .flat_map(std::char::from_u32),
+            Self::Punct => Box::new(
+                (33..=47)
+                    .chain(58..=64)
+                    .chain(91..=96)
+                    .chain(123..=126)
+                    .flat_map(std::char::from_u32),
             ),
-            Self::Space => Box::new(unicode_table::SPACES.iter().cloned()),
-            Self::Upper => Box::new('A'..='Z'),
-            Self::Xdigit => Box::new(('0'..='9').chain('A'..='F').chain('a'..='f')),
+            Self::Space => Box::new(unicode_table::SPACES.iter().cloned()),
+            Self::Upper => Box::new('A'..='Z'),
+            Self::Xdigit => Box::new(('0'..='9').chain('A'..='F').chain('a'..='f')),
         }
     }
 
-    // Hide all the nasty sh*t in here
-    // TODO: Make the 2 set lazily generate the character mapping as necessary.
-    pub fn solve_set_characters(
-        set1_str: &str,
-        set2_str: &str,
-        truncate_set1_flag: bool,
-    ) -> Result<(Vec<char>, Vec<char>), BadSequence> {
-        let set1 = Self::from_str(set1_str)?;
-        let set2 = Self::from_str(set2_str)?;
+    // Hide all the nasty sh*t in here
+    // TODO: Make the 2 set lazily generate the character mapping as necessary.
+    pub fn solve_set_characters(
+        set1_str: &str,
+        set2_str: &str,
+        truncate_set1_flag: bool,
+    ) -> Result<(Vec<char>, Vec<char>), BadSequence> {
+        let set1 = Self::from_str(set1_str)?;
+        let set2 = Self::from_str(set2_str)?;
 
-        let is_char_star = |s: &&Self| -> bool { matches!(s, Self::CharStar(_)) };
-        let set1_star_count = set1.iter().filter(is_char_star).count();
-        if set1_star_count == 0 {
-            let set2_star_count = set2.iter().filter(is_char_star).count();
-            if set2_star_count < 2 {
-                let char_star = set2.iter().find_map(|s| match s {
-                    Self::CharStar(c) => Some(c),
-                    _ => None,
+        let is_char_star = |s: &&Self| -> bool { matches!(s, Self::CharStar(_)) };
+        let set1_star_count = set1.iter().filter(is_char_star).count();
+        if set1_star_count == 0 {
+            let set2_star_count = set2.iter().filter(is_char_star).count();
+            if set2_star_count < 2 {
+                let char_star = set2.iter().find_map(|s| match s {
+                    Self::CharStar(c) => Some(c),
+                    _ => None,
                 });
-                let mut partition = set2.as_slice().split(|s| matches!(s, Self::CharStar(_)));
-                let set1_len = set1.iter().flat_map(Self::flatten).count();
-                let set2_len = set2
-                    .iter()
-                    .filter_map(|s| match s {
-                        Self::CharStar(_) => None,
-                        r => Some(r),
+                let mut partition = set2.as_slice().split(|s| matches!(s, Self::CharStar(_)));
+                let set1_len = set1.iter().flat_map(Self::flatten).count();
+                let set2_len = set2
+                    .iter()
+                    .filter_map(|s| match s {
+                        Self::CharStar(_) => None,
+                        r => Some(r),
                     })
-                    .flat_map(Self::flatten)
-                    .count();
-                let star_compensate_len = set1_len.saturating_sub(set2_len);
-                let (left, right) = (partition.next(), partition.next());
-                let set2_solved: Vec<char> = match (left, right) {
-                    (None, None) => match char_star {
-                        Some(c) => std::iter::repeat(*c).take(star_compensate_len).collect(),
-                        None => std::iter::empty().collect(),
+                    .flat_map(Self::flatten)
+                    .count();
+                let star_compensate_len = set1_len.saturating_sub(set2_len);
+                let (left, right) = (partition.next(), partition.next());
+                let set2_solved: Vec<char> = match (left, right) {
+                    (None, None) => match char_star {
+                        Some(c) => std::iter::repeat(*c).take(star_compensate_len).collect(),
+                        None => std::iter::empty().collect(),
                     },
-                    (None, Some(set2_b)) => {
-                        if let Some(c) = char_star {
-                            std::iter::repeat(*c)
-                                .take(star_compensate_len)
-                                .chain(set2_b.iter().flat_map(Self::flatten))
-                                .collect()
-                        } else {
-                            set2_b.iter().flat_map(Self::flatten).collect()
+                    (None, Some(set2_b)) => {
+                        if let Some(c) = char_star {
+                            std::iter::repeat(*c)
+                                .take(star_compensate_len)
+                                .chain(set2_b.iter().flat_map(Self::flatten))
+                                .collect()
+                        } else {
+                            set2_b.iter().flat_map(Self::flatten).collect()
                         }
                     }
-                    (Some(set2_a), None) => match char_star {
-                        Some(c) => set2_a
-                            .iter()
-                            .flat_map(Self::flatten)
-                            .chain(std::iter::repeat(*c).take(star_compensate_len))
-                            .collect(),
-                        None => set2_a.iter().flat_map(Self::flatten).collect(),
+                    (Some(set2_a), None) => match char_star {
+                        Some(c) => set2_a
+                            .iter()
+                            .flat_map(Self::flatten)
+                            .chain(std::iter::repeat(*c).take(star_compensate_len))
+                            .collect(),
+                        None => set2_a.iter().flat_map(Self::flatten).collect(),
                     },
-                    (Some(set2_a), Some(set2_b)) => match char_star {
-                        Some(c) => set2_a
-                            .iter()
-                            .flat_map(Self::flatten)
-                            .chain(std::iter::repeat(*c).take(star_compensate_len))
-                            .chain(set2_b.iter().flat_map(Self::flatten))
-                            .collect(),
-                        None => set2_a
-                            .iter()
-                            .chain(set2_b.iter())
-                            .flat_map(Self::flatten)
-                            .collect(),
+                    (Some(set2_a), Some(set2_b)) => match char_star {
+                        Some(c) => set2_a
+                            .iter()
+                            .flat_map(Self::flatten)
+                            .chain(std::iter::repeat(*c).take(star_compensate_len))
+                            .chain(set2_b.iter().flat_map(Self::flatten))
+                            .collect(),
+                        None => set2_a
+                            .iter()
+                            .chain(set2_b.iter())
+                            .flat_map(Self::flatten)
+                            .collect(),
                     },
                 };
-                let mut set1_solved: Vec<char> = set1.iter().flat_map(Self::flatten).collect();
-                if truncate_set1_flag {
-                    set1_solved.truncate(set2_solved.len());
+                let mut set1_solved: Vec<char> = set1.iter().flat_map(Self::flatten).collect();
+                if truncate_set1_flag {
+                    set1_solved.truncate(set2_solved.len());
                 }
-                Ok((set1_solved, set2_solved))
-            } else {
-                Err(BadSequence::MultipleCharRepeatInSet2)
+                Ok((set1_solved, set2_solved))
+            } else {
+                Err(BadSequence::MultipleCharRepeatInSet2)
             }
-        } else {
-            Err(BadSequence::CharRepeatInSet1)
+        } else {
+            Err(BadSequence::CharRepeatInSet1)
         }
     }
 }
 
-impl Sequence {
-    pub fn from_str(input: &str) -> Result<Vec<Self>, BadSequence> {
-        many0(alt((
-            Self::parse_char_range,
-            Self::parse_char_star,
-            Self::parse_char_repeat,
-            Self::parse_class,
-            Self::parse_char_equal,
-            // NOTE: This must be the last one
-            map(Self::parse_backslash_or_char, |s| Ok(Self::Char(s))),
-        )))(input)
-        .map(|(_, r)| r)
-        .unwrap()
-        .into_iter()
-        .collect::<Result<Vec<_>, _>>()
+impl Sequence {
+    pub fn from_str(input: &str) -> Result<Vec<Self>, BadSequence> {
+        many0(alt((
+            Self::parse_char_range,
+            Self::parse_char_star,
+            Self::parse_char_repeat,
+            Self::parse_class,
+            Self::parse_char_equal,
+            // NOTE: This must be the last one
+            map(Self::parse_backslash_or_char, |s| Ok(Self::Char(s))),
+        )))(input)
+        .map(|(_, r)| r)
+        .unwrap()
+        .into_iter()
+        .collect::<Result<Vec<_>, _>>()
     }
 
-    fn parse_backslash(input: &str) -> IResult<&str, char> {
-        preceded(tag("\\"), anychar)(input).map(|(l, a)| {
-            let c = match a {
-                'a' => unicode_table::BEL,
-                'b' => unicode_table::BS,
-                'f' => unicode_table::FF,
-                'n' => unicode_table::LF,
-                'r' => unicode_table::CR,
-                't' => unicode_table::HT,
-                'v' => unicode_table::VT,
-                x => x,
+    fn parse_backslash(input: &str) -> IResult<&str, char> {
+        preceded(tag("\\"), anychar)(input).map(|(l, a)| {
+            let c = match a {
+                'a' => unicode_table::BEL,
+                'b' => unicode_table::BS,
+                'f' => unicode_table::FF,
+                'n' => unicode_table::LF,
+                'r' => unicode_table::CR,
+                't' => unicode_table::HT,
+                'v' => unicode_table::VT,
+                x => x,
             };
-            (l, c)
+            (l, c)
         })
     }
 
-    fn parse_backslash_or_char(input: &str) -> IResult<&str, char> {
-        alt((Self::parse_backslash, anychar))(input)
+    fn parse_backslash_or_char(input: &str) -> IResult<&str, char> {
+        alt((Self::parse_backslash, anychar))(input)
     }
 
-    fn parse_char_range(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
-        separated_pair(
-            Self::parse_backslash_or_char,
-            tag("-"),
-            Self::parse_backslash_or_char,
-        )(input)
-        .map(|(l, (a, b))| {
-            (l, {
-                let (start, end) = (u32::from(a), u32::from(b));
-                Ok(Self::CharRange(start, end))
+    fn parse_char_range(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
+        separated_pair(
+            Self::parse_backslash_or_char,
+            tag("-"),
+            Self::parse_backslash_or_char,
+        )(input)
+        .map(|(l, (a, b))| {
+            (l, {
+                let (start, end) = (u32::from(a), u32::from(b));
+                Ok(Self::CharRange(start, end))
             })
         })
     }
 
-    fn parse_char_star(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
-        delimited(tag("["), Self::parse_backslash_or_char, tag("*]"))(input)
-            .map(|(l, a)| (l, Ok(Self::CharStar(a))))
+    fn parse_char_star(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
+        delimited(tag("["), Self::parse_backslash_or_char, tag("*]"))(input)
+            .map(|(l, a)| (l, Ok(Self::CharStar(a))))
     }
 
-    fn parse_char_repeat(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
-        delimited(
-            tag("["),
-            separated_pair(Self::parse_backslash_or_char, tag("*"), digit1),
-            tag("]"),
-        )(input)
-        .map(|(l, (c, cnt_str))| {
-            let result = if cnt_str.starts_with('0') {
-                match usize::from_str_radix(cnt_str, 8) {
-                    Ok(0) => Ok(Self::CharStar(c)),
-                    Ok(count) => Ok(Self::CharRepeat(c, count)),
-                    Err(_) => Err(BadSequence::InvalidRepeatCount(cnt_str.to_string())),
+    fn parse_char_repeat(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
+        delimited(
+            tag("["),
+            separated_pair(Self::parse_backslash_or_char, tag("*"), digit1),
+            tag("]"),
+        )(input)
+        .map(|(l, (c, cnt_str))| {
+            let result = if cnt_str.starts_with('0') {
+                match usize::from_str_radix(cnt_str, 8) {
+                    Ok(0) => Ok(Self::CharStar(c)),
+                    Ok(count) => Ok(Self::CharRepeat(c, count)),
+                    Err(_) => Err(BadSequence::InvalidRepeatCount(cnt_str.to_string())),
                 }
-            } else {
-                match cnt_str.parse::<usize>() {
-                    Ok(0) => Ok(Self::CharStar(c)),
-                    Ok(count) => Ok(Self::CharRepeat(c, count)),
-                    Err(_) => Err(BadSequence::InvalidRepeatCount(cnt_str.to_string())),
+            } else {
+                match cnt_str.parse::<usize>() {
+                    Ok(0) => Ok(Self::CharStar(c)),
+                    Ok(count) => Ok(Self::CharRepeat(c, count)),
+                    Err(_) => Err(BadSequence::InvalidRepeatCount(cnt_str.to_string())),
                 }
             };
-            (l, result)
+            (l, result)
         })
     }
 
-    fn parse_class(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
-        delimited(
-            tag("[:"),
-            alt((
-                map(
-                    alt((
-                        value(Self::Alnum, tag("alnum")),
-                        value(Self::Alpha, tag("alpha")),
-                        value(Self::Blank, tag("blank")),
-                        value(Self::Control, tag("cntrl")),
-                        value(Self::Digit, tag("digit")),
-                        value(Self::Graph, tag("graph")),
-                        value(Self::Lower, tag("lower")),
-                        value(Self::Print, tag("print")),
-                        value(Self::Punct, tag("punct")),
-                        value(Self::Space, tag("space")),
-                        value(Self::Upper, tag("upper")),
-                        value(Self::Xdigit, tag("xdigit")),
+    fn parse_class(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
+        delimited(
+            tag("[:"),
+            alt((
+                map(
+                    alt((
+                        value(Self::Alnum, tag("alnum")),
+                        value(Self::Alpha, tag("alpha")),
+                        value(Self::Blank, tag("blank")),
+                        value(Self::Control, tag("cntrl")),
+                        value(Self::Digit, tag("digit")),
+                        value(Self::Graph, tag("graph")),
+                        value(Self::Lower, tag("lower")),
+                        value(Self::Print, tag("print")),
+                        value(Self::Punct, tag("punct")),
+                        value(Self::Space, tag("space")),
+                        value(Self::Upper, tag("upper")),
+                        value(Self::Xdigit, tag("xdigit")),
                     )),
                     Ok,
                 ),
-                value(Err(BadSequence::MissingCharClassName), tag("")),
+                value(Err(BadSequence::MissingCharClassName), tag("")),
             )),
-            tag(":]"),
-        )(input)
+            tag(":]"),
+        )(input)
     }
 
-    fn parse_char_equal(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
-        delimited(
-            tag("[="),
-            alt((
-                value(
-                    Err(BadSequence::MissingEquivalentClassChar),
-                    peek(tag("=]")),
+    fn parse_char_equal(input: &str) -> IResult<&str, Result<Self, BadSequence>> {
+        delimited(
+            tag("[="),
+            alt((
+                value(
+                    Err(BadSequence::MissingEquivalentClassChar),
+                    peek(tag("=]")),
                 ),
-                map(Self::parse_backslash_or_char, |c| Ok(Self::Char(c))),
+                map(Self::parse_backslash_or_char, |c| Ok(Self::Char(c))),
             )),
-            tag("=]"),
-        )(input)
+            tag("=]"),
+        )(input)
     }
 }
 
-pub trait SymbolTranslator {
-    fn translate(&mut self, current: char) -> Option<char>;
+pub trait SymbolTranslator {
+    fn translate(&mut self, current: char) -> Option<char>;
 }
 
-#[derive(Debug)]
-pub struct DeleteOperation {
-    set: Vec<char>,
-    complement_flag: bool,
+#[derive(Debug)]
+pub struct DeleteOperation {
+    set: Vec<char>,
+    complement_flag: bool,
 }
 
-impl DeleteOperation {
-    pub fn new(set: Vec<char>, complement_flag: bool) -> Self {
-        Self {
-            set,
-            complement_flag,
+impl DeleteOperation {
+    pub fn new(set: Vec<char>, complement_flag: bool) -> Self {
+        Self {
+            set,
+            complement_flag,
         }
     }
 }
 
-impl SymbolTranslator for DeleteOperation {
-    fn translate(&mut self, current: char) -> Option<char> {
-        let found = self.set.iter().any(|sequence| sequence.eq(&current));
-        if self.complement_flag == found {
-            Some(current)
-        } else {
-            None
+impl SymbolTranslator for DeleteOperation {
+    fn translate(&mut self, current: char) -> Option<char> {
+        let found = self.set.iter().any(|sequence| sequence.eq(&current));
+        if self.complement_flag == found {
+            Some(current)
+        } else {
+            None
+        }
+    }
+}
+
+pub struct TranslateOperationComplement {
+    iter: u32,
+    set2_iter: usize,
+    set1: Vec<char>,
+    set2: Vec<char>,
+    translation_map: HashMap<char, char>,
+}
+
+impl TranslateOperationComplement {
+    fn new(set1: Vec<char>, set2: Vec<char>) -> Self {
+        Self {
+            iter: 0,
+            set2_iter: 0,
+            set1,
+            set2,
+            translation_map: HashMap::new(),
         }
     }
 }
 
-pub struct TranslateOperationComplement {
-    iter: u32,
-    set2_iter: usize,
-    set1: Vec<char>,
-    set2: Vec<char>,
-    translation_map: HashMap<char, char>,
+#[derive(Debug)]
+pub struct TranslateOperationStandard {
+    translation_map: HashMap<char, char>,
 }
 
-impl TranslateOperationComplement {
-    fn new(set1: Vec<char>, set2: Vec<char>) -> Self {
-        Self {
-            iter: 0,
-            set2_iter: 0,
-            set1,
-            set2,
-            translation_map: HashMap::new(),
-        }
-    }
-}
-
-#[derive(Debug)]
-pub struct TranslateOperationStandard {
-    translation_map: HashMap<char, char>,
-}
-
-impl TranslateOperationStandard {
-    fn new(set1: Vec<char>, set2: Vec<char>) -> Result<Self, BadSequence> {
-        if let Some(fallback) = set2.last().copied() {
-            Ok(Self {
-                translation_map: set1
-                    .into_iter()
-                    .zip(set2.into_iter().chain(std::iter::repeat(fallback)))
-                    .collect::<HashMap<_, _>>(),
+impl TranslateOperationStandard {
+    fn new(set1: Vec<char>, set2: Vec<char>) -> Result<Self, BadSequence> {
+        if let Some(fallback) = set2.last().copied() {
+            Ok(Self {
+                translation_map: set1
+                    .into_iter()
+                    .zip(set2.into_iter().chain(std::iter::repeat(fallback)))
+                    .collect::<HashMap<_, _>>(),
             })
-        } else if set1.is_empty() && set2.is_empty() {
-            Ok(Self {
-                translation_map: HashMap::new(),
+        } else if set1.is_empty() && set2.is_empty() {
+            Ok(Self {
+                translation_map: HashMap::new(),
             })
-        } else {
-            Err(BadSequence::EmptySet2WhenNotTruncatingSet1)
+        } else {
+            Err(BadSequence::EmptySet2WhenNotTruncatingSet1)
         }
     }
 }
 
-pub enum TranslateOperation {
-    Standard(TranslateOperationStandard),
-    Complement(TranslateOperationComplement),
+pub enum TranslateOperation {
+    Standard(TranslateOperationStandard),
+    Complement(TranslateOperationComplement),
 }
 
-impl TranslateOperation {
-    fn next_complement_char(iter: u32, ignore_list: &[char]) -> (u32, char) {
-        (iter..)
-            .filter_map(std::char::from_u32)
-            .filter(|c| !ignore_list.iter().any(|s| s.eq(c)))
-            .map(|c| (u32::from(c) + 1, c))
-            .next()
-            .expect("exhausted all possible characters")
+impl TranslateOperation {
+    fn next_complement_char(iter: u32, ignore_list: &[char]) -> (u32, char) {
+        (iter..)
+            .filter_map(std::char::from_u32)
+            .filter(|c| !ignore_list.iter().any(|s| s.eq(c)))
+            .map(|c| (u32::from(c) + 1, c))
+            .next()
+            .expect("exhausted all possible characters")
     }
 }
 
-impl TranslateOperation {
-    pub fn new(set1: Vec<char>, set2: Vec<char>, complement: bool) -> Result<Self, BadSequence> {
-        if complement {
-            Ok(Self::Complement(TranslateOperationComplement::new(
-                set1, set2,
+impl TranslateOperation {
+    pub fn new(set1: Vec<char>, set2: Vec<char>, complement: bool) -> Result<Self, BadSequence> {
+        if complement {
+            Ok(Self::Complement(TranslateOperationComplement::new(
+                set1, set2,
             )))
-        } else {
-            Ok(Self::Standard(TranslateOperationStandard::new(set1, set2)?))
+        } else {
+            Ok(Self::Standard(TranslateOperationStandard::new(set1, set2)?))
         }
     }
 }
 
-impl SymbolTranslator for TranslateOperation {
-    fn translate(&mut self, current: char) -> Option<char> {
-        match self {
-            Self::Standard(TranslateOperationStandard { translation_map }) => Some(
-                translation_map
-                    .iter()
-                    .find_map(|(l, r)| if l.eq(&current) { Some(*r) } else { None })
-                    .unwrap_or(current),
+impl SymbolTranslator for TranslateOperation {
+    fn translate(&mut self, current: char) -> Option<char> {
+        match self {
+            Self::Standard(TranslateOperationStandard { translation_map }) => Some(
+                translation_map
+                    .iter()
+                    .find_map(|(l, r)| if l.eq(&current) { Some(*r) } else { None })
+                    .unwrap_or(current),
             ),
-            Self::Complement(TranslateOperationComplement {
-                iter,
-                set2_iter,
-                set1,
-                set2,
-                translation_map,
+            Self::Complement(TranslateOperationComplement {
+                iter,
+                set2_iter,
+                set1,
+                set2,
+                translation_map,
             }) => {
-                // First, try to see if current char is already mapped
-                // If so, return the mapped char
-                // Else, pop from set2
-                // If we popped something, map the next complement character to this value
-                // If set2 is empty, we just map the current char directly to fallback --- to avoid looping unnecessarily
-                if let Some(c) = set1.iter().find(|c| c.eq(&&current)) {
-                    Some(*c)
-                } else {
-                    while translation_map.get(&current).is_none() {
-                        if let Some(value) = set2.get(*set2_iter) {
-                            let (next_iter, next_key) = Self::next_complement_char(*iter, &*set1);
-                            *iter = next_iter;
-                            *set2_iter = set2_iter.saturating_add(1);
-                            translation_map.insert(next_key, *value);
-                        } else {
-                            translation_map.insert(current, *set2.last().unwrap());
+                // First, try to see if current char is already mapped
+                // If so, return the mapped char
+                // Else, pop from set2
+                // If we popped something, map the next complement character to this value
+                // If set2 is empty, we just map the current char directly to fallback --- to avoid looping unnecessarily
+                if let Some(c) = set1.iter().find(|c| c.eq(&&current)) {
+                    Some(*c)
+                } else {
+                    while translation_map.get(&current).is_none() {
+                        if let Some(value) = set2.get(*set2_iter) {
+                            let (next_iter, next_key) = Self::next_complement_char(*iter, &*set1);
+                            *iter = next_iter;
+                            *set2_iter = set2_iter.saturating_add(1);
+                            translation_map.insert(next_key, *value);
+                        } else {
+                            translation_map.insert(current, *set2.last().unwrap());
                         }
                     }
-                    Some(*translation_map.get(&current).unwrap())
+                    Some(*translation_map.get(&current).unwrap())
                 }
             }
         }
     }
 }
 
-#[derive(Debug, Clone)]
-pub struct SqueezeOperation {
-    set1: HashSet<char>,
-    complement: bool,
-    previous: Option<char>,
+#[derive(Debug, Clone)]
+pub struct SqueezeOperation {
+    set1: HashSet<char>,
+    complement: bool,
+    previous: Option<char>,
 }
 
-impl SqueezeOperation {
-    pub fn new(set1: Vec<char>, complement: bool) -> Self {
-        Self {
-            set1: set1.into_iter().collect(),
-            complement,
-            previous: None,
+impl SqueezeOperation {
+    pub fn new(set1: Vec<char>, complement: bool) -> Self {
+        Self {
+            set1: set1.into_iter().collect(),
+            complement,
+            previous: None,
         }
     }
 }
 
-impl SymbolTranslator for SqueezeOperation {
-    fn translate(&mut self, current: char) -> Option<char> {
-        if self.complement {
-            let next = if self.set1.contains(&current) {
-                Some(current)
-            } else {
-                match self.previous {
-                    Some(v) => {
-                        if v.eq(&current) {
-                            None
-                        } else {
-                            Some(current)
+impl SymbolTranslator for SqueezeOperation {
+    fn translate(&mut self, current: char) -> Option<char> {
+        if self.complement {
+            let next = if self.set1.contains(&current) {
+                Some(current)
+            } else {
+                match self.previous {
+                    Some(v) => {
+                        if v.eq(&current) {
+                            None
+                        } else {
+                            Some(current)
                         }
                     }
-                    None => Some(current),
+                    None => Some(current),
                 }
             };
-            self.previous = Some(current);
-            next
-        } else {
-            let next = if self.set1.contains(&current) {
-                match self.previous {
-                    Some(v) if v == current => None,
-                    _ => Some(current),
+            self.previous = Some(current);
+            next
+        } else {
+            let next = if self.set1.contains(&current) {
+                match self.previous {
+                    Some(v) if v == current => None,
+                    _ => Some(current),
                 }
-            } else {
-                Some(current)
+            } else {
+                Some(current)
             };
-            self.previous = Some(current);
-            next
+            self.previous = Some(current);
+            next
         }
     }
 }
 
-pub fn translate_input<T, R, W>(input: &mut R, output: &mut W, mut translator: T)
-where
-    T: SymbolTranslator,
-    R: BufRead,
-    W: Write,
+pub fn translate_input<T, R, W>(input: &mut R, output: &mut W, mut translator: T)
+where
+    T: SymbolTranslator,
+    R: BufRead,
+    W: Write,
 {
-    let mut buf = String::new();
-    let mut output_buf = String::new();
-    while let Ok(length) = input.read_line(&mut buf) {
-        if length == 0 {
+    let mut buf = String::new();
+    let mut output_buf = String::new();
+    while let Ok(length) = input.read_line(&mut buf) {
+        if length == 0 {
             break;
-        } else {
-            let filtered = buf.chars().filter_map(|c| translator.translate(c));
-            output_buf.extend(filtered);
-            output.write_all(output_buf.as_bytes()).unwrap();
+        } else {
+            let filtered = buf.chars().filter_map(|c| translator.translate(c));
+            output_buf.extend(filtered);
+            output.write_all(output_buf.as_bytes()).unwrap();
         }
-        buf.clear();
-        output_buf.clear();
+        buf.clear();
+        output_buf.clear();
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tr/tr.rs.html b/dev/src/uu_tr/tr.rs.html index 46891009c..629c9b447 100644 --- a/dev/src/uu_tr/tr.rs.html +++ b/dev/src/uu_tr/tr.rs.html @@ -1,4 +1,4 @@ -tr.rs - source
1
+tr.rs - source
1
 2
 3
 4
@@ -176,183 +176,183 @@
 176
 177
 178
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) allocs bset dflag cflag sflag tflag
+// spell-checker:ignore (ToDO) allocs bset dflag cflag sflag tflag
 
-extern crate nom;
+extern crate nom;
 
-mod convert;
-mod operation;
-mod unicode_table;
+mod convert;
+mod operation;
+mod unicode_table;
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use nom::AsBytes;
-use operation::{translate_input, Sequence, SqueezeOperation, TranslateOperation};
-use std::io::{stdin, stdout, BufReader, BufWriter};
-use uucore::{format_usage, show};
+use clap::{crate_version, Arg, ArgAction, Command};
+use nom::AsBytes;
+use operation::{translate_input, Sequence, SqueezeOperation, TranslateOperation};
+use std::io::{stdin, stdout, BufReader, BufWriter};
+use uucore::{format_usage, show};
 
-use crate::operation::DeleteOperation;
-use uucore::display::Quotable;
-use uucore::error::{UResult, USimpleError, UUsageError};
+use crate::operation::DeleteOperation;
+use uucore::display::Quotable;
+use uucore::error::{UResult, USimpleError, UUsageError};
 
-static ABOUT: &str = "translate or delete characters";
-const USAGE: &str = "{} [OPTION]... SET1 [SET2]";
+static ABOUT: &str = "translate or delete characters";
+const USAGE: &str = "{} [OPTION]... SET1 [SET2]";
 
-mod options {
-    pub const COMPLEMENT: &str = "complement";
-    pub const DELETE: &str = "delete";
-    pub const SQUEEZE: &str = "squeeze-repeats";
-    pub const TRUNCATE_SET1: &str = "truncate-set1";
-    pub const SETS: &str = "sets";
+mod options {
+    pub const COMPLEMENT: &str = "complement";
+    pub const DELETE: &str = "delete";
+    pub const SQUEEZE: &str = "squeeze-repeats";
+    pub const TRUNCATE_SET1: &str = "truncate-set1";
+    pub const SETS: &str = "sets";
 }
 
-fn get_long_usage() -> String {
+fn get_long_usage() -> String {
     "Translate, squeeze, and/or delete characters from standard input, \
-     writing to standard output."
-        .to_string()
+     writing to standard output."
+        .to_string()
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)?;
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)?;
 
-    let delete_flag = matches.get_flag(options::DELETE);
-    let complement_flag = matches.get_flag(options::COMPLEMENT);
-    let squeeze_flag = matches.get_flag(options::SQUEEZE);
-    let truncate_set1_flag = matches.get_flag(options::TRUNCATE_SET1);
+    let delete_flag = matches.get_flag(options::DELETE);
+    let complement_flag = matches.get_flag(options::COMPLEMENT);
+    let squeeze_flag = matches.get_flag(options::SQUEEZE);
+    let truncate_set1_flag = matches.get_flag(options::TRUNCATE_SET1);
 
-    let sets = matches
-        .get_many::<String>(options::SETS)
-        .map(|v| {
-            v.map(ToString::to_string)
-                .map(|input| convert::reduce_octal_to_char(&input))
-                .collect::<Vec<_>>()
+    let sets = matches
+        .get_many::<String>(options::SETS)
+        .map(|v| {
+            v.map(ToString::to_string)
+                .map(|input| convert::reduce_octal_to_char(&input))
+                .collect::<Vec<_>>()
         })
-        .unwrap_or_default();
-    let sets_len = sets.len();
+        .unwrap_or_default();
+    let sets_len = sets.len();
 
-    if sets.is_empty() {
-        return Err(UUsageError::new(1, "missing operand"));
+    if sets.is_empty() {
+        return Err(UUsageError::new(1, "missing operand"));
     }
 
-    if !(delete_flag || squeeze_flag) && sets_len < 2 {
-        return Err(UUsageError::new(
+    if !(delete_flag || squeeze_flag) && sets_len < 2 {
+        return Err(UUsageError::new(
             1,
-            format!("missing operand after {}", sets[0].quote()),
+            format!("missing operand after {}", sets[0].quote()),
         ));
     }
 
-    if let Some(first) = sets.get(0) {
-        if first.ends_with('\\') {
-            show!(USimpleError::new(
+    if let Some(first) = sets.get(0) {
+        if first.ends_with('\\') {
+            show!(USimpleError::new(
                 0,
-                "warning: an unescaped backslash at end of string is not portable"
-            ));
+                "warning: an unescaped backslash at end of string is not portable"
+            ));
         }
     }
 
-    let stdin = stdin();
-    let mut locked_stdin = stdin.lock();
-    let stdout = stdout();
-    let locked_stdout = stdout.lock();
-    let mut buffered_stdout = BufWriter::new(locked_stdout);
+    let stdin = stdin();
+    let mut locked_stdin = stdin.lock();
+    let stdout = stdout();
+    let locked_stdout = stdout.lock();
+    let mut buffered_stdout = BufWriter::new(locked_stdout);
 
-    let mut sets_iter = sets.iter().map(|c| c.as_str());
-    let (set1, set2) = Sequence::solve_set_characters(
-        sets_iter.next().unwrap_or_default(),
-        sets_iter.next().unwrap_or_default(),
-        truncate_set1_flag,
+    let mut sets_iter = sets.iter().map(|c| c.as_str());
+    let (set1, set2) = Sequence::solve_set_characters(
+        sets_iter.next().unwrap_or_default(),
+        sets_iter.next().unwrap_or_default(),
+        truncate_set1_flag,
     )?;
 
-    if delete_flag {
-        if squeeze_flag {
-            let mut delete_buffer = vec![];
+    if delete_flag {
+        if squeeze_flag {
+            let mut delete_buffer = vec![];
             {
-                let mut delete_writer = BufWriter::new(&mut delete_buffer);
-                let delete_op = DeleteOperation::new(set1, complement_flag);
-                translate_input(&mut locked_stdin, &mut delete_writer, delete_op);
+                let mut delete_writer = BufWriter::new(&mut delete_buffer);
+                let delete_op = DeleteOperation::new(set1, complement_flag);
+                translate_input(&mut locked_stdin, &mut delete_writer, delete_op);
             }
             {
-                let mut squeeze_reader = BufReader::new(delete_buffer.as_bytes());
-                let op = SqueezeOperation::new(set2, complement_flag);
-                translate_input(&mut squeeze_reader, &mut buffered_stdout, op);
+                let mut squeeze_reader = BufReader::new(delete_buffer.as_bytes());
+                let op = SqueezeOperation::new(set2, complement_flag);
+                translate_input(&mut squeeze_reader, &mut buffered_stdout, op);
             }
-        } else {
-            let op = DeleteOperation::new(set1, complement_flag);
-            translate_input(&mut locked_stdin, &mut buffered_stdout, op);
+        } else {
+            let op = DeleteOperation::new(set1, complement_flag);
+            translate_input(&mut locked_stdin, &mut buffered_stdout, op);
         }
-    } else if squeeze_flag {
-        if sets_len < 2 {
-            let op = SqueezeOperation::new(set1, complement_flag);
-            translate_input(&mut locked_stdin, &mut buffered_stdout, op);
-        } else {
-            let mut translate_buffer = vec![];
+    } else if squeeze_flag {
+        if sets_len < 2 {
+            let op = SqueezeOperation::new(set1, complement_flag);
+            translate_input(&mut locked_stdin, &mut buffered_stdout, op);
+        } else {
+            let mut translate_buffer = vec![];
             {
-                let mut writer = BufWriter::new(&mut translate_buffer);
-                let op = TranslateOperation::new(set1, set2.clone(), complement_flag)?;
-                translate_input(&mut locked_stdin, &mut writer, op);
+                let mut writer = BufWriter::new(&mut translate_buffer);
+                let op = TranslateOperation::new(set1, set2.clone(), complement_flag)?;
+                translate_input(&mut locked_stdin, &mut writer, op);
             }
             {
-                let mut reader = BufReader::new(translate_buffer.as_bytes());
-                let squeeze_op = SqueezeOperation::new(set2, false);
-                translate_input(&mut reader, &mut buffered_stdout, squeeze_op);
+                let mut reader = BufReader::new(translate_buffer.as_bytes());
+                let squeeze_op = SqueezeOperation::new(set2, false);
+                translate_input(&mut reader, &mut buffered_stdout, squeeze_op);
             }
         }
-    } else {
-        let op = TranslateOperation::new(set1, set2, complement_flag)?;
-        translate_input(&mut locked_stdin, &mut buffered_stdout, op);
+    } else {
+        let op = TranslateOperation::new(set1, set2, complement_flag)?;
+        translate_input(&mut locked_stdin, &mut buffered_stdout, op);
     }
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::COMPLEMENT)
-                .visible_short_alias('C')
-                .short('c')
-                .long(options::COMPLEMENT)
-                .help("use the complement of SET1")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::COMPLEMENT)
+                .visible_short_alias('C')
+                .short('c')
+                .long(options::COMPLEMENT)
+                .help("use the complement of SET1")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DELETE)
-                .short('d')
-                .long(options::DELETE)
-                .help("delete characters in SET1, do not translate")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::DELETE)
+                .short('d')
+                .long(options::DELETE)
+                .help("delete characters in SET1, do not translate")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SQUEEZE)
-                .long(options::SQUEEZE)
-                .short('s')
-                .help(
+        .arg(
+            Arg::new(options::SQUEEZE)
+                .long(options::SQUEEZE)
+                .short('s')
+                .help(
                     "replace each sequence of a repeated character that is \
                      listed in the last specified SET, with a single occurrence \
                      of that character",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::TRUNCATE_SET1)
-                .long(options::TRUNCATE_SET1)
-                .short('t')
-                .help("first truncate SET1 to length of SET2")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::TRUNCATE_SET1)
+                .long(options::TRUNCATE_SET1)
+                .short('t')
+                .help("first truncate SET1 to length of SET2")
+                .action(ArgAction::SetTrue),
         )
-        .arg(Arg::new(options::SETS).num_args(1..=2))
+        .arg(Arg::new(options::SETS).num_args(1..=2))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tr/unicode_table.rs.html b/dev/src/uu_tr/unicode_table.rs.html index 9a5c4022d..7e1a9dc12 100644 --- a/dev/src/uu_tr/unicode_table.rs.html +++ b/dev/src/uu_tr/unicode_table.rs.html @@ -1,4 +1,4 @@ -unicode_table.rs - source
1
+unicode_table.rs - source
1
 2
 3
 4
@@ -13,20 +13,20 @@
 13
 14
 15
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-pub static BEL: char = '\u{0007}';
-pub static BS: char = '\u{0008}';
-pub static HT: char = '\u{0009}';
-pub static LF: char = '\u{000A}';
-pub static VT: char = '\u{000B}';
-pub static FF: char = '\u{000C}';
-pub static CR: char = '\u{000D}';
-pub static SPACE: char = '\u{0020}';
-pub static SPACES: &[char] = &[HT, LF, VT, FF, CR, SPACE];
-pub static BLANK: &[char] = &[SPACE, HT];
+pub static BEL: char = '\u{0007}';
+pub static BS: char = '\u{0008}';
+pub static HT: char = '\u{0009}';
+pub static LF: char = '\u{000A}';
+pub static VT: char = '\u{000B}';
+pub static FF: char = '\u{000C}';
+pub static CR: char = '\u{000D}';
+pub static SPACE: char = '\u{0020}';
+pub static SPACES: &[char] = &[HT, LF, VT, FF, CR, SPACE];
+pub static BLANK: &[char] = &[SPACE, HT];
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_true/true.rs.html b/dev/src/uu_true/true.rs.html index b3edf31e2..0db1cd4ec 100644 --- a/dev/src/uu_true/true.rs.html +++ b/dev/src/uu_true/true.rs.html @@ -1,4 +1,4 @@ -true.rs - source
1
+true.rs - source
1
 2
 3
 4
@@ -67,17 +67,17 @@
 67
 68
 69
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Jordi Boggiano <j.boggiano@seld.be>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-use clap::{Arg, ArgAction, Command};
-use std::{ffi::OsString, io::Write};
-use uucore::error::{set_exit_code, UResult};
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Jordi Boggiano <j.boggiano@seld.be>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+use clap::{Arg, ArgAction, Command};
+use std::{ffi::OsString, io::Write};
+use uucore::error::{set_exit_code, UResult};
 
-static ABOUT: &str = "\
+static ABOUT: &str = "\
 Returns true, a successful exit status.
 
 Immediately returns with the exit status `0`, except when invoked with one of the recognized
@@ -85,56 +85,56 @@ options. In those cases it will try to write the help or version text. Any IO er
 operation causes the program to return `1` instead.
 ";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let mut command = uu_app();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let mut command = uu_app();
 
-    let args: Vec<OsString> = args.collect();
-    if args.len() > 2 {
-        return Ok(());
+    let args: Vec<OsString> = args.collect();
+    if args.len() > 2 {
+        return Ok(());
     }
 
-    if let Err(e) = command.try_get_matches_from_mut(args) {
-        let error = match e.kind() {
-            clap::error::ErrorKind::DisplayHelp => command.print_help(),
-            clap::error::ErrorKind::DisplayVersion => {
-                writeln!(std::io::stdout(), "{}", command.render_version())
+    if let Err(e) = command.try_get_matches_from_mut(args) {
+        let error = match e.kind() {
+            clap::error::ErrorKind::DisplayHelp => command.print_help(),
+            clap::error::ErrorKind::DisplayVersion => {
+                writeln!(std::io::stdout(), "{}", command.render_version())
             }
-            _ => Ok(()),
+            _ => Ok(()),
         };
 
-        if let Err(print_fail) = error {
-            // Try to display this error.
-            let _ = writeln!(std::io::stderr(), "{}: {}", uucore::util_name(), print_fail);
-            // Mirror GNU options. When failing to print warnings or version flags, then we exit
-            // with FAIL. This avoids allocation some error information which may result in yet
-            // other types of failure.
-            set_exit_code(1);
+        if let Err(print_fail) = error {
+            // Try to display this error.
+            let _ = writeln!(std::io::stderr(), "{}: {}", uucore::util_name(), print_fail);
+            // Mirror GNU options. When failing to print warnings or version flags, then we exit
+            // with FAIL. This avoids allocation some error information which may result in yet
+            // other types of failure.
+            set_exit_code(1);
         }
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(clap::crate_version!())
-        .about(ABOUT)
-        // We provide our own help and version options, to ensure maximum compatibility with GNU.
-        .disable_help_flag(true)
-        .disable_version_flag(true)
-        .arg(
-            Arg::new("help")
-                .long("help")
-                .help("Print help information")
-                .action(ArgAction::Help),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(clap::crate_version!())
+        .about(ABOUT)
+        // We provide our own help and version options, to ensure maximum compatibility with GNU.
+        .disable_help_flag(true)
+        .disable_version_flag(true)
+        .arg(
+            Arg::new("help")
+                .long("help")
+                .help("Print help information")
+                .action(ArgAction::Help),
         )
-        .arg(
-            Arg::new("version")
-                .long("version")
-                .help("Print version information")
-                .action(ArgAction::Version),
+        .arg(
+            Arg::new("version")
+                .long("version")
+                .help("Print version information")
+                .action(ArgAction::Version),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_truncate/truncate.rs.html b/dev/src/uu_truncate/truncate.rs.html index f88dc91f9..9daa687ba 100644 --- a/dev/src/uu_truncate/truncate.rs.html +++ b/dev/src/uu_truncate/truncate.rs.html @@ -1,4 +1,4 @@ -truncate.rs - source
1
+truncate.rs - source
1
 2
 3
 4
@@ -466,94 +466,94 @@
 466
 467
 468
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Alex Lyon <arcterus@mail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Alex Lyon <arcterus@mail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) RFILE refsize rfilename fsize tsize
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::fs::{metadata, OpenOptions};
-use std::io::ErrorKind;
-#[cfg(unix)]
-use std::os::unix::fs::FileTypeExt;
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
-use uucore::parse_size::{parse_size, ParseSizeError};
+// spell-checker:ignore (ToDO) RFILE refsize rfilename fsize tsize
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::fs::{metadata, OpenOptions};
+use std::io::ErrorKind;
+#[cfg(unix)]
+use std::os::unix::fs::FileTypeExt;
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
+use uucore::parse_size::{parse_size, ParseSizeError};
 
-#[derive(Debug, Eq, PartialEq)]
-enum TruncateMode {
-    Absolute(u64),
-    Extend(u64),
-    Reduce(u64),
-    AtMost(u64),
-    AtLeast(u64),
-    RoundDown(u64),
-    RoundUp(u64),
+#[derive(Debug, Eq, PartialEq)]
+enum TruncateMode {
+    Absolute(u64),
+    Extend(u64),
+    Reduce(u64),
+    AtMost(u64),
+    AtLeast(u64),
+    RoundDown(u64),
+    RoundUp(u64),
 }
 
-impl TruncateMode {
-    /// Compute a target size in bytes for this truncate mode.
-    ///
-    /// `fsize` is the size of the reference file, in bytes.
-    ///
-    /// If the mode is [`TruncateMode::Reduce`] and the value to
-    /// reduce by is greater than `fsize`, then this function returns
-    /// 0 (since it cannot return a negative number).
-    ///
-    /// # Examples
-    ///
-    /// Extending a file of 10 bytes by 5 bytes:
-    ///
-    /// ```rust,ignore
-    /// let mode = TruncateMode::Extend(5);
-    /// let fsize = 10;
-    /// assert_eq!(mode.to_size(fsize), 15);
-    /// ```
-    ///
-    /// Reducing a file by more than its size results in 0:
-    ///
-    /// ```rust,ignore
-    /// let mode = TruncateMode::Reduce(5);
-    /// let fsize = 3;
-    /// assert_eq!(mode.to_size(fsize), 0);
-    /// ```
-    fn to_size(&self, fsize: u64) -> u64 {
-        match self {
-            Self::Absolute(size) => *size,
-            Self::Extend(size) => fsize + size,
-            Self::Reduce(size) => {
-                if *size > fsize {
-                    0
-                } else {
-                    fsize - size
+impl TruncateMode {
+    /// Compute a target size in bytes for this truncate mode.
+    ///
+    /// `fsize` is the size of the reference file, in bytes.
+    ///
+    /// If the mode is [`TruncateMode::Reduce`] and the value to
+    /// reduce by is greater than `fsize`, then this function returns
+    /// 0 (since it cannot return a negative number).
+    ///
+    /// # Examples
+    ///
+    /// Extending a file of 10 bytes by 5 bytes:
+    ///
+    /// ```rust,ignore
+    /// let mode = TruncateMode::Extend(5);
+    /// let fsize = 10;
+    /// assert_eq!(mode.to_size(fsize), 15);
+    /// ```
+    ///
+    /// Reducing a file by more than its size results in 0:
+    ///
+    /// ```rust,ignore
+    /// let mode = TruncateMode::Reduce(5);
+    /// let fsize = 3;
+    /// assert_eq!(mode.to_size(fsize), 0);
+    /// ```
+    fn to_size(&self, fsize: u64) -> u64 {
+        match self {
+            Self::Absolute(size) => *size,
+            Self::Extend(size) => fsize + size,
+            Self::Reduce(size) => {
+                if *size > fsize {
+                    0
+                } else {
+                    fsize - size
                 }
             }
-            Self::AtMost(size) => fsize.min(*size),
-            Self::AtLeast(size) => fsize.max(*size),
-            Self::RoundDown(size) => fsize - fsize % size,
-            Self::RoundUp(size) => fsize + fsize % size,
+            Self::AtMost(size) => fsize.min(*size),
+            Self::AtLeast(size) => fsize.max(*size),
+            Self::RoundDown(size) => fsize - fsize % size,
+            Self::RoundUp(size) => fsize + fsize % size,
         }
     }
 }
 
-static ABOUT: &str = "Shrink or extend the size of each file to the specified size.";
-const USAGE: &str = "{} [OPTION]... [FILE]...";
+static ABOUT: &str = "Shrink or extend the size of each file to the specified size.";
+const USAGE: &str = "{} [OPTION]... [FILE]...";
 
-pub mod options {
-    pub static IO_BLOCKS: &str = "io-blocks";
-    pub static NO_CREATE: &str = "no-create";
-    pub static REFERENCE: &str = "reference";
-    pub static SIZE: &str = "size";
-    pub static ARG_FILES: &str = "files";
+pub mod options {
+    pub static IO_BLOCKS: &str = "io-blocks";
+    pub static NO_CREATE: &str = "no-create";
+    pub static REFERENCE: &str = "reference";
+    pub static SIZE: &str = "size";
+    pub static ARG_FILES: &str = "files";
 }
 
-fn get_long_usage() -> String {
-    String::from(
+fn get_long_usage() -> String {
+    String::from(
         "
     SIZE is an integer with an optional prefix and optional unit.
     The available units (K, M, G, T, P, E, Z, and Y) use the following format:
@@ -574,266 +574,266 @@
     )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)
-        .map_err(|e| {
-            e.print().expect("Error writing clap::Error");
-            match e.kind() {
-                clap::error::ErrorKind::DisplayHelp | clap::error::ErrorKind::DisplayVersion => 0,
-                _ => 1,
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)
+        .map_err(|e| {
+            e.print().expect("Error writing clap::Error");
+            match e.kind() {
+                clap::error::ErrorKind::DisplayHelp | clap::error::ErrorKind::DisplayVersion => 0,
+                _ => 1,
             }
         })?;
 
-    let files: Vec<String> = matches
-        .get_many::<String>(options::ARG_FILES)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let files: Vec<String> = matches
+        .get_many::<String>(options::ARG_FILES)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    if files.is_empty() {
-        return Err(UUsageError::new(1, "missing file operand"));
-    } else {
-        let io_blocks = matches.get_flag(options::IO_BLOCKS);
-        let no_create = matches.get_flag(options::NO_CREATE);
-        let reference = matches
-            .get_one::<String>(options::REFERENCE)
-            .map(String::from);
-        let size = matches.get_one::<String>(options::SIZE).map(String::from);
-        truncate(no_create, io_blocks, reference, size, &files)
+    if files.is_empty() {
+        return Err(UUsageError::new(1, "missing file operand"));
+    } else {
+        let io_blocks = matches.get_flag(options::IO_BLOCKS);
+        let no_create = matches.get_flag(options::NO_CREATE);
+        let reference = matches
+            .get_one::<String>(options::REFERENCE)
+            .map(String::from);
+        let size = matches.get_one::<String>(options::SIZE).map(String::from);
+        truncate(no_create, io_blocks, reference, size, &files)
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::IO_BLOCKS)
-                .short('o')
-                .long(options::IO_BLOCKS)
-                .help(
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::IO_BLOCKS)
+                .short('o')
+                .long(options::IO_BLOCKS)
+                .help(
                     "treat SIZE as the number of I/O blocks of the file rather than bytes \
             (NOT IMPLEMENTED)",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NO_CREATE)
-                .short('c')
-                .long(options::NO_CREATE)
-                .help("do not create files that do not exist")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_CREATE)
+                .short('c')
+                .long(options::NO_CREATE)
+                .help("do not create files that do not exist")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REFERENCE)
-                .short('r')
-                .long(options::REFERENCE)
-                .required_unless_present(options::SIZE)
-                .help("base the size of each file on the size of RFILE")
-                .value_name("RFILE")
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::REFERENCE)
+                .short('r')
+                .long(options::REFERENCE)
+                .required_unless_present(options::SIZE)
+                .help("base the size of each file on the size of RFILE")
+                .value_name("RFILE")
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::SIZE)
-                .short('s')
-                .long(options::SIZE)
-                .required_unless_present(options::REFERENCE)
-                .help(
+        .arg(
+            Arg::new(options::SIZE)
+                .short('s')
+                .long(options::SIZE)
+                .required_unless_present(options::REFERENCE)
+                .help(
                     "set or adjust the size of each file according to SIZE, which is in \
             bytes unless --io-blocks is specified",
                 )
-                .value_name("SIZE"),
+                .value_name("SIZE"),
         )
-        .arg(
-            Arg::new(options::ARG_FILES)
-                .value_name("FILE")
-                .action(ArgAction::Append)
-                .required(true)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::ARG_FILES)
+                .value_name("FILE")
+                .action(ArgAction::Append)
+                .required(true)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-/// Truncate the named file to the specified size.
-///
-/// If `create` is true, then the file will be created if it does not
-/// already exist. If `size` is larger than the number of bytes in the
-/// file, then the file will be padded with zeros. If `size` is smaller
-/// than the number of bytes in the file, then the file will be
-/// truncated and any bytes beyond `size` will be lost.
-///
-/// # Errors
-///
-/// If the file could not be opened, or there was a problem setting the
-/// size of the file.
-fn file_truncate(filename: &str, create: bool, size: u64) -> std::io::Result<()> {
-    let path = Path::new(filename);
-    let f = OpenOptions::new().write(true).create(create).open(path)?;
-    f.set_len(size)
+/// Truncate the named file to the specified size.
+///
+/// If `create` is true, then the file will be created if it does not
+/// already exist. If `size` is larger than the number of bytes in the
+/// file, then the file will be padded with zeros. If `size` is smaller
+/// than the number of bytes in the file, then the file will be
+/// truncated and any bytes beyond `size` will be lost.
+///
+/// # Errors
+///
+/// If the file could not be opened, or there was a problem setting the
+/// size of the file.
+fn file_truncate(filename: &str, create: bool, size: u64) -> std::io::Result<()> {
+    let path = Path::new(filename);
+    let f = OpenOptions::new().write(true).create(create).open(path)?;
+    f.set_len(size)
 }
 
-/// Truncate files to a size relative to a given file.
-///
-/// `rfilename` is the name of the reference file.
-///
-/// `size_string` gives the size relative to the reference file to which
-/// to set the target files. For example, "+3K" means "set each file to
-/// be three kilobytes larger than the size of the reference file".
-///
-/// If `create` is true, then each file will be created if it does not
-/// already exist.
-///
-/// # Errors
-///
-/// If any file could not be opened, or there was a problem setting
-/// the size of at least one file.
-///
-/// If at least one file is a named pipe (also known as a fifo).
-fn truncate_reference_and_size(
-    rfilename: &str,
-    size_string: &str,
-    filenames: &[String],
-    create: bool,
-) -> UResult<()> {
-    let mode = match parse_mode_and_size(size_string) {
-        Err(e) => return Err(USimpleError::new(1, format!("Invalid number: {}", e))),
-        Ok(TruncateMode::Absolute(_)) => {
-            return Err(USimpleError::new(
+/// Truncate files to a size relative to a given file.
+///
+/// `rfilename` is the name of the reference file.
+///
+/// `size_string` gives the size relative to the reference file to which
+/// to set the target files. For example, "+3K" means "set each file to
+/// be three kilobytes larger than the size of the reference file".
+///
+/// If `create` is true, then each file will be created if it does not
+/// already exist.
+///
+/// # Errors
+///
+/// If any file could not be opened, or there was a problem setting
+/// the size of at least one file.
+///
+/// If at least one file is a named pipe (also known as a fifo).
+fn truncate_reference_and_size(
+    rfilename: &str,
+    size_string: &str,
+    filenames: &[String],
+    create: bool,
+) -> UResult<()> {
+    let mode = match parse_mode_and_size(size_string) {
+        Err(e) => return Err(USimpleError::new(1, format!("Invalid number: {}", e))),
+        Ok(TruncateMode::Absolute(_)) => {
+            return Err(USimpleError::new(
                 1,
-                String::from("you must specify a relative '--size' with '--reference'"),
+                String::from("you must specify a relative '--size' with '--reference'"),
             ))
         }
-        Ok(m) => m,
+        Ok(m) => m,
     };
-    if let TruncateMode::RoundDown(0) | TruncateMode::RoundUp(0) = mode {
-        return Err(USimpleError::new(1, "division by zero"));
+    if let TruncateMode::RoundDown(0) | TruncateMode::RoundUp(0) = mode {
+        return Err(USimpleError::new(1, "division by zero"));
     }
-    let metadata = metadata(rfilename).map_err(|e| match e.kind() {
-        ErrorKind::NotFound => USimpleError::new(
+    let metadata = metadata(rfilename).map_err(|e| match e.kind() {
+        ErrorKind::NotFound => USimpleError::new(
             1,
             format!(
                 "cannot stat {}: No such file or directory",
-                rfilename.quote()
+                rfilename.quote()
             ),
         ),
-        _ => e.map_err_context(String::new),
+        _ => e.map_err_context(String::new),
     })?;
-    let fsize = metadata.len();
-    let tsize = mode.to_size(fsize);
-    for filename in filenames {
-        #[cfg(unix)]
-        if std::fs::metadata(filename)?.file_type().is_fifo() {
-            return Err(USimpleError::new(
+    let fsize = metadata.len();
+    let tsize = mode.to_size(fsize);
+    for filename in filenames {
+        #[cfg(unix)]
+        if std::fs::metadata(filename)?.file_type().is_fifo() {
+            return Err(USimpleError::new(
                 1,
                 format!(
                     "cannot open {} for writing: No such device or address",
-                    filename.quote()
+                    filename.quote()
                 ),
             ));
         }
 
-        file_truncate(filename, create, tsize)
-            .map_err_context(|| format!("cannot open {} for writing", filename.quote()))?;
+        file_truncate(filename, create, tsize)
+            .map_err_context(|| format!("cannot open {} for writing", filename.quote()))?;
     }
     Ok(())
 }
 
-/// Truncate files to match the size of a given reference file.
-///
-/// `rfilename` is the name of the reference file.
-///
-/// If `create` is true, then each file will be created if it does not
-/// already exist.
-///
-/// # Errors
-///
-/// If any file could not be opened, or there was a problem setting
-/// the size of at least one file.
-///
-/// If at least one file is a named pipe (also known as a fifo).
-fn truncate_reference_file_only(
-    rfilename: &str,
-    filenames: &[String],
-    create: bool,
-) -> UResult<()> {
-    let metadata = metadata(rfilename).map_err(|e| match e.kind() {
-        ErrorKind::NotFound => USimpleError::new(
+/// Truncate files to match the size of a given reference file.
+///
+/// `rfilename` is the name of the reference file.
+///
+/// If `create` is true, then each file will be created if it does not
+/// already exist.
+///
+/// # Errors
+///
+/// If any file could not be opened, or there was a problem setting
+/// the size of at least one file.
+///
+/// If at least one file is a named pipe (also known as a fifo).
+fn truncate_reference_file_only(
+    rfilename: &str,
+    filenames: &[String],
+    create: bool,
+) -> UResult<()> {
+    let metadata = metadata(rfilename).map_err(|e| match e.kind() {
+        ErrorKind::NotFound => USimpleError::new(
             1,
             format!(
                 "cannot stat {}: No such file or directory",
-                rfilename.quote()
+                rfilename.quote()
             ),
         ),
-        _ => e.map_err_context(String::new),
+        _ => e.map_err_context(String::new),
     })?;
-    let tsize = metadata.len();
-    for filename in filenames {
-        #[cfg(unix)]
-        if std::fs::metadata(filename)?.file_type().is_fifo() {
-            return Err(USimpleError::new(
+    let tsize = metadata.len();
+    for filename in filenames {
+        #[cfg(unix)]
+        if std::fs::metadata(filename)?.file_type().is_fifo() {
+            return Err(USimpleError::new(
                 1,
                 format!(
                     "cannot open {} for writing: No such device or address",
-                    filename.quote()
+                    filename.quote()
                 ),
             ));
         }
-        file_truncate(filename, create, tsize)
-            .map_err_context(|| format!("cannot open {} for writing", filename.quote()))?;
+        file_truncate(filename, create, tsize)
+            .map_err_context(|| format!("cannot open {} for writing", filename.quote()))?;
     }
     Ok(())
 }
 
-/// Truncate files to a specified size.
-///
-/// `size_string` gives either an absolute size or a relative size. A
-/// relative size adjusts the size of each file relative to its current
-/// size. For example, "3K" means "set each file to be three kilobytes"
-/// whereas "+3K" means "set each file to be three kilobytes larger than
-/// its current size".
-///
-/// If `create` is true, then each file will be created if it does not
-/// already exist.
-///
-/// # Errors
-///
-/// If any file could not be opened, or there was a problem setting
-/// the size of at least one file.
-///
-/// If at least one file is a named pipe (also known as a fifo).
-fn truncate_size_only(size_string: &str, filenames: &[String], create: bool) -> UResult<()> {
-    let mode = parse_mode_and_size(size_string)
-        .map_err(|e| USimpleError::new(1, format!("Invalid number: {}", e)))?;
-    if let TruncateMode::RoundDown(0) | TruncateMode::RoundUp(0) = mode {
-        return Err(USimpleError::new(1, "division by zero"));
+/// Truncate files to a specified size.
+///
+/// `size_string` gives either an absolute size or a relative size. A
+/// relative size adjusts the size of each file relative to its current
+/// size. For example, "3K" means "set each file to be three kilobytes"
+/// whereas "+3K" means "set each file to be three kilobytes larger than
+/// its current size".
+///
+/// If `create` is true, then each file will be created if it does not
+/// already exist.
+///
+/// # Errors
+///
+/// If any file could not be opened, or there was a problem setting
+/// the size of at least one file.
+///
+/// If at least one file is a named pipe (also known as a fifo).
+fn truncate_size_only(size_string: &str, filenames: &[String], create: bool) -> UResult<()> {
+    let mode = parse_mode_and_size(size_string)
+        .map_err(|e| USimpleError::new(1, format!("Invalid number: {}", e)))?;
+    if let TruncateMode::RoundDown(0) | TruncateMode::RoundUp(0) = mode {
+        return Err(USimpleError::new(1, "division by zero"));
     }
-    for filename in filenames {
-        let fsize = match metadata(filename) {
-            Ok(m) => {
-                #[cfg(unix)]
-                if m.file_type().is_fifo() {
-                    return Err(USimpleError::new(
+    for filename in filenames {
+        let fsize = match metadata(filename) {
+            Ok(m) => {
+                #[cfg(unix)]
+                if m.file_type().is_fifo() {
+                    return Err(USimpleError::new(
                         1,
                         format!(
                             "cannot open {} for writing: No such device or address",
-                            filename.quote()
+                            filename.quote()
                         ),
                     ));
                 }
-                m.len()
+                m.len()
             }
             Err(_) => 0,
         };
-        let tsize = mode.to_size(fsize);
-        match file_truncate(filename, create, tsize) {
+        let tsize = mode.to_size(fsize);
+        match file_truncate(filename, create, tsize) {
             Ok(_) => continue,
-            Err(e) if e.kind() == ErrorKind::NotFound && !create => continue,
-            Err(e) => {
-                return Err(
-                    e.map_err_context(|| format!("cannot open {} for writing", filename.quote()))
+            Err(e) if e.kind() == ErrorKind::NotFound && !create => continue,
+            Err(e) => {
+                return Err(
+                    e.map_err_context(|| format!("cannot open {} for writing", filename.quote()))
                 )
             }
         }
@@ -841,98 +841,98 @@
     Ok(())
 }
 
-fn truncate(
-    no_create: bool,
-    _: bool,
-    reference: Option<String>,
-    size: Option<String>,
-    filenames: &[String],
-) -> UResult<()> {
-    let create = !no_create;
-    // There are four possibilities
-    // - reference file given and size given,
-    // - reference file given but no size given,
-    // - no reference file given but size given,
-    // - no reference file given and no size given,
-    match (reference, size) {
-        (Some(rfilename), Some(size_string)) => {
-            truncate_reference_and_size(&rfilename, &size_string, filenames, create)
+fn truncate(
+    no_create: bool,
+    _: bool,
+    reference: Option<String>,
+    size: Option<String>,
+    filenames: &[String],
+) -> UResult<()> {
+    let create = !no_create;
+    // There are four possibilities
+    // - reference file given and size given,
+    // - reference file given but no size given,
+    // - no reference file given but size given,
+    // - no reference file given and no size given,
+    match (reference, size) {
+        (Some(rfilename), Some(size_string)) => {
+            truncate_reference_and_size(&rfilename, &size_string, filenames, create)
         }
-        (Some(rfilename), None) => truncate_reference_file_only(&rfilename, filenames, create),
-        (None, Some(size_string)) => truncate_size_only(&size_string, filenames, create),
-        (None, None) => unreachable!(), // this case cannot happen anymore because it's handled by clap
-    }
+        (Some(rfilename), None) => truncate_reference_file_only(&rfilename, filenames, create),
+        (None, Some(size_string)) => truncate_size_only(&size_string, filenames, create),
+        (None, None) => unreachable!(), // this case cannot happen anymore because it's handled by clap
+    }
 }
 
-/// Decide whether a character is one of the size modifiers, like '+' or '<'.
-fn is_modifier(c: char) -> bool {
-    c == '+' || c == '-' || c == '<' || c == '>' || c == '/' || c == '%'
-}
+/// Decide whether a character is one of the size modifiers, like '+' or '<'.
+fn is_modifier(c: char) -> bool {
+    c == '+' || c == '-' || c == '<' || c == '>' || c == '/' || c == '%'
+}
 
-/// Parse a size string with optional modifier symbol as its first character.
-///
-/// A size string is as described in [`parse_size`]. The first character
-/// of `size_string` might be a modifier symbol, like `'+'` or
-/// `'<'`. The first element of the pair returned by this function
-/// indicates which modifier symbol was present, or
-/// [`TruncateMode::Absolute`] if none.
-///
-/// # Panics
-///
-/// If `size_string` is empty, or if no number could be parsed from the
-/// given string (for example, if the string were `"abc"`).
-///
-/// # Examples
-///
-/// ```rust,ignore
-/// assert_eq!(parse_mode_and_size("+123"), (TruncateMode::Extend, 123));
-/// ```
-fn parse_mode_and_size(size_string: &str) -> Result<TruncateMode, ParseSizeError> {
-    // Trim any whitespace.
-    let mut size_string = size_string.trim();
+/// Parse a size string with optional modifier symbol as its first character.
+///
+/// A size string is as described in [`parse_size`]. The first character
+/// of `size_string` might be a modifier symbol, like `'+'` or
+/// `'<'`. The first element of the pair returned by this function
+/// indicates which modifier symbol was present, or
+/// [`TruncateMode::Absolute`] if none.
+///
+/// # Panics
+///
+/// If `size_string` is empty, or if no number could be parsed from the
+/// given string (for example, if the string were `"abc"`).
+///
+/// # Examples
+///
+/// ```rust,ignore
+/// assert_eq!(parse_mode_and_size("+123"), (TruncateMode::Extend, 123));
+/// ```
+fn parse_mode_and_size(size_string: &str) -> Result<TruncateMode, ParseSizeError> {
+    // Trim any whitespace.
+    let mut size_string = size_string.trim();
 
-    // Get the modifier character from the size string, if any. For
-    // example, if the argument is "+123", then the modifier is '+'.
-    if let Some(c) = size_string.chars().next() {
-        if is_modifier(c) {
-            size_string = &size_string[1..];
+    // Get the modifier character from the size string, if any. For
+    // example, if the argument is "+123", then the modifier is '+'.
+    if let Some(c) = size_string.chars().next() {
+        if is_modifier(c) {
+            size_string = &size_string[1..];
         }
-        parse_size(size_string).map(match c {
-            '+' => TruncateMode::Extend,
-            '-' => TruncateMode::Reduce,
-            '<' => TruncateMode::AtMost,
-            '>' => TruncateMode::AtLeast,
-            '/' => TruncateMode::RoundDown,
-            '%' => TruncateMode::RoundUp,
-            _ => TruncateMode::Absolute,
+        parse_size(size_string).map(match c {
+            '+' => TruncateMode::Extend,
+            '-' => TruncateMode::Reduce,
+            '<' => TruncateMode::AtMost,
+            '>' => TruncateMode::AtLeast,
+            '/' => TruncateMode::RoundDown,
+            '%' => TruncateMode::RoundUp,
+            _ => TruncateMode::Absolute,
         })
-    } else {
-        Err(ParseSizeError::ParseFailure(size_string.to_string()))
+    } else {
+        Err(ParseSizeError::ParseFailure(size_string.to_string()))
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::parse_mode_and_size;
-    use crate::TruncateMode;
+#[cfg(test)]
+mod tests {
+    use crate::parse_mode_and_size;
+    use crate::TruncateMode;
 
-    #[test]
-    fn test_parse_mode_and_size() {
-        assert_eq!(parse_mode_and_size("10"), Ok(TruncateMode::Absolute(10)));
-        assert_eq!(parse_mode_and_size("+10"), Ok(TruncateMode::Extend(10)));
-        assert_eq!(parse_mode_and_size("-10"), Ok(TruncateMode::Reduce(10)));
-        assert_eq!(parse_mode_and_size("<10"), Ok(TruncateMode::AtMost(10)));
-        assert_eq!(parse_mode_and_size(">10"), Ok(TruncateMode::AtLeast(10)));
-        assert_eq!(parse_mode_and_size("/10"), Ok(TruncateMode::RoundDown(10)));
-        assert_eq!(parse_mode_and_size("%10"), Ok(TruncateMode::RoundUp(10)));
+    #[test]
+    fn test_parse_mode_and_size() {
+        assert_eq!(parse_mode_and_size("10"), Ok(TruncateMode::Absolute(10)));
+        assert_eq!(parse_mode_and_size("+10"), Ok(TruncateMode::Extend(10)));
+        assert_eq!(parse_mode_and_size("-10"), Ok(TruncateMode::Reduce(10)));
+        assert_eq!(parse_mode_and_size("<10"), Ok(TruncateMode::AtMost(10)));
+        assert_eq!(parse_mode_and_size(">10"), Ok(TruncateMode::AtLeast(10)));
+        assert_eq!(parse_mode_and_size("/10"), Ok(TruncateMode::RoundDown(10)));
+        assert_eq!(parse_mode_and_size("%10"), Ok(TruncateMode::RoundUp(10)));
     }
 
-    #[test]
-    fn test_to_size() {
-        assert_eq!(TruncateMode::Extend(5).to_size(10), 15);
-        assert_eq!(TruncateMode::Reduce(5).to_size(10), 5);
-        assert_eq!(TruncateMode::Reduce(5).to_size(3), 0);
+    #[test]
+    fn test_to_size() {
+        assert_eq!(TruncateMode::Extend(5).to_size(10), 15);
+        assert_eq!(TruncateMode::Reduce(5).to_size(10), 5);
+        assert_eq!(TruncateMode::Reduce(5).to_size(3), 0);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tsort/tsort.rs.html b/dev/src/uu_tsort/tsort.rs.html index 4fa2faf80..7a258ff6e 100644 --- a/dev/src/uu_tsort/tsort.rs.html +++ b/dev/src/uu_tsort/tsort.rs.html @@ -1,4 +1,4 @@ -tsort.rs - source
1
+tsort.rs - source
1
 2
 3
 4
@@ -181,188 +181,188 @@
 181
 182
 183
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Ben Eggers <ben.eggers36@gmail.com>
-//  * (c) Akira Hayakawa <ruby.wktk@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-use clap::{crate_version, Arg, Command};
-use std::collections::{HashMap, HashSet};
-use std::fs::File;
-use std::io::{stdin, BufRead, BufReader, Read};
-use std::path::Path;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError};
-use uucore::format_usage;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Ben Eggers <ben.eggers36@gmail.com>
+//  * (c) Akira Hayakawa <ruby.wktk@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+use clap::{crate_version, Arg, Command};
+use std::collections::{HashMap, HashSet};
+use std::fs::File;
+use std::io::{stdin, BufRead, BufReader, Read};
+use std::path::Path;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError};
+use uucore::format_usage;
 
-static ABOUT: &str = "Topological sort the strings in FILE.
+static ABOUT: &str = "Topological sort the strings in FILE.
 Strings are defined as any sequence of tokens separated by whitespace (tab, space, or newline).
 If FILE is not passed in, stdin is used instead.";
-static USAGE: &str = "{} [OPTIONS] FILE";
+static USAGE: &str = "{} [OPTIONS] FILE";
 
-mod options {
-    pub const FILE: &str = "file";
+mod options {
+    pub const FILE: &str = "file";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_lossy();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_lossy();
 
-    let matches = uu_app().try_get_matches_from(args)?;
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let input = matches
-        .get_one::<String>(options::FILE)
-        .expect("Value is required by clap");
+    let input = matches
+        .get_one::<String>(options::FILE)
+        .expect("Value is required by clap");
 
-    let mut stdin_buf;
-    let mut file_buf;
-    let mut reader = BufReader::new(if input == "-" {
-        stdin_buf = stdin();
-        &mut stdin_buf as &mut dyn Read
-    } else {
-        file_buf = File::open(Path::new(&input)).map_err_context(|| input.to_string())?;
-        &mut file_buf as &mut dyn Read
+    let mut stdin_buf;
+    let mut file_buf;
+    let mut reader = BufReader::new(if input == "-" {
+        stdin_buf = stdin();
+        &mut stdin_buf as &mut dyn Read
+    } else {
+        file_buf = File::open(Path::new(&input)).map_err_context(|| input.to_string())?;
+        &mut file_buf as &mut dyn Read
     });
 
-    let mut g = Graph::new();
-    loop {
-        let mut line = String::new();
-        match reader.read_line(&mut line) {
+    let mut g = Graph::new();
+    loop {
+        let mut line = String::new();
+        match reader.read_line(&mut line) {
             Ok(_) => {
-                let tokens: Vec<String> = line.split_whitespace().map(|s| s.to_owned()).collect();
-                if tokens.is_empty() {
+                let tokens: Vec<String> = line.split_whitespace().map(|s| s.to_owned()).collect();
+                if tokens.is_empty() {
                     break;
                 }
-                for ab in tokens.chunks(2) {
-                    match ab.len() {
-                        2 => g.add_edge(&ab[0], &ab[1]),
-                        _ => {
-                            return Err(USimpleError::new(
+                for ab in tokens.chunks(2) {
+                    match ab.len() {
+                        2 => g.add_edge(&ab[0], &ab[1]),
+                        _ => {
+                            return Err(USimpleError::new(
                                 1,
                                 format!(
                                     "{}: input contains an odd number of tokens",
-                                    input.maybe_quote()
+                                    input.maybe_quote()
                                 ),
                             ))
                         }
                     }
                 }
             }
-            _ => break,
+            _ => break,
         }
     }
 
-    g.run_tsort();
+    g.run_tsort();
 
-    if !g.is_acyclic() {
-        return Err(USimpleError::new(
+    if !g.is_acyclic() {
+        return Err(USimpleError::new(
             1,
-            format!("{}, input contains a loop:", input),
+            format!("{}, input contains a loop:", input),
         ));
     }
 
-    for x in &g.result {
-        println!("{}", x);
+    for x in &g.result {
+        println!("{}", x);
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::FILE)
-                .default_value("-")
-                .hide(true)
-                .value_hint(clap::ValueHint::FilePath),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::FILE)
+                .default_value("-")
+                .hide(true)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-// We use String as a representation of node here
-// but using integer may improve performance.
-#[derive(Default)]
-struct Graph {
-    in_edges: HashMap<String, HashSet<String>>,
-    out_edges: HashMap<String, Vec<String>>,
-    result: Vec<String>,
+// We use String as a representation of node here
+// but using integer may improve performance.
+#[derive(Default)]
+struct Graph {
+    in_edges: HashMap<String, HashSet<String>>,
+    out_edges: HashMap<String, Vec<String>>,
+    result: Vec<String>,
 }
 
-impl Graph {
-    fn new() -> Self {
-        Self::default()
+impl Graph {
+    fn new() -> Self {
+        Self::default()
     }
 
-    fn has_node(&self, n: &str) -> bool {
-        self.in_edges.contains_key(n)
+    fn has_node(&self, n: &str) -> bool {
+        self.in_edges.contains_key(n)
     }
 
-    fn has_edge(&self, from: &str, to: &str) -> bool {
-        self.in_edges[to].contains(from)
+    fn has_edge(&self, from: &str, to: &str) -> bool {
+        self.in_edges[to].contains(from)
     }
 
-    fn init_node(&mut self, n: &str) {
-        self.in_edges.insert(n.to_string(), HashSet::new());
-        self.out_edges.insert(n.to_string(), vec![]);
+    fn init_node(&mut self, n: &str) {
+        self.in_edges.insert(n.to_string(), HashSet::new());
+        self.out_edges.insert(n.to_string(), vec![]);
     }
 
-    fn add_edge(&mut self, from: &str, to: &str) {
-        if !self.has_node(to) {
-            self.init_node(to);
+    fn add_edge(&mut self, from: &str, to: &str) {
+        if !self.has_node(to) {
+            self.init_node(to);
         }
 
-        if !self.has_node(from) {
-            self.init_node(from);
+        if !self.has_node(from) {
+            self.init_node(from);
         }
 
-        if from != to && !self.has_edge(from, to) {
-            self.in_edges.get_mut(to).unwrap().insert(from.to_string());
-            self.out_edges.get_mut(from).unwrap().push(to.to_string());
+        if from != to && !self.has_edge(from, to) {
+            self.in_edges.get_mut(to).unwrap().insert(from.to_string());
+            self.out_edges.get_mut(from).unwrap().push(to.to_string());
         }
     }
 
-    // Kahn's algorithm
-    // O(|V|+|E|)
-    fn run_tsort(&mut self) {
-        let mut start_nodes = vec![];
-        for (n, edges) in &self.in_edges {
-            if edges.is_empty() {
-                start_nodes.push(n.clone());
+    // Kahn's algorithm
+    // O(|V|+|E|)
+    fn run_tsort(&mut self) {
+        let mut start_nodes = vec![];
+        for (n, edges) in &self.in_edges {
+            if edges.is_empty() {
+                start_nodes.push(n.clone());
             }
         }
 
-        while !start_nodes.is_empty() {
-            let n = start_nodes.remove(0);
+        while !start_nodes.is_empty() {
+            let n = start_nodes.remove(0);
 
-            self.result.push(n.clone());
+            self.result.push(n.clone());
 
-            let n_out_edges = self.out_edges.get_mut(&n).unwrap();
-            for m in n_out_edges.iter() {
-                let m_in_edges = self.in_edges.get_mut(m).unwrap();
-                m_in_edges.remove(&n);
+            let n_out_edges = self.out_edges.get_mut(&n).unwrap();
+            for m in n_out_edges.iter() {
+                let m_in_edges = self.in_edges.get_mut(m).unwrap();
+                m_in_edges.remove(&n);
 
-                // If m doesn't have other in-coming edges add it to start_nodes
-                if m_in_edges.is_empty() {
-                    start_nodes.push(m.clone());
+                // If m doesn't have other in-coming edges add it to start_nodes
+                if m_in_edges.is_empty() {
+                    start_nodes.push(m.clone());
                 }
             }
-            n_out_edges.clear();
+            n_out_edges.clear();
         }
     }
 
-    fn is_acyclic(&self) -> bool {
-        for edges in self.out_edges.values() {
-            if !edges.is_empty() {
-                return false;
+    fn is_acyclic(&self) -> bool {
+        for edges in self.out_edges.values() {
+            if !edges.is_empty() {
+                return false;
             }
         }
-        true
-    }
+        true
+    }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_tty/tty.rs.html b/dev/src/uu_tty/tty.rs.html index 59f27feab..ed425609c 100644 --- a/dev/src/uu_tty/tty.rs.html +++ b/dev/src/uu_tty/tty.rs.html @@ -1,4 +1,4 @@ -tty.rs - source
1
+tty.rs - source
1
 2
 3
 4
@@ -74,81 +74,81 @@
 74
 75
 76
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Jordi Boggiano <j.boggiano@seld.be>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-//  *
-//  * Synced with http://lingrok.org/xref/coreutils/src/tty.c
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Jordi Boggiano <j.boggiano@seld.be>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+//  *
+//  * Synced with http://lingrok.org/xref/coreutils/src/tty.c
 
-// spell-checker:ignore (ToDO) ttyname filedesc
+// spell-checker:ignore (ToDO) ttyname filedesc
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::io::Write;
-use std::os::unix::io::AsRawFd;
-use uucore::error::{set_exit_code, UResult};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::io::Write;
+use std::os::unix::io::AsRawFd;
+use uucore::error::{set_exit_code, UResult};
+use uucore::format_usage;
 
-static ABOUT: &str = "Print the file name of the terminal connected to standard input.";
-const USAGE: &str = "{} [OPTION]...";
+static ABOUT: &str = "Print the file name of the terminal connected to standard input.";
+const USAGE: &str = "{} [OPTION]...";
 
-mod options {
-    pub const SILENT: &str = "silent";
+mod options {
+    pub const SILENT: &str = "silent";
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().get_matches_from(args);
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().get_matches_from(args);
 
-    let silent = matches.get_flag(options::SILENT);
+    let silent = matches.get_flag(options::SILENT);
 
-    // If silent, we don't need the name, only whether or not stdin is a tty.
-    if silent {
-        return if atty::is(atty::Stream::Stdin) {
+    // If silent, we don't need the name, only whether or not stdin is a tty.
+    if silent {
+        return if atty::is(atty::Stream::Stdin) {
             Ok(())
-        } else {
-            Err(1.into())
+        } else {
+            Err(1.into())
         };
     };
 
-    let mut stdout = std::io::stdout();
+    let mut stdout = std::io::stdout();
 
-    // Get the ttyname via nix
-    let name = nix::unistd::ttyname(std::io::stdin().as_raw_fd());
+    // Get the ttyname via nix
+    let name = nix::unistd::ttyname(std::io::stdin().as_raw_fd());
 
-    let write_result = match name {
-        Ok(name) => writeln!(stdout, "{}", name.display()),
+    let write_result = match name {
+        Ok(name) => writeln!(stdout, "{}", name.display()),
         Err(_) => {
-            set_exit_code(1);
-            writeln!(stdout, "not a tty")
+            set_exit_code(1);
+            writeln!(stdout, "not a tty")
         }
     };
 
-    if write_result.is_err() || stdout.flush().is_err() {
-        // Don't return to prevent a panic later when another flush is attempted
-        // because the `uucore_procs::main` macro inserts a flush after execution for every utility.
-        std::process::exit(3);
+    if write_result.is_err() || stdout.flush().is_err() {
+        // Don't return to prevent a panic later when another flush is attempted
+        // because the `uucore_procs::main` macro inserts a flush after execution for every utility.
+        std::process::exit(3);
     };
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::SILENT)
-                .long(options::SILENT)
-                .visible_alias("quiet")
-                .short('s')
-                .help("print nothing, only return an exit status")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::SILENT)
+                .long(options::SILENT)
+                .visible_alias("quiet")
+                .short('s')
+                .help("print nothing, only return an exit status")
+                .action(ArgAction::SetTrue),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_uname/uname.rs.html b/dev/src/uu_uname/uname.rs.html index 043b7ce6d..7cef0977a 100644 --- a/dev/src/uu_uname/uname.rs.html +++ b/dev/src/uu_uname/uname.rs.html @@ -1,4 +1,4 @@ -uname.rs - source
1
+uname.rs - source
1
 2
 3
 4
@@ -208,215 +208,215 @@
 208
 209
 210
-
// This file is part of the uutils coreutils package.
-//
-// (c) Joao Oliveira <joaoxsouls@gmail.com>
-// (c) Jian Zeng <anonymousknight96 AT gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Joao Oliveira <joaoxsouls@gmail.com>
+// (c) Jian Zeng <anonymousknight96 AT gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// last synced with: uname (GNU coreutils) 8.21
+// last synced with: uname (GNU coreutils) 8.21
 
-// spell-checker:ignore (ToDO) nodename kernelname kernelrelease kernelversion sysname hwplatform mnrsv
+// spell-checker:ignore (ToDO) nodename kernelname kernelrelease kernelversion sysname hwplatform mnrsv
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use platform_info::*;
-use uucore::{
-    error::{FromIo, UResult},
-    format_usage,
+use clap::{crate_version, Arg, ArgAction, Command};
+use platform_info::*;
+use uucore::{
+    error::{FromIo, UResult},
+    format_usage,
 };
 
-const ABOUT: &str = r#"Print certain system information.
+const ABOUT: &str = r#"Print certain system information.
 With no OPTION, same as -s."#;
-const USAGE: &str = "{} [OPTION]...";
+const USAGE: &str = "{} [OPTION]...";
 
-pub mod options {
-    pub static ALL: &str = "all";
-    pub static KERNELNAME: &str = "kernel-name";
-    pub static NODENAME: &str = "nodename";
-    pub static KERNELVERSION: &str = "kernel-version";
-    pub static KERNELRELEASE: &str = "kernel-release";
-    pub static MACHINE: &str = "machine";
-    pub static PROCESSOR: &str = "processor";
-    pub static HWPLATFORM: &str = "hardware-platform";
-    pub static OS: &str = "operating-system";
+pub mod options {
+    pub static ALL: &str = "all";
+    pub static KERNELNAME: &str = "kernel-name";
+    pub static NODENAME: &str = "nodename";
+    pub static KERNELVERSION: &str = "kernel-version";
+    pub static KERNELRELEASE: &str = "kernel-release";
+    pub static MACHINE: &str = "machine";
+    pub static PROCESSOR: &str = "processor";
+    pub static HWPLATFORM: &str = "hardware-platform";
+    pub static OS: &str = "operating-system";
 }
 
-#[cfg(all(target_os = "linux", any(target_env = "gnu", target_env = "")))]
-const HOST_OS: &str = "GNU/Linux";
-#[cfg(all(target_os = "linux", not(any(target_env = "gnu", target_env = ""))))]
-const HOST_OS: &str = "Linux";
-#[cfg(target_os = "android")]
-const HOST_OS: &str = "Android";
-#[cfg(target_os = "windows")]
-const HOST_OS: &str = "Windows NT";
-#[cfg(target_os = "freebsd")]
-const HOST_OS: &str = "FreeBSD";
-#[cfg(target_os = "netbsd")]
-const HOST_OS: &str = "NetBSD";
-#[cfg(target_os = "openbsd")]
-const HOST_OS: &str = "OpenBSD";
-#[cfg(target_vendor = "apple")]
-const HOST_OS: &str = "Darwin";
-#[cfg(target_os = "fuchsia")]
-const HOST_OS: &str = "Fuchsia";
-#[cfg(target_os = "redox")]
-const HOST_OS: &str = "Redox";
+#[cfg(all(target_os = "linux", any(target_env = "gnu", target_env = "")))]
+const HOST_OS: &str = "GNU/Linux";
+#[cfg(all(target_os = "linux", not(any(target_env = "gnu", target_env = ""))))]
+const HOST_OS: &str = "Linux";
+#[cfg(target_os = "android")]
+const HOST_OS: &str = "Android";
+#[cfg(target_os = "windows")]
+const HOST_OS: &str = "Windows NT";
+#[cfg(target_os = "freebsd")]
+const HOST_OS: &str = "FreeBSD";
+#[cfg(target_os = "netbsd")]
+const HOST_OS: &str = "NetBSD";
+#[cfg(target_os = "openbsd")]
+const HOST_OS: &str = "OpenBSD";
+#[cfg(target_vendor = "apple")]
+const HOST_OS: &str = "Darwin";
+#[cfg(target_os = "fuchsia")]
+const HOST_OS: &str = "Fuchsia";
+#[cfg(target_os = "redox")]
+const HOST_OS: &str = "Redox";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let uname =
-        PlatformInfo::new().map_err_context(|| "failed to create PlatformInfo".to_string())?;
-    let mut output = String::new();
+    let uname =
+        PlatformInfo::new().map_err_context(|| "failed to create PlatformInfo".to_string())?;
+    let mut output = String::new();
 
-    let all = matches.get_flag(options::ALL);
-    let kernelname = matches.get_flag(options::KERNELNAME);
-    let nodename = matches.get_flag(options::NODENAME);
-    let kernelrelease = matches.get_flag(options::KERNELRELEASE);
-    let kernelversion = matches.get_flag(options::KERNELVERSION);
-    let machine = matches.get_flag(options::MACHINE);
-    let processor = matches.get_flag(options::PROCESSOR);
-    let hwplatform = matches.get_flag(options::HWPLATFORM);
-    let os = matches.get_flag(options::OS);
+    let all = matches.get_flag(options::ALL);
+    let kernelname = matches.get_flag(options::KERNELNAME);
+    let nodename = matches.get_flag(options::NODENAME);
+    let kernelrelease = matches.get_flag(options::KERNELRELEASE);
+    let kernelversion = matches.get_flag(options::KERNELVERSION);
+    let machine = matches.get_flag(options::MACHINE);
+    let processor = matches.get_flag(options::PROCESSOR);
+    let hwplatform = matches.get_flag(options::HWPLATFORM);
+    let os = matches.get_flag(options::OS);
 
-    let none = !(all
-        || kernelname
-        || nodename
-        || kernelrelease
-        || kernelversion
-        || machine
-        || os
-        || processor
-        || hwplatform);
+    let none = !(all
+        || kernelname
+        || nodename
+        || kernelrelease
+        || kernelversion
+        || machine
+        || os
+        || processor
+        || hwplatform);
 
-    if kernelname || all || none {
-        output.push_str(&uname.sysname());
-        output.push(' ');
+    if kernelname || all || none {
+        output.push_str(&uname.sysname());
+        output.push(' ');
     }
 
-    if nodename || all {
-        output.push_str(&uname.nodename());
-        output.push(' ');
+    if nodename || all {
+        output.push_str(&uname.nodename());
+        output.push(' ');
     }
 
-    if kernelrelease || all {
-        output.push_str(&uname.release());
-        output.push(' ');
+    if kernelrelease || all {
+        output.push_str(&uname.release());
+        output.push(' ');
     }
 
-    if kernelversion || all {
-        output.push_str(&uname.version());
-        output.push(' ');
+    if kernelversion || all {
+        output.push_str(&uname.version());
+        output.push(' ');
     }
 
-    if machine || all {
-        output.push_str(&uname.machine());
-        output.push(' ');
+    if machine || all {
+        output.push_str(&uname.machine());
+        output.push(' ');
     }
 
-    if os || all {
-        output.push_str(HOST_OS);
-        output.push(' ');
+    if os || all {
+        output.push_str(HOST_OS);
+        output.push(' ');
     }
 
-    // This option is unsupported on modern Linux systems
-    // See: https://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
-    if processor {
-        output.push_str("unknown");
-        output.push(' ');
+    // This option is unsupported on modern Linux systems
+    // See: https://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
+    if processor {
+        output.push_str("unknown");
+        output.push(' ');
     }
 
-    // This option is unsupported on modern Linux systems
-    // See: https://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
-    if hwplatform {
-        output.push_str("unknown");
-        output.push(' ');
+    // This option is unsupported on modern Linux systems
+    // See: https://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
+    if hwplatform {
+        output.push_str("unknown");
+        output.push(' ');
     }
 
-    println!("{}", output.trim_end());
+    println!("{}", output.trim_end());
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::ALL)
-                .short('a')
-                .long(options::ALL)
-                .help("Behave as though all of the options -mnrsv were specified.")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::ALL)
+                .short('a')
+                .long(options::ALL)
+                .help("Behave as though all of the options -mnrsv were specified.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::KERNELNAME)
-                .short('s')
-                .long(options::KERNELNAME)
-                .alias("sysname") // Obsolescent option in GNU uname
-                .help("print the kernel name.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::KERNELNAME)
+                .short('s')
+                .long(options::KERNELNAME)
+                .alias("sysname") // Obsolescent option in GNU uname
+                .help("print the kernel name.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::NODENAME)
-                .short('n')
-                .long(options::NODENAME)
-                .help(
+        .arg(
+            Arg::new(options::NODENAME)
+                .short('n')
+                .long(options::NODENAME)
+                .help(
                     "print the nodename (the nodename may be a name that the system \
                 is known by to a communications network).",
                 )
-                .action(ArgAction::SetTrue),
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::KERNELRELEASE)
-                .short('r')
-                .long(options::KERNELRELEASE)
-                .alias("release") // Obsolescent option in GNU uname
-                .help("print the operating system release.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::KERNELRELEASE)
+                .short('r')
+                .long(options::KERNELRELEASE)
+                .alias("release") // Obsolescent option in GNU uname
+                .help("print the operating system release.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::KERNELVERSION)
-                .short('v')
-                .long(options::KERNELVERSION)
-                .help("print the operating system version.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::KERNELVERSION)
+                .short('v')
+                .long(options::KERNELVERSION)
+                .help("print the operating system version.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::MACHINE)
-                .short('m')
-                .long(options::MACHINE)
-                .help("print the machine hardware name.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::MACHINE)
+                .short('m')
+                .long(options::MACHINE)
+                .help("print the machine hardware name.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::OS)
-                .short('o')
-                .long(options::OS)
-                .help("print the operating system name.")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::OS)
+                .short('o')
+                .long(options::OS)
+                .help("print the operating system name.")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PROCESSOR)
-                .short('p')
-                .long(options::PROCESSOR)
-                .help("print the processor type (non-portable)")
-                .action(ArgAction::SetTrue)
-                .hide(true),
+        .arg(
+            Arg::new(options::PROCESSOR)
+                .short('p')
+                .long(options::PROCESSOR)
+                .help("print the processor type (non-portable)")
+                .action(ArgAction::SetTrue)
+                .hide(true),
         )
-        .arg(
-            Arg::new(options::HWPLATFORM)
-                .short('i')
-                .long(options::HWPLATFORM)
-                .help("print the hardware platform (non-portable)")
-                .action(ArgAction::SetTrue)
-                .hide(true),
+        .arg(
+            Arg::new(options::HWPLATFORM)
+                .short('i')
+                .long(options::HWPLATFORM)
+                .help("print the hardware platform (non-portable)")
+                .action(ArgAction::SetTrue)
+                .hide(true),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_unexpand/unexpand.rs.html b/dev/src/uu_unexpand/unexpand.rs.html index 816203cc7..e1a2c9eaa 100644 --- a/dev/src/uu_unexpand/unexpand.rs.html +++ b/dev/src/uu_unexpand/unexpand.rs.html @@ -1,4 +1,4 @@ -unexpand.rs - source
1
+unexpand.rs - source
1
 2
 3
 4
@@ -436,443 +436,443 @@
 436
 437
 438
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Virgile Andreani <virgile.andreani@anbuco.fr>
-//  * (c) kwantam <kwantam@gmail.com>
-//  *     * 2015-04-28 ~ updated to work with both UTF-8 and non-UTF-8 encodings
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Virgile Andreani <virgile.andreani@anbuco.fr>
+//  * (c) kwantam <kwantam@gmail.com>
+//  *     * 2015-04-28 ~ updated to work with both UTF-8 and non-UTF-8 encodings
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) nums aflag uflag scol prevtab amode ctype cwidth nbytes lastcol pctype Preprocess
+// spell-checker:ignore (ToDO) nums aflag uflag scol prevtab amode ctype cwidth nbytes lastcol pctype Preprocess
 
-#[macro_use]
-extern crate uucore;
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::error::Error;
-use std::fmt;
-use std::fs::File;
-use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write};
-use std::num::IntErrorKind;
-use std::str::from_utf8;
-use unicode_width::UnicodeWidthChar;
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UError, UResult};
-use uucore::format_usage;
+#[macro_use]
+extern crate uucore;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::error::Error;
+use std::fmt;
+use std::fs::File;
+use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Stdout, Write};
+use std::num::IntErrorKind;
+use std::str::from_utf8;
+use unicode_width::UnicodeWidthChar;
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UError, UResult};
+use uucore::format_usage;
 
-static NAME: &str = "unexpand";
-static USAGE: &str = "{} [OPTION]... [FILE]...";
-static ABOUT: &str = r#"Convert blanks in each FILE to tabs, writing to standard output.
+static NAME: &str = "unexpand";
+static USAGE: &str = "{} [OPTION]... [FILE]...";
+static ABOUT: &str = r#"Convert blanks in each FILE to tabs, writing to standard output.
                         With no FILE, or when FILE is -, read standard input."#;
 
-const DEFAULT_TABSTOP: usize = 8;
+const DEFAULT_TABSTOP: usize = 8;
 
-#[derive(Debug)]
-enum ParseError {
-    InvalidCharacter(String),
-    TabSizeCannotBeZero,
-    TabSizeTooLarge,
-    TabSizesMustBeAscending,
+#[derive(Debug)]
+enum ParseError {
+    InvalidCharacter(String),
+    TabSizeCannotBeZero,
+    TabSizeTooLarge,
+    TabSizesMustBeAscending,
 }
 
-impl Error for ParseError {}
-impl UError for ParseError {}
+impl Error for ParseError {}
+impl UError for ParseError {}
 
-impl fmt::Display for ParseError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match self {
-            Self::InvalidCharacter(s) => {
-                write!(f, "tab size contains invalid character(s): {}", s.quote())
+impl fmt::Display for ParseError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            Self::InvalidCharacter(s) => {
+                write!(f, "tab size contains invalid character(s): {}", s.quote())
             }
-            Self::TabSizeCannotBeZero => write!(f, "tab size cannot be 0"),
-            Self::TabSizeTooLarge => write!(f, "tab stop value is too large"),
-            Self::TabSizesMustBeAscending => write!(f, "tab sizes must be ascending"),
+            Self::TabSizeCannotBeZero => write!(f, "tab size cannot be 0"),
+            Self::TabSizeTooLarge => write!(f, "tab stop value is too large"),
+            Self::TabSizesMustBeAscending => write!(f, "tab sizes must be ascending"),
         }
     }
 }
 
-fn tabstops_parse(s: &str) -> Result<Vec<usize>, ParseError> {
-    let words = s.split(',');
+fn tabstops_parse(s: &str) -> Result<Vec<usize>, ParseError> {
+    let words = s.split(',');
 
-    let mut nums = Vec::new();
+    let mut nums = Vec::new();
 
-    for word in words {
-        match word.parse::<usize>() {
-            Ok(num) => nums.push(num),
-            Err(e) => match e.kind() {
-                IntErrorKind::PosOverflow => return Err(ParseError::TabSizeTooLarge),
-                _ => {
-                    return Err(ParseError::InvalidCharacter(
-                        word.trim_start_matches(char::is_numeric).to_string(),
+    for word in words {
+        match word.parse::<usize>() {
+            Ok(num) => nums.push(num),
+            Err(e) => match e.kind() {
+                IntErrorKind::PosOverflow => return Err(ParseError::TabSizeTooLarge),
+                _ => {
+                    return Err(ParseError::InvalidCharacter(
+                        word.trim_start_matches(char::is_numeric).to_string(),
                     ))
                 }
             },
         }
     }
 
-    if nums.iter().any(|&n| n == 0) {
-        return Err(ParseError::TabSizeCannotBeZero);
+    if nums.iter().any(|&n| n == 0) {
+        return Err(ParseError::TabSizeCannotBeZero);
     }
 
-    if let (false, _) = nums
-        .iter()
-        .fold((true, 0), |(acc, last), &n| (acc && last < n, n))
+    if let (false, _) = nums
+        .iter()
+        .fold((true, 0), |(acc, last), &n| (acc && last < n, n))
     {
-        return Err(ParseError::TabSizesMustBeAscending);
+        return Err(ParseError::TabSizesMustBeAscending);
     }
 
-    Ok(nums)
+    Ok(nums)
 }
 
-mod options {
-    pub const FILE: &str = "file";
-    pub const ALL: &str = "all";
-    pub const FIRST_ONLY: &str = "first-only";
-    pub const TABS: &str = "tabs";
-    pub const NO_UTF8: &str = "no-utf8";
+mod options {
+    pub const FILE: &str = "file";
+    pub const ALL: &str = "all";
+    pub const FIRST_ONLY: &str = "first-only";
+    pub const TABS: &str = "tabs";
+    pub const NO_UTF8: &str = "no-utf8";
 }
 
-struct Options {
-    files: Vec<String>,
-    tabstops: Vec<usize>,
-    aflag: bool,
-    uflag: bool,
+struct Options {
+    files: Vec<String>,
+    tabstops: Vec<usize>,
+    aflag: bool,
+    uflag: bool,
 }
 
-impl Options {
-    fn new(matches: &clap::ArgMatches) -> Result<Self, ParseError> {
-        let tabstops = match matches.get_many::<String>(options::TABS) {
-            None => vec![DEFAULT_TABSTOP],
-            Some(s) => tabstops_parse(&s.map(|s| s.as_str()).collect::<Vec<_>>().join(","))?,
+impl Options {
+    fn new(matches: &clap::ArgMatches) -> Result<Self, ParseError> {
+        let tabstops = match matches.get_many::<String>(options::TABS) {
+            None => vec![DEFAULT_TABSTOP],
+            Some(s) => tabstops_parse(&s.map(|s| s.as_str()).collect::<Vec<_>>().join(","))?,
         };
 
-        let aflag = (matches.get_flag(options::ALL) || matches.contains_id(options::TABS))
-            && !matches.get_flag(options::FIRST_ONLY);
-        let uflag = !matches.get_flag(options::NO_UTF8);
+        let aflag = (matches.get_flag(options::ALL) || matches.contains_id(options::TABS))
+            && !matches.get_flag(options::FIRST_ONLY);
+        let uflag = !matches.get_flag(options::NO_UTF8);
 
-        let files = match matches.get_one::<String>(options::FILE) {
-            Some(v) => vec![v.to_string()],
-            None => vec!["-".to_owned()],
+        let files = match matches.get_one::<String>(options::FILE) {
+            Some(v) => vec![v.to_string()],
+            None => vec!["-".to_owned()],
         };
 
-        Ok(Self {
-            files,
-            tabstops,
-            aflag,
-            uflag,
+        Ok(Self {
+            files,
+            tabstops,
+            aflag,
+            uflag,
         })
     }
 }
 
-/// Decide whether the character is either a digit or a comma.
-fn is_digit_or_comma(c: char) -> bool {
-    c.is_ascii_digit() || c == ','
-}
+/// Decide whether the character is either a digit or a comma.
+fn is_digit_or_comma(c: char) -> bool {
+    c.is_ascii_digit() || c == ','
+}
 
-/// Preprocess command line arguments and expand shortcuts. For example, "-7" is expanded to
-/// "--tabs=7 --first-only" and "-1,3" to "--tabs=1 --tabs=3 --first-only". However, if "-a" or
-/// "--all" is provided, "--first-only" is omitted.
-fn expand_shortcuts(args: &[String]) -> Vec<String> {
-    let mut processed_args = Vec::with_capacity(args.len());
-    let mut is_all_arg_provided = false;
-    let mut has_shortcuts = false;
+/// Preprocess command line arguments and expand shortcuts. For example, "-7" is expanded to
+/// "--tabs=7 --first-only" and "-1,3" to "--tabs=1 --tabs=3 --first-only". However, if "-a" or
+/// "--all" is provided, "--first-only" is omitted.
+fn expand_shortcuts(args: &[String]) -> Vec<String> {
+    let mut processed_args = Vec::with_capacity(args.len());
+    let mut is_all_arg_provided = false;
+    let mut has_shortcuts = false;
 
-    for arg in args {
-        if arg.starts_with('-') && arg[1..].chars().all(is_digit_or_comma) {
-            arg[1..]
-                .split(',')
-                .filter(|s| !s.is_empty())
-                .for_each(|s| processed_args.push(format!("--tabs={}", s)));
-            has_shortcuts = true;
-        } else {
-            processed_args.push(arg.to_string());
+    for arg in args {
+        if arg.starts_with('-') && arg[1..].chars().all(is_digit_or_comma) {
+            arg[1..]
+                .split(',')
+                .filter(|s| !s.is_empty())
+                .for_each(|s| processed_args.push(format!("--tabs={}", s)));
+            has_shortcuts = true;
+        } else {
+            processed_args.push(arg.to_string());
 
-            if arg == "--all" || arg == "-a" {
-                is_all_arg_provided = true;
+            if arg == "--all" || arg == "-a" {
+                is_all_arg_provided = true;
             }
         }
     }
 
-    if has_shortcuts && !is_all_arg_provided {
-        processed_args.push("--first-only".into());
+    if has_shortcuts && !is_all_arg_provided {
+        processed_args.push("--first-only".into());
     }
 
-    processed_args
+    processed_args
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app().try_get_matches_from(expand_shortcuts(&args))?;
+    let matches = uu_app().try_get_matches_from(expand_shortcuts(&args))?;
 
-    unexpand(&Options::new(&matches)?).map_err_context(String::new)
+    unexpand(&Options::new(&matches)?).map_err_context(String::new)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .name(NAME)
-        .version(crate_version!())
-        .override_usage(format_usage(USAGE))
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::FILE)
-                .hide(true)
-                .action(ArgAction::Append)
-                .value_hint(clap::ValueHint::FilePath),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .name(NAME)
+        .version(crate_version!())
+        .override_usage(format_usage(USAGE))
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::FILE)
+                .hide(true)
+                .action(ArgAction::Append)
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::ALL)
-                .short('a')
-                .long(options::ALL)
-                .help("convert all blanks, instead of just initial blanks")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ALL)
+                .short('a')
+                .long(options::ALL)
+                .help("convert all blanks, instead of just initial blanks")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FIRST_ONLY)
-                .long(options::FIRST_ONLY)
-                .help("convert only leading sequences of blanks (overrides -a)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::FIRST_ONLY)
+                .long(options::FIRST_ONLY)
+                .help("convert only leading sequences of blanks (overrides -a)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::TABS)
-                .short('t')
-                .long(options::TABS)
-                .help(
+        .arg(
+            Arg::new(options::TABS)
+                .short('t')
+                .long(options::TABS)
+                .help(
                     "use comma separated LIST of tab positions or have tabs N characters \
                 apart instead of 8 (enables -a)",
                 )
-                .action(ArgAction::Append)
-                .value_name("N, LIST"),
+                .action(ArgAction::Append)
+                .value_name("N, LIST"),
         )
-        .arg(
-            Arg::new(options::NO_UTF8)
-                .short('U')
-                .long(options::NO_UTF8)
-                .help("interpret input file as 8-bit ASCII rather than UTF-8")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::NO_UTF8)
+                .short('U')
+                .long(options::NO_UTF8)
+                .help("interpret input file as 8-bit ASCII rather than UTF-8")
+                .action(ArgAction::SetTrue),
         )
 }
 
-fn open(path: &str) -> BufReader<Box<dyn Read + 'static>> {
-    let file_buf;
-    if path == "-" {
-        BufReader::new(Box::new(stdin()) as Box<dyn Read>)
-    } else {
-        file_buf = match File::open(path) {
-            Ok(a) => a,
-            Err(e) => crash!(1, "{}: {}", path.maybe_quote(), e),
+fn open(path: &str) -> BufReader<Box<dyn Read + 'static>> {
+    let file_buf;
+    if path == "-" {
+        BufReader::new(Box::new(stdin()) as Box<dyn Read>)
+    } else {
+        file_buf = match File::open(path) {
+            Ok(a) => a,
+            Err(e) => crash!(1, "{}: {}", path.maybe_quote(), e),
         };
-        BufReader::new(Box::new(file_buf) as Box<dyn Read>)
+        BufReader::new(Box::new(file_buf) as Box<dyn Read>)
     }
 }
 
-fn next_tabstop(tabstops: &[usize], col: usize) -> Option<usize> {
-    if tabstops.len() == 1 {
-        Some(tabstops[0] - col % tabstops[0])
-    } else {
-        // find next larger tab
-        // if there isn't one in the list, tab becomes a single space
-        tabstops.iter().find(|&&t| t > col).map(|t| t - col)
+fn next_tabstop(tabstops: &[usize], col: usize) -> Option<usize> {
+    if tabstops.len() == 1 {
+        Some(tabstops[0] - col % tabstops[0])
+    } else {
+        // find next larger tab
+        // if there isn't one in the list, tab becomes a single space
+        tabstops.iter().find(|&&t| t > col).map(|t| t - col)
     }
 }
 
-fn write_tabs(
-    output: &mut BufWriter<Stdout>,
-    tabstops: &[usize],
-    mut scol: usize,
-    col: usize,
-    prevtab: bool,
-    init: bool,
-    amode: bool,
+fn write_tabs(
+    output: &mut BufWriter<Stdout>,
+    tabstops: &[usize],
+    mut scol: usize,
+    col: usize,
+    prevtab: bool,
+    init: bool,
+    amode: bool,
 ) {
-    // This conditional establishes the following:
-    // We never turn a single space before a non-blank into
-    // a tab, unless it's at the start of the line.
-    let ai = init || amode;
-    if (ai && !prevtab && col > scol + 1) || (col > scol && (init || ai && prevtab)) {
-        while let Some(nts) = next_tabstop(tabstops, scol) {
-            if col < scol + nts {
+    // This conditional establishes the following:
+    // We never turn a single space before a non-blank into
+    // a tab, unless it's at the start of the line.
+    let ai = init || amode;
+    if (ai && !prevtab && col > scol + 1) || (col > scol && (init || ai && prevtab)) {
+        while let Some(nts) = next_tabstop(tabstops, scol) {
+            if col < scol + nts {
                 break;
             }
 
-            crash_if_err!(1, output.write_all(b"\t"));
-            scol += nts;
+            crash_if_err!(1, output.write_all(b"\t"));
+            scol += nts;
         }
     }
 
-    while col > scol {
-        crash_if_err!(1, output.write_all(b" "));
-        scol += 1;
+    while col > scol {
+        crash_if_err!(1, output.write_all(b" "));
+        scol += 1;
     }
 }
 
-#[derive(PartialEq, Eq, Debug)]
-enum CharType {
-    Backspace,
-    Space,
-    Tab,
-    Other,
+#[derive(PartialEq, Eq, Debug)]
+enum CharType {
+    Backspace,
+    Space,
+    Tab,
+    Other,
 }
 
-fn next_char_info(uflag: bool, buf: &[u8], byte: usize) -> (CharType, usize, usize) {
-    let (ctype, cwidth, nbytes) = if uflag {
-        let nbytes = char::from(buf[byte]).len_utf8();
+fn next_char_info(uflag: bool, buf: &[u8], byte: usize) -> (CharType, usize, usize) {
+    let (ctype, cwidth, nbytes) = if uflag {
+        let nbytes = char::from(buf[byte]).len_utf8();
 
-        if byte + nbytes > buf.len() {
-            // make sure we don't overrun the buffer because of invalid UTF-8
-            (CharType::Other, 1, 1)
-        } else if let Ok(t) = from_utf8(&buf[byte..byte + nbytes]) {
-            // Now that we think it's UTF-8, figure out what kind of char it is
-            match t.chars().next() {
-                Some(' ') => (CharType::Space, 0, 1),
-                Some('\t') => (CharType::Tab, 0, 1),
-                Some('\x08') => (CharType::Backspace, 0, 1),
-                Some(c) => (
-                    CharType::Other,
-                    UnicodeWidthChar::width(c).unwrap_or(0),
-                    nbytes,
+        if byte + nbytes > buf.len() {
+            // make sure we don't overrun the buffer because of invalid UTF-8
+            (CharType::Other, 1, 1)
+        } else if let Ok(t) = from_utf8(&buf[byte..byte + nbytes]) {
+            // Now that we think it's UTF-8, figure out what kind of char it is
+            match t.chars().next() {
+                Some(' ') => (CharType::Space, 0, 1),
+                Some('\t') => (CharType::Tab, 0, 1),
+                Some('\x08') => (CharType::Backspace, 0, 1),
+                Some(c) => (
+                    CharType::Other,
+                    UnicodeWidthChar::width(c).unwrap_or(0),
+                    nbytes,
                 ),
-                None => {
-                    // invalid char snuck past the utf8_validation_iterator somehow???
-                    (CharType::Other, 1, 1)
+                None => {
+                    // invalid char snuck past the utf8_validation_iterator somehow???
+                    (CharType::Other, 1, 1)
                 }
             }
-        } else {
-            // otherwise, it's not valid
-            (CharType::Other, 1, 1) // implicit assumption: non-UTF8 char has display width 1
-        }
-    } else {
+        } else {
+            // otherwise, it's not valid
+            (CharType::Other, 1, 1) // implicit assumption: non-UTF8 char has display width 1
+        }
+    } else {
         (
-            match buf[byte] {
-                // always take exactly 1 byte in strict ASCII mode
-                0x20 => CharType::Space,
-                0x09 => CharType::Tab,
-                0x08 => CharType::Backspace,
-                _ => CharType::Other,
+            match buf[byte] {
+                // always take exactly 1 byte in strict ASCII mode
+                0x20 => CharType::Space,
+                0x09 => CharType::Tab,
+                0x08 => CharType::Backspace,
+                _ => CharType::Other,
             },
             1,
             1,
         )
     };
 
-    (ctype, cwidth, nbytes)
+    (ctype, cwidth, nbytes)
 }
 
-fn unexpand(options: &Options) -> std::io::Result<()> {
-    let mut output = BufWriter::new(stdout());
-    let ts = &options.tabstops[..];
-    let mut buf = Vec::new();
-    let lastcol = if ts.len() > 1 { *ts.last().unwrap() } else { 0 };
+fn unexpand(options: &Options) -> std::io::Result<()> {
+    let mut output = BufWriter::new(stdout());
+    let ts = &options.tabstops[..];
+    let mut buf = Vec::new();
+    let lastcol = if ts.len() > 1 { *ts.last().unwrap() } else { 0 };
 
-    for file in &options.files {
-        let mut fh = open(file);
+    for file in &options.files {
+        let mut fh = open(file);
 
-        while match fh.read_until(b'\n', &mut buf) {
-            Ok(s) => s > 0,
-            Err(_) => !buf.is_empty(),
+        while match fh.read_until(b'\n', &mut buf) {
+            Ok(s) => s > 0,
+            Err(_) => !buf.is_empty(),
         } {
-            let mut byte = 0; // offset into the buffer
-            let mut col = 0; // the current column
-            let mut scol = 0; // the start col for the current span, i.e., the already-printed width
-            let mut init = true; // are we at the start of the line?
-            let mut pctype = CharType::Other;
+            let mut byte = 0; // offset into the buffer
+            let mut col = 0; // the current column
+            let mut scol = 0; // the start col for the current span, i.e., the already-printed width
+            let mut init = true; // are we at the start of the line?
+            let mut pctype = CharType::Other;
 
-            while byte < buf.len() {
-                // when we have a finite number of columns, never convert past the last column
-                if lastcol > 0 && col >= lastcol {
-                    write_tabs(
-                        &mut output,
-                        ts,
-                        scol,
-                        col,
-                        pctype == CharType::Tab,
-                        init,
+            while byte < buf.len() {
+                // when we have a finite number of columns, never convert past the last column
+                if lastcol > 0 && col >= lastcol {
+                    write_tabs(
+                        &mut output,
+                        ts,
+                        scol,
+                        col,
+                        pctype == CharType::Tab,
+                        init,
                         true,
                     );
-                    output.write_all(&buf[byte..])?;
-                    scol = col;
+                    output.write_all(&buf[byte..])?;
+                    scol = col;
                     break;
                 }
 
-                // figure out how big the next char is, if it's UTF-8
-                let (ctype, cwidth, nbytes) = next_char_info(options.uflag, &buf, byte);
+                // figure out how big the next char is, if it's UTF-8
+                let (ctype, cwidth, nbytes) = next_char_info(options.uflag, &buf, byte);
 
-                // now figure out how many columns this char takes up, and maybe print it
-                let tabs_buffered = init || options.aflag;
-                match ctype {
-                    CharType::Space | CharType::Tab => {
-                        // compute next col, but only write space or tab chars if not buffering
-                        col += if ctype == CharType::Space {
-                            1
-                        } else {
-                            next_tabstop(ts, col).unwrap_or(1)
+                // now figure out how many columns this char takes up, and maybe print it
+                let tabs_buffered = init || options.aflag;
+                match ctype {
+                    CharType::Space | CharType::Tab => {
+                        // compute next col, but only write space or tab chars if not buffering
+                        col += if ctype == CharType::Space {
+                            1
+                        } else {
+                            next_tabstop(ts, col).unwrap_or(1)
                         };
 
-                        if !tabs_buffered {
-                            output.write_all(&buf[byte..byte + nbytes])?;
-                            scol = col; // now printed up to this column
-                        }
+                        if !tabs_buffered {
+                            output.write_all(&buf[byte..byte + nbytes])?;
+                            scol = col; // now printed up to this column
+                        }
                     }
-                    CharType::Other | CharType::Backspace => {
-                        // always
-                        write_tabs(
-                            &mut output,
-                            ts,
-                            scol,
-                            col,
-                            pctype == CharType::Tab,
-                            init,
-                            options.aflag,
+                    CharType::Other | CharType::Backspace => {
+                        // always
+                        write_tabs(
+                            &mut output,
+                            ts,
+                            scol,
+                            col,
+                            pctype == CharType::Tab,
+                            init,
+                            options.aflag,
                         );
-                        init = false; // no longer at the start of a line
-                        col = if ctype == CharType::Other {
-                            // use computed width
-                            col + cwidth
-                        } else if col > 0 {
-                            // Backspace case, but only if col > 0
-                            col - 1
-                        } else {
-                            0
-                        };
-                        output.write_all(&buf[byte..byte + nbytes])?;
-                        scol = col; // we've now printed up to this column
-                    }
+                        init = false; // no longer at the start of a line
+                        col = if ctype == CharType::Other {
+                            // use computed width
+                            col + cwidth
+                        } else if col > 0 {
+                            // Backspace case, but only if col > 0
+                            col - 1
+                        } else {
+                            0
+                        };
+                        output.write_all(&buf[byte..byte + nbytes])?;
+                        scol = col; // we've now printed up to this column
+                    }
                 }
 
-                byte += nbytes; // move on to next char
-                pctype = ctype; // save the previous type
-            }
+                byte += nbytes; // move on to next char
+                pctype = ctype; // save the previous type
+            }
 
-            // write out anything remaining
-            write_tabs(
-                &mut output,
-                ts,
-                scol,
-                col,
-                pctype == CharType::Tab,
-                init,
+            // write out anything remaining
+            write_tabs(
+                &mut output,
+                ts,
+                scol,
+                col,
+                pctype == CharType::Tab,
+                init,
                 true,
             );
-            output.flush()?;
-            buf.truncate(0); // clear out the buffer
-        }
+            output.flush()?;
+            buf.truncate(0); // clear out the buffer
+        }
     }
-    output.flush()
+    output.flush()
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::is_digit_or_comma;
+#[cfg(test)]
+mod tests {
+    use crate::is_digit_or_comma;
 
-    #[test]
-    fn test_is_digit_or_comma() {
-        assert!(is_digit_or_comma('1'));
-        assert!(is_digit_or_comma(','));
-        assert!(!is_digit_or_comma('a'));
+    #[test]
+    fn test_is_digit_or_comma() {
+        assert!(is_digit_or_comma('1'));
+        assert!(is_digit_or_comma(','));
+        assert!(!is_digit_or_comma('a'));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_uniq/uniq.rs.html b/dev/src/uu_uniq/uniq.rs.html index 396d76cb8..0c79b2701 100644 --- a/dev/src/uu_uniq/uniq.rs.html +++ b/dev/src/uu_uniq/uniq.rs.html @@ -1,4 +1,4 @@ -uniq.rs - source
1
+uniq.rs - source
1
 2
 3
 4
@@ -442,254 +442,254 @@
 442
 443
 444
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Chirag B Jadwani <chirag.jadwani@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Chirag B Jadwani <chirag.jadwani@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// TODO remove this when https://github.com/rust-lang/rust-clippy/issues/6902 is fixed
-#![allow(clippy::use_self)]
+// TODO remove this when https://github.com/rust-lang/rust-clippy/issues/6902 is fixed
+#![allow(clippy::use_self)]
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
-use std::fs::File;
-use std::io::{self, stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
-use std::path::Path;
-use std::str::FromStr;
-use strum_macros::{AsRefStr, EnumString};
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use std::fs::File;
+use std::io::{self, stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
+use std::path::Path;
+use std::str::FromStr;
+use strum_macros::{AsRefStr, EnumString};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
+use uucore::format_usage;
 
-static ABOUT: &str = "Report or omit repeated lines.";
-const USAGE: &str = "{} [OPTION]... [INPUT [OUTPUT]]...";
-pub mod options {
-    pub static ALL_REPEATED: &str = "all-repeated";
-    pub static CHECK_CHARS: &str = "check-chars";
-    pub static COUNT: &str = "count";
-    pub static IGNORE_CASE: &str = "ignore-case";
-    pub static REPEATED: &str = "repeated";
-    pub static SKIP_FIELDS: &str = "skip-fields";
-    pub static SKIP_CHARS: &str = "skip-chars";
-    pub static UNIQUE: &str = "unique";
-    pub static ZERO_TERMINATED: &str = "zero-terminated";
-    pub static GROUP: &str = "group";
+static ABOUT: &str = "Report or omit repeated lines.";
+const USAGE: &str = "{} [OPTION]... [INPUT [OUTPUT]]...";
+pub mod options {
+    pub static ALL_REPEATED: &str = "all-repeated";
+    pub static CHECK_CHARS: &str = "check-chars";
+    pub static COUNT: &str = "count";
+    pub static IGNORE_CASE: &str = "ignore-case";
+    pub static REPEATED: &str = "repeated";
+    pub static SKIP_FIELDS: &str = "skip-fields";
+    pub static SKIP_CHARS: &str = "skip-chars";
+    pub static UNIQUE: &str = "unique";
+    pub static ZERO_TERMINATED: &str = "zero-terminated";
+    pub static GROUP: &str = "group";
 }
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-#[derive(PartialEq, Clone, Copy, AsRefStr, EnumString)]
-#[strum(serialize_all = "snake_case")]
-enum Delimiters {
-    Append,
-    Prepend,
-    Separate,
-    Both,
+#[derive(PartialEq, Clone, Copy, AsRefStr, EnumString)]
+#[strum(serialize_all = "snake_case")]
+enum Delimiters {
+    Append,
+    Prepend,
+    Separate,
+    Both,
     None,
 }
 
-struct Uniq {
-    repeats_only: bool,
-    uniques_only: bool,
-    all_repeated: bool,
-    delimiters: Delimiters,
-    show_counts: bool,
-    skip_fields: Option<usize>,
-    slice_start: Option<usize>,
-    slice_stop: Option<usize>,
-    ignore_case: bool,
-    zero_terminated: bool,
+struct Uniq {
+    repeats_only: bool,
+    uniques_only: bool,
+    all_repeated: bool,
+    delimiters: Delimiters,
+    show_counts: bool,
+    skip_fields: Option<usize>,
+    slice_start: Option<usize>,
+    slice_stop: Option<usize>,
+    ignore_case: bool,
+    zero_terminated: bool,
 }
 
-macro_rules! write_line_terminator {
-    ($writer:expr, $line_terminator:expr) => {
-        $writer
-            .write_all(&[$line_terminator])
-            .map_err_context(|| "Could not write line terminator".to_string())
+macro_rules! write_line_terminator {
+    ($writer:expr, $line_terminator:expr) => {
+        $writer
+            .write_all(&[$line_terminator])
+            .map_err_context(|| "Could not write line terminator".to_string())
     };
 }
 
-impl Uniq {
-    pub fn print_uniq<R: Read, W: Write>(
+impl Uniq {
+    pub fn print_uniq<R: Read, W: Write>(
         &self,
-        reader: &mut BufReader<R>,
-        writer: &mut BufWriter<W>,
-    ) -> UResult<()> {
-        let mut first_line_printed = false;
-        let mut group_count = 1;
-        let line_terminator = self.get_line_terminator();
-        let mut lines = reader.split(line_terminator).map(get_line_string);
-        let mut line = match lines.next() {
-            Some(l) => l?,
-            None => return Ok(()),
+        reader: &mut BufReader<R>,
+        writer: &mut BufWriter<W>,
+    ) -> UResult<()> {
+        let mut first_line_printed = false;
+        let mut group_count = 1;
+        let line_terminator = self.get_line_terminator();
+        let mut lines = reader.split(line_terminator).map(get_line_string);
+        let mut line = match lines.next() {
+            Some(l) => l?,
+            None => return Ok(()),
         };
 
-        // compare current `line` with consecutive lines (`next_line`) of the input
-        // and if needed, print `line` based on the command line options provided
-        for next_line in lines {
-            let next_line = next_line?;
-            if self.cmp_keys(&line, &next_line) {
-                if (group_count == 1 && !self.repeats_only)
-                    || (group_count > 1 && !self.uniques_only)
+        // compare current `line` with consecutive lines (`next_line`) of the input
+        // and if needed, print `line` based on the command line options provided
+        for next_line in lines {
+            let next_line = next_line?;
+            if self.cmp_keys(&line, &next_line) {
+                if (group_count == 1 && !self.repeats_only)
+                    || (group_count > 1 && !self.uniques_only)
                 {
-                    self.print_line(writer, &line, group_count, first_line_printed)?;
-                    first_line_printed = true;
+                    self.print_line(writer, &line, group_count, first_line_printed)?;
+                    first_line_printed = true;
                 }
-                line = next_line;
-                group_count = 1;
-            } else {
-                if self.all_repeated {
-                    self.print_line(writer, &line, group_count, first_line_printed)?;
-                    first_line_printed = true;
-                    line = next_line;
+                line = next_line;
+                group_count = 1;
+            } else {
+                if self.all_repeated {
+                    self.print_line(writer, &line, group_count, first_line_printed)?;
+                    first_line_printed = true;
+                    line = next_line;
                 }
-                group_count += 1;
+                group_count += 1;
             }
         }
-        if (group_count == 1 && !self.repeats_only) || (group_count > 1 && !self.uniques_only) {
-            self.print_line(writer, &line, group_count, first_line_printed)?;
-            first_line_printed = true;
+        if (group_count == 1 && !self.repeats_only) || (group_count > 1 && !self.uniques_only) {
+            self.print_line(writer, &line, group_count, first_line_printed)?;
+            first_line_printed = true;
         }
-        if (self.delimiters == Delimiters::Append || self.delimiters == Delimiters::Both)
-            && first_line_printed
+        if (self.delimiters == Delimiters::Append || self.delimiters == Delimiters::Both)
+            && first_line_printed
         {
-            write_line_terminator!(writer, line_terminator)?;
+            write_line_terminator!(writer, line_terminator)?;
         }
         Ok(())
     }
 
-    fn skip_fields<'a>(&self, line: &'a str) -> &'a str {
-        if let Some(skip_fields) = self.skip_fields {
-            let mut i = 0;
-            let mut char_indices = line.char_indices();
-            for _ in 0..skip_fields {
-                if char_indices.all(|(_, c)| c.is_whitespace()) {
-                    return "";
+    fn skip_fields<'a>(&self, line: &'a str) -> &'a str {
+        if let Some(skip_fields) = self.skip_fields {
+            let mut i = 0;
+            let mut char_indices = line.char_indices();
+            for _ in 0..skip_fields {
+                if char_indices.all(|(_, c)| c.is_whitespace()) {
+                    return "";
                 }
-                match char_indices.find(|(_, c)| c.is_whitespace()) {
-                    None => return "",
+                match char_indices.find(|(_, c)| c.is_whitespace()) {
+                    None => return "",
 
-                    Some((next_field_i, _)) => i = next_field_i,
+                    Some((next_field_i, _)) => i = next_field_i,
                 }
             }
-            &line[i..]
-        } else {
-            line
+            &line[i..]
+        } else {
+            line
         }
     }
 
-    fn get_line_terminator(&self) -> u8 {
-        if self.zero_terminated {
-            0
-        } else {
-            b'\n'
-        }
+    fn get_line_terminator(&self) -> u8 {
+        if self.zero_terminated {
+            0
+        } else {
+            b'\n'
+        }
     }
 
-    fn cmp_keys(&self, first: &str, second: &str) -> bool {
-        self.cmp_key(first, |first_iter| {
-            self.cmp_key(second, |second_iter| first_iter.ne(second_iter))
+    fn cmp_keys(&self, first: &str, second: &str) -> bool {
+        self.cmp_key(first, |first_iter| {
+            self.cmp_key(second, |second_iter| first_iter.ne(second_iter))
         })
     }
 
-    fn cmp_key<F>(&self, line: &str, mut closure: F) -> bool
-    where
-        F: FnMut(&mut dyn Iterator<Item = char>) -> bool,
+    fn cmp_key<F>(&self, line: &str, mut closure: F) -> bool
+    where
+        F: FnMut(&mut dyn Iterator<Item = char>) -> bool,
     {
-        let fields_to_check = self.skip_fields(line);
-        let len = fields_to_check.len();
-        let slice_start = self.slice_start.unwrap_or(0);
-        let slice_stop = self.slice_stop.unwrap_or(len);
-        if len > 0 {
-            // fast path: avoid doing any work if there is no need to skip or map to lower-case
-            if !self.ignore_case && slice_start == 0 && slice_stop == len {
-                return closure(&mut fields_to_check.chars());
+        let fields_to_check = self.skip_fields(line);
+        let len = fields_to_check.len();
+        let slice_start = self.slice_start.unwrap_or(0);
+        let slice_stop = self.slice_stop.unwrap_or(len);
+        if len > 0 {
+            // fast path: avoid doing any work if there is no need to skip or map to lower-case
+            if !self.ignore_case && slice_start == 0 && slice_stop == len {
+                return closure(&mut fields_to_check.chars());
             }
 
-            // fast path: avoid skipping
-            if self.ignore_case && slice_start == 0 && slice_stop == len {
-                return closure(&mut fields_to_check.chars().flat_map(|c| c.to_uppercase()));
+            // fast path: avoid skipping
+            if self.ignore_case && slice_start == 0 && slice_stop == len {
+                return closure(&mut fields_to_check.chars().flat_map(|c| c.to_uppercase()));
             }
 
-            // fast path: we can avoid mapping chars to upper-case, if we don't want to ignore the case
-            if !self.ignore_case {
-                return closure(&mut fields_to_check.chars().skip(slice_start).take(slice_stop));
+            // fast path: we can avoid mapping chars to upper-case, if we don't want to ignore the case
+            if !self.ignore_case {
+                return closure(&mut fields_to_check.chars().skip(slice_start).take(slice_stop));
             }
 
-            closure(
-                &mut fields_to_check
-                    .chars()
-                    .skip(slice_start)
-                    .take(slice_stop)
-                    .flat_map(|c| c.to_uppercase()),
+            closure(
+                &mut fields_to_check
+                    .chars()
+                    .skip(slice_start)
+                    .take(slice_stop)
+                    .flat_map(|c| c.to_uppercase()),
             )
-        } else {
-            closure(&mut fields_to_check.chars())
+        } else {
+            closure(&mut fields_to_check.chars())
         }
     }
 
-    fn should_print_delimiter(&self, group_count: usize, first_line_printed: bool) -> bool {
-        // if no delimiter option is selected then no other checks needed
-        self.delimiters != Delimiters::None
-            // print delimiter only before the first line of a group, not between lines of a group
-            && group_count == 1
-            // if at least one line has been output before current group then print delimiter
-            && (first_line_printed
-                // or if we need to prepend delimiter then print it even at the start of the output
-                || self.delimiters == Delimiters::Prepend
-                // the 'both' delimit mode should prepend and append delimiters
-                || self.delimiters == Delimiters::Both)
+    fn should_print_delimiter(&self, group_count: usize, first_line_printed: bool) -> bool {
+        // if no delimiter option is selected then no other checks needed
+        self.delimiters != Delimiters::None
+            // print delimiter only before the first line of a group, not between lines of a group
+            && group_count == 1
+            // if at least one line has been output before current group then print delimiter
+            && (first_line_printed
+                // or if we need to prepend delimiter then print it even at the start of the output
+                || self.delimiters == Delimiters::Prepend
+                // the 'both' delimit mode should prepend and append delimiters
+                || self.delimiters == Delimiters::Both)
     }
 
-    fn print_line<W: Write>(
+    fn print_line<W: Write>(
         &self,
-        writer: &mut BufWriter<W>,
-        line: &str,
-        count: usize,
-        first_line_printed: bool,
-    ) -> UResult<()> {
-        let line_terminator = self.get_line_terminator();
+        writer: &mut BufWriter<W>,
+        line: &str,
+        count: usize,
+        first_line_printed: bool,
+    ) -> UResult<()> {
+        let line_terminator = self.get_line_terminator();
 
-        if self.should_print_delimiter(count, first_line_printed) {
-            write_line_terminator!(writer, line_terminator)?;
+        if self.should_print_delimiter(count, first_line_printed) {
+            write_line_terminator!(writer, line_terminator)?;
         }
 
-        if self.show_counts {
-            writer.write_all(format!("{:7} {}", count, line).as_bytes())
-        } else {
-            writer.write_all(line.as_bytes())
+        if self.show_counts {
+            writer.write_all(format!("{:7} {}", count, line).as_bytes())
+        } else {
+            writer.write_all(line.as_bytes())
         }
-        .map_err_context(|| "Failed to write line".to_string())?;
+        .map_err_context(|| "Failed to write line".to_string())?;
 
-        write_line_terminator!(writer, line_terminator)
+        write_line_terminator!(writer, line_terminator)
     }
 }
 
-fn get_line_string(io_line: io::Result<Vec<u8>>) -> UResult<String> {
-    let line_bytes = io_line.map_err_context(|| "failed to split lines".to_string())?;
-    String::from_utf8(line_bytes)
-        .map_err(|e| USimpleError::new(1, format!("failed to convert line to utf8: {}", e)))
+fn get_line_string(io_line: io::Result<Vec<u8>>) -> UResult<String> {
+    let line_bytes = io_line.map_err_context(|| "failed to split lines".to_string())?;
+    String::from_utf8(line_bytes)
+        .map_err(|e| USimpleError::new(1, format!("failed to convert line to utf8: {}", e)))
 }
 
-fn opt_parsed<T: FromStr>(opt_name: &str, matches: &ArgMatches) -> UResult<Option<T>> {
-    Ok(match matches.get_one::<String>(opt_name) {
-        Some(arg_str) => Some(arg_str.parse().map_err(|_| {
-            USimpleError::new(
+fn opt_parsed<T: FromStr>(opt_name: &str, matches: &ArgMatches) -> UResult<Option<T>> {
+    Ok(match matches.get_one::<String>(opt_name) {
+        Some(arg_str) => Some(arg_str.parse().map_err(|_| {
+            USimpleError::new(
                 1,
                 format!(
                     "Invalid argument for {}: {}",
-                    opt_name,
-                    arg_str.maybe_quote()
+                    opt_name,
+                    arg_str.maybe_quote()
                 ),
             )
         })?),
-        None => None,
+        None => None,
     })
 }
 
-fn get_long_usage() -> String {
-    String::from(
+fn get_long_usage() -> String {
+    String::from(
         "Filter adjacent matching lines from INPUT (or standard input),\n\
         writing to OUTPUT (or standard output).
         Note: 'uniq' does not detect repeated lines unless they are adjacent.\n\
@@ -697,194 +697,194 @@
     )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)?;
 
-    let files: Vec<String> = matches
-        .get_many::<String>(ARG_FILES)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let files: Vec<String> = matches
+        .get_many::<String>(ARG_FILES)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    let (in_file_name, out_file_name) = match files.len() {
-        0 => ("-".to_owned(), "-".to_owned()),
-        1 => (files[0].clone(), "-".to_owned()),
-        2 => (files[0].clone(), files[1].clone()),
-        _ => {
-            unreachable!() // Cannot happen as clap will fail earlier
-        }
+    let (in_file_name, out_file_name) = match files.len() {
+        0 => ("-".to_owned(), "-".to_owned()),
+        1 => (files[0].clone(), "-".to_owned()),
+        2 => (files[0].clone(), files[1].clone()),
+        _ => {
+            unreachable!() // Cannot happen as clap will fail earlier
+        }
     };
 
-    let uniq = Uniq {
-        repeats_only: matches.get_flag(options::REPEATED)
-            || matches.contains_id(options::ALL_REPEATED),
-        uniques_only: matches.get_flag(options::UNIQUE),
-        all_repeated: matches.contains_id(options::ALL_REPEATED)
-            || matches.contains_id(options::GROUP),
-        delimiters: get_delimiter(&matches),
-        show_counts: matches.get_flag(options::COUNT),
-        skip_fields: opt_parsed(options::SKIP_FIELDS, &matches)?,
-        slice_start: opt_parsed(options::SKIP_CHARS, &matches)?,
-        slice_stop: opt_parsed(options::CHECK_CHARS, &matches)?,
-        ignore_case: matches.get_flag(options::IGNORE_CASE),
-        zero_terminated: matches.get_flag(options::ZERO_TERMINATED),
+    let uniq = Uniq {
+        repeats_only: matches.get_flag(options::REPEATED)
+            || matches.contains_id(options::ALL_REPEATED),
+        uniques_only: matches.get_flag(options::UNIQUE),
+        all_repeated: matches.contains_id(options::ALL_REPEATED)
+            || matches.contains_id(options::GROUP),
+        delimiters: get_delimiter(&matches),
+        show_counts: matches.get_flag(options::COUNT),
+        skip_fields: opt_parsed(options::SKIP_FIELDS, &matches)?,
+        slice_start: opt_parsed(options::SKIP_CHARS, &matches)?,
+        slice_stop: opt_parsed(options::CHECK_CHARS, &matches)?,
+        ignore_case: matches.get_flag(options::IGNORE_CASE),
+        zero_terminated: matches.get_flag(options::ZERO_TERMINATED),
     };
 
-    if uniq.show_counts && uniq.all_repeated {
-        return Err(UUsageError::new(
+    if uniq.show_counts && uniq.all_repeated {
+        return Err(UUsageError::new(
             1,
             "printing all duplicated lines and repeat counts is meaningless",
         ));
     }
 
-    uniq.print_uniq(
-        &mut open_input_file(&in_file_name)?,
-        &mut open_output_file(&out_file_name)?,
+    uniq.print_uniq(
+        &mut open_input_file(&in_file_name)?,
+        &mut open_output_file(&out_file_name)?,
     )
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::ALL_REPEATED)
-                .short('D')
-                .long(options::ALL_REPEATED)
-                .value_parser([
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::ALL_REPEATED)
+                .short('D')
+                .long(options::ALL_REPEATED)
+                .value_parser([
                     "none",
                     "prepend",
-                    "separate"
-                ])
-                .help("print all duplicate lines. Delimiting is done with blank lines. [default: none]")
-                .value_name("delimit-method")
-                .num_args(0..=1)
-                .default_missing_value("none")
-                .require_equals(true),
+                    "separate"
+                ])
+                .help("print all duplicate lines. Delimiting is done with blank lines. [default: none]")
+                .value_name("delimit-method")
+                .num_args(0..=1)
+                .default_missing_value("none")
+                .require_equals(true),
         )
-        .arg(
-            Arg::new(options::GROUP)
-                .long(options::GROUP)
-                .value_parser([
+        .arg(
+            Arg::new(options::GROUP)
+                .long(options::GROUP)
+                .value_parser([
                     "separate",
                     "prepend",
                     "append",
                     "both",
                 ])
-                .help("show all items, separating groups with an empty line. [default: separate]")
-                .value_name("group-method")
-                .num_args(0..=1)
-                .default_missing_value("separate")
-                .require_equals(true)
-                .conflicts_with_all([
-                    options::REPEATED,
-                    options::ALL_REPEATED,
-                    options::UNIQUE,
+                .help("show all items, separating groups with an empty line. [default: separate]")
+                .value_name("group-method")
+                .num_args(0..=1)
+                .default_missing_value("separate")
+                .require_equals(true)
+                .conflicts_with_all([
+                    options::REPEATED,
+                    options::ALL_REPEATED,
+                    options::UNIQUE,
                 ]),
         )
-        .arg(
-            Arg::new(options::CHECK_CHARS)
-                .short('w')
-                .long(options::CHECK_CHARS)
-                .help("compare no more than N characters in lines")
-                .value_name("N"),
+        .arg(
+            Arg::new(options::CHECK_CHARS)
+                .short('w')
+                .long(options::CHECK_CHARS)
+                .help("compare no more than N characters in lines")
+                .value_name("N"),
         )
-        .arg(
-            Arg::new(options::COUNT)
-                .short('c')
-                .long(options::COUNT)
-                .help("prefix lines by the number of occurrences")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::COUNT)
+                .short('c')
+                .long(options::COUNT)
+                .help("prefix lines by the number of occurrences")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::IGNORE_CASE)
-                .short('i')
-                .long(options::IGNORE_CASE)
-                .help("ignore differences in case when comparing")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::IGNORE_CASE)
+                .short('i')
+                .long(options::IGNORE_CASE)
+                .help("ignore differences in case when comparing")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::REPEATED)
-                .short('d')
-                .long(options::REPEATED)
-                .help("only print duplicate lines")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::REPEATED)
+                .short('d')
+                .long(options::REPEATED)
+                .help("only print duplicate lines")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SKIP_CHARS)
-                .short('s')
-                .long(options::SKIP_CHARS)
-                .help("avoid comparing the first N characters")
-                .value_name("N"),
+        .arg(
+            Arg::new(options::SKIP_CHARS)
+                .short('s')
+                .long(options::SKIP_CHARS)
+                .help("avoid comparing the first N characters")
+                .value_name("N"),
         )
-        .arg(
-            Arg::new(options::SKIP_FIELDS)
-                .short('f')
-                .long(options::SKIP_FIELDS)
-                .help("avoid comparing the first N fields")
-                .value_name("N"),
+        .arg(
+            Arg::new(options::SKIP_FIELDS)
+                .short('f')
+                .long(options::SKIP_FIELDS)
+                .help("avoid comparing the first N fields")
+                .value_name("N"),
         )
-        .arg(
-            Arg::new(options::UNIQUE)
-                .short('u')
-                .long(options::UNIQUE)
-                .help("only print unique lines")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::UNIQUE)
+                .short('u')
+                .long(options::UNIQUE)
+                .help("only print unique lines")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ZERO_TERMINATED)
-                .short('z')
-                .long(options::ZERO_TERMINATED)
-                .help("end lines with 0 byte, not newline")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ZERO_TERMINATED)
+                .short('z')
+                .long(options::ZERO_TERMINATED)
+                .help("end lines with 0 byte, not newline")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .num_args(0..=2)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .num_args(0..=2)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-fn get_delimiter(matches: &ArgMatches) -> Delimiters {
-    let value = matches
-        .get_one::<String>(options::ALL_REPEATED)
-        .or_else(|| matches.get_one::<String>(options::GROUP));
-    if let Some(delimiter_arg) = value {
-        Delimiters::from_str(delimiter_arg).unwrap() // All possible values for ALL_REPEATED are Delimiters (of type `&str`)
-    } else if matches.contains_id(options::GROUP) {
-        Delimiters::Separate
-    } else {
-        Delimiters::None
+fn get_delimiter(matches: &ArgMatches) -> Delimiters {
+    let value = matches
+        .get_one::<String>(options::ALL_REPEATED)
+        .or_else(|| matches.get_one::<String>(options::GROUP));
+    if let Some(delimiter_arg) = value {
+        Delimiters::from_str(delimiter_arg).unwrap() // All possible values for ALL_REPEATED are Delimiters (of type `&str`)
+    } else if matches.contains_id(options::GROUP) {
+        Delimiters::Separate
+    } else {
+        Delimiters::None
     }
 }
 
-fn open_input_file(in_file_name: &str) -> UResult<BufReader<Box<dyn Read + 'static>>> {
-    let in_file = if in_file_name == "-" {
-        Box::new(stdin()) as Box<dyn Read>
-    } else {
-        let path = Path::new(in_file_name);
-        let in_file = File::open(path)
-            .map_err_context(|| format!("Could not open {}", in_file_name.maybe_quote()))?;
-        Box::new(in_file) as Box<dyn Read>
+fn open_input_file(in_file_name: &str) -> UResult<BufReader<Box<dyn Read + 'static>>> {
+    let in_file = if in_file_name == "-" {
+        Box::new(stdin()) as Box<dyn Read>
+    } else {
+        let path = Path::new(in_file_name);
+        let in_file = File::open(path)
+            .map_err_context(|| format!("Could not open {}", in_file_name.maybe_quote()))?;
+        Box::new(in_file) as Box<dyn Read>
     };
-    Ok(BufReader::new(in_file))
+    Ok(BufReader::new(in_file))
 }
 
-fn open_output_file(out_file_name: &str) -> UResult<BufWriter<Box<dyn Write + 'static>>> {
-    let out_file = if out_file_name == "-" {
-        Box::new(stdout()) as Box<dyn Write>
-    } else {
-        let path = Path::new(out_file_name);
-        let out_file = File::create(path)
-            .map_err_context(|| format!("Could not create {}", out_file_name.maybe_quote()))?;
-        Box::new(out_file) as Box<dyn Write>
+fn open_output_file(out_file_name: &str) -> UResult<BufWriter<Box<dyn Write + 'static>>> {
+    let out_file = if out_file_name == "-" {
+        Box::new(stdout()) as Box<dyn Write>
+    } else {
+        let path = Path::new(out_file_name);
+        let out_file = File::create(path)
+            .map_err_context(|| format!("Could not create {}", out_file_name.maybe_quote()))?;
+        Box::new(out_file) as Box<dyn Write>
     };
-    Ok(BufWriter::new(out_file))
+    Ok(BufWriter::new(out_file))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_unlink/unlink.rs.html b/dev/src/uu_unlink/unlink.rs.html index 485010ece..22f8faa70 100644 --- a/dev/src/uu_unlink/unlink.rs.html +++ b/dev/src/uu_unlink/unlink.rs.html @@ -1,4 +1,4 @@ -unlink.rs - source
1
+unlink.rs - source
1
 2
 3
 4
@@ -42,49 +42,49 @@
 42
 43
 44
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Colin Warren <me@zv.ms>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Colin Warren <me@zv.ms>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-/* last synced with: unlink (GNU coreutils) 8.21 */
+/* last synced with: unlink (GNU coreutils) 8.21 */
 
-use std::ffi::OsString;
-use std::fs::remove_file;
-use std::path::Path;
+use std::ffi::OsString;
+use std::fs::remove_file;
+use std::path::Path;
 
-use clap::builder::ValueParser;
-use clap::{crate_version, Arg, Command};
+use clap::builder::ValueParser;
+use clap::{crate_version, Arg, Command};
 
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult};
 
-static ABOUT: &str = "Unlink the file at FILE.";
-static OPT_PATH: &str = "FILE";
+static ABOUT: &str = "Unlink the file at FILE.";
+static OPT_PATH: &str = "FILE";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let path: &Path = matches.get_one::<OsString>(OPT_PATH).unwrap().as_ref();
+    let path: &Path = matches.get_one::<OsString>(OPT_PATH).unwrap().as_ref();
 
-    remove_file(path).map_err_context(|| format!("cannot unlink {}", path.quote()))
+    remove_file(path).map_err_context(|| format!("cannot unlink {}", path.quote()))
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .infer_long_args(true)
-        .arg(
-            Arg::new(OPT_PATH)
-                .required(true)
-                .hide(true)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::AnyPath),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .infer_long_args(true)
+        .arg(
+            Arg::new(OPT_PATH)
+                .required(true)
+                .hide(true)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::AnyPath),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_uptime/uptime.rs.html b/dev/src/uu_uptime/uptime.rs.html index 56f18613f..da2c29105 100644 --- a/dev/src/uu_uptime/uptime.rs.html +++ b/dev/src/uu_uptime/uptime.rs.html @@ -1,4 +1,4 @@ -uptime.rs - source
1
+uptime.rs - source
1
 2
 3
 4
@@ -182,189 +182,189 @@
 182
 183
 184
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Jordi Boggiano <j.boggiano@seld.be>
-//  * (c) Jian Zeng <anonymousknight86@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Jordi Boggiano <j.boggiano@seld.be>
+//  * (c) Jian Zeng <anonymousknight86@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) getloadavg upsecs updays nusers loadavg boottime uphours upmins
+// spell-checker:ignore (ToDO) getloadavg upsecs updays nusers loadavg boottime uphours upmins
 
-use chrono::{Local, TimeZone, Utc};
-use clap::{crate_version, Arg, ArgAction, Command};
+use chrono::{Local, TimeZone, Utc};
+use clap::{crate_version, Arg, ArgAction, Command};
 
-use uucore::format_usage;
-// import crate time from utmpx
-pub use uucore::libc;
-use uucore::libc::time_t;
+use uucore::format_usage;
+// import crate time from utmpx
+pub use uucore::libc;
+use uucore::libc::time_t;
 
-use uucore::error::{UResult, USimpleError};
+use uucore::error::{UResult, USimpleError};
 
-static ABOUT: &str = "Display the current time, the length of time the system has been up,\n\
+static ABOUT: &str = "Display the current time, the length of time the system has been up,\n\
                       the number of users on the system, and the average number of jobs\n\
                       in the run queue over the last 1, 5 and 15 minutes.";
-const USAGE: &str = "{} [OPTION]...";
-pub mod options {
-    pub static SINCE: &str = "since";
+const USAGE: &str = "{} [OPTION]...";
+pub mod options {
+    pub static SINCE: &str = "since";
 }
 
-#[cfg(unix)]
-use uucore::libc::getloadavg;
+#[cfg(unix)]
+use uucore::libc::getloadavg;
 
-#[cfg(windows)]
-extern "C" {
-    fn GetTickCount() -> uucore::libc::uint32_t;
+#[cfg(windows)]
+extern "C" {
+    fn GetTickCount() -> uucore::libc::uint32_t;
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let (boot_time, user_count) = process_utmpx();
-    let uptime = get_uptime(boot_time);
-    if uptime < 0 {
-        Err(USimpleError::new(1, "could not retrieve system uptime"))
-    } else {
-        if matches.get_flag(options::SINCE) {
-            let initial_date = Local.timestamp(Utc::now().timestamp() - uptime, 0);
-            println!("{}", initial_date.format("%Y-%m-%d %H:%M:%S"));
-            return Ok(());
+    let (boot_time, user_count) = process_utmpx();
+    let uptime = get_uptime(boot_time);
+    if uptime < 0 {
+        Err(USimpleError::new(1, "could not retrieve system uptime"))
+    } else {
+        if matches.get_flag(options::SINCE) {
+            let initial_date = Local.timestamp(Utc::now().timestamp() - uptime, 0);
+            println!("{}", initial_date.format("%Y-%m-%d %H:%M:%S"));
+            return Ok(());
         }
 
-        print_time();
-        let upsecs = uptime;
-        print_uptime(upsecs);
-        print_nusers(user_count);
-        print_loadavg();
+        print_time();
+        let upsecs = uptime;
+        print_uptime(upsecs);
+        print_nusers(user_count);
+        print_loadavg();
 
         Ok(())
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::SINCE)
-                .short('s')
-                .long(options::SINCE)
-                .help("system up since")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::SINCE)
+                .short('s')
+                .long(options::SINCE)
+                .help("system up since")
+                .action(ArgAction::SetTrue),
         )
 }
 
-#[cfg(unix)]
-fn print_loadavg() {
-    use uucore::libc::c_double;
+#[cfg(unix)]
+fn print_loadavg() {
+    use uucore::libc::c_double;
 
-    let mut avg: [c_double; 3] = [0.0; 3];
-    let loads: i32 = unsafe { getloadavg(avg.as_mut_ptr(), 3) };
+    let mut avg: [c_double; 3] = [0.0; 3];
+    let loads: i32 = unsafe { getloadavg(avg.as_mut_ptr(), 3) };
 
-    if loads == -1 {
+    if loads == -1 {
         println!();
-    } else {
+    } else {
         print!("load average: ");
-        for n in 0..loads {
+        for n in 0..loads {
             print!(
                 "{:.2}{}",
-                avg[n as usize],
-                if n == loads - 1 { "\n" } else { ", " }
+                avg[n as usize],
+                if n == loads - 1 { "\n" } else { ", " }
             );
         }
     }
 }
 
-#[cfg(windows)]
-fn print_loadavg() {
-    // XXX: currently this is a noop as Windows does not seem to have anything comparable to
-    //      getloadavg()
-}
+#[cfg(windows)]
+fn print_loadavg() {
+    // XXX: currently this is a noop as Windows does not seem to have anything comparable to
+    //      getloadavg()
+}
 
-#[cfg(unix)]
-fn process_utmpx() -> (Option<time_t>, usize) {
-    use uucore::utmpx::*;
+#[cfg(unix)]
+fn process_utmpx() -> (Option<time_t>, usize) {
+    use uucore::utmpx::*;
 
-    let mut nusers = 0;
-    let mut boot_time = None;
+    let mut nusers = 0;
+    let mut boot_time = None;
 
-    for line in Utmpx::iter_all_records() {
-        match line.record_type() {
-            USER_PROCESS => nusers += 1,
-            BOOT_TIME => {
-                let dt = line.login_time();
-                if dt.second() > 0 {
-                    boot_time = Some(dt.second() as time_t);
+    for line in Utmpx::iter_all_records() {
+        match line.record_type() {
+            USER_PROCESS => nusers += 1,
+            BOOT_TIME => {
+                let dt = line.login_time();
+                if dt.second() > 0 {
+                    boot_time = Some(dt.second() as time_t);
                 }
             }
-            _ => continue,
+            _ => continue,
         }
     }
-    (boot_time, nusers)
+    (boot_time, nusers)
 }
 
-#[cfg(windows)]
-fn process_utmpx() -> (Option<time_t>, usize) {
-    (None, 0) // TODO: change 0 to number of users
-}
+#[cfg(windows)]
+fn process_utmpx() -> (Option<time_t>, usize) {
+    (None, 0) // TODO: change 0 to number of users
+}
 
-fn print_nusers(nusers: usize) {
-    match nusers.cmp(&1) {
-        std::cmp::Ordering::Equal => print!("1 user,  "),
-        std::cmp::Ordering::Greater => print!("{} users,  ", nusers),
-        _ => {}
+fn print_nusers(nusers: usize) {
+    match nusers.cmp(&1) {
+        std::cmp::Ordering::Equal => print!("1 user,  "),
+        std::cmp::Ordering::Greater => print!("{} users,  ", nusers),
+        _ => {}
     };
 }
 
-fn print_time() {
-    let local_time = Local::now().time();
+fn print_time() {
+    let local_time = Local::now().time();
 
-    print!(" {} ", local_time.format("%H:%M:%S"));
+    print!(" {} ", local_time.format("%H:%M:%S"));
 }
 
-#[cfg(unix)]
-fn get_uptime(boot_time: Option<time_t>) -> i64 {
-    use std::fs::File;
-    use std::io::Read;
+#[cfg(unix)]
+fn get_uptime(boot_time: Option<time_t>) -> i64 {
+    use std::fs::File;
+    use std::io::Read;
 
-    let mut proc_uptime_s = String::new();
+    let mut proc_uptime_s = String::new();
 
-    let proc_uptime = File::open("/proc/uptime")
-        .ok()
-        .and_then(|mut f| f.read_to_string(&mut proc_uptime_s).ok())
-        .and_then(|_| proc_uptime_s.split_whitespace().next())
-        .and_then(|s| s.split('.').next().unwrap_or("0").parse().ok());
+    let proc_uptime = File::open("/proc/uptime")
+        .ok()
+        .and_then(|mut f| f.read_to_string(&mut proc_uptime_s).ok())
+        .and_then(|_| proc_uptime_s.split_whitespace().next())
+        .and_then(|s| s.split('.').next().unwrap_or("0").parse().ok());
 
-    proc_uptime.unwrap_or_else(|| match boot_time {
-        Some(t) => {
-            let now = Local::now().timestamp();
-            let boottime = t as i64;
-            now - boottime
+    proc_uptime.unwrap_or_else(|| match boot_time {
+        Some(t) => {
+            let now = Local::now().timestamp();
+            let boottime = t as i64;
+            now - boottime
         }
-        None => -1,
+        None => -1,
     })
 }
 
-#[cfg(windows)]
-fn get_uptime(_boot_time: Option<time_t>) -> i64 {
-    unsafe { GetTickCount() as i64 }
+#[cfg(windows)]
+fn get_uptime(_boot_time: Option<time_t>) -> i64 {
+    unsafe { GetTickCount() as i64 }
 }
 
-fn print_uptime(upsecs: i64) {
-    let updays = upsecs / 86400;
-    let uphours = (upsecs - (updays * 86400)) / 3600;
-    let upmins = (upsecs - (updays * 86400) - (uphours * 3600)) / 60;
-    match updays.cmp(&1) {
-        std::cmp::Ordering::Equal => print!("up {:1} day, {:2}:{:02},  ", updays, uphours, upmins),
-        std::cmp::Ordering::Greater => {
-            print!("up {:1} days, {:2}:{:02},  ", updays, uphours, upmins);
+fn print_uptime(upsecs: i64) {
+    let updays = upsecs / 86400;
+    let uphours = (upsecs - (updays * 86400)) / 3600;
+    let upmins = (upsecs - (updays * 86400) - (uphours * 3600)) / 60;
+    match updays.cmp(&1) {
+        std::cmp::Ordering::Equal => print!("up {:1} day, {:2}:{:02},  ", updays, uphours, upmins),
+        std::cmp::Ordering::Greater => {
+            print!("up {:1} days, {:2}:{:02},  ", updays, uphours, upmins);
         }
-        _ => print!("up  {:2}:{:02}, ", uphours, upmins),
+        _ => print!("up  {:2}:{:02}, ", uphours, upmins),
     };
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_users/users.rs.html b/dev/src/uu_users/users.rs.html index 88401d4dc..07018827c 100644 --- a/dev/src/uu_users/users.rs.html +++ b/dev/src/uu_users/users.rs.html @@ -1,4 +1,4 @@ -users.rs - source
1
+users.rs - source
1
 2
 3
 4
@@ -73,80 +73,80 @@
 73
 74
 75
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) KokaKiwi <kokakiwi@kokakiwi.net>
-//  * (c) Jian Zeng <anonymousknight86@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) KokaKiwi <kokakiwi@kokakiwi.net>
+//  * (c) Jian Zeng <anonymousknight86@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (paths) wtmp
+// spell-checker:ignore (paths) wtmp
 
-use std::ffi::OsString;
-use std::path::Path;
+use std::ffi::OsString;
+use std::path::Path;
 
-use clap::builder::ValueParser;
-use clap::{crate_version, Arg, Command};
-use uucore::error::UResult;
-use uucore::format_usage;
-use uucore::utmpx::{self, Utmpx};
+use clap::builder::ValueParser;
+use clap::{crate_version, Arg, Command};
+use uucore::error::UResult;
+use uucore::format_usage;
+use uucore::utmpx::{self, Utmpx};
 
-static ABOUT: &str = "Print the user names of users currently logged in to the current host";
-const USAGE: &str = "{} [FILE]";
+static ABOUT: &str = "Print the user names of users currently logged in to the current host";
+const USAGE: &str = "{} [FILE]";
 
-static ARG_FILES: &str = "files";
+static ARG_FILES: &str = "files";
 
-fn get_long_usage() -> String {
+fn get_long_usage() -> String {
     format!(
         "Output who is currently logged in according to FILE.
 If FILE is not specified, use {}.  /var/log/wtmp as FILE is common.",
-        utmpx::DEFAULT_FILE
+        utmpx::DEFAULT_FILE
     )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)?;
 
-    let files: Vec<&Path> = matches
-        .get_many::<OsString>(ARG_FILES)
-        .map(|v| v.map(AsRef::as_ref).collect())
-        .unwrap_or_default();
+    let files: Vec<&Path> = matches
+        .get_many::<OsString>(ARG_FILES)
+        .map(|v| v.map(AsRef::as_ref).collect())
+        .unwrap_or_default();
 
-    let filename = if !files.is_empty() {
-        files[0]
-    } else {
-        utmpx::DEFAULT_FILE.as_ref()
+    let filename = if !files.is_empty() {
+        files[0]
+    } else {
+        utmpx::DEFAULT_FILE.as_ref()
     };
 
-    let mut users = Utmpx::iter_all_records_from(filename)
-        .filter(Utmpx::is_user_process)
-        .map(|ut| ut.user())
-        .collect::<Vec<_>>();
+    let mut users = Utmpx::iter_all_records_from(filename)
+        .filter(Utmpx::is_user_process)
+        .map(|ut| ut.user())
+        .collect::<Vec<_>>();
 
-    if !users.is_empty() {
-        users.sort();
-        println!("{}", users.join(" "));
+    if !users.is_empty() {
+        users.sort();
+        println!("{}", users.join(" "));
     }
 
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(ARG_FILES)
-                .num_args(1)
-                .value_hint(clap::ValueHint::FilePath)
-                .value_parser(ValueParser::os_string()),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(ARG_FILES)
+                .num_args(1)
+                .value_hint(clap::ValueHint::FilePath)
+                .value_parser(ValueParser::os_string()),
         )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_vdir/vdir.rs.html b/dev/src/uu_vdir/vdir.rs.html index 87275035d..ec89def30 100644 --- a/dev/src/uu_vdir/vdir.rs.html +++ b/dev/src/uu_vdir/vdir.rs.html @@ -1,4 +1,4 @@ -vdir.rs - source
1
+vdir.rs - source
1
 2
 3
 4
@@ -67,74 +67,74 @@
 67
 68
 69
-
// * This file is part of the uutils coreutils package.
-// *
-// * (c) gmnsii <gmnsii@protonmail.com>
-// *
-// * For the full copyright and license information, please view the LICENSE file
-// * that was distributed with this source code.
+
// * This file is part of the uutils coreutils package.
+// *
+// * (c) gmnsii <gmnsii@protonmail.com>
+// *
+// * For the full copyright and license information, please view the LICENSE file
+// * that was distributed with this source code.
 
-use clap::Command;
-use std::ffi::OsString;
-use std::path::Path;
-use uu_ls::{options, Config, Format};
-use uucore::error::UResult;
-use uucore::quoting_style::{Quotes, QuotingStyle};
+use clap::Command;
+use std::ffi::OsString;
+use std::path::Path;
+use uu_ls::{options, Config, Format};
+use uucore::error::UResult;
+use uucore::quoting_style::{Quotes, QuotingStyle};
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let command = uu_app();
-    let matches = command.get_matches_from(args);
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let command = uu_app();
+    let matches = command.get_matches_from(args);
 
-    let mut default_quoting_style = false;
-    let mut default_format_style = false;
+    let mut default_quoting_style = false;
+    let mut default_format_style = false;
 
-    // We check if any options on formatting or quoting style have been given.
-    // If not, we will use dir default formatting and quoting style options
+    // We check if any options on formatting or quoting style have been given.
+    // If not, we will use dir default formatting and quoting style options
 
-    if !matches.contains_id(options::QUOTING_STYLE)
-        && !matches.get_flag(options::quoting::C)
-        && !matches.get_flag(options::quoting::ESCAPE)
-        && !matches.get_flag(options::quoting::LITERAL)
+    if !matches.contains_id(options::QUOTING_STYLE)
+        && !matches.get_flag(options::quoting::C)
+        && !matches.get_flag(options::quoting::ESCAPE)
+        && !matches.get_flag(options::quoting::LITERAL)
     {
-        default_quoting_style = true;
+        default_quoting_style = true;
     }
-    if !matches.contains_id(options::FORMAT)
-        && !matches.get_flag(options::format::ACROSS)
-        && !matches.get_flag(options::format::COLUMNS)
-        && !matches.get_flag(options::format::COMMAS)
-        && !matches.get_flag(options::format::LONG)
-        && !matches.get_flag(options::format::LONG_NO_GROUP)
-        && !matches.get_flag(options::format::LONG_NO_OWNER)
-        && !matches.get_flag(options::format::LONG_NUMERIC_UID_GID)
-        && !matches.get_flag(options::format::ONE_LINE)
+    if !matches.contains_id(options::FORMAT)
+        && !matches.get_flag(options::format::ACROSS)
+        && !matches.get_flag(options::format::COLUMNS)
+        && !matches.get_flag(options::format::COMMAS)
+        && !matches.get_flag(options::format::LONG)
+        && !matches.get_flag(options::format::LONG_NO_GROUP)
+        && !matches.get_flag(options::format::LONG_NO_OWNER)
+        && !matches.get_flag(options::format::LONG_NUMERIC_UID_GID)
+        && !matches.get_flag(options::format::ONE_LINE)
     {
-        default_format_style = true;
+        default_format_style = true;
     }
 
-    let mut config = Config::from(&matches)?;
+    let mut config = Config::from(&matches)?;
 
-    if default_quoting_style {
-        config.quoting_style = QuotingStyle::C {
-            quotes: Quotes::None,
+    if default_quoting_style {
+        config.quoting_style = QuotingStyle::C {
+            quotes: Quotes::None,
         };
     }
-    if default_format_style {
-        config.format = Format::Long;
+    if default_format_style {
+        config.format = Format::Long;
     }
 
-    let locs = matches
-        .get_many::<OsString>(options::PATHS)
-        .map(|v| v.map(Path::new).collect())
-        .unwrap_or_else(|| vec![Path::new(".")]);
-    uu_ls::list(locs, &config)
+    let locs = matches
+        .get_many::<OsString>(options::PATHS)
+        .map(|v| v.map(Path::new).collect())
+        .unwrap_or_else(|| vec![Path::new(".")]);
+    uu_ls::list(locs, &config)
 }
 
-// To avoid code duplication, we reuse ls uu_app function which has the same
-// arguments. However, coreutils won't compile if one of the utils is missing
-// an uu_app function, so we need this dummy one.
-pub fn uu_app() -> Command {
-    uu_ls::uu_app()
+// To avoid code duplication, we reuse ls uu_app function which has the same
+// arguments. However, coreutils won't compile if one of the utils is missing
+// an uu_app function, so we need this dummy one.
+pub fn uu_app() -> Command {
+    uu_ls::uu_app()
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_wc/count_fast.rs.html b/dev/src/uu_wc/count_fast.rs.html index 29b2da82b..24e420c44 100644 --- a/dev/src/uu_wc/count_fast.rs.html +++ b/dev/src/uu_wc/count_fast.rs.html @@ -1,4 +1,4 @@ -count_fast.rs - source
1
+count_fast.rs - source
1
 2
 3
 4
@@ -161,168 +161,168 @@
 161
 162
 163
-
use crate::word_count::WordCount;
+
use crate::word_count::WordCount;
 
-use super::WordCountable;
+use super::WordCountable;
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use std::fs::OpenOptions;
-use std::io::{self, ErrorKind, Read};
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use std::fs::OpenOptions;
+use std::io::{self, ErrorKind, Read};
 
-#[cfg(unix)]
-use libc::S_IFREG;
-#[cfg(unix)]
-use nix::sys::stat;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use std::os::unix::io::AsRawFd;
+#[cfg(unix)]
+use libc::S_IFREG;
+#[cfg(unix)]
+use nix::sys::stat;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use std::os::unix::io::AsRawFd;
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use libc::S_IFIFO;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use uucore::pipes::{pipe, splice, splice_exact};
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use libc::S_IFIFO;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use uucore::pipes::{pipe, splice, splice_exact};
 
-const BUF_SIZE: usize = 16 * 1024;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-const SPLICE_SIZE: usize = 128 * 1024;
+const BUF_SIZE: usize = 16 * 1024;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+const SPLICE_SIZE: usize = 128 * 1024;
 
-/// This is a Linux-specific function to count the number of bytes using the
-/// `splice` system call, which is faster than using `read`.
-///
-/// On error it returns the number of bytes it did manage to read, since the
-/// caller will fall back to a simpler method.
-#[inline]
-#[cfg(any(target_os = "linux", target_os = "android"))]
-fn count_bytes_using_splice(fd: &impl AsRawFd) -> Result<usize, usize> {
-    let null_file = OpenOptions::new()
-        .write(true)
-        .open("/dev/null")
-        .map_err(|_| 0_usize)?;
-    let null_rdev = stat::fstat(null_file.as_raw_fd())
-        .map_err(|_| 0_usize)?
-        .st_rdev as libc::dev_t;
-    if unsafe { (libc::major(null_rdev), libc::minor(null_rdev)) } != (1, 3) {
-        // This is not a proper /dev/null, writing to it is probably bad
-        // Bit of an edge case, but it has been known to happen
-        return Err(0);
+/// This is a Linux-specific function to count the number of bytes using the
+/// `splice` system call, which is faster than using `read`.
+///
+/// On error it returns the number of bytes it did manage to read, since the
+/// caller will fall back to a simpler method.
+#[inline]
+#[cfg(any(target_os = "linux", target_os = "android"))]
+fn count_bytes_using_splice(fd: &impl AsRawFd) -> Result<usize, usize> {
+    let null_file = OpenOptions::new()
+        .write(true)
+        .open("/dev/null")
+        .map_err(|_| 0_usize)?;
+    let null_rdev = stat::fstat(null_file.as_raw_fd())
+        .map_err(|_| 0_usize)?
+        .st_rdev as libc::dev_t;
+    if unsafe { (libc::major(null_rdev), libc::minor(null_rdev)) } != (1, 3) {
+        // This is not a proper /dev/null, writing to it is probably bad
+        // Bit of an edge case, but it has been known to happen
+        return Err(0);
     }
-    let (pipe_rd, pipe_wr) = pipe().map_err(|_| 0_usize)?;
+    let (pipe_rd, pipe_wr) = pipe().map_err(|_| 0_usize)?;
 
-    let mut byte_count = 0;
-    loop {
-        match splice(fd, &pipe_wr, SPLICE_SIZE) {
+    let mut byte_count = 0;
+    loop {
+        match splice(fd, &pipe_wr, SPLICE_SIZE) {
             Ok(0) => break,
-            Ok(res) => {
-                byte_count += res;
-                // Silent the warning as we want to the error message
-                #[allow(clippy::question_mark)]
-                if splice_exact(&pipe_rd, &null_file, res).is_err() {
-                    return Err(byte_count);
+            Ok(res) => {
+                byte_count += res;
+                // Silent the warning as we want to the error message
+                #[allow(clippy::question_mark)]
+                if splice_exact(&pipe_rd, &null_file, res).is_err() {
+                    return Err(byte_count);
                 }
             }
-            Err(_) => return Err(byte_count),
+            Err(_) => return Err(byte_count),
         };
     }
 
-    Ok(byte_count)
+    Ok(byte_count)
 }
 
-/// In the special case where we only need to count the number of bytes. There
-/// are several optimizations we can do:
-///   1. On Unix,  we can simply `stat` the file if it is regular.
-///   2. On Linux -- if the above did not work -- we can use splice to count
-///      the number of bytes if the file is a FIFO.
-///   3. Otherwise, we just read normally, but without the overhead of counting
-///      other things such as lines and words.
-#[inline]
-pub(crate) fn count_bytes_fast<T: WordCountable>(handle: &mut T) -> (usize, Option<io::Error>) {
-    let mut byte_count = 0;
+/// In the special case where we only need to count the number of bytes. There
+/// are several optimizations we can do:
+///   1. On Unix,  we can simply `stat` the file if it is regular.
+///   2. On Linux -- if the above did not work -- we can use splice to count
+///      the number of bytes if the file is a FIFO.
+///   3. Otherwise, we just read normally, but without the overhead of counting
+///      other things such as lines and words.
+#[inline]
+pub(crate) fn count_bytes_fast<T: WordCountable>(handle: &mut T) -> (usize, Option<io::Error>) {
+    let mut byte_count = 0;
 
-    #[cfg(unix)]
-    {
-        let fd = handle.as_raw_fd();
-        if let Ok(stat) = stat::fstat(fd) {
-            // If the file is regular, then the `st_size` should hold
-            // the file's size in bytes.
-            // If stat.st_size = 0 then
-            //  - either the size is 0
-            //  - or the size is unknown.
-            // The second case happens for files in pseudo-filesystems. For
-            // example with /proc/version and /sys/kernel/profiling. So,
-            // if it is 0 we don't report that and instead do a full read.
-            if (stat.st_mode as libc::mode_t & S_IFREG) != 0 && stat.st_size > 0 {
-                return (stat.st_size as usize, None);
+    #[cfg(unix)]
+    {
+        let fd = handle.as_raw_fd();
+        if let Ok(stat) = stat::fstat(fd) {
+            // If the file is regular, then the `st_size` should hold
+            // the file's size in bytes.
+            // If stat.st_size = 0 then
+            //  - either the size is 0
+            //  - or the size is unknown.
+            // The second case happens for files in pseudo-filesystems. For
+            // example with /proc/version and /sys/kernel/profiling. So,
+            // if it is 0 we don't report that and instead do a full read.
+            if (stat.st_mode as libc::mode_t & S_IFREG) != 0 && stat.st_size > 0 {
+                return (stat.st_size as usize, None);
             }
-            #[cfg(any(target_os = "linux", target_os = "android"))]
-            {
-                // Else, if we're on Linux and our file is a FIFO pipe
-                // (or stdin), we use splice to count the number of bytes.
-                if (stat.st_mode as libc::mode_t & S_IFIFO) != 0 {
-                    match count_bytes_using_splice(handle) {
-                        Ok(n) => return (n, None),
-                        Err(n) => byte_count = n,
+            #[cfg(any(target_os = "linux", target_os = "android"))]
+            {
+                // Else, if we're on Linux and our file is a FIFO pipe
+                // (or stdin), we use splice to count the number of bytes.
+                if (stat.st_mode as libc::mode_t & S_IFIFO) != 0 {
+                    match count_bytes_using_splice(handle) {
+                        Ok(n) => return (n, None),
+                        Err(n) => byte_count = n,
                     }
                 }
             }
         }
     }
 
-    // Fall back on `read`, but without the overhead of counting words and lines.
-    let mut buf = [0_u8; BUF_SIZE];
-    loop {
-        match handle.read(&mut buf) {
-            Ok(0) => return (byte_count, None),
-            Ok(n) => {
-                byte_count += n;
+    // Fall back on `read`, but without the overhead of counting words and lines.
+    let mut buf = [0_u8; BUF_SIZE];
+    loop {
+        match handle.read(&mut buf) {
+            Ok(0) => return (byte_count, None),
+            Ok(n) => {
+                byte_count += n;
             }
-            Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,
-            Err(e) => return (byte_count, Some(e)),
+            Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,
+            Err(e) => return (byte_count, Some(e)),
         }
     }
 }
 
-/// Returns a WordCount that counts the number of bytes, lines, and/or the number of Unicode characters encoded in UTF-8 read via a Reader.
-///
-/// This corresponds to the `-c`, `-l` and `-m` command line flags to wc.
-///
-/// # Arguments
-///
-/// * `R` - A Reader from which the UTF-8 stream will be read.
-pub(crate) fn count_bytes_chars_and_lines_fast<
-    R: Read,
-    const COUNT_BYTES: bool,
-    const COUNT_CHARS: bool,
-    const COUNT_LINES: bool,
->(
-    handle: &mut R,
-) -> (WordCount, Option<io::Error>) {
-    /// Mask of the value bits of a continuation byte
-    const CONT_MASK: u8 = 0b0011_1111u8;
-    /// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte
-    const TAG_CONT_U8: u8 = 0b1000_0000u8;
+/// Returns a WordCount that counts the number of bytes, lines, and/or the number of Unicode characters encoded in UTF-8 read via a Reader.
+///
+/// This corresponds to the `-c`, `-l` and `-m` command line flags to wc.
+///
+/// # Arguments
+///
+/// * `R` - A Reader from which the UTF-8 stream will be read.
+pub(crate) fn count_bytes_chars_and_lines_fast<
+    R: Read,
+    const COUNT_BYTES: bool,
+    const COUNT_CHARS: bool,
+    const COUNT_LINES: bool,
+>(
+    handle: &mut R,
+) -> (WordCount, Option<io::Error>) {
+    /// Mask of the value bits of a continuation byte
+    const CONT_MASK: u8 = 0b0011_1111u8;
+    /// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte
+    const TAG_CONT_U8: u8 = 0b1000_0000u8;
 
-    let mut total = WordCount::default();
-    let mut buf = [0; BUF_SIZE];
-    loop {
-        match handle.read(&mut buf) {
-            Ok(0) => return (total, None),
-            Ok(n) => {
-                if COUNT_BYTES {
-                    total.bytes += n;
+    let mut total = WordCount::default();
+    let mut buf = [0; BUF_SIZE];
+    loop {
+        match handle.read(&mut buf) {
+            Ok(0) => return (total, None),
+            Ok(n) => {
+                if COUNT_BYTES {
+                    total.bytes += n;
                 }
-                if COUNT_CHARS {
-                    total.chars += buf[..n]
-                        .iter()
-                        .filter(|&&byte| (byte & !CONT_MASK) != TAG_CONT_U8)
-                        .count();
+                if COUNT_CHARS {
+                    total.chars += buf[..n]
+                        .iter()
+                        .filter(|&&byte| (byte & !CONT_MASK) != TAG_CONT_U8)
+                        .count();
                 }
-                if COUNT_LINES {
-                    total.lines += bytecount::count(&buf[..n], b'\n');
+                if COUNT_LINES {
+                    total.lines += bytecount::count(&buf[..n], b'\n');
                 }
             }
-            Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,
-            Err(e) => return (total, Some(e)),
+            Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,
+            Err(e) => return (total, Some(e)),
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_wc/countable.rs.html b/dev/src/uu_wc/countable.rs.html index 98f8ca746..c2853225c 100644 --- a/dev/src/uu_wc/countable.rs.html +++ b/dev/src/uu_wc/countable.rs.html @@ -1,4 +1,4 @@ -countable.rs - source
1
+countable.rs - source
1
 2
 3
 4
@@ -35,42 +35,42 @@
 35
 36
 37
-
//! Traits and implementations for iterating over lines in a file-like object.
-//!
-//! This module provides a [`WordCountable`] trait and implementations
-//! for some common file-like objects. Use the [`WordCountable::buffered`]
-//! method to get an iterator over lines of a file-like object.
-use std::fs::File;
-use std::io::{BufRead, BufReader, Read, StdinLock};
+
//! Traits and implementations for iterating over lines in a file-like object.
+//!
+//! This module provides a [`WordCountable`] trait and implementations
+//! for some common file-like objects. Use the [`WordCountable::buffered`]
+//! method to get an iterator over lines of a file-like object.
+use std::fs::File;
+use std::io::{BufRead, BufReader, Read, StdinLock};
 
-#[cfg(unix)]
-use std::os::unix::io::AsRawFd;
+#[cfg(unix)]
+use std::os::unix::io::AsRawFd;
 
-#[cfg(unix)]
-pub trait WordCountable: AsRawFd + Read {
-    type Buffered: BufRead;
-    fn buffered(self) -> Self::Buffered;
+#[cfg(unix)]
+pub trait WordCountable: AsRawFd + Read {
+    type Buffered: BufRead;
+    fn buffered(self) -> Self::Buffered;
 }
 
-#[cfg(not(unix))]
-pub trait WordCountable: Read {
-    type Buffered: BufRead;
-    fn buffered(self) -> Self::Buffered;
+#[cfg(not(unix))]
+pub trait WordCountable: Read {
+    type Buffered: BufRead;
+    fn buffered(self) -> Self::Buffered;
 }
 
-impl WordCountable for StdinLock<'_> {
-    type Buffered = Self;
+impl WordCountable for StdinLock<'_> {
+    type Buffered = Self;
 
-    fn buffered(self) -> Self::Buffered {
-        self
-    }
+    fn buffered(self) -> Self::Buffered {
+        self
+    }
 }
-impl WordCountable for File {
-    type Buffered = BufReader<Self>;
+impl WordCountable for File {
+    type Buffered = BufReader<Self>;
 
-    fn buffered(self) -> Self::Buffered {
-        BufReader::new(self)
+    fn buffered(self) -> Self::Buffered {
+        BufReader::new(self)
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_wc/wc.rs.html b/dev/src/uu_wc/wc.rs.html index 20ef3d5aa..5bf031f31 100644 --- a/dev/src/uu_wc/wc.rs.html +++ b/dev/src/uu_wc/wc.rs.html @@ -1,4 +1,4 @@ -wc.rs - source
1
+wc.rs - source
1
 2
 3
 4
@@ -654,661 +654,661 @@
 654
 655
 656
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Boden Garman <bpgarman@gmail.com>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Boden Garman <bpgarman@gmail.com>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// cSpell:ignore wc wc's
+// cSpell:ignore wc wc's
 
-#[macro_use]
-extern crate uucore;
+#[macro_use]
+extern crate uucore;
 
-mod count_fast;
-mod countable;
-mod word_count;
-use clap::builder::ValueParser;
-use count_fast::{count_bytes_chars_and_lines_fast, count_bytes_fast};
-use countable::WordCountable;
-use unicode_width::UnicodeWidthChar;
-use utf8::{BufReadDecoder, BufReadDecoderError};
-use uucore::format_usage;
-use word_count::{TitledWordCount, WordCount};
+mod count_fast;
+mod countable;
+mod word_count;
+use clap::builder::ValueParser;
+use count_fast::{count_bytes_chars_and_lines_fast, count_bytes_fast};
+use countable::WordCountable;
+use unicode_width::UnicodeWidthChar;
+use utf8::{BufReadDecoder, BufReadDecoderError};
+use uucore::format_usage;
+use word_count::{TitledWordCount, WordCount};
 
-use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
+use clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
 
-use std::cmp::max;
-use std::error::Error;
-use std::ffi::{OsStr, OsString};
-use std::fmt::Display;
-use std::fs::{self, File};
-use std::io::{self, Read, Write};
-use std::path::PathBuf;
+use std::cmp::max;
+use std::error::Error;
+use std::ffi::{OsStr, OsString};
+use std::fmt::Display;
+use std::fs::{self, File};
+use std::io::{self, Read, Write};
+use std::path::PathBuf;
 
-use uucore::error::{UError, UResult, USimpleError};
-use uucore::quoting_style::{escape_name, QuotingStyle};
+use uucore::error::{UError, UResult, USimpleError};
+use uucore::quoting_style::{escape_name, QuotingStyle};
 
-/// The minimum character width for formatting counts when reading from stdin.
-const MINIMUM_WIDTH: usize = 7;
+/// The minimum character width for formatting counts when reading from stdin.
+const MINIMUM_WIDTH: usize = 7;
 
-struct Settings {
-    show_bytes: bool,
-    show_chars: bool,
-    show_lines: bool,
-    show_words: bool,
-    show_max_line_length: bool,
-    files0_from_stdin_mode: bool,
-    title_quoting_style: QuotingStyle,
+struct Settings {
+    show_bytes: bool,
+    show_chars: bool,
+    show_lines: bool,
+    show_words: bool,
+    show_max_line_length: bool,
+    files0_from_stdin_mode: bool,
+    title_quoting_style: QuotingStyle,
 }
 
-impl Settings {
-    fn new(matches: &ArgMatches) -> Self {
-        let title_quoting_style = QuotingStyle::Shell {
-            escape: true,
-            always_quote: false,
-            show_control: false,
+impl Settings {
+    fn new(matches: &ArgMatches) -> Self {
+        let title_quoting_style = QuotingStyle::Shell {
+            escape: true,
+            always_quote: false,
+            show_control: false,
         };
 
-        let files0_from_stdin_mode = match matches.get_one::<String>(options::FILES0_FROM) {
-            Some(files_0_from) => files_0_from == STDIN_REPR,
-            None => false,
+        let files0_from_stdin_mode = match matches.get_one::<String>(options::FILES0_FROM) {
+            Some(files_0_from) => files_0_from == STDIN_REPR,
+            None => false,
         };
 
-        let settings = Self {
-            show_bytes: matches.get_flag(options::BYTES),
-            show_chars: matches.get_flag(options::CHAR),
-            show_lines: matches.get_flag(options::LINES),
-            show_words: matches.get_flag(options::WORDS),
-            show_max_line_length: matches.get_flag(options::MAX_LINE_LENGTH),
-            files0_from_stdin_mode,
-            title_quoting_style,
+        let settings = Self {
+            show_bytes: matches.get_flag(options::BYTES),
+            show_chars: matches.get_flag(options::CHAR),
+            show_lines: matches.get_flag(options::LINES),
+            show_words: matches.get_flag(options::WORDS),
+            show_max_line_length: matches.get_flag(options::MAX_LINE_LENGTH),
+            files0_from_stdin_mode,
+            title_quoting_style,
         };
 
-        if settings.show_bytes
-            || settings.show_chars
-            || settings.show_lines
-            || settings.show_words
-            || settings.show_max_line_length
+        if settings.show_bytes
+            || settings.show_chars
+            || settings.show_lines
+            || settings.show_words
+            || settings.show_max_line_length
         {
-            return settings;
+            return settings;
         }
 
-        Self {
-            show_bytes: true,
-            show_chars: false,
-            show_lines: true,
-            show_words: true,
-            show_max_line_length: false,
-            files0_from_stdin_mode,
-            title_quoting_style: settings.title_quoting_style,
+        Self {
+            show_bytes: true,
+            show_chars: false,
+            show_lines: true,
+            show_words: true,
+            show_max_line_length: false,
+            files0_from_stdin_mode,
+            title_quoting_style: settings.title_quoting_style,
         }
     }
 
-    fn number_enabled(&self) -> u32 {
-        let mut result = 0;
-        result += self.show_bytes as u32;
-        result += self.show_chars as u32;
-        result += self.show_lines as u32;
-        result += self.show_max_line_length as u32;
-        result += self.show_words as u32;
-        result
+    fn number_enabled(&self) -> u32 {
+        let mut result = 0;
+        result += self.show_bytes as u32;
+        result += self.show_chars as u32;
+        result += self.show_lines as u32;
+        result += self.show_max_line_length as u32;
+        result += self.show_words as u32;
+        result
     }
 }
 
-static ABOUT: &str = "Display newline, word, and byte counts for each FILE, and a total line if
+static ABOUT: &str = "Display newline, word, and byte counts for each FILE, and a total line if
 more than one FILE is specified. With no FILE, or when FILE is -, read standard input.";
-const USAGE: &str = "{} [OPTION]... [FILE]...";
+const USAGE: &str = "{} [OPTION]... [FILE]...";
 
-pub mod options {
-    pub static BYTES: &str = "bytes";
-    pub static CHAR: &str = "chars";
-    pub static FILES0_FROM: &str = "files0-from";
-    pub static LINES: &str = "lines";
-    pub static MAX_LINE_LENGTH: &str = "max-line-length";
-    pub static WORDS: &str = "words";
+pub mod options {
+    pub static BYTES: &str = "bytes";
+    pub static CHAR: &str = "chars";
+    pub static FILES0_FROM: &str = "files0-from";
+    pub static LINES: &str = "lines";
+    pub static MAX_LINE_LENGTH: &str = "max-line-length";
+    pub static WORDS: &str = "words";
 }
 
-static ARG_FILES: &str = "files";
-static STDIN_REPR: &str = "-";
+static ARG_FILES: &str = "files";
+static STDIN_REPR: &str = "-";
 
-enum StdinKind {
-    /// Stdin specified on command-line with "-".
-    Explicit,
+enum StdinKind {
+    /// Stdin specified on command-line with "-".
+    Explicit,
 
-    /// Stdin implicitly specified on command-line by not passing any positional argument.
-    Implicit,
+    /// Stdin implicitly specified on command-line by not passing any positional argument.
+    Implicit,
 }
 
-/// Supported inputs.
-enum Input {
-    /// A regular file.
-    Path(PathBuf),
+/// Supported inputs.
+enum Input {
+    /// A regular file.
+    Path(PathBuf),
 
-    /// Standard input.
-    Stdin(StdinKind),
+    /// Standard input.
+    Stdin(StdinKind),
 }
 
-impl From<&OsStr> for Input {
-    fn from(input: &OsStr) -> Self {
-        if input == STDIN_REPR {
-            Self::Stdin(StdinKind::Explicit)
-        } else {
-            Self::Path(input.into())
+impl From<&OsStr> for Input {
+    fn from(input: &OsStr) -> Self {
+        if input == STDIN_REPR {
+            Self::Stdin(StdinKind::Explicit)
+        } else {
+            Self::Path(input.into())
         }
     }
 }
 
-impl Input {
-    /// Converts input to title that appears in stats.
-    fn to_title(&self, quoting_style: &QuotingStyle) -> Option<String> {
-        match self {
-            Self::Path(path) => Some(escape_name(&path.clone().into_os_string(), quoting_style)),
-            Self::Stdin(StdinKind::Explicit) => {
-                Some(escape_name(OsStr::new(STDIN_REPR), quoting_style))
+impl Input {
+    /// Converts input to title that appears in stats.
+    fn to_title(&self, quoting_style: &QuotingStyle) -> Option<String> {
+        match self {
+            Self::Path(path) => Some(escape_name(&path.clone().into_os_string(), quoting_style)),
+            Self::Stdin(StdinKind::Explicit) => {
+                Some(escape_name(OsStr::new(STDIN_REPR), quoting_style))
             }
-            Self::Stdin(StdinKind::Implicit) => None,
+            Self::Stdin(StdinKind::Implicit) => None,
         }
     }
 
-    fn path_display(&self, quoting_style: &QuotingStyle) -> String {
-        match self {
-            Self::Path(path) => escape_name(&path.clone().into_os_string(), quoting_style),
-            Self::Stdin(_) => escape_name(OsStr::new("standard input"), quoting_style),
+    fn path_display(&self, quoting_style: &QuotingStyle) -> String {
+        match self {
+            Self::Path(path) => escape_name(&path.clone().into_os_string(), quoting_style),
+            Self::Stdin(_) => escape_name(OsStr::new("standard input"), quoting_style),
         }
     }
 }
 
-#[derive(Debug)]
-enum WcError {
-    FilesDisabled(String),
-    StdinReprNotAllowed(String),
+#[derive(Debug)]
+enum WcError {
+    FilesDisabled(String),
+    StdinReprNotAllowed(String),
 }
 
-impl UError for WcError {
-    fn code(&self) -> i32 {
-        match self {
-            Self::FilesDisabled(_) | Self::StdinReprNotAllowed(_) => 1,
+impl UError for WcError {
+    fn code(&self) -> i32 {
+        match self {
+            Self::FilesDisabled(_) | Self::StdinReprNotAllowed(_) => 1,
         }
     }
 
-    fn usage(&self) -> bool {
-        matches!(self, Self::FilesDisabled(_))
+    fn usage(&self) -> bool {
+        matches!(self, Self::FilesDisabled(_))
     }
 }
 
-impl Error for WcError {}
+impl Error for WcError {}
 
-impl Display for WcError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::FilesDisabled(message) | Self::StdinReprNotAllowed(message) => {
-                write!(f, "{}", message)
+impl Display for WcError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::FilesDisabled(message) | Self::StdinReprNotAllowed(message) => {
+                write!(f, "{}", message)
             }
         }
     }
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let inputs = inputs(&matches)?;
+    let inputs = inputs(&matches)?;
 
-    let settings = Settings::new(&matches);
+    let settings = Settings::new(&matches);
 
-    wc(&inputs, &settings)
+    wc(&inputs, &settings)
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::BYTES)
-                .short('c')
-                .long(options::BYTES)
-                .help("print the byte counts")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::BYTES)
+                .short('c')
+                .long(options::BYTES)
+                .help("print the byte counts")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::CHAR)
-                .short('m')
-                .long(options::CHAR)
-                .help("print the character counts")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::CHAR)
+                .short('m')
+                .long(options::CHAR)
+                .help("print the character counts")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILES0_FROM)
-                .long(options::FILES0_FROM)
-                .value_name("F")
-                .help(
+        .arg(
+            Arg::new(options::FILES0_FROM)
+                .long(options::FILES0_FROM)
+                .value_name("F")
+                .help(
                     "read input from the files specified by
     NUL-terminated names in file F;
     If F is - then read names from standard input",
                 )
-                .value_hint(clap::ValueHint::FilePath),
+                .value_hint(clap::ValueHint::FilePath),
         )
-        .arg(
-            Arg::new(options::LINES)
-                .short('l')
-                .long(options::LINES)
-                .help("print the newline counts")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::LINES)
+                .short('l')
+                .long(options::LINES)
+                .help("print the newline counts")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::MAX_LINE_LENGTH)
-                .short('L')
-                .long(options::MAX_LINE_LENGTH)
-                .help("print the length of the longest line")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::MAX_LINE_LENGTH)
+                .short('L')
+                .long(options::MAX_LINE_LENGTH)
+                .help("print the length of the longest line")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::WORDS)
-                .short('w')
-                .long(options::WORDS)
-                .help("print the word counts")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::WORDS)
+                .short('w')
+                .long(options::WORDS)
+                .help("print the word counts")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(ARG_FILES)
-                .action(ArgAction::Append)
-                .value_parser(ValueParser::os_string())
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(ARG_FILES)
+                .action(ArgAction::Append)
+                .value_parser(ValueParser::os_string())
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-fn inputs(matches: &ArgMatches) -> UResult<Vec<Input>> {
-    match matches.get_many::<OsString>(ARG_FILES) {
-        Some(os_values) => {
-            if matches.contains_id(options::FILES0_FROM) {
-                return Err(WcError::FilesDisabled(
-                    "file operands cannot be combined with --files0-from".into(),
+fn inputs(matches: &ArgMatches) -> UResult<Vec<Input>> {
+    match matches.get_many::<OsString>(ARG_FILES) {
+        Some(os_values) => {
+            if matches.contains_id(options::FILES0_FROM) {
+                return Err(WcError::FilesDisabled(
+                    "file operands cannot be combined with --files0-from".into(),
                 )
-                .into());
+                .into());
             }
 
-            Ok(os_values.map(|s| Input::from(s.as_os_str())).collect())
+            Ok(os_values.map(|s| Input::from(s.as_os_str())).collect())
         }
-        None => match matches.get_one::<String>(options::FILES0_FROM) {
-            Some(files_0_from) => create_paths_from_files0(files_0_from),
-            None => Ok(vec![Input::Stdin(StdinKind::Implicit)]),
+        None => match matches.get_one::<String>(options::FILES0_FROM) {
+            Some(files_0_from) => create_paths_from_files0(files_0_from),
+            None => Ok(vec![Input::Stdin(StdinKind::Implicit)]),
         },
     }
 }
 
-fn create_paths_from_files0(files_0_from: &str) -> UResult<Vec<Input>> {
-    let mut paths = String::new();
-    let read_from_stdin = files_0_from == STDIN_REPR;
+fn create_paths_from_files0(files_0_from: &str) -> UResult<Vec<Input>> {
+    let mut paths = String::new();
+    let read_from_stdin = files_0_from == STDIN_REPR;
 
-    if read_from_stdin {
-        io::stdin().lock().read_to_string(&mut paths)?;
-    } else {
-        File::open(files_0_from)?.read_to_string(&mut paths)?;
+    if read_from_stdin {
+        io::stdin().lock().read_to_string(&mut paths)?;
+    } else {
+        File::open(files_0_from)?.read_to_string(&mut paths)?;
     }
 
-    let paths: Vec<&str> = paths.split_terminator('\0').collect();
+    let paths: Vec<&str> = paths.split_terminator('\0').collect();
 
-    if read_from_stdin && paths.contains(&STDIN_REPR) {
-        return Err(WcError::StdinReprNotAllowed(
-            "when reading file names from stdin, no file name of '-' allowed".into(),
+    if read_from_stdin && paths.contains(&STDIN_REPR) {
+        return Err(WcError::StdinReprNotAllowed(
+            "when reading file names from stdin, no file name of '-' allowed".into(),
         )
-        .into());
+        .into());
     }
 
-    Ok(paths.iter().map(OsStr::new).map(Input::from).collect())
+    Ok(paths.iter().map(OsStr::new).map(Input::from).collect())
 }
 
-fn word_count_from_reader<T: WordCountable>(
-    mut reader: T,
-    settings: &Settings,
-) -> (WordCount, Option<io::Error>) {
-    match (
-        settings.show_bytes,
-        settings.show_chars,
-        settings.show_lines,
-        settings.show_max_line_length,
-        settings.show_words,
+fn word_count_from_reader<T: WordCountable>(
+    mut reader: T,
+    settings: &Settings,
+) -> (WordCount, Option<io::Error>) {
+    match (
+        settings.show_bytes,
+        settings.show_chars,
+        settings.show_lines,
+        settings.show_max_line_length,
+        settings.show_words,
     ) {
-        // Specialize scanning loop to improve the performance.
-        (false, false, false, false, false) => unreachable!(),
+        // Specialize scanning loop to improve the performance.
+        (false, false, false, false, false) => unreachable!(),
 
-        // show_bytes
-        (true, false, false, false, false) => {
-            // Fast path when only show_bytes is true.
-            let (bytes, error) = count_bytes_fast(&mut reader);
+        // show_bytes
+        (true, false, false, false, false) => {
+            // Fast path when only show_bytes is true.
+            let (bytes, error) = count_bytes_fast(&mut reader);
             (
-                WordCount {
-                    bytes,
-                    ..WordCount::default()
+                WordCount {
+                    bytes,
+                    ..WordCount::default()
                 },
-                error,
+                error,
             )
         }
 
-        // Fast paths that can be computed without Unicode decoding.
-        // show_lines
-        (false, false, true, false, false) => {
-            count_bytes_chars_and_lines_fast::<_, false, false, true>(&mut reader)
+        // Fast paths that can be computed without Unicode decoding.
+        // show_lines
+        (false, false, true, false, false) => {
+            count_bytes_chars_and_lines_fast::<_, false, false, true>(&mut reader)
         }
-        // show_chars
-        (false, true, false, false, false) => {
-            count_bytes_chars_and_lines_fast::<_, false, true, false>(&mut reader)
+        // show_chars
+        (false, true, false, false, false) => {
+            count_bytes_chars_and_lines_fast::<_, false, true, false>(&mut reader)
         }
-        // show_chars, show_lines
-        (false, true, true, false, false) => {
-            count_bytes_chars_and_lines_fast::<_, false, true, true>(&mut reader)
+        // show_chars, show_lines
+        (false, true, true, false, false) => {
+            count_bytes_chars_and_lines_fast::<_, false, true, true>(&mut reader)
         }
-        // show_bytes, show_lines
-        (true, false, true, false, false) => {
-            count_bytes_chars_and_lines_fast::<_, true, false, true>(&mut reader)
+        // show_bytes, show_lines
+        (true, false, true, false, false) => {
+            count_bytes_chars_and_lines_fast::<_, true, false, true>(&mut reader)
         }
-        // show_bytes, show_chars
-        (true, true, false, false, false) => {
-            count_bytes_chars_and_lines_fast::<_, true, true, false>(&mut reader)
+        // show_bytes, show_chars
+        (true, true, false, false, false) => {
+            count_bytes_chars_and_lines_fast::<_, true, true, false>(&mut reader)
         }
-        // show_bytes, show_chars, show_lines
-        (true, true, true, false, false) => {
-            count_bytes_chars_and_lines_fast::<_, true, true, true>(&mut reader)
+        // show_bytes, show_chars, show_lines
+        (true, true, true, false, false) => {
+            count_bytes_chars_and_lines_fast::<_, true, true, true>(&mut reader)
         }
-        // show_words
-        (_, false, false, false, true) => {
-            word_count_from_reader_specialized::<_, false, false, false, true>(reader)
+        // show_words
+        (_, false, false, false, true) => {
+            word_count_from_reader_specialized::<_, false, false, false, true>(reader)
         }
-        // show_max_line_length
-        (_, false, false, true, false) => {
-            word_count_from_reader_specialized::<_, false, false, true, false>(reader)
+        // show_max_line_length
+        (_, false, false, true, false) => {
+            word_count_from_reader_specialized::<_, false, false, true, false>(reader)
         }
-        // show_max_line_length, show_words
-        (_, false, false, true, true) => {
-            word_count_from_reader_specialized::<_, false, false, true, true>(reader)
+        // show_max_line_length, show_words
+        (_, false, false, true, true) => {
+            word_count_from_reader_specialized::<_, false, false, true, true>(reader)
         }
-        // show_chars, show_words
-        (_, false, true, false, true) => {
-            word_count_from_reader_specialized::<_, false, true, false, true>(reader)
+        // show_chars, show_words
+        (_, false, true, false, true) => {
+            word_count_from_reader_specialized::<_, false, true, false, true>(reader)
         }
-        // show_chars, show_lines
-        (_, false, true, true, false) => {
-            word_count_from_reader_specialized::<_, false, true, true, false>(reader)
+        // show_chars, show_lines
+        (_, false, true, true, false) => {
+            word_count_from_reader_specialized::<_, false, true, true, false>(reader)
         }
-        // show_lines, show_max_line_length, show_words
-        (_, false, true, true, true) => {
-            word_count_from_reader_specialized::<_, false, true, true, true>(reader)
+        // show_lines, show_max_line_length, show_words
+        (_, false, true, true, true) => {
+            word_count_from_reader_specialized::<_, false, true, true, true>(reader)
         }
-        // show_chars, show_words
-        (_, true, false, false, true) => {
-            word_count_from_reader_specialized::<_, true, false, false, true>(reader)
+        // show_chars, show_words
+        (_, true, false, false, true) => {
+            word_count_from_reader_specialized::<_, true, false, false, true>(reader)
         }
-        // show_chars, show_max_line_length
-        (_, true, false, true, false) => {
-            word_count_from_reader_specialized::<_, true, false, true, false>(reader)
+        // show_chars, show_max_line_length
+        (_, true, false, true, false) => {
+            word_count_from_reader_specialized::<_, true, false, true, false>(reader)
         }
-        // show_chars, show_max_line_length, show_words
-        (_, true, false, true, true) => {
-            word_count_from_reader_specialized::<_, true, false, true, true>(reader)
+        // show_chars, show_max_line_length, show_words
+        (_, true, false, true, true) => {
+            word_count_from_reader_specialized::<_, true, false, true, true>(reader)
         }
-        // show_chars, show_lines, show_words
-        (_, true, true, false, true) => {
-            word_count_from_reader_specialized::<_, true, true, false, true>(reader)
+        // show_chars, show_lines, show_words
+        (_, true, true, false, true) => {
+            word_count_from_reader_specialized::<_, true, true, false, true>(reader)
         }
-        // show_chars, show_lines, show_max_line_length
-        (_, true, true, true, false) => {
-            word_count_from_reader_specialized::<_, true, true, true, false>(reader)
+        // show_chars, show_lines, show_max_line_length
+        (_, true, true, true, false) => {
+            word_count_from_reader_specialized::<_, true, true, true, false>(reader)
         }
-        // show_chars, show_lines, show_max_line_length, show_words
-        (_, true, true, true, true) => {
-            word_count_from_reader_specialized::<_, true, true, true, true>(reader)
+        // show_chars, show_lines, show_max_line_length, show_words
+        (_, true, true, true, true) => {
+            word_count_from_reader_specialized::<_, true, true, true, true>(reader)
         }
     }
 }
 
-fn word_count_from_reader_specialized<
-    T: WordCountable,
-    const SHOW_CHARS: bool,
-    const SHOW_LINES: bool,
-    const SHOW_MAX_LINE_LENGTH: bool,
-    const SHOW_WORDS: bool,
->(
-    reader: T,
-) -> (WordCount, Option<io::Error>) {
-    let mut total = WordCount::default();
-    let mut reader = BufReadDecoder::new(reader.buffered());
-    let mut in_word = false;
-    let mut current_len = 0;
+fn word_count_from_reader_specialized<
+    T: WordCountable,
+    const SHOW_CHARS: bool,
+    const SHOW_LINES: bool,
+    const SHOW_MAX_LINE_LENGTH: bool,
+    const SHOW_WORDS: bool,
+>(
+    reader: T,
+) -> (WordCount, Option<io::Error>) {
+    let mut total = WordCount::default();
+    let mut reader = BufReadDecoder::new(reader.buffered());
+    let mut in_word = false;
+    let mut current_len = 0;
 
-    while let Some(chunk) = reader.next_strict() {
-        match chunk {
-            Ok(text) => {
-                for ch in text.chars() {
-                    if SHOW_WORDS {
-                        if ch.is_whitespace() {
-                            in_word = false;
-                        } else if ch.is_ascii_control() {
-                            // These count as characters but do not affect the word state
-                        } else if !in_word {
-                            in_word = true;
-                            total.words += 1;
+    while let Some(chunk) = reader.next_strict() {
+        match chunk {
+            Ok(text) => {
+                for ch in text.chars() {
+                    if SHOW_WORDS {
+                        if ch.is_whitespace() {
+                            in_word = false;
+                        } else if ch.is_ascii_control() {
+                            // These count as characters but do not affect the word state
+                        } else if !in_word {
+                            in_word = true;
+                            total.words += 1;
                         }
                     }
-                    if SHOW_MAX_LINE_LENGTH {
-                        match ch {
-                            '\n' | '\r' | '\x0c' => {
-                                total.max_line_length = max(current_len, total.max_line_length);
-                                current_len = 0;
+                    if SHOW_MAX_LINE_LENGTH {
+                        match ch {
+                            '\n' | '\r' | '\x0c' => {
+                                total.max_line_length = max(current_len, total.max_line_length);
+                                current_len = 0;
                             }
-                            '\t' => {
-                                current_len -= current_len % 8;
-                                current_len += 8;
+                            '\t' => {
+                                current_len -= current_len % 8;
+                                current_len += 8;
                             }
-                            _ => {
-                                current_len += ch.width().unwrap_or(0);
+                            _ => {
+                                current_len += ch.width().unwrap_or(0);
                             }
                         }
                     }
-                    if SHOW_LINES && ch == '\n' {
-                        total.lines += 1;
+                    if SHOW_LINES && ch == '\n' {
+                        total.lines += 1;
                     }
-                    if SHOW_CHARS {
-                        total.chars += 1;
+                    if SHOW_CHARS {
+                        total.chars += 1;
                     }
                 }
-                total.bytes += text.len();
+                total.bytes += text.len();
             }
-            Err(BufReadDecoderError::InvalidByteSequence(bytes)) => {
-                // GNU wc treats invalid data as neither word nor char nor whitespace,
-                // so no other counters are affected
-                total.bytes += bytes.len();
+            Err(BufReadDecoderError::InvalidByteSequence(bytes)) => {
+                // GNU wc treats invalid data as neither word nor char nor whitespace,
+                // so no other counters are affected
+                total.bytes += bytes.len();
             }
-            Err(BufReadDecoderError::Io(e)) => {
-                return (total, Some(e));
+            Err(BufReadDecoderError::Io(e)) => {
+                return (total, Some(e));
             }
         }
     }
 
-    total.max_line_length = max(current_len, total.max_line_length);
+    total.max_line_length = max(current_len, total.max_line_length);
 
-    (total, None)
+    (total, None)
 }
 
-enum CountResult {
-    /// Nothing went wrong.
-    Success(WordCount),
-    /// Managed to open but failed to read.
-    Interrupted(WordCount, io::Error),
-    /// Didn't even manage to open.
-    Failure(io::Error),
+enum CountResult {
+    /// Nothing went wrong.
+    Success(WordCount),
+    /// Managed to open but failed to read.
+    Interrupted(WordCount, io::Error),
+    /// Didn't even manage to open.
+    Failure(io::Error),
 }
 
-/// If we fail opening a file we only show the error. If we fail reading it
-/// we show a count for what we managed to read.
-///
-/// Therefore the reading implementations always return a total and sometimes
-/// return an error: (WordCount, Option<io::Error>).
-fn word_count_from_input(input: &Input, settings: &Settings) -> CountResult {
-    match input {
-        Input::Stdin(_) => {
-            let stdin = io::stdin();
-            let stdin_lock = stdin.lock();
-            let count = word_count_from_reader(stdin_lock, settings);
-            match count {
-                (total, Some(error)) => CountResult::Interrupted(total, error),
-                (total, None) => CountResult::Success(total),
+/// If we fail opening a file we only show the error. If we fail reading it
+/// we show a count for what we managed to read.
+///
+/// Therefore the reading implementations always return a total and sometimes
+/// return an error: (WordCount, Option<io::Error>).
+fn word_count_from_input(input: &Input, settings: &Settings) -> CountResult {
+    match input {
+        Input::Stdin(_) => {
+            let stdin = io::stdin();
+            let stdin_lock = stdin.lock();
+            let count = word_count_from_reader(stdin_lock, settings);
+            match count {
+                (total, Some(error)) => CountResult::Interrupted(total, error),
+                (total, None) => CountResult::Success(total),
             }
         }
-        Input::Path(path) => match File::open(path) {
-            Err(error) => CountResult::Failure(error),
-            Ok(file) => match word_count_from_reader(file, settings) {
-                (total, Some(error)) => CountResult::Interrupted(total, error),
-                (total, None) => CountResult::Success(total),
+        Input::Path(path) => match File::open(path) {
+            Err(error) => CountResult::Failure(error),
+            Ok(file) => match word_count_from_reader(file, settings) {
+                (total, Some(error)) => CountResult::Interrupted(total, error),
+                (total, None) => CountResult::Success(total),
             },
         },
     }
 }
 
-/// Compute the number of digits needed to represent all counts in all inputs.
-///
-/// `inputs` may include zero or more [`Input::Stdin`] entries, each of
-/// which represents reading from `stdin`. The presence of any such
-/// entry causes this function to return a width that is at least
-/// [`MINIMUM_WIDTH`].
-///
-/// If `input` is empty, or if only one number needs to be printed (for just
-/// one file) then this function is optimized to return 1 without making any
-/// calls to get file metadata.
-///
-/// If file metadata could not be read from any of the [`Input::Path`] input,
-/// that input does not affect number width computation
-///
-/// Otherwise, the file sizes in the file metadata are summed and the number of
-/// digits in that total size is returned as the number width
-///
-/// To mirror GNU wc's behavior a special case is added. If --files0-from is
-/// used and input is read from stdin and there is only one calculation enabled
-/// columns will not be aligned. This is not exactly GNU wc's behavior, but it
-/// is close enough to pass the GNU test suite.
-fn compute_number_width(inputs: &[Input], settings: &Settings) -> usize {
-    if inputs.is_empty()
-        || (inputs.len() == 1 && settings.number_enabled() == 1)
-        || (settings.files0_from_stdin_mode && settings.number_enabled() == 1)
+/// Compute the number of digits needed to represent all counts in all inputs.
+///
+/// `inputs` may include zero or more [`Input::Stdin`] entries, each of
+/// which represents reading from `stdin`. The presence of any such
+/// entry causes this function to return a width that is at least
+/// [`MINIMUM_WIDTH`].
+///
+/// If `input` is empty, or if only one number needs to be printed (for just
+/// one file) then this function is optimized to return 1 without making any
+/// calls to get file metadata.
+///
+/// If file metadata could not be read from any of the [`Input::Path`] input,
+/// that input does not affect number width computation
+///
+/// Otherwise, the file sizes in the file metadata are summed and the number of
+/// digits in that total size is returned as the number width
+///
+/// To mirror GNU wc's behavior a special case is added. If --files0-from is
+/// used and input is read from stdin and there is only one calculation enabled
+/// columns will not be aligned. This is not exactly GNU wc's behavior, but it
+/// is close enough to pass the GNU test suite.
+fn compute_number_width(inputs: &[Input], settings: &Settings) -> usize {
+    if inputs.is_empty()
+        || (inputs.len() == 1 && settings.number_enabled() == 1)
+        || (settings.files0_from_stdin_mode && settings.number_enabled() == 1)
     {
-        return 1;
+        return 1;
     }
 
-    let mut minimum_width = 1;
-    let mut total = 0;
+    let mut minimum_width = 1;
+    let mut total = 0;
 
-    for input in inputs {
-        match input {
-            Input::Stdin(_) => {
-                minimum_width = MINIMUM_WIDTH;
+    for input in inputs {
+        match input {
+            Input::Stdin(_) => {
+                minimum_width = MINIMUM_WIDTH;
             }
-            Input::Path(path) => {
-                if let Ok(meta) = fs::metadata(path) {
-                    if meta.is_file() {
-                        total += meta.len();
-                    } else {
-                        minimum_width = MINIMUM_WIDTH;
+            Input::Path(path) => {
+                if let Ok(meta) = fs::metadata(path) {
+                    if meta.is_file() {
+                        total += meta.len();
+                    } else {
+                        minimum_width = MINIMUM_WIDTH;
                     }
                 }
             }
         }
     }
 
-    max(minimum_width, total.to_string().len())
+    max(minimum_width, total.to_string().len())
 }
 
-fn wc(inputs: &[Input], settings: &Settings) -> UResult<()> {
-    let number_width = compute_number_width(inputs, settings);
+fn wc(inputs: &[Input], settings: &Settings) -> UResult<()> {
+    let number_width = compute_number_width(inputs, settings);
 
-    let mut total_word_count = WordCount::default();
+    let mut total_word_count = WordCount::default();
 
-    let num_inputs = inputs.len();
+    let num_inputs = inputs.len();
 
-    for input in inputs {
-        let word_count = match word_count_from_input(input, settings) {
-            CountResult::Success(word_count) => word_count,
-            CountResult::Interrupted(word_count, error) => {
-                show!(USimpleError::new(
+    for input in inputs {
+        let word_count = match word_count_from_input(input, settings) {
+            CountResult::Success(word_count) => word_count,
+            CountResult::Interrupted(word_count, error) => {
+                show!(USimpleError::new(
                     1,
                     format!(
                         "{}: {}",
-                        input.path_display(&settings.title_quoting_style),
-                        error
+                        input.path_display(&settings.title_quoting_style),
+                        error
                     )
                 ));
-                word_count
+                word_count
             }
-            CountResult::Failure(error) => {
-                show!(USimpleError::new(
+            CountResult::Failure(error) => {
+                show!(USimpleError::new(
                     1,
                     format!(
                         "{}: {}",
-                        input.path_display(&settings.title_quoting_style),
-                        error
+                        input.path_display(&settings.title_quoting_style),
+                        error
                     )
                 ));
                 continue;
             }
         };
-        total_word_count += word_count;
-        let result = word_count.with_title(input.to_title(&settings.title_quoting_style));
-        if let Err(err) = print_stats(settings, &result, number_width) {
-            show!(USimpleError::new(
+        total_word_count += word_count;
+        let result = word_count.with_title(input.to_title(&settings.title_quoting_style));
+        if let Err(err) = print_stats(settings, &result, number_width) {
+            show!(USimpleError::new(
                 1,
                 format!(
                     "failed to print result for {}: {}",
-                    &result.title.unwrap_or_else(|| String::from("<stdin>")),
-                    err,
+                    &result.title.unwrap_or_else(|| String::from("<stdin>")),
+                    err,
                 ),
             ));
         }
     }
 
-    if num_inputs > 1 {
-        let total_result = total_word_count.with_title(Some(String::from("total")));
-        if let Err(err) = print_stats(settings, &total_result, number_width) {
-            show!(USimpleError::new(
+    if num_inputs > 1 {
+        let total_result = total_word_count.with_title(Some(String::from("total")));
+        if let Err(err) = print_stats(settings, &total_result, number_width) {
+            show!(USimpleError::new(
                 1,
-                format!("failed to print total: {}", err)
+                format!("failed to print total: {}", err)
             ));
         }
     }
 
-    // Although this appears to be returning `Ok`, the exit code may
-    // have been set to a non-zero value by a call to `show!()` above.
-    Ok(())
+    // Although this appears to be returning `Ok`, the exit code may
+    // have been set to a non-zero value by a call to `show!()` above.
+    Ok(())
 }
 
-fn print_stats(
-    settings: &Settings,
-    result: &TitledWordCount,
-    number_width: usize,
-) -> io::Result<()> {
-    let mut columns = Vec::new();
+fn print_stats(
+    settings: &Settings,
+    result: &TitledWordCount,
+    number_width: usize,
+) -> io::Result<()> {
+    let mut columns = Vec::new();
 
-    if settings.show_lines {
-        columns.push(format!("{:1$}", result.count.lines, number_width));
+    if settings.show_lines {
+        columns.push(format!("{:1$}", result.count.lines, number_width));
     }
-    if settings.show_words {
-        columns.push(format!("{:1$}", result.count.words, number_width));
+    if settings.show_words {
+        columns.push(format!("{:1$}", result.count.words, number_width));
     }
-    if settings.show_chars {
-        columns.push(format!("{:1$}", result.count.chars, number_width));
+    if settings.show_chars {
+        columns.push(format!("{:1$}", result.count.chars, number_width));
     }
-    if settings.show_bytes {
-        columns.push(format!("{:1$}", result.count.bytes, number_width));
+    if settings.show_bytes {
+        columns.push(format!("{:1$}", result.count.bytes, number_width));
     }
-    if settings.show_max_line_length {
-        columns.push(format!("{:1$}", result.count.max_line_length, number_width));
+    if settings.show_max_line_length {
+        columns.push(format!("{:1$}", result.count.max_line_length, number_width));
     }
-    if let Some(title) = &result.title {
-        columns.push(title.clone());
+    if let Some(title) = &result.title {
+        columns.push(title.clone());
     }
 
-    writeln!(io::stdout().lock(), "{}", columns.join(" "))
+    writeln!(io::stdout().lock(), "{}", columns.join(" "))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_wc/word_count.rs.html b/dev/src/uu_wc/word_count.rs.html index 3b05236b7..200122247 100644 --- a/dev/src/uu_wc/word_count.rs.html +++ b/dev/src/uu_wc/word_count.rs.html @@ -1,4 +1,4 @@ -word_count.rs - source
1
+word_count.rs - source
1
 2
 3
 4
@@ -45,52 +45,52 @@
 45
 46
 47
-
use std::cmp::max;
-use std::ops::{Add, AddAssign};
+
use std::cmp::max;
+use std::ops::{Add, AddAssign};
 
-#[derive(Debug, Default, Copy, Clone)]
-pub struct WordCount {
-    pub bytes: usize,
-    pub chars: usize,
-    pub lines: usize,
-    pub words: usize,
-    pub max_line_length: usize,
+#[derive(Debug, Default, Copy, Clone)]
+pub struct WordCount {
+    pub bytes: usize,
+    pub chars: usize,
+    pub lines: usize,
+    pub words: usize,
+    pub max_line_length: usize,
 }
 
-impl Add for WordCount {
-    type Output = Self;
+impl Add for WordCount {
+    type Output = Self;
 
-    fn add(self, other: Self) -> Self {
-        Self {
-            bytes: self.bytes + other.bytes,
-            chars: self.chars + other.chars,
-            lines: self.lines + other.lines,
-            words: self.words + other.words,
-            max_line_length: max(self.max_line_length, other.max_line_length),
+    fn add(self, other: Self) -> Self {
+        Self {
+            bytes: self.bytes + other.bytes,
+            chars: self.chars + other.chars,
+            lines: self.lines + other.lines,
+            words: self.words + other.words,
+            max_line_length: max(self.max_line_length, other.max_line_length),
         }
     }
 }
 
-impl AddAssign for WordCount {
-    fn add_assign(&mut self, other: Self) {
-        *self = *self + other;
+impl AddAssign for WordCount {
+    fn add_assign(&mut self, other: Self) {
+        *self = *self + other;
     }
 }
 
-impl WordCount {
-    pub fn with_title(self, title: Option<String>) -> TitledWordCount {
-        TitledWordCount { title, count: self }
+impl WordCount {
+    pub fn with_title(self, title: Option<String>) -> TitledWordCount {
+        TitledWordCount { title, count: self }
     }
 }
 
-/// This struct supplements the actual word count with an optional title that is
-/// displayed to the user at the end of the program.
-/// The reason we don't simply include title in the `WordCount` struct is that
-/// it would result in unnecessary copying of `String`.
-#[derive(Debug, Default, Clone)]
-pub struct TitledWordCount {
-    pub title: Option<String>,
-    pub count: WordCount,
+/// This struct supplements the actual word count with an optional title that is
+/// displayed to the user at the end of the program.
+/// The reason we don't simply include title in the `WordCount` struct is that
+/// it would result in unnecessary copying of `String`.
+#[derive(Debug, Default, Clone)]
+pub struct TitledWordCount {
+    pub title: Option<String>,
+    pub count: WordCount,
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_who/who.rs.html b/dev/src/uu_who/who.rs.html index cf524998a..4ccbc4ac9 100644 --- a/dev/src/uu_who/who.rs.html +++ b/dev/src/uu_who/who.rs.html @@ -1,4 +1,4 @@ -who.rs - source
1
+who.rs - source
1
 2
 3
 4
@@ -564,571 +564,571 @@
 564
 565
 566
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) ttyname hostnames runlevel mesg wtmp statted boottime deadprocs initspawn clockchange curr runlvline pidstr exitstr hoststr
+// spell-checker:ignore (ToDO) ttyname hostnames runlevel mesg wtmp statted boottime deadprocs initspawn clockchange curr runlvline pidstr exitstr hoststr
 
-use uucore::display::Quotable;
-use uucore::error::{FromIo, UResult};
-use uucore::libc::{ttyname, STDIN_FILENO, S_IWGRP};
-use uucore::utmpx::{self, time, Utmpx};
+use uucore::display::Quotable;
+use uucore::error::{FromIo, UResult};
+use uucore::libc::{ttyname, STDIN_FILENO, S_IWGRP};
+use uucore::utmpx::{self, time, Utmpx};
 
-use clap::{crate_version, Arg, ArgAction, Command};
-use std::borrow::Cow;
-use std::ffi::CStr;
-use std::fmt::Write;
-use std::os::unix::fs::MetadataExt;
-use std::path::PathBuf;
-use uucore::format_usage;
+use clap::{crate_version, Arg, ArgAction, Command};
+use std::borrow::Cow;
+use std::ffi::CStr;
+use std::fmt::Write;
+use std::os::unix::fs::MetadataExt;
+use std::path::PathBuf;
+use uucore::format_usage;
 
-mod options {
-    pub const ALL: &str = "all";
-    pub const BOOT: &str = "boot";
-    pub const DEAD: &str = "dead";
-    pub const HEADING: &str = "heading";
-    pub const LOGIN: &str = "login";
-    pub const LOOKUP: &str = "lookup";
-    pub const ONLY_HOSTNAME_USER: &str = "only_hostname_user";
-    pub const PROCESS: &str = "process";
-    pub const COUNT: &str = "count";
-    pub const RUNLEVEL: &str = "runlevel";
-    pub const SHORT: &str = "short";
-    pub const TIME: &str = "time";
-    pub const USERS: &str = "users";
-    pub const MESG: &str = "mesg"; // aliases: --message, --writable
-    pub const FILE: &str = "FILE"; // if length=1: FILE, if length=2: ARG1 ARG2
-}
+mod options {
+    pub const ALL: &str = "all";
+    pub const BOOT: &str = "boot";
+    pub const DEAD: &str = "dead";
+    pub const HEADING: &str = "heading";
+    pub const LOGIN: &str = "login";
+    pub const LOOKUP: &str = "lookup";
+    pub const ONLY_HOSTNAME_USER: &str = "only_hostname_user";
+    pub const PROCESS: &str = "process";
+    pub const COUNT: &str = "count";
+    pub const RUNLEVEL: &str = "runlevel";
+    pub const SHORT: &str = "short";
+    pub const TIME: &str = "time";
+    pub const USERS: &str = "users";
+    pub const MESG: &str = "mesg"; // aliases: --message, --writable
+    pub const FILE: &str = "FILE"; // if length=1: FILE, if length=2: ARG1 ARG2
+}
 
-static ABOUT: &str = "Print information about users who are currently logged in.";
-const USAGE: &str = "{} [OPTION]... [ FILE | ARG1 ARG2 ]";
+static ABOUT: &str = "Print information about users who are currently logged in.";
+const USAGE: &str = "{} [OPTION]... [ FILE | ARG1 ARG2 ]";
 
-#[cfg(target_os = "linux")]
-static RUNLEVEL_HELP: &str = "print current runlevel";
-#[cfg(not(target_os = "linux"))]
-static RUNLEVEL_HELP: &str = "print current runlevel (This is meaningless on non Linux)";
+#[cfg(target_os = "linux")]
+static RUNLEVEL_HELP: &str = "print current runlevel";
+#[cfg(not(target_os = "linux"))]
+static RUNLEVEL_HELP: &str = "print current runlevel (This is meaningless on non Linux)";
 
-fn get_long_usage() -> String {
+fn get_long_usage() -> String {
     format!(
         "If FILE is not specified, use {}.  /var/log/wtmp as FILE is common.\n\
          If ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual.",
-        utmpx::DEFAULT_FILE,
+        utmpx::DEFAULT_FILE,
     )
 }
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let args = args.collect_ignore();
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let args = args.collect_ignore();
 
-    let matches = uu_app()
-        .after_help(get_long_usage())
-        .try_get_matches_from(args)?;
+    let matches = uu_app()
+        .after_help(get_long_usage())
+        .try_get_matches_from(args)?;
 
-    let files: Vec<String> = matches
-        .get_many::<String>(options::FILE)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let files: Vec<String> = matches
+        .get_many::<String>(options::FILE)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    // If true, attempt to canonicalize hostnames via a DNS lookup.
-    let do_lookup = matches.get_flag(options::LOOKUP);
+    // If true, attempt to canonicalize hostnames via a DNS lookup.
+    let do_lookup = matches.get_flag(options::LOOKUP);
 
-    // If true, display only a list of usernames and count of
-    // the users logged on.
-    // Ignored for 'who am i'.
-    let short_list = matches.get_flag(options::COUNT);
+    // If true, display only a list of usernames and count of
+    // the users logged on.
+    // Ignored for 'who am i'.
+    let short_list = matches.get_flag(options::COUNT);
 
-    let all = matches.get_flag(options::ALL);
+    let all = matches.get_flag(options::ALL);
 
-    // If true, display a line at the top describing each field.
-    let include_heading = matches.get_flag(options::HEADING);
+    // If true, display a line at the top describing each field.
+    let include_heading = matches.get_flag(options::HEADING);
 
-    // If true, display a '+' for each user if mesg y, a '-' if mesg n,
-    // or a '?' if their tty cannot be statted.
-    let include_mesg = all || matches.get_flag(options::MESG);
+    // If true, display a '+' for each user if mesg y, a '-' if mesg n,
+    // or a '?' if their tty cannot be statted.
+    let include_mesg = all || matches.get_flag(options::MESG);
 
-    // If true, display the last boot time.
-    let need_boottime = all || matches.get_flag(options::BOOT);
+    // If true, display the last boot time.
+    let need_boottime = all || matches.get_flag(options::BOOT);
 
-    // If true, display dead processes.
-    let need_deadprocs = all || matches.get_flag(options::DEAD);
+    // If true, display dead processes.
+    let need_deadprocs = all || matches.get_flag(options::DEAD);
 
-    // If true, display processes waiting for user login.
-    let need_login = all || matches.get_flag(options::LOGIN);
+    // If true, display processes waiting for user login.
+    let need_login = all || matches.get_flag(options::LOGIN);
 
-    // If true, display processes started by init.
-    let need_initspawn = all || matches.get_flag(options::PROCESS);
+    // If true, display processes started by init.
+    let need_initspawn = all || matches.get_flag(options::PROCESS);
 
-    // If true, display the last clock change.
-    let need_clockchange = all || matches.get_flag(options::TIME);
+    // If true, display the last clock change.
+    let need_clockchange = all || matches.get_flag(options::TIME);
 
-    // If true, display the current runlevel.
-    let need_runlevel = all || matches.get_flag(options::RUNLEVEL);
+    // If true, display the current runlevel.
+    let need_runlevel = all || matches.get_flag(options::RUNLEVEL);
 
-    let use_defaults = !(all
-        || need_boottime
-        || need_deadprocs
-        || need_login
-        || need_initspawn
-        || need_runlevel
-        || need_clockchange
-        || matches.get_flag(options::USERS));
+    let use_defaults = !(all
+        || need_boottime
+        || need_deadprocs
+        || need_login
+        || need_initspawn
+        || need_runlevel
+        || need_clockchange
+        || matches.get_flag(options::USERS));
 
-    // If true, display user processes.
-    let need_users = all || matches.get_flag(options::USERS) || use_defaults;
+    // If true, display user processes.
+    let need_users = all || matches.get_flag(options::USERS) || use_defaults;
 
-    // If true, display the hours:minutes since each user has touched
-    // the keyboard, or "." if within the last minute, or "old" if
-    // not within the last day.
-    let include_idle = need_deadprocs || need_login || need_runlevel || need_users;
+    // If true, display the hours:minutes since each user has touched
+    // the keyboard, or "." if within the last minute, or "old" if
+    // not within the last day.
+    let include_idle = need_deadprocs || need_login || need_runlevel || need_users;
 
-    // If true, display process termination & exit status.
-    let include_exit = need_deadprocs;
+    // If true, display process termination & exit status.
+    let include_exit = need_deadprocs;
 
-    // If true, display only name, line, and time fields.
-    let short_output = !include_exit && use_defaults;
+    // If true, display only name, line, and time fields.
+    let short_output = !include_exit && use_defaults;
 
-    // If true, display info only for the controlling tty.
-    let my_line_only = matches.get_flag(options::ONLY_HOSTNAME_USER) || files.len() == 2;
+    // If true, display info only for the controlling tty.
+    let my_line_only = matches.get_flag(options::ONLY_HOSTNAME_USER) || files.len() == 2;
 
-    let mut who = Who {
-        do_lookup,
-        short_list,
-        short_output,
-        include_idle,
-        include_heading,
-        include_mesg,
-        include_exit,
-        need_boottime,
-        need_deadprocs,
-        need_login,
-        need_initspawn,
-        need_clockchange,
-        need_runlevel,
-        need_users,
-        my_line_only,
-        args: files,
+    let mut who = Who {
+        do_lookup,
+        short_list,
+        short_output,
+        include_idle,
+        include_heading,
+        include_mesg,
+        include_exit,
+        need_boottime,
+        need_deadprocs,
+        need_login,
+        need_initspawn,
+        need_clockchange,
+        need_runlevel,
+        need_users,
+        my_line_only,
+        args: files,
     };
 
-    who.exec()
+    who.exec()
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .infer_long_args(true)
-        .arg(
-            Arg::new(options::ALL)
-                .long(options::ALL)
-                .short('a')
-                .help("same as -b -d --login -p -r -t -T -u")
-                .action(ArgAction::SetTrue),
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .infer_long_args(true)
+        .arg(
+            Arg::new(options::ALL)
+                .long(options::ALL)
+                .short('a')
+                .help("same as -b -d --login -p -r -t -T -u")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::BOOT)
-                .long(options::BOOT)
-                .short('b')
-                .help("time of last system boot")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::BOOT)
+                .long(options::BOOT)
+                .short('b')
+                .help("time of last system boot")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::DEAD)
-                .long(options::DEAD)
-                .short('d')
-                .help("print dead processes")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::DEAD)
+                .long(options::DEAD)
+                .short('d')
+                .help("print dead processes")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::HEADING)
-                .long(options::HEADING)
-                .short('H')
-                .help("print line of column headings")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::HEADING)
+                .long(options::HEADING)
+                .short('H')
+                .help("print line of column headings")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::LOGIN)
-                .long(options::LOGIN)
-                .short('l')
-                .help("print system login processes")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::LOGIN)
+                .long(options::LOGIN)
+                .short('l')
+                .help("print system login processes")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::LOOKUP)
-                .long(options::LOOKUP)
-                .help("attempt to canonicalize hostnames via DNS")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::LOOKUP)
+                .long(options::LOOKUP)
+                .help("attempt to canonicalize hostnames via DNS")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::ONLY_HOSTNAME_USER)
-                .short('m')
-                .help("only hostname and user associated with stdin")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::ONLY_HOSTNAME_USER)
+                .short('m')
+                .help("only hostname and user associated with stdin")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::PROCESS)
-                .long(options::PROCESS)
-                .short('p')
-                .help("print active processes spawned by init")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::PROCESS)
+                .long(options::PROCESS)
+                .short('p')
+                .help("print active processes spawned by init")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::COUNT)
-                .long(options::COUNT)
-                .short('q')
-                .help("all login names and number of users logged on")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::COUNT)
+                .long(options::COUNT)
+                .short('q')
+                .help("all login names and number of users logged on")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::RUNLEVEL)
-                .long(options::RUNLEVEL)
-                .short('r')
-                .help(RUNLEVEL_HELP)
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::RUNLEVEL)
+                .long(options::RUNLEVEL)
+                .short('r')
+                .help(RUNLEVEL_HELP)
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::SHORT)
-                .long(options::SHORT)
-                .short('s')
-                .help("print only name, line, and time (default)")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::SHORT)
+                .long(options::SHORT)
+                .short('s')
+                .help("print only name, line, and time (default)")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::TIME)
-                .long(options::TIME)
-                .short('t')
-                .help("print last system clock change")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::TIME)
+                .long(options::TIME)
+                .short('t')
+                .help("print last system clock change")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::USERS)
-                .long(options::USERS)
-                .short('u')
-                .help("list users logged in")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::USERS)
+                .long(options::USERS)
+                .short('u')
+                .help("list users logged in")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::MESG)
-                .long(options::MESG)
-                .short('T')
-                .visible_short_alias('w')
-                .visible_aliases(["message", "writable"])
-                .help("add user's message status as +, - or ?")
-                .action(ArgAction::SetTrue),
+        .arg(
+            Arg::new(options::MESG)
+                .long(options::MESG)
+                .short('T')
+                .visible_short_alias('w')
+                .visible_aliases(["message", "writable"])
+                .help("add user's message status as +, - or ?")
+                .action(ArgAction::SetTrue),
         )
-        .arg(
-            Arg::new(options::FILE)
-                .num_args(1..=2)
-                .value_hint(clap::ValueHint::FilePath),
+        .arg(
+            Arg::new(options::FILE)
+                .num_args(1..=2)
+                .value_hint(clap::ValueHint::FilePath),
         )
 }
 
-struct Who {
-    do_lookup: bool,
-    short_list: bool,
-    short_output: bool,
-    include_idle: bool,
-    include_heading: bool,
-    include_mesg: bool,
-    include_exit: bool,
-    need_boottime: bool,
-    need_deadprocs: bool,
-    need_login: bool,
-    need_initspawn: bool,
-    need_clockchange: bool,
-    need_runlevel: bool,
-    need_users: bool,
-    my_line_only: bool,
-    args: Vec<String>,
+struct Who {
+    do_lookup: bool,
+    short_list: bool,
+    short_output: bool,
+    include_idle: bool,
+    include_heading: bool,
+    include_mesg: bool,
+    include_exit: bool,
+    need_boottime: bool,
+    need_deadprocs: bool,
+    need_login: bool,
+    need_initspawn: bool,
+    need_clockchange: bool,
+    need_runlevel: bool,
+    need_users: bool,
+    my_line_only: bool,
+    args: Vec<String>,
 }
 
-fn idle_string<'a>(when: i64, boottime: i64) -> Cow<'a, str> {
-    thread_local! {
-        static NOW: time::OffsetDateTime = time::OffsetDateTime::now_local().unwrap();
+fn idle_string<'a>(when: i64, boottime: i64) -> Cow<'a, str> {
+    thread_local! {
+        static NOW: time::OffsetDateTime = time::OffsetDateTime::now_local().unwrap();
     }
-    NOW.with(|n| {
-        let now = n.unix_timestamp();
-        if boottime < when && now - 24 * 3600 < when && when <= now {
-            let seconds_idle = now - when;
-            if seconds_idle < 60 {
-                "  .  ".into()
-            } else {
+    NOW.with(|n| {
+        let now = n.unix_timestamp();
+        if boottime < when && now - 24 * 3600 < when && when <= now {
+            let seconds_idle = now - when;
+            if seconds_idle < 60 {
+                "  .  ".into()
+            } else {
                 format!(
                     "{:02}:{:02}",
-                    seconds_idle / 3600,
-                    (seconds_idle % 3600) / 60
-                )
-                .into()
+                    seconds_idle / 3600,
+                    (seconds_idle % 3600) / 60
+                )
+                .into()
             }
-        } else {
-            " old ".into()
+        } else {
+            " old ".into()
         }
     })
 }
 
-fn time_string(ut: &Utmpx) -> String {
-    // "%b %e %H:%M"
-    let time_format: Vec<time::format_description::FormatItem> =
-        time::format_description::parse("[month repr:short] [day padding:space] [hour]:[minute]")
-            .unwrap();
-    ut.login_time().format(&time_format).unwrap() // LC_ALL=C
-}
+fn time_string(ut: &Utmpx) -> String {
+    // "%b %e %H:%M"
+    let time_format: Vec<time::format_description::FormatItem> =
+        time::format_description::parse("[month repr:short] [day padding:space] [hour]:[minute]")
+            .unwrap();
+    ut.login_time().format(&time_format).unwrap() // LC_ALL=C
+}
 
-#[inline]
-fn current_tty() -> String {
-    unsafe {
-        let res = ttyname(STDIN_FILENO);
-        if !res.is_null() {
-            CStr::from_ptr(res as *const _)
-                .to_string_lossy()
-                .trim_start_matches("/dev/")
-                .to_owned()
-        } else {
-            "".to_owned()
+#[inline]
+fn current_tty() -> String {
+    unsafe {
+        let res = ttyname(STDIN_FILENO);
+        if !res.is_null() {
+            CStr::from_ptr(res as *const _)
+                .to_string_lossy()
+                .trim_start_matches("/dev/")
+                .to_owned()
+        } else {
+            "".to_owned()
         }
     }
 }
 
-impl Who {
-    fn exec(&mut self) -> UResult<()> {
-        let run_level_chk = |_record: i16| {
-            #[cfg(not(target_os = "linux"))]
-            return false;
+impl Who {
+    fn exec(&mut self) -> UResult<()> {
+        let run_level_chk = |_record: i16| {
+            #[cfg(not(target_os = "linux"))]
+            return false;
 
-            #[cfg(target_os = "linux")]
-            return _record == utmpx::RUN_LVL;
+            #[cfg(target_os = "linux")]
+            return _record == utmpx::RUN_LVL;
         };
 
-        let f = if self.args.len() == 1 {
-            self.args[0].as_ref()
-        } else {
-            utmpx::DEFAULT_FILE
+        let f = if self.args.len() == 1 {
+            self.args[0].as_ref()
+        } else {
+            utmpx::DEFAULT_FILE
         };
-        if self.short_list {
-            let users = Utmpx::iter_all_records_from(f)
-                .filter(Utmpx::is_user_process)
-                .map(|ut| ut.user())
-                .collect::<Vec<_>>();
-            println!("{}", users.join(" "));
-            println!("# users={}", users.len());
-        } else {
-            let records = Utmpx::iter_all_records_from(f);
+        if self.short_list {
+            let users = Utmpx::iter_all_records_from(f)
+                .filter(Utmpx::is_user_process)
+                .map(|ut| ut.user())
+                .collect::<Vec<_>>();
+            println!("{}", users.join(" "));
+            println!("# users={}", users.len());
+        } else {
+            let records = Utmpx::iter_all_records_from(f);
 
-            if self.include_heading {
-                self.print_heading();
+            if self.include_heading {
+                self.print_heading();
             }
-            let cur_tty = if self.my_line_only {
-                current_tty()
-            } else {
-                "".to_owned()
+            let cur_tty = if self.my_line_only {
+                current_tty()
+            } else {
+                "".to_owned()
             };
 
-            for ut in records {
-                if !self.my_line_only || cur_tty == ut.tty_device() {
-                    if self.need_users && ut.is_user_process() {
-                        self.print_user(&ut)?;
-                    } else if self.need_runlevel && run_level_chk(ut.record_type()) {
-                        if cfg!(target_os = "linux") {
-                            self.print_runlevel(&ut);
+            for ut in records {
+                if !self.my_line_only || cur_tty == ut.tty_device() {
+                    if self.need_users && ut.is_user_process() {
+                        self.print_user(&ut)?;
+                    } else if self.need_runlevel && run_level_chk(ut.record_type()) {
+                        if cfg!(target_os = "linux") {
+                            self.print_runlevel(&ut);
                         }
-                    } else if self.need_boottime && ut.record_type() == utmpx::BOOT_TIME {
-                        self.print_boottime(&ut);
-                    } else if self.need_clockchange && ut.record_type() == utmpx::NEW_TIME {
-                        self.print_clockchange(&ut);
-                    } else if self.need_initspawn && ut.record_type() == utmpx::INIT_PROCESS {
-                        self.print_initspawn(&ut);
-                    } else if self.need_login && ut.record_type() == utmpx::LOGIN_PROCESS {
-                        self.print_login(&ut);
-                    } else if self.need_deadprocs && ut.record_type() == utmpx::DEAD_PROCESS {
-                        self.print_deadprocs(&ut);
+                    } else if self.need_boottime && ut.record_type() == utmpx::BOOT_TIME {
+                        self.print_boottime(&ut);
+                    } else if self.need_clockchange && ut.record_type() == utmpx::NEW_TIME {
+                        self.print_clockchange(&ut);
+                    } else if self.need_initspawn && ut.record_type() == utmpx::INIT_PROCESS {
+                        self.print_initspawn(&ut);
+                    } else if self.need_login && ut.record_type() == utmpx::LOGIN_PROCESS {
+                        self.print_login(&ut);
+                    } else if self.need_deadprocs && ut.record_type() == utmpx::DEAD_PROCESS {
+                        self.print_deadprocs(&ut);
                     }
                 }
 
-                if ut.record_type() == utmpx::BOOT_TIME {}
+                if ut.record_type() == utmpx::BOOT_TIME {}
             }
         }
         Ok(())
     }
 
-    #[inline]
-    fn print_runlevel(&self, ut: &Utmpx) {
-        let last = (ut.pid() / 256) as u8 as char;
-        let curr = (ut.pid() % 256) as u8 as char;
-        let runlvline = format!("run-level {}", curr);
-        let comment = format!("last={}", if last == 'N' { 'S' } else { 'N' });
+    #[inline]
+    fn print_runlevel(&self, ut: &Utmpx) {
+        let last = (ut.pid() / 256) as u8 as char;
+        let curr = (ut.pid() % 256) as u8 as char;
+        let runlvline = format!("run-level {}", curr);
+        let comment = format!("last={}", if last == 'N' { 'S' } else { 'N' });
 
-        self.print_line(
+        self.print_line(
             "",
             ' ',
-            &runlvline,
-            &time_string(ut),
+            &runlvline,
+            &time_string(ut),
             "",
             "",
-            if !last.is_control() { &comment } else { "" },
+            if !last.is_control() { &comment } else { "" },
             "",
         );
     }
 
-    #[inline]
-    fn print_clockchange(&self, ut: &Utmpx) {
-        self.print_line("", ' ', "clock change", &time_string(ut), "", "", "", "");
+    #[inline]
+    fn print_clockchange(&self, ut: &Utmpx) {
+        self.print_line("", ' ', "clock change", &time_string(ut), "", "", "", "");
     }
 
-    #[inline]
-    fn print_login(&self, ut: &Utmpx) {
-        let comment = format!("id={}", ut.terminal_suffix());
-        let pidstr = format!("{}", ut.pid());
-        self.print_line(
+    #[inline]
+    fn print_login(&self, ut: &Utmpx) {
+        let comment = format!("id={}", ut.terminal_suffix());
+        let pidstr = format!("{}", ut.pid());
+        self.print_line(
             "LOGIN",
             ' ',
-            &ut.tty_device(),
-            &time_string(ut),
+            &ut.tty_device(),
+            &time_string(ut),
             "",
-            &pidstr,
-            &comment,
+            &pidstr,
+            &comment,
             "",
         );
     }
 
-    #[inline]
-    fn print_deadprocs(&self, ut: &Utmpx) {
-        let comment = format!("id={}", ut.terminal_suffix());
-        let pidstr = format!("{}", ut.pid());
-        let e = ut.exit_status();
-        let exitstr = format!("term={} exit={}", e.0, e.1);
-        self.print_line(
+    #[inline]
+    fn print_deadprocs(&self, ut: &Utmpx) {
+        let comment = format!("id={}", ut.terminal_suffix());
+        let pidstr = format!("{}", ut.pid());
+        let e = ut.exit_status();
+        let exitstr = format!("term={} exit={}", e.0, e.1);
+        self.print_line(
             "",
             ' ',
-            &ut.tty_device(),
-            &time_string(ut),
+            &ut.tty_device(),
+            &time_string(ut),
             "",
-            &pidstr,
-            &comment,
-            &exitstr,
+            &pidstr,
+            &comment,
+            &exitstr,
         );
     }
 
-    #[inline]
-    fn print_initspawn(&self, ut: &Utmpx) {
-        let comment = format!("id={}", ut.terminal_suffix());
-        let pidstr = format!("{}", ut.pid());
-        self.print_line(
+    #[inline]
+    fn print_initspawn(&self, ut: &Utmpx) {
+        let comment = format!("id={}", ut.terminal_suffix());
+        let pidstr = format!("{}", ut.pid());
+        self.print_line(
             "",
             ' ',
-            &ut.tty_device(),
-            &time_string(ut),
+            &ut.tty_device(),
+            &time_string(ut),
             "",
-            &pidstr,
-            &comment,
+            &pidstr,
+            &comment,
             "",
         );
     }
 
-    #[inline]
-    fn print_boottime(&self, ut: &Utmpx) {
-        self.print_line("", ' ', "system boot", &time_string(ut), "", "", "", "");
+    #[inline]
+    fn print_boottime(&self, ut: &Utmpx) {
+        self.print_line("", ' ', "system boot", &time_string(ut), "", "", "", "");
     }
 
-    fn print_user(&self, ut: &Utmpx) -> UResult<()> {
-        let mut p = PathBuf::from("/dev");
-        p.push(ut.tty_device().as_str());
-        let mesg;
-        let last_change;
-        match p.metadata() {
-            Ok(meta) => {
-                mesg = if meta.mode() & (S_IWGRP as u32) != 0 {
-                    '+'
-                } else {
-                    '-'
-                };
-                last_change = meta.atime();
+    fn print_user(&self, ut: &Utmpx) -> UResult<()> {
+        let mut p = PathBuf::from("/dev");
+        p.push(ut.tty_device().as_str());
+        let mesg;
+        let last_change;
+        match p.metadata() {
+            Ok(meta) => {
+                mesg = if meta.mode() & (S_IWGRP as u32) != 0 {
+                    '+'
+                } else {
+                    '-'
+                };
+                last_change = meta.atime();
             }
-            _ => {
-                mesg = '?';
-                last_change = 0;
+            _ => {
+                mesg = '?';
+                last_change = 0;
             }
         }
 
-        let idle = if last_change != 0 {
-            idle_string(last_change, 0)
-        } else {
-            "  ?".into()
+        let idle = if last_change != 0 {
+            idle_string(last_change, 0)
+        } else {
+            "  ?".into()
         };
 
-        let s = if self.do_lookup {
-            ut.canon_host().map_err_context(|| {
-                let host = ut.host();
+        let s = if self.do_lookup {
+            ut.canon_host().map_err_context(|| {
+                let host = ut.host();
                 format!(
                     "failed to canonicalize {}",
-                    host.split(':').next().unwrap_or(&host).quote()
+                    host.split(':').next().unwrap_or(&host).quote()
                 )
-            })?
-        } else {
-            ut.host()
+            })?
+        } else {
+            ut.host()
         };
-        let hoststr = if s.is_empty() { s } else { format!("({})", s) };
+        let hoststr = if s.is_empty() { s } else { format!("({})", s) };
 
-        self.print_line(
-            ut.user().as_ref(),
-            mesg,
-            ut.tty_device().as_ref(),
-            time_string(ut).as_str(),
-            idle.as_ref(),
-            format!("{}", ut.pid()).as_str(),
-            hoststr.as_str(),
+        self.print_line(
+            ut.user().as_ref(),
+            mesg,
+            ut.tty_device().as_ref(),
+            time_string(ut).as_str(),
+            idle.as_ref(),
+            format!("{}", ut.pid()).as_str(),
+            hoststr.as_str(),
             "",
         );
 
         Ok(())
     }
 
-    #[allow(clippy::too_many_arguments)]
-    fn print_line(
+    #[allow(clippy::too_many_arguments)]
+    fn print_line(
         &self,
-        user: &str,
-        state: char,
-        line: &str,
-        time: &str,
-        idle: &str,
-        pid: &str,
-        comment: &str,
-        exit: &str,
+        user: &str,
+        state: char,
+        line: &str,
+        time: &str,
+        idle: &str,
+        pid: &str,
+        comment: &str,
+        exit: &str,
     ) {
-        let mut buf = String::with_capacity(64);
-        let msg = vec![' ', state].into_iter().collect::<String>();
+        let mut buf = String::with_capacity(64);
+        let msg = vec![' ', state].into_iter().collect::<String>();
 
-        write!(buf, "{:<8}", user).unwrap();
-        if self.include_mesg {
-            buf.push_str(&msg);
+        write!(buf, "{:<8}", user).unwrap();
+        if self.include_mesg {
+            buf.push_str(&msg);
         }
-        write!(buf, " {:<12}", line).unwrap();
-        // "%b %e %H:%M" (LC_ALL=C)
-        let time_size = 3 + 2 + 2 + 1 + 2;
-        write!(buf, " {:<1$}", time, time_size).unwrap();
+        write!(buf, " {:<12}", line).unwrap();
+        // "%b %e %H:%M" (LC_ALL=C)
+        let time_size = 3 + 2 + 2 + 1 + 2;
+        write!(buf, " {:<1$}", time, time_size).unwrap();
 
-        if !self.short_output {
-            if self.include_idle {
-                write!(buf, " {:<6}", idle).unwrap();
+        if !self.short_output {
+            if self.include_idle {
+                write!(buf, " {:<6}", idle).unwrap();
             }
-            write!(buf, " {:>10}", pid).unwrap();
+            write!(buf, " {:>10}", pid).unwrap();
         }
-        write!(buf, " {:<8}", comment).unwrap();
-        if self.include_exit {
-            write!(buf, " {:<12}", exit).unwrap();
+        write!(buf, " {:<8}", comment).unwrap();
+        if self.include_exit {
+            write!(buf, " {:<12}", exit).unwrap();
         }
-        println!("{}", buf.trim_end());
+        println!("{}", buf.trim_end());
     }
 
-    #[inline]
-    fn print_heading(&self) {
-        self.print_line(
+    #[inline]
+    fn print_heading(&self) {
+        self.print_line(
             "NAME", ' ', "LINE", "TIME", "IDLE", "PID", "COMMENT", "EXIT",
         );
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_whoami/platform/mod.rs.html b/dev/src/uu_whoami/platform/mod.rs.html index 09eaed138..7d7697301 100644 --- a/dev/src/uu_whoami/platform/mod.rs.html +++ b/dev/src/uu_whoami/platform/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
@@ -27,20 +27,20 @@
  *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
- */
+ */
 
-// spell-checker:ignore (ToDO) getusername
+// spell-checker:ignore (ToDO) getusername
 
-#[cfg(unix)]
-pub use self::unix::get_username;
+#[cfg(unix)]
+pub use self::unix::get_username;
 
-#[cfg(windows)]
-pub use self::windows::get_username;
+#[cfg(windows)]
+pub use self::windows::get_username;
 
-#[cfg(unix)]
-mod unix;
+#[cfg(unix)]
+mod unix;
 
-#[cfg(windows)]
-mod windows;
+#[cfg(windows)]
+mod windows;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_whoami/platform/unix.rs.html b/dev/src/uu_whoami/platform/unix.rs.html index 476a61f8c..5bf666572 100644 --- a/dev/src/uu_whoami/platform/unix.rs.html +++ b/dev/src/uu_whoami/platform/unix.rs.html @@ -1,4 +1,4 @@ -unix.rs - source
1
+unix.rs - source
1
 2
 3
 4
@@ -27,18 +27,18 @@
  *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
- */
+ */
 
-use std::ffi::OsString;
-use std::io;
+use std::ffi::OsString;
+use std::io;
 
-use uucore::entries::uid2usr;
+use uucore::entries::uid2usr;
 
-pub fn get_username() -> io::Result<OsString> {
-    // SAFETY: getuid() does nothing with memory and is always successful.
-    let uid = unsafe { libc::geteuid() };
-    // uid2usr should arguably return an OsString but currently doesn't
-    uid2usr(uid).map(Into::into)
+pub fn get_username() -> io::Result<OsString> {
+    // SAFETY: getuid() does nothing with memory and is always successful.
+    let uid = unsafe { libc::geteuid() };
+    // uid2usr should arguably return an OsString but currently doesn't
+    uid2usr(uid).map(Into::into)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_whoami/whoami.rs.html b/dev/src/uu_whoami/whoami.rs.html index fd77112b0..b4403629e 100644 --- a/dev/src/uu_whoami/whoami.rs.html +++ b/dev/src/uu_whoami/whoami.rs.html @@ -1,4 +1,4 @@ -whoami.rs - source
1
+whoami.rs - source
1
 2
 3
 4
@@ -33,40 +33,40 @@
 33
 34
 35
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Jordi Boggiano <j.boggiano@seld.be>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Jordi Boggiano <j.boggiano@seld.be>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-/* last synced with: whoami (GNU coreutils) 8.21 */
+/* last synced with: whoami (GNU coreutils) 8.21 */
 
-#[macro_use]
-extern crate clap;
+#[macro_use]
+extern crate clap;
 
-use clap::Command;
+use clap::Command;
 
-use uucore::display::println_verbatim;
-use uucore::error::{FromIo, UResult};
+use uucore::display::println_verbatim;
+use uucore::error::{FromIo, UResult};
 
-mod platform;
+mod platform;
 
-static ABOUT: &str = "Print the current username.";
+static ABOUT: &str = "Print the current username.";
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    uu_app().try_get_matches_from(args)?;
-    let username = platform::get_username().map_err_context(|| "failed to get username".into())?;
-    println_verbatim(&username).map_err_context(|| "failed to print username".into())?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    uu_app().try_get_matches_from(args)?;
+    let username = platform::get_username().map_err_context(|| "failed to get username".into())?;
+    println_verbatim(&username).map_err_context(|| "failed to print username".into())?;
     Ok(())
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .version(crate_version!())
-        .about(ABOUT)
-        .infer_long_args(true)
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .version(crate_version!())
+        .about(ABOUT)
+        .infer_long_args(true)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_yes/splice.rs.html b/dev/src/uu_yes/splice.rs.html index ac62f1b8d..088f9072e 100644 --- a/dev/src/uu_yes/splice.rs.html +++ b/dev/src/uu_yes/splice.rs.html @@ -1,4 +1,4 @@ -splice.rs - source
1
+splice.rs - source
1
 2
 3
 4
@@ -65,72 +65,72 @@
 65
 66
 67
-
//! On Linux we can use vmsplice() to write data more efficiently.
-//!
-//! This does not always work. We're not allowed to splice to some targets,
-//! and on some systems (notably WSL 1) it isn't supported at all.
-//!
-//! If we get an error code that suggests splicing isn't supported then we
-//! tell that to the caller so it can fall back to a robust naïve method. If
-//! we get another kind of error we bubble it up as normal.
-//!
-//! vmsplice() can only splice into a pipe, so if the output is not a pipe
-//! we make our own and use splice() to bridge the gap from the pipe to the
-//! output.
-//!
-//! We assume that an "unsupported" error will only ever happen before any
-//! data was successfully written to the output. That way we don't have to
-//! make any effort to rescue data from the pipe if splice() fails, we can
-//! just fall back and start over from the beginning.
+
//! On Linux we can use vmsplice() to write data more efficiently.
+//!
+//! This does not always work. We're not allowed to splice to some targets,
+//! and on some systems (notably WSL 1) it isn't supported at all.
+//!
+//! If we get an error code that suggests splicing isn't supported then we
+//! tell that to the caller so it can fall back to a robust naïve method. If
+//! we get another kind of error we bubble it up as normal.
+//!
+//! vmsplice() can only splice into a pipe, so if the output is not a pipe
+//! we make our own and use splice() to bridge the gap from the pipe to the
+//! output.
+//!
+//! We assume that an "unsupported" error will only ever happen before any
+//! data was successfully written to the output. That way we don't have to
+//! make any effort to rescue data from the pipe if splice() fails, we can
+//! just fall back and start over from the beginning.
 
-use std::{io, os::unix::io::AsRawFd};
+use std::{io, os::unix::io::AsRawFd};
 
-use nix::{errno::Errno, libc::S_IFIFO, sys::stat::fstat};
+use nix::{errno::Errno, libc::S_IFIFO, sys::stat::fstat};
 
-use uucore::pipes::{pipe, splice_exact, vmsplice};
+use uucore::pipes::{pipe, splice_exact, vmsplice};
 
-pub(crate) fn splice_data(bytes: &[u8], out: &impl AsRawFd) -> Result<()> {
-    let is_pipe = fstat(out.as_raw_fd())?.st_mode as nix::libc::mode_t & S_IFIFO != 0;
+pub(crate) fn splice_data(bytes: &[u8], out: &impl AsRawFd) -> Result<()> {
+    let is_pipe = fstat(out.as_raw_fd())?.st_mode as nix::libc::mode_t & S_IFIFO != 0;
 
-    if is_pipe {
-        loop {
-            let mut bytes = bytes;
-            while !bytes.is_empty() {
-                let len = vmsplice(out, bytes).map_err(maybe_unsupported)?;
-                bytes = &bytes[len..];
+    if is_pipe {
+        loop {
+            let mut bytes = bytes;
+            while !bytes.is_empty() {
+                let len = vmsplice(out, bytes).map_err(maybe_unsupported)?;
+                bytes = &bytes[len..];
             }
         }
-    } else {
-        let (read, write) = pipe()?;
-        loop {
-            let mut bytes = bytes;
-            while !bytes.is_empty() {
-                let len = vmsplice(&write, bytes).map_err(maybe_unsupported)?;
-                splice_exact(&read, out, len).map_err(maybe_unsupported)?;
-                bytes = &bytes[len..];
+    } else {
+        let (read, write) = pipe()?;
+        loop {
+            let mut bytes = bytes;
+            while !bytes.is_empty() {
+                let len = vmsplice(&write, bytes).map_err(maybe_unsupported)?;
+                splice_exact(&read, out, len).map_err(maybe_unsupported)?;
+                bytes = &bytes[len..];
             }
         }
     }
 }
 
-pub(crate) enum Error {
-    Unsupported,
-    Io(io::Error),
+pub(crate) enum Error {
+    Unsupported,
+    Io(io::Error),
 }
 
-type Result<T> = std::result::Result<T, Error>;
+type Result<T> = std::result::Result<T, Error>;
 
-impl From<nix::Error> for Error {
-    fn from(error: nix::Error) -> Self {
-        Self::Io(io::Error::from_raw_os_error(error as i32))
+impl From<nix::Error> for Error {
+    fn from(error: nix::Error) -> Self {
+        Self::Io(io::Error::from_raw_os_error(error as i32))
     }
 }
 
-fn maybe_unsupported(error: nix::Error) -> Error {
-    match error {
-        Errno::EINVAL | Errno::ENOSYS | Errno::EBADF => Error::Unsupported,
-        _ => error.into(),
+fn maybe_unsupported(error: nix::Error) -> Error {
+    match error {
+        Errno::EINVAL | Errno::ENOSYS | Errno::EBADF => Error::Unsupported,
+        _ => error.into(),
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uu_yes/yes.rs.html b/dev/src/uu_yes/yes.rs.html index 90775db2e..95c5fc424 100644 --- a/dev/src/uu_yes/yes.rs.html +++ b/dev/src/uu_yes/yes.rs.html @@ -1,4 +1,4 @@ -yes.rs - source
1
+yes.rs - source
1
 2
 3
 4
@@ -103,110 +103,110 @@
 103
 104
 105
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * (c) Jordi Boggiano <j.boggiano@seld.be>
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * (c) Jordi Boggiano <j.boggiano@seld.be>
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-/* last synced with: yes (GNU coreutils) 8.13 */
+/* last synced with: yes (GNU coreutils) 8.13 */
 
-use std::borrow::Cow;
-use std::io::{self, Result, Write};
+use std::borrow::Cow;
+use std::io::{self, Result, Write};
 
-use clap::{Arg, ArgAction, Command};
-use uucore::error::{UResult, USimpleError};
-use uucore::format_usage;
+use clap::{Arg, ArgAction, Command};
+use uucore::error::{UResult, USimpleError};
+use uucore::format_usage;
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-mod splice;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+mod splice;
 
-const ABOUT: &str = "repeatedly display a line with STRING (or 'y')";
-const USAGE: &str = "{} [STRING]...";
+const ABOUT: &str = "repeatedly display a line with STRING (or 'y')";
+const USAGE: &str = "{} [STRING]...";
 
-// it's possible that using a smaller or larger buffer might provide better performance on some
-// systems, but honestly this is good enough
-const BUF_SIZE: usize = 16 * 1024;
+// it's possible that using a smaller or larger buffer might provide better performance on some
+// systems, but honestly this is good enough
+const BUF_SIZE: usize = 16 * 1024;
 
-#[uucore::main]
-pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-    let matches = uu_app().try_get_matches_from(args)?;
+#[uucore::main]
+pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+    let matches = uu_app().try_get_matches_from(args)?;
 
-    let string = if let Some(values) = matches.get_many::<String>("STRING") {
-        let mut result = values.fold(String::new(), |res, s| res + s + " ");
-        result.pop();
-        result.push('\n');
-        Cow::from(result)
-    } else {
-        Cow::from("y\n")
+    let string = if let Some(values) = matches.get_many::<String>("STRING") {
+        let mut result = values.fold(String::new(), |res, s| res + s + " ");
+        result.pop();
+        result.push('\n');
+        Cow::from(result)
+    } else {
+        Cow::from("y\n")
     };
 
-    let mut buffer = [0; BUF_SIZE];
-    let bytes = prepare_buffer(&string, &mut buffer);
+    let mut buffer = [0; BUF_SIZE];
+    let bytes = prepare_buffer(&string, &mut buffer);
 
-    match exec(bytes) {
+    match exec(bytes) {
         Ok(()) => Ok(()),
-        Err(err) if err.kind() == io::ErrorKind::BrokenPipe => Ok(()),
-        Err(err) => Err(USimpleError::new(1, format!("standard output: {}", err))),
+        Err(err) if err.kind() == io::ErrorKind::BrokenPipe => Ok(()),
+        Err(err) => Err(USimpleError::new(1, format!("standard output: {}", err))),
     }
 }
 
-pub fn uu_app() -> Command {
-    Command::new(uucore::util_name())
-        .about(ABOUT)
-        .override_usage(format_usage(USAGE))
-        .arg(Arg::new("STRING").action(ArgAction::Append))
-        .infer_long_args(true)
+pub fn uu_app() -> Command {
+    Command::new(uucore::util_name())
+        .about(ABOUT)
+        .override_usage(format_usage(USAGE))
+        .arg(Arg::new("STRING").action(ArgAction::Append))
+        .infer_long_args(true)
 }
 
-fn prepare_buffer<'a>(input: &'a str, buffer: &'a mut [u8; BUF_SIZE]) -> &'a [u8] {
-    if input.len() < BUF_SIZE / 2 {
-        let mut size = 0;
-        while size < BUF_SIZE - input.len() {
-            let (_, right) = buffer.split_at_mut(size);
-            right[..input.len()].copy_from_slice(input.as_bytes());
-            size += input.len();
+fn prepare_buffer<'a>(input: &'a str, buffer: &'a mut [u8; BUF_SIZE]) -> &'a [u8] {
+    if input.len() < BUF_SIZE / 2 {
+        let mut size = 0;
+        while size < BUF_SIZE - input.len() {
+            let (_, right) = buffer.split_at_mut(size);
+            right[..input.len()].copy_from_slice(input.as_bytes());
+            size += input.len();
         }
-        &buffer[..size]
-    } else {
-        input.as_bytes()
+        &buffer[..size]
+    } else {
+        input.as_bytes()
     }
 }
 
-#[cfg(unix)]
-fn enable_pipe_errors() -> Result<()> {
-    let ret = unsafe { libc::signal(libc::SIGPIPE, libc::SIG_DFL) };
-    if ret == libc::SIG_ERR {
-        return Err(io::Error::new(io::ErrorKind::Other, ""));
+#[cfg(unix)]
+fn enable_pipe_errors() -> Result<()> {
+    let ret = unsafe { libc::signal(libc::SIGPIPE, libc::SIG_DFL) };
+    if ret == libc::SIG_ERR {
+        return Err(io::Error::new(io::ErrorKind::Other, ""));
     }
     Ok(())
 }
 
-#[cfg(not(unix))]
-fn enable_pipe_errors() -> Result<()> {
-    // Do nothing.
-    Ok(())
+#[cfg(not(unix))]
+fn enable_pipe_errors() -> Result<()> {
+    // Do nothing.
+    Ok(())
 }
 
-pub fn exec(bytes: &[u8]) -> io::Result<()> {
-    let stdout = io::stdout();
-    let mut stdout = stdout.lock();
+pub fn exec(bytes: &[u8]) -> io::Result<()> {
+    let stdout = io::stdout();
+    let mut stdout = stdout.lock();
 
-    enable_pipe_errors()?;
+    enable_pipe_errors()?;
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    {
-        match splice::splice_data(bytes, &stdout) {
-            Ok(_) => return Ok(()),
-            Err(splice::Error::Io(err)) => return Err(err),
-            Err(splice::Error::Unsupported) => (),
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    {
+        match splice::splice_data(bytes, &stdout) {
+            Ok(_) => return Ok(()),
+            Err(splice::Error::Io(err)) => return Err(err),
+            Err(splice::Error::Unsupported) => (),
         }
     }
 
-    loop {
-        stdout.write_all(bytes)?;
+    loop {
+        stdout.write_all(bytes)?;
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features.rs.html b/dev/src/uucore/features.rs.html index c6e8015f8..c0ed3782e 100644 --- a/dev/src/uucore/features.rs.html +++ b/dev/src/uucore/features.rs.html @@ -1,4 +1,4 @@ -features.rs - source
1
+features.rs - source
1
 2
 3
 4
@@ -44,51 +44,51 @@
 44
 45
 46
-
// features ~ feature-gated modules (core/bundler file)
+
// features ~ feature-gated modules (core/bundler file)
 
-#[cfg(feature = "encoding")]
-pub mod encoding;
-#[cfg(feature = "fs")]
-pub mod fs;
-#[cfg(feature = "fsext")]
-pub mod fsext;
-#[cfg(feature = "lines")]
-pub mod lines;
-#[cfg(feature = "memo")]
-pub mod memo;
-#[cfg(feature = "ringbuffer")]
-pub mod ringbuffer;
-#[cfg(feature = "memo")]
-mod tokenize;
+#[cfg(feature = "encoding")]
+pub mod encoding;
+#[cfg(feature = "fs")]
+pub mod fs;
+#[cfg(feature = "fsext")]
+pub mod fsext;
+#[cfg(feature = "lines")]
+pub mod lines;
+#[cfg(feature = "memo")]
+pub mod memo;
+#[cfg(feature = "ringbuffer")]
+pub mod ringbuffer;
+#[cfg(feature = "memo")]
+mod tokenize;
 
-// * (platform-specific) feature-gated modules
-// ** non-windows (i.e. Unix + Fuchsia)
-#[cfg(all(not(windows), feature = "mode"))]
-pub mod mode;
+// * (platform-specific) feature-gated modules
+// ** non-windows (i.e. Unix + Fuchsia)
+#[cfg(all(not(windows), feature = "mode"))]
+pub mod mode;
 
-// ** unix-only
-#[cfg(all(unix, feature = "entries"))]
-pub mod entries;
-#[cfg(all(unix, feature = "perms"))]
-pub mod perms;
-#[cfg(all(unix, feature = "pipes"))]
-pub mod pipes;
-#[cfg(all(unix, feature = "process"))]
-pub mod process;
+// ** unix-only
+#[cfg(all(unix, feature = "entries"))]
+pub mod entries;
+#[cfg(all(unix, feature = "perms"))]
+pub mod perms;
+#[cfg(all(unix, feature = "pipes"))]
+pub mod pipes;
+#[cfg(all(unix, feature = "process"))]
+pub mod process;
 
-#[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))]
-pub mod signals;
-#[cfg(all(
-    unix,
-    not(target_os = "android"),
-    not(target_os = "fuchsia"),
-    not(target_os = "redox"),
-    not(target_env = "musl"),
-    feature = "utmpx"
-))]
-pub mod utmpx;
-// ** windows-only
-#[cfg(all(windows, feature = "wide"))]
-pub mod wide;
+#[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))]
+pub mod signals;
+#[cfg(all(
+    unix,
+    not(target_os = "android"),
+    not(target_os = "fuchsia"),
+    not(target_os = "redox"),
+    not(target_env = "musl"),
+    feature = "utmpx"
+))]
+pub mod utmpx;
+// ** windows-only
+#[cfg(all(windows, feature = "wide"))]
+pub mod wide;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/encoding.rs.html b/dev/src/uucore/features/encoding.rs.html index 36d25a6d0..37ad61311 100644 --- a/dev/src/uucore/features/encoding.rs.html +++ b/dev/src/uucore/features/encoding.rs.html @@ -1,4 +1,4 @@ -encoding.rs - source
1
+encoding.rs - source
1
 2
 3
 4
@@ -177,184 +177,184 @@
 177
 178
 179
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (strings) ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUV
-// spell-checker:ignore (encodings) lsbf msbf hexupper
+// spell-checker:ignore (strings) ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUV
+// spell-checker:ignore (encodings) lsbf msbf hexupper
 
-use data_encoding::{self, BASE32, BASE64};
+use data_encoding::{self, BASE32, BASE64};
 
-use std::io::{self, Read, Write};
+use std::io::{self, Read, Write};
 
-use data_encoding::{Encoding, BASE32HEX, BASE64URL, HEXUPPER};
-use data_encoding_macro::new_encoding;
-#[cfg(feature = "thiserror")]
-use thiserror::Error;
+use data_encoding::{Encoding, BASE32HEX, BASE64URL, HEXUPPER};
+use data_encoding_macro::new_encoding;
+#[cfg(feature = "thiserror")]
+use thiserror::Error;
 
-#[derive(Debug, Error)]
-pub enum DecodeError {
-    #[error("{}", _0)]
-    Decode(#[from] data_encoding::DecodeError),
-    #[error("{}", _0)]
-    DecodeZ85(#[from] z85::DecodeError),
-    #[error("{}", _0)]
-    Io(#[from] io::Error),
+#[derive(Debug, Error)]
+pub enum DecodeError {
+    #[error("{}", _0)]
+    Decode(#[from] data_encoding::DecodeError),
+    #[error("{}", _0)]
+    DecodeZ85(#[from] z85::DecodeError),
+    #[error("{}", _0)]
+    Io(#[from] io::Error),
 }
 
-pub enum EncodeError {
-    Z85InputLenNotMultipleOf4,
+pub enum EncodeError {
+    Z85InputLenNotMultipleOf4,
 }
 
-pub type DecodeResult = Result<Vec<u8>, DecodeError>;
+pub type DecodeResult = Result<Vec<u8>, DecodeError>;
 
-#[derive(Clone, Copy)]
-pub enum Format {
-    Base64,
-    Base64Url,
-    Base32,
-    Base32Hex,
-    Base16,
-    Base2Lsbf,
-    Base2Msbf,
-    Z85,
+#[derive(Clone, Copy)]
+pub enum Format {
+    Base64,
+    Base64Url,
+    Base32,
+    Base32Hex,
+    Base16,
+    Base2Lsbf,
+    Base2Msbf,
+    Z85,
 }
-use self::Format::*;
+use self::Format::*;
 
-const BASE2LSBF: Encoding = new_encoding! {
-    symbols: "01",
-    bit_order: LeastSignificantFirst,
+const BASE2LSBF: Encoding = new_encoding! {
+    symbols: "01",
+    bit_order: LeastSignificantFirst,
 };
-const BASE2MSBF: Encoding = new_encoding! {
-    symbols: "01",
-    bit_order: MostSignificantFirst,
+const BASE2MSBF: Encoding = new_encoding! {
+    symbols: "01",
+    bit_order: MostSignificantFirst,
 };
 
-pub fn encode(f: Format, input: &[u8]) -> Result<String, EncodeError> {
-    Ok(match f {
-        Base32 => BASE32.encode(input),
-        Base64 => BASE64.encode(input),
-        Base64Url => BASE64URL.encode(input),
-        Base32Hex => BASE32HEX.encode(input),
-        Base16 => HEXUPPER.encode(input),
-        Base2Lsbf => BASE2LSBF.encode(input),
-        Base2Msbf => BASE2MSBF.encode(input),
-        Z85 => {
-            // According to the spec we should not accept inputs whose len is not a multiple of 4.
-            // However, the z85 crate implements a padded encoding and accepts such inputs. We have to manually check for them.
-            if input.len() % 4 != 0 {
-                return Err(EncodeError::Z85InputLenNotMultipleOf4);
-            } else {
-                z85::encode(input)
+pub fn encode(f: Format, input: &[u8]) -> Result<String, EncodeError> {
+    Ok(match f {
+        Base32 => BASE32.encode(input),
+        Base64 => BASE64.encode(input),
+        Base64Url => BASE64URL.encode(input),
+        Base32Hex => BASE32HEX.encode(input),
+        Base16 => HEXUPPER.encode(input),
+        Base2Lsbf => BASE2LSBF.encode(input),
+        Base2Msbf => BASE2MSBF.encode(input),
+        Z85 => {
+            // According to the spec we should not accept inputs whose len is not a multiple of 4.
+            // However, the z85 crate implements a padded encoding and accepts such inputs. We have to manually check for them.
+            if input.len() % 4 != 0 {
+                return Err(EncodeError::Z85InputLenNotMultipleOf4);
+            } else {
+                z85::encode(input)
             }
         }
     })
 }
 
-pub fn decode(f: Format, input: &[u8]) -> DecodeResult {
-    Ok(match f {
-        Base32 => BASE32.decode(input)?,
-        Base64 => BASE64.decode(input)?,
-        Base64Url => BASE64URL.decode(input)?,
-        Base32Hex => BASE32HEX.decode(input)?,
-        Base16 => HEXUPPER.decode(input)?,
-        Base2Lsbf => BASE2LSBF.decode(input)?,
-        Base2Msbf => BASE2MSBF.decode(input)?,
-        Z85 => {
-            // The z85 crate implements a padded encoding by using a leading '#' which is otherwise not allowed.
-            // We manually check for a leading '#' and return an error ourselves.
-            if input.starts_with(&[b'#']) {
-                return Err(z85::DecodeError::InvalidByte(0, b'#').into());
-            } else {
-                z85::decode(input)?
-            }
+pub fn decode(f: Format, input: &[u8]) -> DecodeResult {
+    Ok(match f {
+        Base32 => BASE32.decode(input)?,
+        Base64 => BASE64.decode(input)?,
+        Base64Url => BASE64URL.decode(input)?,
+        Base32Hex => BASE32HEX.decode(input)?,
+        Base16 => HEXUPPER.decode(input)?,
+        Base2Lsbf => BASE2LSBF.decode(input)?,
+        Base2Msbf => BASE2MSBF.decode(input)?,
+        Z85 => {
+            // The z85 crate implements a padded encoding by using a leading '#' which is otherwise not allowed.
+            // We manually check for a leading '#' and return an error ourselves.
+            if input.starts_with(&[b'#']) {
+                return Err(z85::DecodeError::InvalidByte(0, b'#').into());
+            } else {
+                z85::decode(input)?
+            }
         }
     })
 }
 
-pub struct Data<R: Read> {
-    line_wrap: usize,
-    ignore_garbage: bool,
-    input: R,
-    format: Format,
-    alphabet: &'static [u8],
+pub struct Data<R: Read> {
+    line_wrap: usize,
+    ignore_garbage: bool,
+    input: R,
+    format: Format,
+    alphabet: &'static [u8],
 }
 
-impl<R: Read> Data<R> {
-    pub fn new(input: R, format: Format) -> Self {
-        Self {
-            line_wrap: 76,
-            ignore_garbage: false,
-            input,
-            format,
-            alphabet: match format {
-                Base32 => b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",
-                Base64 => b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=+/",
-                Base64Url => b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=_-",
-                Base32Hex => b"0123456789ABCDEFGHIJKLMNOPQRSTUV=",
-                Base16 => b"0123456789ABCDEF",
-                Base2Lsbf => b"01",
-                Base2Msbf => b"01",
-                Z85 => b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#",
+impl<R: Read> Data<R> {
+    pub fn new(input: R, format: Format) -> Self {
+        Self {
+            line_wrap: 76,
+            ignore_garbage: false,
+            input,
+            format,
+            alphabet: match format {
+                Base32 => b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",
+                Base64 => b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=+/",
+                Base64Url => b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=_-",
+                Base32Hex => b"0123456789ABCDEFGHIJKLMNOPQRSTUV=",
+                Base16 => b"0123456789ABCDEF",
+                Base2Lsbf => b"01",
+                Base2Msbf => b"01",
+                Z85 => b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#",
             },
         }
     }
 
-    #[must_use]
-    pub fn line_wrap(mut self, wrap: usize) -> Self {
-        self.line_wrap = wrap;
-        self
-    }
+    #[must_use]
+    pub fn line_wrap(mut self, wrap: usize) -> Self {
+        self.line_wrap = wrap;
+        self
+    }
 
-    #[must_use]
-    pub fn ignore_garbage(mut self, ignore: bool) -> Self {
-        self.ignore_garbage = ignore;
-        self
-    }
+    #[must_use]
+    pub fn ignore_garbage(mut self, ignore: bool) -> Self {
+        self.ignore_garbage = ignore;
+        self
+    }
 
-    pub fn decode(&mut self) -> DecodeResult {
-        let mut buf = vec![];
-        self.input.read_to_end(&mut buf)?;
-        if self.ignore_garbage {
-            buf.retain(|c| self.alphabet.contains(c));
-        } else {
-            buf.retain(|&c| c != b'\r' && c != b'\n');
+    pub fn decode(&mut self) -> DecodeResult {
+        let mut buf = vec![];
+        self.input.read_to_end(&mut buf)?;
+        if self.ignore_garbage {
+            buf.retain(|c| self.alphabet.contains(c));
+        } else {
+            buf.retain(|&c| c != b'\r' && c != b'\n');
         };
-        decode(self.format, &buf)
+        decode(self.format, &buf)
     }
 
-    pub fn encode(&mut self) -> Result<String, EncodeError> {
-        let mut buf: Vec<u8> = vec![];
-        self.input.read_to_end(&mut buf).unwrap();
-        encode(self.format, buf.as_slice())
+    pub fn encode(&mut self) -> Result<String, EncodeError> {
+        let mut buf: Vec<u8> = vec![];
+        self.input.read_to_end(&mut buf).unwrap();
+        encode(self.format, buf.as_slice())
     }
 }
 
-// NOTE: this will likely be phased out at some point
-pub fn wrap_print<R: Read>(data: &Data<R>, res: &str) {
-    let stdout = io::stdout();
-    wrap_write(stdout.lock(), data.line_wrap, res).unwrap();
+// NOTE: this will likely be phased out at some point
+pub fn wrap_print<R: Read>(data: &Data<R>, res: &str) {
+    let stdout = io::stdout();
+    wrap_write(stdout.lock(), data.line_wrap, res).unwrap();
 }
 
-pub fn wrap_write<W: Write>(mut writer: W, line_wrap: usize, res: &str) -> io::Result<()> {
-    use std::cmp::min;
+pub fn wrap_write<W: Write>(mut writer: W, line_wrap: usize, res: &str) -> io::Result<()> {
+    use std::cmp::min;
 
-    if line_wrap == 0 {
-        return write!(writer, "{}", res);
+    if line_wrap == 0 {
+        return write!(writer, "{}", res);
     }
 
-    let mut start = 0;
-    while start < res.len() {
-        let end = min(start + line_wrap, res.len());
-        writeln!(writer, "{}", &res[start..end])?;
-        start = end;
+    let mut start = 0;
+    while start < res.len() {
+        let end = min(start + line_wrap, res.len());
+        writeln!(writer, "{}", &res[start..end])?;
+        start = end;
     }
 
     Ok(())
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/entries.rs.html b/dev/src/uucore/features/entries.rs.html index 6e0bd46d1..29c53fd95 100644 --- a/dev/src/uucore/features/entries.rs.html +++ b/dev/src/uucore/features/entries.rs.html @@ -1,4 +1,4 @@ -entries.rs - source
1
+entries.rs - source
1
 2
 3
 4
@@ -386,336 +386,336 @@
 386
 387
 388
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (vars) Passwd cstr fnam gecos ngroups egid
+// spell-checker:ignore (vars) Passwd cstr fnam gecos ngroups egid
 
-//! Get password/group file entry
-//!
-//! # Examples:
-//!
-//! ```
-//! use uucore::entries::{self, Locate};
-//!
-//! let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
-//!     "root"
-//! } else {
-//!     "wheel"
-//! };
-//!
-//! assert_eq!("root", entries::uid2usr(0).unwrap());
-//! assert_eq!(0, entries::usr2uid("root").unwrap());
-//! assert!(entries::gid2grp(0).is_ok());
-//! assert!(entries::grp2gid(root_group).is_ok());
-//!
-//! assert!(entries::Passwd::locate(0).is_ok());
-//! assert!(entries::Passwd::locate("0").is_ok());
-//! assert!(entries::Passwd::locate("root").is_ok());
-//!
-//! assert!(entries::Group::locate(0).is_ok());
-//! assert!(entries::Group::locate("0").is_ok());
-//! assert!(entries::Group::locate(root_group).is_ok());
-//! ```
+//! Get password/group file entry
+//!
+//! # Examples:
+//!
+//! ```
+//! use uucore::entries::{self, Locate};
+//!
+//! let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
+//!     "root"
+//! } else {
+//!     "wheel"
+//! };
+//!
+//! assert_eq!("root", entries::uid2usr(0).unwrap());
+//! assert_eq!(0, entries::usr2uid("root").unwrap());
+//! assert!(entries::gid2grp(0).is_ok());
+//! assert!(entries::grp2gid(root_group).is_ok());
+//!
+//! assert!(entries::Passwd::locate(0).is_ok());
+//! assert!(entries::Passwd::locate("0").is_ok());
+//! assert!(entries::Passwd::locate("root").is_ok());
+//!
+//! assert!(entries::Group::locate(0).is_ok());
+//! assert!(entries::Group::locate("0").is_ok());
+//! assert!(entries::Group::locate(root_group).is_ok());
+//! ```
 
-#[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
-use libc::time_t;
-use libc::{c_char, c_int, gid_t, uid_t};
-#[cfg(not(target_os = "redox"))]
-use libc::{getgrgid, getgrnam, getgroups};
-use libc::{getpwnam, getpwuid, group, passwd};
+#[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
+use libc::time_t;
+use libc::{c_char, c_int, gid_t, uid_t};
+#[cfg(not(target_os = "redox"))]
+use libc::{getgrgid, getgrnam, getgroups};
+use libc::{getpwnam, getpwuid, group, passwd};
 
-use std::ffi::{CStr, CString};
-use std::io::Error as IOError;
-use std::io::ErrorKind;
-use std::io::Result as IOResult;
-use std::ptr;
-use std::sync::Mutex;
+use std::ffi::{CStr, CString};
+use std::io::Error as IOError;
+use std::io::ErrorKind;
+use std::io::Result as IOResult;
+use std::ptr;
+use std::sync::Mutex;
 
-use once_cell::sync::Lazy;
+use once_cell::sync::Lazy;
 
-extern "C" {
-    /// From: `<https://man7.org/linux/man-pages/man3/getgrouplist.3.html>`
-    /// > The getgrouplist() function scans the group database to obtain
-    /// > the list of groups that user belongs to.
-    fn getgrouplist(
-        name: *const c_char,
-        gid: gid_t,
-        groups: *mut gid_t,
-        ngroups: *mut c_int,
-    ) -> c_int;
+extern "C" {
+    /// From: `<https://man7.org/linux/man-pages/man3/getgrouplist.3.html>`
+    /// > The getgrouplist() function scans the group database to obtain
+    /// > the list of groups that user belongs to.
+    fn getgrouplist(
+        name: *const c_char,
+        gid: gid_t,
+        groups: *mut gid_t,
+        ngroups: *mut c_int,
+    ) -> c_int;
 }
 
-/// From: `<https://man7.org/linux/man-pages/man2/getgroups.2.html>`
-/// > getgroups() returns the supplementary group IDs of the calling
-/// > process in list.
-/// > If size is zero, list is not modified, but the total number of
-/// > supplementary group IDs for the process is returned.  This allows
-/// > the caller to determine the size of a dynamically allocated list
-/// > to be used in a further call to getgroups().
-#[cfg(not(target_os = "redox"))]
-pub fn get_groups() -> IOResult<Vec<gid_t>> {
-    let mut groups = Vec::new();
-    loop {
-        let ngroups = match unsafe { getgroups(0, ptr::null_mut()) } {
-            -1 => return Err(IOError::last_os_error()),
-            // Not just optimization; 0 would mess up the next call
-            0 => return Ok(Vec::new()),
-            n => n,
+/// From: `<https://man7.org/linux/man-pages/man2/getgroups.2.html>`
+/// > getgroups() returns the supplementary group IDs of the calling
+/// > process in list.
+/// > If size is zero, list is not modified, but the total number of
+/// > supplementary group IDs for the process is returned.  This allows
+/// > the caller to determine the size of a dynamically allocated list
+/// > to be used in a further call to getgroups().
+#[cfg(not(target_os = "redox"))]
+pub fn get_groups() -> IOResult<Vec<gid_t>> {
+    let mut groups = Vec::new();
+    loop {
+        let ngroups = match unsafe { getgroups(0, ptr::null_mut()) } {
+            -1 => return Err(IOError::last_os_error()),
+            // Not just optimization; 0 would mess up the next call
+            0 => return Ok(Vec::new()),
+            n => n,
         };
 
-        // This is a small buffer, so we can afford to zero-initialize it and
-        // use safe Vec operations
-        groups.resize(ngroups.try_into().unwrap(), 0);
-        let res = unsafe { getgroups(ngroups, groups.as_mut_ptr()) };
-        if res == -1 {
-            let err = IOError::last_os_error();
-            if err.raw_os_error() == Some(libc::EINVAL) {
-                // Number of groups changed, retry
-                continue;
-            } else {
-                return Err(err);
+        // This is a small buffer, so we can afford to zero-initialize it and
+        // use safe Vec operations
+        groups.resize(ngroups.try_into().unwrap(), 0);
+        let res = unsafe { getgroups(ngroups, groups.as_mut_ptr()) };
+        if res == -1 {
+            let err = IOError::last_os_error();
+            if err.raw_os_error() == Some(libc::EINVAL) {
+                // Number of groups changed, retry
+                continue;
+            } else {
+                return Err(err);
             }
-        } else {
-            groups.truncate(ngroups.try_into().unwrap());
-            return Ok(groups);
+        } else {
+            groups.truncate(ngroups.try_into().unwrap());
+            return Ok(groups);
         }
     }
 }
 
-/// The list of group IDs returned from GNU's `groups` and GNU's `id --groups`
-/// starts with the effective group ID (egid).
-/// This is a wrapper for `get_groups()` to mimic this behavior.
-///
-/// If `arg_id` is `None` (default), `get_groups_gnu` moves the effective
-/// group id (egid) to the first entry in the returned Vector.
-/// If `arg_id` is `Some(x)`, `get_groups_gnu` moves the id with value `x`
-/// to the first entry in the returned Vector. This might be necessary
-/// for `id --groups --real` if `gid` and `egid` are not equal.
-///
-/// From: `<https://www.man7.org/linux/man-pages/man3/getgroups.3p.html>`
-/// > As implied by the definition of supplementary groups, the
-/// > effective group ID may appear in the array returned by
-/// > getgroups() or it may be returned only by getegid().  Duplication
-/// > may exist, but the application needs to call getegid() to be sure
-/// > of getting all of the information. Various implementation
-/// > variations and administrative sequences cause the set of groups
-/// > appearing in the result of getgroups() to vary in order and as to
-/// > whether the effective group ID is included, even when the set of
-/// > groups is the same (in the mathematical sense of ``set''). (The
-/// > history of a process and its parents could affect the details of
-/// > the result.)
-#[cfg(all(unix, not(target_os = "redox"), feature = "process"))]
-pub fn get_groups_gnu(arg_id: Option<u32>) -> IOResult<Vec<gid_t>> {
-    let groups = get_groups()?;
-    let egid = arg_id.unwrap_or_else(crate::features::process::getegid);
-    Ok(sort_groups(groups, egid))
+/// The list of group IDs returned from GNU's `groups` and GNU's `id --groups`
+/// starts with the effective group ID (egid).
+/// This is a wrapper for `get_groups()` to mimic this behavior.
+///
+/// If `arg_id` is `None` (default), `get_groups_gnu` moves the effective
+/// group id (egid) to the first entry in the returned Vector.
+/// If `arg_id` is `Some(x)`, `get_groups_gnu` moves the id with value `x`
+/// to the first entry in the returned Vector. This might be necessary
+/// for `id --groups --real` if `gid` and `egid` are not equal.
+///
+/// From: `<https://www.man7.org/linux/man-pages/man3/getgroups.3p.html>`
+/// > As implied by the definition of supplementary groups, the
+/// > effective group ID may appear in the array returned by
+/// > getgroups() or it may be returned only by getegid().  Duplication
+/// > may exist, but the application needs to call getegid() to be sure
+/// > of getting all of the information. Various implementation
+/// > variations and administrative sequences cause the set of groups
+/// > appearing in the result of getgroups() to vary in order and as to
+/// > whether the effective group ID is included, even when the set of
+/// > groups is the same (in the mathematical sense of ``set''). (The
+/// > history of a process and its parents could affect the details of
+/// > the result.)
+#[cfg(all(unix, not(target_os = "redox"), feature = "process"))]
+pub fn get_groups_gnu(arg_id: Option<u32>) -> IOResult<Vec<gid_t>> {
+    let groups = get_groups()?;
+    let egid = arg_id.unwrap_or_else(crate::features::process::getegid);
+    Ok(sort_groups(groups, egid))
 }
 
-#[cfg(all(unix, feature = "process"))]
-fn sort_groups(mut groups: Vec<gid_t>, egid: gid_t) -> Vec<gid_t> {
-    if let Some(index) = groups.iter().position(|&x| x == egid) {
-        groups[..=index].rotate_right(1);
-    } else {
-        groups.insert(0, egid);
+#[cfg(all(unix, feature = "process"))]
+fn sort_groups(mut groups: Vec<gid_t>, egid: gid_t) -> Vec<gid_t> {
+    if let Some(index) = groups.iter().position(|&x| x == egid) {
+        groups[..=index].rotate_right(1);
+    } else {
+        groups.insert(0, egid);
     }
-    groups
+    groups
 }
 
-#[derive(Clone, Debug)]
-pub struct Passwd {
-    /// AKA passwd.pw_name
-    pub name: String,
-    /// AKA passwd.pw_uid
-    pub uid: uid_t,
-    /// AKA passwd.pw_gid
-    pub gid: gid_t,
-    /// AKA passwd.pw_gecos
-    pub user_info: Option<String>,
-    /// AKA passwd.pw_shell
-    pub user_shell: Option<String>,
-    /// AKA passwd.pw_dir
-    pub user_dir: Option<String>,
-    /// AKA passwd.pw_passwd
-    pub user_passwd: Option<String>,
-    /// AKA passwd.pw_class
-    #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
-    pub user_access_class: Option<String>,
-    /// AKA passwd.pw_change
-    #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
-    pub passwd_change_time: time_t,
-    /// AKA passwd.pw_expire
-    #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
-    pub expiration: time_t,
+#[derive(Clone, Debug)]
+pub struct Passwd {
+    /// AKA passwd.pw_name
+    pub name: String,
+    /// AKA passwd.pw_uid
+    pub uid: uid_t,
+    /// AKA passwd.pw_gid
+    pub gid: gid_t,
+    /// AKA passwd.pw_gecos
+    pub user_info: Option<String>,
+    /// AKA passwd.pw_shell
+    pub user_shell: Option<String>,
+    /// AKA passwd.pw_dir
+    pub user_dir: Option<String>,
+    /// AKA passwd.pw_passwd
+    pub user_passwd: Option<String>,
+    /// AKA passwd.pw_class
+    #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
+    pub user_access_class: Option<String>,
+    /// AKA passwd.pw_change
+    #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
+    pub passwd_change_time: time_t,
+    /// AKA passwd.pw_expire
+    #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
+    pub expiration: time_t,
 }
 
-/// SAFETY: ptr must point to a valid C string.
-/// Returns None if ptr is null.
-unsafe fn cstr2string(ptr: *const c_char) -> Option<String> {
-    if !ptr.is_null() {
-        Some(CStr::from_ptr(ptr).to_string_lossy().into_owned())
-    } else {
-        None
-    }
+/// SAFETY: ptr must point to a valid C string.
+/// Returns None if ptr is null.
+unsafe fn cstr2string(ptr: *const c_char) -> Option<String> {
+    if !ptr.is_null() {
+        Some(CStr::from_ptr(ptr).to_string_lossy().into_owned())
+    } else {
+        None
+    }
 }
 
-impl Passwd {
-    /// SAFETY: All the pointed-to strings must be valid and not change while
-    /// the function runs. That means PW_LOCK must be held.
-    unsafe fn from_raw(raw: passwd) -> Self {
-        Self {
-            name: cstr2string(raw.pw_name).expect("passwd without name"),
-            uid: raw.pw_uid,
-            gid: raw.pw_gid,
-            #[cfg(not(all(
-                target_os = "android",
-                any(target_arch = "x86", target_arch = "arm")
-            )))]
-            user_info: cstr2string(raw.pw_gecos),
-            #[cfg(all(target_os = "android", any(target_arch = "x86", target_arch = "arm")))]
-            user_info: None,
-            user_shell: cstr2string(raw.pw_shell),
-            user_dir: cstr2string(raw.pw_dir),
-            user_passwd: cstr2string(raw.pw_passwd),
-            #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
-            user_access_class: cstr2string(raw.pw_class),
-            #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
-            passwd_change_time: raw.pw_change,
-            #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
-            expiration: raw.pw_expire,
+impl Passwd {
+    /// SAFETY: All the pointed-to strings must be valid and not change while
+    /// the function runs. That means PW_LOCK must be held.
+    unsafe fn from_raw(raw: passwd) -> Self {
+        Self {
+            name: cstr2string(raw.pw_name).expect("passwd without name"),
+            uid: raw.pw_uid,
+            gid: raw.pw_gid,
+            #[cfg(not(all(
+                target_os = "android",
+                any(target_arch = "x86", target_arch = "arm")
+            )))]
+            user_info: cstr2string(raw.pw_gecos),
+            #[cfg(all(target_os = "android", any(target_arch = "x86", target_arch = "arm")))]
+            user_info: None,
+            user_shell: cstr2string(raw.pw_shell),
+            user_dir: cstr2string(raw.pw_dir),
+            user_passwd: cstr2string(raw.pw_passwd),
+            #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
+            user_access_class: cstr2string(raw.pw_class),
+            #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
+            passwd_change_time: raw.pw_change,
+            #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
+            expiration: raw.pw_expire,
         }
     }
 
-    /// This is a wrapper function for `libc::getgrouplist`.
-    ///
-    /// From: `<https://man7.org/linux/man-pages/man3/getgrouplist.3.html>`
-    /// > If the number of groups of which user is a member is less than or
-    /// > equal to *ngroups, then the value *ngroups is returned.
-    /// > If the user is a member of more than *ngroups groups, then
-    /// > getgrouplist() returns -1.  In this case, the value returned in
-    /// > *ngroups can be used to resize the buffer passed to a further
-    /// > call getgrouplist().
-    ///
-    /// However, on macOS/darwin (and maybe others?) `getgrouplist` does
-    /// not update `ngroups` if `ngroups` is too small. Therefore, if not
-    /// updated by `getgrouplist`, `ngroups` needs to be increased in a
-    /// loop until `getgrouplist` stops returning -1.
-    pub fn belongs_to(&self) -> Vec<gid_t> {
-        let mut ngroups: c_int = 8;
-        let mut ngroups_old: c_int;
-        let mut groups = vec![0; ngroups.try_into().unwrap()];
-        let name = CString::new(self.name.clone()).unwrap();
-        loop {
-            ngroups_old = ngroups;
-            if unsafe { getgrouplist(name.as_ptr(), self.gid, groups.as_mut_ptr(), &mut ngroups) }
-                == -1
-            {
-                if ngroups == ngroups_old {
-                    ngroups *= 2;
+    /// This is a wrapper function for `libc::getgrouplist`.
+    ///
+    /// From: `<https://man7.org/linux/man-pages/man3/getgrouplist.3.html>`
+    /// > If the number of groups of which user is a member is less than or
+    /// > equal to *ngroups, then the value *ngroups is returned.
+    /// > If the user is a member of more than *ngroups groups, then
+    /// > getgrouplist() returns -1.  In this case, the value returned in
+    /// > *ngroups can be used to resize the buffer passed to a further
+    /// > call getgrouplist().
+    ///
+    /// However, on macOS/darwin (and maybe others?) `getgrouplist` does
+    /// not update `ngroups` if `ngroups` is too small. Therefore, if not
+    /// updated by `getgrouplist`, `ngroups` needs to be increased in a
+    /// loop until `getgrouplist` stops returning -1.
+    pub fn belongs_to(&self) -> Vec<gid_t> {
+        let mut ngroups: c_int = 8;
+        let mut ngroups_old: c_int;
+        let mut groups = vec![0; ngroups.try_into().unwrap()];
+        let name = CString::new(self.name.clone()).unwrap();
+        loop {
+            ngroups_old = ngroups;
+            if unsafe { getgrouplist(name.as_ptr(), self.gid, groups.as_mut_ptr(), &mut ngroups) }
+                == -1
+            {
+                if ngroups == ngroups_old {
+                    ngroups *= 2;
                 }
-                groups.resize(ngroups.try_into().unwrap(), 0);
-            } else {
+                groups.resize(ngroups.try_into().unwrap(), 0);
+            } else {
                 break;
             }
         }
-        let ngroups = ngroups.try_into().unwrap();
-        assert!(ngroups <= groups.len());
-        groups.truncate(ngroups);
-        groups
+        let ngroups = ngroups.try_into().unwrap();
+        assert!(ngroups <= groups.len());
+        groups.truncate(ngroups);
+        groups
     }
 }
 
-#[derive(Clone, Debug)]
-pub struct Group {
-    /// AKA group.gr_name
-    pub name: String,
-    /// AKA group.gr_gid
-    pub gid: gid_t,
+#[derive(Clone, Debug)]
+pub struct Group {
+    /// AKA group.gr_name
+    pub name: String,
+    /// AKA group.gr_gid
+    pub gid: gid_t,
 }
 
-impl Group {
-    /// SAFETY: gr_name must be valid and not change while
-    /// the function runs. That means PW_LOCK must be held.
-    unsafe fn from_raw(raw: group) -> Self {
-        Self {
-            name: cstr2string(raw.gr_name).expect("group without name"),
-            gid: raw.gr_gid,
+impl Group {
+    /// SAFETY: gr_name must be valid and not change while
+    /// the function runs. That means PW_LOCK must be held.
+    unsafe fn from_raw(raw: group) -> Self {
+        Self {
+            name: cstr2string(raw.gr_name).expect("group without name"),
+            gid: raw.gr_gid,
         }
     }
 }
 
-/// Fetch desired entry.
-pub trait Locate<K> {
-    fn locate(key: K) -> IOResult<Self>
-    where
-        Self: ::std::marker::Sized;
+/// Fetch desired entry.
+pub trait Locate<K> {
+    fn locate(key: K) -> IOResult<Self>
+    where
+        Self: ::std::marker::Sized;
 }
 
-// These functions are not thread-safe:
-// > The return value may point to a static area, and may be
-// > overwritten by subsequent calls to getpwent(3), getpwnam(),
-// > or getpwuid().
-// This applies not just to the struct but also the strings it points
-// to, so we must copy all the data we want before releasing the lock.
-// (Technically we must also ensure that the raw functions aren't being called
-// anywhere else in the program.)
-static PW_LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));
+// These functions are not thread-safe:
+// > The return value may point to a static area, and may be
+// > overwritten by subsequent calls to getpwent(3), getpwnam(),
+// > or getpwuid().
+// This applies not just to the struct but also the strings it points
+// to, so we must copy all the data we want before releasing the lock.
+// (Technically we must also ensure that the raw functions aren't being called
+// anywhere else in the program.)
+static PW_LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));
 
-macro_rules! f {
-    ($fnam:ident, $fid:ident, $t:ident, $st:ident) => {
-        impl Locate<$t> for $st {
-            fn locate(k: $t) -> IOResult<Self> {
-                let _guard = PW_LOCK.lock();
-                // SAFETY: We're holding PW_LOCK.
-                unsafe {
-                    let data = $fid(k);
-                    if !data.is_null() {
-                        Ok($st::from_raw(ptr::read(data as *const _)))
-                    } else {
-                        // FIXME: Resource limits, signals and I/O failure may
-                        // cause this too. See getpwnam(3).
-                        // errno must be set to zero before the call. We can
-                        // use libc::__errno_location() on some platforms.
-                        // The same applies for the two cases below.
-                        Err(IOError::new(
-                            ErrorKind::NotFound,
-                            format!("No such id: {}", k),
+macro_rules! f {
+    ($fnam:ident, $fid:ident, $t:ident, $st:ident) => {
+        impl Locate<$t> for $st {
+            fn locate(k: $t) -> IOResult<Self> {
+                let _guard = PW_LOCK.lock();
+                // SAFETY: We're holding PW_LOCK.
+                unsafe {
+                    let data = $fid(k);
+                    if !data.is_null() {
+                        Ok($st::from_raw(ptr::read(data as *const _)))
+                    } else {
+                        // FIXME: Resource limits, signals and I/O failure may
+                        // cause this too. See getpwnam(3).
+                        // errno must be set to zero before the call. We can
+                        // use libc::__errno_location() on some platforms.
+                        // The same applies for the two cases below.
+                        Err(IOError::new(
+                            ErrorKind::NotFound,
+                            format!("No such id: {}", k),
                         ))
                     }
                 }
             }
         }
 
-        impl<'a> Locate<&'a str> for $st {
-            fn locate(k: &'a str) -> IOResult<Self> {
-                let _guard = PW_LOCK.lock();
-                if let Ok(id) = k.parse::<$t>() {
-                    // SAFETY: We're holding PW_LOCK.
-                    unsafe {
-                        let data = $fid(id);
-                        if !data.is_null() {
-                            Ok($st::from_raw(ptr::read(data as *const _)))
-                        } else {
-                            Err(IOError::new(
-                                ErrorKind::NotFound,
-                                format!("No such id: {}", id),
+        impl<'a> Locate<&'a str> for $st {
+            fn locate(k: &'a str) -> IOResult<Self> {
+                let _guard = PW_LOCK.lock();
+                if let Ok(id) = k.parse::<$t>() {
+                    // SAFETY: We're holding PW_LOCK.
+                    unsafe {
+                        let data = $fid(id);
+                        if !data.is_null() {
+                            Ok($st::from_raw(ptr::read(data as *const _)))
+                        } else {
+                            Err(IOError::new(
+                                ErrorKind::NotFound,
+                                format!("No such id: {}", id),
                             ))
                         }
                     }
-                } else {
-                    // SAFETY: We're holding PW_LOCK.
-                    unsafe {
-                        let data = $fnam(CString::new(k).unwrap().as_ptr());
-                        if !data.is_null() {
-                            Ok($st::from_raw(ptr::read(data as *const _)))
-                        } else {
-                            Err(IOError::new(
-                                ErrorKind::NotFound,
-                                format!("Not found: {}", k),
+                } else {
+                    // SAFETY: We're holding PW_LOCK.
+                    unsafe {
+                        let data = $fnam(CString::new(k).unwrap().as_ptr());
+                        if !data.is_null() {
+                            Ok($st::from_raw(ptr::read(data as *const _)))
+                        } else {
+                            Err(IOError::new(
+                                ErrorKind::NotFound,
+                                format!("Not found: {}", k),
                             ))
                         }
                     }
@@ -725,54 +725,54 @@
     };
 }
 
-f!(getpwnam, getpwuid, uid_t, Passwd);
-#[cfg(not(target_os = "redox"))]
-f!(getgrnam, getgrgid, gid_t, Group);
+f!(getpwnam, getpwuid, uid_t, Passwd);
+#[cfg(not(target_os = "redox"))]
+f!(getgrnam, getgrgid, gid_t, Group);
 
-#[inline]
-pub fn uid2usr(id: uid_t) -> IOResult<String> {
-    Passwd::locate(id).map(|p| p.name)
+#[inline]
+pub fn uid2usr(id: uid_t) -> IOResult<String> {
+    Passwd::locate(id).map(|p| p.name)
 }
 
-#[cfg(not(target_os = "redox"))]
-#[inline]
-pub fn gid2grp(id: gid_t) -> IOResult<String> {
-    Group::locate(id).map(|p| p.name)
+#[cfg(not(target_os = "redox"))]
+#[inline]
+pub fn gid2grp(id: gid_t) -> IOResult<String> {
+    Group::locate(id).map(|p| p.name)
 }
 
-#[inline]
-pub fn usr2uid(name: &str) -> IOResult<uid_t> {
-    Passwd::locate(name).map(|p| p.uid)
+#[inline]
+pub fn usr2uid(name: &str) -> IOResult<uid_t> {
+    Passwd::locate(name).map(|p| p.uid)
 }
 
-#[cfg(not(target_os = "redox"))]
-#[inline]
-pub fn grp2gid(name: &str) -> IOResult<gid_t> {
-    Group::locate(name).map(|p| p.gid)
+#[cfg(not(target_os = "redox"))]
+#[inline]
+pub fn grp2gid(name: &str) -> IOResult<gid_t> {
+    Group::locate(name).map(|p| p.gid)
 }
 
-#[cfg(test)]
-mod test {
-    use super::*;
+#[cfg(test)]
+mod test {
+    use super::*;
 
-    #[test]
-    fn test_sort_groups() {
-        assert_eq!(sort_groups(vec![1, 2, 3], 4), vec![4, 1, 2, 3]);
-        assert_eq!(sort_groups(vec![1, 2, 3], 3), vec![3, 1, 2]);
-        assert_eq!(sort_groups(vec![1, 2, 3], 2), vec![2, 1, 3]);
-        assert_eq!(sort_groups(vec![1, 2, 3], 1), vec![1, 2, 3]);
-        assert_eq!(sort_groups(vec![1, 2, 3], 0), vec![0, 1, 2, 3]);
+    #[test]
+    fn test_sort_groups() {
+        assert_eq!(sort_groups(vec![1, 2, 3], 4), vec![4, 1, 2, 3]);
+        assert_eq!(sort_groups(vec![1, 2, 3], 3), vec![3, 1, 2]);
+        assert_eq!(sort_groups(vec![1, 2, 3], 2), vec![2, 1, 3]);
+        assert_eq!(sort_groups(vec![1, 2, 3], 1), vec![1, 2, 3]);
+        assert_eq!(sort_groups(vec![1, 2, 3], 0), vec![0, 1, 2, 3]);
     }
 
-    #[test]
-    fn test_entries_get_groups_gnu() {
-        if let Ok(mut groups) = get_groups() {
-            if let Some(last) = groups.pop() {
-                groups.insert(0, last);
-                assert_eq!(get_groups_gnu(Some(last)).unwrap(), groups);
+    #[test]
+    fn test_entries_get_groups_gnu() {
+        if let Ok(mut groups) = get_groups() {
+            if let Some(last) = groups.pop() {
+                groups.insert(0, last);
+                assert_eq!(get_groups_gnu(Some(last)).unwrap(), groups);
             }
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/fs.rs.html b/dev/src/uucore/features/fs.rs.html index 0aa975c30..21cd68b76 100644 --- a/dev/src/uucore/features/fs.rs.html +++ b/dev/src/uucore/features/fs.rs.html @@ -1,4 +1,4 @@ -fs.rs - source
1
+fs.rs - source
1
 2
 3
 4
@@ -671,678 +671,678 @@
 671
 672
 673
-
// This file is part of the uutils coreutils package.
-//
-// (c) Joseph Crail <jbcrail@gmail.com>
-// (c) Jian Zeng <anonymousknight96 AT gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Joseph Crail <jbcrail@gmail.com>
+// (c) Jian Zeng <anonymousknight96 AT gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-//! Set of functions to manage files and symlinks
+//! Set of functions to manage files and symlinks
 
-// spell-checker:ignore backport
+// spell-checker:ignore backport
 
-#[cfg(unix)]
-use libc::{
-    mode_t, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK, S_IRGRP,
-    S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH,
-    S_IXUSR,
+#[cfg(unix)]
+use libc::{
+    mode_t, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK, S_IRGRP,
+    S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH,
+    S_IXUSR,
 };
-use std::borrow::Cow;
-use std::collections::HashSet;
-use std::collections::VecDeque;
-use std::env;
-use std::ffi::{OsStr, OsString};
-use std::fs;
-use std::fs::read_dir;
-use std::hash::Hash;
-use std::io::{Error, ErrorKind, Result as IOResult};
-#[cfg(unix)]
-use std::os::unix::{fs::MetadataExt, io::AsRawFd};
-use std::path::{Component, Path, PathBuf, MAIN_SEPARATOR};
-#[cfg(target_os = "windows")]
-use winapi_util::AsHandleRef;
+use std::borrow::Cow;
+use std::collections::HashSet;
+use std::collections::VecDeque;
+use std::env;
+use std::ffi::{OsStr, OsString};
+use std::fs;
+use std::fs::read_dir;
+use std::hash::Hash;
+use std::io::{Error, ErrorKind, Result as IOResult};
+#[cfg(unix)]
+use std::os::unix::{fs::MetadataExt, io::AsRawFd};
+use std::path::{Component, Path, PathBuf, MAIN_SEPARATOR};
+#[cfg(target_os = "windows")]
+use winapi_util::AsHandleRef;
 
-#[cfg(unix)]
-#[macro_export]
-macro_rules! has {
-    ($mode:expr, $perm:expr) => {
-        $mode & $perm != 0
-    };
+#[cfg(unix)]
+#[macro_export]
+macro_rules! has {
+    ($mode:expr, $perm:expr) => {
+        $mode & $perm != 0
+    };
 }
 
-/// Information to uniquely identify a file
-pub struct FileInformation(
-    #[cfg(unix)] nix::sys::stat::FileStat,
-    #[cfg(windows)] winapi_util::file::Information,
+/// Information to uniquely identify a file
+pub struct FileInformation(
+    #[cfg(unix)] nix::sys::stat::FileStat,
+    #[cfg(windows)] winapi_util::file::Information,
 );
 
-impl FileInformation {
-    /// Get information from a currently open file
-    #[cfg(unix)]
-    pub fn from_file(file: &impl AsRawFd) -> IOResult<Self> {
-        let stat = nix::sys::stat::fstat(file.as_raw_fd())?;
-        Ok(Self(stat))
+impl FileInformation {
+    /// Get information from a currently open file
+    #[cfg(unix)]
+    pub fn from_file(file: &impl AsRawFd) -> IOResult<Self> {
+        let stat = nix::sys::stat::fstat(file.as_raw_fd())?;
+        Ok(Self(stat))
     }
 
-    /// Get information from a currently open file
-    #[cfg(target_os = "windows")]
-    pub fn from_file(file: &impl AsHandleRef) -> IOResult<Self> {
-        let info = winapi_util::file::information(file.as_handle_ref())?;
-        Ok(Self(info))
+    /// Get information from a currently open file
+    #[cfg(target_os = "windows")]
+    pub fn from_file(file: &impl AsHandleRef) -> IOResult<Self> {
+        let info = winapi_util::file::information(file.as_handle_ref())?;
+        Ok(Self(info))
     }
 
-    /// Get information for a given path.
-    ///
-    /// If `path` points to a symlink and `dereference` is true, information about
-    /// the link's target will be returned.
-    pub fn from_path(path: impl AsRef<Path>, dereference: bool) -> IOResult<Self> {
-        #[cfg(unix)]
-        {
-            let stat = if dereference {
-                nix::sys::stat::stat(path.as_ref())
-            } else {
-                nix::sys::stat::lstat(path.as_ref())
+    /// Get information for a given path.
+    ///
+    /// If `path` points to a symlink and `dereference` is true, information about
+    /// the link's target will be returned.
+    pub fn from_path(path: impl AsRef<Path>, dereference: bool) -> IOResult<Self> {
+        #[cfg(unix)]
+        {
+            let stat = if dereference {
+                nix::sys::stat::stat(path.as_ref())
+            } else {
+                nix::sys::stat::lstat(path.as_ref())
             };
-            Ok(Self(stat?))
+            Ok(Self(stat?))
         }
-        #[cfg(target_os = "windows")]
-        {
-            use std::fs::OpenOptions;
-            use std::os::windows::prelude::*;
-            let mut open_options = OpenOptions::new();
-            let mut custom_flags = 0;
-            if !dereference {
-                custom_flags |=
-                    windows_sys::Win32::Storage::FileSystem::FILE_FLAG_OPEN_REPARSE_POINT;
+        #[cfg(target_os = "windows")]
+        {
+            use std::fs::OpenOptions;
+            use std::os::windows::prelude::*;
+            let mut open_options = OpenOptions::new();
+            let mut custom_flags = 0;
+            if !dereference {
+                custom_flags |=
+                    windows_sys::Win32::Storage::FileSystem::FILE_FLAG_OPEN_REPARSE_POINT;
             }
-            custom_flags |= windows_sys::Win32::Storage::FileSystem::FILE_FLAG_BACKUP_SEMANTICS;
-            open_options.custom_flags(custom_flags);
-            let file = open_options.read(true).open(path.as_ref())?;
-            Self::from_file(&file)
+            custom_flags |= windows_sys::Win32::Storage::FileSystem::FILE_FLAG_BACKUP_SEMANTICS;
+            open_options.custom_flags(custom_flags);
+            let file = open_options.read(true).open(path.as_ref())?;
+            Self::from_file(&file)
         }
     }
 
-    pub fn file_size(&self) -> u64 {
-        #[cfg(unix)]
-        {
-            assert!(self.0.st_size >= 0, "File size is negative");
-            self.0.st_size.try_into().unwrap()
+    pub fn file_size(&self) -> u64 {
+        #[cfg(unix)]
+        {
+            assert!(self.0.st_size >= 0, "File size is negative");
+            self.0.st_size.try_into().unwrap()
         }
-        #[cfg(target_os = "windows")]
-        {
-            self.0.file_size()
+        #[cfg(target_os = "windows")]
+        {
+            self.0.file_size()
         }
     }
 
-    #[cfg(windows)]
-    pub fn file_index(&self) -> u64 {
-        self.0.file_index()
+    #[cfg(windows)]
+    pub fn file_index(&self) -> u64 {
+        self.0.file_index()
     }
 
-    pub fn number_of_links(&self) -> u64 {
-        #[cfg(unix)]
-        return self.0.st_nlink as u64;
-        #[cfg(windows)]
-        return self.0.number_of_links() as u64;
+    pub fn number_of_links(&self) -> u64 {
+        #[cfg(unix)]
+        return self.0.st_nlink as u64;
+        #[cfg(windows)]
+        return self.0.number_of_links() as u64;
     }
 
-    #[cfg(unix)]
-    pub fn inode(&self) -> u64 {
-        self.0.st_ino as u64
+    #[cfg(unix)]
+    pub fn inode(&self) -> u64 {
+        self.0.st_ino as u64
     }
 }
 
-#[cfg(unix)]
-impl PartialEq for FileInformation {
-    fn eq(&self, other: &Self) -> bool {
-        self.0.st_dev == other.0.st_dev && self.0.st_ino == other.0.st_ino
+#[cfg(unix)]
+impl PartialEq for FileInformation {
+    fn eq(&self, other: &Self) -> bool {
+        self.0.st_dev == other.0.st_dev && self.0.st_ino == other.0.st_ino
     }
 }
 
-#[cfg(target_os = "windows")]
-impl PartialEq for FileInformation {
-    fn eq(&self, other: &Self) -> bool {
-        self.0.volume_serial_number() == other.0.volume_serial_number()
-            && self.0.file_index() == other.0.file_index()
+#[cfg(target_os = "windows")]
+impl PartialEq for FileInformation {
+    fn eq(&self, other: &Self) -> bool {
+        self.0.volume_serial_number() == other.0.volume_serial_number()
+            && self.0.file_index() == other.0.file_index()
     }
 }
 
-impl Eq for FileInformation {}
+impl Eq for FileInformation {}
 
-impl Hash for FileInformation {
-    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
-        #[cfg(unix)]
-        {
-            self.0.st_dev.hash(state);
-            self.0.st_ino.hash(state);
+impl Hash for FileInformation {
+    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
+        #[cfg(unix)]
+        {
+            self.0.st_dev.hash(state);
+            self.0.st_ino.hash(state);
         }
-        #[cfg(target_os = "windows")]
-        {
-            self.0.volume_serial_number().hash(state);
-            self.0.file_index().hash(state);
+        #[cfg(target_os = "windows")]
+        {
+            self.0.volume_serial_number().hash(state);
+            self.0.file_index().hash(state);
         }
     }
 }
 
-/// resolve a relative path
-pub fn resolve_relative_path(path: &Path) -> Cow<Path> {
-    if path.components().all(|e| e != Component::ParentDir) {
-        return path.into();
+/// resolve a relative path
+pub fn resolve_relative_path(path: &Path) -> Cow<Path> {
+    if path.components().all(|e| e != Component::ParentDir) {
+        return path.into();
     }
-    let root = Component::RootDir.as_os_str();
-    let mut result = env::current_dir().unwrap_or_else(|_| PathBuf::from(root));
-    for comp in path.components() {
-        match comp {
-            Component::ParentDir => {
-                if let Ok(p) = result.read_link() {
-                    result = p;
+    let root = Component::RootDir.as_os_str();
+    let mut result = env::current_dir().unwrap_or_else(|_| PathBuf::from(root));
+    for comp in path.components() {
+        match comp {
+            Component::ParentDir => {
+                if let Ok(p) = result.read_link() {
+                    result = p;
                 }
-                result.pop();
+                result.pop();
             }
-            Component::CurDir => (),
-            Component::RootDir | Component::Normal(_) | Component::Prefix(_) => {
-                result.push(comp.as_os_str());
+            Component::CurDir => (),
+            Component::RootDir | Component::Normal(_) | Component::Prefix(_) => {
+                result.push(comp.as_os_str());
             }
         }
     }
-    result.into()
+    result.into()
 }
 
-/// Controls how symbolic links should be handled when canonicalizing a path.
-#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum MissingHandling {
-    /// Return an error if any part of the path is missing.
-    Normal,
+/// Controls how symbolic links should be handled when canonicalizing a path.
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub enum MissingHandling {
+    /// Return an error if any part of the path is missing.
+    Normal,
 
-    /// Resolve symbolic links, ignoring errors on the final component.
-    Existing,
+    /// Resolve symbolic links, ignoring errors on the final component.
+    Existing,
 
-    /// Resolve symbolic links, ignoring errors on the non-final components.
-    Missing,
+    /// Resolve symbolic links, ignoring errors on the non-final components.
+    Missing,
 }
 
-/// Controls when symbolic links are resolved
-#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum ResolveMode {
-    /// Do not resolve any symbolic links.
-    None,
+/// Controls when symbolic links are resolved
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub enum ResolveMode {
+    /// Do not resolve any symbolic links.
+    None,
 
-    /// Resolve symlinks as encountered when processing the path
-    Physical,
+    /// Resolve symlinks as encountered when processing the path
+    Physical,
 
-    /// Resolve '..' elements before symlinks
-    Logical,
+    /// Resolve '..' elements before symlinks
+    Logical,
 }
 
-/// Normalize a path by removing relative information
-/// For example, convert 'bar/../foo/bar.txt' => 'foo/bar.txt'
-/// copied from `<https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90>`
-/// both projects are MIT `<https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT>`
-/// for std impl progress see rfc `<https://github.com/rust-lang/rfcs/issues/2208>`
-/// replace this once that lands
-pub fn normalize_path(path: &Path) -> PathBuf {
-    let mut components = path.components().peekable();
-    let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() {
-        components.next();
-        PathBuf::from(c.as_os_str())
-    } else {
-        PathBuf::new()
+/// Normalize a path by removing relative information
+/// For example, convert 'bar/../foo/bar.txt' => 'foo/bar.txt'
+/// copied from `<https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90>`
+/// both projects are MIT `<https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT>`
+/// for std impl progress see rfc `<https://github.com/rust-lang/rfcs/issues/2208>`
+/// replace this once that lands
+pub fn normalize_path(path: &Path) -> PathBuf {
+    let mut components = path.components().peekable();
+    let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() {
+        components.next();
+        PathBuf::from(c.as_os_str())
+    } else {
+        PathBuf::new()
     };
 
-    for component in components {
-        match component {
-            Component::Prefix(..) => unreachable!(),
-            Component::RootDir => {
-                ret.push(component.as_os_str());
+    for component in components {
+        match component {
+            Component::Prefix(..) => unreachable!(),
+            Component::RootDir => {
+                ret.push(component.as_os_str());
             }
-            Component::CurDir => {}
-            Component::ParentDir => {
-                ret.pop();
+            Component::CurDir => {}
+            Component::ParentDir => {
+                ret.pop();
             }
-            Component::Normal(c) => {
-                ret.push(c);
+            Component::Normal(c) => {
+                ret.push(c);
             }
         }
     }
-    ret
+    ret
 }
 
-fn resolve_symlink<P: AsRef<Path>>(path: P) -> IOResult<Option<PathBuf>> {
-    let result = if fs::symlink_metadata(&path)?.file_type().is_symlink() {
-        Some(fs::read_link(&path)?)
-    } else {
-        None
-    };
-    Ok(result)
+fn resolve_symlink<P: AsRef<Path>>(path: P) -> IOResult<Option<PathBuf>> {
+    let result = if fs::symlink_metadata(&path)?.file_type().is_symlink() {
+        Some(fs::read_link(&path)?)
+    } else {
+        None
+    };
+    Ok(result)
 }
 
-enum OwningComponent {
-    Prefix(OsString),
-    RootDir,
-    CurDir,
-    ParentDir,
-    Normal(OsString),
+enum OwningComponent {
+    Prefix(OsString),
+    RootDir,
+    CurDir,
+    ParentDir,
+    Normal(OsString),
 }
 
-impl OwningComponent {
-    fn as_os_str(&self) -> &OsStr {
-        match self {
-            Self::Prefix(s) => s.as_os_str(),
-            Self::RootDir => Component::RootDir.as_os_str(),
-            Self::CurDir => Component::CurDir.as_os_str(),
-            Self::ParentDir => Component::ParentDir.as_os_str(),
-            Self::Normal(s) => s.as_os_str(),
+impl OwningComponent {
+    fn as_os_str(&self) -> &OsStr {
+        match self {
+            Self::Prefix(s) => s.as_os_str(),
+            Self::RootDir => Component::RootDir.as_os_str(),
+            Self::CurDir => Component::CurDir.as_os_str(),
+            Self::ParentDir => Component::ParentDir.as_os_str(),
+            Self::Normal(s) => s.as_os_str(),
         }
     }
 }
 
-impl<'a> From<Component<'a>> for OwningComponent {
-    fn from(comp: Component<'a>) -> Self {
-        match comp {
-            Component::Prefix(_) => Self::Prefix(comp.as_os_str().to_os_string()),
-            Component::RootDir => Self::RootDir,
-            Component::CurDir => Self::CurDir,
-            Component::ParentDir => Self::ParentDir,
-            Component::Normal(s) => Self::Normal(s.to_os_string()),
+impl<'a> From<Component<'a>> for OwningComponent {
+    fn from(comp: Component<'a>) -> Self {
+        match comp {
+            Component::Prefix(_) => Self::Prefix(comp.as_os_str().to_os_string()),
+            Component::RootDir => Self::RootDir,
+            Component::CurDir => Self::CurDir,
+            Component::ParentDir => Self::ParentDir,
+            Component::Normal(s) => Self::Normal(s.to_os_string()),
         }
     }
 }
 
-/// Return the canonical, absolute form of a path.
-///
-/// This function is a generalization of [`std::fs::canonicalize`] that
-/// allows controlling how symbolic links are resolved and how to deal
-/// with missing components. It returns the canonical, absolute form of
-/// a path.
-/// The `miss_mode` parameter controls how missing path elements are handled
-///
-/// * [`MissingHandling::Normal`] makes this function behave like
-///   [`std::fs::canonicalize`], resolving symbolic links and returning
-///   an error if the path does not exist.
-/// * [`MissingHandling::Missing`] makes this function ignore non-final
-///   components of the path that could not be resolved.
-/// * [`MissingHandling::Existing`] makes this function return an error
-///   if the final component of the path does not exist.
-///
-/// The `res_mode` parameter controls how symbolic links are
-/// resolved:
-///
-/// * [`ResolveMode::None`] makes this function not try to resolve
-///   any symbolic links.
-/// * [`ResolveMode::Physical`] makes this function resolve symlinks as they
-///   are encountered
-/// * [`ResolveMode::Logical`] makes this function resolve '..' components
-///   before symlinks
-///
-pub fn canonicalize<P: AsRef<Path>>(
-    original: P,
-    miss_mode: MissingHandling,
-    res_mode: ResolveMode,
-) -> IOResult<PathBuf> {
-    const SYMLINKS_TO_LOOK_FOR_LOOPS: i32 = 20;
-    let original = original.as_ref();
-    let has_to_be_directory =
-        (miss_mode == MissingHandling::Normal || miss_mode == MissingHandling::Existing) && {
-            let path_str = original.to_string_lossy();
-            path_str.ends_with(MAIN_SEPARATOR) || path_str.ends_with('/')
+/// Return the canonical, absolute form of a path.
+///
+/// This function is a generalization of [`std::fs::canonicalize`] that
+/// allows controlling how symbolic links are resolved and how to deal
+/// with missing components. It returns the canonical, absolute form of
+/// a path.
+/// The `miss_mode` parameter controls how missing path elements are handled
+///
+/// * [`MissingHandling::Normal`] makes this function behave like
+///   [`std::fs::canonicalize`], resolving symbolic links and returning
+///   an error if the path does not exist.
+/// * [`MissingHandling::Missing`] makes this function ignore non-final
+///   components of the path that could not be resolved.
+/// * [`MissingHandling::Existing`] makes this function return an error
+///   if the final component of the path does not exist.
+///
+/// The `res_mode` parameter controls how symbolic links are
+/// resolved:
+///
+/// * [`ResolveMode::None`] makes this function not try to resolve
+///   any symbolic links.
+/// * [`ResolveMode::Physical`] makes this function resolve symlinks as they
+///   are encountered
+/// * [`ResolveMode::Logical`] makes this function resolve '..' components
+///   before symlinks
+///
+pub fn canonicalize<P: AsRef<Path>>(
+    original: P,
+    miss_mode: MissingHandling,
+    res_mode: ResolveMode,
+) -> IOResult<PathBuf> {
+    const SYMLINKS_TO_LOOK_FOR_LOOPS: i32 = 20;
+    let original = original.as_ref();
+    let has_to_be_directory =
+        (miss_mode == MissingHandling::Normal || miss_mode == MissingHandling::Existing) && {
+            let path_str = original.to_string_lossy();
+            path_str.ends_with(MAIN_SEPARATOR) || path_str.ends_with('/')
         };
-    let original = if original.is_absolute() {
-        original.to_path_buf()
-    } else {
-        let current_dir = env::current_dir()?;
-        dunce::canonicalize(current_dir)?.join(original)
+    let original = if original.is_absolute() {
+        original.to_path_buf()
+    } else {
+        let current_dir = env::current_dir()?;
+        dunce::canonicalize(current_dir)?.join(original)
     };
-    let path = if res_mode == ResolveMode::Logical {
-        normalize_path(&original)
-    } else {
-        original
+    let path = if res_mode == ResolveMode::Logical {
+        normalize_path(&original)
+    } else {
+        original
     };
-    let mut parts: VecDeque<OwningComponent> = path.components().map(|part| part.into()).collect();
-    let mut result = PathBuf::new();
-    let mut followed_symlinks = 0;
-    let mut visited_files = HashSet::new();
-    while let Some(part) = parts.pop_front() {
-        match part {
-            OwningComponent::Prefix(s) => {
-                result.push(s);
+    let mut parts: VecDeque<OwningComponent> = path.components().map(|part| part.into()).collect();
+    let mut result = PathBuf::new();
+    let mut followed_symlinks = 0;
+    let mut visited_files = HashSet::new();
+    while let Some(part) = parts.pop_front() {
+        match part {
+            OwningComponent::Prefix(s) => {
+                result.push(s);
                 continue;
             }
-            OwningComponent::RootDir | OwningComponent::Normal(..) => {
-                result.push(part.as_os_str());
+            OwningComponent::RootDir | OwningComponent::Normal(..) => {
+                result.push(part.as_os_str());
             }
-            OwningComponent::CurDir => {}
-            OwningComponent::ParentDir => {
-                result.pop();
+            OwningComponent::CurDir => {}
+            OwningComponent::ParentDir => {
+                result.pop();
             }
         }
-        if res_mode == ResolveMode::None {
+        if res_mode == ResolveMode::None {
             continue;
         }
-        match resolve_symlink(&result) {
-            Ok(Some(link_path)) => {
-                for link_part in link_path.components().rev() {
-                    parts.push_front(link_part.into());
+        match resolve_symlink(&result) {
+            Ok(Some(link_path)) => {
+                for link_part in link_path.components().rev() {
+                    parts.push_front(link_part.into());
                 }
-                if followed_symlinks < SYMLINKS_TO_LOOK_FOR_LOOPS {
-                    followed_symlinks += 1;
-                } else {
-                    let file_info =
-                        FileInformation::from_path(result.parent().unwrap(), false).unwrap();
-                    let mut path_to_follow = PathBuf::new();
-                    for part in &parts {
-                        path_to_follow.push(part.as_os_str());
+                if followed_symlinks < SYMLINKS_TO_LOOK_FOR_LOOPS {
+                    followed_symlinks += 1;
+                } else {
+                    let file_info =
+                        FileInformation::from_path(result.parent().unwrap(), false).unwrap();
+                    let mut path_to_follow = PathBuf::new();
+                    for part in &parts {
+                        path_to_follow.push(part.as_os_str());
                     }
-                    if !visited_files.insert((file_info, path_to_follow)) {
-                        return Err(Error::new(
-                            ErrorKind::InvalidInput,
+                    if !visited_files.insert((file_info, path_to_follow)) {
+                        return Err(Error::new(
+                            ErrorKind::InvalidInput,
                             "Too many levels of symbolic links",
-                        )); // TODO use ErrorKind::FilesystemLoop when stable
-                    }
+                        )); // TODO use ErrorKind::FilesystemLoop when stable
+                    }
                 }
-                result.pop();
+                result.pop();
             }
-            Err(e) => {
-                if miss_mode == MissingHandling::Existing
-                    || (miss_mode == MissingHandling::Normal && !parts.is_empty())
+            Err(e) => {
+                if miss_mode == MissingHandling::Existing
+                    || (miss_mode == MissingHandling::Normal && !parts.is_empty())
                 {
-                    return Err(e);
+                    return Err(e);
                 }
             }
-            _ => {}
+            _ => {}
         }
     }
-    // raise Not a directory if required
-    match miss_mode {
-        MissingHandling::Existing => {
-            if has_to_be_directory {
-                read_dir(&result)?;
+    // raise Not a directory if required
+    match miss_mode {
+        MissingHandling::Existing => {
+            if has_to_be_directory {
+                read_dir(&result)?;
             }
         }
-        MissingHandling::Normal => {
-            if result.exists() {
-                if has_to_be_directory {
-                    read_dir(&result)?;
+        MissingHandling::Normal => {
+            if result.exists() {
+                if has_to_be_directory {
+                    read_dir(&result)?;
                 }
-            } else if let Some(parent) = result.parent() {
-                read_dir(parent)?;
+            } else if let Some(parent) = result.parent() {
+                read_dir(parent)?;
             }
         }
-        _ => {}
+        _ => {}
     }
-    Ok(result)
+    Ok(result)
 }
 
-#[cfg(not(unix))]
-pub fn display_permissions(metadata: &fs::Metadata, display_file_type: bool) -> String {
-    let write = if metadata.permissions().readonly() {
-        '-'
-    } else {
-        'w'
-    };
+#[cfg(not(unix))]
+pub fn display_permissions(metadata: &fs::Metadata, display_file_type: bool) -> String {
+    let write = if metadata.permissions().readonly() {
+        '-'
+    } else {
+        'w'
+    };
 
-    if display_file_type {
-        let file_type = if metadata.is_symlink() {
-            'l'
-        } else if metadata.is_dir() {
-            'd'
-        } else {
-            '-'
-        };
+    if display_file_type {
+        let file_type = if metadata.is_symlink() {
+            'l'
+        } else if metadata.is_dir() {
+            'd'
+        } else {
+            '-'
+        };
 
-        format!("{0}r{1}xr{1}xr{1}x", file_type, write)
-    } else {
-        format!("r{0}xr{0}xr{0}x", write)
+        format!("{0}r{1}xr{1}xr{1}x", file_type, write)
+    } else {
+        format!("r{0}xr{0}xr{0}x", write)
     }
 }
 
-#[cfg(unix)]
-/// Display the permissions of a file
-/// On non unix like system, just show '----------'
-pub fn display_permissions(metadata: &fs::Metadata, display_file_type: bool) -> String {
-    let mode: mode_t = metadata.mode() as mode_t;
-    display_permissions_unix(mode, display_file_type)
+#[cfg(unix)]
+/// Display the permissions of a file
+/// On non unix like system, just show '----------'
+pub fn display_permissions(metadata: &fs::Metadata, display_file_type: bool) -> String {
+    let mode: mode_t = metadata.mode() as mode_t;
+    display_permissions_unix(mode, display_file_type)
 }
 
-#[cfg(unix)]
-/// Display the permissions of a file on a unix like system
-pub fn display_permissions_unix(mode: mode_t, display_file_type: bool) -> String {
-    let mut result;
-    if display_file_type {
-        result = String::with_capacity(10);
-        result.push(match mode & S_IFMT {
-            S_IFDIR => 'd',
-            S_IFCHR => 'c',
-            S_IFBLK => 'b',
-            S_IFREG => '-',
-            S_IFIFO => 'p',
-            S_IFLNK => 'l',
-            S_IFSOCK => 's',
-            // TODO: Other file types
-            _ => '?',
+#[cfg(unix)]
+/// Display the permissions of a file on a unix like system
+pub fn display_permissions_unix(mode: mode_t, display_file_type: bool) -> String {
+    let mut result;
+    if display_file_type {
+        result = String::with_capacity(10);
+        result.push(match mode & S_IFMT {
+            S_IFDIR => 'd',
+            S_IFCHR => 'c',
+            S_IFBLK => 'b',
+            S_IFREG => '-',
+            S_IFIFO => 'p',
+            S_IFLNK => 'l',
+            S_IFSOCK => 's',
+            // TODO: Other file types
+            _ => '?',
         });
-    } else {
-        result = String::with_capacity(9);
+    } else {
+        result = String::with_capacity(9);
     }
 
-    result.push(if has!(mode, S_IRUSR) { 'r' } else { '-' });
-    result.push(if has!(mode, S_IWUSR) { 'w' } else { '-' });
-    result.push(if has!(mode, S_ISUID as mode_t) {
-        if has!(mode, S_IXUSR) {
-            's'
-        } else {
-            'S'
-        }
-    } else if has!(mode, S_IXUSR) {
-        'x'
-    } else {
-        '-'
-    });
+    result.push(if has!(mode, S_IRUSR) { 'r' } else { '-' });
+    result.push(if has!(mode, S_IWUSR) { 'w' } else { '-' });
+    result.push(if has!(mode, S_ISUID as mode_t) {
+        if has!(mode, S_IXUSR) {
+            's'
+        } else {
+            'S'
+        }
+    } else if has!(mode, S_IXUSR) {
+        'x'
+    } else {
+        '-'
+    });
 
-    result.push(if has!(mode, S_IRGRP) { 'r' } else { '-' });
-    result.push(if has!(mode, S_IWGRP) { 'w' } else { '-' });
-    result.push(if has!(mode, S_ISGID as mode_t) {
-        if has!(mode, S_IXGRP) {
-            's'
-        } else {
-            'S'
-        }
-    } else if has!(mode, S_IXGRP) {
-        'x'
-    } else {
-        '-'
-    });
+    result.push(if has!(mode, S_IRGRP) { 'r' } else { '-' });
+    result.push(if has!(mode, S_IWGRP) { 'w' } else { '-' });
+    result.push(if has!(mode, S_ISGID as mode_t) {
+        if has!(mode, S_IXGRP) {
+            's'
+        } else {
+            'S'
+        }
+    } else if has!(mode, S_IXGRP) {
+        'x'
+    } else {
+        '-'
+    });
 
-    result.push(if has!(mode, S_IROTH) { 'r' } else { '-' });
-    result.push(if has!(mode, S_IWOTH) { 'w' } else { '-' });
-    result.push(if has!(mode, S_ISVTX as mode_t) {
-        if has!(mode, S_IXOTH) {
-            't'
-        } else {
-            'T'
-        }
-    } else if has!(mode, S_IXOTH) {
-        'x'
-    } else {
-        '-'
-    });
+    result.push(if has!(mode, S_IROTH) { 'r' } else { '-' });
+    result.push(if has!(mode, S_IWOTH) { 'w' } else { '-' });
+    result.push(if has!(mode, S_ISVTX as mode_t) {
+        if has!(mode, S_IXOTH) {
+            't'
+        } else {
+            'T'
+        }
+    } else if has!(mode, S_IXOTH) {
+        'x'
+    } else {
+        '-'
+    });
 
-    result
+    result
 }
 
-/// For some programs like install or mkdir, dir/. can be provided
-/// Special case to match GNU's behavior:
-/// install -d foo/. should work and just create foo/
-/// std::fs::create_dir("foo/."); fails in pure Rust
-pub fn dir_strip_dot_for_creation(path: &Path) -> PathBuf {
-    if path.to_string_lossy().ends_with("/.") {
-        // Do a simple dance to strip the "/."
-        Path::new(&path).components().collect::<PathBuf>()
-    } else {
-        path.to_path_buf()
+/// For some programs like install or mkdir, dir/. can be provided
+/// Special case to match GNU's behavior:
+/// install -d foo/. should work and just create foo/
+/// std::fs::create_dir("foo/."); fails in pure Rust
+pub fn dir_strip_dot_for_creation(path: &Path) -> PathBuf {
+    if path.to_string_lossy().ends_with("/.") {
+        // Do a simple dance to strip the "/."
+        Path::new(&path).components().collect::<PathBuf>()
+    } else {
+        path.to_path_buf()
     }
 }
 
-/// Checks if `p1` and `p2` are the same file.
-/// If error happens when trying to get files' metadata, returns false
-pub fn paths_refer_to_same_file<P: AsRef<Path>>(p1: P, p2: P, dereference: bool) -> bool {
-    infos_refer_to_same_file(
-        FileInformation::from_path(p1, dereference),
-        FileInformation::from_path(p2, dereference),
+/// Checks if `p1` and `p2` are the same file.
+/// If error happens when trying to get files' metadata, returns false
+pub fn paths_refer_to_same_file<P: AsRef<Path>>(p1: P, p2: P, dereference: bool) -> bool {
+    infos_refer_to_same_file(
+        FileInformation::from_path(p1, dereference),
+        FileInformation::from_path(p2, dereference),
     )
 }
 
-/// Checks if `p1` and `p2` are the same file information.
-/// If error happens when trying to get files' metadata, returns false
-pub fn infos_refer_to_same_file(
-    info1: IOResult<FileInformation>,
-    info2: IOResult<FileInformation>,
-) -> bool {
-    if let Ok(info1) = info1 {
-        if let Ok(info2) = info2 {
-            return info1 == info2;
+/// Checks if `p1` and `p2` are the same file information.
+/// If error happens when trying to get files' metadata, returns false
+pub fn infos_refer_to_same_file(
+    info1: IOResult<FileInformation>,
+    info2: IOResult<FileInformation>,
+) -> bool {
+    if let Ok(info1) = info1 {
+        if let Ok(info2) = info2 {
+            return info1 == info2;
         }
     }
-    false
+    false
+}
+
+/// Converts absolute `path` to be relative to absolute `to` path.
+pub fn make_path_relative_to<P1: AsRef<Path>, P2: AsRef<Path>>(path: P1, to: P2) -> PathBuf {
+    let path = path.as_ref();
+    let to = to.as_ref();
+    let common_prefix_size = path
+        .components()
+        .zip(to.components())
+        .take_while(|(first, second)| first == second)
+        .count();
+    let path_suffix = path
+        .components()
+        .skip(common_prefix_size)
+        .map(|x| x.as_os_str());
+    let mut components: Vec<_> = to
+        .components()
+        .skip(common_prefix_size)
+        .map(|_| Component::ParentDir.as_os_str())
+        .chain(path_suffix)
+        .collect();
+    if components.is_empty() {
+        components.push(Component::CurDir.as_os_str());
+    }
+    components.iter().collect()
 }
 
-/// Converts absolute `path` to be relative to absolute `to` path.
-pub fn make_path_relative_to<P1: AsRef<Path>, P2: AsRef<Path>>(path: P1, to: P2) -> PathBuf {
-    let path = path.as_ref();
-    let to = to.as_ref();
-    let common_prefix_size = path
-        .components()
-        .zip(to.components())
-        .take_while(|(first, second)| first == second)
-        .count();
-    let path_suffix = path
-        .components()
-        .skip(common_prefix_size)
-        .map(|x| x.as_os_str());
-    let mut components: Vec<_> = to
-        .components()
-        .skip(common_prefix_size)
-        .map(|_| Component::ParentDir.as_os_str())
-        .chain(path_suffix)
-        .collect();
-    if components.is_empty() {
-        components.push(Component::CurDir.as_os_str());
-    }
-    components.iter().collect()
-}
+#[cfg(test)]
+mod tests {
+    // Note this useful idiom: importing names from outer (for mod tests) scope.
+    use super::*;
 
-#[cfg(test)]
-mod tests {
-    // Note this useful idiom: importing names from outer (for mod tests) scope.
-    use super::*;
-
-    struct NormalizePathTestCase<'a> {
-        path: &'a str,
-        test: &'a str,
+    struct NormalizePathTestCase<'a> {
+        path: &'a str,
+        test: &'a str,
     }
 
-    const NORMALIZE_PATH_TESTS: [NormalizePathTestCase; 8] = [
-        NormalizePathTestCase {
-            path: "./foo/bar.txt",
-            test: "foo/bar.txt",
+    const NORMALIZE_PATH_TESTS: [NormalizePathTestCase; 8] = [
+        NormalizePathTestCase {
+            path: "./foo/bar.txt",
+            test: "foo/bar.txt",
         },
-        NormalizePathTestCase {
-            path: "bar/../foo/bar.txt",
-            test: "foo/bar.txt",
+        NormalizePathTestCase {
+            path: "bar/../foo/bar.txt",
+            test: "foo/bar.txt",
         },
-        NormalizePathTestCase {
-            path: "foo///bar.txt",
-            test: "foo/bar.txt",
+        NormalizePathTestCase {
+            path: "foo///bar.txt",
+            test: "foo/bar.txt",
         },
-        NormalizePathTestCase {
-            path: "foo///bar",
-            test: "foo/bar",
+        NormalizePathTestCase {
+            path: "foo///bar",
+            test: "foo/bar",
         },
-        NormalizePathTestCase {
-            path: "foo//./bar",
-            test: "foo/bar",
+        NormalizePathTestCase {
+            path: "foo//./bar",
+            test: "foo/bar",
         },
-        NormalizePathTestCase {
-            path: "/foo//./bar",
-            test: "/foo/bar",
+        NormalizePathTestCase {
+            path: "/foo//./bar",
+            test: "/foo/bar",
         },
-        NormalizePathTestCase {
-            path: r"C:/you/later/",
-            test: "C:/you/later",
+        NormalizePathTestCase {
+            path: r"C:/you/later/",
+            test: "C:/you/later",
         },
-        NormalizePathTestCase {
-            path: "\\networkShare/a//foo//./bar",
-            test: "\\networkShare/a/foo/bar",
+        NormalizePathTestCase {
+            path: "\\networkShare/a//foo//./bar",
+            test: "\\networkShare/a/foo/bar",
         },
     ];
 
-    #[test]
-    fn test_normalize_path() {
-        for test in &NORMALIZE_PATH_TESTS {
-            let path = Path::new(test.path);
-            let normalized = normalize_path(path);
+    #[test]
+    fn test_normalize_path() {
+        for test in &NORMALIZE_PATH_TESTS {
+            let path = Path::new(test.path);
+            let normalized = normalize_path(path);
             assert_eq!(
-                test.test
-                    .replace('/', std::path::MAIN_SEPARATOR.to_string().as_str()),
-                normalized.to_str().expect("Path is not valid utf-8!")
+                test.test
+                    .replace('/', std::path::MAIN_SEPARATOR.to_string().as_str()),
+                normalized.to_str().expect("Path is not valid utf-8!")
             );
         }
     }
 
-    #[cfg(unix)]
-    #[test]
-    fn test_display_permissions() {
-        // spell-checker:ignore (perms) brwsr drwxr rwxr
-        assert_eq!(
+    #[cfg(unix)]
+    #[test]
+    fn test_display_permissions() {
+        // spell-checker:ignore (perms) brwsr drwxr rwxr
+        assert_eq!(
             "drwxr-xr-x",
-            display_permissions_unix(S_IFDIR | 0o755, true)
+            display_permissions_unix(S_IFDIR | 0o755, true)
         );
         assert_eq!(
             "rwxr-xr-x",
-            display_permissions_unix(S_IFDIR | 0o755, false)
+            display_permissions_unix(S_IFDIR | 0o755, false)
         );
         assert_eq!(
             "-rw-r--r--",
-            display_permissions_unix(S_IFREG | 0o644, true)
+            display_permissions_unix(S_IFREG | 0o644, true)
         );
         assert_eq!(
             "srw-r-----",
-            display_permissions_unix(S_IFSOCK | 0o640, true)
+            display_permissions_unix(S_IFSOCK | 0o640, true)
         );
         assert_eq!(
             "lrw-r-xr-x",
-            display_permissions_unix(S_IFLNK | 0o655, true)
+            display_permissions_unix(S_IFLNK | 0o655, true)
         );
-        assert_eq!("?rw-r-xr-x", display_permissions_unix(0o655, true));
+        assert_eq!("?rw-r-xr-x", display_permissions_unix(0o655, true));
 
         assert_eq!(
             "brwSr-xr-x",
-            display_permissions_unix(S_IFBLK | S_ISUID as mode_t | 0o655, true)
+            display_permissions_unix(S_IFBLK | S_ISUID as mode_t | 0o655, true)
         );
         assert_eq!(
             "brwsr-xr-x",
-            display_permissions_unix(S_IFBLK | S_ISUID as mode_t | 0o755, true)
+            display_permissions_unix(S_IFBLK | S_ISUID as mode_t | 0o755, true)
         );
 
         assert_eq!(
             "prw---sr--",
-            display_permissions_unix(S_IFIFO | S_ISGID as mode_t | 0o614, true)
+            display_permissions_unix(S_IFIFO | S_ISGID as mode_t | 0o614, true)
         );
         assert_eq!(
             "prw---Sr--",
-            display_permissions_unix(S_IFIFO | S_ISGID as mode_t | 0o604, true)
+            display_permissions_unix(S_IFIFO | S_ISGID as mode_t | 0o604, true)
         );
 
         assert_eq!(
             "c---r-xr-t",
-            display_permissions_unix(S_IFCHR | S_ISVTX as mode_t | 0o055, true)
+            display_permissions_unix(S_IFCHR | S_ISVTX as mode_t | 0o055, true)
         );
         assert_eq!(
             "c---r-xr-T",
-            display_permissions_unix(S_IFCHR | S_ISVTX as mode_t | 0o054, true)
+            display_permissions_unix(S_IFCHR | S_ISVTX as mode_t | 0o054, true)
         );
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/fsext.rs.html b/dev/src/uucore/features/fsext.rs.html index abf0b37a3..034fd5156 100644 --- a/dev/src/uucore/features/fsext.rs.html +++ b/dev/src/uucore/features/fsext.rs.html @@ -1,4 +1,4 @@ -fsext.rs - source
1
+fsext.rs - source
1
 2
 3
 4
@@ -985,992 +985,992 @@
 985
 986
 987
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-// (c) Fangxu Hu <framlog@gmail.com>
-// (c) Sylvestre Ledru <sylvestre@debian.org>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+// (c) Fangxu Hu <framlog@gmail.com>
+// (c) Sylvestre Ledru <sylvestre@debian.org>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-//! Set of functions to manage file systems
+//! Set of functions to manage file systems
 
-// spell-checker:ignore DATETIME subsecond (arch) bitrig ; (fs) cifs smbfs
+// spell-checker:ignore DATETIME subsecond (arch) bitrig ; (fs) cifs smbfs
 
-extern crate time;
-use time::macros::format_description;
-use time::UtcOffset;
+extern crate time;
+use time::macros::format_description;
+use time::UtcOffset;
 
-pub use crate::*; // import macros from `../../macros.rs`
+pub use crate::*; // import macros from `../../macros.rs`
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-const LINUX_MTAB: &str = "/etc/mtab";
-#[cfg(any(target_os = "linux", target_os = "android"))]
-const LINUX_MOUNTINFO: &str = "/proc/self/mountinfo";
-static MOUNT_OPT_BIND: &str = "bind";
-#[cfg(windows)]
-const MAX_PATH: usize = 266;
-#[cfg(not(unix))]
-static EXIT_ERR: i32 = 1;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+const LINUX_MTAB: &str = "/etc/mtab";
+#[cfg(any(target_os = "linux", target_os = "android"))]
+const LINUX_MOUNTINFO: &str = "/proc/self/mountinfo";
+static MOUNT_OPT_BIND: &str = "bind";
+#[cfg(windows)]
+const MAX_PATH: usize = 266;
+#[cfg(not(unix))]
+static EXIT_ERR: i32 = 1;
 
-#[cfg(windows)]
-use std::ffi::OsStr;
-#[cfg(windows)]
-use std::os::windows::ffi::OsStrExt;
-#[cfg(windows)]
-use windows_sys::Win32::Foundation::{ERROR_NO_MORE_FILES, INVALID_HANDLE_VALUE};
-#[cfg(windows)]
-use windows_sys::Win32::Storage::FileSystem::{
-    FindFirstVolumeW, FindNextVolumeW, FindVolumeClose, GetDiskFreeSpaceW, GetDriveTypeW,
-    GetVolumeInformationW, GetVolumePathNamesForVolumeNameW, QueryDosDeviceW,
+#[cfg(windows)]
+use std::ffi::OsStr;
+#[cfg(windows)]
+use std::os::windows::ffi::OsStrExt;
+#[cfg(windows)]
+use windows_sys::Win32::Foundation::{ERROR_NO_MORE_FILES, INVALID_HANDLE_VALUE};
+#[cfg(windows)]
+use windows_sys::Win32::Storage::FileSystem::{
+    FindFirstVolumeW, FindNextVolumeW, FindVolumeClose, GetDiskFreeSpaceW, GetDriveTypeW,
+    GetVolumeInformationW, GetVolumePathNamesForVolumeNameW, QueryDosDeviceW,
 };
-#[cfg(windows)]
-use windows_sys::Win32::System::WindowsProgramming::DRIVE_REMOTE;
+#[cfg(windows)]
+use windows_sys::Win32::System::WindowsProgramming::DRIVE_REMOTE;
 
-// Warning: the pointer has to be used *immediately* or the Vec
-// it points to will be dropped!
-#[cfg(windows)]
-macro_rules! String2LPWSTR {
-    ($str: expr) => {
-        OsStr::new(&$str)
-            .encode_wide()
-            .chain(Some(0))
-            .collect::<Vec<u16>>()
-            .as_ptr()
+// Warning: the pointer has to be used *immediately* or the Vec
+// it points to will be dropped!
+#[cfg(windows)]
+macro_rules! String2LPWSTR {
+    ($str: expr) => {
+        OsStr::new(&$str)
+            .encode_wide()
+            .chain(Some(0))
+            .collect::<Vec<u16>>()
+            .as_ptr()
     };
 }
 
-#[cfg(windows)]
-#[allow(non_snake_case)]
-fn LPWSTR2String(buf: &[u16]) -> String {
-    let len = buf.iter().position(|&n| n == 0).unwrap();
-    String::from_utf16(&buf[..len]).unwrap()
+#[cfg(windows)]
+#[allow(non_snake_case)]
+fn LPWSTR2String(buf: &[u16]) -> String {
+    let len = buf.iter().position(|&n| n == 0).unwrap();
+    String::from_utf16(&buf[..len]).unwrap()
 }
 
-#[cfg(unix)]
-use libc::{
-    mode_t, strerror, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK,
+#[cfg(unix)]
+use libc::{
+    mode_t, strerror, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK,
 };
-use std::borrow::Cow;
-use std::convert::{AsRef, From};
-#[cfg(any(
-    target_vendor = "apple",
-    target_os = "freebsd",
-    target_os = "netbsd",
-    target_os = "openbsd",
-    target_os = "linux",
-    target_os = "android",
-))]
-use std::ffi::CStr;
-#[cfg(not(windows))]
-use std::ffi::CString;
-use std::io::Error as IOError;
-#[cfg(unix)]
-use std::mem;
-#[cfg(not(unix))]
-use std::path::Path;
-use std::time::UNIX_EPOCH;
+use std::borrow::Cow;
+use std::convert::{AsRef, From};
+#[cfg(any(
+    target_vendor = "apple",
+    target_os = "freebsd",
+    target_os = "netbsd",
+    target_os = "openbsd",
+    target_os = "linux",
+    target_os = "android",
+))]
+use std::ffi::CStr;
+#[cfg(not(windows))]
+use std::ffi::CString;
+use std::io::Error as IOError;
+#[cfg(unix)]
+use std::mem;
+#[cfg(not(unix))]
+use std::path::Path;
+use std::time::UNIX_EPOCH;
 
-#[cfg(any(
-    target_os = "linux",
-    target_os = "android",
-    target_vendor = "apple",
-    target_os = "freebsd",
-    target_os = "openbsd"
-))]
-pub use libc::statfs as StatFs;
-#[cfg(any(
-    target_os = "netbsd",
-    target_os = "bitrig",
-    target_os = "dragonfly",
-    target_os = "illumos",
-    target_os = "solaris",
-    target_os = "redox"
-))]
-pub use libc::statvfs as StatFs;
+#[cfg(any(
+    target_os = "linux",
+    target_os = "android",
+    target_vendor = "apple",
+    target_os = "freebsd",
+    target_os = "openbsd"
+))]
+pub use libc::statfs as StatFs;
+#[cfg(any(
+    target_os = "netbsd",
+    target_os = "bitrig",
+    target_os = "dragonfly",
+    target_os = "illumos",
+    target_os = "solaris",
+    target_os = "redox"
+))]
+pub use libc::statvfs as StatFs;
 
-#[cfg(any(
-    target_os = "linux",
-    target_os = "android",
-    target_vendor = "apple",
-    target_os = "freebsd",
-    target_os = "openbsd",
-    target_os = "redox"
-))]
-pub use libc::statfs as statfs_fn;
-#[cfg(any(
-    target_os = "netbsd",
-    target_os = "bitrig",
-    target_os = "illumos",
-    target_os = "solaris",
-    target_os = "dragonfly"
-))]
-pub use libc::statvfs as statfs_fn;
+#[cfg(any(
+    target_os = "linux",
+    target_os = "android",
+    target_vendor = "apple",
+    target_os = "freebsd",
+    target_os = "openbsd",
+    target_os = "redox"
+))]
+pub use libc::statfs as statfs_fn;
+#[cfg(any(
+    target_os = "netbsd",
+    target_os = "bitrig",
+    target_os = "illumos",
+    target_os = "solaris",
+    target_os = "dragonfly"
+))]
+pub use libc::statvfs as statfs_fn;
 
-pub trait BirthTime {
-    fn pretty_birth(&self) -> String;
-    fn birth(&self) -> String;
+pub trait BirthTime {
+    fn pretty_birth(&self) -> String;
+    fn birth(&self) -> String;
 }
 
-use std::fs::Metadata;
-impl BirthTime for Metadata {
-    fn pretty_birth(&self) -> String {
-        self.created()
-            .ok()
-            .and_then(|t| t.duration_since(UNIX_EPOCH).ok())
-            .map(|e| pretty_time(e.as_secs() as i64, i64::from(e.subsec_nanos())))
-            .unwrap_or_else(|| "-".to_owned())
+use std::fs::Metadata;
+impl BirthTime for Metadata {
+    fn pretty_birth(&self) -> String {
+        self.created()
+            .ok()
+            .and_then(|t| t.duration_since(UNIX_EPOCH).ok())
+            .map(|e| pretty_time(e.as_secs() as i64, i64::from(e.subsec_nanos())))
+            .unwrap_or_else(|| "-".to_owned())
     }
 
-    fn birth(&self) -> String {
-        self.created()
-            .ok()
-            .and_then(|t| t.duration_since(UNIX_EPOCH).ok())
-            .map(|e| format!("{}", e.as_secs()))
-            .unwrap_or_else(|| "0".to_owned())
+    fn birth(&self) -> String {
+        self.created()
+            .ok()
+            .and_then(|t| t.duration_since(UNIX_EPOCH).ok())
+            .map(|e| format!("{}", e.as_secs()))
+            .unwrap_or_else(|| "0".to_owned())
     }
 }
 
-#[derive(Debug, Clone)]
-pub struct MountInfo {
-    // it stores `volume_name` in windows platform and `dev_id` in unix platform
-    pub dev_id: String,
-    pub dev_name: String,
-    pub fs_type: String,
-    pub mount_dir: String,
-    pub mount_option: String, // we only care "bind" option
-    pub mount_root: String,
-    pub remote: bool,
-    pub dummy: bool,
+#[derive(Debug, Clone)]
+pub struct MountInfo {
+    // it stores `volume_name` in windows platform and `dev_id` in unix platform
+    pub dev_id: String,
+    pub dev_name: String,
+    pub fs_type: String,
+    pub mount_dir: String,
+    pub mount_option: String, // we only care "bind" option
+    pub mount_root: String,
+    pub remote: bool,
+    pub dummy: bool,
 }
 
-impl MountInfo {
-    fn set_missing_fields(&mut self) {
-        #[cfg(unix)]
-        {
-            use std::os::unix::fs::MetadataExt;
-            // We want to keep the dev_id on Windows
-            // but set dev_id
-            if let Ok(stat) = std::fs::metadata(&self.mount_dir) {
-                // Why do we cast this to i32?
-                self.dev_id = (stat.dev() as i32).to_string();
-            } else {
-                self.dev_id = "".to_string();
+impl MountInfo {
+    fn set_missing_fields(&mut self) {
+        #[cfg(unix)]
+        {
+            use std::os::unix::fs::MetadataExt;
+            // We want to keep the dev_id on Windows
+            // but set dev_id
+            if let Ok(stat) = std::fs::metadata(&self.mount_dir) {
+                // Why do we cast this to i32?
+                self.dev_id = (stat.dev() as i32).to_string();
+            } else {
+                self.dev_id = "".to_string();
             }
         }
-        // set MountInfo::dummy
-        // spell-checker:disable
-        match self.fs_type.as_ref() {
-            "autofs" | "proc" | "subfs"
-            /* for Linux 2.6/3.x */
-            | "debugfs" | "devpts" | "fusectl" | "mqueue" | "rpc_pipefs" | "sysfs"
-            /* FreeBSD, Linux 2.4 */
-            | "devfs"
-            /* for NetBSD 3.0 */
-            | "kernfs"
-            /* for Irix 6.5 */
-            | "ignore" => self.dummy = true,
-            _ => self.dummy = self.fs_type == "none"
-                && !self.mount_option.contains(MOUNT_OPT_BIND)
+        // set MountInfo::dummy
+        // spell-checker:disable
+        match self.fs_type.as_ref() {
+            "autofs" | "proc" | "subfs"
+            /* for Linux 2.6/3.x */
+            | "debugfs" | "devpts" | "fusectl" | "mqueue" | "rpc_pipefs" | "sysfs"
+            /* FreeBSD, Linux 2.4 */
+            | "devfs"
+            /* for NetBSD 3.0 */
+            | "kernfs"
+            /* for Irix 6.5 */
+            | "ignore" => self.dummy = true,
+            _ => self.dummy = self.fs_type == "none"
+                && !self.mount_option.contains(MOUNT_OPT_BIND)
         }
-        // spell-checker:enable
-        // set MountInfo::remote
-        #[cfg(windows)]
-        {
-            self.remote = DRIVE_REMOTE == unsafe { GetDriveTypeW(String2LPWSTR!(self.mount_root)) };
+        // spell-checker:enable
+        // set MountInfo::remote
+        #[cfg(windows)]
+        {
+            self.remote = DRIVE_REMOTE == unsafe { GetDriveTypeW(String2LPWSTR!(self.mount_root)) };
         }
-        #[cfg(unix)]
-        {
-            if self.dev_name.find(':').is_some()
-                || (self.dev_name.starts_with("//") && self.fs_type == "smbfs"
-                    || self.fs_type == "cifs")
-                || self.dev_name == "-hosts"
-            {
-                self.remote = true;
-            } else {
-                self.remote = false;
+        #[cfg(unix)]
+        {
+            if self.dev_name.find(':').is_some()
+                || (self.dev_name.starts_with("//") && self.fs_type == "smbfs"
+                    || self.fs_type == "cifs")
+                || self.dev_name == "-hosts"
+            {
+                self.remote = true;
+            } else {
+                self.remote = false;
             }
         }
     }
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    fn new(file_name: &str, raw: &[&str]) -> Option<Self> {
-        match file_name {
-            // spell-checker:ignore (word) noatime
-            // Format: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
-            // "man proc" for more details
-            LINUX_MOUNTINFO => {
-                const FIELDS_OFFSET: usize = 6;
-                let after_fields = raw[FIELDS_OFFSET..].iter().position(|c| *c == "-").unwrap()
-                    + FIELDS_OFFSET
-                    + 1;
-                let mut m = Self {
-                    dev_id: "".to_string(),
-                    dev_name: raw[after_fields + 1].to_string(),
-                    fs_type: raw[after_fields].to_string(),
-                    mount_root: raw[3].to_string(),
-                    mount_dir: raw[4].to_string(),
-                    mount_option: raw[5].to_string(),
-                    remote: false,
-                    dummy: false,
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    fn new(file_name: &str, raw: &[&str]) -> Option<Self> {
+        match file_name {
+            // spell-checker:ignore (word) noatime
+            // Format: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
+            // "man proc" for more details
+            LINUX_MOUNTINFO => {
+                const FIELDS_OFFSET: usize = 6;
+                let after_fields = raw[FIELDS_OFFSET..].iter().position(|c| *c == "-").unwrap()
+                    + FIELDS_OFFSET
+                    + 1;
+                let mut m = Self {
+                    dev_id: "".to_string(),
+                    dev_name: raw[after_fields + 1].to_string(),
+                    fs_type: raw[after_fields].to_string(),
+                    mount_root: raw[3].to_string(),
+                    mount_dir: raw[4].to_string(),
+                    mount_option: raw[5].to_string(),
+                    remote: false,
+                    dummy: false,
                 };
-                m.set_missing_fields();
-                Some(m)
+                m.set_missing_fields();
+                Some(m)
             }
-            LINUX_MTAB => {
-                let mut m = Self {
-                    dev_id: "".to_string(),
-                    dev_name: raw[0].to_string(),
-                    fs_type: raw[2].to_string(),
-                    mount_root: "".to_string(),
-                    mount_dir: raw[1].to_string(),
-                    mount_option: raw[3].to_string(),
-                    remote: false,
-                    dummy: false,
+            LINUX_MTAB => {
+                let mut m = Self {
+                    dev_id: "".to_string(),
+                    dev_name: raw[0].to_string(),
+                    fs_type: raw[2].to_string(),
+                    mount_root: "".to_string(),
+                    mount_dir: raw[1].to_string(),
+                    mount_option: raw[3].to_string(),
+                    remote: false,
+                    dummy: false,
                 };
-                m.set_missing_fields();
-                Some(m)
+                m.set_missing_fields();
+                Some(m)
             }
-            _ => None,
+            _ => None,
         }
     }
-    #[cfg(windows)]
-    fn new(mut volume_name: String) -> Option<Self> {
-        let mut dev_name_buf = [0u16; MAX_PATH];
-        volume_name.pop();
-        unsafe {
-            QueryDosDeviceW(
-                OsStr::new(&volume_name)
-                    .encode_wide()
-                    .chain(Some(0))
-                    .skip(4)
-                    .collect::<Vec<u16>>()
-                    .as_ptr(),
-                dev_name_buf.as_mut_ptr(),
-                dev_name_buf.len() as u32,
+    #[cfg(windows)]
+    fn new(mut volume_name: String) -> Option<Self> {
+        let mut dev_name_buf = [0u16; MAX_PATH];
+        volume_name.pop();
+        unsafe {
+            QueryDosDeviceW(
+                OsStr::new(&volume_name)
+                    .encode_wide()
+                    .chain(Some(0))
+                    .skip(4)
+                    .collect::<Vec<u16>>()
+                    .as_ptr(),
+                dev_name_buf.as_mut_ptr(),
+                dev_name_buf.len() as u32,
             )
         };
-        volume_name.push('\\');
-        let dev_name = LPWSTR2String(&dev_name_buf);
+        volume_name.push('\\');
+        let dev_name = LPWSTR2String(&dev_name_buf);
 
-        let mut mount_root_buf = [0u16; MAX_PATH];
-        let success = unsafe {
-            GetVolumePathNamesForVolumeNameW(
-                String2LPWSTR!(volume_name),
-                mount_root_buf.as_mut_ptr(),
-                mount_root_buf.len() as u32,
-                ptr::null_mut(),
+        let mut mount_root_buf = [0u16; MAX_PATH];
+        let success = unsafe {
+            GetVolumePathNamesForVolumeNameW(
+                String2LPWSTR!(volume_name),
+                mount_root_buf.as_mut_ptr(),
+                mount_root_buf.len() as u32,
+                ptr::null_mut(),
             )
         };
-        if 0 == success {
-            // TODO: support the case when `GetLastError()` returns `ERROR_MORE_DATA`
-            return None;
+        if 0 == success {
+            // TODO: support the case when `GetLastError()` returns `ERROR_MORE_DATA`
+            return None;
         }
-        let mount_root = LPWSTR2String(&mount_root_buf);
+        let mount_root = LPWSTR2String(&mount_root_buf);
 
-        let mut fs_type_buf = [0u16; MAX_PATH];
-        let success = unsafe {
-            GetVolumeInformationW(
-                String2LPWSTR!(mount_root),
-                ptr::null_mut(),
+        let mut fs_type_buf = [0u16; MAX_PATH];
+        let success = unsafe {
+            GetVolumeInformationW(
+                String2LPWSTR!(mount_root),
+                ptr::null_mut(),
                 0,
-                ptr::null_mut(),
-                ptr::null_mut(),
-                ptr::null_mut(),
-                fs_type_buf.as_mut_ptr(),
-                fs_type_buf.len() as u32,
+                ptr::null_mut(),
+                ptr::null_mut(),
+                ptr::null_mut(),
+                fs_type_buf.as_mut_ptr(),
+                fs_type_buf.len() as u32,
             )
         };
-        let fs_type = if 0 != success {
-            Some(LPWSTR2String(&fs_type_buf))
-        } else {
-            None
+        let fs_type = if 0 != success {
+            Some(LPWSTR2String(&fs_type_buf))
+        } else {
+            None
+        };
+        let mut mn_info = Self {
+            dev_id: volume_name,
+            dev_name,
+            fs_type: fs_type.unwrap_or_else(|| "".to_string()),
+            mount_root,
+            mount_dir: "".to_string(),
+            mount_option: "".to_string(),
+            remote: false,
+            dummy: false,
         };
-        let mut mn_info = Self {
-            dev_id: volume_name,
-            dev_name,
-            fs_type: fs_type.unwrap_or_else(|| "".to_string()),
-            mount_root,
-            mount_dir: "".to_string(),
-            mount_option: "".to_string(),
-            remote: false,
-            dummy: false,
-        };
-        mn_info.set_missing_fields();
-        Some(mn_info)
+        mn_info.set_missing_fields();
+        Some(mn_info)
     }
 }
 
-#[cfg(any(
-    target_os = "freebsd",
-    target_vendor = "apple",
-    target_os = "netbsd",
-    target_os = "openbsd"
-))]
-impl From<StatFs> for MountInfo {
-    fn from(statfs: StatFs) -> Self {
-        let mut info = Self {
-            dev_id: "".to_string(),
-            dev_name: unsafe {
-                // spell-checker:disable-next-line
-                CStr::from_ptr(&statfs.f_mntfromname[0])
-                    .to_string_lossy()
-                    .into_owned()
+#[cfg(any(
+    target_os = "freebsd",
+    target_vendor = "apple",
+    target_os = "netbsd",
+    target_os = "openbsd"
+))]
+impl From<StatFs> for MountInfo {
+    fn from(statfs: StatFs) -> Self {
+        let mut info = Self {
+            dev_id: "".to_string(),
+            dev_name: unsafe {
+                // spell-checker:disable-next-line
+                CStr::from_ptr(&statfs.f_mntfromname[0])
+                    .to_string_lossy()
+                    .into_owned()
             },
-            fs_type: unsafe {
-                // spell-checker:disable-next-line
-                CStr::from_ptr(&statfs.f_fstypename[0])
-                    .to_string_lossy()
-                    .into_owned()
+            fs_type: unsafe {
+                // spell-checker:disable-next-line
+                CStr::from_ptr(&statfs.f_fstypename[0])
+                    .to_string_lossy()
+                    .into_owned()
             },
-            mount_dir: unsafe {
-                // spell-checker:disable-next-line
-                CStr::from_ptr(&statfs.f_mntonname[0])
-                    .to_string_lossy()
-                    .into_owned()
+            mount_dir: unsafe {
+                // spell-checker:disable-next-line
+                CStr::from_ptr(&statfs.f_mntonname[0])
+                    .to_string_lossy()
+                    .into_owned()
             },
-            mount_root: "".to_string(),
-            mount_option: "".to_string(),
-            remote: false,
-            dummy: false,
+            mount_root: "".to_string(),
+            mount_option: "".to_string(),
+            remote: false,
+            dummy: false,
         };
-        info.set_missing_fields();
-        info
+        info.set_missing_fields();
+        info
     }
 }
 
-#[cfg(any(
-    target_os = "freebsd",
-    target_vendor = "apple",
-    target_os = "netbsd",
-    target_os = "openbsd"
-))]
-use libc::c_int;
-#[cfg(any(
-    target_os = "freebsd",
-    target_vendor = "apple",
-    target_os = "netbsd",
-    target_os = "openbsd"
-))]
-extern "C" {
-    #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))]
-    #[link_name = "getmntinfo$INODE64"] // spell-checker:disable-line
-    fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int;
+#[cfg(any(
+    target_os = "freebsd",
+    target_vendor = "apple",
+    target_os = "netbsd",
+    target_os = "openbsd"
+))]
+use libc::c_int;
+#[cfg(any(
+    target_os = "freebsd",
+    target_vendor = "apple",
+    target_os = "netbsd",
+    target_os = "openbsd"
+))]
+extern "C" {
+    #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))]
+    #[link_name = "getmntinfo$INODE64"] // spell-checker:disable-line
+    fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int;
 
-    #[cfg(any(
-        all(target_os = "freebsd"),
-        all(target_os = "netbsd"),
-        all(target_os = "openbsd"),
-        all(target_vendor = "apple", target_arch = "aarch64")
-    ))]
-    #[link_name = "getmntinfo"] // spell-checker:disable-line
-    fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int;
+    #[cfg(any(
+        all(target_os = "freebsd"),
+        all(target_os = "netbsd"),
+        all(target_os = "openbsd"),
+        all(target_vendor = "apple", target_arch = "aarch64")
+    ))]
+    #[link_name = "getmntinfo"] // spell-checker:disable-line
+    fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int;
 }
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use std::fs::File;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use std::io::{BufRead, BufReader};
-#[cfg(any(
-    target_vendor = "apple",
-    target_os = "freebsd",
-    target_os = "windows",
-    target_os = "netbsd",
-    target_os = "openbsd"
-))]
-use std::ptr;
-#[cfg(any(
-    target_vendor = "apple",
-    target_os = "freebsd",
-    target_os = "netbsd",
-    target_os = "openbsd"
-))]
-use std::slice;
-/// Read file system list.
-pub fn read_fs_list() -> Result<Vec<MountInfo>, std::io::Error> {
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    {
-        let (file_name, f) = File::open(LINUX_MOUNTINFO)
-            .map(|f| (LINUX_MOUNTINFO, f))
-            .or_else(|_| File::open(LINUX_MTAB).map(|f| (LINUX_MTAB, f)))?;
-        let reader = BufReader::new(f);
-        Ok(reader
-            .lines()
-            .filter_map(|line| line.ok())
-            .filter_map(|line| {
-                let raw_data = line.split_whitespace().collect::<Vec<&str>>();
-                MountInfo::new(file_name, &raw_data)
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use std::fs::File;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use std::io::{BufRead, BufReader};
+#[cfg(any(
+    target_vendor = "apple",
+    target_os = "freebsd",
+    target_os = "windows",
+    target_os = "netbsd",
+    target_os = "openbsd"
+))]
+use std::ptr;
+#[cfg(any(
+    target_vendor = "apple",
+    target_os = "freebsd",
+    target_os = "netbsd",
+    target_os = "openbsd"
+))]
+use std::slice;
+/// Read file system list.
+pub fn read_fs_list() -> Result<Vec<MountInfo>, std::io::Error> {
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    {
+        let (file_name, f) = File::open(LINUX_MOUNTINFO)
+            .map(|f| (LINUX_MOUNTINFO, f))
+            .or_else(|_| File::open(LINUX_MTAB).map(|f| (LINUX_MTAB, f)))?;
+        let reader = BufReader::new(f);
+        Ok(reader
+            .lines()
+            .filter_map(|line| line.ok())
+            .filter_map(|line| {
+                let raw_data = line.split_whitespace().collect::<Vec<&str>>();
+                MountInfo::new(file_name, &raw_data)
             })
-            .collect::<Vec<_>>())
+            .collect::<Vec<_>>())
     }
-    #[cfg(any(
-        target_os = "freebsd",
-        target_vendor = "apple",
-        target_os = "netbsd",
-        target_os = "openbsd"
-    ))]
-    {
-        let mut mount_buffer_ptr: *mut StatFs = ptr::null_mut();
-        let len = unsafe { get_mount_info(&mut mount_buffer_ptr, 1_i32) };
-        if len < 0 {
+    #[cfg(any(
+        target_os = "freebsd",
+        target_vendor = "apple",
+        target_os = "netbsd",
+        target_os = "openbsd"
+    ))]
+    {
+        let mut mount_buffer_ptr: *mut StatFs = ptr::null_mut();
+        let len = unsafe { get_mount_info(&mut mount_buffer_ptr, 1_i32) };
+        if len < 0 {
             crash!(1, "get_mount_info() failed");
         }
-        let mounts = unsafe { slice::from_raw_parts(mount_buffer_ptr, len as usize) };
-        Ok(mounts
-            .iter()
-            .map(|m| MountInfo::from(*m))
-            .collect::<Vec<_>>())
+        let mounts = unsafe { slice::from_raw_parts(mount_buffer_ptr, len as usize) };
+        Ok(mounts
+            .iter()
+            .map(|m| MountInfo::from(*m))
+            .collect::<Vec<_>>())
     }
-    #[cfg(windows)]
-    {
-        let mut volume_name_buf = [0u16; MAX_PATH];
-        // As recommended in the MS documentation, retrieve the first volume before the others
-        let find_handle =
-            unsafe { FindFirstVolumeW(volume_name_buf.as_mut_ptr(), volume_name_buf.len() as u32) };
-        if INVALID_HANDLE_VALUE == find_handle {
+    #[cfg(windows)]
+    {
+        let mut volume_name_buf = [0u16; MAX_PATH];
+        // As recommended in the MS documentation, retrieve the first volume before the others
+        let find_handle =
+            unsafe { FindFirstVolumeW(volume_name_buf.as_mut_ptr(), volume_name_buf.len() as u32) };
+        if INVALID_HANDLE_VALUE == find_handle {
             crash!(
-                EXIT_ERR,
+                EXIT_ERR,
                 "FindFirstVolumeW failed: {}",
-                IOError::last_os_error()
+                IOError::last_os_error()
             );
         }
-        let mut mounts = Vec::<MountInfo>::new();
-        loop {
-            let volume_name = LPWSTR2String(&volume_name_buf);
-            if !volume_name.starts_with("\\\\?\\") || !volume_name.ends_with('\\') {
-                show_warning!("A bad path was skipped: {}", volume_name);
+        let mut mounts = Vec::<MountInfo>::new();
+        loop {
+            let volume_name = LPWSTR2String(&volume_name_buf);
+            if !volume_name.starts_with("\\\\?\\") || !volume_name.ends_with('\\') {
+                show_warning!("A bad path was skipped: {}", volume_name);
                 continue;
             }
-            if let Some(m) = MountInfo::new(volume_name) {
-                mounts.push(m);
+            if let Some(m) = MountInfo::new(volume_name) {
+                mounts.push(m);
             }
-            if 0 == unsafe {
-                FindNextVolumeW(
-                    find_handle,
-                    volume_name_buf.as_mut_ptr(),
-                    volume_name_buf.len() as u32,
+            if 0 == unsafe {
+                FindNextVolumeW(
+                    find_handle,
+                    volume_name_buf.as_mut_ptr(),
+                    volume_name_buf.len() as u32,
                 )
             } {
-                let err = IOError::last_os_error();
-                if err.raw_os_error() != Some(ERROR_NO_MORE_FILES as i32) {
-                    crash!(EXIT_ERR, "FindNextVolumeW failed: {}", err);
+                let err = IOError::last_os_error();
+                if err.raw_os_error() != Some(ERROR_NO_MORE_FILES as i32) {
+                    crash!(EXIT_ERR, "FindNextVolumeW failed: {}", err);
                 }
                 break;
             }
         }
-        unsafe {
-            FindVolumeClose(find_handle);
+        unsafe {
+            FindVolumeClose(find_handle);
         }
-        Ok(mounts)
+        Ok(mounts)
     }
-    #[cfg(any(target_os = "redox", target_os = "illumos", target_os = "solaris"))]
-    {
-        // No method to read mounts, yet
-        Ok(Vec::new())
+    #[cfg(any(target_os = "redox", target_os = "illumos", target_os = "solaris"))]
+    {
+        // No method to read mounts, yet
+        Ok(Vec::new())
     }
 }
 
-#[derive(Debug, Clone)]
-pub struct FsUsage {
-    pub blocksize: u64,
-    pub blocks: u64,
-    pub bfree: u64,
-    pub bavail: u64,
-    pub bavail_top_bit_set: bool,
-    pub files: u64,
-    pub ffree: u64,
+#[derive(Debug, Clone)]
+pub struct FsUsage {
+    pub blocksize: u64,
+    pub blocks: u64,
+    pub bfree: u64,
+    pub bavail: u64,
+    pub bavail_top_bit_set: bool,
+    pub files: u64,
+    pub ffree: u64,
 }
 
-impl FsUsage {
-    #[cfg(unix)]
-    pub fn new(statvfs: StatFs) -> Self {
+impl FsUsage {
+    #[cfg(unix)]
+    pub fn new(statvfs: StatFs) -> Self {
         {
-            Self {
-                blocksize: statvfs.f_bsize as u64, // or `statvfs.f_frsize` ?
-                blocks: statvfs.f_blocks as u64,
-                bfree: statvfs.f_bfree as u64,
-                bavail: statvfs.f_bavail as u64,
-                bavail_top_bit_set: ((statvfs.f_bavail as u64) & (1u64.rotate_right(1))) != 0,
-                files: statvfs.f_files as u64,
-                ffree: statvfs.f_ffree as u64,
+            Self {
+                blocksize: statvfs.f_bsize as u64, // or `statvfs.f_frsize` ?
+                blocks: statvfs.f_blocks as u64,
+                bfree: statvfs.f_bfree as u64,
+                bavail: statvfs.f_bavail as u64,
+                bavail_top_bit_set: ((statvfs.f_bavail as u64) & (1u64.rotate_right(1))) != 0,
+                files: statvfs.f_files as u64,
+                ffree: statvfs.f_ffree as u64,
             }
         }
     }
-    #[cfg(not(unix))]
-    pub fn new(path: &Path) -> Self {
-        let mut root_path = [0u16; MAX_PATH];
-        let success = unsafe {
-            GetVolumePathNamesForVolumeNameW(
-                //path_utf8.as_ptr(),
-                String2LPWSTR!(path.as_os_str()),
-                root_path.as_mut_ptr(),
-                root_path.len() as u32,
-                ptr::null_mut(),
+    #[cfg(not(unix))]
+    pub fn new(path: &Path) -> Self {
+        let mut root_path = [0u16; MAX_PATH];
+        let success = unsafe {
+            GetVolumePathNamesForVolumeNameW(
+                //path_utf8.as_ptr(),
+                String2LPWSTR!(path.as_os_str()),
+                root_path.as_mut_ptr(),
+                root_path.len() as u32,
+                ptr::null_mut(),
             )
         };
-        if 0 == success {
+        if 0 == success {
             crash!(
-                EXIT_ERR,
+                EXIT_ERR,
                 "GetVolumePathNamesForVolumeNameW failed: {}",
-                IOError::last_os_error()
+                IOError::last_os_error()
             );
         }
 
-        let mut sectors_per_cluster = 0;
-        let mut bytes_per_sector = 0;
-        let mut number_of_free_clusters = 0;
-        let mut total_number_of_clusters = 0;
+        let mut sectors_per_cluster = 0;
+        let mut bytes_per_sector = 0;
+        let mut number_of_free_clusters = 0;
+        let mut total_number_of_clusters = 0;
 
-        let success = unsafe {
-            GetDiskFreeSpaceW(
-                String2LPWSTR!(path.as_os_str()),
-                &mut sectors_per_cluster,
-                &mut bytes_per_sector,
-                &mut number_of_free_clusters,
-                &mut total_number_of_clusters,
+        let success = unsafe {
+            GetDiskFreeSpaceW(
+                String2LPWSTR!(path.as_os_str()),
+                &mut sectors_per_cluster,
+                &mut bytes_per_sector,
+                &mut number_of_free_clusters,
+                &mut total_number_of_clusters,
             )
         };
-        if 0 == success {
-            // Fails in case of CD for example
-            // crash!(
-            //     EXIT_ERR,
-            //     "GetDiskFreeSpaceW failed: {}",
-            //     IOError::last_os_error()
-            // );
-        }
+        if 0 == success {
+            // Fails in case of CD for example
+            // crash!(
+            //     EXIT_ERR,
+            //     "GetDiskFreeSpaceW failed: {}",
+            //     IOError::last_os_error()
+            // );
+        }
 
-        let bytes_per_cluster = sectors_per_cluster as u64 * bytes_per_sector as u64;
-        Self {
-            // f_bsize      File system block size.
-            blocksize: bytes_per_cluster as u64,
-            // f_blocks - Total number of blocks on the file system, in units of f_frsize.
-            // frsize =     Fundamental file system block size (fragment size).
-            blocks: total_number_of_clusters as u64,
-            //  Total number of free blocks.
-            bfree: number_of_free_clusters as u64,
-            //  Total number of free blocks available to non-privileged processes.
-            bavail: 0,
-            bavail_top_bit_set: ((bytes_per_sector as u64) & (1u64.rotate_right(1))) != 0,
-            // Total number of file nodes (inodes) on the file system.
-            files: 0, // Not available on windows
-            // Total number of free file nodes (inodes).
-            ffree: 0, // Meaningless on Windows
-        }
+        let bytes_per_cluster = sectors_per_cluster as u64 * bytes_per_sector as u64;
+        Self {
+            // f_bsize      File system block size.
+            blocksize: bytes_per_cluster as u64,
+            // f_blocks - Total number of blocks on the file system, in units of f_frsize.
+            // frsize =     Fundamental file system block size (fragment size).
+            blocks: total_number_of_clusters as u64,
+            //  Total number of free blocks.
+            bfree: number_of_free_clusters as u64,
+            //  Total number of free blocks available to non-privileged processes.
+            bavail: 0,
+            bavail_top_bit_set: ((bytes_per_sector as u64) & (1u64.rotate_right(1))) != 0,
+            // Total number of file nodes (inodes) on the file system.
+            files: 0, // Not available on windows
+            // Total number of free file nodes (inodes).
+            ffree: 0, // Meaningless on Windows
+        }
     }
 }
 
-#[cfg(unix)]
-pub trait FsMeta {
-    fn fs_type(&self) -> i64;
-    fn io_size(&self) -> u64;
-    fn block_size(&self) -> i64;
-    fn total_blocks(&self) -> u64;
-    fn free_blocks(&self) -> u64;
-    fn avail_blocks(&self) -> u64;
-    fn total_file_nodes(&self) -> u64;
-    fn free_file_nodes(&self) -> u64;
-    fn fsid(&self) -> u64;
-    fn namelen(&self) -> u64;
+#[cfg(unix)]
+pub trait FsMeta {
+    fn fs_type(&self) -> i64;
+    fn io_size(&self) -> u64;
+    fn block_size(&self) -> i64;
+    fn total_blocks(&self) -> u64;
+    fn free_blocks(&self) -> u64;
+    fn avail_blocks(&self) -> u64;
+    fn total_file_nodes(&self) -> u64;
+    fn free_file_nodes(&self) -> u64;
+    fn fsid(&self) -> u64;
+    fn namelen(&self) -> u64;
 }
 
-#[cfg(unix)]
-impl FsMeta for StatFs {
-    fn block_size(&self) -> i64 {
-        self.f_bsize as i64
+#[cfg(unix)]
+impl FsMeta for StatFs {
+    fn block_size(&self) -> i64 {
+        self.f_bsize as i64
     }
-    fn total_blocks(&self) -> u64 {
-        self.f_blocks as u64
+    fn total_blocks(&self) -> u64 {
+        self.f_blocks as u64
     }
-    fn free_blocks(&self) -> u64 {
-        self.f_bfree as u64
+    fn free_blocks(&self) -> u64 {
+        self.f_bfree as u64
     }
-    fn avail_blocks(&self) -> u64 {
-        self.f_bavail as u64
+    fn avail_blocks(&self) -> u64 {
+        self.f_bavail as u64
     }
-    fn total_file_nodes(&self) -> u64 {
-        self.f_files as u64
+    fn total_file_nodes(&self) -> u64 {
+        self.f_files as u64
     }
-    fn free_file_nodes(&self) -> u64 {
-        self.f_ffree as u64
+    fn free_file_nodes(&self) -> u64 {
+        self.f_ffree as u64
     }
-    #[cfg(any(
-        target_os = "linux",
-        target_os = "android",
-        target_vendor = "apple",
-        target_os = "freebsd"
-    ))]
-    fn fs_type(&self) -> i64 {
-        self.f_type as i64
+    #[cfg(any(
+        target_os = "linux",
+        target_os = "android",
+        target_vendor = "apple",
+        target_os = "freebsd"
+    ))]
+    fn fs_type(&self) -> i64 {
+        self.f_type as i64
     }
-    #[cfg(not(any(
-        target_os = "linux",
-        target_os = "android",
-        target_vendor = "apple",
-        target_os = "freebsd"
-    )))]
-    fn fs_type(&self) -> i64 {
-        // FIXME: statvfs doesn't have an equivalent, so we need to do something else
-        unimplemented!()
+    #[cfg(not(any(
+        target_os = "linux",
+        target_os = "android",
+        target_vendor = "apple",
+        target_os = "freebsd"
+    )))]
+    fn fs_type(&self) -> i64 {
+        // FIXME: statvfs doesn't have an equivalent, so we need to do something else
+        unimplemented!()
     }
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    fn io_size(&self) -> u64 {
-        self.f_frsize as u64
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    fn io_size(&self) -> u64 {
+        self.f_frsize as u64
     }
-    #[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "netbsd"))]
-    fn io_size(&self) -> u64 {
-        self.f_iosize as u64
+    #[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "netbsd"))]
+    fn io_size(&self) -> u64 {
+        self.f_iosize as u64
     }
-    // XXX: dunno if this is right
-    #[cfg(not(any(
-        target_vendor = "apple",
-        target_os = "freebsd",
-        target_os = "linux",
-        target_os = "android",
-        target_os = "netbsd"
-    )))]
-    fn io_size(&self) -> u64 {
-        self.f_bsize as u64
+    // XXX: dunno if this is right
+    #[cfg(not(any(
+        target_vendor = "apple",
+        target_os = "freebsd",
+        target_os = "linux",
+        target_os = "android",
+        target_os = "netbsd"
+    )))]
+    fn io_size(&self) -> u64 {
+        self.f_bsize as u64
     }
 
-    // Linux, SunOS, HP-UX, 4.4BSD, FreeBSD have a system call statfs() that returns
-    // a struct statfs, containing a fsid_t f_fsid, where fsid_t is defined
-    // as struct { int val[2];  }
-    //
-    // Solaris, Irix and POSIX have a system call statvfs(2) that returns a
-    // struct statvfs, containing an  unsigned  long  f_fsid
-    #[cfg(any(
-        target_vendor = "apple",
-        target_os = "freebsd",
-        target_os = "linux",
-        target_os = "android",
-        target_os = "openbsd"
-    ))]
-    fn fsid(&self) -> u64 {
-        let f_fsid: &[u32; 2] =
-            unsafe { &*(&self.f_fsid as *const nix::sys::statfs::fsid_t as *const [u32; 2]) };
-        (u64::from(f_fsid[0])) << 32 | u64::from(f_fsid[1])
+    // Linux, SunOS, HP-UX, 4.4BSD, FreeBSD have a system call statfs() that returns
+    // a struct statfs, containing a fsid_t f_fsid, where fsid_t is defined
+    // as struct { int val[2];  }
+    //
+    // Solaris, Irix and POSIX have a system call statvfs(2) that returns a
+    // struct statvfs, containing an  unsigned  long  f_fsid
+    #[cfg(any(
+        target_vendor = "apple",
+        target_os = "freebsd",
+        target_os = "linux",
+        target_os = "android",
+        target_os = "openbsd"
+    ))]
+    fn fsid(&self) -> u64 {
+        let f_fsid: &[u32; 2] =
+            unsafe { &*(&self.f_fsid as *const nix::sys::statfs::fsid_t as *const [u32; 2]) };
+        (u64::from(f_fsid[0])) << 32 | u64::from(f_fsid[1])
     }
-    #[cfg(not(any(
-        target_vendor = "apple",
-        target_os = "freebsd",
-        target_os = "linux",
-        target_os = "android",
-        target_os = "openbsd"
-    )))]
-    fn fsid(&self) -> u64 {
-        self.f_fsid as u64
+    #[cfg(not(any(
+        target_vendor = "apple",
+        target_os = "freebsd",
+        target_os = "linux",
+        target_os = "android",
+        target_os = "openbsd"
+    )))]
+    fn fsid(&self) -> u64 {
+        self.f_fsid as u64
     }
 
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    fn namelen(&self) -> u64 {
-        self.f_namelen as u64
-    }
-    #[cfg(target_vendor = "apple")]
-    fn namelen(&self) -> u64 {
-        1024
-    }
-    #[cfg(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
-    fn namelen(&self) -> u64 {
-        self.f_namemax as u64 // spell-checker:disable-line
-    }
-    // XXX: should everything just use statvfs?
-    #[cfg(not(any(
-        target_vendor = "apple",
-        target_os = "freebsd",
-        target_os = "linux",
-        target_os = "android",
-        target_os = "netbsd",
-        target_os = "openbsd"
-    )))]
-    fn namelen(&self) -> u64 {
-        self.f_namemax as u64 // spell-checker:disable-line
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    fn namelen(&self) -> u64 {
+        self.f_namelen as u64
     }
+    #[cfg(target_vendor = "apple")]
+    fn namelen(&self) -> u64 {
+        1024
+    }
+    #[cfg(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
+    fn namelen(&self) -> u64 {
+        self.f_namemax as u64 // spell-checker:disable-line
+    }
+    // XXX: should everything just use statvfs?
+    #[cfg(not(any(
+        target_vendor = "apple",
+        target_os = "freebsd",
+        target_os = "linux",
+        target_os = "android",
+        target_os = "netbsd",
+        target_os = "openbsd"
+    )))]
+    fn namelen(&self) -> u64 {
+        self.f_namemax as u64 // spell-checker:disable-line
+    }
 }
 
-#[cfg(unix)]
-pub fn statfs<P>(path: P) -> Result<StatFs, String>
-where
-    P: Into<Vec<u8>>,
+#[cfg(unix)]
+pub fn statfs<P>(path: P) -> Result<StatFs, String>
+where
+    P: Into<Vec<u8>>,
 {
-    match CString::new(path) {
-        Ok(p) => {
-            let mut buffer: StatFs = unsafe { mem::zeroed() };
-            unsafe {
-                match statfs_fn(p.as_ptr(), &mut buffer) {
-                    0 => Ok(buffer),
-                    _ => {
-                        let errno = IOError::last_os_error().raw_os_error().unwrap_or(0);
-                        Err(CStr::from_ptr(strerror(errno))
-                            .to_str()
-                            .map_err(|_| "Error message contains invalid UTF-8".to_owned())?
-                            .to_owned())
+    match CString::new(path) {
+        Ok(p) => {
+            let mut buffer: StatFs = unsafe { mem::zeroed() };
+            unsafe {
+                match statfs_fn(p.as_ptr(), &mut buffer) {
+                    0 => Ok(buffer),
+                    _ => {
+                        let errno = IOError::last_os_error().raw_os_error().unwrap_or(0);
+                        Err(CStr::from_ptr(strerror(errno))
+                            .to_str()
+                            .map_err(|_| "Error message contains invalid UTF-8".to_owned())?
+                            .to_owned())
                     }
                 }
             }
         }
-        Err(e) => Err(e.to_string()),
+        Err(e) => Err(e.to_string()),
     }
 }
 
-// match strftime "%Y-%m-%d %H:%M:%S.%f %z"
-const PRETTY_DATETIME_FORMAT: &[time::format_description::FormatItem] = format_description!(
+// match strftime "%Y-%m-%d %H:%M:%S.%f %z"
+const PRETTY_DATETIME_FORMAT: &[time::format_description::FormatItem] = format_description!(
     "\
 [year]-[month]-[day padding:zero] \
 [hour]:[minute]:[second].[subsecond digits:9] \
-[offset_hour sign:mandatory][offset_minute]"
-);
+[offset_hour sign:mandatory][offset_minute]"
+);
 
-pub fn pretty_time(sec: i64, nsec: i64) -> String {
-    // sec == seconds since UNIX_EPOCH
-    // nsec == nanoseconds since (UNIX_EPOCH + sec)
-    let ts_nanos: i128 = (sec * 1_000_000_000 + nsec).into();
+pub fn pretty_time(sec: i64, nsec: i64) -> String {
+    // sec == seconds since UNIX_EPOCH
+    // nsec == nanoseconds since (UNIX_EPOCH + sec)
+    let ts_nanos: i128 = (sec * 1_000_000_000 + nsec).into();
 
-    // Return the date in UTC
-    let tm = match time::OffsetDateTime::from_unix_timestamp_nanos(ts_nanos) {
-        Ok(tm) => tm,
-        Err(e) => {
-            panic!("error: {}", e);
+    // Return the date in UTC
+    let tm = match time::OffsetDateTime::from_unix_timestamp_nanos(ts_nanos) {
+        Ok(tm) => tm,
+        Err(e) => {
+            panic!("error: {}", e);
         }
     };
 
-    // Get the offset to convert to local time
-    // Because of DST (daylight saving), we get the local time back when
-    // the date was set
-    let local_offset = match UtcOffset::local_offset_at(tm) {
-        Ok(lo) => lo,
-        Err(e) => {
-            panic!("error: {}", e);
+    // Get the offset to convert to local time
+    // Because of DST (daylight saving), we get the local time back when
+    // the date was set
+    let local_offset = match UtcOffset::local_offset_at(tm) {
+        Ok(lo) => lo,
+        Err(e) => {
+            panic!("error: {}", e);
         }
     };
 
-    // Include the conversion to local time
-    let res = tm
-        .to_offset(local_offset)
-        .format(&PRETTY_DATETIME_FORMAT)
-        .unwrap();
-    if res.ends_with(" -0000") {
-        res.replace(" -0000", " +0000")
-    } else {
-        res
+    // Include the conversion to local time
+    let res = tm
+        .to_offset(local_offset)
+        .format(&PRETTY_DATETIME_FORMAT)
+        .unwrap();
+    if res.ends_with(" -0000") {
+        res.replace(" -0000", " +0000")
+    } else {
+        res
     }
 }
 
-#[cfg(unix)]
-pub fn pretty_filetype<'a>(mode: mode_t, size: u64) -> &'a str {
-    match mode & S_IFMT {
-        S_IFREG => {
-            if size != 0 {
-                "regular file"
-            } else {
-                "regular empty file"
-            }
+#[cfg(unix)]
+pub fn pretty_filetype<'a>(mode: mode_t, size: u64) -> &'a str {
+    match mode & S_IFMT {
+        S_IFREG => {
+            if size != 0 {
+                "regular file"
+            } else {
+                "regular empty file"
+            }
         }
-        S_IFDIR => "directory",
-        S_IFLNK => "symbolic link",
-        S_IFCHR => "character special file",
-        S_IFBLK => "block special file",
-        S_IFIFO => "fifo",
-        S_IFSOCK => "socket",
-        // TODO: Other file types
-        // See coreutils/gnulib/lib/file-type.c // spell-checker:disable-line
-        _ => "weird file",
+        S_IFDIR => "directory",
+        S_IFLNK => "symbolic link",
+        S_IFCHR => "character special file",
+        S_IFBLK => "block special file",
+        S_IFIFO => "fifo",
+        S_IFSOCK => "socket",
+        // TODO: Other file types
+        // See coreutils/gnulib/lib/file-type.c // spell-checker:disable-line
+        _ => "weird file",
     }
 }
 
-pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str> {
-    // spell-checker:disable
-    match fstype {
-        0x6163_6673 => "acfs".into(),
-        0xADF5 => "adfs".into(),
-        0xADFF => "affs".into(),
-        0x5346_414F => "afs".into(),
-        0x0904_1934 => "anon-inode FS".into(),
-        0x6175_6673 => "aufs".into(),
-        0x0187 => "autofs".into(),
-        0x4246_5331 => "befs".into(),
-        0x6264_6576 => "bdevfs".into(),
-        0x1BAD_FACE => "bfs".into(),
-        0xCAFE_4A11 => "bpf_fs".into(),
-        0x4249_4E4D => "binfmt_misc".into(),
-        0x9123_683E => "btrfs".into(),
-        0x7372_7279 => "btrfs_test".into(),
-        0x00C3_6400 => "ceph".into(),
-        0x0027_E0EB => "cgroupfs".into(),
-        0xFF53_4D42 => "cifs".into(),
-        0x7375_7245 => "coda".into(),
-        0x012F_F7B7 => "coh".into(),
-        0x6265_6570 => "configfs".into(),
-        0x28CD_3D45 => "cramfs".into(),
-        0x453D_CD28 => "cramfs-wend".into(),
-        0x6462_6720 => "debugfs".into(),
-        0x1373 => "devfs".into(),
-        0x1CD1 => "devpts".into(),
-        0xF15F => "ecryptfs".into(),
-        0xDE5E_81E4 => "efivarfs".into(),
-        0x0041_4A53 => "efs".into(),
-        0x5DF5 => "exofs".into(),
-        0x137D => "ext".into(),
-        0xEF53 => "ext2/ext3".into(),
-        0xEF51 => "ext2".into(),
-        0xF2F5_2010 => "f2fs".into(),
-        0x4006 => "fat".into(),
-        0x1983_0326 => "fhgfs".into(),
-        0x6573_5546 => "fuseblk".into(),
-        0x6573_5543 => "fusectl".into(),
-        0x0BAD_1DEA => "futexfs".into(),
-        0x0116_1970 => "gfs/gfs2".into(),
-        0x4750_4653 => "gpfs".into(),
-        0x4244 => "hfs".into(),
-        0x482B => "hfs+".into(),
-        0x4858 => "hfsx".into(),
-        0x00C0_FFEE => "hostfs".into(),
-        0xF995_E849 => "hpfs".into(),
-        0x9584_58F6 => "hugetlbfs".into(),
-        0x1130_7854 => "inodefs".into(),
-        0x0131_11A8 => "ibrix".into(),
-        0x2BAD_1DEA => "inotifyfs".into(),
-        0x9660 => "isofs".into(),
-        0x4004 => "isofs".into(),
-        0x4000 => "isofs".into(),
-        0x07C0 => "jffs".into(),
-        0x72B6 => "jffs2".into(),
-        0x3153_464A => "jfs".into(),
-        0x6B41_4653 => "k-afs".into(),
-        0xC97E_8168 => "logfs".into(),
-        0x0BD0_0BD0 => "lustre".into(),
-        0x5346_314D => "m1fs".into(),
-        0x137F => "minix".into(),
-        0x138F => "minix (30 char.)".into(),
-        0x2468 => "minix v2".into(),
-        0x2478 => "minix v2 (30 char.)".into(),
-        0x4D5A => "minix3".into(),
-        0x1980_0202 => "mqueue".into(),
-        0x4D44 => "msdos".into(),
-        0x564C => "novell".into(),
-        0x6969 => "nfs".into(),
-        0x6E66_7364 => "nfsd".into(),
-        0x3434 => "nilfs".into(),
-        0x6E73_6673 => "nsfs".into(),
-        0x5346_544E => "ntfs".into(),
-        0x9FA1 => "openprom".into(),
-        0x7461_636F => "ocfs2".into(),
-        0x794C_7630 => "overlayfs".into(),
-        0xAAD7_AAEA => "panfs".into(),
-        0x5049_5045 => "pipefs".into(),
-        0x7C7C_6673 => "prl_fs".into(),
-        0x9FA0 => "proc".into(),
-        0x6165_676C => "pstorefs".into(),
-        0x002F => "qnx4".into(),
-        0x6819_1122 => "qnx6".into(),
-        0x8584_58F6 => "ramfs".into(),
-        0x5265_4973 => "reiserfs".into(),
-        0x7275 => "romfs".into(),
-        0x6759_6969 => "rpc_pipefs".into(),
-        0x7363_6673 => "securityfs".into(),
-        0xF97C_FF8C => "selinux".into(),
-        0x4341_5D53 => "smackfs".into(),
-        0x517B => "smb".into(),
-        0xFE53_4D42 => "smb2".into(),
-        0xBEEF_DEAD => "snfs".into(),
-        0x534F_434B => "sockfs".into(),
-        0x7371_7368 => "squashfs".into(),
-        0x6265_6572 => "sysfs".into(),
-        0x012F_F7B6 => "sysv2".into(),
-        0x012F_F7B5 => "sysv4".into(),
-        0x0102_1994 => "tmpfs".into(),
-        0x7472_6163 => "tracefs".into(),
-        0x2405_1905 => "ubifs".into(),
-        0x1501_3346 => "udf".into(),
-        0x0001_1954 => "ufs".into(),
-        0x5419_0100 => "ufs".into(),
-        0x9FA2 => "usbdevfs".into(),
-        0x0102_1997 => "v9fs".into(),
-        0xBACB_ACBC => "vmhgfs".into(),
-        0xA501_FCF5 => "vxfs".into(),
-        0x565A_4653 => "vzfs".into(),
-        0x5346_4846 => "wslfs".into(),
-        0xABBA_1974 => "xenfs".into(),
-        0x012F_F7B4 => "xenix".into(),
-        0x5846_5342 => "xfs".into(),
-        0x012F_D16D => "xia".into(),
-        0x2FC1_2FC1 => "zfs".into(),
-        other => format!("UNKNOWN ({:#x})", other).into(),
+pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str> {
+    // spell-checker:disable
+    match fstype {
+        0x6163_6673 => "acfs".into(),
+        0xADF5 => "adfs".into(),
+        0xADFF => "affs".into(),
+        0x5346_414F => "afs".into(),
+        0x0904_1934 => "anon-inode FS".into(),
+        0x6175_6673 => "aufs".into(),
+        0x0187 => "autofs".into(),
+        0x4246_5331 => "befs".into(),
+        0x6264_6576 => "bdevfs".into(),
+        0x1BAD_FACE => "bfs".into(),
+        0xCAFE_4A11 => "bpf_fs".into(),
+        0x4249_4E4D => "binfmt_misc".into(),
+        0x9123_683E => "btrfs".into(),
+        0x7372_7279 => "btrfs_test".into(),
+        0x00C3_6400 => "ceph".into(),
+        0x0027_E0EB => "cgroupfs".into(),
+        0xFF53_4D42 => "cifs".into(),
+        0x7375_7245 => "coda".into(),
+        0x012F_F7B7 => "coh".into(),
+        0x6265_6570 => "configfs".into(),
+        0x28CD_3D45 => "cramfs".into(),
+        0x453D_CD28 => "cramfs-wend".into(),
+        0x6462_6720 => "debugfs".into(),
+        0x1373 => "devfs".into(),
+        0x1CD1 => "devpts".into(),
+        0xF15F => "ecryptfs".into(),
+        0xDE5E_81E4 => "efivarfs".into(),
+        0x0041_4A53 => "efs".into(),
+        0x5DF5 => "exofs".into(),
+        0x137D => "ext".into(),
+        0xEF53 => "ext2/ext3".into(),
+        0xEF51 => "ext2".into(),
+        0xF2F5_2010 => "f2fs".into(),
+        0x4006 => "fat".into(),
+        0x1983_0326 => "fhgfs".into(),
+        0x6573_5546 => "fuseblk".into(),
+        0x6573_5543 => "fusectl".into(),
+        0x0BAD_1DEA => "futexfs".into(),
+        0x0116_1970 => "gfs/gfs2".into(),
+        0x4750_4653 => "gpfs".into(),
+        0x4244 => "hfs".into(),
+        0x482B => "hfs+".into(),
+        0x4858 => "hfsx".into(),
+        0x00C0_FFEE => "hostfs".into(),
+        0xF995_E849 => "hpfs".into(),
+        0x9584_58F6 => "hugetlbfs".into(),
+        0x1130_7854 => "inodefs".into(),
+        0x0131_11A8 => "ibrix".into(),
+        0x2BAD_1DEA => "inotifyfs".into(),
+        0x9660 => "isofs".into(),
+        0x4004 => "isofs".into(),
+        0x4000 => "isofs".into(),
+        0x07C0 => "jffs".into(),
+        0x72B6 => "jffs2".into(),
+        0x3153_464A => "jfs".into(),
+        0x6B41_4653 => "k-afs".into(),
+        0xC97E_8168 => "logfs".into(),
+        0x0BD0_0BD0 => "lustre".into(),
+        0x5346_314D => "m1fs".into(),
+        0x137F => "minix".into(),
+        0x138F => "minix (30 char.)".into(),
+        0x2468 => "minix v2".into(),
+        0x2478 => "minix v2 (30 char.)".into(),
+        0x4D5A => "minix3".into(),
+        0x1980_0202 => "mqueue".into(),
+        0x4D44 => "msdos".into(),
+        0x564C => "novell".into(),
+        0x6969 => "nfs".into(),
+        0x6E66_7364 => "nfsd".into(),
+        0x3434 => "nilfs".into(),
+        0x6E73_6673 => "nsfs".into(),
+        0x5346_544E => "ntfs".into(),
+        0x9FA1 => "openprom".into(),
+        0x7461_636F => "ocfs2".into(),
+        0x794C_7630 => "overlayfs".into(),
+        0xAAD7_AAEA => "panfs".into(),
+        0x5049_5045 => "pipefs".into(),
+        0x7C7C_6673 => "prl_fs".into(),
+        0x9FA0 => "proc".into(),
+        0x6165_676C => "pstorefs".into(),
+        0x002F => "qnx4".into(),
+        0x6819_1122 => "qnx6".into(),
+        0x8584_58F6 => "ramfs".into(),
+        0x5265_4973 => "reiserfs".into(),
+        0x7275 => "romfs".into(),
+        0x6759_6969 => "rpc_pipefs".into(),
+        0x7363_6673 => "securityfs".into(),
+        0xF97C_FF8C => "selinux".into(),
+        0x4341_5D53 => "smackfs".into(),
+        0x517B => "smb".into(),
+        0xFE53_4D42 => "smb2".into(),
+        0xBEEF_DEAD => "snfs".into(),
+        0x534F_434B => "sockfs".into(),
+        0x7371_7368 => "squashfs".into(),
+        0x6265_6572 => "sysfs".into(),
+        0x012F_F7B6 => "sysv2".into(),
+        0x012F_F7B5 => "sysv4".into(),
+        0x0102_1994 => "tmpfs".into(),
+        0x7472_6163 => "tracefs".into(),
+        0x2405_1905 => "ubifs".into(),
+        0x1501_3346 => "udf".into(),
+        0x0001_1954 => "ufs".into(),
+        0x5419_0100 => "ufs".into(),
+        0x9FA2 => "usbdevfs".into(),
+        0x0102_1997 => "v9fs".into(),
+        0xBACB_ACBC => "vmhgfs".into(),
+        0xA501_FCF5 => "vxfs".into(),
+        0x565A_4653 => "vzfs".into(),
+        0x5346_4846 => "wslfs".into(),
+        0xABBA_1974 => "xenfs".into(),
+        0x012F_F7B4 => "xenix".into(),
+        0x5846_5342 => "xfs".into(),
+        0x012F_D16D => "xia".into(),
+        0x2FC1_2FC1 => "zfs".into(),
+        other => format!("UNKNOWN ({:#x})", other).into(),
     }
-    // spell-checker:enable
-}
+    // spell-checker:enable
+}
 
-#[cfg(test)]
-mod tests {
-    use super::*;
+#[cfg(test)]
+mod tests {
+    use super::*;
 
-    #[test]
-    #[cfg(unix)]
-    fn test_file_type() {
-        assert_eq!("block special file", pretty_filetype(S_IFBLK, 0));
-        assert_eq!("character special file", pretty_filetype(S_IFCHR, 0));
-        assert_eq!("regular file", pretty_filetype(S_IFREG, 1));
-        assert_eq!("regular empty file", pretty_filetype(S_IFREG, 0));
-        assert_eq!("weird file", pretty_filetype(0, 0));
+    #[test]
+    #[cfg(unix)]
+    fn test_file_type() {
+        assert_eq!("block special file", pretty_filetype(S_IFBLK, 0));
+        assert_eq!("character special file", pretty_filetype(S_IFCHR, 0));
+        assert_eq!("regular file", pretty_filetype(S_IFREG, 1));
+        assert_eq!("regular empty file", pretty_filetype(S_IFREG, 0));
+        assert_eq!("weird file", pretty_filetype(0, 0));
     }
 
-    #[test]
-    fn test_fs_type() {
-        // spell-checker:disable
-        assert_eq!("ext2/ext3", pretty_fstype(0xEF53));
-        assert_eq!("tmpfs", pretty_fstype(0x01021994));
-        assert_eq!("nfs", pretty_fstype(0x6969));
-        assert_eq!("btrfs", pretty_fstype(0x9123683e));
-        assert_eq!("xfs", pretty_fstype(0x58465342));
-        assert_eq!("zfs", pretty_fstype(0x2FC12FC1));
-        assert_eq!("ntfs", pretty_fstype(0x5346544e));
-        assert_eq!("fat", pretty_fstype(0x4006));
-        assert_eq!("UNKNOWN (0x1234)", pretty_fstype(0x1234));
-        // spell-checker:enable
-    }
+    #[test]
+    fn test_fs_type() {
+        // spell-checker:disable
+        assert_eq!("ext2/ext3", pretty_fstype(0xEF53));
+        assert_eq!("tmpfs", pretty_fstype(0x01021994));
+        assert_eq!("nfs", pretty_fstype(0x6969));
+        assert_eq!("btrfs", pretty_fstype(0x9123683e));
+        assert_eq!("xfs", pretty_fstype(0x58465342));
+        assert_eq!("zfs", pretty_fstype(0x2FC12FC1));
+        assert_eq!("ntfs", pretty_fstype(0x5346544e));
+        assert_eq!("fat", pretty_fstype(0x4006));
+        assert_eq!("UNKNOWN (0x1234)", pretty_fstype(0x1234));
+        // spell-checker:enable
+    }
 
-    #[test]
-    #[cfg(any(target_os = "linux", target_os = "android"))]
-    fn test_mountinfo() {
-        // spell-checker:ignore (word) relatime
-        let info = MountInfo::new(
-            LINUX_MOUNTINFO,
-            &"106 109 253:6 / /mnt rw,relatime - xfs /dev/fs0 rw"
-                .split_ascii_whitespace()
-                .collect::<Vec<_>>(),
+    #[test]
+    #[cfg(any(target_os = "linux", target_os = "android"))]
+    fn test_mountinfo() {
+        // spell-checker:ignore (word) relatime
+        let info = MountInfo::new(
+            LINUX_MOUNTINFO,
+            &"106 109 253:6 / /mnt rw,relatime - xfs /dev/fs0 rw"
+                .split_ascii_whitespace()
+                .collect::<Vec<_>>(),
         )
-        .unwrap();
+        .unwrap();
 
-        assert_eq!(info.mount_root, "/");
-        assert_eq!(info.mount_dir, "/mnt");
-        assert_eq!(info.mount_option, "rw,relatime");
-        assert_eq!(info.fs_type, "xfs");
-        assert_eq!(info.dev_name, "/dev/fs0");
+        assert_eq!(info.mount_root, "/");
+        assert_eq!(info.mount_dir, "/mnt");
+        assert_eq!(info.mount_option, "rw,relatime");
+        assert_eq!(info.fs_type, "xfs");
+        assert_eq!(info.dev_name, "/dev/fs0");
 
-        // Test parsing with different amounts of optional fields.
-        let info = MountInfo::new(
-            LINUX_MOUNTINFO,
-            &"106 109 253:6 / /mnt rw,relatime master:1 - xfs /dev/fs0 rw"
-                .split_ascii_whitespace()
-                .collect::<Vec<_>>(),
+        // Test parsing with different amounts of optional fields.
+        let info = MountInfo::new(
+            LINUX_MOUNTINFO,
+            &"106 109 253:6 / /mnt rw,relatime master:1 - xfs /dev/fs0 rw"
+                .split_ascii_whitespace()
+                .collect::<Vec<_>>(),
         )
-        .unwrap();
+        .unwrap();
 
-        assert_eq!(info.fs_type, "xfs");
-        assert_eq!(info.dev_name, "/dev/fs0");
+        assert_eq!(info.fs_type, "xfs");
+        assert_eq!(info.dev_name, "/dev/fs0");
 
-        let info = MountInfo::new(
-            LINUX_MOUNTINFO,
-            &"106 109 253:6 / /mnt rw,relatime master:1 shared:2 - xfs /dev/fs0 rw"
-                .split_ascii_whitespace()
-                .collect::<Vec<_>>(),
+        let info = MountInfo::new(
+            LINUX_MOUNTINFO,
+            &"106 109 253:6 / /mnt rw,relatime master:1 shared:2 - xfs /dev/fs0 rw"
+                .split_ascii_whitespace()
+                .collect::<Vec<_>>(),
         )
-        .unwrap();
+        .unwrap();
 
-        assert_eq!(info.fs_type, "xfs");
-        assert_eq!(info.dev_name, "/dev/fs0");
+        assert_eq!(info.fs_type, "xfs");
+        assert_eq!(info.dev_name, "/dev/fs0");
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/lines.rs.html b/dev/src/uucore/features/lines.rs.html index c80e47ce6..e56be2a08 100644 --- a/dev/src/uucore/features/lines.rs.html +++ b/dev/src/uucore/features/lines.rs.html @@ -1,4 +1,4 @@ -lines.rs - source
1
+lines.rs - source
1
 2
 3
 4
@@ -111,118 +111,118 @@
 111
 112
 113
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
-// spell-checker:ignore (vars)
-//! Iterate over lines, including the line ending character(s).
-//!
-//! This module provides the [`lines`] function, similar to the
-//! [`BufRead::lines`] method. While the [`BufRead::lines`] method
-//! yields [`String`] instances that do not include the line ending
-//! characters (`"\n"` or `"\r\n"`), our functions yield
-//! [`Vec`]<['u8']> instances that include the line ending
-//! characters. This is useful if the input data does not end with a
-//! newline character and you want to preserve the exact form of the
-//! input data.
-use std::io::BufRead;
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
+// spell-checker:ignore (vars)
+//! Iterate over lines, including the line ending character(s).
+//!
+//! This module provides the [`lines`] function, similar to the
+//! [`BufRead::lines`] method. While the [`BufRead::lines`] method
+//! yields [`String`] instances that do not include the line ending
+//! characters (`"\n"` or `"\r\n"`), our functions yield
+//! [`Vec`]<['u8']> instances that include the line ending
+//! characters. This is useful if the input data does not end with a
+//! newline character and you want to preserve the exact form of the
+//! input data.
+use std::io::BufRead;
 
-/// Returns an iterator over the lines, including line ending characters.
-///
-/// This function is just like [`BufRead::lines`], but it includes the
-/// line ending characters in each yielded [`String`] if the input
-/// data has them. Set the `sep` parameter to the line ending
-/// character; for Unix line endings, use `b'\n'`.
-///
-/// # Examples
-///
-/// Use `sep` to specify an alternate character for line endings. For
-/// example, if lines are terminated by the null character `b'\0'`:
-///
-/// ```rust,ignore
-/// use std::io::BufRead;
-/// use std::io::Cursor;
-///
-/// let cursor = Cursor::new(b"x\0y\0z\0");
-/// let mut it = lines(cursor, b'\0').map(|l| l.unwrap());
-///
-/// assert_eq!(it.next(), Some(Vec::from("x\0")));
-/// assert_eq!(it.next(), Some(Vec::from("y\0")));
-/// assert_eq!(it.next(), Some(Vec::from("z\0")));
-/// assert_eq!(it.next(), None);
-/// ```
-///
-/// If the input data does not end with a newline character (`'\n'`),
-/// then the last [`String`] yielded by this iterator also does not
-/// end with a newline:
-///
-/// ```rust,ignore
-/// let cursor = Cursor::new(b"x\ny\nz");
-/// let mut it = lines(cursor, b'\n').map(|l| l.unwrap());
-///
-/// assert_eq!(it.next(), Some(Vec::from("x\n")));
-/// assert_eq!(it.next(), Some(Vec::from("y\n")));
-/// assert_eq!(it.next(), Some(Vec::from("z")));
-/// assert_eq!(it.next(), None);
-/// ```
-pub fn lines<B>(reader: B, sep: u8) -> Lines<B>
-where
-    B: BufRead,
+/// Returns an iterator over the lines, including line ending characters.
+///
+/// This function is just like [`BufRead::lines`], but it includes the
+/// line ending characters in each yielded [`String`] if the input
+/// data has them. Set the `sep` parameter to the line ending
+/// character; for Unix line endings, use `b'\n'`.
+///
+/// # Examples
+///
+/// Use `sep` to specify an alternate character for line endings. For
+/// example, if lines are terminated by the null character `b'\0'`:
+///
+/// ```rust,ignore
+/// use std::io::BufRead;
+/// use std::io::Cursor;
+///
+/// let cursor = Cursor::new(b"x\0y\0z\0");
+/// let mut it = lines(cursor, b'\0').map(|l| l.unwrap());
+///
+/// assert_eq!(it.next(), Some(Vec::from("x\0")));
+/// assert_eq!(it.next(), Some(Vec::from("y\0")));
+/// assert_eq!(it.next(), Some(Vec::from("z\0")));
+/// assert_eq!(it.next(), None);
+/// ```
+///
+/// If the input data does not end with a newline character (`'\n'`),
+/// then the last [`String`] yielded by this iterator also does not
+/// end with a newline:
+///
+/// ```rust,ignore
+/// let cursor = Cursor::new(b"x\ny\nz");
+/// let mut it = lines(cursor, b'\n').map(|l| l.unwrap());
+///
+/// assert_eq!(it.next(), Some(Vec::from("x\n")));
+/// assert_eq!(it.next(), Some(Vec::from("y\n")));
+/// assert_eq!(it.next(), Some(Vec::from("z")));
+/// assert_eq!(it.next(), None);
+/// ```
+pub fn lines<B>(reader: B, sep: u8) -> Lines<B>
+where
+    B: BufRead,
 {
-    Lines { buf: reader, sep }
+    Lines { buf: reader, sep }
 }
 
-/// An iterator over the lines of an instance of `BufRead`.
-///
-/// This struct is generally created by calling [`lines`] on a `BufRead`.
-/// Please see the documentation of [`lines`] for more details.
-pub struct Lines<B> {
-    buf: B,
-    sep: u8,
+/// An iterator over the lines of an instance of `BufRead`.
+///
+/// This struct is generally created by calling [`lines`] on a `BufRead`.
+/// Please see the documentation of [`lines`] for more details.
+pub struct Lines<B> {
+    buf: B,
+    sep: u8,
 }
 
-impl<B: BufRead> Iterator for Lines<B> {
-    type Item = std::io::Result<Vec<u8>>;
+impl<B: BufRead> Iterator for Lines<B> {
+    type Item = std::io::Result<Vec<u8>>;
 
-    fn next(&mut self) -> Option<std::io::Result<Vec<u8>>> {
-        let mut buf = Vec::new();
-        match self.buf.read_until(self.sep, &mut buf) {
+    fn next(&mut self) -> Option<std::io::Result<Vec<u8>>> {
+        let mut buf = Vec::new();
+        match self.buf.read_until(self.sep, &mut buf) {
             Ok(0) => None,
-            Ok(_n) => Some(Ok(buf)),
-            Err(e) => Some(Err(e)),
+            Ok(_n) => Some(Ok(buf)),
+            Err(e) => Some(Err(e)),
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::lines::lines;
-    use std::io::Cursor;
+#[cfg(test)]
+mod tests {
+    use crate::lines::lines;
+    use std::io::Cursor;
 
-    #[test]
-    fn test_lines() {
-        let cursor = Cursor::new(b"x\ny\nz");
-        let mut it = lines(cursor, b'\n').map(|l| l.unwrap());
+    #[test]
+    fn test_lines() {
+        let cursor = Cursor::new(b"x\ny\nz");
+        let mut it = lines(cursor, b'\n').map(|l| l.unwrap());
 
-        assert_eq!(it.next(), Some(Vec::from("x\n")));
-        assert_eq!(it.next(), Some(Vec::from("y\n")));
-        assert_eq!(it.next(), Some(Vec::from("z")));
-        assert_eq!(it.next(), None);
+        assert_eq!(it.next(), Some(Vec::from("x\n")));
+        assert_eq!(it.next(), Some(Vec::from("y\n")));
+        assert_eq!(it.next(), Some(Vec::from("z")));
+        assert_eq!(it.next(), None);
     }
 
-    #[test]
-    fn test_lines_zero_terminated() {
-        use std::io::Cursor;
+    #[test]
+    fn test_lines_zero_terminated() {
+        use std::io::Cursor;
 
-        let cursor = Cursor::new(b"x\0y\0z\0");
-        let mut it = lines(cursor, b'\0').map(|l| l.unwrap());
+        let cursor = Cursor::new(b"x\0y\0z\0");
+        let mut it = lines(cursor, b'\0').map(|l| l.unwrap());
 
-        assert_eq!(it.next(), Some(Vec::from("x\0")));
-        assert_eq!(it.next(), Some(Vec::from("y\0")));
-        assert_eq!(it.next(), Some(Vec::from("z\0")));
-        assert_eq!(it.next(), None);
+        assert_eq!(it.next(), Some(Vec::from("x\0")));
+        assert_eq!(it.next(), Some(Vec::from("y\0")));
+        assert_eq!(it.next(), Some(Vec::from("z\0")));
+        assert_eq!(it.next(), None);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/memo.rs.html b/dev/src/uucore/features/memo.rs.html index ee49182ee..5d5e271e0 100644 --- a/dev/src/uucore/features/memo.rs.html +++ b/dev/src/uucore/features/memo.rs.html @@ -1,4 +1,4 @@ -memo.rs - source
1
+memo.rs - source
1
 2
 3
 4
@@ -83,90 +83,90 @@
 83
 84
 85
-
//! Memo runner of printf
-//! Takes a format string and arguments
-//! 1. tokenize format string into tokens, consuming
-//! any subst. arguments along the way.
-//! 2. feeds remaining arguments into function
-//! that prints tokens.
+
//! Memo runner of printf
+//! Takes a format string and arguments
+//! 1. tokenize format string into tokens, consuming
+//! any subst. arguments along the way.
+//! 2. feeds remaining arguments into function
+//! that prints tokens.
 
-use crate::display::Quotable;
-use crate::error::UResult;
-use crate::features::tokenize::sub::Sub;
-use crate::features::tokenize::token::{Token, Tokenizer};
-use crate::features::tokenize::unescaped_text::UnescapedText;
-use crate::show_warning;
-use itertools::put_back_n;
-use std::iter::Peekable;
-use std::slice::Iter;
+use crate::display::Quotable;
+use crate::error::UResult;
+use crate::features::tokenize::sub::Sub;
+use crate::features::tokenize::token::{Token, Tokenizer};
+use crate::features::tokenize::unescaped_text::UnescapedText;
+use crate::show_warning;
+use itertools::put_back_n;
+use std::iter::Peekable;
+use std::slice::Iter;
 
-pub struct Memo {
-    tokens: Vec<Box<dyn Token>>,
+pub struct Memo {
+    tokens: Vec<Box<dyn Token>>,
 }
 
-fn warn_excess_args(first_arg: &str) {
+fn warn_excess_args(first_arg: &str) {
     show_warning!(
         "ignoring excess arguments, starting with {}",
-        first_arg.quote()
+        first_arg.quote()
     );
 }
 
-impl Memo {
-    pub fn new(pf_string: &str, pf_args_it: &mut Peekable<Iter<String>>) -> UResult<Self> {
-        let mut pm = Self { tokens: Vec::new() };
-        let mut tmp_token: Option<Box<dyn Token>>;
-        let mut it = put_back_n(pf_string.chars());
-        let mut has_sub = false;
-        loop {
-            tmp_token = UnescapedText::from_it(&mut it, pf_args_it)?;
-            if let Some(x) = tmp_token {
-                pm.tokens.push(x);
+impl Memo {
+    pub fn new(pf_string: &str, pf_args_it: &mut Peekable<Iter<String>>) -> UResult<Self> {
+        let mut pm = Self { tokens: Vec::new() };
+        let mut tmp_token: Option<Box<dyn Token>>;
+        let mut it = put_back_n(pf_string.chars());
+        let mut has_sub = false;
+        loop {
+            tmp_token = UnescapedText::from_it(&mut it, pf_args_it)?;
+            if let Some(x) = tmp_token {
+                pm.tokens.push(x);
             }
-            tmp_token = Sub::from_it(&mut it, pf_args_it)?;
-            if let Some(x) = tmp_token {
-                if !has_sub {
-                    has_sub = true;
+            tmp_token = Sub::from_it(&mut it, pf_args_it)?;
+            if let Some(x) = tmp_token {
+                if !has_sub {
+                    has_sub = true;
                 }
-                pm.tokens.push(x);
+                pm.tokens.push(x);
             }
-            if let Some(x) = it.next() {
-                it.put_back(x);
-            } else {
+            if let Some(x) = it.next() {
+                it.put_back(x);
+            } else {
                 break;
             }
         }
-        if !has_sub {
-            let mut drain = false;
-            if let Some(first_arg) = pf_args_it.peek() {
-                warn_excess_args(first_arg);
-                drain = true;
+        if !has_sub {
+            let mut drain = false;
+            if let Some(first_arg) = pf_args_it.peek() {
+                warn_excess_args(first_arg);
+                drain = true;
             }
-            if drain {
-                loop {
-                    // drain remaining args;
-                    if pf_args_it.next().is_none() {
+            if drain {
+                loop {
+                    // drain remaining args;
+                    if pf_args_it.next().is_none() {
                         break;
                     }
                 }
             }
         }
-        Ok(pm)
+        Ok(pm)
     }
-    pub fn apply(&self, pf_args_it: &mut Peekable<Iter<String>>) {
-        for tkn in &self.tokens {
-            tkn.print(pf_args_it);
+    pub fn apply(&self, pf_args_it: &mut Peekable<Iter<String>>) {
+        for tkn in &self.tokens {
+            tkn.print(pf_args_it);
         }
     }
-    pub fn run_all(pf_string: &str, pf_args: &[String]) -> UResult<()> {
-        let mut arg_it = pf_args.iter().peekable();
-        let pm = Self::new(pf_string, &mut arg_it)?;
-        loop {
-            if arg_it.peek().is_none() {
-                return Ok(());
+    pub fn run_all(pf_string: &str, pf_args: &[String]) -> UResult<()> {
+        let mut arg_it = pf_args.iter().peekable();
+        let pm = Self::new(pf_string, &mut arg_it)?;
+        loop {
+            if arg_it.peek().is_none() {
+                return Ok(());
             }
-            pm.apply(&mut arg_it);
+            pm.apply(&mut arg_it);
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/mode.rs.html b/dev/src/uucore/features/mode.rs.html index c798438b5..17941a3d8 100644 --- a/dev/src/uucore/features/mode.rs.html +++ b/dev/src/uucore/features/mode.rs.html @@ -1,4 +1,4 @@ -mode.rs - source
1
+mode.rs - source
1
 2
 3
 4
@@ -199,206 +199,206 @@
 199
 200
 201
-
// This file is part of the uutils coreutils package.
-//
-// (c) Alex Lyon <arcterus@mail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Alex Lyon <arcterus@mail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-//! Set of functions to parse modes
+//! Set of functions to parse modes
 
-// spell-checker:ignore (vars) fperm srwx
+// spell-checker:ignore (vars) fperm srwx
 
-use libc::{mode_t, umask, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR};
+use libc::{mode_t, umask, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR};
 
-pub fn parse_numeric(fperm: u32, mut mode: &str, considering_dir: bool) -> Result<u32, String> {
-    let (op, pos) = parse_op(mode).map_or_else(|_| (None, 0), |(op, pos)| (Some(op), pos));
-    mode = mode[pos..].trim();
-    let change = if mode.is_empty() {
-        0
-    } else {
-        u32::from_str_radix(mode, 8).map_err(|e| e.to_string())?
-    };
-    if change > 0o7777 {
-        Err(format!("mode is too large ({} > 7777", change))
-    } else {
-        Ok(match op {
-            Some('+') => fperm | change,
-            Some('-') => fperm & !change,
-            // If this is a directory, we keep the setgid and setuid bits,
-            // unless the mode contains 5 or more octal digits or the mode is "="
-            None if considering_dir && mode.len() < 5 => change | (fperm & (0o4000 | 0o2000)),
-            None | Some('=') => change,
+pub fn parse_numeric(fperm: u32, mut mode: &str, considering_dir: bool) -> Result<u32, String> {
+    let (op, pos) = parse_op(mode).map_or_else(|_| (None, 0), |(op, pos)| (Some(op), pos));
+    mode = mode[pos..].trim();
+    let change = if mode.is_empty() {
+        0
+    } else {
+        u32::from_str_radix(mode, 8).map_err(|e| e.to_string())?
+    };
+    if change > 0o7777 {
+        Err(format!("mode is too large ({} > 7777", change))
+    } else {
+        Ok(match op {
+            Some('+') => fperm | change,
+            Some('-') => fperm & !change,
+            // If this is a directory, we keep the setgid and setuid bits,
+            // unless the mode contains 5 or more octal digits or the mode is "="
+            None if considering_dir && mode.len() < 5 => change | (fperm & (0o4000 | 0o2000)),
+            None | Some('=') => change,
             Some(_) => unreachable!(),
         })
     }
 }
 
-pub fn parse_symbolic(
-    mut fperm: u32,
-    mut mode: &str,
-    umask: u32,
-    considering_dir: bool,
-) -> Result<u32, String> {
-    let (mask, pos) = parse_levels(mode);
-    if pos == mode.len() {
-        return Err(format!("invalid mode ({})", mode));
+pub fn parse_symbolic(
+    mut fperm: u32,
+    mut mode: &str,
+    umask: u32,
+    considering_dir: bool,
+) -> Result<u32, String> {
+    let (mask, pos) = parse_levels(mode);
+    if pos == mode.len() {
+        return Err(format!("invalid mode ({})", mode));
     }
-    let respect_umask = pos == 0;
-    mode = &mode[pos..];
-    while !mode.is_empty() {
-        let (op, pos) = parse_op(mode)?;
-        mode = &mode[pos..];
-        let (mut srwx, pos) = parse_change(mode, fperm, considering_dir);
-        if respect_umask {
-            srwx &= !(umask as u32);
+    let respect_umask = pos == 0;
+    mode = &mode[pos..];
+    while !mode.is_empty() {
+        let (op, pos) = parse_op(mode)?;
+        mode = &mode[pos..];
+        let (mut srwx, pos) = parse_change(mode, fperm, considering_dir);
+        if respect_umask {
+            srwx &= !(umask as u32);
         }
-        mode = &mode[pos..];
-        match op {
-            '+' => fperm |= srwx & mask,
-            '-' => fperm &= !(srwx & mask),
-            '=' => {
-                if considering_dir {
-                    // keep the setgid and setuid bits for directories
-                    srwx |= fperm & (0o4000 | 0o2000);
+        mode = &mode[pos..];
+        match op {
+            '+' => fperm |= srwx & mask,
+            '-' => fperm &= !(srwx & mask),
+            '=' => {
+                if considering_dir {
+                    // keep the setgid and setuid bits for directories
+                    srwx |= fperm & (0o4000 | 0o2000);
                 }
-                fperm = (fperm & !mask) | (srwx & mask);
+                fperm = (fperm & !mask) | (srwx & mask);
             }
-            _ => unreachable!(),
+            _ => unreachable!(),
         }
     }
-    Ok(fperm)
+    Ok(fperm)
 }
 
-fn parse_levels(mode: &str) -> (u32, usize) {
-    let mut mask = 0;
-    let mut pos = 0;
-    for ch in mode.chars() {
-        mask |= match ch {
-            'u' => 0o4700,
-            'g' => 0o2070,
-            'o' => 0o1007,
-            'a' => 0o7777,
-            _ => break,
+fn parse_levels(mode: &str) -> (u32, usize) {
+    let mut mask = 0;
+    let mut pos = 0;
+    for ch in mode.chars() {
+        mask |= match ch {
+            'u' => 0o4700,
+            'g' => 0o2070,
+            'o' => 0o1007,
+            'a' => 0o7777,
+            _ => break,
         };
-        pos += 1;
+        pos += 1;
     }
-    if pos == 0 {
-        mask = 0o7777; // default to 'a'
-    }
-    (mask, pos)
+    if pos == 0 {
+        mask = 0o7777; // default to 'a'
+    }
+    (mask, pos)
 }
 
-fn parse_op(mode: &str) -> Result<(char, usize), String> {
-    let ch = mode
-        .chars()
-        .next()
-        .ok_or_else(|| "unexpected end of mode".to_owned())?;
-    match ch {
-        '+' | '-' | '=' => Ok((ch, 1)),
-        _ => Err(format!(
+fn parse_op(mode: &str) -> Result<(char, usize), String> {
+    let ch = mode
+        .chars()
+        .next()
+        .ok_or_else(|| "unexpected end of mode".to_owned())?;
+    match ch {
+        '+' | '-' | '=' => Ok((ch, 1)),
+        _ => Err(format!(
             "invalid operator (expected +, -, or =, but found {})",
-            ch
+            ch
         )),
     }
 }
 
-fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) {
-    let mut srwx = 0;
-    let mut pos = 0;
-    for ch in mode.chars() {
-        match ch {
-            'r' => srwx |= 0o444,
-            'w' => srwx |= 0o222,
-            'x' => srwx |= 0o111,
-            'X' => {
-                if considering_dir || (fperm & 0o0111) != 0 {
-                    srwx |= 0o111;
+fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) {
+    let mut srwx = 0;
+    let mut pos = 0;
+    for ch in mode.chars() {
+        match ch {
+            'r' => srwx |= 0o444,
+            'w' => srwx |= 0o222,
+            'x' => srwx |= 0o111,
+            'X' => {
+                if considering_dir || (fperm & 0o0111) != 0 {
+                    srwx |= 0o111;
                 }
             }
-            's' => srwx |= 0o4000 | 0o2000,
-            't' => srwx |= 0o1000,
-            'u' => srwx = (fperm & 0o700) | ((fperm >> 3) & 0o070) | ((fperm >> 6) & 0o007),
-            'g' => srwx = ((fperm << 3) & 0o700) | (fperm & 0o070) | ((fperm >> 3) & 0o007),
-            'o' => srwx = ((fperm << 6) & 0o700) | ((fperm << 3) & 0o070) | (fperm & 0o007),
-            _ => break,
+            's' => srwx |= 0o4000 | 0o2000,
+            't' => srwx |= 0o1000,
+            'u' => srwx = (fperm & 0o700) | ((fperm >> 3) & 0o070) | ((fperm >> 6) & 0o007),
+            'g' => srwx = ((fperm << 3) & 0o700) | (fperm & 0o070) | ((fperm >> 3) & 0o007),
+            'o' => srwx = ((fperm << 6) & 0o700) | ((fperm << 3) & 0o070) | (fperm & 0o007),
+            _ => break,
         };
-        pos += 1;
+        pos += 1;
     }
-    if pos == 0 {
-        srwx = 0;
+    if pos == 0 {
+        srwx = 0;
     }
-    (srwx, pos)
+    (srwx, pos)
 }
 
-pub fn parse_mode(mode: &str) -> Result<mode_t, String> {
-    let fperm = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-    let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
-    let result = if mode.contains(arr) {
-        parse_numeric(fperm as u32, mode, true)
-    } else {
-        parse_symbolic(fperm as u32, mode, get_umask(), true)
+pub fn parse_mode(mode: &str) -> Result<mode_t, String> {
+    let fperm = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+    let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
+    let result = if mode.contains(arr) {
+        parse_numeric(fperm as u32, mode, true)
+    } else {
+        parse_symbolic(fperm as u32, mode, get_umask(), true)
     };
-    result.map(|mode| mode as mode_t)
+    result.map(|mode| mode as mode_t)
 }
 
-pub fn get_umask() -> u32 {
-    // There's no portable way to read the umask without changing it.
-    // We have to replace it and then quickly set it back, hopefully before
-    // some other thread is affected.
-    // On modern Linux kernels the current umask could instead be read
-    // from /proc/self/status. But that's a lot of work.
-    // SAFETY: umask always succeeds and doesn't operate on memory. Races are
-    // possible but it can't violate Rust's guarantees.
-    let mask = unsafe { umask(0) };
-    unsafe { umask(mask) };
-    mask as u32
+pub fn get_umask() -> u32 {
+    // There's no portable way to read the umask without changing it.
+    // We have to replace it and then quickly set it back, hopefully before
+    // some other thread is affected.
+    // On modern Linux kernels the current umask could instead be read
+    // from /proc/self/status. But that's a lot of work.
+    // SAFETY: umask always succeeds and doesn't operate on memory. Races are
+    // possible but it can't violate Rust's guarantees.
+    let mask = unsafe { umask(0) };
+    unsafe { umask(mask) };
+    mask as u32
 }
 
-// Iterate 'args' and delete the first occurrence
-// of a prefix '-' if it's associated with MODE
-// e.g. "chmod -v -xw -R FILE" -> "chmod -v xw -R FILE"
-pub fn strip_minus_from_mode(args: &mut Vec<String>) -> bool {
-    for arg in args {
-        if arg == "--" {
+// Iterate 'args' and delete the first occurrence
+// of a prefix '-' if it's associated with MODE
+// e.g. "chmod -v -xw -R FILE" -> "chmod -v xw -R FILE"
+pub fn strip_minus_from_mode(args: &mut Vec<String>) -> bool {
+    for arg in args {
+        if arg == "--" {
             break;
         }
-        if let Some(arg_stripped) = arg.strip_prefix('-') {
-            if let Some(second) = arg.chars().nth(1) {
-                match second {
-                    'r' | 'w' | 'x' | 'X' | 's' | 't' | 'u' | 'g' | 'o' | '0'..='7' => {
-                        *arg = arg_stripped.to_string();
-                        return true;
+        if let Some(arg_stripped) = arg.strip_prefix('-') {
+            if let Some(second) = arg.chars().nth(1) {
+                match second {
+                    'r' | 'w' | 'x' | 'X' | 's' | 't' | 'u' | 'g' | 'o' | '0'..='7' => {
+                        *arg = arg_stripped.to_string();
+                        return true;
                     }
-                    _ => {}
+                    _ => {}
                 }
             }
         }
     }
-    false
-}
+    false
+}
 
-#[cfg(test)]
-mod test {
+#[cfg(test)]
+mod test {
 
-    #[test]
-    fn symbolic_modes() {
-        assert_eq!(super::parse_mode("u+x").unwrap(), 0o766);
+    #[test]
+    fn symbolic_modes() {
+        assert_eq!(super::parse_mode("u+x").unwrap(), 0o766);
         assert_eq!(
-            super::parse_mode("+x").unwrap(),
-            if !crate::os::is_wsl_1() { 0o777 } else { 0o776 }
+            super::parse_mode("+x").unwrap(),
+            if !crate::os::is_wsl_1() { 0o777 } else { 0o776 }
         );
-        assert_eq!(super::parse_mode("a-w").unwrap(), 0o444);
-        assert_eq!(super::parse_mode("g-r").unwrap(), 0o626);
+        assert_eq!(super::parse_mode("a-w").unwrap(), 0o444);
+        assert_eq!(super::parse_mode("g-r").unwrap(), 0o626);
     }
 
-    #[test]
-    fn numeric_modes() {
-        assert_eq!(super::parse_mode("644").unwrap(), 0o644);
-        assert_eq!(super::parse_mode("+100").unwrap(), 0o766);
-        assert_eq!(super::parse_mode("-4").unwrap(), 0o662);
+    #[test]
+    fn numeric_modes() {
+        assert_eq!(super::parse_mode("644").unwrap(), 0o644);
+        assert_eq!(super::parse_mode("+100").unwrap(), 0o766);
+        assert_eq!(super::parse_mode("-4").unwrap(), 0o662);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/perms.rs.html b/dev/src/uucore/features/perms.rs.html index eb9f7e5de..73362195f 100644 --- a/dev/src/uucore/features/perms.rs.html +++ b/dev/src/uucore/features/perms.rs.html @@ -1,4 +1,4 @@ -perms.rs - source
1
+perms.rs - source
1
 2
 3
 4
@@ -526,533 +526,533 @@
 526
 527
 528
-
// This file is part of the uutils coreutils package.
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-//! Common functions to manage permissions
+//! Common functions to manage permissions
 
-use crate::display::Quotable;
-use crate::error::strip_errno;
-use crate::error::UResult;
-use crate::error::USimpleError;
-pub use crate::features::entries;
-use crate::fs::resolve_relative_path;
-use crate::show_error;
-use clap::Arg;
-use clap::ArgMatches;
-use clap::Command;
-use libc::{self, gid_t, uid_t};
-use walkdir::WalkDir;
+use crate::display::Quotable;
+use crate::error::strip_errno;
+use crate::error::UResult;
+use crate::error::USimpleError;
+pub use crate::features::entries;
+use crate::fs::resolve_relative_path;
+use crate::show_error;
+use clap::Arg;
+use clap::ArgMatches;
+use clap::Command;
+use libc::{self, gid_t, uid_t};
+use walkdir::WalkDir;
 
-use std::io::Error as IOError;
-use std::io::Result as IOResult;
+use std::io::Error as IOError;
+use std::io::Result as IOResult;
 
-use std::ffi::CString;
-use std::fs::Metadata;
-use std::os::unix::fs::MetadataExt;
+use std::ffi::CString;
+use std::fs::Metadata;
+use std::os::unix::fs::MetadataExt;
 
-use std::os::unix::ffi::OsStrExt;
-use std::path::Path;
+use std::os::unix::ffi::OsStrExt;
+use std::path::Path;
 
-/// The various level of verbosity
-#[derive(PartialEq, Eq, Clone, Debug)]
-pub enum VerbosityLevel {
-    Silent,
-    Changes,
-    Verbose,
-    Normal,
+/// The various level of verbosity
+#[derive(PartialEq, Eq, Clone, Debug)]
+pub enum VerbosityLevel {
+    Silent,
+    Changes,
+    Verbose,
+    Normal,
 }
-#[derive(PartialEq, Eq, Clone, Debug)]
-pub struct Verbosity {
-    pub groups_only: bool,
-    pub level: VerbosityLevel,
+#[derive(PartialEq, Eq, Clone, Debug)]
+pub struct Verbosity {
+    pub groups_only: bool,
+    pub level: VerbosityLevel,
 }
 
-/// Actually perform the change of owner on a path
-fn chown<P: AsRef<Path>>(path: P, uid: uid_t, gid: gid_t, follow: bool) -> IOResult<()> {
-    let path = path.as_ref();
-    let s = CString::new(path.as_os_str().as_bytes()).unwrap();
-    let ret = unsafe {
-        if follow {
-            libc::chown(s.as_ptr(), uid, gid)
-        } else {
-            libc::lchown(s.as_ptr(), uid, gid)
+/// Actually perform the change of owner on a path
+fn chown<P: AsRef<Path>>(path: P, uid: uid_t, gid: gid_t, follow: bool) -> IOResult<()> {
+    let path = path.as_ref();
+    let s = CString::new(path.as_os_str().as_bytes()).unwrap();
+    let ret = unsafe {
+        if follow {
+            libc::chown(s.as_ptr(), uid, gid)
+        } else {
+            libc::lchown(s.as_ptr(), uid, gid)
         }
     };
-    if ret == 0 {
+    if ret == 0 {
         Ok(())
-    } else {
-        Err(IOError::last_os_error())
+    } else {
+        Err(IOError::last_os_error())
     }
 }
 
-/// Perform the change of owner on a path
-/// with the various options
-/// and error messages management
-pub fn wrap_chown<P: AsRef<Path>>(
-    path: P,
-    meta: &Metadata,
-    dest_uid: Option<u32>,
-    dest_gid: Option<u32>,
-    follow: bool,
-    verbosity: Verbosity,
-) -> Result<String, String> {
-    let dest_uid = dest_uid.unwrap_or_else(|| meta.uid());
-    let dest_gid = dest_gid.unwrap_or_else(|| meta.gid());
-    let path = path.as_ref();
-    let mut out: String = String::new();
+/// Perform the change of owner on a path
+/// with the various options
+/// and error messages management
+pub fn wrap_chown<P: AsRef<Path>>(
+    path: P,
+    meta: &Metadata,
+    dest_uid: Option<u32>,
+    dest_gid: Option<u32>,
+    follow: bool,
+    verbosity: Verbosity,
+) -> Result<String, String> {
+    let dest_uid = dest_uid.unwrap_or_else(|| meta.uid());
+    let dest_gid = dest_gid.unwrap_or_else(|| meta.gid());
+    let path = path.as_ref();
+    let mut out: String = String::new();
 
-    if let Err(e) = chown(path, dest_uid, dest_gid, follow) {
-        match verbosity.level {
-            VerbosityLevel::Silent => (),
-            level => {
-                out = format!(
+    if let Err(e) = chown(path, dest_uid, dest_gid, follow) {
+        match verbosity.level {
+            VerbosityLevel::Silent => (),
+            level => {
+                out = format!(
                     "changing {} of {}: {}",
-                    if verbosity.groups_only {
-                        "group"
-                    } else {
-                        "ownership"
-                    },
-                    path.quote(),
-                    e
+                    if verbosity.groups_only {
+                        "group"
+                    } else {
+                        "ownership"
+                    },
+                    path.quote(),
+                    e
                 );
-                if level == VerbosityLevel::Verbose {
-                    out = if verbosity.groups_only {
-                        let gid = meta.gid();
+                if level == VerbosityLevel::Verbose {
+                    out = if verbosity.groups_only {
+                        let gid = meta.gid();
                         format!(
                             "{}\nfailed to change group of {} from {} to {}",
-                            out,
-                            path.quote(),
-                            entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
-                            entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
+                            out,
+                            path.quote(),
+                            entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
+                            entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
                         )
-                    } else {
-                        let uid = meta.uid();
-                        let gid = meta.gid();
+                    } else {
+                        let uid = meta.uid();
+                        let gid = meta.gid();
                         format!(
                             "{}\nfailed to change ownership of {} from {}:{} to {}:{}",
-                            out,
-                            path.quote(),
-                            entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
-                            entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
-                            entries::uid2usr(dest_uid).unwrap_or_else(|_| dest_uid.to_string()),
-                            entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
+                            out,
+                            path.quote(),
+                            entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
+                            entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
+                            entries::uid2usr(dest_uid).unwrap_or_else(|_| dest_uid.to_string()),
+                            entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
                         )
                     };
                 };
             }
         }
-        return Err(out);
-    } else {
-        let changed = dest_uid != meta.uid() || dest_gid != meta.gid();
-        if changed {
-            match verbosity.level {
-                VerbosityLevel::Changes | VerbosityLevel::Verbose => {
-                    let gid = meta.gid();
-                    out = if verbosity.groups_only {
+        return Err(out);
+    } else {
+        let changed = dest_uid != meta.uid() || dest_gid != meta.gid();
+        if changed {
+            match verbosity.level {
+                VerbosityLevel::Changes | VerbosityLevel::Verbose => {
+                    let gid = meta.gid();
+                    out = if verbosity.groups_only {
                         format!(
                             "changed group of {} from {} to {}",
-                            path.quote(),
-                            entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
-                            entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
+                            path.quote(),
+                            entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
+                            entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
                         )
-                    } else {
-                        let gid = meta.gid();
-                        let uid = meta.uid();
+                    } else {
+                        let gid = meta.gid();
+                        let uid = meta.uid();
                         format!(
                             "changed ownership of {} from {}:{} to {}:{}",
-                            path.quote(),
-                            entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
-                            entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
-                            entries::uid2usr(dest_uid).unwrap_or_else(|_| dest_uid.to_string()),
-                            entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
+                            path.quote(),
+                            entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
+                            entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
+                            entries::uid2usr(dest_uid).unwrap_or_else(|_| dest_uid.to_string()),
+                            entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
                         )
                     };
                 }
-                _ => (),
+                _ => (),
             };
-        } else if verbosity.level == VerbosityLevel::Verbose {
-            out = if verbosity.groups_only {
+        } else if verbosity.level == VerbosityLevel::Verbose {
+            out = if verbosity.groups_only {
                 format!(
                     "group of {} retained as {}",
-                    path.quote(),
-                    entries::gid2grp(dest_gid).unwrap_or_default()
+                    path.quote(),
+                    entries::gid2grp(dest_gid).unwrap_or_default()
                 )
-            } else {
+            } else {
                 format!(
                     "ownership of {} retained as {}:{}",
-                    path.quote(),
-                    entries::uid2usr(dest_uid).unwrap_or_else(|_| dest_uid.to_string()),
-                    entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
+                    path.quote(),
+                    entries::uid2usr(dest_uid).unwrap_or_else(|_| dest_uid.to_string()),
+                    entries::gid2grp(dest_gid).unwrap_or_else(|_| dest_gid.to_string())
                 )
             };
         }
     }
-    Ok(out)
+    Ok(out)
 }
 
-pub enum IfFrom {
-    All,
-    User(u32),
-    Group(u32),
-    UserGroup(u32, u32),
+pub enum IfFrom {
+    All,
+    User(u32),
+    Group(u32),
+    UserGroup(u32, u32),
 }
 
-#[derive(PartialEq, Eq)]
-pub enum TraverseSymlinks {
+#[derive(PartialEq, Eq)]
+pub enum TraverseSymlinks {
     None,
-    First,
-    All,
+    First,
+    All,
 }
 
-pub struct ChownExecutor {
-    pub dest_uid: Option<u32>,
-    pub dest_gid: Option<u32>,
-    pub traverse_symlinks: TraverseSymlinks,
-    pub verbosity: Verbosity,
-    pub filter: IfFrom,
-    pub files: Vec<String>,
-    pub recursive: bool,
-    pub preserve_root: bool,
-    pub dereference: bool,
+pub struct ChownExecutor {
+    pub dest_uid: Option<u32>,
+    pub dest_gid: Option<u32>,
+    pub traverse_symlinks: TraverseSymlinks,
+    pub verbosity: Verbosity,
+    pub filter: IfFrom,
+    pub files: Vec<String>,
+    pub recursive: bool,
+    pub preserve_root: bool,
+    pub dereference: bool,
 }
 
-impl ChownExecutor {
-    pub fn exec(&self) -> UResult<()> {
-        let mut ret = 0;
-        for f in &self.files {
-            ret |= self.traverse(f);
+impl ChownExecutor {
+    pub fn exec(&self) -> UResult<()> {
+        let mut ret = 0;
+        for f in &self.files {
+            ret |= self.traverse(f);
         }
-        if ret != 0 {
-            return Err(ret.into());
+        if ret != 0 {
+            return Err(ret.into());
         }
         Ok(())
     }
 
-    fn traverse<P: AsRef<Path>>(&self, root: P) -> i32 {
-        let path = root.as_ref();
-        let meta = match self.obtain_meta(path, self.dereference) {
-            Some(m) => m,
-            _ => return 1,
+    fn traverse<P: AsRef<Path>>(&self, root: P) -> i32 {
+        let path = root.as_ref();
+        let meta = match self.obtain_meta(path, self.dereference) {
+            Some(m) => m,
+            _ => return 1,
         };
 
-        // Prohibit only if:
-        // (--preserve-root and -R present) &&
-        // (
-        //     (argument is not symlink && resolved to be '/') ||
-        //     (argument is symlink && should follow argument && resolved to be '/')
-        // )
-        if self.recursive && self.preserve_root {
-            let may_exist = if self.dereference {
-                path.canonicalize().ok()
-            } else {
-                let real = resolve_relative_path(path);
-                if real.is_dir() {
-                    Some(real.canonicalize().expect("failed to get real path"))
-                } else {
-                    Some(real.into_owned())
+        // Prohibit only if:
+        // (--preserve-root and -R present) &&
+        // (
+        //     (argument is not symlink && resolved to be '/') ||
+        //     (argument is symlink && should follow argument && resolved to be '/')
+        // )
+        if self.recursive && self.preserve_root {
+            let may_exist = if self.dereference {
+                path.canonicalize().ok()
+            } else {
+                let real = resolve_relative_path(path);
+                if real.is_dir() {
+                    Some(real.canonicalize().expect("failed to get real path"))
+                } else {
+                    Some(real.into_owned())
                 }
             };
 
-            if let Some(p) = may_exist {
-                if p.parent().is_none() {
+            if let Some(p) = may_exist {
+                if p.parent().is_none() {
                     show_error!("it is dangerous to operate recursively on '/'");
                     show_error!("use --no-preserve-root to override this failsafe");
-                    return 1;
+                    return 1;
                 }
             }
         }
 
-        let ret = if self.matched(meta.uid(), meta.gid()) {
-            match wrap_chown(
-                path,
-                &meta,
-                self.dest_uid,
-                self.dest_gid,
-                self.dereference,
-                self.verbosity.clone(),
+        let ret = if self.matched(meta.uid(), meta.gid()) {
+            match wrap_chown(
+                path,
+                &meta,
+                self.dest_uid,
+                self.dest_gid,
+                self.dereference,
+                self.verbosity.clone(),
             ) {
-                Ok(n) => {
-                    if !n.is_empty() {
-                        show_error!("{}", n);
+                Ok(n) => {
+                    if !n.is_empty() {
+                        show_error!("{}", n);
                     }
-                    0
-                }
-                Err(e) => {
-                    if self.verbosity.level != VerbosityLevel::Silent {
-                        show_error!("{}", e);
+                    0
+                }
+                Err(e) => {
+                    if self.verbosity.level != VerbosityLevel::Silent {
+                        show_error!("{}", e);
                     }
-                    1
-                }
+                    1
+                }
             }
-        } else {
-            0
-        };
+        } else {
+            0
+        };
 
-        if !self.recursive {
-            ret
-        } else {
-            ret | self.dive_into(&root)
+        if !self.recursive {
+            ret
+        } else {
+            ret | self.dive_into(&root)
         }
     }
 
-    fn dive_into<P: AsRef<Path>>(&self, root: P) -> i32 {
-        let root = root.as_ref();
+    fn dive_into<P: AsRef<Path>>(&self, root: P) -> i32 {
+        let root = root.as_ref();
 
-        // walkdir always dereferences the root directory, so we have to check it ourselves
-        if self.traverse_symlinks == TraverseSymlinks::None && root.is_symlink() {
-            return 0;
+        // walkdir always dereferences the root directory, so we have to check it ourselves
+        if self.traverse_symlinks == TraverseSymlinks::None && root.is_symlink() {
+            return 0;
         }
 
-        let mut ret = 0;
-        let mut iterator = WalkDir::new(root)
-            .follow_links(self.traverse_symlinks == TraverseSymlinks::All)
-            .min_depth(1)
-            .into_iter();
-        // We can't use a for loop because we need to manipulate the iterator inside the loop.
-        while let Some(entry) = iterator.next() {
-            let entry = match entry {
-                Err(e) => {
-                    ret = 1;
-                    if let Some(path) = e.path() {
+        let mut ret = 0;
+        let mut iterator = WalkDir::new(root)
+            .follow_links(self.traverse_symlinks == TraverseSymlinks::All)
+            .min_depth(1)
+            .into_iter();
+        // We can't use a for loop because we need to manipulate the iterator inside the loop.
+        while let Some(entry) = iterator.next() {
+            let entry = match entry {
+                Err(e) => {
+                    ret = 1;
+                    if let Some(path) = e.path() {
                         show_error!(
                             "cannot access '{}': {}",
-                            path.display(),
-                            if let Some(error) = e.io_error() {
-                                strip_errno(error)
-                            } else {
-                                "Too many levels of symbolic links".into()
+                            path.display(),
+                            if let Some(error) = e.io_error() {
+                                strip_errno(error)
+                            } else {
+                                "Too many levels of symbolic links".into()
                             }
                         );
-                    } else {
-                        show_error!("{}", e);
+                    } else {
+                        show_error!("{}", e);
                     }
                     continue;
                 }
-                Ok(entry) => entry,
+                Ok(entry) => entry,
             };
-            let path = entry.path();
-            let meta = match self.obtain_meta(path, self.dereference) {
-                Some(m) => m,
-                _ => {
-                    ret = 1;
-                    if entry.file_type().is_dir() {
-                        // Instruct walkdir to skip this directory to avoid getting another error
-                        // when walkdir tries to query the children of this directory.
-                        iterator.skip_current_dir();
+            let path = entry.path();
+            let meta = match self.obtain_meta(path, self.dereference) {
+                Some(m) => m,
+                _ => {
+                    ret = 1;
+                    if entry.file_type().is_dir() {
+                        // Instruct walkdir to skip this directory to avoid getting another error
+                        // when walkdir tries to query the children of this directory.
+                        iterator.skip_current_dir();
                     }
                     continue;
                 }
             };
 
-            if !self.matched(meta.uid(), meta.gid()) {
+            if !self.matched(meta.uid(), meta.gid()) {
                 continue;
             }
 
-            ret = match wrap_chown(
-                path,
-                &meta,
-                self.dest_uid,
-                self.dest_gid,
-                self.dereference,
-                self.verbosity.clone(),
+            ret = match wrap_chown(
+                path,
+                &meta,
+                self.dest_uid,
+                self.dest_gid,
+                self.dereference,
+                self.verbosity.clone(),
             ) {
-                Ok(n) => {
-                    if !n.is_empty() {
-                        show_error!("{}", n);
+                Ok(n) => {
+                    if !n.is_empty() {
+                        show_error!("{}", n);
                     }
-                    0
-                }
-                Err(e) => {
-                    if self.verbosity.level != VerbosityLevel::Silent {
-                        show_error!("{}", e);
+                    0
+                }
+                Err(e) => {
+                    if self.verbosity.level != VerbosityLevel::Silent {
+                        show_error!("{}", e);
                     }
-                    1
-                }
+                    1
+                }
             }
         }
-        ret
+        ret
     }
 
-    fn obtain_meta<P: AsRef<Path>>(&self, path: P, follow: bool) -> Option<Metadata> {
-        let path = path.as_ref();
-        let meta = if follow {
-            path.metadata()
-        } else {
-            path.symlink_metadata()
+    fn obtain_meta<P: AsRef<Path>>(&self, path: P, follow: bool) -> Option<Metadata> {
+        let path = path.as_ref();
+        let meta = if follow {
+            path.metadata()
+        } else {
+            path.symlink_metadata()
         };
-        match meta {
-            Err(e) => {
-                match self.verbosity.level {
-                    VerbosityLevel::Silent => (),
-                    _ => show_error!(
+        match meta {
+            Err(e) => {
+                match self.verbosity.level {
+                    VerbosityLevel::Silent => (),
+                    _ => show_error!(
                         "cannot {} {}: {}",
-                        if follow { "dereference" } else { "access" },
-                        path.quote(),
-                        strip_errno(&e)
+                        if follow { "dereference" } else { "access" },
+                        path.quote(),
+                        strip_errno(&e)
                     ),
                 }
-                None
-            }
-            Ok(meta) => Some(meta),
+                None
+            }
+            Ok(meta) => Some(meta),
         }
     }
 
-    #[inline]
-    fn matched(&self, uid: uid_t, gid: gid_t) -> bool {
-        match self.filter {
-            IfFrom::All => true,
-            IfFrom::User(u) => u == uid,
-            IfFrom::Group(g) => g == gid,
-            IfFrom::UserGroup(u, g) => u == uid && g == gid,
+    #[inline]
+    fn matched(&self, uid: uid_t, gid: gid_t) -> bool {
+        match self.filter {
+            IfFrom::All => true,
+            IfFrom::User(u) => u == uid,
+            IfFrom::Group(g) => g == gid,
+            IfFrom::UserGroup(u, g) => u == uid && g == gid,
         }
     }
 }
 
-pub mod options {
-    pub const HELP: &str = "help";
-    pub mod verbosity {
-        pub const CHANGES: &str = "changes";
-        pub const QUIET: &str = "quiet";
-        pub const SILENT: &str = "silent";
-        pub const VERBOSE: &str = "verbose";
+pub mod options {
+    pub const HELP: &str = "help";
+    pub mod verbosity {
+        pub const CHANGES: &str = "changes";
+        pub const QUIET: &str = "quiet";
+        pub const SILENT: &str = "silent";
+        pub const VERBOSE: &str = "verbose";
     }
-    pub mod preserve_root {
-        pub const PRESERVE: &str = "preserve-root";
-        pub const NO_PRESERVE: &str = "no-preserve-root";
+    pub mod preserve_root {
+        pub const PRESERVE: &str = "preserve-root";
+        pub const NO_PRESERVE: &str = "no-preserve-root";
     }
-    pub mod dereference {
-        pub const DEREFERENCE: &str = "dereference";
-        pub const NO_DEREFERENCE: &str = "no-dereference";
+    pub mod dereference {
+        pub const DEREFERENCE: &str = "dereference";
+        pub const NO_DEREFERENCE: &str = "no-dereference";
     }
-    pub const FROM: &str = "from";
-    pub const RECURSIVE: &str = "recursive";
-    pub mod traverse {
-        pub const TRAVERSE: &str = "H";
-        pub const NO_TRAVERSE: &str = "P";
-        pub const EVERY: &str = "L";
+    pub const FROM: &str = "from";
+    pub const RECURSIVE: &str = "recursive";
+    pub mod traverse {
+        pub const TRAVERSE: &str = "H";
+        pub const NO_TRAVERSE: &str = "P";
+        pub const EVERY: &str = "L";
     }
-    pub const REFERENCE: &str = "reference";
-    pub const ARG_OWNER: &str = "OWNER";
-    pub const ARG_GROUP: &str = "GROUP";
-    pub const ARG_FILES: &str = "FILE";
+    pub const REFERENCE: &str = "reference";
+    pub const ARG_OWNER: &str = "OWNER";
+    pub const ARG_GROUP: &str = "GROUP";
+    pub const ARG_FILES: &str = "FILE";
 }
 
-type GidUidFilterParser = fn(&ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)>;
+type GidUidFilterParser = fn(&ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)>;
 
-/// Base implementation for `chgrp` and `chown`.
-///
-/// An argument called `add_arg_if_not_reference` will be added to `command` if
-/// `args` does not contain the `--reference` option.
-/// `parse_gid_uid_and_filter` will be called to obtain the target gid and uid, and the filter,
-/// from `ArgMatches`.
-/// `groups_only` determines whether verbose output will only mention the group.
-pub fn chown_base(
-    mut command: Command,
-    args: impl crate::Args,
-    add_arg_if_not_reference: &'static str,
-    parse_gid_uid_and_filter: GidUidFilterParser,
-    groups_only: bool,
-) -> UResult<()> {
-    let args: Vec<_> = args.collect();
-    let mut reference = false;
-    let mut help = false;
-    // stop processing options on --
-    for arg in args.iter().take_while(|s| *s != "--") {
-        if arg.to_string_lossy().starts_with("--reference=") || arg == "--reference" {
-            reference = true;
-        } else if arg == "--help" {
-            // we stop processing once we see --help,
-            // as it doesn't matter if we've seen reference or not
-            help = true;
+/// Base implementation for `chgrp` and `chown`.
+///
+/// An argument called `add_arg_if_not_reference` will be added to `command` if
+/// `args` does not contain the `--reference` option.
+/// `parse_gid_uid_and_filter` will be called to obtain the target gid and uid, and the filter,
+/// from `ArgMatches`.
+/// `groups_only` determines whether verbose output will only mention the group.
+pub fn chown_base(
+    mut command: Command,
+    args: impl crate::Args,
+    add_arg_if_not_reference: &'static str,
+    parse_gid_uid_and_filter: GidUidFilterParser,
+    groups_only: bool,
+) -> UResult<()> {
+    let args: Vec<_> = args.collect();
+    let mut reference = false;
+    let mut help = false;
+    // stop processing options on --
+    for arg in args.iter().take_while(|s| *s != "--") {
+        if arg.to_string_lossy().starts_with("--reference=") || arg == "--reference" {
+            reference = true;
+        } else if arg == "--help" {
+            // we stop processing once we see --help,
+            // as it doesn't matter if we've seen reference or not
+            help = true;
             break;
         }
     }
 
-    if help || !reference {
-        // add both positional arguments
-        // arg_group is only required if
-        command = command.arg(
-            Arg::new(add_arg_if_not_reference)
-                .value_name(add_arg_if_not_reference)
-                .required(true),
+    if help || !reference {
+        // add both positional arguments
+        // arg_group is only required if
+        command = command.arg(
+            Arg::new(add_arg_if_not_reference)
+                .value_name(add_arg_if_not_reference)
+                .required(true),
         );
     }
-    command = command.arg(
-        Arg::new(options::ARG_FILES)
-            .value_name(options::ARG_FILES)
-            .value_hint(clap::ValueHint::FilePath)
-            .action(clap::ArgAction::Append)
-            .required(true)
-            .num_args(1..),
+    command = command.arg(
+        Arg::new(options::ARG_FILES)
+            .value_name(options::ARG_FILES)
+            .value_hint(clap::ValueHint::FilePath)
+            .action(clap::ArgAction::Append)
+            .required(true)
+            .num_args(1..),
     );
-    let matches = command.try_get_matches_from(args)?;
+    let matches = command.try_get_matches_from(args)?;
 
-    let files: Vec<String> = matches
-        .get_many::<String>(options::ARG_FILES)
-        .map(|v| v.map(ToString::to_string).collect())
-        .unwrap_or_default();
+    let files: Vec<String> = matches
+        .get_many::<String>(options::ARG_FILES)
+        .map(|v| v.map(ToString::to_string).collect())
+        .unwrap_or_default();
 
-    let preserve_root = matches.get_flag(options::preserve_root::PRESERVE);
+    let preserve_root = matches.get_flag(options::preserve_root::PRESERVE);
 
-    let mut dereference = if matches.get_flag(options::dereference::DEREFERENCE) {
+    let mut dereference = if matches.get_flag(options::dereference::DEREFERENCE) {
         Some(true)
-    } else if matches.get_flag(options::dereference::NO_DEREFERENCE) {
+    } else if matches.get_flag(options::dereference::NO_DEREFERENCE) {
         Some(false)
-    } else {
-        None
+    } else {
+        None
+    };
+
+    let mut traverse_symlinks = if matches.get_flag(options::traverse::TRAVERSE) {
+        TraverseSymlinks::First
+    } else if matches.get_flag(options::traverse::EVERY) {
+        TraverseSymlinks::All
+    } else {
+        TraverseSymlinks::None
     };
 
-    let mut traverse_symlinks = if matches.get_flag(options::traverse::TRAVERSE) {
-        TraverseSymlinks::First
-    } else if matches.get_flag(options::traverse::EVERY) {
-        TraverseSymlinks::All
-    } else {
-        TraverseSymlinks::None
-    };
-
-    let recursive = matches.get_flag(options::RECURSIVE);
-    if recursive {
-        if traverse_symlinks == TraverseSymlinks::None {
-            if dereference == Some(true) {
-                return Err(USimpleError::new(1, "-R --dereference requires -H or -L"));
+    let recursive = matches.get_flag(options::RECURSIVE);
+    if recursive {
+        if traverse_symlinks == TraverseSymlinks::None {
+            if dereference == Some(true) {
+                return Err(USimpleError::new(1, "-R --dereference requires -H or -L"));
             }
-            dereference = Some(false);
+            dereference = Some(false);
         }
-    } else {
-        traverse_symlinks = TraverseSymlinks::None;
+    } else {
+        traverse_symlinks = TraverseSymlinks::None;
     }
 
-    let verbosity_level = if matches.get_flag(options::verbosity::CHANGES) {
-        VerbosityLevel::Changes
-    } else if matches.get_flag(options::verbosity::SILENT)
-        || matches.get_flag(options::verbosity::QUIET)
+    let verbosity_level = if matches.get_flag(options::verbosity::CHANGES) {
+        VerbosityLevel::Changes
+    } else if matches.get_flag(options::verbosity::SILENT)
+        || matches.get_flag(options::verbosity::QUIET)
     {
-        VerbosityLevel::Silent
-    } else if matches.get_flag(options::verbosity::VERBOSE) {
-        VerbosityLevel::Verbose
-    } else {
-        VerbosityLevel::Normal
+        VerbosityLevel::Silent
+    } else if matches.get_flag(options::verbosity::VERBOSE) {
+        VerbosityLevel::Verbose
+    } else {
+        VerbosityLevel::Normal
     };
-    let (dest_gid, dest_uid, filter) = parse_gid_uid_and_filter(&matches)?;
+    let (dest_gid, dest_uid, filter) = parse_gid_uid_and_filter(&matches)?;
 
-    let executor = ChownExecutor {
-        traverse_symlinks,
-        dest_gid,
-        dest_uid,
-        verbosity: Verbosity {
-            groups_only,
-            level: verbosity_level,
+    let executor = ChownExecutor {
+        traverse_symlinks,
+        dest_gid,
+        dest_uid,
+        verbosity: Verbosity {
+            groups_only,
+            level: verbosity_level,
         },
-        recursive,
-        dereference: dereference.unwrap_or(true),
-        preserve_root,
-        files,
-        filter,
+        recursive,
+        dereference: dereference.unwrap_or(true),
+        preserve_root,
+        files,
+        filter,
     };
-    executor.exec()
+    executor.exec()
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/pipes.rs.html b/dev/src/uucore/features/pipes.rs.html index 5040c480d..5b09a43d3 100644 --- a/dev/src/uucore/features/pipes.rs.html +++ b/dev/src/uucore/features/pipes.rs.html @@ -1,4 +1,4 @@ -pipes.rs - source
1
+pipes.rs - source
1
 2
 3
 4
@@ -69,76 +69,76 @@
 69
 70
 71
-
/// Thin pipe-related wrappers around functions from the `nix` crate.
-use std::fs::File;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use std::io::IoSlice;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use std::os::unix::io::AsRawFd;
-use std::os::unix::io::FromRawFd;
+
/// Thin pipe-related wrappers around functions from the `nix` crate.
+use std::fs::File;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use std::io::IoSlice;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use std::os::unix::io::AsRawFd;
+use std::os::unix::io::FromRawFd;
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-use nix::fcntl::SpliceFFlags;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use nix::fcntl::SpliceFFlags;
 
-pub use nix::{Error, Result};
+pub use nix::{Error, Result};
 
-/// A wrapper around [`nix::unistd::pipe`] that ensures the pipe is cleaned up.
-///
-/// Returns two `File` objects: everything written to the second can be read
-/// from the first.
-pub fn pipe() -> Result<(File, File)> {
-    let (read, write) = nix::unistd::pipe()?;
-    // SAFETY: The file descriptors do not have other owners.
-    unsafe { Ok((File::from_raw_fd(read), File::from_raw_fd(write))) }
+/// A wrapper around [`nix::unistd::pipe`] that ensures the pipe is cleaned up.
+///
+/// Returns two `File` objects: everything written to the second can be read
+/// from the first.
+pub fn pipe() -> Result<(File, File)> {
+    let (read, write) = nix::unistd::pipe()?;
+    // SAFETY: The file descriptors do not have other owners.
+    unsafe { Ok((File::from_raw_fd(read), File::from_raw_fd(write))) }
 }
 
-/// Less noisy wrapper around [`nix::fcntl::splice`].
-///
-/// Up to `len` bytes are moved from `source` to `target`. Returns the number
-/// of successfully moved bytes.
-///
-/// At least one of `source` and `target` must be some sort of pipe.
-/// To get around this requirement, consider splicing from your source into
-/// a [`pipe`] and then from the pipe into your target (with `splice_exact`):
-/// this is still very efficient.
-#[cfg(any(target_os = "linux", target_os = "android"))]
-pub fn splice(source: &impl AsRawFd, target: &impl AsRawFd, len: usize) -> Result<usize> {
-    nix::fcntl::splice(
-        source.as_raw_fd(),
+/// Less noisy wrapper around [`nix::fcntl::splice`].
+///
+/// Up to `len` bytes are moved from `source` to `target`. Returns the number
+/// of successfully moved bytes.
+///
+/// At least one of `source` and `target` must be some sort of pipe.
+/// To get around this requirement, consider splicing from your source into
+/// a [`pipe`] and then from the pipe into your target (with `splice_exact`):
+/// this is still very efficient.
+#[cfg(any(target_os = "linux", target_os = "android"))]
+pub fn splice(source: &impl AsRawFd, target: &impl AsRawFd, len: usize) -> Result<usize> {
+    nix::fcntl::splice(
+        source.as_raw_fd(),
         None,
-        target.as_raw_fd(),
+        target.as_raw_fd(),
         None,
-        len,
-        SpliceFFlags::empty(),
+        len,
+        SpliceFFlags::empty(),
     )
 }
 
-/// Splice wrapper which fully finishes the write.
-///
-/// Exactly `len` bytes are moved from `source` into `target`.
-///
-/// Panics if `source` runs out of data before `len` bytes have been moved.
-#[cfg(any(target_os = "linux", target_os = "android"))]
-pub fn splice_exact(source: &impl AsRawFd, target: &impl AsRawFd, len: usize) -> Result<()> {
-    let mut left = len;
-    while left != 0 {
-        let written = splice(source, target, left)?;
-        assert_ne!(written, 0, "unexpected end of data");
-        left -= written;
+/// Splice wrapper which fully finishes the write.
+///
+/// Exactly `len` bytes are moved from `source` into `target`.
+///
+/// Panics if `source` runs out of data before `len` bytes have been moved.
+#[cfg(any(target_os = "linux", target_os = "android"))]
+pub fn splice_exact(source: &impl AsRawFd, target: &impl AsRawFd, len: usize) -> Result<()> {
+    let mut left = len;
+    while left != 0 {
+        let written = splice(source, target, left)?;
+        assert_ne!(written, 0, "unexpected end of data");
+        left -= written;
     }
     Ok(())
 }
 
-/// Copy data from `bytes` into `target`, which must be a pipe.
-///
-/// Returns the number of successfully copied bytes.
-#[cfg(any(target_os = "linux", target_os = "android"))]
-pub fn vmsplice(target: &impl AsRawFd, bytes: &[u8]) -> Result<usize> {
-    nix::fcntl::vmsplice(
-        target.as_raw_fd(),
-        &[IoSlice::new(bytes)],
-        SpliceFFlags::empty(),
+/// Copy data from `bytes` into `target`, which must be a pipe.
+///
+/// Returns the number of successfully copied bytes.
+#[cfg(any(target_os = "linux", target_os = "android"))]
+pub fn vmsplice(target: &impl AsRawFd, bytes: &[u8]) -> Result<usize> {
+    nix::fcntl::vmsplice(
+        target.as_raw_fd(),
+        &[IoSlice::new(bytes)],
+        SpliceFFlags::empty(),
     )
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/process.rs.html b/dev/src/uucore/features/process.rs.html index edd46a526..cd4e2bd46 100644 --- a/dev/src/uucore/features/process.rs.html +++ b/dev/src/uucore/features/process.rs.html @@ -1,4 +1,4 @@ -process.rs - source
1
+process.rs - source
1
 2
 3
 4
@@ -145,152 +145,152 @@
 145
 146
 147
-
// This file is part of the uutils coreutils package.
-//
-// (c) Maciej Dziardziel <fiedzia@gmail.com>
-// (c) Jian Zeng <anonymousknight96 AT gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Maciej Dziardziel <fiedzia@gmail.com>
+// (c) Jian Zeng <anonymousknight96 AT gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-// spell-checker:ignore (vars) cvar exitstatus
-// spell-checker:ignore (sys/unix) WIFSIGNALED
+// spell-checker:ignore (vars) cvar exitstatus
+// spell-checker:ignore (sys/unix) WIFSIGNALED
 
-//! Set of functions to manage IDs
+//! Set of functions to manage IDs
 
-use libc::{gid_t, pid_t, uid_t};
-use std::fmt;
-use std::io;
-use std::process::Child;
-use std::process::ExitStatus as StdExitStatus;
-use std::thread;
-use std::time::{Duration, Instant};
+use libc::{gid_t, pid_t, uid_t};
+use std::fmt;
+use std::io;
+use std::process::Child;
+use std::process::ExitStatus as StdExitStatus;
+use std::thread;
+use std::time::{Duration, Instant};
 
-// SAFETY: These functions always succeed and return simple integers.
+// SAFETY: These functions always succeed and return simple integers.
 
-/// `geteuid()` returns the effective user ID of the calling process.
-pub fn geteuid() -> uid_t {
-    unsafe { libc::geteuid() }
+/// `geteuid()` returns the effective user ID of the calling process.
+pub fn geteuid() -> uid_t {
+    unsafe { libc::geteuid() }
 }
 
-/// `getegid()` returns the effective group ID of the calling process.
-pub fn getegid() -> gid_t {
-    unsafe { libc::getegid() }
+/// `getegid()` returns the effective group ID of the calling process.
+pub fn getegid() -> gid_t {
+    unsafe { libc::getegid() }
 }
 
-/// `getgid()` returns the real group ID of the calling process.
-pub fn getgid() -> gid_t {
-    unsafe { libc::getgid() }
+/// `getgid()` returns the real group ID of the calling process.
+pub fn getgid() -> gid_t {
+    unsafe { libc::getgid() }
 }
 
-/// `getuid()` returns the real user ID of the calling process.
-pub fn getuid() -> uid_t {
-    unsafe { libc::getuid() }
+/// `getuid()` returns the real user ID of the calling process.
+pub fn getuid() -> uid_t {
+    unsafe { libc::getuid() }
 }
 
-// This is basically sys::unix::process::ExitStatus
-#[derive(PartialEq, Eq, Clone, Copy, Debug)]
-pub enum ExitStatus {
-    Code(i32),
-    Signal(i32),
+// This is basically sys::unix::process::ExitStatus
+#[derive(PartialEq, Eq, Clone, Copy, Debug)]
+pub enum ExitStatus {
+    Code(i32),
+    Signal(i32),
 }
 
-#[allow(clippy::trivially_copy_pass_by_ref)]
-impl ExitStatus {
-    fn from_std_status(status: StdExitStatus) -> Self {
-        #[cfg(unix)]
-        {
-            use std::os::unix::process::ExitStatusExt;
+#[allow(clippy::trivially_copy_pass_by_ref)]
+impl ExitStatus {
+    fn from_std_status(status: StdExitStatus) -> Self {
+        #[cfg(unix)]
+        {
+            use std::os::unix::process::ExitStatusExt;
 
-            if let Some(signal) = status.signal() {
-                return Self::Signal(signal);
+            if let Some(signal) = status.signal() {
+                return Self::Signal(signal);
             }
         }
 
-        // NOTE: this should never fail as we check if the program exited through a signal above
-        Self::Code(status.code().unwrap())
+        // NOTE: this should never fail as we check if the program exited through a signal above
+        Self::Code(status.code().unwrap())
     }
 
-    pub fn success(&self) -> bool {
-        match *self {
-            Self::Code(code) => code == 0,
-            _ => false,
+    pub fn success(&self) -> bool {
+        match *self {
+            Self::Code(code) => code == 0,
+            _ => false,
         }
     }
 
-    pub fn code(&self) -> Option<i32> {
-        match *self {
-            Self::Code(code) => Some(code),
-            _ => None,
+    pub fn code(&self) -> Option<i32> {
+        match *self {
+            Self::Code(code) => Some(code),
+            _ => None,
         }
     }
 
-    pub fn signal(&self) -> Option<i32> {
-        match *self {
-            Self::Signal(code) => Some(code),
-            _ => None,
+    pub fn signal(&self) -> Option<i32> {
+        match *self {
+            Self::Signal(code) => Some(code),
+            _ => None,
         }
     }
 }
 
-impl fmt::Display for ExitStatus {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        match *self {
-            Self::Code(code) => write!(f, "exit code: {}", code),
-            Self::Signal(code) => write!(f, "exit code: {}", code),
+impl fmt::Display for ExitStatus {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match *self {
+            Self::Code(code) => write!(f, "exit code: {}", code),
+            Self::Signal(code) => write!(f, "exit code: {}", code),
         }
     }
 }
 
-/// Missing methods for Child objects
-pub trait ChildExt {
-    /// Send a signal to a Child process.
-    ///
-    /// Caller beware: if the process already exited then you may accidentally
-    /// send the signal to an unrelated process that recycled the PID.
-    fn send_signal(&mut self, signal: usize) -> io::Result<()>;
+/// Missing methods for Child objects
+pub trait ChildExt {
+    /// Send a signal to a Child process.
+    ///
+    /// Caller beware: if the process already exited then you may accidentally
+    /// send the signal to an unrelated process that recycled the PID.
+    fn send_signal(&mut self, signal: usize) -> io::Result<()>;
 
-    /// Wait for a process to finish or return after the specified duration.
-    /// A `timeout` of zero disables the timeout.
-    fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result<Option<ExitStatus>>;
+    /// Wait for a process to finish or return after the specified duration.
+    /// A `timeout` of zero disables the timeout.
+    fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result<Option<ExitStatus>>;
 }
 
-impl ChildExt for Child {
-    fn send_signal(&mut self, signal: usize) -> io::Result<()> {
-        if unsafe { libc::kill(self.id() as pid_t, signal as i32) } != 0 {
-            Err(io::Error::last_os_error())
-        } else {
+impl ChildExt for Child {
+    fn send_signal(&mut self, signal: usize) -> io::Result<()> {
+        if unsafe { libc::kill(self.id() as pid_t, signal as i32) } != 0 {
+            Err(io::Error::last_os_error())
+        } else {
             Ok(())
         }
     }
 
-    fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result<Option<ExitStatus>> {
-        if timeout == Duration::from_micros(0) {
-            return self
-                .wait()
-                .map(|status| Some(ExitStatus::from_std_status(status)));
+    fn wait_or_timeout(&mut self, timeout: Duration) -> io::Result<Option<ExitStatus>> {
+        if timeout == Duration::from_micros(0) {
+            return self
+                .wait()
+                .map(|status| Some(ExitStatus::from_std_status(status)));
         }
-        // .try_wait() doesn't drop stdin, so we do it manually
-        drop(self.stdin.take());
+        // .try_wait() doesn't drop stdin, so we do it manually
+        drop(self.stdin.take());
 
-        let start = Instant::now();
-        loop {
-            if let Some(status) = self.try_wait()? {
-                return Ok(Some(ExitStatus::from_std_status(status)));
+        let start = Instant::now();
+        loop {
+            if let Some(status) = self.try_wait()? {
+                return Ok(Some(ExitStatus::from_std_status(status)));
             }
 
-            if start.elapsed() >= timeout {
+            if start.elapsed() >= timeout {
                 break;
             }
 
-            // XXX: this is kinda gross, but it's cleaner than starting a thread just to wait
-            //      (which was the previous solution).  We might want to use a different duration
-            //      here as well
-            thread::sleep(Duration::from_millis(100));
+            // XXX: this is kinda gross, but it's cleaner than starting a thread just to wait
+            //      (which was the previous solution).  We might want to use a different duration
+            //      here as well
+            thread::sleep(Duration::from_millis(100));
         }
 
         Ok(None)
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/ringbuffer.rs.html b/dev/src/uucore/features/ringbuffer.rs.html index 22635ce7e..d1494026e 100644 --- a/dev/src/uucore/features/ringbuffer.rs.html +++ b/dev/src/uucore/features/ringbuffer.rs.html @@ -1,4 +1,4 @@ -ringbuffer.rs - source
1
+ringbuffer.rs - source
1
 2
 3
 4
@@ -134,141 +134,141 @@
 134
 135
 136
-
//! A fixed-size ring buffer.
-use std::collections::VecDeque;
+
//! A fixed-size ring buffer.
+use std::collections::VecDeque;
 
-/// A fixed-size ring buffer backed by a `VecDeque`.
-///
-/// If the ring buffer is not full, then calling the [`push_back`]
-/// method appends elements, as in a [`VecDeque`]. If the ring buffer
-/// is full, then calling [`push_back`] removes the element at the
-/// front of the buffer (in a first-in, first-out manner) before
-/// appending the new element to the back of the buffer.
-///
-/// Use [`from_iter`] to take the last `size` elements from an
-/// iterator.
-///
-/// # Examples
-///
-/// After exceeding the size limit, the oldest elements are dropped in
-/// favor of the newest element:
-///
-/// ```rust,ignore
-/// let mut buffer: RingBuffer<u8> = RingBuffer::new(2);
-/// buffer.push_back(0);
-/// buffer.push_back(1);
-/// buffer.push_back(2);
-/// assert_eq!(vec![1, 2], buffer.data);
-/// ```
-///
-/// Take the last `n` elements from an iterator:
-///
-/// ```rust,ignore
-/// let iter = [0, 1, 2].iter();
-/// let actual = RingBuffer::from_iter(iter, 2).data;
-/// let expected = VecDeque::from_iter([1, 2].iter());
-/// assert_eq!(expected, actual);
-/// ```
-///
-/// [`push_back`]: struct.RingBuffer.html#method.push_back
-/// [`from_iter`]: struct.RingBuffer.html#method.from_iter
-pub struct RingBuffer<T> {
-    pub data: VecDeque<T>,
-    size: usize,
+/// A fixed-size ring buffer backed by a `VecDeque`.
+///
+/// If the ring buffer is not full, then calling the [`push_back`]
+/// method appends elements, as in a [`VecDeque`]. If the ring buffer
+/// is full, then calling [`push_back`] removes the element at the
+/// front of the buffer (in a first-in, first-out manner) before
+/// appending the new element to the back of the buffer.
+///
+/// Use [`from_iter`] to take the last `size` elements from an
+/// iterator.
+///
+/// # Examples
+///
+/// After exceeding the size limit, the oldest elements are dropped in
+/// favor of the newest element:
+///
+/// ```rust,ignore
+/// let mut buffer: RingBuffer<u8> = RingBuffer::new(2);
+/// buffer.push_back(0);
+/// buffer.push_back(1);
+/// buffer.push_back(2);
+/// assert_eq!(vec![1, 2], buffer.data);
+/// ```
+///
+/// Take the last `n` elements from an iterator:
+///
+/// ```rust,ignore
+/// let iter = [0, 1, 2].iter();
+/// let actual = RingBuffer::from_iter(iter, 2).data;
+/// let expected = VecDeque::from_iter([1, 2].iter());
+/// assert_eq!(expected, actual);
+/// ```
+///
+/// [`push_back`]: struct.RingBuffer.html#method.push_back
+/// [`from_iter`]: struct.RingBuffer.html#method.from_iter
+pub struct RingBuffer<T> {
+    pub data: VecDeque<T>,
+    size: usize,
 }
 
-impl<T> RingBuffer<T> {
-    pub fn new(size: usize) -> Self {
-        Self {
-            data: VecDeque::new(),
-            size,
+impl<T> RingBuffer<T> {
+    pub fn new(size: usize) -> Self {
+        Self {
+            data: VecDeque::new(),
+            size,
         }
     }
 
-    pub fn from_iter(iter: impl Iterator<Item = T>, size: usize) -> Self {
-        let mut ring_buffer = Self::new(size);
-        for value in iter {
-            ring_buffer.push_back(value);
+    pub fn from_iter(iter: impl Iterator<Item = T>, size: usize) -> Self {
+        let mut ring_buffer = Self::new(size);
+        for value in iter {
+            ring_buffer.push_back(value);
         }
-        ring_buffer
+        ring_buffer
     }
 
-    /// Append a value to the end of the ring buffer.
-    ///
-    /// If the ring buffer is not full, this method return [`None`]. If
-    /// the ring buffer is full, appending a new element will cause the
-    /// oldest element to be evicted. In that case this method returns
-    /// that element, or `None`.
-    ///
-    /// In the special case where the size limit is zero, each call to
-    /// this method with input `value` returns `Some(value)`, because
-    /// the input is immediately evicted.
-    ///
-    /// # Examples
-    ///
-    /// Appending an element when the buffer is full returns the oldest
-    /// element:
-    ///
-    /// ```rust,ignore
-    /// let mut buf = RingBuffer::new(3);
-    /// assert_eq!(None, buf.push_back(0));
-    /// assert_eq!(None, buf.push_back(1));
-    /// assert_eq!(None, buf.push_back(2));
-    /// assert_eq!(Some(0), buf.push_back(3));
-    /// ```
-    ///
-    /// If the size limit is zero, then this method always returns the
-    /// input value:
-    ///
-    /// ```rust,ignore
-    /// let mut buf = RingBuffer::new(0);
-    /// assert_eq!(Some(0), buf.push_back(0));
-    /// assert_eq!(Some(1), buf.push_back(1));
-    /// assert_eq!(Some(2), buf.push_back(2));
-    /// ```
-    pub fn push_back(&mut self, value: T) -> Option<T> {
-        if self.size == 0 {
-            return Some(value);
+    /// Append a value to the end of the ring buffer.
+    ///
+    /// If the ring buffer is not full, this method return [`None`]. If
+    /// the ring buffer is full, appending a new element will cause the
+    /// oldest element to be evicted. In that case this method returns
+    /// that element, or `None`.
+    ///
+    /// In the special case where the size limit is zero, each call to
+    /// this method with input `value` returns `Some(value)`, because
+    /// the input is immediately evicted.
+    ///
+    /// # Examples
+    ///
+    /// Appending an element when the buffer is full returns the oldest
+    /// element:
+    ///
+    /// ```rust,ignore
+    /// let mut buf = RingBuffer::new(3);
+    /// assert_eq!(None, buf.push_back(0));
+    /// assert_eq!(None, buf.push_back(1));
+    /// assert_eq!(None, buf.push_back(2));
+    /// assert_eq!(Some(0), buf.push_back(3));
+    /// ```
+    ///
+    /// If the size limit is zero, then this method always returns the
+    /// input value:
+    ///
+    /// ```rust,ignore
+    /// let mut buf = RingBuffer::new(0);
+    /// assert_eq!(Some(0), buf.push_back(0));
+    /// assert_eq!(Some(1), buf.push_back(1));
+    /// assert_eq!(Some(2), buf.push_back(2));
+    /// ```
+    pub fn push_back(&mut self, value: T) -> Option<T> {
+        if self.size == 0 {
+            return Some(value);
         }
-        let result = if self.size <= self.data.len() {
-            self.data.pop_front()
-        } else {
-            None
-        };
-        self.data.push_back(value);
-        result
+        let result = if self.size <= self.data.len() {
+            self.data.pop_front()
+        } else {
+            None
+        };
+        self.data.push_back(value);
+        result
     }
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use crate::ringbuffer::RingBuffer;
-    use std::collections::VecDeque;
+    use crate::ringbuffer::RingBuffer;
+    use std::collections::VecDeque;
 
-    #[test]
-    fn test_size_limit_zero() {
-        let mut buf = RingBuffer::new(0);
-        assert_eq!(Some(0), buf.push_back(0));
-        assert_eq!(Some(1), buf.push_back(1));
-        assert_eq!(Some(2), buf.push_back(2));
+    #[test]
+    fn test_size_limit_zero() {
+        let mut buf = RingBuffer::new(0);
+        assert_eq!(Some(0), buf.push_back(0));
+        assert_eq!(Some(1), buf.push_back(1));
+        assert_eq!(Some(2), buf.push_back(2));
     }
 
-    #[test]
-    fn test_evict_oldest() {
-        let mut buf = RingBuffer::new(2);
-        assert_eq!(None, buf.push_back(0));
-        assert_eq!(None, buf.push_back(1));
-        assert_eq!(Some(0), buf.push_back(2));
+    #[test]
+    fn test_evict_oldest() {
+        let mut buf = RingBuffer::new(2);
+        assert_eq!(None, buf.push_back(0));
+        assert_eq!(None, buf.push_back(1));
+        assert_eq!(Some(0), buf.push_back(2));
     }
 
-    #[test]
-    fn test_from_iter() {
-        let iter = [0, 1, 2].iter();
-        let actual = RingBuffer::from_iter(iter, 2).data;
-        let expected: VecDeque<&i32> = [1, 2].iter().collect();
-        assert_eq!(expected, actual);
+    #[test]
+    fn test_from_iter() {
+        let iter = [0, 1, 2].iter();
+        let actual = RingBuffer::from_iter(iter, 2).data;
+        let expected: VecDeque<&i32> = [1, 2].iter().collect();
+        assert_eq!(expected, actual);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/signals.rs.html b/dev/src/uucore/features/signals.rs.html index 477af5e9d..e8a3cf5f2 100644 --- a/dev/src/uucore/features/signals.rs.html +++ b/dev/src/uucore/features/signals.rs.html @@ -1,4 +1,4 @@ -signals.rs - source
1
+signals.rs - source
1
 2
 3
 4
@@ -227,17 +227,17 @@
 227
 228
 229
-
// This file is part of the uutils coreutils package.
-//
-// (c) Maciej Dziardziel <fiedzia@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE file
-// that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Maciej Dziardziel <fiedzia@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE file
+// that was distributed with this source code.
 
-// spell-checker:ignore (vars/api) fcntl setrlimit setitimer
-// spell-checker:ignore (vars/signals) ABRT ALRM CHLD SEGV SIGABRT SIGALRM SIGBUS SIGCHLD SIGCONT SIGEMT SIGFPE SIGHUP SIGILL SIGINFO SIGINT SIGIO SIGIOT SIGKILL SIGPIPE SIGPROF SIGPWR SIGQUIT SIGSEGV SIGSTOP SIGSYS SIGTERM SIGTRAP SIGTSTP SIGTHR SIGTTIN SIGTTOU SIGURG SIGUSR SIGVTALRM SIGWINCH SIGXCPU SIGXFSZ STKFLT PWR THR TSTP TTIN TTOU VTALRM XCPU XFSZ
+// spell-checker:ignore (vars/api) fcntl setrlimit setitimer
+// spell-checker:ignore (vars/signals) ABRT ALRM CHLD SEGV SIGABRT SIGALRM SIGBUS SIGCHLD SIGCONT SIGEMT SIGFPE SIGHUP SIGILL SIGINFO SIGINT SIGIO SIGIOT SIGKILL SIGPIPE SIGPROF SIGPWR SIGQUIT SIGSEGV SIGSTOP SIGSYS SIGTERM SIGTRAP SIGTSTP SIGTHR SIGTTIN SIGTTOU SIGURG SIGUSR SIGVTALRM SIGWINCH SIGXCPU SIGXFSZ STKFLT PWR THR TSTP TTIN TTOU VTALRM XCPU XFSZ
 
-pub static DEFAULT_SIGNAL: usize = 15;
+pub static DEFAULT_SIGNAL: usize = 15;
 
 /*
 
@@ -250,10 +250,10 @@ Linux Programmer's Manual
 29 POLL    30 PWR     31 SYS
 
 
-*/
+*/
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-pub static ALL_SIGNALS: [&str; 32] = [
+#[cfg(any(target_os = "linux", target_os = "android"))]
+pub static ALL_SIGNALS: [&str; 32] = [
     "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "BUS", "FPE", "KILL", "USR1", "SEGV",
     "USR2", "PIPE", "ALRM", "TERM", "STKFLT", "CHLD", "CONT", "STOP", "TSTP", "TTIN", "TTOU",
     "URG", "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "POLL", "PWR", "SYS",
@@ -298,10 +298,10 @@ No    Name         Default Action       Description
 30    SIGUSR1      terminate process    User defined signal 1
 31    SIGUSR2      terminate process    User defined signal 2
 
-*/
+*/
 
-#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
-pub static ALL_SIGNALS: [&str; 32] = [
+#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
+pub static ALL_SIGNALS: [&str; 32] = [
     "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV",
     "SYS", "PIPE", "ALRM", "TERM", "URG", "STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "IO",
     "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2",
@@ -343,10 +343,10 @@ No    Name         Default Action       Description
      SIGUSR1          30    User defined signal 1
      SIGUSR2          31    User defined signal 2
      SIGPWR           32    Power fail/restart
-*/
+*/
 
-#[cfg(target_os = "netbsd")]
-pub static ALL_SIGNALS: [&str; 33] = [
+#[cfg(target_os = "netbsd")]
+pub static ALL_SIGNALS: [&str; 33] = [
     "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV",
     "SYS", "PIPE", "ALRM", "TERM", "URG", "STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "IO",
     "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2", "PWR",
@@ -395,66 +395,66 @@ No    Name         Default Action       Description
      SIGUSR1      terminate process    user-defined signal 1
      SIGUSR2      terminate process    user-defined signal 2
      SIGTHR       discard signal       thread AST
-*/
+*/
 
-#[cfg(target_os = "openbsd")]
-pub static ALL_SIGNALS: [&str; 33] = [
+#[cfg(target_os = "openbsd")]
+pub static ALL_SIGNALS: [&str; 33] = [
     "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE", "KILL", "BUS", "SEGV",
     "SYS", "PIPE", "ALRM", "TERM", "URG", "STOP", "TSTP", "CONT", "CHLD", "TTIN", "TTOU", "IO",
     "XCPU", "XFSZ", "VTALRM", "PROF", "WINCH", "INFO", "USR1", "USR2", "THR",
 ];
 
-pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option<usize> {
-    if let Ok(value) = signal_name_or_value.parse() {
-        if is_signal(value) {
-            return Some(value);
-        } else {
-            return None;
+pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option<usize> {
+    if let Ok(value) = signal_name_or_value.parse() {
+        if is_signal(value) {
+            return Some(value);
+        } else {
+            return None;
         }
     }
-    let signal_name = signal_name_or_value.trim_start_matches("SIG");
+    let signal_name = signal_name_or_value.trim_start_matches("SIG");
 
-    ALL_SIGNALS.iter().position(|&s| s == signal_name)
+    ALL_SIGNALS.iter().position(|&s| s == signal_name)
 }
 
-pub fn is_signal(num: usize) -> bool {
-    num < ALL_SIGNALS.len()
+pub fn is_signal(num: usize) -> bool {
+    num < ALL_SIGNALS.len()
 }
 
-pub fn signal_name_by_value(signal_value: usize) -> Option<&'static str> {
-    ALL_SIGNALS.get(signal_value).copied()
+pub fn signal_name_by_value(signal_value: usize) -> Option<&'static str> {
+    ALL_SIGNALS.get(signal_value).copied()
 }
 
-#[test]
-fn signal_by_value() {
-    assert_eq!(signal_by_name_or_value("0"), Some(0));
-    for (value, _signal) in ALL_SIGNALS.iter().enumerate() {
-        assert_eq!(signal_by_name_or_value(&value.to_string()), Some(value));
+#[test]
+fn signal_by_value() {
+    assert_eq!(signal_by_name_or_value("0"), Some(0));
+    for (value, _signal) in ALL_SIGNALS.iter().enumerate() {
+        assert_eq!(signal_by_name_or_value(&value.to_string()), Some(value));
     }
 }
 
-#[test]
-fn signal_by_short_name() {
-    for (value, signal) in ALL_SIGNALS.iter().enumerate() {
-        assert_eq!(signal_by_name_or_value(signal), Some(value));
+#[test]
+fn signal_by_short_name() {
+    for (value, signal) in ALL_SIGNALS.iter().enumerate() {
+        assert_eq!(signal_by_name_or_value(signal), Some(value));
     }
 }
 
-#[test]
-fn signal_by_long_name() {
-    for (value, signal) in ALL_SIGNALS.iter().enumerate() {
+#[test]
+fn signal_by_long_name() {
+    for (value, signal) in ALL_SIGNALS.iter().enumerate() {
         assert_eq!(
-            signal_by_name_or_value(&format!("SIG{}", signal)),
-            Some(value)
+            signal_by_name_or_value(&format!("SIG{}", signal)),
+            Some(value)
         );
     }
 }
 
-#[test]
-fn name() {
-    for (value, signal) in ALL_SIGNALS.iter().enumerate() {
-        assert_eq!(signal_name_by_value(value), Some(*signal));
+#[test]
+fn name() {
+    for (value, signal) in ALL_SIGNALS.iter().enumerate() {
+        assert_eq!(signal_name_by_value(value), Some(*signal));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/mod.rs.html b/dev/src/uucore/features/tokenize/mod.rs.html index a714400ad..699d1310d 100644 --- a/dev/src/uucore/features/tokenize/mod.rs.html +++ b/dev/src/uucore/features/tokenize/mod.rs.html @@ -1,12 +1,12 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
 5
-
#[allow(clippy::module_inception)]
-mod num_format;
-pub mod sub;
-pub mod token;
-pub mod unescaped_text;
+
#[allow(clippy::module_inception)]
+mod num_format;
+pub mod sub;
+pub mod token;
+pub mod unescaped_text;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/format_field.rs.html b/dev/src/uucore/features/tokenize/num_format/format_field.rs.html index 3f5e55935..3f41fb630 100644 --- a/dev/src/uucore/features/tokenize/num_format/format_field.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/format_field.rs.html @@ -1,4 +1,4 @@ -format_field.rs - source
1
+format_field.rs - source
1
 2
 3
 4
@@ -41,48 +41,48 @@
 41
 42
 43
-
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
+
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
 
-//! Primitives used by Sub Tokenizer
-//! and num_format modules
-#[derive(Clone)]
-pub enum FieldType {
-    Strf,
-    Floatf,
-    CninetyNineHexFloatf,
-    Scif,
-    Decf,
-    Intf,
-    Charf,
+//! Primitives used by Sub Tokenizer
+//! and num_format modules
+#[derive(Clone)]
+pub enum FieldType {
+    Strf,
+    Floatf,
+    CninetyNineHexFloatf,
+    Scif,
+    Decf,
+    Intf,
+    Charf,
 }
 
-// #[allow(non_camel_case_types)]
-// pub enum FChar {
-// d,
-// e,
-// E,
-// i,
-// f,
-// F,
-// g,
-// G,
-// u,
-// x,
-// X,
-// o
-// }
-//
+// #[allow(non_camel_case_types)]
+// pub enum FChar {
+// d,
+// e,
+// E,
+// i,
+// f,
+// F,
+// g,
+// G,
+// u,
+// x,
+// X,
+// o
+// }
+//
 
-// a Sub Tokens' fields are stored
-// as a single object so they can be more simply
-// passed by ref to num_format in a Sub method
-#[derive(Clone)]
-pub struct FormatField<'a> {
-    pub min_width: Option<isize>,
-    pub second_field: Option<u32>,
-    pub field_char: &'a char,
-    pub field_type: &'a FieldType,
-    pub orig: &'a String,
+// a Sub Tokens' fields are stored
+// as a single object so they can be more simply
+// passed by ref to num_format in a Sub method
+#[derive(Clone)]
+pub struct FormatField<'a> {
+    pub min_width: Option<isize>,
+    pub second_field: Option<u32>,
+    pub field_char: &'a char,
+    pub field_type: &'a FieldType,
+    pub orig: &'a String,
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatter.rs.html b/dev/src/uucore/features/tokenize/num_format/formatter.rs.html index 6f0620f86..0c0949e2d 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatter.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatter.rs.html @@ -1,4 +1,4 @@ -formatter.rs - source
1
+formatter.rs - source
1
 2
 3
 4
@@ -57,64 +57,64 @@
 57
 58
 59
-
//! Primitives used by num_format and sub_modules.
-//! never dealt with above (e.g. Sub Tokenizer never uses these)
+
//! Primitives used by num_format and sub_modules.
+//! never dealt with above (e.g. Sub Tokenizer never uses these)
 
-use crate::{display::Quotable, show_error};
-use itertools::{put_back_n, PutBackN};
-use std::str::Chars;
+use crate::{display::Quotable, show_error};
+use itertools::{put_back_n, PutBackN};
+use std::str::Chars;
 
-use super::format_field::FormatField;
+use super::format_field::FormatField;
 
-// contains the rough ingredients to final
-// output for a number, organized together
-// to allow for easy generalization of output manipulation
-// (e.g. max number of digits after decimal)
-#[derive(Default)]
-pub struct FormatPrimitive {
-    pub prefix: Option<String>,
-    pub pre_decimal: Option<String>,
-    pub post_decimal: Option<String>,
-    pub suffix: Option<String>,
+// contains the rough ingredients to final
+// output for a number, organized together
+// to allow for easy generalization of output manipulation
+// (e.g. max number of digits after decimal)
+#[derive(Default)]
+pub struct FormatPrimitive {
+    pub prefix: Option<String>,
+    pub pre_decimal: Option<String>,
+    pub post_decimal: Option<String>,
+    pub suffix: Option<String>,
 }
 
-#[derive(Clone, PartialEq, Eq)]
-pub enum Base {
-    Ten = 10,
-    Hex = 16,
-    Octal = 8,
+#[derive(Clone, PartialEq, Eq)]
+pub enum Base {
+    Ten = 10,
+    Hex = 16,
+    Octal = 8,
 }
 
-// information from the beginning of a numeric argument
-// the precedes the beginning of a numeric value
-pub struct InitialPrefix {
-    pub radix_in: Base,
-    pub sign: i8,
-    pub offset: usize,
+// information from the beginning of a numeric argument
+// the precedes the beginning of a numeric value
+pub struct InitialPrefix {
+    pub radix_in: Base,
+    pub sign: i8,
+    pub offset: usize,
 }
 
-pub trait Formatter {
-    //  return a FormatPrimitive for
-    // particular field char(s), given the argument
-    // string and prefix information (sign, radix)
-    fn get_primitive(
+pub trait Formatter {
+    //  return a FormatPrimitive for
+    // particular field char(s), given the argument
+    // string and prefix information (sign, radix)
+    fn get_primitive(
         &self,
-        field: &FormatField,
-        in_prefix: &InitialPrefix,
-        str_in: &str,
-    ) -> Option<FormatPrimitive>;
-    // return a string from a FormatPrimitive,
-    // given information about the field
-    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String;
+        field: &FormatField,
+        in_prefix: &InitialPrefix,
+        str_in: &str,
+    ) -> Option<FormatPrimitive>;
+    // return a string from a FormatPrimitive,
+    // given information about the field
+    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String;
 }
-pub fn get_it_at(offset: usize, str_in: &str) -> PutBackN<Chars> {
-    put_back_n(str_in[offset..].chars())
+pub fn get_it_at(offset: usize, str_in: &str) -> PutBackN<Chars> {
+    put_back_n(str_in[offset..].chars())
 }
 
-// TODO: put this somewhere better
-pub fn warn_incomplete_conv(pf_arg: &str) {
-    // important: keep println here not print
-    show_error!("{}: value not completely converted", pf_arg.maybe_quote());
+// TODO: put this somewhere better
+pub fn warn_incomplete_conv(pf_arg: &str) {
+    // important: keep println here not print
+    show_error!("{}: value not completely converted", pf_arg.maybe_quote());
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatters/base_conv/mod.rs.html b/dev/src/uucore/features/tokenize/num_format/formatters/base_conv/mod.rs.html index 7936a3d25..32c632a89 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatters/base_conv/mod.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatters/base_conv/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
@@ -268,275 +268,275 @@
 268
 269
 270
-
// spell-checker:ignore (ToDO) arrnum arr_num mult basenum bufferval refd vals arrfloat conv intermed addl
+
// spell-checker:ignore (ToDO) arrnum arr_num mult basenum bufferval refd vals arrfloat conv intermed addl
 
-pub fn arrnum_int_mult(arr_num: &[u8], basenum: u8, base_ten_int_fact: u8) -> Vec<u8> {
-    let mut carry: u16 = 0;
-    let mut rem: u16;
-    let mut new_amount: u16;
-    let fact: u16 = u16::from(base_ten_int_fact);
-    let base: u16 = u16::from(basenum);
+pub fn arrnum_int_mult(arr_num: &[u8], basenum: u8, base_ten_int_fact: u8) -> Vec<u8> {
+    let mut carry: u16 = 0;
+    let mut rem: u16;
+    let mut new_amount: u16;
+    let fact: u16 = u16::from(base_ten_int_fact);
+    let base: u16 = u16::from(basenum);
 
-    let mut ret_rev: Vec<u8> = Vec::new();
-    let mut it = arr_num.iter().rev();
-    loop {
-        let i = it.next();
-        match i {
-            Some(u) => {
-                new_amount = (u16::from(*u) * fact) + carry;
-                rem = new_amount % base;
-                carry = (new_amount - rem) / base;
-                ret_rev.push(rem as u8);
+    let mut ret_rev: Vec<u8> = Vec::new();
+    let mut it = arr_num.iter().rev();
+    loop {
+        let i = it.next();
+        match i {
+            Some(u) => {
+                new_amount = (u16::from(*u) * fact) + carry;
+                rem = new_amount % base;
+                carry = (new_amount - rem) / base;
+                ret_rev.push(rem as u8);
             }
-            None => {
-                while carry != 0 {
-                    rem = carry % base;
-                    carry = (carry - rem) / base;
-                    ret_rev.push(rem as u8);
+            None => {
+                while carry != 0 {
+                    rem = carry % base;
+                    carry = (carry - rem) / base;
+                    ret_rev.push(rem as u8);
                 }
                 break;
             }
         }
     }
-    let ret: Vec<u8> = ret_rev.into_iter().rev().collect();
-    ret
+    let ret: Vec<u8> = ret_rev.into_iter().rev().collect();
+    ret
 }
 
-#[allow(dead_code)]
-pub struct Remainder<'a> {
-    pub position: usize,
-    pub replace: Vec<u8>,
-    pub arr_num: &'a Vec<u8>,
+#[allow(dead_code)]
+pub struct Remainder<'a> {
+    pub position: usize,
+    pub replace: Vec<u8>,
+    pub arr_num: &'a Vec<u8>,
 }
 
-#[allow(dead_code)]
-pub struct DivOut<'a> {
-    pub quotient: u8,
-    pub remainder: Remainder<'a>,
+#[allow(dead_code)]
+pub struct DivOut<'a> {
+    pub quotient: u8,
+    pub remainder: Remainder<'a>,
 }
 
-#[allow(dead_code)]
-pub fn arrnum_int_div_step<'a>(
-    rem_in: &'a Remainder,
-    radix_in: u8,
-    base_ten_int_divisor: u8,
-    after_decimal: bool,
-) -> DivOut<'a> {
-    let mut rem_out = Remainder {
-        position: rem_in.position,
-        replace: Vec::new(),
-        arr_num: rem_in.arr_num,
+#[allow(dead_code)]
+pub fn arrnum_int_div_step<'a>(
+    rem_in: &'a Remainder,
+    radix_in: u8,
+    base_ten_int_divisor: u8,
+    after_decimal: bool,
+) -> DivOut<'a> {
+    let mut rem_out = Remainder {
+        position: rem_in.position,
+        replace: Vec::new(),
+        arr_num: rem_in.arr_num,
     };
 
-    let mut bufferval: u16 = 0;
-    let base: u16 = u16::from(radix_in);
-    let divisor: u16 = u16::from(base_ten_int_divisor);
-    let mut traversed = 0;
+    let mut bufferval: u16 = 0;
+    let base: u16 = u16::from(radix_in);
+    let divisor: u16 = u16::from(base_ten_int_divisor);
+    let mut traversed = 0;
 
-    let mut quotient = 0;
-    let refd_vals = &rem_in.arr_num[rem_in.position + rem_in.replace.len()..];
-    let mut it_replace = rem_in.replace.iter();
-    let mut it_f = refd_vals.iter();
-    loop {
-        let u = match it_replace.next() {
-            Some(u_rep) => u16::from(*u_rep),
-            None => match it_f.next() {
-                Some(u_orig) => u16::from(*u_orig),
-                None => {
-                    if !after_decimal {
+    let mut quotient = 0;
+    let refd_vals = &rem_in.arr_num[rem_in.position + rem_in.replace.len()..];
+    let mut it_replace = rem_in.replace.iter();
+    let mut it_f = refd_vals.iter();
+    loop {
+        let u = match it_replace.next() {
+            Some(u_rep) => u16::from(*u_rep),
+            None => match it_f.next() {
+                Some(u_orig) => u16::from(*u_orig),
+                None => {
+                    if !after_decimal {
                         break;
                     }
-                    0
-                }
+                    0
+                }
             },
         };
-        traversed += 1;
-        bufferval += u;
-        if bufferval > divisor {
-            while bufferval >= divisor {
-                quotient += 1;
-                bufferval -= divisor;
+        traversed += 1;
+        bufferval += u;
+        if bufferval > divisor {
+            while bufferval >= divisor {
+                quotient += 1;
+                bufferval -= divisor;
             }
-            rem_out.replace = if bufferval == 0 {
-                Vec::new()
-            } else {
-                let remainder_as_arrnum = unsigned_to_arrnum(bufferval);
-                base_conv_vec(&remainder_as_arrnum, 10, radix_in)
+            rem_out.replace = if bufferval == 0 {
+                Vec::new()
+            } else {
+                let remainder_as_arrnum = unsigned_to_arrnum(bufferval);
+                base_conv_vec(&remainder_as_arrnum, 10, radix_in)
             };
-            rem_out.position += 1 + (traversed - rem_out.replace.len());
+            rem_out.position += 1 + (traversed - rem_out.replace.len());
             break;
-        } else {
-            bufferval *= base;
+        } else {
+            bufferval *= base;
         }
     }
-    DivOut {
-        quotient,
-        remainder: rem_out,
+    DivOut {
+        quotient,
+        remainder: rem_out,
     }
 }
-pub fn arrnum_int_add(arrnum: &[u8], basenum: u8, base_ten_int_term: u8) -> Vec<u8> {
-    let mut carry: u16 = u16::from(base_ten_int_term);
-    let mut rem: u16;
-    let mut new_amount: u16;
-    let base: u16 = u16::from(basenum);
+pub fn arrnum_int_add(arrnum: &[u8], basenum: u8, base_ten_int_term: u8) -> Vec<u8> {
+    let mut carry: u16 = u16::from(base_ten_int_term);
+    let mut rem: u16;
+    let mut new_amount: u16;
+    let base: u16 = u16::from(basenum);
 
-    let mut ret_rev: Vec<u8> = Vec::new();
-    let mut it = arrnum.iter().rev();
-    loop {
-        let i = it.next();
-        match i {
-            Some(u) => {
-                new_amount = u16::from(*u) + carry;
-                rem = new_amount % base;
-                carry = (new_amount - rem) / base;
-                ret_rev.push(rem as u8);
+    let mut ret_rev: Vec<u8> = Vec::new();
+    let mut it = arrnum.iter().rev();
+    loop {
+        let i = it.next();
+        match i {
+            Some(u) => {
+                new_amount = u16::from(*u) + carry;
+                rem = new_amount % base;
+                carry = (new_amount - rem) / base;
+                ret_rev.push(rem as u8);
             }
-            None => {
-                while carry != 0 {
-                    rem = carry % base;
-                    carry = (carry - rem) / base;
-                    ret_rev.push(rem as u8);
+            None => {
+                while carry != 0 {
+                    rem = carry % base;
+                    carry = (carry - rem) / base;
+                    ret_rev.push(rem as u8);
                 }
                 break;
             }
         }
     }
-    let ret: Vec<u8> = ret_rev.into_iter().rev().collect();
-    ret
+    let ret: Vec<u8> = ret_rev.into_iter().rev().collect();
+    ret
 }
 
-pub fn base_conv_vec(src: &[u8], radix_src: u8, radix_dest: u8) -> Vec<u8> {
-    let mut result = vec![0];
-    for i in src {
-        result = arrnum_int_mult(&result, radix_dest, radix_src);
-        result = arrnum_int_add(&result, radix_dest, *i);
+pub fn base_conv_vec(src: &[u8], radix_src: u8, radix_dest: u8) -> Vec<u8> {
+    let mut result = vec![0];
+    for i in src {
+        result = arrnum_int_mult(&result, radix_dest, radix_src);
+        result = arrnum_int_add(&result, radix_dest, *i);
     }
-    result
+    result
 }
 
-#[allow(dead_code)]
-pub fn unsigned_to_arrnum(src: u16) -> Vec<u8> {
-    let mut result: Vec<u8> = Vec::new();
-    let mut src_tmp: u16 = src;
-    while src_tmp > 0 {
-        result.push((src_tmp % 10) as u8);
-        src_tmp /= 10;
+#[allow(dead_code)]
+pub fn unsigned_to_arrnum(src: u16) -> Vec<u8> {
+    let mut result: Vec<u8> = Vec::new();
+    let mut src_tmp: u16 = src;
+    while src_tmp > 0 {
+        result.push((src_tmp % 10) as u8);
+        src_tmp /= 10;
     }
-    result.reverse();
-    result
+    result.reverse();
+    result
 }
 
-// temporary needs-improvement-function
-pub fn base_conv_float(src: &[u8], radix_src: u8, _radix_dest: u8) -> f64 {
-    // it would require a lot of addl code
-    // to implement this for arbitrary string input.
-    // until then, the below operates as an outline
-    // of how it would work.
-    let mut factor: f64 = 1_f64;
-    let radix_src_float: f64 = f64::from(radix_src);
-    let mut r: f64 = 0_f64;
-    for (i, u) in src.iter().enumerate() {
-        if i > 15 {
+// temporary needs-improvement-function
+pub fn base_conv_float(src: &[u8], radix_src: u8, _radix_dest: u8) -> f64 {
+    // it would require a lot of addl code
+    // to implement this for arbitrary string input.
+    // until then, the below operates as an outline
+    // of how it would work.
+    let mut factor: f64 = 1_f64;
+    let radix_src_float: f64 = f64::from(radix_src);
+    let mut r: f64 = 0_f64;
+    for (i, u) in src.iter().enumerate() {
+        if i > 15 {
             break;
         }
-        factor /= radix_src_float;
-        r += factor * f64::from(*u);
+        factor /= radix_src_float;
+        r += factor * f64::from(*u);
     }
-    r
+    r
 }
 
-pub fn str_to_arrnum(src: &str, radix_def_src: &dyn RadixDef) -> Vec<u8> {
-    let mut intermed_in: Vec<u8> = Vec::new();
-    for c in src.chars() {
-        #[allow(clippy::single_match)]
-        match radix_def_src.parse_char(c) {
-            Some(u) => {
-                intermed_in.push(u);
+pub fn str_to_arrnum(src: &str, radix_def_src: &dyn RadixDef) -> Vec<u8> {
+    let mut intermed_in: Vec<u8> = Vec::new();
+    for c in src.chars() {
+        #[allow(clippy::single_match)]
+        match radix_def_src.parse_char(c) {
+            Some(u) => {
+                intermed_in.push(u);
             }
-            None => {} //todo err msg on incorrect
-        }
+            None => {} //todo err msg on incorrect
+        }
     }
-    intermed_in
+    intermed_in
 }
 
-pub fn arrnum_to_str(src: &[u8], radix_def_dest: &dyn RadixDef) -> String {
-    let mut str_out = String::new();
-    for u in src.iter() {
-        #[allow(clippy::single_match)]
-        match radix_def_dest.format_u8(*u) {
-            Some(c) => {
-                str_out.push(c);
+pub fn arrnum_to_str(src: &[u8], radix_def_dest: &dyn RadixDef) -> String {
+    let mut str_out = String::new();
+    for u in src.iter() {
+        #[allow(clippy::single_match)]
+        match radix_def_dest.format_u8(*u) {
+            Some(c) => {
+                str_out.push(c);
             }
-            None => {} //todo
-        }
+            None => {} //todo
+        }
     }
-    str_out
+    str_out
 }
 
-pub fn base_conv_str(
-    src: &str,
-    radix_def_src: &dyn RadixDef,
-    radix_def_dest: &dyn RadixDef,
-) -> String {
-    let intermed_in: Vec<u8> = str_to_arrnum(src, radix_def_src);
-    let intermed_out = base_conv_vec(
-        &intermed_in,
-        radix_def_src.get_max(),
-        radix_def_dest.get_max(),
+pub fn base_conv_str(
+    src: &str,
+    radix_def_src: &dyn RadixDef,
+    radix_def_dest: &dyn RadixDef,
+) -> String {
+    let intermed_in: Vec<u8> = str_to_arrnum(src, radix_def_src);
+    let intermed_out = base_conv_vec(
+        &intermed_in,
+        radix_def_src.get_max(),
+        radix_def_dest.get_max(),
     );
-    arrnum_to_str(&intermed_out, radix_def_dest)
+    arrnum_to_str(&intermed_out, radix_def_dest)
 }
 
-pub trait RadixDef {
-    fn get_max(&self) -> u8;
-    fn parse_char(&self, x: char) -> Option<u8>;
-    fn format_u8(&self, x: u8) -> Option<char>;
+pub trait RadixDef {
+    fn get_max(&self) -> u8;
+    fn parse_char(&self, x: char) -> Option<u8>;
+    fn format_u8(&self, x: u8) -> Option<char>;
 }
-pub struct RadixTen;
+pub struct RadixTen;
 
-const ZERO_ASC: u8 = b'0';
-const UPPER_A_ASC: u8 = b'A';
-const LOWER_A_ASC: u8 = b'a';
+const ZERO_ASC: u8 = b'0';
+const UPPER_A_ASC: u8 = b'A';
+const LOWER_A_ASC: u8 = b'a';
 
-impl RadixDef for RadixTen {
-    fn get_max(&self) -> u8 {
-        10
-    }
-    fn parse_char(&self, c: char) -> Option<u8> {
-        match c {
-            '0'..='9' => Some(c as u8 - ZERO_ASC),
-            _ => None,
+impl RadixDef for RadixTen {
+    fn get_max(&self) -> u8 {
+        10
+    }
+    fn parse_char(&self, c: char) -> Option<u8> {
+        match c {
+            '0'..='9' => Some(c as u8 - ZERO_ASC),
+            _ => None,
         }
     }
-    fn format_u8(&self, u: u8) -> Option<char> {
-        match u {
-            0..=9 => Some((ZERO_ASC + u) as char),
-            _ => None,
+    fn format_u8(&self, u: u8) -> Option<char> {
+        match u {
+            0..=9 => Some((ZERO_ASC + u) as char),
+            _ => None,
         }
     }
 }
-pub struct RadixHex;
-impl RadixDef for RadixHex {
-    fn get_max(&self) -> u8 {
-        16
-    }
-    fn parse_char(&self, c: char) -> Option<u8> {
-        match c {
-            '0'..='9' => Some(c as u8 - ZERO_ASC),
-            'A'..='F' => Some(c as u8 + 10 - UPPER_A_ASC),
-            'a'..='f' => Some(c as u8 + 10 - LOWER_A_ASC),
-            _ => None,
+pub struct RadixHex;
+impl RadixDef for RadixHex {
+    fn get_max(&self) -> u8 {
+        16
+    }
+    fn parse_char(&self, c: char) -> Option<u8> {
+        match c {
+            '0'..='9' => Some(c as u8 - ZERO_ASC),
+            'A'..='F' => Some(c as u8 + 10 - UPPER_A_ASC),
+            'a'..='f' => Some(c as u8 + 10 - LOWER_A_ASC),
+            _ => None,
         }
     }
-    fn format_u8(&self, u: u8) -> Option<char> {
-        match u {
-            0..=9 => Some((ZERO_ASC + u) as char),
-            10..=15 => Some((UPPER_A_ASC + (u - 10)) as char),
-            _ => None,
+    fn format_u8(&self, u: u8) -> Option<char> {
+        match u {
+            0..=9 => Some((ZERO_ASC + u) as char),
+            10..=15 => Some((UPPER_A_ASC + (u - 10)) as char),
+            _ => None,
         }
     }
 }
 
-mod tests;
+mod tests;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatters/base_conv/tests.rs.html b/dev/src/uucore/features/tokenize/num_format/formatters/base_conv/tests.rs.html index 5187cb543..2ae38348b 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatters/base_conv/tests.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatters/base_conv/tests.rs.html @@ -1,4 +1,4 @@ -tests.rs - source
1
+tests.rs - source
1
 2
 3
 4
@@ -54,61 +54,61 @@
 54
 55
 56
-
// spell-checker:ignore (ToDO) arrnum mult
+
// spell-checker:ignore (ToDO) arrnum mult
 
-#[cfg(test)]
-use super::*;
+#[cfg(test)]
+use super::*;
 
-#[test]
-fn test_arrnum_int_mult() {
-    // (in base 10) 12 * 4 = 48
-    let factor: Vec<u8> = vec![1, 2];
-    let base_num = 10;
-    let base_ten_int_fact: u8 = 4;
-    let should_output: Vec<u8> = vec![4, 8];
+#[test]
+fn test_arrnum_int_mult() {
+    // (in base 10) 12 * 4 = 48
+    let factor: Vec<u8> = vec![1, 2];
+    let base_num = 10;
+    let base_ten_int_fact: u8 = 4;
+    let should_output: Vec<u8> = vec![4, 8];
 
-    let product = arrnum_int_mult(&factor, base_num, base_ten_int_fact);
-    assert!(product == should_output);
+    let product = arrnum_int_mult(&factor, base_num, base_ten_int_fact);
+    assert!(product == should_output);
 }
 
-#[test]
-fn test_arrnum_int_non_base_10() {
-    // (in base 3)
-    // 5 * 4 = 20
-    let factor: Vec<u8> = vec![1, 2];
-    let base_num = 3;
-    let base_ten_int_fact: u8 = 4;
-    let should_output: Vec<u8> = vec![2, 0, 2];
+#[test]
+fn test_arrnum_int_non_base_10() {
+    // (in base 3)
+    // 5 * 4 = 20
+    let factor: Vec<u8> = vec![1, 2];
+    let base_num = 3;
+    let base_ten_int_fact: u8 = 4;
+    let should_output: Vec<u8> = vec![2, 0, 2];
 
-    let product = arrnum_int_mult(&factor, base_num, base_ten_int_fact);
-    assert!(product == should_output);
+    let product = arrnum_int_mult(&factor, base_num, base_ten_int_fact);
+    assert!(product == should_output);
 }
 
-#[test]
-fn test_arrnum_int_div_short_circuit() {
-    // (
-    let arrnum: Vec<u8> = vec![5, 5, 5, 5, 0];
-    let base_num = 10;
-    let base_ten_int_divisor: u8 = 41;
-    let remainder_passed_in = Remainder {
-        position: 1,
-        replace: vec![1, 3],
-        arr_num: &arrnum,
+#[test]
+fn test_arrnum_int_div_short_circuit() {
+    // (
+    let arrnum: Vec<u8> = vec![5, 5, 5, 5, 0];
+    let base_num = 10;
+    let base_ten_int_divisor: u8 = 41;
+    let remainder_passed_in = Remainder {
+        position: 1,
+        replace: vec![1, 3],
+        arr_num: &arrnum,
     };
 
-    // the "replace" should mean the number being divided
-    // is 1350, the first time you can get 41 to go into
-    // 1350, its at 135, where you can get a quotient of
-    // 3 and a remainder of 12;
+    // the "replace" should mean the number being divided
+    // is 1350, the first time you can get 41 to go into
+    // 1350, its at 135, where you can get a quotient of
+    // 3 and a remainder of 12;
 
-    let quotient_should_be: u8 = 3;
-    let remainder_position_should_be: usize = 3;
-    let remainder_replace_should_be = vec![1, 2];
+    let quotient_should_be: u8 = 3;
+    let remainder_position_should_be: usize = 3;
+    let remainder_replace_should_be = vec![1, 2];
 
-    let result = arrnum_int_div_step(&remainder_passed_in, base_num, base_ten_int_divisor, false);
-    assert!(quotient_should_be == result.quotient);
-    assert!(remainder_position_should_be == result.remainder.position);
-    assert!(remainder_replace_should_be == result.remainder.replace);
+    let result = arrnum_int_div_step(&remainder_passed_in, base_num, base_ten_int_divisor, false);
+    assert!(quotient_should_be == result.quotient);
+    assert!(remainder_position_should_be == result.remainder.position);
+    assert!(remainder_replace_should_be == result.remainder.replace);
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatters/cninetyninehexfloatf.rs.html b/dev/src/uucore/features/tokenize/num_format/formatters/cninetyninehexfloatf.rs.html index 2341f6232..713608546 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatters/cninetyninehexfloatf.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatters/cninetyninehexfloatf.rs.html @@ -1,4 +1,4 @@ -cninetyninehexfloatf.rs - source
1
+cninetyninehexfloatf.rs - source
1
 2
 3
 4
@@ -113,120 +113,120 @@
 113
 114
 115
-
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
-// spell-checker:ignore (ToDO) arrnum
+
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
+// spell-checker:ignore (ToDO) arrnum
 
-//! formatter for %a %F C99 Hex-floating-point subs
-use super::super::format_field::FormatField;
-use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix};
-use super::base_conv;
-use super::base_conv::RadixDef;
-use super::float_common::{primitive_to_str_common, FloatAnalysis};
+//! formatter for %a %F C99 Hex-floating-point subs
+use super::super::format_field::FormatField;
+use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix};
+use super::base_conv;
+use super::base_conv::RadixDef;
+use super::float_common::{primitive_to_str_common, FloatAnalysis};
 
-#[derive(Default)]
-pub struct CninetyNineHexFloatf {
-    #[allow(dead_code)]
-    as_num: f64,
+#[derive(Default)]
+pub struct CninetyNineHexFloatf {
+    #[allow(dead_code)]
+    as_num: f64,
 }
-impl CninetyNineHexFloatf {
-    pub fn new() -> Self {
-        Self::default()
+impl CninetyNineHexFloatf {
+    pub fn new() -> Self {
+        Self::default()
     }
 }
 
-impl Formatter for CninetyNineHexFloatf {
-    fn get_primitive(
+impl Formatter for CninetyNineHexFloatf {
+    fn get_primitive(
         &self,
-        field: &FormatField,
-        initial_prefix: &InitialPrefix,
-        str_in: &str,
-    ) -> Option<FormatPrimitive> {
-        let second_field = field.second_field.unwrap_or(6) + 1;
-        let analysis = FloatAnalysis::analyze(
-            str_in,
-            initial_prefix,
-            Some(second_field as usize),
+        field: &FormatField,
+        initial_prefix: &InitialPrefix,
+        str_in: &str,
+    ) -> Option<FormatPrimitive> {
+        let second_field = field.second_field.unwrap_or(6) + 1;
+        let analysis = FloatAnalysis::analyze(
+            str_in,
+            initial_prefix,
+            Some(second_field as usize),
             None,
             true,
         );
-        let f = get_primitive_hex(
-            initial_prefix,
-            &str_in[initial_prefix.offset..],
-            &analysis,
-            second_field as usize,
-            *field.field_char == 'A',
+        let f = get_primitive_hex(
+            initial_prefix,
+            &str_in[initial_prefix.offset..],
+            &analysis,
+            second_field as usize,
+            *field.field_char == 'A',
         );
-        Some(f)
+        Some(f)
     }
-    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
-        primitive_to_str_common(prim, &field)
+    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
+        primitive_to_str_common(prim, &field)
     }
 }
 
-// c99 hex has unique requirements of all floating point subs in pretty much every part of building a primitive, from prefix and suffix to need for base conversion (in all other cases if you don't have decimal you must have decimal, here it's the other way around)
+// c99 hex has unique requirements of all floating point subs in pretty much every part of building a primitive, from prefix and suffix to need for base conversion (in all other cases if you don't have decimal you must have decimal, here it's the other way around)
 
-// on the todo list is to have a trait for get_primitive that is implemented by each float formatter and can override a default. when that happens we can take the parts of get_primitive_dec specific to dec and spin them out to their own functions that can be overridden.
-fn get_primitive_hex(
-    initial_prefix: &InitialPrefix,
-    _str_in: &str,
-    _analysis: &FloatAnalysis,
-    _last_dec_place: usize,
-    capitalized: bool,
-) -> FormatPrimitive {
-    let prefix = Some(String::from(if initial_prefix.sign == -1 {
-        "-0x"
-    } else {
-        "0x"
-    }));
+// on the todo list is to have a trait for get_primitive that is implemented by each float formatter and can override a default. when that happens we can take the parts of get_primitive_dec specific to dec and spin them out to their own functions that can be overridden.
+fn get_primitive_hex(
+    initial_prefix: &InitialPrefix,
+    _str_in: &str,
+    _analysis: &FloatAnalysis,
+    _last_dec_place: usize,
+    capitalized: bool,
+) -> FormatPrimitive {
+    let prefix = Some(String::from(if initial_prefix.sign == -1 {
+        "-0x"
+    } else {
+        "0x"
+    }));
 
-    // TODO actual conversion, make sure to get back mantissa.
-    // for hex to hex, it's really just a matter of moving the
-    // decimal point and calculating the mantissa by its initial
-    // position and its moves, with every position counting for
-    // the addition or subtraction of 4 (2**4, because 4 bits in a hex digit)
-    // to the exponent.
-    // decimal's going to be a little more complicated. correct simulation
-    // of glibc will require after-decimal division to a specified precision.
-    // the difficult part of this (arrnum_int_div_step) is already implemented.
+    // TODO actual conversion, make sure to get back mantissa.
+    // for hex to hex, it's really just a matter of moving the
+    // decimal point and calculating the mantissa by its initial
+    // position and its moves, with every position counting for
+    // the addition or subtraction of 4 (2**4, because 4 bits in a hex digit)
+    // to the exponent.
+    // decimal's going to be a little more complicated. correct simulation
+    // of glibc will require after-decimal division to a specified precision.
+    // the difficult part of this (arrnum_int_div_step) is already implemented.
 
-    // the hex float name may be a bit misleading in terms of how to go about the
-    // conversion. The best way to do it is to just convert the float number
-    // directly to base 2 and then at the end translate back to hex.
-    let mantissa = 0;
-    let suffix = Some({
-        let ind = if capitalized { "P" } else { "p" };
-        if mantissa >= 0 {
-            format!("{}+{}", ind, mantissa)
-        } else {
-            format!("{}{}", ind, mantissa)
+    // the hex float name may be a bit misleading in terms of how to go about the
+    // conversion. The best way to do it is to just convert the float number
+    // directly to base 2 and then at the end translate back to hex.
+    let mantissa = 0;
+    let suffix = Some({
+        let ind = if capitalized { "P" } else { "p" };
+        if mantissa >= 0 {
+            format!("{}+{}", ind, mantissa)
+        } else {
+            format!("{}{}", ind, mantissa)
         }
     });
-    FormatPrimitive {
-        prefix,
-        suffix,
-        ..Default::default()
+    FormatPrimitive {
+        prefix,
+        suffix,
+        ..Default::default()
     }
 }
 
-#[allow(dead_code)]
-fn to_hex(src: &str, before_decimal: bool) -> String {
-    let radix_ten = base_conv::RadixTen;
-    let radix_hex = base_conv::RadixHex;
-    if before_decimal {
-        base_conv::base_conv_str(src, &radix_ten, &radix_hex)
-    } else {
-        let as_arrnum_ten = base_conv::str_to_arrnum(src, &radix_ten);
-        let s = format!(
+#[allow(dead_code)]
+fn to_hex(src: &str, before_decimal: bool) -> String {
+    let radix_ten = base_conv::RadixTen;
+    let radix_hex = base_conv::RadixHex;
+    if before_decimal {
+        base_conv::base_conv_str(src, &radix_ten, &radix_hex)
+    } else {
+        let as_arrnum_ten = base_conv::str_to_arrnum(src, &radix_ten);
+        let s = format!(
             "{}",
-            base_conv::base_conv_float(&as_arrnum_ten, radix_ten.get_max(), radix_hex.get_max())
+            base_conv::base_conv_float(&as_arrnum_ten, radix_ten.get_max(), radix_hex.get_max())
         );
-        if s.len() > 2 {
-            String::from(&s[2..])
-        } else {
-            // zero
-            s
+        if s.len() > 2 {
+            String::from(&s[2..])
+        } else {
+            // zero
+            s
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatters/decf.rs.html b/dev/src/uucore/features/tokenize/num_format/formatters/decf.rs.html index c5342e1fd..785c16773 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatters/decf.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatters/decf.rs.html @@ -1,4 +1,4 @@ -decf.rs - source
1
+decf.rs - source
1
 2
 3
 4
@@ -183,190 +183,190 @@
 183
 184
 185
-
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
+
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
 
-//! formatter for %g %G decimal subs
-use super::super::format_field::FormatField;
-use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix};
-use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis};
+//! formatter for %g %G decimal subs
+use super::super::format_field::FormatField;
+use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix};
+use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis};
 
-const SIGNIFICANT_FIGURES: usize = 6;
+const SIGNIFICANT_FIGURES: usize = 6;
 
-// Parse a numeric string as the nearest integer with a given significance.
-// This is a helper function for round().
-// Examples:
-//  round_to_significance("456", 1) == 500
-//  round_to_significance("456", 2) == 460
-//  round_to_significance("456", 9) == 456
-fn round_to_significance(input: &str, significant_figures: usize) -> u32 {
-    if significant_figures < input.len() {
-        // If the input has too many digits, use a float intermediary
-        // to round it before converting to an integer. Otherwise,
-        // converting straight to integer will truncate.
-        // There might be a cleaner way to do this...
-        let digits = &input[..significant_figures + 1];
-        let float_representation = digits.parse::<f32>().unwrap();
-        (float_representation / 10.0).round() as u32
-    } else {
-        input.parse::<u32>().unwrap_or(0)
+// Parse a numeric string as the nearest integer with a given significance.
+// This is a helper function for round().
+// Examples:
+//  round_to_significance("456", 1) == 500
+//  round_to_significance("456", 2) == 460
+//  round_to_significance("456", 9) == 456
+fn round_to_significance(input: &str, significant_figures: usize) -> u32 {
+    if significant_figures < input.len() {
+        // If the input has too many digits, use a float intermediary
+        // to round it before converting to an integer. Otherwise,
+        // converting straight to integer will truncate.
+        // There might be a cleaner way to do this...
+        let digits = &input[..significant_figures + 1];
+        let float_representation = digits.parse::<f32>().unwrap();
+        (float_representation / 10.0).round() as u32
+    } else {
+        input.parse::<u32>().unwrap_or(0)
     }
 }
 
-// Removing trailing zeroes, expressing the result as an integer where
-// possible. This is a helper function for round().
-fn truncate(mut format: FormatPrimitive) -> FormatPrimitive {
-    if let Some(ref post_dec) = format.post_decimal {
-        let trimmed = post_dec.trim_end_matches('0');
+// Removing trailing zeroes, expressing the result as an integer where
+// possible. This is a helper function for round().
+fn truncate(mut format: FormatPrimitive) -> FormatPrimitive {
+    if let Some(ref post_dec) = format.post_decimal {
+        let trimmed = post_dec.trim_end_matches('0');
 
-        if trimmed.is_empty() {
-            // If there are no nonzero digits after the decimal point,
-            // use integer formatting by clearing post_decimal and suffix.
-            format.post_decimal = Some("".into());
-            if format.suffix == Some("e+00".into()) {
-                format.suffix = Some("".into());
+        if trimmed.is_empty() {
+            // If there are no nonzero digits after the decimal point,
+            // use integer formatting by clearing post_decimal and suffix.
+            format.post_decimal = Some("".into());
+            if format.suffix == Some("e+00".into()) {
+                format.suffix = Some("".into());
             }
-        } else if trimmed.len() != post_dec.len() {
-            // Otherwise, update the format to remove only the trailing
-            // zeroes (e.g. "4.50" becomes "4.5", not "4"). If there were
-            // no trailing zeroes, do nothing.
-            format.post_decimal = Some(trimmed.to_owned());
+        } else if trimmed.len() != post_dec.len() {
+            // Otherwise, update the format to remove only the trailing
+            // zeroes (e.g. "4.50" becomes "4.5", not "4"). If there were
+            // no trailing zeroes, do nothing.
+            format.post_decimal = Some(trimmed.to_owned());
         }
     }
-    format
+    format
 }
 
-// Round a format to six significant figures and remove trailing zeroes.
-fn round(mut format: FormatPrimitive) -> FormatPrimitive {
-    let mut significant_digits_remaining = SIGNIFICANT_FIGURES;
+// Round a format to six significant figures and remove trailing zeroes.
+fn round(mut format: FormatPrimitive) -> FormatPrimitive {
+    let mut significant_digits_remaining = SIGNIFICANT_FIGURES;
 
-    // First, take as many significant digits as possible from pre_decimal,
-    if format.pre_decimal.is_some() {
-        let input = format.pre_decimal.as_ref().unwrap();
-        let rounded = round_to_significance(input, significant_digits_remaining);
-        let mut rounded_str = rounded.to_string();
-        significant_digits_remaining -= rounded_str.len();
+    // First, take as many significant digits as possible from pre_decimal,
+    if format.pre_decimal.is_some() {
+        let input = format.pre_decimal.as_ref().unwrap();
+        let rounded = round_to_significance(input, significant_digits_remaining);
+        let mut rounded_str = rounded.to_string();
+        significant_digits_remaining -= rounded_str.len();
 
-        // If the pre_decimal has exactly enough significant digits,
-        // round the input to the nearest integer. If the first
-        // post_decimal digit is 5 or higher, round up by incrementing
-        // the pre_decimal number. Otherwise, use the pre_decimal as-is.
-        if significant_digits_remaining == 0 {
-            if let Some(digits) = &format.post_decimal {
-                if digits.chars().next().unwrap_or('0') >= '5' {
-                    let rounded = rounded + 1;
-                    rounded_str = rounded.to_string();
+        // If the pre_decimal has exactly enough significant digits,
+        // round the input to the nearest integer. If the first
+        // post_decimal digit is 5 or higher, round up by incrementing
+        // the pre_decimal number. Otherwise, use the pre_decimal as-is.
+        if significant_digits_remaining == 0 {
+            if let Some(digits) = &format.post_decimal {
+                if digits.chars().next().unwrap_or('0') >= '5' {
+                    let rounded = rounded + 1;
+                    rounded_str = rounded.to_string();
                 }
             }
         }
-        format.pre_decimal = Some(rounded_str);
+        format.pre_decimal = Some(rounded_str);
     }
 
-    // If no significant digits remain, or there's no post_decimal to
-    // round, return the rounded pre_decimal value with no post_decimal.
-    // Otherwise, round the post_decimal to the remaining significance.
-    if significant_digits_remaining == 0 {
-        format.post_decimal = Some(String::new());
-    } else if let Some(input) = format.post_decimal {
-        let leading_zeroes = input.len() - input.trim_start_matches('0').len();
-        let digits = &input[leading_zeroes..];
+    // If no significant digits remain, or there's no post_decimal to
+    // round, return the rounded pre_decimal value with no post_decimal.
+    // Otherwise, round the post_decimal to the remaining significance.
+    if significant_digits_remaining == 0 {
+        format.post_decimal = Some(String::new());
+    } else if let Some(input) = format.post_decimal {
+        let leading_zeroes = input.len() - input.trim_start_matches('0').len();
+        let digits = &input[leading_zeroes..];
 
-        // In the post_decimal, leading zeroes are significant. "01.0010"
-        // has one significant digit in pre_decimal, and 3 from post_decimal.
-        let mut post_decimal_str = String::with_capacity(significant_digits_remaining);
-        for _ in 0..leading_zeroes {
-            post_decimal_str.push('0');
+        // In the post_decimal, leading zeroes are significant. "01.0010"
+        // has one significant digit in pre_decimal, and 3 from post_decimal.
+        let mut post_decimal_str = String::with_capacity(significant_digits_remaining);
+        for _ in 0..leading_zeroes {
+            post_decimal_str.push('0');
         }
 
-        if leading_zeroes < significant_digits_remaining {
-            // After significant leading zeroes, round the remaining digits
-            // to any remaining significance.
-            let rounded = round_to_significance(digits, significant_digits_remaining);
-            post_decimal_str.push_str(&rounded.to_string());
-        } else if leading_zeroes == significant_digits_remaining
-            && digits.chars().next().unwrap_or('0') >= '5'
-        {
-            // If necessary, round up the post_decimal ("1.000009" should
-            // round to 1.00001, instead of truncating after the last
-            // significant leading zero).
-            post_decimal_str.pop();
-            post_decimal_str.push('1');
-        } else {
-            // If the rounded post_decimal is entirely zeroes, discard
-            // it and use integer formatting instead.
-            post_decimal_str = "".into();
+        if leading_zeroes < significant_digits_remaining {
+            // After significant leading zeroes, round the remaining digits
+            // to any remaining significance.
+            let rounded = round_to_significance(digits, significant_digits_remaining);
+            post_decimal_str.push_str(&rounded.to_string());
+        } else if leading_zeroes == significant_digits_remaining
+            && digits.chars().next().unwrap_or('0') >= '5'
+        {
+            // If necessary, round up the post_decimal ("1.000009" should
+            // round to 1.00001, instead of truncating after the last
+            // significant leading zero).
+            post_decimal_str.pop();
+            post_decimal_str.push('1');
+        } else {
+            // If the rounded post_decimal is entirely zeroes, discard
+            // it and use integer formatting instead.
+            post_decimal_str = "".into();
         }
 
-        format.post_decimal = Some(post_decimal_str);
+        format.post_decimal = Some(post_decimal_str);
     }
-    truncate(format)
+    truncate(format)
 }
 
-// Given an exponent used in scientific notation, return whether the
-// number is small enough to be expressed as a decimal instead. "Small
-// enough" is based only on the number's magnitude, not the length of
-// any string representation.
-fn should_represent_as_decimal(suffix: &Option<String>) -> bool {
-    match suffix {
-        Some(exponent) => {
-            if exponent.chars().nth(1) == Some('-') {
-                exponent < &"e-05".into()
-            } else {
-                exponent < &"e+06".into()
+// Given an exponent used in scientific notation, return whether the
+// number is small enough to be expressed as a decimal instead. "Small
+// enough" is based only on the number's magnitude, not the length of
+// any string representation.
+fn should_represent_as_decimal(suffix: &Option<String>) -> bool {
+    match suffix {
+        Some(exponent) => {
+            if exponent.chars().nth(1) == Some('-') {
+                exponent < &"e-05".into()
+            } else {
+                exponent < &"e+06".into()
             }
         }
-        None => true,
+        None => true,
     }
 }
 
-pub struct Decf;
+pub struct Decf;
 
-impl Decf {
-    pub fn new() -> Self {
-        Self
-    }
+impl Decf {
+    pub fn new() -> Self {
+        Self
+    }
 }
-impl Formatter for Decf {
-    fn get_primitive(
+impl Formatter for Decf {
+    fn get_primitive(
         &self,
-        field: &FormatField,
-        initial_prefix: &InitialPrefix,
-        str_in: &str,
-    ) -> Option<FormatPrimitive> {
-        let second_field = field.second_field.unwrap_or(6) + 1;
-        // default to scif interpretation so as to not truncate input vals
-        // (that would be displayed in scif) based on relation to decimal place
-        let analysis = FloatAnalysis::analyze(
-            str_in,
-            initial_prefix,
-            Some(second_field as usize + 1),
+        field: &FormatField,
+        initial_prefix: &InitialPrefix,
+        str_in: &str,
+    ) -> Option<FormatPrimitive> {
+        let second_field = field.second_field.unwrap_or(6) + 1;
+        // default to scif interpretation so as to not truncate input vals
+        // (that would be displayed in scif) based on relation to decimal place
+        let analysis = FloatAnalysis::analyze(
+            str_in,
+            initial_prefix,
+            Some(second_field as usize + 1),
             None,
             false,
         );
-        let mut f_dec = get_primitive_dec(
-            initial_prefix,
-            &str_in[initial_prefix.offset..],
-            &analysis,
-            second_field as usize,
-            Some(*field.field_char == 'G'),
+        let mut f_dec = get_primitive_dec(
+            initial_prefix,
+            &str_in[initial_prefix.offset..],
+            &analysis,
+            second_field as usize,
+            Some(*field.field_char == 'G'),
         );
 
-        if should_represent_as_decimal(&f_dec.suffix) {
-            // Use decimal formatting instead of scientific notation
-            // if the input's magnitude is small.
-            f_dec = get_primitive_dec(
-                initial_prefix,
-                &str_in[initial_prefix.offset..],
-                &analysis,
-                second_field as usize,
+        if should_represent_as_decimal(&f_dec.suffix) {
+            // Use decimal formatting instead of scientific notation
+            // if the input's magnitude is small.
+            f_dec = get_primitive_dec(
+                initial_prefix,
+                &str_in[initial_prefix.offset..],
+                &analysis,
+                second_field as usize,
                 None,
             );
         }
 
-        Some(round(f_dec))
+        Some(round(f_dec))
     }
-    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
-        primitive_to_str_common(prim, &field)
+    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
+        primitive_to_str_common(prim, &field)
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatters/float_common.rs.html b/dev/src/uucore/features/tokenize/num_format/formatters/float_common.rs.html index 5588471ea..bbd48f4aa 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatters/float_common.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatters/float_common.rs.html @@ -1,4 +1,4 @@ -float_common.rs - source
1
+float_common.rs - source
1
 2
 3
 4
@@ -373,380 +373,380 @@
 373
 374
 375
-
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
-// spell-checker:ignore (ToDO) arrnum
+
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
+// spell-checker:ignore (ToDO) arrnum
 
-use super::super::format_field::FormatField;
-use super::super::formatter::{
-    get_it_at, warn_incomplete_conv, Base, FormatPrimitive, InitialPrefix,
+use super::super::format_field::FormatField;
+use super::super::formatter::{
+    get_it_at, warn_incomplete_conv, Base, FormatPrimitive, InitialPrefix,
 };
-use super::base_conv;
-use super::base_conv::RadixDef;
+use super::base_conv;
+use super::base_conv::RadixDef;
 
-// if the memory, copy, and comparison cost of chars
-//  becomes an issue, we can always operate in vec<u8> here
-//  rather than just at de_hex
+// if the memory, copy, and comparison cost of chars
+//  becomes an issue, we can always operate in vec<u8> here
+//  rather than just at de_hex
 
-pub struct FloatAnalysis {
-    pub len_important: usize,
-    // none means no decimal point.
-    pub decimal_pos: Option<usize>,
-    pub follow: Option<char>,
+pub struct FloatAnalysis {
+    pub len_important: usize,
+    // none means no decimal point.
+    pub decimal_pos: Option<usize>,
+    pub follow: Option<char>,
 }
-fn has_enough_digits(
-    hex_input: bool,
-    hex_output: bool,
-    string_position: usize,
-    starting_position: usize,
-    limit: usize,
-) -> bool {
-    // -1s are for rounding
-    if hex_output {
-        if hex_input {
-            (string_position - 1) - starting_position >= limit
-        } else {
-            false //undecidable without converting
-        }
-    } else if hex_input {
-        (((string_position - 1) - starting_position) * 9) / 8 >= limit
-    } else {
-        (string_position - 1) - starting_position >= limit
+fn has_enough_digits(
+    hex_input: bool,
+    hex_output: bool,
+    string_position: usize,
+    starting_position: usize,
+    limit: usize,
+) -> bool {
+    // -1s are for rounding
+    if hex_output {
+        if hex_input {
+            (string_position - 1) - starting_position >= limit
+        } else {
+            false //undecidable without converting
+        }
+    } else if hex_input {
+        (((string_position - 1) - starting_position) * 9) / 8 >= limit
+    } else {
+        (string_position - 1) - starting_position >= limit
     }
 }
 
-impl FloatAnalysis {
-    pub fn analyze(
-        str_in: &str,
-        initial_prefix: &InitialPrefix,
-        max_sd_opt: Option<usize>,
-        max_after_dec_opt: Option<usize>,
-        hex_output: bool,
-    ) -> Self {
-        // this fn assumes
-        // the input string
-        // has no leading spaces or 0s
-        let str_it = get_it_at(initial_prefix.offset, str_in);
-        let mut ret = Self {
-            len_important: 0,
-            decimal_pos: None,
-            follow: None,
+impl FloatAnalysis {
+    pub fn analyze(
+        str_in: &str,
+        initial_prefix: &InitialPrefix,
+        max_sd_opt: Option<usize>,
+        max_after_dec_opt: Option<usize>,
+        hex_output: bool,
+    ) -> Self {
+        // this fn assumes
+        // the input string
+        // has no leading spaces or 0s
+        let str_it = get_it_at(initial_prefix.offset, str_in);
+        let mut ret = Self {
+            len_important: 0,
+            decimal_pos: None,
+            follow: None,
         };
-        let hex_input = match initial_prefix.radix_in {
-            Base::Hex => true,
-            Base::Ten => false,
-            Base::Octal => {
+        let hex_input = match initial_prefix.radix_in {
+            Base::Hex => true,
+            Base::Ten => false,
+            Base::Octal => {
                 panic!("this should never happen: floats should never receive octal input");
             }
         };
-        let mut i = 0;
-        let mut pos_before_first_nonzero_after_decimal: Option<usize> = None;
-        for c in str_it {
-            match c {
-                e @ '0'..='9' | e @ 'A'..='F' | e @ 'a'..='f' => {
-                    if !hex_input {
-                        match e {
-                            '0'..='9' => {}
-                            _ => {
-                                warn_incomplete_conv(str_in);
+        let mut i = 0;
+        let mut pos_before_first_nonzero_after_decimal: Option<usize> = None;
+        for c in str_it {
+            match c {
+                e @ '0'..='9' | e @ 'A'..='F' | e @ 'a'..='f' => {
+                    if !hex_input {
+                        match e {
+                            '0'..='9' => {}
+                            _ => {
+                                warn_incomplete_conv(str_in);
                                 break;
                             }
                         }
                     }
-                    if ret.decimal_pos.is_some()
-                        && pos_before_first_nonzero_after_decimal.is_none()
-                        && e != '0'
-                    {
-                        pos_before_first_nonzero_after_decimal = Some(i - 1);
+                    if ret.decimal_pos.is_some()
+                        && pos_before_first_nonzero_after_decimal.is_none()
+                        && e != '0'
+                    {
+                        pos_before_first_nonzero_after_decimal = Some(i - 1);
                     }
-                    if let Some(max_sd) = max_sd_opt {
-                        if i == max_sd {
-                            // follow is used in cases of %g
-                            // where the character right after the last
-                            // sd is considered is rounded affecting
-                            // the previous digit in 1/2 of instances
-                            ret.follow = Some(e);
-                        } else if ret.decimal_pos.is_some() && i > max_sd {
+                    if let Some(max_sd) = max_sd_opt {
+                        if i == max_sd {
+                            // follow is used in cases of %g
+                            // where the character right after the last
+                            // sd is considered is rounded affecting
+                            // the previous digit in 1/2 of instances
+                            ret.follow = Some(e);
+                        } else if ret.decimal_pos.is_some() && i > max_sd {
                             break;
                         }
                     }
-                    if let Some(max_after_dec) = max_after_dec_opt {
-                        if let Some(p) = ret.decimal_pos {
-                            if has_enough_digits(hex_input, hex_output, i, p, max_after_dec) {
+                    if let Some(max_after_dec) = max_after_dec_opt {
+                        if let Some(p) = ret.decimal_pos {
+                            if has_enough_digits(hex_input, hex_output, i, p, max_after_dec) {
                                 break;
                             }
                         }
-                    } else if let Some(max_sd) = max_sd_opt {
-                        if let Some(p) = pos_before_first_nonzero_after_decimal {
-                            if has_enough_digits(hex_input, hex_output, i, p, max_sd) {
+                    } else if let Some(max_sd) = max_sd_opt {
+                        if let Some(p) = pos_before_first_nonzero_after_decimal {
+                            if has_enough_digits(hex_input, hex_output, i, p, max_sd) {
                                 break;
                             }
                         }
                     }
                 }
-                '.' => {
-                    if ret.decimal_pos.is_none() {
-                        ret.decimal_pos = Some(i);
-                    } else {
-                        warn_incomplete_conv(str_in);
+                '.' => {
+                    if ret.decimal_pos.is_none() {
+                        ret.decimal_pos = Some(i);
+                    } else {
+                        warn_incomplete_conv(str_in);
                         break;
                     }
                 }
-                _ => {
-                    warn_incomplete_conv(str_in);
+                _ => {
+                    warn_incomplete_conv(str_in);
                     break;
                 }
             };
-            i += 1;
+            i += 1;
         }
-        ret.len_important = i;
-        ret
+        ret.len_important = i;
+        ret
     }
 }
 
-fn de_hex(src: &str, before_decimal: bool) -> String {
-    let radix_ten = base_conv::RadixTen;
-    let radix_hex = base_conv::RadixHex;
-    if before_decimal {
-        base_conv::base_conv_str(src, &radix_hex, &radix_ten)
-    } else {
-        let as_arrnum_hex = base_conv::str_to_arrnum(src, &radix_hex);
-        let s = format!(
+fn de_hex(src: &str, before_decimal: bool) -> String {
+    let radix_ten = base_conv::RadixTen;
+    let radix_hex = base_conv::RadixHex;
+    if before_decimal {
+        base_conv::base_conv_str(src, &radix_hex, &radix_ten)
+    } else {
+        let as_arrnum_hex = base_conv::str_to_arrnum(src, &radix_hex);
+        let s = format!(
             "{}",
-            base_conv::base_conv_float(&as_arrnum_hex, radix_hex.get_max(), radix_ten.get_max())
+            base_conv::base_conv_float(&as_arrnum_hex, radix_hex.get_max(), radix_ten.get_max())
         );
-        if s.len() > 2 {
-            String::from(&s[2..])
-        } else {
-            // zero
-            s
+        if s.len() > 2 {
+            String::from(&s[2..])
+        } else {
+            // zero
+            s
         }
     }
 }
 
-// takes a string in,
-// truncates to a position,
-// bumps the last digit up one,
-// and if the digit was nine
-// propagate to the next, etc.
-// If before the decimal and the most
-// significant digit is a 9, it becomes a 1
-fn _round_str_from(in_str: &str, position: usize, before_dec: bool) -> (String, bool) {
-    let mut it = in_str[0..position].chars();
-    let mut rev = String::new();
-    let mut i = position;
-    let mut finished_in_dec = false;
-    while let Some(c) = it.next_back() {
-        i -= 1;
-        match c {
-            '9' => {
-                // If we're before the decimal
-                // and on the most significant digit,
-                // round 9 to 1, else to 0.
-                if before_dec && i == 0 {
-                    rev.push('1');
-                } else {
-                    rev.push('0');
+// takes a string in,
+// truncates to a position,
+// bumps the last digit up one,
+// and if the digit was nine
+// propagate to the next, etc.
+// If before the decimal and the most
+// significant digit is a 9, it becomes a 1
+fn _round_str_from(in_str: &str, position: usize, before_dec: bool) -> (String, bool) {
+    let mut it = in_str[0..position].chars();
+    let mut rev = String::new();
+    let mut i = position;
+    let mut finished_in_dec = false;
+    while let Some(c) = it.next_back() {
+        i -= 1;
+        match c {
+            '9' => {
+                // If we're before the decimal
+                // and on the most significant digit,
+                // round 9 to 1, else to 0.
+                if before_dec && i == 0 {
+                    rev.push('1');
+                } else {
+                    rev.push('0');
                 }
             }
-            e => {
-                rev.push(((e as u8) + 1) as char);
-                finished_in_dec = true;
+            e => {
+                rev.push(((e as u8) + 1) as char);
+                finished_in_dec = true;
                 break;
             }
         }
     }
-    let mut fwd = String::from(&in_str[0..i]);
-    for ch in rev.chars().rev() {
-        fwd.push(ch);
+    let mut fwd = String::from(&in_str[0..i]);
+    for ch in rev.chars().rev() {
+        fwd.push(ch);
     }
-    (fwd, finished_in_dec)
+    (fwd, finished_in_dec)
 }
 
-fn round_terminal_digit(
-    before_dec: String,
-    after_dec: String,
-    position: usize,
-) -> (String, String, bool) {
-    if position < after_dec.len() {
-        let digit_at_pos: char;
+fn round_terminal_digit(
+    before_dec: String,
+    after_dec: String,
+    position: usize,
+) -> (String, String, bool) {
+    if position < after_dec.len() {
+        let digit_at_pos: char;
         {
-            digit_at_pos = after_dec[position..=position].chars().next().expect("");
+            digit_at_pos = after_dec[position..=position].chars().next().expect("");
         }
-        if let '5'..='9' = digit_at_pos {
-            let (new_after_dec, finished_in_dec) = _round_str_from(&after_dec, position, false);
-            if finished_in_dec {
-                return (before_dec, new_after_dec, false);
-            } else {
-                let (new_before_dec, _) = _round_str_from(&before_dec, before_dec.len(), true);
-                let mut dec_place_chg = false;
-                let mut before_dec_chars = new_before_dec.chars();
-                if before_dec_chars.next() == Some('1') && before_dec_chars.all(|c| c == '0') {
-                    // If the first digit is a one and remaining are zeros, we have
-                    // rounded to a new decimal place, so the decimal place must be updated.
-                    // Only update decimal place if the before decimal != 0
-                    dec_place_chg = before_dec != "0";
+        if let '5'..='9' = digit_at_pos {
+            let (new_after_dec, finished_in_dec) = _round_str_from(&after_dec, position, false);
+            if finished_in_dec {
+                return (before_dec, new_after_dec, false);
+            } else {
+                let (new_before_dec, _) = _round_str_from(&before_dec, before_dec.len(), true);
+                let mut dec_place_chg = false;
+                let mut before_dec_chars = new_before_dec.chars();
+                if before_dec_chars.next() == Some('1') && before_dec_chars.all(|c| c == '0') {
+                    // If the first digit is a one and remaining are zeros, we have
+                    // rounded to a new decimal place, so the decimal place must be updated.
+                    // Only update decimal place if the before decimal != 0
+                    dec_place_chg = before_dec != "0";
                 }
-                return (new_before_dec, new_after_dec, dec_place_chg);
+                return (new_before_dec, new_after_dec, dec_place_chg);
             }
-            // TODO
-        }
+            // TODO
+        }
     }
-    (before_dec, after_dec, false)
+    (before_dec, after_dec, false)
 }
 
-pub fn get_primitive_dec(
-    initial_prefix: &InitialPrefix,
-    str_in: &str,
-    analysis: &FloatAnalysis,
-    last_dec_place: usize,
-    sci_mode: Option<bool>,
-) -> FormatPrimitive {
-    let mut f: FormatPrimitive = Default::default();
+pub fn get_primitive_dec(
+    initial_prefix: &InitialPrefix,
+    str_in: &str,
+    analysis: &FloatAnalysis,
+    last_dec_place: usize,
+    sci_mode: Option<bool>,
+) -> FormatPrimitive {
+    let mut f: FormatPrimitive = Default::default();
 
-    // add negative sign section
-    if initial_prefix.sign == -1 {
-        f.prefix = Some(String::from("-"));
+    // add negative sign section
+    if initial_prefix.sign == -1 {
+        f.prefix = Some(String::from("-"));
     }
 
-    // assign the digits before and after the decimal points
-    // to separate slices. If no digits after decimal point,
-    // assign 0
-    let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos {
-        Some(pos) => (&str_in[..pos], &str_in[pos + 1..]),
-        None => (str_in, "0"),
+    // assign the digits before and after the decimal points
+    // to separate slices. If no digits after decimal point,
+    // assign 0
+    let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos {
+        Some(pos) => (&str_in[..pos], &str_in[pos + 1..]),
+        None => (str_in, "0"),
     };
-    if first_segment_raw.is_empty() {
-        first_segment_raw = "0";
+    if first_segment_raw.is_empty() {
+        first_segment_raw = "0";
     }
-    // convert to string, de_hexifying if input is in hex   // spell-checker:disable-line
-    let (first_segment, second_segment) = match initial_prefix.radix_in {
-        Base::Hex => (
-            de_hex(first_segment_raw, true),
-            de_hex(second_segment_raw, false),
+    // convert to string, de_hexifying if input is in hex   // spell-checker:disable-line
+    let (first_segment, second_segment) = match initial_prefix.radix_in {
+        Base::Hex => (
+            de_hex(first_segment_raw, true),
+            de_hex(second_segment_raw, false),
         ),
-        _ => (
-            String::from(first_segment_raw),
-            String::from(second_segment_raw),
+        _ => (
+            String::from(first_segment_raw),
+            String::from(second_segment_raw),
         ),
     };
-    let (pre_dec_unrounded, post_dec_unrounded, mut mantissa) = if sci_mode.is_some() {
-        if first_segment.len() > 1 {
-            let mut post_dec = String::from(&first_segment[1..]);
-            post_dec.push_str(&second_segment);
+    let (pre_dec_unrounded, post_dec_unrounded, mut mantissa) = if sci_mode.is_some() {
+        if first_segment.len() > 1 {
+            let mut post_dec = String::from(&first_segment[1..]);
+            post_dec.push_str(&second_segment);
             (
-                String::from(&first_segment[0..1]),
-                post_dec,
-                first_segment.len() as isize - 1,
+                String::from(&first_segment[0..1]),
+                post_dec,
+                first_segment.len() as isize - 1,
             )
-        } else {
-            match first_segment
-                .chars()
-                .next()
-                .expect("float_common: no chars in first segment.")
+        } else {
+            match first_segment
+                .chars()
+                .next()
+                .expect("float_common: no chars in first segment.")
             {
-                '0' => {
-                    let it = second_segment.chars().enumerate();
-                    let mut m: isize = 0;
-                    let mut pre = String::from("0");
-                    let mut post = String::from("0");
-                    for (i, c) in it {
-                        match c {
-                            '0' => {}
-                            _ => {
-                                m = -((i as isize) + 1);
-                                pre = String::from(&second_segment[i..=i]);
-                                post = String::from(&second_segment[i + 1..]);
+                '0' => {
+                    let it = second_segment.chars().enumerate();
+                    let mut m: isize = 0;
+                    let mut pre = String::from("0");
+                    let mut post = String::from("0");
+                    for (i, c) in it {
+                        match c {
+                            '0' => {}
+                            _ => {
+                                m = -((i as isize) + 1);
+                                pre = String::from(&second_segment[i..=i]);
+                                post = String::from(&second_segment[i + 1..]);
                                 break;
                             }
                         }
                     }
-                    (pre, post, m)
+                    (pre, post, m)
                 }
-                _ => (first_segment, second_segment, 0),
+                _ => (first_segment, second_segment, 0),
             }
         }
-    } else {
-        (first_segment, second_segment, 0)
+    } else {
+        (first_segment, second_segment, 0)
     };
 
-    let (pre_dec_draft, post_dec_draft, dec_place_chg) =
-        round_terminal_digit(pre_dec_unrounded, post_dec_unrounded, last_dec_place - 1);
-    f.post_decimal = Some(post_dec_draft);
-    if let Some(capitalized) = sci_mode {
-        let si_ind = if capitalized { 'E' } else { 'e' };
-        // Increase the mantissa if we're adding a decimal place
-        if dec_place_chg {
-            mantissa += 1;
+    let (pre_dec_draft, post_dec_draft, dec_place_chg) =
+        round_terminal_digit(pre_dec_unrounded, post_dec_unrounded, last_dec_place - 1);
+    f.post_decimal = Some(post_dec_draft);
+    if let Some(capitalized) = sci_mode {
+        let si_ind = if capitalized { 'E' } else { 'e' };
+        // Increase the mantissa if we're adding a decimal place
+        if dec_place_chg {
+            mantissa += 1;
         }
-        f.suffix = Some(if mantissa >= 0 {
-            format!("{}+{:02}", si_ind, mantissa)
-        } else {
-            // negative sign is considered in format!s
-            // leading zeroes
-            format!("{}{:03}", si_ind, mantissa)
+        f.suffix = Some(if mantissa >= 0 {
+            format!("{}+{:02}", si_ind, mantissa)
+        } else {
+            // negative sign is considered in format!s
+            // leading zeroes
+            format!("{}{:03}", si_ind, mantissa)
         });
-        f.pre_decimal = Some(pre_dec_draft);
-    } else if dec_place_chg {
-        // We've rounded up to a new decimal place so append 0
-        f.pre_decimal = Some(pre_dec_draft + "0");
-    } else {
-        f.pre_decimal = Some(pre_dec_draft);
+        f.pre_decimal = Some(pre_dec_draft);
+    } else if dec_place_chg {
+        // We've rounded up to a new decimal place so append 0
+        f.pre_decimal = Some(pre_dec_draft + "0");
+    } else {
+        f.pre_decimal = Some(pre_dec_draft);
     }
 
-    f
+    f
 }
 
-pub fn primitive_to_str_common(prim: &FormatPrimitive, field: &FormatField) -> String {
-    let mut final_str = String::new();
-    if let Some(ref prefix) = prim.prefix {
-        final_str.push_str(prefix);
+pub fn primitive_to_str_common(prim: &FormatPrimitive, field: &FormatField) -> String {
+    let mut final_str = String::new();
+    if let Some(ref prefix) = prim.prefix {
+        final_str.push_str(prefix);
     }
-    match prim.pre_decimal {
-        Some(ref pre_decimal) => {
-            final_str.push_str(pre_decimal);
+    match prim.pre_decimal {
+        Some(ref pre_decimal) => {
+            final_str.push_str(pre_decimal);
         }
-        None => {
+        None => {
             panic!(
                 "error, format primitives provided to int, will, incidentally under correct \
-                 behavior, always have a pre_dec value."
-            );
+                 behavior, always have a pre_dec value."
+            );
         }
     }
-    let decimal_places = field.second_field.unwrap_or(6);
-    match prim.post_decimal {
-        Some(ref post_decimal) => {
-            if !post_decimal.is_empty() && decimal_places > 0 {
-                final_str.push('.');
-                let len_avail = post_decimal.len() as u32;
+    let decimal_places = field.second_field.unwrap_or(6);
+    match prim.post_decimal {
+        Some(ref post_decimal) => {
+            if !post_decimal.is_empty() && decimal_places > 0 {
+                final_str.push('.');
+                let len_avail = post_decimal.len() as u32;
 
-                if decimal_places >= len_avail {
-                    // println!("dec {}, len avail {}", decimal_places, len_avail);
-                    final_str.push_str(post_decimal);
+                if decimal_places >= len_avail {
+                    // println!("dec {}, len avail {}", decimal_places, len_avail);
+                    final_str.push_str(post_decimal);
 
-                    if *field.field_char != 'g' && *field.field_char != 'G' {
-                        let diff = decimal_places - len_avail;
-                        for _ in 0..diff {
-                            final_str.push('0');
+                    if *field.field_char != 'g' && *field.field_char != 'G' {
+                        let diff = decimal_places - len_avail;
+                        for _ in 0..diff {
+                            final_str.push('0');
                         }
                     }
-                } else {
-                    // println!("printing to only {}", decimal_places);
-                    final_str.push_str(&post_decimal[0..decimal_places as usize]);
+                } else {
+                    // println!("printing to only {}", decimal_places);
+                    final_str.push_str(&post_decimal[0..decimal_places as usize]);
                 }
             }
         }
-        None => {
+        None => {
             panic!(
                 "error, format primitives provided to int, will, incidentally under correct \
-                 behavior, always have a pre_dec value."
-            );
+                 behavior, always have a pre_dec value."
+            );
         }
     }
-    if let Some(ref suffix) = prim.suffix {
-        final_str.push_str(suffix);
+    if let Some(ref suffix) = prim.suffix {
+        final_str.push_str(suffix);
     }
 
-    final_str
+    final_str
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatters/floatf.rs.html b/dev/src/uucore/features/tokenize/num_format/formatters/floatf.rs.html index bf94548f6..860b2dfeb 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatters/floatf.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatters/floatf.rs.html @@ -1,4 +1,4 @@ -floatf.rs - source
1
+floatf.rs - source
1
 2
 3
 4
@@ -41,48 +41,48 @@
 41
 42
 43
-
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
-// spell-checker:ignore (ToDO) arrnum
+
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
+// spell-checker:ignore (ToDO) arrnum
 
-//! formatter for %f %F common-notation floating-point subs
-use super::super::format_field::FormatField;
-use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix};
-use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis};
+//! formatter for %f %F common-notation floating-point subs
+use super::super::format_field::FormatField;
+use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix};
+use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis};
 
-#[derive(Default)]
-pub struct Floatf;
-impl Floatf {
-    pub fn new() -> Self {
-        Self::default()
+#[derive(Default)]
+pub struct Floatf;
+impl Floatf {
+    pub fn new() -> Self {
+        Self::default()
     }
 }
-impl Formatter for Floatf {
-    fn get_primitive(
+impl Formatter for Floatf {
+    fn get_primitive(
         &self,
-        field: &FormatField,
-        initial_prefix: &InitialPrefix,
-        str_in: &str,
-    ) -> Option<FormatPrimitive> {
-        let second_field = field.second_field.unwrap_or(6) + 1;
-        let analysis = FloatAnalysis::analyze(
-            str_in,
-            initial_prefix,
+        field: &FormatField,
+        initial_prefix: &InitialPrefix,
+        str_in: &str,
+    ) -> Option<FormatPrimitive> {
+        let second_field = field.second_field.unwrap_or(6) + 1;
+        let analysis = FloatAnalysis::analyze(
+            str_in,
+            initial_prefix,
             None,
-            Some(second_field as usize),
+            Some(second_field as usize),
             false,
         );
-        let f = get_primitive_dec(
-            initial_prefix,
-            &str_in[initial_prefix.offset..],
-            &analysis,
-            second_field as usize,
+        let f = get_primitive_dec(
+            initial_prefix,
+            &str_in[initial_prefix.offset..],
+            &analysis,
+            second_field as usize,
             None,
         );
-        Some(f)
+        Some(f)
     }
-    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
-        primitive_to_str_common(prim, &field)
+    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
+        primitive_to_str_common(prim, &field)
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatters/intf.rs.html b/dev/src/uucore/features/tokenize/num_format/formatters/intf.rs.html index 1e8a7334c..ecd842943 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatters/intf.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatters/intf.rs.html @@ -1,4 +1,4 @@ -intf.rs - source
1
+intf.rs - source
1
 2
 3
 4
@@ -279,286 +279,286 @@
 279
 280
 281
-
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
-// spell-checker:ignore (ToDO) arrnum
+
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
+// spell-checker:ignore (ToDO) arrnum
 
-//! formatter for unsigned and signed int subs
-//! unsigned int: %X %x (hex u64) %o (octal u64) %u (base ten u64)
-//! signed int: %i %d (both base ten i64)
-use super::super::format_field::FormatField;
-use super::super::formatter::{
-    get_it_at, warn_incomplete_conv, Base, FormatPrimitive, Formatter, InitialPrefix,
+//! formatter for unsigned and signed int subs
+//! unsigned int: %X %x (hex u64) %o (octal u64) %u (base ten u64)
+//! signed int: %i %d (both base ten i64)
+use super::super::format_field::FormatField;
+use super::super::formatter::{
+    get_it_at, warn_incomplete_conv, Base, FormatPrimitive, Formatter, InitialPrefix,
 };
-use std::i64;
-use std::u64;
+use std::i64;
+use std::u64;
 
-#[derive(Default)]
-pub struct Intf {
-    _a: u32,
+#[derive(Default)]
+pub struct Intf {
+    _a: u32,
 }
 
-// see the Intf::analyze() function below
-struct IntAnalysis {
-    check_past_max: bool,
-    past_max: bool,
-    is_zero: bool,
-    len_digits: u8,
+// see the Intf::analyze() function below
+struct IntAnalysis {
+    check_past_max: bool,
+    past_max: bool,
+    is_zero: bool,
+    len_digits: u8,
 }
 
-impl Intf {
-    pub fn new() -> Self {
-        Self::default()
+impl Intf {
+    pub fn new() -> Self {
+        Self::default()
     }
-    // take a ref to argument string, and basic information
-    // about prefix (offset, radix, sign), and analyze string
-    // to gain the IntAnalysis information above
-    // check_past_max: true if the number *may* be above max,
-    //   but we don't know either way. One of several reasons
-    //   we may have to parse as int.
-    // past_max: true if the object is past max, false if not
-    //  in the future we should probably combine these into an
-    //  Option<bool>
-    // is_zero: true if number is zero, false otherwise
-    // len_digits: length of digits used to create the int
-    //   important, for example, if we run into a non-valid character
-    fn analyze(str_in: &str, signed_out: bool, initial_prefix: &InitialPrefix) -> IntAnalysis {
-        // the maximum number of digits we could conceivably
-        // have before the decimal point without exceeding the
-        // max
-        let mut str_it = get_it_at(initial_prefix.offset, str_in);
-        let max_sd_in = if signed_out {
-            match initial_prefix.radix_in {
-                Base::Ten => 19,
-                Base::Octal => 21,
-                Base::Hex => 16,
+    // take a ref to argument string, and basic information
+    // about prefix (offset, radix, sign), and analyze string
+    // to gain the IntAnalysis information above
+    // check_past_max: true if the number *may* be above max,
+    //   but we don't know either way. One of several reasons
+    //   we may have to parse as int.
+    // past_max: true if the object is past max, false if not
+    //  in the future we should probably combine these into an
+    //  Option<bool>
+    // is_zero: true if number is zero, false otherwise
+    // len_digits: length of digits used to create the int
+    //   important, for example, if we run into a non-valid character
+    fn analyze(str_in: &str, signed_out: bool, initial_prefix: &InitialPrefix) -> IntAnalysis {
+        // the maximum number of digits we could conceivably
+        // have before the decimal point without exceeding the
+        // max
+        let mut str_it = get_it_at(initial_prefix.offset, str_in);
+        let max_sd_in = if signed_out {
+            match initial_prefix.radix_in {
+                Base::Ten => 19,
+                Base::Octal => 21,
+                Base::Hex => 16,
             }
-        } else {
-            match initial_prefix.radix_in {
-                Base::Ten => 20,
-                Base::Octal => 22,
-                Base::Hex => 16,
+        } else {
+            match initial_prefix.radix_in {
+                Base::Ten => 20,
+                Base::Octal => 22,
+                Base::Hex => 16,
             }
         };
-        let mut ret = IntAnalysis {
-            check_past_max: false,
-            past_max: false,
-            is_zero: false,
-            len_digits: 0,
+        let mut ret = IntAnalysis {
+            check_past_max: false,
+            past_max: false,
+            is_zero: false,
+            len_digits: 0,
         };
 
-        // todo turn this to a while let now that we know
-        // no special behavior on EOI break
-        loop {
-            let c_opt = str_it.next();
-            if let Some(c) = c_opt {
-                match c {
-                    '0'..='9' | 'a'..='f' | 'A'..='F' => {
-                        if ret.len_digits == 0 && c == '0' {
-                            ret.is_zero = true;
-                        } else if ret.is_zero {
-                            ret.is_zero = false;
+        // todo turn this to a while let now that we know
+        // no special behavior on EOI break
+        loop {
+            let c_opt = str_it.next();
+            if let Some(c) = c_opt {
+                match c {
+                    '0'..='9' | 'a'..='f' | 'A'..='F' => {
+                        if ret.len_digits == 0 && c == '0' {
+                            ret.is_zero = true;
+                        } else if ret.is_zero {
+                            ret.is_zero = false;
                         }
-                        ret.len_digits += 1;
-                        if ret.len_digits == max_sd_in {
-                            if let Some(next_ch) = str_it.next() {
-                                match next_ch {
-                                    '0'..='9' => {
-                                        ret.past_max = true;
+                        ret.len_digits += 1;
+                        if ret.len_digits == max_sd_in {
+                            if let Some(next_ch) = str_it.next() {
+                                match next_ch {
+                                    '0'..='9' => {
+                                        ret.past_max = true;
                                     }
-                                    _ => {
-                                        // force conversion
-                                        // to check if its above max.
-                                        // todo: spin out convert
-                                        // into fn, call it here to try
-                                        // read val, on Ok()
-                                        // save val for reuse later
-                                        // that way on same-base in and out
-                                        // we don't needlessly convert int
-                                        // to str, we can just copy it over.
-                                        ret.check_past_max = true;
-                                        str_it.put_back(next_ch);
+                                    _ => {
+                                        // force conversion
+                                        // to check if its above max.
+                                        // todo: spin out convert
+                                        // into fn, call it here to try
+                                        // read val, on Ok()
+                                        // save val for reuse later
+                                        // that way on same-base in and out
+                                        // we don't needlessly convert int
+                                        // to str, we can just copy it over.
+                                        ret.check_past_max = true;
+                                        str_it.put_back(next_ch);
                                     }
                                 }
-                                if ret.past_max {
+                                if ret.past_max {
                                     break;
                                 }
-                            } else {
-                                ret.check_past_max = true;
+                            } else {
+                                ret.check_past_max = true;
                             }
                         }
                     }
-                    _ => {
-                        warn_incomplete_conv(str_in);
+                    _ => {
+                        warn_incomplete_conv(str_in);
                         break;
                     }
                 }
-            } else {
-                // breaks on EOL
-                break;
+            } else {
+                // breaks on EOL
+                break;
             }
         }
-        ret
+        ret
     }
-    // get a FormatPrimitive of the maximum value for the field char
-    //  and given sign
-    fn get_max(field_char: char, sign: i8) -> FormatPrimitive {
-        let mut fmt_primitive: FormatPrimitive = Default::default();
-        fmt_primitive.pre_decimal = Some(String::from(match field_char {
-            'd' | 'i' => match sign {
-                1 => "9223372036854775807",
-                _ => {
-                    fmt_primitive.prefix = Some(String::from("-"));
-                    "9223372036854775808"
-                }
+    // get a FormatPrimitive of the maximum value for the field char
+    //  and given sign
+    fn get_max(field_char: char, sign: i8) -> FormatPrimitive {
+        let mut fmt_primitive: FormatPrimitive = Default::default();
+        fmt_primitive.pre_decimal = Some(String::from(match field_char {
+            'd' | 'i' => match sign {
+                1 => "9223372036854775807",
+                _ => {
+                    fmt_primitive.prefix = Some(String::from("-"));
+                    "9223372036854775808"
+                }
             },
-            'x' | 'X' => "ffffffffffffffff",
-            'o' => "1777777777777777777777",
-            /* 'u' | */ _ => "18446744073709551615",
+            'x' | 'X' => "ffffffffffffffff",
+            'o' => "1777777777777777777777",
+            /* 'u' | */ _ => "18446744073709551615",
         }));
-        fmt_primitive
+        fmt_primitive
     }
-    // conv_from_segment contract:
-    // 1. takes
-    // - a string that begins with a non-zero digit, and proceeds
-    //  with zero or more following digits until the end of the string
-    // - a radix to interpret those digits as
-    // - a char that communicates:
-    //     whether to interpret+output the string as an i64 or u64
-    //     what radix to write the parsed number as.
-    // 2. parses it as a rust integral type
-    // 3. outputs FormatPrimitive with:
-    // - if the string falls within bounds:
-    //   number parsed and written in the correct radix
-    // - if the string falls outside bounds:
-    //   for i64 output, the int minimum or int max (depending on sign)
-    //   for u64 output, the u64 max in the output radix
-    fn conv_from_segment(
-        segment: &str,
-        radix_in: Base,
-        field_char: char,
-        sign: i8,
-    ) -> FormatPrimitive {
-        match field_char {
-            'i' | 'd' => match i64::from_str_radix(segment, radix_in as u32) {
-                Ok(i) => {
-                    let mut fmt_prim: FormatPrimitive = Default::default();
-                    if sign == -1 {
-                        fmt_prim.prefix = Some(String::from("-"));
+    // conv_from_segment contract:
+    // 1. takes
+    // - a string that begins with a non-zero digit, and proceeds
+    //  with zero or more following digits until the end of the string
+    // - a radix to interpret those digits as
+    // - a char that communicates:
+    //     whether to interpret+output the string as an i64 or u64
+    //     what radix to write the parsed number as.
+    // 2. parses it as a rust integral type
+    // 3. outputs FormatPrimitive with:
+    // - if the string falls within bounds:
+    //   number parsed and written in the correct radix
+    // - if the string falls outside bounds:
+    //   for i64 output, the int minimum or int max (depending on sign)
+    //   for u64 output, the u64 max in the output radix
+    fn conv_from_segment(
+        segment: &str,
+        radix_in: Base,
+        field_char: char,
+        sign: i8,
+    ) -> FormatPrimitive {
+        match field_char {
+            'i' | 'd' => match i64::from_str_radix(segment, radix_in as u32) {
+                Ok(i) => {
+                    let mut fmt_prim: FormatPrimitive = Default::default();
+                    if sign == -1 {
+                        fmt_prim.prefix = Some(String::from("-"));
                     }
-                    fmt_prim.pre_decimal = Some(format!("{}", i));
-                    fmt_prim
+                    fmt_prim.pre_decimal = Some(format!("{}", i));
+                    fmt_prim
                 }
-                Err(_) => Self::get_max(field_char, sign),
+                Err(_) => Self::get_max(field_char, sign),
             },
-            _ => match u64::from_str_radix(segment, radix_in as u32) {
-                Ok(u) => {
-                    let mut fmt_prim: FormatPrimitive = Default::default();
-                    let u_f = if sign == -1 { u64::MAX - (u - 1) } else { u };
-                    fmt_prim.pre_decimal = Some(match field_char {
-                        'X' => format!("{:X}", u_f),
-                        'x' => format!("{:x}", u_f),
-                        'o' => format!("{:o}", u_f),
-                        _ => format!("{}", u_f),
+            _ => match u64::from_str_radix(segment, radix_in as u32) {
+                Ok(u) => {
+                    let mut fmt_prim: FormatPrimitive = Default::default();
+                    let u_f = if sign == -1 { u64::MAX - (u - 1) } else { u };
+                    fmt_prim.pre_decimal = Some(match field_char {
+                        'X' => format!("{:X}", u_f),
+                        'x' => format!("{:x}", u_f),
+                        'o' => format!("{:o}", u_f),
+                        _ => format!("{}", u_f),
                     });
-                    fmt_prim
+                    fmt_prim
                 }
-                Err(_) => Self::get_max(field_char, sign),
+                Err(_) => Self::get_max(field_char, sign),
             },
         }
     }
 }
-impl Formatter for Intf {
-    fn get_primitive(
+impl Formatter for Intf {
+    fn get_primitive(
         &self,
-        field: &FormatField,
-        initial_prefix: &InitialPrefix,
-        str_in: &str,
-    ) -> Option<FormatPrimitive> {
-        let begin = initial_prefix.offset;
+        field: &FormatField,
+        initial_prefix: &InitialPrefix,
+        str_in: &str,
+    ) -> Option<FormatPrimitive> {
+        let begin = initial_prefix.offset;
 
-        // get information about the string. see Intf::Analyze
-        // def above.
-        let convert_hints = Self::analyze(
-            str_in,
-            *field.field_char == 'i' || *field.field_char == 'd',
-            initial_prefix,
+        // get information about the string. see Intf::Analyze
+        // def above.
+        let convert_hints = Self::analyze(
+            str_in,
+            *field.field_char == 'i' || *field.field_char == 'd',
+            initial_prefix,
         );
-        // We always will have a format primitive to return
-        Some(if convert_hints.len_digits == 0 || convert_hints.is_zero {
-            // if non-digit or end is reached before a non-zero digit
-            FormatPrimitive {
-                pre_decimal: Some(String::from("0")),
-                ..Default::default()
+        // We always will have a format primitive to return
+        Some(if convert_hints.len_digits == 0 || convert_hints.is_zero {
+            // if non-digit or end is reached before a non-zero digit
+            FormatPrimitive {
+                pre_decimal: Some(String::from("0")),
+                ..Default::default()
             }
-        } else if !convert_hints.past_max {
-            // if the number is or may be below the bounds limit
-            let radix_out = match *field.field_char {
-                'd' | 'i' | 'u' => Base::Ten,
-                'x' | 'X' => Base::Hex,
-                /* 'o' | */ _ => Base::Octal,
+        } else if !convert_hints.past_max {
+            // if the number is or may be below the bounds limit
+            let radix_out = match *field.field_char {
+                'd' | 'i' | 'u' => Base::Ten,
+                'x' | 'X' => Base::Hex,
+                /* 'o' | */ _ => Base::Octal,
             };
-            let radix_mismatch = !radix_out.eq(&initial_prefix.radix_in);
-            let decrease_from_max: bool = initial_prefix.sign == -1 && *field.field_char != 'i';
-            let end = begin + convert_hints.len_digits as usize;
+            let radix_mismatch = !radix_out.eq(&initial_prefix.radix_in);
+            let decrease_from_max: bool = initial_prefix.sign == -1 && *field.field_char != 'i';
+            let end = begin + convert_hints.len_digits as usize;
 
-            // convert to int if any one of these is true:
-            // - number of digits in int indicates it may be past max
-            // - we're subtracting from the max
-            // - we're converting the base
-            if convert_hints.check_past_max || decrease_from_max || radix_mismatch {
-                // radix of in and out is the same.
-                let segment = String::from(&str_in[begin..end]);
-                Self::conv_from_segment(
-                    &segment,
-                    initial_prefix.radix_in.clone(),
-                    *field.field_char,
-                    initial_prefix.sign,
+            // convert to int if any one of these is true:
+            // - number of digits in int indicates it may be past max
+            // - we're subtracting from the max
+            // - we're converting the base
+            if convert_hints.check_past_max || decrease_from_max || radix_mismatch {
+                // radix of in and out is the same.
+                let segment = String::from(&str_in[begin..end]);
+                Self::conv_from_segment(
+                    &segment,
+                    initial_prefix.radix_in.clone(),
+                    *field.field_char,
+                    initial_prefix.sign,
                 )
-            } else {
-                // otherwise just do a straight string copy.
-                let mut fmt_prim: FormatPrimitive = Default::default();
+            } else {
+                // otherwise just do a straight string copy.
+                let mut fmt_prim: FormatPrimitive = Default::default();
 
-                // this is here and not earlier because
-                // zero doesn't get a sign, and conv_from_segment
-                // creates its format primitive separately
-                if initial_prefix.sign == -1 && *field.field_char == 'i' {
-                    fmt_prim.prefix = Some(String::from("-"));
+                // this is here and not earlier because
+                // zero doesn't get a sign, and conv_from_segment
+                // creates its format primitive separately
+                if initial_prefix.sign == -1 && *field.field_char == 'i' {
+                    fmt_prim.prefix = Some(String::from("-"));
                 }
-                fmt_prim.pre_decimal = Some(String::from(&str_in[begin..end]));
-                fmt_prim
+                fmt_prim.pre_decimal = Some(String::from(&str_in[begin..end]));
+                fmt_prim
             }
-        } else {
-            Self::get_max(*field.field_char, initial_prefix.sign)
+        } else {
+            Self::get_max(*field.field_char, initial_prefix.sign)
         })
     }
-    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
-        let mut final_str: String = String::new();
-        if let Some(ref prefix) = prim.prefix {
-            final_str.push_str(prefix);
+    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
+        let mut final_str: String = String::new();
+        if let Some(ref prefix) = prim.prefix {
+            final_str.push_str(prefix);
         }
-        // integral second fields is zero-padded minimum-width
-        // which gets handled before general minimum-width
-        match prim.pre_decimal {
-            Some(ref pre_decimal) => {
-                if let Some(min) = field.second_field {
-                    let mut i = min;
-                    let len = pre_decimal.len() as u32;
-                    while i > len {
-                        final_str.push('0');
-                        i -= 1;
+        // integral second fields is zero-padded minimum-width
+        // which gets handled before general minimum-width
+        match prim.pre_decimal {
+            Some(ref pre_decimal) => {
+                if let Some(min) = field.second_field {
+                    let mut i = min;
+                    let len = pre_decimal.len() as u32;
+                    while i > len {
+                        final_str.push('0');
+                        i -= 1;
                     }
                 }
-                final_str.push_str(pre_decimal);
+                final_str.push_str(pre_decimal);
             }
-            None => {
+            None => {
                 panic!(
                     "error, format primitives provided to int, will, incidentally under \
-                     correct behavior, always have a pre_dec value."
-                );
+                     correct behavior, always have a pre_dec value."
+                );
             }
         }
-        final_str
+        final_str
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatters/mod.rs.html b/dev/src/uucore/features/tokenize/num_format/formatters/mod.rs.html index f7d6b95bb..cc18fddcd 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatters/mod.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatters/mod.rs.html @@ -1,4 +1,4 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
@@ -7,14 +7,14 @@
 7
 8
 9
-
// spell-checker:ignore (vars) charf cninetyninehexfloatf decf floatf intf scif strf Cninety
+
// spell-checker:ignore (vars) charf cninetyninehexfloatf decf floatf intf scif strf Cninety
 
-mod base_conv;
-pub mod cninetyninehexfloatf;
-pub mod decf;
-mod float_common;
-pub mod floatf;
-pub mod intf;
-pub mod scif;
+mod base_conv;
+pub mod cninetyninehexfloatf;
+pub mod decf;
+mod float_common;
+pub mod floatf;
+pub mod intf;
+pub mod scif;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/formatters/scif.rs.html b/dev/src/uucore/features/tokenize/num_format/formatters/scif.rs.html index 2dce4abb7..cb1d9eb70 100644 --- a/dev/src/uucore/features/tokenize/num_format/formatters/scif.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/formatters/scif.rs.html @@ -1,4 +1,4 @@ -scif.rs - source
1
+scif.rs - source
1
 2
 3
 4
@@ -41,48 +41,48 @@
 41
 42
 43
-
// spell-checker:ignore (vars) charf cninetyninehexfloatf decf floatf intf scif strf Cninety
+
// spell-checker:ignore (vars) charf cninetyninehexfloatf decf floatf intf scif strf Cninety
 
-//! formatter for %e %E scientific notation subs
-use super::super::format_field::FormatField;
-use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix};
-use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis};
+//! formatter for %e %E scientific notation subs
+use super::super::format_field::FormatField;
+use super::super::formatter::{FormatPrimitive, Formatter, InitialPrefix};
+use super::float_common::{get_primitive_dec, primitive_to_str_common, FloatAnalysis};
 
-#[derive(Default)]
-pub struct Scif;
+#[derive(Default)]
+pub struct Scif;
 
-impl Scif {
-    pub fn new() -> Self {
-        Self::default()
+impl Scif {
+    pub fn new() -> Self {
+        Self::default()
     }
 }
-impl Formatter for Scif {
-    fn get_primitive(
+impl Formatter for Scif {
+    fn get_primitive(
         &self,
-        field: &FormatField,
-        initial_prefix: &InitialPrefix,
-        str_in: &str,
-    ) -> Option<FormatPrimitive> {
-        let second_field = field.second_field.unwrap_or(6) + 1;
-        let analysis = FloatAnalysis::analyze(
-            str_in,
-            initial_prefix,
-            Some(second_field as usize + 1),
+        field: &FormatField,
+        initial_prefix: &InitialPrefix,
+        str_in: &str,
+    ) -> Option<FormatPrimitive> {
+        let second_field = field.second_field.unwrap_or(6) + 1;
+        let analysis = FloatAnalysis::analyze(
+            str_in,
+            initial_prefix,
+            Some(second_field as usize + 1),
             None,
             false,
         );
-        let f = get_primitive_dec(
-            initial_prefix,
-            &str_in[initial_prefix.offset..],
-            &analysis,
-            second_field as usize,
-            Some(*field.field_char == 'E'),
+        let f = get_primitive_dec(
+            initial_prefix,
+            &str_in[initial_prefix.offset..],
+            &analysis,
+            second_field as usize,
+            Some(*field.field_char == 'E'),
         );
-        Some(f)
+        Some(f)
     }
-    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
-        primitive_to_str_common(prim, &field)
+    fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
+        primitive_to_str_common(prim, &field)
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/mod.rs.html b/dev/src/uucore/features/tokenize/num_format/mod.rs.html index 699e696aa..1befb1d55 100644 --- a/dev/src/uucore/features/tokenize/num_format/mod.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/mod.rs.html @@ -1,10 +1,10 @@ -mod.rs - source
1
+mod.rs - source
1
 2
 3
 4
-
pub mod format_field;
-mod formatter;
-mod formatters;
-pub mod num_format;
+
pub mod format_field;
+mod formatter;
+mod formatters;
+pub mod num_format;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/num_format/num_format.rs.html b/dev/src/uucore/features/tokenize/num_format/num_format.rs.html index 518b8b284..b1b47d4d2 100644 --- a/dev/src/uucore/features/tokenize/num_format/num_format.rs.html +++ b/dev/src/uucore/features/tokenize/num_format/num_format.rs.html @@ -1,4 +1,4 @@ -num_format.rs - source
1
+num_format.rs - source
1
 2
 3
 4
@@ -268,275 +268,275 @@
 268
 269
 270
-
// spell-checker:ignore (vars) charf cninetyninehexfloatf decf floatf intf scif strf Cninety
+
// spell-checker:ignore (vars) charf cninetyninehexfloatf decf floatf intf scif strf Cninety
 
-//! handles creating printed output for numeric substitutions
+//! handles creating printed output for numeric substitutions
 
-// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
+// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
 
-use std::env;
-use std::vec::Vec;
+use std::env;
+use std::vec::Vec;
 
-use crate::display::Quotable;
-use crate::{show_error, show_warning};
+use crate::display::Quotable;
+use crate::{show_error, show_warning};
 
-use super::format_field::{FieldType, FormatField};
-use super::formatter::{Base, FormatPrimitive, Formatter, InitialPrefix};
-use super::formatters::cninetyninehexfloatf::CninetyNineHexFloatf;
-use super::formatters::decf::Decf;
-use super::formatters::floatf::Floatf;
-use super::formatters::intf::Intf;
-use super::formatters::scif::Scif;
+use super::format_field::{FieldType, FormatField};
+use super::formatter::{Base, FormatPrimitive, Formatter, InitialPrefix};
+use super::formatters::cninetyninehexfloatf::CninetyNineHexFloatf;
+use super::formatters::decf::Decf;
+use super::formatters::floatf::Floatf;
+use super::formatters::intf::Intf;
+use super::formatters::scif::Scif;
 
-pub fn warn_expected_numeric(pf_arg: &str) {
-    // important: keep println here not print
-    show_error!("{}: expected a numeric value", pf_arg.maybe_quote());
+pub fn warn_expected_numeric(pf_arg: &str) {
+    // important: keep println here not print
+    show_error!("{}: expected a numeric value", pf_arg.maybe_quote());
 }
 
-// when character constant arguments have excess characters
-// issue a warning when POSIXLY_CORRECT is not set
-fn warn_char_constant_ign(remaining_bytes: &[u8]) {
-    match env::var("POSIXLY_CORRECT") {
+// when character constant arguments have excess characters
+// issue a warning when POSIXLY_CORRECT is not set
+fn warn_char_constant_ign(remaining_bytes: &[u8]) {
+    match env::var("POSIXLY_CORRECT") {
         Ok(_) => {}
-        Err(e) => {
-            if let env::VarError::NotPresent = e {
+        Err(e) => {
+            if let env::VarError::NotPresent = e {
                 show_warning!(
                     "{:?}: character(s) following character \
                      constant have been ignored",
-                    remaining_bytes
+                    remaining_bytes
                 );
             }
         }
     }
 }
 
-// this function looks at the first few
-// characters of an argument and returns a value if we can learn
-// a value from that (e.g. no argument? return 0, char constant? ret value)
-fn get_provided(str_in_opt: Option<&String>) -> Option<u8> {
-    const C_S_QUOTE: u8 = 39;
-    const C_D_QUOTE: u8 = 34;
-    match str_in_opt {
-        Some(str_in) => {
-            let mut byte_it = str_in.bytes();
-            if let Some(ch) = byte_it.next() {
-                match ch {
-                    C_S_QUOTE | C_D_QUOTE => {
-                        Some(match byte_it.next() {
-                            Some(second_byte) => {
-                                let mut ignored: Vec<u8> = Vec::new();
-                                for cont in byte_it {
-                                    ignored.push(cont);
+// this function looks at the first few
+// characters of an argument and returns a value if we can learn
+// a value from that (e.g. no argument? return 0, char constant? ret value)
+fn get_provided(str_in_opt: Option<&String>) -> Option<u8> {
+    const C_S_QUOTE: u8 = 39;
+    const C_D_QUOTE: u8 = 34;
+    match str_in_opt {
+        Some(str_in) => {
+            let mut byte_it = str_in.bytes();
+            if let Some(ch) = byte_it.next() {
+                match ch {
+                    C_S_QUOTE | C_D_QUOTE => {
+                        Some(match byte_it.next() {
+                            Some(second_byte) => {
+                                let mut ignored: Vec<u8> = Vec::new();
+                                for cont in byte_it {
+                                    ignored.push(cont);
                                 }
-                                if !ignored.is_empty() {
-                                    warn_char_constant_ign(&ignored);
+                                if !ignored.is_empty() {
+                                    warn_char_constant_ign(&ignored);
                                 }
-                                second_byte as u8
-                            }
-                            // no byte after quote
-                            None => {
-                                let so_far = (ch as u8 as char).to_string();
-                                warn_expected_numeric(&so_far);
-                                0_u8
+                                second_byte as u8
                             }
+                            // no byte after quote
+                            None => {
+                                let so_far = (ch as u8 as char).to_string();
+                                warn_expected_numeric(&so_far);
+                                0_u8
+                            }
                         })
                     }
-                    // first byte is not quote
-                    _ => None, // no first byte
-                }
-            } else {
+                    // first byte is not quote
+                    _ => None, // no first byte
+                }
+            } else {
                 Some(0_u8)
             }
         }
-        None => Some(0),
+        None => Some(0),
     }
 }
 
-// takes a string and returns
-// a sign,
-// a base,
-// and an offset for index after all
-//  initial spacing, sign, base prefix, and leading zeroes
-fn get_initial_prefix(str_in: &str, field_type: &FieldType) -> InitialPrefix {
-    let mut str_it = str_in.chars();
-    let mut ret = InitialPrefix {
-        radix_in: Base::Ten,
-        sign: 1,
-        offset: 0,
+// takes a string and returns
+// a sign,
+// a base,
+// and an offset for index after all
+//  initial spacing, sign, base prefix, and leading zeroes
+fn get_initial_prefix(str_in: &str, field_type: &FieldType) -> InitialPrefix {
+    let mut str_it = str_in.chars();
+    let mut ret = InitialPrefix {
+        radix_in: Base::Ten,
+        sign: 1,
+        offset: 0,
     };
-    let mut top_char = str_it.next();
-    // skip spaces and ensure top_char is the first non-space char
-    // (or None if none exists)
-    while let Some(' ') = top_char {
-        ret.offset += 1;
-        top_char = str_it.next();
+    let mut top_char = str_it.next();
+    // skip spaces and ensure top_char is the first non-space char
+    // (or None if none exists)
+    while let Some(' ') = top_char {
+        ret.offset += 1;
+        top_char = str_it.next();
     }
-    // parse sign
-    match top_char {
+    // parse sign
+    match top_char {
         Some('+') => {
-            ret.offset += 1;
-            top_char = str_it.next();
+            ret.offset += 1;
+            top_char = str_it.next();
         }
         Some('-') => {
-            ret.sign = -1;
-            ret.offset += 1;
-            top_char = str_it.next();
+            ret.sign = -1;
+            ret.offset += 1;
+            top_char = str_it.next();
         }
-        _ => {}
+        _ => {}
     }
-    // we want to exit with offset being
-    // the index of the first non-zero
-    // digit before the decimal point or
-    // if there is none, the zero before the
-    // decimal point, or, if there is none,
-    // the decimal point.
+    // we want to exit with offset being
+    // the index of the first non-zero
+    // digit before the decimal point or
+    // if there is none, the zero before the
+    // decimal point, or, if there is none,
+    // the decimal point.
 
-    // while we are determining the offset
-    // we will ensure as a convention
-    // the offset is always on the first character
-    // that we are yet unsure if it is the
-    // final offset. If the zero could be before
-    // a decimal point we don't move past the zero.
-    let mut is_hex = false;
-    if Some('0') == top_char {
-        if let Some(base) = str_it.next() {
-            // lead zeroes can only exist in
-            // octal and hex base
-            let mut do_clean_lead_zeroes = false;
-            match base {
-                'x' | 'X' => {
-                    is_hex = true;
-                    ret.offset += 2;
-                    ret.radix_in = Base::Hex;
-                    do_clean_lead_zeroes = true;
+    // while we are determining the offset
+    // we will ensure as a convention
+    // the offset is always on the first character
+    // that we are yet unsure if it is the
+    // final offset. If the zero could be before
+    // a decimal point we don't move past the zero.
+    let mut is_hex = false;
+    if Some('0') == top_char {
+        if let Some(base) = str_it.next() {
+            // lead zeroes can only exist in
+            // octal and hex base
+            let mut do_clean_lead_zeroes = false;
+            match base {
+                'x' | 'X' => {
+                    is_hex = true;
+                    ret.offset += 2;
+                    ret.radix_in = Base::Hex;
+                    do_clean_lead_zeroes = true;
                 }
-                e @ '0'..='9' => {
-                    ret.offset += 1;
-                    if let FieldType::Intf = *field_type {
-                        ret.radix_in = Base::Octal;
+                e @ '0'..='9' => {
+                    ret.offset += 1;
+                    if let FieldType::Intf = *field_type {
+                        ret.radix_in = Base::Octal;
                     }
-                    if e == '0' {
-                        do_clean_lead_zeroes = true;
+                    if e == '0' {
+                        do_clean_lead_zeroes = true;
                     }
                 }
-                _ => {}
+                _ => {}
             }
-            if do_clean_lead_zeroes {
-                let mut first = true;
-                for ch_zero in str_it {
-                    // see notes on offset above:
-                    // this is why the offset for octal and decimal numbers
-                    // that reach this branch is 1 even though
-                    // they have already eaten the characters '00'
-                    // this is also why when hex encounters its
-                    // first zero it does not move its offset
-                    // forward because it does not know for sure
-                    // that it's current offset (of that zero)
-                    // is not the final offset,
-                    // whereas at that point octal knows its
-                    // current offset is not the final offset.
-                    match ch_zero {
-                        '0' => {
-                            if !(is_hex && first) {
-                                ret.offset += 1;
+            if do_clean_lead_zeroes {
+                let mut first = true;
+                for ch_zero in str_it {
+                    // see notes on offset above:
+                    // this is why the offset for octal and decimal numbers
+                    // that reach this branch is 1 even though
+                    // they have already eaten the characters '00'
+                    // this is also why when hex encounters its
+                    // first zero it does not move its offset
+                    // forward because it does not know for sure
+                    // that it's current offset (of that zero)
+                    // is not the final offset,
+                    // whereas at that point octal knows its
+                    // current offset is not the final offset.
+                    match ch_zero {
+                        '0' => {
+                            if !(is_hex && first) {
+                                ret.offset += 1;
                             }
                         }
-                        // if decimal, keep last zero if one exists
-                        // (it's possible for last zero to
-                        // not exist at this branch if we're in hex input)
-                        '.' => break,
-                        // other digit, etc.
-                        _ => {
-                            if !(is_hex && first) {
-                                ret.offset += 1;
+                        // if decimal, keep last zero if one exists
+                        // (it's possible for last zero to
+                        // not exist at this branch if we're in hex input)
+                        '.' => break,
+                        // other digit, etc.
+                        _ => {
+                            if !(is_hex && first) {
+                                ret.offset += 1;
                             }
                             break;
                         }
                     }
-                    if first {
-                        first = false;
+                    if first {
+                        first = false;
                     }
                 }
             }
         }
     }
-    ret
+    ret
 }
 
-// this is the function a Sub's print will delegate to
-// if it is a numeric field, passing the field details
-// and an iterator to the argument
-pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option<String> {
-    let field_char = field.field_char;
+// this is the function a Sub's print will delegate to
+// if it is a numeric field, passing the field details
+// and an iterator to the argument
+pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option<String> {
+    let field_char = field.field_char;
 
-    // num format mainly operates by further delegating to one of
-    // several Formatter structs depending on the field
-    // see formatter.rs for more details
+    // num format mainly operates by further delegating to one of
+    // several Formatter structs depending on the field
+    // see formatter.rs for more details
 
-    // to do switch to static dispatch
-    let formatter: Box<dyn Formatter> = match *field.field_type {
-        FieldType::Intf => Box::new(Intf::new()),
-        FieldType::Floatf => Box::new(Floatf::new()),
-        FieldType::CninetyNineHexFloatf => Box::new(CninetyNineHexFloatf::new()),
-        FieldType::Scif => Box::new(Scif::new()),
-        FieldType::Decf => Box::new(Decf::new()),
-        _ => {
+    // to do switch to static dispatch
+    let formatter: Box<dyn Formatter> = match *field.field_type {
+        FieldType::Intf => Box::new(Intf::new()),
+        FieldType::Floatf => Box::new(Floatf::new()),
+        FieldType::CninetyNineHexFloatf => Box::new(CninetyNineHexFloatf::new()),
+        FieldType::Scif => Box::new(Scif::new()),
+        FieldType::Decf => Box::new(Decf::new()),
+        _ => {
             panic!("asked to do num format with non-num field type");
         }
     };
-    let prim_opt=
-        // if we can get an assumed value from looking at the first
-        // few characters, use that value to create the FormatPrimitive
-        if let Some(provided_num) = get_provided(in_str_opt) {
-            let mut tmp : FormatPrimitive = Default::default();
-            match field_char {
-                'u' | 'i' | 'd' => {
-                    tmp.pre_decimal = Some(
-                        format!("{}", provided_num));
+    let prim_opt=
+        // if we can get an assumed value from looking at the first
+        // few characters, use that value to create the FormatPrimitive
+        if let Some(provided_num) = get_provided(in_str_opt) {
+            let mut tmp : FormatPrimitive = Default::default();
+            match field_char {
+                'u' | 'i' | 'd' => {
+                    tmp.pre_decimal = Some(
+                        format!("{}", provided_num));
                 },
-                'x' | 'X' => {
-                    tmp.pre_decimal = Some(
-                        format!("{:x}", provided_num));
+                'x' | 'X' => {
+                    tmp.pre_decimal = Some(
+                        format!("{:x}", provided_num));
                 },
-                'o' => {
-                    tmp.pre_decimal = Some(
-                        format!("{:o}", provided_num));
+                'o' => {
+                    tmp.pre_decimal = Some(
+                        format!("{:o}", provided_num));
                 },
-                'e' | 'E' | 'g' | 'G' => {
-                    let as_str = format!("{}", provided_num);
-                    let initial_prefix = get_initial_prefix(
-                        &as_str,
-                        field.field_type
+                'e' | 'E' | 'g' | 'G' => {
+                    let as_str = format!("{}", provided_num);
+                    let initial_prefix = get_initial_prefix(
+                        &as_str,
+                        field.field_type
                     );
-                    tmp=formatter.get_primitive(field, &initial_prefix, &as_str)
-                        .expect("err during default provided num");
+                    tmp=formatter.get_primitive(field, &initial_prefix, &as_str)
+                        .expect("err during default provided num");
                 },
-                _ => {
-                    tmp.pre_decimal = Some(
-                        format!("{}", provided_num));
-                    tmp.post_decimal = Some(String::from("0"));
+                _ => {
+                    tmp.pre_decimal = Some(
+                        format!("{}", provided_num));
+                    tmp.post_decimal = Some(String::from("0"));
                 }
             }
-            Some(tmp)
-        } else {
-            // otherwise we'll interpret the argument as a number
-            // using the appropriate Formatter
-            let in_str = in_str_opt.expect(
+            Some(tmp)
+        } else {
+            // otherwise we'll interpret the argument as a number
+            // using the appropriate Formatter
+            let in_str = in_str_opt.expect(
                 "please send the devs this message:
                 \n get_provided is failing to ret as Some(0) on no str ");
-            // first get information about the beginning of the
-            // numeric argument that would be useful for
-            // any formatter (int or float)
-            let initial_prefix = get_initial_prefix(
-                in_str,
-                field.field_type
+            // first get information about the beginning of the
+            // numeric argument that would be useful for
+            // any formatter (int or float)
+            let initial_prefix = get_initial_prefix(
+                in_str,
+                field.field_type
             );
-            // then get the FormatPrimitive from the Formatter
-            formatter.get_primitive(field, &initial_prefix, in_str)
+            // then get the FormatPrimitive from the Formatter
+            formatter.get_primitive(field, &initial_prefix, in_str)
         };
-    // if we have a formatPrimitive, print its results
-    // according to the field-char appropriate Formatter
-    prim_opt.map(|prim| formatter.primitive_to_str(&prim, field.clone()))
+    // if we have a formatPrimitive, print its results
+    // according to the field-char appropriate Formatter
+    prim_opt.map(|prim| formatter.primitive_to_str(&prim, field.clone()))
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/sub.rs.html b/dev/src/uucore/features/tokenize/sub.rs.html index 66ba70968..92ce1832a 100644 --- a/dev/src/uucore/features/tokenize/sub.rs.html +++ b/dev/src/uucore/features/tokenize/sub.rs.html @@ -1,4 +1,4 @@ -sub.rs - source
1
+sub.rs - source
1
 2
 3
 4
@@ -447,454 +447,454 @@
 447
 448
 449
-
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
+
// spell-checker:ignore (vars) charf decf floatf intf scif strf Cninety
 
-//! Sub is a token that represents a
-//! segment of the format string that is a substitution
-//! it is created by Sub's implementation of the Tokenizer trait
-//! Subs which have numeric field chars make use of the num_format
-//! submodule
-use crate::error::{UError, UResult};
-use itertools::{put_back_n, PutBackN};
-use std::error::Error;
-use std::fmt::Display;
-use std::iter::Peekable;
-use std::process::exit;
-use std::slice::Iter;
-use std::str::Chars;
-// use std::collections::HashSet;
+//! Sub is a token that represents a
+//! segment of the format string that is a substitution
+//! it is created by Sub's implementation of the Tokenizer trait
+//! Subs which have numeric field chars make use of the num_format
+//! submodule
+use crate::error::{UError, UResult};
+use itertools::{put_back_n, PutBackN};
+use std::error::Error;
+use std::fmt::Display;
+use std::iter::Peekable;
+use std::process::exit;
+use std::slice::Iter;
+use std::str::Chars;
+// use std::collections::HashSet;
 
-use super::num_format::format_field::{FieldType, FormatField};
-use super::num_format::num_format;
-use super::token;
-use super::unescaped_text::UnescapedText;
+use super::num_format::format_field::{FieldType, FormatField};
+use super::num_format::num_format;
+use super::token;
+use super::unescaped_text::UnescapedText;
 
-const EXIT_ERR: i32 = 1;
+const EXIT_ERR: i32 = 1;
 
-#[derive(Debug)]
-pub enum SubError {
-    InvalidSpec(String),
+#[derive(Debug)]
+pub enum SubError {
+    InvalidSpec(String),
 }
 
-impl Display for SubError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
-        match self {
-            Self::InvalidSpec(s) => write!(f, "%{}: invalid conversion specification", s),
+impl Display for SubError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
+        match self {
+            Self::InvalidSpec(s) => write!(f, "%{}: invalid conversion specification", s),
         }
     }
 }
 
-impl Error for SubError {}
+impl Error for SubError {}
 
-impl UError for SubError {}
+impl UError for SubError {}
 
-fn convert_asterisk_arg_int(asterisk_arg: &str) -> isize {
-    // this is a costly way to parse the
-    // args used for asterisk values into integers
-    // from various bases. Actually doing it correctly
-    // (going through the pipeline to intf, but returning
-    // the integer instead of writing it to string and then
-    // back) is on the refactoring TODO
-    let field_type = FieldType::Intf;
-    let field_char = 'i';
-    let field_info = FormatField {
-        min_width: Some(0),
-        second_field: Some(0),
-        orig: &asterisk_arg.to_string(),
-        field_type: &field_type,
-        field_char: &field_char,
+fn convert_asterisk_arg_int(asterisk_arg: &str) -> isize {
+    // this is a costly way to parse the
+    // args used for asterisk values into integers
+    // from various bases. Actually doing it correctly
+    // (going through the pipeline to intf, but returning
+    // the integer instead of writing it to string and then
+    // back) is on the refactoring TODO
+    let field_type = FieldType::Intf;
+    let field_char = 'i';
+    let field_info = FormatField {
+        min_width: Some(0),
+        second_field: Some(0),
+        orig: &asterisk_arg.to_string(),
+        field_type: &field_type,
+        field_char: &field_char,
     };
-    num_format::num_format(&field_info, Some(&asterisk_arg.to_string()))
-        .unwrap()
-        .parse::<isize>()
-        .unwrap()
+    num_format::num_format(&field_info, Some(&asterisk_arg.to_string()))
+        .unwrap()
+        .parse::<isize>()
+        .unwrap()
 }
 
-pub enum CanAsterisk<T> {
-    Fixed(T),
-    Asterisk,
+pub enum CanAsterisk<T> {
+    Fixed(T),
+    Asterisk,
 }
 
-// Sub is a tokenizer which creates tokens
-// for substitution segments of a format string
-pub struct Sub {
-    min_width: CanAsterisk<Option<isize>>,
-    second_field: CanAsterisk<Option<u32>>,
-    field_char: char,
-    field_type: FieldType,
-    orig: String,
-    prefix_char: char,
+// Sub is a tokenizer which creates tokens
+// for substitution segments of a format string
+pub struct Sub {
+    min_width: CanAsterisk<Option<isize>>,
+    second_field: CanAsterisk<Option<u32>>,
+    field_char: char,
+    field_type: FieldType,
+    orig: String,
+    prefix_char: char,
 }
-impl Sub {
-    pub fn new(
-        min_width: CanAsterisk<Option<isize>>,
-        second_field: CanAsterisk<Option<u32>>,
-        field_char: char,
-        orig: String,
-        prefix_char: char,
-    ) -> Self {
-        // for more dry printing, field characters are grouped
-        // in initialization of token.
-        let field_type = match field_char {
-            's' | 'b' => FieldType::Strf,
-            'd' | 'i' | 'u' | 'o' | 'x' | 'X' => FieldType::Intf,
-            'f' | 'F' => FieldType::Floatf,
-            'a' | 'A' => FieldType::CninetyNineHexFloatf,
-            'e' | 'E' => FieldType::Scif,
-            'g' | 'G' => FieldType::Decf,
-            'c' => FieldType::Charf,
-            _ => {
-                // should be unreachable.
-                println!("Invalid field type");
-                exit(EXIT_ERR);
+impl Sub {
+    pub fn new(
+        min_width: CanAsterisk<Option<isize>>,
+        second_field: CanAsterisk<Option<u32>>,
+        field_char: char,
+        orig: String,
+        prefix_char: char,
+    ) -> Self {
+        // for more dry printing, field characters are grouped
+        // in initialization of token.
+        let field_type = match field_char {
+            's' | 'b' => FieldType::Strf,
+            'd' | 'i' | 'u' | 'o' | 'x' | 'X' => FieldType::Intf,
+            'f' | 'F' => FieldType::Floatf,
+            'a' | 'A' => FieldType::CninetyNineHexFloatf,
+            'e' | 'E' => FieldType::Scif,
+            'g' | 'G' => FieldType::Decf,
+            'c' => FieldType::Charf,
+            _ => {
+                // should be unreachable.
+                println!("Invalid field type");
+                exit(EXIT_ERR);
             }
         };
-        Self {
-            min_width,
-            second_field,
-            field_char,
-            field_type,
-            orig,
-            prefix_char,
+        Self {
+            min_width,
+            second_field,
+            field_char,
+            field_type,
+            orig,
+            prefix_char,
         }
     }
 }
 
-#[derive(Default)]
-struct SubParser {
-    min_width_tmp: Option<String>,
-    min_width_is_asterisk: bool,
-    past_decimal: bool,
-    second_field_tmp: Option<String>,
-    second_field_is_asterisk: bool,
-    specifiers_found: bool,
-    field_char: Option<char>,
-    text_so_far: String,
+#[derive(Default)]
+struct SubParser {
+    min_width_tmp: Option<String>,
+    min_width_is_asterisk: bool,
+    past_decimal: bool,
+    second_field_tmp: Option<String>,
+    second_field_is_asterisk: bool,
+    specifiers_found: bool,
+    field_char: Option<char>,
+    text_so_far: String,
 }
 
-impl SubParser {
-    fn new() -> Self {
-        Self::default()
+impl SubParser {
+    fn new() -> Self {
+        Self::default()
     }
-    fn from_it(
-        it: &mut PutBackN<Chars>,
-        args: &mut Peekable<Iter<String>>,
-    ) -> UResult<Option<Box<dyn token::Token>>> {
-        let mut parser = Self::new();
-        if parser.sub_vals_retrieved(it)? {
-            let t: Box<dyn token::Token> = Self::build_token(parser);
-            t.print(args);
-            Ok(Some(t))
-        } else {
+    fn from_it(
+        it: &mut PutBackN<Chars>,
+        args: &mut Peekable<Iter<String>>,
+    ) -> UResult<Option<Box<dyn token::Token>>> {
+        let mut parser = Self::new();
+        if parser.sub_vals_retrieved(it)? {
+            let t: Box<dyn token::Token> = Self::build_token(parser);
+            t.print(args);
+            Ok(Some(t))
+        } else {
             Ok(None)
         }
     }
-    fn build_token(parser: Self) -> Box<dyn token::Token> {
-        // not a self method so as to allow move of sub-parser vals.
-        // return new Sub struct as token
-        let prefix_char = match &parser.min_width_tmp {
-            Some(width) if width.starts_with('0') => '0',
-            _ => ' ',
+    fn build_token(parser: Self) -> Box<dyn token::Token> {
+        // not a self method so as to allow move of sub-parser vals.
+        // return new Sub struct as token
+        let prefix_char = match &parser.min_width_tmp {
+            Some(width) if width.starts_with('0') => '0',
+            _ => ' ',
         };
 
-        let t: Box<dyn token::Token> = Box::new(Sub::new(
-            if parser.min_width_is_asterisk {
-                CanAsterisk::Asterisk
-            } else {
-                CanAsterisk::Fixed(
-                    parser
-                        .min_width_tmp
-                        .map(|x| x.parse::<isize>().unwrap_or(1)),
+        let t: Box<dyn token::Token> = Box::new(Sub::new(
+            if parser.min_width_is_asterisk {
+                CanAsterisk::Asterisk
+            } else {
+                CanAsterisk::Fixed(
+                    parser
+                        .min_width_tmp
+                        .map(|x| x.parse::<isize>().unwrap_or(1)),
                 )
             },
-            if parser.second_field_is_asterisk {
-                CanAsterisk::Asterisk
-            } else {
-                CanAsterisk::Fixed(parser.second_field_tmp.map(|x| x.parse::<u32>().unwrap()))
+            if parser.second_field_is_asterisk {
+                CanAsterisk::Asterisk
+            } else {
+                CanAsterisk::Fixed(parser.second_field_tmp.map(|x| x.parse::<u32>().unwrap()))
             },
-            parser.field_char.unwrap(),
-            parser.text_so_far,
-            prefix_char,
+            parser.field_char.unwrap(),
+            parser.text_so_far,
+            prefix_char,
         ));
-        t
+        t
     }
-    fn sub_vals_retrieved(&mut self, it: &mut PutBackN<Chars>) -> UResult<bool> {
-        if !Self::successfully_eat_prefix(it, &mut self.text_so_far)? {
-            return Ok(false);
+    fn sub_vals_retrieved(&mut self, it: &mut PutBackN<Chars>) -> UResult<bool> {
+        if !Self::successfully_eat_prefix(it, &mut self.text_so_far)? {
+            return Ok(false);
         }
-        // this fn in particular is much longer than it needs to be
-        // .could get a lot
-        // of code savings just by cleaning it up. shouldn't use a regex
-        // though, as we want to mimic the original behavior of printing
-        // the field as interpreted up until the error in the field.
+        // this fn in particular is much longer than it needs to be
+        // .could get a lot
+        // of code savings just by cleaning it up. shouldn't use a regex
+        // though, as we want to mimic the original behavior of printing
+        // the field as interpreted up until the error in the field.
 
-        let mut legal_fields = vec![
-            // 'a', 'A', //c99 hex float implementation not yet complete
-            'b', 'c', 'd', 'e', 'E', 'f', 'F', 'g', 'G', 'i', 'o', 's', 'u', 'x', 'X',
+        let mut legal_fields = vec![
+            // 'a', 'A', //c99 hex float implementation not yet complete
+            'b', 'c', 'd', 'e', 'E', 'f', 'F', 'g', 'G', 'i', 'o', 's', 'u', 'x', 'X',
         ];
-        let mut specifiers = vec!['h', 'j', 'l', 'L', 't', 'z'];
-        legal_fields.sort_unstable();
-        specifiers.sort_unstable();
+        let mut specifiers = vec!['h', 'j', 'l', 'L', 't', 'z'];
+        legal_fields.sort_unstable();
+        specifiers.sort_unstable();
 
-        // divide substitution from %([0-9]+)?(.[0-9+])?([a-zA-Z])
-        // into min_width, second_field, field_char
-        for ch in it {
-            self.text_so_far.push(ch);
-            match ch as char {
-                '-' | '*' | '0'..='9' => {
-                    if !self.past_decimal {
-                        if self.min_width_is_asterisk || self.specifiers_found {
-                            return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
+        // divide substitution from %([0-9]+)?(.[0-9+])?([a-zA-Z])
+        // into min_width, second_field, field_char
+        for ch in it {
+            self.text_so_far.push(ch);
+            match ch as char {
+                '-' | '*' | '0'..='9' => {
+                    if !self.past_decimal {
+                        if self.min_width_is_asterisk || self.specifiers_found {
+                            return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
                         }
-                        if self.min_width_tmp.is_none() {
-                            self.min_width_tmp = Some(String::new());
+                        if self.min_width_tmp.is_none() {
+                            self.min_width_tmp = Some(String::new());
                         }
-                        match self.min_width_tmp.as_mut() {
-                            Some(x) => {
-                                if (ch == '-' || ch == '*') && !x.is_empty() {
-                                    return Err(
-                                        SubError::InvalidSpec(self.text_so_far.clone()).into()
+                        match self.min_width_tmp.as_mut() {
+                            Some(x) => {
+                                if (ch == '-' || ch == '*') && !x.is_empty() {
+                                    return Err(
+                                        SubError::InvalidSpec(self.text_so_far.clone()).into()
                                     );
                                 }
-                                if ch == '*' {
-                                    self.min_width_is_asterisk = true;
+                                if ch == '*' {
+                                    self.min_width_is_asterisk = true;
                                 }
-                                x.push(ch);
+                                x.push(ch);
                             }
-                            None => {
+                            None => {
                                 panic!("should be unreachable");
                             }
                         }
-                    } else {
-                        // second field should never have a
-                        // negative value
-                        if self.second_field_is_asterisk || ch == '-' || self.specifiers_found {
-                            return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
+                    } else {
+                        // second field should never have a
+                        // negative value
+                        if self.second_field_is_asterisk || ch == '-' || self.specifiers_found {
+                            return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
                         }
-                        if self.second_field_tmp.is_none() {
-                            self.second_field_tmp = Some(String::new());
+                        if self.second_field_tmp.is_none() {
+                            self.second_field_tmp = Some(String::new());
                         }
-                        match self.second_field_tmp.as_mut() {
-                            Some(x) => {
-                                if ch == '*' && !x.is_empty() {
-                                    return Err(
-                                        SubError::InvalidSpec(self.text_so_far.clone()).into()
+                        match self.second_field_tmp.as_mut() {
+                            Some(x) => {
+                                if ch == '*' && !x.is_empty() {
+                                    return Err(
+                                        SubError::InvalidSpec(self.text_so_far.clone()).into()
                                     );
                                 }
-                                if ch == '*' {
-                                    self.second_field_is_asterisk = true;
+                                if ch == '*' {
+                                    self.second_field_is_asterisk = true;
                                 }
-                                x.push(ch);
+                                x.push(ch);
                             }
-                            None => {
+                            None => {
                                 panic!("should be unreachable");
                             }
                         }
                     }
                 }
-                '.' => {
-                    if !self.past_decimal {
-                        self.past_decimal = true;
-                    } else {
-                        return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
+                '.' => {
+                    if !self.past_decimal {
+                        self.past_decimal = true;
+                    } else {
+                        return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
                     }
                 }
-                x if legal_fields.binary_search(&x).is_ok() => {
-                    self.field_char = Some(ch);
-                    self.text_so_far.push(ch);
+                x if legal_fields.binary_search(&x).is_ok() => {
+                    self.field_char = Some(ch);
+                    self.text_so_far.push(ch);
                     break;
                 }
-                x if specifiers.binary_search(&x).is_ok() => {
-                    if !self.past_decimal {
-                        self.past_decimal = true;
+                x if specifiers.binary_search(&x).is_ok() => {
+                    if !self.past_decimal {
+                        self.past_decimal = true;
                     }
-                    if !self.specifiers_found {
-                        self.specifiers_found = true;
+                    if !self.specifiers_found {
+                        self.specifiers_found = true;
                     }
                 }
-                _ => {
-                    return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
+                _ => {
+                    return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
                 }
             }
         }
-        if self.field_char.is_none() {
-            return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
+        if self.field_char.is_none() {
+            return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
         }
-        let field_char_retrieved = self.field_char.unwrap();
-        if self.past_decimal && self.second_field_tmp.is_none() {
-            self.second_field_tmp = Some(String::from("0"));
+        let field_char_retrieved = self.field_char.unwrap();
+        if self.past_decimal && self.second_field_tmp.is_none() {
+            self.second_field_tmp = Some(String::from("0"));
         }
-        self.validate_field_params(field_char_retrieved)?;
-        // if the dot is provided without a second field
-        // printf interprets it as 0.
-        if let Some(x) = self.second_field_tmp.as_mut() {
-            if x.is_empty() {
-                self.min_width_tmp = Some(String::from("0"));
+        self.validate_field_params(field_char_retrieved)?;
+        // if the dot is provided without a second field
+        // printf interprets it as 0.
+        if let Some(x) = self.second_field_tmp.as_mut() {
+            if x.is_empty() {
+                self.min_width_tmp = Some(String::from("0"));
             }
         }
 
         Ok(true)
     }
-    fn successfully_eat_prefix(
-        it: &mut PutBackN<Chars>,
-        text_so_far: &mut String,
-    ) -> UResult<bool> {
-        // get next two chars,
-        // if they're '%%' we're not tokenizing it
-        // else put chars back
-        let preface = it.next();
-        let n_ch = it.next();
-        if preface == Some('%') && n_ch != Some('%') {
-            match n_ch {
-                Some(x) => {
-                    it.put_back(x);
+    fn successfully_eat_prefix(
+        it: &mut PutBackN<Chars>,
+        text_so_far: &mut String,
+    ) -> UResult<bool> {
+        // get next two chars,
+        // if they're '%%' we're not tokenizing it
+        // else put chars back
+        let preface = it.next();
+        let n_ch = it.next();
+        if preface == Some('%') && n_ch != Some('%') {
+            match n_ch {
+                Some(x) => {
+                    it.put_back(x);
                     Ok(true)
                 }
-                None => {
-                    text_so_far.push('%');
-                    Err(SubError::InvalidSpec(text_so_far.clone()).into())
+                None => {
+                    text_so_far.push('%');
+                    Err(SubError::InvalidSpec(text_so_far.clone()).into())
                 }
             }
-        } else {
-            if let Some(x) = n_ch {
-                it.put_back(x);
+        } else {
+            if let Some(x) = n_ch {
+                it.put_back(x);
             };
-            if let Some(x) = preface {
-                it.put_back(x);
+            if let Some(x) = preface {
+                it.put_back(x);
             };
             Ok(false)
         }
     }
-    fn validate_field_params(&self, field_char: char) -> UResult<()> {
-        // check for illegal combinations here when possible vs
-        // on each application so we check less per application
-        // to do: move these checks to Sub::new
-        if (field_char == 's' && self.min_width_tmp == Some(String::from("0")))
-            || (field_char == 'c'
-                && (self.min_width_tmp == Some(String::from("0")) || self.past_decimal))
-            || (field_char == 'b'
-                && (self.min_width_tmp.is_some()
-                    || self.past_decimal
-                    || self.second_field_tmp.is_some()))
+    fn validate_field_params(&self, field_char: char) -> UResult<()> {
+        // check for illegal combinations here when possible vs
+        // on each application so we check less per application
+        // to do: move these checks to Sub::new
+        if (field_char == 's' && self.min_width_tmp == Some(String::from("0")))
+            || (field_char == 'c'
+                && (self.min_width_tmp == Some(String::from("0")) || self.past_decimal))
+            || (field_char == 'b'
+                && (self.min_width_tmp.is_some()
+                    || self.past_decimal
+                    || self.second_field_tmp.is_some()))
         {
-            // invalid string substitution
-            // to do: include information about an invalid
-            // string substitution
-            return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
+            // invalid string substitution
+            // to do: include information about an invalid
+            // string substitution
+            return Err(SubError::InvalidSpec(self.text_so_far.clone()).into());
         }
         Ok(())
     }
 }
 
-impl token::Tokenizer for Sub {
-    fn from_it(
-        it: &mut PutBackN<Chars>,
-        args: &mut Peekable<Iter<String>>,
-    ) -> UResult<Option<Box<dyn token::Token>>> {
-        SubParser::from_it(it, args)
+impl token::Tokenizer for Sub {
+    fn from_it(
+        it: &mut PutBackN<Chars>,
+        args: &mut Peekable<Iter<String>>,
+    ) -> UResult<Option<Box<dyn token::Token>>> {
+        SubParser::from_it(it, args)
     }
 }
-impl token::Token for Sub {
-    fn print(&self, pf_args_it: &mut Peekable<Iter<String>>) {
-        let field = FormatField {
-            min_width: match self.min_width {
-                CanAsterisk::Fixed(x) => x,
-                CanAsterisk::Asterisk => {
-                    match pf_args_it.next() {
-                        // temporary, use intf.rs instead
-                        Some(x) => Some(convert_asterisk_arg_int(x)),
-                        None => Some(0),
+impl token::Token for Sub {
+    fn print(&self, pf_args_it: &mut Peekable<Iter<String>>) {
+        let field = FormatField {
+            min_width: match self.min_width {
+                CanAsterisk::Fixed(x) => x,
+                CanAsterisk::Asterisk => {
+                    match pf_args_it.next() {
+                        // temporary, use intf.rs instead
+                        Some(x) => Some(convert_asterisk_arg_int(x)),
+                        None => Some(0),
                     }
                 }
             },
-            second_field: match self.second_field {
-                CanAsterisk::Fixed(x) => x,
-                CanAsterisk::Asterisk => {
-                    match pf_args_it.next() {
-                        // temporary, use intf.rs instead
-                        Some(x) => {
-                            let result = convert_asterisk_arg_int(x);
-                            if result < 0 {
-                                None
-                            } else {
-                                Some(result as u32)
+            second_field: match self.second_field {
+                CanAsterisk::Fixed(x) => x,
+                CanAsterisk::Asterisk => {
+                    match pf_args_it.next() {
+                        // temporary, use intf.rs instead
+                        Some(x) => {
+                            let result = convert_asterisk_arg_int(x);
+                            if result < 0 {
+                                None
+                            } else {
+                                Some(result as u32)
                             }
                         }
-                        None => Some(0),
+                        None => Some(0),
                     }
                 }
             },
-            field_char: &self.field_char,
-            field_type: &self.field_type,
-            orig: &self.orig,
+            field_char: &self.field_char,
+            field_type: &self.field_type,
+            orig: &self.orig,
         };
-        let pf_arg = pf_args_it.next();
+        let pf_arg = pf_args_it.next();
 
-        // minimum width is handled independently of actual
-        // field char
-        let pre_min_width_opt: Option<String> = match *field.field_type {
-            // if %s just return arg
-            // if %b use UnescapedText module's unescape-fn
-            // if %c return first char of arg
-            FieldType::Strf | FieldType::Charf => {
-                match pf_arg {
-                    Some(arg_string) => {
-                        match *field.field_char {
-                            's' => Some(match field.second_field {
-                                Some(max) => String::from(&arg_string[..max as usize]),
-                                None => arg_string.clone(),
+        // minimum width is handled independently of actual
+        // field char
+        let pre_min_width_opt: Option<String> = match *field.field_type {
+            // if %s just return arg
+            // if %b use UnescapedText module's unescape-fn
+            // if %c return first char of arg
+            FieldType::Strf | FieldType::Charf => {
+                match pf_arg {
+                    Some(arg_string) => {
+                        match *field.field_char {
+                            's' => Some(match field.second_field {
+                                Some(max) => String::from(&arg_string[..max as usize]),
+                                None => arg_string.clone(),
                             }),
-                            'b' => {
-                                let mut a_it = put_back_n(arg_string.chars());
-                                UnescapedText::from_it_core(&mut a_it, true);
-                                None
-                            }
-                            // for 'c': get iter of string vals,
-                            // get opt<char> of first val
-                            // and map it to opt<String>
-                            /* 'c' | */
-                            _ => arg_string.chars().next().map(|x| x.to_string()),
+                            'b' => {
+                                let mut a_it = put_back_n(arg_string.chars());
+                                UnescapedText::from_it_core(&mut a_it, true);
+                                None
+                            }
+                            // for 'c': get iter of string vals,
+                            // get opt<char> of first val
+                            // and map it to opt<String>
+                            /* 'c' | */
+                            _ => arg_string.chars().next().map(|x| x.to_string()),
                         }
                     }
-                    None => None,
+                    None => None,
                 }
             }
-            _ => {
-                // non string/char fields are delegated to num_format
-                num_format::num_format(&field, pf_arg)
+            _ => {
+                // non string/char fields are delegated to num_format
+                num_format::num_format(&field, pf_arg)
             }
         };
-        if let Some(pre_min_width) = pre_min_width_opt {
-            // if have a string, print it, ensuring minimum width is met.
-            print!(
+        if let Some(pre_min_width) = pre_min_width_opt {
+            // if have a string, print it, ensuring minimum width is met.
+            print!(
                 "{}",
-                match field.min_width {
-                    Some(min_width) => {
-                        let diff: isize = min_width.abs() as isize - pre_min_width.len() as isize;
-                        if diff > 0 {
-                            let mut final_str = String::new();
-                            // definitely more efficient ways
-                            //  to do this.
-                            let pad_before = min_width > 0;
-                            if !pad_before {
-                                final_str.push_str(&pre_min_width);
+                match field.min_width {
+                    Some(min_width) => {
+                        let diff: isize = min_width.abs() as isize - pre_min_width.len() as isize;
+                        if diff > 0 {
+                            let mut final_str = String::new();
+                            // definitely more efficient ways
+                            //  to do this.
+                            let pad_before = min_width > 0;
+                            if !pad_before {
+                                final_str.push_str(&pre_min_width);
                             }
-                            for _ in 0..diff {
-                                final_str.push(self.prefix_char);
+                            for _ in 0..diff {
+                                final_str.push(self.prefix_char);
                             }
-                            if pad_before {
-                                final_str.push_str(&pre_min_width);
+                            if pad_before {
+                                final_str.push_str(&pre_min_width);
                             }
-                            final_str
-                        } else {
-                            pre_min_width
+                            final_str
+                        } else {
+                            pre_min_width
                         }
                     }
-                    None => pre_min_width,
+                    None => pre_min_width,
                 }
             );
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/token.rs.html b/dev/src/uucore/features/tokenize/token.rs.html index ee2b99116..67d0eb252 100644 --- a/dev/src/uucore/features/tokenize/token.rs.html +++ b/dev/src/uucore/features/tokenize/token.rs.html @@ -1,4 +1,4 @@ -token.rs - source
1
+token.rs - source
1
 2
 3
 4
@@ -31,38 +31,38 @@
 31
 32
 33
-
//! Traits and enums dealing with Tokenization of printf Format String
-use itertools::PutBackN;
-use std::iter::Peekable;
-use std::slice::Iter;
-use std::str::Chars;
+
//! Traits and enums dealing with Tokenization of printf Format String
+use itertools::PutBackN;
+use std::iter::Peekable;
+use std::slice::Iter;
+use std::str::Chars;
 
-use crate::error::UResult;
+use crate::error::UResult;
 
-// A token object is an object that can print the expected output
-// of a contiguous segment of the format string, and
-// requires at most 1 argument
-pub trait Token {
-    fn print(&self, args: &mut Peekable<Iter<String>>);
+// A token object is an object that can print the expected output
+// of a contiguous segment of the format string, and
+// requires at most 1 argument
+pub trait Token {
+    fn print(&self, args: &mut Peekable<Iter<String>>);
 }
 
-// A tokenizer object is an object that takes an iterator
-// at a position in a format string, and sees whether
-// it can return a token of a type it knows how to produce
-// if so, return the token, move the iterator past the
-// format string text the token represents, and if an
-// argument is used move the argument iter forward one
+// A tokenizer object is an object that takes an iterator
+// at a position in a format string, and sees whether
+// it can return a token of a type it knows how to produce
+// if so, return the token, move the iterator past the
+// format string text the token represents, and if an
+// argument is used move the argument iter forward one
 
-// creating token of a format string segment should also cause
-// printing of that token's value. Essentially tokenizing
-// a whole format string will print the format string and consume
-// a number of arguments equal to the number of argument-using tokens
+// creating token of a format string segment should also cause
+// printing of that token's value. Essentially tokenizing
+// a whole format string will print the format string and consume
+// a number of arguments equal to the number of argument-using tokens
 
-pub trait Tokenizer {
-    fn from_it(
-        it: &mut PutBackN<Chars>,
-        args: &mut Peekable<Iter<String>>,
-    ) -> UResult<Option<Box<dyn Token>>>;
+pub trait Tokenizer {
+    fn from_it(
+        it: &mut PutBackN<Chars>,
+        args: &mut Peekable<Iter<String>>,
+    ) -> UResult<Option<Box<dyn Token>>>;
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/tokenize/unescaped_text.rs.html b/dev/src/uucore/features/tokenize/unescaped_text.rs.html index 71adf576e..92703b35c 100644 --- a/dev/src/uucore/features/tokenize/unescaped_text.rs.html +++ b/dev/src/uucore/features/tokenize/unescaped_text.rs.html @@ -1,4 +1,4 @@ -unescaped_text.rs - source
1
+unescaped_text.rs - source
1
 2
 3
 4
@@ -277,284 +277,284 @@
 277
 278
 279
-
//! UnescapedText is a tokenizer impl
-//! for tokenizing character literals,
-//! and escaped character literals (of allowed escapes),
-//! into an unescaped text byte array
+
//! UnescapedText is a tokenizer impl
+//! for tokenizing character literals,
+//! and escaped character literals (of allowed escapes),
+//! into an unescaped text byte array
 
-// spell-checker:ignore (ToDO) retval hexchars octals printf's bvec vals coreutil addchar eval bytecode bslice
+// spell-checker:ignore (ToDO) retval hexchars octals printf's bvec vals coreutil addchar eval bytecode bslice
 
-use itertools::PutBackN;
-use std::char::from_u32;
-use std::io::{stdout, Write};
-use std::iter::Peekable;
-use std::process::exit;
-use std::slice::Iter;
-use std::str::Chars;
+use itertools::PutBackN;
+use std::char::from_u32;
+use std::io::{stdout, Write};
+use std::iter::Peekable;
+use std::process::exit;
+use std::slice::Iter;
+use std::str::Chars;
 
-use crate::error::UResult;
+use crate::error::UResult;
 
-use super::token;
+use super::token;
 
-const EXIT_OK: i32 = 0;
-const EXIT_ERR: i32 = 1;
+const EXIT_OK: i32 = 0;
+const EXIT_ERR: i32 = 1;
 
-// by default stdout only flushes
-// to console when a newline is passed.
-fn flush_char(c: char) {
-    print!("{}", c);
-    let _ = stdout().flush();
+// by default stdout only flushes
+// to console when a newline is passed.
+fn flush_char(c: char) {
+    print!("{}", c);
+    let _ = stdout().flush();
 }
 
-fn flush_str(s: &str) {
-    print!("{}", s);
-    let _ = stdout().flush();
+fn flush_str(s: &str) {
+    print!("{}", s);
+    let _ = stdout().flush();
 }
 
-fn flush_bytes(bslice: &[u8]) {
-    let _ = stdout().write(bslice);
-    let _ = stdout().flush();
+fn flush_bytes(bslice: &[u8]) {
+    let _ = stdout().write(bslice);
+    let _ = stdout().flush();
 }
 
-#[derive(Default)]
-pub struct UnescapedText(Vec<u8>);
-impl UnescapedText {
-    fn new() -> Self {
-        Self::default()
+#[derive(Default)]
+pub struct UnescapedText(Vec<u8>);
+impl UnescapedText {
+    fn new() -> Self {
+        Self::default()
     }
-    // take an iterator to the format string
-    // consume between min and max chars
-    // and return it as a base-X number
-    fn base_to_u32(min_chars: u8, max_chars: u8, base: u32, it: &mut PutBackN<Chars>) -> u32 {
-        let mut retval: u32 = 0;
-        let mut found = 0;
-        while found < max_chars {
-            // if end of input break
-            let nc = it.next();
-            match nc {
-                Some(digit) => {
-                    // if end of hexchars break
-                    match digit.to_digit(base) {
-                        Some(d) => {
-                            found += 1;
-                            retval *= base;
-                            retval += d;
+    // take an iterator to the format string
+    // consume between min and max chars
+    // and return it as a base-X number
+    fn base_to_u32(min_chars: u8, max_chars: u8, base: u32, it: &mut PutBackN<Chars>) -> u32 {
+        let mut retval: u32 = 0;
+        let mut found = 0;
+        while found < max_chars {
+            // if end of input break
+            let nc = it.next();
+            match nc {
+                Some(digit) => {
+                    // if end of hexchars break
+                    match digit.to_digit(base) {
+                        Some(d) => {
+                            found += 1;
+                            retval *= base;
+                            retval += d;
                         }
-                        None => {
-                            it.put_back(digit);
+                        None => {
+                            it.put_back(digit);
                             break;
                         }
                     }
                 }
-                None => {
+                None => {
                     break;
                 }
             }
         }
-        if found < min_chars {
-            // only ever expected for hex
-            println!("missing hexadecimal number in escape"); //todo stderr
-            exit(EXIT_ERR);
+        if found < min_chars {
+            // only ever expected for hex
+            println!("missing hexadecimal number in escape"); //todo stderr
+            exit(EXIT_ERR);
         }
-        retval
+        retval
     }
-    // validates against valid
-    // IEC 10646 vals - these values
-    // are pinned against the more popular
-    // printf so as to not disrupt when
-    // dropped-in as a replacement.
-    fn validate_iec(val: u32, eight_word: bool) {
-        let mut preface = 'u';
-        let leading_zeros = if eight_word {
-            preface = 'U';
-            8
-        } else {
-            4
-        };
-        let err_msg = format!(
+    // validates against valid
+    // IEC 10646 vals - these values
+    // are pinned against the more popular
+    // printf so as to not disrupt when
+    // dropped-in as a replacement.
+    fn validate_iec(val: u32, eight_word: bool) {
+        let mut preface = 'u';
+        let leading_zeros = if eight_word {
+            preface = 'U';
+            8
+        } else {
+            4
+        };
+        let err_msg = format!(
             "invalid universal character name {0}{1:02$x}",
-            preface, val, leading_zeros
+            preface, val, leading_zeros
         );
-        if (val < 159 && (val != 36 && val != 64 && val != 96)) || (val > 55296 && val < 57343) {
-            println!("{}", err_msg); //todo stderr
-            exit(EXIT_ERR);
+        if (val < 159 && (val != 36 && val != 64 && val != 96)) || (val > 55296 && val < 57343) {
+            println!("{}", err_msg); //todo stderr
+            exit(EXIT_ERR);
         }
     }
-    // pass an iterator that succeeds an '/',
-    // and process the remaining character
-    // adding the unescaped bytes
-    // to the passed byte_vec
-    // in subs_mode change octal behavior
-    fn handle_escaped(byte_vec: &mut Vec<u8>, it: &mut PutBackN<Chars>, subs_mode: bool) {
-        let ch = it.next().unwrap_or('\\');
-        match ch {
-            '0'..='9' | 'x' => {
-                let min_len = 1;
-                let mut max_len = 2;
-                let mut base = 16;
-                let ignore = false;
-                match ch {
-                    'x' => {}
-                    e @ '0'..='9' => {
-                        max_len = 3;
-                        base = 8;
-                        // in practice, gnu coreutils printf
-                        // interprets octals without a
-                        // leading zero in %b
-                        // but it only skips leading zeros
-                        // in %b mode.
-                        // if we ever want to match gnu coreutil
-                        // printf's docs instead of its behavior
-                        // we'd set this to true.
-                        // if subs_mode && e != '0'
-                        //  { ignore = true; }
-                        if !subs_mode || e != '0' {
-                            it.put_back(ch);
+    // pass an iterator that succeeds an '/',
+    // and process the remaining character
+    // adding the unescaped bytes
+    // to the passed byte_vec
+    // in subs_mode change octal behavior
+    fn handle_escaped(byte_vec: &mut Vec<u8>, it: &mut PutBackN<Chars>, subs_mode: bool) {
+        let ch = it.next().unwrap_or('\\');
+        match ch {
+            '0'..='9' | 'x' => {
+                let min_len = 1;
+                let mut max_len = 2;
+                let mut base = 16;
+                let ignore = false;
+                match ch {
+                    'x' => {}
+                    e @ '0'..='9' => {
+                        max_len = 3;
+                        base = 8;
+                        // in practice, gnu coreutils printf
+                        // interprets octals without a
+                        // leading zero in %b
+                        // but it only skips leading zeros
+                        // in %b mode.
+                        // if we ever want to match gnu coreutil
+                        // printf's docs instead of its behavior
+                        // we'd set this to true.
+                        // if subs_mode && e != '0'
+                        //  { ignore = true; }
+                        if !subs_mode || e != '0' {
+                            it.put_back(ch);
                         }
                     }
-                    _ => {}
+                    _ => {}
                 }
-                if !ignore {
-                    let val = (Self::base_to_u32(min_len, max_len, base, it) % 256) as u8;
-                    byte_vec.push(val);
-                    let bvec = [val];
-                    flush_bytes(&bvec);
-                } else {
-                    byte_vec.push(ch as u8);
+                if !ignore {
+                    let val = (Self::base_to_u32(min_len, max_len, base, it) % 256) as u8;
+                    byte_vec.push(val);
+                    let bvec = [val];
+                    flush_bytes(&bvec);
+                } else {
+                    byte_vec.push(ch as u8);
                 }
             }
-            e => {
-                // only for hex and octal
-                // is byte encoding specified.
-                // otherwise, why not leave the door open
-                // for other encodings unless it turns out
-                // a bottleneck.
-                let mut s = String::new();
-                let ch = match e {
-                    '\\' => '\\',
-                    '"' => '"',
-                    'n' => '\n',
-                    'r' => '\r',
-                    't' => '\t',
-                    // bell
-                    'a' => '\x07',
-                    // backspace
-                    'b' => '\x08',
-                    // vertical tab
-                    'v' => '\x0B',
-                    // form feed
-                    'f' => '\x0C',
-                    // escape character
-                    'e' => '\x1B',
-                    'c' => exit(EXIT_OK),
-                    'u' | 'U' => {
-                        let len = match e {
-                            'u' => 4,
-                            /* 'U' | */ _ => 8,
+            e => {
+                // only for hex and octal
+                // is byte encoding specified.
+                // otherwise, why not leave the door open
+                // for other encodings unless it turns out
+                // a bottleneck.
+                let mut s = String::new();
+                let ch = match e {
+                    '\\' => '\\',
+                    '"' => '"',
+                    'n' => '\n',
+                    'r' => '\r',
+                    't' => '\t',
+                    // bell
+                    'a' => '\x07',
+                    // backspace
+                    'b' => '\x08',
+                    // vertical tab
+                    'v' => '\x0B',
+                    // form feed
+                    'f' => '\x0C',
+                    // escape character
+                    'e' => '\x1B',
+                    'c' => exit(EXIT_OK),
+                    'u' | 'U' => {
+                        let len = match e {
+                            'u' => 4,
+                            /* 'U' | */ _ => 8,
                         };
-                        let val = Self::base_to_u32(len, len, 16, it);
-                        Self::validate_iec(val, false);
-                        if let Some(c) = from_u32(val) {
-                            c
-                        } else {
-                            '-'
-                        }
+                        let val = Self::base_to_u32(len, len, 16, it);
+                        Self::validate_iec(val, false);
+                        if let Some(c) = from_u32(val) {
+                            c
+                        } else {
+                            '-'
+                        }
                     }
-                    _ => {
-                        s.push('\\');
-                        ch
+                    _ => {
+                        s.push('\\');
+                        ch
                     }
                 };
-                s.push(ch);
-                flush_str(&s);
-                byte_vec.extend(s.bytes());
+                s.push(ch);
+                flush_str(&s);
+                byte_vec.extend(s.bytes());
             }
         };
     }
 
-    // take an iterator to a string,
-    // and return a wrapper around a Vec<u8> of unescaped bytes
-    // break on encounter of sub symbol ('%[^%]') unless called
-    // through %b subst.
-    pub fn from_it_core(
-        it: &mut PutBackN<Chars>,
-        subs_mode: bool,
-    ) -> Option<Box<dyn token::Token>> {
-        let mut addchar = false;
-        let mut new_text = Self::new();
-        let mut tmp_str = String::new();
+    // take an iterator to a string,
+    // and return a wrapper around a Vec<u8> of unescaped bytes
+    // break on encounter of sub symbol ('%[^%]') unless called
+    // through %b subst.
+    pub fn from_it_core(
+        it: &mut PutBackN<Chars>,
+        subs_mode: bool,
+    ) -> Option<Box<dyn token::Token>> {
+        let mut addchar = false;
+        let mut new_text = Self::new();
+        let mut tmp_str = String::new();
         {
-            let new_vec: &mut Vec<u8> = &mut (new_text.0);
-            while let Some(ch) = it.next() {
-                if !addchar {
-                    addchar = true;
+            let new_vec: &mut Vec<u8> = &mut (new_text.0);
+            while let Some(ch) = it.next() {
+                if !addchar {
+                    addchar = true;
                 }
-                match ch as char {
-                    x if x != '\\' && x != '%' => {
-                        // lazy branch eval
-                        // remember this fn could be called
-                        // many times in a single exec through %b
-                        flush_char(ch);
-                        tmp_str.push(ch);
+                match ch as char {
+                    x if x != '\\' && x != '%' => {
+                        // lazy branch eval
+                        // remember this fn could be called
+                        // many times in a single exec through %b
+                        flush_char(ch);
+                        tmp_str.push(ch);
                     }
-                    '\\' => {
-                        // the literal may be a literal bytecode
-                        // and not valid utf-8. Str only supports
-                        // valid utf-8.
-                        // if we find the unnecessary drain
-                        // on non hex or octal escapes is costly
-                        // then we can make it faster/more complex
-                        // with as-necessary draining.
-                        if !tmp_str.is_empty() {
-                            new_vec.extend(tmp_str.bytes());
-                            tmp_str = String::new();
+                    '\\' => {
+                        // the literal may be a literal bytecode
+                        // and not valid utf-8. Str only supports
+                        // valid utf-8.
+                        // if we find the unnecessary drain
+                        // on non hex or octal escapes is costly
+                        // then we can make it faster/more complex
+                        // with as-necessary draining.
+                        if !tmp_str.is_empty() {
+                            new_vec.extend(tmp_str.bytes());
+                            tmp_str = String::new();
                         }
-                        Self::handle_escaped(new_vec, it, subs_mode);
+                        Self::handle_escaped(new_vec, it, subs_mode);
                     }
-                    x if x == '%' && !subs_mode => {
-                        if let Some(follow) = it.next() {
-                            if follow == '%' {
-                                flush_char(ch);
-                                tmp_str.push(ch);
-                            } else {
-                                it.put_back(follow);
-                                it.put_back(ch);
+                    x if x == '%' && !subs_mode => {
+                        if let Some(follow) = it.next() {
+                            if follow == '%' {
+                                flush_char(ch);
+                                tmp_str.push(ch);
+                            } else {
+                                it.put_back(follow);
+                                it.put_back(ch);
                                 break;
                             }
-                        } else {
-                            it.put_back(ch);
+                        } else {
+                            it.put_back(ch);
                             break;
                         }
                     }
-                    _ => {
-                        flush_char(ch);
-                        tmp_str.push(ch);
+                    _ => {
+                        flush_char(ch);
+                        tmp_str.push(ch);
                     }
                 }
             }
-            if !tmp_str.is_empty() {
-                new_vec.extend(tmp_str.bytes());
+            if !tmp_str.is_empty() {
+                new_vec.extend(tmp_str.bytes());
             }
         }
-        if addchar {
-            Some(Box::new(new_text))
-        } else {
-            None
-        }
+        if addchar {
+            Some(Box::new(new_text))
+        } else {
+            None
+        }
     }
 }
-impl token::Tokenizer for UnescapedText {
-    fn from_it(
-        it: &mut PutBackN<Chars>,
-        _: &mut Peekable<Iter<String>>,
-    ) -> UResult<Option<Box<dyn token::Token>>> {
-        Ok(Self::from_it_core(it, false))
+impl token::Tokenizer for UnescapedText {
+    fn from_it(
+        it: &mut PutBackN<Chars>,
+        _: &mut Peekable<Iter<String>>,
+    ) -> UResult<Option<Box<dyn token::Token>>> {
+        Ok(Self::from_it_core(it, false))
     }
 }
-impl token::Token for UnescapedText {
-    fn print(&self, _: &mut Peekable<Iter<String>>) {
-        flush_bytes(&self.0[..]);
+impl token::Token for UnescapedText {
+    fn print(&self, _: &mut Peekable<Iter<String>>) {
+        flush_bytes(&self.0[..]);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/features/utmpx.rs.html b/dev/src/uucore/features/utmpx.rs.html index 4640c3426..ac8b8da16 100644 --- a/dev/src/uucore/features/utmpx.rs.html +++ b/dev/src/uucore/features/utmpx.rs.html @@ -1,4 +1,4 @@ -utmpx.rs - source
1
+utmpx.rs - source
1
 2
 3
 4
@@ -354,361 +354,361 @@
 354
 355
 356
-
// This file is part of the uutils coreutils package.
-//
-// (c) Jian Zeng <anonymousknight96@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
-//
-//! Aims to provide platform-independent methods to obtain login records
-//!
-//! **ONLY** support linux, macos and freebsd for the time being
-//!
-//! # Examples:
-//!
-//! ```
-//! use uucore::utmpx::Utmpx;
-//! for ut in Utmpx::iter_all_records() {
-//!     if ut.is_user_process() {
-//!         println!("{}: {}", ut.host(), ut.user())
-//!     }
-//! }
-//! ```
-//!
-//! Specifying the path to login record:
-//!
-//! ```
-//! use uucore::utmpx::Utmpx;
-//! for ut in Utmpx::iter_all_records_from("/some/where/else") {
-//!     if ut.is_user_process() {
-//!         println!("{}: {}", ut.host(), ut.user())
-//!     }
-//! }
-//! ```
+
// This file is part of the uutils coreutils package.
+//
+// (c) Jian Zeng <anonymousknight96@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
+//
+//! Aims to provide platform-independent methods to obtain login records
+//!
+//! **ONLY** support linux, macos and freebsd for the time being
+//!
+//! # Examples:
+//!
+//! ```
+//! use uucore::utmpx::Utmpx;
+//! for ut in Utmpx::iter_all_records() {
+//!     if ut.is_user_process() {
+//!         println!("{}: {}", ut.host(), ut.user())
+//!     }
+//! }
+//! ```
+//!
+//! Specifying the path to login record:
+//!
+//! ```
+//! use uucore::utmpx::Utmpx;
+//! for ut in Utmpx::iter_all_records_from("/some/where/else") {
+//!     if ut.is_user_process() {
+//!         println!("{}: {}", ut.host(), ut.user())
+//!     }
+//! }
+//! ```
 
-pub extern crate time;
+pub extern crate time;
 
-use std::ffi::CString;
-use std::io::Result as IOResult;
-use std::marker::PhantomData;
-use std::os::unix::ffi::OsStrExt;
-use std::path::Path;
-use std::ptr;
-use std::sync::{Mutex, MutexGuard};
+use std::ffi::CString;
+use std::io::Result as IOResult;
+use std::marker::PhantomData;
+use std::os::unix::ffi::OsStrExt;
+use std::path::Path;
+use std::ptr;
+use std::sync::{Mutex, MutexGuard};
 
-pub use self::ut::*;
-use libc::utmpx;
-// pub use libc::getutxid;
-// pub use libc::getutxline;
-// pub use libc::pututxline;
-pub use libc::endutxent;
-pub use libc::getutxent;
-pub use libc::setutxent;
-#[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "netbsd"))]
-pub use libc::utmpxname;
-#[cfg(target_os = "freebsd")]
-pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int {
-    0
-}
+pub use self::ut::*;
+use libc::utmpx;
+// pub use libc::getutxid;
+// pub use libc::getutxline;
+// pub use libc::pututxline;
+pub use libc::endutxent;
+pub use libc::getutxent;
+pub use libc::setutxent;
+#[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "netbsd"))]
+pub use libc::utmpxname;
+#[cfg(target_os = "freebsd")]
+pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int {
+    0
+}
 
-use once_cell::sync::Lazy;
+use once_cell::sync::Lazy;
 
-use crate::*; // import macros from `../../macros.rs`
+use crate::*; // import macros from `../../macros.rs`
 
-// In case the c_char array doesn't end with NULL
-macro_rules! chars2string {
-    ($arr:expr) => {
-        $arr.iter()
-            .take_while(|i| **i > 0)
-            .map(|&i| i as u8 as char)
-            .collect::<String>()
+// In case the c_char array doesn't end with NULL
+macro_rules! chars2string {
+    ($arr:expr) => {
+        $arr.iter()
+            .take_while(|i| **i > 0)
+            .map(|&i| i as u8 as char)
+            .collect::<String>()
     };
 }
 
-#[cfg(target_os = "linux")]
-mod ut {
-    pub static DEFAULT_FILE: &str = "/var/run/utmp";
+#[cfg(target_os = "linux")]
+mod ut {
+    pub static DEFAULT_FILE: &str = "/var/run/utmp";
 
-    pub use libc::__UT_HOSTSIZE as UT_HOSTSIZE;
-    pub use libc::__UT_LINESIZE as UT_LINESIZE;
-    pub use libc::__UT_NAMESIZE as UT_NAMESIZE;
-    pub const UT_IDSIZE: usize = 4;
+    pub use libc::__UT_HOSTSIZE as UT_HOSTSIZE;
+    pub use libc::__UT_LINESIZE as UT_LINESIZE;
+    pub use libc::__UT_NAMESIZE as UT_NAMESIZE;
+    pub const UT_IDSIZE: usize = 4;
 
-    pub use libc::ACCOUNTING;
-    pub use libc::BOOT_TIME;
-    pub use libc::DEAD_PROCESS;
-    pub use libc::EMPTY;
-    pub use libc::INIT_PROCESS;
-    pub use libc::LOGIN_PROCESS;
-    pub use libc::NEW_TIME;
-    pub use libc::OLD_TIME;
-    pub use libc::RUN_LVL;
-    pub use libc::USER_PROCESS;
+    pub use libc::ACCOUNTING;
+    pub use libc::BOOT_TIME;
+    pub use libc::DEAD_PROCESS;
+    pub use libc::EMPTY;
+    pub use libc::INIT_PROCESS;
+    pub use libc::LOGIN_PROCESS;
+    pub use libc::NEW_TIME;
+    pub use libc::OLD_TIME;
+    pub use libc::RUN_LVL;
+    pub use libc::USER_PROCESS;
 }
 
-#[cfg(target_vendor = "apple")]
-mod ut {
-    pub static DEFAULT_FILE: &str = "/var/run/utmpx";
+#[cfg(target_vendor = "apple")]
+mod ut {
+    pub static DEFAULT_FILE: &str = "/var/run/utmpx";
 
-    pub use libc::_UTX_HOSTSIZE as UT_HOSTSIZE;
-    pub use libc::_UTX_IDSIZE as UT_IDSIZE;
-    pub use libc::_UTX_LINESIZE as UT_LINESIZE;
-    pub use libc::_UTX_USERSIZE as UT_NAMESIZE;
+    pub use libc::_UTX_HOSTSIZE as UT_HOSTSIZE;
+    pub use libc::_UTX_IDSIZE as UT_IDSIZE;
+    pub use libc::_UTX_LINESIZE as UT_LINESIZE;
+    pub use libc::_UTX_USERSIZE as UT_NAMESIZE;
 
-    pub use libc::ACCOUNTING;
-    pub use libc::BOOT_TIME;
-    pub use libc::DEAD_PROCESS;
-    pub use libc::EMPTY;
-    pub use libc::INIT_PROCESS;
-    pub use libc::LOGIN_PROCESS;
-    pub use libc::NEW_TIME;
-    pub use libc::OLD_TIME;
-    pub use libc::RUN_LVL;
-    pub use libc::SHUTDOWN_TIME;
-    pub use libc::SIGNATURE;
-    pub use libc::USER_PROCESS;
+    pub use libc::ACCOUNTING;
+    pub use libc::BOOT_TIME;
+    pub use libc::DEAD_PROCESS;
+    pub use libc::EMPTY;
+    pub use libc::INIT_PROCESS;
+    pub use libc::LOGIN_PROCESS;
+    pub use libc::NEW_TIME;
+    pub use libc::OLD_TIME;
+    pub use libc::RUN_LVL;
+    pub use libc::SHUTDOWN_TIME;
+    pub use libc::SIGNATURE;
+    pub use libc::USER_PROCESS;
 }
 
-#[cfg(target_os = "freebsd")]
-mod ut {
-    pub static DEFAULT_FILE: &str = "";
+#[cfg(target_os = "freebsd")]
+mod ut {
+    pub static DEFAULT_FILE: &str = "";
 
-    pub const UT_LINESIZE: usize = 16;
-    pub const UT_NAMESIZE: usize = 32;
-    pub const UT_IDSIZE: usize = 8;
-    pub const UT_HOSTSIZE: usize = 128;
+    pub const UT_LINESIZE: usize = 16;
+    pub const UT_NAMESIZE: usize = 32;
+    pub const UT_IDSIZE: usize = 8;
+    pub const UT_HOSTSIZE: usize = 128;
 
-    pub use libc::BOOT_TIME;
-    pub use libc::DEAD_PROCESS;
-    pub use libc::EMPTY;
-    pub use libc::INIT_PROCESS;
-    pub use libc::LOGIN_PROCESS;
-    pub use libc::NEW_TIME;
-    pub use libc::OLD_TIME;
-    pub use libc::SHUTDOWN_TIME;
-    pub use libc::USER_PROCESS;
+    pub use libc::BOOT_TIME;
+    pub use libc::DEAD_PROCESS;
+    pub use libc::EMPTY;
+    pub use libc::INIT_PROCESS;
+    pub use libc::LOGIN_PROCESS;
+    pub use libc::NEW_TIME;
+    pub use libc::OLD_TIME;
+    pub use libc::SHUTDOWN_TIME;
+    pub use libc::USER_PROCESS;
 }
 
-#[cfg(target_os = "netbsd")]
-mod ut {
-    pub static DEFAULT_FILE: &str = "/var/run/utmpx";
+#[cfg(target_os = "netbsd")]
+mod ut {
+    pub static DEFAULT_FILE: &str = "/var/run/utmpx";
 
-    pub const ACCOUNTING: usize = 9;
-    pub const SHUTDOWN_TIME: usize = 11;
+    pub const ACCOUNTING: usize = 9;
+    pub const SHUTDOWN_TIME: usize = 11;
 
-    pub use libc::_UTX_HOSTSIZE as UT_HOSTSIZE;
-    pub use libc::_UTX_IDSIZE as UT_IDSIZE;
-    pub use libc::_UTX_LINESIZE as UT_LINESIZE;
-    pub use libc::_UTX_USERSIZE as UT_NAMESIZE;
+    pub use libc::_UTX_HOSTSIZE as UT_HOSTSIZE;
+    pub use libc::_UTX_IDSIZE as UT_IDSIZE;
+    pub use libc::_UTX_LINESIZE as UT_LINESIZE;
+    pub use libc::_UTX_USERSIZE as UT_NAMESIZE;
 
-    pub use libc::ACCOUNTING;
-    pub use libc::DEAD_PROCESS;
-    pub use libc::EMPTY;
-    pub use libc::INIT_PROCESS;
-    pub use libc::LOGIN_PROCESS;
-    pub use libc::NEW_TIME;
-    pub use libc::OLD_TIME;
-    pub use libc::RUN_LVL;
-    pub use libc::SIGNATURE;
-    pub use libc::USER_PROCESS;
+    pub use libc::ACCOUNTING;
+    pub use libc::DEAD_PROCESS;
+    pub use libc::EMPTY;
+    pub use libc::INIT_PROCESS;
+    pub use libc::LOGIN_PROCESS;
+    pub use libc::NEW_TIME;
+    pub use libc::OLD_TIME;
+    pub use libc::RUN_LVL;
+    pub use libc::SIGNATURE;
+    pub use libc::USER_PROCESS;
 }
 
-pub struct Utmpx {
-    inner: utmpx,
+pub struct Utmpx {
+    inner: utmpx,
 }
 
-impl Utmpx {
-    /// A.K.A. ut.ut_type
-    pub fn record_type(&self) -> i16 {
-        self.inner.ut_type as i16
+impl Utmpx {
+    /// A.K.A. ut.ut_type
+    pub fn record_type(&self) -> i16 {
+        self.inner.ut_type as i16
     }
-    /// A.K.A. ut.ut_pid
-    pub fn pid(&self) -> i32 {
-        self.inner.ut_pid as i32
+    /// A.K.A. ut.ut_pid
+    pub fn pid(&self) -> i32 {
+        self.inner.ut_pid as i32
     }
-    /// A.K.A. ut.ut_id
-    pub fn terminal_suffix(&self) -> String {
-        chars2string!(self.inner.ut_id)
+    /// A.K.A. ut.ut_id
+    pub fn terminal_suffix(&self) -> String {
+        chars2string!(self.inner.ut_id)
     }
-    /// A.K.A. ut.ut_user
-    pub fn user(&self) -> String {
-        chars2string!(self.inner.ut_user)
+    /// A.K.A. ut.ut_user
+    pub fn user(&self) -> String {
+        chars2string!(self.inner.ut_user)
     }
-    /// A.K.A. ut.ut_host
-    pub fn host(&self) -> String {
-        chars2string!(self.inner.ut_host)
+    /// A.K.A. ut.ut_host
+    pub fn host(&self) -> String {
+        chars2string!(self.inner.ut_host)
     }
-    /// A.K.A. ut.ut_line
-    pub fn tty_device(&self) -> String {
-        chars2string!(self.inner.ut_line)
+    /// A.K.A. ut.ut_line
+    pub fn tty_device(&self) -> String {
+        chars2string!(self.inner.ut_line)
     }
-    /// A.K.A. ut.ut_tv
-    pub fn login_time(&self) -> time::OffsetDateTime {
-        let ts_nanos: i128 = (self.inner.ut_tv.tv_sec as i64 * 1_000_000_000_i64
-            + self.inner.ut_tv.tv_usec as i64 * 1_000_i64)
-            .into();
-        let local_offset = time::OffsetDateTime::now_local().unwrap().offset();
-        time::OffsetDateTime::from_unix_timestamp_nanos(ts_nanos)
-            .unwrap()
-            .to_offset(local_offset)
+    /// A.K.A. ut.ut_tv
+    pub fn login_time(&self) -> time::OffsetDateTime {
+        let ts_nanos: i128 = (self.inner.ut_tv.tv_sec as i64 * 1_000_000_000_i64
+            + self.inner.ut_tv.tv_usec as i64 * 1_000_i64)
+            .into();
+        let local_offset = time::OffsetDateTime::now_local().unwrap().offset();
+        time::OffsetDateTime::from_unix_timestamp_nanos(ts_nanos)
+            .unwrap()
+            .to_offset(local_offset)
     }
-    /// A.K.A. ut.ut_exit
-    ///
-    /// Return (e_termination, e_exit)
-    #[cfg(target_os = "linux")]
-    pub fn exit_status(&self) -> (i16, i16) {
-        (self.inner.ut_exit.e_termination, self.inner.ut_exit.e_exit)
+    /// A.K.A. ut.ut_exit
+    ///
+    /// Return (e_termination, e_exit)
+    #[cfg(target_os = "linux")]
+    pub fn exit_status(&self) -> (i16, i16) {
+        (self.inner.ut_exit.e_termination, self.inner.ut_exit.e_exit)
     }
-    /// A.K.A. ut.ut_exit
-    ///
-    /// Return (0, 0) on Non-Linux platform
-    #[cfg(not(target_os = "linux"))]
-    pub fn exit_status(&self) -> (i16, i16) {
+    /// A.K.A. ut.ut_exit
+    ///
+    /// Return (0, 0) on Non-Linux platform
+    #[cfg(not(target_os = "linux"))]
+    pub fn exit_status(&self) -> (i16, i16) {
         (0, 0)
     }
-    /// Consumes the `Utmpx`, returning the underlying C struct utmpx
-    pub fn into_inner(self) -> utmpx {
-        self.inner
+    /// Consumes the `Utmpx`, returning the underlying C struct utmpx
+    pub fn into_inner(self) -> utmpx {
+        self.inner
     }
-    pub fn is_user_process(&self) -> bool {
-        !self.user().is_empty() && self.record_type() == USER_PROCESS
+    pub fn is_user_process(&self) -> bool {
+        !self.user().is_empty() && self.record_type() == USER_PROCESS
     }
 
-    /// Canonicalize host name using DNS
-    pub fn canon_host(&self) -> IOResult<String> {
-        let host = self.host();
+    /// Canonicalize host name using DNS
+    pub fn canon_host(&self) -> IOResult<String> {
+        let host = self.host();
 
-        let (hostname, display) = host.split_once(':').unwrap_or((&host, ""));
+        let (hostname, display) = host.split_once(':').unwrap_or((&host, ""));
 
-        if !hostname.is_empty() {
-            extern crate dns_lookup;
-            use dns_lookup::{getaddrinfo, AddrInfoHints};
+        if !hostname.is_empty() {
+            extern crate dns_lookup;
+            use dns_lookup::{getaddrinfo, AddrInfoHints};
 
-            const AI_CANONNAME: i32 = 0x2;
-            let hints = AddrInfoHints {
-                flags: AI_CANONNAME,
-                ..AddrInfoHints::default()
+            const AI_CANONNAME: i32 = 0x2;
+            let hints = AddrInfoHints {
+                flags: AI_CANONNAME,
+                ..AddrInfoHints::default()
             };
-            if let Ok(sockets) = getaddrinfo(Some(hostname), None, Some(hints)) {
-                let sockets = sockets.collect::<IOResult<Vec<_>>>()?;
-                for socket in sockets {
-                    if let Some(ai_canonname) = socket.canonname {
-                        return Ok(if display.is_empty() {
-                            ai_canonname
-                        } else {
-                            format!("{}:{}", ai_canonname, display)
+            if let Ok(sockets) = getaddrinfo(Some(hostname), None, Some(hints)) {
+                let sockets = sockets.collect::<IOResult<Vec<_>>>()?;
+                for socket in sockets {
+                    if let Some(ai_canonname) = socket.canonname {
+                        return Ok(if display.is_empty() {
+                            ai_canonname
+                        } else {
+                            format!("{}:{}", ai_canonname, display)
                         });
                     }
                 }
-            } else {
-                // GNU coreutils has this behavior
-                return Ok(hostname.to_string());
+            } else {
+                // GNU coreutils has this behavior
+                return Ok(hostname.to_string());
             }
         }
 
-        Ok(host.to_string())
+        Ok(host.to_string())
     }
 
-    /// Iterate through all the utmp records.
-    ///
-    /// This will use the default location, or the path [`Utmpx::iter_all_records_from`]
-    /// was most recently called with.
-    ///
-    /// Only one instance of [`UtmpxIter`] may be active at a time. This
-    /// function will block as long as one is still active. Beware!
-    pub fn iter_all_records() -> UtmpxIter {
-        let iter = UtmpxIter::new();
-        unsafe {
-            // This can technically fail, and it would be nice to detect that,
-            // but it doesn't return anything so we'd have to do nasty things
-            // with errno.
-            setutxent();
+    /// Iterate through all the utmp records.
+    ///
+    /// This will use the default location, or the path [`Utmpx::iter_all_records_from`]
+    /// was most recently called with.
+    ///
+    /// Only one instance of [`UtmpxIter`] may be active at a time. This
+    /// function will block as long as one is still active. Beware!
+    pub fn iter_all_records() -> UtmpxIter {
+        let iter = UtmpxIter::new();
+        unsafe {
+            // This can technically fail, and it would be nice to detect that,
+            // but it doesn't return anything so we'd have to do nasty things
+            // with errno.
+            setutxent();
         }
-        iter
+        iter
     }
 
-    /// Iterate through all the utmp records from a specific file.
-    ///
-    /// No failure is reported or detected.
-    ///
-    /// This function affects subsequent calls to [`Utmpx::iter_all_records`].
-    ///
-    /// The same caveats as for [`Utmpx::iter_all_records`] apply.
-    pub fn iter_all_records_from<P: AsRef<Path>>(path: P) -> UtmpxIter {
-        let iter = UtmpxIter::new();
-        let path = CString::new(path.as_ref().as_os_str().as_bytes()).unwrap();
-        unsafe {
-            // In glibc, utmpxname() only fails if there's not enough memory
-            // to copy the string.
-            // Solaris returns 1 on success instead of 0. Supposedly there also
-            // exist systems where it returns void.
-            // GNU who on Debian seems to output nothing if an invalid filename
-            // is specified, no warning or anything.
-            // So this function is pretty crazy and we don't try to detect errors.
-            // Not much we can do besides pray.
-            utmpxname(path.as_ptr());
-            setutxent();
+    /// Iterate through all the utmp records from a specific file.
+    ///
+    /// No failure is reported or detected.
+    ///
+    /// This function affects subsequent calls to [`Utmpx::iter_all_records`].
+    ///
+    /// The same caveats as for [`Utmpx::iter_all_records`] apply.
+    pub fn iter_all_records_from<P: AsRef<Path>>(path: P) -> UtmpxIter {
+        let iter = UtmpxIter::new();
+        let path = CString::new(path.as_ref().as_os_str().as_bytes()).unwrap();
+        unsafe {
+            // In glibc, utmpxname() only fails if there's not enough memory
+            // to copy the string.
+            // Solaris returns 1 on success instead of 0. Supposedly there also
+            // exist systems where it returns void.
+            // GNU who on Debian seems to output nothing if an invalid filename
+            // is specified, no warning or anything.
+            // So this function is pretty crazy and we don't try to detect errors.
+            // Not much we can do besides pray.
+            utmpxname(path.as_ptr());
+            setutxent();
         }
-        iter
+        iter
     }
 }
 
-// On some systems these functions are not thread-safe. On others they're
-// thread-local. Therefore we use a mutex to allow only one guard to exist at
-// a time, and make sure UtmpxIter cannot be sent across threads.
-//
-// I believe the only technical memory unsafety that could happen is a data
-// race while copying the data out of the pointer returned by getutxent(), but
-// ordinary race conditions are also very much possible.
-static LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));
+// On some systems these functions are not thread-safe. On others they're
+// thread-local. Therefore we use a mutex to allow only one guard to exist at
+// a time, and make sure UtmpxIter cannot be sent across threads.
+//
+// I believe the only technical memory unsafety that could happen is a data
+// race while copying the data out of the pointer returned by getutxent(), but
+// ordinary race conditions are also very much possible.
+static LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));
 
-/// Iterator of login records
-pub struct UtmpxIter {
-    #[allow(dead_code)]
-    guard: MutexGuard<'static, ()>,
-    /// Ensure UtmpxIter is !Send. Technically redundant because MutexGuard
-    /// is also !Send.
-    phantom: PhantomData<std::rc::Rc<()>>,
+/// Iterator of login records
+pub struct UtmpxIter {
+    #[allow(dead_code)]
+    guard: MutexGuard<'static, ()>,
+    /// Ensure UtmpxIter is !Send. Technically redundant because MutexGuard
+    /// is also !Send.
+    phantom: PhantomData<std::rc::Rc<()>>,
 }
 
-impl UtmpxIter {
-    fn new() -> Self {
-        // PoisonErrors can safely be ignored
-        let guard = LOCK.lock().unwrap_or_else(|err| err.into_inner());
-        Self {
-            guard,
-            phantom: PhantomData,
+impl UtmpxIter {
+    fn new() -> Self {
+        // PoisonErrors can safely be ignored
+        let guard = LOCK.lock().unwrap_or_else(|err| err.into_inner());
+        Self {
+            guard,
+            phantom: PhantomData,
         }
     }
 }
 
-impl Iterator for UtmpxIter {
-    type Item = Utmpx;
-    fn next(&mut self) -> Option<Self::Item> {
-        unsafe {
-            let res = getutxent();
-            if !res.is_null() {
-                // The data behind this pointer will be replaced by the next
-                // call to getutxent(), so we have to read it now.
-                // All the strings live inline in the struct as arrays, which
-                // makes things easier.
-                Some(Utmpx {
-                    inner: ptr::read(res as *const _),
+impl Iterator for UtmpxIter {
+    type Item = Utmpx;
+    fn next(&mut self) -> Option<Self::Item> {
+        unsafe {
+            let res = getutxent();
+            if !res.is_null() {
+                // The data behind this pointer will be replaced by the next
+                // call to getutxent(), so we have to read it now.
+                // All the strings live inline in the struct as arrays, which
+                // makes things easier.
+                Some(Utmpx {
+                    inner: ptr::read(res as *const _),
                 })
-            } else {
-                None
-            }
+            } else {
+                None
+            }
         }
     }
 }
 
-impl Drop for UtmpxIter {
-    fn drop(&mut self) {
-        unsafe {
-            endutxent();
+impl Drop for UtmpxIter {
+    fn drop(&mut self) {
+        unsafe {
+            endutxent();
         }
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/lib.rs.html b/dev/src/uucore/lib.rs.html index 40a8bc226..1f33f44d5 100644 --- a/dev/src/uucore/lib.rs.html +++ b/dev/src/uucore/lib.rs.html @@ -1,4 +1,4 @@ -lib.rs - source
1
+lib.rs - source
1
 2
 3
 4
@@ -234,241 +234,241 @@
 234
 235
 236
-
// library ~ (core/bundler file)
+
// library ~ (core/bundler file)
 
-// Copyright (C) ~ Alex Lyon <arcterus@mail.com>
-// Copyright (C) ~ Roy Ivy III <rivy.dev@gmail.com>; MIT license
+// Copyright (C) ~ Alex Lyon <arcterus@mail.com>
+// Copyright (C) ~ Roy Ivy III <rivy.dev@gmail.com>; MIT license
 
-// * feature-gated external crates (re-shared as public internal modules)
-#[cfg(feature = "libc")]
-pub extern crate libc;
-#[cfg(all(feature = "windows-sys", target_os = "windows"))]
-pub extern crate windows_sys;
+// * feature-gated external crates (re-shared as public internal modules)
+#[cfg(feature = "libc")]
+pub extern crate libc;
+#[cfg(all(feature = "windows-sys", target_os = "windows"))]
+pub extern crate windows_sys;
 
-//## internal modules
+//## internal modules
 
-mod features; // feature-gated code modules
-mod macros; // crate macros (macro_rules-type; exported to `crate::...`)
-mod mods; // core cross-platform modules
-mod parser; // string parsing modules
+mod features; // feature-gated code modules
+mod macros; // crate macros (macro_rules-type; exported to `crate::...`)
+mod mods; // core cross-platform modules
+mod parser; // string parsing modules
 
-pub use uucore_procs::*;
+pub use uucore_procs::*;
 
-// * cross-platform modules
-pub use crate::mods::backup_control;
-pub use crate::mods::display;
-pub use crate::mods::error;
-pub use crate::mods::os;
-pub use crate::mods::panic;
-pub use crate::mods::quoting_style;
-pub use crate::mods::ranges;
-pub use crate::mods::version_cmp;
+// * cross-platform modules
+pub use crate::mods::backup_control;
+pub use crate::mods::display;
+pub use crate::mods::error;
+pub use crate::mods::os;
+pub use crate::mods::panic;
+pub use crate::mods::quoting_style;
+pub use crate::mods::ranges;
+pub use crate::mods::version_cmp;
 
-// * string parsing modules
-pub use crate::parser::parse_glob;
-pub use crate::parser::parse_size;
-pub use crate::parser::parse_time;
+// * string parsing modules
+pub use crate::parser::parse_glob;
+pub use crate::parser::parse_size;
+pub use crate::parser::parse_time;
 
-// * feature-gated modules
-#[cfg(feature = "encoding")]
-pub use crate::features::encoding;
-#[cfg(feature = "fs")]
-pub use crate::features::fs;
-#[cfg(feature = "fsext")]
-pub use crate::features::fsext;
-#[cfg(feature = "lines")]
-pub use crate::features::lines;
-#[cfg(feature = "memo")]
-pub use crate::features::memo;
-#[cfg(feature = "ringbuffer")]
-pub use crate::features::ringbuffer;
+// * feature-gated modules
+#[cfg(feature = "encoding")]
+pub use crate::features::encoding;
+#[cfg(feature = "fs")]
+pub use crate::features::fs;
+#[cfg(feature = "fsext")]
+pub use crate::features::fsext;
+#[cfg(feature = "lines")]
+pub use crate::features::lines;
+#[cfg(feature = "memo")]
+pub use crate::features::memo;
+#[cfg(feature = "ringbuffer")]
+pub use crate::features::ringbuffer;
 
-// * (platform-specific) feature-gated modules
-// ** non-windows (i.e. Unix + Fuchsia)
-#[cfg(all(not(windows), feature = "mode"))]
-pub use crate::features::mode;
-// ** unix-only
-#[cfg(all(unix, feature = "entries"))]
-pub use crate::features::entries;
-#[cfg(all(unix, feature = "perms"))]
-pub use crate::features::perms;
-#[cfg(all(unix, feature = "pipes"))]
-pub use crate::features::pipes;
-#[cfg(all(unix, feature = "process"))]
-pub use crate::features::process;
-#[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))]
-pub use crate::features::signals;
-#[cfg(all(
-    unix,
-    not(target_os = "android"),
-    not(target_os = "fuchsia"),
-    not(target_os = "redox"),
-    not(target_env = "musl"),
-    feature = "utmpx"
-))]
-pub use crate::features::utmpx;
-// ** windows-only
-#[cfg(all(windows, feature = "wide"))]
-pub use crate::features::wide;
+// * (platform-specific) feature-gated modules
+// ** non-windows (i.e. Unix + Fuchsia)
+#[cfg(all(not(windows), feature = "mode"))]
+pub use crate::features::mode;
+// ** unix-only
+#[cfg(all(unix, feature = "entries"))]
+pub use crate::features::entries;
+#[cfg(all(unix, feature = "perms"))]
+pub use crate::features::perms;
+#[cfg(all(unix, feature = "pipes"))]
+pub use crate::features::pipes;
+#[cfg(all(unix, feature = "process"))]
+pub use crate::features::process;
+#[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))]
+pub use crate::features::signals;
+#[cfg(all(
+    unix,
+    not(target_os = "android"),
+    not(target_os = "fuchsia"),
+    not(target_os = "redox"),
+    not(target_env = "musl"),
+    feature = "utmpx"
+))]
+pub use crate::features::utmpx;
+// ** windows-only
+#[cfg(all(windows, feature = "wide"))]
+pub use crate::features::wide;
 
-//## core functions
+//## core functions
 
-use std::ffi::OsString;
-use std::sync::atomic::Ordering;
+use std::ffi::OsString;
+use std::sync::atomic::Ordering;
 
-use once_cell::sync::Lazy;
+use once_cell::sync::Lazy;
 
-#[macro_export]
-macro_rules! bin {
-    ($util:ident) => {
-        pub fn main() {
-            use std::io::Write;
-            uucore::panic::mute_sigpipe_panic(); // suppress extraneous error output for SIGPIPE failures/panics
-            let code = $util::uumain(uucore::args_os()); // execute utility code
-            std::io::stdout().flush().expect("could not flush stdout"); // (defensively) flush stdout for utility prior to exit; see <https://github.com/rust-lang/rust/issues/23818>
-            std::process::exit(code);
+#[macro_export]
+macro_rules! bin {
+    ($util:ident) => {
+        pub fn main() {
+            use std::io::Write;
+            uucore::panic::mute_sigpipe_panic(); // suppress extraneous error output for SIGPIPE failures/panics
+            let code = $util::uumain(uucore::args_os()); // execute utility code
+            std::io::stdout().flush().expect("could not flush stdout"); // (defensively) flush stdout for utility prior to exit; see <https://github.com/rust-lang/rust/issues/23818>
+            std::process::exit(code);
         }
     };
 }
 
-/// Generate the usage string for clap.
-///
-/// This function replaces all occurrences of `{}` with the execution phrase
-/// and returns the resulting `String`. It does **not** support
-/// more advanced formatting features such as `{0}`.
-pub fn format_usage(s: &str) -> String {
-    s.replace("{}", crate::execution_phrase())
+/// Generate the usage string for clap.
+///
+/// This function replaces all occurrences of `{}` with the execution phrase
+/// and returns the resulting `String`. It does **not** support
+/// more advanced formatting features such as `{0}`.
+pub fn format_usage(s: &str) -> String {
+    s.replace("{}", crate::execution_phrase())
 }
 
-pub fn get_utility_is_second_arg() -> bool {
-    crate::macros::UTILITY_IS_SECOND_ARG.load(Ordering::SeqCst)
+pub fn get_utility_is_second_arg() -> bool {
+    crate::macros::UTILITY_IS_SECOND_ARG.load(Ordering::SeqCst)
 }
 
-pub fn set_utility_is_second_arg() {
-    crate::macros::UTILITY_IS_SECOND_ARG.store(true, Ordering::SeqCst);
+pub fn set_utility_is_second_arg() {
+    crate::macros::UTILITY_IS_SECOND_ARG.store(true, Ordering::SeqCst);
 }
 
-// args_os() can be expensive to call, it copies all of argv before iterating.
-// So if we want only the first arg or so it's overkill. We cache it.
-static ARGV: Lazy<Vec<OsString>> = Lazy::new(|| wild::args_os().collect());
+// args_os() can be expensive to call, it copies all of argv before iterating.
+// So if we want only the first arg or so it's overkill. We cache it.
+static ARGV: Lazy<Vec<OsString>> = Lazy::new(|| wild::args_os().collect());
 
-static UTIL_NAME: Lazy<String> = Lazy::new(|| {
-    if get_utility_is_second_arg() {
-        &ARGV[1]
-    } else {
-        &ARGV[0]
+static UTIL_NAME: Lazy<String> = Lazy::new(|| {
+    if get_utility_is_second_arg() {
+        &ARGV[1]
+    } else {
+        &ARGV[0]
     }
-    .to_string_lossy()
-    .into_owned()
+    .to_string_lossy()
+    .into_owned()
 });
 
-/// Derive the utility name.
-pub fn util_name() -> &'static str {
-    &UTIL_NAME
+/// Derive the utility name.
+pub fn util_name() -> &'static str {
+    &UTIL_NAME
 }
 
-static EXECUTION_PHRASE: Lazy<String> = Lazy::new(|| {
-    if get_utility_is_second_arg() {
-        ARGV.iter()
-            .take(2)
-            .map(|os_str| os_str.to_string_lossy().into_owned())
-            .collect::<Vec<_>>()
-            .join(" ")
-    } else {
-        ARGV[0].to_string_lossy().into_owned()
+static EXECUTION_PHRASE: Lazy<String> = Lazy::new(|| {
+    if get_utility_is_second_arg() {
+        ARGV.iter()
+            .take(2)
+            .map(|os_str| os_str.to_string_lossy().into_owned())
+            .collect::<Vec<_>>()
+            .join(" ")
+    } else {
+        ARGV[0].to_string_lossy().into_owned()
     }
 });
 
-/// Derive the complete execution phrase for "usage".
-pub fn execution_phrase() -> &'static str {
-    &EXECUTION_PHRASE
+/// Derive the complete execution phrase for "usage".
+pub fn execution_phrase() -> &'static str {
+    &EXECUTION_PHRASE
 }
 
-pub trait Args: Iterator<Item = OsString> + Sized {
-    /// Collects the iterator into a `Vec<String>`, lossily converting the `OsString`s to `Strings`.
-    fn collect_lossy(self) -> Vec<String> {
-        self.map(|s| s.to_string_lossy().into_owned()).collect()
+pub trait Args: Iterator<Item = OsString> + Sized {
+    /// Collects the iterator into a `Vec<String>`, lossily converting the `OsString`s to `Strings`.
+    fn collect_lossy(self) -> Vec<String> {
+        self.map(|s| s.to_string_lossy().into_owned()).collect()
     }
 
-    /// Collects the iterator into a `Vec<String>`, removing any elements that contain invalid encoding.
-    fn collect_ignore(self) -> Vec<String> {
-        self.filter_map(|s| s.into_string().ok()).collect()
+    /// Collects the iterator into a `Vec<String>`, removing any elements that contain invalid encoding.
+    fn collect_ignore(self) -> Vec<String> {
+        self.filter_map(|s| s.into_string().ok()).collect()
     }
 }
 
-impl<T: Iterator<Item = OsString> + Sized> Args for T {}
+impl<T: Iterator<Item = OsString> + Sized> Args for T {}
 
-pub fn args_os() -> impl Iterator<Item = OsString> {
-    ARGV.iter().cloned()
+pub fn args_os() -> impl Iterator<Item = OsString> {
+    ARGV.iter().cloned()
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use std::ffi::OsStr;
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use std::ffi::OsStr;
 
-    fn make_os_vec(os_str: &OsStr) -> Vec<OsString> {
+    fn make_os_vec(os_str: &OsStr) -> Vec<OsString> {
         vec![
-            OsString::from("test"),
-            OsString::from("สวัสดี"), // spell-checker:disable-line
-            os_str.to_os_string(),
+            OsString::from("test"),
+            OsString::from("สวัสดี"), // spell-checker:disable-line
+            os_str.to_os_string(),
         ]
     }
 
-    #[cfg(any(unix, target_os = "redox"))]
-    fn test_invalid_utf8_args_lossy(os_str: &OsStr) {
-        // assert our string is invalid utf8
-        assert!(os_str.to_os_string().into_string().is_err());
-        let test_vec = make_os_vec(os_str);
-        let collected_to_str = test_vec.clone().into_iter().collect_lossy();
-        // conservation of length - when accepting lossy conversion no arguments may be dropped
-        assert_eq!(collected_to_str.len(), test_vec.len());
-        // first indices identical
-        for index in 0..2 {
-            assert_eq!(collected_to_str[index], test_vec[index].to_str().unwrap());
+    #[cfg(any(unix, target_os = "redox"))]
+    fn test_invalid_utf8_args_lossy(os_str: &OsStr) {
+        // assert our string is invalid utf8
+        assert!(os_str.to_os_string().into_string().is_err());
+        let test_vec = make_os_vec(os_str);
+        let collected_to_str = test_vec.clone().into_iter().collect_lossy();
+        // conservation of length - when accepting lossy conversion no arguments may be dropped
+        assert_eq!(collected_to_str.len(), test_vec.len());
+        // first indices identical
+        for index in 0..2 {
+            assert_eq!(collected_to_str[index], test_vec[index].to_str().unwrap());
         }
-        // lossy conversion for string with illegal encoding is done
-        assert_eq!(
-            *collected_to_str[2],
-            os_str.to_os_string().to_string_lossy()
+        // lossy conversion for string with illegal encoding is done
+        assert_eq!(
+            *collected_to_str[2],
+            os_str.to_os_string().to_string_lossy()
         );
     }
 
-    #[cfg(any(unix, target_os = "redox"))]
-    fn test_invalid_utf8_args_ignore(os_str: &OsStr) {
-        // assert our string is invalid utf8
-        assert!(os_str.to_os_string().into_string().is_err());
-        let test_vec = make_os_vec(os_str);
-        let collected_to_str = test_vec.clone().into_iter().collect_ignore();
-        // assert that the broken entry is filtered out
-        assert_eq!(collected_to_str.len(), test_vec.len() - 1);
-        // assert that the unbroken indices are converted as expected
-        for index in 0..2 {
+    #[cfg(any(unix, target_os = "redox"))]
+    fn test_invalid_utf8_args_ignore(os_str: &OsStr) {
+        // assert our string is invalid utf8
+        assert!(os_str.to_os_string().into_string().is_err());
+        let test_vec = make_os_vec(os_str);
+        let collected_to_str = test_vec.clone().into_iter().collect_ignore();
+        // assert that the broken entry is filtered out
+        assert_eq!(collected_to_str.len(), test_vec.len() - 1);
+        // assert that the unbroken indices are converted as expected
+        for index in 0..2 {
             assert_eq!(
-                collected_to_str.get(index).unwrap(),
-                test_vec.get(index).unwrap().to_str().unwrap()
+                collected_to_str.get(index).unwrap(),
+                test_vec.get(index).unwrap().to_str().unwrap()
             );
         }
     }
 
-    #[test]
-    fn valid_utf8_encoding_args() {
-        // create a vector containing only correct encoding
-        let test_vec = make_os_vec(&OsString::from("test2"));
-        // expect complete conversion without losses, even when lossy conversion is accepted
-        let _ = test_vec.into_iter().collect_lossy();
+    #[test]
+    fn valid_utf8_encoding_args() {
+        // create a vector containing only correct encoding
+        let test_vec = make_os_vec(&OsString::from("test2"));
+        // expect complete conversion without losses, even when lossy conversion is accepted
+        let _ = test_vec.into_iter().collect_lossy();
     }
 
-    #[cfg(any(unix, target_os = "redox"))]
-    #[test]
-    fn invalid_utf8_args_unix() {
-        use std::os::unix::ffi::OsStrExt;
+    #[cfg(any(unix, target_os = "redox"))]
+    #[test]
+    fn invalid_utf8_args_unix() {
+        use std::os::unix::ffi::OsStrExt;
 
-        let source = [0x66, 0x6f, 0x80, 0x6f];
-        let os_str = OsStr::from_bytes(&source[..]);
-        test_invalid_utf8_args_lossy(os_str);
-        test_invalid_utf8_args_ignore(os_str);
+        let source = [0x66, 0x6f, 0x80, 0x6f];
+        let os_str = OsStr::from_bytes(&source[..]);
+        test_invalid_utf8_args_lossy(os_str);
+        test_invalid_utf8_args_ignore(os_str);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/macros.rs.html b/dev/src/uucore/macros.rs.html index 977085c20..8a64d50b5 100644 --- a/dev/src/uucore/macros.rs.html +++ b/dev/src/uucore/macros.rs.html @@ -1,4 +1,4 @@ -macros.rs - source
1
+macros.rs - source
1
 2
 3
 4
@@ -231,238 +231,238 @@
 231
 232
 233
-
// TODO fix broken links
-#![allow(rustdoc::broken_intra_doc_links)]
-//! Macros for the uucore utilities.
-//!
-//! This module bundles all macros used across the uucore utilities. These
-//! include macros for reporting errors in various formats, aborting program
-//! execution and more.
-//!
-//! To make use of all macros in this module, they must be imported like so:
-//!
-//! ```ignore
-//! #[macro_use]
-//! extern crate uucore;
-//! ```
-//!
-//! Alternatively, you can import single macros by importing them through their
-//! fully qualified name like this:
-//!
-//! ```no_run
-//! use uucore::{show, crash};
-//! ```
-//!
-//! Here's an overview of the macros sorted by purpose
-//!
-//! - Print errors
-//!   - From types implementing [`crate::error::UError`]: [`show!`],
-//!     [`show_if_err!`]
-//!   - From custom messages: [`show_error!`]
-//! - Print warnings: [`show_warning!`]
-//! - Terminate util execution
-//!   - Crash program: [`crash!`], [`crash_if_err!`]
+
// TODO fix broken links
+#![allow(rustdoc::broken_intra_doc_links)]
+//! Macros for the uucore utilities.
+//!
+//! This module bundles all macros used across the uucore utilities. These
+//! include macros for reporting errors in various formats, aborting program
+//! execution and more.
+//!
+//! To make use of all macros in this module, they must be imported like so:
+//!
+//! ```ignore
+//! #[macro_use]
+//! extern crate uucore;
+//! ```
+//!
+//! Alternatively, you can import single macros by importing them through their
+//! fully qualified name like this:
+//!
+//! ```no_run
+//! use uucore::{show, crash};
+//! ```
+//!
+//! Here's an overview of the macros sorted by purpose
+//!
+//! - Print errors
+//!   - From types implementing [`crate::error::UError`]: [`show!`],
+//!     [`show_if_err!`]
+//!   - From custom messages: [`show_error!`]
+//! - Print warnings: [`show_warning!`]
+//! - Terminate util execution
+//!   - Crash program: [`crash!`], [`crash_if_err!`]
 
-// spell-checker:ignore sourcepath targetpath rustdoc
+// spell-checker:ignore sourcepath targetpath rustdoc
 
-use std::sync::atomic::AtomicBool;
+use std::sync::atomic::AtomicBool;
 
-// This file is part of the uutils coreutils package.
-//
-// (c) Alex Lyon <arcterus@mail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+// This file is part of the uutils coreutils package.
+//
+// (c) Alex Lyon <arcterus@mail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-/// Whether we were called as a multicall binary ("coreutils <utility>")
-pub static UTILITY_IS_SECOND_ARG: AtomicBool = AtomicBool::new(false);
+/// Whether we were called as a multicall binary ("coreutils <utility>")
+pub static UTILITY_IS_SECOND_ARG: AtomicBool = AtomicBool::new(false);
 
-//====
+//====
 
-/// Display a [`crate::error::UError`] and set global exit code.
-///
-/// Prints the error message contained in an [`crate::error::UError`] to stderr
-/// and sets the exit code through [`crate::error::set_exit_code`]. The printed
-/// error message is prepended with the calling utility's name. A call to this
-/// macro will not finish program execution.
-///
-/// # Examples
-///
-/// The following example would print a message "Some error occurred" and set
-/// the utility's exit code to 2.
-///
-/// ```
-/// # #[macro_use]
-/// # extern crate uucore;
-///
-/// use uucore::error::{self, USimpleError};
-///
-/// fn main() {
-///     let err = USimpleError::new(2, "Some error occurred.");
-///     show!(err);
-///     assert_eq!(error::get_exit_code(), 2);
-/// }
-/// ```
-///
-/// If not using [`crate::error::UError`], one may achieve the same behavior
-/// like this:
-///
-/// ```
-/// # #[macro_use]
-/// # extern crate uucore;
-///
-/// use uucore::error::set_exit_code;
-///
-/// fn main() {
-///     set_exit_code(2);
-///     show_error!("Some error occurred.");
-/// }
-/// ```
-#[macro_export]
-macro_rules! show(
-    ($err:expr) => ({
-        let e = $err;
-        $crate::error::set_exit_code(e.code());
-        eprintln!("{}: {}", $crate::util_name(), e);
+/// Display a [`crate::error::UError`] and set global exit code.
+///
+/// Prints the error message contained in an [`crate::error::UError`] to stderr
+/// and sets the exit code through [`crate::error::set_exit_code`]. The printed
+/// error message is prepended with the calling utility's name. A call to this
+/// macro will not finish program execution.
+///
+/// # Examples
+///
+/// The following example would print a message "Some error occurred" and set
+/// the utility's exit code to 2.
+///
+/// ```
+/// # #[macro_use]
+/// # extern crate uucore;
+///
+/// use uucore::error::{self, USimpleError};
+///
+/// fn main() {
+///     let err = USimpleError::new(2, "Some error occurred.");
+///     show!(err);
+///     assert_eq!(error::get_exit_code(), 2);
+/// }
+/// ```
+///
+/// If not using [`crate::error::UError`], one may achieve the same behavior
+/// like this:
+///
+/// ```
+/// # #[macro_use]
+/// # extern crate uucore;
+///
+/// use uucore::error::set_exit_code;
+///
+/// fn main() {
+///     set_exit_code(2);
+///     show_error!("Some error occurred.");
+/// }
+/// ```
+#[macro_export]
+macro_rules! show(
+    ($err:expr) => ({
+        let e = $err;
+        $crate::error::set_exit_code(e.code());
+        eprintln!("{}: {}", $crate::util_name(), e);
     })
 );
 
-/// Display an error and set global exit code in error case.
-///
-/// Wraps around [`show!`] and takes a [`crate::error::UResult`] instead of a
-/// [`crate::error::UError`] type. This macro invokes [`show!`] if the
-/// [`crate::error::UResult`] is an `Err`-variant. This can be invoked directly
-/// on the result of a function call, like in the `install` utility:
-///
-/// ```ignore
-/// show_if_err!(copy(sourcepath, &targetpath, b));
-/// ```
-///
-/// # Examples
-///
-/// ```ignore
-/// # #[macro_use]
-/// # extern crate uucore;
-/// # use uucore::error::{UError, UIoError, UResult, USimpleError};
-///
-/// # fn main() {
-/// let is_ok = Ok(1);
-/// // This does nothing at all
-/// show_if_err!(is_ok);
-///
-/// let is_err = Err(USimpleError::new(1, "I'm an error").into());
-/// // Calls `show!` on the contained USimpleError
-/// show_if_err!(is_err);
-/// # }
-/// ```
-///
-///
-#[macro_export]
-macro_rules! show_if_err(
-    ($res:expr) => ({
-        if let Err(e) = $res {
-            show!(e);
+/// Display an error and set global exit code in error case.
+///
+/// Wraps around [`show!`] and takes a [`crate::error::UResult`] instead of a
+/// [`crate::error::UError`] type. This macro invokes [`show!`] if the
+/// [`crate::error::UResult`] is an `Err`-variant. This can be invoked directly
+/// on the result of a function call, like in the `install` utility:
+///
+/// ```ignore
+/// show_if_err!(copy(sourcepath, &targetpath, b));
+/// ```
+///
+/// # Examples
+///
+/// ```ignore
+/// # #[macro_use]
+/// # extern crate uucore;
+/// # use uucore::error::{UError, UIoError, UResult, USimpleError};
+///
+/// # fn main() {
+/// let is_ok = Ok(1);
+/// // This does nothing at all
+/// show_if_err!(is_ok);
+///
+/// let is_err = Err(USimpleError::new(1, "I'm an error").into());
+/// // Calls `show!` on the contained USimpleError
+/// show_if_err!(is_err);
+/// # }
+/// ```
+///
+///
+#[macro_export]
+macro_rules! show_if_err(
+    ($res:expr) => ({
+        if let Err(e) = $res {
+            show!(e);
         }
     })
 );
 
-/// Show an error to stderr in a similar style to GNU coreutils.
-///
-/// Takes a [`format!`]-like input and prints it to stderr. The output is
-/// prepended with the current utility's name.
-///
-/// # Examples
-///
-/// ```
-/// # #[macro_use]
-/// # extern crate uucore;
-/// # fn main() {
-/// show_error!("Couldn't apply {} to {}", "foo", "bar");
-/// # }
-/// ```
-#[macro_export]
-macro_rules! show_error(
-    ($($args:tt)+) => ({
-        eprint!("{}: ", $crate::util_name());
-        eprintln!($($args)+);
+/// Show an error to stderr in a similar style to GNU coreutils.
+///
+/// Takes a [`format!`]-like input and prints it to stderr. The output is
+/// prepended with the current utility's name.
+///
+/// # Examples
+///
+/// ```
+/// # #[macro_use]
+/// # extern crate uucore;
+/// # fn main() {
+/// show_error!("Couldn't apply {} to {}", "foo", "bar");
+/// # }
+/// ```
+#[macro_export]
+macro_rules! show_error(
+    ($($args:tt)+) => ({
+        eprint!("{}: ", $crate::util_name());
+        eprintln!($($args)+);
     })
 );
 
-/// Print a warning message to stderr.
-///
-/// Takes [`format!`]-compatible input and prepends it with the current
-/// utility's name and "warning: " before printing to stderr.
-///
-/// # Examples
-///
-/// ```
-/// # #[macro_use]
-/// # extern crate uucore;
-/// # fn main() {
-/// // outputs <name>: warning: Couldn't apply foo to bar
-/// show_warning!("Couldn't apply {} to {}", "foo", "bar");
-/// # }
-/// ```
-#[macro_export]
-macro_rules! show_warning(
-    ($($args:tt)+) => ({
-        eprint!("{}: warning: ", $crate::util_name());
-        eprintln!($($args)+);
+/// Print a warning message to stderr.
+///
+/// Takes [`format!`]-compatible input and prepends it with the current
+/// utility's name and "warning: " before printing to stderr.
+///
+/// # Examples
+///
+/// ```
+/// # #[macro_use]
+/// # extern crate uucore;
+/// # fn main() {
+/// // outputs <name>: warning: Couldn't apply foo to bar
+/// show_warning!("Couldn't apply {} to {}", "foo", "bar");
+/// # }
+/// ```
+#[macro_export]
+macro_rules! show_warning(
+    ($($args:tt)+) => ({
+        eprint!("{}: warning: ", $crate::util_name());
+        eprintln!($($args)+);
     })
 );
 
-/// Display an error and [`std::process::exit`]
-///
-/// Displays the provided error message using [`show_error!`], then invokes
-/// [`std::process::exit`] with the provided exit code.
-///
-/// # Examples
-///
-/// ```should_panic
-/// # #[macro_use]
-/// # extern crate uucore;
-/// # fn main() {
-/// // outputs <name>: Couldn't apply foo to bar
-/// // and terminates execution
-/// crash!(1, "Couldn't apply {} to {}", "foo", "bar");
-/// # }
-/// ```
-#[macro_export]
-macro_rules! crash(
-    ($exit_code:expr, $($args:tt)+) => ({
-        $crate::show_error!($($args)+);
-        std::process::exit($exit_code);
+/// Display an error and [`std::process::exit`]
+///
+/// Displays the provided error message using [`show_error!`], then invokes
+/// [`std::process::exit`] with the provided exit code.
+///
+/// # Examples
+///
+/// ```should_panic
+/// # #[macro_use]
+/// # extern crate uucore;
+/// # fn main() {
+/// // outputs <name>: Couldn't apply foo to bar
+/// // and terminates execution
+/// crash!(1, "Couldn't apply {} to {}", "foo", "bar");
+/// # }
+/// ```
+#[macro_export]
+macro_rules! crash(
+    ($exit_code:expr, $($args:tt)+) => ({
+        $crate::show_error!($($args)+);
+        std::process::exit($exit_code);
     })
 );
 
-/// Unwrap a [`std::result::Result`], crashing instead of panicking.
-///
-/// If the result is an `Ok`-variant, returns the value contained inside. If it
-/// is an `Err`-variant, invokes [`crash!`] with the formatted error instead.
-///
-/// # Examples
-///
-/// ```should_panic
-/// # #[macro_use]
-/// # extern crate uucore;
-/// # fn main() {
-/// let is_ok: Result<u32, &str> = Ok(1);
-/// // Does nothing
-/// crash_if_err!(1, is_ok);
-///
-/// let is_err: Result<u32, &str> = Err("This didn't work...");
-/// // Calls `crash!`
-/// crash_if_err!(1, is_err);
-/// # }
-/// ```
-#[macro_export]
-macro_rules! crash_if_err(
-    ($exit_code:expr, $exp:expr) => (
-        match $exp {
-            Ok(m) => m,
-            Err(f) => $crate::crash!($exit_code, "{}", f),
+/// Unwrap a [`std::result::Result`], crashing instead of panicking.
+///
+/// If the result is an `Ok`-variant, returns the value contained inside. If it
+/// is an `Err`-variant, invokes [`crash!`] with the formatted error instead.
+///
+/// # Examples
+///
+/// ```should_panic
+/// # #[macro_use]
+/// # extern crate uucore;
+/// # fn main() {
+/// let is_ok: Result<u32, &str> = Ok(1);
+/// // Does nothing
+/// crash_if_err!(1, is_ok);
+///
+/// let is_err: Result<u32, &str> = Err("This didn't work...");
+/// // Calls `crash!`
+/// crash_if_err!(1, is_err);
+/// # }
+/// ```
+#[macro_export]
+macro_rules! crash_if_err(
+    ($exit_code:expr, $exp:expr) => (
+        match $exp {
+            Ok(m) => m,
+            Err(f) => $crate::crash!($exit_code, "{}", f),
         }
     )
 );
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/mods.rs.html b/dev/src/uucore/mods.rs.html index 01e12f00a..aefc4cec6 100644 --- a/dev/src/uucore/mods.rs.html +++ b/dev/src/uucore/mods.rs.html @@ -1,4 +1,4 @@ -mods.rs - source
1
+mods.rs - source
1
 2
 3
 4
@@ -9,16 +9,16 @@
 9
 10
 11
-
// mods ~ cross-platforms modules (core/bundler file)
+
// mods ~ cross-platforms modules (core/bundler file)
 
-pub mod backup_control;
-pub mod display;
-pub mod error;
-pub mod os;
-pub mod panic;
-pub mod ranges;
-pub mod version_cmp;
-// dir and vdir also need access to the quoting_style module
-pub mod quoting_style;
+pub mod backup_control;
+pub mod display;
+pub mod error;
+pub mod os;
+pub mod panic;
+pub mod ranges;
+pub mod version_cmp;
+// dir and vdir also need access to the quoting_style module
+pub mod quoting_style;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/mods/backup_control.rs.html b/dev/src/uucore/mods/backup_control.rs.html index 1679fa89b..2378c524b 100644 --- a/dev/src/uucore/mods/backup_control.rs.html +++ b/dev/src/uucore/mods/backup_control.rs.html @@ -1,4 +1,4 @@ -backup_control.rs - source
1
+backup_control.rs - source
1
 2
 3
 4
@@ -629,103 +629,103 @@
 629
 630
 631
-
//! Implement GNU-style backup functionality.
-//!
-//! This module implements the backup functionality as described in the [GNU
-//! manual][1]. It provides
-//!
-//! - pre-defined [`clap`-Arguments][2] for inclusion in utilities that
-//!   implement backups
-//! - determination of the [backup mode][3]
-//! - determination of the [backup suffix][4]
-//! - [backup target path construction][5]
-//! - [Error types][6] for backup-related errors
-//! - GNU-compliant [help texts][7] for backup-related errors
-//!
-//! Backup-functionality is implemented by the following utilities:
-//!
-//! - `cp`
-//! - `install`
-//! - `ln`
-//! - `mv`
-//!
-//!
-//! [1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
-//! [2]: arguments
-//! [3]: `determine_backup_mode()`
-//! [4]: `determine_backup_suffix()`
-//! [5]: `get_backup_path()`
-//! [6]: `BackupError`
-//! [7]: `BACKUP_CONTROL_LONG_HELP`
-//!
-//!
-//! # Usage example
-//!
-//! ```
-//! #[macro_use]
-//! extern crate uucore;
-//!
-//! use clap::{Command, Arg, ArgMatches};
-//! use std::path::{Path, PathBuf};
-//! use uucore::backup_control::{self, BackupMode};
-//! use uucore::error::{UError, UResult};
-//!
-//! fn main() {
-//!     let usage = String::from("command [OPTION]... ARG");
-//!     let long_usage = String::from("And here's a detailed explanation");
-//!
-//!     let matches = Command::new("command")
-//!         .arg(backup_control::arguments::backup())
-//!         .arg(backup_control::arguments::backup_no_args())
-//!         .arg(backup_control::arguments::suffix())
-//!         .override_usage(usage)
-//!         .after_help(format!(
-//!             "{}\n{}",
-//!             long_usage,
-//!             backup_control::BACKUP_CONTROL_LONG_HELP
-//!         ))
-//!         .get_matches_from(vec![
-//!             "command", "--backup=t", "--suffix=bak~"
-//!         ]);
-//!
-//!     let backup_mode = match backup_control::determine_backup_mode(&matches) {
-//!         Err(e) => {
-//!             show!(e);
-//!             return;
-//!         },
-//!         Ok(mode) => mode,
-//!     };
-//!     let backup_suffix = backup_control::determine_backup_suffix(&matches);
-//!     let target_path = Path::new("/tmp/example");
-//!
-//!     let backup_path = backup_control::get_backup_path(
-//!         backup_mode, target_path, &backup_suffix
-//!     );
-//!
-//!     // Perform your backups here.
-//!
-//! }
-//! ```
+
//! Implement GNU-style backup functionality.
+//!
+//! This module implements the backup functionality as described in the [GNU
+//! manual][1]. It provides
+//!
+//! - pre-defined [`clap`-Arguments][2] for inclusion in utilities that
+//!   implement backups
+//! - determination of the [backup mode][3]
+//! - determination of the [backup suffix][4]
+//! - [backup target path construction][5]
+//! - [Error types][6] for backup-related errors
+//! - GNU-compliant [help texts][7] for backup-related errors
+//!
+//! Backup-functionality is implemented by the following utilities:
+//!
+//! - `cp`
+//! - `install`
+//! - `ln`
+//! - `mv`
+//!
+//!
+//! [1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
+//! [2]: arguments
+//! [3]: `determine_backup_mode()`
+//! [4]: `determine_backup_suffix()`
+//! [5]: `get_backup_path()`
+//! [6]: `BackupError`
+//! [7]: `BACKUP_CONTROL_LONG_HELP`
+//!
+//!
+//! # Usage example
+//!
+//! ```
+//! #[macro_use]
+//! extern crate uucore;
+//!
+//! use clap::{Command, Arg, ArgMatches};
+//! use std::path::{Path, PathBuf};
+//! use uucore::backup_control::{self, BackupMode};
+//! use uucore::error::{UError, UResult};
+//!
+//! fn main() {
+//!     let usage = String::from("command [OPTION]... ARG");
+//!     let long_usage = String::from("And here's a detailed explanation");
+//!
+//!     let matches = Command::new("command")
+//!         .arg(backup_control::arguments::backup())
+//!         .arg(backup_control::arguments::backup_no_args())
+//!         .arg(backup_control::arguments::suffix())
+//!         .override_usage(usage)
+//!         .after_help(format!(
+//!             "{}\n{}",
+//!             long_usage,
+//!             backup_control::BACKUP_CONTROL_LONG_HELP
+//!         ))
+//!         .get_matches_from(vec![
+//!             "command", "--backup=t", "--suffix=bak~"
+//!         ]);
+//!
+//!     let backup_mode = match backup_control::determine_backup_mode(&matches) {
+//!         Err(e) => {
+//!             show!(e);
+//!             return;
+//!         },
+//!         Ok(mode) => mode,
+//!     };
+//!     let backup_suffix = backup_control::determine_backup_suffix(&matches);
+//!     let target_path = Path::new("/tmp/example");
+//!
+//!     let backup_path = backup_control::get_backup_path(
+//!         backup_mode, target_path, &backup_suffix
+//!     );
+//!
+//!     // Perform your backups here.
+//!
+//! }
+//! ```
 
-// spell-checker:ignore backupopt
+// spell-checker:ignore backupopt
 
-use crate::{
-    display::Quotable,
-    error::{UError, UResult},
+use crate::{
+    display::Quotable,
+    error::{UError, UResult},
 };
-use clap::ArgMatches;
-use std::{
-    env,
-    error::Error,
-    fmt::{Debug, Display},
-    path::{Path, PathBuf},
+use clap::ArgMatches;
+use std::{
+    env,
+    error::Error,
+    fmt::{Debug, Display},
+    path::{Path, PathBuf},
 };
 
-pub static BACKUP_CONTROL_VALUES: &[&str] = &[
+pub static BACKUP_CONTROL_VALUES: &[&str] = &[
     "simple", "never", "numbered", "t", "existing", "nil", "none", "off",
 ];
 
-pub const BACKUP_CONTROL_LONG_HELP: &str =
+pub const BACKUP_CONTROL_LONG_HELP: &str =
     "The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
 The version control method may be selected via the --backup option or through
 the VERSION_CONTROL environment variable.  Here are the values:
@@ -735,530 +735,530 @@ the VERSION_CONTROL environment variable.  Here are the values:
   existing, nil   numbered if numbered backups exist, simple otherwise
   simple, never   always make simple backups";
 
-static VALID_ARGS_HELP: &str = "Valid arguments are:
+static VALID_ARGS_HELP: &str = "Valid arguments are:
   - 'none', 'off'
   - 'simple', 'never'
   - 'existing', 'nil'
   - 'numbered', 't'";
 
-/// Available backup modes.
-///
-/// The mapping of the backup modes to the CLI arguments is annotated on the
-/// enum variants.
-#[derive(Debug, Clone, Copy, Eq, PartialEq)]
-pub enum BackupMode {
-    /// Argument 'none', 'off'
-    NoBackup,
-    /// Argument 'simple', 'never'
-    SimpleBackup,
-    /// Argument 'numbered', 't'
-    NumberedBackup,
-    /// Argument 'existing', 'nil'
-    ExistingBackup,
+/// Available backup modes.
+///
+/// The mapping of the backup modes to the CLI arguments is annotated on the
+/// enum variants.
+#[derive(Debug, Clone, Copy, Eq, PartialEq)]
+pub enum BackupMode {
+    /// Argument 'none', 'off'
+    NoBackup,
+    /// Argument 'simple', 'never'
+    SimpleBackup,
+    /// Argument 'numbered', 't'
+    NumberedBackup,
+    /// Argument 'existing', 'nil'
+    ExistingBackup,
 }
 
-/// Backup error types.
-///
-/// Errors are currently raised by [`determine_backup_mode`] only. All errors
-/// are implemented as [`UError`] for uniform handling across utilities.
-#[derive(Debug, Eq, PartialEq)]
-pub enum BackupError {
-    /// An invalid argument (e.g. 'foo') was given as backup type. First
-    /// parameter is the argument, second is the arguments origin (CLI or
-    /// ENV-var)
-    InvalidArgument(String, String),
-    /// An ambiguous argument (e.g. 'n') was given as backup type. First
-    /// parameter is the argument, second is the arguments origin (CLI or
-    /// ENV-var)
-    AmbiguousArgument(String, String),
-    /// Currently unused
-    BackupImpossible(),
-    // BackupFailed(PathBuf, PathBuf, std::io::Error),
-}
+/// Backup error types.
+///
+/// Errors are currently raised by [`determine_backup_mode`] only. All errors
+/// are implemented as [`UError`] for uniform handling across utilities.
+#[derive(Debug, Eq, PartialEq)]
+pub enum BackupError {
+    /// An invalid argument (e.g. 'foo') was given as backup type. First
+    /// parameter is the argument, second is the arguments origin (CLI or
+    /// ENV-var)
+    InvalidArgument(String, String),
+    /// An ambiguous argument (e.g. 'n') was given as backup type. First
+    /// parameter is the argument, second is the arguments origin (CLI or
+    /// ENV-var)
+    AmbiguousArgument(String, String),
+    /// Currently unused
+    BackupImpossible(),
+    // BackupFailed(PathBuf, PathBuf, std::io::Error),
+}
 
-impl UError for BackupError {
-    fn code(&self) -> i32 {
-        match self {
-            Self::BackupImpossible() => 2,
-            _ => 1,
+impl UError for BackupError {
+    fn code(&self) -> i32 {
+        match self {
+            Self::BackupImpossible() => 2,
+            _ => 1,
         }
     }
 
-    fn usage(&self) -> bool {
-        // Suggested by clippy.
-        matches!(
+    fn usage(&self) -> bool {
+        // Suggested by clippy.
+        matches!(
             self,
-            Self::InvalidArgument(_, _) | Self::AmbiguousArgument(_, _)
+            Self::InvalidArgument(_, _) | Self::AmbiguousArgument(_, _)
         )
     }
 }
 
-impl Error for BackupError {}
+impl Error for BackupError {}
 
-impl Display for BackupError {
-    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        match self {
-            Self::InvalidArgument(arg, origin) => write!(
-                f,
+impl Display for BackupError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        match self {
+            Self::InvalidArgument(arg, origin) => write!(
+                f,
                 "invalid argument {} for '{}'\n{}",
-                arg.quote(),
-                origin,
-                VALID_ARGS_HELP
+                arg.quote(),
+                origin,
+                VALID_ARGS_HELP
             ),
-            Self::AmbiguousArgument(arg, origin) => write!(
-                f,
+            Self::AmbiguousArgument(arg, origin) => write!(
+                f,
                 "ambiguous argument {} for '{}'\n{}",
-                arg.quote(),
-                origin,
-                VALID_ARGS_HELP
+                arg.quote(),
+                origin,
+                VALID_ARGS_HELP
             ),
-            Self::BackupImpossible() => write!(f, "cannot create backup"),
-            // Placeholder for later
-            // Self::BackupFailed(from, to, e) => Display::fmt(
-            //     &uio_error!(e, "failed to backup {} to {}", from.quote(), to.quote()),
-            //     f
-            // ),
+            Self::BackupImpossible() => write!(f, "cannot create backup"),
+            // Placeholder for later
+            // Self::BackupFailed(from, to, e) => Display::fmt(
+            //     &uio_error!(e, "failed to backup {} to {}", from.quote(), to.quote()),
+            //     f
+            // ),
+        }
+    }
+}
+
+/// Arguments for backup-related functionality.
+///
+/// Rather than implementing the `clap`-Arguments for every utility, it is
+/// recommended to include the `clap` arguments via the functions provided here.
+/// This way the backup-specific arguments are handled uniformly across
+/// utilities and can be maintained in one central place.
+pub mod arguments {
+    use clap::ArgAction;
+
+    extern crate clap;
+
+    pub static OPT_BACKUP: &str = "backupopt_backup";
+    pub static OPT_BACKUP_NO_ARG: &str = "backupopt_b";
+    pub static OPT_SUFFIX: &str = "backupopt_suffix";
+
+    /// '--backup' argument
+    pub fn backup() -> clap::Arg {
+        clap::Arg::new(OPT_BACKUP)
+            .long("backup")
+            .help("make a backup of each existing destination file")
+            .action(clap::ArgAction::Set)
+            .require_equals(true)
+            .num_args(0..=1)
+            .value_name("CONTROL")
+    }
+
+    /// '-b' argument
+    pub fn backup_no_args() -> clap::Arg {
+        clap::Arg::new(OPT_BACKUP_NO_ARG)
+            .short('b')
+            .help("like --backup but does not accept an argument")
+            .action(ArgAction::SetTrue)
+    }
+
+    /// '-S, --suffix' argument
+    pub fn suffix() -> clap::Arg {
+        clap::Arg::new(OPT_SUFFIX)
+            .short('S')
+            .long("suffix")
+            .help("override the usual backup suffix")
+            .action(clap::ArgAction::Set)
+            .value_name("SUFFIX")
+            .allow_hyphen_values(true)
+    }
+}
+
+/// Obtain the suffix to use for a backup.
+///
+/// In order of precedence, this function obtains the backup suffix
+///
+/// 1. From the '-S' or '--suffix' CLI argument, if present
+/// 2. From the "SIMPLE_BACKUP_SUFFIX" environment variable, if present
+/// 3. By using the default '~' if none of the others apply
+///
+/// This function directly takes [`clap::ArgMatches`] as argument and looks for
+/// the '-S' and '--suffix' arguments itself.
+pub fn determine_backup_suffix(matches: &ArgMatches) -> String {
+    let supplied_suffix = matches.get_one::<String>(arguments::OPT_SUFFIX);
+    if let Some(suffix) = supplied_suffix {
+        String::from(suffix)
+    } else {
+        env::var("SIMPLE_BACKUP_SUFFIX").unwrap_or_else(|_| "~".to_owned())
+    }
+}
+
+/// Determine the "mode" for the backup operation to perform, if any.
+///
+/// Parses the backup options according to the [GNU manual][1], and converts
+/// them to an instance of `BackupMode` for further processing.
+///
+/// Takes [`clap::ArgMatches`] as argument which **must** contain the options
+/// from [`arguments::backup()`] and [`arguments::backup_no_args()`]. Otherwise
+/// the `NoBackup` mode is returned unconditionally.
+///
+/// It is recommended for anyone who would like to implement the
+/// backup-functionality to use the arguments prepared in the `arguments`
+/// submodule (see examples)
+///
+/// [1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
+///
+///
+/// # Errors
+///
+/// If an argument supplied directly to the long `backup` option, or read in
+/// through the `VERSION CONTROL` env var is ambiguous (i.e. may resolve to
+/// multiple backup modes) or invalid, an [`InvalidArgument`][10] or
+/// [`AmbiguousArgument`][11] error is returned, respectively.
+///
+/// [10]: BackupError::InvalidArgument
+/// [11]: BackupError::AmbiguousArgument
+///
+///
+/// # Examples
+///
+/// Here's how one would integrate the backup mode determination into an
+/// application.
+///
+/// ```
+/// #[macro_use]
+/// extern crate uucore;
+/// use uucore::backup_control::{self, BackupMode};
+/// use clap::{Command, Arg, ArgMatches};
+///
+/// fn main() {
+///     let matches = Command::new("command")
+///         .arg(backup_control::arguments::backup())
+///         .arg(backup_control::arguments::backup_no_args())
+///         .get_matches_from(vec![
+///             "command", "-b", "--backup=t"
+///         ]);
+///
+///     let backup_mode = backup_control::determine_backup_mode(&matches).unwrap();
+///     assert_eq!(backup_mode, BackupMode::NumberedBackup)
+/// }
+/// ```
+///
+/// This example shows an ambiguous input, as 'n' may resolve to 4 different
+/// backup modes.
+///
+///
+/// ```
+/// #[macro_use]
+/// extern crate uucore;
+/// use uucore::backup_control::{self, BackupMode, BackupError};
+/// use clap::{Command, Arg, ArgMatches};
+///
+/// fn main() {
+///     let matches = Command::new("command")
+///         .arg(backup_control::arguments::backup())
+///         .arg(backup_control::arguments::backup_no_args())
+///         .get_matches_from(vec![
+///             "command", "-b", "--backup=n"
+///         ]);
+///
+///     let backup_mode = backup_control::determine_backup_mode(&matches);
+///
+///     assert!(backup_mode.is_err());
+///     let err = backup_mode.unwrap_err();
+///     // assert_eq!(err, BackupError::AmbiguousArgument);
+///     // Use uucore functionality to show the error to the user
+///     show!(err);
+/// }
+/// ```
+pub fn determine_backup_mode(matches: &ArgMatches) -> UResult<BackupMode> {
+    if matches.contains_id(arguments::OPT_BACKUP) {
+        // Use method to determine the type of backups to make. When this option
+        // is used but method is not specified, then the value of the
+        // VERSION_CONTROL environment variable is used. And if VERSION_CONTROL
+        // is not set, the default backup type is 'existing'.
+        if let Some(method) = matches.get_one::<String>(arguments::OPT_BACKUP) {
+            // Second argument is for the error string that is returned.
+            match_method(method, "backup type")
+        } else if let Ok(method) = env::var("VERSION_CONTROL") {
+            // Second argument is for the error string that is returned.
+            match_method(&method, "$VERSION_CONTROL")
+        } else {
+            // Default if no argument is provided to '--backup'
+            Ok(BackupMode::ExistingBackup)
         }
+    } else if matches.get_flag(arguments::OPT_BACKUP_NO_ARG) {
+        // the short form of this option, -b does not accept any argument.
+        // Using -b is equivalent to using --backup=existing.
+        Ok(BackupMode::ExistingBackup)
+    } else {
+        // No option was present at all
+        Ok(BackupMode::NoBackup)
     }
 }
 
-/// Arguments for backup-related functionality.
-///
-/// Rather than implementing the `clap`-Arguments for every utility, it is
-/// recommended to include the `clap` arguments via the functions provided here.
-/// This way the backup-specific arguments are handled uniformly across
-/// utilities and can be maintained in one central place.
-pub mod arguments {
-    use clap::ArgAction;
-
-    extern crate clap;
-
-    pub static OPT_BACKUP: &str = "backupopt_backup";
-    pub static OPT_BACKUP_NO_ARG: &str = "backupopt_b";
-    pub static OPT_SUFFIX: &str = "backupopt_suffix";
-
-    /// '--backup' argument
-    pub fn backup() -> clap::Arg {
-        clap::Arg::new(OPT_BACKUP)
-            .long("backup")
-            .help("make a backup of each existing destination file")
-            .action(clap::ArgAction::Set)
-            .require_equals(true)
-            .num_args(0..=1)
-            .value_name("CONTROL")
-    }
-
-    /// '-b' argument
-    pub fn backup_no_args() -> clap::Arg {
-        clap::Arg::new(OPT_BACKUP_NO_ARG)
-            .short('b')
-            .help("like --backup but does not accept an argument")
-            .action(ArgAction::SetTrue)
-    }
-
-    /// '-S, --suffix' argument
-    pub fn suffix() -> clap::Arg {
-        clap::Arg::new(OPT_SUFFIX)
-            .short('S')
-            .long("suffix")
-            .help("override the usual backup suffix")
-            .action(clap::ArgAction::Set)
-            .value_name("SUFFIX")
-            .allow_hyphen_values(true)
+/// Match a backup option string to a `BackupMode`.
+///
+/// The GNU manual specifies that abbreviations to options are valid as long as
+/// they aren't ambiguous. This function matches the given `method` argument
+/// against all valid backup options (via `starts_with`), and returns a valid
+/// [`BackupMode`] if exactly one backup option matches the `method` given.
+///
+/// `origin` is required in order to format the generated error message
+/// properly, when an error occurs.
+///
+///
+/// # Errors
+///
+/// If `method` is invalid or ambiguous (i.e. may resolve to multiple backup
+/// modes), an [`InvalidArgument`][10] or [`AmbiguousArgument`][11] error is
+/// returned, respectively.
+///
+/// [10]: BackupError::InvalidArgument
+/// [11]: BackupError::AmbiguousArgument
+fn match_method(method: &str, origin: &str) -> UResult<BackupMode> {
+    let matches: Vec<&&str> = BACKUP_CONTROL_VALUES
+        .iter()
+        .filter(|val| val.starts_with(method))
+        .collect();
+    if matches.len() == 1 {
+        match *matches[0] {
+            "simple" | "never" => Ok(BackupMode::SimpleBackup),
+            "numbered" | "t" => Ok(BackupMode::NumberedBackup),
+            "existing" | "nil" => Ok(BackupMode::ExistingBackup),
+            "none" | "off" => Ok(BackupMode::NoBackup),
+            _ => unreachable!(), // cannot happen as we must have exactly one match
+                                 // from the list above.
+        }
+    } else if matches.is_empty() {
+        Err(BackupError::InvalidArgument(method.to_string(), origin.to_string()).into())
+    } else {
+        Err(BackupError::AmbiguousArgument(method.to_string(), origin.to_string()).into())
     }
 }
 
-/// Obtain the suffix to use for a backup.
-///
-/// In order of precedence, this function obtains the backup suffix
-///
-/// 1. From the '-S' or '--suffix' CLI argument, if present
-/// 2. From the "SIMPLE_BACKUP_SUFFIX" environment variable, if present
-/// 3. By using the default '~' if none of the others apply
-///
-/// This function directly takes [`clap::ArgMatches`] as argument and looks for
-/// the '-S' and '--suffix' arguments itself.
-pub fn determine_backup_suffix(matches: &ArgMatches) -> String {
-    let supplied_suffix = matches.get_one::<String>(arguments::OPT_SUFFIX);
-    if let Some(suffix) = supplied_suffix {
-        String::from(suffix)
-    } else {
-        env::var("SIMPLE_BACKUP_SUFFIX").unwrap_or_else(|_| "~".to_owned())
+pub fn get_backup_path(
+    backup_mode: BackupMode,
+    backup_path: &Path,
+    suffix: &str,
+) -> Option<PathBuf> {
+    match backup_mode {
+        BackupMode::NoBackup => None,
+        BackupMode::SimpleBackup => Some(simple_backup_path(backup_path, suffix)),
+        BackupMode::NumberedBackup => Some(numbered_backup_path(backup_path)),
+        BackupMode::ExistingBackup => Some(existing_backup_path(backup_path, suffix)),
     }
 }
 
-/// Determine the "mode" for the backup operation to perform, if any.
-///
-/// Parses the backup options according to the [GNU manual][1], and converts
-/// them to an instance of `BackupMode` for further processing.
-///
-/// Takes [`clap::ArgMatches`] as argument which **must** contain the options
-/// from [`arguments::backup()`] and [`arguments::backup_no_args()`]. Otherwise
-/// the `NoBackup` mode is returned unconditionally.
-///
-/// It is recommended for anyone who would like to implement the
-/// backup-functionality to use the arguments prepared in the `arguments`
-/// submodule (see examples)
-///
-/// [1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
-///
-///
-/// # Errors
-///
-/// If an argument supplied directly to the long `backup` option, or read in
-/// through the `VERSION CONTROL` env var is ambiguous (i.e. may resolve to
-/// multiple backup modes) or invalid, an [`InvalidArgument`][10] or
-/// [`AmbiguousArgument`][11] error is returned, respectively.
-///
-/// [10]: BackupError::InvalidArgument
-/// [11]: BackupError::AmbiguousArgument
-///
-///
-/// # Examples
-///
-/// Here's how one would integrate the backup mode determination into an
-/// application.
-///
-/// ```
-/// #[macro_use]
-/// extern crate uucore;
-/// use uucore::backup_control::{self, BackupMode};
-/// use clap::{Command, Arg, ArgMatches};
-///
-/// fn main() {
-///     let matches = Command::new("command")
-///         .arg(backup_control::arguments::backup())
-///         .arg(backup_control::arguments::backup_no_args())
-///         .get_matches_from(vec![
-///             "command", "-b", "--backup=t"
-///         ]);
-///
-///     let backup_mode = backup_control::determine_backup_mode(&matches).unwrap();
-///     assert_eq!(backup_mode, BackupMode::NumberedBackup)
-/// }
-/// ```
-///
-/// This example shows an ambiguous input, as 'n' may resolve to 4 different
-/// backup modes.
-///
-///
-/// ```
-/// #[macro_use]
-/// extern crate uucore;
-/// use uucore::backup_control::{self, BackupMode, BackupError};
-/// use clap::{Command, Arg, ArgMatches};
-///
-/// fn main() {
-///     let matches = Command::new("command")
-///         .arg(backup_control::arguments::backup())
-///         .arg(backup_control::arguments::backup_no_args())
-///         .get_matches_from(vec![
-///             "command", "-b", "--backup=n"
-///         ]);
-///
-///     let backup_mode = backup_control::determine_backup_mode(&matches);
-///
-///     assert!(backup_mode.is_err());
-///     let err = backup_mode.unwrap_err();
-///     // assert_eq!(err, BackupError::AmbiguousArgument);
-///     // Use uucore functionality to show the error to the user
-///     show!(err);
-/// }
-/// ```
-pub fn determine_backup_mode(matches: &ArgMatches) -> UResult<BackupMode> {
-    if matches.contains_id(arguments::OPT_BACKUP) {
-        // Use method to determine the type of backups to make. When this option
-        // is used but method is not specified, then the value of the
-        // VERSION_CONTROL environment variable is used. And if VERSION_CONTROL
-        // is not set, the default backup type is 'existing'.
-        if let Some(method) = matches.get_one::<String>(arguments::OPT_BACKUP) {
-            // Second argument is for the error string that is returned.
-            match_method(method, "backup type")
-        } else if let Ok(method) = env::var("VERSION_CONTROL") {
-            // Second argument is for the error string that is returned.
-            match_method(&method, "$VERSION_CONTROL")
-        } else {
-            // Default if no argument is provided to '--backup'
-            Ok(BackupMode::ExistingBackup)
-        }
-    } else if matches.get_flag(arguments::OPT_BACKUP_NO_ARG) {
-        // the short form of this option, -b does not accept any argument.
-        // Using -b is equivalent to using --backup=existing.
-        Ok(BackupMode::ExistingBackup)
-    } else {
-        // No option was present at all
-        Ok(BackupMode::NoBackup)
-    }
+fn simple_backup_path(path: &Path, suffix: &str) -> PathBuf {
+    let mut p = path.to_string_lossy().into_owned();
+    p.push_str(suffix);
+    PathBuf::from(p)
 }
 
-/// Match a backup option string to a `BackupMode`.
-///
-/// The GNU manual specifies that abbreviations to options are valid as long as
-/// they aren't ambiguous. This function matches the given `method` argument
-/// against all valid backup options (via `starts_with`), and returns a valid
-/// [`BackupMode`] if exactly one backup option matches the `method` given.
-///
-/// `origin` is required in order to format the generated error message
-/// properly, when an error occurs.
-///
-///
-/// # Errors
-///
-/// If `method` is invalid or ambiguous (i.e. may resolve to multiple backup
-/// modes), an [`InvalidArgument`][10] or [`AmbiguousArgument`][11] error is
-/// returned, respectively.
-///
-/// [10]: BackupError::InvalidArgument
-/// [11]: BackupError::AmbiguousArgument
-fn match_method(method: &str, origin: &str) -> UResult<BackupMode> {
-    let matches: Vec<&&str> = BACKUP_CONTROL_VALUES
-        .iter()
-        .filter(|val| val.starts_with(method))
-        .collect();
-    if matches.len() == 1 {
-        match *matches[0] {
-            "simple" | "never" => Ok(BackupMode::SimpleBackup),
-            "numbered" | "t" => Ok(BackupMode::NumberedBackup),
-            "existing" | "nil" => Ok(BackupMode::ExistingBackup),
-            "none" | "off" => Ok(BackupMode::NoBackup),
-            _ => unreachable!(), // cannot happen as we must have exactly one match
-                                 // from the list above.
-        }
-    } else if matches.is_empty() {
-        Err(BackupError::InvalidArgument(method.to_string(), origin.to_string()).into())
-    } else {
-        Err(BackupError::AmbiguousArgument(method.to_string(), origin.to_string()).into())
-    }
-}
-
-pub fn get_backup_path(
-    backup_mode: BackupMode,
-    backup_path: &Path,
-    suffix: &str,
-) -> Option<PathBuf> {
-    match backup_mode {
-        BackupMode::NoBackup => None,
-        BackupMode::SimpleBackup => Some(simple_backup_path(backup_path, suffix)),
-        BackupMode::NumberedBackup => Some(numbered_backup_path(backup_path)),
-        BackupMode::ExistingBackup => Some(existing_backup_path(backup_path, suffix)),
-    }
-}
-
-fn simple_backup_path(path: &Path, suffix: &str) -> PathBuf {
-    let mut p = path.to_string_lossy().into_owned();
-    p.push_str(suffix);
-    PathBuf::from(p)
-}
-
-fn numbered_backup_path(path: &Path) -> PathBuf {
-    for i in 1_u64.. {
-        let path_str = &format!("{}.~{}~", path.to_string_lossy(), i);
-        let path = Path::new(path_str);
-        if !path.exists() {
-            return path.to_path_buf();
+fn numbered_backup_path(path: &Path) -> PathBuf {
+    for i in 1_u64.. {
+        let path_str = &format!("{}.~{}~", path.to_string_lossy(), i);
+        let path = Path::new(path_str);
+        if !path.exists() {
+            return path.to_path_buf();
         }
     }
     panic!("cannot create backup")
 }
 
-fn existing_backup_path(path: &Path, suffix: &str) -> PathBuf {
-    let test_path_str = &format!("{}.~1~", path.to_string_lossy());
-    let test_path = Path::new(test_path_str);
-    if test_path.exists() {
-        numbered_backup_path(path)
-    } else {
-        simple_backup_path(path, suffix)
+fn existing_backup_path(path: &Path, suffix: &str) -> PathBuf {
+    let test_path_str = &format!("{}.~1~", path.to_string_lossy());
+    let test_path = Path::new(test_path_str);
+    if test_path.exists() {
+        numbered_backup_path(path)
+    } else {
+        simple_backup_path(path, suffix)
     }
 }
 
-//
-// Tests for this module
-//
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use std::env;
-    // Required to instantiate mutex in shared context
-    use clap::Command;
-    use once_cell::sync::Lazy;
-    use std::sync::Mutex;
+//
+// Tests for this module
+//
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use std::env;
+    // Required to instantiate mutex in shared context
+    use clap::Command;
+    use once_cell::sync::Lazy;
+    use std::sync::Mutex;
 
-    // The mutex is required here as by default all tests are run as separate
-    // threads under the same parent process. As environment variables are
-    // specific to processes (and thus shared among threads), data races *will*
-    // occur if no precautions are taken. Thus we have all tests that rely on
-    // environment variables lock this empty mutex to ensure they don't access
-    // it concurrently.
-    static TEST_MUTEX: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));
+    // The mutex is required here as by default all tests are run as separate
+    // threads under the same parent process. As environment variables are
+    // specific to processes (and thus shared among threads), data races *will*
+    // occur if no precautions are taken. Thus we have all tests that rely on
+    // environment variables lock this empty mutex to ensure they don't access
+    // it concurrently.
+    static TEST_MUTEX: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));
 
-    // Environment variable for "VERSION_CONTROL"
-    static ENV_VERSION_CONTROL: &str = "VERSION_CONTROL";
+    // Environment variable for "VERSION_CONTROL"
+    static ENV_VERSION_CONTROL: &str = "VERSION_CONTROL";
 
-    fn make_app() -> clap::Command {
-        Command::new("command")
-            .arg(arguments::backup())
-            .arg(arguments::backup_no_args())
-            .arg(arguments::suffix())
+    fn make_app() -> clap::Command {
+        Command::new("command")
+            .arg(arguments::backup())
+            .arg(arguments::backup_no_args())
+            .arg(arguments::suffix())
     }
 
-    // Defaults to --backup=existing
-    #[test]
-    fn test_backup_mode_short_only() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        let matches = make_app().get_matches_from(vec!["command", "-b"]);
+    // Defaults to --backup=existing
+    #[test]
+    fn test_backup_mode_short_only() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        let matches = make_app().get_matches_from(vec!["command", "-b"]);
 
-        let result = determine_backup_mode(&matches).unwrap();
+        let result = determine_backup_mode(&matches).unwrap();
 
-        assert_eq!(result, BackupMode::ExistingBackup);
+        assert_eq!(result, BackupMode::ExistingBackup);
     }
 
-    // --backup takes precedence over -b
-    #[test]
-    fn test_backup_mode_long_preferred_over_short() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        let matches = make_app().get_matches_from(vec!["command", "-b", "--backup=none"]);
+    // --backup takes precedence over -b
+    #[test]
+    fn test_backup_mode_long_preferred_over_short() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        let matches = make_app().get_matches_from(vec!["command", "-b", "--backup=none"]);
 
-        let result = determine_backup_mode(&matches).unwrap();
+        let result = determine_backup_mode(&matches).unwrap();
 
-        assert_eq!(result, BackupMode::NoBackup);
+        assert_eq!(result, BackupMode::NoBackup);
     }
 
-    // --backup can be passed without an argument
-    #[test]
-    fn test_backup_mode_long_without_args_no_env() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
+    // --backup can be passed without an argument
+    #[test]
+    fn test_backup_mode_long_without_args_no_env() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
 
-        let result = determine_backup_mode(&matches).unwrap();
+        let result = determine_backup_mode(&matches).unwrap();
 
-        assert_eq!(result, BackupMode::ExistingBackup);
+        assert_eq!(result, BackupMode::ExistingBackup);
     }
 
-    // --backup can be passed with an argument only
-    #[test]
-    fn test_backup_mode_long_with_args() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        let matches = make_app().get_matches_from(vec!["command", "--backup=simple"]);
+    // --backup can be passed with an argument only
+    #[test]
+    fn test_backup_mode_long_with_args() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        let matches = make_app().get_matches_from(vec!["command", "--backup=simple"]);
 
-        let result = determine_backup_mode(&matches).unwrap();
+        let result = determine_backup_mode(&matches).unwrap();
 
-        assert_eq!(result, BackupMode::SimpleBackup);
+        assert_eq!(result, BackupMode::SimpleBackup);
     }
 
-    // --backup errors on invalid argument
-    #[test]
-    fn test_backup_mode_long_with_args_invalid() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        let matches = make_app().get_matches_from(vec!["command", "--backup=foobar"]);
+    // --backup errors on invalid argument
+    #[test]
+    fn test_backup_mode_long_with_args_invalid() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        let matches = make_app().get_matches_from(vec!["command", "--backup=foobar"]);
 
-        let result = determine_backup_mode(&matches);
+        let result = determine_backup_mode(&matches);
 
-        assert!(result.is_err());
-        let text = format!("{}", result.unwrap_err());
-        assert!(text.contains("invalid argument 'foobar' for 'backup type'"));
+        assert!(result.is_err());
+        let text = format!("{}", result.unwrap_err());
+        assert!(text.contains("invalid argument 'foobar' for 'backup type'"));
     }
 
-    // --backup errors on ambiguous argument
-    #[test]
-    fn test_backup_mode_long_with_args_ambiguous() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        let matches = make_app().get_matches_from(vec!["command", "--backup=n"]);
+    // --backup errors on ambiguous argument
+    #[test]
+    fn test_backup_mode_long_with_args_ambiguous() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        let matches = make_app().get_matches_from(vec!["command", "--backup=n"]);
 
-        let result = determine_backup_mode(&matches);
+        let result = determine_backup_mode(&matches);
 
-        assert!(result.is_err());
-        let text = format!("{}", result.unwrap_err());
-        assert!(text.contains("ambiguous argument 'n' for 'backup type'"));
+        assert!(result.is_err());
+        let text = format!("{}", result.unwrap_err());
+        assert!(text.contains("ambiguous argument 'n' for 'backup type'"));
     }
 
-    // --backup accepts shortened arguments (si for simple)
-    #[test]
-    fn test_backup_mode_long_with_arg_shortened() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        let matches = make_app().get_matches_from(vec!["command", "--backup=si"]);
+    // --backup accepts shortened arguments (si for simple)
+    #[test]
+    fn test_backup_mode_long_with_arg_shortened() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        let matches = make_app().get_matches_from(vec!["command", "--backup=si"]);
 
-        let result = determine_backup_mode(&matches).unwrap();
+        let result = determine_backup_mode(&matches).unwrap();
 
-        assert_eq!(result, BackupMode::SimpleBackup);
+        assert_eq!(result, BackupMode::SimpleBackup);
     }
 
-    // -b ignores the "VERSION_CONTROL" environment variable
-    #[test]
-    fn test_backup_mode_short_only_ignore_env() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        env::set_var(ENV_VERSION_CONTROL, "none");
-        let matches = make_app().get_matches_from(vec!["command", "-b"]);
+    // -b ignores the "VERSION_CONTROL" environment variable
+    #[test]
+    fn test_backup_mode_short_only_ignore_env() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        env::set_var(ENV_VERSION_CONTROL, "none");
+        let matches = make_app().get_matches_from(vec!["command", "-b"]);
 
-        let result = determine_backup_mode(&matches).unwrap();
+        let result = determine_backup_mode(&matches).unwrap();
 
-        assert_eq!(result, BackupMode::ExistingBackup);
-        env::remove_var(ENV_VERSION_CONTROL);
+        assert_eq!(result, BackupMode::ExistingBackup);
+        env::remove_var(ENV_VERSION_CONTROL);
     }
 
-    // --backup can be passed without an argument, but reads env var if existent
-    #[test]
-    fn test_backup_mode_long_without_args_with_env() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        env::set_var(ENV_VERSION_CONTROL, "none");
-        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
+    // --backup can be passed without an argument, but reads env var if existent
+    #[test]
+    fn test_backup_mode_long_without_args_with_env() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        env::set_var(ENV_VERSION_CONTROL, "none");
+        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
 
-        let result = determine_backup_mode(&matches).unwrap();
+        let result = determine_backup_mode(&matches).unwrap();
 
-        assert_eq!(result, BackupMode::NoBackup);
-        env::remove_var(ENV_VERSION_CONTROL);
+        assert_eq!(result, BackupMode::NoBackup);
+        env::remove_var(ENV_VERSION_CONTROL);
     }
 
-    // --backup errors on invalid VERSION_CONTROL env var
-    #[test]
-    fn test_backup_mode_long_with_env_var_invalid() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        env::set_var(ENV_VERSION_CONTROL, "foobar");
-        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
+    // --backup errors on invalid VERSION_CONTROL env var
+    #[test]
+    fn test_backup_mode_long_with_env_var_invalid() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        env::set_var(ENV_VERSION_CONTROL, "foobar");
+        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
 
-        let result = determine_backup_mode(&matches);
+        let result = determine_backup_mode(&matches);
 
-        assert!(result.is_err());
-        let text = format!("{}", result.unwrap_err());
-        assert!(text.contains("invalid argument 'foobar' for '$VERSION_CONTROL'"));
-        env::remove_var(ENV_VERSION_CONTROL);
+        assert!(result.is_err());
+        let text = format!("{}", result.unwrap_err());
+        assert!(text.contains("invalid argument 'foobar' for '$VERSION_CONTROL'"));
+        env::remove_var(ENV_VERSION_CONTROL);
     }
 
-    // --backup errors on ambiguous VERSION_CONTROL env var
-    #[test]
-    fn test_backup_mode_long_with_env_var_ambiguous() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        env::set_var(ENV_VERSION_CONTROL, "n");
-        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
+    // --backup errors on ambiguous VERSION_CONTROL env var
+    #[test]
+    fn test_backup_mode_long_with_env_var_ambiguous() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        env::set_var(ENV_VERSION_CONTROL, "n");
+        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
 
-        let result = determine_backup_mode(&matches);
+        let result = determine_backup_mode(&matches);
 
-        assert!(result.is_err());
-        let text = format!("{}", result.unwrap_err());
-        assert!(text.contains("ambiguous argument 'n' for '$VERSION_CONTROL'"));
-        env::remove_var(ENV_VERSION_CONTROL);
+        assert!(result.is_err());
+        let text = format!("{}", result.unwrap_err());
+        assert!(text.contains("ambiguous argument 'n' for '$VERSION_CONTROL'"));
+        env::remove_var(ENV_VERSION_CONTROL);
     }
 
-    // --backup accepts shortened env vars (si for simple)
-    #[test]
-    fn test_backup_mode_long_with_env_var_shortened() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        env::set_var(ENV_VERSION_CONTROL, "si");
-        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
+    // --backup accepts shortened env vars (si for simple)
+    #[test]
+    fn test_backup_mode_long_with_env_var_shortened() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        env::set_var(ENV_VERSION_CONTROL, "si");
+        let matches = make_app().get_matches_from(vec!["command", "--backup"]);
 
-        let result = determine_backup_mode(&matches).unwrap();
+        let result = determine_backup_mode(&matches).unwrap();
 
-        assert_eq!(result, BackupMode::SimpleBackup);
-        env::remove_var(ENV_VERSION_CONTROL);
+        assert_eq!(result, BackupMode::SimpleBackup);
+        env::remove_var(ENV_VERSION_CONTROL);
     }
 
-    #[test]
-    fn test_suffix_takes_hyphen_value() {
-        let _dummy = TEST_MUTEX.lock().unwrap();
-        let matches = make_app().get_matches_from(vec!["command", "-b", "--suffix", "-v"]);
+    #[test]
+    fn test_suffix_takes_hyphen_value() {
+        let _dummy = TEST_MUTEX.lock().unwrap();
+        let matches = make_app().get_matches_from(vec!["command", "-b", "--suffix", "-v"]);
 
-        let result = determine_backup_suffix(&matches);
-        assert_eq!(result, "-v");
+        let result = determine_backup_suffix(&matches);
+        assert_eq!(result, "-v");
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/mods/display.rs.html b/dev/src/uucore/mods/display.rs.html index fcf4576d9..1f71e1cc8 100644 --- a/dev/src/uucore/mods/display.rs.html +++ b/dev/src/uucore/mods/display.rs.html @@ -1,4 +1,4 @@ -display.rs - source
1
+display.rs - source
1
 2
 3
 4
@@ -67,74 +67,74 @@
 67
 68
 69
-
/// Utilities for printing paths, with special attention paid to special
-/// characters and invalid unicode.
-///
-/// For displaying paths in informational messages use `Quotable::quote`. This
-/// will wrap quotes around the filename and add the necessary escapes to make
-/// it copy/paste-able into a shell.
-///
-/// For writing raw paths to stdout when the output should not be quoted or escaped,
-/// use `println_verbatim`. This will preserve invalid unicode.
-///
-/// # Examples
-/// ```
-/// use std::path::Path;
-/// use uucore::display::{Quotable, println_verbatim};
-///
-/// let path = Path::new("foo/bar.baz");
-///
-/// println!("Found file {}", path.quote()); // Prints "Found file 'foo/bar.baz'"
-/// println_verbatim(path)?; // Prints "foo/bar.baz"
-/// # Ok::<(), std::io::Error>(())
-/// ```
-use std::ffi::OsStr;
-use std::io::{self, Write as IoWrite};
+
/// Utilities for printing paths, with special attention paid to special
+/// characters and invalid unicode.
+///
+/// For displaying paths in informational messages use `Quotable::quote`. This
+/// will wrap quotes around the filename and add the necessary escapes to make
+/// it copy/paste-able into a shell.
+///
+/// For writing raw paths to stdout when the output should not be quoted or escaped,
+/// use `println_verbatim`. This will preserve invalid unicode.
+///
+/// # Examples
+/// ```
+/// use std::path::Path;
+/// use uucore::display::{Quotable, println_verbatim};
+///
+/// let path = Path::new("foo/bar.baz");
+///
+/// println!("Found file {}", path.quote()); // Prints "Found file 'foo/bar.baz'"
+/// println_verbatim(path)?; // Prints "foo/bar.baz"
+/// # Ok::<(), std::io::Error>(())
+/// ```
+use std::ffi::OsStr;
+use std::io::{self, Write as IoWrite};
 
-#[cfg(unix)]
-use std::os::unix::ffi::OsStrExt;
-#[cfg(target_os = "wasi")]
-use std::os::wasi::ffi::OsStrExt;
+#[cfg(unix)]
+use std::os::unix::ffi::OsStrExt;
+#[cfg(target_os = "wasi")]
+use std::os::wasi::ffi::OsStrExt;
 
-// These used to be defined here, but they live in their own crate now.
-pub use os_display::{Quotable, Quoted};
+// These used to be defined here, but they live in their own crate now.
+pub use os_display::{Quotable, Quoted};
 
-/// Print a path (or `OsStr`-like object) directly to stdout, with a trailing newline,
-/// without losing any information if its encoding is invalid.
-///
-/// This function is appropriate for commands where printing paths is the point and the
-/// output is likely to be captured, like `pwd` and `basename`. For informational output
-/// use `Quotable::quote`.
-///
-/// FIXME: This is lossy on Windows. It could probably be implemented using some low-level
-/// API that takes UTF-16, without going through io::Write. This is not a big priority
-/// because broken filenames are much rarer on Windows than on Unix.
-pub fn println_verbatim<S: AsRef<OsStr>>(text: S) -> io::Result<()> {
-    let stdout = io::stdout();
-    let mut stdout = stdout.lock();
-    #[cfg(any(unix, target_os = "wasi"))]
-    {
-        stdout.write_all(text.as_ref().as_bytes())?;
-        stdout.write_all(b"\n")?;
+/// Print a path (or `OsStr`-like object) directly to stdout, with a trailing newline,
+/// without losing any information if its encoding is invalid.
+///
+/// This function is appropriate for commands where printing paths is the point and the
+/// output is likely to be captured, like `pwd` and `basename`. For informational output
+/// use `Quotable::quote`.
+///
+/// FIXME: This is lossy on Windows. It could probably be implemented using some low-level
+/// API that takes UTF-16, without going through io::Write. This is not a big priority
+/// because broken filenames are much rarer on Windows than on Unix.
+pub fn println_verbatim<S: AsRef<OsStr>>(text: S) -> io::Result<()> {
+    let stdout = io::stdout();
+    let mut stdout = stdout.lock();
+    #[cfg(any(unix, target_os = "wasi"))]
+    {
+        stdout.write_all(text.as_ref().as_bytes())?;
+        stdout.write_all(b"\n")?;
     }
-    #[cfg(not(any(unix, target_os = "wasi")))]
-    {
-        writeln!(stdout, "{}", std::path::Path::new(text.as_ref()).display())?;
+    #[cfg(not(any(unix, target_os = "wasi")))]
+    {
+        writeln!(stdout, "{}", std::path::Path::new(text.as_ref()).display())?;
     }
     Ok(())
 }
 
-/// Like `println_verbatim`, without the trailing newline.
-pub fn print_verbatim<S: AsRef<OsStr>>(text: S) -> io::Result<()> {
-    let mut stdout = io::stdout();
-    #[cfg(any(unix, target_os = "wasi"))]
-    {
-        stdout.write_all(text.as_ref().as_bytes())
+/// Like `println_verbatim`, without the trailing newline.
+pub fn print_verbatim<S: AsRef<OsStr>>(text: S) -> io::Result<()> {
+    let mut stdout = io::stdout();
+    #[cfg(any(unix, target_os = "wasi"))]
+    {
+        stdout.write_all(text.as_ref().as_bytes())
     }
-    #[cfg(not(any(unix, target_os = "wasi")))]
-    {
-        write!(stdout, "{}", std::path::Path::new(text.as_ref()).display())
+    #[cfg(not(any(unix, target_os = "wasi")))]
+    {
+        write!(stdout, "{}", std::path::Path::new(text.as_ref()).display())
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/mods/error.rs.html b/dev/src/uucore/mods/error.rs.html index a0c2a7489..09892afde 100644 --- a/dev/src/uucore/mods/error.rs.html +++ b/dev/src/uucore/mods/error.rs.html @@ -1,4 +1,4 @@ -error.rs - source
1
+error.rs - source
1
 2
 3
 4
@@ -693,700 +693,700 @@
 693
 694
 695
-
// TODO fix broken links
-#![allow(rustdoc::broken_intra_doc_links)]
-//! All utils return exit with an exit code. Usually, the following scheme is used:
-//! * `0`: succeeded
-//! * `1`: minor problems
-//! * `2`: major problems
-//!
-//! This module provides types to reconcile these exit codes with idiomatic Rust error
-//! handling. This has a couple advantages over manually using [`std::process::exit`]:
-//! 1. It enables the use of `?`, `map_err`, `unwrap_or`, etc. in `uumain`.
-//! 1. It encourages the use of [`UResult`]/[`Result`] in functions in the utils.
-//! 1. The error messages are largely standardized across utils.
-//! 1. Standardized error messages can be created from external result types
-//!    (i.e. [`std::io::Result`] & `clap::ClapResult`).
-//! 1. [`set_exit_code`] takes away the burden of manually tracking exit codes for non-fatal errors.
-//!
-//! # Usage
-//! The signature of a typical util should be:
-//! ```ignore
-//! fn uumain(args: impl uucore::Args) -> UResult<()> {
-//!     ...
-//! }
-//! ```
-//! [`UResult`] is a simple wrapper around [`Result`] with a custom error trait: [`UError`]. The
-//! most important difference with types implementing [`std::error::Error`] is that [`UError`]s
-//! can specify the exit code of the program when they are returned from `uumain`:
-//! * When `Ok` is returned, the code set with [`set_exit_code`] is used as exit code. If
-//!   [`set_exit_code`] was not used, then `0` is used.
-//! * When `Err` is returned, the code corresponding with the error is used as exit code and the
-//! error message is displayed.
-//!
-//! Additionally, the errors can be displayed manually with the [`show`] and [`show_if_err`] macros:
-//! ```ignore
-//! let res = Err(USimpleError::new(1, "Error!!"));
-//! show_if_err!(res);
-//! // or
-//! if let Err(e) = res {
-//!    show!(e);
-//! }
-//! ```
-//!
-//! **Note**: The [`show`] and [`show_if_err`] macros set the exit code of the program using
-//! [`set_exit_code`]. See the documentation on that function for more information.
-//!
-//! # Guidelines
-//! * Use error types from `uucore` where possible.
-//! * Add error types to `uucore` if an error appears in multiple utils.
-//! * Prefer proper custom error types over [`ExitCode`] and [`USimpleError`].
-//! * [`USimpleError`] may be used in small utils with simple error handling.
-//! * Using [`ExitCode`] is not recommended but can be useful for converting utils to use
-//!   [`UResult`].
+
// TODO fix broken links
+#![allow(rustdoc::broken_intra_doc_links)]
+//! All utils return exit with an exit code. Usually, the following scheme is used:
+//! * `0`: succeeded
+//! * `1`: minor problems
+//! * `2`: major problems
+//!
+//! This module provides types to reconcile these exit codes with idiomatic Rust error
+//! handling. This has a couple advantages over manually using [`std::process::exit`]:
+//! 1. It enables the use of `?`, `map_err`, `unwrap_or`, etc. in `uumain`.
+//! 1. It encourages the use of [`UResult`]/[`Result`] in functions in the utils.
+//! 1. The error messages are largely standardized across utils.
+//! 1. Standardized error messages can be created from external result types
+//!    (i.e. [`std::io::Result`] & `clap::ClapResult`).
+//! 1. [`set_exit_code`] takes away the burden of manually tracking exit codes for non-fatal errors.
+//!
+//! # Usage
+//! The signature of a typical util should be:
+//! ```ignore
+//! fn uumain(args: impl uucore::Args) -> UResult<()> {
+//!     ...
+//! }
+//! ```
+//! [`UResult`] is a simple wrapper around [`Result`] with a custom error trait: [`UError`]. The
+//! most important difference with types implementing [`std::error::Error`] is that [`UError`]s
+//! can specify the exit code of the program when they are returned from `uumain`:
+//! * When `Ok` is returned, the code set with [`set_exit_code`] is used as exit code. If
+//!   [`set_exit_code`] was not used, then `0` is used.
+//! * When `Err` is returned, the code corresponding with the error is used as exit code and the
+//! error message is displayed.
+//!
+//! Additionally, the errors can be displayed manually with the [`show`] and [`show_if_err`] macros:
+//! ```ignore
+//! let res = Err(USimpleError::new(1, "Error!!"));
+//! show_if_err!(res);
+//! // or
+//! if let Err(e) = res {
+//!    show!(e);
+//! }
+//! ```
+//!
+//! **Note**: The [`show`] and [`show_if_err`] macros set the exit code of the program using
+//! [`set_exit_code`]. See the documentation on that function for more information.
+//!
+//! # Guidelines
+//! * Use error types from `uucore` where possible.
+//! * Add error types to `uucore` if an error appears in multiple utils.
+//! * Prefer proper custom error types over [`ExitCode`] and [`USimpleError`].
+//! * [`USimpleError`] may be used in small utils with simple error handling.
+//! * Using [`ExitCode`] is not recommended but can be useful for converting utils to use
+//!   [`UResult`].
 
-// spell-checker:ignore uioerror rustdoc
+// spell-checker:ignore uioerror rustdoc
 
-use clap;
-use std::{
-    error::Error,
-    fmt::{Display, Formatter},
-    sync::atomic::{AtomicI32, Ordering},
+use clap;
+use std::{
+    error::Error,
+    fmt::{Display, Formatter},
+    sync::atomic::{AtomicI32, Ordering},
 };
 
-static EXIT_CODE: AtomicI32 = AtomicI32::new(0);
+static EXIT_CODE: AtomicI32 = AtomicI32::new(0);
 
-/// Get the last exit code set with [`set_exit_code`].
-/// The default value is `0`.
-pub fn get_exit_code() -> i32 {
-    EXIT_CODE.load(Ordering::SeqCst)
+/// Get the last exit code set with [`set_exit_code`].
+/// The default value is `0`.
+pub fn get_exit_code() -> i32 {
+    EXIT_CODE.load(Ordering::SeqCst)
 }
 
-/// Set the exit code for the program if `uumain` returns `Ok(())`.
-///
-/// This function is most useful for non-fatal errors, for example when applying an operation to
-/// multiple files:
-/// ```ignore
-/// use uucore::error::{UResult, set_exit_code};
-///
-/// fn uumain(args: impl uucore::Args) -> UResult<()> {
-///     ...
-///     for file in files {
-///         let res = some_operation_that_might_fail(file);
-///         match res {
-///             Ok() => {},
-///             Err(_) => set_exit_code(1),
-///         }
-///     }
-///     Ok(()) // If any of the operations failed, 1 is returned.
-/// }
-/// ```
-pub fn set_exit_code(code: i32) {
-    EXIT_CODE.store(code, Ordering::SeqCst);
+/// Set the exit code for the program if `uumain` returns `Ok(())`.
+///
+/// This function is most useful for non-fatal errors, for example when applying an operation to
+/// multiple files:
+/// ```ignore
+/// use uucore::error::{UResult, set_exit_code};
+///
+/// fn uumain(args: impl uucore::Args) -> UResult<()> {
+///     ...
+///     for file in files {
+///         let res = some_operation_that_might_fail(file);
+///         match res {
+///             Ok() => {},
+///             Err(_) => set_exit_code(1),
+///         }
+///     }
+///     Ok(()) // If any of the operations failed, 1 is returned.
+/// }
+/// ```
+pub fn set_exit_code(code: i32) {
+    EXIT_CODE.store(code, Ordering::SeqCst);
 }
 
-/// Result type that should be returned by all utils.
-pub type UResult<T> = Result<T, Box<dyn UError>>;
+/// Result type that should be returned by all utils.
+pub type UResult<T> = Result<T, Box<dyn UError>>;
 
-/// Custom errors defined by the utils and `uucore`.
-///
-/// All errors should implement [`std::error::Error`], [`std::fmt::Display`] and
-/// [`std::fmt::Debug`] and have an additional `code` method that specifies the
-/// exit code of the program if the error is returned from `uumain`.
-///
-/// An example of a custom error from `ls`:
-///
-/// ```
-/// use uucore::{
-///     display::Quotable,
-///     error::{UError, UResult}
-/// };
-/// use std::{
-///     error::Error,
-///     fmt::{Display, Debug},
-///     path::PathBuf
-/// };
-///
-/// #[derive(Debug)]
-/// enum LsError {
-///     InvalidLineWidth(String),
-///     NoMetadata(PathBuf),
-/// }
-///
-/// impl UError for LsError {
-///     fn code(&self) -> i32 {
-///         match self {
-///             LsError::InvalidLineWidth(_) => 2,
-///             LsError::NoMetadata(_) => 1,
-///         }
-///     }
-/// }
-///
-/// impl Error for LsError {}
-///
-/// impl Display for LsError {
-///     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-///         match self {
-///             LsError::InvalidLineWidth(s) => write!(f, "invalid line width: {}", s.quote()),
-///             LsError::NoMetadata(p) => write!(f, "could not open file: {}", p.quote()),
-///         }
-///     }
-/// }
-/// ```
-///
-/// The main routine would look like this:
-///
-/// ```ignore
-/// #[uucore::main]
-/// pub fn uumain(args: impl uucore::Args) -> UResult<()> {
-///     // Perform computations here ...
-///     return Err(LsError::InvalidLineWidth(String::from("test")).into())
-/// }
-/// ```
-///
-/// The call to `into()` is required to convert the `LsError` to
-/// [`Box<dyn UError>`]. The implementation for `From` is provided automatically.
-///
-/// A crate like [`quick_error`](https://crates.io/crates/quick-error) might
-/// also be used, but will still require an `impl` for the `code` method.
-pub trait UError: Error + Send {
-    /// Error code of a custom error.
-    ///
-    /// Set a return value for each variant of an enum-type to associate an
-    /// error code (which is returned to the system shell) with an error
-    /// variant.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// use uucore::{
-    ///     display::Quotable,
-    ///     error::UError
-    /// };
-    /// use std::{
-    ///     error::Error,
-    ///     fmt::{Display, Debug},
-    ///     path::PathBuf
-    /// };
-    ///
-    /// #[derive(Debug)]
-    /// enum MyError {
-    ///     Foo(String),
-    ///     Bar(PathBuf),
-    ///     Bing(),
-    /// }
-    ///
-    /// impl UError for MyError {
-    ///     fn code(&self) -> i32 {
-    ///         match self {
-    ///             MyError::Foo(_) => 2,
-    ///             // All other errors yield the same error code, there's no
-    ///             // need to list them explicitly.
-    ///             _ => 1,
-    ///         }
-    ///     }
-    /// }
-    ///
-    /// impl Error for MyError {}
-    ///
-    /// impl Display for MyError {
-    ///     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-    ///         use MyError as ME;
-    ///         match self {
-    ///             ME::Foo(s) => write!(f, "Unknown Foo: {}", s.quote()),
-    ///             ME::Bar(p) => write!(f, "Couldn't find Bar: {}", p.quote()),
-    ///             ME::Bing() => write!(f, "Exterminate!"),
-    ///         }
-    ///     }
-    /// }
-    /// ```
-    fn code(&self) -> i32 {
-        1
-    }
+/// Custom errors defined by the utils and `uucore`.
+///
+/// All errors should implement [`std::error::Error`], [`std::fmt::Display`] and
+/// [`std::fmt::Debug`] and have an additional `code` method that specifies the
+/// exit code of the program if the error is returned from `uumain`.
+///
+/// An example of a custom error from `ls`:
+///
+/// ```
+/// use uucore::{
+///     display::Quotable,
+///     error::{UError, UResult}
+/// };
+/// use std::{
+///     error::Error,
+///     fmt::{Display, Debug},
+///     path::PathBuf
+/// };
+///
+/// #[derive(Debug)]
+/// enum LsError {
+///     InvalidLineWidth(String),
+///     NoMetadata(PathBuf),
+/// }
+///
+/// impl UError for LsError {
+///     fn code(&self) -> i32 {
+///         match self {
+///             LsError::InvalidLineWidth(_) => 2,
+///             LsError::NoMetadata(_) => 1,
+///         }
+///     }
+/// }
+///
+/// impl Error for LsError {}
+///
+/// impl Display for LsError {
+///     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+///         match self {
+///             LsError::InvalidLineWidth(s) => write!(f, "invalid line width: {}", s.quote()),
+///             LsError::NoMetadata(p) => write!(f, "could not open file: {}", p.quote()),
+///         }
+///     }
+/// }
+/// ```
+///
+/// The main routine would look like this:
+///
+/// ```ignore
+/// #[uucore::main]
+/// pub fn uumain(args: impl uucore::Args) -> UResult<()> {
+///     // Perform computations here ...
+///     return Err(LsError::InvalidLineWidth(String::from("test")).into())
+/// }
+/// ```
+///
+/// The call to `into()` is required to convert the `LsError` to
+/// [`Box<dyn UError>`]. The implementation for `From` is provided automatically.
+///
+/// A crate like [`quick_error`](https://crates.io/crates/quick-error) might
+/// also be used, but will still require an `impl` for the `code` method.
+pub trait UError: Error + Send {
+    /// Error code of a custom error.
+    ///
+    /// Set a return value for each variant of an enum-type to associate an
+    /// error code (which is returned to the system shell) with an error
+    /// variant.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// use uucore::{
+    ///     display::Quotable,
+    ///     error::UError
+    /// };
+    /// use std::{
+    ///     error::Error,
+    ///     fmt::{Display, Debug},
+    ///     path::PathBuf
+    /// };
+    ///
+    /// #[derive(Debug)]
+    /// enum MyError {
+    ///     Foo(String),
+    ///     Bar(PathBuf),
+    ///     Bing(),
+    /// }
+    ///
+    /// impl UError for MyError {
+    ///     fn code(&self) -> i32 {
+    ///         match self {
+    ///             MyError::Foo(_) => 2,
+    ///             // All other errors yield the same error code, there's no
+    ///             // need to list them explicitly.
+    ///             _ => 1,
+    ///         }
+    ///     }
+    /// }
+    ///
+    /// impl Error for MyError {}
+    ///
+    /// impl Display for MyError {
+    ///     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+    ///         use MyError as ME;
+    ///         match self {
+    ///             ME::Foo(s) => write!(f, "Unknown Foo: {}", s.quote()),
+    ///             ME::Bar(p) => write!(f, "Couldn't find Bar: {}", p.quote()),
+    ///             ME::Bing() => write!(f, "Exterminate!"),
+    ///         }
+    ///     }
+    /// }
+    /// ```
+    fn code(&self) -> i32 {
+        1
+    }
 
-    /// Print usage help to a custom error.
-    ///
-    /// Return true or false to control whether a short usage help is printed
-    /// below the error message. The usage help is in the format: "Try `{name}
-    /// --help` for more information." and printed only if `true` is returned.
-    ///
-    /// # Example
-    ///
-    /// ```
-    /// use uucore::{
-    ///     display::Quotable,
-    ///     error::UError
-    /// };
-    /// use std::{
-    ///     error::Error,
-    ///     fmt::{Display, Debug},
-    ///     path::PathBuf
-    /// };
-    ///
-    /// #[derive(Debug)]
-    /// enum MyError {
-    ///     Foo(String),
-    ///     Bar(PathBuf),
-    ///     Bing(),
-    /// }
-    ///
-    /// impl UError for MyError {
-    ///     fn usage(&self) -> bool {
-    ///         match self {
-    ///             // This will have a short usage help appended
-    ///             MyError::Bar(_) => true,
-    ///             // These matches won't have a short usage help appended
-    ///             _ => false,
-    ///         }
-    ///     }
-    /// }
-    ///
-    /// impl Error for MyError {}
-    ///
-    /// impl Display for MyError {
-    ///     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-    ///         use MyError as ME;
-    ///         match self {
-    ///             ME::Foo(s) => write!(f, "Unknown Foo: {}", s.quote()),
-    ///             ME::Bar(p) => write!(f, "Couldn't find Bar: {}", p.quote()),
-    ///             ME::Bing() => write!(f, "Exterminate!"),
-    ///         }
-    ///     }
-    /// }
-    /// ```
-    fn usage(&self) -> bool {
-        false
-    }
+    /// Print usage help to a custom error.
+    ///
+    /// Return true or false to control whether a short usage help is printed
+    /// below the error message. The usage help is in the format: "Try `{name}
+    /// --help` for more information." and printed only if `true` is returned.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// use uucore::{
+    ///     display::Quotable,
+    ///     error::UError
+    /// };
+    /// use std::{
+    ///     error::Error,
+    ///     fmt::{Display, Debug},
+    ///     path::PathBuf
+    /// };
+    ///
+    /// #[derive(Debug)]
+    /// enum MyError {
+    ///     Foo(String),
+    ///     Bar(PathBuf),
+    ///     Bing(),
+    /// }
+    ///
+    /// impl UError for MyError {
+    ///     fn usage(&self) -> bool {
+    ///         match self {
+    ///             // This will have a short usage help appended
+    ///             MyError::Bar(_) => true,
+    ///             // These matches won't have a short usage help appended
+    ///             _ => false,
+    ///         }
+    ///     }
+    /// }
+    ///
+    /// impl Error for MyError {}
+    ///
+    /// impl Display for MyError {
+    ///     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+    ///         use MyError as ME;
+    ///         match self {
+    ///             ME::Foo(s) => write!(f, "Unknown Foo: {}", s.quote()),
+    ///             ME::Bar(p) => write!(f, "Couldn't find Bar: {}", p.quote()),
+    ///             ME::Bing() => write!(f, "Exterminate!"),
+    ///         }
+    ///     }
+    /// }
+    /// ```
+    fn usage(&self) -> bool {
+        false
+    }
 }
 
-impl<T> From<T> for Box<dyn UError>
-where
-    T: UError + 'static,
+impl<T> From<T> for Box<dyn UError>
+where
+    T: UError + 'static,
 {
-    fn from(t: T) -> Self {
-        Box::new(t)
+    fn from(t: T) -> Self {
+        Box::new(t)
     }
 }
 
-/// A simple error type with an exit code and a message that implements [`UError`].
-///
-/// ```
-/// use uucore::error::{UResult, USimpleError};
-/// let err = USimpleError { code: 1, message: "error!".into()};
-/// let res: UResult<()> = Err(err.into());
-/// // or using the `new` method:
-/// let res: UResult<()> = Err(USimpleError::new(1, "error!"));
-/// ```
-#[derive(Debug)]
-pub struct USimpleError {
-    pub code: i32,
-    pub message: String,
+/// A simple error type with an exit code and a message that implements [`UError`].
+///
+/// ```
+/// use uucore::error::{UResult, USimpleError};
+/// let err = USimpleError { code: 1, message: "error!".into()};
+/// let res: UResult<()> = Err(err.into());
+/// // or using the `new` method:
+/// let res: UResult<()> = Err(USimpleError::new(1, "error!"));
+/// ```
+#[derive(Debug)]
+pub struct USimpleError {
+    pub code: i32,
+    pub message: String,
 }
 
-impl USimpleError {
-    #[allow(clippy::new_ret_no_self)]
-    pub fn new<S: Into<String>>(code: i32, message: S) -> Box<dyn UError> {
-        Box::new(Self {
-            code,
-            message: message.into(),
+impl USimpleError {
+    #[allow(clippy::new_ret_no_self)]
+    pub fn new<S: Into<String>>(code: i32, message: S) -> Box<dyn UError> {
+        Box::new(Self {
+            code,
+            message: message.into(),
         })
     }
 }
 
-impl Error for USimpleError {}
+impl Error for USimpleError {}
 
-impl Display for USimpleError {
-    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
-        self.message.fmt(f)
+impl Display for USimpleError {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
+        self.message.fmt(f)
     }
 }
 
-impl UError for USimpleError {
-    fn code(&self) -> i32 {
-        self.code
+impl UError for USimpleError {
+    fn code(&self) -> i32 {
+        self.code
     }
 }
 
-#[derive(Debug)]
-pub struct UUsageError {
-    pub code: i32,
-    pub message: String,
+#[derive(Debug)]
+pub struct UUsageError {
+    pub code: i32,
+    pub message: String,
 }
 
-impl UUsageError {
-    #[allow(clippy::new_ret_no_self)]
-    pub fn new<S: Into<String>>(code: i32, message: S) -> Box<dyn UError> {
-        Box::new(Self {
-            code,
-            message: message.into(),
+impl UUsageError {
+    #[allow(clippy::new_ret_no_self)]
+    pub fn new<S: Into<String>>(code: i32, message: S) -> Box<dyn UError> {
+        Box::new(Self {
+            code,
+            message: message.into(),
         })
     }
 }
 
-impl Error for UUsageError {}
+impl Error for UUsageError {}
 
-impl Display for UUsageError {
-    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
-        self.message.fmt(f)
+impl Display for UUsageError {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
+        self.message.fmt(f)
     }
 }
 
-impl UError for UUsageError {
-    fn code(&self) -> i32 {
-        self.code
+impl UError for UUsageError {
+    fn code(&self) -> i32 {
+        self.code
     }
 
-    fn usage(&self) -> bool {
-        true
-    }
+    fn usage(&self) -> bool {
+        true
+    }
 }
 
-/// Wrapper type around [`std::io::Error`].
-///
-/// The messages displayed by [`UIoError`] should match the error messages displayed by GNU
-/// coreutils.
-///
-/// There are two ways to construct this type: with [`UIoError::new`] or by calling the
-/// [`FromIo::map_err_context`] method on a [`std::io::Result`] or [`std::io::Error`].
-/// ```
-/// use uucore::{
-///     display::Quotable,
-///     error::{FromIo, UResult, UIoError, UError}
-/// };
-/// use std::fs::File;
-/// use std::path::Path;
-/// let path = Path::new("test.txt");
-///
-/// // Manual construction
-/// let e: Box<dyn UError> = UIoError::new(
-///     std::io::ErrorKind::NotFound,
-///     format!("cannot access {}", path.quote())
-/// );
-/// let res: UResult<()> = Err(e.into());
-///
-/// // Converting from an `std::io::Error`.
-/// let res: UResult<File> = File::open(path).map_err_context(|| format!("cannot access {}", path.quote()));
-/// ```
-#[derive(Debug)]
-pub struct UIoError {
-    context: Option<String>,
-    inner: std::io::Error,
+/// Wrapper type around [`std::io::Error`].
+///
+/// The messages displayed by [`UIoError`] should match the error messages displayed by GNU
+/// coreutils.
+///
+/// There are two ways to construct this type: with [`UIoError::new`] or by calling the
+/// [`FromIo::map_err_context`] method on a [`std::io::Result`] or [`std::io::Error`].
+/// ```
+/// use uucore::{
+///     display::Quotable,
+///     error::{FromIo, UResult, UIoError, UError}
+/// };
+/// use std::fs::File;
+/// use std::path::Path;
+/// let path = Path::new("test.txt");
+///
+/// // Manual construction
+/// let e: Box<dyn UError> = UIoError::new(
+///     std::io::ErrorKind::NotFound,
+///     format!("cannot access {}", path.quote())
+/// );
+/// let res: UResult<()> = Err(e.into());
+///
+/// // Converting from an `std::io::Error`.
+/// let res: UResult<File> = File::open(path).map_err_context(|| format!("cannot access {}", path.quote()));
+/// ```
+#[derive(Debug)]
+pub struct UIoError {
+    context: Option<String>,
+    inner: std::io::Error,
 }
 
-impl UIoError {
-    #[allow(clippy::new_ret_no_self)]
-    pub fn new<S: Into<String>>(kind: std::io::ErrorKind, context: S) -> Box<dyn UError> {
-        Box::new(Self {
-            context: Some(context.into()),
-            inner: kind.into(),
+impl UIoError {
+    #[allow(clippy::new_ret_no_self)]
+    pub fn new<S: Into<String>>(kind: std::io::ErrorKind, context: S) -> Box<dyn UError> {
+        Box::new(Self {
+            context: Some(context.into()),
+            inner: kind.into(),
         })
     }
 }
 
-impl UError for UIoError {}
+impl UError for UIoError {}
 
-impl Error for UIoError {}
+impl Error for UIoError {}
 
-impl Display for UIoError {
-    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
-        use std::io::ErrorKind::*;
+impl Display for UIoError {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
+        use std::io::ErrorKind::*;
 
-        let mut message;
-        let message = if self.inner.raw_os_error().is_some() {
-            // These are errors that come directly from the OS.
-            // We want to normalize their messages across systems,
-            // and we want to strip the "(os error X)" suffix.
-            match self.inner.kind() {
-                NotFound => "No such file or directory",
-                PermissionDenied => "Permission denied",
-                ConnectionRefused => "Connection refused",
-                ConnectionReset => "Connection reset",
-                ConnectionAborted => "Connection aborted",
-                NotConnected => "Not connected",
-                AddrInUse => "Address in use",
-                AddrNotAvailable => "Address not available",
-                BrokenPipe => "Broken pipe",
-                AlreadyExists => "Already exists",
-                WouldBlock => "Would block",
-                InvalidInput => "Invalid input",
-                InvalidData => "Invalid data",
-                TimedOut => "Timed out",
-                WriteZero => "Write zero",
-                Interrupted => "Interrupted",
-                UnexpectedEof => "Unexpected end of file",
-                _ => {
-                    // TODO: When the new error variants
-                    // (https://github.com/rust-lang/rust/issues/86442)
-                    // are stabilized, we should add them to the match statement.
-                    message = strip_errno(&self.inner);
-                    capitalize(&mut message);
-                    &message
+        let mut message;
+        let message = if self.inner.raw_os_error().is_some() {
+            // These are errors that come directly from the OS.
+            // We want to normalize their messages across systems,
+            // and we want to strip the "(os error X)" suffix.
+            match self.inner.kind() {
+                NotFound => "No such file or directory",
+                PermissionDenied => "Permission denied",
+                ConnectionRefused => "Connection refused",
+                ConnectionReset => "Connection reset",
+                ConnectionAborted => "Connection aborted",
+                NotConnected => "Not connected",
+                AddrInUse => "Address in use",
+                AddrNotAvailable => "Address not available",
+                BrokenPipe => "Broken pipe",
+                AlreadyExists => "Already exists",
+                WouldBlock => "Would block",
+                InvalidInput => "Invalid input",
+                InvalidData => "Invalid data",
+                TimedOut => "Timed out",
+                WriteZero => "Write zero",
+                Interrupted => "Interrupted",
+                UnexpectedEof => "Unexpected end of file",
+                _ => {
+                    // TODO: When the new error variants
+                    // (https://github.com/rust-lang/rust/issues/86442)
+                    // are stabilized, we should add them to the match statement.
+                    message = strip_errno(&self.inner);
+                    capitalize(&mut message);
+                    &message
                 }
             }
-        } else {
-            // These messages don't need as much normalization, and the above
-            // messages wouldn't always be a good substitute.
-            // For example, ErrorKind::NotFound doesn't necessarily mean it was
-            // a file that was not found.
-            // There are also errors with entirely custom messages.
-            message = self.inner.to_string();
-            capitalize(&mut message);
-            &message
+        } else {
+            // These messages don't need as much normalization, and the above
+            // messages wouldn't always be a good substitute.
+            // For example, ErrorKind::NotFound doesn't necessarily mean it was
+            // a file that was not found.
+            // There are also errors with entirely custom messages.
+            message = self.inner.to_string();
+            capitalize(&mut message);
+            &message
         };
-        if let Some(ctx) = &self.context {
-            write!(f, "{}: {}", ctx, message)
-        } else {
-            write!(f, "{}", message)
+        if let Some(ctx) = &self.context {
+            write!(f, "{}: {}", ctx, message)
+        } else {
+            write!(f, "{}", message)
         }
     }
 }
 
-/// Capitalize the first character of an ASCII string.
-fn capitalize(text: &mut str) {
-    if let Some(first) = text.get_mut(..1) {
-        first.make_ascii_uppercase();
+/// Capitalize the first character of an ASCII string.
+fn capitalize(text: &mut str) {
+    if let Some(first) = text.get_mut(..1) {
+        first.make_ascii_uppercase();
     }
 }
 
-/// Strip the trailing " (os error XX)" from io error strings.
-pub fn strip_errno(err: &std::io::Error) -> String {
-    let mut msg = err.to_string();
-    if let Some(pos) = msg.find(" (os error ") {
-        msg.truncate(pos);
+/// Strip the trailing " (os error XX)" from io error strings.
+pub fn strip_errno(err: &std::io::Error) -> String {
+    let mut msg = err.to_string();
+    if let Some(pos) = msg.find(" (os error ") {
+        msg.truncate(pos);
     }
-    msg
+    msg
 }
 
-/// Enables the conversion from [`std::io::Error`] to [`UError`] and from [`std::io::Result`] to
-/// [`UResult`].
-pub trait FromIo<T> {
-    fn map_err_context(self, context: impl FnOnce() -> String) -> T;
+/// Enables the conversion from [`std::io::Error`] to [`UError`] and from [`std::io::Result`] to
+/// [`UResult`].
+pub trait FromIo<T> {
+    fn map_err_context(self, context: impl FnOnce() -> String) -> T;
 }
 
-impl FromIo<Box<UIoError>> for std::io::Error {
-    fn map_err_context(self, context: impl FnOnce() -> String) -> Box<UIoError> {
-        Box::new(UIoError {
-            context: Some((context)()),
-            inner: self,
+impl FromIo<Box<UIoError>> for std::io::Error {
+    fn map_err_context(self, context: impl FnOnce() -> String) -> Box<UIoError> {
+        Box::new(UIoError {
+            context: Some((context)()),
+            inner: self,
         })
     }
 }
 
-impl<T> FromIo<UResult<T>> for std::io::Result<T> {
-    fn map_err_context(self, context: impl FnOnce() -> String) -> UResult<T> {
-        self.map_err(|e| e.map_err_context(context) as Box<dyn UError>)
+impl<T> FromIo<UResult<T>> for std::io::Result<T> {
+    fn map_err_context(self, context: impl FnOnce() -> String) -> UResult<T> {
+        self.map_err(|e| e.map_err_context(context) as Box<dyn UError>)
     }
 }
 
-impl FromIo<Box<UIoError>> for std::io::ErrorKind {
-    fn map_err_context(self, context: impl FnOnce() -> String) -> Box<UIoError> {
-        Box::new(UIoError {
-            context: Some((context)()),
-            inner: std::io::Error::new(self, ""),
+impl FromIo<Box<UIoError>> for std::io::ErrorKind {
+    fn map_err_context(self, context: impl FnOnce() -> String) -> Box<UIoError> {
+        Box::new(UIoError {
+            context: Some((context)()),
+            inner: std::io::Error::new(self, ""),
         })
     }
 }
 
-impl From<std::io::Error> for UIoError {
-    fn from(f: std::io::Error) -> Self {
-        Self {
-            context: None,
-            inner: f,
+impl From<std::io::Error> for UIoError {
+    fn from(f: std::io::Error) -> Self {
+        Self {
+            context: None,
+            inner: f,
         }
     }
 }
 
-impl From<std::io::Error> for Box<dyn UError> {
-    fn from(f: std::io::Error) -> Self {
-        let u_error: UIoError = f.into();
-        Box::new(u_error) as Self
-    }
+impl From<std::io::Error> for Box<dyn UError> {
+    fn from(f: std::io::Error) -> Self {
+        let u_error: UIoError = f.into();
+        Box::new(u_error) as Self
+    }
 }
 
-/// Shorthand to construct [`UIoError`]-instances.
-///
-/// This macro serves as a convenience call to quickly construct instances of
-/// [`UIoError`]. It takes:
-///
-/// - An instance of [`std::io::Error`]
-/// - A `format!`-compatible string and
-/// - An arbitrary number of arguments to the format string
-///
-/// In exactly this order. It is equivalent to the more verbose code seen in the
-/// example.
-///
-/// # Examples
-///
-/// ```
-/// use uucore::error::UIoError;
-/// use uucore::uio_error;
-///
-/// let io_err = std::io::Error::new(
-///     std::io::ErrorKind::PermissionDenied, "fix me please!"
-/// );
-///
-/// let uio_err = UIoError::new(
-///     io_err.kind(),
-///     format!("Error code: {}", 2)
-/// );
-///
-/// let other_uio_err = uio_error!(io_err, "Error code: {}", 2);
-///
-/// // prints "fix me please!: Permission denied"
-/// println!("{}", uio_err);
-/// // prints "Error code: 2: Permission denied"
-/// println!("{}", other_uio_err);
-/// ```
-///
-/// The [`std::fmt::Display`] impl of [`UIoError`] will then ensure that an
-/// appropriate error message relating to the actual error kind of the
-/// [`std::io::Error`] is appended to whatever error message is defined in
-/// addition (as secondary argument).
-///
-/// If you want to show only the error message for the [`std::io::ErrorKind`]
-/// that's contained in [`UIoError`], pass the second argument as empty string:
-///
-/// ```
-/// use uucore::error::UIoError;
-/// use uucore::uio_error;
-///
-/// let io_err = std::io::Error::new(
-///     std::io::ErrorKind::PermissionDenied, "fix me please!"
-/// );
-///
-/// let other_uio_err = uio_error!(io_err, "");
-///
-/// // prints: ": Permission denied"
-/// println!("{}", other_uio_err);
-/// ```
-//#[macro_use]
-#[macro_export]
-macro_rules! uio_error(
-    ($err:expr, $($args:tt)+) => ({
-        UIoError::new(
-            $err.kind(),
-            format!($($args)+)
+/// Shorthand to construct [`UIoError`]-instances.
+///
+/// This macro serves as a convenience call to quickly construct instances of
+/// [`UIoError`]. It takes:
+///
+/// - An instance of [`std::io::Error`]
+/// - A `format!`-compatible string and
+/// - An arbitrary number of arguments to the format string
+///
+/// In exactly this order. It is equivalent to the more verbose code seen in the
+/// example.
+///
+/// # Examples
+///
+/// ```
+/// use uucore::error::UIoError;
+/// use uucore::uio_error;
+///
+/// let io_err = std::io::Error::new(
+///     std::io::ErrorKind::PermissionDenied, "fix me please!"
+/// );
+///
+/// let uio_err = UIoError::new(
+///     io_err.kind(),
+///     format!("Error code: {}", 2)
+/// );
+///
+/// let other_uio_err = uio_error!(io_err, "Error code: {}", 2);
+///
+/// // prints "fix me please!: Permission denied"
+/// println!("{}", uio_err);
+/// // prints "Error code: 2: Permission denied"
+/// println!("{}", other_uio_err);
+/// ```
+///
+/// The [`std::fmt::Display`] impl of [`UIoError`] will then ensure that an
+/// appropriate error message relating to the actual error kind of the
+/// [`std::io::Error`] is appended to whatever error message is defined in
+/// addition (as secondary argument).
+///
+/// If you want to show only the error message for the [`std::io::ErrorKind`]
+/// that's contained in [`UIoError`], pass the second argument as empty string:
+///
+/// ```
+/// use uucore::error::UIoError;
+/// use uucore::uio_error;
+///
+/// let io_err = std::io::Error::new(
+///     std::io::ErrorKind::PermissionDenied, "fix me please!"
+/// );
+///
+/// let other_uio_err = uio_error!(io_err, "");
+///
+/// // prints: ": Permission denied"
+/// println!("{}", other_uio_err);
+/// ```
+//#[macro_use]
+#[macro_export]
+macro_rules! uio_error(
+    ($err:expr, $($args:tt)+) => ({
+        UIoError::new(
+            $err.kind(),
+            format!($($args)+)
         )
     })
 );
 
-/// A special error type that does not print any message when returned from
-/// `uumain`. Especially useful for porting utilities to using [`UResult`].
-///
-/// There are two ways to construct an [`ExitCode`]:
-/// ```
-/// use uucore::error::{ExitCode, UResult};
-/// // Explicit
-/// let res: UResult<()> = Err(ExitCode(1).into());
-///
-/// // Using into on `i32`:
-/// let res: UResult<()> = Err(1.into());
-/// ```
-/// This type is especially useful for a trivial conversion from utils returning [`i32`] to
-/// returning [`UResult`].
-#[derive(Debug)]
-pub struct ExitCode(pub i32);
+/// A special error type that does not print any message when returned from
+/// `uumain`. Especially useful for porting utilities to using [`UResult`].
+///
+/// There are two ways to construct an [`ExitCode`]:
+/// ```
+/// use uucore::error::{ExitCode, UResult};
+/// // Explicit
+/// let res: UResult<()> = Err(ExitCode(1).into());
+///
+/// // Using into on `i32`:
+/// let res: UResult<()> = Err(1.into());
+/// ```
+/// This type is especially useful for a trivial conversion from utils returning [`i32`] to
+/// returning [`UResult`].
+#[derive(Debug)]
+pub struct ExitCode(pub i32);
 
-impl ExitCode {
-    #[allow(clippy::new_ret_no_self)]
-    pub fn new(code: i32) -> Box<dyn UError> {
-        Box::new(Self(code))
+impl ExitCode {
+    #[allow(clippy::new_ret_no_self)]
+    pub fn new(code: i32) -> Box<dyn UError> {
+        Box::new(Self(code))
     }
 }
 
-impl Error for ExitCode {}
+impl Error for ExitCode {}
 
-impl Display for ExitCode {
-    fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
+impl Display for ExitCode {
+    fn fmt(&self, _: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
         Ok(())
     }
 }
 
-impl UError for ExitCode {
-    fn code(&self) -> i32 {
-        self.0
+impl UError for ExitCode {
+    fn code(&self) -> i32 {
+        self.0
+    }
+}
+
+impl From<i32> for Box<dyn UError> {
+    fn from(i: i32) -> Self {
+        ExitCode::new(i)
     }
 }
 
-impl From<i32> for Box<dyn UError> {
-    fn from(i: i32) -> Self {
-        ExitCode::new(i)
+/// A wrapper for `clap::Error` that implements [`UError`]
+///
+/// Contains a custom error code. When `Display::fmt` is called on this struct
+/// the [`clap::Error`] will be printed _directly to `stdout` or `stderr`_.
+/// This is because `clap` only supports colored output when it prints directly.
+///
+/// [`ClapErrorWrapper`] is generally created by calling the
+/// [`UClapError::with_exit_code`] method on [`clap::Error`] or using the [`From`]
+/// implementation from [`clap::Error`] to `Box<dyn UError>`, which constructs
+/// a [`ClapErrorWrapper`] with an exit code of `1`.
+///
+/// ```rust
+/// use uucore::error::{ClapErrorWrapper, UError, UClapError};
+/// let command = clap::Command::new("test");
+/// let result: Result<_, ClapErrorWrapper> = command.try_get_matches().with_exit_code(125);
+///
+/// let command = clap::Command::new("test");
+/// let result: Result<_, Box<dyn UError>> = command.try_get_matches().map_err(Into::into);
+/// ```
+#[derive(Debug)]
+pub struct ClapErrorWrapper {
+    code: i32,
+    error: clap::Error,
+}
+
+/// Extension trait for `clap::Error` to adjust the exit code.
+pub trait UClapError<T> {
+    fn with_exit_code(self, code: i32) -> T;
+}
+
+impl From<clap::Error> for Box<dyn UError> {
+    fn from(e: clap::Error) -> Self {
+        Box::new(ClapErrorWrapper { code: 1, error: e })
     }
 }
 
-/// A wrapper for `clap::Error` that implements [`UError`]
-///
-/// Contains a custom error code. When `Display::fmt` is called on this struct
-/// the [`clap::Error`] will be printed _directly to `stdout` or `stderr`_.
-/// This is because `clap` only supports colored output when it prints directly.
-///
-/// [`ClapErrorWrapper`] is generally created by calling the
-/// [`UClapError::with_exit_code`] method on [`clap::Error`] or using the [`From`]
-/// implementation from [`clap::Error`] to `Box<dyn UError>`, which constructs
-/// a [`ClapErrorWrapper`] with an exit code of `1`.
-///
-/// ```rust
-/// use uucore::error::{ClapErrorWrapper, UError, UClapError};
-/// let command = clap::Command::new("test");
-/// let result: Result<_, ClapErrorWrapper> = command.try_get_matches().with_exit_code(125);
-///
-/// let command = clap::Command::new("test");
-/// let result: Result<_, Box<dyn UError>> = command.try_get_matches().map_err(Into::into);
-/// ```
-#[derive(Debug)]
-pub struct ClapErrorWrapper {
-    code: i32,
-    error: clap::Error,
-}
-
-/// Extension trait for `clap::Error` to adjust the exit code.
-pub trait UClapError<T> {
-    fn with_exit_code(self, code: i32) -> T;
-}
-
-impl From<clap::Error> for Box<dyn UError> {
-    fn from(e: clap::Error) -> Self {
-        Box::new(ClapErrorWrapper { code: 1, error: e })
+impl UClapError<ClapErrorWrapper> for clap::Error {
+    fn with_exit_code(self, code: i32) -> ClapErrorWrapper {
+        ClapErrorWrapper { code, error: self }
     }
 }
 
-impl UClapError<ClapErrorWrapper> for clap::Error {
-    fn with_exit_code(self, code: i32) -> ClapErrorWrapper {
-        ClapErrorWrapper { code, error: self }
-    }
-}
-
-impl UClapError<Result<clap::ArgMatches, ClapErrorWrapper>>
-    for Result<clap::ArgMatches, clap::Error>
+impl UClapError<Result<clap::ArgMatches, ClapErrorWrapper>>
+    for Result<clap::ArgMatches, clap::Error>
 {
-    fn with_exit_code(self, code: i32) -> Result<clap::ArgMatches, ClapErrorWrapper> {
-        self.map_err(|e| e.with_exit_code(code))
+    fn with_exit_code(self, code: i32) -> Result<clap::ArgMatches, ClapErrorWrapper> {
+        self.map_err(|e| e.with_exit_code(code))
     }
 }
 
-impl UError for ClapErrorWrapper {
-    fn code(&self) -> i32 {
-        // If the error is a DisplayHelp or DisplayVersion variant,
-        // we don't want to apply the custom error code, but leave
-        // it 0.
-        if let clap::error::ErrorKind::DisplayHelp | clap::error::ErrorKind::DisplayVersion =
-            self.error.kind()
+impl UError for ClapErrorWrapper {
+    fn code(&self) -> i32 {
+        // If the error is a DisplayHelp or DisplayVersion variant,
+        // we don't want to apply the custom error code, but leave
+        // it 0.
+        if let clap::error::ErrorKind::DisplayHelp | clap::error::ErrorKind::DisplayVersion =
+            self.error.kind()
         {
-            0
-        } else {
-            self.code
+            0
+        } else {
+            self.code
         }
     }
 }
 
-impl Error for ClapErrorWrapper {}
+impl Error for ClapErrorWrapper {}
 
-// This is abuse of the Display trait
-impl Display for ClapErrorWrapper {
-    fn fmt(&self, _f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
-        self.error.print().unwrap();
+// This is abuse of the Display trait
+impl Display for ClapErrorWrapper {
+    fn fmt(&self, _f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
+        self.error.print().unwrap();
         Ok(())
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/mods/os.rs.html b/dev/src/uucore/mods/os.rs.html index 394f8405f..58a89064a 100644 --- a/dev/src/uucore/mods/os.rs.html +++ b/dev/src/uucore/mods/os.rs.html @@ -1,4 +1,4 @@ -os.rs - source
1
+os.rs - source
1
 2
 3
 4
@@ -31,38 +31,38 @@
 31
 32
 33
-
/// Test if the program is running under WSL
-// ref: <https://github.com/microsoft/WSL/issues/4555> @@ <https://archive.is/dP0bz>
+
/// Test if the program is running under WSL
+// ref: <https://github.com/microsoft/WSL/issues/4555> @@ <https://archive.is/dP0bz>
 
-// spell-checker:ignore (path) osrelease
+// spell-checker:ignore (path) osrelease
 
-pub fn is_wsl_1() -> bool {
-    #[cfg(target_os = "linux")]
-    {
-        if is_wsl_2() {
-            return false;
+pub fn is_wsl_1() -> bool {
+    #[cfg(target_os = "linux")]
+    {
+        if is_wsl_2() {
+            return false;
         }
-        if let Ok(b) = std::fs::read("/proc/sys/kernel/osrelease") {
-            if let Ok(s) = std::str::from_utf8(&b) {
-                let a = s.to_ascii_lowercase();
-                return a.contains("microsoft") || a.contains("wsl");
+        if let Ok(b) = std::fs::read("/proc/sys/kernel/osrelease") {
+            if let Ok(s) = std::str::from_utf8(&b) {
+                let a = s.to_ascii_lowercase();
+                return a.contains("microsoft") || a.contains("wsl");
             }
         }
     }
-    false
-}
+    false
+}
 
-pub fn is_wsl_2() -> bool {
-    #[cfg(target_os = "linux")]
-    {
-        if let Ok(b) = std::fs::read("/proc/sys/kernel/osrelease") {
-            if let Ok(s) = std::str::from_utf8(&b) {
-                let a = s.to_ascii_lowercase();
-                return a.contains("wsl2");
+pub fn is_wsl_2() -> bool {
+    #[cfg(target_os = "linux")]
+    {
+        if let Ok(b) = std::fs::read("/proc/sys/kernel/osrelease") {
+            if let Ok(s) = std::str::from_utf8(&b) {
+                let a = s.to_ascii_lowercase();
+                return a.contains("wsl2");
             }
         }
     }
-    false
-}
+    false
+}
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/mods/panic.rs.html b/dev/src/uucore/mods/panic.rs.html index be5969814..5b3957a23 100644 --- a/dev/src/uucore/mods/panic.rs.html +++ b/dev/src/uucore/mods/panic.rs.html @@ -1,4 +1,4 @@ -panic.rs - source
1
+panic.rs - source
1
 2
 3
 4
@@ -40,47 +40,47 @@
 40
 41
 42
-
//! Custom panic hooks that allow silencing certain types of errors.
-//!
-//! Use the [`mute_sigpipe_panic`] function to silence panics caused by
-//! broken pipe errors. This can happen when a process is still
-//! producing data when the consuming process terminates and closes the
-//! pipe. For example,
-//!
-//! ```sh
-//! $ seq inf | head -n 1
-//! ```
-//!
-use std::panic;
-use std::panic::PanicInfo;
+
//! Custom panic hooks that allow silencing certain types of errors.
+//!
+//! Use the [`mute_sigpipe_panic`] function to silence panics caused by
+//! broken pipe errors. This can happen when a process is still
+//! producing data when the consuming process terminates and closes the
+//! pipe. For example,
+//!
+//! ```sh
+//! $ seq inf | head -n 1
+//! ```
+//!
+use std::panic;
+use std::panic::PanicInfo;
 
-/// Decide whether a panic was caused by a broken pipe (SIGPIPE) error.
-fn is_broken_pipe(info: &PanicInfo) -> bool {
-    if let Some(res) = info.payload().downcast_ref::<String>() {
-        if res.contains("BrokenPipe") || res.contains("Broken pipe") {
-            return true;
+/// Decide whether a panic was caused by a broken pipe (SIGPIPE) error.
+fn is_broken_pipe(info: &PanicInfo) -> bool {
+    if let Some(res) = info.payload().downcast_ref::<String>() {
+        if res.contains("BrokenPipe") || res.contains("Broken pipe") {
+            return true;
         }
     }
-    false
-}
+    false
+}
 
-/// Terminate without error on panics that occur due to broken pipe errors.
-///
-/// For background discussions on `SIGPIPE` handling, see
-///
-/// * `<https://github.com/uutils/coreutils/issues/374>`
-/// * `<https://github.com/uutils/coreutils/pull/1106>`
-/// * `<https://github.com/rust-lang/rust/issues/62569>`
-/// * `<https://github.com/BurntSushi/ripgrep/issues/200>`
-/// * `<https://github.com/crev-dev/cargo-crev/issues/287>`
-///
-pub fn mute_sigpipe_panic() {
-    let hook = panic::take_hook();
-    panic::set_hook(Box::new(move |info| {
-        if !is_broken_pipe(info) {
-            hook(info);
+/// Terminate without error on panics that occur due to broken pipe errors.
+///
+/// For background discussions on `SIGPIPE` handling, see
+///
+/// * `<https://github.com/uutils/coreutils/issues/374>`
+/// * `<https://github.com/uutils/coreutils/pull/1106>`
+/// * `<https://github.com/rust-lang/rust/issues/62569>`
+/// * `<https://github.com/BurntSushi/ripgrep/issues/200>`
+/// * `<https://github.com/crev-dev/cargo-crev/issues/287>`
+///
+pub fn mute_sigpipe_panic() {
+    let hook = panic::take_hook();
+    panic::set_hook(Box::new(move |info| {
+        if !is_broken_pipe(info) {
+            hook(info);
         }
     }));
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/mods/quoting_style.rs.html b/dev/src/uucore/mods/quoting_style.rs.html index 993d73209..3f985f6d8 100644 --- a/dev/src/uucore/mods/quoting_style.rs.html +++ b/dev/src/uucore/mods/quoting_style.rs.html @@ -1,4 +1,4 @@ -quoting_style.rs - source
1
+quoting_style.rs - source
1
 2
 3
 4
@@ -729,386 +729,386 @@
 729
 730
 731
-
use std::char::from_digit;
-use std::ffi::OsStr;
+
use std::char::from_digit;
+use std::ffi::OsStr;
 
-// These are characters with special meaning in the shell (e.g. bash).
-// The first const contains characters that only have a special meaning when they appear at the beginning of a name.
-const SPECIAL_SHELL_CHARS_START: &[char] = &['~', '#'];
-const SPECIAL_SHELL_CHARS: &str = "`$&*()|[]{};\\'\"<>?! ";
+// These are characters with special meaning in the shell (e.g. bash).
+// The first const contains characters that only have a special meaning when they appear at the beginning of a name.
+const SPECIAL_SHELL_CHARS_START: &[char] = &['~', '#'];
+const SPECIAL_SHELL_CHARS: &str = "`$&*()|[]{};\\'\"<>?! ";
 
-pub enum QuotingStyle {
-    Shell {
-        escape: bool,
-        always_quote: bool,
-        show_control: bool,
+pub enum QuotingStyle {
+    Shell {
+        escape: bool,
+        always_quote: bool,
+        show_control: bool,
     },
-    C {
-        quotes: Quotes,
+    C {
+        quotes: Quotes,
     },
-    Literal {
-        show_control: bool,
+    Literal {
+        show_control: bool,
     },
 }
 
-#[derive(Clone, Copy)]
-pub enum Quotes {
+#[derive(Clone, Copy)]
+pub enum Quotes {
     None,
-    Single,
-    Double,
-    // TODO: Locale
+    Single,
+    Double,
+    // TODO: Locale
+}
+
+// This implementation is heavily inspired by the std::char::EscapeDefault implementation
+// in the Rust standard library. This custom implementation is needed because the
+// characters \a, \b, \e, \f & \v are not recognized by Rust.
+struct EscapedChar {
+    state: EscapeState,
 }
 
-// This implementation is heavily inspired by the std::char::EscapeDefault implementation
-// in the Rust standard library. This custom implementation is needed because the
-// characters \a, \b, \e, \f & \v are not recognized by Rust.
-struct EscapedChar {
-    state: EscapeState,
+enum EscapeState {
+    Done,
+    Char(char),
+    Backslash(char),
+    ForceQuote(char),
+    Octal(EscapeOctal),
 }
 
-enum EscapeState {
-    Done,
-    Char(char),
-    Backslash(char),
-    ForceQuote(char),
-    Octal(EscapeOctal),
+struct EscapeOctal {
+    c: char,
+    state: EscapeOctalState,
+    idx: usize,
 }
 
-struct EscapeOctal {
-    c: char,
-    state: EscapeOctalState,
-    idx: usize,
+enum EscapeOctalState {
+    Done,
+    Backslash,
+    Value,
 }
 
-enum EscapeOctalState {
-    Done,
-    Backslash,
-    Value,
-}
+impl Iterator for EscapeOctal {
+    type Item = char;
 
-impl Iterator for EscapeOctal {
-    type Item = char;
-
-    fn next(&mut self) -> Option<char> {
-        match self.state {
-            EscapeOctalState::Done => None,
-            EscapeOctalState::Backslash => {
-                self.state = EscapeOctalState::Value;
+    fn next(&mut self) -> Option<char> {
+        match self.state {
+            EscapeOctalState::Done => None,
+            EscapeOctalState::Backslash => {
+                self.state = EscapeOctalState::Value;
                 Some('\\')
             }
-            EscapeOctalState::Value => {
-                let octal_digit = ((self.c as u32) >> (self.idx * 3)) & 0o7;
-                if self.idx == 0 {
-                    self.state = EscapeOctalState::Done;
-                } else {
-                    self.idx -= 1;
+            EscapeOctalState::Value => {
+                let octal_digit = ((self.c as u32) >> (self.idx * 3)) & 0o7;
+                if self.idx == 0 {
+                    self.state = EscapeOctalState::Done;
+                } else {
+                    self.idx -= 1;
                 }
-                Some(from_digit(octal_digit, 8).unwrap())
+                Some(from_digit(octal_digit, 8).unwrap())
             }
         }
     }
 }
 
-impl EscapeOctal {
-    fn from(c: char) -> Self {
-        Self {
-            c,
-            idx: 2,
-            state: EscapeOctalState::Backslash,
+impl EscapeOctal {
+    fn from(c: char) -> Self {
+        Self {
+            c,
+            idx: 2,
+            state: EscapeOctalState::Backslash,
         }
     }
 }
 
-impl EscapedChar {
-    fn new_literal(c: char) -> Self {
-        Self {
-            state: EscapeState::Char(c),
+impl EscapedChar {
+    fn new_literal(c: char) -> Self {
+        Self {
+            state: EscapeState::Char(c),
         }
     }
 
-    fn new_c(c: char, quotes: Quotes) -> Self {
-        use EscapeState::*;
-        let init_state = match c {
-            '\x07' => Backslash('a'),
-            '\x08' => Backslash('b'),
-            '\t' => Backslash('t'),
-            '\n' => Backslash('n'),
-            '\x0B' => Backslash('v'),
-            '\x0C' => Backslash('f'),
-            '\r' => Backslash('r'),
-            '\\' => Backslash('\\'),
-            '\'' => match quotes {
-                Quotes::Single => Backslash('\''),
-                _ => Char('\''),
+    fn new_c(c: char, quotes: Quotes) -> Self {
+        use EscapeState::*;
+        let init_state = match c {
+            '\x07' => Backslash('a'),
+            '\x08' => Backslash('b'),
+            '\t' => Backslash('t'),
+            '\n' => Backslash('n'),
+            '\x0B' => Backslash('v'),
+            '\x0C' => Backslash('f'),
+            '\r' => Backslash('r'),
+            '\\' => Backslash('\\'),
+            '\'' => match quotes {
+                Quotes::Single => Backslash('\''),
+                _ => Char('\''),
             },
-            '"' => match quotes {
-                Quotes::Double => Backslash('"'),
-                _ => Char('"'),
+            '"' => match quotes {
+                Quotes::Double => Backslash('"'),
+                _ => Char('"'),
             },
-            ' ' => match quotes {
-                Quotes::None => Backslash(' '),
-                _ => Char(' '),
+            ' ' => match quotes {
+                Quotes::None => Backslash(' '),
+                _ => Char(' '),
             },
-            _ if c.is_ascii_control() => Octal(EscapeOctal::from(c)),
-            _ => Char(c),
+            _ if c.is_ascii_control() => Octal(EscapeOctal::from(c)),
+            _ => Char(c),
         };
-        Self { state: init_state }
+        Self { state: init_state }
     }
 
-    fn new_shell(c: char, escape: bool, quotes: Quotes) -> Self {
-        use EscapeState::*;
-        let init_state = match c {
-            _ if !escape && c.is_control() => Char(c),
-            '\x07' => Backslash('a'),
-            '\x08' => Backslash('b'),
-            '\t' => Backslash('t'),
-            '\n' => Backslash('n'),
-            '\x0B' => Backslash('v'),
-            '\x0C' => Backslash('f'),
-            '\r' => Backslash('r'),
-            '\x00'..='\x1F' | '\x7F' => Octal(EscapeOctal::from(c)),
-            '\'' => match quotes {
-                Quotes::Single => Backslash('\''),
-                _ => Char('\''),
+    fn new_shell(c: char, escape: bool, quotes: Quotes) -> Self {
+        use EscapeState::*;
+        let init_state = match c {
+            _ if !escape && c.is_control() => Char(c),
+            '\x07' => Backslash('a'),
+            '\x08' => Backslash('b'),
+            '\t' => Backslash('t'),
+            '\n' => Backslash('n'),
+            '\x0B' => Backslash('v'),
+            '\x0C' => Backslash('f'),
+            '\r' => Backslash('r'),
+            '\x00'..='\x1F' | '\x7F' => Octal(EscapeOctal::from(c)),
+            '\'' => match quotes {
+                Quotes::Single => Backslash('\''),
+                _ => Char('\''),
             },
-            _ if SPECIAL_SHELL_CHARS.contains(c) => ForceQuote(c),
-            _ => Char(c),
+            _ if SPECIAL_SHELL_CHARS.contains(c) => ForceQuote(c),
+            _ => Char(c),
         };
-        Self { state: init_state }
+        Self { state: init_state }
     }
 
-    fn hide_control(self) -> Self {
-        match self.state {
-            EscapeState::Char(c) if c.is_control() => Self {
-                state: EscapeState::Char('?'),
+    fn hide_control(self) -> Self {
+        match self.state {
+            EscapeState::Char(c) if c.is_control() => Self {
+                state: EscapeState::Char('?'),
             },
-            _ => self,
+            _ => self,
         }
     }
 }
 
-impl Iterator for EscapedChar {
-    type Item = char;
+impl Iterator for EscapedChar {
+    type Item = char;
 
-    fn next(&mut self) -> Option<char> {
-        match self.state {
-            EscapeState::Backslash(c) => {
-                self.state = EscapeState::Char(c);
+    fn next(&mut self) -> Option<char> {
+        match self.state {
+            EscapeState::Backslash(c) => {
+                self.state = EscapeState::Char(c);
                 Some('\\')
             }
-            EscapeState::Char(c) | EscapeState::ForceQuote(c) => {
-                self.state = EscapeState::Done;
-                Some(c)
+            EscapeState::Char(c) | EscapeState::ForceQuote(c) => {
+                self.state = EscapeState::Done;
+                Some(c)
             }
-            EscapeState::Done => None,
-            EscapeState::Octal(ref mut iter) => iter.next(),
+            EscapeState::Done => None,
+            EscapeState::Octal(ref mut iter) => iter.next(),
         }
     }
 }
 
-fn shell_without_escape(name: &str, quotes: Quotes, show_control_chars: bool) -> (String, bool) {
-    let mut must_quote = false;
-    let mut escaped_str = String::with_capacity(name.len());
+fn shell_without_escape(name: &str, quotes: Quotes, show_control_chars: bool) -> (String, bool) {
+    let mut must_quote = false;
+    let mut escaped_str = String::with_capacity(name.len());
 
-    for c in name.chars() {
-        let escaped = {
-            let ec = EscapedChar::new_shell(c, false, quotes);
-            if show_control_chars {
-                ec
-            } else {
-                ec.hide_control()
+    for c in name.chars() {
+        let escaped = {
+            let ec = EscapedChar::new_shell(c, false, quotes);
+            if show_control_chars {
+                ec
+            } else {
+                ec.hide_control()
             }
         };
 
-        match escaped.state {
-            EscapeState::Backslash('\'') => escaped_str.push_str("'\\''"),
-            EscapeState::ForceQuote(x) => {
-                must_quote = true;
-                escaped_str.push(x);
+        match escaped.state {
+            EscapeState::Backslash('\'') => escaped_str.push_str("'\\''"),
+            EscapeState::ForceQuote(x) => {
+                must_quote = true;
+                escaped_str.push(x);
             }
-            _ => {
-                for char in escaped {
-                    escaped_str.push(char);
+            _ => {
+                for char in escaped {
+                    escaped_str.push(char);
                 }
             }
         }
     }
 
-    must_quote = must_quote || name.starts_with(SPECIAL_SHELL_CHARS_START);
-    (escaped_str, must_quote)
+    must_quote = must_quote || name.starts_with(SPECIAL_SHELL_CHARS_START);
+    (escaped_str, must_quote)
 }
 
-fn shell_with_escape(name: &str, quotes: Quotes) -> (String, bool) {
-    // We need to keep track of whether we are in a dollar expression
-    // because e.g. \b\n is escaped as $'\b\n' and not like $'b'$'n'
-    let mut in_dollar = false;
-    let mut must_quote = false;
-    let mut escaped_str = String::with_capacity(name.len());
+fn shell_with_escape(name: &str, quotes: Quotes) -> (String, bool) {
+    // We need to keep track of whether we are in a dollar expression
+    // because e.g. \b\n is escaped as $'\b\n' and not like $'b'$'n'
+    let mut in_dollar = false;
+    let mut must_quote = false;
+    let mut escaped_str = String::with_capacity(name.len());
 
-    for c in name.chars() {
-        let escaped = EscapedChar::new_shell(c, true, quotes);
-        match escaped.state {
-            EscapeState::Char(x) => {
-                if in_dollar {
-                    escaped_str.push_str("''");
-                    in_dollar = false;
+    for c in name.chars() {
+        let escaped = EscapedChar::new_shell(c, true, quotes);
+        match escaped.state {
+            EscapeState::Char(x) => {
+                if in_dollar {
+                    escaped_str.push_str("''");
+                    in_dollar = false;
                 }
-                escaped_str.push(x);
+                escaped_str.push(x);
             }
-            EscapeState::ForceQuote(x) => {
-                if in_dollar {
-                    escaped_str.push_str("''");
-                    in_dollar = false;
+            EscapeState::ForceQuote(x) => {
+                if in_dollar {
+                    escaped_str.push_str("''");
+                    in_dollar = false;
                 }
-                must_quote = true;
-                escaped_str.push(x);
+                must_quote = true;
+                escaped_str.push(x);
             }
-            // Single quotes are not put in dollar expressions, but are escaped
-            // if the string also contains double quotes. In that case, they must
-            // be handled separately.
-            EscapeState::Backslash('\'') => {
-                must_quote = true;
-                in_dollar = false;
-                escaped_str.push_str("'\\''");
+            // Single quotes are not put in dollar expressions, but are escaped
+            // if the string also contains double quotes. In that case, they must
+            // be handled separately.
+            EscapeState::Backslash('\'') => {
+                must_quote = true;
+                in_dollar = false;
+                escaped_str.push_str("'\\''");
             }
-            _ => {
-                if !in_dollar {
-                    escaped_str.push_str("'$'");
-                    in_dollar = true;
+            _ => {
+                if !in_dollar {
+                    escaped_str.push_str("'$'");
+                    in_dollar = true;
                 }
-                must_quote = true;
-                for char in escaped {
-                    escaped_str.push(char);
+                must_quote = true;
+                for char in escaped {
+                    escaped_str.push(char);
                 }
             }
         }
     }
-    must_quote = must_quote || name.starts_with(SPECIAL_SHELL_CHARS_START);
-    (escaped_str, must_quote)
+    must_quote = must_quote || name.starts_with(SPECIAL_SHELL_CHARS_START);
+    (escaped_str, must_quote)
 }
 
-pub fn escape_name(name: &OsStr, style: &QuotingStyle) -> String {
-    match style {
-        QuotingStyle::Literal { show_control } => {
-            if !show_control {
-                name.to_string_lossy()
-                    .chars()
-                    .flat_map(|c| EscapedChar::new_literal(c).hide_control())
-                    .collect()
-            } else {
-                name.to_string_lossy().into_owned()
+pub fn escape_name(name: &OsStr, style: &QuotingStyle) -> String {
+    match style {
+        QuotingStyle::Literal { show_control } => {
+            if !show_control {
+                name.to_string_lossy()
+                    .chars()
+                    .flat_map(|c| EscapedChar::new_literal(c).hide_control())
+                    .collect()
+            } else {
+                name.to_string_lossy().into_owned()
             }
         }
-        QuotingStyle::C { quotes } => {
-            let escaped_str: String = name
-                .to_string_lossy()
-                .chars()
-                .flat_map(|c| EscapedChar::new_c(c, *quotes))
-                .collect();
+        QuotingStyle::C { quotes } => {
+            let escaped_str: String = name
+                .to_string_lossy()
+                .chars()
+                .flat_map(|c| EscapedChar::new_c(c, *quotes))
+                .collect();
 
-            match quotes {
-                Quotes::Single => format!("'{}'", escaped_str),
-                Quotes::Double => format!("\"{}\"", escaped_str),
-                _ => escaped_str,
+            match quotes {
+                Quotes::Single => format!("'{}'", escaped_str),
+                Quotes::Double => format!("\"{}\"", escaped_str),
+                _ => escaped_str,
             }
         }
-        QuotingStyle::Shell {
-            escape,
-            always_quote,
-            show_control,
+        QuotingStyle::Shell {
+            escape,
+            always_quote,
+            show_control,
         } => {
-            let name = name.to_string_lossy();
-            let (quotes, must_quote) = if name.contains(&['"', '`', '$', '\\'][..]) {
-                (Quotes::Single, true)
-            } else if name.contains('\'') {
-                (Quotes::Double, true)
-            } else if *always_quote {
-                (Quotes::Single, true)
-            } else {
-                (Quotes::Single, false)
+            let name = name.to_string_lossy();
+            let (quotes, must_quote) = if name.contains(&['"', '`', '$', '\\'][..]) {
+                (Quotes::Single, true)
+            } else if name.contains('\'') {
+                (Quotes::Double, true)
+            } else if *always_quote {
+                (Quotes::Single, true)
+            } else {
+                (Quotes::Single, false)
             };
 
-            let (escaped_str, contains_quote_chars) = if *escape {
-                shell_with_escape(&name, quotes)
-            } else {
-                shell_without_escape(&name, quotes, *show_control)
+            let (escaped_str, contains_quote_chars) = if *escape {
+                shell_with_escape(&name, quotes)
+            } else {
+                shell_without_escape(&name, quotes, *show_control)
             };
 
-            match (must_quote | contains_quote_chars, quotes) {
-                (true, Quotes::Single) => format!("'{}'", escaped_str),
-                (true, Quotes::Double) => format!("\"{}\"", escaped_str),
-                _ => escaped_str,
+            match (must_quote | contains_quote_chars, quotes) {
+                (true, Quotes::Single) => format!("'{}'", escaped_str),
+                (true, Quotes::Double) => format!("\"{}\"", escaped_str),
+                _ => escaped_str,
             }
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::quoting_style::{escape_name, Quotes, QuotingStyle};
+#[cfg(test)]
+mod tests {
+    use crate::quoting_style::{escape_name, Quotes, QuotingStyle};
 
-    // spell-checker:ignore (tests/words) one\'two one'two
+    // spell-checker:ignore (tests/words) one\'two one'two
 
-    fn get_style(s: &str) -> QuotingStyle {
-        match s {
-            "literal" => QuotingStyle::Literal {
-                show_control: false,
+    fn get_style(s: &str) -> QuotingStyle {
+        match s {
+            "literal" => QuotingStyle::Literal {
+                show_control: false,
             },
-            "literal-show" => QuotingStyle::Literal { show_control: true },
-            "escape" => QuotingStyle::C {
-                quotes: Quotes::None,
+            "literal-show" => QuotingStyle::Literal { show_control: true },
+            "escape" => QuotingStyle::C {
+                quotes: Quotes::None,
             },
-            "c" => QuotingStyle::C {
-                quotes: Quotes::Double,
+            "c" => QuotingStyle::C {
+                quotes: Quotes::Double,
             },
-            "shell" => QuotingStyle::Shell {
-                escape: false,
-                always_quote: false,
-                show_control: false,
+            "shell" => QuotingStyle::Shell {
+                escape: false,
+                always_quote: false,
+                show_control: false,
             },
-            "shell-show" => QuotingStyle::Shell {
-                escape: false,
-                always_quote: false,
-                show_control: true,
+            "shell-show" => QuotingStyle::Shell {
+                escape: false,
+                always_quote: false,
+                show_control: true,
             },
-            "shell-always" => QuotingStyle::Shell {
-                escape: false,
-                always_quote: true,
-                show_control: false,
+            "shell-always" => QuotingStyle::Shell {
+                escape: false,
+                always_quote: true,
+                show_control: false,
             },
-            "shell-always-show" => QuotingStyle::Shell {
-                escape: false,
-                always_quote: true,
-                show_control: true,
+            "shell-always-show" => QuotingStyle::Shell {
+                escape: false,
+                always_quote: true,
+                show_control: true,
             },
-            "shell-escape" => QuotingStyle::Shell {
-                escape: true,
-                always_quote: false,
-                show_control: false,
+            "shell-escape" => QuotingStyle::Shell {
+                escape: true,
+                always_quote: false,
+                show_control: false,
             },
-            "shell-escape-always" => QuotingStyle::Shell {
-                escape: true,
-                always_quote: true,
-                show_control: false,
+            "shell-escape-always" => QuotingStyle::Shell {
+                escape: true,
+                always_quote: true,
+                show_control: false,
             },
-            _ => panic!("Invalid name!"),
+            _ => panic!("Invalid name!"),
         }
     }
 
-    fn check_names(name: &str, map: &[(&str, &str)]) {
+    fn check_names(name: &str, map: &[(&str, &str)]) {
         assert_eq!(
-            map.iter()
-                .map(|(_, style)| escape_name(name.as_ref(), &get_style(style)))
-                .collect::<Vec<String>>(),
-            map.iter()
-                .map(|(correct, _)| correct.to_string())
-                .collect::<Vec<String>>()
+            map.iter()
+                .map(|(_, style)| escape_name(name.as_ref(), &get_style(style)))
+                .collect::<Vec<String>>(),
+            map.iter()
+                .map(|(correct, _)| correct.to_string())
+                .collect::<Vec<String>>()
         );
     }
 
-    #[test]
-    fn test_simple_names() {
-        check_names(
+    #[test]
+    fn test_simple_names() {
+        check_names(
             "one_two",
             &[
                 ("one_two", "literal"),
@@ -1125,9 +1125,9 @@
         );
     }
 
-    #[test]
-    fn test_spaces() {
-        check_names(
+    #[test]
+    fn test_spaces() {
+        check_names(
             "one two",
             &[
                 ("one two", "literal"),
@@ -1143,7 +1143,7 @@
             ],
         );
 
-        check_names(
+        check_names(
             " one",
             &[
                 (" one", "literal"),
@@ -1160,10 +1160,10 @@
         );
     }
 
-    #[test]
-    fn test_quotes() {
-        // One double quote
-        check_names(
+    #[test]
+    fn test_quotes() {
+        // One double quote
+        check_names(
             "one\"two",
             &[
                 ("one\"two", "literal"),
@@ -1179,8 +1179,8 @@
             ],
         );
 
-        // One single quote
-        check_names(
+        // One single quote
+        check_names(
             "one\'two",
             &[
                 ("one'two", "literal"),
@@ -1196,8 +1196,8 @@
             ],
         );
 
-        // One single quote and one double quote
-        check_names(
+        // One single quote and one double quote
+        check_names(
             "one'two\"three",
             &[
                 ("one'two\"three", "literal"),
@@ -1213,8 +1213,8 @@
             ],
         );
 
-        // Consecutive quotes
-        check_names(
+        // Consecutive quotes
+        check_names(
             "one''two\"\"three",
             &[
                 ("one''two\"\"three", "literal"),
@@ -1231,10 +1231,10 @@
         );
     }
 
-    #[test]
-    fn test_control_chars() {
-        // A simple newline
-        check_names(
+    #[test]
+    fn test_control_chars() {
+        // A simple newline
+        check_names(
             "one\ntwo",
             &[
                 ("one?two", "literal"),
@@ -1250,8 +1250,8 @@
             ],
         );
 
-        // A control character followed by a special shell character
-        check_names(
+        // A control character followed by a special shell character
+        check_names(
             "one\n&two",
             &[
                 ("one?&two", "literal"),
@@ -1267,9 +1267,9 @@
             ],
         );
 
-        // The first 16 control characters. NUL is also included, even though it is of
-        // no importance for file names.
-        check_names(
+        // The first 16 control characters. NUL is also included, even though it is of
+        // no importance for file names.
+        check_names(
             "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F",
             &[
                 ("????????????????", "literal"),
@@ -1306,8 +1306,8 @@
             ],
         );
 
-        // The last 16 control characters.
-        check_names(
+        // The last 16 control characters.
+        check_names(
             "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
             &[
                 ("????????????????", "literal"),
@@ -1344,8 +1344,8 @@
             ],
         );
 
-        // DEL
-        check_names(
+        // DEL
+        check_names(
             "\x7F",
             &[
                 ("?", "literal"),
@@ -1362,12 +1362,12 @@
         );
     }
 
-    #[test]
-    fn test_question_mark() {
-        // A question mark must force quotes in shell and shell-always, unless
-        // it is in place of a control character (that case is already covered
-        // in other tests)
-        check_names(
+    #[test]
+    fn test_question_mark() {
+        // A question mark must force quotes in shell and shell-always, unless
+        // it is in place of a control character (that case is already covered
+        // in other tests)
+        check_names(
             "one?two",
             &[
                 ("one?two", "literal"),
@@ -1384,10 +1384,10 @@
         );
     }
 
-    #[test]
-    fn test_backslash() {
-        // Escaped in C-style, but not in Shell-style escaping
-        check_names(
+    #[test]
+    fn test_backslash() {
+        // Escaped in C-style, but not in Shell-style escaping
+        check_names(
             "one\\two",
             &[
                 ("one\\two", "literal"),
@@ -1402,34 +1402,34 @@
         );
     }
 
-    #[test]
-    fn test_tilde_and_hash() {
-        check_names("~", &[("'~'", "shell"), ("'~'", "shell-escape")]);
-        check_names(
+    #[test]
+    fn test_tilde_and_hash() {
+        check_names("~", &[("'~'", "shell"), ("'~'", "shell-escape")]);
+        check_names(
             "~name",
             &[("'~name'", "shell"), ("'~name'", "shell-escape")],
         );
-        check_names(
+        check_names(
             "some~name",
             &[("some~name", "shell"), ("some~name", "shell-escape")],
         );
-        check_names("name~", &[("name~", "shell"), ("name~", "shell-escape")]);
+        check_names("name~", &[("name~", "shell"), ("name~", "shell-escape")]);
 
-        check_names("#", &[("'#'", "shell"), ("'#'", "shell-escape")]);
-        check_names(
+        check_names("#", &[("'#'", "shell"), ("'#'", "shell-escape")]);
+        check_names(
             "#name",
             &[("'#name'", "shell"), ("'#name'", "shell-escape")],
         );
-        check_names(
+        check_names(
             "some#name",
             &[("some#name", "shell"), ("some#name", "shell-escape")],
         );
-        check_names("name#", &[("name#", "shell"), ("name#", "shell-escape")]);
+        check_names("name#", &[("name#", "shell"), ("name#", "shell-escape")]);
     }
 
-    #[test]
-    fn test_special_chars_in_double_quotes() {
-        check_names(
+    #[test]
+    fn test_special_chars_in_double_quotes() {
+        check_names(
             "can'$t",
             &[
                 ("'can'\\''$t'", "shell"),
@@ -1439,7 +1439,7 @@
             ],
         );
 
-        check_names(
+        check_names(
             "can'`t",
             &[
                 ("'can'\\''`t'", "shell"),
@@ -1449,7 +1449,7 @@
             ],
         );
 
-        check_names(
+        check_names(
             "can'\\t",
             &[
                 ("'can'\\''\\t'", "shell"),
@@ -1461,4 +1461,4 @@
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/mods/ranges.rs.html b/dev/src/uucore/mods/ranges.rs.html index 249dcaaad..e3feaf6ac 100644 --- a/dev/src/uucore/mods/ranges.rs.html +++ b/dev/src/uucore/mods/ranges.rs.html @@ -1,4 +1,4 @@ -ranges.rs - source
1
+ranges.rs - source
1
 2
 3
 4
@@ -232,239 +232,239 @@
 232
 233
 234
-
// This file is part of the uutils coreutils package.
-//
-// (c) Rolf Morel <rolfmorel@gmail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Rolf Morel <rolfmorel@gmail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) inval
+// spell-checker:ignore (ToDO) inval
 
-use std::cmp::max;
-use std::str::FromStr;
+use std::cmp::max;
+use std::str::FromStr;
 
-use crate::display::Quotable;
+use crate::display::Quotable;
 
-#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
-pub struct Range {
-    pub low: usize,
-    pub high: usize,
+#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
+pub struct Range {
+    pub low: usize,
+    pub high: usize,
 }
 
-impl FromStr for Range {
-    type Err = &'static str;
+impl FromStr for Range {
+    type Err = &'static str;
 
-    /// Parse a string of the form `a-b` into a `Range`
-    ///
-    /// ```
-    /// use std::str::FromStr;
-    /// use uucore::ranges::Range;
-    /// assert_eq!(Range::from_str("5"), Ok(Range { low: 5, high: 5 }));
-    /// assert_eq!(Range::from_str("4-"), Ok(Range { low: 4, high: usize::MAX - 1 }));
-    /// assert_eq!(Range::from_str("-4"), Ok(Range { low: 1, high: 4 }));
-    /// assert_eq!(Range::from_str("2-4"), Ok(Range { low: 2, high: 4 }));
-    /// assert!(Range::from_str("0-4").is_err());
-    /// assert!(Range::from_str("4-2").is_err());
-    /// assert!(Range::from_str("-").is_err());
-    /// assert!(Range::from_str("a").is_err());
-    /// assert!(Range::from_str("a-b").is_err());
-    /// ```
-    fn from_str(s: &str) -> Result<Self, &'static str> {
-        fn parse(s: &str) -> Result<usize, &'static str> {
-            match s.parse::<usize>() {
+    /// Parse a string of the form `a-b` into a `Range`
+    ///
+    /// ```
+    /// use std::str::FromStr;
+    /// use uucore::ranges::Range;
+    /// assert_eq!(Range::from_str("5"), Ok(Range { low: 5, high: 5 }));
+    /// assert_eq!(Range::from_str("4-"), Ok(Range { low: 4, high: usize::MAX - 1 }));
+    /// assert_eq!(Range::from_str("-4"), Ok(Range { low: 1, high: 4 }));
+    /// assert_eq!(Range::from_str("2-4"), Ok(Range { low: 2, high: 4 }));
+    /// assert!(Range::from_str("0-4").is_err());
+    /// assert!(Range::from_str("4-2").is_err());
+    /// assert!(Range::from_str("-").is_err());
+    /// assert!(Range::from_str("a").is_err());
+    /// assert!(Range::from_str("a-b").is_err());
+    /// ```
+    fn from_str(s: &str) -> Result<Self, &'static str> {
+        fn parse(s: &str) -> Result<usize, &'static str> {
+            match s.parse::<usize>() {
                 Ok(0) => Err("fields and positions are numbered from 1"),
-                Ok(n) => Ok(n),
+                Ok(n) => Ok(n),
                 Err(_) => Err("failed to parse range"),
             }
         }
 
-        Ok(match s.split_once('-') {
-            None => {
-                let n = parse(s)?;
-                Self { low: n, high: n }
+        Ok(match s.split_once('-') {
+            None => {
+                let n = parse(s)?;
+                Self { low: n, high: n }
             }
-            Some(("", "")) => return Err("invalid range with no endpoint"),
-            Some((low, "")) => Self {
-                low: parse(low)?,
-                high: usize::MAX - 1,
+            Some(("", "")) => return Err("invalid range with no endpoint"),
+            Some((low, "")) => Self {
+                low: parse(low)?,
+                high: usize::MAX - 1,
             },
-            Some(("", high)) => Self {
-                low: 1,
-                high: parse(high)?,
+            Some(("", high)) => Self {
+                low: 1,
+                high: parse(high)?,
             },
-            Some((low, high)) => {
-                let (low, high) = (parse(low)?, parse(high)?);
-                if low <= high {
-                    Self { low, high }
-                } else {
-                    return Err("high end of range less than low end");
+            Some((low, high)) => {
+                let (low, high) = (parse(low)?, parse(high)?);
+                if low <= high {
+                    Self { low, high }
+                } else {
+                    return Err("high end of range less than low end");
                 }
             }
         })
     }
 }
 
-impl Range {
-    pub fn from_list(list: &str) -> Result<Vec<Self>, String> {
-        let mut ranges = Vec::new();
+impl Range {
+    pub fn from_list(list: &str) -> Result<Vec<Self>, String> {
+        let mut ranges = Vec::new();
 
-        for item in list.split(&[',', ' ']) {
-            let range_item = FromStr::from_str(item)
-                .map_err(|e| format!("range {} was invalid: {}", item.quote(), e))?;
-            ranges.push(range_item);
+        for item in list.split(&[',', ' ']) {
+            let range_item = FromStr::from_str(item)
+                .map_err(|e| format!("range {} was invalid: {}", item.quote(), e))?;
+            ranges.push(range_item);
         }
 
-        Ok(Self::merge(ranges))
+        Ok(Self::merge(ranges))
     }
 
-    /// Merge any overlapping ranges
-    ///
-    /// Is guaranteed to return only disjoint ranges in a sorted order.
-    fn merge(mut ranges: Vec<Self>) -> Vec<Self> {
-        ranges.sort();
+    /// Merge any overlapping ranges
+    ///
+    /// Is guaranteed to return only disjoint ranges in a sorted order.
+    fn merge(mut ranges: Vec<Self>) -> Vec<Self> {
+        ranges.sort();
 
-        // merge overlapping ranges
-        for i in 0..ranges.len() {
-            let j = i + 1;
+        // merge overlapping ranges
+        for i in 0..ranges.len() {
+            let j = i + 1;
 
-            // The +1 is a small optimization, because we can merge adjacent Ranges.
-            // For example (1,3) and (4,6), because in the integers, there are no
-            // possible values between 3 and 4, this is equivalent to (1,6).
-            while j < ranges.len() && ranges[j].low <= ranges[i].high + 1 {
-                let j_high = ranges.remove(j).high;
-                ranges[i].high = max(ranges[i].high, j_high);
+            // The +1 is a small optimization, because we can merge adjacent Ranges.
+            // For example (1,3) and (4,6), because in the integers, there are no
+            // possible values between 3 and 4, this is equivalent to (1,6).
+            while j < ranges.len() && ranges[j].low <= ranges[i].high + 1 {
+                let j_high = ranges.remove(j).high;
+                ranges[i].high = max(ranges[i].high, j_high);
             }
         }
-        ranges
+        ranges
     }
 }
 
-pub fn complement(ranges: &[Range]) -> Vec<Range> {
-    let mut prev_high = 0;
-    let mut complements = Vec::with_capacity(ranges.len() + 1);
+pub fn complement(ranges: &[Range]) -> Vec<Range> {
+    let mut prev_high = 0;
+    let mut complements = Vec::with_capacity(ranges.len() + 1);
 
-    for range in ranges {
-        if range.low > prev_high + 1 {
-            complements.push(Range {
-                low: prev_high + 1,
-                high: range.low - 1,
+    for range in ranges {
+        if range.low > prev_high + 1 {
+            complements.push(Range {
+                low: prev_high + 1,
+                high: range.low - 1,
             });
         }
-        prev_high = range.high;
+        prev_high = range.high;
     }
 
-    if prev_high < usize::MAX - 1 {
-        complements.push(Range {
-            low: prev_high + 1,
-            high: usize::MAX - 1,
+    if prev_high < usize::MAX - 1 {
+        complements.push(Range {
+            low: prev_high + 1,
+            high: usize::MAX - 1,
         });
     }
 
-    complements
+    complements
 }
 
-/// Test if at least one of the given Ranges contain the supplied value.
-///
-/// Examples:
-///
-/// ```
-/// let ranges = uucore::ranges::Range::from_list("11,2,6-8").unwrap();
-///
-/// assert!(!uucore::ranges::contain(&ranges, 0));
-/// assert!(!uucore::ranges::contain(&ranges, 1));
-/// assert!(!uucore::ranges::contain(&ranges, 5));
-/// assert!(!uucore::ranges::contain(&ranges, 10));
-///
-/// assert!(uucore::ranges::contain(&ranges, 2));
-/// assert!(uucore::ranges::contain(&ranges, 6));
-/// assert!(uucore::ranges::contain(&ranges, 7));
-/// assert!(uucore::ranges::contain(&ranges, 8));
-/// assert!(uucore::ranges::contain(&ranges, 11));
-/// ```
-pub fn contain(ranges: &[Range], n: usize) -> bool {
-    for range in ranges {
-        if n >= range.low && n <= range.high {
-            return true;
+/// Test if at least one of the given Ranges contain the supplied value.
+///
+/// Examples:
+///
+/// ```
+/// let ranges = uucore::ranges::Range::from_list("11,2,6-8").unwrap();
+///
+/// assert!(!uucore::ranges::contain(&ranges, 0));
+/// assert!(!uucore::ranges::contain(&ranges, 1));
+/// assert!(!uucore::ranges::contain(&ranges, 5));
+/// assert!(!uucore::ranges::contain(&ranges, 10));
+///
+/// assert!(uucore::ranges::contain(&ranges, 2));
+/// assert!(uucore::ranges::contain(&ranges, 6));
+/// assert!(uucore::ranges::contain(&ranges, 7));
+/// assert!(uucore::ranges::contain(&ranges, 8));
+/// assert!(uucore::ranges::contain(&ranges, 11));
+/// ```
+pub fn contain(ranges: &[Range], n: usize) -> bool {
+    for range in ranges {
+        if n >= range.low && n <= range.high {
+            return true;
         }
     }
 
-    false
-}
+    false
+}
 
-#[cfg(test)]
-mod test {
-    use super::{complement, Range};
+#[cfg(test)]
+mod test {
+    use super::{complement, Range};
 
-    fn m(a: Vec<Range>, b: &[Range]) {
-        assert_eq!(Range::merge(a), b);
+    fn m(a: Vec<Range>, b: &[Range]) {
+        assert_eq!(Range::merge(a), b);
     }
 
-    fn r(low: usize, high: usize) -> Range {
-        Range { low, high }
+    fn r(low: usize, high: usize) -> Range {
+        Range { low, high }
     }
 
-    #[test]
-    fn merging() {
-        // Single element
-        m(vec![r(1, 2)], &[r(1, 2)]);
+    #[test]
+    fn merging() {
+        // Single element
+        m(vec![r(1, 2)], &[r(1, 2)]);
 
-        // Disjoint in wrong order
-        m(vec![r(4, 5), r(1, 2)], &[r(1, 2), r(4, 5)]);
+        // Disjoint in wrong order
+        m(vec![r(4, 5), r(1, 2)], &[r(1, 2), r(4, 5)]);
 
-        // Two elements must be merged
-        m(vec![r(1, 3), r(2, 4), r(6, 7)], &[r(1, 4), r(6, 7)]);
+        // Two elements must be merged
+        m(vec![r(1, 3), r(2, 4), r(6, 7)], &[r(1, 4), r(6, 7)]);
 
-        // Two merges and a duplicate
-        m(
-            vec![r(1, 3), r(6, 7), r(2, 4), r(6, 7)],
-            &[r(1, 4), r(6, 7)],
+        // Two merges and a duplicate
+        m(
+            vec![r(1, 3), r(6, 7), r(2, 4), r(6, 7)],
+            &[r(1, 4), r(6, 7)],
         );
 
-        // One giant
-        m(
+        // One giant
+        m(
             vec![
-                r(110, 120),
-                r(10, 20),
-                r(100, 200),
-                r(130, 140),
-                r(150, 160),
+                r(110, 120),
+                r(10, 20),
+                r(100, 200),
+                r(130, 140),
+                r(150, 160),
             ],
-            &[r(10, 20), r(100, 200)],
+            &[r(10, 20), r(100, 200)],
         );
 
-        // Last one joins the previous two
-        m(vec![r(10, 20), r(30, 40), r(20, 30)], &[r(10, 40)]);
+        // Last one joins the previous two
+        m(vec![r(10, 20), r(30, 40), r(20, 30)], &[r(10, 40)]);
 
-        m(
-            vec![r(10, 20), r(30, 40), r(50, 60), r(20, 30)],
-            &[r(10, 40), r(50, 60)],
+        m(
+            vec![r(10, 20), r(30, 40), r(50, 60), r(20, 30)],
+            &[r(10, 40), r(50, 60)],
         );
 
-        // Merge adjacent ranges
-        m(vec![r(1, 3), r(4, 6)], &[r(1, 6)]);
+        // Merge adjacent ranges
+        m(vec![r(1, 3), r(4, 6)], &[r(1, 6)]);
     }
 
-    #[test]
-    fn complementing() {
-        // Simple
-        assert_eq!(complement(&[r(3, 4)]), vec![r(1, 2), r(5, usize::MAX - 1)]);
+    #[test]
+    fn complementing() {
+        // Simple
+        assert_eq!(complement(&[r(3, 4)]), vec![r(1, 2), r(5, usize::MAX - 1)]);
 
-        // With start
-        assert_eq!(
-            complement(&[r(1, 3), r(6, 10)]),
-            vec![r(4, 5), r(11, usize::MAX - 1)]
+        // With start
+        assert_eq!(
+            complement(&[r(1, 3), r(6, 10)]),
+            vec![r(4, 5), r(11, usize::MAX - 1)]
         );
 
-        // With end
-        assert_eq!(
-            complement(&[r(2, 4), r(6, usize::MAX - 1)]),
-            vec![r(1, 1), r(5, 5)]
+        // With end
+        assert_eq!(
+            complement(&[r(2, 4), r(6, usize::MAX - 1)]),
+            vec![r(1, 1), r(5, 5)]
         );
 
-        // With start and end
-        assert_eq!(complement(&[r(1, 4), r(6, usize::MAX - 1)]), vec![r(5, 5)]);
+        // With start and end
+        assert_eq!(complement(&[r(1, 4), r(6, usize::MAX - 1)]), vec![r(5, 5)]);
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/mods/version_cmp.rs.html b/dev/src/uucore/mods/version_cmp.rs.html index ab52002bb..1059cbe4a 100644 --- a/dev/src/uucore/mods/version_cmp.rs.html +++ b/dev/src/uucore/mods/version_cmp.rs.html @@ -1,4 +1,4 @@ -version_cmp.rs - source
1
+version_cmp.rs - source
1
 2
 3
 4
@@ -359,366 +359,366 @@
 359
 360
 361
-
use std::cmp::Ordering;
+
use std::cmp::Ordering;
 
-/// Compares the non-digit parts of a version.
-/// Special cases: ~ are before everything else, even ends ("a~" < "a")
-/// Letters are before non-letters
-fn version_non_digit_cmp(a: &str, b: &str) -> Ordering {
-    let mut a_chars = a.chars();
-    let mut b_chars = b.chars();
-    loop {
-        match (a_chars.next(), b_chars.next()) {
-            (Some(c1), Some(c2)) if c1 == c2 => {}
-            (None, None) => return Ordering::Equal,
-            (_, Some('~')) => return Ordering::Greater,
-            (Some('~'), _) => return Ordering::Less,
-            (None, Some(_)) => return Ordering::Less,
-            (Some(_), None) => return Ordering::Greater,
-            (Some(c1), Some(c2)) if c1.is_ascii_alphabetic() && !c2.is_ascii_alphabetic() => {
-                return Ordering::Less
+/// Compares the non-digit parts of a version.
+/// Special cases: ~ are before everything else, even ends ("a~" < "a")
+/// Letters are before non-letters
+fn version_non_digit_cmp(a: &str, b: &str) -> Ordering {
+    let mut a_chars = a.chars();
+    let mut b_chars = b.chars();
+    loop {
+        match (a_chars.next(), b_chars.next()) {
+            (Some(c1), Some(c2)) if c1 == c2 => {}
+            (None, None) => return Ordering::Equal,
+            (_, Some('~')) => return Ordering::Greater,
+            (Some('~'), _) => return Ordering::Less,
+            (None, Some(_)) => return Ordering::Less,
+            (Some(_), None) => return Ordering::Greater,
+            (Some(c1), Some(c2)) if c1.is_ascii_alphabetic() && !c2.is_ascii_alphabetic() => {
+                return Ordering::Less
             }
-            (Some(c1), Some(c2)) if !c1.is_ascii_alphabetic() && c2.is_ascii_alphabetic() => {
-                return Ordering::Greater
+            (Some(c1), Some(c2)) if !c1.is_ascii_alphabetic() && c2.is_ascii_alphabetic() => {
+                return Ordering::Greater
             }
-            (Some(c1), Some(c2)) => return c1.cmp(&c2),
+            (Some(c1), Some(c2)) => return c1.cmp(&c2),
         }
     }
 }
 
-/// Remove file endings matching the regex (\.[A-Za-z~][A-Za-z0-9~]*)*$
-fn remove_file_ending(a: &str) -> &str {
-    let mut ending_start = None;
-    let mut prev_was_dot = false;
-    for (idx, char) in a.char_indices() {
-        if char == '.' {
-            if ending_start.is_none() || prev_was_dot {
-                ending_start = Some(idx);
+/// Remove file endings matching the regex (\.[A-Za-z~][A-Za-z0-9~]*)*$
+fn remove_file_ending(a: &str) -> &str {
+    let mut ending_start = None;
+    let mut prev_was_dot = false;
+    for (idx, char) in a.char_indices() {
+        if char == '.' {
+            if ending_start.is_none() || prev_was_dot {
+                ending_start = Some(idx);
             }
-            prev_was_dot = true;
-        } else if prev_was_dot {
-            prev_was_dot = false;
-            if !char.is_ascii_alphabetic() && char != '~' {
-                ending_start = None;
+            prev_was_dot = true;
+        } else if prev_was_dot {
+            prev_was_dot = false;
+            if !char.is_ascii_alphabetic() && char != '~' {
+                ending_start = None;
             }
-        } else if !char.is_ascii_alphanumeric() && char != '~' {
-            ending_start = None;
+        } else if !char.is_ascii_alphanumeric() && char != '~' {
+            ending_start = None;
         }
     }
-    if prev_was_dot {
-        ending_start = None;
+    if prev_was_dot {
+        ending_start = None;
     }
-    if let Some(ending_start) = ending_start {
-        &a[..ending_start]
-    } else {
-        a
+    if let Some(ending_start) = ending_start {
+        &a[..ending_start]
+    } else {
+        a
     }
 }
 
-pub fn version_cmp(mut a: &str, mut b: &str) -> Ordering {
-    let str_cmp = a.cmp(b);
-    if str_cmp == Ordering::Equal {
-        return str_cmp;
+pub fn version_cmp(mut a: &str, mut b: &str) -> Ordering {
+    let str_cmp = a.cmp(b);
+    if str_cmp == Ordering::Equal {
+        return str_cmp;
     }
 
-    // Special cases:
-    // 1. Empty strings
-    match (a.is_empty(), b.is_empty()) {
-        (true, false) => return Ordering::Less,
-        (false, true) => return Ordering::Greater,
+    // Special cases:
+    // 1. Empty strings
+    match (a.is_empty(), b.is_empty()) {
+        (true, false) => return Ordering::Less,
+        (false, true) => return Ordering::Greater,
         (true, true) => unreachable!(),
         (false, false) => {}
     }
-    // 2. Dots
-    match (a == ".", b == ".") {
-        (true, false) => return Ordering::Less,
-        (false, true) => return Ordering::Greater,
+    // 2. Dots
+    match (a == ".", b == ".") {
+        (true, false) => return Ordering::Less,
+        (false, true) => return Ordering::Greater,
         (true, true) => unreachable!(),
         (false, false) => {}
     }
-    // 3. Two Dots
-    match (a == "..", b == "..") {
-        (true, false) => return Ordering::Less,
-        (false, true) => return Ordering::Greater,
+    // 3. Two Dots
+    match (a == "..", b == "..") {
+        (true, false) => return Ordering::Less,
+        (false, true) => return Ordering::Greater,
         (true, true) => unreachable!(),
         (false, false) => {}
     }
-    // 4. Strings starting with a dot
-    match (a.starts_with('.'), b.starts_with('.')) {
-        (true, false) => return Ordering::Less,
-        (false, true) => return Ordering::Greater,
+    // 4. Strings starting with a dot
+    match (a.starts_with('.'), b.starts_with('.')) {
+        (true, false) => return Ordering::Less,
+        (false, true) => return Ordering::Greater,
         (true, true) => {
-            // Strip the leading dot for later comparisons
-            a = &a[1..];
-            b = &b[1..];
+            // Strip the leading dot for later comparisons
+            a = &a[1..];
+            b = &b[1..];
         }
-        _ => {}
+        _ => {}
     }
 
-    // Try to strip file extensions
-    let (mut a, mut b) = match (remove_file_ending(a), remove_file_ending(b)) {
-        (a_stripped, b_stripped) if a_stripped == b_stripped => {
-            // If both would be the same after stripping file extensions, don't strip them.
-            (a, b)
+    // Try to strip file extensions
+    let (mut a, mut b) = match (remove_file_ending(a), remove_file_ending(b)) {
+        (a_stripped, b_stripped) if a_stripped == b_stripped => {
+            // If both would be the same after stripping file extensions, don't strip them.
+            (a, b)
         }
-        stripped => stripped,
+        stripped => stripped,
     };
 
-    // 1. Compare leading non-numerical part
-    // 2. Compare leading numerical part
-    // 3. Repeat
-    loop {
-        let a_numerical_start = a.find(|c: char| c.is_ascii_digit()).unwrap_or(a.len());
-        let b_numerical_start = b.find(|c: char| c.is_ascii_digit()).unwrap_or(b.len());
+    // 1. Compare leading non-numerical part
+    // 2. Compare leading numerical part
+    // 3. Repeat
+    loop {
+        let a_numerical_start = a.find(|c: char| c.is_ascii_digit()).unwrap_or(a.len());
+        let b_numerical_start = b.find(|c: char| c.is_ascii_digit()).unwrap_or(b.len());
 
-        let a_str = &a[..a_numerical_start];
-        let b_str = &b[..b_numerical_start];
+        let a_str = &a[..a_numerical_start];
+        let b_str = &b[..b_numerical_start];
 
-        match version_non_digit_cmp(a_str, b_str) {
-            Ordering::Equal => {}
-            ord => return ord,
+        match version_non_digit_cmp(a_str, b_str) {
+            Ordering::Equal => {}
+            ord => return ord,
         }
 
-        a = &a[a_numerical_start..];
-        b = &b[a_numerical_start..];
+        a = &a[a_numerical_start..];
+        b = &b[a_numerical_start..];
 
-        let a_numerical_end = a.find(|c: char| !c.is_ascii_digit()).unwrap_or(a.len());
-        let b_numerical_end = b.find(|c: char| !c.is_ascii_digit()).unwrap_or(b.len());
+        let a_numerical_end = a.find(|c: char| !c.is_ascii_digit()).unwrap_or(a.len());
+        let b_numerical_end = b.find(|c: char| !c.is_ascii_digit()).unwrap_or(b.len());
 
-        let a_str = a[..a_numerical_end].trim_start_matches('0');
-        let b_str = b[..b_numerical_end].trim_start_matches('0');
+        let a_str = a[..a_numerical_end].trim_start_matches('0');
+        let b_str = b[..b_numerical_end].trim_start_matches('0');
 
-        match a_str.len().cmp(&b_str.len()) {
-            Ordering::Equal => {}
-            ord => return ord,
+        match a_str.len().cmp(&b_str.len()) {
+            Ordering::Equal => {}
+            ord => return ord,
         }
 
-        match a_str.cmp(b_str) {
-            Ordering::Equal => {}
-            ord => return ord,
+        match a_str.cmp(b_str) {
+            Ordering::Equal => {}
+            ord => return ord,
         }
 
-        a = &a[a_numerical_end..];
-        b = &b[b_numerical_end..];
+        a = &a[a_numerical_end..];
+        b = &b[b_numerical_end..];
 
-        if a.is_empty() && b.is_empty() {
-            // Default to the lexical comparison.
-            return str_cmp;
+        if a.is_empty() && b.is_empty() {
+            // Default to the lexical comparison.
+            return str_cmp;
         }
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use crate::version_cmp::version_cmp;
-    use std::cmp::Ordering;
-    #[test]
-    fn test_version_cmp() {
-        // Identical strings
-        assert_eq!(version_cmp("hello", "hello"), Ordering::Equal);
+#[cfg(test)]
+mod tests {
+    use crate::version_cmp::version_cmp;
+    use std::cmp::Ordering;
+    #[test]
+    fn test_version_cmp() {
+        // Identical strings
+        assert_eq!(version_cmp("hello", "hello"), Ordering::Equal);
 
-        assert_eq!(version_cmp("file12", "file12"), Ordering::Equal);
+        assert_eq!(version_cmp("file12", "file12"), Ordering::Equal);
 
         assert_eq!(
-            version_cmp("file12-suffix", "file12-suffix"),
-            Ordering::Equal
+            version_cmp("file12-suffix", "file12-suffix"),
+            Ordering::Equal
         );
 
         assert_eq!(
-            version_cmp("file12-suffix24", "file12-suffix24"),
-            Ordering::Equal
+            version_cmp("file12-suffix24", "file12-suffix24"),
+            Ordering::Equal
         );
 
-        // Shortened names
-        assert_eq!(version_cmp("world", "wo"), Ordering::Greater,);
+        // Shortened names
+        assert_eq!(version_cmp("world", "wo"), Ordering::Greater,);
 
-        assert_eq!(version_cmp("hello10wo", "hello10world"), Ordering::Less,);
+        assert_eq!(version_cmp("hello10wo", "hello10world"), Ordering::Less,);
 
-        // Simple names
-        assert_eq!(version_cmp("world", "hello"), Ordering::Greater,);
+        // Simple names
+        assert_eq!(version_cmp("world", "hello"), Ordering::Greater,);
 
-        assert_eq!(version_cmp("hello", "world"), Ordering::Less);
+        assert_eq!(version_cmp("hello", "world"), Ordering::Less);
 
-        assert_eq!(version_cmp("apple", "ant"), Ordering::Greater);
+        assert_eq!(version_cmp("apple", "ant"), Ordering::Greater);
 
-        assert_eq!(version_cmp("ant", "apple"), Ordering::Less);
+        assert_eq!(version_cmp("ant", "apple"), Ordering::Less);
 
-        // Uppercase letters
-        assert_eq!(
-            version_cmp("Beef", "apple"),
-            Ordering::Less,
-            "Uppercase letters are sorted before all lowercase letters"
-        );
+        // Uppercase letters
+        assert_eq!(
+            version_cmp("Beef", "apple"),
+            Ordering::Less,
+            "Uppercase letters are sorted before all lowercase letters"
+        );
 
-        assert_eq!(version_cmp("Apple", "apple"), Ordering::Less);
+        assert_eq!(version_cmp("Apple", "apple"), Ordering::Less);
 
-        assert_eq!(version_cmp("apple", "aPple"), Ordering::Greater);
+        assert_eq!(version_cmp("apple", "aPple"), Ordering::Greater);
 
-        // Numbers
-        assert_eq!(
-            version_cmp("100", "20"),
-            Ordering::Greater,
+        // Numbers
+        assert_eq!(
+            version_cmp("100", "20"),
+            Ordering::Greater,
             "Greater numbers are greater even if they start with a smaller digit",
         );
 
         assert_eq!(
-            version_cmp("20", "20"),
-            Ordering::Equal,
-            "Equal numbers are equal"
-        );
+            version_cmp("20", "20"),
+            Ordering::Equal,
+            "Equal numbers are equal"
+        );
 
         assert_eq!(
-            version_cmp("15", "200"),
-            Ordering::Less,
-            "Small numbers are smaller"
-        );
+            version_cmp("15", "200"),
+            Ordering::Less,
+            "Small numbers are smaller"
+        );
 
-        // Comparing numbers with other characters
-        assert_eq!(
-            version_cmp("1000", "apple"),
-            Ordering::Less,
-            "Numbers are sorted before other characters"
-        );
+        // Comparing numbers with other characters
+        assert_eq!(
+            version_cmp("1000", "apple"),
+            Ordering::Less,
+            "Numbers are sorted before other characters"
+        );
 
         assert_eq!(
-            // spell-checker:disable-next-line
-            version_cmp("file1000", "fileapple"),
-            Ordering::Less,
-            "Numbers in the middle of the name are sorted before other characters"
-        );
+            // spell-checker:disable-next-line
+            version_cmp("file1000", "fileapple"),
+            Ordering::Less,
+            "Numbers in the middle of the name are sorted before other characters"
+        );
 
-        // Leading zeroes
-        assert_eq!(
-            version_cmp("012", "12"),
-            Ordering::Less,
-            "A single leading zero can make a difference"
-        );
+        // Leading zeroes
+        assert_eq!(
+            version_cmp("012", "12"),
+            Ordering::Less,
+            "A single leading zero can make a difference"
+        );
 
         assert_eq!(
-            version_cmp("000800", "0000800"),
-            Ordering::Greater,
-            "Leading number of zeroes is used even if both non-zero number of zeros"
-        );
+            version_cmp("000800", "0000800"),
+            Ordering::Greater,
+            "Leading number of zeroes is used even if both non-zero number of zeros"
+        );
 
-        // Numbers and other characters combined
-        assert_eq!(version_cmp("ab10", "aa11"), Ordering::Greater);
+        // Numbers and other characters combined
+        assert_eq!(version_cmp("ab10", "aa11"), Ordering::Greater);
 
         assert_eq!(
-            version_cmp("aa10", "aa11"),
-            Ordering::Less,
-            "Numbers after other characters are handled correctly."
-        );
+            version_cmp("aa10", "aa11"),
+            Ordering::Less,
+            "Numbers after other characters are handled correctly."
+        );
 
         assert_eq!(
-            version_cmp("aa2", "aa100"),
-            Ordering::Less,
-            "Numbers after alphabetical characters are handled correctly."
-        );
+            version_cmp("aa2", "aa100"),
+            Ordering::Less,
+            "Numbers after alphabetical characters are handled correctly."
+        );
 
         assert_eq!(
-            version_cmp("aa10bb", "aa11aa"),
-            Ordering::Less,
-            "Number is used even if alphabetical characters after it differ."
-        );
+            version_cmp("aa10bb", "aa11aa"),
+            Ordering::Less,
+            "Number is used even if alphabetical characters after it differ."
+        );
 
         assert_eq!(
-            version_cmp("aa10aa0010", "aa11aa1"),
-            Ordering::Less,
-            "Second number is ignored if the first number differs."
-        );
+            version_cmp("aa10aa0010", "aa11aa1"),
+            Ordering::Less,
+            "Second number is ignored if the first number differs."
+        );
 
         assert_eq!(
-            version_cmp("aa10aa0010", "aa10aa1"),
-            Ordering::Greater,
-            "Second number is used if the rest is equal."
-        );
+            version_cmp("aa10aa0010", "aa10aa1"),
+            Ordering::Greater,
+            "Second number is used if the rest is equal."
+        );
 
         assert_eq!(
-            version_cmp("aa10aa0010", "aa00010aa1"),
-            Ordering::Greater,
-            "Second number is used if the rest is equal up to leading zeroes of the first number."
-        );
+            version_cmp("aa10aa0010", "aa00010aa1"),
+            Ordering::Greater,
+            "Second number is used if the rest is equal up to leading zeroes of the first number."
+        );
 
         assert_eq!(
-            version_cmp("aa10aa0022", "aa010aa022"),
-            Ordering::Greater,
-            "The leading zeroes of the first number has priority."
-        );
+            version_cmp("aa10aa0022", "aa010aa022"),
+            Ordering::Greater,
+            "The leading zeroes of the first number has priority."
+        );
 
         assert_eq!(
-            version_cmp("aa10aa0022", "aa10aa022"),
-            Ordering::Less,
-            "The leading zeroes of other numbers than the first are used."
-        );
+            version_cmp("aa10aa0022", "aa10aa022"),
+            Ordering::Less,
+            "The leading zeroes of other numbers than the first are used."
+        );
 
         assert_eq!(
-            version_cmp("file-1.4", "file-1.13"),
-            Ordering::Less,
-            "Periods are handled as normal text, not as a decimal point."
-        );
+            version_cmp("file-1.4", "file-1.13"),
+            Ordering::Less,
+            "Periods are handled as normal text, not as a decimal point."
+        );
 
-        // Greater than u64::Max
-        // u64 == 18446744073709551615 so this should be plenty:
-        //        20000000000000000000000
-        assert_eq!(
-            version_cmp("aa2000000000000000000000bb", "aa002000000000000000000001bb"),
-            Ordering::Less,
-            "Numbers larger than u64::MAX are handled correctly without crashing"
-        );
+        // Greater than u64::Max
+        // u64 == 18446744073709551615 so this should be plenty:
+        //        20000000000000000000000
+        assert_eq!(
+            version_cmp("aa2000000000000000000000bb", "aa002000000000000000000001bb"),
+            Ordering::Less,
+            "Numbers larger than u64::MAX are handled correctly without crashing"
+        );
 
         assert_eq!(
-            version_cmp("aa2000000000000000000000bb", "aa002000000000000000000000bb"),
-            Ordering::Greater,
+            version_cmp("aa2000000000000000000000bb", "aa002000000000000000000000bb"),
+            Ordering::Greater,
             "Leading zeroes for numbers larger than u64::MAX are \
-            handled correctly without crashing"
-        );
+            handled correctly without crashing"
+        );
 
         assert_eq!(
-            version_cmp("  a", "a"),
-            Ordering::Greater,
-            "Whitespace is after letters because letters are before non-letters"
-        );
+            version_cmp("  a", "a"),
+            Ordering::Greater,
+            "Whitespace is after letters because letters are before non-letters"
+        );
 
         assert_eq!(
-            version_cmp("a~", "ab"),
-            Ordering::Less,
-            "A tilde is before other letters"
-        );
+            version_cmp("a~", "ab"),
+            Ordering::Less,
+            "A tilde is before other letters"
+        );
 
         assert_eq!(
-            version_cmp("a~", "a"),
-            Ordering::Less,
-            "A tilde is before the line end"
-        );
+            version_cmp("a~", "a"),
+            Ordering::Less,
+            "A tilde is before the line end"
+        );
         assert_eq!(
-            version_cmp("~", ""),
-            Ordering::Greater,
-            "A tilde is after the empty string"
-        );
+            version_cmp("~", ""),
+            Ordering::Greater,
+            "A tilde is after the empty string"
+        );
         assert_eq!(
-            version_cmp(".f", ".1"),
-            Ordering::Greater,
-            "if both start with a dot it is ignored for the comparison"
-        );
+            version_cmp(".f", ".1"),
+            Ordering::Greater,
+            "if both start with a dot it is ignored for the comparison"
+        );
 
-        // The following tests are incompatible with GNU as of 2021/06.
-        // I think that's because of a bug in GNU, reported as https://lists.gnu.org/archive/html/bug-coreutils/2021-06/msg00045.html
+        // The following tests are incompatible with GNU as of 2021/06.
+        // I think that's because of a bug in GNU, reported as https://lists.gnu.org/archive/html/bug-coreutils/2021-06/msg00045.html
+        assert_eq!(
+            version_cmp("a..a", "a.+"),
+            Ordering::Less,
+            ".a is stripped before the comparison"
+        );
         assert_eq!(
-            version_cmp("a..a", "a.+"),
-            Ordering::Less,
-            ".a is stripped before the comparison"
-        );
+            version_cmp("a.", "a+"),
+            Ordering::Greater,
+            ". is not stripped before the comparison"
+        );
         assert_eq!(
-            version_cmp("a.", "a+"),
-            Ordering::Greater,
-            ". is not stripped before the comparison"
-        );
-        assert_eq!(
-            version_cmp("a\0a", "a"),
-            Ordering::Greater,
-            "NULL bytes are handled comparison"
-        );
+            version_cmp("a\0a", "a"),
+            Ordering::Greater,
+            "NULL bytes are handled comparison"
+        );
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/parser.rs.html b/dev/src/uucore/parser.rs.html index eb7c7f8bf..bf4ee2280 100644 --- a/dev/src/uucore/parser.rs.html +++ b/dev/src/uucore/parser.rs.html @@ -1,8 +1,8 @@ -parser.rs - source
1
+parser.rs - source
1
 2
 3
-
pub mod parse_glob;
-pub mod parse_size;
-pub mod parse_time;
+
pub mod parse_glob;
+pub mod parse_size;
+pub mod parse_time;
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/parser/parse_glob.rs.html b/dev/src/uucore/parser/parse_glob.rs.html index ce92d4e4c..c682832d6 100644 --- a/dev/src/uucore/parser/parse_glob.rs.html +++ b/dev/src/uucore/parser/parse_glob.rs.html @@ -1,4 +1,4 @@ -parse_glob.rs - source
1
+parse_glob.rs - source
1
 2
 3
 4
@@ -107,114 +107,114 @@
 107
 108
 109
-
//! Parsing a glob Pattern from a string.
-//!
-//! Use the [`from_str`] function to parse a [`Pattern`] from a string.
+
//! Parsing a glob Pattern from a string.
+//!
+//! Use the [`from_str`] function to parse a [`Pattern`] from a string.
 
-// cSpell:words fnmatch
+// cSpell:words fnmatch
 
-use glob::{Pattern, PatternError};
+use glob::{Pattern, PatternError};
 
-fn fix_negation(glob: &str) -> String {
-    let mut chars = glob.chars().collect::<Vec<_>>();
+fn fix_negation(glob: &str) -> String {
+    let mut chars = glob.chars().collect::<Vec<_>>();
 
-    let mut i = 0;
-    while i < chars.len() {
-        if chars[i] == '[' && i + 4 <= glob.len() && chars[i + 1] == '^' {
-            match chars[i + 3..].iter().position(|x| *x == ']') {
-                None => (),
-                Some(j) => {
-                    chars[i + 1] = '!';
-                    i += j + 4;
+    let mut i = 0;
+    while i < chars.len() {
+        if chars[i] == '[' && i + 4 <= glob.len() && chars[i + 1] == '^' {
+            match chars[i + 3..].iter().position(|x| *x == ']') {
+                None => (),
+                Some(j) => {
+                    chars[i + 1] = '!';
+                    i += j + 4;
                     continue;
                 }
             }
         }
 
-        i += 1;
+        i += 1;
     }
 
-    chars.into_iter().collect::<String>()
+    chars.into_iter().collect::<String>()
 }
 
-/// Parse a glob Pattern from a string.
-///
-/// This function amends the input string to replace any caret or circumflex
-/// character (^) used to negate a set of characters with an exclamation mark
-/// (!), which adapts rust's glob matching to function the way the GNU utils'
-/// fnmatch does.
-///
-/// # Examples
-///
-/// ```rust
-/// use std::time::Duration;
-/// use uucore::parse_glob::from_str;
-/// assert!(!from_str("[^abc]").unwrap().matches("a"));
-/// assert!(from_str("[^abc]").unwrap().matches("x"));
-/// ```
-pub fn from_str(glob: &str) -> Result<Pattern, PatternError> {
-    Pattern::new(&fix_negation(glob))
+/// Parse a glob Pattern from a string.
+///
+/// This function amends the input string to replace any caret or circumflex
+/// character (^) used to negate a set of characters with an exclamation mark
+/// (!), which adapts rust's glob matching to function the way the GNU utils'
+/// fnmatch does.
+///
+/// # Examples
+///
+/// ```rust
+/// use std::time::Duration;
+/// use uucore::parse_glob::from_str;
+/// assert!(!from_str("[^abc]").unwrap().matches("a"));
+/// assert!(from_str("[^abc]").unwrap().matches("x"));
+/// ```
+pub fn from_str(glob: &str) -> Result<Pattern, PatternError> {
+    Pattern::new(&fix_negation(glob))
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use super::*;
+    use super::*;
 
-    #[test]
-    fn test_from_str() {
-        assert_eq!(from_str("[^abc]").unwrap(), Pattern::new("[!abc]").unwrap());
+    #[test]
+    fn test_from_str() {
+        assert_eq!(from_str("[^abc]").unwrap(), Pattern::new("[!abc]").unwrap());
     }
 
-    #[test]
-    fn test_fix_negation() {
-        // Happy/Simple case
-        assert_eq!(fix_negation("[^abc]"), "[!abc]");
+    #[test]
+    fn test_fix_negation() {
+        // Happy/Simple case
+        assert_eq!(fix_negation("[^abc]"), "[!abc]");
 
-        // Should fix negations in a long regex
-        assert_eq!(fix_negation("foo[abc]  bar[^def]"), "foo[abc]  bar[!def]");
+        // Should fix negations in a long regex
+        assert_eq!(fix_negation("foo[abc]  bar[^def]"), "foo[abc]  bar[!def]");
 
-        // Should fix multiple negations in a regex
-        assert_eq!(fix_negation("foo[^abc]bar[^def]"), "foo[!abc]bar[!def]");
+        // Should fix multiple negations in a regex
+        assert_eq!(fix_negation("foo[^abc]bar[^def]"), "foo[!abc]bar[!def]");
 
-        // Should fix negation of the single character ]
-        assert_eq!(fix_negation("[^]]"), "[!]]");
+        // Should fix negation of the single character ]
+        assert_eq!(fix_negation("[^]]"), "[!]]");
 
-        // Should fix negation of the single character ^
-        assert_eq!(fix_negation("[^^]"), "[!^]");
+        // Should fix negation of the single character ^
+        assert_eq!(fix_negation("[^^]"), "[!^]");
 
-        // Should fix negation of the space character
-        assert_eq!(fix_negation("[^ ]"), "[! ]");
+        // Should fix negation of the space character
+        assert_eq!(fix_negation("[^ ]"), "[! ]");
 
-        // Complicated patterns
-        assert_eq!(fix_negation("[^][]"), "[!][]");
-        assert_eq!(fix_negation("[^[]]"), "[![]]");
+        // Complicated patterns
+        assert_eq!(fix_negation("[^][]"), "[!][]");
+        assert_eq!(fix_negation("[^[]]"), "[![]]");
 
-        // More complex patterns that should be replaced
-        assert_eq!(fix_negation("[[]] [^a]"), "[[]] [!a]");
-        assert_eq!(fix_negation("[[] [^a]"), "[[] [!a]");
-        assert_eq!(fix_negation("[]] [^a]"), "[]] [!a]");
+        // More complex patterns that should be replaced
+        assert_eq!(fix_negation("[[]] [^a]"), "[[]] [!a]");
+        assert_eq!(fix_negation("[[] [^a]"), "[[] [!a]");
+        assert_eq!(fix_negation("[]] [^a]"), "[]] [!a]");
     }
 
-    #[test]
-    fn test_fix_negation_should_not_amend() {
-        assert_eq!(fix_negation("abc"), "abc");
+    #[test]
+    fn test_fix_negation_should_not_amend() {
+        assert_eq!(fix_negation("abc"), "abc");
 
-        // Regex specifically matches either [ or ^
-        assert_eq!(fix_negation("[[^]"), "[[^]");
+        // Regex specifically matches either [ or ^
+        assert_eq!(fix_negation("[[^]"), "[[^]");
 
-        // Regex that specifically matches either space or ^
-        assert_eq!(fix_negation("[ ^]"), "[ ^]");
+        // Regex that specifically matches either space or ^
+        assert_eq!(fix_negation("[ ^]"), "[ ^]");
 
-        // Regex that specifically matches either [, space or ^
-        assert_eq!(fix_negation("[[ ^]"), "[[ ^]");
-        assert_eq!(fix_negation("[ [^]"), "[ [^]");
+        // Regex that specifically matches either [, space or ^
+        assert_eq!(fix_negation("[[ ^]"), "[[ ^]");
+        assert_eq!(fix_negation("[ [^]"), "[ [^]");
 
-        // Invalid globs (according to rust's glob implementation) will remain unamended
-        assert_eq!(fix_negation("[^]"), "[^]");
-        assert_eq!(fix_negation("[^"), "[^");
-        assert_eq!(fix_negation("[][^]"), "[][^]");
+        // Invalid globs (according to rust's glob implementation) will remain unamended
+        assert_eq!(fix_negation("[^]"), "[^]");
+        assert_eq!(fix_negation("[^"), "[^");
+        assert_eq!(fix_negation("[][^]"), "[][^]");
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/parser/parse_size.rs.html b/dev/src/uucore/parser/parse_size.rs.html index f8863d78b..db72ec92f 100644 --- a/dev/src/uucore/parser/parse_size.rs.html +++ b/dev/src/uucore/parser/parse_size.rs.html @@ -1,4 +1,4 @@ -parse_size.rs - source
1
+parse_size.rs - source
1
 2
 3
 4
@@ -321,328 +321,328 @@
 321
 322
 323
-
//  * This file is part of the uutils coreutils package.
-//  *
-//  * For the full copyright and license information, please view the LICENSE
-//  * file that was distributed with this source code.
+
//  * This file is part of the uutils coreutils package.
+//  *
+//  * For the full copyright and license information, please view the LICENSE
+//  * file that was distributed with this source code.
 
-// spell-checker:ignore (ToDO) hdsf ghead gtail
+// spell-checker:ignore (ToDO) hdsf ghead gtail
 
-use std::error::Error;
-use std::fmt;
+use std::error::Error;
+use std::fmt;
 
-use crate::display::Quotable;
+use crate::display::Quotable;
 
-/// Parse a size string into a number of bytes.
-///
-/// A size string comprises an integer and an optional unit. The unit
-/// may be K, M, G, T, P, E, Z or Y (powers of 1024), or KB, MB,
-/// etc. (powers of 1000), or b which is 512.
-/// Binary prefixes can be used, too: KiB=K, MiB=M, and so on.
-///
-/// # Errors
-///
-/// Will return `ParseSizeError` if it's not possible to parse this
-/// string into a number, e.g. if the string does not begin with a
-/// numeral, or if the unit is not one of the supported units described
-/// in the preceding section.
-///
-/// # Examples
-///
-/// ```rust
-/// use uucore::parse_size::parse_size;
-/// assert_eq!(Ok(123), parse_size("123"));
-/// assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000
-/// assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024
-/// ```
-pub fn parse_size(size: &str) -> Result<u64, ParseSizeError> {
-    if size.is_empty() {
-        return Err(ParseSizeError::parse_failure(size));
+/// Parse a size string into a number of bytes.
+///
+/// A size string comprises an integer and an optional unit. The unit
+/// may be K, M, G, T, P, E, Z or Y (powers of 1024), or KB, MB,
+/// etc. (powers of 1000), or b which is 512.
+/// Binary prefixes can be used, too: KiB=K, MiB=M, and so on.
+///
+/// # Errors
+///
+/// Will return `ParseSizeError` if it's not possible to parse this
+/// string into a number, e.g. if the string does not begin with a
+/// numeral, or if the unit is not one of the supported units described
+/// in the preceding section.
+///
+/// # Examples
+///
+/// ```rust
+/// use uucore::parse_size::parse_size;
+/// assert_eq!(Ok(123), parse_size("123"));
+/// assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000
+/// assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024
+/// ```
+pub fn parse_size(size: &str) -> Result<u64, ParseSizeError> {
+    if size.is_empty() {
+        return Err(ParseSizeError::parse_failure(size));
     }
-    // Get the numeric part of the size argument. For example, if the
-    // argument is "123K", then the numeric part is "123".
-    let numeric_string: String = size.chars().take_while(|c| c.is_ascii_digit()).collect();
-    let number: u64 = if !numeric_string.is_empty() {
-        match numeric_string.parse() {
-            Ok(n) => n,
-            Err(_) => return Err(ParseSizeError::parse_failure(size)),
+    // Get the numeric part of the size argument. For example, if the
+    // argument is "123K", then the numeric part is "123".
+    let numeric_string: String = size.chars().take_while(|c| c.is_ascii_digit()).collect();
+    let number: u64 = if !numeric_string.is_empty() {
+        match numeric_string.parse() {
+            Ok(n) => n,
+            Err(_) => return Err(ParseSizeError::parse_failure(size)),
         }
-    } else {
-        1
-    };
+    } else {
+        1
+    };
 
-    // Get the alphabetic units part of the size argument and compute
-    // the factor it represents. For example, if the argument is "123K",
-    // then the unit part is "K" and the factor is 1024. This may be the
-    // empty string, in which case, the factor is 1.
-    let unit = &size[numeric_string.len()..];
-    let (base, exponent): (u128, u32) = match unit {
-        "" => (1, 0),
-        "b" => (512, 1), // (`od`, `head` and `tail` use "b")
-        "KiB" | "kiB" | "K" | "k" => (1024, 1),
-        "MiB" | "miB" | "M" | "m" => (1024, 2),
-        "GiB" | "giB" | "G" | "g" => (1024, 3),
-        "TiB" | "tiB" | "T" | "t" => (1024, 4),
-        "PiB" | "piB" | "P" | "p" => (1024, 5),
-        "EiB" | "eiB" | "E" | "e" => (1024, 6),
-        "ZiB" | "ziB" | "Z" | "z" => (1024, 7),
-        "YiB" | "yiB" | "Y" | "y" => (1024, 8),
-        "KB" | "kB" => (1000, 1),
-        "MB" | "mB" => (1000, 2),
-        "GB" | "gB" => (1000, 3),
-        "TB" | "tB" => (1000, 4),
-        "PB" | "pB" => (1000, 5),
-        "EB" | "eB" => (1000, 6),
-        "ZB" | "zB" => (1000, 7),
-        "YB" | "yB" => (1000, 8),
-        _ if numeric_string.is_empty() => return Err(ParseSizeError::parse_failure(size)),
-        _ => return Err(ParseSizeError::invalid_suffix(size)),
+    // Get the alphabetic units part of the size argument and compute
+    // the factor it represents. For example, if the argument is "123K",
+    // then the unit part is "K" and the factor is 1024. This may be the
+    // empty string, in which case, the factor is 1.
+    let unit = &size[numeric_string.len()..];
+    let (base, exponent): (u128, u32) = match unit {
+        "" => (1, 0),
+        "b" => (512, 1), // (`od`, `head` and `tail` use "b")
+        "KiB" | "kiB" | "K" | "k" => (1024, 1),
+        "MiB" | "miB" | "M" | "m" => (1024, 2),
+        "GiB" | "giB" | "G" | "g" => (1024, 3),
+        "TiB" | "tiB" | "T" | "t" => (1024, 4),
+        "PiB" | "piB" | "P" | "p" => (1024, 5),
+        "EiB" | "eiB" | "E" | "e" => (1024, 6),
+        "ZiB" | "ziB" | "Z" | "z" => (1024, 7),
+        "YiB" | "yiB" | "Y" | "y" => (1024, 8),
+        "KB" | "kB" => (1000, 1),
+        "MB" | "mB" => (1000, 2),
+        "GB" | "gB" => (1000, 3),
+        "TB" | "tB" => (1000, 4),
+        "PB" | "pB" => (1000, 5),
+        "EB" | "eB" => (1000, 6),
+        "ZB" | "zB" => (1000, 7),
+        "YB" | "yB" => (1000, 8),
+        _ if numeric_string.is_empty() => return Err(ParseSizeError::parse_failure(size)),
+        _ => return Err(ParseSizeError::invalid_suffix(size)),
     };
-    let factor = match u64::try_from(base.pow(exponent)) {
-        Ok(n) => n,
-        Err(_) => return Err(ParseSizeError::size_too_big(size)),
+    let factor = match u64::try_from(base.pow(exponent)) {
+        Ok(n) => n,
+        Err(_) => return Err(ParseSizeError::size_too_big(size)),
     };
-    number
-        .checked_mul(factor)
-        .ok_or_else(|| ParseSizeError::size_too_big(size))
+    number
+        .checked_mul(factor)
+        .ok_or_else(|| ParseSizeError::size_too_big(size))
 }
 
-#[derive(Debug, PartialEq, Eq)]
-pub enum ParseSizeError {
-    InvalidSuffix(String), // Suffix
-    ParseFailure(String),  // Syntax
-    SizeTooBig(String),    // Overflow
-}
+#[derive(Debug, PartialEq, Eq)]
+pub enum ParseSizeError {
+    InvalidSuffix(String), // Suffix
+    ParseFailure(String),  // Syntax
+    SizeTooBig(String),    // Overflow
+}
 
-impl Error for ParseSizeError {
-    fn description(&self) -> &str {
-        match *self {
-            Self::InvalidSuffix(ref s) => s,
-            Self::ParseFailure(ref s) => s,
-            Self::SizeTooBig(ref s) => s,
+impl Error for ParseSizeError {
+    fn description(&self) -> &str {
+        match *self {
+            Self::InvalidSuffix(ref s) => s,
+            Self::ParseFailure(ref s) => s,
+            Self::SizeTooBig(ref s) => s,
         }
     }
 }
 
-impl fmt::Display for ParseSizeError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
-        let s = match self {
-            Self::InvalidSuffix(s) | Self::ParseFailure(s) | Self::SizeTooBig(s) => s,
+impl fmt::Display for ParseSizeError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        let s = match self {
+            Self::InvalidSuffix(s) | Self::ParseFailure(s) | Self::SizeTooBig(s) => s,
         };
-        write!(f, "{}", s)
+        write!(f, "{}", s)
     }
 }
 
-// FIXME: It's more idiomatic to move the formatting into the Display impl,
-// but there's a lot of downstream code that constructs these errors manually
-// that would be affected
-impl ParseSizeError {
-    fn invalid_suffix(s: &str) -> Self {
-        Self::InvalidSuffix(format!("{}", s.quote()))
+// FIXME: It's more idiomatic to move the formatting into the Display impl,
+// but there's a lot of downstream code that constructs these errors manually
+// that would be affected
+impl ParseSizeError {
+    fn invalid_suffix(s: &str) -> Self {
+        Self::InvalidSuffix(format!("{}", s.quote()))
     }
 
-    fn parse_failure(s: &str) -> Self {
-        // stderr on linux (GNU coreutils 8.32) (LC_ALL=C)
-        // has to be handled in the respective uutils because strings differ, e.g.:
-        //
-        // `NUM`
-        // head:     invalid number of bytes: '1fb'
-        // tail:     invalid number of bytes: '1fb'
-        //
-        // `SIZE`
-        // split:    invalid number of bytes: '1fb'
-        // truncate: Invalid number: '1fb'
-        //
-        // `MODE`
-        // stdbuf:   invalid mode '1fb'
-        //
-        // `SIZE`
-        // sort:     invalid suffix in --buffer-size argument '1fb'
-        // sort:     invalid --buffer-size argument 'fb'
-        //
-        // `SIZE`
-        // du:       invalid suffix in --buffer-size argument '1fb'
-        // du:       invalid suffix in --threshold argument '1fb'
-        // du:       invalid --buffer-size argument 'fb'
-        // du:       invalid --threshold argument 'fb'
-        //
-        // `BYTES`
-        // od:       invalid suffix in --read-bytes argument '1fb'
-        // od:       invalid --read-bytes argument  argument 'fb'
-        //                   --skip-bytes
-        //                   --width
-        //                   --strings
-        // etc.
-        Self::ParseFailure(format!("{}", s.quote()))
+    fn parse_failure(s: &str) -> Self {
+        // stderr on linux (GNU coreutils 8.32) (LC_ALL=C)
+        // has to be handled in the respective uutils because strings differ, e.g.:
+        //
+        // `NUM`
+        // head:     invalid number of bytes: '1fb'
+        // tail:     invalid number of bytes: '1fb'
+        //
+        // `SIZE`
+        // split:    invalid number of bytes: '1fb'
+        // truncate: Invalid number: '1fb'
+        //
+        // `MODE`
+        // stdbuf:   invalid mode '1fb'
+        //
+        // `SIZE`
+        // sort:     invalid suffix in --buffer-size argument '1fb'
+        // sort:     invalid --buffer-size argument 'fb'
+        //
+        // `SIZE`
+        // du:       invalid suffix in --buffer-size argument '1fb'
+        // du:       invalid suffix in --threshold argument '1fb'
+        // du:       invalid --buffer-size argument 'fb'
+        // du:       invalid --threshold argument 'fb'
+        //
+        // `BYTES`
+        // od:       invalid suffix in --read-bytes argument '1fb'
+        // od:       invalid --read-bytes argument  argument 'fb'
+        //                   --skip-bytes
+        //                   --width
+        //                   --strings
+        // etc.
+        Self::ParseFailure(format!("{}", s.quote()))
     }
 
-    fn size_too_big(s: &str) -> Self {
-        // stderr on linux (GNU coreutils 8.32) (LC_ALL=C)
-        // has to be handled in the respective uutils because strings differ, e.g.:
-        //
-        // head:     invalid number of bytes: '1Y': Value too large for defined data type
-        // tail:     invalid number of bytes: '1Y': Value too large for defined data type
-        // split:    invalid number of bytes: '1Y': Value too large for defined data type
-        // truncate:          Invalid number: '1Y': Value too large for defined data type
-        // stdbuf:               invalid mode '1Y': Value too large for defined data type
-        // sort:     -S argument '1Y' too large
-        // du:       -B argument '1Y' too large
-        // od:       -N argument '1Y' too large
-        // etc.
-        //
-        // stderr on macos (brew - GNU coreutils 8.32) also differs for the same version, e.g.:
-        // ghead:   invalid number of bytes: '1Y': Value too large to be stored in data type
-        // gtail:   invalid number of bytes: '1Y': Value too large to be stored in data type
-        Self::SizeTooBig(format!(
+    fn size_too_big(s: &str) -> Self {
+        // stderr on linux (GNU coreutils 8.32) (LC_ALL=C)
+        // has to be handled in the respective uutils because strings differ, e.g.:
+        //
+        // head:     invalid number of bytes: '1Y': Value too large for defined data type
+        // tail:     invalid number of bytes: '1Y': Value too large for defined data type
+        // split:    invalid number of bytes: '1Y': Value too large for defined data type
+        // truncate:          Invalid number: '1Y': Value too large for defined data type
+        // stdbuf:               invalid mode '1Y': Value too large for defined data type
+        // sort:     -S argument '1Y' too large
+        // du:       -B argument '1Y' too large
+        // od:       -N argument '1Y' too large
+        // etc.
+        //
+        // stderr on macos (brew - GNU coreutils 8.32) also differs for the same version, e.g.:
+        // ghead:   invalid number of bytes: '1Y': Value too large to be stored in data type
+        // gtail:   invalid number of bytes: '1Y': Value too large to be stored in data type
+        Self::SizeTooBig(format!(
             "{}: Value too large for defined data type",
-            s.quote()
+            s.quote()
         ))
     }
 }
 
-#[cfg(test)]
-mod tests {
-    use super::*;
+#[cfg(test)]
+mod tests {
+    use super::*;
 
-    fn variant_eq(a: &ParseSizeError, b: &ParseSizeError) -> bool {
-        std::mem::discriminant(a) == std::mem::discriminant(b)
+    fn variant_eq(a: &ParseSizeError, b: &ParseSizeError) -> bool {
+        std::mem::discriminant(a) == std::mem::discriminant(b)
     }
 
-    #[test]
-    fn all_suffixes() {
-        // Units  are  K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).
-        // Binary prefixes can be used, too: KiB=K, MiB=M, and so on.
-        let suffixes = [
+    #[test]
+    fn all_suffixes() {
+        // Units  are  K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).
+        // Binary prefixes can be used, too: KiB=K, MiB=M, and so on.
+        let suffixes = [
             ('K', 1u32),
             ('M', 2u32),
             ('G', 3u32),
             ('T', 4u32),
             ('P', 5u32),
             ('E', 6u32),
-            // The following will always result ParseSizeError::SizeTooBig as they cannot fit in u64
-            // ('Z', 7u32),
-            // ('Y', 8u32),
-        ];
+            // The following will always result ParseSizeError::SizeTooBig as they cannot fit in u64
+            // ('Z', 7u32),
+            // ('Y', 8u32),
+        ];
 
-        for &(c, exp) in &suffixes {
-            let s = format!("2{}B", c); // KB
-            assert_eq!(Ok((2 * (1000_u128).pow(exp)) as u64), parse_size(&s));
-            let s = format!("2{}", c); // K
-            assert_eq!(Ok((2 * (1024_u128).pow(exp)) as u64), parse_size(&s));
-            let s = format!("2{}iB", c); // KiB
-            assert_eq!(Ok((2 * (1024_u128).pow(exp)) as u64), parse_size(&s));
-            let s = format!("2{}iB", c.to_lowercase()); // kiB
-            assert_eq!(Ok((2 * (1024_u128).pow(exp)) as u64), parse_size(&s));
+        for &(c, exp) in &suffixes {
+            let s = format!("2{}B", c); // KB
+            assert_eq!(Ok((2 * (1000_u128).pow(exp)) as u64), parse_size(&s));
+            let s = format!("2{}", c); // K
+            assert_eq!(Ok((2 * (1024_u128).pow(exp)) as u64), parse_size(&s));
+            let s = format!("2{}iB", c); // KiB
+            assert_eq!(Ok((2 * (1024_u128).pow(exp)) as u64), parse_size(&s));
+            let s = format!("2{}iB", c.to_lowercase()); // kiB
+            assert_eq!(Ok((2 * (1024_u128).pow(exp)) as u64), parse_size(&s));
 
-            // suffix only
-            let s = format!("{}B", c); // KB
-            assert_eq!(Ok(((1000_u128).pow(exp)) as u64), parse_size(&s));
-            let s = format!("{}", c); // K
-            assert_eq!(Ok(((1024_u128).pow(exp)) as u64), parse_size(&s));
-            let s = format!("{}iB", c); // KiB
-            assert_eq!(Ok(((1024_u128).pow(exp)) as u64), parse_size(&s));
-            let s = format!("{}iB", c.to_lowercase()); // kiB
-            assert_eq!(Ok(((1024_u128).pow(exp)) as u64), parse_size(&s));
+            // suffix only
+            let s = format!("{}B", c); // KB
+            assert_eq!(Ok(((1000_u128).pow(exp)) as u64), parse_size(&s));
+            let s = format!("{}", c); // K
+            assert_eq!(Ok(((1024_u128).pow(exp)) as u64), parse_size(&s));
+            let s = format!("{}iB", c); // KiB
+            assert_eq!(Ok(((1024_u128).pow(exp)) as u64), parse_size(&s));
+            let s = format!("{}iB", c.to_lowercase()); // kiB
+            assert_eq!(Ok(((1024_u128).pow(exp)) as u64), parse_size(&s));
         }
     }
 
-    #[test]
-    #[cfg(not(target_pointer_width = "128"))]
-    fn overflow_x64() {
-        assert!(parse_size("10000000000000000000000").is_err());
-        assert!(parse_size("1000000000T").is_err());
-        assert!(parse_size("100000P").is_err());
-        assert!(parse_size("100E").is_err());
-        assert!(parse_size("1Z").is_err());
-        assert!(parse_size("1Y").is_err());
+    #[test]
+    #[cfg(not(target_pointer_width = "128"))]
+    fn overflow_x64() {
+        assert!(parse_size("10000000000000000000000").is_err());
+        assert!(parse_size("1000000000T").is_err());
+        assert!(parse_size("100000P").is_err());
+        assert!(parse_size("100E").is_err());
+        assert!(parse_size("1Z").is_err());
+        assert!(parse_size("1Y").is_err());
 
-        assert!(variant_eq(
-            &parse_size("1Z").unwrap_err(),
-            &ParseSizeError::SizeTooBig(String::new())
+        assert!(variant_eq(
+            &parse_size("1Z").unwrap_err(),
+            &ParseSizeError::SizeTooBig(String::new())
         ));
 
         assert_eq!(
-            ParseSizeError::SizeTooBig("'1Y': Value too large for defined data type".to_string()),
-            parse_size("1Y").unwrap_err()
+            ParseSizeError::SizeTooBig("'1Y': Value too large for defined data type".to_string()),
+            parse_size("1Y").unwrap_err()
         );
     }
 
-    #[test]
-    fn invalid_suffix() {
-        let test_strings = ["328hdsf3290", "5mib", "1e2", "1H", "1.2"];
-        for &test_string in &test_strings {
+    #[test]
+    fn invalid_suffix() {
+        let test_strings = ["328hdsf3290", "5mib", "1e2", "1H", "1.2"];
+        for &test_string in &test_strings {
             assert_eq!(
-                parse_size(test_string).unwrap_err(),
-                ParseSizeError::InvalidSuffix(format!("{}", test_string.quote()))
+                parse_size(test_string).unwrap_err(),
+                ParseSizeError::InvalidSuffix(format!("{}", test_string.quote()))
             );
         }
     }
 
-    #[test]
-    fn invalid_syntax() {
-        let test_strings = ["biB", "-", "+", "", "-1", "∞"];
-        for &test_string in &test_strings {
+    #[test]
+    fn invalid_syntax() {
+        let test_strings = ["biB", "-", "+", "", "-1", "∞"];
+        for &test_string in &test_strings {
             assert_eq!(
-                parse_size(test_string).unwrap_err(),
-                ParseSizeError::ParseFailure(format!("{}", test_string.quote()))
+                parse_size(test_string).unwrap_err(),
+                ParseSizeError::ParseFailure(format!("{}", test_string.quote()))
             );
         }
     }
 
-    #[test]
-    fn b_suffix() {
-        assert_eq!(Ok(3 * 512), parse_size("3b")); // b is 512
+    #[test]
+    fn b_suffix() {
+        assert_eq!(Ok(3 * 512), parse_size("3b")); // b is 512
+    }
+
+    #[test]
+    fn no_suffix() {
+        assert_eq!(Ok(1234), parse_size("1234"));
+        assert_eq!(Ok(0), parse_size("0"));
+        assert_eq!(Ok(5), parse_size("5"));
+        assert_eq!(Ok(999), parse_size("999"));
     }
 
-    #[test]
-    fn no_suffix() {
-        assert_eq!(Ok(1234), parse_size("1234"));
-        assert_eq!(Ok(0), parse_size("0"));
-        assert_eq!(Ok(5), parse_size("5"));
-        assert_eq!(Ok(999), parse_size("999"));
+    #[test]
+    fn kilobytes_suffix() {
+        assert_eq!(Ok(123 * 1000), parse_size("123KB")); // KB is 1000
+        assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000
+        assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024
+        assert_eq!(Ok(0), parse_size("0K"));
+        assert_eq!(Ok(0), parse_size("0KB"));
+        assert_eq!(Ok(1000), parse_size("KB"));
+        assert_eq!(Ok(1024), parse_size("K"));
+        assert_eq!(Ok(2000), parse_size("2kB"));
+        assert_eq!(Ok(4000), parse_size("4KB"));
     }
 
-    #[test]
-    fn kilobytes_suffix() {
-        assert_eq!(Ok(123 * 1000), parse_size("123KB")); // KB is 1000
-        assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000
-        assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024
-        assert_eq!(Ok(0), parse_size("0K"));
-        assert_eq!(Ok(0), parse_size("0KB"));
-        assert_eq!(Ok(1000), parse_size("KB"));
-        assert_eq!(Ok(1024), parse_size("K"));
-        assert_eq!(Ok(2000), parse_size("2kB"));
-        assert_eq!(Ok(4000), parse_size("4KB"));
+    #[test]
+    fn megabytes_suffix() {
+        assert_eq!(Ok(123 * 1024 * 1024), parse_size("123M"));
+        assert_eq!(Ok(123 * 1000 * 1000), parse_size("123MB"));
+        assert_eq!(Ok(1024 * 1024), parse_size("M"));
+        assert_eq!(Ok(1000 * 1000), parse_size("MB"));
+        assert_eq!(Ok(2 * 1_048_576), parse_size("2m"));
+        assert_eq!(Ok(4 * 1_048_576), parse_size("4M"));
+        assert_eq!(Ok(2_000_000), parse_size("2mB"));
+        assert_eq!(Ok(4_000_000), parse_size("4MB"));
     }
 
-    #[test]
-    fn megabytes_suffix() {
-        assert_eq!(Ok(123 * 1024 * 1024), parse_size("123M"));
-        assert_eq!(Ok(123 * 1000 * 1000), parse_size("123MB"));
-        assert_eq!(Ok(1024 * 1024), parse_size("M"));
-        assert_eq!(Ok(1000 * 1000), parse_size("MB"));
-        assert_eq!(Ok(2 * 1_048_576), parse_size("2m"));
-        assert_eq!(Ok(4 * 1_048_576), parse_size("4M"));
-        assert_eq!(Ok(2_000_000), parse_size("2mB"));
-        assert_eq!(Ok(4_000_000), parse_size("4MB"));
+    #[test]
+    fn gigabytes_suffix() {
+        assert_eq!(Ok(1_073_741_824), parse_size("1G"));
+        assert_eq!(Ok(2_000_000_000), parse_size("2GB"));
     }
 
-    #[test]
-    fn gigabytes_suffix() {
-        assert_eq!(Ok(1_073_741_824), parse_size("1G"));
-        assert_eq!(Ok(2_000_000_000), parse_size("2GB"));
-    }
-
-    #[test]
-    #[cfg(target_pointer_width = "64")]
-    fn x64() {
-        assert_eq!(Ok(1_099_511_627_776), parse_size("1T"));
-        assert_eq!(Ok(1_125_899_906_842_624), parse_size("1P"));
-        assert_eq!(Ok(1_152_921_504_606_846_976), parse_size("1E"));
-        assert_eq!(Ok(2_000_000_000_000), parse_size("2TB"));
-        assert_eq!(Ok(2_000_000_000_000_000), parse_size("2PB"));
-        assert_eq!(Ok(2_000_000_000_000_000_000), parse_size("2EB"));
+    #[test]
+    #[cfg(target_pointer_width = "64")]
+    fn x64() {
+        assert_eq!(Ok(1_099_511_627_776), parse_size("1T"));
+        assert_eq!(Ok(1_125_899_906_842_624), parse_size("1P"));
+        assert_eq!(Ok(1_152_921_504_606_846_976), parse_size("1E"));
+        assert_eq!(Ok(2_000_000_000_000), parse_size("2TB"));
+        assert_eq!(Ok(2_000_000_000_000_000), parse_size("2PB"));
+        assert_eq!(Ok(2_000_000_000_000_000_000), parse_size("2EB"));
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore/parser/parse_time.rs.html b/dev/src/uucore/parser/parse_time.rs.html index f230b91ea..3ce15f0a6 100644 --- a/dev/src/uucore/parser/parse_time.rs.html +++ b/dev/src/uucore/parser/parse_time.rs.html @@ -1,4 +1,4 @@ -parse_time.rs - source
1
+parse_time.rs - source
1
 2
 3
 4
@@ -131,138 +131,138 @@
 131
 132
 133
-
// This file is part of the uutils coreutils package.
-//
-// (c) Alex Lyon <arcterus@mail.com>
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
+
// This file is part of the uutils coreutils package.
+//
+// (c) Alex Lyon <arcterus@mail.com>
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
 
-// spell-checker:ignore (vars) NANOS numstr
-//! Parsing a duration from a string.
-//!
-//! Use the [`from_str`] function to parse a [`Duration`] from a string.
+// spell-checker:ignore (vars) NANOS numstr
+//! Parsing a duration from a string.
+//!
+//! Use the [`from_str`] function to parse a [`Duration`] from a string.
 
-use std::time::Duration;
+use std::time::Duration;
 
-use crate::display::Quotable;
+use crate::display::Quotable;
 
-/// Parse a duration from a string.
-///
-/// The string may contain only a number, like "123" or "4.5", or it
-/// may contain a number with a unit specifier, like "123s" meaning
-/// one hundred twenty three seconds or "4.5d" meaning four and a half
-/// days. If no unit is specified, the unit is assumed to be seconds.
-///
-/// The only allowed suffixes are
-///
-/// * "s" for seconds,
-/// * "m" for minutes,
-/// * "h" for hours,
-/// * "d" for days.
-///
-/// This function uses [`Duration::saturating_mul`] to compute the
-/// number of seconds, so it does not overflow. If overflow would have
-/// occurred, [`Duration::MAX`] is returned instead.
-///
-/// # Errors
-///
-/// This function returns an error if the input string is empty, the
-/// input is not a valid number, or the unit specifier is invalid or
-/// unknown.
-///
-/// # Examples
-///
-/// ```rust
-/// use std::time::Duration;
-/// use uucore::parse_time::from_str;
-/// assert_eq!(from_str("123"), Ok(Duration::from_secs(123)));
-/// assert_eq!(from_str("2d"), Ok(Duration::from_secs(60 * 60 * 24 * 2)));
-/// ```
-pub fn from_str(string: &str) -> Result<Duration, String> {
-    let len = string.len();
-    if len == 0 {
-        return Err("empty string".to_owned());
+/// Parse a duration from a string.
+///
+/// The string may contain only a number, like "123" or "4.5", or it
+/// may contain a number with a unit specifier, like "123s" meaning
+/// one hundred twenty three seconds or "4.5d" meaning four and a half
+/// days. If no unit is specified, the unit is assumed to be seconds.
+///
+/// The only allowed suffixes are
+///
+/// * "s" for seconds,
+/// * "m" for minutes,
+/// * "h" for hours,
+/// * "d" for days.
+///
+/// This function uses [`Duration::saturating_mul`] to compute the
+/// number of seconds, so it does not overflow. If overflow would have
+/// occurred, [`Duration::MAX`] is returned instead.
+///
+/// # Errors
+///
+/// This function returns an error if the input string is empty, the
+/// input is not a valid number, or the unit specifier is invalid or
+/// unknown.
+///
+/// # Examples
+///
+/// ```rust
+/// use std::time::Duration;
+/// use uucore::parse_time::from_str;
+/// assert_eq!(from_str("123"), Ok(Duration::from_secs(123)));
+/// assert_eq!(from_str("2d"), Ok(Duration::from_secs(60 * 60 * 24 * 2)));
+/// ```
+pub fn from_str(string: &str) -> Result<Duration, String> {
+    let len = string.len();
+    if len == 0 {
+        return Err("empty string".to_owned());
     }
-    let slice = &string[..len - 1];
-    let (numstr, times) = match string.chars().next_back().unwrap() {
-        's' => (slice, 1),
-        'm' => (slice, 60),
-        'h' => (slice, 60 * 60),
-        'd' => (slice, 60 * 60 * 24),
-        val if !val.is_alphabetic() => (string, 1),
-        _ => {
-            if string == "inf" || string == "infinity" {
+    let slice = &string[..len - 1];
+    let (numstr, times) = match string.chars().next_back().unwrap() {
+        's' => (slice, 1),
+        'm' => (slice, 60),
+        'h' => (slice, 60 * 60),
+        'd' => (slice, 60 * 60 * 24),
+        val if !val.is_alphabetic() => (string, 1),
+        _ => {
+            if string == "inf" || string == "infinity" {
                 ("inf", 1)
-            } else {
-                return Err(format!("invalid time interval {}", string.quote()));
+            } else {
+                return Err(format!("invalid time interval {}", string.quote()));
             }
         }
     };
-    let num = numstr
-        .parse::<f64>()
-        .map_err(|e| format!("invalid time interval {}: {}", string.quote(), e))?;
+    let num = numstr
+        .parse::<f64>()
+        .map_err(|e| format!("invalid time interval {}: {}", string.quote(), e))?;
 
-    if num < 0. {
-        return Err(format!("invalid time interval {}", string.quote()));
+    if num < 0. {
+        return Err(format!("invalid time interval {}", string.quote()));
     }
 
-    const NANOS_PER_SEC: u32 = 1_000_000_000;
-    let whole_secs = num.trunc();
-    let nanos = (num.fract() * (NANOS_PER_SEC as f64)).trunc();
-    let duration = Duration::new(whole_secs as u64, nanos as u32);
-    Ok(duration.saturating_mul(times))
+    const NANOS_PER_SEC: u32 = 1_000_000_000;
+    let whole_secs = num.trunc();
+    let nanos = (num.fract() * (NANOS_PER_SEC as f64)).trunc();
+    let duration = Duration::new(whole_secs as u64, nanos as u32);
+    Ok(duration.saturating_mul(times))
 }
 
-#[cfg(test)]
-mod tests {
+#[cfg(test)]
+mod tests {
 
-    use crate::parse_time::from_str;
-    use std::time::Duration;
+    use crate::parse_time::from_str;
+    use std::time::Duration;
 
-    #[test]
-    fn test_no_units() {
-        assert_eq!(from_str("123"), Ok(Duration::from_secs(123)));
+    #[test]
+    fn test_no_units() {
+        assert_eq!(from_str("123"), Ok(Duration::from_secs(123)));
     }
 
-    #[test]
-    fn test_units() {
-        assert_eq!(from_str("2d"), Ok(Duration::from_secs(60 * 60 * 24 * 2)));
+    #[test]
+    fn test_units() {
+        assert_eq!(from_str("2d"), Ok(Duration::from_secs(60 * 60 * 24 * 2)));
     }
 
-    #[test]
-    fn test_saturating_mul() {
-        assert_eq!(from_str("9223372036854775808d"), Ok(Duration::MAX));
+    #[test]
+    fn test_saturating_mul() {
+        assert_eq!(from_str("9223372036854775808d"), Ok(Duration::MAX));
     }
 
-    #[test]
-    fn test_error_empty() {
-        assert!(from_str("").is_err());
+    #[test]
+    fn test_error_empty() {
+        assert!(from_str("").is_err());
     }
 
-    #[test]
-    fn test_error_invalid_unit() {
-        assert!(from_str("123X").is_err());
+    #[test]
+    fn test_error_invalid_unit() {
+        assert!(from_str("123X").is_err());
     }
 
-    #[test]
-    fn test_error_invalid_magnitude() {
-        assert!(from_str("12abc3s").is_err());
+    #[test]
+    fn test_error_invalid_magnitude() {
+        assert!(from_str("12abc3s").is_err());
     }
 
-    #[test]
-    fn test_negative() {
-        assert!(from_str("-1").is_err());
+    #[test]
+    fn test_negative() {
+        assert!(from_str("-1").is_err());
     }
 
-    /// Test that capital letters are not allowed in suffixes.
-    #[test]
-    fn test_no_capital_letters() {
-        assert!(from_str("1S").is_err());
-        assert!(from_str("1M").is_err());
-        assert!(from_str("1H").is_err());
-        assert!(from_str("1D").is_err());
+    /// Test that capital letters are not allowed in suffixes.
+    #[test]
+    fn test_no_capital_letters() {
+        assert!(from_str("1S").is_err());
+        assert!(from_str("1M").is_err());
+        assert!(from_str("1H").is_err());
+        assert!(from_str("1D").is_err());
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uucore_procs/lib.rs.html b/dev/src/uucore_procs/lib.rs.html index 782a06d8e..d54bb4ace 100644 --- a/dev/src/uucore_procs/lib.rs.html +++ b/dev/src/uucore_procs/lib.rs.html @@ -1,4 +1,4 @@ -lib.rs - source
1
+lib.rs - source
1
 2
 3
 4
@@ -244,191 +244,191 @@
 244
 245
 246
-
// Copyright (C) ~ Roy Ivy III <rivy.dev@gmail.com>; MIT license
+
// Copyright (C) ~ Roy Ivy III <rivy.dev@gmail.com>; MIT license
 
-extern crate proc_macro;
-use std::{fs::File, io::Read, path::PathBuf};
+extern crate proc_macro;
+use std::{fs::File, io::Read, path::PathBuf};
 
-use proc_macro::{Literal, TokenStream, TokenTree};
-use quote::quote;
+use proc_macro::{Literal, TokenStream, TokenTree};
+use quote::quote;
 
-//## rust proc-macro background info
-//* ref: <https://dev.to/naufraghi/procedural-macro-in-rust-101-k3f> @@ <http://archive.is/Vbr5e>
-//* ref: [path construction from LitStr](https://oschwald.github.io/maxminddb-rust/syn/struct.LitStr.html) @@ <http://archive.is/8YDua>
+//## rust proc-macro background info
+//* ref: <https://dev.to/naufraghi/procedural-macro-in-rust-101-k3f> @@ <http://archive.is/Vbr5e>
+//* ref: [path construction from LitStr](https://oschwald.github.io/maxminddb-rust/syn/struct.LitStr.html) @@ <http://archive.is/8YDua>
 
-#[proc_macro_attribute]
-pub fn main(_args: TokenStream, stream: TokenStream) -> TokenStream {
-    let stream = proc_macro2::TokenStream::from(stream);
+#[proc_macro_attribute]
+pub fn main(_args: TokenStream, stream: TokenStream) -> TokenStream {
+    let stream = proc_macro2::TokenStream::from(stream);
 
-    let new = quote!(
-        pub fn uumain(args: impl uucore::Args) -> i32 {
-            #stream
-            let result = uumain(args);
-            match result {
-                Ok(()) => uucore::error::get_exit_code(),
-                Err(e) => {
-                    let s = format!("{}", e);
-                    if s != "" {
-                        uucore::show_error!("{}", s);
+    let new = quote!(
+        pub fn uumain(args: impl uucore::Args) -> i32 {
+            #stream
+            let result = uumain(args);
+            match result {
+                Ok(()) => uucore::error::get_exit_code(),
+                Err(e) => {
+                    let s = format!("{}", e);
+                    if s != "" {
+                        uucore::show_error!("{}", s);
                     }
-                    if e.usage() {
-                        eprintln!("Try '{} --help' for more information.", uucore::execution_phrase());
+                    if e.usage() {
+                        eprintln!("Try '{} --help' for more information.", uucore::execution_phrase());
                     }
-                    e.code()
+                    e.code()
                 }
             }
         }
     );
 
-    TokenStream::from(new)
+    TokenStream::from(new)
 }
 
-/// Get the usage from the "Usage" section in the help file.
-///
-/// The usage is assumed to be surrounded by markdown code fences. It may span
-/// multiple lines. The first word of each line is assumed to be the name of
-/// the util and is replaced by "{}" so that the output of this function can be
-/// used with `uucore::format_usage`.
-#[proc_macro]
-pub fn help_usage(input: TokenStream) -> TokenStream {
-    let input: Vec<TokenTree> = input.into_iter().collect();
-    let filename = get_argument(&input, 0, "filename");
-    let text: String = parse_usage(&parse_help("usage", &filename));
-    TokenTree::Literal(Literal::string(&text)).into()
+/// Get the usage from the "Usage" section in the help file.
+///
+/// The usage is assumed to be surrounded by markdown code fences. It may span
+/// multiple lines. The first word of each line is assumed to be the name of
+/// the util and is replaced by "{}" so that the output of this function can be
+/// used with `uucore::format_usage`.
+#[proc_macro]
+pub fn help_usage(input: TokenStream) -> TokenStream {
+    let input: Vec<TokenTree> = input.into_iter().collect();
+    let filename = get_argument(&input, 0, "filename");
+    let text: String = parse_usage(&parse_help("usage", &filename));
+    TokenTree::Literal(Literal::string(&text)).into()
 }
 
-/// Reads a section from a file of the util as a `str` literal.
-///
-/// It reads from the file specified as the second argument, relative to the
-/// crate root. The contents of this file are read verbatim, without parsing or
-/// escaping. The name of the help file should match the name of the util.
-/// I.e. numfmt should have a file called `numfmt.md`. By convention, the file
-/// should start with a top-level section with the name of the util. The other
-/// sections must start with 2 `#` characters. Capitalization of the sections
-/// does not matter. Leading and trailing whitespace of each section will be
-/// removed.
-///
-/// Example:
-/// ```md
-/// # numfmt
-/// ## About
-/// Convert numbers from/to human-readable strings
-///
-/// ## Long help
-/// This text will be the long help
-/// ```
-///
-/// ```rust,ignore
-/// help_section!("about", "numfmt.md");
-/// ```
-#[proc_macro]
-pub fn help_section(input: TokenStream) -> TokenStream {
-    let input: Vec<TokenTree> = input.into_iter().collect();
-    let section = get_argument(&input, 0, "section");
-    let filename = get_argument(&input, 1, "filename");
-    let text = parse_help(&section, &filename);
-    TokenTree::Literal(Literal::string(&text)).into()
+/// Reads a section from a file of the util as a `str` literal.
+///
+/// It reads from the file specified as the second argument, relative to the
+/// crate root. The contents of this file are read verbatim, without parsing or
+/// escaping. The name of the help file should match the name of the util.
+/// I.e. numfmt should have a file called `numfmt.md`. By convention, the file
+/// should start with a top-level section with the name of the util. The other
+/// sections must start with 2 `#` characters. Capitalization of the sections
+/// does not matter. Leading and trailing whitespace of each section will be
+/// removed.
+///
+/// Example:
+/// ```md
+/// # numfmt
+/// ## About
+/// Convert numbers from/to human-readable strings
+///
+/// ## Long help
+/// This text will be the long help
+/// ```
+///
+/// ```rust,ignore
+/// help_section!("about", "numfmt.md");
+/// ```
+#[proc_macro]
+pub fn help_section(input: TokenStream) -> TokenStream {
+    let input: Vec<TokenTree> = input.into_iter().collect();
+    let section = get_argument(&input, 0, "section");
+    let filename = get_argument(&input, 1, "filename");
+    let text = parse_help(&section, &filename);
+    TokenTree::Literal(Literal::string(&text)).into()
 }
 
-/// Get an argument from the input vector of `TokenTree`.
-///
-/// Asserts that the argument is a string literal and returns the string value,
-/// otherwise it panics with an error.
-fn get_argument(input: &[TokenTree], index: usize, name: &str) -> String {
-    // Multiply by two to ignore the `','` in between the arguments
-    let string = match &input.get(index * 2) {
-        Some(TokenTree::Literal(lit)) => lit.to_string(),
-        Some(_) => panic!("Argument {} should be a string literal.", index),
-        None => panic!("Missing argument at index {} for {}", index, name),
+/// Get an argument from the input vector of `TokenTree`.
+///
+/// Asserts that the argument is a string literal and returns the string value,
+/// otherwise it panics with an error.
+fn get_argument(input: &[TokenTree], index: usize, name: &str) -> String {
+    // Multiply by two to ignore the `','` in between the arguments
+    let string = match &input.get(index * 2) {
+        Some(TokenTree::Literal(lit)) => lit.to_string(),
+        Some(_) => panic!("Argument {} should be a string literal.", index),
+        None => panic!("Missing argument at index {} for {}", index, name),
     };
 
-    string
-        .parse::<String>()
-        .unwrap()
-        .strip_prefix('"')
-        .unwrap()
-        .strip_suffix('"')
-        .unwrap()
-        .to_string()
+    string
+        .parse::<String>()
+        .unwrap()
+        .strip_prefix('"')
+        .unwrap()
+        .strip_suffix('"')
+        .unwrap()
+        .to_string()
 }
 
-/// Read the help file and extract a section
-fn parse_help(section: &str, filename: &str) -> String {
-    let section = section.to_lowercase();
-    let section = section.trim_matches('"');
-    let mut content = String::new();
-    let mut path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
+/// Read the help file and extract a section
+fn parse_help(section: &str, filename: &str) -> String {
+    let section = section.to_lowercase();
+    let section = section.trim_matches('"');
+    let mut content = String::new();
+    let mut path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
 
-    path.push(filename);
+    path.push(filename);
 
-    File::open(path)
-        .unwrap()
-        .read_to_string(&mut content)
-        .unwrap();
+    File::open(path)
+        .unwrap()
+        .read_to_string(&mut content)
+        .unwrap();
 
-    parse_help_section(section, &content)
+    parse_help_section(section, &content)
 }
 
-/// Get a single section from content
-///
-/// The section must be a second level section (i.e. start with `##`).
-fn parse_help_section(section: &str, content: &str) -> String {
-    fn is_section_header(line: &str, section: &str) -> bool {
-        line.strip_prefix("##")
-            .map_or(false, |l| l.trim().to_lowercase() == section)
+/// Get a single section from content
+///
+/// The section must be a second level section (i.e. start with `##`).
+fn parse_help_section(section: &str, content: &str) -> String {
+    fn is_section_header(line: &str, section: &str) -> bool {
+        line.strip_prefix("##")
+            .map_or(false, |l| l.trim().to_lowercase() == section)
     }
 
-    // We cannot distinguish between an empty or non-existing section below,
-    // so we do a quick test to check whether the section exists to provide
-    // a nice error message.
-    if content.lines().all(|l| !is_section_header(l, section)) {
+    // We cannot distinguish between an empty or non-existing section below,
+    // so we do a quick test to check whether the section exists to provide
+    // a nice error message.
+    if content.lines().all(|l| !is_section_header(l, section)) {
         panic!(
             "The section '{}' could not be found in the help file. Maybe it is spelled wrong?",
-            section
+            section
         )
     }
 
-    content
-        .lines()
-        .skip_while(|&l| !is_section_header(l, section))
-        .skip(1)
-        .take_while(|l| !l.starts_with("##"))
-        .collect::<Vec<_>>()
-        .join("\n")
-        .trim()
-        .to_string()
+    content
+        .lines()
+        .skip_while(|&l| !is_section_header(l, section))
+        .skip(1)
+        .take_while(|l| !l.starts_with("##"))
+        .collect::<Vec<_>>()
+        .join("\n")
+        .trim()
+        .to_string()
 }
 
-/// Parses a markdown code block into a usage string
-///
-/// The code fences are removed and the name of the util is replaced
-/// with `{}` so that it can be replaced with the appropriate name
-/// at runtime.
-fn parse_usage(content: &str) -> String {
-    content
-        .strip_suffix("```")
-        .unwrap()
-        .lines()
-        .skip(1) // Skip the "```" of markdown syntax
-        .map(|l| {
-            // Replace the util name (assumed to be the first word) with "{}"
-            // to be replaced with the runtime value later.
-            if let Some((_util, args)) = l.split_once(' ') {
-                format!("{{}} {}\n", args)
-            } else {
-                "{}\n".to_string()
+/// Parses a markdown code block into a usage string
+///
+/// The code fences are removed and the name of the util is replaced
+/// with `{}` so that it can be replaced with the appropriate name
+/// at runtime.
+fn parse_usage(content: &str) -> String {
+    content
+        .strip_suffix("```")
+        .unwrap()
+        .lines()
+        .skip(1) // Skip the "```" of markdown syntax
+        .map(|l| {
+            // Replace the util name (assumed to be the first word) with "{}"
+            // to be replaced with the runtime value later.
+            if let Some((_util, args)) = l.split_once(' ') {
+                format!("{{}} {}\n", args)
+            } else {
+                "{}\n".to_string()
             }
         })
-        .collect()
+        .collect()
 }
 
-#[cfg(test)]
-mod tests {
-    use super::{parse_help_section, parse_usage};
+#[cfg(test)]
+mod tests {
+    use super::{parse_help_section, parse_usage};
 
-    #[test]
-    fn section_parsing() {
-        let input = "\
+    #[test]
+    fn section_parsing() {
+        let input = "\
             # ls\n\
             ## some section\n\
             This is some section\n\
@@ -438,19 +438,19 @@
             with multiple lines\n";
 
         assert_eq!(
-            parse_help_section("some section", input),
-            "This is some section"
-        );
+            parse_help_section("some section", input),
+            "This is some section"
+        );
         assert_eq!(
-            parse_help_section("another section", input),
-            "This is the other section\nwith multiple lines"
-        );
+            parse_help_section("another section", input),
+            "This is the other section\nwith multiple lines"
+        );
     }
 
-    #[test]
-    #[should_panic]
-    fn section_parsing_panic() {
-        let input = "\
+    #[test]
+    #[should_panic]
+    fn section_parsing_panic() {
+        let input = "\
             # ls\n\
             ## some section\n\
             This is some section\n\
@@ -458,12 +458,12 @@
             ## ANOTHER SECTION
             This is the other section\n\
             with multiple lines\n";
-        parse_help_section("non-existent section", input);
+        parse_help_section("non-existent section", input);
     }
 
-    #[test]
-    fn usage_parsing() {
-        let input = "\
+    #[test]
+    fn usage_parsing() {
+        let input = "\
             # ls\n\
             ## Usage\n\
             ```\n\
@@ -476,19 +476,19 @@
             This is the other section\n\
             with multiple lines\n";
 
-        assert_eq!(parse_usage(&parse_help_section("usage", input)), "{} -l",);
+        assert_eq!(parse_usage(&parse_help_section("usage", input)), "{} -l",);
 
         assert_eq!(
-            parse_usage(
+            parse_usage(
                 "\
                 ```\n\
                 util [some] [options]\n\
                 ```\
-                "
-            ),
-            "{} [some] [options]"
-        );
+                "
+            ),
+            "{} [some] [options]"
+        );
     }
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/uudoc/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-08c28f92bbf77c3a/out/uutils_map.rs.html b/dev/src/uudoc/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-08c28f92bbf77c3a/out/uutils_map.rs.html deleted file mode 100644 index 3d4244881..000000000 --- a/dev/src/uudoc/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-08c28f92bbf77c3a/out/uutils_map.rs.html +++ /dev/null @@ -1,310 +0,0 @@ -uutils_map.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-
type UtilityMap<T> = phf::Map<&'static str, (fn(T) -> i32, fn() -> Command)>;
-
-fn util_map<T: uucore::Args>() -> UtilityMap<T> {
-::phf::Map {
-    key: 12913932095322966823,
-    disps: &[
-        (0, 115),
-        (0, 9),
-        (1, 0),
-        (0, 16),
-        (0, 23),
-        (11, 18),
-        (0, 3),
-        (7, 37),
-        (0, 114),
-        (0, 81),
-        (1, 35),
-        (0, 46),
-        (0, 61),
-        (1, 54),
-        (0, 2),
-        (3, 41),
-        (0, 2),
-        (1, 97),
-        (4, 50),
-        (2, 7),
-        (4, 12),
-        (2, 55),
-        (0, 100),
-        (27, 53),
-    ],
-    entries: &[
-        ("printenv", (printenv::uumain, printenv::uu_app)),
-        ("expand", (expand::uumain, expand::uu_app)),
-        ("yes", (yes::uumain, yes::uu_app)),
-        ("rmdir", (rmdir::uumain, rmdir::uu_app)),
-        ("mknod", (mknod::uumain, mknod::uu_app)),
-        ("truncate", (truncate::uumain, truncate::uu_app)),
-        ("pinky", (pinky::uumain, pinky::uu_app)),
-        ("pr", (pr::uumain, pr::uu_app)),
-        ("uptime", (uptime::uumain, uptime::uu_app)),
-        ("nohup", (nohup::uumain, nohup::uu_app)),
-        ("base32", (base32::uumain, base32::uu_app)),
-        ("stdbuf", (stdbuf::uumain, stdbuf::uu_app)),
-        ("chgrp", (chgrp::uumain, chgrp::uu_app)),
-        ("stat", (stat::uumain, stat::uu_app)),
-        ("hostid", (hostid::uumain, hostid::uu_app)),
-        ("nice", (nice::uumain, nice::uu_app)),
-        ("mv", (mv::uumain, mv::uu_app)),
-        ("cat", (cat::uumain, cat::uu_app)),
-        ("fmt", (fmt::uumain, fmt::uu_app)),
-        ("sha1sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("cp", (cp::uumain, cp::uu_app)),
-        ("unlink", (unlink::uumain, unlink::uu_app)),
-        ("more", (more::uumain, more::uu_app)),
-        ("rm", (rm::uumain, rm::uu_app)),
-        ("sha256sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("dd", (dd::uumain, dd::uu_app)),
-        ("tr", (tr::uumain, tr::uu_app)),
-        ("false", (r#false::uumain, r#false::uu_app)),
-        ("od", (od::uumain, od::uu_app)),
-        ("factor", (factor::uumain, factor::uu_app)),
-        ("link", (link::uumain, link::uu_app)),
-        ("fold", (fold::uumain, fold::uu_app)),
-        ("touch", (touch::uumain, touch::uu_app)),
-        ("hashsum", (hashsum::uumain, hashsum::uu_app_custom)),
-        ("logname", (logname::uumain, logname::uu_app)),
-        ("ls", (ls::uumain, ls::uu_app)),
-        ("who", (who::uumain, who::uu_app)),
-        ("dir", (dir::uumain, dir::uu_app)),
-        ("cksum", (cksum::uumain, cksum::uu_app)),
-        ("base64", (base64::uumain, base64::uu_app)),
-        ("uname", (uname::uumain, uname::uu_app)),
-        ("vdir", (vdir::uumain, vdir::uu_app)),
-        ("split", (split::uumain, split::uu_app)),
-        ("sha3sum", (hashsum::uumain, hashsum::uu_app_bits)),
-        ("seq", (seq::uumain, seq::uu_app)),
-        ("realpath", (realpath::uumain, realpath::uu_app)),
-        ("kill", (kill::uumain, kill::uu_app)),
-        ("chroot", (chroot::uumain, chroot::uu_app)),
-        ("unexpand", (unexpand::uumain, unexpand::uu_app)),
-        ("sha512sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("chown", (chown::uumain, chown::uu_app)),
-        ("env", (env::uumain, env::uu_app)),
-        ("relpath", (relpath::uumain, relpath::uu_app)),
-        ("groups", (groups::uumain, groups::uu_app)),
-        ("sha224sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("shake256sum", (hashsum::uumain, hashsum::uu_app_bits)),
-        ("users", (users::uumain, users::uu_app)),
-        ("ln", (ln::uumain, ln::uu_app)),
-        ("whoami", (whoami::uumain, whoami::uu_app)),
-        ("timeout", (timeout::uumain, timeout::uu_app)),
-        ("runcon", (runcon::uumain, runcon::uu_app)),
-        ("du", (du::uumain, du::uu_app)),
-        ("id", (id::uumain, id::uu_app)),
-        ("wc", (wc::uumain, wc::uu_app)),
-        ("stty", (stty::uumain, stty::uu_app)),
-        ("basenc", (basenc::uumain, basenc::uu_app)),
-        ("sum", (sum::uumain, sum::uu_app)),
-        ("md5sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("sha3-512sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("head", (head::uumain, head::uu_app)),
-        ("cut", (cut::uumain, cut::uu_app)),
-        ("comm", (comm::uumain, comm::uu_app)),
-        ("readlink", (readlink::uumain, readlink::uu_app)),
-        ("arch", (arch::uumain, arch::uu_app)),
-        ("ptx", (ptx::uumain, ptx::uu_app)),
-        ("tee", (tee::uumain, tee::uu_app)),
-        ("hostname", (hostname::uumain, hostname::uu_app)),
-        ("true", (r#true::uumain, r#true::uu_app)),
-        ("pwd", (pwd::uumain, pwd::uu_app)),
-        ("nproc", (nproc::uumain, nproc::uu_app)),
-        ("tail", (tail::uumain, tail::uu_app)),
-        ("[", (uu_test::uumain, uu_test::uu_app)),
-        ("chcon", (chcon::uumain, chcon::uu_app)),
-        ("dirname", (dirname::uumain, dirname::uu_app)),
-        ("dircolors", (dircolors::uumain, dircolors::uu_app)),
-        ("printf", (printf::uumain, printf::uu_app)),
-        ("shred", (shred::uumain, shred::uu_app)),
-        ("sha3-256sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("shuf", (shuf::uumain, shuf::uu_app)),
-        ("tty", (tty::uumain, tty::uu_app)),
-        ("expr", (expr::uumain, expr::uu_app)),
-        ("pathchk", (pathchk::uumain, pathchk::uu_app)),
-        ("basename", (basename::uumain, basename::uu_app)),
-        ("numfmt", (numfmt::uumain, numfmt::uu_app)),
-        ("df", (df::uumain, df::uu_app)),
-        ("join", (join::uumain, join::uu_app)),
-        ("nl", (nl::uumain, nl::uu_app)),
-        ("sha3-224sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("mkfifo", (mkfifo::uumain, mkfifo::uu_app)),
-        ("shake128sum", (hashsum::uumain, hashsum::uu_app_bits)),
-        ("b2sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("install", (install::uumain, install::uu_app)),
-        ("chmod", (chmod::uumain, chmod::uu_app)),
-        ("sleep", (sleep::uumain, sleep::uu_app)),
-        ("date", (date::uumain, date::uu_app)),
-        ("csplit", (csplit::uumain, csplit::uu_app)),
-        ("mkdir", (mkdir::uumain, mkdir::uu_app)),
-        ("sync", (sync::uumain, sync::uu_app)),
-        ("b3sum", (hashsum::uumain, hashsum::uu_app_b3sum)),
-        ("mktemp", (mktemp::uumain, mktemp::uu_app)),
-        ("tsort", (tsort::uumain, tsort::uu_app)),
-        ("tac", (tac::uumain, tac::uu_app)),
-        ("test", (uu_test::uumain, uu_test::uu_app)),
-        ("paste", (paste::uumain, paste::uu_app)),
-        ("sort", (sort::uumain, sort::uu_app)),
-        ("echo", (echo::uumain, echo::uu_app)),
-        ("sha384sum", (hashsum::uumain, hashsum::uu_app_common)),
-        ("uniq", (uniq::uumain, uniq::uu_app)),
-        ("sha3-384sum", (hashsum::uumain, hashsum::uu_app_common)),
-    ],
-}
-}
-
-
\ No newline at end of file diff --git a/dev/src/uudoc/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-602414eb6d83e2f7/out/uutils_map.rs.html b/dev/src/uudoc/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-602414eb6d83e2f7/out/uutils_map.rs.html new file mode 100644 index 000000000..e152ace96 --- /dev/null +++ b/dev/src/uudoc/home/runner/work/uutils.github.io/uutils.github.io/coreutils/target/debug/build/coreutils-602414eb6d83e2f7/out/uutils_map.rs.html @@ -0,0 +1,310 @@ +uutils_map.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+
type UtilityMap<T> = phf::Map<&'static str, (fn(T) -> i32, fn() -> Command)>;
+
+fn util_map<T: uucore::Args>() -> UtilityMap<T> {
+::phf::Map {
+    key: 12913932095322966823,
+    disps: &[
+        (0, 115),
+        (0, 9),
+        (1, 0),
+        (0, 16),
+        (0, 23),
+        (11, 18),
+        (0, 3),
+        (7, 37),
+        (0, 114),
+        (0, 81),
+        (1, 35),
+        (0, 46),
+        (0, 61),
+        (1, 54),
+        (0, 2),
+        (3, 41),
+        (0, 2),
+        (1, 97),
+        (4, 50),
+        (2, 7),
+        (4, 12),
+        (2, 55),
+        (0, 100),
+        (27, 53),
+    ],
+    entries: &[
+        ("printenv", (printenv::uumain, printenv::uu_app)),
+        ("expand", (expand::uumain, expand::uu_app)),
+        ("yes", (yes::uumain, yes::uu_app)),
+        ("rmdir", (rmdir::uumain, rmdir::uu_app)),
+        ("mknod", (mknod::uumain, mknod::uu_app)),
+        ("truncate", (truncate::uumain, truncate::uu_app)),
+        ("pinky", (pinky::uumain, pinky::uu_app)),
+        ("pr", (pr::uumain, pr::uu_app)),
+        ("uptime", (uptime::uumain, uptime::uu_app)),
+        ("nohup", (nohup::uumain, nohup::uu_app)),
+        ("base32", (base32::uumain, base32::uu_app)),
+        ("stdbuf", (stdbuf::uumain, stdbuf::uu_app)),
+        ("chgrp", (chgrp::uumain, chgrp::uu_app)),
+        ("stat", (stat::uumain, stat::uu_app)),
+        ("hostid", (hostid::uumain, hostid::uu_app)),
+        ("nice", (nice::uumain, nice::uu_app)),
+        ("mv", (mv::uumain, mv::uu_app)),
+        ("cat", (cat::uumain, cat::uu_app)),
+        ("fmt", (fmt::uumain, fmt::uu_app)),
+        ("sha1sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("cp", (cp::uumain, cp::uu_app)),
+        ("unlink", (unlink::uumain, unlink::uu_app)),
+        ("more", (more::uumain, more::uu_app)),
+        ("rm", (rm::uumain, rm::uu_app)),
+        ("sha256sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("dd", (dd::uumain, dd::uu_app)),
+        ("tr", (tr::uumain, tr::uu_app)),
+        ("false", (r#false::uumain, r#false::uu_app)),
+        ("od", (od::uumain, od::uu_app)),
+        ("factor", (factor::uumain, factor::uu_app)),
+        ("link", (link::uumain, link::uu_app)),
+        ("fold", (fold::uumain, fold::uu_app)),
+        ("touch", (touch::uumain, touch::uu_app)),
+        ("hashsum", (hashsum::uumain, hashsum::uu_app_custom)),
+        ("logname", (logname::uumain, logname::uu_app)),
+        ("ls", (ls::uumain, ls::uu_app)),
+        ("who", (who::uumain, who::uu_app)),
+        ("dir", (dir::uumain, dir::uu_app)),
+        ("cksum", (cksum::uumain, cksum::uu_app)),
+        ("base64", (base64::uumain, base64::uu_app)),
+        ("uname", (uname::uumain, uname::uu_app)),
+        ("vdir", (vdir::uumain, vdir::uu_app)),
+        ("split", (split::uumain, split::uu_app)),
+        ("sha3sum", (hashsum::uumain, hashsum::uu_app_bits)),
+        ("seq", (seq::uumain, seq::uu_app)),
+        ("realpath", (realpath::uumain, realpath::uu_app)),
+        ("kill", (kill::uumain, kill::uu_app)),
+        ("chroot", (chroot::uumain, chroot::uu_app)),
+        ("unexpand", (unexpand::uumain, unexpand::uu_app)),
+        ("sha512sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("chown", (chown::uumain, chown::uu_app)),
+        ("env", (env::uumain, env::uu_app)),
+        ("relpath", (relpath::uumain, relpath::uu_app)),
+        ("groups", (groups::uumain, groups::uu_app)),
+        ("sha224sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("shake256sum", (hashsum::uumain, hashsum::uu_app_bits)),
+        ("users", (users::uumain, users::uu_app)),
+        ("ln", (ln::uumain, ln::uu_app)),
+        ("whoami", (whoami::uumain, whoami::uu_app)),
+        ("timeout", (timeout::uumain, timeout::uu_app)),
+        ("runcon", (runcon::uumain, runcon::uu_app)),
+        ("du", (du::uumain, du::uu_app)),
+        ("id", (id::uumain, id::uu_app)),
+        ("wc", (wc::uumain, wc::uu_app)),
+        ("stty", (stty::uumain, stty::uu_app)),
+        ("basenc", (basenc::uumain, basenc::uu_app)),
+        ("sum", (sum::uumain, sum::uu_app)),
+        ("md5sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("sha3-512sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("head", (head::uumain, head::uu_app)),
+        ("cut", (cut::uumain, cut::uu_app)),
+        ("comm", (comm::uumain, comm::uu_app)),
+        ("readlink", (readlink::uumain, readlink::uu_app)),
+        ("arch", (arch::uumain, arch::uu_app)),
+        ("ptx", (ptx::uumain, ptx::uu_app)),
+        ("tee", (tee::uumain, tee::uu_app)),
+        ("hostname", (hostname::uumain, hostname::uu_app)),
+        ("true", (r#true::uumain, r#true::uu_app)),
+        ("pwd", (pwd::uumain, pwd::uu_app)),
+        ("nproc", (nproc::uumain, nproc::uu_app)),
+        ("tail", (tail::uumain, tail::uu_app)),
+        ("[", (uu_test::uumain, uu_test::uu_app)),
+        ("chcon", (chcon::uumain, chcon::uu_app)),
+        ("dirname", (dirname::uumain, dirname::uu_app)),
+        ("dircolors", (dircolors::uumain, dircolors::uu_app)),
+        ("printf", (printf::uumain, printf::uu_app)),
+        ("shred", (shred::uumain, shred::uu_app)),
+        ("sha3-256sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("shuf", (shuf::uumain, shuf::uu_app)),
+        ("tty", (tty::uumain, tty::uu_app)),
+        ("expr", (expr::uumain, expr::uu_app)),
+        ("pathchk", (pathchk::uumain, pathchk::uu_app)),
+        ("basename", (basename::uumain, basename::uu_app)),
+        ("numfmt", (numfmt::uumain, numfmt::uu_app)),
+        ("df", (df::uumain, df::uu_app)),
+        ("join", (join::uumain, join::uu_app)),
+        ("nl", (nl::uumain, nl::uu_app)),
+        ("sha3-224sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("mkfifo", (mkfifo::uumain, mkfifo::uu_app)),
+        ("shake128sum", (hashsum::uumain, hashsum::uu_app_bits)),
+        ("b2sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("install", (install::uumain, install::uu_app)),
+        ("chmod", (chmod::uumain, chmod::uu_app)),
+        ("sleep", (sleep::uumain, sleep::uu_app)),
+        ("date", (date::uumain, date::uu_app)),
+        ("csplit", (csplit::uumain, csplit::uu_app)),
+        ("mkdir", (mkdir::uumain, mkdir::uu_app)),
+        ("sync", (sync::uumain, sync::uu_app)),
+        ("b3sum", (hashsum::uumain, hashsum::uu_app_b3sum)),
+        ("mktemp", (mktemp::uumain, mktemp::uu_app)),
+        ("tsort", (tsort::uumain, tsort::uu_app)),
+        ("tac", (tac::uumain, tac::uu_app)),
+        ("test", (uu_test::uumain, uu_test::uu_app)),
+        ("paste", (paste::uumain, paste::uu_app)),
+        ("sort", (sort::uumain, sort::uu_app)),
+        ("echo", (echo::uumain, echo::uu_app)),
+        ("sha384sum", (hashsum::uumain, hashsum::uu_app_common)),
+        ("uniq", (uniq::uumain, uniq::uu_app)),
+        ("sha3-384sum", (hashsum::uumain, hashsum::uu_app_common)),
+    ],
+}
+}
+
+
\ No newline at end of file diff --git a/dev/src/uudoc/uudoc.rs.html b/dev/src/uudoc/uudoc.rs.html index 461225630..44b6832a9 100644 --- a/dev/src/uudoc/uudoc.rs.html +++ b/dev/src/uudoc/uudoc.rs.html @@ -1,4 +1,4 @@ -uudoc.rs - source
1
+uudoc.rs - source
1
 2
 3
 4
@@ -301,27 +301,27 @@
 301
 302
 303
-
// This file is part of the uutils coreutils package.
-//
-// For the full copyright and license information, please view the LICENSE
-// file that was distributed with this source code.
-// spell-checker:ignore tldr
+
// This file is part of the uutils coreutils package.
+//
+// For the full copyright and license information, please view the LICENSE
+// file that was distributed with this source code.
+// spell-checker:ignore tldr
 
-use clap::Command;
-use std::collections::HashMap;
-use std::ffi::OsString;
-use std::fs::File;
-use std::io::{self, Read, Seek, Write};
-use zip::ZipArchive;
+use clap::Command;
+use std::collections::HashMap;
+use std::ffi::OsString;
+use std::fs::File;
+use std::io::{self, Read, Seek, Write};
+use zip::ZipArchive;
 
 include!(concat!(env!("OUT_DIR"), "/uutils_map.rs"));
 
-fn main() -> io::Result<()> {
-    let mut tldr_zip = File::open("docs/tldr.zip")
-        .ok()
-        .and_then(|f| ZipArchive::new(f).ok());
+fn main() -> io::Result<()> {
+    let mut tldr_zip = File::open("docs/tldr.zip")
+        .ok()
+        .and_then(|f| ZipArchive::new(f).ok());
 
-    if tldr_zip.is_none() {
+    if tldr_zip.is_none() {
         println!("Warning: No tldr archive found, so the documentation will not include examples.");
         println!("To include examples in the documentation, download the tldr archive and put it in the docs/ folder.");
         println!();
@@ -329,17 +329,17 @@
         println!();
     }
 
-    let utils = util_map::<Box<dyn Iterator<Item = OsString>>>();
-    match std::fs::create_dir("docs/src/utils/") {
-        Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => Ok(()),
-        x => x,
+    let utils = util_map::<Box<dyn Iterator<Item = OsString>>>();
+    match std::fs::create_dir("docs/src/utils/") {
+        Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => Ok(()),
+        x => x,
     }?;
 
     println!("Writing initial info to SUMMARY.md");
-    let mut summary = File::create("docs/src/SUMMARY.md")?;
+    let mut summary = File::create("docs/src/SUMMARY.md")?;
 
-    let _ = write!(
-        summary,
+    let _ = write!(
+        summary,
         "# Summary\n\
         \n\
         [Introduction](index.md)\n\
@@ -353,256 +353,256 @@
     );
 
     println!("Gathering utils per platform");
-    let utils_per_platform = {
-        let mut map = HashMap::new();
-        for platform in ["unix", "macos", "windows"] {
-            let platform_utils: Vec<String> = String::from_utf8(
-                std::process::Command::new("./util/show-utils.sh")
-                    .arg(format!("--features=feat_os_{}", platform))
-                    .output()?
-                    .stdout,
+    let utils_per_platform = {
+        let mut map = HashMap::new();
+        for platform in ["unix", "macos", "windows"] {
+            let platform_utils: Vec<String> = String::from_utf8(
+                std::process::Command::new("./util/show-utils.sh")
+                    .arg(format!("--features=feat_os_{}", platform))
+                    .output()?
+                    .stdout,
             )
-            .unwrap()
-            .split(' ')
-            .map(ToString::to_string)
-            .collect();
-            map.insert(platform, platform_utils);
+            .unwrap()
+            .split(' ')
+            .map(ToString::to_string)
+            .collect();
+            map.insert(platform, platform_utils);
         }
 
-        // Linux is a special case because it can support selinux
-        let platform_utils: Vec<String> = String::from_utf8(
-            std::process::Command::new("./util/show-utils.sh")
-                .arg("--features=feat_os_unix feat_selinux")
-                .output()?
-                .stdout,
+        // Linux is a special case because it can support selinux
+        let platform_utils: Vec<String> = String::from_utf8(
+            std::process::Command::new("./util/show-utils.sh")
+                .arg("--features=feat_os_unix feat_selinux")
+                .output()?
+                .stdout,
         )
-        .unwrap()
-        .split(' ')
-        .map(ToString::to_string)
-        .collect();
-        map.insert("linux", platform_utils);
+        .unwrap()
+        .split(' ')
+        .map(ToString::to_string)
+        .collect();
+        map.insert("linux", platform_utils);
 
-        map
+        map
     };
 
     println!("Writing to utils");
-    let mut utils = utils.entries().collect::<Vec<_>>();
-    utils.sort();
-    for (&name, (_, command)) in utils {
-        if name == "[" {
+    let mut utils = utils.entries().collect::<Vec<_>>();
+    utils.sort();
+    for (&name, (_, command)) in utils {
+        if name == "[" {
             continue;
         }
-        let p = format!("docs/src/utils/{}.md", name);
-        if let Ok(f) = File::create(&p) {
-            MDWriter {
-                w: Box::new(f),
-                command: command(),
-                name,
-                tldr_zip: &mut tldr_zip,
-                utils_per_platform: &utils_per_platform,
+        let p = format!("docs/src/utils/{}.md", name);
+        if let Ok(f) = File::create(&p) {
+            MDWriter {
+                w: Box::new(f),
+                command: command(),
+                name,
+                tldr_zip: &mut tldr_zip,
+                utils_per_platform: &utils_per_platform,
             }
-            .markdown()?;
-            println!("Wrote to '{}'", p);
-        } else {
-            println!("Error writing to {}", p);
+            .markdown()?;
+            println!("Wrote to '{}'", p);
+        } else {
+            println!("Error writing to {}", p);
         }
-        writeln!(summary, "* [{0}](utils/{0}.md)", name)?;
+        writeln!(summary, "* [{0}](utils/{0}.md)", name)?;
     }
     Ok(())
 }
 
-struct MDWriter<'a, 'b> {
-    w: Box<dyn Write>,
-    command: Command,
-    name: &'a str,
-    tldr_zip: &'b mut Option<ZipArchive<File>>,
-    utils_per_platform: &'b HashMap<&'b str, Vec<String>>,
+struct MDWriter<'a, 'b> {
+    w: Box<dyn Write>,
+    command: Command,
+    name: &'a str,
+    tldr_zip: &'b mut Option<ZipArchive<File>>,
+    utils_per_platform: &'b HashMap<&'b str, Vec<String>>,
 }
 
-impl<'a, 'b> MDWriter<'a, 'b> {
-    fn markdown(&mut self) -> io::Result<()> {
-        write!(self.w, "# {}\n\n", self.name)?;
-        self.additional()?;
-        self.usage()?;
-        self.description()?;
-        self.options()?;
-        self.examples()
+impl<'a, 'b> MDWriter<'a, 'b> {
+    fn markdown(&mut self) -> io::Result<()> {
+        write!(self.w, "# {}\n\n", self.name)?;
+        self.additional()?;
+        self.usage()?;
+        self.description()?;
+        self.options()?;
+        self.examples()
     }
 
-    fn additional(&mut self) -> io::Result<()> {
-        writeln!(self.w, "<div class=\"additional\">")?;
-        self.platforms()?;
-        self.version()?;
-        writeln!(self.w, "</div>")
+    fn additional(&mut self) -> io::Result<()> {
+        writeln!(self.w, "<div class=\"additional\">")?;
+        self.platforms()?;
+        self.version()?;
+        writeln!(self.w, "</div>")
     }
 
-    fn platforms(&mut self) -> io::Result<()> {
-        writeln!(self.w, "<div class=\"platforms\">")?;
-        for (feature, icon) in [
+    fn platforms(&mut self) -> io::Result<()> {
+        writeln!(self.w, "<div class=\"platforms\">")?;
+        for (feature, icon) in [
             ("linux", "linux"),
-            // freebsd is disabled for now because mdbook does not use font-awesome 5 yet.
-            // ("unix", "freebsd"),
-            ("macos", "apple"),
+            // freebsd is disabled for now because mdbook does not use font-awesome 5 yet.
+            // ("unix", "freebsd"),
+            ("macos", "apple"),
             ("windows", "windows"),
         ] {
-            if self.name.contains("sum")
-                || self.utils_per_platform[feature]
-                    .iter()
-                    .any(|u| u == self.name)
+            if self.name.contains("sum")
+                || self.utils_per_platform[feature]
+                    .iter()
+                    .any(|u| u == self.name)
             {
-                writeln!(self.w, "<i class=\"fa fa-brands fa-{}\"></i>", icon)?;
+                writeln!(self.w, "<i class=\"fa fa-brands fa-{}\"></i>", icon)?;
             }
         }
-        writeln!(self.w, "</div>")?;
+        writeln!(self.w, "</div>")?;
 
         Ok(())
     }
 
-    fn version(&mut self) -> io::Result<()> {
+    fn version(&mut self) -> io::Result<()> {
         writeln!(
-            self.w,
+            self.w,
             "<div class=\"version\">v{}</div>",
-            self.command.render_version().split_once(' ').unwrap().1
-        )
+            self.command.render_version().split_once(' ').unwrap().1
+        )
     }
 
-    fn usage(&mut self) -> io::Result<()> {
-        writeln!(self.w, "\n```")?;
-        let mut usage: String = self
-            .command
-            .render_usage()
-            .to_string()
-            .lines()
-            .map(|l| l.strip_prefix("Usage:").unwrap_or(l))
-            .map(|l| l.trim())
-            .filter(|l| !l.is_empty())
-            .collect::<Vec<_>>()
-            .join("\n");
-        usage = usage
-            .to_string()
-            .replace(uucore::execution_phrase(), self.name);
-        writeln!(self.w, "{}", usage)?;
-        writeln!(self.w, "```")
+    fn usage(&mut self) -> io::Result<()> {
+        writeln!(self.w, "\n```")?;
+        let mut usage: String = self
+            .command
+            .render_usage()
+            .to_string()
+            .lines()
+            .map(|l| l.strip_prefix("Usage:").unwrap_or(l))
+            .map(|l| l.trim())
+            .filter(|l| !l.is_empty())
+            .collect::<Vec<_>>()
+            .join("\n");
+        usage = usage
+            .to_string()
+            .replace(uucore::execution_phrase(), self.name);
+        writeln!(self.w, "{}", usage)?;
+        writeln!(self.w, "```")
     }
 
-    fn description(&mut self) -> io::Result<()> {
-        if let Some(about) = self
-            .command
-            .get_long_about()
-            .or_else(|| self.command.get_about())
+    fn description(&mut self) -> io::Result<()> {
+        if let Some(about) = self
+            .command
+            .get_long_about()
+            .or_else(|| self.command.get_about())
         {
-            writeln!(self.w, "{}", about)
-        } else {
+            writeln!(self.w, "{}", about)
+        } else {
             Ok(())
         }
     }
 
-    fn examples(&mut self) -> io::Result<()> {
-        if let Some(zip) = self.tldr_zip {
-            let content = if let Some(f) =
-                get_zip_content(zip, &format!("pages/common/{}.md", self.name))
+    fn examples(&mut self) -> io::Result<()> {
+        if let Some(zip) = self.tldr_zip {
+            let content = if let Some(f) =
+                get_zip_content(zip, &format!("pages/common/{}.md", self.name))
             {
-                f
-            } else if let Some(f) = get_zip_content(zip, &format!("pages/linux/{}.md", self.name)) {
-                f
-            } else {
-                return Ok(());
+                f
+            } else if let Some(f) = get_zip_content(zip, &format!("pages/linux/{}.md", self.name)) {
+                f
+            } else {
+                return Ok(());
             };
 
-            writeln!(self.w, "## Examples")?;
-            writeln!(self.w)?;
-            for line in content.lines().skip_while(|l| !l.starts_with('-')) {
-                if let Some(l) = line.strip_prefix("- ") {
-                    writeln!(self.w, "{}", l)?;
-                } else if line.starts_with('`') {
-                    writeln!(self.w, "```shell\n{}\n```", line.trim_matches('`'))?;
-                } else if line.is_empty() {
-                    writeln!(self.w)?;
-                } else {
+            writeln!(self.w, "## Examples")?;
+            writeln!(self.w)?;
+            for line in content.lines().skip_while(|l| !l.starts_with('-')) {
+                if let Some(l) = line.strip_prefix("- ") {
+                    writeln!(self.w, "{}", l)?;
+                } else if line.starts_with('`') {
+                    writeln!(self.w, "```shell\n{}\n```", line.trim_matches('`'))?;
+                } else if line.is_empty() {
+                    writeln!(self.w)?;
+                } else {
                     println!("Not sure what to do with this line:");
-                    println!("{}", line);
+                    println!("{}", line);
                 }
             }
-            writeln!(self.w)?;
+            writeln!(self.w)?;
             writeln!(
-                self.w,
-                "> The examples are provided by the [tldr-pages project](https://tldr.sh) under the [CC BY 4.0 License](https://github.com/tldr-pages/tldr/blob/main/LICENSE.md)."
-            )?;
-            writeln!(self.w, ">")?;
+                self.w,
+                "> The examples are provided by the [tldr-pages project](https://tldr.sh) under the [CC BY 4.0 License](https://github.com/tldr-pages/tldr/blob/main/LICENSE.md)."
+            )?;
+            writeln!(self.w, ">")?;
             writeln!(
-                self.w,
-                "> Please note that, as uutils is a work in progress, some examples might fail."
-            )?;
+                self.w,
+                "> Please note that, as uutils is a work in progress, some examples might fail."
+            )?;
         }
         Ok(())
     }
 
-    fn options(&mut self) -> io::Result<()> {
-        writeln!(self.w, "<h2>Options</h2>")?;
-        write!(self.w, "<dl>")?;
-        for arg in self.command.get_arguments() {
-            write!(self.w, "<dt>")?;
-            let mut first = true;
-            for l in arg.get_long_and_visible_aliases().unwrap_or_default() {
-                if !first {
-                    write!(self.w, ", ")?;
-                } else {
-                    first = false;
+    fn options(&mut self) -> io::Result<()> {
+        writeln!(self.w, "<h2>Options</h2>")?;
+        write!(self.w, "<dl>")?;
+        for arg in self.command.get_arguments() {
+            write!(self.w, "<dt>")?;
+            let mut first = true;
+            for l in arg.get_long_and_visible_aliases().unwrap_or_default() {
+                if !first {
+                    write!(self.w, ", ")?;
+                } else {
+                    first = false;
                 }
-                write!(self.w, "<code>")?;
-                write!(self.w, "--{}", l)?;
-                if let Some(names) = arg.get_value_names() {
+                write!(self.w, "<code>")?;
+                write!(self.w, "--{}", l)?;
+                if let Some(names) = arg.get_value_names() {
                     write!(
-                        self.w,
+                        self.w,
                         "={}",
-                        names
-                            .iter()
-                            .map(|x| format!("&lt;{}&gt;", x))
-                            .collect::<Vec<_>>()
-                            .join(" ")
+                        names
+                            .iter()
+                            .map(|x| format!("&lt;{}&gt;", x))
+                            .collect::<Vec<_>>()
+                            .join(" ")
                     )?;
                 }
-                write!(self.w, "</code>")?;
+                write!(self.w, "</code>")?;
             }
-            for s in arg.get_short_and_visible_aliases().unwrap_or_default() {
-                if !first {
-                    write!(self.w, ", ")?;
-                } else {
-                    first = false;
+            for s in arg.get_short_and_visible_aliases().unwrap_or_default() {
+                if !first {
+                    write!(self.w, ", ")?;
+                } else {
+                    first = false;
                 }
-                write!(self.w, "<code>")?;
-                write!(self.w, "-{}", s)?;
-                if let Some(names) = arg.get_value_names() {
+                write!(self.w, "<code>")?;
+                write!(self.w, "-{}", s)?;
+                if let Some(names) = arg.get_value_names() {
                     write!(
-                        self.w,
+                        self.w,
                         " {}",
-                        names
-                            .iter()
-                            .map(|x| format!("&lt;{}&gt;", x))
-                            .collect::<Vec<_>>()
-                            .join(" ")
+                        names
+                            .iter()
+                            .map(|x| format!("&lt;{}&gt;", x))
+                            .collect::<Vec<_>>()
+                            .join(" ")
                     )?;
                 }
-                write!(self.w, "</code>")?;
+                write!(self.w, "</code>")?;
             }
-            writeln!(self.w, "</dt>")?;
+            writeln!(self.w, "</dt>")?;
             writeln!(
-                self.w,
+                self.w,
                 "<dd>\n\n{}\n\n</dd>",
-                arg.get_help()
-                    .unwrap_or_default()
-                    .to_string()
-                    .replace('\n', "<br />")
+                arg.get_help()
+                    .unwrap_or_default()
+                    .to_string()
+                    .replace('\n', "<br />")
             )?;
         }
-        writeln!(self.w, "</dl>\n")
+        writeln!(self.w, "</dl>\n")
     }
 }
 
-fn get_zip_content(archive: &mut ZipArchive<impl Read + Seek>, name: &str) -> Option<String> {
-    let mut s = String::new();
-    archive.by_name(name).ok()?.read_to_string(&mut s).unwrap();
-    Some(s)
+fn get_zip_content(archive: &mut ZipArchive<impl Read + Seek>, name: &str) -> Option<String> {
+    let mut s = String::new();
+    archive.by_name(name).ok()?.read_to_string(&mut s).unwrap();
+    Some(s)
 }
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/vdir/main.rs.html b/dev/src/vdir/main.rs.html index 262fe7856..7f9bf4fd2 100644 --- a/dev/src/vdir/main.rs.html +++ b/dev/src/vdir/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_vdir);
+main.rs - source
1
+
uucore::bin!(uu_vdir);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/wc/main.rs.html b/dev/src/wc/main.rs.html index efc65dab0..e6d5d4f67 100644 --- a/dev/src/wc/main.rs.html +++ b/dev/src/wc/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_wc);
+main.rs - source
1
+
uucore::bin!(uu_wc);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/who/main.rs.html b/dev/src/who/main.rs.html index 143c64939..f74f60fbf 100644 --- a/dev/src/who/main.rs.html +++ b/dev/src/who/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_who);
+main.rs - source
1
+
uucore::bin!(uu_who);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/whoami/main.rs.html b/dev/src/whoami/main.rs.html index 7ab9c04e9..ed5cc1a8a 100644 --- a/dev/src/whoami/main.rs.html +++ b/dev/src/whoami/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_whoami);
+main.rs - source
1
+
uucore::bin!(uu_whoami);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/src/yes/main.rs.html b/dev/src/yes/main.rs.html index 296bb9fe3..c5382fad6 100644 --- a/dev/src/yes/main.rs.html +++ b/dev/src/yes/main.rs.html @@ -1,4 +1,4 @@ -main.rs - source
1
-
uucore::bin!(uu_yes);
+main.rs - source
1
+
uucore::bin!(uu_yes);
 
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/stat/all.html b/dev/stat/all.html index 7c8e7170c..149730a11 100644 --- a/dev/stat/all.html +++ b/dev/stat/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/stat/fn.main.html b/dev/stat/fn.main.html index 131b45565..9c160b968 100644 --- a/dev/stat/fn.main.html +++ b/dev/stat/fn.main.html @@ -1 +1 @@ -main in stat - Rust

Function stat::main

source · []
pub fn main()
\ No newline at end of file +main in stat - Rust

Function stat::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/stat/index.html b/dev/stat/index.html index bd907452a..77a36d5cb 100644 --- a/dev/stat/index.html +++ b/dev/stat/index.html @@ -1 +1 @@ -stat - Rust
\ No newline at end of file +stat - Rust
\ No newline at end of file diff --git a/dev/stdbuf/all.html b/dev/stdbuf/all.html index 384ffb39d..c1d02cb00 100644 --- a/dev/stdbuf/all.html +++ b/dev/stdbuf/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/stdbuf/fn.main.html b/dev/stdbuf/fn.main.html index b4689ec55..9e4e9ce62 100644 --- a/dev/stdbuf/fn.main.html +++ b/dev/stdbuf/fn.main.html @@ -1 +1 @@ -main in stdbuf - Rust

Function stdbuf::main

source · []
pub fn main()
\ No newline at end of file +main in stdbuf - Rust

Function stdbuf::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/stdbuf/index.html b/dev/stdbuf/index.html index 2599cea60..1176d2c42 100644 --- a/dev/stdbuf/index.html +++ b/dev/stdbuf/index.html @@ -1 +1 @@ -stdbuf - Rust
\ No newline at end of file +stdbuf - Rust
\ No newline at end of file diff --git a/dev/stty/all.html b/dev/stty/all.html index 026b94115..2e830c6ed 100644 --- a/dev/stty/all.html +++ b/dev/stty/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/stty/fn.main.html b/dev/stty/fn.main.html index ff7862217..fc45b2664 100644 --- a/dev/stty/fn.main.html +++ b/dev/stty/fn.main.html @@ -1 +1 @@ -main in stty - Rust

Function stty::main

source · []
pub fn main()
\ No newline at end of file +main in stty - Rust

Function stty::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/stty/index.html b/dev/stty/index.html index 2c3025e11..3db383a28 100644 --- a/dev/stty/index.html +++ b/dev/stty/index.html @@ -1 +1 @@ -stty - Rust
\ No newline at end of file +stty - Rust
\ No newline at end of file diff --git a/dev/sum/all.html b/dev/sum/all.html index c09907c8d..6d32f3f5e 100644 --- a/dev/sum/all.html +++ b/dev/sum/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/sum/fn.main.html b/dev/sum/fn.main.html index 3dc85f2f9..ce6e6ca4d 100644 --- a/dev/sum/fn.main.html +++ b/dev/sum/fn.main.html @@ -1 +1 @@ -main in sum - Rust

Function sum::main

source · []
pub fn main()
\ No newline at end of file +main in sum - Rust

Function sum::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/sum/index.html b/dev/sum/index.html index e32a3033f..6523191f4 100644 --- a/dev/sum/index.html +++ b/dev/sum/index.html @@ -1 +1 @@ -sum - Rust
\ No newline at end of file +sum - Rust
\ No newline at end of file diff --git a/dev/sync/all.html b/dev/sync/all.html index ecfb2054d..b677748ab 100644 --- a/dev/sync/all.html +++ b/dev/sync/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/sync/fn.main.html b/dev/sync/fn.main.html index a3f01168b..18d4d8ed6 100644 --- a/dev/sync/fn.main.html +++ b/dev/sync/fn.main.html @@ -1 +1 @@ -main in sync - Rust

Function sync::main

source · []
pub fn main()
\ No newline at end of file +main in sync - Rust

Function sync::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/sync/index.html b/dev/sync/index.html index 7f6bc5a34..a2bd833e2 100644 --- a/dev/sync/index.html +++ b/dev/sync/index.html @@ -1 +1 @@ -sync - Rust
\ No newline at end of file +sync - Rust
\ No newline at end of file diff --git a/dev/tac/all.html b/dev/tac/all.html index 6e31781a3..2aecb6699 100644 --- a/dev/tac/all.html +++ b/dev/tac/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/tac/fn.main.html b/dev/tac/fn.main.html index 523f3a37e..c10f8d52a 100644 --- a/dev/tac/fn.main.html +++ b/dev/tac/fn.main.html @@ -1 +1 @@ -main in tac - Rust

Function tac::main

source · []
pub fn main()
\ No newline at end of file +main in tac - Rust

Function tac::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/tac/index.html b/dev/tac/index.html index 7aaa46594..ccf3d804d 100644 --- a/dev/tac/index.html +++ b/dev/tac/index.html @@ -1 +1 @@ -tac - Rust
\ No newline at end of file +tac - Rust
\ No newline at end of file diff --git a/dev/tail/all.html b/dev/tail/all.html index 2d96ae9ef..0a840a020 100644 --- a/dev/tail/all.html +++ b/dev/tail/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/tail/fn.main.html b/dev/tail/fn.main.html index 68cabdc42..ee223d910 100644 --- a/dev/tail/fn.main.html +++ b/dev/tail/fn.main.html @@ -1 +1 @@ -main in tail - Rust

Function tail::main

source · []
pub fn main()
\ No newline at end of file +main in tail - Rust

Function tail::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/tail/index.html b/dev/tail/index.html index c5c237b44..634cbbed0 100644 --- a/dev/tail/index.html +++ b/dev/tail/index.html @@ -1 +1 @@ -tail - Rust
\ No newline at end of file +tail - Rust
\ No newline at end of file diff --git a/dev/tee/all.html b/dev/tee/all.html index f7be26ec6..fc441b7e7 100644 --- a/dev/tee/all.html +++ b/dev/tee/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/tee/fn.main.html b/dev/tee/fn.main.html index 070eacb4d..7619904be 100644 --- a/dev/tee/fn.main.html +++ b/dev/tee/fn.main.html @@ -1 +1 @@ -main in tee - Rust

Function tee::main

source · []
pub fn main()
\ No newline at end of file +main in tee - Rust

Function tee::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/tee/index.html b/dev/tee/index.html index e65a6fa4e..958c44957 100644 --- a/dev/tee/index.html +++ b/dev/tee/index.html @@ -1 +1 @@ -tee - Rust
\ No newline at end of file +tee - Rust
\ No newline at end of file diff --git a/dev/test/all.html b/dev/test/all.html index c0fced54f..b908cb207 100644 --- a/dev/test/all.html +++ b/dev/test/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/test/fn.main.html b/dev/test/fn.main.html index 0eccb4f46..0ca993294 100644 --- a/dev/test/fn.main.html +++ b/dev/test/fn.main.html @@ -1 +1 @@ -main in test - Rust

Function test::main

source · []
pub fn main()
\ No newline at end of file +main in test - Rust

Function test::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/test/index.html b/dev/test/index.html index a0dcfb5e9..4fb1513ac 100644 --- a/dev/test/index.html +++ b/dev/test/index.html @@ -1 +1 @@ -test - Rust
\ No newline at end of file +test - Rust
\ No newline at end of file diff --git a/dev/timeout/all.html b/dev/timeout/all.html index fbfdb69c7..8332ada0f 100644 --- a/dev/timeout/all.html +++ b/dev/timeout/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/timeout/fn.main.html b/dev/timeout/fn.main.html index 9b5385272..8b24d6ff1 100644 --- a/dev/timeout/fn.main.html +++ b/dev/timeout/fn.main.html @@ -1 +1 @@ -main in timeout - Rust

Function timeout::main

source · []
pub fn main()
\ No newline at end of file +main in timeout - Rust

Function timeout::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/timeout/index.html b/dev/timeout/index.html index 6cf0bebd4..a613938a8 100644 --- a/dev/timeout/index.html +++ b/dev/timeout/index.html @@ -1 +1 @@ -timeout - Rust
\ No newline at end of file +timeout - Rust
\ No newline at end of file diff --git a/dev/touch/all.html b/dev/touch/all.html index a3da90ab9..53d42db62 100644 --- a/dev/touch/all.html +++ b/dev/touch/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/touch/fn.main.html b/dev/touch/fn.main.html index 59a74d222..436ce4cf2 100644 --- a/dev/touch/fn.main.html +++ b/dev/touch/fn.main.html @@ -1 +1 @@ -main in touch - Rust

Function touch::main

source · []
pub fn main()
\ No newline at end of file +main in touch - Rust

Function touch::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/touch/index.html b/dev/touch/index.html index c1f661dfc..359e1fd7e 100644 --- a/dev/touch/index.html +++ b/dev/touch/index.html @@ -1 +1 @@ -touch - Rust
\ No newline at end of file +touch - Rust
\ No newline at end of file diff --git a/dev/tr/all.html b/dev/tr/all.html index 0afe323e6..bd6380d01 100644 --- a/dev/tr/all.html +++ b/dev/tr/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/tr/fn.main.html b/dev/tr/fn.main.html index 7d25b421b..468f24bac 100644 --- a/dev/tr/fn.main.html +++ b/dev/tr/fn.main.html @@ -1 +1 @@ -main in tr - Rust

Function tr::main

source · []
pub fn main()
\ No newline at end of file +main in tr - Rust

Function tr::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/tr/index.html b/dev/tr/index.html index 56465039e..8dd3a271a 100644 --- a/dev/tr/index.html +++ b/dev/tr/index.html @@ -1 +1 @@ -tr - Rust
\ No newline at end of file +tr - Rust
\ No newline at end of file diff --git a/dev/true/all.html b/dev/true/all.html index fa6c36e51..b819c1a89 100644 --- a/dev/true/all.html +++ b/dev/true/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/true/fn.main.html b/dev/true/fn.main.html index 341aba8ca..02ba126aa 100644 --- a/dev/true/fn.main.html +++ b/dev/true/fn.main.html @@ -1 +1 @@ -main in true - Rust

Function true::main

source · []
pub fn main()
\ No newline at end of file +main in true - Rust

Function true::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/true/index.html b/dev/true/index.html index b8bab855d..8c5f5b4c7 100644 --- a/dev/true/index.html +++ b/dev/true/index.html @@ -1 +1 @@ -true - Rust
\ No newline at end of file +true - Rust
\ No newline at end of file diff --git a/dev/truncate/all.html b/dev/truncate/all.html index 2f26d4480..94ff22ef0 100644 --- a/dev/truncate/all.html +++ b/dev/truncate/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/truncate/fn.main.html b/dev/truncate/fn.main.html index 8d636670d..972839e9a 100644 --- a/dev/truncate/fn.main.html +++ b/dev/truncate/fn.main.html @@ -1 +1 @@ -main in truncate - Rust
pub fn main()
\ No newline at end of file +main in truncate - Rust
pub fn main()
\ No newline at end of file diff --git a/dev/truncate/index.html b/dev/truncate/index.html index 3d1782293..6fdcdbbc9 100644 --- a/dev/truncate/index.html +++ b/dev/truncate/index.html @@ -1 +1 @@ -truncate - Rust
\ No newline at end of file +truncate - Rust
\ No newline at end of file diff --git a/dev/tsort/all.html b/dev/tsort/all.html index 5d55f5cde..639f2fed0 100644 --- a/dev/tsort/all.html +++ b/dev/tsort/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/tsort/fn.main.html b/dev/tsort/fn.main.html index 84820f4ff..b24a4f848 100644 --- a/dev/tsort/fn.main.html +++ b/dev/tsort/fn.main.html @@ -1 +1 @@ -main in tsort - Rust

Function tsort::main

source · []
pub fn main()
\ No newline at end of file +main in tsort - Rust

Function tsort::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/tsort/index.html b/dev/tsort/index.html index 3310ba4d6..7b3b2de1e 100644 --- a/dev/tsort/index.html +++ b/dev/tsort/index.html @@ -1 +1 @@ -tsort - Rust
\ No newline at end of file +tsort - Rust
\ No newline at end of file diff --git a/dev/tty/all.html b/dev/tty/all.html index 4bb1173e5..fdaa5d403 100644 --- a/dev/tty/all.html +++ b/dev/tty/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/tty/fn.main.html b/dev/tty/fn.main.html index a9ea26c8a..d43eba785 100644 --- a/dev/tty/fn.main.html +++ b/dev/tty/fn.main.html @@ -1 +1 @@ -main in tty - Rust

Function tty::main

source · []
pub fn main()
\ No newline at end of file +main in tty - Rust

Function tty::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/tty/index.html b/dev/tty/index.html index 92ee12f04..ec9794e7e 100644 --- a/dev/tty/index.html +++ b/dev/tty/index.html @@ -1 +1 @@ -tty - Rust
\ No newline at end of file +tty - Rust
\ No newline at end of file diff --git a/dev/uname/all.html b/dev/uname/all.html index 54fa1b5a5..6436cc858 100644 --- a/dev/uname/all.html +++ b/dev/uname/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uname/fn.main.html b/dev/uname/fn.main.html index 85fabf719..d3a0b59d5 100644 --- a/dev/uname/fn.main.html +++ b/dev/uname/fn.main.html @@ -1 +1 @@ -main in uname - Rust

Function uname::main

source · []
pub fn main()
\ No newline at end of file +main in uname - Rust

Function uname::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/uname/index.html b/dev/uname/index.html index 447b4d8b3..5131efdc8 100644 --- a/dev/uname/index.html +++ b/dev/uname/index.html @@ -1 +1 @@ -uname - Rust
\ No newline at end of file +uname - Rust
\ No newline at end of file diff --git a/dev/unexpand/all.html b/dev/unexpand/all.html index 76d94b0d8..7a905df5f 100644 --- a/dev/unexpand/all.html +++ b/dev/unexpand/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/unexpand/fn.main.html b/dev/unexpand/fn.main.html index 439e03cd5..26c51f3a2 100644 --- a/dev/unexpand/fn.main.html +++ b/dev/unexpand/fn.main.html @@ -1 +1 @@ -main in unexpand - Rust
pub fn main()
\ No newline at end of file +main in unexpand - Rust
pub fn main()
\ No newline at end of file diff --git a/dev/unexpand/index.html b/dev/unexpand/index.html index 66505ed49..fd3e6e841 100644 --- a/dev/unexpand/index.html +++ b/dev/unexpand/index.html @@ -1 +1 @@ -unexpand - Rust
\ No newline at end of file +unexpand - Rust
\ No newline at end of file diff --git a/dev/uniq/all.html b/dev/uniq/all.html index f4951d2d2..7d423f7fe 100644 --- a/dev/uniq/all.html +++ b/dev/uniq/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uniq/fn.main.html b/dev/uniq/fn.main.html index a1fc3be02..d900b2996 100644 --- a/dev/uniq/fn.main.html +++ b/dev/uniq/fn.main.html @@ -1 +1 @@ -main in uniq - Rust

Function uniq::main

source · []
pub fn main()
\ No newline at end of file +main in uniq - Rust

Function uniq::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/uniq/index.html b/dev/uniq/index.html index 89d33b558..c2b7d6c81 100644 --- a/dev/uniq/index.html +++ b/dev/uniq/index.html @@ -1 +1 @@ -uniq - Rust
\ No newline at end of file +uniq - Rust
\ No newline at end of file diff --git a/dev/unlink/all.html b/dev/unlink/all.html index dfa827fce..28bb316c3 100644 --- a/dev/unlink/all.html +++ b/dev/unlink/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/unlink/fn.main.html b/dev/unlink/fn.main.html index 4151b4b0d..916d05841 100644 --- a/dev/unlink/fn.main.html +++ b/dev/unlink/fn.main.html @@ -1 +1 @@ -main in unlink - Rust

Function unlink::main

source · []
pub fn main()
\ No newline at end of file +main in unlink - Rust

Function unlink::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/unlink/index.html b/dev/unlink/index.html index 536bfc86a..e217f82ca 100644 --- a/dev/unlink/index.html +++ b/dev/unlink/index.html @@ -1 +1 @@ -unlink - Rust
\ No newline at end of file +unlink - Rust
\ No newline at end of file diff --git a/dev/uptime/all.html b/dev/uptime/all.html index 720d1bf33..c05263a85 100644 --- a/dev/uptime/all.html +++ b/dev/uptime/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uptime/fn.main.html b/dev/uptime/fn.main.html index 6366cad05..3b1ed98b1 100644 --- a/dev/uptime/fn.main.html +++ b/dev/uptime/fn.main.html @@ -1 +1 @@ -main in uptime - Rust

Function uptime::main

source · []
pub fn main()
\ No newline at end of file +main in uptime - Rust

Function uptime::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/uptime/index.html b/dev/uptime/index.html index e03d19de6..b3c692990 100644 --- a/dev/uptime/index.html +++ b/dev/uptime/index.html @@ -1 +1 @@ -uptime - Rust
\ No newline at end of file +uptime - Rust
\ No newline at end of file diff --git a/dev/users/all.html b/dev/users/all.html index 2aa956071..4ce473590 100644 --- a/dev/users/all.html +++ b/dev/users/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/users/fn.main.html b/dev/users/fn.main.html index a014a1f2a..2d03fbc22 100644 --- a/dev/users/fn.main.html +++ b/dev/users/fn.main.html @@ -1 +1 @@ -main in users - Rust

Function users::main

source · []
pub fn main()
\ No newline at end of file +main in users - Rust

Function users::main

source · []
pub fn main()
\ No newline at end of file diff --git a/dev/users/index.html b/dev/users/index.html index 2ef662b9a..061b8d9e5 100644 --- a/dev/users/index.html +++ b/dev/users/index.html @@ -1 +1 @@ -users - Rust
\ No newline at end of file +users - Rust
\ No newline at end of file diff --git a/dev/uu_arch/all.html b/dev/uu_arch/all.html index 38e144d80..bc290c377 100644 --- a/dev/uu_arch/all.html +++ b/dev/uu_arch/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_arch/fn.uu_app.html b/dev/uu_arch/fn.uu_app.html index cb67f132f..4dfeb3968 100644 --- a/dev/uu_arch/fn.uu_app.html +++ b/dev/uu_arch/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_arch - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_arch - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_arch/fn.uumain.html b/dev/uu_arch/fn.uumain.html index 117a081a4..22c936611 100644 --- a/dev/uu_arch/fn.uumain.html +++ b/dev/uu_arch/fn.uumain.html @@ -1 +1 @@ -uumain in uu_arch - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_arch - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_arch/index.html b/dev/uu_arch/index.html index 1e3675601..a73b29791 100644 --- a/dev/uu_arch/index.html +++ b/dev/uu_arch/index.html @@ -1 +1 @@ -uu_arch - Rust
\ No newline at end of file +uu_arch - Rust
\ No newline at end of file diff --git a/dev/uu_base32/all.html b/dev/uu_base32/all.html index c54cc7691..7fcd543d5 100644 --- a/dev/uu_base32/all.html +++ b/dev/uu_base32/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_base32/base_common/fn.base_app.html b/dev/uu_base32/base_common/fn.base_app.html index 182c3561e..03076a6fc 100644 --- a/dev/uu_base32/base_common/fn.base_app.html +++ b/dev/uu_base32/base_common/fn.base_app.html @@ -1 +1 @@ -base_app in uu_base32::base_common - Rust
pub fn base_app(about: &'static str, usage: &str) -> Command
\ No newline at end of file +base_app in uu_base32::base_common - Rust
pub fn base_app(about: &'static str, usage: &str) -> Command
\ No newline at end of file diff --git a/dev/uu_base32/base_common/fn.get_input.html b/dev/uu_base32/base_common/fn.get_input.html index 791d37655..8f09ecbb6 100644 --- a/dev/uu_base32/base_common/fn.get_input.html +++ b/dev/uu_base32/base_common/fn.get_input.html @@ -1 +1 @@ -get_input in uu_base32::base_common - Rust
pub fn get_input<'a>(
    config: &Config,
    stdin_ref: &'a Stdin
) -> UResult<Box<dyn Read + 'a>>
\ No newline at end of file +get_input in uu_base32::base_common - Rust
pub fn get_input<'a>(
    config: &Config,
    stdin_ref: &'a Stdin
) -> UResult<Box<dyn Read + 'a>>
\ No newline at end of file diff --git a/dev/uu_base32/base_common/fn.handle_input.html b/dev/uu_base32/base_common/fn.handle_input.html index fb917f05c..e4883b51e 100644 --- a/dev/uu_base32/base_common/fn.handle_input.html +++ b/dev/uu_base32/base_common/fn.handle_input.html @@ -1 +1 @@ -handle_input in uu_base32::base_common - Rust
pub fn handle_input<R: Read>(
    input: &mut R,
    format: Format,
    line_wrap: Option<usize>,
    ignore_garbage: bool,
    decode: bool
) -> UResult<()>
\ No newline at end of file +handle_input in uu_base32::base_common - Rust
pub fn handle_input<R: Read>(
    input: &mut R,
    format: Format,
    line_wrap: Option<usize>,
    ignore_garbage: bool,
    decode: bool
) -> UResult<()>
\ No newline at end of file diff --git a/dev/uu_base32/base_common/fn.parse_base_cmd_args.html b/dev/uu_base32/base_common/fn.parse_base_cmd_args.html index 6f2f9aad9..02827c236 100644 --- a/dev/uu_base32/base_common/fn.parse_base_cmd_args.html +++ b/dev/uu_base32/base_common/fn.parse_base_cmd_args.html @@ -1 +1 @@ -parse_base_cmd_args in uu_base32::base_common - Rust
pub fn parse_base_cmd_args(
    args: impl Args,
    about: &'static str,
    usage: &str
) -> UResult<Config>
\ No newline at end of file +parse_base_cmd_args in uu_base32::base_common - Rust
pub fn parse_base_cmd_args(
    args: impl Args,
    about: &'static str,
    usage: &str
) -> UResult<Config>
\ No newline at end of file diff --git a/dev/uu_base32/base_common/index.html b/dev/uu_base32/base_common/index.html index 3097d9103..10e0e4721 100644 --- a/dev/uu_base32/base_common/index.html +++ b/dev/uu_base32/base_common/index.html @@ -1 +1 @@ -uu_base32::base_common - Rust
\ No newline at end of file +uu_base32::base_common - Rust
\ No newline at end of file diff --git a/dev/uu_base32/base_common/options/index.html b/dev/uu_base32/base_common/options/index.html index 2ff3de161..edc92a3e7 100644 --- a/dev/uu_base32/base_common/options/index.html +++ b/dev/uu_base32/base_common/options/index.html @@ -1 +1 @@ -uu_base32::base_common::options - Rust
\ No newline at end of file +uu_base32::base_common::options - Rust
\ No newline at end of file diff --git a/dev/uu_base32/base_common/options/static.DECODE.html b/dev/uu_base32/base_common/options/static.DECODE.html index ed9e68cd3..9367609cb 100644 --- a/dev/uu_base32/base_common/options/static.DECODE.html +++ b/dev/uu_base32/base_common/options/static.DECODE.html @@ -1 +1 @@ -DECODE in uu_base32::base_common::options - Rust
pub static DECODE: &'static str
\ No newline at end of file +DECODE in uu_base32::base_common::options - Rust
pub static DECODE: &'static str
\ No newline at end of file diff --git a/dev/uu_base32/base_common/options/static.FILE.html b/dev/uu_base32/base_common/options/static.FILE.html index a3af8fd92..5632a7712 100644 --- a/dev/uu_base32/base_common/options/static.FILE.html +++ b/dev/uu_base32/base_common/options/static.FILE.html @@ -1 +1 @@ -FILE in uu_base32::base_common::options - Rust
pub static FILE: &'static str
\ No newline at end of file +FILE in uu_base32::base_common::options - Rust
pub static FILE: &'static str
\ No newline at end of file diff --git a/dev/uu_base32/base_common/options/static.IGNORE_GARBAGE.html b/dev/uu_base32/base_common/options/static.IGNORE_GARBAGE.html index 20e88cdde..f29a95561 100644 --- a/dev/uu_base32/base_common/options/static.IGNORE_GARBAGE.html +++ b/dev/uu_base32/base_common/options/static.IGNORE_GARBAGE.html @@ -1 +1 @@ -IGNORE_GARBAGE in uu_base32::base_common::options - Rust
pub static IGNORE_GARBAGE: &'static str
\ No newline at end of file +IGNORE_GARBAGE in uu_base32::base_common::options - Rust
pub static IGNORE_GARBAGE: &'static str
\ No newline at end of file diff --git a/dev/uu_base32/base_common/options/static.WRAP.html b/dev/uu_base32/base_common/options/static.WRAP.html index 5fdde0b89..73c3e7ca5 100644 --- a/dev/uu_base32/base_common/options/static.WRAP.html +++ b/dev/uu_base32/base_common/options/static.WRAP.html @@ -1 +1 @@ -WRAP in uu_base32::base_common::options - Rust
pub static WRAP: &'static str
\ No newline at end of file +WRAP in uu_base32::base_common::options - Rust
pub static WRAP: &'static str
\ No newline at end of file diff --git a/dev/uu_base32/base_common/static.BASE_CMD_PARSE_ERROR.html b/dev/uu_base32/base_common/static.BASE_CMD_PARSE_ERROR.html index f7925a0d6..52846ada3 100644 --- a/dev/uu_base32/base_common/static.BASE_CMD_PARSE_ERROR.html +++ b/dev/uu_base32/base_common/static.BASE_CMD_PARSE_ERROR.html @@ -1 +1 @@ -BASE_CMD_PARSE_ERROR in uu_base32::base_common - Rust
pub static BASE_CMD_PARSE_ERROR: i32
\ No newline at end of file +BASE_CMD_PARSE_ERROR in uu_base32::base_common - Rust
pub static BASE_CMD_PARSE_ERROR: i32
\ No newline at end of file diff --git a/dev/uu_base32/base_common/struct.Config.html b/dev/uu_base32/base_common/struct.Config.html index a0ebd172b..ced6f4570 100644 --- a/dev/uu_base32/base_common/struct.Config.html +++ b/dev/uu_base32/base_common/struct.Config.html @@ -1,17 +1,10 @@ -Config in uu_base32::base_common - Rust
pub struct Config {
-    pub decode: bool,
-    pub ignore_garbage: bool,
-    pub wrap_cols: Option<usize>,
-    pub to_read: Option<String>,
-}

Fields

decode: boolignore_garbage: boolwrap_cols: Option<usize>to_read: Option<String>

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Config in uu_base32::base_common - Rust
pub struct Config {
+    pub decode: bool,
+    pub ignore_garbage: bool,
+    pub wrap_cols: Option<usize>,
+    pub to_read: Option<String>,
+}

Fields

decode: boolignore_garbage: boolwrap_cols: Option<usize>to_read: Option<String>

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_base32/fn.uu_app.html b/dev/uu_base32/fn.uu_app.html index 6c3f4e533..b1dac385b 100644 --- a/dev/uu_base32/fn.uu_app.html +++ b/dev/uu_base32/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_base32 - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_base32 - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_base32/fn.uumain.html b/dev/uu_base32/fn.uumain.html index 7688d0c0d..35bab1be7 100644 --- a/dev/uu_base32/fn.uumain.html +++ b/dev/uu_base32/fn.uumain.html @@ -1 +1 @@ -uumain in uu_base32 - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_base32 - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_base32/index.html b/dev/uu_base32/index.html index 6d2746cd4..0befc6dcd 100644 --- a/dev/uu_base32/index.html +++ b/dev/uu_base32/index.html @@ -1 +1 @@ -uu_base32 - Rust
\ No newline at end of file +uu_base32 - Rust
\ No newline at end of file diff --git a/dev/uu_base64/all.html b/dev/uu_base64/all.html index a23bf7a59..386251d7a 100644 --- a/dev/uu_base64/all.html +++ b/dev/uu_base64/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_base64/fn.uu_app.html b/dev/uu_base64/fn.uu_app.html index 1cd3f8880..ad5689d83 100644 --- a/dev/uu_base64/fn.uu_app.html +++ b/dev/uu_base64/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_base64 - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_base64 - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_base64/fn.uumain.html b/dev/uu_base64/fn.uumain.html index d7fa3f16a..c9d882086 100644 --- a/dev/uu_base64/fn.uumain.html +++ b/dev/uu_base64/fn.uumain.html @@ -1 +1 @@ -uumain in uu_base64 - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_base64 - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_base64/index.html b/dev/uu_base64/index.html index d701503e6..8635a29b4 100644 --- a/dev/uu_base64/index.html +++ b/dev/uu_base64/index.html @@ -1 +1 @@ -uu_base64 - Rust
\ No newline at end of file +uu_base64 - Rust
\ No newline at end of file diff --git a/dev/uu_basename/all.html b/dev/uu_basename/all.html index cfd855069..9f74137ac 100644 --- a/dev/uu_basename/all.html +++ b/dev/uu_basename/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_basename/fn.uu_app.html b/dev/uu_basename/fn.uu_app.html index 4a276f552..8975c03da 100644 --- a/dev/uu_basename/fn.uu_app.html +++ b/dev/uu_basename/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_basename - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_basename - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_basename/fn.uumain.html b/dev/uu_basename/fn.uumain.html index 4f82c3c81..944808198 100644 --- a/dev/uu_basename/fn.uumain.html +++ b/dev/uu_basename/fn.uumain.html @@ -1 +1 @@ -uumain in uu_basename - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_basename - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_basename/index.html b/dev/uu_basename/index.html index 9375c8817..14b26172d 100644 --- a/dev/uu_basename/index.html +++ b/dev/uu_basename/index.html @@ -1 +1 @@ -uu_basename - Rust
\ No newline at end of file +uu_basename - Rust
\ No newline at end of file diff --git a/dev/uu_basename/options/index.html b/dev/uu_basename/options/index.html index 96aa63fbc..21111d3a0 100644 --- a/dev/uu_basename/options/index.html +++ b/dev/uu_basename/options/index.html @@ -1 +1 @@ -uu_basename::options - Rust
\ No newline at end of file +uu_basename::options - Rust
\ No newline at end of file diff --git a/dev/uu_basename/options/static.MULTIPLE.html b/dev/uu_basename/options/static.MULTIPLE.html index 96b459aaf..76702fb9b 100644 --- a/dev/uu_basename/options/static.MULTIPLE.html +++ b/dev/uu_basename/options/static.MULTIPLE.html @@ -1 +1 @@ -MULTIPLE in uu_basename::options - Rust
pub static MULTIPLE: &'static str
\ No newline at end of file +MULTIPLE in uu_basename::options - Rust
pub static MULTIPLE: &'static str
\ No newline at end of file diff --git a/dev/uu_basename/options/static.NAME.html b/dev/uu_basename/options/static.NAME.html index 51e152e2b..20f260611 100644 --- a/dev/uu_basename/options/static.NAME.html +++ b/dev/uu_basename/options/static.NAME.html @@ -1 +1 @@ -NAME in uu_basename::options - Rust
pub static NAME: &'static str
\ No newline at end of file +NAME in uu_basename::options - Rust
pub static NAME: &'static str
\ No newline at end of file diff --git a/dev/uu_basename/options/static.SUFFIX.html b/dev/uu_basename/options/static.SUFFIX.html index d19f4848a..dee7e1ee7 100644 --- a/dev/uu_basename/options/static.SUFFIX.html +++ b/dev/uu_basename/options/static.SUFFIX.html @@ -1 +1 @@ -SUFFIX in uu_basename::options - Rust
pub static SUFFIX: &'static str
\ No newline at end of file +SUFFIX in uu_basename::options - Rust
pub static SUFFIX: &'static str
\ No newline at end of file diff --git a/dev/uu_basename/options/static.ZERO.html b/dev/uu_basename/options/static.ZERO.html index 0e9892126..ef31a081f 100644 --- a/dev/uu_basename/options/static.ZERO.html +++ b/dev/uu_basename/options/static.ZERO.html @@ -1 +1 @@ -ZERO in uu_basename::options - Rust
pub static ZERO: &'static str
\ No newline at end of file +ZERO in uu_basename::options - Rust
pub static ZERO: &'static str
\ No newline at end of file diff --git a/dev/uu_basenc/all.html b/dev/uu_basenc/all.html index e2ef95d23..1e0c566ed 100644 --- a/dev/uu_basenc/all.html +++ b/dev/uu_basenc/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_basenc/fn.uu_app.html b/dev/uu_basenc/fn.uu_app.html index abbf0a5ca..d2c8a208a 100644 --- a/dev/uu_basenc/fn.uu_app.html +++ b/dev/uu_basenc/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_basenc - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_basenc - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_basenc/fn.uumain.html b/dev/uu_basenc/fn.uumain.html index 8275dd3c3..6a040fedd 100644 --- a/dev/uu_basenc/fn.uumain.html +++ b/dev/uu_basenc/fn.uumain.html @@ -1 +1 @@ -uumain in uu_basenc - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_basenc - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_basenc/index.html b/dev/uu_basenc/index.html index af345d2a9..1c2006410 100644 --- a/dev/uu_basenc/index.html +++ b/dev/uu_basenc/index.html @@ -1 +1 @@ -uu_basenc - Rust
\ No newline at end of file +uu_basenc - Rust
\ No newline at end of file diff --git a/dev/uu_cat/all.html b/dev/uu_cat/all.html index ed89abb81..3b7102249 100644 --- a/dev/uu_cat/all.html +++ b/dev/uu_cat/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_cat/fn.uu_app.html b/dev/uu_cat/fn.uu_app.html index 03fd6233e..d79a7a7af 100644 --- a/dev/uu_cat/fn.uu_app.html +++ b/dev/uu_cat/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_cat - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_cat - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_cat/fn.uumain.html b/dev/uu_cat/fn.uumain.html index c01ef3dcb..7e08f9b2e 100644 --- a/dev/uu_cat/fn.uumain.html +++ b/dev/uu_cat/fn.uumain.html @@ -1 +1 @@ -uumain in uu_cat - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_cat - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_cat/index.html b/dev/uu_cat/index.html index 88f00bcca..35fb5a1d4 100644 --- a/dev/uu_cat/index.html +++ b/dev/uu_cat/index.html @@ -1 +1 @@ -uu_cat - Rust
\ No newline at end of file +uu_cat - Rust
\ No newline at end of file diff --git a/dev/uu_chcon/all.html b/dev/uu_chcon/all.html index a734c845a..8a63a7a0a 100644 --- a/dev/uu_chcon/all.html +++ b/dev/uu_chcon/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_chcon/fn.uu_app.html b/dev/uu_chcon/fn.uu_app.html index 0d86549e4..5c559bdb7 100644 --- a/dev/uu_chcon/fn.uu_app.html +++ b/dev/uu_chcon/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_chcon - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_chcon - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_chcon/fn.uumain.html b/dev/uu_chcon/fn.uumain.html index 5be286089..2ac303a1e 100644 --- a/dev/uu_chcon/fn.uumain.html +++ b/dev/uu_chcon/fn.uumain.html @@ -1 +1 @@ -uumain in uu_chcon - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_chcon - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_chcon/index.html b/dev/uu_chcon/index.html index e2976418b..f3fbbf3fe 100644 --- a/dev/uu_chcon/index.html +++ b/dev/uu_chcon/index.html @@ -1 +1 @@ -uu_chcon - Rust
\ No newline at end of file +uu_chcon - Rust
\ No newline at end of file diff --git a/dev/uu_chcon/options/dereference/index.html b/dev/uu_chcon/options/dereference/index.html index 1bd530fb0..a6a590f53 100644 --- a/dev/uu_chcon/options/dereference/index.html +++ b/dev/uu_chcon/options/dereference/index.html @@ -1 +1 @@ -uu_chcon::options::dereference - Rust
\ No newline at end of file +uu_chcon::options::dereference - Rust
\ No newline at end of file diff --git a/dev/uu_chcon/options/dereference/static.DEREFERENCE.html b/dev/uu_chcon/options/dereference/static.DEREFERENCE.html index 0f9d2fac1..4705d84da 100644 --- a/dev/uu_chcon/options/dereference/static.DEREFERENCE.html +++ b/dev/uu_chcon/options/dereference/static.DEREFERENCE.html @@ -1 +1 @@ -DEREFERENCE in uu_chcon::options::dereference - Rust
pub static DEREFERENCE: &'static str
\ No newline at end of file +DEREFERENCE in uu_chcon::options::dereference - Rust
pub static DEREFERENCE: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/dereference/static.NO_DEREFERENCE.html b/dev/uu_chcon/options/dereference/static.NO_DEREFERENCE.html index a6107bacf..db6f2e121 100644 --- a/dev/uu_chcon/options/dereference/static.NO_DEREFERENCE.html +++ b/dev/uu_chcon/options/dereference/static.NO_DEREFERENCE.html @@ -1 +1 @@ -NO_DEREFERENCE in uu_chcon::options::dereference - Rust
pub static NO_DEREFERENCE: &'static str
\ No newline at end of file +NO_DEREFERENCE in uu_chcon::options::dereference - Rust
pub static NO_DEREFERENCE: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/index.html b/dev/uu_chcon/options/index.html index 46abf8684..2f1dc63bb 100644 --- a/dev/uu_chcon/options/index.html +++ b/dev/uu_chcon/options/index.html @@ -1 +1 @@ -uu_chcon::options - Rust
\ No newline at end of file +uu_chcon::options - Rust
\ No newline at end of file diff --git a/dev/uu_chcon/options/preserve_root/index.html b/dev/uu_chcon/options/preserve_root/index.html index 16a6a8fe4..4e28619fd 100644 --- a/dev/uu_chcon/options/preserve_root/index.html +++ b/dev/uu_chcon/options/preserve_root/index.html @@ -1 +1 @@ -uu_chcon::options::preserve_root - Rust
\ No newline at end of file +uu_chcon::options::preserve_root - Rust
\ No newline at end of file diff --git a/dev/uu_chcon/options/preserve_root/static.NO_PRESERVE_ROOT.html b/dev/uu_chcon/options/preserve_root/static.NO_PRESERVE_ROOT.html index 96be9a809..88313105c 100644 --- a/dev/uu_chcon/options/preserve_root/static.NO_PRESERVE_ROOT.html +++ b/dev/uu_chcon/options/preserve_root/static.NO_PRESERVE_ROOT.html @@ -1 +1 @@ -NO_PRESERVE_ROOT in uu_chcon::options::preserve_root - Rust
pub static NO_PRESERVE_ROOT: &'static str
\ No newline at end of file +NO_PRESERVE_ROOT in uu_chcon::options::preserve_root - Rust
pub static NO_PRESERVE_ROOT: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/preserve_root/static.PRESERVE_ROOT.html b/dev/uu_chcon/options/preserve_root/static.PRESERVE_ROOT.html index 465cfdbb7..38599f5dc 100644 --- a/dev/uu_chcon/options/preserve_root/static.PRESERVE_ROOT.html +++ b/dev/uu_chcon/options/preserve_root/static.PRESERVE_ROOT.html @@ -1 +1 @@ -PRESERVE_ROOT in uu_chcon::options::preserve_root - Rust
pub static PRESERVE_ROOT: &'static str
\ No newline at end of file +PRESERVE_ROOT in uu_chcon::options::preserve_root - Rust
pub static PRESERVE_ROOT: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/static.HELP.html b/dev/uu_chcon/options/static.HELP.html index c376c4701..216a93b41 100644 --- a/dev/uu_chcon/options/static.HELP.html +++ b/dev/uu_chcon/options/static.HELP.html @@ -1 +1 @@ -HELP in uu_chcon::options - Rust
pub static HELP: &'static str
\ No newline at end of file +HELP in uu_chcon::options - Rust
pub static HELP: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/static.RANGE.html b/dev/uu_chcon/options/static.RANGE.html index 9524e3af9..491347c41 100644 --- a/dev/uu_chcon/options/static.RANGE.html +++ b/dev/uu_chcon/options/static.RANGE.html @@ -1 +1 @@ -RANGE in uu_chcon::options - Rust
pub static RANGE: &'static str
\ No newline at end of file +RANGE in uu_chcon::options - Rust
pub static RANGE: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/static.RECURSIVE.html b/dev/uu_chcon/options/static.RECURSIVE.html index f86dd8ce5..494abfb9a 100644 --- a/dev/uu_chcon/options/static.RECURSIVE.html +++ b/dev/uu_chcon/options/static.RECURSIVE.html @@ -1 +1 @@ -RECURSIVE in uu_chcon::options - Rust
pub static RECURSIVE: &'static str
\ No newline at end of file +RECURSIVE in uu_chcon::options - Rust
pub static RECURSIVE: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/static.REFERENCE.html b/dev/uu_chcon/options/static.REFERENCE.html index ff4d67f61..ae46776bd 100644 --- a/dev/uu_chcon/options/static.REFERENCE.html +++ b/dev/uu_chcon/options/static.REFERENCE.html @@ -1 +1 @@ -REFERENCE in uu_chcon::options - Rust
pub static REFERENCE: &'static str
\ No newline at end of file +REFERENCE in uu_chcon::options - Rust
pub static REFERENCE: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/static.ROLE.html b/dev/uu_chcon/options/static.ROLE.html index e02b31a2b..dd03ed4ca 100644 --- a/dev/uu_chcon/options/static.ROLE.html +++ b/dev/uu_chcon/options/static.ROLE.html @@ -1 +1 @@ -ROLE in uu_chcon::options - Rust
pub static ROLE: &'static str
\ No newline at end of file +ROLE in uu_chcon::options - Rust
pub static ROLE: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/static.TYPE.html b/dev/uu_chcon/options/static.TYPE.html index 82f063a9c..7711e109c 100644 --- a/dev/uu_chcon/options/static.TYPE.html +++ b/dev/uu_chcon/options/static.TYPE.html @@ -1 +1 @@ -TYPE in uu_chcon::options - Rust
pub static TYPE: &'static str
\ No newline at end of file +TYPE in uu_chcon::options - Rust
pub static TYPE: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/static.USER.html b/dev/uu_chcon/options/static.USER.html index 4deacec47..c41574af3 100644 --- a/dev/uu_chcon/options/static.USER.html +++ b/dev/uu_chcon/options/static.USER.html @@ -1 +1 @@ -USER in uu_chcon::options - Rust
pub static USER: &'static str
\ No newline at end of file +USER in uu_chcon::options - Rust
pub static USER: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/static.VERBOSE.html b/dev/uu_chcon/options/static.VERBOSE.html index 48f3f8bcb..f09160030 100644 --- a/dev/uu_chcon/options/static.VERBOSE.html +++ b/dev/uu_chcon/options/static.VERBOSE.html @@ -1 +1 @@ -VERBOSE in uu_chcon::options - Rust
pub static VERBOSE: &'static str
\ No newline at end of file +VERBOSE in uu_chcon::options - Rust
pub static VERBOSE: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/sym_links/index.html b/dev/uu_chcon/options/sym_links/index.html index 3e0e27845..6a4f0969c 100644 --- a/dev/uu_chcon/options/sym_links/index.html +++ b/dev/uu_chcon/options/sym_links/index.html @@ -1 +1 @@ -uu_chcon::options::sym_links - Rust
\ No newline at end of file +uu_chcon::options::sym_links - Rust
\ No newline at end of file diff --git a/dev/uu_chcon/options/sym_links/static.FOLLOW_ARG_DIR_SYM_LINK.html b/dev/uu_chcon/options/sym_links/static.FOLLOW_ARG_DIR_SYM_LINK.html index c1b34f40e..a8fc5cf57 100644 --- a/dev/uu_chcon/options/sym_links/static.FOLLOW_ARG_DIR_SYM_LINK.html +++ b/dev/uu_chcon/options/sym_links/static.FOLLOW_ARG_DIR_SYM_LINK.html @@ -1 +1 @@ -FOLLOW_ARG_DIR_SYM_LINK in uu_chcon::options::sym_links - Rust
pub static FOLLOW_ARG_DIR_SYM_LINK: &'static str
\ No newline at end of file +FOLLOW_ARG_DIR_SYM_LINK in uu_chcon::options::sym_links - Rust
pub static FOLLOW_ARG_DIR_SYM_LINK: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/sym_links/static.FOLLOW_DIR_SYM_LINKS.html b/dev/uu_chcon/options/sym_links/static.FOLLOW_DIR_SYM_LINKS.html index c9e5779eb..2e3f03c61 100644 --- a/dev/uu_chcon/options/sym_links/static.FOLLOW_DIR_SYM_LINKS.html +++ b/dev/uu_chcon/options/sym_links/static.FOLLOW_DIR_SYM_LINKS.html @@ -1 +1 @@ -FOLLOW_DIR_SYM_LINKS in uu_chcon::options::sym_links - Rust
pub static FOLLOW_DIR_SYM_LINKS: &'static str
\ No newline at end of file +FOLLOW_DIR_SYM_LINKS in uu_chcon::options::sym_links - Rust
pub static FOLLOW_DIR_SYM_LINKS: &'static str
\ No newline at end of file diff --git a/dev/uu_chcon/options/sym_links/static.NO_FOLLOW_SYM_LINKS.html b/dev/uu_chcon/options/sym_links/static.NO_FOLLOW_SYM_LINKS.html index 6393fc885..3f12b0c52 100644 --- a/dev/uu_chcon/options/sym_links/static.NO_FOLLOW_SYM_LINKS.html +++ b/dev/uu_chcon/options/sym_links/static.NO_FOLLOW_SYM_LINKS.html @@ -1 +1 @@ -NO_FOLLOW_SYM_LINKS in uu_chcon::options::sym_links - Rust
pub static NO_FOLLOW_SYM_LINKS: &'static str
\ No newline at end of file +NO_FOLLOW_SYM_LINKS in uu_chcon::options::sym_links - Rust
pub static NO_FOLLOW_SYM_LINKS: &'static str
\ No newline at end of file diff --git a/dev/uu_chgrp/all.html b/dev/uu_chgrp/all.html index 80ac1e343..0b1353182 100644 --- a/dev/uu_chgrp/all.html +++ b/dev/uu_chgrp/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/fn.get_groups.html b/dev/uu_chgrp/entries/fn.get_groups.html index 2e5e35db5..fa74c78af 100644 --- a/dev/uu_chgrp/entries/fn.get_groups.html +++ b/dev/uu_chgrp/entries/fn.get_groups.html @@ -1,4 +1,4 @@ -get_groups in uu_chgrp::entries - Rust
pub fn get_groups() -> Result<Vec<u32, Global>, Error>
Expand description

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

+get_groups in uu_chgrp::entries - Rust
pub fn get_groups() -> Result<Vec<u32, Global>, Error>
Expand description

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

getgroups() returns the supplementary group IDs of the calling process in list. @@ -7,4 +7,4 @@ supplementary group IDs for the process is returned. This allows the caller to determine the size of a dynamically allocated list to be used in a further call to getgroups().

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/fn.get_groups_gnu.html b/dev/uu_chgrp/entries/fn.get_groups_gnu.html index d420ac7d1..281ed0ab9 100644 --- a/dev/uu_chgrp/entries/fn.get_groups_gnu.html +++ b/dev/uu_chgrp/entries/fn.get_groups_gnu.html @@ -1,4 +1,4 @@ -get_groups_gnu in uu_chgrp::entries - Rust
pub fn get_groups_gnu(arg_id: Option<u32>) -> Result<Vec<u32, Global>, Error>
Expand description

The list of group IDs returned from GNU’s groups and GNU’s id --groups +get_groups_gnu in uu_chgrp::entries - Rust

pub fn get_groups_gnu(arg_id: Option<u32>) -> Result<Vec<u32, Global>, Error>
Expand description

The list of group IDs returned from GNU’s groups and GNU’s id --groups starts with the effective group ID (egid). This is a wrapper for get_groups() to mimic this behavior.

If arg_id is None (default), get_groups_gnu moves the effective @@ -20,4 +20,4 @@ groups is the same (in the mathematical sense of ``set’’). (The history of a process and its parents could affect the details of the result.)

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/fn.gid2grp.html b/dev/uu_chgrp/entries/fn.gid2grp.html index df0a92c4e..071c1b503 100644 --- a/dev/uu_chgrp/entries/fn.gid2grp.html +++ b/dev/uu_chgrp/entries/fn.gid2grp.html @@ -1 +1 @@ -gid2grp in uu_chgrp::entries - Rust
pub fn gid2grp(id: u32) -> Result<String, Error>
\ No newline at end of file +gid2grp in uu_chgrp::entries - Rust
pub fn gid2grp(id: u32) -> Result<String, Error>
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/fn.grp2gid.html b/dev/uu_chgrp/entries/fn.grp2gid.html index 53bec10ea..3973a06f4 100644 --- a/dev/uu_chgrp/entries/fn.grp2gid.html +++ b/dev/uu_chgrp/entries/fn.grp2gid.html @@ -1 +1 @@ -grp2gid in uu_chgrp::entries - Rust
pub fn grp2gid(name: &str) -> Result<u32, Error>
\ No newline at end of file +grp2gid in uu_chgrp::entries - Rust
pub fn grp2gid(name: &str) -> Result<u32, Error>
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/fn.uid2usr.html b/dev/uu_chgrp/entries/fn.uid2usr.html index 77eee6c04..d337be7e6 100644 --- a/dev/uu_chgrp/entries/fn.uid2usr.html +++ b/dev/uu_chgrp/entries/fn.uid2usr.html @@ -1 +1 @@ -uid2usr in uu_chgrp::entries - Rust
pub fn uid2usr(id: u32) -> Result<String, Error>
\ No newline at end of file +uid2usr in uu_chgrp::entries - Rust
pub fn uid2usr(id: u32) -> Result<String, Error>
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/fn.usr2uid.html b/dev/uu_chgrp/entries/fn.usr2uid.html index 73840d4f5..6b68af9af 100644 --- a/dev/uu_chgrp/entries/fn.usr2uid.html +++ b/dev/uu_chgrp/entries/fn.usr2uid.html @@ -1 +1 @@ -usr2uid in uu_chgrp::entries - Rust
pub fn usr2uid(name: &str) -> Result<u32, Error>
\ No newline at end of file +usr2uid in uu_chgrp::entries - Rust
pub fn usr2uid(name: &str) -> Result<u32, Error>
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/index.html b/dev/uu_chgrp/entries/index.html index 15b04885d..22928ad1d 100644 --- a/dev/uu_chgrp/entries/index.html +++ b/dev/uu_chgrp/entries/index.html @@ -1,28 +1,25 @@ -uu_chgrp::entries - Rust
Expand description

Get password/group file entry

+uu_chgrp::entries - Rust
Expand description

Get password/group file entry

Examples:

-
use uucore::entries::{self, Locate};
+
use uucore::entries::{self, Locate};
 
-let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
-    "root"
-} else {
-    "wheel"
-};
+let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
+    "root"
+} else {
+    "wheel"
+};
 
-assert_eq!("root", entries::uid2usr(0).unwrap());
-assert_eq!(0, entries::usr2uid("root").unwrap());
-assert!(entries::gid2grp(0).is_ok());
-assert!(entries::grp2gid(root_group).is_ok());
+assert_eq!("root", entries::uid2usr(0).unwrap());
+assert_eq!(0, entries::usr2uid("root").unwrap());
+assert!(entries::gid2grp(0).is_ok());
+assert!(entries::grp2gid(root_group).is_ok());
 
-assert!(entries::Passwd::locate(0).is_ok());
-assert!(entries::Passwd::locate("0").is_ok());
-assert!(entries::Passwd::locate("root").is_ok());
+assert!(entries::Passwd::locate(0).is_ok());
+assert!(entries::Passwd::locate("0").is_ok());
+assert!(entries::Passwd::locate("root").is_ok());
 
-assert!(entries::Group::locate(0).is_ok());
-assert!(entries::Group::locate("0").is_ok());
-assert!(entries::Group::locate(root_group).is_ok());
-

Structs

Traits

Fetch desired entry.

-

Functions

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

-

The list of group IDs returned from GNU’s groups and GNU’s id --groups +assert!(entries::Group::locate(0).is_ok()); +assert!(entries::Group::locate("0").is_ok()); +assert!(entries::Group::locate(root_group).is_ok());

+

Structs

Traits

Fetch desired entry.

Functions

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>
The list of group IDs returned from GNU’s groups and GNU’s id --groups starts with the effective group ID (egid). -This is a wrapper for get_groups() to mimic this behavior.

-
\ No newline at end of file +This is a wrapper for get_groups() to mimic this behavior.
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/struct.Group.html b/dev/uu_chgrp/entries/struct.Group.html index 85aa7fff3..51b29de18 100644 --- a/dev/uu_chgrp/entries/struct.Group.html +++ b/dev/uu_chgrp/entries/struct.Group.html @@ -1,23 +1,10 @@ -Group in uu_chgrp::entries - Rust
pub struct Group {
-    pub name: String,
-    pub gid: u32,
-}

Fields

name: String

AKA group.gr_name

-
gid: u32

AKA group.gr_gid

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Group in uu_chgrp::entries - Rust
pub struct Group {
+    pub name: String,
+    pub gid: u32,
+}

Fields

name: String

AKA group.gr_name

+
gid: u32

AKA group.gr_gid

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/struct.Passwd.html b/dev/uu_chgrp/entries/struct.Passwd.html index 6e4ad7c7c..fc7dfcebf 100644 --- a/dev/uu_chgrp/entries/struct.Passwd.html +++ b/dev/uu_chgrp/entries/struct.Passwd.html @@ -1,19 +1,19 @@ -Passwd in uu_chgrp::entries - Rust
pub struct Passwd {
-    pub name: String,
-    pub uid: u32,
-    pub gid: u32,
-    pub user_info: Option<String>,
-    pub user_shell: Option<String>,
-    pub user_dir: Option<String>,
-    pub user_passwd: Option<String>,
-}

Fields

name: String

AKA passwd.pw_name

-
uid: u32

AKA passwd.pw_uid

-
gid: u32

AKA passwd.pw_gid

-
user_info: Option<String>

AKA passwd.pw_gecos

-
user_shell: Option<String>

AKA passwd.pw_shell

-
user_dir: Option<String>

AKA passwd.pw_dir

-
user_passwd: Option<String>

AKA passwd.pw_passwd

-

Implementations

This is a wrapper function for libc::getgrouplist.

+Passwd in uu_chgrp::entries - Rust
pub struct Passwd {
+    pub name: String,
+    pub uid: u32,
+    pub gid: u32,
+    pub user_info: Option<String>,
+    pub user_shell: Option<String>,
+    pub user_dir: Option<String>,
+    pub user_passwd: Option<String>,
+}

Fields

name: String

AKA passwd.pw_name

+
uid: u32

AKA passwd.pw_uid

+
gid: u32

AKA passwd.pw_gid

+
user_info: Option<String>

AKA passwd.pw_gecos

+
user_shell: Option<String>

AKA passwd.pw_shell

+
user_dir: Option<String>

AKA passwd.pw_dir

+
user_passwd: Option<String>

AKA passwd.pw_passwd

+

Implementations

This is a wrapper function for libc::getgrouplist.

From: <https://man7.org/linux/man-pages/man3/getgrouplist.3.html>

If the number of groups of which user is a member is less than or @@ -27,21 +27,8 @@ call getgrouplist().

not update ngroups if ngroups is too small. Therefore, if not updated by getgrouplist, ngroups needs to be increased in a loop until getgrouplist stops returning -1.

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_chgrp/entries/trait.Locate.html b/dev/uu_chgrp/entries/trait.Locate.html index 6bd0d0c59..5b64fec77 100644 --- a/dev/uu_chgrp/entries/trait.Locate.html +++ b/dev/uu_chgrp/entries/trait.Locate.html @@ -1,4 +1,4 @@ -Locate in uu_chgrp::entries - Rust
pub trait Locate<K> {
-    fn locate(key: K) -> Result<Self, Error>;
+Locate in uu_chgrp::entries - Rust
pub trait Locate<K> {
+    fn locate(key: K) -> Result<Self, Error>;
 }
Expand description

Fetch desired entry.

-

Required Methods

Implementors

\ No newline at end of file +

Required Methods

Implementors

\ No newline at end of file diff --git a/dev/uu_chgrp/fn.uu_app.html b/dev/uu_chgrp/fn.uu_app.html index 5efa93f55..81915bec5 100644 --- a/dev/uu_chgrp/fn.uu_app.html +++ b/dev/uu_chgrp/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_chgrp - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_chgrp - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_chgrp/fn.uumain.html b/dev/uu_chgrp/fn.uumain.html index c137c5415..8460fe72b 100644 --- a/dev/uu_chgrp/fn.uumain.html +++ b/dev/uu_chgrp/fn.uumain.html @@ -1 +1 @@ -uumain in uu_chgrp - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_chgrp - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_chgrp/index.html b/dev/uu_chgrp/index.html index b474b48d3..aaaae6e79 100644 --- a/dev/uu_chgrp/index.html +++ b/dev/uu_chgrp/index.html @@ -1,2 +1 @@ -uu_chgrp - Rust

Modules

Get password/group file entry

-

Functions

\ No newline at end of file +uu_chgrp - Rust

Modules

Get password/group file entry

Functions

\ No newline at end of file diff --git a/dev/uu_chmod/all.html b/dev/uu_chmod/all.html index cd33373bf..66e7ceb9e 100644 --- a/dev/uu_chmod/all.html +++ b/dev/uu_chmod/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_chmod/fn.uu_app.html b/dev/uu_chmod/fn.uu_app.html index ea5b5ed14..6d97bbcae 100644 --- a/dev/uu_chmod/fn.uu_app.html +++ b/dev/uu_chmod/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_chmod - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_chmod - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_chmod/fn.uumain.html b/dev/uu_chmod/fn.uumain.html index adfb45737..1c324fff6 100644 --- a/dev/uu_chmod/fn.uumain.html +++ b/dev/uu_chmod/fn.uumain.html @@ -1 +1 @@ -uumain in uu_chmod - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_chmod - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_chmod/index.html b/dev/uu_chmod/index.html index 29776bfd3..da7961db4 100644 --- a/dev/uu_chmod/index.html +++ b/dev/uu_chmod/index.html @@ -1 +1 @@ -uu_chmod - Rust
\ No newline at end of file +uu_chmod - Rust
\ No newline at end of file diff --git a/dev/uu_chown/all.html b/dev/uu_chown/all.html index 17da928ca..5ce8fed5b 100644 --- a/dev/uu_chown/all.html +++ b/dev/uu_chown/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_chown/entries/fn.get_groups.html b/dev/uu_chown/entries/fn.get_groups.html index 475633815..616bcfa9a 100644 --- a/dev/uu_chown/entries/fn.get_groups.html +++ b/dev/uu_chown/entries/fn.get_groups.html @@ -1,4 +1,4 @@ -get_groups in uu_chown::entries - Rust
pub fn get_groups() -> Result<Vec<u32, Global>, Error>
Expand description

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

+get_groups in uu_chown::entries - Rust
pub fn get_groups() -> Result<Vec<u32, Global>, Error>
Expand description

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

getgroups() returns the supplementary group IDs of the calling process in list. @@ -7,4 +7,4 @@ supplementary group IDs for the process is returned. This allows the caller to determine the size of a dynamically allocated list to be used in a further call to getgroups().

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uu_chown/entries/fn.get_groups_gnu.html b/dev/uu_chown/entries/fn.get_groups_gnu.html index 2ea1b12e7..d99992c4f 100644 --- a/dev/uu_chown/entries/fn.get_groups_gnu.html +++ b/dev/uu_chown/entries/fn.get_groups_gnu.html @@ -1,4 +1,4 @@ -get_groups_gnu in uu_chown::entries - Rust
pub fn get_groups_gnu(arg_id: Option<u32>) -> Result<Vec<u32, Global>, Error>
Expand description

The list of group IDs returned from GNU’s groups and GNU’s id --groups +get_groups_gnu in uu_chown::entries - Rust

pub fn get_groups_gnu(arg_id: Option<u32>) -> Result<Vec<u32, Global>, Error>
Expand description

The list of group IDs returned from GNU’s groups and GNU’s id --groups starts with the effective group ID (egid). This is a wrapper for get_groups() to mimic this behavior.

If arg_id is None (default), get_groups_gnu moves the effective @@ -20,4 +20,4 @@ groups is the same (in the mathematical sense of ``set’’). (The history of a process and its parents could affect the details of the result.)

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uu_chown/entries/fn.gid2grp.html b/dev/uu_chown/entries/fn.gid2grp.html index ea90215ed..825602aca 100644 --- a/dev/uu_chown/entries/fn.gid2grp.html +++ b/dev/uu_chown/entries/fn.gid2grp.html @@ -1 +1 @@ -gid2grp in uu_chown::entries - Rust
pub fn gid2grp(id: u32) -> Result<String, Error>
\ No newline at end of file +gid2grp in uu_chown::entries - Rust
pub fn gid2grp(id: u32) -> Result<String, Error>
\ No newline at end of file diff --git a/dev/uu_chown/entries/fn.grp2gid.html b/dev/uu_chown/entries/fn.grp2gid.html index bde5e765b..fcc4604b3 100644 --- a/dev/uu_chown/entries/fn.grp2gid.html +++ b/dev/uu_chown/entries/fn.grp2gid.html @@ -1 +1 @@ -grp2gid in uu_chown::entries - Rust
pub fn grp2gid(name: &str) -> Result<u32, Error>
\ No newline at end of file +grp2gid in uu_chown::entries - Rust
pub fn grp2gid(name: &str) -> Result<u32, Error>
\ No newline at end of file diff --git a/dev/uu_chown/entries/fn.uid2usr.html b/dev/uu_chown/entries/fn.uid2usr.html index 714da11ff..69211a0f1 100644 --- a/dev/uu_chown/entries/fn.uid2usr.html +++ b/dev/uu_chown/entries/fn.uid2usr.html @@ -1 +1 @@ -uid2usr in uu_chown::entries - Rust
pub fn uid2usr(id: u32) -> Result<String, Error>
\ No newline at end of file +uid2usr in uu_chown::entries - Rust
pub fn uid2usr(id: u32) -> Result<String, Error>
\ No newline at end of file diff --git a/dev/uu_chown/entries/fn.usr2uid.html b/dev/uu_chown/entries/fn.usr2uid.html index 81824dbe6..d5902e955 100644 --- a/dev/uu_chown/entries/fn.usr2uid.html +++ b/dev/uu_chown/entries/fn.usr2uid.html @@ -1 +1 @@ -usr2uid in uu_chown::entries - Rust
pub fn usr2uid(name: &str) -> Result<u32, Error>
\ No newline at end of file +usr2uid in uu_chown::entries - Rust
pub fn usr2uid(name: &str) -> Result<u32, Error>
\ No newline at end of file diff --git a/dev/uu_chown/entries/index.html b/dev/uu_chown/entries/index.html index 36426d1e8..695d5924c 100644 --- a/dev/uu_chown/entries/index.html +++ b/dev/uu_chown/entries/index.html @@ -1,28 +1,25 @@ -uu_chown::entries - Rust
Expand description

Get password/group file entry

+uu_chown::entries - Rust
Expand description

Get password/group file entry

Examples:

-
use uucore::entries::{self, Locate};
+
use uucore::entries::{self, Locate};
 
-let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
-    "root"
-} else {
-    "wheel"
-};
+let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
+    "root"
+} else {
+    "wheel"
+};
 
-assert_eq!("root", entries::uid2usr(0).unwrap());
-assert_eq!(0, entries::usr2uid("root").unwrap());
-assert!(entries::gid2grp(0).is_ok());
-assert!(entries::grp2gid(root_group).is_ok());
+assert_eq!("root", entries::uid2usr(0).unwrap());
+assert_eq!(0, entries::usr2uid("root").unwrap());
+assert!(entries::gid2grp(0).is_ok());
+assert!(entries::grp2gid(root_group).is_ok());
 
-assert!(entries::Passwd::locate(0).is_ok());
-assert!(entries::Passwd::locate("0").is_ok());
-assert!(entries::Passwd::locate("root").is_ok());
+assert!(entries::Passwd::locate(0).is_ok());
+assert!(entries::Passwd::locate("0").is_ok());
+assert!(entries::Passwd::locate("root").is_ok());
 
-assert!(entries::Group::locate(0).is_ok());
-assert!(entries::Group::locate("0").is_ok());
-assert!(entries::Group::locate(root_group).is_ok());
-

Structs

Traits

Fetch desired entry.

-

Functions

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

-

The list of group IDs returned from GNU’s groups and GNU’s id --groups +assert!(entries::Group::locate(0).is_ok()); +assert!(entries::Group::locate("0").is_ok()); +assert!(entries::Group::locate(root_group).is_ok());

+

Structs

Traits

Fetch desired entry.

Functions

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>
The list of group IDs returned from GNU’s groups and GNU’s id --groups starts with the effective group ID (egid). -This is a wrapper for get_groups() to mimic this behavior.

-
\ No newline at end of file +This is a wrapper for get_groups() to mimic this behavior.
\ No newline at end of file diff --git a/dev/uu_chown/entries/struct.Group.html b/dev/uu_chown/entries/struct.Group.html index d84f8d4f5..d085935cd 100644 --- a/dev/uu_chown/entries/struct.Group.html +++ b/dev/uu_chown/entries/struct.Group.html @@ -1,23 +1,10 @@ -Group in uu_chown::entries - Rust
pub struct Group {
-    pub name: String,
-    pub gid: u32,
-}

Fields

name: String

AKA group.gr_name

-
gid: u32

AKA group.gr_gid

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Group in uu_chown::entries - Rust
pub struct Group {
+    pub name: String,
+    pub gid: u32,
+}

Fields

name: String

AKA group.gr_name

+
gid: u32

AKA group.gr_gid

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_chown/entries/struct.Passwd.html b/dev/uu_chown/entries/struct.Passwd.html index 59fd7700c..f7571af4b 100644 --- a/dev/uu_chown/entries/struct.Passwd.html +++ b/dev/uu_chown/entries/struct.Passwd.html @@ -1,19 +1,19 @@ -Passwd in uu_chown::entries - Rust
pub struct Passwd {
-    pub name: String,
-    pub uid: u32,
-    pub gid: u32,
-    pub user_info: Option<String>,
-    pub user_shell: Option<String>,
-    pub user_dir: Option<String>,
-    pub user_passwd: Option<String>,
-}

Fields

name: String

AKA passwd.pw_name

-
uid: u32

AKA passwd.pw_uid

-
gid: u32

AKA passwd.pw_gid

-
user_info: Option<String>

AKA passwd.pw_gecos

-
user_shell: Option<String>

AKA passwd.pw_shell

-
user_dir: Option<String>

AKA passwd.pw_dir

-
user_passwd: Option<String>

AKA passwd.pw_passwd

-

Implementations

This is a wrapper function for libc::getgrouplist.

+Passwd in uu_chown::entries - Rust
pub struct Passwd {
+    pub name: String,
+    pub uid: u32,
+    pub gid: u32,
+    pub user_info: Option<String>,
+    pub user_shell: Option<String>,
+    pub user_dir: Option<String>,
+    pub user_passwd: Option<String>,
+}

Fields

name: String

AKA passwd.pw_name

+
uid: u32

AKA passwd.pw_uid

+
gid: u32

AKA passwd.pw_gid

+
user_info: Option<String>

AKA passwd.pw_gecos

+
user_shell: Option<String>

AKA passwd.pw_shell

+
user_dir: Option<String>

AKA passwd.pw_dir

+
user_passwd: Option<String>

AKA passwd.pw_passwd

+

Implementations

This is a wrapper function for libc::getgrouplist.

From: <https://man7.org/linux/man-pages/man3/getgrouplist.3.html>

If the number of groups of which user is a member is less than or @@ -27,21 +27,8 @@ call getgrouplist().

not update ngroups if ngroups is too small. Therefore, if not updated by getgrouplist, ngroups needs to be increased in a loop until getgrouplist stops returning -1.

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_chown/entries/trait.Locate.html b/dev/uu_chown/entries/trait.Locate.html index 6af021811..f330eec2d 100644 --- a/dev/uu_chown/entries/trait.Locate.html +++ b/dev/uu_chown/entries/trait.Locate.html @@ -1,4 +1,4 @@ -Locate in uu_chown::entries - Rust
pub trait Locate<K> {
-    fn locate(key: K) -> Result<Self, Error>;
+Locate in uu_chown::entries - Rust
pub trait Locate<K> {
+    fn locate(key: K) -> Result<Self, Error>;
 }
Expand description

Fetch desired entry.

-

Required Methods

Implementors

\ No newline at end of file +

Required Methods

Implementors

\ No newline at end of file diff --git a/dev/uu_chown/fn.uu_app.html b/dev/uu_chown/fn.uu_app.html index bdb46c918..402e4eabb 100644 --- a/dev/uu_chown/fn.uu_app.html +++ b/dev/uu_chown/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_chown - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_chown - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_chown/fn.uumain.html b/dev/uu_chown/fn.uumain.html index 1ccdf2872..05ae414f7 100644 --- a/dev/uu_chown/fn.uumain.html +++ b/dev/uu_chown/fn.uumain.html @@ -1 +1 @@ -uumain in uu_chown - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_chown - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_chown/index.html b/dev/uu_chown/index.html index a61bf41b3..df5b1a073 100644 --- a/dev/uu_chown/index.html +++ b/dev/uu_chown/index.html @@ -1,3 +1 @@ -uu_chown - Rust

Modules

Get password/group file entry

-

Structs

Traits

Fetch desired entry.

-

Functions

\ No newline at end of file +uu_chown - Rust

Modules

Get password/group file entry

Structs

Traits

Fetch desired entry.

Functions

\ No newline at end of file diff --git a/dev/uu_chown/struct.Group.html b/dev/uu_chown/struct.Group.html index 9c77ca1d3..06bd3a845 100644 --- a/dev/uu_chown/struct.Group.html +++ b/dev/uu_chown/struct.Group.html @@ -1,23 +1,10 @@ -Group in uu_chown - Rust
pub struct Group {
-    pub name: String,
-    pub gid: u32,
-}

Fields

name: String

AKA group.gr_name

-
gid: u32

AKA group.gr_gid

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Group in uu_chown - Rust
pub struct Group {
+    pub name: String,
+    pub gid: u32,
+}

Fields

name: String

AKA group.gr_name

+
gid: u32

AKA group.gr_gid

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_chown/struct.Passwd.html b/dev/uu_chown/struct.Passwd.html index 9c1468dff..5a0c6e8a0 100644 --- a/dev/uu_chown/struct.Passwd.html +++ b/dev/uu_chown/struct.Passwd.html @@ -1,19 +1,19 @@ -Passwd in uu_chown - Rust
pub struct Passwd {
-    pub name: String,
-    pub uid: u32,
-    pub gid: u32,
-    pub user_info: Option<String>,
-    pub user_shell: Option<String>,
-    pub user_dir: Option<String>,
-    pub user_passwd: Option<String>,
-}

Fields

name: String

AKA passwd.pw_name

-
uid: u32

AKA passwd.pw_uid

-
gid: u32

AKA passwd.pw_gid

-
user_info: Option<String>

AKA passwd.pw_gecos

-
user_shell: Option<String>

AKA passwd.pw_shell

-
user_dir: Option<String>

AKA passwd.pw_dir

-
user_passwd: Option<String>

AKA passwd.pw_passwd

-

Implementations

This is a wrapper function for libc::getgrouplist.

+Passwd in uu_chown - Rust
pub struct Passwd {
+    pub name: String,
+    pub uid: u32,
+    pub gid: u32,
+    pub user_info: Option<String>,
+    pub user_shell: Option<String>,
+    pub user_dir: Option<String>,
+    pub user_passwd: Option<String>,
+}

Fields

name: String

AKA passwd.pw_name

+
uid: u32

AKA passwd.pw_uid

+
gid: u32

AKA passwd.pw_gid

+
user_info: Option<String>

AKA passwd.pw_gecos

+
user_shell: Option<String>

AKA passwd.pw_shell

+
user_dir: Option<String>

AKA passwd.pw_dir

+
user_passwd: Option<String>

AKA passwd.pw_passwd

+

Implementations

This is a wrapper function for libc::getgrouplist.

From: <https://man7.org/linux/man-pages/man3/getgrouplist.3.html>

If the number of groups of which user is a member is less than or @@ -27,21 +27,8 @@ call getgrouplist().

not update ngroups if ngroups is too small. Therefore, if not updated by getgrouplist, ngroups needs to be increased in a loop until getgrouplist stops returning -1.

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_chown/trait.Locate.html b/dev/uu_chown/trait.Locate.html index ac26fab8e..e16fd6a29 100644 --- a/dev/uu_chown/trait.Locate.html +++ b/dev/uu_chown/trait.Locate.html @@ -1,4 +1,4 @@ -Locate in uu_chown - Rust
pub trait Locate<K> {
-    fn locate(key: K) -> Result<Self, Error>;
+Locate in uu_chown - Rust
pub trait Locate<K> {
+    fn locate(key: K) -> Result<Self, Error>;
 }
Expand description

Fetch desired entry.

-

Required Methods

Implementors

\ No newline at end of file +

Required Methods

Implementors

\ No newline at end of file diff --git a/dev/uu_chroot/all.html b/dev/uu_chroot/all.html index 122100b4b..8c06f1c76 100644 --- a/dev/uu_chroot/all.html +++ b/dev/uu_chroot/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_chroot/fn.uu_app.html b/dev/uu_chroot/fn.uu_app.html index f05eba1f4..f4e1a2c80 100644 --- a/dev/uu_chroot/fn.uu_app.html +++ b/dev/uu_chroot/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_chroot - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_chroot - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_chroot/fn.uumain.html b/dev/uu_chroot/fn.uumain.html index 4560bd3bd..397e2ee7a 100644 --- a/dev/uu_chroot/fn.uumain.html +++ b/dev/uu_chroot/fn.uumain.html @@ -1 +1 @@ -uumain in uu_chroot - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_chroot - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_chroot/index.html b/dev/uu_chroot/index.html index 7d9b2b8ce..18bb88b87 100644 --- a/dev/uu_chroot/index.html +++ b/dev/uu_chroot/index.html @@ -1 +1 @@ -uu_chroot - Rust
\ No newline at end of file +uu_chroot - Rust
\ No newline at end of file diff --git a/dev/uu_cksum/all.html b/dev/uu_cksum/all.html index e23b3af39..870b6c0ea 100644 --- a/dev/uu_cksum/all.html +++ b/dev/uu_cksum/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_cksum/fn.uu_app.html b/dev/uu_cksum/fn.uu_app.html index fe7e2a93d..244ceec28 100644 --- a/dev/uu_cksum/fn.uu_app.html +++ b/dev/uu_cksum/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_cksum - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_cksum - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_cksum/fn.uumain.html b/dev/uu_cksum/fn.uumain.html index 92cc6b5fa..eead90125 100644 --- a/dev/uu_cksum/fn.uumain.html +++ b/dev/uu_cksum/fn.uumain.html @@ -1 +1 @@ -uumain in uu_cksum - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_cksum - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_cksum/index.html b/dev/uu_cksum/index.html index d98137d96..c0b3ff565 100644 --- a/dev/uu_cksum/index.html +++ b/dev/uu_cksum/index.html @@ -1 +1 @@ -uu_cksum - Rust
\ No newline at end of file +uu_cksum - Rust
\ No newline at end of file diff --git a/dev/uu_comm/all.html b/dev/uu_comm/all.html index 382f03d6b..5cde2f19d 100644 --- a/dev/uu_comm/all.html +++ b/dev/uu_comm/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_comm/fn.uu_app.html b/dev/uu_comm/fn.uu_app.html index bfe3154d0..b29a66b2b 100644 --- a/dev/uu_comm/fn.uu_app.html +++ b/dev/uu_comm/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_comm - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_comm - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_comm/fn.uumain.html b/dev/uu_comm/fn.uumain.html index 876f6c063..6ff6d0c09 100644 --- a/dev/uu_comm/fn.uumain.html +++ b/dev/uu_comm/fn.uumain.html @@ -1 +1 @@ -uumain in uu_comm - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_comm - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_comm/index.html b/dev/uu_comm/index.html index dfae95282..38971864e 100644 --- a/dev/uu_comm/index.html +++ b/dev/uu_comm/index.html @@ -1 +1 @@ -uu_comm - Rust
\ No newline at end of file +uu_comm - Rust
\ No newline at end of file diff --git a/dev/uu_cp/all.html b/dev/uu_cp/all.html index 1e4705269..26c6b4063 100644 --- a/dev/uu_cp/all.html +++ b/dev/uu_cp/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_cp/enum.Attribute.html b/dev/uu_cp/enum.Attribute.html index 370a03c94..7daa00814 100644 --- a/dev/uu_cp/enum.Attribute.html +++ b/dev/uu_cp/enum.Attribute.html @@ -1,41 +1,16 @@ -Attribute in uu_cp - Rust
pub enum Attribute {
+Attribute in uu_cp - Rust
pub enum Attribute {
     Ownership,
     Mode,
     Timestamps,
     Context,
     Links,
     Xattr,
-}

Variants

Ownership

Mode

Timestamps

Context

Xattr

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

The associated error which can be returned from parsing.

-

Parses a string s to return a value of this type. Read more

-

This method returns an Ordering between self and other. Read more

-

Compares and returns the maximum of two values. Read more

-

Compares and returns the minimum of two values. Read more

-

Restrict a value to a certain interval. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

This method returns an ordering between self and other values if one exists. Read more

-

This method tests less than (for self and other) and is used by the < operator. Read more

-

This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

-

This method tests greater than (for self and other) and is used by the > operator. Read more

-

This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Ownership

Mode

Timestamps

Context

Xattr

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cp/enum.ClobberMode.html b/dev/uu_cp/enum.ClobberMode.html index 86a89413a..5e37c1a99 100644 --- a/dev/uu_cp/enum.ClobberMode.html +++ b/dev/uu_cp/enum.ClobberMode.html @@ -1,25 +1,12 @@ -ClobberMode in uu_cp - Rust
pub enum ClobberMode {
+ClobberMode in uu_cp - Rust
pub enum ClobberMode {
     Force,
     RemoveDestination,
     Standard,
 }
Expand description

Specifies whether when overwrite files

-

Variants

Force

RemoveDestination

Standard

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Variants

Force

RemoveDestination

Standard

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cp/enum.CopyMode.html b/dev/uu_cp/enum.CopyMode.html index 887c4d040..cf958828d 100644 --- a/dev/uu_cp/enum.CopyMode.html +++ b/dev/uu_cp/enum.CopyMode.html @@ -1,18 +1,11 @@ -CopyMode in uu_cp - Rust
pub enum CopyMode {
+CopyMode in uu_cp - Rust
pub enum CopyMode {
     Link,
     SymLink,
     Copy,
     Update,
     AttrOnly,
-}

Variants

Copy

Update

AttrOnly

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Copy

Update

AttrOnly

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cp/enum.Error.html b/dev/uu_cp/enum.Error.html index 255e93587..66bf32346 100644 --- a/dev/uu_cp/enum.Error.html +++ b/dev/uu_cp/enum.Error.html @@ -1,53 +1,33 @@ -Error in uu_cp - Rust
pub enum Error {
-    IoErr(Error),
-    IoErrContext(ErrorString),
-    Error(String),
+Error in uu_cp - Rust
pub enum Error {
+    IoErr(Error),
+    IoErrContext(ErrorString),
+    Error(String),
     NotAllFilesCopied,
     WalkDirErr(Error),
-    StripPrefixError(StripPrefixError),
-    Skipped(String),
-    InvalidArgument(String),
-    NotImplemented(String),
-    Backup(String),
-    NotADirectory(String),
-}

Variants

IoErr(Error)

Simple io::Error wrapper

-

IoErrContext(ErrorString)

Wrapper for io::Error with path context

-

Error(String)

General copy error

+ StripPrefixError(StripPrefixError), + Skipped(String), + InvalidArgument(String), + NotImplemented(String), + Backup(String), + NotADirectory(String), +}

Variants

IoErr(Error)

Simple io::Error wrapper

+

IoErrContext(ErrorString)

Wrapper for io::Error with path context

+

Error(String)

General copy error

NotAllFilesCopied

Represents the state when a non-fatal error has occurred and not all files were copied.

WalkDirErr(Error)

Simple walkdir::Error wrapper

-

StripPrefixError(StripPrefixError)

Simple std::path::StripPrefixError wrapper

-

Skipped(String)

Result of a skipped file

-

InvalidArgument(String)

Result of a skipped file

-

NotImplemented(String)

All standard options are included as an an implementation +

StripPrefixError(StripPrefixError)

Simple std::path::StripPrefixError wrapper

+

Skipped(String)

Result of a skipped file

+

InvalidArgument(String)

Result of a skipped file

+

NotImplemented(String)

All standard options are included as an an implementation path, but those that are not implemented yet should return a NotImplemented error.

-

Backup(String)

Invalid arguments to backup

-

NotADirectory(String)

Trait Implementations

Formats the value using the given formatter. Read more

-

Formats the value using the given formatter. Read more

-

The lower-level source of this error, if any. Read more

-
👎 Deprecated since 1.42.0:

use the Display impl or to_string()

-
👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

-
🔬 This is a nightly-only experimental API. (error_generic_member_access)

Provides type based access to context intended for error reports. Read more

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Error code of a custom error. Read more

-

Print usage help to a custom error. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Backup(String)

Invalid arguments to backup

+

NotADirectory(String)

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0:

use the Display impl or to_string()

+
👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

+
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Error code of a custom error. Read more
Print usage help to a custom error. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

Converts the given value to a String. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cp/enum.OverwriteMode.html b/dev/uu_cp/enum.OverwriteMode.html index d8fcfda5c..3a54291b1 100644 --- a/dev/uu_cp/enum.OverwriteMode.html +++ b/dev/uu_cp/enum.OverwriteMode.html @@ -1,28 +1,15 @@ -OverwriteMode in uu_cp - Rust
pub enum OverwriteMode {
+OverwriteMode in uu_cp - Rust
pub enum OverwriteMode {
     Clobber(ClobberMode),
     Interactive(ClobberMode),
     NoClobber,
 }
Expand description

Specifies whether when overwrite files

-

Variants

Clobber(ClobberMode)

Default Always overwrite existing files

+

Variants

Clobber(ClobberMode)

Default Always overwrite existing files

Interactive(ClobberMode)

Prompt before overwriting a file

NoClobber

Never overwrite a file

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cp/enum.ReflinkMode.html b/dev/uu_cp/enum.ReflinkMode.html index 9a17fcbc8..8e667459c 100644 --- a/dev/uu_cp/enum.ReflinkMode.html +++ b/dev/uu_cp/enum.ReflinkMode.html @@ -1,25 +1,12 @@ -ReflinkMode in uu_cp - Rust
pub enum ReflinkMode {
+ReflinkMode in uu_cp - Rust
pub enum ReflinkMode {
     Always,
     Auto,
     Never,
 }
Expand description

Possible arguments for --reflink.

-

Variants

Always

Auto

Never

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Variants

Always

Auto

Never

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cp/enum.SparseMode.html b/dev/uu_cp/enum.SparseMode.html index d8466cae9..30e82cb38 100644 --- a/dev/uu_cp/enum.SparseMode.html +++ b/dev/uu_cp/enum.SparseMode.html @@ -1,25 +1,12 @@ -SparseMode in uu_cp - Rust
pub enum SparseMode {
+SparseMode in uu_cp - Rust
pub enum SparseMode {
     Always,
     Auto,
     Never,
 }
Expand description

Possible arguments for --sparse.

-

Variants

Always

Auto

Never

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Variants

Always

Auto

Never

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cp/enum.TargetType.html b/dev/uu_cp/enum.TargetType.html index d39e55b99..3e84feaf9 100644 --- a/dev/uu_cp/enum.TargetType.html +++ b/dev/uu_cp/enum.TargetType.html @@ -1,16 +1,9 @@ -TargetType in uu_cp - Rust
pub enum TargetType {
+TargetType in uu_cp - Rust
pub enum TargetType {
     Directory,
     File,
 }
Expand description

Specifies the expected file type of copy target

-

Variants

Directory

File

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Variants

Directory

File

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cp/fn.localize_to_target.html b/dev/uu_cp/fn.localize_to_target.html index 978006d89..51de3d3d5 100644 --- a/dev/uu_cp/fn.localize_to_target.html +++ b/dev/uu_cp/fn.localize_to_target.html @@ -1,9 +1,9 @@ -localize_to_target in uu_cp - Rust
pub fn localize_to_target(
    root: &Path,
    source: &Path,
    target: &Path
) -> CopyResult<PathBuf>
Expand description

Remove the root prefix from source and prefix it with target +localize_to_target in uu_cp - Rust

pub fn localize_to_target(
    root: &Path,
    source: &Path,
    target: &Path
) -> CopyResult<PathBuf>
Expand description

Remove the root prefix from source and prefix it with target to create a file that is local to target

Examples

-
assert!(uu_cp::localize_to_target(
-    &Path::new("a/source/"),
-    &Path::new("a/source/c.txt"),
-    &Path::new("target/"),
-).unwrap() == Path::new("target/c.txt"))
-
\ No newline at end of file +
assert!(uu_cp::localize_to_target(
+    &Path::new("a/source/"),
+    &Path::new("a/source/c.txt"),
+    &Path::new("target/"),
+).unwrap() == Path::new("target/c.txt"))
+
\ No newline at end of file diff --git a/dev/uu_cp/fn.uu_app.html b/dev/uu_cp/fn.uu_app.html index d5f9a500e..b370bd586 100644 --- a/dev/uu_cp/fn.uu_app.html +++ b/dev/uu_cp/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_cp - Rust

Function uu_cp::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_cp - Rust

Function uu_cp::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_cp/fn.uumain.html b/dev/uu_cp/fn.uumain.html index 750fe12ef..97e198813 100644 --- a/dev/uu_cp/fn.uumain.html +++ b/dev/uu_cp/fn.uumain.html @@ -1 +1 @@ -uumain in uu_cp - Rust

Function uu_cp::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_cp - Rust

Function uu_cp::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_cp/fn.verify_target_type.html b/dev/uu_cp/fn.verify_target_type.html index 4db5f47ec..7d73f327f 100644 --- a/dev/uu_cp/fn.verify_target_type.html +++ b/dev/uu_cp/fn.verify_target_type.html @@ -1,2 +1,2 @@ -verify_target_type in uu_cp - Rust
pub fn verify_target_type(
    target: &Path,
    target_type: &TargetType
) -> CopyResult<()>
Expand description

Generate an error message if target is not the correct target_type

-
\ No newline at end of file +verify_target_type in uu_cp - Rust
pub fn verify_target_type(
    target: &Path,
    target_type: &TargetType
) -> CopyResult<()>
Expand description

Generate an error message if target is not the correct target_type

+
\ No newline at end of file diff --git a/dev/uu_cp/index.html b/dev/uu_cp/index.html index 52e2d0e03..0a9a78f44 100644 --- a/dev/uu_cp/index.html +++ b/dev/uu_cp/index.html @@ -1,10 +1,2 @@ -uu_cp - Rust

Structs

Re-usable, extensible copy options

-

Enums

Specifies whether when overwrite files

-

Specifies whether when overwrite files

-

Possible arguments for --reflink.

-

Possible arguments for --sparse.

-

Specifies the expected file type of copy target

-

Functions

Remove the root prefix from source and prefix it with target -to create a file that is local to target

-

Generate an error message if target is not the correct target_type

-

Type Definitions

\ No newline at end of file +uu_cp - Rust

Structs

Re-usable, extensible copy options

Enums

Specifies whether when overwrite files
Specifies whether when overwrite files
Possible arguments for --reflink.
Possible arguments for --sparse.
Specifies the expected file type of copy target

Functions

Remove the root prefix from source and prefix it with target +to create a file that is local to target
Generate an error message if target is not the correct target_type

Type Definitions

\ No newline at end of file diff --git a/dev/uu_cp/struct.Options.html b/dev/uu_cp/struct.Options.html index 5e182c886..d3fac7101 100644 --- a/dev/uu_cp/struct.Options.html +++ b/dev/uu_cp/struct.Options.html @@ -1,13 +1,6 @@ -Options in uu_cp - Rust
pub struct Options { /* private fields */ }
Expand description

Re-usable, extensible copy options

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Options in uu_cp - Rust
pub struct Options { /* private fields */ }
Expand description

Re-usable, extensible copy options

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cp/type.CopyResult.html b/dev/uu_cp/type.CopyResult.html index b027f0bb3..13df52e6a 100644 --- a/dev/uu_cp/type.CopyResult.html +++ b/dev/uu_cp/type.CopyResult.html @@ -1 +1 @@ -CopyResult in uu_cp - Rust

Type Definition uu_cp::CopyResult

source · []
pub type CopyResult<T> = Result<T, Error>;
\ No newline at end of file +CopyResult in uu_cp - Rust

Type Definition uu_cp::CopyResult

source · []
pub type CopyResult<T> = Result<T, Error>;
\ No newline at end of file diff --git a/dev/uu_cp/type.Source.html b/dev/uu_cp/type.Source.html index 3ccba9c98..ea7f26372 100644 --- a/dev/uu_cp/type.Source.html +++ b/dev/uu_cp/type.Source.html @@ -1 +1 @@ -Source in uu_cp - Rust

Type Definition uu_cp::Source

source · []
pub type Source = PathBuf;
\ No newline at end of file +Source in uu_cp - Rust

Type Definition uu_cp::Source

source · []
pub type Source = PathBuf;
\ No newline at end of file diff --git a/dev/uu_cp/type.SourceSlice.html b/dev/uu_cp/type.SourceSlice.html index 6fbd64cc9..9621f97d4 100644 --- a/dev/uu_cp/type.SourceSlice.html +++ b/dev/uu_cp/type.SourceSlice.html @@ -1 +1 @@ -SourceSlice in uu_cp - Rust

Type Definition uu_cp::SourceSlice

source · []
pub type SourceSlice = Path;
\ No newline at end of file +SourceSlice in uu_cp - Rust

Type Definition uu_cp::SourceSlice

source · []
pub type SourceSlice = Path;
\ No newline at end of file diff --git a/dev/uu_cp/type.Target.html b/dev/uu_cp/type.Target.html index 03afa6017..76b750a4d 100644 --- a/dev/uu_cp/type.Target.html +++ b/dev/uu_cp/type.Target.html @@ -1 +1 @@ -Target in uu_cp - Rust

Type Definition uu_cp::Target

source · []
pub type Target = PathBuf;
\ No newline at end of file +Target in uu_cp - Rust

Type Definition uu_cp::Target

source · []
pub type Target = PathBuf;
\ No newline at end of file diff --git a/dev/uu_cp/type.TargetSlice.html b/dev/uu_cp/type.TargetSlice.html index 50dbf2cd9..d99e05fa9 100644 --- a/dev/uu_cp/type.TargetSlice.html +++ b/dev/uu_cp/type.TargetSlice.html @@ -1 +1 @@ -TargetSlice in uu_cp - Rust

Type Definition uu_cp::TargetSlice

source · []
pub type TargetSlice = Path;
\ No newline at end of file +TargetSlice in uu_cp - Rust

Type Definition uu_cp::TargetSlice

source · []
pub type TargetSlice = Path;
\ No newline at end of file diff --git a/dev/uu_csplit/all.html b/dev/uu_csplit/all.html index b21c6d253..045006d6f 100644 --- a/dev/uu_csplit/all.html +++ b/dev/uu_csplit/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Structs

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Structs

Functions

\ No newline at end of file diff --git a/dev/uu_csplit/fn.csplit.html b/dev/uu_csplit/fn.csplit.html index 5f7469cb3..8f60c106c 100644 --- a/dev/uu_csplit/fn.csplit.html +++ b/dev/uu_csplit/fn.csplit.html @@ -1,7 +1,7 @@ -csplit in uu_csplit - Rust
pub fn csplit<T>(
    options: &CsplitOptions,
    patterns: Vec<Pattern>,
    input: T
) -> Result<(), CsplitError> where
    T: BufRead
Expand description

Splits a file into severals according to the command line patterns.

+csplit in uu_csplit - Rust
pub fn csplit<T>(
    options: &CsplitOptions,
    patterns: Vec<Pattern>,
    input: T
) -> Result<(), CsplitError>where
    T: BufRead,
Expand description

Splits a file into severals according to the command line patterns.

Errors

    -
  • io::Error if there is some problem reading/writing from/to a file.
  • +
  • io::Error if there is some problem reading/writing from/to a file.
  • [CsplitError::LineOutOfRange] if the line number pattern is larger than the number of input lines.
  • [CsplitError::LineOutOfRangeOnRepetition], like previous but after applying the pattern @@ -10,4 +10,4 @@ more than once.
  • [CsplitError::MatchNotFoundOnRepetition], like previous but after applying the pattern more than once.
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uu_csplit/fn.uu_app.html b/dev/uu_csplit/fn.uu_app.html index 07ee21f90..dc2699b54 100644 --- a/dev/uu_csplit/fn.uu_app.html +++ b/dev/uu_csplit/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_csplit - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_csplit - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_csplit/fn.uumain.html b/dev/uu_csplit/fn.uumain.html index d86dd4b84..a79b0a5a0 100644 --- a/dev/uu_csplit/fn.uumain.html +++ b/dev/uu_csplit/fn.uumain.html @@ -1 +1 @@ -uumain in uu_csplit - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_csplit - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_csplit/index.html b/dev/uu_csplit/index.html index ea7c958a3..245adf961 100644 --- a/dev/uu_csplit/index.html +++ b/dev/uu_csplit/index.html @@ -1,3 +1 @@ -uu_csplit - Rust

Structs

Command line options for csplit.

-

Functions

Splits a file into severals according to the command line patterns.

-
\ No newline at end of file +uu_csplit - Rust

Structs

Command line options for csplit.

Functions

Splits a file into severals according to the command line patterns.
\ No newline at end of file diff --git a/dev/uu_csplit/struct.CsplitOptions.html b/dev/uu_csplit/struct.CsplitOptions.html index fa34abeca..3aace7081 100644 --- a/dev/uu_csplit/struct.CsplitOptions.html +++ b/dev/uu_csplit/struct.CsplitOptions.html @@ -1,13 +1,6 @@ -CsplitOptions in uu_csplit - Rust
pub struct CsplitOptions { /* private fields */ }
Expand description

Command line options for csplit.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+CsplitOptions in uu_csplit - Rust
pub struct CsplitOptions { /* private fields */ }
Expand description

Command line options for csplit.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_cut/all.html b/dev/uu_cut/all.html index d6cd8aa44..46adea853 100644 --- a/dev/uu_cut/all.html +++ b/dev/uu_cut/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_cut/fn.uu_app.html b/dev/uu_cut/fn.uu_app.html index 676dd4040..e06f3fc35 100644 --- a/dev/uu_cut/fn.uu_app.html +++ b/dev/uu_cut/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_cut - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_cut - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_cut/fn.uumain.html b/dev/uu_cut/fn.uumain.html index b3a43342c..e916dbabf 100644 --- a/dev/uu_cut/fn.uumain.html +++ b/dev/uu_cut/fn.uumain.html @@ -1 +1 @@ -uumain in uu_cut - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_cut - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_cut/index.html b/dev/uu_cut/index.html index 4fb0a7c0a..48aabb8a9 100644 --- a/dev/uu_cut/index.html +++ b/dev/uu_cut/index.html @@ -1 +1 @@ -uu_cut - Rust
\ No newline at end of file +uu_cut - Rust
\ No newline at end of file diff --git a/dev/uu_date/all.html b/dev/uu_date/all.html index 7cd8baa68..b4e2b9237 100644 --- a/dev/uu_date/all.html +++ b/dev/uu_date/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_date/fn.uu_app.html b/dev/uu_date/fn.uu_app.html index b1f354eb8..aa306ee86 100644 --- a/dev/uu_date/fn.uu_app.html +++ b/dev/uu_date/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_date - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_date - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_date/fn.uumain.html b/dev/uu_date/fn.uumain.html index cd389285f..830bb1120 100644 --- a/dev/uu_date/fn.uumain.html +++ b/dev/uu_date/fn.uumain.html @@ -1 +1 @@ -uumain in uu_date - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_date - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_date/index.html b/dev/uu_date/index.html index 2367c8f88..7d8a51209 100644 --- a/dev/uu_date/index.html +++ b/dev/uu_date/index.html @@ -1 +1 @@ -uu_date - Rust
\ No newline at end of file +uu_date - Rust
\ No newline at end of file diff --git a/dev/uu_dd/all.html b/dev/uu_dd/all.html index d2c35326a..557969f99 100644 --- a/dev/uu_dd/all.html +++ b/dev/uu_dd/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_dd/fn.uu_app.html b/dev/uu_dd/fn.uu_app.html index 64f9d6a2c..e6ab81d17 100644 --- a/dev/uu_dd/fn.uu_app.html +++ b/dev/uu_dd/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_dd - Rust

Function uu_dd::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_dd - Rust

Function uu_dd::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_dd/fn.uumain.html b/dev/uu_dd/fn.uumain.html index 63a7b8fea..9110e09d8 100644 --- a/dev/uu_dd/fn.uumain.html +++ b/dev/uu_dd/fn.uumain.html @@ -1 +1 @@ -uumain in uu_dd - Rust

Function uu_dd::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_dd - Rust

Function uu_dd::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_dd/index.html b/dev/uu_dd/index.html index 7f8c35426..5fc7d08fc 100644 --- a/dev/uu_dd/index.html +++ b/dev/uu_dd/index.html @@ -1 +1 @@ -uu_dd - Rust
\ No newline at end of file +uu_dd - Rust
\ No newline at end of file diff --git a/dev/uu_df/all.html b/dev/uu_df/all.html index 2048b75b5..7bceb2699 100644 --- a/dev/uu_df/all.html +++ b/dev/uu_df/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_df/fn.uu_app.html b/dev/uu_df/fn.uu_app.html index 2581732dc..00e20f5d6 100644 --- a/dev/uu_df/fn.uu_app.html +++ b/dev/uu_df/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_df - Rust

Function uu_df::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_df - Rust

Function uu_df::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_df/fn.uumain.html b/dev/uu_df/fn.uumain.html index 362a0e3a6..202e68947 100644 --- a/dev/uu_df/fn.uumain.html +++ b/dev/uu_df/fn.uumain.html @@ -1 +1 @@ -uumain in uu_df - Rust

Function uu_df::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_df - Rust

Function uu_df::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_df/index.html b/dev/uu_df/index.html index 9b58a88c2..4011c74ed 100644 --- a/dev/uu_df/index.html +++ b/dev/uu_df/index.html @@ -1 +1 @@ -uu_df - Rust
\ No newline at end of file +uu_df - Rust
\ No newline at end of file diff --git a/dev/uu_dir/all.html b/dev/uu_dir/all.html index 079caa416..2e01ccb99 100644 --- a/dev/uu_dir/all.html +++ b/dev/uu_dir/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_dir/fn.uu_app.html b/dev/uu_dir/fn.uu_app.html index aecf08263..caea98759 100644 --- a/dev/uu_dir/fn.uu_app.html +++ b/dev/uu_dir/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_dir - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_dir - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_dir/fn.uumain.html b/dev/uu_dir/fn.uumain.html index b0cd984fd..eb4a5d1ee 100644 --- a/dev/uu_dir/fn.uumain.html +++ b/dev/uu_dir/fn.uumain.html @@ -1 +1 @@ -uumain in uu_dir - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_dir - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_dir/index.html b/dev/uu_dir/index.html index 879d4e0f9..9672553ff 100644 --- a/dev/uu_dir/index.html +++ b/dev/uu_dir/index.html @@ -1 +1 @@ -uu_dir - Rust
\ No newline at end of file +uu_dir - Rust
\ No newline at end of file diff --git a/dev/uu_dircolors/all.html b/dev/uu_dircolors/all.html index 4ec74e31f..af699d402 100644 --- a/dev/uu_dircolors/all.html +++ b/dev/uu_dircolors/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Enums

Traits

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Enums

Traits

Functions

\ No newline at end of file diff --git a/dev/uu_dircolors/enum.OutputFmt.html b/dev/uu_dircolors/enum.OutputFmt.html index d92efbf44..f0ce4f370 100644 --- a/dev/uu_dircolors/enum.OutputFmt.html +++ b/dev/uu_dircolors/enum.OutputFmt.html @@ -1,21 +1,12 @@ -OutputFmt in uu_dircolors - Rust
pub enum OutputFmt {
+OutputFmt in uu_dircolors - Rust
pub enum OutputFmt {
     Shell,
     CShell,
     Display,
     Unknown,
-}

Variants

Shell

CShell

Display

Unknown

Trait Implementations

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Shell

CShell

Display

Unknown

Trait Implementations

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_dircolors/fn.guess_syntax.html b/dev/uu_dircolors/fn.guess_syntax.html index 4b24615f2..47635547d 100644 --- a/dev/uu_dircolors/fn.guess_syntax.html +++ b/dev/uu_dircolors/fn.guess_syntax.html @@ -1 +1 @@ -guess_syntax in uu_dircolors - Rust
pub fn guess_syntax() -> OutputFmt
\ No newline at end of file +guess_syntax in uu_dircolors - Rust
pub fn guess_syntax() -> OutputFmt
\ No newline at end of file diff --git a/dev/uu_dircolors/fn.uu_app.html b/dev/uu_dircolors/fn.uu_app.html index f6608a688..d95fc12ab 100644 --- a/dev/uu_dircolors/fn.uu_app.html +++ b/dev/uu_dircolors/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_dircolors - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_dircolors - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_dircolors/fn.uumain.html b/dev/uu_dircolors/fn.uumain.html index 32a8748a3..516878b30 100644 --- a/dev/uu_dircolors/fn.uumain.html +++ b/dev/uu_dircolors/fn.uumain.html @@ -1 +1 @@ -uumain in uu_dircolors - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_dircolors - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_dircolors/index.html b/dev/uu_dircolors/index.html index 8b74cfe32..13b36b057 100644 --- a/dev/uu_dircolors/index.html +++ b/dev/uu_dircolors/index.html @@ -1 +1 @@ -uu_dircolors - Rust
\ No newline at end of file +uu_dircolors - Rust
\ No newline at end of file diff --git a/dev/uu_dircolors/trait.StrUtils.html b/dev/uu_dircolors/trait.StrUtils.html index 4a6c3d78f..55502c611 100644 --- a/dev/uu_dircolors/trait.StrUtils.html +++ b/dev/uu_dircolors/trait.StrUtils.html @@ -1,7 +1,7 @@ -StrUtils in uu_dircolors - Rust
pub trait StrUtils {
-    fn purify(&self) -> &Self;
-    fn split_two(&self) -> (&str, &str);
-    fn fnmatch(&self, pattern: &str) -> bool;
-}

Required Methods

Remove comments and trim whitespace

-

Like split_whitespace() but only produce 2 components

-

Implementations on Foreign Types

Implementors

\ No newline at end of file +StrUtils in uu_dircolors - Rust
pub trait StrUtils {
+    fn purify(&self) -> &Self;
+    fn split_two(&self) -> (&str, &str);
+    fn fnmatch(&self, pattern: &str) -> bool;
+}

Required Methods

Remove comments and trim whitespace

+

Like split_whitespace() but only produce 2 components

+

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/dev/uu_dirname/all.html b/dev/uu_dirname/all.html index f373d981e..0d009e7ad 100644 --- a/dev/uu_dirname/all.html +++ b/dev/uu_dirname/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_dirname/fn.uu_app.html b/dev/uu_dirname/fn.uu_app.html index de0737f6d..8c235f940 100644 --- a/dev/uu_dirname/fn.uu_app.html +++ b/dev/uu_dirname/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_dirname - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_dirname - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_dirname/fn.uumain.html b/dev/uu_dirname/fn.uumain.html index f1694bd61..9200abba1 100644 --- a/dev/uu_dirname/fn.uumain.html +++ b/dev/uu_dirname/fn.uumain.html @@ -1 +1 @@ -uumain in uu_dirname - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_dirname - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_dirname/index.html b/dev/uu_dirname/index.html index 73820ec81..646c5bcac 100644 --- a/dev/uu_dirname/index.html +++ b/dev/uu_dirname/index.html @@ -1 +1 @@ -uu_dirname - Rust
\ No newline at end of file +uu_dirname - Rust
\ No newline at end of file diff --git a/dev/uu_du/all.html b/dev/uu_du/all.html index dfeb0c5f6..2f632b46b 100644 --- a/dev/uu_du/all.html +++ b/dev/uu_du/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_du/fn.uu_app.html b/dev/uu_du/fn.uu_app.html index ba2d4a386..91ba2d44c 100644 --- a/dev/uu_du/fn.uu_app.html +++ b/dev/uu_du/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_du - Rust

Function uu_du::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_du - Rust

Function uu_du::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_du/fn.uumain.html b/dev/uu_du/fn.uumain.html index 5d1a33f29..71758167b 100644 --- a/dev/uu_du/fn.uumain.html +++ b/dev/uu_du/fn.uumain.html @@ -1 +1 @@ -uumain in uu_du - Rust

Function uu_du::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_du - Rust

Function uu_du::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_du/index.html b/dev/uu_du/index.html index 74c00403e..d4492b7e5 100644 --- a/dev/uu_du/index.html +++ b/dev/uu_du/index.html @@ -1 +1 @@ -uu_du - Rust
\ No newline at end of file +uu_du - Rust
\ No newline at end of file diff --git a/dev/uu_echo/all.html b/dev/uu_echo/all.html index 1347962ca..f4cc96cf4 100644 --- a/dev/uu_echo/all.html +++ b/dev/uu_echo/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_echo/fn.uu_app.html b/dev/uu_echo/fn.uu_app.html index 38528275a..d240b45e3 100644 --- a/dev/uu_echo/fn.uu_app.html +++ b/dev/uu_echo/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_echo - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_echo - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_echo/fn.uumain.html b/dev/uu_echo/fn.uumain.html index d3dcefae2..36653e53b 100644 --- a/dev/uu_echo/fn.uumain.html +++ b/dev/uu_echo/fn.uumain.html @@ -1 +1 @@ -uumain in uu_echo - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_echo - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_echo/index.html b/dev/uu_echo/index.html index 0f331e8eb..1dad3f7a1 100644 --- a/dev/uu_echo/index.html +++ b/dev/uu_echo/index.html @@ -1 +1 @@ -uu_echo - Rust
\ No newline at end of file +uu_echo - Rust
\ No newline at end of file diff --git a/dev/uu_env/all.html b/dev/uu_env/all.html index 6296c9572..c2bc2bb79 100644 --- a/dev/uu_env/all.html +++ b/dev/uu_env/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_env/fn.uu_app.html b/dev/uu_env/fn.uu_app.html index 2605aad26..c68269888 100644 --- a/dev/uu_env/fn.uu_app.html +++ b/dev/uu_env/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_env - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_env - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_env/fn.uumain.html b/dev/uu_env/fn.uumain.html index bf2c79f89..f498bcdbc 100644 --- a/dev/uu_env/fn.uumain.html +++ b/dev/uu_env/fn.uumain.html @@ -1 +1 @@ -uumain in uu_env - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_env - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_env/index.html b/dev/uu_env/index.html index 4abb53729..024d5b731 100644 --- a/dev/uu_env/index.html +++ b/dev/uu_env/index.html @@ -1 +1 @@ -uu_env - Rust
\ No newline at end of file +uu_env - Rust
\ No newline at end of file diff --git a/dev/uu_expand/all.html b/dev/uu_expand/all.html index 9e4c6ebc0..0162a6790 100644 --- a/dev/uu_expand/all.html +++ b/dev/uu_expand/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_expand/fn.uu_app.html b/dev/uu_expand/fn.uu_app.html index e5f3f6760..3761dc648 100644 --- a/dev/uu_expand/fn.uu_app.html +++ b/dev/uu_expand/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_expand - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_expand - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_expand/fn.uumain.html b/dev/uu_expand/fn.uumain.html index 50a831673..ee12da4f2 100644 --- a/dev/uu_expand/fn.uumain.html +++ b/dev/uu_expand/fn.uumain.html @@ -1 +1 @@ -uumain in uu_expand - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_expand - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_expand/index.html b/dev/uu_expand/index.html index a35c2c19f..70cd3f889 100644 --- a/dev/uu_expand/index.html +++ b/dev/uu_expand/index.html @@ -1 +1 @@ -uu_expand - Rust
\ No newline at end of file +uu_expand - Rust
\ No newline at end of file diff --git a/dev/uu_expand/options/index.html b/dev/uu_expand/options/index.html index 212ff6215..713aaed9f 100644 --- a/dev/uu_expand/options/index.html +++ b/dev/uu_expand/options/index.html @@ -1 +1 @@ -uu_expand::options - Rust
\ No newline at end of file +uu_expand::options - Rust
\ No newline at end of file diff --git a/dev/uu_expand/options/static.FILES.html b/dev/uu_expand/options/static.FILES.html index 9377c0563..17df8845d 100644 --- a/dev/uu_expand/options/static.FILES.html +++ b/dev/uu_expand/options/static.FILES.html @@ -1 +1 @@ -FILES in uu_expand::options - Rust
pub static FILES: &'static str
\ No newline at end of file +FILES in uu_expand::options - Rust
pub static FILES: &'static str
\ No newline at end of file diff --git a/dev/uu_expand/options/static.INITIAL.html b/dev/uu_expand/options/static.INITIAL.html index f39f4a0cf..65e6e7199 100644 --- a/dev/uu_expand/options/static.INITIAL.html +++ b/dev/uu_expand/options/static.INITIAL.html @@ -1 +1 @@ -INITIAL in uu_expand::options - Rust
pub static INITIAL: &'static str
\ No newline at end of file +INITIAL in uu_expand::options - Rust
pub static INITIAL: &'static str
\ No newline at end of file diff --git a/dev/uu_expand/options/static.NO_UTF8.html b/dev/uu_expand/options/static.NO_UTF8.html index e8c147aec..6f6610e33 100644 --- a/dev/uu_expand/options/static.NO_UTF8.html +++ b/dev/uu_expand/options/static.NO_UTF8.html @@ -1 +1 @@ -NO_UTF8 in uu_expand::options - Rust
pub static NO_UTF8: &'static str
\ No newline at end of file +NO_UTF8 in uu_expand::options - Rust
pub static NO_UTF8: &'static str
\ No newline at end of file diff --git a/dev/uu_expand/options/static.TABS.html b/dev/uu_expand/options/static.TABS.html index b57914e78..38074886b 100644 --- a/dev/uu_expand/options/static.TABS.html +++ b/dev/uu_expand/options/static.TABS.html @@ -1 +1 @@ -TABS in uu_expand::options - Rust
pub static TABS: &'static str
\ No newline at end of file +TABS in uu_expand::options - Rust
pub static TABS: &'static str
\ No newline at end of file diff --git a/dev/uu_expr/all.html b/dev/uu_expr/all.html index fd5cf2ca1..d77778a31 100644 --- a/dev/uu_expr/all.html +++ b/dev/uu_expr/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_expr/fn.uu_app.html b/dev/uu_expr/fn.uu_app.html index a698000c7..38a8250f8 100644 --- a/dev/uu_expr/fn.uu_app.html +++ b/dev/uu_expr/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_expr - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_expr - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_expr/fn.uumain.html b/dev/uu_expr/fn.uumain.html index 60af46b37..163c04fbf 100644 --- a/dev/uu_expr/fn.uumain.html +++ b/dev/uu_expr/fn.uumain.html @@ -1 +1 @@ -uumain in uu_expr - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_expr - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_expr/index.html b/dev/uu_expr/index.html index 9a204de60..649ff680f 100644 --- a/dev/uu_expr/index.html +++ b/dev/uu_expr/index.html @@ -1 +1 @@ -uu_expr - Rust
\ No newline at end of file +uu_expr - Rust
\ No newline at end of file diff --git a/dev/uu_factor/all.html b/dev/uu_factor/all.html index 379f14dc4..6b3a44219 100644 --- a/dev/uu_factor/all.html +++ b/dev/uu_factor/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_factor/fn.factor.html b/dev/uu_factor/fn.factor.html index 7e0e0466e..fe0007f94 100644 --- a/dev/uu_factor/fn.factor.html +++ b/dev/uu_factor/fn.factor.html @@ -1 +1 @@ -factor in uu_factor - Rust
pub fn factor(n: u64) -> Factors
\ No newline at end of file +factor in uu_factor - Rust
pub fn factor(n: u64) -> Factors
\ No newline at end of file diff --git a/dev/uu_factor/fn.uu_app.html b/dev/uu_factor/fn.uu_app.html index dbf090041..45a62b511 100644 --- a/dev/uu_factor/fn.uu_app.html +++ b/dev/uu_factor/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_factor - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_factor - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_factor/fn.uumain.html b/dev/uu_factor/fn.uumain.html index 0a5513a8e..5c4e01d3e 100644 --- a/dev/uu_factor/fn.uumain.html +++ b/dev/uu_factor/fn.uumain.html @@ -1 +1 @@ -uumain in uu_factor - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_factor - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_factor/index.html b/dev/uu_factor/index.html index 99a075cf5..476af5b08 100644 --- a/dev/uu_factor/index.html +++ b/dev/uu_factor/index.html @@ -1 +1 @@ -uu_factor - Rust
\ No newline at end of file +uu_factor - Rust
\ No newline at end of file diff --git a/dev/uu_factor/numeric/fn.gcd.html b/dev/uu_factor/numeric/fn.gcd.html index 89414b0c5..a94a8fc57 100644 --- a/dev/uu_factor/numeric/fn.gcd.html +++ b/dev/uu_factor/numeric/fn.gcd.html @@ -1 +1 @@ -gcd in uu_factor::numeric - Rust
pub fn gcd(u: u64, v: u64) -> u64
\ No newline at end of file +gcd in uu_factor::numeric - Rust
pub fn gcd(u: u64, v: u64) -> u64
\ No newline at end of file diff --git a/dev/uu_factor/numeric/index.html b/dev/uu_factor/numeric/index.html index 4c8e8fbf0..73fb6e342 100644 --- a/dev/uu_factor/numeric/index.html +++ b/dev/uu_factor/numeric/index.html @@ -1 +1 @@ -uu_factor::numeric - Rust
\ No newline at end of file +uu_factor::numeric - Rust
\ No newline at end of file diff --git a/dev/uu_factor/struct.Factors.html b/dev/uu_factor/struct.Factors.html index 6230f8fc3..9d96a8f24 100644 --- a/dev/uu_factor/struct.Factors.html +++ b/dev/uu_factor/struct.Factors.html @@ -1,23 +1,7 @@ -Factors in uu_factor - Rust
pub struct Factors(_);

Implementations

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Factors in uu_factor - Rust
pub struct Factors(_);

Implementations

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

Converts the given value to a String. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_factor/table/constant.CHUNK_SIZE.html b/dev/uu_factor/table/constant.CHUNK_SIZE.html index 6878156bc..4802a3736 100644 --- a/dev/uu_factor/table/constant.CHUNK_SIZE.html +++ b/dev/uu_factor/table/constant.CHUNK_SIZE.html @@ -1 +1 @@ -CHUNK_SIZE in uu_factor::table - Rust
pub const CHUNK_SIZE: usize = 8;
\ No newline at end of file +CHUNK_SIZE in uu_factor::table - Rust
pub const CHUNK_SIZE: usize = 8;
\ No newline at end of file diff --git a/dev/uu_factor/table/constant.NEXT_PRIME.html b/dev/uu_factor/table/constant.NEXT_PRIME.html index a35c59ba8..f8d0183ac 100644 --- a/dev/uu_factor/table/constant.NEXT_PRIME.html +++ b/dev/uu_factor/table/constant.NEXT_PRIME.html @@ -1 +1 @@ -NEXT_PRIME in uu_factor::table - Rust
pub const NEXT_PRIME: u64 = 2137;
\ No newline at end of file +NEXT_PRIME in uu_factor::table - Rust
pub const NEXT_PRIME: u64 = 2137;
\ No newline at end of file diff --git a/dev/uu_factor/table/constant.PRIME_INVERSIONS_U64.html b/dev/uu_factor/table/constant.PRIME_INVERSIONS_U64.html index fc20d9fae..d3e64ad1a 100644 --- a/dev/uu_factor/table/constant.PRIME_INVERSIONS_U64.html +++ b/dev/uu_factor/table/constant.PRIME_INVERSIONS_U64.html @@ -1 +1 @@ -PRIME_INVERSIONS_U64 in uu_factor::table - Rust
pub const PRIME_INVERSIONS_U64: &'static [(u64, u64, u64)];
\ No newline at end of file +PRIME_INVERSIONS_U64 in uu_factor::table - Rust
pub const PRIME_INVERSIONS_U64: &'static [(u64, u64, u64)];
\ No newline at end of file diff --git a/dev/uu_factor/table/fn.factor.html b/dev/uu_factor/table/fn.factor.html index c6701521c..56dcbf92b 100644 --- a/dev/uu_factor/table/fn.factor.html +++ b/dev/uu_factor/table/fn.factor.html @@ -1 +1 @@ -factor in uu_factor::table - Rust
pub fn factor(num: &mut u64, factors: &mut Factors)
\ No newline at end of file +factor in uu_factor::table - Rust
pub fn factor(num: &mut u64, factors: &mut Factors)
\ No newline at end of file diff --git a/dev/uu_factor/table/fn.factor_chunk.html b/dev/uu_factor/table/fn.factor_chunk.html index 36e6ca491..b44848363 100644 --- a/dev/uu_factor/table/fn.factor_chunk.html +++ b/dev/uu_factor/table/fn.factor_chunk.html @@ -1 +1 @@ -factor_chunk in uu_factor::table - Rust
pub fn factor_chunk(n_s: &mut [u64; 8], f_s: &mut [Factors; 8])
\ No newline at end of file +factor_chunk in uu_factor::table - Rust
pub fn factor_chunk(n_s: &mut [u64; 8], f_s: &mut [Factors; 8])
\ No newline at end of file diff --git a/dev/uu_factor/table/index.html b/dev/uu_factor/table/index.html index 288200da6..fd7090b7a 100644 --- a/dev/uu_factor/table/index.html +++ b/dev/uu_factor/table/index.html @@ -1 +1 @@ -uu_factor::table - Rust
\ No newline at end of file +uu_factor::table - Rust
\ No newline at end of file diff --git a/dev/uu_false/all.html b/dev/uu_false/all.html index ff703525d..e86028c23 100644 --- a/dev/uu_false/all.html +++ b/dev/uu_false/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_false/fn.uu_app.html b/dev/uu_false/fn.uu_app.html index 5351f8537..2dbc9ffee 100644 --- a/dev/uu_false/fn.uu_app.html +++ b/dev/uu_false/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_false - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_false - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_false/fn.uumain.html b/dev/uu_false/fn.uumain.html index b64f4ce9a..73d09da4c 100644 --- a/dev/uu_false/fn.uumain.html +++ b/dev/uu_false/fn.uumain.html @@ -1 +1 @@ -uumain in uu_false - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_false - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_false/index.html b/dev/uu_false/index.html index b796c3965..e8d21ef87 100644 --- a/dev/uu_false/index.html +++ b/dev/uu_false/index.html @@ -1 +1 @@ -uu_false - Rust
\ No newline at end of file +uu_false - Rust
\ No newline at end of file diff --git a/dev/uu_fmt/all.html b/dev/uu_fmt/all.html index 065c8e46e..66beeed8f 100644 --- a/dev/uu_fmt/all.html +++ b/dev/uu_fmt/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Structs

Functions

Typedefs

\ No newline at end of file +List of all items in this crate

List of all items

Structs

Functions

Typedefs

\ No newline at end of file diff --git a/dev/uu_fmt/fn.uu_app.html b/dev/uu_fmt/fn.uu_app.html index 182e81a10..0943d99fb 100644 --- a/dev/uu_fmt/fn.uu_app.html +++ b/dev/uu_fmt/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_fmt - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_fmt - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_fmt/fn.uumain.html b/dev/uu_fmt/fn.uumain.html index 6e0027d8f..984e27054 100644 --- a/dev/uu_fmt/fn.uumain.html +++ b/dev/uu_fmt/fn.uumain.html @@ -1 +1 @@ -uumain in uu_fmt - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_fmt - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_fmt/index.html b/dev/uu_fmt/index.html index f45d58ae6..7bfe3f87d 100644 --- a/dev/uu_fmt/index.html +++ b/dev/uu_fmt/index.html @@ -1 +1 @@ -uu_fmt - Rust
\ No newline at end of file +uu_fmt - Rust
\ No newline at end of file diff --git a/dev/uu_fmt/struct.FmtOptions.html b/dev/uu_fmt/struct.FmtOptions.html index 638881afa..fa44609e6 100644 --- a/dev/uu_fmt/struct.FmtOptions.html +++ b/dev/uu_fmt/struct.FmtOptions.html @@ -1,12 +1,5 @@ -FmtOptions in uu_fmt - Rust
pub struct FmtOptions { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+FmtOptions in uu_fmt - Rust
pub struct FmtOptions { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_fmt/type.FileOrStdReader.html b/dev/uu_fmt/type.FileOrStdReader.html index 472ab36cb..b5f8876c9 100644 --- a/dev/uu_fmt/type.FileOrStdReader.html +++ b/dev/uu_fmt/type.FileOrStdReader.html @@ -1 +1 @@ -FileOrStdReader in uu_fmt - Rust

Type Definition uu_fmt::FileOrStdReader

source · []
pub type FileOrStdReader = BufReader<Box<dyn Read + 'static>>;
\ No newline at end of file +FileOrStdReader in uu_fmt - Rust

Type Definition uu_fmt::FileOrStdReader

source · []
pub type FileOrStdReader = BufReader<Box<dyn Read + 'static>>;
\ No newline at end of file diff --git a/dev/uu_fold/all.html b/dev/uu_fold/all.html index 624343e56..1cafaf1f9 100644 --- a/dev/uu_fold/all.html +++ b/dev/uu_fold/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_fold/fn.uu_app.html b/dev/uu_fold/fn.uu_app.html index acf37ee7a..20914beeb 100644 --- a/dev/uu_fold/fn.uu_app.html +++ b/dev/uu_fold/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_fold - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_fold - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_fold/fn.uumain.html b/dev/uu_fold/fn.uumain.html index 08be008dc..a20d1adb4 100644 --- a/dev/uu_fold/fn.uumain.html +++ b/dev/uu_fold/fn.uumain.html @@ -1 +1 @@ -uumain in uu_fold - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_fold - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_fold/index.html b/dev/uu_fold/index.html index 76cafae6d..37b9c8164 100644 --- a/dev/uu_fold/index.html +++ b/dev/uu_fold/index.html @@ -1 +1 @@ -uu_fold - Rust
\ No newline at end of file +uu_fold - Rust
\ No newline at end of file diff --git a/dev/uu_groups/all.html b/dev/uu_groups/all.html index 7d566da27..b0299a03c 100644 --- a/dev/uu_groups/all.html +++ b/dev/uu_groups/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_groups/fn.uu_app.html b/dev/uu_groups/fn.uu_app.html index e9406c1f6..1867ce245 100644 --- a/dev/uu_groups/fn.uu_app.html +++ b/dev/uu_groups/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_groups - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_groups - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_groups/fn.uumain.html b/dev/uu_groups/fn.uumain.html index 8db426d5a..7caedc2dc 100644 --- a/dev/uu_groups/fn.uumain.html +++ b/dev/uu_groups/fn.uumain.html @@ -1 +1 @@ -uumain in uu_groups - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_groups - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_groups/index.html b/dev/uu_groups/index.html index c24ada8b4..5550a99f3 100644 --- a/dev/uu_groups/index.html +++ b/dev/uu_groups/index.html @@ -1 +1 @@ -uu_groups - Rust
\ No newline at end of file +uu_groups - Rust
\ No newline at end of file diff --git a/dev/uu_hashsum/all.html b/dev/uu_hashsum/all.html index d8780d3a1..3e4d74bc1 100644 --- a/dev/uu_hashsum/all.html +++ b/dev/uu_hashsum/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_hashsum/fn.uu_app_b3sum.html b/dev/uu_hashsum/fn.uu_app_b3sum.html index ca28fa2fa..e247cad75 100644 --- a/dev/uu_hashsum/fn.uu_app_b3sum.html +++ b/dev/uu_hashsum/fn.uu_app_b3sum.html @@ -1 +1 @@ -uu_app_b3sum in uu_hashsum - Rust
pub fn uu_app_b3sum() -> Command
\ No newline at end of file +uu_app_b3sum in uu_hashsum - Rust
pub fn uu_app_b3sum() -> Command
\ No newline at end of file diff --git a/dev/uu_hashsum/fn.uu_app_bits.html b/dev/uu_hashsum/fn.uu_app_bits.html index 031c0a0b5..0bb30006e 100644 --- a/dev/uu_hashsum/fn.uu_app_bits.html +++ b/dev/uu_hashsum/fn.uu_app_bits.html @@ -1 +1 @@ -uu_app_bits in uu_hashsum - Rust
pub fn uu_app_bits() -> Command
\ No newline at end of file +uu_app_bits in uu_hashsum - Rust
pub fn uu_app_bits() -> Command
\ No newline at end of file diff --git a/dev/uu_hashsum/fn.uu_app_common.html b/dev/uu_hashsum/fn.uu_app_common.html index dc78f558e..e0a0c1b17 100644 --- a/dev/uu_hashsum/fn.uu_app_common.html +++ b/dev/uu_hashsum/fn.uu_app_common.html @@ -1 +1 @@ -uu_app_common in uu_hashsum - Rust
pub fn uu_app_common() -> Command
\ No newline at end of file +uu_app_common in uu_hashsum - Rust
pub fn uu_app_common() -> Command
\ No newline at end of file diff --git a/dev/uu_hashsum/fn.uu_app_custom.html b/dev/uu_hashsum/fn.uu_app_custom.html index 4c890505f..09b1497c6 100644 --- a/dev/uu_hashsum/fn.uu_app_custom.html +++ b/dev/uu_hashsum/fn.uu_app_custom.html @@ -1 +1 @@ -uu_app_custom in uu_hashsum - Rust
pub fn uu_app_custom() -> Command
\ No newline at end of file +uu_app_custom in uu_hashsum - Rust
pub fn uu_app_custom() -> Command
\ No newline at end of file diff --git a/dev/uu_hashsum/fn.uumain.html b/dev/uu_hashsum/fn.uumain.html index a970b88ab..b74e85371 100644 --- a/dev/uu_hashsum/fn.uumain.html +++ b/dev/uu_hashsum/fn.uumain.html @@ -1 +1 @@ -uumain in uu_hashsum - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_hashsum - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_hashsum/index.html b/dev/uu_hashsum/index.html index 234121e49..4c8d2d780 100644 --- a/dev/uu_hashsum/index.html +++ b/dev/uu_hashsum/index.html @@ -1 +1 @@ -uu_hashsum - Rust
\ No newline at end of file +uu_hashsum - Rust
\ No newline at end of file diff --git a/dev/uu_head/all.html b/dev/uu_head/all.html index 57e510201..c9a5ccdfb 100644 --- a/dev/uu_head/all.html +++ b/dev/uu_head/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_head/fn.uu_app.html b/dev/uu_head/fn.uu_app.html index e9d3c131a..20359057b 100644 --- a/dev/uu_head/fn.uu_app.html +++ b/dev/uu_head/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_head - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_head - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_head/fn.uumain.html b/dev/uu_head/fn.uumain.html index c824c584b..64607af86 100644 --- a/dev/uu_head/fn.uumain.html +++ b/dev/uu_head/fn.uumain.html @@ -1 +1 @@ -uumain in uu_head - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_head - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_head/index.html b/dev/uu_head/index.html index ca1682ee7..976815673 100644 --- a/dev/uu_head/index.html +++ b/dev/uu_head/index.html @@ -1 +1 @@ -uu_head - Rust
\ No newline at end of file +uu_head - Rust
\ No newline at end of file diff --git a/dev/uu_hostid/all.html b/dev/uu_hostid/all.html index 3ef63ec77..3f46b4d04 100644 --- a/dev/uu_hostid/all.html +++ b/dev/uu_hostid/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_hostid/fn.gethostid.html b/dev/uu_hostid/fn.gethostid.html index fb4c1599e..6ecc6169f 100644 --- a/dev/uu_hostid/fn.gethostid.html +++ b/dev/uu_hostid/fn.gethostid.html @@ -1 +1 @@ -gethostid in uu_hostid - Rust
pub unsafe extern "C" fn gethostid() -> c_long
\ No newline at end of file +gethostid in uu_hostid - Rust
pub unsafe extern "C" fn gethostid() -> c_long
\ No newline at end of file diff --git a/dev/uu_hostid/fn.uu_app.html b/dev/uu_hostid/fn.uu_app.html index e24790979..1d6a3a05c 100644 --- a/dev/uu_hostid/fn.uu_app.html +++ b/dev/uu_hostid/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_hostid - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_hostid - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_hostid/fn.uumain.html b/dev/uu_hostid/fn.uumain.html index dea0d2ee7..5f1338c3c 100644 --- a/dev/uu_hostid/fn.uumain.html +++ b/dev/uu_hostid/fn.uumain.html @@ -1 +1 @@ -uumain in uu_hostid - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_hostid - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_hostid/index.html b/dev/uu_hostid/index.html index d6b971535..727c7b866 100644 --- a/dev/uu_hostid/index.html +++ b/dev/uu_hostid/index.html @@ -1 +1 @@ -uu_hostid - Rust
\ No newline at end of file +uu_hostid - Rust
\ No newline at end of file diff --git a/dev/uu_hostname/all.html b/dev/uu_hostname/all.html index 46bfe12dd..7279f7484 100644 --- a/dev/uu_hostname/all.html +++ b/dev/uu_hostname/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_hostname/fn.uu_app.html b/dev/uu_hostname/fn.uu_app.html index 33fa2ad53..af034d56e 100644 --- a/dev/uu_hostname/fn.uu_app.html +++ b/dev/uu_hostname/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_hostname - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_hostname - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_hostname/fn.uumain.html b/dev/uu_hostname/fn.uumain.html index e8b95d9f5..e0af45389 100644 --- a/dev/uu_hostname/fn.uumain.html +++ b/dev/uu_hostname/fn.uumain.html @@ -1 +1 @@ -uumain in uu_hostname - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_hostname - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_hostname/index.html b/dev/uu_hostname/index.html index 2a3cc6842..2cd522793 100644 --- a/dev/uu_hostname/index.html +++ b/dev/uu_hostname/index.html @@ -1 +1 @@ -uu_hostname - Rust
\ No newline at end of file +uu_hostname - Rust
\ No newline at end of file diff --git a/dev/uu_id/all.html b/dev/uu_id/all.html index bd756df38..2dc2b638d 100644 --- a/dev/uu_id/all.html +++ b/dev/uu_id/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_id/fn.uu_app.html b/dev/uu_id/fn.uu_app.html index 5e94dfab5..45b1c832f 100644 --- a/dev/uu_id/fn.uu_app.html +++ b/dev/uu_id/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_id - Rust

Function uu_id::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_id - Rust

Function uu_id::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_id/fn.uumain.html b/dev/uu_id/fn.uumain.html index f41e2e9d9..e4202ecf5 100644 --- a/dev/uu_id/fn.uumain.html +++ b/dev/uu_id/fn.uumain.html @@ -1 +1 @@ -uumain in uu_id - Rust

Function uu_id::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_id - Rust

Function uu_id::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_id/index.html b/dev/uu_id/index.html index 6eb4e7c0e..0337828b8 100644 --- a/dev/uu_id/index.html +++ b/dev/uu_id/index.html @@ -1 +1 @@ -uu_id - Rust

Re-exports

pub use uucore::libc;

Functions

\ No newline at end of file +uu_id - Rust

Re-exports

pub use uucore::libc;

Functions

\ No newline at end of file diff --git a/dev/uu_install/all.html b/dev/uu_install/all.html index 8d232ba40..6154a6d60 100644 --- a/dev/uu_install/all.html +++ b/dev/uu_install/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Structs

Enums

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Structs

Enums

Functions

\ No newline at end of file diff --git a/dev/uu_install/enum.MainFunction.html b/dev/uu_install/enum.MainFunction.html index 7c1f03621..f0ace1dd3 100644 --- a/dev/uu_install/enum.MainFunction.html +++ b/dev/uu_install/enum.MainFunction.html @@ -1,25 +1,12 @@ -MainFunction in uu_install - Rust
pub enum MainFunction {
+MainFunction in uu_install - Rust
pub enum MainFunction {
     Directory,
     Standard,
 }

Variants

Directory

Create directories

Standard

Install files to locations (primary functionality)

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_install/fn.uu_app.html b/dev/uu_install/fn.uu_app.html index ec48ff283..e34cac8ec 100644 --- a/dev/uu_install/fn.uu_app.html +++ b/dev/uu_install/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_install - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_install - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_install/fn.uumain.html b/dev/uu_install/fn.uumain.html index 6feb60278..c65ff9873 100644 --- a/dev/uu_install/fn.uumain.html +++ b/dev/uu_install/fn.uumain.html @@ -1 +1 @@ -uumain in uu_install - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_install - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_install/index.html b/dev/uu_install/index.html index c6bbb54f5..9a781d79a 100644 --- a/dev/uu_install/index.html +++ b/dev/uu_install/index.html @@ -1 +1 @@ -uu_install - Rust
\ No newline at end of file +uu_install - Rust
\ No newline at end of file diff --git a/dev/uu_install/struct.Behavior.html b/dev/uu_install/struct.Behavior.html index b9134e6e2..6b0689d82 100644 --- a/dev/uu_install/struct.Behavior.html +++ b/dev/uu_install/struct.Behavior.html @@ -1,13 +1,6 @@ -Behavior in uu_install - Rust
pub struct Behavior { /* private fields */ }

Implementations

Determine the mode for chmod after copy.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Behavior in uu_install - Rust
pub struct Behavior { /* private fields */ }

Implementations

Determine the mode for chmod after copy.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_join/all.html b/dev/uu_join/all.html index 3cfd68c73..360bc77f7 100644 --- a/dev/uu_join/all.html +++ b/dev/uu_join/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_join/fn.uu_app.html b/dev/uu_join/fn.uu_app.html index bbfac8f0a..7af7c02cc 100644 --- a/dev/uu_join/fn.uu_app.html +++ b/dev/uu_join/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_join - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_join - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_join/fn.uumain.html b/dev/uu_join/fn.uumain.html index da8c063d8..0dbd78ed6 100644 --- a/dev/uu_join/fn.uumain.html +++ b/dev/uu_join/fn.uumain.html @@ -1 +1 @@ -uumain in uu_join - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_join - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_join/index.html b/dev/uu_join/index.html index 5b89bea92..bcb8c064c 100644 --- a/dev/uu_join/index.html +++ b/dev/uu_join/index.html @@ -1 +1 @@ -uu_join - Rust
\ No newline at end of file +uu_join - Rust
\ No newline at end of file diff --git a/dev/uu_kill/all.html b/dev/uu_kill/all.html index 84e3ef4db..7aa0c796b 100644 --- a/dev/uu_kill/all.html +++ b/dev/uu_kill/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_kill/enum.Mode.html b/dev/uu_kill/enum.Mode.html index 66e1227a8..0d5c0c53d 100644 --- a/dev/uu_kill/enum.Mode.html +++ b/dev/uu_kill/enum.Mode.html @@ -1,21 +1,9 @@ -Mode in uu_kill - Rust
pub enum Mode {
+Mode in uu_kill - Rust
pub enum Mode {
     Kill,
     Table,
     List,
-}

Variants

Kill

Table

List

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Kill

Table

List

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_kill/fn.uu_app.html b/dev/uu_kill/fn.uu_app.html index b4db15778..c302ca4a0 100644 --- a/dev/uu_kill/fn.uu_app.html +++ b/dev/uu_kill/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_kill - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_kill - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_kill/fn.uumain.html b/dev/uu_kill/fn.uumain.html index 7982ec078..80542c105 100644 --- a/dev/uu_kill/fn.uumain.html +++ b/dev/uu_kill/fn.uumain.html @@ -1 +1 @@ -uumain in uu_kill - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_kill - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_kill/index.html b/dev/uu_kill/index.html index 9e5539642..e02126af1 100644 --- a/dev/uu_kill/index.html +++ b/dev/uu_kill/index.html @@ -1 +1 @@ -uu_kill - Rust
\ No newline at end of file +uu_kill - Rust
\ No newline at end of file diff --git a/dev/uu_kill/options/index.html b/dev/uu_kill/options/index.html index a9cbc5707..3a72b2091 100644 --- a/dev/uu_kill/options/index.html +++ b/dev/uu_kill/options/index.html @@ -1 +1 @@ -uu_kill::options - Rust
\ No newline at end of file +uu_kill::options - Rust
\ No newline at end of file diff --git a/dev/uu_kill/options/static.LIST.html b/dev/uu_kill/options/static.LIST.html index c9a0f58cb..66c892d18 100644 --- a/dev/uu_kill/options/static.LIST.html +++ b/dev/uu_kill/options/static.LIST.html @@ -1 +1 @@ -LIST in uu_kill::options - Rust
pub static LIST: &'static str
\ No newline at end of file +LIST in uu_kill::options - Rust
pub static LIST: &'static str
\ No newline at end of file diff --git a/dev/uu_kill/options/static.PIDS_OR_SIGNALS.html b/dev/uu_kill/options/static.PIDS_OR_SIGNALS.html index cc8c7a707..c770a6cbf 100644 --- a/dev/uu_kill/options/static.PIDS_OR_SIGNALS.html +++ b/dev/uu_kill/options/static.PIDS_OR_SIGNALS.html @@ -1 +1 @@ -PIDS_OR_SIGNALS in uu_kill::options - Rust
pub static PIDS_OR_SIGNALS: &'static str
\ No newline at end of file +PIDS_OR_SIGNALS in uu_kill::options - Rust
pub static PIDS_OR_SIGNALS: &'static str
\ No newline at end of file diff --git a/dev/uu_kill/options/static.SIGNAL.html b/dev/uu_kill/options/static.SIGNAL.html index eac377ae7..f19427214 100644 --- a/dev/uu_kill/options/static.SIGNAL.html +++ b/dev/uu_kill/options/static.SIGNAL.html @@ -1 +1 @@ -SIGNAL in uu_kill::options - Rust
pub static SIGNAL: &'static str
\ No newline at end of file +SIGNAL in uu_kill::options - Rust
pub static SIGNAL: &'static str
\ No newline at end of file diff --git a/dev/uu_kill/options/static.TABLE.html b/dev/uu_kill/options/static.TABLE.html index 8df9f265e..2f0c95016 100644 --- a/dev/uu_kill/options/static.TABLE.html +++ b/dev/uu_kill/options/static.TABLE.html @@ -1 +1 @@ -TABLE in uu_kill::options - Rust
pub static TABLE: &'static str
\ No newline at end of file +TABLE in uu_kill::options - Rust
pub static TABLE: &'static str
\ No newline at end of file diff --git a/dev/uu_link/all.html b/dev/uu_link/all.html index 3e2e24eec..3fa3cba7b 100644 --- a/dev/uu_link/all.html +++ b/dev/uu_link/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

Statics

\ No newline at end of file +List of all items in this crate

List of all items

Functions

Statics

\ No newline at end of file diff --git a/dev/uu_link/fn.uu_app.html b/dev/uu_link/fn.uu_app.html index 40d0759e0..e16c6350a 100644 --- a/dev/uu_link/fn.uu_app.html +++ b/dev/uu_link/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_link - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_link - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_link/fn.uumain.html b/dev/uu_link/fn.uumain.html index 1a6845632..0f9a047f3 100644 --- a/dev/uu_link/fn.uumain.html +++ b/dev/uu_link/fn.uumain.html @@ -1 +1 @@ -uumain in uu_link - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_link - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_link/index.html b/dev/uu_link/index.html index cee53dcb2..9d19db96e 100644 --- a/dev/uu_link/index.html +++ b/dev/uu_link/index.html @@ -1 +1 @@ -uu_link - Rust
\ No newline at end of file +uu_link - Rust
\ No newline at end of file diff --git a/dev/uu_link/options/index.html b/dev/uu_link/options/index.html index 4cb47ed9f..30aede8cd 100644 --- a/dev/uu_link/options/index.html +++ b/dev/uu_link/options/index.html @@ -1 +1 @@ -uu_link::options - Rust
\ No newline at end of file +uu_link::options - Rust
\ No newline at end of file diff --git a/dev/uu_link/options/static.FILES.html b/dev/uu_link/options/static.FILES.html index 4deef5537..2e712f924 100644 --- a/dev/uu_link/options/static.FILES.html +++ b/dev/uu_link/options/static.FILES.html @@ -1 +1 @@ -FILES in uu_link::options - Rust
pub static FILES: &'static str
\ No newline at end of file +FILES in uu_link::options - Rust
pub static FILES: &'static str
\ No newline at end of file diff --git a/dev/uu_ln/all.html b/dev/uu_ln/all.html index f807c7415..b01feac0b 100644 --- a/dev/uu_ln/all.html +++ b/dev/uu_ln/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Structs

Enums

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Structs

Enums

Functions

\ No newline at end of file diff --git a/dev/uu_ln/enum.OverwriteMode.html b/dev/uu_ln/enum.OverwriteMode.html index 439f1e64b..d1f1a569f 100644 --- a/dev/uu_ln/enum.OverwriteMode.html +++ b/dev/uu_ln/enum.OverwriteMode.html @@ -1,25 +1,11 @@ -OverwriteMode in uu_ln - Rust
pub enum OverwriteMode {
+OverwriteMode in uu_ln - Rust
pub enum OverwriteMode {
     NoClobber,
     Interactive,
     Force,
-}

Variants

NoClobber

Interactive

Force

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

NoClobber

Interactive

Force

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_ln/fn.uu_app.html b/dev/uu_ln/fn.uu_app.html index c5b0a0cce..7b3c0384a 100644 --- a/dev/uu_ln/fn.uu_app.html +++ b/dev/uu_ln/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_ln - Rust

Function uu_ln::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_ln - Rust

Function uu_ln::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_ln/fn.uumain.html b/dev/uu_ln/fn.uumain.html index 25763c6ef..d02d6ffa5 100644 --- a/dev/uu_ln/fn.uumain.html +++ b/dev/uu_ln/fn.uumain.html @@ -1 +1 @@ -uumain in uu_ln - Rust

Function uu_ln::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_ln - Rust

Function uu_ln::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_ln/index.html b/dev/uu_ln/index.html index 4efcb5c30..feee59708 100644 --- a/dev/uu_ln/index.html +++ b/dev/uu_ln/index.html @@ -1 +1 @@ -uu_ln - Rust
\ No newline at end of file +uu_ln - Rust
\ No newline at end of file diff --git a/dev/uu_ln/struct.Settings.html b/dev/uu_ln/struct.Settings.html index f1838eaca..8fb3a0e7c 100644 --- a/dev/uu_ln/struct.Settings.html +++ b/dev/uu_ln/struct.Settings.html @@ -1,12 +1,5 @@ -Settings in uu_ln - Rust
pub struct Settings { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Settings in uu_ln - Rust
pub struct Settings { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_logname/all.html b/dev/uu_logname/all.html index ccea3aaba..e5ccc4a16 100644 --- a/dev/uu_logname/all.html +++ b/dev/uu_logname/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_logname/fn.getlogin.html b/dev/uu_logname/fn.getlogin.html index d9d11f57c..435346105 100644 --- a/dev/uu_logname/fn.getlogin.html +++ b/dev/uu_logname/fn.getlogin.html @@ -1 +1 @@ -getlogin in uu_logname - Rust
pub unsafe extern "C" fn getlogin() -> *const c_char
\ No newline at end of file +getlogin in uu_logname - Rust
pub unsafe extern "C" fn getlogin() -> *const c_char
\ No newline at end of file diff --git a/dev/uu_logname/fn.uu_app.html b/dev/uu_logname/fn.uu_app.html index 60ad8793f..8be07a903 100644 --- a/dev/uu_logname/fn.uu_app.html +++ b/dev/uu_logname/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_logname - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_logname - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_logname/fn.uumain.html b/dev/uu_logname/fn.uumain.html index 65025c539..4aa41fa1e 100644 --- a/dev/uu_logname/fn.uumain.html +++ b/dev/uu_logname/fn.uumain.html @@ -1 +1 @@ -uumain in uu_logname - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_logname - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_logname/index.html b/dev/uu_logname/index.html index f745a860f..bc5ab25d2 100644 --- a/dev/uu_logname/index.html +++ b/dev/uu_logname/index.html @@ -1 +1 @@ -uu_logname - Rust
\ No newline at end of file +uu_logname - Rust
\ No newline at end of file diff --git a/dev/uu_ls/all.html b/dev/uu_ls/all.html index fef7698c1..05fd1077b 100644 --- a/dev/uu_ls/all.html +++ b/dev/uu_ls/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_ls/enum.Format.html b/dev/uu_ls/enum.Format.html index 7ca9722df..d71052a34 100644 --- a/dev/uu_ls/enum.Format.html +++ b/dev/uu_ls/enum.Format.html @@ -1,22 +1,13 @@ -Format in uu_ls - Rust
pub enum Format {
+Format in uu_ls - Rust
pub enum Format {
     Columns,
     Long,
     OneLine,
     Across,
     Commas,
-}

Variants

Columns

Long

OneLine

Across

Commas

Trait Implementations

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Columns

Long

OneLine

Across

Commas

Trait Implementations

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_ls/fn.list.html b/dev/uu_ls/fn.list.html index 5ccc46932..edea2bdcc 100644 --- a/dev/uu_ls/fn.list.html +++ b/dev/uu_ls/fn.list.html @@ -1 +1 @@ -list in uu_ls - Rust

Function uu_ls::list

source · []
pub fn list(locs: Vec<&Path>, config: &Config) -> UResult<()>
\ No newline at end of file +list in uu_ls - Rust

Function uu_ls::list

source · []
pub fn list(locs: Vec<&Path>, config: &Config) -> UResult<()>
\ No newline at end of file diff --git a/dev/uu_ls/fn.uu_app.html b/dev/uu_ls/fn.uu_app.html index 369dbff27..99331f8c0 100644 --- a/dev/uu_ls/fn.uu_app.html +++ b/dev/uu_ls/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_ls - Rust

Function uu_ls::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_ls - Rust

Function uu_ls::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_ls/fn.uumain.html b/dev/uu_ls/fn.uumain.html index 4ea10e04c..81afe447e 100644 --- a/dev/uu_ls/fn.uumain.html +++ b/dev/uu_ls/fn.uumain.html @@ -1 +1 @@ -uumain in uu_ls - Rust

Function uu_ls::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_ls - Rust

Function uu_ls::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_ls/index.html b/dev/uu_ls/index.html index 7d0cdbd5e..98257a946 100644 --- a/dev/uu_ls/index.html +++ b/dev/uu_ls/index.html @@ -1 +1 @@ -uu_ls - Rust
\ No newline at end of file +uu_ls - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/dereference/index.html b/dev/uu_ls/options/dereference/index.html index 0bcb4fe0c..27a0b013e 100644 --- a/dev/uu_ls/options/dereference/index.html +++ b/dev/uu_ls/options/dereference/index.html @@ -1 +1 @@ -uu_ls::options::dereference - Rust
\ No newline at end of file +uu_ls::options::dereference - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/dereference/static.ALL.html b/dev/uu_ls/options/dereference/static.ALL.html index b2d7ea85d..559a13601 100644 --- a/dev/uu_ls/options/dereference/static.ALL.html +++ b/dev/uu_ls/options/dereference/static.ALL.html @@ -1 +1 @@ -ALL in uu_ls::options::dereference - Rust
pub static ALL: &'static str
\ No newline at end of file +ALL in uu_ls::options::dereference - Rust
pub static ALL: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/dereference/static.ARGS.html b/dev/uu_ls/options/dereference/static.ARGS.html index 4e1c24690..146f95f2b 100644 --- a/dev/uu_ls/options/dereference/static.ARGS.html +++ b/dev/uu_ls/options/dereference/static.ARGS.html @@ -1 +1 @@ -ARGS in uu_ls::options::dereference - Rust
pub static ARGS: &'static str
\ No newline at end of file +ARGS in uu_ls::options::dereference - Rust
pub static ARGS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/dereference/static.DIR_ARGS.html b/dev/uu_ls/options/dereference/static.DIR_ARGS.html index 0076229a3..f7ef4412c 100644 --- a/dev/uu_ls/options/dereference/static.DIR_ARGS.html +++ b/dev/uu_ls/options/dereference/static.DIR_ARGS.html @@ -1 +1 @@ -DIR_ARGS in uu_ls::options::dereference - Rust
pub static DIR_ARGS: &'static str
\ No newline at end of file +DIR_ARGS in uu_ls::options::dereference - Rust
pub static DIR_ARGS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/files/index.html b/dev/uu_ls/options/files/index.html index b49f7978f..76e3982da 100644 --- a/dev/uu_ls/options/files/index.html +++ b/dev/uu_ls/options/files/index.html @@ -1 +1 @@ -uu_ls::options::files - Rust
\ No newline at end of file +uu_ls::options::files - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/files/static.ALL.html b/dev/uu_ls/options/files/static.ALL.html index 0342dc940..685b89e9e 100644 --- a/dev/uu_ls/options/files/static.ALL.html +++ b/dev/uu_ls/options/files/static.ALL.html @@ -1 +1 @@ -ALL in uu_ls::options::files - Rust
pub static ALL: &'static str
\ No newline at end of file +ALL in uu_ls::options::files - Rust
pub static ALL: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/files/static.ALMOST_ALL.html b/dev/uu_ls/options/files/static.ALMOST_ALL.html index 580960a92..51c6d09a3 100644 --- a/dev/uu_ls/options/files/static.ALMOST_ALL.html +++ b/dev/uu_ls/options/files/static.ALMOST_ALL.html @@ -1 +1 @@ -ALMOST_ALL in uu_ls::options::files - Rust
pub static ALMOST_ALL: &'static str
\ No newline at end of file +ALMOST_ALL in uu_ls::options::files - Rust
pub static ALMOST_ALL: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/format/index.html b/dev/uu_ls/options/format/index.html index 148883f5b..573e9d243 100644 --- a/dev/uu_ls/options/format/index.html +++ b/dev/uu_ls/options/format/index.html @@ -1 +1 @@ -uu_ls::options::format - Rust
\ No newline at end of file +uu_ls::options::format - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/format/static.ACROSS.html b/dev/uu_ls/options/format/static.ACROSS.html index bbadb502b..a4d985f5b 100644 --- a/dev/uu_ls/options/format/static.ACROSS.html +++ b/dev/uu_ls/options/format/static.ACROSS.html @@ -1 +1 @@ -ACROSS in uu_ls::options::format - Rust
pub static ACROSS: &'static str
\ No newline at end of file +ACROSS in uu_ls::options::format - Rust
pub static ACROSS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/format/static.COLUMNS.html b/dev/uu_ls/options/format/static.COLUMNS.html index 6aa3e7100..a3d3929db 100644 --- a/dev/uu_ls/options/format/static.COLUMNS.html +++ b/dev/uu_ls/options/format/static.COLUMNS.html @@ -1 +1 @@ -COLUMNS in uu_ls::options::format - Rust
pub static COLUMNS: &'static str
\ No newline at end of file +COLUMNS in uu_ls::options::format - Rust
pub static COLUMNS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/format/static.COMMAS.html b/dev/uu_ls/options/format/static.COMMAS.html index 1ea30c1bd..c08b79ff3 100644 --- a/dev/uu_ls/options/format/static.COMMAS.html +++ b/dev/uu_ls/options/format/static.COMMAS.html @@ -1 +1 @@ -COMMAS in uu_ls::options::format - Rust
pub static COMMAS: &'static str
\ No newline at end of file +COMMAS in uu_ls::options::format - Rust
pub static COMMAS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/format/static.LONG.html b/dev/uu_ls/options/format/static.LONG.html index c9b3e3f22..c37b4973d 100644 --- a/dev/uu_ls/options/format/static.LONG.html +++ b/dev/uu_ls/options/format/static.LONG.html @@ -1 +1 @@ -LONG in uu_ls::options::format - Rust
pub static LONG: &'static str
\ No newline at end of file +LONG in uu_ls::options::format - Rust
pub static LONG: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/format/static.LONG_NO_GROUP.html b/dev/uu_ls/options/format/static.LONG_NO_GROUP.html index 86893e555..6c069e056 100644 --- a/dev/uu_ls/options/format/static.LONG_NO_GROUP.html +++ b/dev/uu_ls/options/format/static.LONG_NO_GROUP.html @@ -1 +1 @@ -LONG_NO_GROUP in uu_ls::options::format - Rust
pub static LONG_NO_GROUP: &'static str
\ No newline at end of file +LONG_NO_GROUP in uu_ls::options::format - Rust
pub static LONG_NO_GROUP: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/format/static.LONG_NO_OWNER.html b/dev/uu_ls/options/format/static.LONG_NO_OWNER.html index 06019136c..1c13e493c 100644 --- a/dev/uu_ls/options/format/static.LONG_NO_OWNER.html +++ b/dev/uu_ls/options/format/static.LONG_NO_OWNER.html @@ -1 +1 @@ -LONG_NO_OWNER in uu_ls::options::format - Rust
pub static LONG_NO_OWNER: &'static str
\ No newline at end of file +LONG_NO_OWNER in uu_ls::options::format - Rust
pub static LONG_NO_OWNER: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/format/static.LONG_NUMERIC_UID_GID.html b/dev/uu_ls/options/format/static.LONG_NUMERIC_UID_GID.html index 9f7600fbf..16193ada0 100644 --- a/dev/uu_ls/options/format/static.LONG_NUMERIC_UID_GID.html +++ b/dev/uu_ls/options/format/static.LONG_NUMERIC_UID_GID.html @@ -1 +1 @@ -LONG_NUMERIC_UID_GID in uu_ls::options::format - Rust
pub static LONG_NUMERIC_UID_GID: &'static str
\ No newline at end of file +LONG_NUMERIC_UID_GID in uu_ls::options::format - Rust
pub static LONG_NUMERIC_UID_GID: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/format/static.ONE_LINE.html b/dev/uu_ls/options/format/static.ONE_LINE.html index af8fb39e2..c95d6641b 100644 --- a/dev/uu_ls/options/format/static.ONE_LINE.html +++ b/dev/uu_ls/options/format/static.ONE_LINE.html @@ -1 +1 @@ -ONE_LINE in uu_ls::options::format - Rust
pub static ONE_LINE: &'static str
\ No newline at end of file +ONE_LINE in uu_ls::options::format - Rust
pub static ONE_LINE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/format/static.TAB_SIZE.html b/dev/uu_ls/options/format/static.TAB_SIZE.html index 0ca64f224..dee3afeba 100644 --- a/dev/uu_ls/options/format/static.TAB_SIZE.html +++ b/dev/uu_ls/options/format/static.TAB_SIZE.html @@ -1 +1 @@ -TAB_SIZE in uu_ls::options::format - Rust
pub static TAB_SIZE: &'static str
\ No newline at end of file +TAB_SIZE in uu_ls::options::format - Rust
pub static TAB_SIZE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/index.html b/dev/uu_ls/options/index.html index 8d24bb05c..44b16f8c4 100644 --- a/dev/uu_ls/options/index.html +++ b/dev/uu_ls/options/index.html @@ -1 +1 @@ -uu_ls::options - Rust
\ No newline at end of file +uu_ls::options - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/indicator_style/index.html b/dev/uu_ls/options/indicator_style/index.html index f24529dcb..663618374 100644 --- a/dev/uu_ls/options/indicator_style/index.html +++ b/dev/uu_ls/options/indicator_style/index.html @@ -1 +1 @@ -uu_ls::options::indicator_style - Rust
\ No newline at end of file +uu_ls::options::indicator_style - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/indicator_style/static.CLASSIFY.html b/dev/uu_ls/options/indicator_style/static.CLASSIFY.html index 47603eb3f..28438de85 100644 --- a/dev/uu_ls/options/indicator_style/static.CLASSIFY.html +++ b/dev/uu_ls/options/indicator_style/static.CLASSIFY.html @@ -1 +1 @@ -CLASSIFY in uu_ls::options::indicator_style - Rust
pub static CLASSIFY: &'static str
\ No newline at end of file +CLASSIFY in uu_ls::options::indicator_style - Rust
pub static CLASSIFY: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/indicator_style/static.FILE_TYPE.html b/dev/uu_ls/options/indicator_style/static.FILE_TYPE.html index 44f75b184..7b0eb4c1e 100644 --- a/dev/uu_ls/options/indicator_style/static.FILE_TYPE.html +++ b/dev/uu_ls/options/indicator_style/static.FILE_TYPE.html @@ -1 +1 @@ -FILE_TYPE in uu_ls::options::indicator_style - Rust
pub static FILE_TYPE: &'static str
\ No newline at end of file +FILE_TYPE in uu_ls::options::indicator_style - Rust
pub static FILE_TYPE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/indicator_style/static.SLASH.html b/dev/uu_ls/options/indicator_style/static.SLASH.html index 81ed9ff3b..5b30559ef 100644 --- a/dev/uu_ls/options/indicator_style/static.SLASH.html +++ b/dev/uu_ls/options/indicator_style/static.SLASH.html @@ -1 +1 @@ -SLASH in uu_ls::options::indicator_style - Rust
pub static SLASH: &'static str
\ No newline at end of file +SLASH in uu_ls::options::indicator_style - Rust
pub static SLASH: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/quoting/index.html b/dev/uu_ls/options/quoting/index.html index c9a15f23a..bb349a3a9 100644 --- a/dev/uu_ls/options/quoting/index.html +++ b/dev/uu_ls/options/quoting/index.html @@ -1 +1 @@ -uu_ls::options::quoting - Rust
\ No newline at end of file +uu_ls::options::quoting - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/quoting/static.C.html b/dev/uu_ls/options/quoting/static.C.html index cde619d07..852fdabd3 100644 --- a/dev/uu_ls/options/quoting/static.C.html +++ b/dev/uu_ls/options/quoting/static.C.html @@ -1 +1 @@ -C in uu_ls::options::quoting - Rust
pub static C: &'static str
\ No newline at end of file +C in uu_ls::options::quoting - Rust
pub static C: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/quoting/static.ESCAPE.html b/dev/uu_ls/options/quoting/static.ESCAPE.html index 8e1144798..9c287969a 100644 --- a/dev/uu_ls/options/quoting/static.ESCAPE.html +++ b/dev/uu_ls/options/quoting/static.ESCAPE.html @@ -1 +1 @@ -ESCAPE in uu_ls::options::quoting - Rust
pub static ESCAPE: &'static str
\ No newline at end of file +ESCAPE in uu_ls::options::quoting - Rust
pub static ESCAPE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/quoting/static.LITERAL.html b/dev/uu_ls/options/quoting/static.LITERAL.html index 3887302a2..4c716d805 100644 --- a/dev/uu_ls/options/quoting/static.LITERAL.html +++ b/dev/uu_ls/options/quoting/static.LITERAL.html @@ -1 +1 @@ -LITERAL in uu_ls::options::quoting - Rust
pub static LITERAL: &'static str
\ No newline at end of file +LITERAL in uu_ls::options::quoting - Rust
pub static LITERAL: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/size/index.html b/dev/uu_ls/options/size/index.html index 24ef9eb44..9259aed99 100644 --- a/dev/uu_ls/options/size/index.html +++ b/dev/uu_ls/options/size/index.html @@ -1 +1 @@ -uu_ls::options::size - Rust
\ No newline at end of file +uu_ls::options::size - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/size/static.ALLOCATION_SIZE.html b/dev/uu_ls/options/size/static.ALLOCATION_SIZE.html index 19eb7d390..5e680f4f3 100644 --- a/dev/uu_ls/options/size/static.ALLOCATION_SIZE.html +++ b/dev/uu_ls/options/size/static.ALLOCATION_SIZE.html @@ -1 +1 @@ -ALLOCATION_SIZE in uu_ls::options::size - Rust
pub static ALLOCATION_SIZE: &'static str
\ No newline at end of file +ALLOCATION_SIZE in uu_ls::options::size - Rust
pub static ALLOCATION_SIZE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/size/static.BLOCK_SIZE.html b/dev/uu_ls/options/size/static.BLOCK_SIZE.html index 4848ee23d..6f51b3f81 100644 --- a/dev/uu_ls/options/size/static.BLOCK_SIZE.html +++ b/dev/uu_ls/options/size/static.BLOCK_SIZE.html @@ -1 +1 @@ -BLOCK_SIZE in uu_ls::options::size - Rust
pub static BLOCK_SIZE: &'static str
\ No newline at end of file +BLOCK_SIZE in uu_ls::options::size - Rust
pub static BLOCK_SIZE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/size/static.HUMAN_READABLE.html b/dev/uu_ls/options/size/static.HUMAN_READABLE.html index b91695e8d..5dec0fe67 100644 --- a/dev/uu_ls/options/size/static.HUMAN_READABLE.html +++ b/dev/uu_ls/options/size/static.HUMAN_READABLE.html @@ -1 +1 @@ -HUMAN_READABLE in uu_ls::options::size - Rust
pub static HUMAN_READABLE: &'static str
\ No newline at end of file +HUMAN_READABLE in uu_ls::options::size - Rust
pub static HUMAN_READABLE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/size/static.KIBIBYTES.html b/dev/uu_ls/options/size/static.KIBIBYTES.html index 6b954a108..5c46f20fc 100644 --- a/dev/uu_ls/options/size/static.KIBIBYTES.html +++ b/dev/uu_ls/options/size/static.KIBIBYTES.html @@ -1 +1 @@ -KIBIBYTES in uu_ls::options::size - Rust
pub static KIBIBYTES: &'static str
\ No newline at end of file +KIBIBYTES in uu_ls::options::size - Rust
pub static KIBIBYTES: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/size/static.SI.html b/dev/uu_ls/options/size/static.SI.html index 0b683609c..21d474dbe 100644 --- a/dev/uu_ls/options/size/static.SI.html +++ b/dev/uu_ls/options/size/static.SI.html @@ -1 +1 @@ -SI in uu_ls::options::size - Rust
pub static SI: &'static str
\ No newline at end of file +SI in uu_ls::options::size - Rust
pub static SI: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/sort/index.html b/dev/uu_ls/options/sort/index.html index f407aa9b5..6c3d3d667 100644 --- a/dev/uu_ls/options/sort/index.html +++ b/dev/uu_ls/options/sort/index.html @@ -1 +1 @@ -uu_ls::options::sort - Rust
\ No newline at end of file +uu_ls::options::sort - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/sort/static.EXTENSION.html b/dev/uu_ls/options/sort/static.EXTENSION.html index c47c2c7ef..4b0340464 100644 --- a/dev/uu_ls/options/sort/static.EXTENSION.html +++ b/dev/uu_ls/options/sort/static.EXTENSION.html @@ -1 +1 @@ -EXTENSION in uu_ls::options::sort - Rust
pub static EXTENSION: &'static str
\ No newline at end of file +EXTENSION in uu_ls::options::sort - Rust
pub static EXTENSION: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/sort/static.NONE.html b/dev/uu_ls/options/sort/static.NONE.html index ad04644b6..bf6def40e 100644 --- a/dev/uu_ls/options/sort/static.NONE.html +++ b/dev/uu_ls/options/sort/static.NONE.html @@ -1 +1 @@ -NONE in uu_ls::options::sort - Rust
pub static NONE: &'static str
\ No newline at end of file +NONE in uu_ls::options::sort - Rust
pub static NONE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/sort/static.SIZE.html b/dev/uu_ls/options/sort/static.SIZE.html index eedf8b7dc..33aa01c52 100644 --- a/dev/uu_ls/options/sort/static.SIZE.html +++ b/dev/uu_ls/options/sort/static.SIZE.html @@ -1 +1 @@ -SIZE in uu_ls::options::sort - Rust
pub static SIZE: &'static str
\ No newline at end of file +SIZE in uu_ls::options::sort - Rust
pub static SIZE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/sort/static.TIME.html b/dev/uu_ls/options/sort/static.TIME.html index b5ff4cbbf..7c6f3d8b7 100644 --- a/dev/uu_ls/options/sort/static.TIME.html +++ b/dev/uu_ls/options/sort/static.TIME.html @@ -1 +1 @@ -TIME in uu_ls::options::sort - Rust
pub static TIME: &'static str
\ No newline at end of file +TIME in uu_ls::options::sort - Rust
pub static TIME: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/sort/static.VERSION.html b/dev/uu_ls/options/sort/static.VERSION.html index b78167899..4b4fbc5c9 100644 --- a/dev/uu_ls/options/sort/static.VERSION.html +++ b/dev/uu_ls/options/sort/static.VERSION.html @@ -1 +1 @@ -VERSION in uu_ls::options::sort - Rust
pub static VERSION: &'static str
\ No newline at end of file +VERSION in uu_ls::options::sort - Rust
pub static VERSION: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.AUTHOR.html b/dev/uu_ls/options/static.AUTHOR.html index 2fdcbaa39..e0785a358 100644 --- a/dev/uu_ls/options/static.AUTHOR.html +++ b/dev/uu_ls/options/static.AUTHOR.html @@ -1 +1 @@ -AUTHOR in uu_ls::options - Rust
pub static AUTHOR: &'static str
\ No newline at end of file +AUTHOR in uu_ls::options - Rust
pub static AUTHOR: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.COLOR.html b/dev/uu_ls/options/static.COLOR.html index 0e66222f9..ed309b7b5 100644 --- a/dev/uu_ls/options/static.COLOR.html +++ b/dev/uu_ls/options/static.COLOR.html @@ -1 +1 @@ -COLOR in uu_ls::options - Rust
pub static COLOR: &'static str
\ No newline at end of file +COLOR in uu_ls::options - Rust
pub static COLOR: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.CONTEXT.html b/dev/uu_ls/options/static.CONTEXT.html index c173f23d4..502cdfb1d 100644 --- a/dev/uu_ls/options/static.CONTEXT.html +++ b/dev/uu_ls/options/static.CONTEXT.html @@ -1 +1 @@ -CONTEXT in uu_ls::options - Rust
pub static CONTEXT: &'static str
\ No newline at end of file +CONTEXT in uu_ls::options - Rust
pub static CONTEXT: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.DIRECTORY.html b/dev/uu_ls/options/static.DIRECTORY.html index 115972c2a..de3781c32 100644 --- a/dev/uu_ls/options/static.DIRECTORY.html +++ b/dev/uu_ls/options/static.DIRECTORY.html @@ -1 +1 @@ -DIRECTORY in uu_ls::options - Rust
pub static DIRECTORY: &'static str
\ No newline at end of file +DIRECTORY in uu_ls::options - Rust
pub static DIRECTORY: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.DIRED.html b/dev/uu_ls/options/static.DIRED.html index 55cf01429..64095be67 100644 --- a/dev/uu_ls/options/static.DIRED.html +++ b/dev/uu_ls/options/static.DIRED.html @@ -1 +1 @@ -DIRED in uu_ls::options - Rust
pub static DIRED: &'static str
\ No newline at end of file +DIRED in uu_ls::options - Rust
pub static DIRED: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.FORMAT.html b/dev/uu_ls/options/static.FORMAT.html index fb9add93a..556160863 100644 --- a/dev/uu_ls/options/static.FORMAT.html +++ b/dev/uu_ls/options/static.FORMAT.html @@ -1 +1 @@ -FORMAT in uu_ls::options - Rust
pub static FORMAT: &'static str
\ No newline at end of file +FORMAT in uu_ls::options - Rust
pub static FORMAT: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.FULL_TIME.html b/dev/uu_ls/options/static.FULL_TIME.html index 4cda3a7c3..02b1d5d49 100644 --- a/dev/uu_ls/options/static.FULL_TIME.html +++ b/dev/uu_ls/options/static.FULL_TIME.html @@ -1 +1 @@ -FULL_TIME in uu_ls::options - Rust
pub static FULL_TIME: &'static str
\ No newline at end of file +FULL_TIME in uu_ls::options - Rust
pub static FULL_TIME: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.GROUP_DIRECTORIES_FIRST.html b/dev/uu_ls/options/static.GROUP_DIRECTORIES_FIRST.html index 405be0296..1c5633aac 100644 --- a/dev/uu_ls/options/static.GROUP_DIRECTORIES_FIRST.html +++ b/dev/uu_ls/options/static.GROUP_DIRECTORIES_FIRST.html @@ -1 +1 @@ -GROUP_DIRECTORIES_FIRST in uu_ls::options - Rust
pub static GROUP_DIRECTORIES_FIRST: &'static str
\ No newline at end of file +GROUP_DIRECTORIES_FIRST in uu_ls::options - Rust
pub static GROUP_DIRECTORIES_FIRST: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.HELP.html b/dev/uu_ls/options/static.HELP.html index 244aee2fe..299155aaf 100644 --- a/dev/uu_ls/options/static.HELP.html +++ b/dev/uu_ls/options/static.HELP.html @@ -1 +1 @@ -HELP in uu_ls::options - Rust
pub static HELP: &'static str
\ No newline at end of file +HELP in uu_ls::options - Rust
pub static HELP: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.HIDE.html b/dev/uu_ls/options/static.HIDE.html index 221a90efa..628952994 100644 --- a/dev/uu_ls/options/static.HIDE.html +++ b/dev/uu_ls/options/static.HIDE.html @@ -1 +1 @@ -HIDE in uu_ls::options - Rust
pub static HIDE: &'static str
\ No newline at end of file +HIDE in uu_ls::options - Rust
pub static HIDE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.HIDE_CONTROL_CHARS.html b/dev/uu_ls/options/static.HIDE_CONTROL_CHARS.html index f64011675..e5a909f11 100644 --- a/dev/uu_ls/options/static.HIDE_CONTROL_CHARS.html +++ b/dev/uu_ls/options/static.HIDE_CONTROL_CHARS.html @@ -1 +1 @@ -HIDE_CONTROL_CHARS in uu_ls::options - Rust
pub static HIDE_CONTROL_CHARS: &'static str
\ No newline at end of file +HIDE_CONTROL_CHARS in uu_ls::options - Rust
pub static HIDE_CONTROL_CHARS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.IGNORE.html b/dev/uu_ls/options/static.IGNORE.html index bab35037b..b8b90c814 100644 --- a/dev/uu_ls/options/static.IGNORE.html +++ b/dev/uu_ls/options/static.IGNORE.html @@ -1 +1 @@ -IGNORE in uu_ls::options - Rust
pub static IGNORE: &'static str
\ No newline at end of file +IGNORE in uu_ls::options - Rust
pub static IGNORE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.IGNORE_BACKUPS.html b/dev/uu_ls/options/static.IGNORE_BACKUPS.html index 1a9c33ce1..661754492 100644 --- a/dev/uu_ls/options/static.IGNORE_BACKUPS.html +++ b/dev/uu_ls/options/static.IGNORE_BACKUPS.html @@ -1 +1 @@ -IGNORE_BACKUPS in uu_ls::options - Rust
pub static IGNORE_BACKUPS: &'static str
\ No newline at end of file +IGNORE_BACKUPS in uu_ls::options - Rust
pub static IGNORE_BACKUPS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.INDICATOR_STYLE.html b/dev/uu_ls/options/static.INDICATOR_STYLE.html index be51562f8..1343fcb35 100644 --- a/dev/uu_ls/options/static.INDICATOR_STYLE.html +++ b/dev/uu_ls/options/static.INDICATOR_STYLE.html @@ -1 +1 @@ -INDICATOR_STYLE in uu_ls::options - Rust
pub static INDICATOR_STYLE: &'static str
\ No newline at end of file +INDICATOR_STYLE in uu_ls::options - Rust
pub static INDICATOR_STYLE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.INODE.html b/dev/uu_ls/options/static.INODE.html index 2d06c4620..6db0b680f 100644 --- a/dev/uu_ls/options/static.INODE.html +++ b/dev/uu_ls/options/static.INODE.html @@ -1 +1 @@ -INODE in uu_ls::options - Rust
pub static INODE: &'static str
\ No newline at end of file +INODE in uu_ls::options - Rust
pub static INODE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.NO_GROUP.html b/dev/uu_ls/options/static.NO_GROUP.html index 92eebc925..5ef3ed324 100644 --- a/dev/uu_ls/options/static.NO_GROUP.html +++ b/dev/uu_ls/options/static.NO_GROUP.html @@ -1 +1 @@ -NO_GROUP in uu_ls::options - Rust
pub static NO_GROUP: &'static str
\ No newline at end of file +NO_GROUP in uu_ls::options - Rust
pub static NO_GROUP: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.PATHS.html b/dev/uu_ls/options/static.PATHS.html index 0fd397a50..3428367fd 100644 --- a/dev/uu_ls/options/static.PATHS.html +++ b/dev/uu_ls/options/static.PATHS.html @@ -1 +1 @@ -PATHS in uu_ls::options - Rust
pub static PATHS: &'static str
\ No newline at end of file +PATHS in uu_ls::options - Rust
pub static PATHS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.QUOTING_STYLE.html b/dev/uu_ls/options/static.QUOTING_STYLE.html index 51096fd33..55812aaa4 100644 --- a/dev/uu_ls/options/static.QUOTING_STYLE.html +++ b/dev/uu_ls/options/static.QUOTING_STYLE.html @@ -1 +1 @@ -QUOTING_STYLE in uu_ls::options - Rust
pub static QUOTING_STYLE: &'static str
\ No newline at end of file +QUOTING_STYLE in uu_ls::options - Rust
pub static QUOTING_STYLE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.RECURSIVE.html b/dev/uu_ls/options/static.RECURSIVE.html index 5ad069898..7616d92cd 100644 --- a/dev/uu_ls/options/static.RECURSIVE.html +++ b/dev/uu_ls/options/static.RECURSIVE.html @@ -1 +1 @@ -RECURSIVE in uu_ls::options - Rust
pub static RECURSIVE: &'static str
\ No newline at end of file +RECURSIVE in uu_ls::options - Rust
pub static RECURSIVE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.REVERSE.html b/dev/uu_ls/options/static.REVERSE.html index 349a5a3b7..ad47de8af 100644 --- a/dev/uu_ls/options/static.REVERSE.html +++ b/dev/uu_ls/options/static.REVERSE.html @@ -1 +1 @@ -REVERSE in uu_ls::options - Rust
pub static REVERSE: &'static str
\ No newline at end of file +REVERSE in uu_ls::options - Rust
pub static REVERSE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.SHOW_CONTROL_CHARS.html b/dev/uu_ls/options/static.SHOW_CONTROL_CHARS.html index 617cfd438..36700dde0 100644 --- a/dev/uu_ls/options/static.SHOW_CONTROL_CHARS.html +++ b/dev/uu_ls/options/static.SHOW_CONTROL_CHARS.html @@ -1 +1 @@ -SHOW_CONTROL_CHARS in uu_ls::options - Rust
pub static SHOW_CONTROL_CHARS: &'static str
\ No newline at end of file +SHOW_CONTROL_CHARS in uu_ls::options - Rust
pub static SHOW_CONTROL_CHARS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.SORT.html b/dev/uu_ls/options/static.SORT.html index e2bbe41ae..87b9697b7 100644 --- a/dev/uu_ls/options/static.SORT.html +++ b/dev/uu_ls/options/static.SORT.html @@ -1 +1 @@ -SORT in uu_ls::options - Rust
pub static SORT: &'static str
\ No newline at end of file +SORT in uu_ls::options - Rust
pub static SORT: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.TIME.html b/dev/uu_ls/options/static.TIME.html index 11075998d..f2543ab96 100644 --- a/dev/uu_ls/options/static.TIME.html +++ b/dev/uu_ls/options/static.TIME.html @@ -1 +1 @@ -TIME in uu_ls::options - Rust
pub static TIME: &'static str
\ No newline at end of file +TIME in uu_ls::options - Rust
pub static TIME: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.TIME_STYLE.html b/dev/uu_ls/options/static.TIME_STYLE.html index ee13c86bf..1ed9b76f8 100644 --- a/dev/uu_ls/options/static.TIME_STYLE.html +++ b/dev/uu_ls/options/static.TIME_STYLE.html @@ -1 +1 @@ -TIME_STYLE in uu_ls::options - Rust
pub static TIME_STYLE: &'static str
\ No newline at end of file +TIME_STYLE in uu_ls::options - Rust
pub static TIME_STYLE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.WIDTH.html b/dev/uu_ls/options/static.WIDTH.html index e713bc0c8..5586993b9 100644 --- a/dev/uu_ls/options/static.WIDTH.html +++ b/dev/uu_ls/options/static.WIDTH.html @@ -1 +1 @@ -WIDTH in uu_ls::options - Rust
pub static WIDTH: &'static str
\ No newline at end of file +WIDTH in uu_ls::options - Rust
pub static WIDTH: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/static.ZERO.html b/dev/uu_ls/options/static.ZERO.html index b3faf3cec..c1c3f8232 100644 --- a/dev/uu_ls/options/static.ZERO.html +++ b/dev/uu_ls/options/static.ZERO.html @@ -1 +1 @@ -ZERO in uu_ls::options - Rust
pub static ZERO: &'static str
\ No newline at end of file +ZERO in uu_ls::options - Rust
pub static ZERO: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/time/index.html b/dev/uu_ls/options/time/index.html index e389afeaf..08807e173 100644 --- a/dev/uu_ls/options/time/index.html +++ b/dev/uu_ls/options/time/index.html @@ -1 +1 @@ -uu_ls::options::time - Rust
\ No newline at end of file +uu_ls::options::time - Rust
\ No newline at end of file diff --git a/dev/uu_ls/options/time/static.ACCESS.html b/dev/uu_ls/options/time/static.ACCESS.html index 1a7420d52..0f58df90e 100644 --- a/dev/uu_ls/options/time/static.ACCESS.html +++ b/dev/uu_ls/options/time/static.ACCESS.html @@ -1 +1 @@ -ACCESS in uu_ls::options::time - Rust
pub static ACCESS: &'static str
\ No newline at end of file +ACCESS in uu_ls::options::time - Rust
pub static ACCESS: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/options/time/static.CHANGE.html b/dev/uu_ls/options/time/static.CHANGE.html index 34fc0d9a8..b91dfdc62 100644 --- a/dev/uu_ls/options/time/static.CHANGE.html +++ b/dev/uu_ls/options/time/static.CHANGE.html @@ -1 +1 @@ -CHANGE in uu_ls::options::time - Rust
pub static CHANGE: &'static str
\ No newline at end of file +CHANGE in uu_ls::options::time - Rust
pub static CHANGE: &'static str
\ No newline at end of file diff --git a/dev/uu_ls/struct.Config.html b/dev/uu_ls/struct.Config.html index e985262fe..350a5c971 100644 --- a/dev/uu_ls/struct.Config.html +++ b/dev/uu_ls/struct.Config.html @@ -1,16 +1,9 @@ -Config in uu_ls - Rust
pub struct Config {
+Config in uu_ls - Rust
pub struct Config {
     pub format: Format,
-    pub quoting_style: QuotingStyle,
+    pub quoting_style: QuotingStyle,
     /* private fields */
-}

Fields

format: Formatquoting_style: QuotingStyle

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Fields

format: Formatquoting_style: QuotingStyle

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_mkdir/all.html b/dev/uu_mkdir/all.html index 2185754ac..dadbc6a7d 100644 --- a/dev/uu_mkdir/all.html +++ b/dev/uu_mkdir/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_mkdir/fn.uu_app.html b/dev/uu_mkdir/fn.uu_app.html index 0a883295b..73796455b 100644 --- a/dev/uu_mkdir/fn.uu_app.html +++ b/dev/uu_mkdir/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_mkdir - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_mkdir - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_mkdir/fn.uumain.html b/dev/uu_mkdir/fn.uumain.html index 69e621615..0b0909b68 100644 --- a/dev/uu_mkdir/fn.uumain.html +++ b/dev/uu_mkdir/fn.uumain.html @@ -1 +1 @@ -uumain in uu_mkdir - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_mkdir - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_mkdir/index.html b/dev/uu_mkdir/index.html index 09e5c4d04..e3fc32bc0 100644 --- a/dev/uu_mkdir/index.html +++ b/dev/uu_mkdir/index.html @@ -1 +1 @@ -uu_mkdir - Rust
\ No newline at end of file +uu_mkdir - Rust
\ No newline at end of file diff --git a/dev/uu_mkfifo/all.html b/dev/uu_mkfifo/all.html index 39c9d1a8a..5f159b206 100644 --- a/dev/uu_mkfifo/all.html +++ b/dev/uu_mkfifo/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_mkfifo/fn.uu_app.html b/dev/uu_mkfifo/fn.uu_app.html index b34c95310..85a38b79c 100644 --- a/dev/uu_mkfifo/fn.uu_app.html +++ b/dev/uu_mkfifo/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_mkfifo - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_mkfifo - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_mkfifo/fn.uumain.html b/dev/uu_mkfifo/fn.uumain.html index 49d424002..d7c56c88e 100644 --- a/dev/uu_mkfifo/fn.uumain.html +++ b/dev/uu_mkfifo/fn.uumain.html @@ -1 +1 @@ -uumain in uu_mkfifo - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_mkfifo - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_mkfifo/index.html b/dev/uu_mkfifo/index.html index ad6ed25d7..f19a2f305 100644 --- a/dev/uu_mkfifo/index.html +++ b/dev/uu_mkfifo/index.html @@ -1 +1 @@ -uu_mkfifo - Rust
\ No newline at end of file +uu_mkfifo - Rust
\ No newline at end of file diff --git a/dev/uu_mknod/all.html b/dev/uu_mknod/all.html index 86eb8a3c4..0e89f724d 100644 --- a/dev/uu_mknod/all.html +++ b/dev/uu_mknod/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_mknod/fn.uu_app.html b/dev/uu_mknod/fn.uu_app.html index ef1da8819..0e66dca45 100644 --- a/dev/uu_mknod/fn.uu_app.html +++ b/dev/uu_mknod/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_mknod - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_mknod - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_mknod/fn.uumain.html b/dev/uu_mknod/fn.uumain.html index fcb446e70..61c6e6db3 100644 --- a/dev/uu_mknod/fn.uumain.html +++ b/dev/uu_mknod/fn.uumain.html @@ -1 +1 @@ -uumain in uu_mknod - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_mknod - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_mknod/index.html b/dev/uu_mknod/index.html index 17de710e7..f216f2ee2 100644 --- a/dev/uu_mknod/index.html +++ b/dev/uu_mknod/index.html @@ -1 +1 @@ -uu_mknod - Rust
\ No newline at end of file +uu_mknod - Rust
\ No newline at end of file diff --git a/dev/uu_mktemp/all.html b/dev/uu_mktemp/all.html index 234b2c164..a7df4125a 100644 --- a/dev/uu_mktemp/all.html +++ b/dev/uu_mktemp/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_mktemp/fn.dry_exec.html b/dev/uu_mktemp/fn.dry_exec.html index 4a1a7ad54..8c9ed22ae 100644 --- a/dev/uu_mktemp/fn.dry_exec.html +++ b/dev/uu_mktemp/fn.dry_exec.html @@ -1 +1 @@ -dry_exec in uu_mktemp - Rust
pub fn dry_exec(
    tmpdir: &str,
    prefix: &str,
    rand: usize,
    suffix: &str
) -> UResult<()>
\ No newline at end of file +dry_exec in uu_mktemp - Rust
pub fn dry_exec(
    tmpdir: &str,
    prefix: &str,
    rand: usize,
    suffix: &str
) -> UResult<()>
\ No newline at end of file diff --git a/dev/uu_mktemp/fn.uu_app.html b/dev/uu_mktemp/fn.uu_app.html index 1e1ee16bc..6cad49abe 100644 --- a/dev/uu_mktemp/fn.uu_app.html +++ b/dev/uu_mktemp/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_mktemp - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_mktemp - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_mktemp/fn.uumain.html b/dev/uu_mktemp/fn.uumain.html index a23e10a47..b7340cc43 100644 --- a/dev/uu_mktemp/fn.uumain.html +++ b/dev/uu_mktemp/fn.uumain.html @@ -1 +1 @@ -uumain in uu_mktemp - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_mktemp - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_mktemp/index.html b/dev/uu_mktemp/index.html index de571d3ca..a1cfc88ea 100644 --- a/dev/uu_mktemp/index.html +++ b/dev/uu_mktemp/index.html @@ -1 +1 @@ -uu_mktemp - Rust
\ No newline at end of file +uu_mktemp - Rust
\ No newline at end of file diff --git a/dev/uu_more/all.html b/dev/uu_more/all.html index 371342c98..9df9024f1 100644 --- a/dev/uu_more/all.html +++ b/dev/uu_more/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_more/fn.uu_app.html b/dev/uu_more/fn.uu_app.html index 71ed3e5bc..9356eb5a5 100644 --- a/dev/uu_more/fn.uu_app.html +++ b/dev/uu_more/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_more - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_more - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_more/fn.uumain.html b/dev/uu_more/fn.uumain.html index f0ebfc09d..6fbf65695 100644 --- a/dev/uu_more/fn.uumain.html +++ b/dev/uu_more/fn.uumain.html @@ -1 +1 @@ -uumain in uu_more - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_more - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_more/index.html b/dev/uu_more/index.html index 443e01eac..e37dfc02e 100644 --- a/dev/uu_more/index.html +++ b/dev/uu_more/index.html @@ -1 +1 @@ -uu_more - Rust
\ No newline at end of file +uu_more - Rust
\ No newline at end of file diff --git a/dev/uu_more/options/constant.CLEAN_PRINT.html b/dev/uu_more/options/constant.CLEAN_PRINT.html index 651da3995..7ef33b09a 100644 --- a/dev/uu_more/options/constant.CLEAN_PRINT.html +++ b/dev/uu_more/options/constant.CLEAN_PRINT.html @@ -1 +1 @@ -CLEAN_PRINT in uu_more::options - Rust
pub const CLEAN_PRINT: &'static str = "clean-print";
\ No newline at end of file +CLEAN_PRINT in uu_more::options - Rust
pub const CLEAN_PRINT: &'static str = "clean-print";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.FILES.html b/dev/uu_more/options/constant.FILES.html index d90365db8..c4f405e75 100644 --- a/dev/uu_more/options/constant.FILES.html +++ b/dev/uu_more/options/constant.FILES.html @@ -1 +1 @@ -FILES in uu_more::options - Rust
pub const FILES: &'static str = "files";
\ No newline at end of file +FILES in uu_more::options - Rust
pub const FILES: &'static str = "files";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.FROM_LINE.html b/dev/uu_more/options/constant.FROM_LINE.html index f54fb233f..086c72054 100644 --- a/dev/uu_more/options/constant.FROM_LINE.html +++ b/dev/uu_more/options/constant.FROM_LINE.html @@ -1 +1 @@ -FROM_LINE in uu_more::options - Rust
pub const FROM_LINE: &'static str = "from-line";
\ No newline at end of file +FROM_LINE in uu_more::options - Rust
pub const FROM_LINE: &'static str = "from-line";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.LINES.html b/dev/uu_more/options/constant.LINES.html index 0891dc0e4..fb5671b37 100644 --- a/dev/uu_more/options/constant.LINES.html +++ b/dev/uu_more/options/constant.LINES.html @@ -1 +1 @@ -LINES in uu_more::options - Rust
pub const LINES: &'static str = "lines";
\ No newline at end of file +LINES in uu_more::options - Rust
pub const LINES: &'static str = "lines";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.LOGICAL.html b/dev/uu_more/options/constant.LOGICAL.html index ecf9499d0..88c8798c7 100644 --- a/dev/uu_more/options/constant.LOGICAL.html +++ b/dev/uu_more/options/constant.LOGICAL.html @@ -1 +1 @@ -LOGICAL in uu_more::options - Rust
pub const LOGICAL: &'static str = "logical";
\ No newline at end of file +LOGICAL in uu_more::options - Rust
pub const LOGICAL: &'static str = "logical";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.NO_PAUSE.html b/dev/uu_more/options/constant.NO_PAUSE.html index 5497a6ed8..381772db7 100644 --- a/dev/uu_more/options/constant.NO_PAUSE.html +++ b/dev/uu_more/options/constant.NO_PAUSE.html @@ -1 +1 @@ -NO_PAUSE in uu_more::options - Rust
pub const NO_PAUSE: &'static str = "no-pause";
\ No newline at end of file +NO_PAUSE in uu_more::options - Rust
pub const NO_PAUSE: &'static str = "no-pause";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.NUMBER.html b/dev/uu_more/options/constant.NUMBER.html index 16b4c68d3..d0b8c81c2 100644 --- a/dev/uu_more/options/constant.NUMBER.html +++ b/dev/uu_more/options/constant.NUMBER.html @@ -1 +1 @@ -NUMBER in uu_more::options - Rust
pub const NUMBER: &'static str = "number";
\ No newline at end of file +NUMBER in uu_more::options - Rust
pub const NUMBER: &'static str = "number";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.PATTERN.html b/dev/uu_more/options/constant.PATTERN.html index f0ca60567..479f22c8e 100644 --- a/dev/uu_more/options/constant.PATTERN.html +++ b/dev/uu_more/options/constant.PATTERN.html @@ -1 +1 @@ -PATTERN in uu_more::options - Rust
pub const PATTERN: &'static str = "pattern";
\ No newline at end of file +PATTERN in uu_more::options - Rust
pub const PATTERN: &'static str = "pattern";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.PLAIN.html b/dev/uu_more/options/constant.PLAIN.html index 18aa88746..b2d93dc86 100644 --- a/dev/uu_more/options/constant.PLAIN.html +++ b/dev/uu_more/options/constant.PLAIN.html @@ -1 +1 @@ -PLAIN in uu_more::options - Rust
pub const PLAIN: &'static str = "plain";
\ No newline at end of file +PLAIN in uu_more::options - Rust
pub const PLAIN: &'static str = "plain";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.PRINT_OVER.html b/dev/uu_more/options/constant.PRINT_OVER.html index 027d222a9..995dc0027 100644 --- a/dev/uu_more/options/constant.PRINT_OVER.html +++ b/dev/uu_more/options/constant.PRINT_OVER.html @@ -1 +1 @@ -PRINT_OVER in uu_more::options - Rust
pub const PRINT_OVER: &'static str = "print-over";
\ No newline at end of file +PRINT_OVER in uu_more::options - Rust
pub const PRINT_OVER: &'static str = "print-over";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.SILENT.html b/dev/uu_more/options/constant.SILENT.html index ff9bba309..40302db5d 100644 --- a/dev/uu_more/options/constant.SILENT.html +++ b/dev/uu_more/options/constant.SILENT.html @@ -1 +1 @@ -SILENT in uu_more::options - Rust
pub const SILENT: &'static str = "silent";
\ No newline at end of file +SILENT in uu_more::options - Rust
pub const SILENT: &'static str = "silent";
\ No newline at end of file diff --git a/dev/uu_more/options/constant.SQUEEZE.html b/dev/uu_more/options/constant.SQUEEZE.html index aebfdd3a4..790f32fed 100644 --- a/dev/uu_more/options/constant.SQUEEZE.html +++ b/dev/uu_more/options/constant.SQUEEZE.html @@ -1 +1 @@ -SQUEEZE in uu_more::options - Rust
pub const SQUEEZE: &'static str = "squeeze";
\ No newline at end of file +SQUEEZE in uu_more::options - Rust
pub const SQUEEZE: &'static str = "squeeze";
\ No newline at end of file diff --git a/dev/uu_more/options/index.html b/dev/uu_more/options/index.html index 93507c5cb..957b10722 100644 --- a/dev/uu_more/options/index.html +++ b/dev/uu_more/options/index.html @@ -1 +1 @@ -uu_more::options - Rust
\ No newline at end of file +uu_more::options - Rust
\ No newline at end of file diff --git a/dev/uu_mv/all.html b/dev/uu_mv/all.html index 96eae2f96..e840a51d8 100644 --- a/dev/uu_mv/all.html +++ b/dev/uu_mv/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Structs

Enums

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Structs

Enums

Functions

\ No newline at end of file diff --git a/dev/uu_mv/enum.OverwriteMode.html b/dev/uu_mv/enum.OverwriteMode.html index b36d6c66b..1e327847e 100644 --- a/dev/uu_mv/enum.OverwriteMode.html +++ b/dev/uu_mv/enum.OverwriteMode.html @@ -1,24 +1,11 @@ -OverwriteMode in uu_mv - Rust
pub enum OverwriteMode {
+OverwriteMode in uu_mv - Rust
pub enum OverwriteMode {
     NoClobber,
     Interactive,
     Force,
-}

Variants

NoClobber

Interactive

Force

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

NoClobber

Interactive

Force

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_mv/fn.uu_app.html b/dev/uu_mv/fn.uu_app.html index 9b70996b1..3ac13eb73 100644 --- a/dev/uu_mv/fn.uu_app.html +++ b/dev/uu_mv/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_mv - Rust

Function uu_mv::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_mv - Rust

Function uu_mv::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_mv/fn.uumain.html b/dev/uu_mv/fn.uumain.html index 8e2edff53..1b1b564f6 100644 --- a/dev/uu_mv/fn.uumain.html +++ b/dev/uu_mv/fn.uumain.html @@ -1 +1 @@ -uumain in uu_mv - Rust

Function uu_mv::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_mv - Rust

Function uu_mv::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_mv/index.html b/dev/uu_mv/index.html index 648bd997b..3503f11ce 100644 --- a/dev/uu_mv/index.html +++ b/dev/uu_mv/index.html @@ -1 +1 @@ -uu_mv - Rust
\ No newline at end of file +uu_mv - Rust
\ No newline at end of file diff --git a/dev/uu_mv/struct.Behavior.html b/dev/uu_mv/struct.Behavior.html index 0061bc9ea..f26356341 100644 --- a/dev/uu_mv/struct.Behavior.html +++ b/dev/uu_mv/struct.Behavior.html @@ -1,12 +1,5 @@ -Behavior in uu_mv - Rust
pub struct Behavior { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Behavior in uu_mv - Rust
pub struct Behavior { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_nice/all.html b/dev/uu_nice/all.html index 6e1bceec0..e0121e839 100644 --- a/dev/uu_nice/all.html +++ b/dev/uu_nice/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

Statics

\ No newline at end of file +List of all items in this crate

List of all items

Functions

Statics

\ No newline at end of file diff --git a/dev/uu_nice/fn.uu_app.html b/dev/uu_nice/fn.uu_app.html index 64a9dbe81..84ad30e17 100644 --- a/dev/uu_nice/fn.uu_app.html +++ b/dev/uu_nice/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_nice - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_nice - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_nice/fn.uumain.html b/dev/uu_nice/fn.uumain.html index 0f0915599..cc7aa7e34 100644 --- a/dev/uu_nice/fn.uumain.html +++ b/dev/uu_nice/fn.uumain.html @@ -1 +1 @@ -uumain in uu_nice - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_nice - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_nice/index.html b/dev/uu_nice/index.html index 6b28d699d..a2363d177 100644 --- a/dev/uu_nice/index.html +++ b/dev/uu_nice/index.html @@ -1 +1 @@ -uu_nice - Rust
\ No newline at end of file +uu_nice - Rust
\ No newline at end of file diff --git a/dev/uu_nice/options/index.html b/dev/uu_nice/options/index.html index 643022ab9..a90fef778 100644 --- a/dev/uu_nice/options/index.html +++ b/dev/uu_nice/options/index.html @@ -1 +1 @@ -uu_nice::options - Rust
\ No newline at end of file +uu_nice::options - Rust
\ No newline at end of file diff --git a/dev/uu_nice/options/static.ADJUSTMENT.html b/dev/uu_nice/options/static.ADJUSTMENT.html index 6c6e2b8fc..f9611fcfb 100644 --- a/dev/uu_nice/options/static.ADJUSTMENT.html +++ b/dev/uu_nice/options/static.ADJUSTMENT.html @@ -1 +1 @@ -ADJUSTMENT in uu_nice::options - Rust
pub static ADJUSTMENT: &'static str
\ No newline at end of file +ADJUSTMENT in uu_nice::options - Rust
pub static ADJUSTMENT: &'static str
\ No newline at end of file diff --git a/dev/uu_nice/options/static.COMMAND.html b/dev/uu_nice/options/static.COMMAND.html index 9001aa4de..d32fb47b2 100644 --- a/dev/uu_nice/options/static.COMMAND.html +++ b/dev/uu_nice/options/static.COMMAND.html @@ -1 +1 @@ -COMMAND in uu_nice::options - Rust
pub static COMMAND: &'static str
\ No newline at end of file +COMMAND in uu_nice::options - Rust
pub static COMMAND: &'static str
\ No newline at end of file diff --git a/dev/uu_nl/all.html b/dev/uu_nl/all.html index 54ca61619..d8c507515 100644 --- a/dev/uu_nl/all.html +++ b/dev/uu_nl/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_nl/fn.uu_app.html b/dev/uu_nl/fn.uu_app.html index 27036a77e..a4181f0c3 100644 --- a/dev/uu_nl/fn.uu_app.html +++ b/dev/uu_nl/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_nl - Rust

Function uu_nl::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_nl - Rust

Function uu_nl::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_nl/fn.uumain.html b/dev/uu_nl/fn.uumain.html index 64a1234ca..9ee417b1f 100644 --- a/dev/uu_nl/fn.uumain.html +++ b/dev/uu_nl/fn.uumain.html @@ -1 +1 @@ -uumain in uu_nl - Rust

Function uu_nl::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_nl - Rust

Function uu_nl::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_nl/index.html b/dev/uu_nl/index.html index 9a9606089..fe96f057c 100644 --- a/dev/uu_nl/index.html +++ b/dev/uu_nl/index.html @@ -1 +1 @@ -uu_nl - Rust
\ No newline at end of file +uu_nl - Rust
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.BODY_NUMBERING.html b/dev/uu_nl/options/constant.BODY_NUMBERING.html index 6050d73b3..8d91f4c5f 100644 --- a/dev/uu_nl/options/constant.BODY_NUMBERING.html +++ b/dev/uu_nl/options/constant.BODY_NUMBERING.html @@ -1 +1 @@ -BODY_NUMBERING in uu_nl::options - Rust
pub const BODY_NUMBERING: &'static str = "body-numbering";
\ No newline at end of file +BODY_NUMBERING in uu_nl::options - Rust
pub const BODY_NUMBERING: &'static str = "body-numbering";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.FILE.html b/dev/uu_nl/options/constant.FILE.html index ecf3d4921..c6c1cafc2 100644 --- a/dev/uu_nl/options/constant.FILE.html +++ b/dev/uu_nl/options/constant.FILE.html @@ -1 +1 @@ -FILE in uu_nl::options - Rust
pub const FILE: &'static str = "file";
\ No newline at end of file +FILE in uu_nl::options - Rust
pub const FILE: &'static str = "file";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.FOOTER_NUMBERING.html b/dev/uu_nl/options/constant.FOOTER_NUMBERING.html index 71c7a51c1..abc9db17e 100644 --- a/dev/uu_nl/options/constant.FOOTER_NUMBERING.html +++ b/dev/uu_nl/options/constant.FOOTER_NUMBERING.html @@ -1 +1 @@ -FOOTER_NUMBERING in uu_nl::options - Rust
pub const FOOTER_NUMBERING: &'static str = "footer-numbering";
\ No newline at end of file +FOOTER_NUMBERING in uu_nl::options - Rust
pub const FOOTER_NUMBERING: &'static str = "footer-numbering";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.HEADER_NUMBERING.html b/dev/uu_nl/options/constant.HEADER_NUMBERING.html index ef16496ca..a2dc06652 100644 --- a/dev/uu_nl/options/constant.HEADER_NUMBERING.html +++ b/dev/uu_nl/options/constant.HEADER_NUMBERING.html @@ -1 +1 @@ -HEADER_NUMBERING in uu_nl::options - Rust
pub const HEADER_NUMBERING: &'static str = "header-numbering";
\ No newline at end of file +HEADER_NUMBERING in uu_nl::options - Rust
pub const HEADER_NUMBERING: &'static str = "header-numbering";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.HELP.html b/dev/uu_nl/options/constant.HELP.html index 37008eff2..44877fb20 100644 --- a/dev/uu_nl/options/constant.HELP.html +++ b/dev/uu_nl/options/constant.HELP.html @@ -1 +1 @@ -HELP in uu_nl::options - Rust
pub const HELP: &'static str = "help";
\ No newline at end of file +HELP in uu_nl::options - Rust
pub const HELP: &'static str = "help";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.JOIN_BLANK_LINES.html b/dev/uu_nl/options/constant.JOIN_BLANK_LINES.html index 99782d036..22040d0cf 100644 --- a/dev/uu_nl/options/constant.JOIN_BLANK_LINES.html +++ b/dev/uu_nl/options/constant.JOIN_BLANK_LINES.html @@ -1 +1 @@ -JOIN_BLANK_LINES in uu_nl::options - Rust
pub const JOIN_BLANK_LINES: &'static str = "join-blank-lines";
\ No newline at end of file +JOIN_BLANK_LINES in uu_nl::options - Rust
pub const JOIN_BLANK_LINES: &'static str = "join-blank-lines";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.LINE_INCREMENT.html b/dev/uu_nl/options/constant.LINE_INCREMENT.html index 1f73db559..fdd10badd 100644 --- a/dev/uu_nl/options/constant.LINE_INCREMENT.html +++ b/dev/uu_nl/options/constant.LINE_INCREMENT.html @@ -1 +1 @@ -LINE_INCREMENT in uu_nl::options - Rust
pub const LINE_INCREMENT: &'static str = "line-increment";
\ No newline at end of file +LINE_INCREMENT in uu_nl::options - Rust
pub const LINE_INCREMENT: &'static str = "line-increment";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.NO_RENUMBER.html b/dev/uu_nl/options/constant.NO_RENUMBER.html index 0fba2fc19..43e01763a 100644 --- a/dev/uu_nl/options/constant.NO_RENUMBER.html +++ b/dev/uu_nl/options/constant.NO_RENUMBER.html @@ -1 +1 @@ -NO_RENUMBER in uu_nl::options - Rust
pub const NO_RENUMBER: &'static str = "no-renumber";
\ No newline at end of file +NO_RENUMBER in uu_nl::options - Rust
pub const NO_RENUMBER: &'static str = "no-renumber";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.NUMBER_FORMAT.html b/dev/uu_nl/options/constant.NUMBER_FORMAT.html index 33834b730..e51139a78 100644 --- a/dev/uu_nl/options/constant.NUMBER_FORMAT.html +++ b/dev/uu_nl/options/constant.NUMBER_FORMAT.html @@ -1 +1 @@ -NUMBER_FORMAT in uu_nl::options - Rust
pub const NUMBER_FORMAT: &'static str = "number-format";
\ No newline at end of file +NUMBER_FORMAT in uu_nl::options - Rust
pub const NUMBER_FORMAT: &'static str = "number-format";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.NUMBER_SEPARATOR.html b/dev/uu_nl/options/constant.NUMBER_SEPARATOR.html index 704234eaa..1c13b82ae 100644 --- a/dev/uu_nl/options/constant.NUMBER_SEPARATOR.html +++ b/dev/uu_nl/options/constant.NUMBER_SEPARATOR.html @@ -1 +1 @@ -NUMBER_SEPARATOR in uu_nl::options - Rust
pub const NUMBER_SEPARATOR: &'static str = "number-separator";
\ No newline at end of file +NUMBER_SEPARATOR in uu_nl::options - Rust
pub const NUMBER_SEPARATOR: &'static str = "number-separator";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.NUMBER_WIDTH.html b/dev/uu_nl/options/constant.NUMBER_WIDTH.html index 13a9bfcd0..b74ad63fb 100644 --- a/dev/uu_nl/options/constant.NUMBER_WIDTH.html +++ b/dev/uu_nl/options/constant.NUMBER_WIDTH.html @@ -1 +1 @@ -NUMBER_WIDTH in uu_nl::options - Rust
pub const NUMBER_WIDTH: &'static str = "number-width";
\ No newline at end of file +NUMBER_WIDTH in uu_nl::options - Rust
pub const NUMBER_WIDTH: &'static str = "number-width";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.SECTION_DELIMITER.html b/dev/uu_nl/options/constant.SECTION_DELIMITER.html index 5e0d7ce9d..271d74e09 100644 --- a/dev/uu_nl/options/constant.SECTION_DELIMITER.html +++ b/dev/uu_nl/options/constant.SECTION_DELIMITER.html @@ -1 +1 @@ -SECTION_DELIMITER in uu_nl::options - Rust
pub const SECTION_DELIMITER: &'static str = "section-delimiter";
\ No newline at end of file +SECTION_DELIMITER in uu_nl::options - Rust
pub const SECTION_DELIMITER: &'static str = "section-delimiter";
\ No newline at end of file diff --git a/dev/uu_nl/options/constant.STARTING_LINE_NUMBER.html b/dev/uu_nl/options/constant.STARTING_LINE_NUMBER.html index dcb0f8d1d..c8ef69ae5 100644 --- a/dev/uu_nl/options/constant.STARTING_LINE_NUMBER.html +++ b/dev/uu_nl/options/constant.STARTING_LINE_NUMBER.html @@ -1 +1 @@ -STARTING_LINE_NUMBER in uu_nl::options - Rust
pub const STARTING_LINE_NUMBER: &'static str = "starting-line-number";
\ No newline at end of file +STARTING_LINE_NUMBER in uu_nl::options - Rust
pub const STARTING_LINE_NUMBER: &'static str = "starting-line-number";
\ No newline at end of file diff --git a/dev/uu_nl/options/index.html b/dev/uu_nl/options/index.html index b4d911d5b..5c7480190 100644 --- a/dev/uu_nl/options/index.html +++ b/dev/uu_nl/options/index.html @@ -1 +1 @@ -uu_nl::options - Rust
\ No newline at end of file +uu_nl::options - Rust
\ No newline at end of file diff --git a/dev/uu_nl/struct.Settings.html b/dev/uu_nl/struct.Settings.html index c8ac354f1..a38b03099 100644 --- a/dev/uu_nl/struct.Settings.html +++ b/dev/uu_nl/struct.Settings.html @@ -1,12 +1,5 @@ -Settings in uu_nl - Rust
pub struct Settings { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Settings in uu_nl - Rust
pub struct Settings { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_nohup/all.html b/dev/uu_nohup/all.html index 94df22a6e..dcdf2b69b 100644 --- a/dev/uu_nohup/all.html +++ b/dev/uu_nohup/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_nohup/fn.uu_app.html b/dev/uu_nohup/fn.uu_app.html index 234180d71..02b7cbf50 100644 --- a/dev/uu_nohup/fn.uu_app.html +++ b/dev/uu_nohup/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_nohup - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_nohup - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_nohup/fn.uumain.html b/dev/uu_nohup/fn.uumain.html index 0fec50c52..bdcf8616d 100644 --- a/dev/uu_nohup/fn.uumain.html +++ b/dev/uu_nohup/fn.uumain.html @@ -1 +1 @@ -uumain in uu_nohup - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_nohup - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_nohup/index.html b/dev/uu_nohup/index.html index 237653f35..d7eb15fe9 100644 --- a/dev/uu_nohup/index.html +++ b/dev/uu_nohup/index.html @@ -1 +1 @@ -uu_nohup - Rust
\ No newline at end of file +uu_nohup - Rust
\ No newline at end of file diff --git a/dev/uu_nproc/all.html b/dev/uu_nproc/all.html index 41273874e..86c6d3feb 100644 --- a/dev/uu_nproc/all.html +++ b/dev/uu_nproc/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

Constants

\ No newline at end of file +List of all items in this crate

List of all items

Functions

Constants

\ No newline at end of file diff --git a/dev/uu_nproc/constant._SC_NPROCESSORS_CONF.html b/dev/uu_nproc/constant._SC_NPROCESSORS_CONF.html index b5c7cd523..753acc60f 100644 --- a/dev/uu_nproc/constant._SC_NPROCESSORS_CONF.html +++ b/dev/uu_nproc/constant._SC_NPROCESSORS_CONF.html @@ -1 +1 @@ -_SC_NPROCESSORS_CONF in uu_nproc - Rust
pub const _SC_NPROCESSORS_CONF: c_int = 83;
\ No newline at end of file +_SC_NPROCESSORS_CONF in uu_nproc - Rust
pub const _SC_NPROCESSORS_CONF: c_int = 83;
\ No newline at end of file diff --git a/dev/uu_nproc/fn.uu_app.html b/dev/uu_nproc/fn.uu_app.html index c845d306e..f6f2ddb61 100644 --- a/dev/uu_nproc/fn.uu_app.html +++ b/dev/uu_nproc/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_nproc - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_nproc - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_nproc/fn.uumain.html b/dev/uu_nproc/fn.uumain.html index 632369e38..8408e818e 100644 --- a/dev/uu_nproc/fn.uumain.html +++ b/dev/uu_nproc/fn.uumain.html @@ -1 +1 @@ -uumain in uu_nproc - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_nproc - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_nproc/index.html b/dev/uu_nproc/index.html index 322725492..f6bba5fb2 100644 --- a/dev/uu_nproc/index.html +++ b/dev/uu_nproc/index.html @@ -1 +1 @@ -uu_nproc - Rust
\ No newline at end of file +uu_nproc - Rust
\ No newline at end of file diff --git a/dev/uu_numfmt/all.html b/dev/uu_numfmt/all.html index e70f45248..4870648fb 100644 --- a/dev/uu_numfmt/all.html +++ b/dev/uu_numfmt/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_numfmt/errors/enum.NumfmtError.html b/dev/uu_numfmt/errors/enum.NumfmtError.html index ca349fd23..a7ee1fee3 100644 --- a/dev/uu_numfmt/errors/enum.NumfmtError.html +++ b/dev/uu_numfmt/errors/enum.NumfmtError.html @@ -1,25 +1,12 @@ -NumfmtError in uu_numfmt::errors - Rust
pub enum NumfmtError {
-    IoError(String),
-    IllegalArgument(String),
-    FormattingError(String),
-}

Variants

IoError(String)

IllegalArgument(String)

FormattingError(String)

Trait Implementations

Formats the value using the given formatter. Read more

-

Formats the value using the given formatter. Read more

-

The lower-level source of this error, if any. Read more

-
👎 Deprecated since 1.42.0:

use the Display impl or to_string()

-
👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

-
🔬 This is a nightly-only experimental API. (error_generic_member_access)

Provides type based access to context intended for error reports. Read more

-

Error code of a custom error. Read more

-

Print usage help to a custom error. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+NumfmtError in uu_numfmt::errors - Rust
pub enum NumfmtError {
+    IoError(String),
+    IllegalArgument(String),
+    FormattingError(String),
+}

Variants

IoError(String)

IllegalArgument(String)

FormattingError(String)

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0:

use the Display impl or to_string()

+
👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

+
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Error code of a custom error. Read more
Print usage help to a custom error. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

Converts the given value to a String. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_numfmt/errors/index.html b/dev/uu_numfmt/errors/index.html index 07f4bec31..13060adb0 100644 --- a/dev/uu_numfmt/errors/index.html +++ b/dev/uu_numfmt/errors/index.html @@ -1 +1 @@ -uu_numfmt::errors - Rust
\ No newline at end of file +uu_numfmt::errors - Rust
\ No newline at end of file diff --git a/dev/uu_numfmt/fn.uu_app.html b/dev/uu_numfmt/fn.uu_app.html index c23c66fb7..8cd76f521 100644 --- a/dev/uu_numfmt/fn.uu_app.html +++ b/dev/uu_numfmt/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_numfmt - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_numfmt - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_numfmt/fn.uumain.html b/dev/uu_numfmt/fn.uumain.html index 34fc169c9..18ea29aaf 100644 --- a/dev/uu_numfmt/fn.uumain.html +++ b/dev/uu_numfmt/fn.uumain.html @@ -1 +1 @@ -uumain in uu_numfmt - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_numfmt - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_numfmt/format/fn.div_round.html b/dev/uu_numfmt/format/fn.div_round.html index 2fede6da9..2e898198b 100644 --- a/dev/uu_numfmt/format/fn.div_round.html +++ b/dev/uu_numfmt/format/fn.div_round.html @@ -1,22 +1,22 @@ -div_round in uu_numfmt::format - Rust
pub fn div_round(n: f64, d: f64, method: RoundMethod) -> f64
Expand description

Divide numerator by denominator, with rounding.

+div_round in uu_numfmt::format - Rust
pub fn div_round(n: f64, d: f64, method: RoundMethod) -> f64
Expand description

Divide numerator by denominator, with rounding.

If the result of the division is less than 10.0, round to one decimal point.

Otherwise, round to an integer.

Examples:

-
use uu_numfmt::format::div_round;
-use uu_numfmt::options::RoundMethod;
+
use uu_numfmt::format::div_round;
+use uu_numfmt::options::RoundMethod;
 
-// Rounding methods:
-assert_eq!(div_round(1.01, 1.0, RoundMethod::FromZero), 1.1);
-assert_eq!(div_round(1.01, 1.0, RoundMethod::TowardsZero), 1.0);
-assert_eq!(div_round(1.01, 1.0, RoundMethod::Up), 1.1);
-assert_eq!(div_round(1.01, 1.0, RoundMethod::Down), 1.0);
-assert_eq!(div_round(1.01, 1.0, RoundMethod::Nearest), 1.0);
+// Rounding methods:
+assert_eq!(div_round(1.01, 1.0, RoundMethod::FromZero), 1.1);
+assert_eq!(div_round(1.01, 1.0, RoundMethod::TowardsZero), 1.0);
+assert_eq!(div_round(1.01, 1.0, RoundMethod::Up), 1.1);
+assert_eq!(div_round(1.01, 1.0, RoundMethod::Down), 1.0);
+assert_eq!(div_round(1.01, 1.0, RoundMethod::Nearest), 1.0);
 
-// Division:
-assert_eq!(div_round(999.1, 1000.0, RoundMethod::FromZero), 1.0);
-assert_eq!(div_round(1001., 10., RoundMethod::FromZero), 101.);
-assert_eq!(div_round(9991., 10., RoundMethod::FromZero), 1000.);
-assert_eq!(div_round(-12.34, 1.0, RoundMethod::FromZero), -13.0);
-assert_eq!(div_round(1000.0, -3.14, RoundMethod::FromZero), -319.0);
-assert_eq!(div_round(-271828.0, -271.0, RoundMethod::FromZero), 1004.0);
-
\ No newline at end of file +// Division: +assert_eq!(div_round(999.1, 1000.0, RoundMethod::FromZero), 1.0); +assert_eq!(div_round(1001., 10., RoundMethod::FromZero), 101.); +assert_eq!(div_round(9991., 10., RoundMethod::FromZero), 1000.); +assert_eq!(div_round(-12.34, 1.0, RoundMethod::FromZero), -13.0); +assert_eq!(div_round(1000.0, -3.14, RoundMethod::FromZero), -319.0); +assert_eq!(div_round(-271828.0, -271.0, RoundMethod::FromZero), 1004.0);
+
\ No newline at end of file diff --git a/dev/uu_numfmt/format/fn.format_and_print.html b/dev/uu_numfmt/format/fn.format_and_print.html index 4fbd78f50..ee068a063 100644 --- a/dev/uu_numfmt/format/fn.format_and_print.html +++ b/dev/uu_numfmt/format/fn.format_and_print.html @@ -1,5 +1,5 @@ -format_and_print in uu_numfmt::format - Rust
pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<(), String>
Expand description

Format a line of text according to the selected options.

+format_and_print in uu_numfmt::format - Rust
pub fn format_and_print(s: &str, options: &NumfmtOptions) -> Result<(), String>
Expand description

Format a line of text according to the selected options.

Given a line of text s, split the line into fields, transform and format any selected numeric fields, and print the result to stdout. Fields not selected for conversion are passed through unmodified.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uu_numfmt/format/index.html b/dev/uu_numfmt/format/index.html index 7ca8e04a6..ad478d8ff 100644 --- a/dev/uu_numfmt/format/index.html +++ b/dev/uu_numfmt/format/index.html @@ -1,6 +1,3 @@ -uu_numfmt::format - Rust

Structs

Iterate over a line’s fields, where each field is a contiguous sequence of +uu_numfmt::format - Rust

Structs

Iterate over a line’s fields, where each field is a contiguous sequence of non-whitespace, optionally prefixed with one or more characters of leading -whitespace. Fields are returned as tuples of (prefix, field).

-

Functions

Divide numerator by denominator, with rounding.

-

Format a line of text according to the selected options.

-
\ No newline at end of file +whitespace. Fields are returned as tuples of (prefix, field).

Functions

Divide numerator by denominator, with rounding.
Format a line of text according to the selected options.
\ No newline at end of file diff --git a/dev/uu_numfmt/format/struct.WhitespaceSplitter.html b/dev/uu_numfmt/format/struct.WhitespaceSplitter.html index 086e1af30..f64e48128 100644 --- a/dev/uu_numfmt/format/struct.WhitespaceSplitter.html +++ b/dev/uu_numfmt/format/struct.WhitespaceSplitter.html @@ -1,363 +1,160 @@ -WhitespaceSplitter in uu_numfmt::format - Rust
pub struct WhitespaceSplitter<'a> {
-    pub s: Option<&'a str>,
+WhitespaceSplitter in uu_numfmt::format - Rust
pub struct WhitespaceSplitter<'a> {
+    pub s: Option<&'a str>,
 }
Expand description

Iterate over a line’s fields, where each field is a contiguous sequence of non-whitespace, optionally prefixed with one or more characters of leading whitespace. Fields are returned as tuples of (prefix, field).

Examples:

-
let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("    1234 5") };
+
let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("    1234 5") };
 
-assert_eq!(Some(("    ", "1234")), fields.next());
-assert_eq!(Some((" ", "5")), fields.next());
-assert_eq!(None, fields.next());
+assert_eq!(Some((" ", "1234")), fields.next()); +assert_eq!(Some((" ", "5")), fields.next()); +assert_eq!(None, fields.next());

Delimiters are included in the results; prefix will be empty only for the first field of the line (including the case where the input line is empty):

-
let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("first second") };
+
let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("first second") };
 
-assert_eq!(Some(("", "first")), fields.next());
-assert_eq!(Some((" ", "second")), fields.next());
+assert_eq!(Some(("", "first")), fields.next());
+assert_eq!(Some((" ", "second")), fields.next());
 
-let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("") };
+let mut fields = uu_numfmt::format::WhitespaceSplitter { s: Some("") };
 
-assert_eq!(Some(("", "")), fields.next());
-

Fields

s: Option<&'a str>

Trait Implementations

Yield the next field in the input string as a tuple (prefix, field).

-

The type of the elements being iterated over.

-
🔬 This is a nightly-only experimental API. (iter_next_chunk)

Advances the iterator and returns an array containing the next N values. Read more

-

Returns the bounds on the remaining length of the iterator. Read more

-

Consumes the iterator, counting the number of iterations and returning it. Read more

-

Consumes the iterator, returning the last element. Read more

-
🔬 This is a nightly-only experimental API. (iter_advance_by)

Advances the iterator by n elements. Read more

-

Returns the nth element of the iterator. Read more

-

Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more

-

Takes two iterators and creates a new iterator over both in sequence. Read more

-

‘Zips up’ two iterators into a single iterator of pairs. Read more

-
🔬 This is a nightly-only experimental API. (iter_intersperse)

Creates a new iterator which places a copy of separator between adjacent -items of the original iterator. Read more

-
🔬 This is a nightly-only experimental API. (iter_intersperse)

Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more

-

Takes a closure and creates an iterator which calls that closure on each -element. Read more

-

Calls a closure on each element of an iterator. Read more

-

Creates an iterator which uses a closure to determine if an element -should be yielded. Read more

-

Creates an iterator that both filters and maps. Read more

-

Creates an iterator which gives the current iteration count as well as -the next value. Read more

-

Creates an iterator which can use the peek and peek_mut methods +assert_eq!(Some(("", "")), fields.next());

+

Fields

s: Option<&'a str>

Trait Implementations

Yield the next field in the input string as a tuple (prefix, field).

+
The type of the elements being iterated over.
🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
Returns the bounds on the remaining length of the iterator. Read more
Consumes the iterator, counting the number of iterations and returning it. Read more
Consumes the iterator, returning the last element. Read more
🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
Returns the nth element of the iterator. Read more
Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
Takes two iterators and creates a new iterator over both in sequence. Read more
‘Zips up’ two iterators into a single iterator of pairs. Read more
🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
Takes a closure and creates an iterator which calls that closure on each +element. Read more
Calls a closure on each element of an iterator. Read more
Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
Creates an iterator that both filters and maps. Read more
Creates an iterator which gives the current iteration count as well as +the next value. Read more
Creates an iterator which can use the peek and peek_mut methods to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more

-

Creates an iterator that skips elements based on a predicate. Read more

-

Creates an iterator that yields elements based on a predicate. Read more

-

Creates an iterator that both yields elements based on a predicate and maps. Read more

-

Creates an iterator that skips the first n elements. Read more

-

Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more

-

An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more

-

Creates an iterator that works like map, but flattens nested structure. Read more

-

Creates an iterator that flattens nested structure. Read more

-

Creates an iterator which ends after the first None. Read more

-

Does something with each element of an iterator, passing the value on. Read more

-

Borrows an iterator, rather than consuming it. Read more

-

Transforms an iterator into a collection. Read more

-
🔬 This is a nightly-only experimental API. (iterator_try_collect)

Fallibly transforms an iterator into a collection, short circuiting if -a failure is encountered. Read more

-
🔬 This is a nightly-only experimental API. (iter_collect_into)

Collects all the items from an iterator into a collection. Read more

-

Consumes an iterator, creating two collections from it. Read more

-
🔬 This is a nightly-only experimental API. (iter_partition_in_place)

Reorders the elements of this iterator in-place according to the given predicate, -such that all those that return true precede all those that return false. -Returns the number of true elements found. Read more

-
🔬 This is a nightly-only experimental API. (iter_is_partitioned)

Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more

-

An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more

-

An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more

-

Folds every element into an accumulator by applying an operation, -returning the final result. Read more

-

Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more

-
🔬 This is a nightly-only experimental API. (iterator_try_reduce)

Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more

-

Tests if every element of the iterator matches a predicate. Read more

-

Tests if any element of the iterator matches a predicate. Read more

-

Searches for an element of an iterator that satisfies a predicate. Read more

-

Applies function to the elements of iterator and returns -the first non-none result. Read more

-
🔬 This is a nightly-only experimental API. (try_find)

Applies function to the elements of iterator and returns -the first true result or the first error. Read more

-

Searches for an element in an iterator, returning its index. Read more

-

Searches for an element in an iterator from the right, returning its -index. Read more

-

Returns the maximum element of an iterator. Read more

-

Returns the minimum element of an iterator. Read more

-

Returns the element that gives the maximum value from the -specified function. Read more

-

Returns the element that gives the maximum value with respect to the -specified comparison function. Read more

-

Returns the element that gives the minimum value from the -specified function. Read more

-

Returns the element that gives the minimum value with respect to the -specified comparison function. Read more

-

Reverses an iterator’s direction. Read more

-

Converts an iterator of pairs into a pair of containers. Read more

-

Creates an iterator which copies all of its elements. Read more

-

Creates an iterator which clones all of its elements. Read more

-

Repeats an iterator endlessly. Read more

-

Sums the elements of an iterator. Read more

-

Iterates over the entire iterator, multiplying all the elements Read more

-

Lexicographically compares the elements of this Iterator with those -of another. Read more

-
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

-

Lexicographically compares the elements of this Iterator with those -of another. Read more

-
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

-

Determines if the elements of this Iterator are equal to those of -another. Read more

-
🔬 This is a nightly-only experimental API. (iter_order_by)

Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more

-

Determines if the elements of this Iterator are unequal to those of -another. Read more

-

Determines if the elements of this Iterator are lexicographically -less than those of another. Read more

-

Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more

-

Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more

-

Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more

-
🔬 This is a nightly-only experimental API. (is_sorted)

Checks if the elements of this iterator are sorted. Read more

-
🔬 This is a nightly-only experimental API. (is_sorted)

Checks if the elements of this iterator are sorted using the given comparator function. Read more

-
🔬 This is a nightly-only experimental API. (is_sorted)

Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+their documentation for more information. Read more
Creates an iterator that skips elements based on a predicate. Read more
Creates an iterator that yields elements based on a predicate. Read more
Creates an iterator that both yields elements based on a predicate and maps. Read more
Creates an iterator that skips the first n elements. Read more
Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
An iterator adapter similar to fold that holds internal state and +produces a new iterator. Read more
Creates an iterator that works like map, but flattens nested structure. Read more
Creates an iterator which ends after the first None. Read more
Does something with each element of an iterator, passing the value on. Read more
Borrows an iterator, rather than consuming it. Read more
Transforms an iterator into a collection. Read more
🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
Consumes an iterator, creating two collections from it. Read more
🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
Folds every element into an accumulator by applying an operation, +returning the final result. Read more
Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
Tests if every element of the iterator matches a predicate. Read more
Tests if any element of the iterator matches a predicate. Read more
Searches for an element of an iterator that satisfies a predicate. Read more
Applies function to the elements of iterator and returns +the first non-none result. Read more
🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
Searches for an element in an iterator, returning its index. Read more
Returns the element that gives the maximum value from the +specified function. Read more
Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
Returns the element that gives the minimum value from the +specified function. Read more
Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
Converts an iterator of pairs into a pair of containers. Read more
Creates an iterator which copies all of its elements. Read more
Creates an iterator which clones all of its elements. Read more
🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
Sums the elements of an iterator. Read more
Iterates over the entire iterator, multiplying all the elements Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
Lexicographically compares the elements of this Iterator with those +of another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
Determines if the elements of this Iterator are equal to those of +another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
Determines if the elements of this Iterator are unequal to those of +another. Read more
Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type of the elements being iterated over.

-

Which kind of iterator are we turning this into?

-

Creates an iterator from a value. Read more

-

Alternate elements from two iterators until both have run out. Read more

-

Alternate elements from two iterators until at least one of them has run -out. Read more

-

An iterator adaptor to insert a particular value -between each element of the adapted iterator. Read more

-

An iterator adaptor to insert a particular value created by a function -between each element of the adapted iterator. Read more

-

Create an iterator which iterates over both this and the specified -iterator simultaneously, yielding pairs of two optional elements. Read more

-

Create an iterator which iterates over both this and the specified -iterator simultaneously, yielding pairs of elements. Read more

-

A “meta iterator adaptor”. Its closure receives a reference to the +From<T> for U chooses to do.

+
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
Alternate elements from two iterators until both have run out. Read more
Alternate elements from two iterators until at least one of them has run +out. Read more
An iterator adaptor to insert a particular value +between each element of the adapted iterator. Read more
An iterator adaptor to insert a particular value created by a function +between each element of the adapted iterator. Read more
Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of two optional elements. Read more
Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of elements. Read more
A “meta iterator adaptor”. Its closure receives a reference to the iterator and may pick off as many elements as it likes, to produce the -next iterator element. Read more

-

Return an iterable that can group iterator elements. +next iterator element. Read more

Return an iterable that can group iterator elements. Consecutive elements that map to the same key (“runs”), are assigned -to the same group. Read more

-

Return an iterable that can chunk the iterator. Read more

-

Return an iterator over all contiguous windows producing tuples of -a specific size (up to 12). Read more

-

Return an iterator over all windows, wrapping back to the first +to the same group. Read more

Return an iterable that can chunk the iterator. Read more
Return an iterator over all contiguous windows producing tuples of +a specific size (up to 12). Read more
Return an iterator over all windows, wrapping back to the first elements when the window would otherwise exceed the length of the -iterator, producing tuples of a specific size (up to 12). Read more

-

Return an iterator that groups the items in tuples of a specific size -(up to 12). Read more

-

Split into an iterator pair that both yield all elements from -the original iterator. Read more

-
👎 Deprecated since 0.8.0:

Use std .step_by() instead

-

Return an iterator adaptor that steps n elements in the base iterator -for each iteration. Read more

-

Convert each item of the iterator using the Into trait. Read more

-
👎 Deprecated since 0.10.0:

Use .map_ok() instead

-

See .map_ok().

-

Return an iterator adaptor that applies the provided closure +iterator, producing tuples of a specific size (up to 12). Read more

Return an iterator that groups the items in tuples of a specific size +(up to 12). Read more
Split into an iterator pair that both yield all elements from +the original iterator. Read more
👎Deprecated since 0.8.0:

Use std .step_by() instead

+
Return an iterator adaptor that steps n elements in the base iterator +for each iteration. Read more
Convert each item of the iterator using the Into trait. Read more
👎Deprecated since 0.10.0:

Use .map_ok() instead

+
Return an iterator adaptor that applies the provided closure to every Result::Ok value. Result::Err values are -unchanged. Read more

-

Return an iterator adaptor that filters every Result::Ok +unchanged. Read more

Return an iterator adaptor that filters every Result::Ok value with the provided closure. Result::Err values are -unchanged. Read more

-

Return an iterator adaptor that filters and transforms every +unchanged. Read more

Return an iterator adaptor that filters and transforms every Result::Ok value with the provided closure. Result::Err -values are unchanged. Read more

-

Return an iterator adaptor that flattens every Result::Ok value into -a series of Result::Ok values. Result::Err values are unchanged. Read more

-

Return an iterator adaptor that merges the two base iterators in +values are unchanged. Read more

Return an iterator adaptor that flattens every Result::Ok value into +a series of Result::Ok values. Result::Err values are unchanged. Read more
Return an iterator adaptor that merges the two base iterators in ascending order. If both base iterators are sorted (ascending), the -result is sorted. Read more

-

Return an iterator adaptor that merges the two base iterators in order. -This is much like .merge() but allows for a custom ordering. Read more

-

Create an iterator that merges items from both this and the specified -iterator in ascending order. Read more

-

Return an iterator adaptor that flattens an iterator of iterators by -merging them in ascending order. Read more

-

Return an iterator adaptor that flattens an iterator of iterators by -merging them according to the given closure. Read more

-

Return an iterator adaptor that iterates over the cartesian product of -the element sets of two iterators self and J. Read more

-

Return an iterator adaptor that iterates over the cartesian product of -all subiterators returned by meta-iterator self. Read more

-

Return an iterator adaptor that uses the passed-in closure to -optionally merge together consecutive elements. Read more

-

Remove duplicates from sections of consecutive identical elements. -If the iterator is sorted, all elements will be unique. Read more

-

Remove duplicates from sections of consecutive identical elements, +result is sorted. Read more

Return an iterator adaptor that merges the two base iterators in order. +This is much like .merge() but allows for a custom ordering. Read more
Create an iterator that merges items from both this and the specified +iterator in ascending order. Read more
Return an iterator adaptor that flattens an iterator of iterators by +merging them in ascending order. Read more
Return an iterator adaptor that flattens an iterator of iterators by +merging them according to the given closure. Read more
Return an iterator adaptor that iterates over the cartesian product of +the element sets of two iterators self and J. Read more
Return an iterator adaptor that iterates over the cartesian product of +all subiterators returned by meta-iterator self. Read more
Return an iterator adaptor that uses the passed-in closure to +optionally merge together consecutive elements. Read more
Remove duplicates from sections of consecutive identical elements. +If the iterator is sorted, all elements will be unique. Read more
Remove duplicates from sections of consecutive identical elements, determining equality using a comparison function. -If the iterator is sorted, all elements will be unique. Read more

-

Remove duplicates from sections of consecutive identical elements, while keeping a count of +If the iterator is sorted, all elements will be unique. Read more

Remove duplicates from sections of consecutive identical elements, while keeping a count of how many repeated elements were present. -If the iterator is sorted, all elements will be unique. Read more

-

Remove duplicates from sections of consecutive identical elements, while keeping a count of +If the iterator is sorted, all elements will be unique. Read more

Remove duplicates from sections of consecutive identical elements, while keeping a count of how many repeated elements were present. This will determine equality using a comparison function. -If the iterator is sorted, all elements will be unique. Read more

-

Return an iterator adaptor that produces elements that appear more than once during the -iteration. Duplicates are detected using hash and equality. Read more

-

Return an iterator adaptor that produces elements that appear more than once during the -iteration. Duplicates are detected using hash and equality. Read more

-

Return an iterator adaptor that filters out elements that have +If the iterator is sorted, all elements will be unique. Read more

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
Return an iterator adaptor that filters out elements that have already been produced once during the iteration. Duplicates -are detected using hash and equality. Read more

-

Return an iterator adaptor that filters out elements that have -already been produced once during the iteration. Read more

-

Return an iterator adaptor that borrows from this iterator and -takes items while the closure accept returns true. Read more

-

Return an iterator adaptor that borrows from a Clone-able iterator -to only pick off elements while the predicate accept returns true. Read more

-

Return an iterator adaptor that filters Option<A> iterator elements -and produces A. Stops on the first None encountered. Read more

-

Return an iterator adaptor that iterates over the combinations of the -elements from an iterator. Read more

-

Return an iterator adaptor that iterates over the k-length combinations of -the elements from an iterator. Read more

-

Return an iterator that iterates over the k-length combinations of -the elements from an iterator, with replacement. Read more

-

Return an iterator adaptor that iterates over all k-permutations of the -elements from an iterator. Read more

-

Return an iterator that iterates through the powerset of the elements from an -iterator. Read more

-

Return an iterator adaptor that pads the sequence to a minimum length of -min by filling missing elements using a closure f. Read more

-

Return an iterator adaptor that wraps each element in a Position to -ease special-case handling of the first or last elements. Read more

-

Return an iterator adaptor that yields the indices of all elements -satisfying a predicate, counted from the start of the iterator. Read more

-

Return an iterator adaptor that applies a mutating function -to each element before yielding it. Read more

-

Advances the iterator and returns the next items grouped in a tuple of -a specific size (up to 12). Read more

-

Collects all items from the iterator into a tuple of a specific size -(up to 12). Read more

-

Find the position and value of the first element satisfying a predicate. Read more

-

Find the value of the first element satisfying a predicate or return the last element, if any. Read more

-

Find the value of the first element satisfying a predicate or return the first element, if any. Read more

-

Returns true if the given item is present in this iterator. Read more

-

Check whether all elements compare equal. Read more

-

Check whether all elements are unique (non equal). Read more

-

Consume the first n elements from the iterator eagerly, -and return the same iterator again. Read more

-

Consume the last n elements from the iterator eagerly, -and return the same iterator again. Read more

-
👎 Deprecated since 0.8.0:

Use .for_each() instead

-

Run the closure f eagerly on each element of the iterator. Read more

-

Combine all an iterator’s elements into one element by using Extend. Read more

-

.collect_vec() is simply a type specialization of Iterator::collect, -for convenience. Read more

-

.try_collect() is more convenient way of writing -.collect::<Result<_, _>>() Read more

-

Assign to each reference in self from the from iterator, -stopping at the shortest of the two iterators. Read more

-

Combine all iterator elements into one String, separated by sep. Read more

-

Format all iterator elements, separated by sep. Read more

-

Format all iterator elements, separated by sep. Read more

-
👎 Deprecated since 0.10.0:

Use .fold_ok() instead

-

See .fold_ok().

-

Fold Result values from an iterator. Read more

-

Fold Option values from an iterator. Read more

-
👎 Deprecated since 0.10.2:

Use Iterator::reduce instead

-

Accumulator of the elements in the iterator. Read more

-

Accumulate the elements in the iterator in a tree-like manner. Read more

-

An iterator method that applies a function, producing a single, final value. Read more

-

Iterate over the entire iterator and add all the elements. Read more

-

Iterate over the entire iterator and multiply all the elements. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. The key function is -called exactly once per key. Read more

-

Sort the k smallest elements into a new iterator, in ascending order. Read more

-

Collect all iterator elements into one of two -partitions. Unlike Iterator::partition, each partition may -have a distinct type. Read more

-

Partition a sequence of Results into one list of all the Ok elements -and another list of all the Err elements. Read more

-

Return a HashMap of keys mapped to Vecs of values. Keys and values -are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more

-

Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified -in the closure. Read more

-

Constructs a GroupingMap to be used later with one of the efficient -group-and-fold operations it allows to perform. Read more

-

Constructs a GroupingMap to be used later with one of the efficient -group-and-fold operations it allows to perform. Read more

-

Return all minimum elements of an iterator. Read more

-

Return all minimum elements of an iterator, as determined by -the specified function. Read more

-

Return all minimum elements of an iterator, as determined by -the specified function. Read more

-

Return all maximum elements of an iterator. Read more

-

Return all maximum elements of an iterator, as determined by -the specified function. Read more

-

Return all minimum elements of an iterator, as determined by -the specified function. Read more

-

Return the minimum and maximum elements in the iterator. Read more

-

Return the minimum and maximum element of an iterator, as determined by -the specified function. Read more

-

Return the minimum and maximum element of an iterator, as determined by -the specified comparison function. Read more

-

Return the position of the maximum element in the iterator. Read more

-

Return the position of the maximum element in the iterator, as -determined by the specified function. Read more

-

Return the position of the maximum element in the iterator, as -determined by the specified comparison function. Read more

-

Return the position of the minimum element in the iterator. Read more

-

Return the position of the minimum element in the iterator, as -determined by the specified function. Read more

-

Return the position of the minimum element in the iterator, as -determined by the specified comparison function. Read more

-

Return the positions of the minimum and maximum elements in -the iterator. Read more

-

Return the postions of the minimum and maximum elements of an -iterator, as determined by the specified function. Read more

-

Return the postions of the minimum and maximum elements of an -iterator, as determined by the specified comparison function. Read more

-

If the iterator yields exactly one element, that element will be returned, otherwise +are detected using hash and equality. Read more

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Read more
Return an iterator adaptor that borrows from this iterator and +takes items while the closure accept returns true. Read more
Return an iterator adaptor that borrows from a Clone-able iterator +to only pick off elements while the predicate accept returns true. Read more
Return an iterator adaptor that filters Option<A> iterator elements +and produces A. Stops on the first None encountered. Read more
Return an iterator adaptor that iterates over the combinations of the +elements from an iterator. Read more
Return an iterator adaptor that iterates over the k-length combinations of +the elements from an iterator. Read more
Return an iterator that iterates over the k-length combinations of +the elements from an iterator, with replacement. Read more
Return an iterator adaptor that iterates over all k-permutations of the +elements from an iterator. Read more
Return an iterator that iterates through the powerset of the elements from an +iterator. Read more
Return an iterator adaptor that pads the sequence to a minimum length of +min by filling missing elements using a closure f. Read more
Return an iterator adaptor that wraps each element in a Position to +ease special-case handling of the first or last elements. Read more
Return an iterator adaptor that yields the indices of all elements +satisfying a predicate, counted from the start of the iterator. Read more
Return an iterator adaptor that applies a mutating function +to each element before yielding it. Read more
Advances the iterator and returns the next items grouped in a tuple of +a specific size (up to 12). Read more
Collects all items from the iterator into a tuple of a specific size +(up to 12). Read more
Find the position and value of the first element satisfying a predicate. Read more
Find the value of the first element satisfying a predicate or return the last element, if any. Read more
Find the value of the first element satisfying a predicate or return the first element, if any. Read more
Returns true if the given item is present in this iterator. Read more
Check whether all elements compare equal. Read more
Check whether all elements are unique (non equal). Read more
Consume the first n elements from the iterator eagerly, +and return the same iterator again. Read more
Consume the last n elements from the iterator eagerly, +and return the same iterator again. Read more
👎Deprecated since 0.8.0:

Use .for_each() instead

+
Run the closure f eagerly on each element of the iterator. Read more
Combine all an iterator’s elements into one element by using Extend. Read more
.collect_vec() is simply a type specialization of Iterator::collect, +for convenience. Read more
.try_collect() is more convenient way of writing +.collect::<Result<_, _>>() Read more
Assign to each reference in self from the from iterator, +stopping at the shortest of the two iterators. Read more
Combine all iterator elements into one String, separated by sep. Read more
Format all iterator elements, separated by sep. Read more
Format all iterator elements, separated by sep. Read more
👎Deprecated since 0.10.0:

Use .fold_ok() instead

+
Fold Result values from an iterator. Read more
Fold Option values from an iterator. Read more
👎Deprecated since 0.10.2:

Use Iterator::reduce instead

+
Accumulator of the elements in the iterator. Read more
Accumulate the elements in the iterator in a tree-like manner. Read more
An iterator method that applies a function, producing a single, final value. Read more
Iterate over the entire iterator and add all the elements. Read more
Iterate over the entire iterator and multiply all the elements. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. The key function is +called exactly once per key. Read more
Sort the k smallest elements into a new iterator, in ascending order. Read more
Collect all iterator elements into one of two +partitions. Unlike Iterator::partition, each partition may +have a distinct type. Read more
Partition a sequence of Results into one list of all the Ok elements +and another list of all the Err elements. Read more
Return a HashMap of keys mapped to Vecs of values. Keys and values +are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more
Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified +in the closure. Read more
Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
Return all minimum elements of an iterator. Read more
Return all minimum elements of an iterator, as determined by +the specified function. Read more
Return all minimum elements of an iterator, as determined by +the specified function. Read more
Return all maximum elements of an iterator. Read more
Return all maximum elements of an iterator, as determined by +the specified function. Read more
Return all minimum elements of an iterator, as determined by +the specified function. Read more
Return the minimum and maximum elements in the iterator. Read more
Return the minimum and maximum element of an iterator, as determined by +the specified function. Read more
Return the minimum and maximum element of an iterator, as determined by +the specified comparison function. Read more
Return the position of the maximum element in the iterator. Read more
Return the position of the maximum element in the iterator, as +determined by the specified function. Read more
Return the position of the maximum element in the iterator, as +determined by the specified comparison function. Read more
Return the position of the minimum element in the iterator. Read more
Return the position of the minimum element in the iterator, as +determined by the specified function. Read more
Return the position of the minimum element in the iterator, as +determined by the specified comparison function. Read more
Return the positions of the minimum and maximum elements in +the iterator. Read more
Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified function. Read more
Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified comparison function. Read more
If the iterator yields exactly one element, that element will be returned, otherwise an error will be returned containing an iterator that has the same output as the input -iterator. Read more

-

If the iterator yields no elements, Ok(None) will be returned. If the iterator yields +iterator. Read more

If the iterator yields no elements, Ok(None) will be returned. If the iterator yields exactly one element, that element will be returned, otherwise an error will be returned -containing an iterator that has the same output as the input iterator. Read more

-

An iterator adaptor that allows the user to peek at multiple .next() -values without advancing the base iterator. Read more

-

Collect the items in this iterator and return a HashMap which +containing an iterator that has the same output as the input iterator. Read more

An iterator adaptor that allows the user to peek at multiple .next() +values without advancing the base iterator. Read more
Collect the items in this iterator and return a HashMap which contains each item that appears in the iterator and the number -of times it appears. Read more

-

Collect the items in this iterator and return a HashMap which +of times it appears. Read more

Collect the items in this iterator and return a HashMap which contains each item that appears in the iterator and the number of times it appears, -determining identity using a keying function. Read more

-

Converts an iterator of tuples into a tuple of containers. Read more

-

Unzip this iterator into multiple collections.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +determining identity using a keying function. Read more
Converts an iterator of tuples into a tuple of containers. Read more
Unzip this iterator into multiple collections.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_numfmt/index.html b/dev/uu_numfmt/index.html index 6a4b1d2ff..efd0d34a9 100644 --- a/dev/uu_numfmt/index.html +++ b/dev/uu_numfmt/index.html @@ -1 +1 @@ -uu_numfmt - Rust
\ No newline at end of file +uu_numfmt - Rust
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.DELIMITER.html b/dev/uu_numfmt/options/constant.DELIMITER.html index a46b48057..2ffcc27a6 100644 --- a/dev/uu_numfmt/options/constant.DELIMITER.html +++ b/dev/uu_numfmt/options/constant.DELIMITER.html @@ -1 +1 @@ -DELIMITER in uu_numfmt::options - Rust
pub const DELIMITER: &'static str = "delimiter";
\ No newline at end of file +DELIMITER in uu_numfmt::options - Rust
pub const DELIMITER: &'static str = "delimiter";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.FIELD.html b/dev/uu_numfmt/options/constant.FIELD.html index 71e89310d..56f85e760 100644 --- a/dev/uu_numfmt/options/constant.FIELD.html +++ b/dev/uu_numfmt/options/constant.FIELD.html @@ -1 +1 @@ -FIELD in uu_numfmt::options - Rust
pub const FIELD: &'static str = "field";
\ No newline at end of file +FIELD in uu_numfmt::options - Rust
pub const FIELD: &'static str = "field";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.FIELD_DEFAULT.html b/dev/uu_numfmt/options/constant.FIELD_DEFAULT.html index 7833e7cb1..627bc3160 100644 --- a/dev/uu_numfmt/options/constant.FIELD_DEFAULT.html +++ b/dev/uu_numfmt/options/constant.FIELD_DEFAULT.html @@ -1 +1 @@ -FIELD_DEFAULT in uu_numfmt::options - Rust
pub const FIELD_DEFAULT: &'static str = "1";
\ No newline at end of file +FIELD_DEFAULT in uu_numfmt::options - Rust
pub const FIELD_DEFAULT: &'static str = "1";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.FORMAT.html b/dev/uu_numfmt/options/constant.FORMAT.html index a42cb9534..66963ea27 100644 --- a/dev/uu_numfmt/options/constant.FORMAT.html +++ b/dev/uu_numfmt/options/constant.FORMAT.html @@ -1 +1 @@ -FORMAT in uu_numfmt::options - Rust
pub const FORMAT: &'static str = "format";
\ No newline at end of file +FORMAT in uu_numfmt::options - Rust
pub const FORMAT: &'static str = "format";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.FROM.html b/dev/uu_numfmt/options/constant.FROM.html index f8b5a39a7..a92573ab0 100644 --- a/dev/uu_numfmt/options/constant.FROM.html +++ b/dev/uu_numfmt/options/constant.FROM.html @@ -1 +1 @@ -FROM in uu_numfmt::options - Rust
pub const FROM: &'static str = "from";
\ No newline at end of file +FROM in uu_numfmt::options - Rust
pub const FROM: &'static str = "from";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.FROM_DEFAULT.html b/dev/uu_numfmt/options/constant.FROM_DEFAULT.html index 708d41ff0..80dd0f9a7 100644 --- a/dev/uu_numfmt/options/constant.FROM_DEFAULT.html +++ b/dev/uu_numfmt/options/constant.FROM_DEFAULT.html @@ -1 +1 @@ -FROM_DEFAULT in uu_numfmt::options - Rust
pub const FROM_DEFAULT: &'static str = "none";
\ No newline at end of file +FROM_DEFAULT in uu_numfmt::options - Rust
pub const FROM_DEFAULT: &'static str = "none";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.FROM_UNIT.html b/dev/uu_numfmt/options/constant.FROM_UNIT.html index d45e4e1fb..6adcc5e50 100644 --- a/dev/uu_numfmt/options/constant.FROM_UNIT.html +++ b/dev/uu_numfmt/options/constant.FROM_UNIT.html @@ -1 +1 @@ -FROM_UNIT in uu_numfmt::options - Rust
pub const FROM_UNIT: &'static str = "from-unit";
\ No newline at end of file +FROM_UNIT in uu_numfmt::options - Rust
pub const FROM_UNIT: &'static str = "from-unit";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.FROM_UNIT_DEFAULT.html b/dev/uu_numfmt/options/constant.FROM_UNIT_DEFAULT.html index 5128c684b..f8478f729 100644 --- a/dev/uu_numfmt/options/constant.FROM_UNIT_DEFAULT.html +++ b/dev/uu_numfmt/options/constant.FROM_UNIT_DEFAULT.html @@ -1 +1 @@ -FROM_UNIT_DEFAULT in uu_numfmt::options - Rust
pub const FROM_UNIT_DEFAULT: &'static str = "1";
\ No newline at end of file +FROM_UNIT_DEFAULT in uu_numfmt::options - Rust
pub const FROM_UNIT_DEFAULT: &'static str = "1";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.HEADER.html b/dev/uu_numfmt/options/constant.HEADER.html index 66623eafa..f3e165b46 100644 --- a/dev/uu_numfmt/options/constant.HEADER.html +++ b/dev/uu_numfmt/options/constant.HEADER.html @@ -1 +1 @@ -HEADER in uu_numfmt::options - Rust
pub const HEADER: &'static str = "header";
\ No newline at end of file +HEADER in uu_numfmt::options - Rust
pub const HEADER: &'static str = "header";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.HEADER_DEFAULT.html b/dev/uu_numfmt/options/constant.HEADER_DEFAULT.html index 6ba9573c6..e4d85e00b 100644 --- a/dev/uu_numfmt/options/constant.HEADER_DEFAULT.html +++ b/dev/uu_numfmt/options/constant.HEADER_DEFAULT.html @@ -1 +1 @@ -HEADER_DEFAULT in uu_numfmt::options - Rust
pub const HEADER_DEFAULT: &'static str = "1";
\ No newline at end of file +HEADER_DEFAULT in uu_numfmt::options - Rust
pub const HEADER_DEFAULT: &'static str = "1";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.NUMBER.html b/dev/uu_numfmt/options/constant.NUMBER.html index 79542791d..2e7895c39 100644 --- a/dev/uu_numfmt/options/constant.NUMBER.html +++ b/dev/uu_numfmt/options/constant.NUMBER.html @@ -1 +1 @@ -NUMBER in uu_numfmt::options - Rust
pub const NUMBER: &'static str = "NUMBER";
\ No newline at end of file +NUMBER in uu_numfmt::options - Rust
pub const NUMBER: &'static str = "NUMBER";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.PADDING.html b/dev/uu_numfmt/options/constant.PADDING.html index 17ce859f2..2644571bb 100644 --- a/dev/uu_numfmt/options/constant.PADDING.html +++ b/dev/uu_numfmt/options/constant.PADDING.html @@ -1 +1 @@ -PADDING in uu_numfmt::options - Rust
pub const PADDING: &'static str = "padding";
\ No newline at end of file +PADDING in uu_numfmt::options - Rust
pub const PADDING: &'static str = "padding";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.ROUND.html b/dev/uu_numfmt/options/constant.ROUND.html index a278c1d3e..069708aa4 100644 --- a/dev/uu_numfmt/options/constant.ROUND.html +++ b/dev/uu_numfmt/options/constant.ROUND.html @@ -1 +1 @@ -ROUND in uu_numfmt::options - Rust
pub const ROUND: &'static str = "round";
\ No newline at end of file +ROUND in uu_numfmt::options - Rust
pub const ROUND: &'static str = "round";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.SUFFIX.html b/dev/uu_numfmt/options/constant.SUFFIX.html index ecd8ad63a..4ced007c4 100644 --- a/dev/uu_numfmt/options/constant.SUFFIX.html +++ b/dev/uu_numfmt/options/constant.SUFFIX.html @@ -1 +1 @@ -SUFFIX in uu_numfmt::options - Rust
pub const SUFFIX: &'static str = "suffix";
\ No newline at end of file +SUFFIX in uu_numfmt::options - Rust
pub const SUFFIX: &'static str = "suffix";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.TO.html b/dev/uu_numfmt/options/constant.TO.html index 4399a1fa5..a8befa8ee 100644 --- a/dev/uu_numfmt/options/constant.TO.html +++ b/dev/uu_numfmt/options/constant.TO.html @@ -1 +1 @@ -TO in uu_numfmt::options - Rust
pub const TO: &'static str = "to";
\ No newline at end of file +TO in uu_numfmt::options - Rust
pub const TO: &'static str = "to";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.TO_DEFAULT.html b/dev/uu_numfmt/options/constant.TO_DEFAULT.html index d0eab8e28..c298cd059 100644 --- a/dev/uu_numfmt/options/constant.TO_DEFAULT.html +++ b/dev/uu_numfmt/options/constant.TO_DEFAULT.html @@ -1 +1 @@ -TO_DEFAULT in uu_numfmt::options - Rust
pub const TO_DEFAULT: &'static str = "none";
\ No newline at end of file +TO_DEFAULT in uu_numfmt::options - Rust
pub const TO_DEFAULT: &'static str = "none";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.TO_UNIT.html b/dev/uu_numfmt/options/constant.TO_UNIT.html index 769ca4d6c..155e3f5f3 100644 --- a/dev/uu_numfmt/options/constant.TO_UNIT.html +++ b/dev/uu_numfmt/options/constant.TO_UNIT.html @@ -1 +1 @@ -TO_UNIT in uu_numfmt::options - Rust
pub const TO_UNIT: &'static str = "to-unit";
\ No newline at end of file +TO_UNIT in uu_numfmt::options - Rust
pub const TO_UNIT: &'static str = "to-unit";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/constant.TO_UNIT_DEFAULT.html b/dev/uu_numfmt/options/constant.TO_UNIT_DEFAULT.html index d7280dc2f..8c8a1e1aa 100644 --- a/dev/uu_numfmt/options/constant.TO_UNIT_DEFAULT.html +++ b/dev/uu_numfmt/options/constant.TO_UNIT_DEFAULT.html @@ -1 +1 @@ -TO_UNIT_DEFAULT in uu_numfmt::options - Rust
pub const TO_UNIT_DEFAULT: &'static str = "1";
\ No newline at end of file +TO_UNIT_DEFAULT in uu_numfmt::options - Rust
pub const TO_UNIT_DEFAULT: &'static str = "1";
\ No newline at end of file diff --git a/dev/uu_numfmt/options/enum.RoundMethod.html b/dev/uu_numfmt/options/enum.RoundMethod.html index 6dee182f9..2d357d688 100644 --- a/dev/uu_numfmt/options/enum.RoundMethod.html +++ b/dev/uu_numfmt/options/enum.RoundMethod.html @@ -1,23 +1,11 @@ -RoundMethod in uu_numfmt::options - Rust
pub enum RoundMethod {
+RoundMethod in uu_numfmt::options - Rust
pub enum RoundMethod {
     Up,
     Down,
     FromZero,
     TowardsZero,
     Nearest,
-}

Variants

Up

Down

FromZero

TowardsZero

Nearest

Implementations

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Up

Down

FromZero

TowardsZero

Nearest

Implementations

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_numfmt/options/index.html b/dev/uu_numfmt/options/index.html index 077aff16d..ea22b0e43 100644 --- a/dev/uu_numfmt/options/index.html +++ b/dev/uu_numfmt/options/index.html @@ -1 +1 @@ -uu_numfmt::options - Rust
\ No newline at end of file +uu_numfmt::options - Rust
\ No newline at end of file diff --git a/dev/uu_numfmt/options/struct.FormatOptions.html b/dev/uu_numfmt/options/struct.FormatOptions.html index 105090827..a36592369 100644 --- a/dev/uu_numfmt/options/struct.FormatOptions.html +++ b/dev/uu_numfmt/options/struct.FormatOptions.html @@ -1,26 +1,14 @@ -FormatOptions in uu_numfmt::options - Rust
pub struct FormatOptions {
-    pub grouping: bool,
-    pub padding: Option<isize>,
-    pub precision: Option<usize>,
-    pub prefix: String,
-    pub suffix: String,
-    pub zero_padding: bool,
-}

Fields

grouping: boolpadding: Option<isize>precision: Option<usize>prefix: Stringsuffix: Stringzero_padding: bool

Trait Implementations

Formats the value using the given formatter. Read more

-

Returns the “default value” for a type. Read more

-

The associated error which can be returned from parsing.

-

Parses a string s to return a value of this type. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+FormatOptions in uu_numfmt::options - Rust
pub struct FormatOptions {
+    pub grouping: bool,
+    pub padding: Option<isize>,
+    pub precision: Option<usize>,
+    pub prefix: String,
+    pub suffix: String,
+    pub zero_padding: bool,
+}

Fields

grouping: boolpadding: Option<isize>precision: Option<usize>prefix: Stringsuffix: Stringzero_padding: bool

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_numfmt/options/struct.NumfmtOptions.html b/dev/uu_numfmt/options/struct.NumfmtOptions.html index ca4ac733d..d3f517110 100644 --- a/dev/uu_numfmt/options/struct.NumfmtOptions.html +++ b/dev/uu_numfmt/options/struct.NumfmtOptions.html @@ -1,21 +1,14 @@ -NumfmtOptions in uu_numfmt::options - Rust
pub struct NumfmtOptions {
+NumfmtOptions in uu_numfmt::options - Rust
pub struct NumfmtOptions {
     pub transform: TransformOptions,
-    pub padding: isize,
-    pub header: usize,
-    pub fields: Vec<Range>,
-    pub delimiter: Option<String>,
+    pub padding: isize,
+    pub header: usize,
+    pub fields: Vec<Range>,
+    pub delimiter: Option<String>,
     pub round: RoundMethod,
-    pub suffix: Option<String>,
+    pub suffix: Option<String>,
     pub format: FormatOptions,
-}

Fields

transform: TransformOptionspadding: isizeheader: usizefields: Vec<Range>delimiter: Option<String>round: RoundMethodsuffix: Option<String>format: FormatOptions

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Fields

transform: TransformOptionspadding: isizeheader: usizefields: Vec<Range>delimiter: Option<String>round: RoundMethodsuffix: Option<String>format: FormatOptions

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_numfmt/options/struct.TransformOptions.html b/dev/uu_numfmt/options/struct.TransformOptions.html index 088c5fd82..8cf018846 100644 --- a/dev/uu_numfmt/options/struct.TransformOptions.html +++ b/dev/uu_numfmt/options/struct.TransformOptions.html @@ -1,17 +1,10 @@ -TransformOptions in uu_numfmt::options - Rust
pub struct TransformOptions {
+TransformOptions in uu_numfmt::options - Rust
pub struct TransformOptions {
     pub from: Unit,
-    pub from_unit: usize,
+    pub from_unit: usize,
     pub to: Unit,
-    pub to_unit: usize,
-}

Fields

from: Unitfrom_unit: usizeto: Unitto_unit: usize

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+ pub to_unit: usize, +}

Fields

from: Unitfrom_unit: usizeto: Unitto_unit: usize

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_od/all.html b/dev/uu_od/all.html index 4c02ba123..3bce71199 100644 --- a/dev/uu_od/all.html +++ b/dev/uu_od/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_od/fn.uu_app.html b/dev/uu_od/fn.uu_app.html index c59c69319..12565d9f7 100644 --- a/dev/uu_od/fn.uu_app.html +++ b/dev/uu_od/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_od - Rust

Function uu_od::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_od - Rust

Function uu_od::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_od/fn.uumain.html b/dev/uu_od/fn.uumain.html index 9bb7bb36b..365b1ac42 100644 --- a/dev/uu_od/fn.uumain.html +++ b/dev/uu_od/fn.uumain.html @@ -1 +1 @@ -uumain in uu_od - Rust

Function uu_od::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_od - Rust

Function uu_od::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_od/index.html b/dev/uu_od/index.html index e504e9cff..67b8b402a 100644 --- a/dev/uu_od/index.html +++ b/dev/uu_od/index.html @@ -1 +1 @@ -uu_od - Rust
\ No newline at end of file +uu_od - Rust
\ No newline at end of file diff --git a/dev/uu_paste/all.html b/dev/uu_paste/all.html index 3f7726e41..c9dcb707e 100644 --- a/dev/uu_paste/all.html +++ b/dev/uu_paste/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_paste/fn.uu_app.html b/dev/uu_paste/fn.uu_app.html index ffea52513..d51c7c70d 100644 --- a/dev/uu_paste/fn.uu_app.html +++ b/dev/uu_paste/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_paste - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_paste - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_paste/fn.uumain.html b/dev/uu_paste/fn.uumain.html index 4b4b1abd0..c18f2afc6 100644 --- a/dev/uu_paste/fn.uumain.html +++ b/dev/uu_paste/fn.uumain.html @@ -1 +1 @@ -uumain in uu_paste - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_paste - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_paste/index.html b/dev/uu_paste/index.html index f0d801c9f..285caff77 100644 --- a/dev/uu_paste/index.html +++ b/dev/uu_paste/index.html @@ -1 +1 @@ -uu_paste - Rust
\ No newline at end of file +uu_paste - Rust
\ No newline at end of file diff --git a/dev/uu_pathchk/all.html b/dev/uu_pathchk/all.html index 610ca164c..d5629e60a 100644 --- a/dev/uu_pathchk/all.html +++ b/dev/uu_pathchk/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_pathchk/fn.uu_app.html b/dev/uu_pathchk/fn.uu_app.html index 909868043..ad8851c86 100644 --- a/dev/uu_pathchk/fn.uu_app.html +++ b/dev/uu_pathchk/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_pathchk - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_pathchk - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_pathchk/fn.uumain.html b/dev/uu_pathchk/fn.uumain.html index 29e4372ce..ff9174b40 100644 --- a/dev/uu_pathchk/fn.uumain.html +++ b/dev/uu_pathchk/fn.uumain.html @@ -1 +1 @@ -uumain in uu_pathchk - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_pathchk - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_pathchk/index.html b/dev/uu_pathchk/index.html index 89225178e..32e803f8b 100644 --- a/dev/uu_pathchk/index.html +++ b/dev/uu_pathchk/index.html @@ -1 +1 @@ -uu_pathchk - Rust
\ No newline at end of file +uu_pathchk - Rust
\ No newline at end of file diff --git a/dev/uu_pinky/all.html b/dev/uu_pinky/all.html index 45957e3bb..aacb8a9b5 100644 --- a/dev/uu_pinky/all.html +++ b/dev/uu_pinky/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Traits

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Traits

Functions

\ No newline at end of file diff --git a/dev/uu_pinky/fn.uu_app.html b/dev/uu_pinky/fn.uu_app.html index db3aeaee0..0241d6b7f 100644 --- a/dev/uu_pinky/fn.uu_app.html +++ b/dev/uu_pinky/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_pinky - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_pinky - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_pinky/fn.uumain.html b/dev/uu_pinky/fn.uumain.html index 48f361a06..2d60c4cce 100644 --- a/dev/uu_pinky/fn.uumain.html +++ b/dev/uu_pinky/fn.uumain.html @@ -1 +1 @@ -uumain in uu_pinky - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_pinky - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_pinky/index.html b/dev/uu_pinky/index.html index e83052b61..25d6ae1b0 100644 --- a/dev/uu_pinky/index.html +++ b/dev/uu_pinky/index.html @@ -1 +1 @@ -uu_pinky - Rust
\ No newline at end of file +uu_pinky - Rust
\ No newline at end of file diff --git a/dev/uu_pinky/trait.Capitalize.html b/dev/uu_pinky/trait.Capitalize.html index a6c6f2694..bb821c302 100644 --- a/dev/uu_pinky/trait.Capitalize.html +++ b/dev/uu_pinky/trait.Capitalize.html @@ -1,3 +1,3 @@ -Capitalize in uu_pinky - Rust
pub trait Capitalize {
-    fn capitalize(&self) -> String;
-}

Required Methods

Implementations on Foreign Types

Implementors

\ No newline at end of file +Capitalize in uu_pinky - Rust
pub trait Capitalize {
+    fn capitalize(&self) -> String;
+}

Required Methods

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/dev/uu_pr/all.html b/dev/uu_pr/all.html index e65bac6b2..b9fac01aa 100644 --- a/dev/uu_pr/all.html +++ b/dev/uu_pr/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_pr/fn.uu_app.html b/dev/uu_pr/fn.uu_app.html index 21dc524dc..1da139516 100644 --- a/dev/uu_pr/fn.uu_app.html +++ b/dev/uu_pr/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_pr - Rust

Function uu_pr::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_pr - Rust

Function uu_pr::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_pr/fn.uumain.html b/dev/uu_pr/fn.uumain.html index 344a21dd9..4c0f0c3f7 100644 --- a/dev/uu_pr/fn.uumain.html +++ b/dev/uu_pr/fn.uumain.html @@ -1 +1 @@ -uumain in uu_pr - Rust

Function uu_pr::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_pr - Rust

Function uu_pr::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_pr/index.html b/dev/uu_pr/index.html index a37c6e66b..769499a1f 100644 --- a/dev/uu_pr/index.html +++ b/dev/uu_pr/index.html @@ -1 +1 @@ -uu_pr - Rust
\ No newline at end of file +uu_pr - Rust
\ No newline at end of file diff --git a/dev/uu_printenv/all.html b/dev/uu_printenv/all.html index fa1173288..e664203fb 100644 --- a/dev/uu_printenv/all.html +++ b/dev/uu_printenv/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_printenv/fn.uu_app.html b/dev/uu_printenv/fn.uu_app.html index a34048e1b..734070142 100644 --- a/dev/uu_printenv/fn.uu_app.html +++ b/dev/uu_printenv/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_printenv - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_printenv - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_printenv/fn.uumain.html b/dev/uu_printenv/fn.uumain.html index 907828cae..ae363e0ed 100644 --- a/dev/uu_printenv/fn.uumain.html +++ b/dev/uu_printenv/fn.uumain.html @@ -1 +1 @@ -uumain in uu_printenv - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_printenv - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_printenv/index.html b/dev/uu_printenv/index.html index eb0807055..c49f28e6e 100644 --- a/dev/uu_printenv/index.html +++ b/dev/uu_printenv/index.html @@ -1 +1 @@ -uu_printenv - Rust
\ No newline at end of file +uu_printenv - Rust
\ No newline at end of file diff --git a/dev/uu_printf/all.html b/dev/uu_printf/all.html index 94a613c46..addf2a0fa 100644 --- a/dev/uu_printf/all.html +++ b/dev/uu_printf/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_printf/fn.uu_app.html b/dev/uu_printf/fn.uu_app.html index b55be1e4a..567dfb1cd 100644 --- a/dev/uu_printf/fn.uu_app.html +++ b/dev/uu_printf/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_printf - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_printf - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_printf/fn.uumain.html b/dev/uu_printf/fn.uumain.html index fdd62e520..cddee31be 100644 --- a/dev/uu_printf/fn.uumain.html +++ b/dev/uu_printf/fn.uumain.html @@ -1 +1 @@ -uumain in uu_printf - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_printf - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_printf/index.html b/dev/uu_printf/index.html index 46642641d..f1e3b729b 100644 --- a/dev/uu_printf/index.html +++ b/dev/uu_printf/index.html @@ -1 +1 @@ -uu_printf - Rust
\ No newline at end of file +uu_printf - Rust
\ No newline at end of file diff --git a/dev/uu_ptx/all.html b/dev/uu_ptx/all.html index 229fb0ef0..d98ec0088 100644 --- a/dev/uu_ptx/all.html +++ b/dev/uu_ptx/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_ptx/fn.uu_app.html b/dev/uu_ptx/fn.uu_app.html index 3ee5fd902..f090e6a23 100644 --- a/dev/uu_ptx/fn.uu_app.html +++ b/dev/uu_ptx/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_ptx - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_ptx - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_ptx/fn.uumain.html b/dev/uu_ptx/fn.uumain.html index ba006ac9f..4c3e63e23 100644 --- a/dev/uu_ptx/fn.uumain.html +++ b/dev/uu_ptx/fn.uumain.html @@ -1 +1 @@ -uumain in uu_ptx - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_ptx - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_ptx/index.html b/dev/uu_ptx/index.html index 3cb7d9e79..0ed436407 100644 --- a/dev/uu_ptx/index.html +++ b/dev/uu_ptx/index.html @@ -1 +1 @@ -uu_ptx - Rust
\ No newline at end of file +uu_ptx - Rust
\ No newline at end of file diff --git a/dev/uu_pwd/all.html b/dev/uu_pwd/all.html index 8a7fe4465..a14fd05f2 100644 --- a/dev/uu_pwd/all.html +++ b/dev/uu_pwd/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_pwd/fn.uu_app.html b/dev/uu_pwd/fn.uu_app.html index cb4933446..7bed08068 100644 --- a/dev/uu_pwd/fn.uu_app.html +++ b/dev/uu_pwd/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_pwd - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_pwd - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_pwd/fn.uumain.html b/dev/uu_pwd/fn.uumain.html index 8fa7cf560..cb50f9835 100644 --- a/dev/uu_pwd/fn.uumain.html +++ b/dev/uu_pwd/fn.uumain.html @@ -1 +1 @@ -uumain in uu_pwd - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_pwd - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_pwd/index.html b/dev/uu_pwd/index.html index 4fe5643d0..015be43ca 100644 --- a/dev/uu_pwd/index.html +++ b/dev/uu_pwd/index.html @@ -1 +1 @@ -uu_pwd - Rust
\ No newline at end of file +uu_pwd - Rust
\ No newline at end of file diff --git a/dev/uu_readlink/all.html b/dev/uu_readlink/all.html index 17b4aa8a9..aa27ace3b 100644 --- a/dev/uu_readlink/all.html +++ b/dev/uu_readlink/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_readlink/fn.uu_app.html b/dev/uu_readlink/fn.uu_app.html index 8284140df..59ca15842 100644 --- a/dev/uu_readlink/fn.uu_app.html +++ b/dev/uu_readlink/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_readlink - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_readlink - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_readlink/fn.uumain.html b/dev/uu_readlink/fn.uumain.html index 49495f3dc..4861ccad4 100644 --- a/dev/uu_readlink/fn.uumain.html +++ b/dev/uu_readlink/fn.uumain.html @@ -1 +1 @@ -uumain in uu_readlink - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_readlink - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_readlink/index.html b/dev/uu_readlink/index.html index 07e6e1a77..0b1d321da 100644 --- a/dev/uu_readlink/index.html +++ b/dev/uu_readlink/index.html @@ -1 +1 @@ -uu_readlink - Rust
\ No newline at end of file +uu_readlink - Rust
\ No newline at end of file diff --git a/dev/uu_realpath/all.html b/dev/uu_realpath/all.html index 9e206e59c..1a8693745 100644 --- a/dev/uu_realpath/all.html +++ b/dev/uu_realpath/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_realpath/fn.uu_app.html b/dev/uu_realpath/fn.uu_app.html index 72c2ce767..5226a1e13 100644 --- a/dev/uu_realpath/fn.uu_app.html +++ b/dev/uu_realpath/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_realpath - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_realpath - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_realpath/fn.uumain.html b/dev/uu_realpath/fn.uumain.html index de172d0e9..c20a06b73 100644 --- a/dev/uu_realpath/fn.uumain.html +++ b/dev/uu_realpath/fn.uumain.html @@ -1 +1 @@ -uumain in uu_realpath - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_realpath - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_realpath/index.html b/dev/uu_realpath/index.html index f3709a090..ce9ff58f4 100644 --- a/dev/uu_realpath/index.html +++ b/dev/uu_realpath/index.html @@ -1 +1 @@ -uu_realpath - Rust
\ No newline at end of file +uu_realpath - Rust
\ No newline at end of file diff --git a/dev/uu_relpath/all.html b/dev/uu_relpath/all.html index 3c336a8c0..34feb360d 100644 --- a/dev/uu_relpath/all.html +++ b/dev/uu_relpath/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_relpath/fn.uu_app.html b/dev/uu_relpath/fn.uu_app.html index d1a4414e6..5b1838cd8 100644 --- a/dev/uu_relpath/fn.uu_app.html +++ b/dev/uu_relpath/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_relpath - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_relpath - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_relpath/fn.uumain.html b/dev/uu_relpath/fn.uumain.html index 5fc0271c0..123ecad37 100644 --- a/dev/uu_relpath/fn.uumain.html +++ b/dev/uu_relpath/fn.uumain.html @@ -1 +1 @@ -uumain in uu_relpath - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_relpath - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_relpath/index.html b/dev/uu_relpath/index.html index a3794d7dd..154e9bd32 100644 --- a/dev/uu_relpath/index.html +++ b/dev/uu_relpath/index.html @@ -1 +1 @@ -uu_relpath - Rust
\ No newline at end of file +uu_relpath - Rust
\ No newline at end of file diff --git a/dev/uu_rm/all.html b/dev/uu_rm/all.html index 0ae5e06e3..9aa7f65fa 100644 --- a/dev/uu_rm/all.html +++ b/dev/uu_rm/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_rm/fn.uu_app.html b/dev/uu_rm/fn.uu_app.html index 7b7a53c53..c5a339f99 100644 --- a/dev/uu_rm/fn.uu_app.html +++ b/dev/uu_rm/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_rm - Rust

Function uu_rm::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_rm - Rust

Function uu_rm::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_rm/fn.uumain.html b/dev/uu_rm/fn.uumain.html index fee6bc6ae..9d4a3adec 100644 --- a/dev/uu_rm/fn.uumain.html +++ b/dev/uu_rm/fn.uumain.html @@ -1 +1 @@ -uumain in uu_rm - Rust

Function uu_rm::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_rm - Rust

Function uu_rm::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_rm/index.html b/dev/uu_rm/index.html index c99aeb0fa..d19eca5f7 100644 --- a/dev/uu_rm/index.html +++ b/dev/uu_rm/index.html @@ -1 +1 @@ -uu_rm - Rust
\ No newline at end of file +uu_rm - Rust
\ No newline at end of file diff --git a/dev/uu_rmdir/all.html b/dev/uu_rmdir/all.html index 03345a4e5..a69223b69 100644 --- a/dev/uu_rmdir/all.html +++ b/dev/uu_rmdir/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_rmdir/fn.uu_app.html b/dev/uu_rmdir/fn.uu_app.html index a0bccec4a..c65b45fac 100644 --- a/dev/uu_rmdir/fn.uu_app.html +++ b/dev/uu_rmdir/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_rmdir - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_rmdir - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_rmdir/fn.uumain.html b/dev/uu_rmdir/fn.uumain.html index 6c476f057..ab06ff5b5 100644 --- a/dev/uu_rmdir/fn.uumain.html +++ b/dev/uu_rmdir/fn.uumain.html @@ -1 +1 @@ -uumain in uu_rmdir - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_rmdir - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_rmdir/index.html b/dev/uu_rmdir/index.html index 1c6d42242..8580d62d6 100644 --- a/dev/uu_rmdir/index.html +++ b/dev/uu_rmdir/index.html @@ -1 +1 @@ -uu_rmdir - Rust
\ No newline at end of file +uu_rmdir - Rust
\ No newline at end of file diff --git a/dev/uu_runcon/all.html b/dev/uu_runcon/all.html index c2a8324f3..5b09e76c6 100644 --- a/dev/uu_runcon/all.html +++ b/dev/uu_runcon/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_runcon/fn.uu_app.html b/dev/uu_runcon/fn.uu_app.html index 1b94e7628..2d7d6a90a 100644 --- a/dev/uu_runcon/fn.uu_app.html +++ b/dev/uu_runcon/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_runcon - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_runcon - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_runcon/fn.uumain.html b/dev/uu_runcon/fn.uumain.html index 828b05d2b..fa379b7e5 100644 --- a/dev/uu_runcon/fn.uumain.html +++ b/dev/uu_runcon/fn.uumain.html @@ -1 +1 @@ -uumain in uu_runcon - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_runcon - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_runcon/index.html b/dev/uu_runcon/index.html index c346e6d00..70001bac9 100644 --- a/dev/uu_runcon/index.html +++ b/dev/uu_runcon/index.html @@ -1 +1 @@ -uu_runcon - Rust
\ No newline at end of file +uu_runcon - Rust
\ No newline at end of file diff --git a/dev/uu_runcon/options/constant.COMPUTE.html b/dev/uu_runcon/options/constant.COMPUTE.html index c29b069d6..dc9a6cff9 100644 --- a/dev/uu_runcon/options/constant.COMPUTE.html +++ b/dev/uu_runcon/options/constant.COMPUTE.html @@ -1 +1 @@ -COMPUTE in uu_runcon::options - Rust
pub const COMPUTE: &'static str = "compute";
\ No newline at end of file +COMPUTE in uu_runcon::options - Rust
pub const COMPUTE: &'static str = "compute";
\ No newline at end of file diff --git a/dev/uu_runcon/options/constant.RANGE.html b/dev/uu_runcon/options/constant.RANGE.html index 376527bc3..ff24fb146 100644 --- a/dev/uu_runcon/options/constant.RANGE.html +++ b/dev/uu_runcon/options/constant.RANGE.html @@ -1 +1 @@ -RANGE in uu_runcon::options - Rust
pub const RANGE: &'static str = "range";
\ No newline at end of file +RANGE in uu_runcon::options - Rust
pub const RANGE: &'static str = "range";
\ No newline at end of file diff --git a/dev/uu_runcon/options/constant.ROLE.html b/dev/uu_runcon/options/constant.ROLE.html index 46ba24909..023e7cba0 100644 --- a/dev/uu_runcon/options/constant.ROLE.html +++ b/dev/uu_runcon/options/constant.ROLE.html @@ -1 +1 @@ -ROLE in uu_runcon::options - Rust
pub const ROLE: &'static str = "role";
\ No newline at end of file +ROLE in uu_runcon::options - Rust
pub const ROLE: &'static str = "role";
\ No newline at end of file diff --git a/dev/uu_runcon/options/constant.TYPE.html b/dev/uu_runcon/options/constant.TYPE.html index d129d866e..cceabfba6 100644 --- a/dev/uu_runcon/options/constant.TYPE.html +++ b/dev/uu_runcon/options/constant.TYPE.html @@ -1 +1 @@ -TYPE in uu_runcon::options - Rust
pub const TYPE: &'static str = "type";
\ No newline at end of file +TYPE in uu_runcon::options - Rust
pub const TYPE: &'static str = "type";
\ No newline at end of file diff --git a/dev/uu_runcon/options/constant.USER.html b/dev/uu_runcon/options/constant.USER.html index ad8d0e341..4bf0805c6 100644 --- a/dev/uu_runcon/options/constant.USER.html +++ b/dev/uu_runcon/options/constant.USER.html @@ -1 +1 @@ -USER in uu_runcon::options - Rust
pub const USER: &'static str = "user";
\ No newline at end of file +USER in uu_runcon::options - Rust
pub const USER: &'static str = "user";
\ No newline at end of file diff --git a/dev/uu_runcon/options/index.html b/dev/uu_runcon/options/index.html index c7aa7351d..d2edf5a4d 100644 --- a/dev/uu_runcon/options/index.html +++ b/dev/uu_runcon/options/index.html @@ -1 +1 @@ -uu_runcon::options - Rust
\ No newline at end of file +uu_runcon::options - Rust
\ No newline at end of file diff --git a/dev/uu_seq/all.html b/dev/uu_seq/all.html index 69b3b2696..1baa479aa 100644 --- a/dev/uu_seq/all.html +++ b/dev/uu_seq/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_seq/fn.uu_app.html b/dev/uu_seq/fn.uu_app.html index f18f1d7b6..33b990e11 100644 --- a/dev/uu_seq/fn.uu_app.html +++ b/dev/uu_seq/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_seq - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_seq - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_seq/fn.uumain.html b/dev/uu_seq/fn.uumain.html index 4b9772434..36af24391 100644 --- a/dev/uu_seq/fn.uumain.html +++ b/dev/uu_seq/fn.uumain.html @@ -1 +1 @@ -uumain in uu_seq - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_seq - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_seq/index.html b/dev/uu_seq/index.html index ae15d8201..4569fa9ab 100644 --- a/dev/uu_seq/index.html +++ b/dev/uu_seq/index.html @@ -1 +1 @@ -uu_seq - Rust
\ No newline at end of file +uu_seq - Rust
\ No newline at end of file diff --git a/dev/uu_shred/all.html b/dev/uu_shred/all.html index 48fce816e..eca596567 100644 --- a/dev/uu_shred/all.html +++ b/dev/uu_shred/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_shred/fn.uu_app.html b/dev/uu_shred/fn.uu_app.html index 4f4ec8352..71cbc540c 100644 --- a/dev/uu_shred/fn.uu_app.html +++ b/dev/uu_shred/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_shred - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_shred - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_shred/fn.uumain.html b/dev/uu_shred/fn.uumain.html index 52f8bacd4..79c658f6a 100644 --- a/dev/uu_shred/fn.uumain.html +++ b/dev/uu_shred/fn.uumain.html @@ -1 +1 @@ -uumain in uu_shred - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_shred - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_shred/index.html b/dev/uu_shred/index.html index d84900e22..a6bfddf10 100644 --- a/dev/uu_shred/index.html +++ b/dev/uu_shred/index.html @@ -1 +1 @@ -uu_shred - Rust
\ No newline at end of file +uu_shred - Rust
\ No newline at end of file diff --git a/dev/uu_shred/options/constant.EXACT.html b/dev/uu_shred/options/constant.EXACT.html index 7fd6ca204..6efd79544 100644 --- a/dev/uu_shred/options/constant.EXACT.html +++ b/dev/uu_shred/options/constant.EXACT.html @@ -1 +1 @@ -EXACT in uu_shred::options - Rust
pub const EXACT: &'static str = "exact";
\ No newline at end of file +EXACT in uu_shred::options - Rust
pub const EXACT: &'static str = "exact";
\ No newline at end of file diff --git a/dev/uu_shred/options/constant.FILE.html b/dev/uu_shred/options/constant.FILE.html index 049829c4a..d569aca74 100644 --- a/dev/uu_shred/options/constant.FILE.html +++ b/dev/uu_shred/options/constant.FILE.html @@ -1 +1 @@ -FILE in uu_shred::options - Rust
pub const FILE: &'static str = "file";
\ No newline at end of file +FILE in uu_shred::options - Rust
pub const FILE: &'static str = "file";
\ No newline at end of file diff --git a/dev/uu_shred/options/constant.FORCE.html b/dev/uu_shred/options/constant.FORCE.html index 5a698b705..d5d2e3484 100644 --- a/dev/uu_shred/options/constant.FORCE.html +++ b/dev/uu_shred/options/constant.FORCE.html @@ -1 +1 @@ -FORCE in uu_shred::options - Rust
pub const FORCE: &'static str = "force";
\ No newline at end of file +FORCE in uu_shred::options - Rust
pub const FORCE: &'static str = "force";
\ No newline at end of file diff --git a/dev/uu_shred/options/constant.ITERATIONS.html b/dev/uu_shred/options/constant.ITERATIONS.html index 0cb7b3645..ad0282637 100644 --- a/dev/uu_shred/options/constant.ITERATIONS.html +++ b/dev/uu_shred/options/constant.ITERATIONS.html @@ -1 +1 @@ -ITERATIONS in uu_shred::options - Rust
pub const ITERATIONS: &'static str = "iterations";
\ No newline at end of file +ITERATIONS in uu_shred::options - Rust
pub const ITERATIONS: &'static str = "iterations";
\ No newline at end of file diff --git a/dev/uu_shred/options/constant.REMOVE.html b/dev/uu_shred/options/constant.REMOVE.html index faca1874a..d73715033 100644 --- a/dev/uu_shred/options/constant.REMOVE.html +++ b/dev/uu_shred/options/constant.REMOVE.html @@ -1 +1 @@ -REMOVE in uu_shred::options - Rust
pub const REMOVE: &'static str = "remove";
\ No newline at end of file +REMOVE in uu_shred::options - Rust
pub const REMOVE: &'static str = "remove";
\ No newline at end of file diff --git a/dev/uu_shred/options/constant.SIZE.html b/dev/uu_shred/options/constant.SIZE.html index 43860140b..3b5dd8617 100644 --- a/dev/uu_shred/options/constant.SIZE.html +++ b/dev/uu_shred/options/constant.SIZE.html @@ -1 +1 @@ -SIZE in uu_shred::options - Rust
pub const SIZE: &'static str = "size";
\ No newline at end of file +SIZE in uu_shred::options - Rust
pub const SIZE: &'static str = "size";
\ No newline at end of file diff --git a/dev/uu_shred/options/constant.VERBOSE.html b/dev/uu_shred/options/constant.VERBOSE.html index de73569b1..d685ea989 100644 --- a/dev/uu_shred/options/constant.VERBOSE.html +++ b/dev/uu_shred/options/constant.VERBOSE.html @@ -1 +1 @@ -VERBOSE in uu_shred::options - Rust
pub const VERBOSE: &'static str = "verbose";
\ No newline at end of file +VERBOSE in uu_shred::options - Rust
pub const VERBOSE: &'static str = "verbose";
\ No newline at end of file diff --git a/dev/uu_shred/options/constant.ZERO.html b/dev/uu_shred/options/constant.ZERO.html index 769e3b121..341970152 100644 --- a/dev/uu_shred/options/constant.ZERO.html +++ b/dev/uu_shred/options/constant.ZERO.html @@ -1 +1 @@ -ZERO in uu_shred::options - Rust
pub const ZERO: &'static str = "zero";
\ No newline at end of file +ZERO in uu_shred::options - Rust
pub const ZERO: &'static str = "zero";
\ No newline at end of file diff --git a/dev/uu_shred/options/index.html b/dev/uu_shred/options/index.html index 8b904d065..73b743219 100644 --- a/dev/uu_shred/options/index.html +++ b/dev/uu_shred/options/index.html @@ -1 +1 @@ -uu_shred::options - Rust
\ No newline at end of file +uu_shred::options - Rust
\ No newline at end of file diff --git a/dev/uu_shuf/all.html b/dev/uu_shuf/all.html index 453f94788..c88ccc5b7 100644 --- a/dev/uu_shuf/all.html +++ b/dev/uu_shuf/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_shuf/fn.uu_app.html b/dev/uu_shuf/fn.uu_app.html index 8bcd52558..3213f53e3 100644 --- a/dev/uu_shuf/fn.uu_app.html +++ b/dev/uu_shuf/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_shuf - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_shuf - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_shuf/fn.uumain.html b/dev/uu_shuf/fn.uumain.html index 2fba19a0c..87ae762b7 100644 --- a/dev/uu_shuf/fn.uumain.html +++ b/dev/uu_shuf/fn.uumain.html @@ -1 +1 @@ -uumain in uu_shuf - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_shuf - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_shuf/index.html b/dev/uu_shuf/index.html index a0582a6cd..bea524ed4 100644 --- a/dev/uu_shuf/index.html +++ b/dev/uu_shuf/index.html @@ -1 +1 @@ -uu_shuf - Rust
\ No newline at end of file +uu_shuf - Rust
\ No newline at end of file diff --git a/dev/uu_sleep/all.html b/dev/uu_sleep/all.html index ec6a051a4..7a1b103f7 100644 --- a/dev/uu_sleep/all.html +++ b/dev/uu_sleep/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_sleep/fn.uu_app.html b/dev/uu_sleep/fn.uu_app.html index 74cd7890f..054f1cae3 100644 --- a/dev/uu_sleep/fn.uu_app.html +++ b/dev/uu_sleep/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_sleep - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_sleep - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_sleep/fn.uumain.html b/dev/uu_sleep/fn.uumain.html index 5ac1d1ea6..32a576431 100644 --- a/dev/uu_sleep/fn.uumain.html +++ b/dev/uu_sleep/fn.uumain.html @@ -1 +1 @@ -uumain in uu_sleep - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_sleep - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_sleep/index.html b/dev/uu_sleep/index.html index 6383ec1b6..f657bb0a9 100644 --- a/dev/uu_sleep/index.html +++ b/dev/uu_sleep/index.html @@ -1 +1 @@ -uu_sleep - Rust
\ No newline at end of file +uu_sleep - Rust
\ No newline at end of file diff --git a/dev/uu_sort/all.html b/dev/uu_sort/all.html index d5aab8080..70e1b933f 100644 --- a/dev/uu_sort/all.html +++ b/dev/uu_sort/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Structs

Enums

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Structs

Enums

Functions

\ No newline at end of file diff --git a/dev/uu_sort/enum.GeneralF64ParseResult.html b/dev/uu_sort/enum.GeneralF64ParseResult.html index 5d195c1f2..72582d67f 100644 --- a/dev/uu_sort/enum.GeneralF64ParseResult.html +++ b/dev/uu_sort/enum.GeneralF64ParseResult.html @@ -1,40 +1,15 @@ -GeneralF64ParseResult in uu_sort - Rust
pub enum GeneralF64ParseResult {
+GeneralF64ParseResult in uu_sort - Rust
pub enum GeneralF64ParseResult {
     Invalid,
     NaN,
     NegInfinity,
-    Number(f64),
+    Number(f64),
     Infinity,
-}

Variants

Invalid

NaN

NegInfinity

Number(f64)

Infinity

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

This method returns an ordering between self and other values if one exists. Read more

-

This method tests less than (for self and other) and is used by the < operator. Read more

-

This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

-

This method tests greater than (for self and other) and is used by the > operator. Read more

-

This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Invalid

NaN

NegInfinity

Number(f64)

Infinity

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The alignment of pointer.

-

The type for initializers.

-

Initializes a with the given initializer. Read more

-

Dereferences the given pointer. Read more

-

Mutably dereferences the given pointer. Read more

-

Drops the object pointed to by the given pointer. Read more

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_sort/fn.uu_app.html b/dev/uu_sort/fn.uu_app.html index 471c33d16..20a8c4731 100644 --- a/dev/uu_sort/fn.uu_app.html +++ b/dev/uu_sort/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_sort - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_sort - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_sort/fn.uumain.html b/dev/uu_sort/fn.uumain.html index 52a680482..415ee5df3 100644 --- a/dev/uu_sort/fn.uumain.html +++ b/dev/uu_sort/fn.uumain.html @@ -1 +1 @@ -uumain in uu_sort - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_sort - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_sort/index.html b/dev/uu_sort/index.html index 729329804..8263feb14 100644 --- a/dev/uu_sort/index.html +++ b/dev/uu_sort/index.html @@ -1 +1 @@ -uu_sort - Rust
\ No newline at end of file +uu_sort - Rust
\ No newline at end of file diff --git a/dev/uu_sort/struct.GlobalSettings.html b/dev/uu_sort/struct.GlobalSettings.html index 039adad57..34867d12d 100644 --- a/dev/uu_sort/struct.GlobalSettings.html +++ b/dev/uu_sort/struct.GlobalSettings.html @@ -1,24 +1,5 @@ -GlobalSettings in uu_sort - Rust
pub struct GlobalSettings { /* private fields */ }

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Returns the “default value” for a type. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+GlobalSettings in uu_sort - Rust
pub struct GlobalSettings { /* private fields */ }

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The alignment of pointer.

-

The type for initializers.

-

Initializes a with the given initializer. Read more

-

Dereferences the given pointer. Read more

-

Mutably dereferences the given pointer. Read more

-

Drops the object pointed to by the given pointer. Read more

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_sort/struct.Line.html b/dev/uu_sort/struct.Line.html index f84a392ba..3b584aa8e 100644 --- a/dev/uu_sort/struct.Line.html +++ b/dev/uu_sort/struct.Line.html @@ -1,24 +1,5 @@ -Line in uu_sort - Rust
pub struct Line<'a> { /* private fields */ }

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Line in uu_sort - Rust
pub struct Line<'a> { /* private fields */ }

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The alignment of pointer.

-

The type for initializers.

-

Initializes a with the given initializer. Read more

-

Dereferences the given pointer. Read more

-

Mutably dereferences the given pointer. Read more

-

Drops the object pointed to by the given pointer. Read more

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_sort/struct.Output.html b/dev/uu_sort/struct.Output.html index 2034d2264..352f25ccf 100644 --- a/dev/uu_sort/struct.Output.html +++ b/dev/uu_sort/struct.Output.html @@ -1,18 +1,5 @@ -Output in uu_sort - Rust
pub struct Output { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Output in uu_sort - Rust
pub struct Output { /* private fields */ }

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The alignment of pointer.

-

The type for initializers.

-

Initializes a with the given initializer. Read more

-

Dereferences the given pointer. Read more

-

Mutably dereferences the given pointer. Read more

-

Drops the object pointed to by the given pointer. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_split/all.html b/dev/uu_split/all.html index 43e3d6290..a13eba02b 100644 --- a/dev/uu_split/all.html +++ b/dev/uu_split/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_split/fn.uu_app.html b/dev/uu_split/fn.uu_app.html index 737b293a6..f98169d02 100644 --- a/dev/uu_split/fn.uu_app.html +++ b/dev/uu_split/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_split - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_split - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_split/fn.uumain.html b/dev/uu_split/fn.uumain.html index 308225413..25043e7a2 100644 --- a/dev/uu_split/fn.uumain.html +++ b/dev/uu_split/fn.uumain.html @@ -1 +1 @@ -uumain in uu_split - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_split - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_split/index.html b/dev/uu_split/index.html index c435ff084..c2d5db4b2 100644 --- a/dev/uu_split/index.html +++ b/dev/uu_split/index.html @@ -1 +1 @@ -uu_split - Rust
\ No newline at end of file +uu_split - Rust
\ No newline at end of file diff --git a/dev/uu_stat/all.html b/dev/uu_stat/all.html index 0e35de180..786610822 100644 --- a/dev/uu_stat/all.html +++ b/dev/uu_stat/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_stat/constant.F_ALTER.html b/dev/uu_stat/constant.F_ALTER.html index 391147507..6961c91ae 100644 --- a/dev/uu_stat/constant.F_ALTER.html +++ b/dev/uu_stat/constant.F_ALTER.html @@ -1 +1 @@ -F_ALTER in uu_stat - Rust
pub const F_ALTER: u8 = 1;
\ No newline at end of file +F_ALTER in uu_stat - Rust
pub const F_ALTER: u8 = 1;
\ No newline at end of file diff --git a/dev/uu_stat/constant.F_GROUP.html b/dev/uu_stat/constant.F_GROUP.html index 49a339836..26fbb5fa7 100644 --- a/dev/uu_stat/constant.F_GROUP.html +++ b/dev/uu_stat/constant.F_GROUP.html @@ -1 +1 @@ -F_GROUP in uu_stat - Rust
pub const F_GROUP: u8 = _; // 32u8
\ No newline at end of file +F_GROUP in uu_stat - Rust
pub const F_GROUP: u8 = _; // 32u8
\ No newline at end of file diff --git a/dev/uu_stat/constant.F_LEFT.html b/dev/uu_stat/constant.F_LEFT.html index d76b326f7..aa8f3daa7 100644 --- a/dev/uu_stat/constant.F_LEFT.html +++ b/dev/uu_stat/constant.F_LEFT.html @@ -1 +1 @@ -F_LEFT in uu_stat - Rust
pub const F_LEFT: u8 = _; // 4u8
\ No newline at end of file +F_LEFT in uu_stat - Rust
pub const F_LEFT: u8 = _; // 4u8
\ No newline at end of file diff --git a/dev/uu_stat/constant.F_SIGN.html b/dev/uu_stat/constant.F_SIGN.html index fa7f6980b..7caf0bd44 100644 --- a/dev/uu_stat/constant.F_SIGN.html +++ b/dev/uu_stat/constant.F_SIGN.html @@ -1 +1 @@ -F_SIGN in uu_stat - Rust
pub const F_SIGN: u8 = _; // 16u8
\ No newline at end of file +F_SIGN in uu_stat - Rust
pub const F_SIGN: u8 = _; // 16u8
\ No newline at end of file diff --git a/dev/uu_stat/constant.F_SPACE.html b/dev/uu_stat/constant.F_SPACE.html index 89bc9dbc3..b3b306f7c 100644 --- a/dev/uu_stat/constant.F_SPACE.html +++ b/dev/uu_stat/constant.F_SPACE.html @@ -1 +1 @@ -F_SPACE in uu_stat - Rust
pub const F_SPACE: u8 = _; // 8u8
\ No newline at end of file +F_SPACE in uu_stat - Rust
pub const F_SPACE: u8 = _; // 8u8
\ No newline at end of file diff --git a/dev/uu_stat/constant.F_ZERO.html b/dev/uu_stat/constant.F_ZERO.html index 969c75b16..6951aac7d 100644 --- a/dev/uu_stat/constant.F_ZERO.html +++ b/dev/uu_stat/constant.F_ZERO.html @@ -1 +1 @@ -F_ZERO in uu_stat - Rust
pub const F_ZERO: u8 = _; // 2u8
\ No newline at end of file +F_ZERO in uu_stat - Rust
pub const F_ZERO: u8 = _; // 2u8
\ No newline at end of file diff --git a/dev/uu_stat/enum.OutputType.html b/dev/uu_stat/enum.OutputType.html index 801419f05..3579e7fef 100644 --- a/dev/uu_stat/enum.OutputType.html +++ b/dev/uu_stat/enum.OutputType.html @@ -1,23 +1,14 @@ -OutputType in uu_stat - Rust
pub enum OutputType {
+OutputType in uu_stat - Rust
pub enum OutputType {
     Str,
     Integer,
     Unsigned,
     UnsignedHex,
     UnsignedOct,
     Unknown,
-}

Variants

Str

Integer

Unsigned

UnsignedHex

UnsignedOct

Unknown

Trait Implementations

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Str

Integer

Unsigned

UnsignedHex

UnsignedOct

Unknown

Trait Implementations

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_stat/enum.Token.html b/dev/uu_stat/enum.Token.html index 02da2c794..43d731f90 100644 --- a/dev/uu_stat/enum.Token.html +++ b/dev/uu_stat/enum.Token.html @@ -1,24 +1,15 @@ -Token in uu_stat - Rust
pub enum Token {
-    Char(char),
+Token in uu_stat - Rust
pub enum Token {
+    Char(char),
     Directive {
-        flag: u8,
-        width: usize,
-        precision: i32,
-        format: char,
+        flag: u8,
+        width: usize,
+        precision: i32,
+        format: char,
     },
-}

Variants

Char(char)

Directive

Fields

flag: u8
width: usize
precision: i32
format: char

Trait Implementations

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Char(char)

Directive

Fields

flag: u8
width: usize
precision: i32
format: char

Trait Implementations

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_stat/fn.group_num.html b/dev/uu_stat/fn.group_num.html index e4f957426..c144fe9d1 100644 --- a/dev/uu_stat/fn.group_num.html +++ b/dev/uu_stat/fn.group_num.html @@ -1 +1 @@ -group_num in uu_stat - Rust
pub fn group_num(s: &str) -> Cow<'_, str>
\ No newline at end of file +group_num in uu_stat - Rust
pub fn group_num(s: &str) -> Cow<'_, str>
\ No newline at end of file diff --git a/dev/uu_stat/fn.uu_app.html b/dev/uu_stat/fn.uu_app.html index b46305baa..cb89ecf92 100644 --- a/dev/uu_stat/fn.uu_app.html +++ b/dev/uu_stat/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_stat - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_stat - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_stat/fn.uumain.html b/dev/uu_stat/fn.uumain.html index fcd7dffb3..54105d578 100644 --- a/dev/uu_stat/fn.uumain.html +++ b/dev/uu_stat/fn.uumain.html @@ -1 +1 @@ -uumain in uu_stat - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_stat - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_stat/index.html b/dev/uu_stat/index.html index b6e0d4523..d7f2336c5 100644 --- a/dev/uu_stat/index.html +++ b/dev/uu_stat/index.html @@ -1 +1 @@ -uu_stat - Rust
\ No newline at end of file +uu_stat - Rust
\ No newline at end of file diff --git a/dev/uu_stat/options/index.html b/dev/uu_stat/options/index.html index e4933c086..756ac3bc6 100644 --- a/dev/uu_stat/options/index.html +++ b/dev/uu_stat/options/index.html @@ -1 +1 @@ -uu_stat::options - Rust
\ No newline at end of file +uu_stat::options - Rust
\ No newline at end of file diff --git a/dev/uu_stat/options/static.DEREFERENCE.html b/dev/uu_stat/options/static.DEREFERENCE.html index 5e4dda593..54fd093ca 100644 --- a/dev/uu_stat/options/static.DEREFERENCE.html +++ b/dev/uu_stat/options/static.DEREFERENCE.html @@ -1 +1 @@ -DEREFERENCE in uu_stat::options - Rust
pub static DEREFERENCE: &'static str
\ No newline at end of file +DEREFERENCE in uu_stat::options - Rust
pub static DEREFERENCE: &'static str
\ No newline at end of file diff --git a/dev/uu_stat/options/static.FILE_SYSTEM.html b/dev/uu_stat/options/static.FILE_SYSTEM.html index 67e31b7fd..3b3ec3e61 100644 --- a/dev/uu_stat/options/static.FILE_SYSTEM.html +++ b/dev/uu_stat/options/static.FILE_SYSTEM.html @@ -1 +1 @@ -FILE_SYSTEM in uu_stat::options - Rust
pub static FILE_SYSTEM: &'static str
\ No newline at end of file +FILE_SYSTEM in uu_stat::options - Rust
pub static FILE_SYSTEM: &'static str
\ No newline at end of file diff --git a/dev/uu_stat/options/static.FORMAT.html b/dev/uu_stat/options/static.FORMAT.html index 63f6b80ca..c3c88c615 100644 --- a/dev/uu_stat/options/static.FORMAT.html +++ b/dev/uu_stat/options/static.FORMAT.html @@ -1 +1 @@ -FORMAT in uu_stat::options - Rust
pub static FORMAT: &'static str
\ No newline at end of file +FORMAT in uu_stat::options - Rust
pub static FORMAT: &'static str
\ No newline at end of file diff --git a/dev/uu_stat/options/static.PRINTF.html b/dev/uu_stat/options/static.PRINTF.html index e95829094..a0303d278 100644 --- a/dev/uu_stat/options/static.PRINTF.html +++ b/dev/uu_stat/options/static.PRINTF.html @@ -1 +1 @@ -PRINTF in uu_stat::options - Rust
pub static PRINTF: &'static str
\ No newline at end of file +PRINTF in uu_stat::options - Rust
pub static PRINTF: &'static str
\ No newline at end of file diff --git a/dev/uu_stat/options/static.TERSE.html b/dev/uu_stat/options/static.TERSE.html index 1b648631b..6c88a0aff 100644 --- a/dev/uu_stat/options/static.TERSE.html +++ b/dev/uu_stat/options/static.TERSE.html @@ -1 +1 @@ -TERSE in uu_stat::options - Rust
pub static TERSE: &'static str
\ No newline at end of file +TERSE in uu_stat::options - Rust
pub static TERSE: &'static str
\ No newline at end of file diff --git a/dev/uu_stat/struct.Stater.html b/dev/uu_stat/struct.Stater.html index 462d71f2c..ff9633dc5 100644 --- a/dev/uu_stat/struct.Stater.html +++ b/dev/uu_stat/struct.Stater.html @@ -1,12 +1,5 @@ -Stater in uu_stat - Rust
pub struct Stater { /* private fields */ }

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Stater in uu_stat - Rust
pub struct Stater { /* private fields */ }

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_stat/trait.ScanUtil.html b/dev/uu_stat/trait.ScanUtil.html index 0b79560cd..5ef9e4700 100644 --- a/dev/uu_stat/trait.ScanUtil.html +++ b/dev/uu_stat/trait.ScanUtil.html @@ -1,4 +1,4 @@ -ScanUtil in uu_stat - Rust
pub trait ScanUtil {
-    fn scan_num<F>(&self) -> Option<(F, usize)>
    where
        F: FromStr
; - fn scan_char(&self, radix: u32) -> Option<(char, usize)>; -}

Required Methods

Implementations on Foreign Types

Implementors

\ No newline at end of file +ScanUtil in uu_stat - Rust
pub trait ScanUtil {
+    fn scan_num<F>(&self) -> Option<(F, usize)>
    where
        F: FromStr
; + fn scan_char(&self, radix: u32) -> Option<(char, usize)>; +}

Required Methods

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/dev/uu_stdbuf/all.html b/dev/uu_stdbuf/all.html index a2fc45ac1..2e26f5161 100644 --- a/dev/uu_stdbuf/all.html +++ b/dev/uu_stdbuf/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_stdbuf/fn.uu_app.html b/dev/uu_stdbuf/fn.uu_app.html index 0c1fcde7c..5e0ce8dd3 100644 --- a/dev/uu_stdbuf/fn.uu_app.html +++ b/dev/uu_stdbuf/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_stdbuf - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_stdbuf - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_stdbuf/fn.uumain.html b/dev/uu_stdbuf/fn.uumain.html index 48b5f489c..8626d1281 100644 --- a/dev/uu_stdbuf/fn.uumain.html +++ b/dev/uu_stdbuf/fn.uumain.html @@ -1 +1 @@ -uumain in uu_stdbuf - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_stdbuf - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_stdbuf/index.html b/dev/uu_stdbuf/index.html index 64d69a0ed..16ea5d027 100644 --- a/dev/uu_stdbuf/index.html +++ b/dev/uu_stdbuf/index.html @@ -1 +1 @@ -uu_stdbuf - Rust
\ No newline at end of file +uu_stdbuf - Rust
\ No newline at end of file diff --git a/dev/uu_stty/all.html b/dev/uu_stty/all.html index 60ecb589f..3f089dab3 100644 --- a/dev/uu_stty/all.html +++ b/dev/uu_stty/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Structs

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Structs

Functions

\ No newline at end of file diff --git a/dev/uu_stty/fn.tiocgwinsz.html b/dev/uu_stty/fn.tiocgwinsz.html index ae7832a41..52fd3b5d3 100644 --- a/dev/uu_stty/fn.tiocgwinsz.html +++ b/dev/uu_stty/fn.tiocgwinsz.html @@ -1,2 +1,2 @@ -tiocgwinsz in uu_stty - Rust
pub unsafe fn tiocgwinsz(fd: c_int, data: *mut TermSize) -> Result<c_int>
Expand description

Get terminal window size

-
\ No newline at end of file +tiocgwinsz in uu_stty - Rust
pub unsafe fn tiocgwinsz(fd: c_int, data: *mut TermSize) -> Result<c_int>
Expand description

Get terminal window size

+
\ No newline at end of file diff --git a/dev/uu_stty/fn.tiocswinsz.html b/dev/uu_stty/fn.tiocswinsz.html index 3837c972b..acb0d0716 100644 --- a/dev/uu_stty/fn.tiocswinsz.html +++ b/dev/uu_stty/fn.tiocswinsz.html @@ -1,2 +1,2 @@ -tiocswinsz in uu_stty - Rust
pub unsafe fn tiocswinsz(fd: c_int, data: *const TermSize) -> Result<c_int>
Expand description

Set terminal window size

-
\ No newline at end of file +tiocswinsz in uu_stty - Rust
pub unsafe fn tiocswinsz(fd: c_int, data: *const TermSize) -> Result<c_int>
Expand description

Set terminal window size

+
\ No newline at end of file diff --git a/dev/uu_stty/fn.uu_app.html b/dev/uu_stty/fn.uu_app.html index 89bb092f3..577aa2322 100644 --- a/dev/uu_stty/fn.uu_app.html +++ b/dev/uu_stty/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_stty - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_stty - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_stty/fn.uumain.html b/dev/uu_stty/fn.uumain.html index 66a0a1993..e7a0dbd3f 100644 --- a/dev/uu_stty/fn.uumain.html +++ b/dev/uu_stty/fn.uumain.html @@ -1 +1 @@ -uumain in uu_stty - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_stty - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_stty/index.html b/dev/uu_stty/index.html index bb06e7d20..f25654dd9 100644 --- a/dev/uu_stty/index.html +++ b/dev/uu_stty/index.html @@ -1,3 +1 @@ -uu_stty - Rust

Structs

Functions

Get terminal window size

-

Set terminal window size

-
\ No newline at end of file +uu_stty - Rust

Structs

Functions

Get terminal window size
Set terminal window size
\ No newline at end of file diff --git a/dev/uu_stty/struct.Flag.html b/dev/uu_stty/struct.Flag.html index f6ec44080..d8c7b89cb 100644 --- a/dev/uu_stty/struct.Flag.html +++ b/dev/uu_stty/struct.Flag.html @@ -1,18 +1,5 @@ -Flag in uu_stty - Rust
pub struct Flag<T> { /* private fields */ }

Implementations

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Flag in uu_stty - Rust
pub struct Flag<T> { /* private fields */ }

Implementations

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_stty/struct.TermSize.html b/dev/uu_stty/struct.TermSize.html index f32925823..f8fe91137 100644 --- a/dev/uu_stty/struct.TermSize.html +++ b/dev/uu_stty/struct.TermSize.html @@ -1,14 +1,5 @@ -TermSize in uu_stty - Rust
#[repr(C)]
pub struct TermSize { /* private fields */ }

Trait Implementations

Formats the value using the given formatter. Read more

-

Returns the “default value” for a type. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+TermSize in uu_stty - Rust
#[repr(C)]
pub struct TermSize { /* private fields */ }

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_sum/all.html b/dev/uu_sum/all.html index 8eb28535e..a702ae00b 100644 --- a/dev/uu_sum/all.html +++ b/dev/uu_sum/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_sum/fn.uu_app.html b/dev/uu_sum/fn.uu_app.html index 347a8f84f..b30d39e0b 100644 --- a/dev/uu_sum/fn.uu_app.html +++ b/dev/uu_sum/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_sum - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_sum - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_sum/fn.uumain.html b/dev/uu_sum/fn.uumain.html index 227bd65e7..56b9bca0c 100644 --- a/dev/uu_sum/fn.uumain.html +++ b/dev/uu_sum/fn.uumain.html @@ -1 +1 @@ -uumain in uu_sum - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_sum - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_sum/index.html b/dev/uu_sum/index.html index d9c54e746..9987ed6ce 100644 --- a/dev/uu_sum/index.html +++ b/dev/uu_sum/index.html @@ -1 +1 @@ -uu_sum - Rust
\ No newline at end of file +uu_sum - Rust
\ No newline at end of file diff --git a/dev/uu_sync/all.html b/dev/uu_sync/all.html index 79575917c..6bf64699a 100644 --- a/dev/uu_sync/all.html +++ b/dev/uu_sync/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

Statics

\ No newline at end of file +List of all items in this crate

List of all items

Functions

Statics

\ No newline at end of file diff --git a/dev/uu_sync/fn.uu_app.html b/dev/uu_sync/fn.uu_app.html index 9782e0608..577af0ac0 100644 --- a/dev/uu_sync/fn.uu_app.html +++ b/dev/uu_sync/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_sync - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_sync - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_sync/fn.uumain.html b/dev/uu_sync/fn.uumain.html index ad689c4f4..1b58484c3 100644 --- a/dev/uu_sync/fn.uumain.html +++ b/dev/uu_sync/fn.uumain.html @@ -1 +1 @@ -uumain in uu_sync - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_sync - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_sync/index.html b/dev/uu_sync/index.html index 0ec1820c7..4c88c1446 100644 --- a/dev/uu_sync/index.html +++ b/dev/uu_sync/index.html @@ -1 +1 @@ -uu_sync - Rust
\ No newline at end of file +uu_sync - Rust
\ No newline at end of file diff --git a/dev/uu_sync/options/index.html b/dev/uu_sync/options/index.html index 06d0def6e..ee9c7db11 100644 --- a/dev/uu_sync/options/index.html +++ b/dev/uu_sync/options/index.html @@ -1 +1 @@ -uu_sync::options - Rust
\ No newline at end of file +uu_sync::options - Rust
\ No newline at end of file diff --git a/dev/uu_sync/options/static.DATA.html b/dev/uu_sync/options/static.DATA.html index 6c40b80af..fc02b31d2 100644 --- a/dev/uu_sync/options/static.DATA.html +++ b/dev/uu_sync/options/static.DATA.html @@ -1 +1 @@ -DATA in uu_sync::options - Rust
pub static DATA: &'static str
\ No newline at end of file +DATA in uu_sync::options - Rust
pub static DATA: &'static str
\ No newline at end of file diff --git a/dev/uu_sync/options/static.FILE_SYSTEM.html b/dev/uu_sync/options/static.FILE_SYSTEM.html index ede62a2b8..e1dd60bf7 100644 --- a/dev/uu_sync/options/static.FILE_SYSTEM.html +++ b/dev/uu_sync/options/static.FILE_SYSTEM.html @@ -1 +1 @@ -FILE_SYSTEM in uu_sync::options - Rust
pub static FILE_SYSTEM: &'static str
\ No newline at end of file +FILE_SYSTEM in uu_sync::options - Rust
pub static FILE_SYSTEM: &'static str
\ No newline at end of file diff --git a/dev/uu_tac/all.html b/dev/uu_tac/all.html index f2674fa74..6b5cea985 100644 --- a/dev/uu_tac/all.html +++ b/dev/uu_tac/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_tac/fn.uu_app.html b/dev/uu_tac/fn.uu_app.html index ee86ef85e..bf930e27b 100644 --- a/dev/uu_tac/fn.uu_app.html +++ b/dev/uu_tac/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_tac - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_tac - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_tac/fn.uumain.html b/dev/uu_tac/fn.uumain.html index 1ad63bb29..d8f796c7f 100644 --- a/dev/uu_tac/fn.uumain.html +++ b/dev/uu_tac/fn.uumain.html @@ -1 +1 @@ -uumain in uu_tac - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_tac - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_tac/index.html b/dev/uu_tac/index.html index 776161c92..4ca0dc721 100644 --- a/dev/uu_tac/index.html +++ b/dev/uu_tac/index.html @@ -1 +1 @@ -uu_tac - Rust
\ No newline at end of file +uu_tac - Rust
\ No newline at end of file diff --git a/dev/uu_tail/all.html b/dev/uu_tail/all.html index 9c8e6356d..264d3840c 100644 --- a/dev/uu_tail/all.html +++ b/dev/uu_tail/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_tail/args/enum.FilterMode.html b/dev/uu_tail/args/enum.FilterMode.html index cc555ab68..049c515d2 100644 --- a/dev/uu_tail/args/enum.FilterMode.html +++ b/dev/uu_tail/args/enum.FilterMode.html @@ -1,21 +1,11 @@ -FilterMode in uu_tail::args - Rust
pub enum FilterMode {
+FilterMode in uu_tail::args - Rust
pub enum FilterMode {
     Bytes(Signum),
-    Lines(Signumu8),
-}

Variants

Bytes(Signum)

Lines(Signumu8)

Mode for lines delimited by delimiter as u8

-

Trait Implementations

Formats the value using the given formatter. Read more

-

Returns the “default value” for a type. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+ Lines(Signumu8), +}

Variants

Bytes(Signum)

Lines(Signumu8)

Mode for lines delimited by delimiter as u8

+

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_tail/args/enum.FollowMode.html b/dev/uu_tail/args/enum.FollowMode.html index 59d4c0fae..9bab13277 100644 --- a/dev/uu_tail/args/enum.FollowMode.html +++ b/dev/uu_tail/args/enum.FollowMode.html @@ -1,24 +1,10 @@ -FollowMode in uu_tail::args - Rust
pub enum FollowMode {
+FollowMode in uu_tail::args - Rust
pub enum FollowMode {
     Descriptor,
     Name,
-}

Variants

Descriptor

Name

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Descriptor

Name

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_tail/args/enum.Signum.html b/dev/uu_tail/args/enum.Signum.html index 7e5f1e68f..0bd3e3769 100644 --- a/dev/uu_tail/args/enum.Signum.html +++ b/dev/uu_tail/args/enum.Signum.html @@ -1,26 +1,12 @@ -Signum in uu_tail::args - Rust
pub enum Signum {
-    Negative(u64),
-    Positive(u64),
+Signum in uu_tail::args - Rust
pub enum Signum {
+    Negative(u64),
+    Positive(u64),
     PlusZero,
     MinusZero,
-}

Variants

Negative(u64)

Positive(u64)

PlusZero

MinusZero

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Negative(u64)

Positive(u64)

PlusZero

MinusZero

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_tail/args/fn.arg_iterate.html b/dev/uu_tail/args/fn.arg_iterate.html index 07c58aa12..b6a60522d 100644 --- a/dev/uu_tail/args/fn.arg_iterate.html +++ b/dev/uu_tail/args/fn.arg_iterate.html @@ -1 +1 @@ -arg_iterate in uu_tail::args - Rust
pub fn arg_iterate<'a>(
    args: impl Args + 'a
) -> UResult<Box<dyn Iterator<Item = OsString> + 'a>>
\ No newline at end of file +arg_iterate in uu_tail::args - Rust
pub fn arg_iterate<'a>(
    args: impl Args + 'a
) -> UResult<Box<dyn Iterator<Item = OsString> + 'a>>
\ No newline at end of file diff --git a/dev/uu_tail/args/fn.parse_args.html b/dev/uu_tail/args/fn.parse_args.html index 65576dc18..b55f9467f 100644 --- a/dev/uu_tail/args/fn.parse_args.html +++ b/dev/uu_tail/args/fn.parse_args.html @@ -1 +1 @@ -parse_args in uu_tail::args - Rust
pub fn parse_args(args: impl Args) -> UResult<Settings>
\ No newline at end of file +parse_args in uu_tail::args - Rust
pub fn parse_args(args: impl Args) -> UResult<Settings>
\ No newline at end of file diff --git a/dev/uu_tail/args/fn.stdin_is_pipe_or_fifo.html b/dev/uu_tail/args/fn.stdin_is_pipe_or_fifo.html index 0abe0086b..757083a11 100644 --- a/dev/uu_tail/args/fn.stdin_is_pipe_or_fifo.html +++ b/dev/uu_tail/args/fn.stdin_is_pipe_or_fifo.html @@ -1 +1 @@ -stdin_is_pipe_or_fifo in uu_tail::args - Rust
pub fn stdin_is_pipe_or_fifo() -> bool
\ No newline at end of file +stdin_is_pipe_or_fifo in uu_tail::args - Rust
pub fn stdin_is_pipe_or_fifo() -> bool
\ No newline at end of file diff --git a/dev/uu_tail/args/fn.uu_app.html b/dev/uu_tail/args/fn.uu_app.html index c78d60cd0..3b8142248 100644 --- a/dev/uu_tail/args/fn.uu_app.html +++ b/dev/uu_tail/args/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_tail::args - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_tail::args - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_tail/args/index.html b/dev/uu_tail/args/index.html index 8009b0d3c..e58ff3643 100644 --- a/dev/uu_tail/args/index.html +++ b/dev/uu_tail/args/index.html @@ -1 +1 @@ -uu_tail::args - Rust
\ No newline at end of file +uu_tail::args - Rust
\ No newline at end of file diff --git a/dev/uu_tail/args/options/index.html b/dev/uu_tail/args/options/index.html index c010d9c92..9974b6738 100644 --- a/dev/uu_tail/args/options/index.html +++ b/dev/uu_tail/args/options/index.html @@ -1 +1 @@ -uu_tail::args::options - Rust
\ No newline at end of file +uu_tail::args::options - Rust
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.ARG_FILES.html b/dev/uu_tail/args/options/static.ARG_FILES.html index 6a56d9529..cd1f0086b 100644 --- a/dev/uu_tail/args/options/static.ARG_FILES.html +++ b/dev/uu_tail/args/options/static.ARG_FILES.html @@ -1 +1 @@ -ARG_FILES in uu_tail::args::options - Rust
pub static ARG_FILES: &'static str
\ No newline at end of file +ARG_FILES in uu_tail::args::options - Rust
pub static ARG_FILES: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.BYTES.html b/dev/uu_tail/args/options/static.BYTES.html index f2eb870a2..76a0ad368 100644 --- a/dev/uu_tail/args/options/static.BYTES.html +++ b/dev/uu_tail/args/options/static.BYTES.html @@ -1 +1 @@ -BYTES in uu_tail::args::options - Rust
pub static BYTES: &'static str
\ No newline at end of file +BYTES in uu_tail::args::options - Rust
pub static BYTES: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.DISABLE_INOTIFY_TERM.html b/dev/uu_tail/args/options/static.DISABLE_INOTIFY_TERM.html index 984c2fc0e..5d496a6b9 100644 --- a/dev/uu_tail/args/options/static.DISABLE_INOTIFY_TERM.html +++ b/dev/uu_tail/args/options/static.DISABLE_INOTIFY_TERM.html @@ -1 +1 @@ -DISABLE_INOTIFY_TERM in uu_tail::args::options - Rust
pub static DISABLE_INOTIFY_TERM: &'static str
\ No newline at end of file +DISABLE_INOTIFY_TERM in uu_tail::args::options - Rust
pub static DISABLE_INOTIFY_TERM: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.FOLLOW.html b/dev/uu_tail/args/options/static.FOLLOW.html index 0748dc4ce..8f23b9078 100644 --- a/dev/uu_tail/args/options/static.FOLLOW.html +++ b/dev/uu_tail/args/options/static.FOLLOW.html @@ -1 +1 @@ -FOLLOW in uu_tail::args::options - Rust
pub static FOLLOW: &'static str
\ No newline at end of file +FOLLOW in uu_tail::args::options - Rust
pub static FOLLOW: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.FOLLOW_RETRY.html b/dev/uu_tail/args/options/static.FOLLOW_RETRY.html index 2eb1e0e3c..a66747575 100644 --- a/dev/uu_tail/args/options/static.FOLLOW_RETRY.html +++ b/dev/uu_tail/args/options/static.FOLLOW_RETRY.html @@ -1 +1 @@ -FOLLOW_RETRY in uu_tail::args::options - Rust
pub static FOLLOW_RETRY: &'static str
\ No newline at end of file +FOLLOW_RETRY in uu_tail::args::options - Rust
pub static FOLLOW_RETRY: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.LINES.html b/dev/uu_tail/args/options/static.LINES.html index 5ed32e81e..2449c6695 100644 --- a/dev/uu_tail/args/options/static.LINES.html +++ b/dev/uu_tail/args/options/static.LINES.html @@ -1 +1 @@ -LINES in uu_tail::args::options - Rust
pub static LINES: &'static str
\ No newline at end of file +LINES in uu_tail::args::options - Rust
pub static LINES: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.MAX_UNCHANGED_STATS.html b/dev/uu_tail/args/options/static.MAX_UNCHANGED_STATS.html index e4a52b6e8..6f5e0a3fe 100644 --- a/dev/uu_tail/args/options/static.MAX_UNCHANGED_STATS.html +++ b/dev/uu_tail/args/options/static.MAX_UNCHANGED_STATS.html @@ -1 +1 @@ -MAX_UNCHANGED_STATS in uu_tail::args::options - Rust
pub static MAX_UNCHANGED_STATS: &'static str
\ No newline at end of file +MAX_UNCHANGED_STATS in uu_tail::args::options - Rust
pub static MAX_UNCHANGED_STATS: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.PID.html b/dev/uu_tail/args/options/static.PID.html index 737f8a78e..6bcb3a9cc 100644 --- a/dev/uu_tail/args/options/static.PID.html +++ b/dev/uu_tail/args/options/static.PID.html @@ -1 +1 @@ -PID in uu_tail::args::options - Rust
pub static PID: &'static str
\ No newline at end of file +PID in uu_tail::args::options - Rust
pub static PID: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.PRESUME_INPUT_PIPE.html b/dev/uu_tail/args/options/static.PRESUME_INPUT_PIPE.html index 883fc0853..04cb51fde 100644 --- a/dev/uu_tail/args/options/static.PRESUME_INPUT_PIPE.html +++ b/dev/uu_tail/args/options/static.PRESUME_INPUT_PIPE.html @@ -1 +1 @@ -PRESUME_INPUT_PIPE in uu_tail::args::options - Rust
pub static PRESUME_INPUT_PIPE: &'static str
\ No newline at end of file +PRESUME_INPUT_PIPE in uu_tail::args::options - Rust
pub static PRESUME_INPUT_PIPE: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.RETRY.html b/dev/uu_tail/args/options/static.RETRY.html index 46ffaa02b..6d917196f 100644 --- a/dev/uu_tail/args/options/static.RETRY.html +++ b/dev/uu_tail/args/options/static.RETRY.html @@ -1 +1 @@ -RETRY in uu_tail::args::options - Rust
pub static RETRY: &'static str
\ No newline at end of file +RETRY in uu_tail::args::options - Rust
pub static RETRY: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.SLEEP_INT.html b/dev/uu_tail/args/options/static.SLEEP_INT.html index d65e5a69e..6be15d789 100644 --- a/dev/uu_tail/args/options/static.SLEEP_INT.html +++ b/dev/uu_tail/args/options/static.SLEEP_INT.html @@ -1 +1 @@ -SLEEP_INT in uu_tail::args::options - Rust
pub static SLEEP_INT: &'static str
\ No newline at end of file +SLEEP_INT in uu_tail::args::options - Rust
pub static SLEEP_INT: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.USE_POLLING.html b/dev/uu_tail/args/options/static.USE_POLLING.html index 9e33534e3..b98b6d16f 100644 --- a/dev/uu_tail/args/options/static.USE_POLLING.html +++ b/dev/uu_tail/args/options/static.USE_POLLING.html @@ -1 +1 @@ -USE_POLLING in uu_tail::args::options - Rust
pub static USE_POLLING: &'static str
\ No newline at end of file +USE_POLLING in uu_tail::args::options - Rust
pub static USE_POLLING: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/static.ZERO_TERM.html b/dev/uu_tail/args/options/static.ZERO_TERM.html index 4ad435439..d46532227 100644 --- a/dev/uu_tail/args/options/static.ZERO_TERM.html +++ b/dev/uu_tail/args/options/static.ZERO_TERM.html @@ -1 +1 @@ -ZERO_TERM in uu_tail::args::options - Rust
pub static ZERO_TERM: &'static str
\ No newline at end of file +ZERO_TERM in uu_tail::args::options - Rust
pub static ZERO_TERM: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/verbosity/index.html b/dev/uu_tail/args/options/verbosity/index.html index 2b0cd9aea..a4ed50dfa 100644 --- a/dev/uu_tail/args/options/verbosity/index.html +++ b/dev/uu_tail/args/options/verbosity/index.html @@ -1 +1 @@ -uu_tail::args::options::verbosity - Rust
\ No newline at end of file +uu_tail::args::options::verbosity - Rust
\ No newline at end of file diff --git a/dev/uu_tail/args/options/verbosity/static.QUIET.html b/dev/uu_tail/args/options/verbosity/static.QUIET.html index a41eacafa..2e7bd2cb0 100644 --- a/dev/uu_tail/args/options/verbosity/static.QUIET.html +++ b/dev/uu_tail/args/options/verbosity/static.QUIET.html @@ -1 +1 @@ -QUIET in uu_tail::args::options::verbosity - Rust
pub static QUIET: &'static str
\ No newline at end of file +QUIET in uu_tail::args::options::verbosity - Rust
pub static QUIET: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/options/verbosity/static.VERBOSE.html b/dev/uu_tail/args/options/verbosity/static.VERBOSE.html index d02def095..6eff2c3fc 100644 --- a/dev/uu_tail/args/options/verbosity/static.VERBOSE.html +++ b/dev/uu_tail/args/options/verbosity/static.VERBOSE.html @@ -1 +1 @@ -VERBOSE in uu_tail::args::options::verbosity - Rust
pub static VERBOSE: &'static str
\ No newline at end of file +VERBOSE in uu_tail::args::options::verbosity - Rust
pub static VERBOSE: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/args/struct.Settings.html b/dev/uu_tail/args/struct.Settings.html index da41737e1..95ff81e89 100644 --- a/dev/uu_tail/args/struct.Settings.html +++ b/dev/uu_tail/args/struct.Settings.html @@ -1,25 +1,16 @@ -Settings in uu_tail::args - Rust
pub struct Settings {
-    pub follow: Option<FollowMode>,
-    pub max_unchanged_stats: u32,
+Settings in uu_tail::args - Rust
pub struct Settings {
+    pub follow: Option<FollowMode>,
+    pub max_unchanged_stats: u32,
     pub mode: FilterMode,
     pub pid: pid_t,
-    pub retry: bool,
-    pub sleep_sec: Duration,
-    pub use_polling: bool,
-    pub verbose: bool,
-    pub presume_input_pipe: bool,
-    pub inputs: VecDeque<Input>,
-}

Fields

follow: Option<FollowMode>max_unchanged_stats: u32mode: FilterModepid: pid_tretry: boolsleep_sec: Durationuse_polling: boolverbose: boolpresume_input_pipe: boolinputs: VecDeque<Input>

Implementations

Trait Implementations

Formats the value using the given formatter. Read more

-

Returns the “default value” for a type. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+ pub retry: bool, + pub sleep_sec: Duration, + pub use_polling: bool, + pub verbose: bool, + pub presume_input_pipe: bool, + pub inputs: VecDeque<Input>, +}

Fields

follow: Option<FollowMode>max_unchanged_stats: u32mode: FilterModepid: pid_tretry: boolsleep_sec: Durationuse_polling: boolverbose: boolpresume_input_pipe: boolinputs: VecDeque<Input>

Implementations

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_tail/chunks/constant.BLOCK_SIZE.html b/dev/uu_tail/chunks/constant.BLOCK_SIZE.html index a0aa8c3b7..80d58d453 100644 --- a/dev/uu_tail/chunks/constant.BLOCK_SIZE.html +++ b/dev/uu_tail/chunks/constant.BLOCK_SIZE.html @@ -1,3 +1,3 @@ -BLOCK_SIZE in uu_tail::chunks - Rust
pub const BLOCK_SIZE: u64 = _; // 65_536u64
Expand description

When reading files in reverse in bounded_tail, this is the size of each +BLOCK_SIZE in uu_tail::chunks - Rust

pub const BLOCK_SIZE: u64 = _; // 65_536u64
Expand description

When reading files in reverse in bounded_tail, this is the size of each block read at a time.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uu_tail/chunks/constant.BUFFER_SIZE.html b/dev/uu_tail/chunks/constant.BUFFER_SIZE.html index fb77a79c8..dd616f7b7 100644 --- a/dev/uu_tail/chunks/constant.BUFFER_SIZE.html +++ b/dev/uu_tail/chunks/constant.BUFFER_SIZE.html @@ -1,6 +1,6 @@ -BUFFER_SIZE in uu_tail::chunks - Rust
pub const BUFFER_SIZE: usize = 8192;
Expand description

The size of the backing buffer of a LinesChunk or BytesChunk in bytes. The value of BUFFER_SIZE +BUFFER_SIZE in uu_tail::chunks - Rust

pub const BUFFER_SIZE: usize = 8192;
Expand description

The size of the backing buffer of a LinesChunk or BytesChunk in bytes. The value of BUFFER_SIZE originates from the BUFSIZ constant in stdio.h and the libc crate to make stream IO efficient. In the latter the value is constantly set to 8192 on all platforms, where the value in stdio.h is determined on each platform differently. Since libc chose 8192 as a reasonable default the value here is set to this value, too.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uu_tail/chunks/index.html b/dev/uu_tail/chunks/index.html index 729fb1400..8f274739b 100644 --- a/dev/uu_tail/chunks/index.html +++ b/dev/uu_tail/chunks/index.html @@ -1,20 +1,13 @@ -uu_tail::chunks - Rust
Expand description

Iterating over a file by chunks, either starting at the end of the file with ReverseChunks +uu_tail::chunks - Rust

Expand description

Iterating over a file by chunks, either starting at the end of the file with ReverseChunks or at the end of piped stdin with LinesChunk or BytesChunk.

Use ReverseChunks::new to create a new iterator over chunks of bytes from the file.

-

Structs

A BytesChunk storing a fixed size number of bytes in a buffer.

-

An abstraction layer on top of BytesChunk mainly to simplify filling only the needed amount -of chunks. See also Self::fill.

-

Works similar to a BytesChunk but also stores the number of lines encountered in the current -buffer. The size of the buffer is limited to a fixed size number of bytes.

-

An abstraction layer on top of LinesChunk mainly to simplify filling only the needed amount +

Structs

A BytesChunk storing a fixed size number of bytes in a buffer.
An abstraction layer on top of BytesChunk mainly to simplify filling only the needed amount +of chunks. See also Self::fill.
Works similar to a BytesChunk but also stores the number of lines encountered in the current +buffer. The size of the buffer is limited to a fixed size number of bytes.
An abstraction layer on top of LinesChunk mainly to simplify filling only the needed amount of chunks. See also Self::fill. Works similar like BytesChunkBuffer, but works on top -of lines delimited by self.delimiter instead of bytes.

-

An iterator over a file in non-overlapping chunks from the end of the file.

-

Constants

When reading files in reverse in bounded_tail, this is the size of each -block read at a time.

-

The size of the backing buffer of a LinesChunk or BytesChunk in bytes. The value of BUFFER_SIZE +of lines delimited by self.delimiter instead of bytes.

An iterator over a file in non-overlapping chunks from the end of the file.

Constants

When reading files in reverse in bounded_tail, this is the size of each +block read at a time.
The size of the backing buffer of a LinesChunk or BytesChunk in bytes. The value of BUFFER_SIZE originates from the BUFSIZ constant in stdio.h and the libc crate to make stream IO efficient. In the latter the value is constantly set to 8192 on all platforms, where the value in stdio.h is determined on each platform differently. Since libc chose 8192 as a reasonable default the -value here is set to this value, too.

-
\ No newline at end of file +value here is set to this value, too.
\ No newline at end of file diff --git a/dev/uu_tail/chunks/struct.BytesChunk.html b/dev/uu_tail/chunks/struct.BytesChunk.html index 6f5d478fa..7b430038c 100644 --- a/dev/uu_tail/chunks/struct.BytesChunk.html +++ b/dev/uu_tail/chunks/struct.BytesChunk.html @@ -1,39 +1,25 @@ -BytesChunk in uu_tail::chunks - Rust
pub struct BytesChunk { /* private fields */ }
Expand description

A BytesChunk storing a fixed size number of bytes in a buffer.

-

Implementations

Receive the internal buffer safely, so it returns a slice only containing as many bytes as +BytesChunk in uu_tail::chunks - Rust

pub struct BytesChunk { /* private fields */ }
Expand description

A BytesChunk storing a fixed size number of bytes in a buffer.

+

Implementations

Receive the internal buffer safely, so it returns a slice only containing as many bytes as large the self.bytes value is.

returns: a slice containing the bytes of the internal buffer from [0..self.bytes]

Examples
-
let mut chunk = BytesChunk::new();
-chunk.bytes = 1;
-assert_eq!(&[0], chunk.get_buffer());
-

Like BytesChunk::get_buffer, but returning a slice from [offset.self.bytes].

+
let mut chunk = BytesChunk::new();
+chunk.bytes = 1;
+assert_eq!(&[0], chunk.get_buffer());
+

Like BytesChunk::get_buffer, but returning a slice from [offset.self.bytes].

returns: a slice containing the bytes of the internal buffer from [offset..self.bytes]

Examples
-
let mut chunk = BytesChunk::new();
-chunk.bytes = 2;
-assert_eq!(&[0], chunk.get_buffer_with(1));
-

Fills self.buffer with maximal BUFFER_SIZE number of bytes, draining the reader by +

let mut chunk = BytesChunk::new();
+chunk.bytes = 2;
+assert_eq!(&[0], chunk.get_buffer_with(1));
+

Fills self.buffer with maximal BUFFER_SIZE number of bytes, draining the reader by that number of bytes. If EOF is reached (so 0 bytes are read), then returns -UResult<None> or else the result with [Some(bytes)] where bytes is the number of bytes +[UResult<None>] or else the result with [Some(bytes)] where bytes is the number of bytes read from the source.

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_tail/chunks/struct.BytesChunkBuffer.html b/dev/uu_tail/chunks/struct.BytesChunkBuffer.html index 1558c1f53..1378da4a8 100644 --- a/dev/uu_tail/chunks/struct.BytesChunkBuffer.html +++ b/dev/uu_tail/chunks/struct.BytesChunkBuffer.html @@ -1,48 +1,41 @@ -BytesChunkBuffer in uu_tail::chunks - Rust
pub struct BytesChunkBuffer { /* private fields */ }
Expand description

An abstraction layer on top of BytesChunk mainly to simplify filling only the needed amount +BytesChunkBuffer in uu_tail::chunks - Rust

pub struct BytesChunkBuffer { /* private fields */ }
Expand description

An abstraction layer on top of BytesChunk mainly to simplify filling only the needed amount of chunks. See also Self::fill.

-

Implementations

Creates a new BytesChunkBuffer.

+

Implementations

Creates a new BytesChunkBuffer.

Arguments
  • num_print: The number of bytes to print
Examples
-
let mut chunk = BytesChunk::new();
-chunk.buffer[1] = 1;
-chunk.bytes = 2;
-let new_chunk = BytesChunk::from_chunk(&chunk, 0);
-assert_eq!(2, new_chunk.get_buffer().len());
-assert_eq!(&[0, 1], new_chunk.get_buffer());
+
let mut chunk = BytesChunk::new();
+chunk.buffer[1] = 1;
+chunk.bytes = 2;
+let new_chunk = BytesChunk::from_chunk(&chunk, 0);
+assert_eq!(2, new_chunk.get_buffer().len());
+assert_eq!(&[0, 1], new_chunk.get_buffer());
 
-let new_chunk = BytesChunk::from_chunk(&chunk, 1);
-assert_eq!(1, new_chunk.get_buffer().len());
-assert_eq!(&[1], new_chunk.get_buffer());
-

Fills this buffer with chunks and consumes the reader completely. This method ensures that +let new_chunk = BytesChunk::from_chunk(&chunk, 1); +assert_eq!(1, new_chunk.get_buffer().len()); +assert_eq!(&[1], new_chunk.get_buffer());

+

Fills this buffer with chunks and consumes the reader completely. This method ensures that there are exactly as many chunks as needed to match self.num_print bytes, so there are in sum exactly self.num_print bytes stored in all chunks. The method returns an iterator over these chunks. If there are no chunks, for example because the piped stdin contained no bytes, or num_print = 0 then iterator.next returns None.

Examples
-
use crate::chunks::BytesChunkBuffer;
-use std::io::{BufReader, Cursor};
+
use crate::chunks::BytesChunkBuffer;
+use std::io::{BufReader, Cursor};
 
-let mut reader = BufReader::new(Cursor::new(""));
-let num_print = 0;
-let mut chunks = BytesChunkBuffer::new(num_print);
-chunks.fill(&mut reader).unwrap();
+let mut reader = BufReader::new(Cursor::new(""));
+let num_print = 0;
+let mut chunks = BytesChunkBuffer::new(num_print);
+chunks.fill(&mut reader).unwrap();
 
-let mut reader = BufReader::new(Cursor::new("a"));
-let num_print = 1;
-let mut chunks = BytesChunkBuffer::new(num_print);
-chunks.fill(&mut reader).unwrap();
-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+let mut reader = BufReader::new(Cursor::new("a")); +let num_print = 1; +let mut chunks = BytesChunkBuffer::new(num_print); +chunks.fill(&mut reader).unwrap();
+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_tail/chunks/struct.LinesChunk.html b/dev/uu_tail/chunks/struct.LinesChunk.html index 6b0e8cb6f..2e9903ace 100644 --- a/dev/uu_tail/chunks/struct.LinesChunk.html +++ b/dev/uu_tail/chunks/struct.LinesChunk.html @@ -1,49 +1,41 @@ -LinesChunk in uu_tail::chunks - Rust
pub struct LinesChunk { /* private fields */ }
Expand description

Works similar to a BytesChunk but also stores the number of lines encountered in the current +LinesChunk in uu_tail::chunks - Rust

pub struct LinesChunk { /* private fields */ }
Expand description

Works similar to a BytesChunk but also stores the number of lines encountered in the current buffer. The size of the buffer is limited to a fixed size number of bytes.

-

Implementations

Returns true if this buffer has stored any bytes.

+

Implementations

Returns true if this buffer has stored any bytes.

Examples
-
let mut chunk = LinesChunk::new(b'\n');
-assert!(!chunk.has_data());
+
let mut chunk = LinesChunk::new(b'\n');
+assert!(!chunk.has_data());
 
-chunk.buffer[0] = 1;
-assert!(!chunk.has_data());
+chunk.buffer[0] = 1;
+assert!(!chunk.has_data());
 
-chunk.bytes = 1;
-assert!(chunk.has_data());
-

Returns this buffer safely. See BytesChunk::get_buffer

-

returns: &u8 with length self.bytes

-

Returns this buffer safely with an offset applied. See BytesChunk::get_buffer_with.

-

returns: &u8 with length self.bytes - offset

-

Return the number of lines the buffer contains. self.lines needs to be set before the call +chunk.bytes = 1; +assert!(chunk.has_data());

+

Returns this buffer safely. See BytesChunk::get_buffer

+

returns: &u8 with length self.bytes

+

Returns this buffer safely with an offset applied. See BytesChunk::get_buffer_with.

+

returns: &u8 with length self.bytes - offset

+

Return the number of lines the buffer contains. self.lines needs to be set before the call to this function returns the correct value. If the calculation of lines is needed then use self.count_lines.

-

Fills self.buffer with maximal BUFFER_SIZE number of bytes, draining the reader by +

Fills self.buffer with maximal BUFFER_SIZE number of bytes, draining the reader by that number of bytes. This function works like the BytesChunk::fill function besides that this function also counts and stores the number of lines encountered while reading from the filehandle.

-

Print the bytes contained in this buffer calculated with the given offset in number of +

Print the bytes contained in this buffer calculated with the given offset in number of lines.

Arguments
    -
  • writer: must implement Write
  • +
  • writer: must implement Write
  • offset: An offset in number of lines.
-

Print the bytes contained in this buffer beginning from the given offset in number of bytes.

+

Print the bytes contained in this buffer beginning from the given offset in number of bytes.

Arguments
    -
  • writer: must implement Write
  • +
  • writer: must implement Write
  • offset: An offset in number of bytes.
-

Trait Implementations

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_tail/chunks/struct.LinesChunkBuffer.html b/dev/uu_tail/chunks/struct.LinesChunkBuffer.html index 00b601ef2..12dc08c2c 100644 --- a/dev/uu_tail/chunks/struct.LinesChunkBuffer.html +++ b/dev/uu_tail/chunks/struct.LinesChunkBuffer.html @@ -1,21 +1,14 @@ -LinesChunkBuffer in uu_tail::chunks - Rust
pub struct LinesChunkBuffer { /* private fields */ }
Expand description

An abstraction layer on top of LinesChunk mainly to simplify filling only the needed amount +LinesChunkBuffer in uu_tail::chunks - Rust

pub struct LinesChunkBuffer { /* private fields */ }
Expand description

An abstraction layer on top of LinesChunk mainly to simplify filling only the needed amount of chunks. See also Self::fill. Works similar like BytesChunkBuffer, but works on top of lines delimited by self.delimiter instead of bytes.

-

Implementations

Create a new LinesChunkBuffer

-

Fills this buffer with chunks and consumes the reader completely. This method ensures that +

Implementations

Create a new LinesChunkBuffer

+

Fills this buffer with chunks and consumes the reader completely. This method ensures that there are exactly as many chunks as needed to match self.num_print lines, so there are in sum exactly self.num_print lines stored in all chunks. The method returns an iterator over these chunks. If there are no chunks, for example because the piped stdin contained no lines, or num_print = 0 then iterator.next will return None.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_tail/chunks/struct.ReverseChunks.html b/dev/uu_tail/chunks/struct.ReverseChunks.html index 571f2b8b1..7c81121ad 100644 --- a/dev/uu_tail/chunks/struct.ReverseChunks.html +++ b/dev/uu_tail/chunks/struct.ReverseChunks.html @@ -1,343 +1,140 @@ -ReverseChunks in uu_tail::chunks - Rust
pub struct ReverseChunks<'a> { /* private fields */ }
Expand description

An iterator over a file in non-overlapping chunks from the end of the file.

-

Each chunk is a Vec<u8> of size BLOCK_SIZE (except +ReverseChunks in uu_tail::chunks - Rust

pub struct ReverseChunks<'a> { /* private fields */ }
Expand description

An iterator over a file in non-overlapping chunks from the end of the file.

+

Each chunk is a Vec<u8> of size BLOCK_SIZE (except possibly the last chunk, which might be smaller). Each call to ReverseChunks::next will seek backwards through the given file.

-

Implementations

Trait Implementations

The type of the elements being iterated over.

-

Advances the iterator and returns the next value. Read more

-
🔬 This is a nightly-only experimental API. (iter_next_chunk)

Advances the iterator and returns an array containing the next N values. Read more

-

Returns the bounds on the remaining length of the iterator. Read more

-

Consumes the iterator, counting the number of iterations and returning it. Read more

-

Consumes the iterator, returning the last element. Read more

-
🔬 This is a nightly-only experimental API. (iter_advance_by)

Advances the iterator by n elements. Read more

-

Returns the nth element of the iterator. Read more

-

Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more

-

Takes two iterators and creates a new iterator over both in sequence. Read more

-

‘Zips up’ two iterators into a single iterator of pairs. Read more

-
🔬 This is a nightly-only experimental API. (iter_intersperse)

Creates a new iterator which places a copy of separator between adjacent -items of the original iterator. Read more

-
🔬 This is a nightly-only experimental API. (iter_intersperse)

Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more

-

Takes a closure and creates an iterator which calls that closure on each -element. Read more

-

Calls a closure on each element of an iterator. Read more

-

Creates an iterator which uses a closure to determine if an element -should be yielded. Read more

-

Creates an iterator that both filters and maps. Read more

-

Creates an iterator which gives the current iteration count as well as -the next value. Read more

-

Creates an iterator which can use the peek and peek_mut methods +

Implementations

Trait Implementations

The type of the elements being iterated over.
Advances the iterator and returns the next value. Read more
🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
Returns the bounds on the remaining length of the iterator. Read more
Consumes the iterator, counting the number of iterations and returning it. Read more
Consumes the iterator, returning the last element. Read more
🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
Returns the nth element of the iterator. Read more
Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
Takes two iterators and creates a new iterator over both in sequence. Read more
‘Zips up’ two iterators into a single iterator of pairs. Read more
🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
Takes a closure and creates an iterator which calls that closure on each +element. Read more
Calls a closure on each element of an iterator. Read more
Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
Creates an iterator that both filters and maps. Read more
Creates an iterator which gives the current iteration count as well as +the next value. Read more
Creates an iterator which can use the peek and peek_mut methods to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more

-

Creates an iterator that skips elements based on a predicate. Read more

-

Creates an iterator that yields elements based on a predicate. Read more

-

Creates an iterator that both yields elements based on a predicate and maps. Read more

-

Creates an iterator that skips the first n elements. Read more

-

Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more

-

An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more

-

Creates an iterator that works like map, but flattens nested structure. Read more

-

Creates an iterator that flattens nested structure. Read more

-

Creates an iterator which ends after the first None. Read more

-

Does something with each element of an iterator, passing the value on. Read more

-

Borrows an iterator, rather than consuming it. Read more

-

Transforms an iterator into a collection. Read more

-
🔬 This is a nightly-only experimental API. (iterator_try_collect)

Fallibly transforms an iterator into a collection, short circuiting if -a failure is encountered. Read more

-
🔬 This is a nightly-only experimental API. (iter_collect_into)

Collects all the items from an iterator into a collection. Read more

-

Consumes an iterator, creating two collections from it. Read more

-
🔬 This is a nightly-only experimental API. (iter_partition_in_place)

Reorders the elements of this iterator in-place according to the given predicate, -such that all those that return true precede all those that return false. -Returns the number of true elements found. Read more

-
🔬 This is a nightly-only experimental API. (iter_is_partitioned)

Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more

-

An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more

-

An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more

-

Folds every element into an accumulator by applying an operation, -returning the final result. Read more

-

Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more

-
🔬 This is a nightly-only experimental API. (iterator_try_reduce)

Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more

-

Tests if every element of the iterator matches a predicate. Read more

-

Tests if any element of the iterator matches a predicate. Read more

-

Searches for an element of an iterator that satisfies a predicate. Read more

-

Applies function to the elements of iterator and returns -the first non-none result. Read more

-
🔬 This is a nightly-only experimental API. (try_find)

Applies function to the elements of iterator and returns -the first true result or the first error. Read more

-

Searches for an element in an iterator, returning its index. Read more

-

Searches for an element in an iterator from the right, returning its -index. Read more

-

Returns the maximum element of an iterator. Read more

-

Returns the minimum element of an iterator. Read more

-

Returns the element that gives the maximum value from the -specified function. Read more

-

Returns the element that gives the maximum value with respect to the -specified comparison function. Read more

-

Returns the element that gives the minimum value from the -specified function. Read more

-

Returns the element that gives the minimum value with respect to the -specified comparison function. Read more

-

Reverses an iterator’s direction. Read more

-

Converts an iterator of pairs into a pair of containers. Read more

-

Creates an iterator which copies all of its elements. Read more

-

Creates an iterator which clones all of its elements. Read more

-

Repeats an iterator endlessly. Read more

-

Sums the elements of an iterator. Read more

-

Iterates over the entire iterator, multiplying all the elements Read more

-

Lexicographically compares the elements of this Iterator with those -of another. Read more

-
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

-

Lexicographically compares the elements of this Iterator with those -of another. Read more

-
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

-

Determines if the elements of this Iterator are equal to those of -another. Read more

-
🔬 This is a nightly-only experimental API. (iter_order_by)

Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more

-

Determines if the elements of this Iterator are unequal to those of -another. Read more

-

Determines if the elements of this Iterator are lexicographically -less than those of another. Read more

-

Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more

-

Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more

-

Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more

-
🔬 This is a nightly-only experimental API. (is_sorted)

Checks if the elements of this iterator are sorted. Read more

-
🔬 This is a nightly-only experimental API. (is_sorted)

Checks if the elements of this iterator are sorted using the given comparator function. Read more

-
🔬 This is a nightly-only experimental API. (is_sorted)

Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+their documentation for more information. Read more
Creates an iterator that skips elements based on a predicate. Read more
Creates an iterator that yields elements based on a predicate. Read more
Creates an iterator that both yields elements based on a predicate and maps. Read more
Creates an iterator that skips the first n elements. Read more
Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
An iterator adapter similar to fold that holds internal state and +produces a new iterator. Read more
Creates an iterator that works like map, but flattens nested structure. Read more
Creates an iterator which ends after the first None. Read more
Does something with each element of an iterator, passing the value on. Read more
Borrows an iterator, rather than consuming it. Read more
Transforms an iterator into a collection. Read more
🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
Consumes an iterator, creating two collections from it. Read more
🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
Folds every element into an accumulator by applying an operation, +returning the final result. Read more
Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
Tests if every element of the iterator matches a predicate. Read more
Tests if any element of the iterator matches a predicate. Read more
Searches for an element of an iterator that satisfies a predicate. Read more
Applies function to the elements of iterator and returns +the first non-none result. Read more
🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
Searches for an element in an iterator, returning its index. Read more
Returns the element that gives the maximum value from the +specified function. Read more
Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
Returns the element that gives the minimum value from the +specified function. Read more
Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
Converts an iterator of pairs into a pair of containers. Read more
Creates an iterator which copies all of its elements. Read more
Creates an iterator which clones all of its elements. Read more
🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
Sums the elements of an iterator. Read more
Iterates over the entire iterator, multiplying all the elements Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
Lexicographically compares the elements of this Iterator with those +of another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
Determines if the elements of this Iterator are equal to those of +another. Read more
🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
Determines if the elements of this Iterator are unequal to those of +another. Read more
Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type of the elements being iterated over.

-

Which kind of iterator are we turning this into?

-

Creates an iterator from a value. Read more

-

Alternate elements from two iterators until both have run out. Read more

-

Alternate elements from two iterators until at least one of them has run -out. Read more

-

An iterator adaptor to insert a particular value -between each element of the adapted iterator. Read more

-

An iterator adaptor to insert a particular value created by a function -between each element of the adapted iterator. Read more

-

Create an iterator which iterates over both this and the specified -iterator simultaneously, yielding pairs of two optional elements. Read more

-

Create an iterator which iterates over both this and the specified -iterator simultaneously, yielding pairs of elements. Read more

-

A “meta iterator adaptor”. Its closure receives a reference to the +From<T> for U chooses to do.

+
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
Alternate elements from two iterators until both have run out. Read more
Alternate elements from two iterators until at least one of them has run +out. Read more
An iterator adaptor to insert a particular value +between each element of the adapted iterator. Read more
An iterator adaptor to insert a particular value created by a function +between each element of the adapted iterator. Read more
Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of two optional elements. Read more
Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of elements. Read more
A “meta iterator adaptor”. Its closure receives a reference to the iterator and may pick off as many elements as it likes, to produce the -next iterator element. Read more

-

Return an iterable that can group iterator elements. +next iterator element. Read more

Return an iterable that can group iterator elements. Consecutive elements that map to the same key (“runs”), are assigned -to the same group. Read more

-

Return an iterable that can chunk the iterator. Read more

-

Return an iterator over all contiguous windows producing tuples of -a specific size (up to 12). Read more

-

Return an iterator over all windows, wrapping back to the first +to the same group. Read more

Return an iterable that can chunk the iterator. Read more
Return an iterator over all contiguous windows producing tuples of +a specific size (up to 12). Read more
Return an iterator over all windows, wrapping back to the first elements when the window would otherwise exceed the length of the -iterator, producing tuples of a specific size (up to 12). Read more

-

Return an iterator that groups the items in tuples of a specific size -(up to 12). Read more

-

Split into an iterator pair that both yield all elements from -the original iterator. Read more

-
👎 Deprecated since 0.8.0:

Use std .step_by() instead

-

Return an iterator adaptor that steps n elements in the base iterator -for each iteration. Read more

-

Convert each item of the iterator using the Into trait. Read more

-
👎 Deprecated since 0.10.0:

Use .map_ok() instead

-

See .map_ok().

-

Return an iterator adaptor that applies the provided closure +iterator, producing tuples of a specific size (up to 12). Read more

Return an iterator that groups the items in tuples of a specific size +(up to 12). Read more
Split into an iterator pair that both yield all elements from +the original iterator. Read more
👎Deprecated since 0.8.0:

Use std .step_by() instead

+
Return an iterator adaptor that steps n elements in the base iterator +for each iteration. Read more
Convert each item of the iterator using the Into trait. Read more
👎Deprecated since 0.10.0:

Use .map_ok() instead

+
Return an iterator adaptor that applies the provided closure to every Result::Ok value. Result::Err values are -unchanged. Read more

-

Return an iterator adaptor that filters every Result::Ok +unchanged. Read more

Return an iterator adaptor that filters every Result::Ok value with the provided closure. Result::Err values are -unchanged. Read more

-

Return an iterator adaptor that filters and transforms every +unchanged. Read more

Return an iterator adaptor that filters and transforms every Result::Ok value with the provided closure. Result::Err -values are unchanged. Read more

-

Return an iterator adaptor that flattens every Result::Ok value into -a series of Result::Ok values. Result::Err values are unchanged. Read more

-

Return an iterator adaptor that merges the two base iterators in +values are unchanged. Read more

Return an iterator adaptor that flattens every Result::Ok value into +a series of Result::Ok values. Result::Err values are unchanged. Read more
Return an iterator adaptor that merges the two base iterators in ascending order. If both base iterators are sorted (ascending), the -result is sorted. Read more

-

Return an iterator adaptor that merges the two base iterators in order. -This is much like .merge() but allows for a custom ordering. Read more

-

Create an iterator that merges items from both this and the specified -iterator in ascending order. Read more

-

Return an iterator adaptor that flattens an iterator of iterators by -merging them in ascending order. Read more

-

Return an iterator adaptor that flattens an iterator of iterators by -merging them according to the given closure. Read more

-

Return an iterator adaptor that iterates over the cartesian product of -the element sets of two iterators self and J. Read more

-

Return an iterator adaptor that iterates over the cartesian product of -all subiterators returned by meta-iterator self. Read more

-

Return an iterator adaptor that uses the passed-in closure to -optionally merge together consecutive elements. Read more

-

Remove duplicates from sections of consecutive identical elements. -If the iterator is sorted, all elements will be unique. Read more

-

Remove duplicates from sections of consecutive identical elements, +result is sorted. Read more

Return an iterator adaptor that merges the two base iterators in order. +This is much like .merge() but allows for a custom ordering. Read more
Create an iterator that merges items from both this and the specified +iterator in ascending order. Read more
Return an iterator adaptor that flattens an iterator of iterators by +merging them in ascending order. Read more
Return an iterator adaptor that flattens an iterator of iterators by +merging them according to the given closure. Read more
Return an iterator adaptor that iterates over the cartesian product of +the element sets of two iterators self and J. Read more
Return an iterator adaptor that iterates over the cartesian product of +all subiterators returned by meta-iterator self. Read more
Return an iterator adaptor that uses the passed-in closure to +optionally merge together consecutive elements. Read more
Remove duplicates from sections of consecutive identical elements. +If the iterator is sorted, all elements will be unique. Read more
Remove duplicates from sections of consecutive identical elements, determining equality using a comparison function. -If the iterator is sorted, all elements will be unique. Read more

-

Remove duplicates from sections of consecutive identical elements, while keeping a count of +If the iterator is sorted, all elements will be unique. Read more

Remove duplicates from sections of consecutive identical elements, while keeping a count of how many repeated elements were present. -If the iterator is sorted, all elements will be unique. Read more

-

Remove duplicates from sections of consecutive identical elements, while keeping a count of +If the iterator is sorted, all elements will be unique. Read more

Remove duplicates from sections of consecutive identical elements, while keeping a count of how many repeated elements were present. This will determine equality using a comparison function. -If the iterator is sorted, all elements will be unique. Read more

-

Return an iterator adaptor that produces elements that appear more than once during the -iteration. Duplicates are detected using hash and equality. Read more

-

Return an iterator adaptor that produces elements that appear more than once during the -iteration. Duplicates are detected using hash and equality. Read more

-

Return an iterator adaptor that filters out elements that have +If the iterator is sorted, all elements will be unique. Read more

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
Return an iterator adaptor that filters out elements that have already been produced once during the iteration. Duplicates -are detected using hash and equality. Read more

-

Return an iterator adaptor that filters out elements that have -already been produced once during the iteration. Read more

-

Return an iterator adaptor that borrows from this iterator and -takes items while the closure accept returns true. Read more

-

Return an iterator adaptor that borrows from a Clone-able iterator -to only pick off elements while the predicate accept returns true. Read more

-

Return an iterator adaptor that filters Option<A> iterator elements -and produces A. Stops on the first None encountered. Read more

-

Return an iterator adaptor that iterates over the combinations of the -elements from an iterator. Read more

-

Return an iterator adaptor that iterates over the k-length combinations of -the elements from an iterator. Read more

-

Return an iterator that iterates over the k-length combinations of -the elements from an iterator, with replacement. Read more

-

Return an iterator adaptor that iterates over all k-permutations of the -elements from an iterator. Read more

-

Return an iterator that iterates through the powerset of the elements from an -iterator. Read more

-

Return an iterator adaptor that pads the sequence to a minimum length of -min by filling missing elements using a closure f. Read more

-

Return an iterator adaptor that wraps each element in a Position to -ease special-case handling of the first or last elements. Read more

-

Return an iterator adaptor that yields the indices of all elements -satisfying a predicate, counted from the start of the iterator. Read more

-

Return an iterator adaptor that applies a mutating function -to each element before yielding it. Read more

-

Advances the iterator and returns the next items grouped in a tuple of -a specific size (up to 12). Read more

-

Collects all items from the iterator into a tuple of a specific size -(up to 12). Read more

-

Find the position and value of the first element satisfying a predicate. Read more

-

Find the value of the first element satisfying a predicate or return the last element, if any. Read more

-

Find the value of the first element satisfying a predicate or return the first element, if any. Read more

-

Returns true if the given item is present in this iterator. Read more

-

Check whether all elements compare equal. Read more

-

Check whether all elements are unique (non equal). Read more

-

Consume the first n elements from the iterator eagerly, -and return the same iterator again. Read more

-

Consume the last n elements from the iterator eagerly, -and return the same iterator again. Read more

-
👎 Deprecated since 0.8.0:

Use .for_each() instead

-

Run the closure f eagerly on each element of the iterator. Read more

-

Combine all an iterator’s elements into one element by using Extend. Read more

-

.collect_vec() is simply a type specialization of Iterator::collect, -for convenience. Read more

-

.try_collect() is more convenient way of writing -.collect::<Result<_, _>>() Read more

-

Assign to each reference in self from the from iterator, -stopping at the shortest of the two iterators. Read more

-

Combine all iterator elements into one String, separated by sep. Read more

-

Format all iterator elements, separated by sep. Read more

-

Format all iterator elements, separated by sep. Read more

-
👎 Deprecated since 0.10.0:

Use .fold_ok() instead

-

See .fold_ok().

-

Fold Result values from an iterator. Read more

-

Fold Option values from an iterator. Read more

-
👎 Deprecated since 0.10.2:

Use Iterator::reduce instead

-

Accumulator of the elements in the iterator. Read more

-

Accumulate the elements in the iterator in a tree-like manner. Read more

-

An iterator method that applies a function, producing a single, final value. Read more

-

Iterate over the entire iterator and add all the elements. Read more

-

Iterate over the entire iterator and multiply all the elements. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. Read more

-

Sort all iterator elements into a new iterator in ascending order. The key function is -called exactly once per key. Read more

-

Sort the k smallest elements into a new iterator, in ascending order. Read more

-

Collect all iterator elements into one of two -partitions. Unlike Iterator::partition, each partition may -have a distinct type. Read more

-

Partition a sequence of Results into one list of all the Ok elements -and another list of all the Err elements. Read more

-

Return a HashMap of keys mapped to Vecs of values. Keys and values -are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more

-

Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified -in the closure. Read more

-

Constructs a GroupingMap to be used later with one of the efficient -group-and-fold operations it allows to perform. Read more

-

Constructs a GroupingMap to be used later with one of the efficient -group-and-fold operations it allows to perform. Read more

-

Return all minimum elements of an iterator. Read more

-

Return all minimum elements of an iterator, as determined by -the specified function. Read more

-

Return all minimum elements of an iterator, as determined by -the specified function. Read more

-

Return all maximum elements of an iterator. Read more

-

Return all maximum elements of an iterator, as determined by -the specified function. Read more

-

Return all minimum elements of an iterator, as determined by -the specified function. Read more

-

Return the minimum and maximum elements in the iterator. Read more

-

Return the minimum and maximum element of an iterator, as determined by -the specified function. Read more

-

Return the minimum and maximum element of an iterator, as determined by -the specified comparison function. Read more

-

Return the position of the maximum element in the iterator. Read more

-

Return the position of the maximum element in the iterator, as -determined by the specified function. Read more

-

Return the position of the maximum element in the iterator, as -determined by the specified comparison function. Read more

-

Return the position of the minimum element in the iterator. Read more

-

Return the position of the minimum element in the iterator, as -determined by the specified function. Read more

-

Return the position of the minimum element in the iterator, as -determined by the specified comparison function. Read more

-

Return the positions of the minimum and maximum elements in -the iterator. Read more

-

Return the postions of the minimum and maximum elements of an -iterator, as determined by the specified function. Read more

-

Return the postions of the minimum and maximum elements of an -iterator, as determined by the specified comparison function. Read more

-

If the iterator yields exactly one element, that element will be returned, otherwise +are detected using hash and equality. Read more

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Read more
Return an iterator adaptor that borrows from this iterator and +takes items while the closure accept returns true. Read more
Return an iterator adaptor that borrows from a Clone-able iterator +to only pick off elements while the predicate accept returns true. Read more
Return an iterator adaptor that filters Option<A> iterator elements +and produces A. Stops on the first None encountered. Read more
Return an iterator adaptor that iterates over the combinations of the +elements from an iterator. Read more
Return an iterator adaptor that iterates over the k-length combinations of +the elements from an iterator. Read more
Return an iterator that iterates over the k-length combinations of +the elements from an iterator, with replacement. Read more
Return an iterator adaptor that iterates over all k-permutations of the +elements from an iterator. Read more
Return an iterator that iterates through the powerset of the elements from an +iterator. Read more
Return an iterator adaptor that pads the sequence to a minimum length of +min by filling missing elements using a closure f. Read more
Return an iterator adaptor that wraps each element in a Position to +ease special-case handling of the first or last elements. Read more
Return an iterator adaptor that yields the indices of all elements +satisfying a predicate, counted from the start of the iterator. Read more
Return an iterator adaptor that applies a mutating function +to each element before yielding it. Read more
Advances the iterator and returns the next items grouped in a tuple of +a specific size (up to 12). Read more
Collects all items from the iterator into a tuple of a specific size +(up to 12). Read more
Find the position and value of the first element satisfying a predicate. Read more
Find the value of the first element satisfying a predicate or return the last element, if any. Read more
Find the value of the first element satisfying a predicate or return the first element, if any. Read more
Returns true if the given item is present in this iterator. Read more
Check whether all elements compare equal. Read more
Check whether all elements are unique (non equal). Read more
Consume the first n elements from the iterator eagerly, +and return the same iterator again. Read more
Consume the last n elements from the iterator eagerly, +and return the same iterator again. Read more
👎Deprecated since 0.8.0:

Use .for_each() instead

+
Run the closure f eagerly on each element of the iterator. Read more
Combine all an iterator’s elements into one element by using Extend. Read more
.collect_vec() is simply a type specialization of Iterator::collect, +for convenience. Read more
.try_collect() is more convenient way of writing +.collect::<Result<_, _>>() Read more
Assign to each reference in self from the from iterator, +stopping at the shortest of the two iterators. Read more
Combine all iterator elements into one String, separated by sep. Read more
Format all iterator elements, separated by sep. Read more
Format all iterator elements, separated by sep. Read more
👎Deprecated since 0.10.0:

Use .fold_ok() instead

+
Fold Result values from an iterator. Read more
Fold Option values from an iterator. Read more
👎Deprecated since 0.10.2:

Use Iterator::reduce instead

+
Accumulator of the elements in the iterator. Read more
Accumulate the elements in the iterator in a tree-like manner. Read more
An iterator method that applies a function, producing a single, final value. Read more
Iterate over the entire iterator and add all the elements. Read more
Iterate over the entire iterator and multiply all the elements. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. Read more
Sort all iterator elements into a new iterator in ascending order. The key function is +called exactly once per key. Read more
Sort the k smallest elements into a new iterator, in ascending order. Read more
Collect all iterator elements into one of two +partitions. Unlike Iterator::partition, each partition may +have a distinct type. Read more
Partition a sequence of Results into one list of all the Ok elements +and another list of all the Err elements. Read more
Return a HashMap of keys mapped to Vecs of values. Keys and values +are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more
Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified +in the closure. Read more
Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
Return all minimum elements of an iterator. Read more
Return all minimum elements of an iterator, as determined by +the specified function. Read more
Return all minimum elements of an iterator, as determined by +the specified function. Read more
Return all maximum elements of an iterator. Read more
Return all maximum elements of an iterator, as determined by +the specified function. Read more
Return all minimum elements of an iterator, as determined by +the specified function. Read more
Return the minimum and maximum elements in the iterator. Read more
Return the minimum and maximum element of an iterator, as determined by +the specified function. Read more
Return the minimum and maximum element of an iterator, as determined by +the specified comparison function. Read more
Return the position of the maximum element in the iterator. Read more
Return the position of the maximum element in the iterator, as +determined by the specified function. Read more
Return the position of the maximum element in the iterator, as +determined by the specified comparison function. Read more
Return the position of the minimum element in the iterator. Read more
Return the position of the minimum element in the iterator, as +determined by the specified function. Read more
Return the position of the minimum element in the iterator, as +determined by the specified comparison function. Read more
Return the positions of the minimum and maximum elements in +the iterator. Read more
Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified function. Read more
Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified comparison function. Read more
If the iterator yields exactly one element, that element will be returned, otherwise an error will be returned containing an iterator that has the same output as the input -iterator. Read more

-

If the iterator yields no elements, Ok(None) will be returned. If the iterator yields +iterator. Read more

If the iterator yields no elements, Ok(None) will be returned. If the iterator yields exactly one element, that element will be returned, otherwise an error will be returned -containing an iterator that has the same output as the input iterator. Read more

-

An iterator adaptor that allows the user to peek at multiple .next() -values without advancing the base iterator. Read more

-

Collect the items in this iterator and return a HashMap which +containing an iterator that has the same output as the input iterator. Read more

An iterator adaptor that allows the user to peek at multiple .next() +values without advancing the base iterator. Read more
Collect the items in this iterator and return a HashMap which contains each item that appears in the iterator and the number -of times it appears. Read more

-

Collect the items in this iterator and return a HashMap which +of times it appears. Read more

Collect the items in this iterator and return a HashMap which contains each item that appears in the iterator and the number of times it appears, -determining identity using a keying function. Read more

-

Converts an iterator of tuples into a tuple of containers. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +determining identity using a keying function. Read more
Converts an iterator of tuples into a tuple of containers. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uu_tail/fn.uumain.html b/dev/uu_tail/fn.uumain.html index 34ffbc098..7b9a236e0 100644 --- a/dev/uu_tail/fn.uumain.html +++ b/dev/uu_tail/fn.uumain.html @@ -1 +1 @@ -uumain in uu_tail - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_tail - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_tail/index.html b/dev/uu_tail/index.html index 7bfa32739..e9c2bae49 100644 --- a/dev/uu_tail/index.html +++ b/dev/uu_tail/index.html @@ -1,3 +1,2 @@ -uu_tail - Rust

Re-exports

pub use args::uu_app;

Modules

Iterating over a file by chunks, either starting at the end of the file with ReverseChunks -or at the end of piped stdin with LinesChunk or BytesChunk.

-

Functions

\ No newline at end of file +uu_tail - Rust

Re-exports

pub use args::uu_app;

Modules

Iterating over a file by chunks, either starting at the end of the file with ReverseChunks +or at the end of piped stdin with LinesChunk or BytesChunk.

Functions

\ No newline at end of file diff --git a/dev/uu_tail/text/index.html b/dev/uu_tail/text/index.html index 2f4e16b93..d91f80c2e 100644 --- a/dev/uu_tail/text/index.html +++ b/dev/uu_tail/text/index.html @@ -1 +1 @@ -uu_tail::text - Rust
\ No newline at end of file +uu_tail::text - Rust
\ No newline at end of file diff --git a/dev/uu_tail/text/static.BACKEND.html b/dev/uu_tail/text/static.BACKEND.html index 2ee561750..bc42e983c 100644 --- a/dev/uu_tail/text/static.BACKEND.html +++ b/dev/uu_tail/text/static.BACKEND.html @@ -1 +1 @@ -BACKEND in uu_tail::text - Rust
pub static BACKEND: &'static str
\ No newline at end of file +BACKEND in uu_tail::text - Rust
pub static BACKEND: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/text/static.BAD_FD.html b/dev/uu_tail/text/static.BAD_FD.html index ea478b962..b619b9f81 100644 --- a/dev/uu_tail/text/static.BAD_FD.html +++ b/dev/uu_tail/text/static.BAD_FD.html @@ -1 +1 @@ -BAD_FD in uu_tail::text - Rust
pub static BAD_FD: &'static str
\ No newline at end of file +BAD_FD in uu_tail::text - Rust
pub static BAD_FD: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/text/static.BECOME_INACCESSIBLE.html b/dev/uu_tail/text/static.BECOME_INACCESSIBLE.html index 2bbbff716..1174695f3 100644 --- a/dev/uu_tail/text/static.BECOME_INACCESSIBLE.html +++ b/dev/uu_tail/text/static.BECOME_INACCESSIBLE.html @@ -1 +1 @@ -BECOME_INACCESSIBLE in uu_tail::text - Rust
pub static BECOME_INACCESSIBLE: &'static str
\ No newline at end of file +BECOME_INACCESSIBLE in uu_tail::text - Rust
pub static BECOME_INACCESSIBLE: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/text/static.DASH.html b/dev/uu_tail/text/static.DASH.html index 39a0ba87b..db0991cfd 100644 --- a/dev/uu_tail/text/static.DASH.html +++ b/dev/uu_tail/text/static.DASH.html @@ -1 +1 @@ -DASH in uu_tail::text - Rust
pub static DASH: &'static str
\ No newline at end of file +DASH in uu_tail::text - Rust
pub static DASH: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/text/static.DEV_STDIN.html b/dev/uu_tail/text/static.DEV_STDIN.html index fd0b9b2a9..53f1eef0e 100644 --- a/dev/uu_tail/text/static.DEV_STDIN.html +++ b/dev/uu_tail/text/static.DEV_STDIN.html @@ -1 +1 @@ -DEV_STDIN in uu_tail::text - Rust
pub static DEV_STDIN: &'static str
\ No newline at end of file +DEV_STDIN in uu_tail::text - Rust
pub static DEV_STDIN: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/text/static.FD0.html b/dev/uu_tail/text/static.FD0.html index 36fd1c79a..ef65f83ca 100644 --- a/dev/uu_tail/text/static.FD0.html +++ b/dev/uu_tail/text/static.FD0.html @@ -1 +1 @@ -FD0 in uu_tail::text - Rust
pub static FD0: &'static str
\ No newline at end of file +FD0 in uu_tail::text - Rust
pub static FD0: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/text/static.NO_FILES_REMAINING.html b/dev/uu_tail/text/static.NO_FILES_REMAINING.html index 1d80db079..8cc6cc135 100644 --- a/dev/uu_tail/text/static.NO_FILES_REMAINING.html +++ b/dev/uu_tail/text/static.NO_FILES_REMAINING.html @@ -1 +1 @@ -NO_FILES_REMAINING in uu_tail::text - Rust
pub static NO_FILES_REMAINING: &'static str
\ No newline at end of file +NO_FILES_REMAINING in uu_tail::text - Rust
pub static NO_FILES_REMAINING: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/text/static.NO_SUCH_FILE.html b/dev/uu_tail/text/static.NO_SUCH_FILE.html index af4a6a4b1..37dffc7af 100644 --- a/dev/uu_tail/text/static.NO_SUCH_FILE.html +++ b/dev/uu_tail/text/static.NO_SUCH_FILE.html @@ -1 +1 @@ -NO_SUCH_FILE in uu_tail::text - Rust
pub static NO_SUCH_FILE: &'static str
\ No newline at end of file +NO_SUCH_FILE in uu_tail::text - Rust
pub static NO_SUCH_FILE: &'static str
\ No newline at end of file diff --git a/dev/uu_tail/text/static.STDIN_HEADER.html b/dev/uu_tail/text/static.STDIN_HEADER.html index 4ea4d6e94..3c603ad59 100644 --- a/dev/uu_tail/text/static.STDIN_HEADER.html +++ b/dev/uu_tail/text/static.STDIN_HEADER.html @@ -1 +1 @@ -STDIN_HEADER in uu_tail::text - Rust
pub static STDIN_HEADER: &'static str
\ No newline at end of file +STDIN_HEADER in uu_tail::text - Rust
pub static STDIN_HEADER: &'static str
\ No newline at end of file diff --git a/dev/uu_tee/all.html b/dev/uu_tee/all.html index 76a8bbe27..ea5689f2e 100644 --- a/dev/uu_tee/all.html +++ b/dev/uu_tee/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_tee/fn.uu_app.html b/dev/uu_tee/fn.uu_app.html index cca6da334..ba4acabf5 100644 --- a/dev/uu_tee/fn.uu_app.html +++ b/dev/uu_tee/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_tee - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_tee - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_tee/fn.uumain.html b/dev/uu_tee/fn.uumain.html index e40313da5..611846a95 100644 --- a/dev/uu_tee/fn.uumain.html +++ b/dev/uu_tee/fn.uumain.html @@ -1 +1 @@ -uumain in uu_tee - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_tee - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_tee/index.html b/dev/uu_tee/index.html index 6ddbad56c..d16c1e241 100644 --- a/dev/uu_tee/index.html +++ b/dev/uu_tee/index.html @@ -1 +1 @@ -uu_tee - Rust
\ No newline at end of file +uu_tee - Rust
\ No newline at end of file diff --git a/dev/uu_test/all.html b/dev/uu_test/all.html index b1fb686c4..2a646881b 100644 --- a/dev/uu_test/all.html +++ b/dev/uu_test/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_test/fn.uu_app.html b/dev/uu_test/fn.uu_app.html index bc6924b76..c10f63bc1 100644 --- a/dev/uu_test/fn.uu_app.html +++ b/dev/uu_test/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_test - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_test - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_test/fn.uumain.html b/dev/uu_test/fn.uumain.html index 89bf35e01..5e51b4ab1 100644 --- a/dev/uu_test/fn.uumain.html +++ b/dev/uu_test/fn.uumain.html @@ -1 +1 @@ -uumain in uu_test - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_test - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_test/index.html b/dev/uu_test/index.html index cc3e4d3ba..5c9098087 100644 --- a/dev/uu_test/index.html +++ b/dev/uu_test/index.html @@ -1 +1 @@ -uu_test - Rust
\ No newline at end of file +uu_test - Rust
\ No newline at end of file diff --git a/dev/uu_timeout/all.html b/dev/uu_timeout/all.html index 899a6c4ce..45324f29a 100644 --- a/dev/uu_timeout/all.html +++ b/dev/uu_timeout/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_timeout/fn.uu_app.html b/dev/uu_timeout/fn.uu_app.html index dc94ad5a6..92e4341b9 100644 --- a/dev/uu_timeout/fn.uu_app.html +++ b/dev/uu_timeout/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_timeout - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_timeout - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_timeout/fn.uumain.html b/dev/uu_timeout/fn.uumain.html index dba26b57a..8eb8f7183 100644 --- a/dev/uu_timeout/fn.uumain.html +++ b/dev/uu_timeout/fn.uumain.html @@ -1 +1 @@ -uumain in uu_timeout - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_timeout - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_timeout/index.html b/dev/uu_timeout/index.html index 61d92b402..798c245bc 100644 --- a/dev/uu_timeout/index.html +++ b/dev/uu_timeout/index.html @@ -1 +1 @@ -uu_timeout - Rust
\ No newline at end of file +uu_timeout - Rust
\ No newline at end of file diff --git a/dev/uu_timeout/options/index.html b/dev/uu_timeout/options/index.html index 5ef43e714..63597f7f5 100644 --- a/dev/uu_timeout/options/index.html +++ b/dev/uu_timeout/options/index.html @@ -1 +1 @@ -uu_timeout::options - Rust
\ No newline at end of file +uu_timeout::options - Rust
\ No newline at end of file diff --git a/dev/uu_timeout/options/static.COMMAND.html b/dev/uu_timeout/options/static.COMMAND.html index 369c04061..59b2e48ad 100644 --- a/dev/uu_timeout/options/static.COMMAND.html +++ b/dev/uu_timeout/options/static.COMMAND.html @@ -1 +1 @@ -COMMAND in uu_timeout::options - Rust
pub static COMMAND: &'static str
\ No newline at end of file +COMMAND in uu_timeout::options - Rust
pub static COMMAND: &'static str
\ No newline at end of file diff --git a/dev/uu_timeout/options/static.DURATION.html b/dev/uu_timeout/options/static.DURATION.html index 2c656b146..70c8336d7 100644 --- a/dev/uu_timeout/options/static.DURATION.html +++ b/dev/uu_timeout/options/static.DURATION.html @@ -1 +1 @@ -DURATION in uu_timeout::options - Rust
pub static DURATION: &'static str
\ No newline at end of file +DURATION in uu_timeout::options - Rust
pub static DURATION: &'static str
\ No newline at end of file diff --git a/dev/uu_timeout/options/static.FOREGROUND.html b/dev/uu_timeout/options/static.FOREGROUND.html index ab30e0560..653d792b8 100644 --- a/dev/uu_timeout/options/static.FOREGROUND.html +++ b/dev/uu_timeout/options/static.FOREGROUND.html @@ -1 +1 @@ -FOREGROUND in uu_timeout::options - Rust
pub static FOREGROUND: &'static str
\ No newline at end of file +FOREGROUND in uu_timeout::options - Rust
pub static FOREGROUND: &'static str
\ No newline at end of file diff --git a/dev/uu_timeout/options/static.KILL_AFTER.html b/dev/uu_timeout/options/static.KILL_AFTER.html index 0112bf2f2..d455f0442 100644 --- a/dev/uu_timeout/options/static.KILL_AFTER.html +++ b/dev/uu_timeout/options/static.KILL_AFTER.html @@ -1 +1 @@ -KILL_AFTER in uu_timeout::options - Rust
pub static KILL_AFTER: &'static str
\ No newline at end of file +KILL_AFTER in uu_timeout::options - Rust
pub static KILL_AFTER: &'static str
\ No newline at end of file diff --git a/dev/uu_timeout/options/static.PRESERVE_STATUS.html b/dev/uu_timeout/options/static.PRESERVE_STATUS.html index 591de7ca9..17fac97cf 100644 --- a/dev/uu_timeout/options/static.PRESERVE_STATUS.html +++ b/dev/uu_timeout/options/static.PRESERVE_STATUS.html @@ -1 +1 @@ -PRESERVE_STATUS in uu_timeout::options - Rust
pub static PRESERVE_STATUS: &'static str
\ No newline at end of file +PRESERVE_STATUS in uu_timeout::options - Rust
pub static PRESERVE_STATUS: &'static str
\ No newline at end of file diff --git a/dev/uu_timeout/options/static.SIGNAL.html b/dev/uu_timeout/options/static.SIGNAL.html index a12abb405..c9a83fa0d 100644 --- a/dev/uu_timeout/options/static.SIGNAL.html +++ b/dev/uu_timeout/options/static.SIGNAL.html @@ -1 +1 @@ -SIGNAL in uu_timeout::options - Rust
pub static SIGNAL: &'static str
\ No newline at end of file +SIGNAL in uu_timeout::options - Rust
pub static SIGNAL: &'static str
\ No newline at end of file diff --git a/dev/uu_timeout/options/static.VERBOSE.html b/dev/uu_timeout/options/static.VERBOSE.html index 53931f783..853efb276 100644 --- a/dev/uu_timeout/options/static.VERBOSE.html +++ b/dev/uu_timeout/options/static.VERBOSE.html @@ -1 +1 @@ -VERBOSE in uu_timeout::options - Rust
pub static VERBOSE: &'static str
\ No newline at end of file +VERBOSE in uu_timeout::options - Rust
pub static VERBOSE: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/all.html b/dev/uu_touch/all.html index b289086e0..fb554d589 100644 --- a/dev/uu_touch/all.html +++ b/dev/uu_touch/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_touch/fn.uu_app.html b/dev/uu_touch/fn.uu_app.html index 561e0ae76..3d2dc6dfa 100644 --- a/dev/uu_touch/fn.uu_app.html +++ b/dev/uu_touch/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_touch - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_touch - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_touch/fn.uumain.html b/dev/uu_touch/fn.uumain.html index db96eaa83..b7bf7c1b3 100644 --- a/dev/uu_touch/fn.uumain.html +++ b/dev/uu_touch/fn.uumain.html @@ -1 +1 @@ -uumain in uu_touch - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_touch - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_touch/index.html b/dev/uu_touch/index.html index c7e41f705..ffaba5aab 100644 --- a/dev/uu_touch/index.html +++ b/dev/uu_touch/index.html @@ -1 +1 @@ -uu_touch - Rust
\ No newline at end of file +uu_touch - Rust
\ No newline at end of file diff --git a/dev/uu_touch/options/index.html b/dev/uu_touch/options/index.html index 056056115..1e9902787 100644 --- a/dev/uu_touch/options/index.html +++ b/dev/uu_touch/options/index.html @@ -1 +1 @@ -uu_touch::options - Rust
\ No newline at end of file +uu_touch::options - Rust
\ No newline at end of file diff --git a/dev/uu_touch/options/sources/index.html b/dev/uu_touch/options/sources/index.html index 8a32f445b..d0de55384 100644 --- a/dev/uu_touch/options/sources/index.html +++ b/dev/uu_touch/options/sources/index.html @@ -1 +1 @@ -uu_touch::options::sources - Rust
\ No newline at end of file +uu_touch::options::sources - Rust
\ No newline at end of file diff --git a/dev/uu_touch/options/sources/static.CURRENT.html b/dev/uu_touch/options/sources/static.CURRENT.html index 55655ccaa..4d179e6af 100644 --- a/dev/uu_touch/options/sources/static.CURRENT.html +++ b/dev/uu_touch/options/sources/static.CURRENT.html @@ -1 +1 @@ -CURRENT in uu_touch::options::sources - Rust
pub static CURRENT: &'static str
\ No newline at end of file +CURRENT in uu_touch::options::sources - Rust
pub static CURRENT: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/options/sources/static.DATE.html b/dev/uu_touch/options/sources/static.DATE.html index 9c6f5de90..0bbb3a810 100644 --- a/dev/uu_touch/options/sources/static.DATE.html +++ b/dev/uu_touch/options/sources/static.DATE.html @@ -1 +1 @@ -DATE in uu_touch::options::sources - Rust
pub static DATE: &'static str
\ No newline at end of file +DATE in uu_touch::options::sources - Rust
pub static DATE: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/options/sources/static.REFERENCE.html b/dev/uu_touch/options/sources/static.REFERENCE.html index 3778a77db..6a0975347 100644 --- a/dev/uu_touch/options/sources/static.REFERENCE.html +++ b/dev/uu_touch/options/sources/static.REFERENCE.html @@ -1 +1 @@ -REFERENCE in uu_touch::options::sources - Rust
pub static REFERENCE: &'static str
\ No newline at end of file +REFERENCE in uu_touch::options::sources - Rust
pub static REFERENCE: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/options/static.ACCESS.html b/dev/uu_touch/options/static.ACCESS.html index 9ea4aa365..65b12f29a 100644 --- a/dev/uu_touch/options/static.ACCESS.html +++ b/dev/uu_touch/options/static.ACCESS.html @@ -1 +1 @@ -ACCESS in uu_touch::options - Rust
pub static ACCESS: &'static str
\ No newline at end of file +ACCESS in uu_touch::options - Rust
pub static ACCESS: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/options/static.HELP.html b/dev/uu_touch/options/static.HELP.html index 23188a4c5..eb08d5c35 100644 --- a/dev/uu_touch/options/static.HELP.html +++ b/dev/uu_touch/options/static.HELP.html @@ -1 +1 @@ -HELP in uu_touch::options - Rust
pub static HELP: &'static str
\ No newline at end of file +HELP in uu_touch::options - Rust
pub static HELP: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/options/static.MODIFICATION.html b/dev/uu_touch/options/static.MODIFICATION.html index bef11b32b..d5ef22157 100644 --- a/dev/uu_touch/options/static.MODIFICATION.html +++ b/dev/uu_touch/options/static.MODIFICATION.html @@ -1 +1 @@ -MODIFICATION in uu_touch::options - Rust
pub static MODIFICATION: &'static str
\ No newline at end of file +MODIFICATION in uu_touch::options - Rust
pub static MODIFICATION: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/options/static.NO_CREATE.html b/dev/uu_touch/options/static.NO_CREATE.html index 669168eda..0ed690df9 100644 --- a/dev/uu_touch/options/static.NO_CREATE.html +++ b/dev/uu_touch/options/static.NO_CREATE.html @@ -1 +1 @@ -NO_CREATE in uu_touch::options - Rust
pub static NO_CREATE: &'static str
\ No newline at end of file +NO_CREATE in uu_touch::options - Rust
pub static NO_CREATE: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/options/static.NO_DEREF.html b/dev/uu_touch/options/static.NO_DEREF.html index 4b99b2df5..3b890f7e0 100644 --- a/dev/uu_touch/options/static.NO_DEREF.html +++ b/dev/uu_touch/options/static.NO_DEREF.html @@ -1 +1 @@ -NO_DEREF in uu_touch::options - Rust
pub static NO_DEREF: &'static str
\ No newline at end of file +NO_DEREF in uu_touch::options - Rust
pub static NO_DEREF: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/options/static.SOURCES.html b/dev/uu_touch/options/static.SOURCES.html index 83250650f..6ffbbb5ba 100644 --- a/dev/uu_touch/options/static.SOURCES.html +++ b/dev/uu_touch/options/static.SOURCES.html @@ -1 +1 @@ -SOURCES in uu_touch::options - Rust
pub static SOURCES: &'static str
\ No newline at end of file +SOURCES in uu_touch::options - Rust
pub static SOURCES: &'static str
\ No newline at end of file diff --git a/dev/uu_touch/options/static.TIME.html b/dev/uu_touch/options/static.TIME.html index ca8b2b056..70a2cf5f5 100644 --- a/dev/uu_touch/options/static.TIME.html +++ b/dev/uu_touch/options/static.TIME.html @@ -1 +1 @@ -TIME in uu_touch::options - Rust
pub static TIME: &'static str
\ No newline at end of file +TIME in uu_touch::options - Rust
pub static TIME: &'static str
\ No newline at end of file diff --git a/dev/uu_tr/all.html b/dev/uu_tr/all.html index 10511a527..dbab6e48e 100644 --- a/dev/uu_tr/all.html +++ b/dev/uu_tr/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_tr/fn.uu_app.html b/dev/uu_tr/fn.uu_app.html index 1fd2d3c8e..e244dac30 100644 --- a/dev/uu_tr/fn.uu_app.html +++ b/dev/uu_tr/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_tr - Rust

Function uu_tr::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_tr - Rust

Function uu_tr::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_tr/fn.uumain.html b/dev/uu_tr/fn.uumain.html index 89dc2ac83..c544feaed 100644 --- a/dev/uu_tr/fn.uumain.html +++ b/dev/uu_tr/fn.uumain.html @@ -1 +1 @@ -uumain in uu_tr - Rust

Function uu_tr::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_tr - Rust

Function uu_tr::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_tr/index.html b/dev/uu_tr/index.html index 39a66ccdf..99cbd0a7b 100644 --- a/dev/uu_tr/index.html +++ b/dev/uu_tr/index.html @@ -1 +1 @@ -uu_tr - Rust
\ No newline at end of file +uu_tr - Rust
\ No newline at end of file diff --git a/dev/uu_true/all.html b/dev/uu_true/all.html index 7292b27fc..4bdbb1606 100644 --- a/dev/uu_true/all.html +++ b/dev/uu_true/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_true/fn.uu_app.html b/dev/uu_true/fn.uu_app.html index 105ed1e0d..5d1362960 100644 --- a/dev/uu_true/fn.uu_app.html +++ b/dev/uu_true/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_true - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_true - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_true/fn.uumain.html b/dev/uu_true/fn.uumain.html index 7dd46902b..c47fc3c7f 100644 --- a/dev/uu_true/fn.uumain.html +++ b/dev/uu_true/fn.uumain.html @@ -1 +1 @@ -uumain in uu_true - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_true - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_true/index.html b/dev/uu_true/index.html index 7c8fccfe1..4919396e8 100644 --- a/dev/uu_true/index.html +++ b/dev/uu_true/index.html @@ -1 +1 @@ -uu_true - Rust
\ No newline at end of file +uu_true - Rust
\ No newline at end of file diff --git a/dev/uu_truncate/all.html b/dev/uu_truncate/all.html index 68b358947..b7ce16a3f 100644 --- a/dev/uu_truncate/all.html +++ b/dev/uu_truncate/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_truncate/fn.uu_app.html b/dev/uu_truncate/fn.uu_app.html index 6838e84a4..6f5c23d73 100644 --- a/dev/uu_truncate/fn.uu_app.html +++ b/dev/uu_truncate/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_truncate - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_truncate - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_truncate/fn.uumain.html b/dev/uu_truncate/fn.uumain.html index f243a2c8f..babd88292 100644 --- a/dev/uu_truncate/fn.uumain.html +++ b/dev/uu_truncate/fn.uumain.html @@ -1 +1 @@ -uumain in uu_truncate - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_truncate - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_truncate/index.html b/dev/uu_truncate/index.html index 1b891392b..7a2faa626 100644 --- a/dev/uu_truncate/index.html +++ b/dev/uu_truncate/index.html @@ -1 +1 @@ -uu_truncate - Rust
\ No newline at end of file +uu_truncate - Rust
\ No newline at end of file diff --git a/dev/uu_truncate/options/index.html b/dev/uu_truncate/options/index.html index c02133288..38c37793f 100644 --- a/dev/uu_truncate/options/index.html +++ b/dev/uu_truncate/options/index.html @@ -1 +1 @@ -uu_truncate::options - Rust
\ No newline at end of file +uu_truncate::options - Rust
\ No newline at end of file diff --git a/dev/uu_truncate/options/static.ARG_FILES.html b/dev/uu_truncate/options/static.ARG_FILES.html index f6f37637c..9bf5818a8 100644 --- a/dev/uu_truncate/options/static.ARG_FILES.html +++ b/dev/uu_truncate/options/static.ARG_FILES.html @@ -1 +1 @@ -ARG_FILES in uu_truncate::options - Rust
pub static ARG_FILES: &'static str
\ No newline at end of file +ARG_FILES in uu_truncate::options - Rust
pub static ARG_FILES: &'static str
\ No newline at end of file diff --git a/dev/uu_truncate/options/static.IO_BLOCKS.html b/dev/uu_truncate/options/static.IO_BLOCKS.html index dadef0556..0a91493b4 100644 --- a/dev/uu_truncate/options/static.IO_BLOCKS.html +++ b/dev/uu_truncate/options/static.IO_BLOCKS.html @@ -1 +1 @@ -IO_BLOCKS in uu_truncate::options - Rust
pub static IO_BLOCKS: &'static str
\ No newline at end of file +IO_BLOCKS in uu_truncate::options - Rust
pub static IO_BLOCKS: &'static str
\ No newline at end of file diff --git a/dev/uu_truncate/options/static.NO_CREATE.html b/dev/uu_truncate/options/static.NO_CREATE.html index f5192403f..e58d389da 100644 --- a/dev/uu_truncate/options/static.NO_CREATE.html +++ b/dev/uu_truncate/options/static.NO_CREATE.html @@ -1 +1 @@ -NO_CREATE in uu_truncate::options - Rust
pub static NO_CREATE: &'static str
\ No newline at end of file +NO_CREATE in uu_truncate::options - Rust
pub static NO_CREATE: &'static str
\ No newline at end of file diff --git a/dev/uu_truncate/options/static.REFERENCE.html b/dev/uu_truncate/options/static.REFERENCE.html index c77e72409..18a05bb76 100644 --- a/dev/uu_truncate/options/static.REFERENCE.html +++ b/dev/uu_truncate/options/static.REFERENCE.html @@ -1 +1 @@ -REFERENCE in uu_truncate::options - Rust
pub static REFERENCE: &'static str
\ No newline at end of file +REFERENCE in uu_truncate::options - Rust
pub static REFERENCE: &'static str
\ No newline at end of file diff --git a/dev/uu_truncate/options/static.SIZE.html b/dev/uu_truncate/options/static.SIZE.html index 8e9243c2c..17981ec6a 100644 --- a/dev/uu_truncate/options/static.SIZE.html +++ b/dev/uu_truncate/options/static.SIZE.html @@ -1 +1 @@ -SIZE in uu_truncate::options - Rust
pub static SIZE: &'static str
\ No newline at end of file +SIZE in uu_truncate::options - Rust
pub static SIZE: &'static str
\ No newline at end of file diff --git a/dev/uu_tsort/all.html b/dev/uu_tsort/all.html index f9fbdbfd2..37880f0f6 100644 --- a/dev/uu_tsort/all.html +++ b/dev/uu_tsort/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_tsort/fn.uu_app.html b/dev/uu_tsort/fn.uu_app.html index 2d49e07e4..5bc9214fe 100644 --- a/dev/uu_tsort/fn.uu_app.html +++ b/dev/uu_tsort/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_tsort - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_tsort - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_tsort/fn.uumain.html b/dev/uu_tsort/fn.uumain.html index b3a36711d..2e815a0bb 100644 --- a/dev/uu_tsort/fn.uumain.html +++ b/dev/uu_tsort/fn.uumain.html @@ -1 +1 @@ -uumain in uu_tsort - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_tsort - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_tsort/index.html b/dev/uu_tsort/index.html index e487869e3..55f9402f7 100644 --- a/dev/uu_tsort/index.html +++ b/dev/uu_tsort/index.html @@ -1 +1 @@ -uu_tsort - Rust
\ No newline at end of file +uu_tsort - Rust
\ No newline at end of file diff --git a/dev/uu_tty/all.html b/dev/uu_tty/all.html index dd9c391e2..0bf93d6de 100644 --- a/dev/uu_tty/all.html +++ b/dev/uu_tty/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_tty/fn.uu_app.html b/dev/uu_tty/fn.uu_app.html index 30c86d229..a1dc91f12 100644 --- a/dev/uu_tty/fn.uu_app.html +++ b/dev/uu_tty/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_tty - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_tty - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_tty/fn.uumain.html b/dev/uu_tty/fn.uumain.html index c8eee9b36..60eb13d98 100644 --- a/dev/uu_tty/fn.uumain.html +++ b/dev/uu_tty/fn.uumain.html @@ -1 +1 @@ -uumain in uu_tty - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_tty - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_tty/index.html b/dev/uu_tty/index.html index eaa641d7d..2102815a5 100644 --- a/dev/uu_tty/index.html +++ b/dev/uu_tty/index.html @@ -1 +1 @@ -uu_tty - Rust
\ No newline at end of file +uu_tty - Rust
\ No newline at end of file diff --git a/dev/uu_uname/all.html b/dev/uu_uname/all.html index 334392d5a..7849d938d 100644 --- a/dev/uu_uname/all.html +++ b/dev/uu_uname/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_uname/fn.uu_app.html b/dev/uu_uname/fn.uu_app.html index c9beb7923..f04ee12f9 100644 --- a/dev/uu_uname/fn.uu_app.html +++ b/dev/uu_uname/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_uname - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_uname - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_uname/fn.uumain.html b/dev/uu_uname/fn.uumain.html index 2dd1310fd..c2e932c96 100644 --- a/dev/uu_uname/fn.uumain.html +++ b/dev/uu_uname/fn.uumain.html @@ -1 +1 @@ -uumain in uu_uname - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_uname - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_uname/index.html b/dev/uu_uname/index.html index 78581ef6c..a1cdf56db 100644 --- a/dev/uu_uname/index.html +++ b/dev/uu_uname/index.html @@ -1 +1 @@ -uu_uname - Rust
\ No newline at end of file +uu_uname - Rust
\ No newline at end of file diff --git a/dev/uu_uname/options/index.html b/dev/uu_uname/options/index.html index fe4a4f047..64b455147 100644 --- a/dev/uu_uname/options/index.html +++ b/dev/uu_uname/options/index.html @@ -1 +1 @@ -uu_uname::options - Rust
\ No newline at end of file +uu_uname::options - Rust
\ No newline at end of file diff --git a/dev/uu_uname/options/static.ALL.html b/dev/uu_uname/options/static.ALL.html index f18c3f9c0..f53fb51f1 100644 --- a/dev/uu_uname/options/static.ALL.html +++ b/dev/uu_uname/options/static.ALL.html @@ -1 +1 @@ -ALL in uu_uname::options - Rust
pub static ALL: &'static str
\ No newline at end of file +ALL in uu_uname::options - Rust
pub static ALL: &'static str
\ No newline at end of file diff --git a/dev/uu_uname/options/static.HWPLATFORM.html b/dev/uu_uname/options/static.HWPLATFORM.html index 5d426be7e..0a706360f 100644 --- a/dev/uu_uname/options/static.HWPLATFORM.html +++ b/dev/uu_uname/options/static.HWPLATFORM.html @@ -1 +1 @@ -HWPLATFORM in uu_uname::options - Rust
pub static HWPLATFORM: &'static str
\ No newline at end of file +HWPLATFORM in uu_uname::options - Rust
pub static HWPLATFORM: &'static str
\ No newline at end of file diff --git a/dev/uu_uname/options/static.KERNELNAME.html b/dev/uu_uname/options/static.KERNELNAME.html index a79e7c8fb..ce1848a1f 100644 --- a/dev/uu_uname/options/static.KERNELNAME.html +++ b/dev/uu_uname/options/static.KERNELNAME.html @@ -1 +1 @@ -KERNELNAME in uu_uname::options - Rust
pub static KERNELNAME: &'static str
\ No newline at end of file +KERNELNAME in uu_uname::options - Rust
pub static KERNELNAME: &'static str
\ No newline at end of file diff --git a/dev/uu_uname/options/static.KERNELRELEASE.html b/dev/uu_uname/options/static.KERNELRELEASE.html index e4af051b8..d6f152868 100644 --- a/dev/uu_uname/options/static.KERNELRELEASE.html +++ b/dev/uu_uname/options/static.KERNELRELEASE.html @@ -1 +1 @@ -KERNELRELEASE in uu_uname::options - Rust
pub static KERNELRELEASE: &'static str
\ No newline at end of file +KERNELRELEASE in uu_uname::options - Rust
pub static KERNELRELEASE: &'static str
\ No newline at end of file diff --git a/dev/uu_uname/options/static.KERNELVERSION.html b/dev/uu_uname/options/static.KERNELVERSION.html index 0a9b90fc5..195c17dd5 100644 --- a/dev/uu_uname/options/static.KERNELVERSION.html +++ b/dev/uu_uname/options/static.KERNELVERSION.html @@ -1 +1 @@ -KERNELVERSION in uu_uname::options - Rust
pub static KERNELVERSION: &'static str
\ No newline at end of file +KERNELVERSION in uu_uname::options - Rust
pub static KERNELVERSION: &'static str
\ No newline at end of file diff --git a/dev/uu_uname/options/static.MACHINE.html b/dev/uu_uname/options/static.MACHINE.html index 989d77002..468488328 100644 --- a/dev/uu_uname/options/static.MACHINE.html +++ b/dev/uu_uname/options/static.MACHINE.html @@ -1 +1 @@ -MACHINE in uu_uname::options - Rust
pub static MACHINE: &'static str
\ No newline at end of file +MACHINE in uu_uname::options - Rust
pub static MACHINE: &'static str
\ No newline at end of file diff --git a/dev/uu_uname/options/static.NODENAME.html b/dev/uu_uname/options/static.NODENAME.html index 64bc0277f..1e883d418 100644 --- a/dev/uu_uname/options/static.NODENAME.html +++ b/dev/uu_uname/options/static.NODENAME.html @@ -1 +1 @@ -NODENAME in uu_uname::options - Rust
pub static NODENAME: &'static str
\ No newline at end of file +NODENAME in uu_uname::options - Rust
pub static NODENAME: &'static str
\ No newline at end of file diff --git a/dev/uu_uname/options/static.OS.html b/dev/uu_uname/options/static.OS.html index 085a473f4..d6fc599f7 100644 --- a/dev/uu_uname/options/static.OS.html +++ b/dev/uu_uname/options/static.OS.html @@ -1 +1 @@ -OS in uu_uname::options - Rust
pub static OS: &'static str
\ No newline at end of file +OS in uu_uname::options - Rust
pub static OS: &'static str
\ No newline at end of file diff --git a/dev/uu_uname/options/static.PROCESSOR.html b/dev/uu_uname/options/static.PROCESSOR.html index c838657de..d4c8b8051 100644 --- a/dev/uu_uname/options/static.PROCESSOR.html +++ b/dev/uu_uname/options/static.PROCESSOR.html @@ -1 +1 @@ -PROCESSOR in uu_uname::options - Rust
pub static PROCESSOR: &'static str
\ No newline at end of file +PROCESSOR in uu_uname::options - Rust
pub static PROCESSOR: &'static str
\ No newline at end of file diff --git a/dev/uu_unexpand/all.html b/dev/uu_unexpand/all.html index 371e1cc60..3c5334888 100644 --- a/dev/uu_unexpand/all.html +++ b/dev/uu_unexpand/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_unexpand/fn.uu_app.html b/dev/uu_unexpand/fn.uu_app.html index e6e31467d..b1334f40d 100644 --- a/dev/uu_unexpand/fn.uu_app.html +++ b/dev/uu_unexpand/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_unexpand - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_unexpand - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_unexpand/fn.uumain.html b/dev/uu_unexpand/fn.uumain.html index 3cb6a191e..34b512803 100644 --- a/dev/uu_unexpand/fn.uumain.html +++ b/dev/uu_unexpand/fn.uumain.html @@ -1 +1 @@ -uumain in uu_unexpand - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_unexpand - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_unexpand/index.html b/dev/uu_unexpand/index.html index 7371379cc..e39ddd5d6 100644 --- a/dev/uu_unexpand/index.html +++ b/dev/uu_unexpand/index.html @@ -1 +1 @@ -uu_unexpand - Rust
\ No newline at end of file +uu_unexpand - Rust
\ No newline at end of file diff --git a/dev/uu_uniq/all.html b/dev/uu_uniq/all.html index cc7222b9e..7458d0d40 100644 --- a/dev/uu_uniq/all.html +++ b/dev/uu_uniq/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_uniq/fn.uu_app.html b/dev/uu_uniq/fn.uu_app.html index 5e9fe9a89..ca1371f6d 100644 --- a/dev/uu_uniq/fn.uu_app.html +++ b/dev/uu_uniq/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_uniq - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_uniq - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_uniq/fn.uumain.html b/dev/uu_uniq/fn.uumain.html index fb074c1bb..7a3463d0a 100644 --- a/dev/uu_uniq/fn.uumain.html +++ b/dev/uu_uniq/fn.uumain.html @@ -1 +1 @@ -uumain in uu_uniq - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_uniq - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_uniq/index.html b/dev/uu_uniq/index.html index ac84bdd24..7fd971b86 100644 --- a/dev/uu_uniq/index.html +++ b/dev/uu_uniq/index.html @@ -1 +1 @@ -uu_uniq - Rust
\ No newline at end of file +uu_uniq - Rust
\ No newline at end of file diff --git a/dev/uu_uniq/options/index.html b/dev/uu_uniq/options/index.html index 3a745f4a9..0502c85e8 100644 --- a/dev/uu_uniq/options/index.html +++ b/dev/uu_uniq/options/index.html @@ -1 +1 @@ -uu_uniq::options - Rust
\ No newline at end of file +uu_uniq::options - Rust
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.ALL_REPEATED.html b/dev/uu_uniq/options/static.ALL_REPEATED.html index 17dde1289..112d0f359 100644 --- a/dev/uu_uniq/options/static.ALL_REPEATED.html +++ b/dev/uu_uniq/options/static.ALL_REPEATED.html @@ -1 +1 @@ -ALL_REPEATED in uu_uniq::options - Rust
pub static ALL_REPEATED: &'static str
\ No newline at end of file +ALL_REPEATED in uu_uniq::options - Rust
pub static ALL_REPEATED: &'static str
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.CHECK_CHARS.html b/dev/uu_uniq/options/static.CHECK_CHARS.html index 3f89d3eee..0708f62f3 100644 --- a/dev/uu_uniq/options/static.CHECK_CHARS.html +++ b/dev/uu_uniq/options/static.CHECK_CHARS.html @@ -1 +1 @@ -CHECK_CHARS in uu_uniq::options - Rust
pub static CHECK_CHARS: &'static str
\ No newline at end of file +CHECK_CHARS in uu_uniq::options - Rust
pub static CHECK_CHARS: &'static str
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.COUNT.html b/dev/uu_uniq/options/static.COUNT.html index 9c120e2ea..929024863 100644 --- a/dev/uu_uniq/options/static.COUNT.html +++ b/dev/uu_uniq/options/static.COUNT.html @@ -1 +1 @@ -COUNT in uu_uniq::options - Rust
pub static COUNT: &'static str
\ No newline at end of file +COUNT in uu_uniq::options - Rust
pub static COUNT: &'static str
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.GROUP.html b/dev/uu_uniq/options/static.GROUP.html index 86bb71a31..1b293568e 100644 --- a/dev/uu_uniq/options/static.GROUP.html +++ b/dev/uu_uniq/options/static.GROUP.html @@ -1 +1 @@ -GROUP in uu_uniq::options - Rust
pub static GROUP: &'static str
\ No newline at end of file +GROUP in uu_uniq::options - Rust
pub static GROUP: &'static str
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.IGNORE_CASE.html b/dev/uu_uniq/options/static.IGNORE_CASE.html index e14058bd2..bf7850edb 100644 --- a/dev/uu_uniq/options/static.IGNORE_CASE.html +++ b/dev/uu_uniq/options/static.IGNORE_CASE.html @@ -1 +1 @@ -IGNORE_CASE in uu_uniq::options - Rust
pub static IGNORE_CASE: &'static str
\ No newline at end of file +IGNORE_CASE in uu_uniq::options - Rust
pub static IGNORE_CASE: &'static str
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.REPEATED.html b/dev/uu_uniq/options/static.REPEATED.html index 96a4e1193..71942fd1f 100644 --- a/dev/uu_uniq/options/static.REPEATED.html +++ b/dev/uu_uniq/options/static.REPEATED.html @@ -1 +1 @@ -REPEATED in uu_uniq::options - Rust
pub static REPEATED: &'static str
\ No newline at end of file +REPEATED in uu_uniq::options - Rust
pub static REPEATED: &'static str
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.SKIP_CHARS.html b/dev/uu_uniq/options/static.SKIP_CHARS.html index 134ab7a06..06b0675ab 100644 --- a/dev/uu_uniq/options/static.SKIP_CHARS.html +++ b/dev/uu_uniq/options/static.SKIP_CHARS.html @@ -1 +1 @@ -SKIP_CHARS in uu_uniq::options - Rust
pub static SKIP_CHARS: &'static str
\ No newline at end of file +SKIP_CHARS in uu_uniq::options - Rust
pub static SKIP_CHARS: &'static str
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.SKIP_FIELDS.html b/dev/uu_uniq/options/static.SKIP_FIELDS.html index 3a8f0a5e3..64a816bc9 100644 --- a/dev/uu_uniq/options/static.SKIP_FIELDS.html +++ b/dev/uu_uniq/options/static.SKIP_FIELDS.html @@ -1 +1 @@ -SKIP_FIELDS in uu_uniq::options - Rust
pub static SKIP_FIELDS: &'static str
\ No newline at end of file +SKIP_FIELDS in uu_uniq::options - Rust
pub static SKIP_FIELDS: &'static str
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.UNIQUE.html b/dev/uu_uniq/options/static.UNIQUE.html index 7fd5142c8..8f785e3c5 100644 --- a/dev/uu_uniq/options/static.UNIQUE.html +++ b/dev/uu_uniq/options/static.UNIQUE.html @@ -1 +1 @@ -UNIQUE in uu_uniq::options - Rust
pub static UNIQUE: &'static str
\ No newline at end of file +UNIQUE in uu_uniq::options - Rust
pub static UNIQUE: &'static str
\ No newline at end of file diff --git a/dev/uu_uniq/options/static.ZERO_TERMINATED.html b/dev/uu_uniq/options/static.ZERO_TERMINATED.html index bb737d788..f24d2b52e 100644 --- a/dev/uu_uniq/options/static.ZERO_TERMINATED.html +++ b/dev/uu_uniq/options/static.ZERO_TERMINATED.html @@ -1 +1 @@ -ZERO_TERMINATED in uu_uniq::options - Rust
pub static ZERO_TERMINATED: &'static str
\ No newline at end of file +ZERO_TERMINATED in uu_uniq::options - Rust
pub static ZERO_TERMINATED: &'static str
\ No newline at end of file diff --git a/dev/uu_unlink/all.html b/dev/uu_unlink/all.html index 51ee931fd..05530e57b 100644 --- a/dev/uu_unlink/all.html +++ b/dev/uu_unlink/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_unlink/fn.uu_app.html b/dev/uu_unlink/fn.uu_app.html index ff1d0d79c..360b131cf 100644 --- a/dev/uu_unlink/fn.uu_app.html +++ b/dev/uu_unlink/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_unlink - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_unlink - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_unlink/fn.uumain.html b/dev/uu_unlink/fn.uumain.html index 131397aa7..b3445c9f5 100644 --- a/dev/uu_unlink/fn.uumain.html +++ b/dev/uu_unlink/fn.uumain.html @@ -1 +1 @@ -uumain in uu_unlink - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_unlink - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_unlink/index.html b/dev/uu_unlink/index.html index 875094b4d..1ab6fe76c 100644 --- a/dev/uu_unlink/index.html +++ b/dev/uu_unlink/index.html @@ -1 +1 @@ -uu_unlink - Rust
\ No newline at end of file +uu_unlink - Rust
\ No newline at end of file diff --git a/dev/uu_uptime/all.html b/dev/uu_uptime/all.html index 5fa555870..0e451f5be 100644 --- a/dev/uu_uptime/all.html +++ b/dev/uu_uptime/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

Statics

\ No newline at end of file +List of all items in this crate

List of all items

Functions

Statics

\ No newline at end of file diff --git a/dev/uu_uptime/fn.uu_app.html b/dev/uu_uptime/fn.uu_app.html index 77027054b..a3d71bd0a 100644 --- a/dev/uu_uptime/fn.uu_app.html +++ b/dev/uu_uptime/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_uptime - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_uptime - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_uptime/fn.uumain.html b/dev/uu_uptime/fn.uumain.html index 56c7193b5..e788932ad 100644 --- a/dev/uu_uptime/fn.uumain.html +++ b/dev/uu_uptime/fn.uumain.html @@ -1 +1 @@ -uumain in uu_uptime - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_uptime - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_uptime/index.html b/dev/uu_uptime/index.html index bf845d3e3..ad0a2fb4a 100644 --- a/dev/uu_uptime/index.html +++ b/dev/uu_uptime/index.html @@ -1 +1 @@ -uu_uptime - Rust
\ No newline at end of file +uu_uptime - Rust
\ No newline at end of file diff --git a/dev/uu_uptime/options/index.html b/dev/uu_uptime/options/index.html index ae75c19f2..dab314ace 100644 --- a/dev/uu_uptime/options/index.html +++ b/dev/uu_uptime/options/index.html @@ -1 +1 @@ -uu_uptime::options - Rust
\ No newline at end of file +uu_uptime::options - Rust
\ No newline at end of file diff --git a/dev/uu_uptime/options/static.SINCE.html b/dev/uu_uptime/options/static.SINCE.html index 5efb6578b..05e9cc629 100644 --- a/dev/uu_uptime/options/static.SINCE.html +++ b/dev/uu_uptime/options/static.SINCE.html @@ -1 +1 @@ -SINCE in uu_uptime::options - Rust
pub static SINCE: &'static str
\ No newline at end of file +SINCE in uu_uptime::options - Rust
pub static SINCE: &'static str
\ No newline at end of file diff --git a/dev/uu_users/all.html b/dev/uu_users/all.html index f928ef0d3..5226f2dc0 100644 --- a/dev/uu_users/all.html +++ b/dev/uu_users/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_users/fn.uu_app.html b/dev/uu_users/fn.uu_app.html index 4723ae2a7..4036818d0 100644 --- a/dev/uu_users/fn.uu_app.html +++ b/dev/uu_users/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_users - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_users - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_users/fn.uumain.html b/dev/uu_users/fn.uumain.html index fdd1e140d..4edd8fb27 100644 --- a/dev/uu_users/fn.uumain.html +++ b/dev/uu_users/fn.uumain.html @@ -1 +1 @@ -uumain in uu_users - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_users - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_users/index.html b/dev/uu_users/index.html index aefc5dcae..2bd01f91e 100644 --- a/dev/uu_users/index.html +++ b/dev/uu_users/index.html @@ -1 +1 @@ -uu_users - Rust
\ No newline at end of file +uu_users - Rust
\ No newline at end of file diff --git a/dev/uu_vdir/all.html b/dev/uu_vdir/all.html index a8d4041f1..01089fb09 100644 --- a/dev/uu_vdir/all.html +++ b/dev/uu_vdir/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_vdir/fn.uu_app.html b/dev/uu_vdir/fn.uu_app.html index 4c8873b4c..32664f92c 100644 --- a/dev/uu_vdir/fn.uu_app.html +++ b/dev/uu_vdir/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_vdir - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_vdir - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_vdir/fn.uumain.html b/dev/uu_vdir/fn.uumain.html index 99668395e..baaff9b2e 100644 --- a/dev/uu_vdir/fn.uumain.html +++ b/dev/uu_vdir/fn.uumain.html @@ -1 +1 @@ -uumain in uu_vdir - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_vdir - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_vdir/index.html b/dev/uu_vdir/index.html index d1e977048..21aa9a3f0 100644 --- a/dev/uu_vdir/index.html +++ b/dev/uu_vdir/index.html @@ -1 +1 @@ -uu_vdir - Rust
\ No newline at end of file +uu_vdir - Rust
\ No newline at end of file diff --git a/dev/uu_wc/all.html b/dev/uu_wc/all.html index d621b6e6b..2b7c021b5 100644 --- a/dev/uu_wc/all.html +++ b/dev/uu_wc/all.html @@ -1 +1 @@ -List of all items in this crate
\ No newline at end of file +List of all items in this crate
\ No newline at end of file diff --git a/dev/uu_wc/fn.uu_app.html b/dev/uu_wc/fn.uu_app.html index aaa559191..e3e02aff4 100644 --- a/dev/uu_wc/fn.uu_app.html +++ b/dev/uu_wc/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_wc - Rust

Function uu_wc::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_wc - Rust

Function uu_wc::uu_app

source · []
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_wc/fn.uumain.html b/dev/uu_wc/fn.uumain.html index 88a5d5f12..05c14738d 100644 --- a/dev/uu_wc/fn.uumain.html +++ b/dev/uu_wc/fn.uumain.html @@ -1 +1 @@ -uumain in uu_wc - Rust

Function uu_wc::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_wc - Rust

Function uu_wc::uumain

source · []
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_wc/index.html b/dev/uu_wc/index.html index 073d79317..d1e1b5652 100644 --- a/dev/uu_wc/index.html +++ b/dev/uu_wc/index.html @@ -1 +1 @@ -uu_wc - Rust
\ No newline at end of file +uu_wc - Rust
\ No newline at end of file diff --git a/dev/uu_wc/options/index.html b/dev/uu_wc/options/index.html index 17cfb3d7d..39480c8ae 100644 --- a/dev/uu_wc/options/index.html +++ b/dev/uu_wc/options/index.html @@ -1 +1 @@ -uu_wc::options - Rust
\ No newline at end of file +uu_wc::options - Rust
\ No newline at end of file diff --git a/dev/uu_wc/options/static.BYTES.html b/dev/uu_wc/options/static.BYTES.html index b61a4dd60..a5a40e992 100644 --- a/dev/uu_wc/options/static.BYTES.html +++ b/dev/uu_wc/options/static.BYTES.html @@ -1 +1 @@ -BYTES in uu_wc::options - Rust
pub static BYTES: &'static str
\ No newline at end of file +BYTES in uu_wc::options - Rust
pub static BYTES: &'static str
\ No newline at end of file diff --git a/dev/uu_wc/options/static.CHAR.html b/dev/uu_wc/options/static.CHAR.html index dae428b78..2ca1d83ea 100644 --- a/dev/uu_wc/options/static.CHAR.html +++ b/dev/uu_wc/options/static.CHAR.html @@ -1 +1 @@ -CHAR in uu_wc::options - Rust
pub static CHAR: &'static str
\ No newline at end of file +CHAR in uu_wc::options - Rust
pub static CHAR: &'static str
\ No newline at end of file diff --git a/dev/uu_wc/options/static.FILES0_FROM.html b/dev/uu_wc/options/static.FILES0_FROM.html index 4d087061c..7b1ebd595 100644 --- a/dev/uu_wc/options/static.FILES0_FROM.html +++ b/dev/uu_wc/options/static.FILES0_FROM.html @@ -1 +1 @@ -FILES0_FROM in uu_wc::options - Rust
pub static FILES0_FROM: &'static str
\ No newline at end of file +FILES0_FROM in uu_wc::options - Rust
pub static FILES0_FROM: &'static str
\ No newline at end of file diff --git a/dev/uu_wc/options/static.LINES.html b/dev/uu_wc/options/static.LINES.html index 3ae057763..c27c6d7a8 100644 --- a/dev/uu_wc/options/static.LINES.html +++ b/dev/uu_wc/options/static.LINES.html @@ -1 +1 @@ -LINES in uu_wc::options - Rust
pub static LINES: &'static str
\ No newline at end of file +LINES in uu_wc::options - Rust
pub static LINES: &'static str
\ No newline at end of file diff --git a/dev/uu_wc/options/static.MAX_LINE_LENGTH.html b/dev/uu_wc/options/static.MAX_LINE_LENGTH.html index 5495efcf7..040f5d1de 100644 --- a/dev/uu_wc/options/static.MAX_LINE_LENGTH.html +++ b/dev/uu_wc/options/static.MAX_LINE_LENGTH.html @@ -1 +1 @@ -MAX_LINE_LENGTH in uu_wc::options - Rust
pub static MAX_LINE_LENGTH: &'static str
\ No newline at end of file +MAX_LINE_LENGTH in uu_wc::options - Rust
pub static MAX_LINE_LENGTH: &'static str
\ No newline at end of file diff --git a/dev/uu_wc/options/static.WORDS.html b/dev/uu_wc/options/static.WORDS.html index 9b6c3489f..604f02d7c 100644 --- a/dev/uu_wc/options/static.WORDS.html +++ b/dev/uu_wc/options/static.WORDS.html @@ -1 +1 @@ -WORDS in uu_wc::options - Rust
pub static WORDS: &'static str
\ No newline at end of file +WORDS in uu_wc::options - Rust
pub static WORDS: &'static str
\ No newline at end of file diff --git a/dev/uu_who/all.html b/dev/uu_who/all.html index 98e2c2e59..29ba4b9e5 100644 --- a/dev/uu_who/all.html +++ b/dev/uu_who/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_who/fn.uu_app.html b/dev/uu_who/fn.uu_app.html index 5ab4c2828..196cd1df1 100644 --- a/dev/uu_who/fn.uu_app.html +++ b/dev/uu_who/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_who - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_who - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_who/fn.uumain.html b/dev/uu_who/fn.uumain.html index 73bb2e286..5cb207af3 100644 --- a/dev/uu_who/fn.uumain.html +++ b/dev/uu_who/fn.uumain.html @@ -1 +1 @@ -uumain in uu_who - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_who - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_who/index.html b/dev/uu_who/index.html index c072cdb5e..45cf5f32a 100644 --- a/dev/uu_who/index.html +++ b/dev/uu_who/index.html @@ -1 +1 @@ -uu_who - Rust
\ No newline at end of file +uu_who - Rust
\ No newline at end of file diff --git a/dev/uu_whoami/all.html b/dev/uu_whoami/all.html index 8e9c6aeec..da21ff018 100644 --- a/dev/uu_whoami/all.html +++ b/dev/uu_whoami/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_whoami/fn.uu_app.html b/dev/uu_whoami/fn.uu_app.html index b82332e84..0319cc5b1 100644 --- a/dev/uu_whoami/fn.uu_app.html +++ b/dev/uu_whoami/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_whoami - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_whoami - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_whoami/fn.uumain.html b/dev/uu_whoami/fn.uumain.html index d165de68a..88802adf1 100644 --- a/dev/uu_whoami/fn.uumain.html +++ b/dev/uu_whoami/fn.uumain.html @@ -1 +1 @@ -uumain in uu_whoami - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_whoami - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_whoami/index.html b/dev/uu_whoami/index.html index 48664f873..2231244d4 100644 --- a/dev/uu_whoami/index.html +++ b/dev/uu_whoami/index.html @@ -1 +1 @@ -uu_whoami - Rust
\ No newline at end of file +uu_whoami - Rust
\ No newline at end of file diff --git a/dev/uu_yes/all.html b/dev/uu_yes/all.html index bb481e4e0..7ee2b4d1f 100644 --- a/dev/uu_yes/all.html +++ b/dev/uu_yes/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Functions

\ No newline at end of file +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/dev/uu_yes/fn.exec.html b/dev/uu_yes/fn.exec.html index e63b1da35..60a2919bb 100644 --- a/dev/uu_yes/fn.exec.html +++ b/dev/uu_yes/fn.exec.html @@ -1 +1 @@ -exec in uu_yes - Rust

Function uu_yes::exec

source · []
pub fn exec(bytes: &[u8]) -> Result<()>
\ No newline at end of file +exec in uu_yes - Rust

Function uu_yes::exec

source · []
pub fn exec(bytes: &[u8]) -> Result<()>
\ No newline at end of file diff --git a/dev/uu_yes/fn.uu_app.html b/dev/uu_yes/fn.uu_app.html index 0549f14a7..193e59fc2 100644 --- a/dev/uu_yes/fn.uu_app.html +++ b/dev/uu_yes/fn.uu_app.html @@ -1 +1 @@ -uu_app in uu_yes - Rust
pub fn uu_app() -> Command
\ No newline at end of file +uu_app in uu_yes - Rust
pub fn uu_app() -> Command
\ No newline at end of file diff --git a/dev/uu_yes/fn.uumain.html b/dev/uu_yes/fn.uumain.html index 2deb2e7ab..63495301e 100644 --- a/dev/uu_yes/fn.uumain.html +++ b/dev/uu_yes/fn.uumain.html @@ -1 +1 @@ -uumain in uu_yes - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file +uumain in uu_yes - Rust
pub fn uumain(args: impl Args) -> i32
\ No newline at end of file diff --git a/dev/uu_yes/index.html b/dev/uu_yes/index.html index c1a76a38f..c4fb9ca44 100644 --- a/dev/uu_yes/index.html +++ b/dev/uu_yes/index.html @@ -1 +1 @@ -uu_yes - Rust
\ No newline at end of file +uu_yes - Rust
\ No newline at end of file diff --git a/dev/uucore/all.html b/dev/uucore/all.html index 4ac1f3492..cd647b033 100644 --- a/dev/uucore/all.html +++ b/dev/uucore/all.html @@ -1 +1 @@ -List of all items in this crate

List of all items

Structs

Enums

Traits

Macros

Attribute Macros

Functions

Typedefs

Statics

Constants

\ No newline at end of file +List of all items in this crate

List of all items

Structs

Enums

Traits

Macros

Attribute Macros

Functions

Typedefs

Statics

Constants

\ No newline at end of file diff --git a/dev/uucore/attr.main.html b/dev/uucore/attr.main.html index 1e1994610..0e7d50058 100644 --- a/dev/uucore/attr.main.html +++ b/dev/uucore/attr.main.html @@ -1 +1 @@ -main in uucore - Rust

Attribute Macro uucore::main

source · []
#[main]
\ No newline at end of file +main in uucore - Rust

Attribute Macro uucore::main

source · []
#[main]
\ No newline at end of file diff --git a/dev/uucore/backup_control/arguments/fn.backup.html b/dev/uucore/backup_control/arguments/fn.backup.html index 7e31bbce9..621cdf4f3 100644 --- a/dev/uucore/backup_control/arguments/fn.backup.html +++ b/dev/uucore/backup_control/arguments/fn.backup.html @@ -1,2 +1,2 @@ -backup in uucore::backup_control::arguments - Rust
pub fn backup() -> Arg
Expand description

‘–backup’ argument

-
\ No newline at end of file +backup in uucore::backup_control::arguments - Rust
pub fn backup() -> Arg
Expand description

‘–backup’ argument

+
\ No newline at end of file diff --git a/dev/uucore/backup_control/arguments/fn.backup_no_args.html b/dev/uucore/backup_control/arguments/fn.backup_no_args.html index eafa74759..4158d58df 100644 --- a/dev/uucore/backup_control/arguments/fn.backup_no_args.html +++ b/dev/uucore/backup_control/arguments/fn.backup_no_args.html @@ -1,2 +1,2 @@ -backup_no_args in uucore::backup_control::arguments - Rust
pub fn backup_no_args() -> Arg
Expand description

‘-b’ argument

-
\ No newline at end of file +backup_no_args in uucore::backup_control::arguments - Rust
pub fn backup_no_args() -> Arg
Expand description

‘-b’ argument

+
\ No newline at end of file diff --git a/dev/uucore/backup_control/arguments/fn.suffix.html b/dev/uucore/backup_control/arguments/fn.suffix.html index c696a92ca..8705e3652 100644 --- a/dev/uucore/backup_control/arguments/fn.suffix.html +++ b/dev/uucore/backup_control/arguments/fn.suffix.html @@ -1,2 +1,2 @@ -suffix in uucore::backup_control::arguments - Rust
pub fn suffix() -> Arg
Expand description

‘-S, –suffix’ argument

-
\ No newline at end of file +suffix in uucore::backup_control::arguments - Rust
pub fn suffix() -> Arg
Expand description

‘-S, –suffix’ argument

+
\ No newline at end of file diff --git a/dev/uucore/backup_control/arguments/index.html b/dev/uucore/backup_control/arguments/index.html index ad81dab6f..5f1b87f49 100644 --- a/dev/uucore/backup_control/arguments/index.html +++ b/dev/uucore/backup_control/arguments/index.html @@ -1,9 +1,6 @@ -uucore::backup_control::arguments - Rust
Expand description

Arguments for backup-related functionality.

+uucore::backup_control::arguments - Rust
Expand description

Arguments for backup-related functionality.

Rather than implementing the clap-Arguments for every utility, it is recommended to include the clap arguments via the functions provided here. This way the backup-specific arguments are handled uniformly across utilities and can be maintained in one central place.

-

Statics

Functions

‘–backup’ argument

-

‘-b’ argument

-

‘-S, –suffix’ argument

-
\ No newline at end of file +

Statics

Functions

‘–backup’ argument
‘-b’ argument
‘-S, –suffix’ argument
\ No newline at end of file diff --git a/dev/uucore/backup_control/arguments/static.OPT_BACKUP.html b/dev/uucore/backup_control/arguments/static.OPT_BACKUP.html index 800e0e986..e65dc843a 100644 --- a/dev/uucore/backup_control/arguments/static.OPT_BACKUP.html +++ b/dev/uucore/backup_control/arguments/static.OPT_BACKUP.html @@ -1 +1 @@ -OPT_BACKUP in uucore::backup_control::arguments - Rust
pub static OPT_BACKUP: &'static str
\ No newline at end of file +OPT_BACKUP in uucore::backup_control::arguments - Rust
pub static OPT_BACKUP: &'static str
\ No newline at end of file diff --git a/dev/uucore/backup_control/arguments/static.OPT_BACKUP_NO_ARG.html b/dev/uucore/backup_control/arguments/static.OPT_BACKUP_NO_ARG.html index dcc6765fe..92be6bbe1 100644 --- a/dev/uucore/backup_control/arguments/static.OPT_BACKUP_NO_ARG.html +++ b/dev/uucore/backup_control/arguments/static.OPT_BACKUP_NO_ARG.html @@ -1 +1 @@ -OPT_BACKUP_NO_ARG in uucore::backup_control::arguments - Rust
pub static OPT_BACKUP_NO_ARG: &'static str
\ No newline at end of file +OPT_BACKUP_NO_ARG in uucore::backup_control::arguments - Rust
pub static OPT_BACKUP_NO_ARG: &'static str
\ No newline at end of file diff --git a/dev/uucore/backup_control/arguments/static.OPT_SUFFIX.html b/dev/uucore/backup_control/arguments/static.OPT_SUFFIX.html index 2a6680991..1e682cdc0 100644 --- a/dev/uucore/backup_control/arguments/static.OPT_SUFFIX.html +++ b/dev/uucore/backup_control/arguments/static.OPT_SUFFIX.html @@ -1 +1 @@ -OPT_SUFFIX in uucore::backup_control::arguments - Rust
pub static OPT_SUFFIX: &'static str
\ No newline at end of file +OPT_SUFFIX in uucore::backup_control::arguments - Rust
pub static OPT_SUFFIX: &'static str
\ No newline at end of file diff --git a/dev/uucore/backup_control/constant.BACKUP_CONTROL_LONG_HELP.html b/dev/uucore/backup_control/constant.BACKUP_CONTROL_LONG_HELP.html index f0a171c11..0a3670cd1 100644 --- a/dev/uucore/backup_control/constant.BACKUP_CONTROL_LONG_HELP.html +++ b/dev/uucore/backup_control/constant.BACKUP_CONTROL_LONG_HELP.html @@ -1,8 +1,8 @@ -BACKUP_CONTROL_LONG_HELP in uucore::backup_control - Rust
pub const BACKUP_CONTROL_LONG_HELP: &'static str = "The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
+BACKUP_CONTROL_LONG_HELP in uucore::backup_control - Rust
pub const BACKUP_CONTROL_LONG_HELP: &'static str = "The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
 The version control method may be selected via the --backup option or through
 the VERSION_CONTROL environment variable.  Here are the values:
 
   none, off       never make backups (even if --backup is given)
   numbered, t     make numbered backups
   existing, nil   numbered if numbered backups exist, simple otherwise
-  simple, never   always make simple backups";
\ No newline at end of file + simple, never always make simple backups";
\ No newline at end of file diff --git a/dev/uucore/backup_control/enum.BackupError.html b/dev/uucore/backup_control/enum.BackupError.html index 951224068..974257d7e 100644 --- a/dev/uucore/backup_control/enum.BackupError.html +++ b/dev/uucore/backup_control/enum.BackupError.html @@ -1,38 +1,24 @@ -BackupError in uucore::backup_control - Rust
pub enum BackupError {
-    InvalidArgument(StringString),
-    AmbiguousArgument(StringString),
+BackupError in uucore::backup_control - Rust
pub enum BackupError {
+    InvalidArgument(StringString),
+    AmbiguousArgument(StringString),
     BackupImpossible(),
 }
Expand description

Backup error types.

Errors are currently raised by determine_backup_mode only. All errors are implemented as UError for uniform handling across utilities.

-

Variants

InvalidArgument(StringString)

An invalid argument (e.g. ‘foo’) was given as backup type. First +

Variants

InvalidArgument(StringString)

An invalid argument (e.g. ‘foo’) was given as backup type. First parameter is the argument, second is the arguments origin (CLI or ENV-var)

-

AmbiguousArgument(StringString)

An ambiguous argument (e.g. ‘n’) was given as backup type. First +

AmbiguousArgument(StringString)

An ambiguous argument (e.g. ‘n’) was given as backup type. First parameter is the argument, second is the arguments origin (CLI or ENV-var)

BackupImpossible()

Currently unused

-

Trait Implementations

Formats the value using the given formatter. Read more

-

Formats the value using the given formatter. Read more

-

The lower-level source of this error, if any. Read more

-
👎 Deprecated since 1.42.0:

use the Display impl or to_string()

-
👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

-
🔬 This is a nightly-only experimental API. (error_generic_member_access)

Provides type based access to context intended for error reports. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Error code of a custom error. Read more

-

Print usage help to a custom error. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0:

use the Display impl or to_string()

+
👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

+
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more
Error code of a custom error. Read more
Print usage help to a custom error. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

Converts the given value to a String. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uucore/backup_control/enum.BackupMode.html b/dev/uucore/backup_control/enum.BackupMode.html index 7f1931b85..6f635259f 100644 --- a/dev/uucore/backup_control/enum.BackupMode.html +++ b/dev/uucore/backup_control/enum.BackupMode.html @@ -1,4 +1,4 @@ -BackupMode in uucore::backup_control - Rust
pub enum BackupMode {
+BackupMode in uucore::backup_control - Rust
pub enum BackupMode {
     NoBackup,
     SimpleBackup,
     NumberedBackup,
@@ -10,24 +10,10 @@ enum variants.

SimpleBackup

Argument ‘simple’, ‘never’

NumberedBackup

Argument ‘numbered’, ‘t’

ExistingBackup

Argument ‘existing’, ‘nil’

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

This method tests for self and other values to be equal, and is used -by ==. Read more

-

This method tests for !=.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used +by ==. Read more
This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uucore/backup_control/fn.determine_backup_mode.html b/dev/uucore/backup_control/fn.determine_backup_mode.html index fd28caa5a..a7b4e3f14 100644 --- a/dev/uucore/backup_control/fn.determine_backup_mode.html +++ b/dev/uucore/backup_control/fn.determine_backup_mode.html @@ -1,4 +1,4 @@ -determine_backup_mode in uucore::backup_control - Rust
pub fn determine_backup_mode(matches: &ArgMatches) -> UResult<BackupMode>
Expand description

Determine the “mode” for the backup operation to perform, if any.

+determine_backup_mode in uucore::backup_control - Rust
pub fn determine_backup_mode(matches: &ArgMatches) -> UResult<BackupMode>
Expand description

Determine the “mode” for the backup operation to perform, if any.

Parses the backup options according to the GNU manual, and converts them to an instance of BackupMode for further processing.

Takes [clap::ArgMatches] as argument which must contain the options @@ -16,44 +16,44 @@ multiple backup modes) or invalid, an

#[macro_use]
-extern crate uucore;
-use uucore::backup_control::{self, BackupMode};
-use clap::{Command, Arg, ArgMatches};
+
#[macro_use]
+extern crate uucore;
+use uucore::backup_control::{self, BackupMode};
+use clap::{Command, Arg, ArgMatches};
 
-fn main() {
-    let matches = Command::new("command")
-        .arg(backup_control::arguments::backup())
-        .arg(backup_control::arguments::backup_no_args())
-        .get_matches_from(vec![
-            "command", "-b", "--backup=t"
-        ]);
+fn main() {
+    let matches = Command::new("command")
+        .arg(backup_control::arguments::backup())
+        .arg(backup_control::arguments::backup_no_args())
+        .get_matches_from(vec![
+            "command", "-b", "--backup=t"
+        ]);
 
-    let backup_mode = backup_control::determine_backup_mode(&matches).unwrap();
-    assert_eq!(backup_mode, BackupMode::NumberedBackup)
+    let backup_mode = backup_control::determine_backup_mode(&matches).unwrap();
+    assert_eq!(backup_mode, BackupMode::NumberedBackup)
 }

This example shows an ambiguous input, as ‘n’ may resolve to 4 different backup modes.

-
#[macro_use]
-extern crate uucore;
-use uucore::backup_control::{self, BackupMode, BackupError};
-use clap::{Command, Arg, ArgMatches};
+
#[macro_use]
+extern crate uucore;
+use uucore::backup_control::{self, BackupMode, BackupError};
+use clap::{Command, Arg, ArgMatches};
 
-fn main() {
-    let matches = Command::new("command")
-        .arg(backup_control::arguments::backup())
-        .arg(backup_control::arguments::backup_no_args())
-        .get_matches_from(vec![
-            "command", "-b", "--backup=n"
-        ]);
+fn main() {
+    let matches = Command::new("command")
+        .arg(backup_control::arguments::backup())
+        .arg(backup_control::arguments::backup_no_args())
+        .get_matches_from(vec![
+            "command", "-b", "--backup=n"
+        ]);
 
-    let backup_mode = backup_control::determine_backup_mode(&matches);
+    let backup_mode = backup_control::determine_backup_mode(&matches);
 
-    assert!(backup_mode.is_err());
-    let err = backup_mode.unwrap_err();
-    // assert_eq!(err, BackupError::AmbiguousArgument);
-    // Use uucore functionality to show the error to the user
-    show!(err);
+    assert!(backup_mode.is_err());
+    let err = backup_mode.unwrap_err();
+    // assert_eq!(err, BackupError::AmbiguousArgument);
+    // Use uucore functionality to show the error to the user
+    show!(err);
 }
-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uucore/backup_control/fn.determine_backup_suffix.html b/dev/uucore/backup_control/fn.determine_backup_suffix.html index e1bcd80f7..1f83fc2de 100644 --- a/dev/uucore/backup_control/fn.determine_backup_suffix.html +++ b/dev/uucore/backup_control/fn.determine_backup_suffix.html @@ -1,4 +1,4 @@ -determine_backup_suffix in uucore::backup_control - Rust
pub fn determine_backup_suffix(matches: &ArgMatches) -> String
Expand description

Obtain the suffix to use for a backup.

+determine_backup_suffix in uucore::backup_control - Rust
pub fn determine_backup_suffix(matches: &ArgMatches) -> String
Expand description

Obtain the suffix to use for a backup.

In order of precedence, this function obtains the backup suffix

  1. From the ‘-S’ or ‘–suffix’ CLI argument, if present
  2. @@ -7,4 +7,4 @@

This function directly takes [clap::ArgMatches] as argument and looks for the ‘-S’ and ‘–suffix’ arguments itself.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uucore/backup_control/fn.get_backup_path.html b/dev/uucore/backup_control/fn.get_backup_path.html index 09d6b15fe..db4d54996 100644 --- a/dev/uucore/backup_control/fn.get_backup_path.html +++ b/dev/uucore/backup_control/fn.get_backup_path.html @@ -1 +1 @@ -get_backup_path in uucore::backup_control - Rust
pub fn get_backup_path(
    backup_mode: BackupMode,
    backup_path: &Path,
    suffix: &str
) -> Option<PathBuf>
\ No newline at end of file +get_backup_path in uucore::backup_control - Rust
pub fn get_backup_path(
    backup_mode: BackupMode,
    backup_path: &Path,
    suffix: &str
) -> Option<PathBuf>
\ No newline at end of file diff --git a/dev/uucore/backup_control/index.html b/dev/uucore/backup_control/index.html index 528587b32..067762c43 100644 --- a/dev/uucore/backup_control/index.html +++ b/dev/uucore/backup_control/index.html @@ -1,4 +1,4 @@ -uucore::backup_control - Rust
Expand description

Implement GNU-style backup functionality.

+uucore::backup_control - Rust
Expand description

Implement GNU-style backup functionality.

This module implements the backup functionality as described in the GNU manual. It provides

    @@ -18,52 +18,47 @@ implement backups
  • mv

Usage example

-
#[macro_use]
-extern crate uucore;
+
#[macro_use]
+extern crate uucore;
 
-use clap::{Command, Arg, ArgMatches};
-use std::path::{Path, PathBuf};
-use uucore::backup_control::{self, BackupMode};
-use uucore::error::{UError, UResult};
+use clap::{Command, Arg, ArgMatches};
+use std::path::{Path, PathBuf};
+use uucore::backup_control::{self, BackupMode};
+use uucore::error::{UError, UResult};
 
-fn main() {
-    let usage = String::from("command [OPTION]... ARG");
-    let long_usage = String::from("And here's a detailed explanation");
+fn main() {
+    let usage = String::from("command [OPTION]... ARG");
+    let long_usage = String::from("And here's a detailed explanation");
 
-    let matches = Command::new("command")
-        .arg(backup_control::arguments::backup())
-        .arg(backup_control::arguments::backup_no_args())
-        .arg(backup_control::arguments::suffix())
-        .override_usage(usage)
-        .after_help(format!(
+    let matches = Command::new("command")
+        .arg(backup_control::arguments::backup())
+        .arg(backup_control::arguments::backup_no_args())
+        .arg(backup_control::arguments::suffix())
+        .override_usage(usage)
+        .after_help(format!(
             "{}\n{}",
-            long_usage,
-            backup_control::BACKUP_CONTROL_LONG_HELP
+            long_usage,
+            backup_control::BACKUP_CONTROL_LONG_HELP
         ))
-        .get_matches_from(vec![
-            "command", "--backup=t", "--suffix=bak~"
-        ]);
+        .get_matches_from(vec![
+            "command", "--backup=t", "--suffix=bak~"
+        ]);
 
-    let backup_mode = match backup_control::determine_backup_mode(&matches) {
-        Err(e) => {
-            show!(e);
+    let backup_mode = match backup_control::determine_backup_mode(&matches) {
+        Err(e) => {
+            show!(e);
             return;
         },
-        Ok(mode) => mode,
+        Ok(mode) => mode,
     };
-    let backup_suffix = backup_control::determine_backup_suffix(&matches);
-    let target_path = Path::new("/tmp/example");
+    let backup_suffix = backup_control::determine_backup_suffix(&matches);
+    let target_path = Path::new("/tmp/example");
 
-    let backup_path = backup_control::get_backup_path(
-        backup_mode, target_path, &backup_suffix
+    let backup_path = backup_control::get_backup_path(
+        backup_mode, target_path, &backup_suffix
     );
 
-    // Perform your backups here.
+    // Perform your backups here.
 
-}
-

Modules

Arguments for backup-related functionality.

-

Enums

Backup error types.

-

Available backup modes.

-

Constants

Statics

Functions

Determine the “mode” for the backup operation to perform, if any.

-

Obtain the suffix to use for a backup.

-
\ No newline at end of file +}
+

Modules

Arguments for backup-related functionality.

Enums

Backup error types.
Available backup modes.

Constants

Statics

Functions

Determine the “mode” for the backup operation to perform, if any.
Obtain the suffix to use for a backup.
\ No newline at end of file diff --git a/dev/uucore/backup_control/static.BACKUP_CONTROL_VALUES.html b/dev/uucore/backup_control/static.BACKUP_CONTROL_VALUES.html index a0c2e5315..140c28cff 100644 --- a/dev/uucore/backup_control/static.BACKUP_CONTROL_VALUES.html +++ b/dev/uucore/backup_control/static.BACKUP_CONTROL_VALUES.html @@ -1 +1 @@ -BACKUP_CONTROL_VALUES in uucore::backup_control - Rust
pub static BACKUP_CONTROL_VALUES: &'static [&'static str]
\ No newline at end of file +BACKUP_CONTROL_VALUES in uucore::backup_control - Rust
pub static BACKUP_CONTROL_VALUES: &'static [&'static str]
\ No newline at end of file diff --git a/dev/uucore/display/fn.print_verbatim.html b/dev/uucore/display/fn.print_verbatim.html index 6fb0070d0..afe8068aa 100644 --- a/dev/uucore/display/fn.print_verbatim.html +++ b/dev/uucore/display/fn.print_verbatim.html @@ -1,2 +1,2 @@ -print_verbatim in uucore::display - Rust
pub fn print_verbatim<S: AsRef<OsStr>>(text: S) -> Result<()>
Expand description

Like println_verbatim, without the trailing newline.

-
\ No newline at end of file +print_verbatim in uucore::display - Rust
pub fn print_verbatim<S: AsRef<OsStr>>(text: S) -> Result<()>
Expand description

Like println_verbatim, without the trailing newline.

+
\ No newline at end of file diff --git a/dev/uucore/display/fn.println_verbatim.html b/dev/uucore/display/fn.println_verbatim.html index c4b792cbd..f96495edf 100644 --- a/dev/uucore/display/fn.println_verbatim.html +++ b/dev/uucore/display/fn.println_verbatim.html @@ -1,4 +1,4 @@ -println_verbatim in uucore::display - Rust
pub fn println_verbatim<S: AsRef<OsStr>>(text: S) -> Result<()>
Expand description

Print a path (or OsStr-like object) directly to stdout, with a trailing newline, +println_verbatim in uucore::display - Rust

pub fn println_verbatim<S: AsRef<OsStr>>(text: S) -> Result<()>
Expand description

Print a path (or OsStr-like object) directly to stdout, with a trailing newline, without losing any information if its encoding is invalid.

This function is appropriate for commands where printing paths is the point and the output is likely to be captured, like pwd and basename. For informational output @@ -6,4 +6,4 @@ use Quotable::quote.

FIXME: This is lossy on Windows. It could probably be implemented using some low-level API that takes UTF-16, without going through io::Write. This is not a big priority because broken filenames are much rarer on Windows than on Unix.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uucore/display/index.html b/dev/uucore/display/index.html index d69ce6f14..24ea1aac0 100644 --- a/dev/uucore/display/index.html +++ b/dev/uucore/display/index.html @@ -1,6 +1,2 @@ -uucore::display - Rust

Structs

A wrapper around string types for displaying with quoting and escaping applied.

-

Traits

An extension trait to apply quoting to strings.

-

Functions

Like println_verbatim, without the trailing newline.

-

Print a path (or OsStr-like object) directly to stdout, with a trailing newline, -without losing any information if its encoding is invalid.

-
\ No newline at end of file +uucore::display - Rust

Structs

A wrapper around string types for displaying with quoting and escaping applied.

Traits

An extension trait to apply quoting to strings.

Functions

Like println_verbatim, without the trailing newline.
Print a path (or OsStr-like object) directly to stdout, with a trailing newline, +without losing any information if its encoding is invalid.
\ No newline at end of file diff --git a/dev/uucore/display/struct.Quoted.html b/dev/uucore/display/struct.Quoted.html index 40cc2b9e1..3b39e886e 100644 --- a/dev/uucore/display/struct.Quoted.html +++ b/dev/uucore/display/struct.Quoted.html @@ -1,14 +1,14 @@ -Quoted in uucore::display - Rust
pub struct Quoted<'a> { /* private fields */ }
Expand description

A wrapper around string types for displaying with quoting and escaping applied.

-

Implementations

Quote a string with the default style for the platform.

+Quoted in uucore::display - Rust
pub struct Quoted<'a> { /* private fields */ }
Expand description

A wrapper around string types for displaying with quoting and escaping applied.

+

Implementations

Quote a string with the default style for the platform.

On Windows this is PowerShell syntax, on all other platforms this is bash/ksh syntax.

-

Quote an OsStr with the default style for the platform.

+

Quote an OsStr with the default style for the platform.

On platforms other than Windows, Unix and WASI, if the encoding is invalid, the Debug representation will be used.

-

Toggle forced quoting. If true, quotes are added even if no special +

Toggle forced quoting. If true, quotes are added even if no special characters are present.

Defaults to true.

-

When quoting for PowerShell, toggle whether to quote for external programs.

+

When quoting for PowerShell, toggle whether to quote for external programs.

If enabled, double quotes (and sometimes backslashes) will be escaped so that they can be passed to external programs.

If disabled, quoting will suit internal commandlets and .NET functions. @@ -22,24 +22,8 @@ then this setting should be disabled.

Optional

This requires either the windows or the native feature. It has no effect on Unix-style quoting.

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Formats the value using the given formatter. Read more

-

Converts to this type from the input type.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

Converts the given value to a String. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uucore/display/trait.Quotable.html b/dev/uucore/display/trait.Quotable.html index 2ab39f6bc..a3e41667a 100644 --- a/dev/uucore/display/trait.Quotable.html +++ b/dev/uucore/display/trait.Quotable.html @@ -1,30 +1,30 @@ -Quotable in uucore::display - Rust
pub trait Quotable {
+Quotable in uucore::display - Rust
pub trait Quotable {
     fn quote(&self) -> Quoted<'_>;
 
     fn maybe_quote(&self) -> Quoted<'_> { ... }
 }
Expand description

An extension trait to apply quoting to strings.

-

This is implemented on str, OsStr and Path.

+

This is implemented on str, OsStr and Path.

For finer control, see the constructors on Quoted.

-

Required Methods

Returns an object that implements Display for printing strings with +

Required Methods

Returns an object that implements Display for printing strings with proper quoting and escaping for the platform.

On Unix this corresponds to bash/ksh syntax, on Windows PowerShell syntax is used.

Examples
-
use std::path::Path;
-use os_display::Quotable;
+
use std::path::Path;
+use os_display::Quotable;
 
-let path = Path::new("foo/bar.baz");
+let path = Path::new("foo/bar.baz");
 
-println!("Found file {}", path.quote()); // Prints "Found file 'foo/bar.baz'"
-

Provided Methods

Like quote(), but don’t actually add quotes unless necessary because of +println!("Found file {}", path.quote()); // Prints "Found file 'foo/bar.baz'"

+

Provided Methods

Like quote(), but don’t actually add quotes unless necessary because of whitespace or special characters.

Examples
-
use std::path::Path;
-use os_display::Quotable;
+
use std::path::Path;
+use os_display::Quotable;
 
-let foo = Path::new("foo/bar.baz");
-let bar = "foo bar";
+let foo = Path::new("foo/bar.baz");
+let bar = "foo bar";
 
-println!("{}: Not found", foo.maybe_quote()); // Prints "foo/bar.baz: Not found"
-println!("{}: Not found", bar.maybe_quote()); // Prints "'foo bar': Not found"
-

Implementations on Foreign Types

Implementors

\ No newline at end of file +println!("{}: Not found", foo.maybe_quote()); // Prints "foo/bar.baz: Not found" +println!("{}: Not found", bar.maybe_quote()); // Prints "'foo bar': Not found" +

Implementations on Foreign Types

Implementors

\ No newline at end of file diff --git a/dev/uucore/encoding/enum.DecodeError.html b/dev/uucore/encoding/enum.DecodeError.html index 4dda0f041..e4d570c73 100644 --- a/dev/uucore/encoding/enum.DecodeError.html +++ b/dev/uucore/encoding/enum.DecodeError.html @@ -1,26 +1,12 @@ -DecodeError in uucore::encoding - Rust
pub enum DecodeError {
+DecodeError in uucore::encoding - Rust
pub enum DecodeError {
     Decode(DecodeError),
     DecodeZ85(DecodeError),
-    Io(Error),
-}

Variants

Decode(DecodeError)

DecodeZ85(DecodeError)

Io(Error)

Trait Implementations

Formats the value using the given formatter. Read more

-

Formats the value using the given formatter. Read more

-

The lower-level source of this error, if any. Read more

-
👎 Deprecated since 1.42.0:

use the Display impl or to_string()

-
👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

-
🔬 This is a nightly-only experimental API. (error_generic_member_access)

Provides type based access to context intended for error reports. Read more

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Converts to this type from the input type.

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+ Io(Error), +}

Variants

Decode(DecodeError)

DecodeZ85(DecodeError)

Io(Error)

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0:

use the Display impl or to_string()

+
👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

+
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

Converts the given value to a String. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uucore/encoding/enum.EncodeError.html b/dev/uucore/encoding/enum.EncodeError.html index f4fec4e9c..590a8fa9a 100644 --- a/dev/uucore/encoding/enum.EncodeError.html +++ b/dev/uucore/encoding/enum.EncodeError.html @@ -1,14 +1,7 @@ -EncodeError in uucore::encoding - Rust
pub enum EncodeError {
+EncodeError in uucore::encoding - Rust
pub enum EncodeError {
     Z85InputLenNotMultipleOf4,
-}

Variants

Z85InputLenNotMultipleOf4

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Z85InputLenNotMultipleOf4

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uucore/encoding/enum.Format.html b/dev/uucore/encoding/enum.Format.html index 22371053a..040c757d1 100644 --- a/dev/uucore/encoding/enum.Format.html +++ b/dev/uucore/encoding/enum.Format.html @@ -1,4 +1,4 @@ -Format in uucore::encoding - Rust
pub enum Format {
+Format in uucore::encoding - Rust
pub enum Format {
     Base64,
     Base64Url,
     Base32,
@@ -7,20 +7,8 @@
     Base2Lsbf,
     Base2Msbf,
     Z85,
-}

Variants

Base64

Base64Url

Base32

Base32Hex

Base16

Base2Lsbf

Base2Msbf

Z85

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+}

Variants

Base64

Base64Url

Base32

Base32Hex

Base16

Base2Lsbf

Base2Msbf

Z85

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uucore/encoding/fn.decode.html b/dev/uucore/encoding/fn.decode.html index d45ebb245..496355c47 100644 --- a/dev/uucore/encoding/fn.decode.html +++ b/dev/uucore/encoding/fn.decode.html @@ -1 +1 @@ -decode in uucore::encoding - Rust
pub fn decode(f: Format, input: &[u8]) -> DecodeResult
\ No newline at end of file +decode in uucore::encoding - Rust
pub fn decode(f: Format, input: &[u8]) -> DecodeResult
\ No newline at end of file diff --git a/dev/uucore/encoding/fn.encode.html b/dev/uucore/encoding/fn.encode.html index 084cc0158..5a17fea40 100644 --- a/dev/uucore/encoding/fn.encode.html +++ b/dev/uucore/encoding/fn.encode.html @@ -1 +1 @@ -encode in uucore::encoding - Rust
pub fn encode(f: Format, input: &[u8]) -> Result<String, EncodeError>
\ No newline at end of file +encode in uucore::encoding - Rust
pub fn encode(f: Format, input: &[u8]) -> Result<String, EncodeError>
\ No newline at end of file diff --git a/dev/uucore/encoding/fn.wrap_print.html b/dev/uucore/encoding/fn.wrap_print.html index 57b7ac500..166db411e 100644 --- a/dev/uucore/encoding/fn.wrap_print.html +++ b/dev/uucore/encoding/fn.wrap_print.html @@ -1 +1 @@ -wrap_print in uucore::encoding - Rust
pub fn wrap_print<R: Read>(data: &Data<R>, res: &str)
\ No newline at end of file +wrap_print in uucore::encoding - Rust
pub fn wrap_print<R: Read>(data: &Data<R>, res: &str)
\ No newline at end of file diff --git a/dev/uucore/encoding/fn.wrap_write.html b/dev/uucore/encoding/fn.wrap_write.html index dc936b8aa..e61e956e1 100644 --- a/dev/uucore/encoding/fn.wrap_write.html +++ b/dev/uucore/encoding/fn.wrap_write.html @@ -1 +1 @@ -wrap_write in uucore::encoding - Rust
pub fn wrap_write<W: Write>(writer: W, line_wrap: usize, res: &str) -> Result<()>
\ No newline at end of file +wrap_write in uucore::encoding - Rust
pub fn wrap_write<W: Write>(writer: W, line_wrap: usize, res: &str) -> Result<()>
\ No newline at end of file diff --git a/dev/uucore/encoding/index.html b/dev/uucore/encoding/index.html index e27fbb0f8..8f993d1fc 100644 --- a/dev/uucore/encoding/index.html +++ b/dev/uucore/encoding/index.html @@ -1 +1 @@ -uucore::encoding - Rust
\ No newline at end of file +uucore::encoding - Rust
\ No newline at end of file diff --git a/dev/uucore/encoding/struct.Data.html b/dev/uucore/encoding/struct.Data.html index 493a904fa..9acae07a1 100644 --- a/dev/uucore/encoding/struct.Data.html +++ b/dev/uucore/encoding/struct.Data.html @@ -1,12 +1,5 @@ -Data in uucore::encoding - Rust
pub struct Data<R: Read> { /* private fields */ }

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+Data in uucore::encoding - Rust
pub struct Data<R: Read> { /* private fields */ }

Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uucore/encoding/type.DecodeResult.html b/dev/uucore/encoding/type.DecodeResult.html index b48b9b638..df637d6e0 100644 --- a/dev/uucore/encoding/type.DecodeResult.html +++ b/dev/uucore/encoding/type.DecodeResult.html @@ -1 +1 @@ -DecodeResult in uucore::encoding - Rust
pub type DecodeResult = Result<Vec<u8>, DecodeError>;
\ No newline at end of file +DecodeResult in uucore::encoding - Rust
pub type DecodeResult = Result<Vec<u8>, DecodeError>;
\ No newline at end of file diff --git a/dev/uucore/entries/fn.get_groups.html b/dev/uucore/entries/fn.get_groups.html index 185cff8c1..45db13e9d 100644 --- a/dev/uucore/entries/fn.get_groups.html +++ b/dev/uucore/entries/fn.get_groups.html @@ -1,4 +1,4 @@ -get_groups in uucore::entries - Rust
pub fn get_groups() -> IOResult<Vec<gid_t>>
Expand description

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

+get_groups in uucore::entries - Rust
pub fn get_groups() -> IOResult<Vec<gid_t>>
Expand description

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

getgroups() returns the supplementary group IDs of the calling process in list. @@ -7,4 +7,4 @@ supplementary group IDs for the process is returned. This allows the caller to determine the size of a dynamically allocated list to be used in a further call to getgroups().

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uucore/entries/fn.get_groups_gnu.html b/dev/uucore/entries/fn.get_groups_gnu.html index 5d3efbfb9..536d4e1e9 100644 --- a/dev/uucore/entries/fn.get_groups_gnu.html +++ b/dev/uucore/entries/fn.get_groups_gnu.html @@ -1,4 +1,4 @@ -get_groups_gnu in uucore::entries - Rust
pub fn get_groups_gnu(arg_id: Option<u32>) -> IOResult<Vec<gid_t>>
Expand description

The list of group IDs returned from GNU’s groups and GNU’s id --groups +get_groups_gnu in uucore::entries - Rust

pub fn get_groups_gnu(arg_id: Option<u32>) -> IOResult<Vec<gid_t>>
Expand description

The list of group IDs returned from GNU’s groups and GNU’s id --groups starts with the effective group ID (egid). This is a wrapper for get_groups() to mimic this behavior.

If arg_id is None (default), get_groups_gnu moves the effective @@ -20,4 +20,4 @@ groups is the same (in the mathematical sense of ``set’’). (The history of a process and its parents could affect the details of the result.)

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uucore/entries/fn.gid2grp.html b/dev/uucore/entries/fn.gid2grp.html index 7bbeb95a2..1e3bc0845 100644 --- a/dev/uucore/entries/fn.gid2grp.html +++ b/dev/uucore/entries/fn.gid2grp.html @@ -1 +1 @@ -gid2grp in uucore::entries - Rust
pub fn gid2grp(id: gid_t) -> IOResult<String>
\ No newline at end of file +gid2grp in uucore::entries - Rust
pub fn gid2grp(id: gid_t) -> IOResult<String>
\ No newline at end of file diff --git a/dev/uucore/entries/fn.grp2gid.html b/dev/uucore/entries/fn.grp2gid.html index d2137ce1f..48d730be8 100644 --- a/dev/uucore/entries/fn.grp2gid.html +++ b/dev/uucore/entries/fn.grp2gid.html @@ -1 +1 @@ -grp2gid in uucore::entries - Rust
pub fn grp2gid(name: &str) -> IOResult<gid_t>
\ No newline at end of file +grp2gid in uucore::entries - Rust
pub fn grp2gid(name: &str) -> IOResult<gid_t>
\ No newline at end of file diff --git a/dev/uucore/entries/fn.uid2usr.html b/dev/uucore/entries/fn.uid2usr.html index 15e601db2..fe935d241 100644 --- a/dev/uucore/entries/fn.uid2usr.html +++ b/dev/uucore/entries/fn.uid2usr.html @@ -1 +1 @@ -uid2usr in uucore::entries - Rust
pub fn uid2usr(id: uid_t) -> IOResult<String>
\ No newline at end of file +uid2usr in uucore::entries - Rust
pub fn uid2usr(id: uid_t) -> IOResult<String>
\ No newline at end of file diff --git a/dev/uucore/entries/fn.usr2uid.html b/dev/uucore/entries/fn.usr2uid.html index 37a04de7d..d0e222212 100644 --- a/dev/uucore/entries/fn.usr2uid.html +++ b/dev/uucore/entries/fn.usr2uid.html @@ -1 +1 @@ -usr2uid in uucore::entries - Rust
pub fn usr2uid(name: &str) -> IOResult<uid_t>
\ No newline at end of file +usr2uid in uucore::entries - Rust
pub fn usr2uid(name: &str) -> IOResult<uid_t>
\ No newline at end of file diff --git a/dev/uucore/entries/index.html b/dev/uucore/entries/index.html index b6d9b41d1..bca7098be 100644 --- a/dev/uucore/entries/index.html +++ b/dev/uucore/entries/index.html @@ -1,28 +1,25 @@ -uucore::entries - Rust
Expand description

Get password/group file entry

+uucore::entries - Rust
Expand description

Get password/group file entry

Examples:

-
use uucore::entries::{self, Locate};
+
use uucore::entries::{self, Locate};
 
-let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
-    "root"
-} else {
-    "wheel"
-};
+let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
+    "root"
+} else {
+    "wheel"
+};
 
-assert_eq!("root", entries::uid2usr(0).unwrap());
-assert_eq!(0, entries::usr2uid("root").unwrap());
-assert!(entries::gid2grp(0).is_ok());
-assert!(entries::grp2gid(root_group).is_ok());
+assert_eq!("root", entries::uid2usr(0).unwrap());
+assert_eq!(0, entries::usr2uid("root").unwrap());
+assert!(entries::gid2grp(0).is_ok());
+assert!(entries::grp2gid(root_group).is_ok());
 
-assert!(entries::Passwd::locate(0).is_ok());
-assert!(entries::Passwd::locate("0").is_ok());
-assert!(entries::Passwd::locate("root").is_ok());
+assert!(entries::Passwd::locate(0).is_ok());
+assert!(entries::Passwd::locate("0").is_ok());
+assert!(entries::Passwd::locate("root").is_ok());
 
-assert!(entries::Group::locate(0).is_ok());
-assert!(entries::Group::locate("0").is_ok());
-assert!(entries::Group::locate(root_group).is_ok());
-

Structs

Traits

Fetch desired entry.

-

Functions

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

-

The list of group IDs returned from GNU’s groups and GNU’s id --groups +assert!(entries::Group::locate(0).is_ok()); +assert!(entries::Group::locate("0").is_ok()); +assert!(entries::Group::locate(root_group).is_ok());

+

Structs

Traits

Fetch desired entry.

Functions

From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>
The list of group IDs returned from GNU’s groups and GNU’s id --groups starts with the effective group ID (egid). -This is a wrapper for get_groups() to mimic this behavior.

-
\ No newline at end of file +This is a wrapper for get_groups() to mimic this behavior.
\ No newline at end of file diff --git a/dev/uucore/entries/struct.Group.html b/dev/uucore/entries/struct.Group.html index 2d2758962..40d53b3a8 100644 --- a/dev/uucore/entries/struct.Group.html +++ b/dev/uucore/entries/struct.Group.html @@ -1,23 +1,10 @@ -Group in uucore::entries - Rust

Fields

name: String

AKA group.gr_name

gid: gid_t

AKA group.gr_gid

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uucore/entries/struct.Passwd.html b/dev/uucore/entries/struct.Passwd.html index 7ae734c91..2bc1d66f1 100644 --- a/dev/uucore/entries/struct.Passwd.html +++ b/dev/uucore/entries/struct.Passwd.html @@ -1,19 +1,19 @@ -Passwd in uucore::entries - Rust
pub struct Passwd {
-    pub name: String,
+Passwd in uucore::entries - Rust
pub struct Passwd {
+    pub name: String,
     pub uid: uid_t,
     pub gid: gid_t,
-    pub user_info: Option<String>,
-    pub user_shell: Option<String>,
-    pub user_dir: Option<String>,
-    pub user_passwd: Option<String>,
-}

Fields

name: String

AKA passwd.pw_name

+ pub user_info: Option<String>, + pub user_shell: Option<String>, + pub user_dir: Option<String>, + pub user_passwd: Option<String>, +}

Fields

name: String

AKA passwd.pw_name

uid: uid_t

AKA passwd.pw_uid

gid: gid_t

AKA passwd.pw_gid

-
user_info: Option<String>

AKA passwd.pw_gecos

-
user_shell: Option<String>

AKA passwd.pw_shell

-
user_dir: Option<String>

AKA passwd.pw_dir

-
user_passwd: Option<String>

AKA passwd.pw_passwd

-

Implementations

This is a wrapper function for libc::getgrouplist.

+
user_info: Option<String>

AKA passwd.pw_gecos

+
user_shell: Option<String>

AKA passwd.pw_shell

+
user_dir: Option<String>

AKA passwd.pw_dir

+
user_passwd: Option<String>

AKA passwd.pw_passwd

+

Implementations

This is a wrapper function for libc::getgrouplist.

From: <https://man7.org/linux/man-pages/man3/getgrouplist.3.html>

If the number of groups of which user is a member is less than or @@ -27,21 +27,8 @@ call getgrouplist().

not update ngroups if ngroups is too small. Therefore, if not updated by getgrouplist, ngroups needs to be increased in a loop until getgrouplist stops returning -1.

-

Trait Implementations

Returns a copy of the value. Read more

-

Performs copy-assignment from source. Read more

-

Formats the value using the given formatter. Read more

-

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

-

Immutably borrows from an owned value. Read more

-

Mutably borrows from an owned value. Read more

-

Returns the argument unchanged.

-

Calls U::from(self).

+

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

+

Calls U::from(self).

That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

-

The resulting type after obtaining ownership.

-

Creates owned data from borrowed data, usually by cloning. Read more

-

Uses borrowed data to replace owned data, usually by cloning. Read more

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-

The type returned in the event of a conversion error.

-

Performs the conversion.

-
\ No newline at end of file +From<T> for U chooses to do.

+
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
\ No newline at end of file diff --git a/dev/uucore/entries/trait.Locate.html b/dev/uucore/entries/trait.Locate.html index d829a50e9..0f4ef0a57 100644 --- a/dev/uucore/entries/trait.Locate.html +++ b/dev/uucore/entries/trait.Locate.html @@ -1,4 +1,4 @@ -Locate in uucore::entries - Rust
pub trait Locate<K> {
-    fn locate(key: K) -> IOResult<Self>
    where
        Self: Sized
; +Locate in uucore::entries - Rust
pub trait Locate<K> {
+    fn locate(key: K) -> IOResult<Self>
    where
        Self: Sized
; }
Expand description

Fetch desired entry.

-

Required Methods

Implementors

\ No newline at end of file +

Required Methods

Implementors

\ No newline at end of file diff --git a/dev/uucore/error/fn.get_exit_code.html b/dev/uucore/error/fn.get_exit_code.html index 070627c36..b20a671c4 100644 --- a/dev/uucore/error/fn.get_exit_code.html +++ b/dev/uucore/error/fn.get_exit_code.html @@ -1,3 +1,3 @@ -get_exit_code in uucore::error - Rust
pub fn get_exit_code() -> i32
Expand description

Get the last exit code set with set_exit_code. +get_exit_code in uucore::error - Rust

pub fn get_exit_code() -> i32
Expand description

Get the last exit code set with set_exit_code. The default value is 0.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/dev/uucore/error/fn.set_exit_code.html b/dev/uucore/error/fn.set_exit_code.html index f903c9e6c..2a178e1fc 100644 --- a/dev/uucore/error/fn.set_exit_code.html +++ b/dev/uucore/error/fn.set_exit_code.html @@ -1,18 +1,18 @@ -set_exit_code in uucore::error - Rust
pub fn set_exit_code(code: i32)
Expand description

Set the exit code for the program if uumain returns Ok(()).

+set_exit_code in uucore::error - Rust
pub fn set_exit_code(code: i32)
Expand description

Set the exit code for the program if uumain returns Ok(()).

This function is most useful for non-fatal errors, for example when applying an operation to multiple files:

-
use uucore::error::{UResult, set_exit_code};
+
use uucore::error::{UResult, set_exit_code};
 
-fn uumain(args: impl uucore::Args) -> UResult<()> {
+fn uumain(args: impl uucore::Args) -> UResult<()> {
     ...
-    for file in files {
-        let res = some_operation_that_might_fail(file);
-        match res {
+    for file in files {
+        let res = some_operation_that_might_fail(file);
+        match res {
             Ok() => {},
-            Err(_) => set_exit_code(1),
+            Err(_) => set_exit_code(1),
         }
     }
-    Ok(()) // If any of the operations failed, 1 is returned.
-}
-
\ No newline at end of file + Ok(()) // If any of the operations failed, 1 is returned. +}
+
\ No newline at end of file diff --git a/dev/uucore/error/fn.strip_errno.html b/dev/uucore/error/fn.strip_errno.html index 1eb5a3ef6..281e562bd 100644 --- a/dev/uucore/error/fn.strip_errno.html +++ b/dev/uucore/error/fn.strip_errno.html @@ -1,2 +1,2 @@ -strip_errno in uucore::error - Rust
pub fn strip_errno(err: &Error) -> String
Expand description

Strip the trailing “ (os error XX)“ from io error strings.

-
\ No newline at end of file +strip_errno in uucore::error - Rust
pub fn strip_errno(err: &Error) -> String
Expand description

Strip the trailing “ (os error XX)“ from io error strings.

+
\ No newline at end of file diff --git a/dev/uucore/error/index.html b/dev/uucore/error/index.html index b12e05f37..1a6b79a8c 100644 --- a/dev/uucore/error/index.html +++ b/dev/uucore/error/index.html @@ -1,27 +1,27 @@ -uucore::error - Rust
Expand description

All utils return exit with an exit code. Usually, the following scheme is used:

+uucore::error - Rust
Expand description

All utils return exit with an exit code. Usually, the following scheme is used:

  • 0: succeeded
  • 1: minor problems
  • 2: major problems

This module provides types to reconcile these exit codes with idiomatic Rust error -handling. This has a couple advantages over manually using std::process::exit:

+handling. This has a couple advantages over manually using std::process::exit:

  1. It enables the use of ?, map_err, unwrap_or, etc. in uumain.
  2. -
  3. It encourages the use of UResult/Result in functions in the utils.
  4. +
  5. It encourages the use of UResult/Result in functions in the utils.
  6. The error messages are largely standardized across utils.
  7. Standardized error messages can be created from external result types -(i.e. std::io::Result & clap::ClapResult).
  8. +(i.e. std::io::Result & clap::ClapResult).
  9. set_exit_code takes away the burden of manually tracking exit codes for non-fatal errors.

Usage

The signature of a typical util should be:

-
fn uumain(args: impl uucore::Args) -> UResult<()> {
+
fn uumain(args: impl uucore::Args) -> UResult<()> {
     ...
 }
-

UResult is a simple wrapper around Result with a custom error trait: UError. The -most important difference with types implementing std::error::Error is that UErrors +

UResult is a simple wrapper around Result with a custom error trait: UError. The +most important difference with types implementing std::error::Error is that UErrors can specify the exit code of the program when they are returned from uumain:

  • When Ok is returned, the code set with set_exit_code is used as exit code. If @@ -31,11 +31,11 @@ error message is displayed.

Additionally, the errors can be displayed manually with the [show] and [show_if_err] macros:

-
let res = Err(USimpleError::new(1, "Error!!"));
-show_if_err!(res);
-// or
-if let Err(e) = res {
-   show!(e);
+
let res = Err(USimpleError::new(1, "Error!!"));
+show_if_err!(res);
+// or
+if let Err(e) = res {
+   show!(e);
 }

Note: The [show] and [show_if_err] macros set the exit code of the program using set_exit_code. See the documentation on that function for more information.

@@ -48,19 +48,7 @@ error message is displayed.
  • Using ExitCode is not recommended but can be useful for converting utils to use UResult.
  • -

    Macros

    Shorthand to construct UIoError-instances.

    -

    Structs

    A wrapper for clap::Error that implements UError

    -

    A special error type that does not print any message when returned from -uumain. Especially useful for porting utilities to using UResult.

    -

    Wrapper type around std::io::Error.

    -

    A simple error type with an exit code and a message that implements UError.

    -

    Traits

    Enables the conversion from std::io::Error to UError and from std::io::Result to -UResult.

    -

    Extension trait for clap::Error to adjust the exit code.

    -

    Custom errors defined by the utils and uucore.

    -

    Functions

    Get the last exit code set with set_exit_code. -The default value is 0.

    -

    Set the exit code for the program if uumain returns Ok(()).

    -

    Strip the trailing “ (os error XX)“ from io error strings.

    -

    Type Definitions

    Result type that should be returned by all utils.

    -
    \ No newline at end of file +

    Macros

    Shorthand to construct UIoError-instances.

    Structs

    A wrapper for clap::Error that implements UError
    A special error type that does not print any message when returned from +uumain. Especially useful for porting utilities to using UResult.
    Wrapper type around std::io::Error.
    A simple error type with an exit code and a message that implements UError.

    Traits

    Enables the conversion from std::io::Error to UError and from std::io::Result to +UResult.
    Extension trait for clap::Error to adjust the exit code.
    Custom errors defined by the utils and uucore.

    Functions

    Get the last exit code set with set_exit_code. +The default value is 0.
    Set the exit code for the program if uumain returns Ok(()).
    Strip the trailing “ (os error XX)“ from io error strings.

    Type Definitions

    Result type that should be returned by all utils.
    \ No newline at end of file diff --git a/dev/uucore/error/macro.uio_error.html b/dev/uucore/error/macro.uio_error.html index e720da42c..863410cff 100644 --- a/dev/uucore/error/macro.uio_error.html +++ b/dev/uucore/error/macro.uio_error.html @@ -1,51 +1,51 @@ -uio_error in uucore::error - Rust
    macro_rules! uio_error {
    -    ($err:expr, $($args:tt)+) => { ... };
    +uio_error in uucore::error - Rust
    macro_rules! uio_error {
    +    ($err:expr, $($args:tt)+) => { ... };
     }
    Expand description

    Shorthand to construct UIoError-instances.

    This macro serves as a convenience call to quickly construct instances of UIoError. It takes:

      -
    • An instance of std::io::Error
    • +
    • An instance of std::io::Error
    • A format!-compatible string and
    • An arbitrary number of arguments to the format string

    In exactly this order. It is equivalent to the more verbose code seen in the example.

    Examples

    -
    use uucore::error::UIoError;
    -use uucore::uio_error;
    +
    use uucore::error::UIoError;
    +use uucore::uio_error;
     
    -let io_err = std::io::Error::new(
    -    std::io::ErrorKind::PermissionDenied, "fix me please!"
    -);
    +let io_err = std::io::Error::new(
    +    std::io::ErrorKind::PermissionDenied, "fix me please!"
    +);
     
    -let uio_err = UIoError::new(
    -    io_err.kind(),
    +let uio_err = UIoError::new(
    +    io_err.kind(),
         format!("Error code: {}", 2)
     );
     
    -let other_uio_err = uio_error!(io_err, "Error code: {}", 2);
    +let other_uio_err = uio_error!(io_err, "Error code: {}", 2);
     
    -// prints "fix me please!: Permission denied"
    -println!("{}", uio_err);
    -// prints "Error code: 2: Permission denied"
    -println!("{}", other_uio_err);
    -

    The std::fmt::Display impl of UIoError will then ensure that an +// prints "fix me please!: Permission denied" +println!("{}", uio_err); +// prints "Error code: 2: Permission denied" +println!("{}", other_uio_err);

    +

    The std::fmt::Display impl of UIoError will then ensure that an appropriate error message relating to the actual error kind of the -std::io::Error is appended to whatever error message is defined in +std::io::Error is appended to whatever error message is defined in addition (as secondary argument).

    -

    If you want to show only the error message for the std::io::ErrorKind +

    If you want to show only the error message for the std::io::ErrorKind that’s contained in UIoError, pass the second argument as empty string:

    -
    use uucore::error::UIoError;
    -use uucore::uio_error;
    +
    use uucore::error::UIoError;
    +use uucore::uio_error;
     
    -let io_err = std::io::Error::new(
    -    std::io::ErrorKind::PermissionDenied, "fix me please!"
    -);
    +let io_err = std::io::Error::new(
    +    std::io::ErrorKind::PermissionDenied, "fix me please!"
    +);
     
    -let other_uio_err = uio_error!(io_err, "");
    +let other_uio_err = uio_error!(io_err, "");
     
    -// prints: ": Permission denied"
    -println!("{}", other_uio_err);
    -
    \ No newline at end of file +// prints: ": Permission denied" +println!("{}", other_uio_err);
    +
    \ No newline at end of file diff --git a/dev/uucore/error/struct.ClapErrorWrapper.html b/dev/uucore/error/struct.ClapErrorWrapper.html index 6c6d9a6f5..c88b3fd05 100644 --- a/dev/uucore/error/struct.ClapErrorWrapper.html +++ b/dev/uucore/error/struct.ClapErrorWrapper.html @@ -1,36 +1,23 @@ -ClapErrorWrapper in uucore::error - Rust
    pub struct ClapErrorWrapper { /* private fields */ }
    Expand description

    A wrapper for clap::Error that implements UError

    +ClapErrorWrapper in uucore::error - Rust
    pub struct ClapErrorWrapper { /* private fields */ }
    Expand description

    A wrapper for clap::Error that implements UError

    Contains a custom error code. When Display::fmt is called on this struct the [clap::Error] will be printed directly to stdout or stderr. This is because clap only supports colored output when it prints directly.

    ClapErrorWrapper is generally created by calling the -UClapError::with_exit_code method on [clap::Error] or using the From +UClapError::with_exit_code method on [clap::Error] or using the From implementation from [clap::Error] to Box<dyn UError>, which constructs a ClapErrorWrapper with an exit code of 1.

    -
    use uucore::error::{ClapErrorWrapper, UError, UClapError};
    -let command = clap::Command::new("test");
    -let result: Result<_, ClapErrorWrapper> = command.try_get_matches().with_exit_code(125);
    +
    use uucore::error::{ClapErrorWrapper, UError, UClapError};
    +let command = clap::Command::new("test");
    +let result: Result<_, ClapErrorWrapper> = command.try_get_matches().with_exit_code(125);
     
    -let command = clap::Command::new("test");
    -let result: Result<_, Box<dyn UError>> = command.try_get_matches().map_err(Into::into);
    -

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Formats the value using the given formatter. Read more

    -

    The lower-level source of this error, if any. Read more

    -
    👎 Deprecated since 1.42.0:

    use the Display impl or to_string()

    -
    👎 Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    -
    🔬 This is a nightly-only experimental API. (error_generic_member_access)

    Provides type based access to context intended for error reports. Read more

    -

    Error code of a custom error. Read more

    -

    Print usage help to a custom error. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +let command = clap::Command::new("test"); +let result: Result<_, Box<dyn UError>> = command.try_get_matches().map_err(Into::into);
    +

    Trait Implementations

    Formats the value using the given formatter. Read more
    Formats the value using the given formatter. Read more
    The lower-level source of this error, if any. Read more
    👎Deprecated since 1.42.0:

    use the Display impl or to_string()

    +
    👎Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    +
    🔬This is a nightly-only experimental API. (error_generic_member_access)
    Provides type based access to context intended for error reports. Read more
    Error code of a custom error. Read more
    Print usage help to a custom error. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    Converts the given value to a String. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    🔬This is a nightly-only experimental API. (provide_any)
    Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
    Converts the given value to a String. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/error/struct.ExitCode.html b/dev/uucore/error/struct.ExitCode.html index 843616dfe..5c76a151f 100644 --- a/dev/uucore/error/struct.ExitCode.html +++ b/dev/uucore/error/struct.ExitCode.html @@ -1,33 +1,20 @@ -ExitCode in uucore::error - Rust
    pub struct ExitCode(pub i32);
    Expand description

    A special error type that does not print any message when returned from +ExitCode in uucore::error - Rust

    pub struct ExitCode(pub i32);
    Expand description

    A special error type that does not print any message when returned from uumain. Especially useful for porting utilities to using UResult.

    There are two ways to construct an ExitCode:

    -
    use uucore::error::{ExitCode, UResult};
    -// Explicit
    -let res: UResult<()> = Err(ExitCode(1).into());
    +
    use uucore::error::{ExitCode, UResult};
    +// Explicit
    +let res: UResult<()> = Err(ExitCode(1).into());
     
    -// Using into on `i32`:
    -let res: UResult<()> = Err(1.into());
    -

    This type is especially useful for a trivial conversion from utils returning i32 to +// Using into on `i32`: +let res: UResult<()> = Err(1.into());

    +

    This type is especially useful for a trivial conversion from utils returning i32 to returning UResult.

    -

    Tuple Fields

    0: i32

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Formats the value using the given formatter. Read more

    -

    The lower-level source of this error, if any. Read more

    -
    👎 Deprecated since 1.42.0:

    use the Display impl or to_string()

    -
    👎 Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    -
    🔬 This is a nightly-only experimental API. (error_generic_member_access)

    Provides type based access to context intended for error reports. Read more

    -

    Error code of a custom error. Read more

    -

    Print usage help to a custom error. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Tuple Fields

    0: i32

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more
    Formats the value using the given formatter. Read more
    The lower-level source of this error, if any. Read more
    👎Deprecated since 1.42.0:

    use the Display impl or to_string()

    +
    👎Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    +
    🔬This is a nightly-only experimental API. (error_generic_member_access)
    Provides type based access to context intended for error reports. Read more
    Error code of a custom error. Read more
    Print usage help to a custom error. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    Converts the given value to a String. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    🔬This is a nightly-only experimental API. (provide_any)
    Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
    Converts the given value to a String. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/error/struct.UIoError.html b/dev/uucore/error/struct.UIoError.html index 7ec75f445..63f21d9de 100644 --- a/dev/uucore/error/struct.UIoError.html +++ b/dev/uucore/error/struct.UIoError.html @@ -1,45 +1,31 @@ -UIoError in uucore::error - Rust
    pub struct UIoError { /* private fields */ }
    Expand description

    Wrapper type around std::io::Error.

    +UIoError in uucore::error - Rust
    pub struct UIoError { /* private fields */ }
    Expand description

    Wrapper type around std::io::Error.

    The messages displayed by UIoError should match the error messages displayed by GNU coreutils.

    There are two ways to construct this type: with UIoError::new or by calling the -FromIo::map_err_context method on a std::io::Result or std::io::Error.

    +FromIo::map_err_context method on a std::io::Result or std::io::Error.

    -
    use uucore::{
    -    display::Quotable,
    -    error::{FromIo, UResult, UIoError, UError}
    +
    use uucore::{
    +    display::Quotable,
    +    error::{FromIo, UResult, UIoError, UError}
     };
    -use std::fs::File;
    -use std::path::Path;
    -let path = Path::new("test.txt");
    +use std::fs::File;
    +use std::path::Path;
    +let path = Path::new("test.txt");
     
    -// Manual construction
    -let e: Box<dyn UError> = UIoError::new(
    -    std::io::ErrorKind::NotFound,
    -    format!("cannot access {}", path.quote())
    +// Manual construction
    +let e: Box<dyn UError> = UIoError::new(
    +    std::io::ErrorKind::NotFound,
    +    format!("cannot access {}", path.quote())
     );
    -let res: UResult<()> = Err(e.into());
    +let res: UResult<()> = Err(e.into());
     
    -// Converting from an `std::io::Error`.
    -let res: UResult<File> = File::open(path).map_err_context(|| format!("cannot access {}", path.quote()));
    -

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Formats the value using the given formatter. Read more

    -

    The lower-level source of this error, if any. Read more

    -
    👎 Deprecated since 1.42.0:

    use the Display impl or to_string()

    -
    👎 Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    -
    🔬 This is a nightly-only experimental API. (error_generic_member_access)

    Provides type based access to context intended for error reports. Read more

    -

    Converts to this type from the input type.

    -

    Error code of a custom error. Read more

    -

    Print usage help to a custom error. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +// Converting from an `std::io::Error`. +let res: UResult<File> = File::open(path).map_err_context(|| format!("cannot access {}", path.quote()));
    +

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more
    Formats the value using the given formatter. Read more
    The lower-level source of this error, if any. Read more
    👎Deprecated since 1.42.0:

    use the Display impl or to_string()

    +
    👎Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    +
    🔬This is a nightly-only experimental API. (error_generic_member_access)
    Provides type based access to context intended for error reports. Read more
    Converts to this type from the input type.
    Error code of a custom error. Read more
    Print usage help to a custom error. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    Converts the given value to a String. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    🔬This is a nightly-only experimental API. (provide_any)
    Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
    Converts the given value to a String. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/error/struct.USimpleError.html b/dev/uucore/error/struct.USimpleError.html index 257790ad7..e3f32f44b 100644 --- a/dev/uucore/error/struct.USimpleError.html +++ b/dev/uucore/error/struct.USimpleError.html @@ -1,31 +1,18 @@ -USimpleError in uucore::error - Rust
    pub struct USimpleError {
    -    pub code: i32,
    -    pub message: String,
    +USimpleError in uucore::error - Rust
    pub struct USimpleError {
    +    pub code: i32,
    +    pub message: String,
     }
    Expand description

    A simple error type with an exit code and a message that implements UError.

    -
    use uucore::error::{UResult, USimpleError};
    -let err = USimpleError { code: 1, message: "error!".into()};
    -let res: UResult<()> = Err(err.into());
    -// or using the `new` method:
    -let res: UResult<()> = Err(USimpleError::new(1, "error!"));
    -

    Fields

    code: i32message: String

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Formats the value using the given formatter. Read more

    -

    The lower-level source of this error, if any. Read more

    -
    👎 Deprecated since 1.42.0:

    use the Display impl or to_string()

    -
    👎 Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    -
    🔬 This is a nightly-only experimental API. (error_generic_member_access)

    Provides type based access to context intended for error reports. Read more

    -

    Error code of a custom error. Read more

    -

    Print usage help to a custom error. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +
    use uucore::error::{UResult, USimpleError};
    +let err = USimpleError { code: 1, message: "error!".into()};
    +let res: UResult<()> = Err(err.into());
    +// or using the `new` method:
    +let res: UResult<()> = Err(USimpleError::new(1, "error!"));
    +

    Fields

    code: i32message: String

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more
    Formats the value using the given formatter. Read more
    The lower-level source of this error, if any. Read more
    👎Deprecated since 1.42.0:

    use the Display impl or to_string()

    +
    👎Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    +
    🔬This is a nightly-only experimental API. (error_generic_member_access)
    Provides type based access to context intended for error reports. Read more
    Error code of a custom error. Read more
    Print usage help to a custom error. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    Converts the given value to a String. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    🔬This is a nightly-only experimental API. (provide_any)
    Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
    Converts the given value to a String. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/error/struct.UUsageError.html b/dev/uucore/error/struct.UUsageError.html index 3fe0887c0..375fe9bdf 100644 --- a/dev/uucore/error/struct.UUsageError.html +++ b/dev/uucore/error/struct.UUsageError.html @@ -1,24 +1,11 @@ -UUsageError in uucore::error - Rust
    pub struct UUsageError {
    -    pub code: i32,
    -    pub message: String,
    -}

    Fields

    code: i32message: String

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Formats the value using the given formatter. Read more

    -

    The lower-level source of this error, if any. Read more

    -
    👎 Deprecated since 1.42.0:

    use the Display impl or to_string()

    -
    👎 Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    -
    🔬 This is a nightly-only experimental API. (error_generic_member_access)

    Provides type based access to context intended for error reports. Read more

    -

    Error code of a custom error. Read more

    -

    Print usage help to a custom error. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +UUsageError in uucore::error - Rust
    pub struct UUsageError {
    +    pub code: i32,
    +    pub message: String,
    +}

    Fields

    code: i32message: String

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more
    Formats the value using the given formatter. Read more
    The lower-level source of this error, if any. Read more
    👎Deprecated since 1.42.0:

    use the Display impl or to_string()

    +
    👎Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    +
    🔬This is a nightly-only experimental API. (error_generic_member_access)
    Provides type based access to context intended for error reports. Read more
    Error code of a custom error. Read more
    Print usage help to a custom error. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    Converts the given value to a String. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    🔬This is a nightly-only experimental API. (provide_any)
    Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
    Converts the given value to a String. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/error/trait.FromIo.html b/dev/uucore/error/trait.FromIo.html index 618f49a8d..837e6e02a 100644 --- a/dev/uucore/error/trait.FromIo.html +++ b/dev/uucore/error/trait.FromIo.html @@ -1,5 +1,5 @@ -FromIo in uucore::error - Rust
    pub trait FromIo<T> {
    -    fn map_err_context(self, context: impl FnOnce() -> String) -> T;
    -}
    Expand description

    Enables the conversion from std::io::Error to UError and from std::io::Result to +FromIo in uucore::error - Rust

    pub trait FromIo<T> {
    +    fn map_err_context(self, context: impl FnOnce() -> String) -> T;
    +}
    Expand description

    Enables the conversion from std::io::Error to UError and from std::io::Result to UResult.

    -

    Required Methods

    Implementations on Foreign Types

    Implementors

    \ No newline at end of file +

    Required Methods

    Implementations on Foreign Types

    Implementors

    \ No newline at end of file diff --git a/dev/uucore/error/trait.UClapError.html b/dev/uucore/error/trait.UClapError.html index d5de2b478..7f7a584cf 100644 --- a/dev/uucore/error/trait.UClapError.html +++ b/dev/uucore/error/trait.UClapError.html @@ -1,4 +1,4 @@ -UClapError in uucore::error - Rust
    pub trait UClapError<T> {
    -    fn with_exit_code(self, code: i32) -> T;
    +UClapError in uucore::error - Rust
    pub trait UClapError<T> {
    +    fn with_exit_code(self, code: i32) -> T;
     }
    Expand description

    Extension trait for clap::Error to adjust the exit code.

    -

    Required Methods

    Implementations on Foreign Types

    Implementors

    \ No newline at end of file +

    Required Methods

    Implementations on Foreign Types

    Implementors

    \ No newline at end of file diff --git a/dev/uucore/error/trait.UError.html b/dev/uucore/error/trait.UError.html index 109c89053..3b41f9ff8 100644 --- a/dev/uucore/error/trait.UError.html +++ b/dev/uucore/error/trait.UError.html @@ -1,149 +1,145 @@ -UError in uucore::error - Rust
    pub trait UError: Error + Send {
    -    fn code(&self) -> i32 { ... }
    -    fn usage(&self) -> bool { ... }
    +UError in uucore::error - Rust
    pub trait UError: Error + Send {
    +    fn code(&self) -> i32 { ... }
    +    fn usage(&self) -> bool { ... }
     }
    Expand description

    Custom errors defined by the utils and uucore.

    -

    All errors should implement std::error::Error, std::fmt::Display and -std::fmt::Debug and have an additional code method that specifies the +

    All errors should implement std::error::Error, std::fmt::Display and +std::fmt::Debug and have an additional code method that specifies the exit code of the program if the error is returned from uumain.

    An example of a custom error from ls:

    -
    use uucore::{
    -    display::Quotable,
    -    error::{UError, UResult}
    +
    use uucore::{
    +    display::Quotable,
    +    error::{UError, UResult}
     };
    -use std::{
    -    error::Error,
    -    fmt::{Display, Debug},
    -    path::PathBuf
    +use std::{
    +    error::Error,
    +    fmt::{Display, Debug},
    +    path::PathBuf
     };
     
    -#[derive(Debug)]
    -enum LsError {
    -    InvalidLineWidth(String),
    -    NoMetadata(PathBuf),
    +#[derive(Debug)]
    +enum LsError {
    +    InvalidLineWidth(String),
    +    NoMetadata(PathBuf),
     }
     
    -impl UError for LsError {
    -    fn code(&self) -> i32 {
    -        match self {
    -            LsError::InvalidLineWidth(_) => 2,
    -            LsError::NoMetadata(_) => 1,
    +impl UError for LsError {
    +    fn code(&self) -> i32 {
    +        match self {
    +            LsError::InvalidLineWidth(_) => 2,
    +            LsError::NoMetadata(_) => 1,
             }
         }
     }
     
    -impl Error for LsError {}
    +impl Error for LsError {}
     
    -impl Display for LsError {
    -    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
    -        match self {
    -            LsError::InvalidLineWidth(s) => write!(f, "invalid line width: {}", s.quote()),
    -            LsError::NoMetadata(p) => write!(f, "could not open file: {}", p.quote()),
    +impl Display for LsError {
    +    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
    +        match self {
    +            LsError::InvalidLineWidth(s) => write!(f, "invalid line width: {}", s.quote()),
    +            LsError::NoMetadata(p) => write!(f, "could not open file: {}", p.quote()),
             }
         }
     }

    The main routine would look like this:

    -
    #[uucore::main]
    -pub fn uumain(args: impl uucore::Args) -> UResult<()> {
    -    // Perform computations here ...
    -    return Err(LsError::InvalidLineWidth(String::from("test")).into())
    +
    #[uucore::main]
    +pub fn uumain(args: impl uucore::Args) -> UResult<()> {
    +    // Perform computations here ...
    +    return Err(LsError::InvalidLineWidth(String::from("test")).into())
     }

    The call to into() is required to convert the LsError to -Box<dyn UError>. The implementation for From is provided automatically.

    +Box<dyn UError>. The implementation for From is provided automatically.

    A crate like quick_error might also be used, but will still require an impl for the code method.

    -

    Provided Methods

    Error code of a custom error.

    +

    Provided Methods

    Error code of a custom error.

    Set a return value for each variant of an enum-type to associate an error code (which is returned to the system shell) with an error variant.

    Example
    -
    use uucore::{
    -    display::Quotable,
    -    error::UError
    +
    use uucore::{
    +    display::Quotable,
    +    error::UError
     };
    -use std::{
    -    error::Error,
    -    fmt::{Display, Debug},
    -    path::PathBuf
    +use std::{
    +    error::Error,
    +    fmt::{Display, Debug},
    +    path::PathBuf
     };
     
    -#[derive(Debug)]
    -enum MyError {
    -    Foo(String),
    -    Bar(PathBuf),
    -    Bing(),
    +#[derive(Debug)]
    +enum MyError {
    +    Foo(String),
    +    Bar(PathBuf),
    +    Bing(),
     }
     
    -impl UError for MyError {
    -    fn code(&self) -> i32 {
    -        match self {
    -            MyError::Foo(_) => 2,
    -            // All other errors yield the same error code, there's no
    -            // need to list them explicitly.
    -            _ => 1,
    +impl UError for MyError {
    +    fn code(&self) -> i32 {
    +        match self {
    +            MyError::Foo(_) => 2,
    +            // All other errors yield the same error code, there's no
    +            // need to list them explicitly.
    +            _ => 1,
             }
         }
     }
     
    -impl Error for MyError {}
    +impl Error for MyError {}
     
    -impl Display for MyError {
    -    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
    -        use MyError as ME;
    -        match self {
    -            ME::Foo(s) => write!(f, "Unknown Foo: {}", s.quote()),
    -            ME::Bar(p) => write!(f, "Couldn't find Bar: {}", p.quote()),
    -            ME::Bing() => write!(f, "Exterminate!"),
    +impl Display for MyError {
    +    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
    +        use MyError as ME;
    +        match self {
    +            ME::Foo(s) => write!(f, "Unknown Foo: {}", s.quote()),
    +            ME::Bar(p) => write!(f, "Couldn't find Bar: {}", p.quote()),
    +            ME::Bing() => write!(f, "Exterminate!"),
             }
         }
     }
    -

    Print usage help to a custom error.

    +

    Print usage help to a custom error.

    Return true or false to control whether a short usage help is printed below the error message. The usage help is in the format: “Try {name} --help for more information.” and printed only if true is returned.

    Example
    -
    use uucore::{
    -    display::Quotable,
    -    error::UError
    +
    use uucore::{
    +    display::Quotable,
    +    error::UError
     };
    -use std::{
    -    error::Error,
    -    fmt::{Display, Debug},
    -    path::PathBuf
    +use std::{
    +    error::Error,
    +    fmt::{Display, Debug},
    +    path::PathBuf
     };
     
    -#[derive(Debug)]
    -enum MyError {
    -    Foo(String),
    -    Bar(PathBuf),
    -    Bing(),
    +#[derive(Debug)]
    +enum MyError {
    +    Foo(String),
    +    Bar(PathBuf),
    +    Bing(),
     }
     
    -impl UError for MyError {
    -    fn usage(&self) -> bool {
    -        match self {
    -            // This will have a short usage help appended
    -            MyError::Bar(_) => true,
    -            // These matches won't have a short usage help appended
    -            _ => false,
    +impl UError for MyError {
    +    fn usage(&self) -> bool {
    +        match self {
    +            // This will have a short usage help appended
    +            MyError::Bar(_) => true,
    +            // These matches won't have a short usage help appended
    +            _ => false,
             }
         }
     }
     
    -impl Error for MyError {}
    +impl Error for MyError {}
     
    -impl Display for MyError {
    -    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
    -        use MyError as ME;
    -        match self {
    -            ME::Foo(s) => write!(f, "Unknown Foo: {}", s.quote()),
    -            ME::Bar(p) => write!(f, "Couldn't find Bar: {}", p.quote()),
    -            ME::Bing() => write!(f, "Exterminate!"),
    +impl Display for MyError {
    +    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
    +        use MyError as ME;
    +        match self {
    +            ME::Foo(s) => write!(f, "Unknown Foo: {}", s.quote()),
    +            ME::Bar(p) => write!(f, "Couldn't find Bar: {}", p.quote()),
    +            ME::Bing() => write!(f, "Exterminate!"),
             }
         }
     }
    -

    Trait Implementations

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Converts to this type from the input type.

    -

    Implementors

    \ No newline at end of file +

    Trait Implementations

    Converts to this type from the input type.
    Converts to this type from the input type.
    Converts to this type from the input type.
    Converts to this type from the input type.

    Implementors

    \ No newline at end of file diff --git a/dev/uucore/error/type.UResult.html b/dev/uucore/error/type.UResult.html index d98b74103..235e10c3f 100644 --- a/dev/uucore/error/type.UResult.html +++ b/dev/uucore/error/type.UResult.html @@ -1,2 +1,2 @@ -UResult in uucore::error - Rust

    Type Definition uucore::error::UResult

    source · []
    pub type UResult<T> = Result<T, Box<dyn UError>>;
    Expand description

    Result type that should be returned by all utils.

    -
    \ No newline at end of file +UResult in uucore::error - Rust

    Type Definition uucore::error::UResult

    source · []
    pub type UResult<T> = Result<T, Box<dyn UError>>;
    Expand description

    Result type that should be returned by all utils.

    +
    \ No newline at end of file diff --git a/dev/uucore/fn.args_os.html b/dev/uucore/fn.args_os.html index 726e6f069..2037165fd 100644 --- a/dev/uucore/fn.args_os.html +++ b/dev/uucore/fn.args_os.html @@ -1 +1 @@ -args_os in uucore - Rust
    pub fn args_os() -> impl Iterator<Item = OsString>
    \ No newline at end of file +args_os in uucore - Rust
    pub fn args_os() -> impl Iterator<Item = OsString>
    \ No newline at end of file diff --git a/dev/uucore/fn.execution_phrase.html b/dev/uucore/fn.execution_phrase.html index 3358f8c38..106500cbb 100644 --- a/dev/uucore/fn.execution_phrase.html +++ b/dev/uucore/fn.execution_phrase.html @@ -1,2 +1,2 @@ -execution_phrase in uucore - Rust
    pub fn execution_phrase() -> &'static str
    Expand description

    Derive the complete execution phrase for “usage”.

    -
    \ No newline at end of file +execution_phrase in uucore - Rust
    pub fn execution_phrase() -> &'static str
    Expand description

    Derive the complete execution phrase for “usage”.

    +
    \ No newline at end of file diff --git a/dev/uucore/fn.format_usage.html b/dev/uucore/fn.format_usage.html index c4833f10b..371ebcf51 100644 --- a/dev/uucore/fn.format_usage.html +++ b/dev/uucore/fn.format_usage.html @@ -1,5 +1,5 @@ -format_usage in uucore - Rust
    pub fn format_usage(s: &str) -> String
    Expand description

    Generate the usage string for clap.

    +format_usage in uucore - Rust
    pub fn format_usage(s: &str) -> String
    Expand description

    Generate the usage string for clap.

    This function replaces all occurrences of {} with the execution phrase and returns the resulting String. It does not support more advanced formatting features such as {0}.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/fn.get_utility_is_second_arg.html b/dev/uucore/fn.get_utility_is_second_arg.html index f98daf11d..66e50525f 100644 --- a/dev/uucore/fn.get_utility_is_second_arg.html +++ b/dev/uucore/fn.get_utility_is_second_arg.html @@ -1 +1 @@ -get_utility_is_second_arg in uucore - Rust
    pub fn get_utility_is_second_arg() -> bool
    \ No newline at end of file +get_utility_is_second_arg in uucore - Rust
    pub fn get_utility_is_second_arg() -> bool
    \ No newline at end of file diff --git a/dev/uucore/fn.set_utility_is_second_arg.html b/dev/uucore/fn.set_utility_is_second_arg.html index 014818092..9abed4caf 100644 --- a/dev/uucore/fn.set_utility_is_second_arg.html +++ b/dev/uucore/fn.set_utility_is_second_arg.html @@ -1 +1 @@ -set_utility_is_second_arg in uucore - Rust
    pub fn set_utility_is_second_arg()
    \ No newline at end of file +set_utility_is_second_arg in uucore - Rust
    pub fn set_utility_is_second_arg()
    \ No newline at end of file diff --git a/dev/uucore/fn.util_name.html b/dev/uucore/fn.util_name.html index b2b26b9fd..eedbbbdfd 100644 --- a/dev/uucore/fn.util_name.html +++ b/dev/uucore/fn.util_name.html @@ -1,2 +1,2 @@ -util_name in uucore - Rust
    pub fn util_name() -> &'static str
    Expand description

    Derive the utility name.

    -
    \ No newline at end of file +util_name in uucore - Rust
    pub fn util_name() -> &'static str
    Expand description

    Derive the utility name.

    +
    \ No newline at end of file diff --git a/dev/uucore/fs/enum.MissingHandling.html b/dev/uucore/fs/enum.MissingHandling.html index 6e13978f0..3b681d875 100644 --- a/dev/uucore/fs/enum.MissingHandling.html +++ b/dev/uucore/fs/enum.MissingHandling.html @@ -1,4 +1,4 @@ -MissingHandling in uucore::fs - Rust
    pub enum MissingHandling {
    +MissingHandling in uucore::fs - Rust
    pub enum MissingHandling {
         Normal,
         Existing,
         Missing,
    @@ -6,24 +6,10 @@
     

    Variants

    Normal

    Return an error if any part of the path is missing.

    Existing

    Resolve symbolic links, ignoring errors on the final component.

    Missing

    Resolve symbolic links, ignoring errors on the non-final components.

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/fs/enum.ResolveMode.html b/dev/uucore/fs/enum.ResolveMode.html index fd4b06cb2..1a657f11e 100644 --- a/dev/uucore/fs/enum.ResolveMode.html +++ b/dev/uucore/fs/enum.ResolveMode.html @@ -1,4 +1,4 @@ -ResolveMode in uucore::fs - Rust
    pub enum ResolveMode {
    +ResolveMode in uucore::fs - Rust
    pub enum ResolveMode {
         None,
         Physical,
         Logical,
    @@ -6,24 +6,10 @@
     

    Variants

    None

    Do not resolve any symbolic links.

    Physical

    Resolve symlinks as encountered when processing the path

    Logical

    Resolve ‘..’ elements before symlinks

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/fs/fn.canonicalize.html b/dev/uucore/fs/fn.canonicalize.html index 7879ef9b8..eb0e7b65c 100644 --- a/dev/uucore/fs/fn.canonicalize.html +++ b/dev/uucore/fs/fn.canonicalize.html @@ -1,12 +1,12 @@ -canonicalize in uucore::fs - Rust
    pub fn canonicalize<P: AsRef<Path>>(
        original: P,
        miss_mode: MissingHandling,
        res_mode: ResolveMode
    ) -> IOResult<PathBuf>
    Expand description

    Return the canonical, absolute form of a path.

    -

    This function is a generalization of std::fs::canonicalize that +canonicalize in uucore::fs - Rust

    pub fn canonicalize<P: AsRef<Path>>(
        original: P,
        miss_mode: MissingHandling,
        res_mode: ResolveMode
    ) -> IOResult<PathBuf>
    Expand description

    Return the canonical, absolute form of a path.

    +

    This function is a generalization of std::fs::canonicalize that allows controlling how symbolic links are resolved and how to deal with missing components. It returns the canonical, absolute form of a path. The miss_mode parameter controls how missing path elements are handled

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/fs/fn.dir_strip_dot_for_creation.html b/dev/uucore/fs/fn.dir_strip_dot_for_creation.html index e138e6477..f6535143e 100644 --- a/dev/uucore/fs/fn.dir_strip_dot_for_creation.html +++ b/dev/uucore/fs/fn.dir_strip_dot_for_creation.html @@ -1,5 +1,5 @@ -dir_strip_dot_for_creation in uucore::fs - Rust
    pub fn dir_strip_dot_for_creation(path: &Path) -> PathBuf
    Expand description

    For some programs like install or mkdir, dir/. can be provided +dir_strip_dot_for_creation in uucore::fs - Rust

    pub fn dir_strip_dot_for_creation(path: &Path) -> PathBuf
    Expand description

    For some programs like install or mkdir, dir/. can be provided Special case to match GNU’s behavior: install -d foo/. should work and just create foo/ std::fs::create_dir(“foo/.”); fails in pure Rust

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/fs/fn.display_permissions.html b/dev/uucore/fs/fn.display_permissions.html index 3b4efe4f5..f766dbec7 100644 --- a/dev/uucore/fs/fn.display_permissions.html +++ b/dev/uucore/fs/fn.display_permissions.html @@ -1,3 +1,3 @@ -display_permissions in uucore::fs - Rust
    pub fn display_permissions(
        metadata: &Metadata,
        display_file_type: bool
    ) -> String
    Expand description

    Display the permissions of a file +display_permissions in uucore::fs - Rust

    pub fn display_permissions(
        metadata: &Metadata,
        display_file_type: bool
    ) -> String
    Expand description

    Display the permissions of a file On non unix like system, just show ‘–––––’

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/fs/fn.display_permissions_unix.html b/dev/uucore/fs/fn.display_permissions_unix.html index 6ae613764..49791e072 100644 --- a/dev/uucore/fs/fn.display_permissions_unix.html +++ b/dev/uucore/fs/fn.display_permissions_unix.html @@ -1,2 +1,2 @@ -display_permissions_unix in uucore::fs - Rust
    pub fn display_permissions_unix(mode: mode_t, display_file_type: bool) -> String
    Expand description

    Display the permissions of a file on a unix like system

    -
    \ No newline at end of file +display_permissions_unix in uucore::fs - Rust
    pub fn display_permissions_unix(mode: mode_t, display_file_type: bool) -> String
    Expand description

    Display the permissions of a file on a unix like system

    +
    \ No newline at end of file diff --git a/dev/uucore/fs/fn.infos_refer_to_same_file.html b/dev/uucore/fs/fn.infos_refer_to_same_file.html index 833d06d36..5272a6b25 100644 --- a/dev/uucore/fs/fn.infos_refer_to_same_file.html +++ b/dev/uucore/fs/fn.infos_refer_to_same_file.html @@ -1,3 +1,3 @@ -infos_refer_to_same_file in uucore::fs - Rust
    pub fn infos_refer_to_same_file(
        info1: IOResult<FileInformation>,
        info2: IOResult<FileInformation>
    ) -> bool
    Expand description

    Checks if p1 and p2 are the same file information. +infos_refer_to_same_file in uucore::fs - Rust

    pub fn infos_refer_to_same_file(
        info1: IOResult<FileInformation>,
        info2: IOResult<FileInformation>
    ) -> bool
    Expand description

    Checks if p1 and p2 are the same file information. If error happens when trying to get files’ metadata, returns false

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/fs/fn.make_path_relative_to.html b/dev/uucore/fs/fn.make_path_relative_to.html index e4bbf8dcf..228f73355 100644 --- a/dev/uucore/fs/fn.make_path_relative_to.html +++ b/dev/uucore/fs/fn.make_path_relative_to.html @@ -1,2 +1,2 @@ -make_path_relative_to in uucore::fs - Rust
    pub fn make_path_relative_to<P1: AsRef<Path>, P2: AsRef<Path>>(
        path: P1,
        to: P2
    ) -> PathBuf
    Expand description

    Converts absolute path to be relative to absolute to path.

    -
    \ No newline at end of file +make_path_relative_to in uucore::fs - Rust
    pub fn make_path_relative_to<P1: AsRef<Path>, P2: AsRef<Path>>(
        path: P1,
        to: P2
    ) -> PathBuf
    Expand description

    Converts absolute path to be relative to absolute to path.

    +
    \ No newline at end of file diff --git a/dev/uucore/fs/fn.normalize_path.html b/dev/uucore/fs/fn.normalize_path.html index 528b3bd99..3a9cecf64 100644 --- a/dev/uucore/fs/fn.normalize_path.html +++ b/dev/uucore/fs/fn.normalize_path.html @@ -1,7 +1,7 @@ -normalize_path in uucore::fs - Rust
    pub fn normalize_path(path: &Path) -> PathBuf
    Expand description

    Normalize a path by removing relative information +normalize_path in uucore::fs - Rust

    pub fn normalize_path(path: &Path) -> PathBuf
    Expand description

    Normalize a path by removing relative information For example, convert ‘bar/../foo/bar.txt’ => ‘foo/bar.txt’ copied from <https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90> both projects are MIT <https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT> for std impl progress see rfc <https://github.com/rust-lang/rfcs/issues/2208> replace this once that lands

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/fs/fn.paths_refer_to_same_file.html b/dev/uucore/fs/fn.paths_refer_to_same_file.html index f533252aa..dce7a751a 100644 --- a/dev/uucore/fs/fn.paths_refer_to_same_file.html +++ b/dev/uucore/fs/fn.paths_refer_to_same_file.html @@ -1,3 +1,3 @@ -paths_refer_to_same_file in uucore::fs - Rust
    pub fn paths_refer_to_same_file<P: AsRef<Path>>(
        p1: P,
        p2: P,
        dereference: bool
    ) -> bool
    Expand description

    Checks if p1 and p2 are the same file. +paths_refer_to_same_file in uucore::fs - Rust

    pub fn paths_refer_to_same_file<P: AsRef<Path>>(
        p1: P,
        p2: P,
        dereference: bool
    ) -> bool
    Expand description

    Checks if p1 and p2 are the same file. If error happens when trying to get files’ metadata, returns false

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/fs/fn.resolve_relative_path.html b/dev/uucore/fs/fn.resolve_relative_path.html index f048b35a8..9e70637e0 100644 --- a/dev/uucore/fs/fn.resolve_relative_path.html +++ b/dev/uucore/fs/fn.resolve_relative_path.html @@ -1,2 +1,2 @@ -resolve_relative_path in uucore::fs - Rust
    pub fn resolve_relative_path(path: &Path) -> Cow<'_, Path>
    Expand description

    resolve a relative path

    -
    \ No newline at end of file +resolve_relative_path in uucore::fs - Rust
    pub fn resolve_relative_path(path: &Path) -> Cow<'_, Path>
    Expand description

    resolve a relative path

    +
    \ No newline at end of file diff --git a/dev/uucore/fs/index.html b/dev/uucore/fs/index.html index e86d082f2..8eccf821c 100644 --- a/dev/uucore/fs/index.html +++ b/dev/uucore/fs/index.html @@ -1,25 +1,13 @@ -uucore::fs - Rust

    Module uucore::fs

    source · []
    Expand description

    Set of functions to manage files and symlinks

    -

    Macros

    Structs

    Information to uniquely identify a file

    -

    Enums

    Controls how symbolic links should be handled when canonicalizing a path.

    -

    Controls when symbolic links are resolved

    -

    Functions

    Return the canonical, absolute form of a path.

    -

    For some programs like install or mkdir, dir/. can be provided +uucore::fs - Rust

    Module uucore::fs

    source · []
    Expand description

    Set of functions to manage files and symlinks

    +

    Macros

    Structs

    Information to uniquely identify a file

    Enums

    Controls how symbolic links should be handled when canonicalizing a path.
    Controls when symbolic links are resolved

    Functions

    Return the canonical, absolute form of a path.
    For some programs like install or mkdir, dir/. can be provided Special case to match GNU’s behavior: install -d foo/. should work and just create foo/ -std::fs::create_dir(“foo/.”); fails in pure Rust

    -

    Display the permissions of a file -On non unix like system, just show ‘–––––’

    -

    Display the permissions of a file on a unix like system

    -

    Checks if p1 and p2 are the same file information. -If error happens when trying to get files’ metadata, returns false

    -

    Converts absolute path to be relative to absolute to path.

    -

    Normalize a path by removing relative information +std::fs::create_dir(“foo/.”); fails in pure Rust

    Display the permissions of a file +On non unix like system, just show ‘–––––’
    Display the permissions of a file on a unix like system
    Checks if p1 and p2 are the same file information. +If error happens when trying to get files’ metadata, returns false
    Converts absolute path to be relative to absolute to path.
    Normalize a path by removing relative information For example, convert ‘bar/../foo/bar.txt’ => ‘foo/bar.txt’ copied from <https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90> both projects are MIT <https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT> for std impl progress see rfc <https://github.com/rust-lang/rfcs/issues/2208> -replace this once that lands

    -

    Checks if p1 and p2 are the same file. -If error happens when trying to get files’ metadata, returns false

    -

    resolve a relative path

    -
    \ No newline at end of file +replace this once that lands
    Checks if p1 and p2 are the same file. +If error happens when trying to get files’ metadata, returns false
    resolve a relative path
    \ No newline at end of file diff --git a/dev/uucore/fs/macro.has.html b/dev/uucore/fs/macro.has.html index 792b19a0e..d64fdb5fa 100644 --- a/dev/uucore/fs/macro.has.html +++ b/dev/uucore/fs/macro.has.html @@ -1,4 +1,4 @@ -has in uucore::fs - Rust
    macro_rules! has {
    -    ($mode:expr, $perm:expr) => { ... };
    +has in uucore::fs - Rust
    macro_rules! has {
    +    ($mode:expr, $perm:expr) => { ... };
     }
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/fs/struct.FileInformation.html b/dev/uucore/fs/struct.FileInformation.html index 759675e0e..eed7514f9 100644 --- a/dev/uucore/fs/struct.FileInformation.html +++ b/dev/uucore/fs/struct.FileInformation.html @@ -1,22 +1,12 @@ -FileInformation in uucore::fs - Rust
    pub struct FileInformation(_);
    Expand description

    Information to uniquely identify a file

    -

    Implementations

    Get information from a currently open file

    -

    Get information for a given path.

    +FileInformation in uucore::fs - Rust
    pub struct FileInformation(_);
    Expand description

    Information to uniquely identify a file

    +

    Implementations

    Get information from a currently open file

    +

    Get information for a given path.

    If path points to a symlink and dereference is true, information about the link’s target will be returned.

    -

    Trait Implementations

    Feeds this value into the given Hasher. Read more

    -

    Feeds a slice of this type into the given Hasher. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations

    Feeds this value into the given Hasher. Read more
    Feeds a slice of this type into the given Hasher. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/fsext/fn.StatFs.html b/dev/uucore/fsext/fn.StatFs.html index 2775495eb..9878146f6 100644 --- a/dev/uucore/fsext/fn.StatFs.html +++ b/dev/uucore/fsext/fn.StatFs.html @@ -1 +1 @@ -StatFs in uucore::fsext - Rust
    pub unsafe extern "C" fn StatFs(
        path: *const i8,
        buf: *mut statfs
    ) -> i32
    \ No newline at end of file +StatFs in uucore::fsext - Rust
    pub unsafe extern "C" fn StatFs(
        path: *const i8,
        buf: *mut statfs
    ) -> i32
    \ No newline at end of file diff --git a/dev/uucore/fsext/fn.pretty_filetype.html b/dev/uucore/fsext/fn.pretty_filetype.html index d0ed6c93d..44e7ddcc1 100644 --- a/dev/uucore/fsext/fn.pretty_filetype.html +++ b/dev/uucore/fsext/fn.pretty_filetype.html @@ -1 +1 @@ -pretty_filetype in uucore::fsext - Rust
    pub fn pretty_filetype<'a>(mode: mode_t, size: u64) -> &'a str
    \ No newline at end of file +pretty_filetype in uucore::fsext - Rust
    pub fn pretty_filetype<'a>(mode: mode_t, size: u64) -> &'a str
    \ No newline at end of file diff --git a/dev/uucore/fsext/fn.pretty_fstype.html b/dev/uucore/fsext/fn.pretty_fstype.html index 574edf205..e8f542d33 100644 --- a/dev/uucore/fsext/fn.pretty_fstype.html +++ b/dev/uucore/fsext/fn.pretty_fstype.html @@ -1 +1 @@ -pretty_fstype in uucore::fsext - Rust
    pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str>
    \ No newline at end of file +pretty_fstype in uucore::fsext - Rust
    pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str>
    \ No newline at end of file diff --git a/dev/uucore/fsext/fn.pretty_time.html b/dev/uucore/fsext/fn.pretty_time.html index 87afce51d..ba4739209 100644 --- a/dev/uucore/fsext/fn.pretty_time.html +++ b/dev/uucore/fsext/fn.pretty_time.html @@ -1 +1 @@ -pretty_time in uucore::fsext - Rust
    pub fn pretty_time(sec: i64, nsec: i64) -> String
    \ No newline at end of file +pretty_time in uucore::fsext - Rust
    pub fn pretty_time(sec: i64, nsec: i64) -> String
    \ No newline at end of file diff --git a/dev/uucore/fsext/fn.read_fs_list.html b/dev/uucore/fsext/fn.read_fs_list.html index b40cf30c4..8cc3e8884 100644 --- a/dev/uucore/fsext/fn.read_fs_list.html +++ b/dev/uucore/fsext/fn.read_fs_list.html @@ -1,2 +1,2 @@ -read_fs_list in uucore::fsext - Rust
    pub fn read_fs_list() -> Result<Vec<MountInfo>, Error>
    Expand description

    Read file system list.

    -
    \ No newline at end of file +read_fs_list in uucore::fsext - Rust
    pub fn read_fs_list() -> Result<Vec<MountInfo>, Error>
    Expand description

    Read file system list.

    +
    \ No newline at end of file diff --git a/dev/uucore/fsext/fn.statfs.html b/dev/uucore/fsext/fn.statfs.html index c1a3ad48f..b95a13bf7 100644 --- a/dev/uucore/fsext/fn.statfs.html +++ b/dev/uucore/fsext/fn.statfs.html @@ -1 +1 @@ -statfs in uucore::fsext - Rust
    pub fn statfs<P>(path: P) -> Result<StatFs, String> where
        P: Into<Vec<u8>>, 
    \ No newline at end of file +statfs in uucore::fsext - Rust
    pub fn statfs<P>(path: P) -> Result<StatFs, String>where
        P: Into<Vec<u8>>,
    \ No newline at end of file diff --git a/dev/uucore/fsext/fn.statfs_fn.html b/dev/uucore/fsext/fn.statfs_fn.html index 3fc6937be..23751b851 100644 --- a/dev/uucore/fsext/fn.statfs_fn.html +++ b/dev/uucore/fsext/fn.statfs_fn.html @@ -1 +1 @@ -statfs_fn in uucore::fsext - Rust
    pub unsafe extern "C" fn statfs_fn(
        path: *const i8,
        buf: *mut statfs
    ) -> i32
    \ No newline at end of file +statfs_fn in uucore::fsext - Rust
    pub unsafe extern "C" fn statfs_fn(
        path: *const i8,
        buf: *mut statfs
    ) -> i32
    \ No newline at end of file diff --git a/dev/uucore/fsext/index.html b/dev/uucore/fsext/index.html index b3c15d0e4..7d07dcc06 100644 --- a/dev/uucore/fsext/index.html +++ b/dev/uucore/fsext/index.html @@ -1,3 +1,2 @@ -uucore::fsext - Rust
    \ No newline at end of file +uucore::fsext - Rust
    \ No newline at end of file diff --git a/dev/uucore/fsext/struct.FsUsage.html b/dev/uucore/fsext/struct.FsUsage.html index 8e018adfd..0441638c0 100644 --- a/dev/uucore/fsext/struct.FsUsage.html +++ b/dev/uucore/fsext/struct.FsUsage.html @@ -1,26 +1,13 @@ -FsUsage in uucore::fsext - Rust
    pub struct FsUsage {
    -    pub blocksize: u64,
    -    pub blocks: u64,
    -    pub bfree: u64,
    -    pub bavail: u64,
    -    pub bavail_top_bit_set: bool,
    -    pub files: u64,
    -    pub ffree: u64,
    -}

    Fields

    blocksize: u64blocks: u64bfree: u64bavail: u64bavail_top_bit_set: boolfiles: u64ffree: u64

    Implementations

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +FsUsage in uucore::fsext - Rust
    pub struct FsUsage {
    +    pub blocksize: u64,
    +    pub blocks: u64,
    +    pub bfree: u64,
    +    pub bavail: u64,
    +    pub bavail_top_bit_set: bool,
    +    pub files: u64,
    +    pub ffree: u64,
    +}

    Fields

    blocksize: u64blocks: u64bfree: u64bavail: u64bavail_top_bit_set: boolfiles: u64ffree: u64

    Implementations

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/fsext/struct.MountInfo.html b/dev/uucore/fsext/struct.MountInfo.html index f8b98aaf3..0a8c03656 100644 --- a/dev/uucore/fsext/struct.MountInfo.html +++ b/dev/uucore/fsext/struct.MountInfo.html @@ -1,27 +1,14 @@ -MountInfo in uucore::fsext - Rust
    pub struct MountInfo {
    -    pub dev_id: String,
    -    pub dev_name: String,
    -    pub fs_type: String,
    -    pub mount_dir: String,
    -    pub mount_option: String,
    -    pub mount_root: String,
    -    pub remote: bool,
    -    pub dummy: bool,
    -}

    Fields

    dev_id: Stringdev_name: Stringfs_type: Stringmount_dir: Stringmount_option: Stringmount_root: Stringremote: booldummy: bool

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +MountInfo in uucore::fsext - Rust
    pub struct MountInfo {
    +    pub dev_id: String,
    +    pub dev_name: String,
    +    pub fs_type: String,
    +    pub mount_dir: String,
    +    pub mount_option: String,
    +    pub mount_root: String,
    +    pub remote: bool,
    +    pub dummy: bool,
    +}

    Fields

    dev_id: Stringdev_name: Stringfs_type: Stringmount_dir: Stringmount_option: Stringmount_root: Stringremote: booldummy: bool

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/fsext/struct.StatFs.html b/dev/uucore/fsext/struct.StatFs.html index 063446e5a..bb33d292c 100644 --- a/dev/uucore/fsext/struct.StatFs.html +++ b/dev/uucore/fsext/struct.StatFs.html @@ -1,35 +1,19 @@ -StatFs in uucore::fsext - Rust
    #[repr(C)]
    pub struct StatFs { - pub f_type: i64, - pub f_bsize: i64, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, +StatFs in uucore::fsext - Rust
    #[repr(C)]
    pub struct StatFs { + pub f_type: i64, + pub f_bsize: i64, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, pub f_fsid: fsid_t, - pub f_namelen: i64, - pub f_frsize: i64, + pub f_namelen: i64, + pub f_frsize: i64, /* private fields */ -}

    Fields

    f_type: i64f_bsize: i64f_blocks: u64f_bfree: u64f_bavail: u64f_files: u64f_ffree: u64f_fsid: fsid_tf_namelen: i64f_frsize: i64

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Feeds this value into the given Hasher. Read more

    -

    Feeds a slice of this type into the given Hasher. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Fields

    f_type: i64f_bsize: i64f_blocks: u64f_bfree: u64f_bavail: u64f_files: u64f_ffree: u64f_fsid: fsid_tf_namelen: i64f_frsize: i64

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more
    Feeds this value into the given Hasher. Read more
    Feeds a slice of this type into the given Hasher. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/fsext/struct.statfs_fn.html b/dev/uucore/fsext/struct.statfs_fn.html index 2c3849024..cab739109 100644 --- a/dev/uucore/fsext/struct.statfs_fn.html +++ b/dev/uucore/fsext/struct.statfs_fn.html @@ -1,35 +1,19 @@ -statfs_fn in uucore::fsext - Rust
    #[repr(C)]
    pub struct statfs_fn { - pub f_type: i64, - pub f_bsize: i64, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, +statfs_fn in uucore::fsext - Rust
    #[repr(C)]
    pub struct statfs_fn { + pub f_type: i64, + pub f_bsize: i64, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, pub f_fsid: fsid_t, - pub f_namelen: i64, - pub f_frsize: i64, + pub f_namelen: i64, + pub f_frsize: i64, /* private fields */ -}

    Fields

    f_type: i64f_bsize: i64f_blocks: u64f_bfree: u64f_bavail: u64f_files: u64f_ffree: u64f_fsid: fsid_tf_namelen: i64f_frsize: i64

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Feeds this value into the given Hasher. Read more

    -

    Feeds a slice of this type into the given Hasher. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Fields

    f_type: i64f_bsize: i64f_blocks: u64f_bfree: u64f_bavail: u64f_files: u64f_ffree: u64f_fsid: fsid_tf_namelen: i64f_frsize: i64

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more
    Feeds this value into the given Hasher. Read more
    Feeds a slice of this type into the given Hasher. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/fsext/trait.BirthTime.html b/dev/uucore/fsext/trait.BirthTime.html index 868a42050..e89060952 100644 --- a/dev/uucore/fsext/trait.BirthTime.html +++ b/dev/uucore/fsext/trait.BirthTime.html @@ -1,4 +1,4 @@ -BirthTime in uucore::fsext - Rust
    pub trait BirthTime {
    -    fn pretty_birth(&self) -> String;
    -    fn birth(&self) -> String;
    -}

    Required Methods

    Implementations on Foreign Types

    Implementors

    \ No newline at end of file +BirthTime in uucore::fsext - Rust
    pub trait BirthTime {
    +    fn pretty_birth(&self) -> String;
    +    fn birth(&self) -> String;
    +}

    Required Methods

    Implementations on Foreign Types

    Implementors

    \ No newline at end of file diff --git a/dev/uucore/fsext/trait.FsMeta.html b/dev/uucore/fsext/trait.FsMeta.html index 4a3cb0d1b..3bcaa2b83 100644 --- a/dev/uucore/fsext/trait.FsMeta.html +++ b/dev/uucore/fsext/trait.FsMeta.html @@ -1,12 +1,12 @@ -FsMeta in uucore::fsext - Rust
    pub trait FsMeta {
    -    fn fs_type(&self) -> i64;
    -    fn io_size(&self) -> u64;
    -    fn block_size(&self) -> i64;
    -    fn total_blocks(&self) -> u64;
    -    fn free_blocks(&self) -> u64;
    -    fn avail_blocks(&self) -> u64;
    -    fn total_file_nodes(&self) -> u64;
    -    fn free_file_nodes(&self) -> u64;
    -    fn fsid(&self) -> u64;
    -    fn namelen(&self) -> u64;
    -}

    Required Methods

    Implementors

    \ No newline at end of file +FsMeta in uucore::fsext - Rust
    pub trait FsMeta {
    +    fn fs_type(&self) -> i64;
    +    fn io_size(&self) -> u64;
    +    fn block_size(&self) -> i64;
    +    fn total_blocks(&self) -> u64;
    +    fn free_blocks(&self) -> u64;
    +    fn avail_blocks(&self) -> u64;
    +    fn total_file_nodes(&self) -> u64;
    +    fn free_file_nodes(&self) -> u64;
    +    fn fsid(&self) -> u64;
    +    fn namelen(&self) -> u64;
    +}

    Required Methods

    Implementors

    \ No newline at end of file diff --git a/dev/uucore/index.html b/dev/uucore/index.html index bd8ce076a..1573768d2 100644 --- a/dev/uucore/index.html +++ b/dev/uucore/index.html @@ -1,29 +1,2 @@ -uucore - Rust

    Re-exports

    pub extern crate libc;

    Modules

    Implement GNU-style backup functionality.

    -

    Get password/group file entry

    -

    All utils return exit with an exit code. Usually, the following scheme is used:

    -

    Set of functions to manage files and symlinks

    -

    Set of functions to manage file systems

    -

    Iterate over lines, including the line ending character(s).

    -

    Memo runner of printf -Takes a format string and arguments

    -

    Set of functions to parse modes

    -

    Custom panic hooks that allow silencing certain types of errors.

    -

    Parsing a glob Pattern from a string.

    -

    Parsing a duration from a string.

    -

    Common functions to manage permissions

    -

    Set of functions to manage IDs

    -

    A fixed-size ring buffer.

    -

    Aims to provide platform-independent methods to obtain login records

    -

    Macros

    Display an error and std::process::exit

    -

    Unwrap a std::result::Result, crashing instead of panicking.

    -

    Reads a section from a file of the util as a str literal.

    -

    Get the usage from the “Usage” section in the help file.

    -

    Display a crate::error::UError and set global exit code.

    -

    Show an error to stderr in a similar style to GNU coreutils.

    -

    Display an error and set global exit code in error case.

    -

    Print a warning message to stderr.

    -

    Shorthand to construct UIoError-instances.

    -

    Traits

    Functions

    Derive the complete execution phrase for “usage”.

    -

    Generate the usage string for clap.

    -

    Derive the utility name.

    -

    Attribute Macros

    \ No newline at end of file +uucore - Rust

    Re-exports

    pub extern crate libc;

    Modules

    Implement GNU-style backup functionality.
    Get password/group file entry
    All utils return exit with an exit code. Usually, the following scheme is used:
    Set of functions to manage files and symlinks
    Set of functions to manage file systems
    Iterate over lines, including the line ending character(s).
    Memo runner of printf +Takes a format string and arguments
    Set of functions to parse modes
    Custom panic hooks that allow silencing certain types of errors.
    Parsing a glob Pattern from a string.
    Parsing a duration from a string.
    Common functions to manage permissions
    Set of functions to manage IDs
    A fixed-size ring buffer.
    Aims to provide platform-independent methods to obtain login records

    Macros

    Display an error and std::process::exit
    Unwrap a std::result::Result, crashing instead of panicking.
    Reads a section from a file of the util as a str literal.
    Get the usage from the “Usage” section in the help file.
    Display a crate::error::UError and set global exit code.
    Show an error to stderr in a similar style to GNU coreutils.
    Display an error and set global exit code in error case.
    Print a warning message to stderr.
    Shorthand to construct UIoError-instances.

    Traits

    Functions

    Derive the complete execution phrase for “usage”.
    Generate the usage string for clap.
    Derive the utility name.

    Attribute Macros

    \ No newline at end of file diff --git a/dev/uucore/lines/fn.lines.html b/dev/uucore/lines/fn.lines.html index de87947b4..457f290e6 100644 --- a/dev/uucore/lines/fn.lines.html +++ b/dev/uucore/lines/fn.lines.html @@ -1,31 +1,31 @@ -lines in uucore::lines - Rust
    pub fn lines<B>(reader: B, sep: u8) -> Lines<B>Notable traits for Lines<B>impl<B: BufRead> Iterator for Lines<B>    type Item = Result<Vec<u8>>; where
        B: BufRead
    Expand description

    Returns an iterator over the lines, including line ending characters.

    -

    This function is just like BufRead::lines, but it includes the -line ending characters in each yielded String if the input +lines in uucore::lines - Rust

    pub fn lines<B>(reader: B, sep: u8) -> Lines<B>Notable traits for Lines<B>impl<B: BufRead> Iterator for Lines<B>    type Item = Result<Vec<u8>>;where
        B: BufRead,
    Expand description

    Returns an iterator over the lines, including line ending characters.

    +

    This function is just like BufRead::lines, but it includes the +line ending characters in each yielded String if the input data has them. Set the sep parameter to the line ending character; for Unix line endings, use b'\n'.

    Examples

    Use sep to specify an alternate character for line endings. For example, if lines are terminated by the null character b'\0':

    -
    use std::io::BufRead;
    -use std::io::Cursor;
    +
    use std::io::BufRead;
    +use std::io::Cursor;
     
    -let cursor = Cursor::new(b"x\0y\0z\0");
    -let mut it = lines(cursor, b'\0').map(|l| l.unwrap());
    +let cursor = Cursor::new(b"x\0y\0z\0");
    +let mut it = lines(cursor, b'\0').map(|l| l.unwrap());
     
    -assert_eq!(it.next(), Some(Vec::from("x\0")));
    -assert_eq!(it.next(), Some(Vec::from("y\0")));
    -assert_eq!(it.next(), Some(Vec::from("z\0")));
    -assert_eq!(it.next(), None);
    +assert_eq!(it.next(), Some(Vec::from("x\0"))); +assert_eq!(it.next(), Some(Vec::from("y\0"))); +assert_eq!(it.next(), Some(Vec::from("z\0"))); +assert_eq!(it.next(), None);

    If the input data does not end with a newline character ('\n'), -then the last String yielded by this iterator also does not +then the last String yielded by this iterator also does not end with a newline:

    -
    let cursor = Cursor::new(b"x\ny\nz");
    -let mut it = lines(cursor, b'\n').map(|l| l.unwrap());
    +
    let cursor = Cursor::new(b"x\ny\nz");
    +let mut it = lines(cursor, b'\n').map(|l| l.unwrap());
     
    -assert_eq!(it.next(), Some(Vec::from("x\n")));
    -assert_eq!(it.next(), Some(Vec::from("y\n")));
    -assert_eq!(it.next(), Some(Vec::from("z")));
    -assert_eq!(it.next(), None);
    -
    \ No newline at end of file +assert_eq!(it.next(), Some(Vec::from("x\n"))); +assert_eq!(it.next(), Some(Vec::from("y\n"))); +assert_eq!(it.next(), Some(Vec::from("z"))); +assert_eq!(it.next(), None);
    +
    \ No newline at end of file diff --git a/dev/uucore/lines/index.html b/dev/uucore/lines/index.html index 5a5f36375..ef641768d 100644 --- a/dev/uucore/lines/index.html +++ b/dev/uucore/lines/index.html @@ -1,12 +1,10 @@ -uucore::lines - Rust
    Expand description

    Iterate over lines, including the line ending character(s).

    +uucore::lines - Rust
    Expand description

    Iterate over lines, including the line ending character(s).

    This module provides the lines function, similar to the -BufRead::lines method. While the BufRead::lines method -yields String instances that do not include the line ending +BufRead::lines method. While the BufRead::lines method +yields String instances that do not include the line ending characters ("\n" or "\r\n"), our functions yield -Vec<[‘u8’]> instances that include the line ending +Vec<[‘u8’]> instances that include the line ending characters. This is useful if the input data does not end with a newline character and you want to preserve the exact form of the input data.

    -

    Structs

    An iterator over the lines of an instance of BufRead.

    -

    Functions

    Returns an iterator over the lines, including line ending characters.

    -
    \ No newline at end of file +

    Structs

    An iterator over the lines of an instance of BufRead.

    Functions

    Returns an iterator over the lines, including line ending characters.
    \ No newline at end of file diff --git a/dev/uucore/lines/struct.Lines.html b/dev/uucore/lines/struct.Lines.html index ced917d22..7a2289345 100644 --- a/dev/uucore/lines/struct.Lines.html +++ b/dev/uucore/lines/struct.Lines.html @@ -1,342 +1,139 @@ -Lines in uucore::lines - Rust
    pub struct Lines<B> { /* private fields */ }
    Expand description

    An iterator over the lines of an instance of BufRead.

    +Lines in uucore::lines - Rust
    pub struct Lines<B> { /* private fields */ }
    Expand description

    An iterator over the lines of an instance of BufRead.

    This struct is generally created by calling lines on a BufRead. Please see the documentation of lines for more details.

    -

    Trait Implementations

    The type of the elements being iterated over.

    -

    Advances the iterator and returns the next value. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_next_chunk)

    Advances the iterator and returns an array containing the next N values. Read more

    -

    Returns the bounds on the remaining length of the iterator. Read more

    -

    Consumes the iterator, counting the number of iterations and returning it. Read more

    -

    Consumes the iterator, returning the last element. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_advance_by)

    Advances the iterator by n elements. Read more

    -

    Returns the nth element of the iterator. Read more

    -

    Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more

    -

    Takes two iterators and creates a new iterator over both in sequence. Read more

    -

    ‘Zips up’ two iterators into a single iterator of pairs. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places a copy of separator between adjacent -items of the original iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more

    -

    Takes a closure and creates an iterator which calls that closure on each -element. Read more

    -

    Calls a closure on each element of an iterator. Read more

    -

    Creates an iterator which uses a closure to determine if an element -should be yielded. Read more

    -

    Creates an iterator that both filters and maps. Read more

    -

    Creates an iterator which gives the current iteration count as well as -the next value. Read more

    -

    Creates an iterator which can use the peek and peek_mut methods +

    Trait Implementations

    The type of the elements being iterated over.
    Advances the iterator and returns the next value. Read more
    🔬This is a nightly-only experimental API. (iter_next_chunk)
    Advances the iterator and returns an array containing the next N values. Read more
    Returns the bounds on the remaining length of the iterator. Read more
    Consumes the iterator, counting the number of iterations and returning it. Read more
    Consumes the iterator, returning the last element. Read more
    🔬This is a nightly-only experimental API. (iter_advance_by)
    Advances the iterator by n elements. Read more
    Returns the nth element of the iterator. Read more
    Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
    Takes two iterators and creates a new iterator over both in sequence. Read more
    ‘Zips up’ two iterators into a single iterator of pairs. Read more
    🔬This is a nightly-only experimental API. (iter_intersperse)
    Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
    Takes a closure and creates an iterator which calls that closure on each +element. Read more
    Calls a closure on each element of an iterator. Read more
    Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
    Creates an iterator that both filters and maps. Read more
    Creates an iterator which gives the current iteration count as well as +the next value. Read more
    Creates an iterator which can use the peek and peek_mut methods to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more

    -

    Creates an iterator that skips elements based on a predicate. Read more

    -

    Creates an iterator that yields elements based on a predicate. Read more

    -

    Creates an iterator that both yields elements based on a predicate and maps. Read more

    -

    Creates an iterator that skips the first n elements. Read more

    -

    Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more

    -

    An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more

    -

    Creates an iterator that works like map, but flattens nested structure. Read more

    -

    Creates an iterator that flattens nested structure. Read more

    -

    Creates an iterator which ends after the first None. Read more

    -

    Does something with each element of an iterator, passing the value on. Read more

    -

    Borrows an iterator, rather than consuming it. Read more

    -

    Transforms an iterator into a collection. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_collect)

    Fallibly transforms an iterator into a collection, short circuiting if -a failure is encountered. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_collect_into)

    Collects all the items from an iterator into a collection. Read more

    -

    Consumes an iterator, creating two collections from it. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_partition_in_place)

    Reorders the elements of this iterator in-place according to the given predicate, -such that all those that return true precede all those that return false. -Returns the number of true elements found. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_is_partitioned)

    Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more

    -

    An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more

    -

    An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more

    -

    Folds every element into an accumulator by applying an operation, -returning the final result. Read more

    -

    Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_reduce)

    Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more

    -

    Tests if every element of the iterator matches a predicate. Read more

    -

    Tests if any element of the iterator matches a predicate. Read more

    -

    Searches for an element of an iterator that satisfies a predicate. Read more

    -

    Applies function to the elements of iterator and returns -the first non-none result. Read more

    -
    🔬 This is a nightly-only experimental API. (try_find)

    Applies function to the elements of iterator and returns -the first true result or the first error. Read more

    -

    Searches for an element in an iterator, returning its index. Read more

    -

    Searches for an element in an iterator from the right, returning its -index. Read more

    -

    Returns the maximum element of an iterator. Read more

    -

    Returns the minimum element of an iterator. Read more

    -

    Returns the element that gives the maximum value from the -specified function. Read more

    -

    Returns the element that gives the maximum value with respect to the -specified comparison function. Read more

    -

    Returns the element that gives the minimum value from the -specified function. Read more

    -

    Returns the element that gives the minimum value with respect to the -specified comparison function. Read more

    -

    Reverses an iterator’s direction. Read more

    -

    Converts an iterator of pairs into a pair of containers. Read more

    -

    Creates an iterator which copies all of its elements. Read more

    -

    Creates an iterator which clones all of its elements. Read more

    -

    Repeats an iterator endlessly. Read more

    -

    Sums the elements of an iterator. Read more

    -

    Iterates over the entire iterator, multiplying all the elements Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Determines if the elements of this Iterator are equal to those of -another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more

    -

    Determines if the elements of this Iterator are unequal to those of -another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given comparator function. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +their documentation for more information. Read more
    Creates an iterator that skips elements based on a predicate. Read more
    Creates an iterator that yields elements based on a predicate. Read more
    Creates an iterator that both yields elements based on a predicate and maps. Read more
    Creates an iterator that skips the first n elements. Read more
    Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
    An iterator adapter similar to fold that holds internal state and +produces a new iterator. Read more
    Creates an iterator that works like map, but flattens nested structure. Read more
    Creates an iterator which ends after the first None. Read more
    Does something with each element of an iterator, passing the value on. Read more
    Borrows an iterator, rather than consuming it. Read more
    Transforms an iterator into a collection. Read more
    🔬This is a nightly-only experimental API. (iter_collect_into)
    Collects all the items from an iterator into a collection. Read more
    Consumes an iterator, creating two collections from it. Read more
    🔬This is a nightly-only experimental API. (iter_is_partitioned)
    Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
    An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
    An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
    Folds every element into an accumulator by applying an operation, +returning the final result. Read more
    Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
    🔬This is a nightly-only experimental API. (iterator_try_reduce)
    Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
    Tests if every element of the iterator matches a predicate. Read more
    Tests if any element of the iterator matches a predicate. Read more
    Searches for an element of an iterator that satisfies a predicate. Read more
    Applies function to the elements of iterator and returns +the first non-none result. Read more
    🔬This is a nightly-only experimental API. (try_find)
    Applies function to the elements of iterator and returns +the first true result or the first error. Read more
    Searches for an element in an iterator, returning its index. Read more
    Returns the element that gives the maximum value from the +specified function. Read more
    Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
    Returns the element that gives the minimum value from the +specified function. Read more
    Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
    Converts an iterator of pairs into a pair of containers. Read more
    Creates an iterator which copies all of its elements. Read more
    Creates an iterator which clones all of its elements. Read more
    🔬This is a nightly-only experimental API. (iter_array_chunks)
    Returns an iterator over N elements of the iterator at a time. Read more
    Sums the elements of an iterator. Read more
    Iterates over the entire iterator, multiplying all the elements Read more
    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    Lexicographically compares the elements of this Iterator with those +of another. Read more
    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    Determines if the elements of this Iterator are equal to those of +another. Read more
    🔬This is a nightly-only experimental API. (iter_order_by)
    Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
    Determines if the elements of this Iterator are unequal to those of +another. Read more
    Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
    Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
    Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
    Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given comparator function. Read more
    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type of the elements being iterated over.

    -

    Which kind of iterator are we turning this into?

    -

    Creates an iterator from a value. Read more

    -

    Alternate elements from two iterators until both have run out. Read more

    -

    Alternate elements from two iterators until at least one of them has run -out. Read more

    -

    An iterator adaptor to insert a particular value -between each element of the adapted iterator. Read more

    -

    An iterator adaptor to insert a particular value created by a function -between each element of the adapted iterator. Read more

    -

    Create an iterator which iterates over both this and the specified -iterator simultaneously, yielding pairs of two optional elements. Read more

    -

    Create an iterator which iterates over both this and the specified -iterator simultaneously, yielding pairs of elements. Read more

    -

    A “meta iterator adaptor”. Its closure receives a reference to the +From<T> for U chooses to do.

    +
    The type of the elements being iterated over.
    Which kind of iterator are we turning this into?
    Creates an iterator from a value. Read more
    Alternate elements from two iterators until both have run out. Read more
    Alternate elements from two iterators until at least one of them has run +out. Read more
    An iterator adaptor to insert a particular value +between each element of the adapted iterator. Read more
    An iterator adaptor to insert a particular value created by a function +between each element of the adapted iterator. Read more
    Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of two optional elements. Read more
    Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of elements. Read more
    A “meta iterator adaptor”. Its closure receives a reference to the iterator and may pick off as many elements as it likes, to produce the -next iterator element. Read more

    -

    Return an iterable that can group iterator elements. +next iterator element. Read more

    Return an iterable that can group iterator elements. Consecutive elements that map to the same key (“runs”), are assigned -to the same group. Read more

    -

    Return an iterable that can chunk the iterator. Read more

    -

    Return an iterator over all contiguous windows producing tuples of -a specific size (up to 12). Read more

    -

    Return an iterator over all windows, wrapping back to the first +to the same group. Read more

    Return an iterable that can chunk the iterator. Read more
    Return an iterator over all contiguous windows producing tuples of +a specific size (up to 12). Read more
    Return an iterator over all windows, wrapping back to the first elements when the window would otherwise exceed the length of the -iterator, producing tuples of a specific size (up to 12). Read more

    -

    Return an iterator that groups the items in tuples of a specific size -(up to 12). Read more

    -

    Split into an iterator pair that both yield all elements from -the original iterator. Read more

    -
    👎 Deprecated since 0.8.0:

    Use std .step_by() instead

    -

    Return an iterator adaptor that steps n elements in the base iterator -for each iteration. Read more

    -

    Convert each item of the iterator using the Into trait. Read more

    -
    👎 Deprecated since 0.10.0:

    Use .map_ok() instead

    -

    See .map_ok().

    -

    Return an iterator adaptor that applies the provided closure +iterator, producing tuples of a specific size (up to 12). Read more

    Return an iterator that groups the items in tuples of a specific size +(up to 12). Read more
    Split into an iterator pair that both yield all elements from +the original iterator. Read more
    👎Deprecated since 0.8.0:

    Use std .step_by() instead

    +
    Return an iterator adaptor that steps n elements in the base iterator +for each iteration. Read more
    Convert each item of the iterator using the Into trait. Read more
    👎Deprecated since 0.10.0:

    Use .map_ok() instead

    +
    Return an iterator adaptor that applies the provided closure to every Result::Ok value. Result::Err values are -unchanged. Read more

    -

    Return an iterator adaptor that filters every Result::Ok +unchanged. Read more

    Return an iterator adaptor that filters every Result::Ok value with the provided closure. Result::Err values are -unchanged. Read more

    -

    Return an iterator adaptor that filters and transforms every +unchanged. Read more

    Return an iterator adaptor that filters and transforms every Result::Ok value with the provided closure. Result::Err -values are unchanged. Read more

    -

    Return an iterator adaptor that flattens every Result::Ok value into -a series of Result::Ok values. Result::Err values are unchanged. Read more

    -

    Return an iterator adaptor that merges the two base iterators in +values are unchanged. Read more

    Return an iterator adaptor that flattens every Result::Ok value into +a series of Result::Ok values. Result::Err values are unchanged. Read more
    Return an iterator adaptor that merges the two base iterators in ascending order. If both base iterators are sorted (ascending), the -result is sorted. Read more

    -

    Return an iterator adaptor that merges the two base iterators in order. -This is much like .merge() but allows for a custom ordering. Read more

    -

    Create an iterator that merges items from both this and the specified -iterator in ascending order. Read more

    -

    Return an iterator adaptor that flattens an iterator of iterators by -merging them in ascending order. Read more

    -

    Return an iterator adaptor that flattens an iterator of iterators by -merging them according to the given closure. Read more

    -

    Return an iterator adaptor that iterates over the cartesian product of -the element sets of two iterators self and J. Read more

    -

    Return an iterator adaptor that iterates over the cartesian product of -all subiterators returned by meta-iterator self. Read more

    -

    Return an iterator adaptor that uses the passed-in closure to -optionally merge together consecutive elements. Read more

    -

    Remove duplicates from sections of consecutive identical elements. -If the iterator is sorted, all elements will be unique. Read more

    -

    Remove duplicates from sections of consecutive identical elements, +result is sorted. Read more

    Return an iterator adaptor that merges the two base iterators in order. +This is much like .merge() but allows for a custom ordering. Read more
    Create an iterator that merges items from both this and the specified +iterator in ascending order. Read more
    Return an iterator adaptor that flattens an iterator of iterators by +merging them in ascending order. Read more
    Return an iterator adaptor that flattens an iterator of iterators by +merging them according to the given closure. Read more
    Return an iterator adaptor that iterates over the cartesian product of +the element sets of two iterators self and J. Read more
    Return an iterator adaptor that iterates over the cartesian product of +all subiterators returned by meta-iterator self. Read more
    Return an iterator adaptor that uses the passed-in closure to +optionally merge together consecutive elements. Read more
    Remove duplicates from sections of consecutive identical elements. +If the iterator is sorted, all elements will be unique. Read more
    Remove duplicates from sections of consecutive identical elements, determining equality using a comparison function. -If the iterator is sorted, all elements will be unique. Read more

    -

    Remove duplicates from sections of consecutive identical elements, while keeping a count of +If the iterator is sorted, all elements will be unique. Read more

    Remove duplicates from sections of consecutive identical elements, while keeping a count of how many repeated elements were present. -If the iterator is sorted, all elements will be unique. Read more

    -

    Remove duplicates from sections of consecutive identical elements, while keeping a count of +If the iterator is sorted, all elements will be unique. Read more

    Remove duplicates from sections of consecutive identical elements, while keeping a count of how many repeated elements were present. This will determine equality using a comparison function. -If the iterator is sorted, all elements will be unique. Read more

    -

    Return an iterator adaptor that produces elements that appear more than once during the -iteration. Duplicates are detected using hash and equality. Read more

    -

    Return an iterator adaptor that produces elements that appear more than once during the -iteration. Duplicates are detected using hash and equality. Read more

    -

    Return an iterator adaptor that filters out elements that have +If the iterator is sorted, all elements will be unique. Read more

    Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
    Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
    Return an iterator adaptor that filters out elements that have already been produced once during the iteration. Duplicates -are detected using hash and equality. Read more

    -

    Return an iterator adaptor that filters out elements that have -already been produced once during the iteration. Read more

    -

    Return an iterator adaptor that borrows from this iterator and -takes items while the closure accept returns true. Read more

    -

    Return an iterator adaptor that borrows from a Clone-able iterator -to only pick off elements while the predicate accept returns true. Read more

    -

    Return an iterator adaptor that filters Option<A> iterator elements -and produces A. Stops on the first None encountered. Read more

    -

    Return an iterator adaptor that iterates over the combinations of the -elements from an iterator. Read more

    -

    Return an iterator adaptor that iterates over the k-length combinations of -the elements from an iterator. Read more

    -

    Return an iterator that iterates over the k-length combinations of -the elements from an iterator, with replacement. Read more

    -

    Return an iterator adaptor that iterates over all k-permutations of the -elements from an iterator. Read more

    -

    Return an iterator that iterates through the powerset of the elements from an -iterator. Read more

    -

    Return an iterator adaptor that pads the sequence to a minimum length of -min by filling missing elements using a closure f. Read more

    -

    Return an iterator adaptor that wraps each element in a Position to -ease special-case handling of the first or last elements. Read more

    -

    Return an iterator adaptor that yields the indices of all elements -satisfying a predicate, counted from the start of the iterator. Read more

    -

    Return an iterator adaptor that applies a mutating function -to each element before yielding it. Read more

    -

    Advances the iterator and returns the next items grouped in a tuple of -a specific size (up to 12). Read more

    -

    Collects all items from the iterator into a tuple of a specific size -(up to 12). Read more

    -

    Find the position and value of the first element satisfying a predicate. Read more

    -

    Find the value of the first element satisfying a predicate or return the last element, if any. Read more

    -

    Find the value of the first element satisfying a predicate or return the first element, if any. Read more

    -

    Returns true if the given item is present in this iterator. Read more

    -

    Check whether all elements compare equal. Read more

    -

    Check whether all elements are unique (non equal). Read more

    -

    Consume the first n elements from the iterator eagerly, -and return the same iterator again. Read more

    -

    Consume the last n elements from the iterator eagerly, -and return the same iterator again. Read more

    -
    👎 Deprecated since 0.8.0:

    Use .for_each() instead

    -

    Run the closure f eagerly on each element of the iterator. Read more

    -

    Combine all an iterator’s elements into one element by using Extend. Read more

    -

    .collect_vec() is simply a type specialization of Iterator::collect, -for convenience. Read more

    -

    .try_collect() is more convenient way of writing -.collect::<Result<_, _>>() Read more

    -

    Assign to each reference in self from the from iterator, -stopping at the shortest of the two iterators. Read more

    -

    Combine all iterator elements into one String, separated by sep. Read more

    -

    Format all iterator elements, separated by sep. Read more

    -

    Format all iterator elements, separated by sep. Read more

    -
    👎 Deprecated since 0.10.0:

    Use .fold_ok() instead

    -

    See .fold_ok().

    -

    Fold Result values from an iterator. Read more

    -

    Fold Option values from an iterator. Read more

    -
    👎 Deprecated since 0.10.2:

    Use Iterator::reduce instead

    -

    Accumulator of the elements in the iterator. Read more

    -

    Accumulate the elements in the iterator in a tree-like manner. Read more

    -

    An iterator method that applies a function, producing a single, final value. Read more

    -

    Iterate over the entire iterator and add all the elements. Read more

    -

    Iterate over the entire iterator and multiply all the elements. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. The key function is -called exactly once per key. Read more

    -

    Sort the k smallest elements into a new iterator, in ascending order. Read more

    -

    Collect all iterator elements into one of two -partitions. Unlike Iterator::partition, each partition may -have a distinct type. Read more

    -

    Partition a sequence of Results into one list of all the Ok elements -and another list of all the Err elements. Read more

    -

    Return a HashMap of keys mapped to Vecs of values. Keys and values -are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more

    -

    Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified -in the closure. Read more

    -

    Constructs a GroupingMap to be used later with one of the efficient -group-and-fold operations it allows to perform. Read more

    -

    Constructs a GroupingMap to be used later with one of the efficient -group-and-fold operations it allows to perform. Read more

    -

    Return all minimum elements of an iterator. Read more

    -

    Return all minimum elements of an iterator, as determined by -the specified function. Read more

    -

    Return all minimum elements of an iterator, as determined by -the specified function. Read more

    -

    Return all maximum elements of an iterator. Read more

    -

    Return all maximum elements of an iterator, as determined by -the specified function. Read more

    -

    Return all minimum elements of an iterator, as determined by -the specified function. Read more

    -

    Return the minimum and maximum elements in the iterator. Read more

    -

    Return the minimum and maximum element of an iterator, as determined by -the specified function. Read more

    -

    Return the minimum and maximum element of an iterator, as determined by -the specified comparison function. Read more

    -

    Return the position of the maximum element in the iterator. Read more

    -

    Return the position of the maximum element in the iterator, as -determined by the specified function. Read more

    -

    Return the position of the maximum element in the iterator, as -determined by the specified comparison function. Read more

    -

    Return the position of the minimum element in the iterator. Read more

    -

    Return the position of the minimum element in the iterator, as -determined by the specified function. Read more

    -

    Return the position of the minimum element in the iterator, as -determined by the specified comparison function. Read more

    -

    Return the positions of the minimum and maximum elements in -the iterator. Read more

    -

    Return the postions of the minimum and maximum elements of an -iterator, as determined by the specified function. Read more

    -

    Return the postions of the minimum and maximum elements of an -iterator, as determined by the specified comparison function. Read more

    -

    If the iterator yields exactly one element, that element will be returned, otherwise +are detected using hash and equality. Read more

    Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Read more
    Return an iterator adaptor that borrows from this iterator and +takes items while the closure accept returns true. Read more
    Return an iterator adaptor that borrows from a Clone-able iterator +to only pick off elements while the predicate accept returns true. Read more
    Return an iterator adaptor that filters Option<A> iterator elements +and produces A. Stops on the first None encountered. Read more
    Return an iterator adaptor that iterates over the combinations of the +elements from an iterator. Read more
    Return an iterator adaptor that iterates over the k-length combinations of +the elements from an iterator. Read more
    Return an iterator that iterates over the k-length combinations of +the elements from an iterator, with replacement. Read more
    Return an iterator adaptor that iterates over all k-permutations of the +elements from an iterator. Read more
    Return an iterator that iterates through the powerset of the elements from an +iterator. Read more
    Return an iterator adaptor that pads the sequence to a minimum length of +min by filling missing elements using a closure f. Read more
    Return an iterator adaptor that wraps each element in a Position to +ease special-case handling of the first or last elements. Read more
    Return an iterator adaptor that yields the indices of all elements +satisfying a predicate, counted from the start of the iterator. Read more
    Return an iterator adaptor that applies a mutating function +to each element before yielding it. Read more
    Advances the iterator and returns the next items grouped in a tuple of +a specific size (up to 12). Read more
    Collects all items from the iterator into a tuple of a specific size +(up to 12). Read more
    Find the position and value of the first element satisfying a predicate. Read more
    Find the value of the first element satisfying a predicate or return the last element, if any. Read more
    Find the value of the first element satisfying a predicate or return the first element, if any. Read more
    Returns true if the given item is present in this iterator. Read more
    Check whether all elements compare equal. Read more
    Check whether all elements are unique (non equal). Read more
    Consume the first n elements from the iterator eagerly, +and return the same iterator again. Read more
    Consume the last n elements from the iterator eagerly, +and return the same iterator again. Read more
    👎Deprecated since 0.8.0:

    Use .for_each() instead

    +
    Run the closure f eagerly on each element of the iterator. Read more
    Combine all an iterator’s elements into one element by using Extend. Read more
    .collect_vec() is simply a type specialization of Iterator::collect, +for convenience. Read more
    .try_collect() is more convenient way of writing +.collect::<Result<_, _>>() Read more
    Assign to each reference in self from the from iterator, +stopping at the shortest of the two iterators. Read more
    Combine all iterator elements into one String, separated by sep. Read more
    Format all iterator elements, separated by sep. Read more
    Format all iterator elements, separated by sep. Read more
    👎Deprecated since 0.10.0:

    Use .fold_ok() instead

    +
    Fold Result values from an iterator. Read more
    Fold Option values from an iterator. Read more
    👎Deprecated since 0.10.2:

    Use Iterator::reduce instead

    +
    Accumulator of the elements in the iterator. Read more
    Accumulate the elements in the iterator in a tree-like manner. Read more
    An iterator method that applies a function, producing a single, final value. Read more
    Iterate over the entire iterator and add all the elements. Read more
    Iterate over the entire iterator and multiply all the elements. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. The key function is +called exactly once per key. Read more
    Sort the k smallest elements into a new iterator, in ascending order. Read more
    Collect all iterator elements into one of two +partitions. Unlike Iterator::partition, each partition may +have a distinct type. Read more
    Partition a sequence of Results into one list of all the Ok elements +and another list of all the Err elements. Read more
    Return a HashMap of keys mapped to Vecs of values. Keys and values +are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more
    Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified +in the closure. Read more
    Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
    Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
    Return all minimum elements of an iterator. Read more
    Return all minimum elements of an iterator, as determined by +the specified function. Read more
    Return all minimum elements of an iterator, as determined by +the specified function. Read more
    Return all maximum elements of an iterator. Read more
    Return all maximum elements of an iterator, as determined by +the specified function. Read more
    Return all minimum elements of an iterator, as determined by +the specified function. Read more
    Return the minimum and maximum elements in the iterator. Read more
    Return the minimum and maximum element of an iterator, as determined by +the specified function. Read more
    Return the minimum and maximum element of an iterator, as determined by +the specified comparison function. Read more
    Return the position of the maximum element in the iterator. Read more
    Return the position of the maximum element in the iterator, as +determined by the specified function. Read more
    Return the position of the maximum element in the iterator, as +determined by the specified comparison function. Read more
    Return the position of the minimum element in the iterator. Read more
    Return the position of the minimum element in the iterator, as +determined by the specified function. Read more
    Return the position of the minimum element in the iterator, as +determined by the specified comparison function. Read more
    Return the positions of the minimum and maximum elements in +the iterator. Read more
    Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified function. Read more
    Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified comparison function. Read more
    If the iterator yields exactly one element, that element will be returned, otherwise an error will be returned containing an iterator that has the same output as the input -iterator. Read more

    -

    If the iterator yields no elements, Ok(None) will be returned. If the iterator yields +iterator. Read more

    If the iterator yields no elements, Ok(None) will be returned. If the iterator yields exactly one element, that element will be returned, otherwise an error will be returned -containing an iterator that has the same output as the input iterator. Read more

    -

    An iterator adaptor that allows the user to peek at multiple .next() -values without advancing the base iterator. Read more

    -

    Collect the items in this iterator and return a HashMap which +containing an iterator that has the same output as the input iterator. Read more

    An iterator adaptor that allows the user to peek at multiple .next() +values without advancing the base iterator. Read more
    Collect the items in this iterator and return a HashMap which contains each item that appears in the iterator and the number -of times it appears. Read more

    -

    Collect the items in this iterator and return a HashMap which +of times it appears. Read more

    Collect the items in this iterator and return a HashMap which contains each item that appears in the iterator and the number of times it appears, -determining identity using a keying function. Read more

    -

    Converts an iterator of tuples into a tuple of containers. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +determining identity using a keying function. Read more
    Converts an iterator of tuples into a tuple of containers. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/macro.bin.html b/dev/uucore/macro.bin.html index 4aeb4b6ec..c182edea6 100644 --- a/dev/uucore/macro.bin.html +++ b/dev/uucore/macro.bin.html @@ -1,4 +1,4 @@ -bin in uucore - Rust
    macro_rules! bin {
    -    ($util:ident) => { ... };
    +bin in uucore - Rust
    macro_rules! bin {
    +    ($util:ident) => { ... };
     }
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/macro.crash.html b/dev/uucore/macro.crash.html index 4fb78997b..fa164105b 100644 --- a/dev/uucore/macro.crash.html +++ b/dev/uucore/macro.crash.html @@ -1,11 +1,11 @@ -crash in uucore - Rust
    macro_rules! crash {
    -    ($exit_code:expr, $($args:tt)+) => { ... };
    +crash in uucore - Rust
    macro_rules! crash {
    +    ($exit_code:expr, $($args:tt)+) => { ... };
     }
    -
    Expand description

    Display an error and std::process::exit

    +
    Expand description

    Display an error and std::process::exit

    Displays the provided error message using [show_error!], then invokes -std::process::exit with the provided exit code.

    +std::process::exit with the provided exit code.

    Examples

    -
    // outputs <name>: Couldn't apply foo to bar
    -// and terminates execution
    -crash!(1, "Couldn't apply {} to {}", "foo", "bar");
    -
    \ No newline at end of file +
    // outputs <name>: Couldn't apply foo to bar
    +// and terminates execution
    +crash!(1, "Couldn't apply {} to {}", "foo", "bar");
    +
    \ No newline at end of file diff --git a/dev/uucore/macro.crash_if_err.html b/dev/uucore/macro.crash_if_err.html index 7f24c66fb..33aa03f1c 100644 --- a/dev/uucore/macro.crash_if_err.html +++ b/dev/uucore/macro.crash_if_err.html @@ -1,15 +1,15 @@ -crash_if_err in uucore - Rust
    macro_rules! crash_if_err {
    -    ($exit_code:expr, $exp:expr) => { ... };
    +crash_if_err in uucore - Rust
    macro_rules! crash_if_err {
    +    ($exit_code:expr, $exp:expr) => { ... };
     }
    -
    Expand description

    Unwrap a std::result::Result, crashing instead of panicking.

    +
    Expand description

    Unwrap a std::result::Result, crashing instead of panicking.

    If the result is an Ok-variant, returns the value contained inside. If it is an Err-variant, invokes [crash!] with the formatted error instead.

    Examples

    -
    let is_ok: Result<u32, &str> = Ok(1);
    -// Does nothing
    -crash_if_err!(1, is_ok);
    +
    let is_ok: Result<u32, &str> = Ok(1);
    +// Does nothing
    +crash_if_err!(1, is_ok);
     
    -let is_err: Result<u32, &str> = Err("This didn't work...");
    -// Calls `crash!`
    -crash_if_err!(1, is_err);
    -
    \ No newline at end of file +let is_err: Result<u32, &str> = Err("This didn't work..."); +// Calls `crash!` +crash_if_err!(1, is_err);
    +
    \ No newline at end of file diff --git a/dev/uucore/macro.has.html b/dev/uucore/macro.has.html index e29c222ac..ace605f22 100644 --- a/dev/uucore/macro.has.html +++ b/dev/uucore/macro.has.html @@ -1,4 +1,4 @@ -has in uucore - Rust
    macro_rules! has {
    -    ($mode:expr, $perm:expr) => { ... };
    +has in uucore - Rust
    macro_rules! has {
    +    ($mode:expr, $perm:expr) => { ... };
     }
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/macro.help_section.html b/dev/uucore/macro.help_section.html index 8fff528fe..ac5e3ed7e 100644 --- a/dev/uucore/macro.help_section.html +++ b/dev/uucore/macro.help_section.html @@ -1,4 +1,4 @@ -help_section in uucore - Rust
    help_section!() { /* proc-macro */ }
    Expand description

    Reads a section from a file of the util as a str literal.

    +help_section in uucore - Rust
    help_section!() { /* proc-macro */ }
    Expand description

    Reads a section from a file of the util as a str literal.

    It reads from the file specified as the second argument, relative to the crate root. The contents of this file are read verbatim, without parsing or escaping. The name of the help file should match the name of the util. @@ -13,5 +13,5 @@ Convert numbers from/to human-readable strings # Long help This text will be the long help

    -
    help_section!("about", "numfmt.md");
    -
    \ No newline at end of file +
    help_section!("about", "numfmt.md");
    +
    \ No newline at end of file diff --git a/dev/uucore/macro.help_usage.html b/dev/uucore/macro.help_usage.html index 5bae2f89c..4cbbd6e47 100644 --- a/dev/uucore/macro.help_usage.html +++ b/dev/uucore/macro.help_usage.html @@ -1,6 +1,6 @@ -help_usage in uucore - Rust
    help_usage!() { /* proc-macro */ }
    Expand description

    Get the usage from the “Usage” section in the help file.

    +help_usage in uucore - Rust
    help_usage!() { /* proc-macro */ }
    Expand description

    Get the usage from the “Usage” section in the help file.

    The usage is assumed to be surrounded by markdown code fences. It may span multiple lines. The first word of each line is assumed to be the name of the util and is replaced by “{}” so that the output of this function can be used with uucore::format_usage.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/macro.show.html b/dev/uucore/macro.show.html index 97f9417f2..f9efb665f 100644 --- a/dev/uucore/macro.show.html +++ b/dev/uucore/macro.show.html @@ -1,5 +1,5 @@ -show in uucore - Rust
    macro_rules! show {
    -    ($err:expr) => { ... };
    +show in uucore - Rust
    macro_rules! show {
    +    ($err:expr) => { ... };
     }
    Expand description

    Display a crate::error::UError and set global exit code.

    Prints the error message contained in an crate::error::UError to stderr @@ -11,21 +11,21 @@ macro will not finish program execution.

    the utility’s exit code to 2.

    
    -use uucore::error::{self, USimpleError};
    +use uucore::error::{self, USimpleError};
     
    -fn main() {
    -    let err = USimpleError::new(2, "Some error occurred.");
    -    show!(err);
    -    assert_eq!(error::get_exit_code(), 2);
    +fn main() {
    +    let err = USimpleError::new(2, "Some error occurred.");
    +    show!(err);
    +    assert_eq!(error::get_exit_code(), 2);
     }

    If not using crate::error::UError, one may achieve the same behavior like this:

    
    -use uucore::error::set_exit_code;
    +use uucore::error::set_exit_code;
     
    -fn main() {
    -    set_exit_code(2);
    +fn main() {
    +    set_exit_code(2);
         show_error!("Some error occurred.");
     }
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/macro.show_error.html b/dev/uucore/macro.show_error.html index a45d9863d..1be92e6cb 100644 --- a/dev/uucore/macro.show_error.html +++ b/dev/uucore/macro.show_error.html @@ -1,9 +1,9 @@ -show_error in uucore - Rust
    macro_rules! show_error {
    -    ($($args:tt)+) => { ... };
    +show_error in uucore - Rust
    macro_rules! show_error {
    +    ($($args:tt)+) => { ... };
     }
    Expand description

    Show an error to stderr in a similar style to GNU coreutils.

    -

    Takes a format!-like input and prints it to stderr. The output is +

    Takes a format!-like input and prints it to stderr. The output is prepended with the current utility’s name.

    Examples

    show_error!("Couldn't apply {} to {}", "foo", "bar");
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/macro.show_if_err.html b/dev/uucore/macro.show_if_err.html index 1c3ece6ae..78d567853 100644 --- a/dev/uucore/macro.show_if_err.html +++ b/dev/uucore/macro.show_if_err.html @@ -1,5 +1,5 @@ -show_if_err in uucore - Rust
    macro_rules! show_if_err {
    -    ($res:expr) => { ... };
    +show_if_err in uucore - Rust
    macro_rules! show_if_err {
    +    ($res:expr) => { ... };
     }
    Expand description

    Display an error and set global exit code in error case.

    Wraps around [show!] and takes a crate::error::UResult instead of a @@ -7,14 +7,14 @@ crate::error::UResult is an Err-variant. This can be invoked directly on the result of a function call, like in the install utility:

    -
    show_if_err!(copy(sourcepath, &targetpath, b));
    +
    show_if_err!(copy(sourcepath, &targetpath, b));

    Examples

    -
    
    -let is_ok = Ok(1);
    -// This does nothing at all
    -show_if_err!(is_ok);
    +
    
    +let is_ok = Ok(1);
    +// This does nothing at all
    +show_if_err!(is_ok);
     
    -let is_err = Err(USimpleError::new(1, "I'm an error").into());
    -// Calls `show!` on the contained USimpleError
    -show_if_err!(is_err);
    -
    \ No newline at end of file +let is_err = Err(USimpleError::new(1, "I'm an error").into()); +// Calls `show!` on the contained USimpleError +show_if_err!(is_err);
    +
    \ No newline at end of file diff --git a/dev/uucore/macro.show_warning.html b/dev/uucore/macro.show_warning.html index 8c4df128d..5a56cd0e1 100644 --- a/dev/uucore/macro.show_warning.html +++ b/dev/uucore/macro.show_warning.html @@ -1,10 +1,10 @@ -show_warning in uucore - Rust
    macro_rules! show_warning {
    -    ($($args:tt)+) => { ... };
    +show_warning in uucore - Rust
    macro_rules! show_warning {
    +    ($($args:tt)+) => { ... };
     }
    Expand description

    Print a warning message to stderr.

    -

    Takes format!-compatible input and prepends it with the current +

    Takes format!-compatible input and prepends it with the current utility’s name and “warning: “ before printing to stderr.

    Examples

    -
    // outputs <name>: warning: Couldn't apply foo to bar
    -show_warning!("Couldn't apply {} to {}", "foo", "bar");
    -
    \ No newline at end of file +
    // outputs <name>: warning: Couldn't apply foo to bar
    +show_warning!("Couldn't apply {} to {}", "foo", "bar");
    +
    \ No newline at end of file diff --git a/dev/uucore/macro.uio_error.html b/dev/uucore/macro.uio_error.html index 3fe1a375f..1adebe884 100644 --- a/dev/uucore/macro.uio_error.html +++ b/dev/uucore/macro.uio_error.html @@ -1,51 +1,51 @@ -uio_error in uucore - Rust
    macro_rules! uio_error {
    -    ($err:expr, $($args:tt)+) => { ... };
    +uio_error in uucore - Rust
    macro_rules! uio_error {
    +    ($err:expr, $($args:tt)+) => { ... };
     }
    Expand description

    Shorthand to construct UIoError-instances.

    This macro serves as a convenience call to quickly construct instances of UIoError. It takes:

      -
    • An instance of std::io::Error
    • +
    • An instance of std::io::Error
    • A format!-compatible string and
    • An arbitrary number of arguments to the format string

    In exactly this order. It is equivalent to the more verbose code seen in the example.

    Examples

    -
    use uucore::error::UIoError;
    -use uucore::uio_error;
    +
    use uucore::error::UIoError;
    +use uucore::uio_error;
     
    -let io_err = std::io::Error::new(
    -    std::io::ErrorKind::PermissionDenied, "fix me please!"
    -);
    +let io_err = std::io::Error::new(
    +    std::io::ErrorKind::PermissionDenied, "fix me please!"
    +);
     
    -let uio_err = UIoError::new(
    -    io_err.kind(),
    +let uio_err = UIoError::new(
    +    io_err.kind(),
         format!("Error code: {}", 2)
     );
     
    -let other_uio_err = uio_error!(io_err, "Error code: {}", 2);
    +let other_uio_err = uio_error!(io_err, "Error code: {}", 2);
     
    -// prints "fix me please!: Permission denied"
    -println!("{}", uio_err);
    -// prints "Error code: 2: Permission denied"
    -println!("{}", other_uio_err);
    -

    The std::fmt::Display impl of UIoError will then ensure that an +// prints "fix me please!: Permission denied" +println!("{}", uio_err); +// prints "Error code: 2: Permission denied" +println!("{}", other_uio_err);

    +

    The std::fmt::Display impl of UIoError will then ensure that an appropriate error message relating to the actual error kind of the -std::io::Error is appended to whatever error message is defined in +std::io::Error is appended to whatever error message is defined in addition (as secondary argument).

    -

    If you want to show only the error message for the std::io::ErrorKind +

    If you want to show only the error message for the std::io::ErrorKind that’s contained in UIoError, pass the second argument as empty string:

    -
    use uucore::error::UIoError;
    -use uucore::uio_error;
    +
    use uucore::error::UIoError;
    +use uucore::uio_error;
     
    -let io_err = std::io::Error::new(
    -    std::io::ErrorKind::PermissionDenied, "fix me please!"
    -);
    +let io_err = std::io::Error::new(
    +    std::io::ErrorKind::PermissionDenied, "fix me please!"
    +);
     
    -let other_uio_err = uio_error!(io_err, "");
    +let other_uio_err = uio_error!(io_err, "");
     
    -// prints: ": Permission denied"
    -println!("{}", other_uio_err);
    -
    \ No newline at end of file +// prints: ": Permission denied" +println!("{}", other_uio_err);
    +
    \ No newline at end of file diff --git a/dev/uucore/memo/index.html b/dev/uucore/memo/index.html index 429942957..528084380 100644 --- a/dev/uucore/memo/index.html +++ b/dev/uucore/memo/index.html @@ -1,4 +1,4 @@ -uucore::memo - Rust
    Expand description

    Memo runner of printf +uucore::memo - Rust

    Expand description

    Memo runner of printf Takes a format string and arguments

    1. tokenize format string into tokens, consuming @@ -6,4 +6,4 @@ any subst. arguments along the way.
    2. feeds remaining arguments into function that prints tokens.
    -

    Structs

    \ No newline at end of file +

    Structs

    \ No newline at end of file diff --git a/dev/uucore/memo/struct.Memo.html b/dev/uucore/memo/struct.Memo.html index 6447e5bd4..d8e6ab69b 100644 --- a/dev/uucore/memo/struct.Memo.html +++ b/dev/uucore/memo/struct.Memo.html @@ -1,12 +1,5 @@ -Memo in uucore::memo - Rust
    pub struct Memo { /* private fields */ }

    Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +Memo in uucore::memo - Rust
    pub struct Memo { /* private fields */ }

    Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/mode/fn.get_umask.html b/dev/uucore/mode/fn.get_umask.html index 135441879..31752d433 100644 --- a/dev/uucore/mode/fn.get_umask.html +++ b/dev/uucore/mode/fn.get_umask.html @@ -1 +1 @@ -get_umask in uucore::mode - Rust
    pub fn get_umask() -> u32
    \ No newline at end of file +get_umask in uucore::mode - Rust
    pub fn get_umask() -> u32
    \ No newline at end of file diff --git a/dev/uucore/mode/fn.parse_mode.html b/dev/uucore/mode/fn.parse_mode.html index 103ae3315..cb78d9168 100644 --- a/dev/uucore/mode/fn.parse_mode.html +++ b/dev/uucore/mode/fn.parse_mode.html @@ -1 +1 @@ -parse_mode in uucore::mode - Rust
    pub fn parse_mode(mode: &str) -> Result<mode_t, String>
    \ No newline at end of file +parse_mode in uucore::mode - Rust
    pub fn parse_mode(mode: &str) -> Result<mode_t, String>
    \ No newline at end of file diff --git a/dev/uucore/mode/fn.parse_numeric.html b/dev/uucore/mode/fn.parse_numeric.html index 64ba9161e..0257d0a41 100644 --- a/dev/uucore/mode/fn.parse_numeric.html +++ b/dev/uucore/mode/fn.parse_numeric.html @@ -1 +1 @@ -parse_numeric in uucore::mode - Rust
    pub fn parse_numeric(
        fperm: u32,
        mode: &str,
        considering_dir: bool
    ) -> Result<u32, String>
    \ No newline at end of file +parse_numeric in uucore::mode - Rust
    pub fn parse_numeric(
        fperm: u32,
        mode: &str,
        considering_dir: bool
    ) -> Result<u32, String>
    \ No newline at end of file diff --git a/dev/uucore/mode/fn.parse_symbolic.html b/dev/uucore/mode/fn.parse_symbolic.html index c6c6c6d7e..58c865eef 100644 --- a/dev/uucore/mode/fn.parse_symbolic.html +++ b/dev/uucore/mode/fn.parse_symbolic.html @@ -1 +1 @@ -parse_symbolic in uucore::mode - Rust
    pub fn parse_symbolic(
        fperm: u32,
        mode: &str,
        umask: u32,
        considering_dir: bool
    ) -> Result<u32, String>
    \ No newline at end of file +parse_symbolic in uucore::mode - Rust
    pub fn parse_symbolic(
        fperm: u32,
        mode: &str,
        umask: u32,
        considering_dir: bool
    ) -> Result<u32, String>
    \ No newline at end of file diff --git a/dev/uucore/mode/fn.strip_minus_from_mode.html b/dev/uucore/mode/fn.strip_minus_from_mode.html index 6b1ef2bd8..ce2aabff7 100644 --- a/dev/uucore/mode/fn.strip_minus_from_mode.html +++ b/dev/uucore/mode/fn.strip_minus_from_mode.html @@ -1 +1 @@ -strip_minus_from_mode in uucore::mode - Rust
    pub fn strip_minus_from_mode(args: &mut Vec<String>) -> bool
    \ No newline at end of file +strip_minus_from_mode in uucore::mode - Rust
    pub fn strip_minus_from_mode(args: &mut Vec<String>) -> bool
    \ No newline at end of file diff --git a/dev/uucore/mode/index.html b/dev/uucore/mode/index.html index cc5f620df..330fd966d 100644 --- a/dev/uucore/mode/index.html +++ b/dev/uucore/mode/index.html @@ -1,2 +1,2 @@ -uucore::mode - Rust
    Expand description

    Set of functions to parse modes

    -

    Functions

    \ No newline at end of file +uucore::mode - Rust
    Expand description

    Set of functions to parse modes

    +

    Functions

    \ No newline at end of file diff --git a/dev/uucore/os/fn.is_wsl_1.html b/dev/uucore/os/fn.is_wsl_1.html index 2f532c3c6..35f868345 100644 --- a/dev/uucore/os/fn.is_wsl_1.html +++ b/dev/uucore/os/fn.is_wsl_1.html @@ -1,2 +1,2 @@ -is_wsl_1 in uucore::os - Rust
    pub fn is_wsl_1() -> bool
    Expand description

    Test if the program is running under WSL

    -
    \ No newline at end of file +is_wsl_1 in uucore::os - Rust
    pub fn is_wsl_1() -> bool
    Expand description

    Test if the program is running under WSL

    +
    \ No newline at end of file diff --git a/dev/uucore/os/fn.is_wsl_2.html b/dev/uucore/os/fn.is_wsl_2.html index afc270e9c..1706dfa3f 100644 --- a/dev/uucore/os/fn.is_wsl_2.html +++ b/dev/uucore/os/fn.is_wsl_2.html @@ -1 +1 @@ -is_wsl_2 in uucore::os - Rust
    pub fn is_wsl_2() -> bool
    \ No newline at end of file +is_wsl_2 in uucore::os - Rust
    pub fn is_wsl_2() -> bool
    \ No newline at end of file diff --git a/dev/uucore/os/index.html b/dev/uucore/os/index.html index 73e2ae10e..117a27e3d 100644 --- a/dev/uucore/os/index.html +++ b/dev/uucore/os/index.html @@ -1,2 +1 @@ -uucore::os - Rust

    Module uucore::os

    source · []

    Functions

    Test if the program is running under WSL

    -
    \ No newline at end of file +uucore::os - Rust

    Module uucore::os

    source · []

    Functions

    Test if the program is running under WSL
    \ No newline at end of file diff --git a/dev/uucore/panic/fn.mute_sigpipe_panic.html b/dev/uucore/panic/fn.mute_sigpipe_panic.html index aa9b8ebb2..13d9a906f 100644 --- a/dev/uucore/panic/fn.mute_sigpipe_panic.html +++ b/dev/uucore/panic/fn.mute_sigpipe_panic.html @@ -1,4 +1,4 @@ -mute_sigpipe_panic in uucore::panic - Rust
    pub fn mute_sigpipe_panic()
    Expand description

    Terminate without error on panics that occur due to broken pipe errors.

    +mute_sigpipe_panic in uucore::panic - Rust
    pub fn mute_sigpipe_panic()
    Expand description

    Terminate without error on panics that occur due to broken pipe errors.

    For background discussions on SIGPIPE handling, see

    • <https://github.com/uutils/coreutils/issues/374>
    • @@ -7,4 +7,4 @@
    • <https://github.com/BurntSushi/ripgrep/issues/200>
    • <https://github.com/crev-dev/cargo-crev/issues/287>
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/panic/index.html b/dev/uucore/panic/index.html index 9dff669a5..4fb4f6f13 100644 --- a/dev/uucore/panic/index.html +++ b/dev/uucore/panic/index.html @@ -1,7 +1,6 @@ -uucore::panic - Rust
    Expand description

    Custom panic hooks that allow silencing certain types of errors.

    +uucore::panic - Rust
    Expand description

    Custom panic hooks that allow silencing certain types of errors.

    Use the mute_sigpipe_panic function to silence panics caused by broken pipe errors. This can happen when a process is still producing data when the consuming process terminates and closes the pipe. For example,

    -
    $ seq inf | head -n 1

    Functions

    Terminate without error on panics that occur due to broken pipe errors.

    -
    \ No newline at end of file +
    $ seq inf | head -n 1

    Functions

    Terminate without error on panics that occur due to broken pipe errors.
    \ No newline at end of file diff --git a/dev/uucore/parse_glob/fn.from_str.html b/dev/uucore/parse_glob/fn.from_str.html index 74cc537e6..927269b48 100644 --- a/dev/uucore/parse_glob/fn.from_str.html +++ b/dev/uucore/parse_glob/fn.from_str.html @@ -1,11 +1,11 @@ -from_str in uucore::parse_glob - Rust
    pub fn from_str(glob: &str) -> Result<Pattern, PatternError>
    Expand description

    Parse a glob Pattern from a string.

    +from_str in uucore::parse_glob - Rust
    pub fn from_str(glob: &str) -> Result<Pattern, PatternError>
    Expand description

    Parse a glob Pattern from a string.

    This function amends the input string to replace any caret or circumflex character (^) used to negate a set of characters with an exclamation mark (!), which adapts rust’s glob matching to function the way the GNU utils’ fnmatch does.

    Examples

    -
    use std::time::Duration;
    -use uucore::parse_glob::from_str;
    -assert!(!from_str("[^abc]").unwrap().matches("a"));
    -assert!(from_str("[^abc]").unwrap().matches("x"));
    -
    \ No newline at end of file +
    use std::time::Duration;
    +use uucore::parse_glob::from_str;
    +assert!(!from_str("[^abc]").unwrap().matches("a"));
    +assert!(from_str("[^abc]").unwrap().matches("x"));
    +
    \ No newline at end of file diff --git a/dev/uucore/parse_glob/index.html b/dev/uucore/parse_glob/index.html index a5cf3340e..66b57c17e 100644 --- a/dev/uucore/parse_glob/index.html +++ b/dev/uucore/parse_glob/index.html @@ -1,4 +1,3 @@ -uucore::parse_glob - Rust
    Expand description

    Parsing a glob Pattern from a string.

    +uucore::parse_glob - Rust
    Expand description

    Parsing a glob Pattern from a string.

    Use the from_str function to parse a Pattern from a string.

    -

    Functions

    Parse a glob Pattern from a string.

    -
    \ No newline at end of file +

    Functions

    Parse a glob Pattern from a string.
    \ No newline at end of file diff --git a/dev/uucore/parse_size/enum.ParseSizeError.html b/dev/uucore/parse_size/enum.ParseSizeError.html index 9019af94e..99e16ce19 100644 --- a/dev/uucore/parse_size/enum.ParseSizeError.html +++ b/dev/uucore/parse_size/enum.ParseSizeError.html @@ -1,26 +1,14 @@ -ParseSizeError in uucore::parse_size - Rust
    pub enum ParseSizeError {
    -    InvalidSuffix(String),
    -    ParseFailure(String),
    -    SizeTooBig(String),
    -}

    Variants

    InvalidSuffix(String)

    ParseFailure(String)

    SizeTooBig(String)

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Formats the value using the given formatter. Read more

    -
    👎 Deprecated since 1.42.0:

    use the Display impl or to_string()

    -

    The lower-level source of this error, if any. Read more

    -
    👎 Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    -
    🔬 This is a nightly-only experimental API. (error_generic_member_access)

    Provides type based access to context intended for error reports. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +ParseSizeError in uucore::parse_size - Rust
    pub enum ParseSizeError {
    +    InvalidSuffix(String),
    +    ParseFailure(String),
    +    SizeTooBig(String),
    +}

    Variants

    InvalidSuffix(String)

    ParseFailure(String)

    SizeTooBig(String)

    Trait Implementations

    Formats the value using the given formatter. Read more
    Formats the value using the given formatter. Read more
    👎Deprecated since 1.42.0:

    use the Display impl or to_string()

    +
    The lower-level source of this error, if any. Read more
    👎Deprecated since 1.33.0:

    replaced by Error::source, which can support downcasting

    +
    🔬This is a nightly-only experimental API. (error_generic_member_access)
    Provides type based access to context intended for error reports. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    Converts the given value to a String. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    🔬This is a nightly-only experimental API. (provide_any)
    Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
    Converts the given value to a String. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/parse_size/fn.parse_size.html b/dev/uucore/parse_size/fn.parse_size.html index dca6e0ef3..0bc3a3cd1 100644 --- a/dev/uucore/parse_size/fn.parse_size.html +++ b/dev/uucore/parse_size/fn.parse_size.html @@ -1,4 +1,4 @@ -parse_size in uucore::parse_size - Rust
    pub fn parse_size(size: &str) -> Result<u64, ParseSizeError>
    Expand description

    Parse a size string into a number of bytes.

    +parse_size in uucore::parse_size - Rust
    pub fn parse_size(size: &str) -> Result<u64, ParseSizeError>
    Expand description

    Parse a size string into a number of bytes.

    A size string comprises an integer and an optional unit. The unit may be K, M, G, T, P, E, Z or Y (powers of 1024), or KB, MB, etc. (powers of 1000), or b which is 512. @@ -9,8 +9,8 @@ string into a number, e.g. if the string does not begin with a numeral, or if the unit is not one of the supported units described in the preceding section.

    Examples

    -
    use uucore::parse_size::parse_size;
    -assert_eq!(Ok(123), parse_size("123"));
    -assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000
    -assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024
    -
    \ No newline at end of file +
    use uucore::parse_size::parse_size;
    +assert_eq!(Ok(123), parse_size("123"));
    +assert_eq!(Ok(9 * 1000), parse_size("9kB")); // kB is 1000
    +assert_eq!(Ok(2 * 1024), parse_size("2K")); // K is 1024
    +
    \ No newline at end of file diff --git a/dev/uucore/parse_size/index.html b/dev/uucore/parse_size/index.html index b379f22b9..878733a2b 100644 --- a/dev/uucore/parse_size/index.html +++ b/dev/uucore/parse_size/index.html @@ -1,2 +1 @@ -uucore::parse_size - Rust

    Enums

    Functions

    Parse a size string into a number of bytes.

    -
    \ No newline at end of file +uucore::parse_size - Rust

    Enums

    Functions

    Parse a size string into a number of bytes.
    \ No newline at end of file diff --git a/dev/uucore/parse_time/fn.from_str.html b/dev/uucore/parse_time/fn.from_str.html index bbafefd5c..6353c6429 100644 --- a/dev/uucore/parse_time/fn.from_str.html +++ b/dev/uucore/parse_time/fn.from_str.html @@ -1,4 +1,4 @@ -from_str in uucore::parse_time - Rust
    pub fn from_str(string: &str) -> Result<Duration, String>
    Expand description

    Parse a duration from a string.

    +from_str in uucore::parse_time - Rust
    pub fn from_str(string: &str) -> Result<Duration, String>
    Expand description

    Parse a duration from a string.

    The string may contain only a number, like “123” or “4.5”, or it may contain a number with a unit specifier, like “123s” meaning one hundred twenty three seconds or “4.5d” meaning four and a half @@ -10,16 +10,16 @@ days. If no unit is specified, the unit is assumed to be seconds.

  • “h” for hours,
  • “d” for days.
  • -

    This function uses Duration::saturating_mul to compute the +

    This function uses Duration::saturating_mul to compute the number of seconds, so it does not overflow. If overflow would have -occurred, Duration::MAX is returned instead.

    +occurred, Duration::MAX is returned instead.

    Errors

    This function returns an error if the input string is empty, the input is not a valid number, or the unit specifier is invalid or unknown.

    Examples

    -
    use std::time::Duration;
    -use uucore::parse_time::from_str;
    -assert_eq!(from_str("123"), Ok(Duration::from_secs(123)));
    -assert_eq!(from_str("2d"), Ok(Duration::from_secs(60 * 60 * 24 * 2)));
    -
    \ No newline at end of file +
    use std::time::Duration;
    +use uucore::parse_time::from_str;
    +assert_eq!(from_str("123"), Ok(Duration::from_secs(123)));
    +assert_eq!(from_str("2d"), Ok(Duration::from_secs(60 * 60 * 24 * 2)));
    +
    \ No newline at end of file diff --git a/dev/uucore/parse_time/index.html b/dev/uucore/parse_time/index.html index 3990407e4..c8b7abc88 100644 --- a/dev/uucore/parse_time/index.html +++ b/dev/uucore/parse_time/index.html @@ -1,4 +1,3 @@ -uucore::parse_time - Rust
    Expand description

    Parsing a duration from a string.

    -

    Use the from_str function to parse a Duration from a string.

    -

    Functions

    Parse a duration from a string.

    -
    \ No newline at end of file +uucore::parse_time - Rust
    Expand description

    Parsing a duration from a string.

    +

    Use the from_str function to parse a Duration from a string.

    +

    Functions

    Parse a duration from a string.
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/fn.get_groups.html b/dev/uucore/perms/entries/fn.get_groups.html index d3f00f6e8..c000dd38b 100644 --- a/dev/uucore/perms/entries/fn.get_groups.html +++ b/dev/uucore/perms/entries/fn.get_groups.html @@ -1,4 +1,4 @@ -get_groups in uucore::perms::entries - Rust
    pub fn get_groups() -> IOResult<Vec<gid_t>>
    Expand description

    From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

    +get_groups in uucore::perms::entries - Rust
    pub fn get_groups() -> IOResult<Vec<gid_t>>
    Expand description

    From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

    getgroups() returns the supplementary group IDs of the calling process in list. @@ -7,4 +7,4 @@ supplementary group IDs for the process is returned. This allows the caller to determine the size of a dynamically allocated list to be used in a further call to getgroups().

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/fn.get_groups_gnu.html b/dev/uucore/perms/entries/fn.get_groups_gnu.html index b99605614..967e78ac8 100644 --- a/dev/uucore/perms/entries/fn.get_groups_gnu.html +++ b/dev/uucore/perms/entries/fn.get_groups_gnu.html @@ -1,4 +1,4 @@ -get_groups_gnu in uucore::perms::entries - Rust
    pub fn get_groups_gnu(arg_id: Option<u32>) -> IOResult<Vec<gid_t>>
    Expand description

    The list of group IDs returned from GNU’s groups and GNU’s id --groups +get_groups_gnu in uucore::perms::entries - Rust

    pub fn get_groups_gnu(arg_id: Option<u32>) -> IOResult<Vec<gid_t>>
    Expand description

    The list of group IDs returned from GNU’s groups and GNU’s id --groups starts with the effective group ID (egid). This is a wrapper for get_groups() to mimic this behavior.

    If arg_id is None (default), get_groups_gnu moves the effective @@ -20,4 +20,4 @@ groups is the same (in the mathematical sense of ``set’’). (The history of a process and its parents could affect the details of the result.)

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/fn.gid2grp.html b/dev/uucore/perms/entries/fn.gid2grp.html index 5390e28ce..0fb39a36c 100644 --- a/dev/uucore/perms/entries/fn.gid2grp.html +++ b/dev/uucore/perms/entries/fn.gid2grp.html @@ -1 +1 @@ -gid2grp in uucore::perms::entries - Rust
    pub fn gid2grp(id: gid_t) -> IOResult<String>
    \ No newline at end of file +gid2grp in uucore::perms::entries - Rust
    pub fn gid2grp(id: gid_t) -> IOResult<String>
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/fn.grp2gid.html b/dev/uucore/perms/entries/fn.grp2gid.html index 2cb85115c..494608088 100644 --- a/dev/uucore/perms/entries/fn.grp2gid.html +++ b/dev/uucore/perms/entries/fn.grp2gid.html @@ -1 +1 @@ -grp2gid in uucore::perms::entries - Rust
    pub fn grp2gid(name: &str) -> IOResult<gid_t>
    \ No newline at end of file +grp2gid in uucore::perms::entries - Rust
    pub fn grp2gid(name: &str) -> IOResult<gid_t>
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/fn.uid2usr.html b/dev/uucore/perms/entries/fn.uid2usr.html index 12a298c1f..9a0be942f 100644 --- a/dev/uucore/perms/entries/fn.uid2usr.html +++ b/dev/uucore/perms/entries/fn.uid2usr.html @@ -1 +1 @@ -uid2usr in uucore::perms::entries - Rust
    pub fn uid2usr(id: uid_t) -> IOResult<String>
    \ No newline at end of file +uid2usr in uucore::perms::entries - Rust
    pub fn uid2usr(id: uid_t) -> IOResult<String>
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/fn.usr2uid.html b/dev/uucore/perms/entries/fn.usr2uid.html index 74e8e5f6c..b11b8ffa8 100644 --- a/dev/uucore/perms/entries/fn.usr2uid.html +++ b/dev/uucore/perms/entries/fn.usr2uid.html @@ -1 +1 @@ -usr2uid in uucore::perms::entries - Rust
    pub fn usr2uid(name: &str) -> IOResult<uid_t>
    \ No newline at end of file +usr2uid in uucore::perms::entries - Rust
    pub fn usr2uid(name: &str) -> IOResult<uid_t>
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/index.html b/dev/uucore/perms/entries/index.html index fd6bd7696..194eae409 100644 --- a/dev/uucore/perms/entries/index.html +++ b/dev/uucore/perms/entries/index.html @@ -1,28 +1,25 @@ -uucore::perms::entries - Rust
    Expand description

    Get password/group file entry

    +uucore::perms::entries - Rust
    Expand description

    Get password/group file entry

    Examples:

    -
    use uucore::entries::{self, Locate};
    +
    use uucore::entries::{self, Locate};
     
    -let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
    -    "root"
    -} else {
    -    "wheel"
    -};
    +let root_group = if cfg!(any(target_os = "linux", target_os = "android")) {
    +    "root"
    +} else {
    +    "wheel"
    +};
     
    -assert_eq!("root", entries::uid2usr(0).unwrap());
    -assert_eq!(0, entries::usr2uid("root").unwrap());
    -assert!(entries::gid2grp(0).is_ok());
    -assert!(entries::grp2gid(root_group).is_ok());
    +assert_eq!("root", entries::uid2usr(0).unwrap());
    +assert_eq!(0, entries::usr2uid("root").unwrap());
    +assert!(entries::gid2grp(0).is_ok());
    +assert!(entries::grp2gid(root_group).is_ok());
     
    -assert!(entries::Passwd::locate(0).is_ok());
    -assert!(entries::Passwd::locate("0").is_ok());
    -assert!(entries::Passwd::locate("root").is_ok());
    +assert!(entries::Passwd::locate(0).is_ok());
    +assert!(entries::Passwd::locate("0").is_ok());
    +assert!(entries::Passwd::locate("root").is_ok());
     
    -assert!(entries::Group::locate(0).is_ok());
    -assert!(entries::Group::locate("0").is_ok());
    -assert!(entries::Group::locate(root_group).is_ok());
    -

    Structs

    Traits

    Fetch desired entry.

    -

    Functions

    From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>

    -

    The list of group IDs returned from GNU’s groups and GNU’s id --groups +assert!(entries::Group::locate(0).is_ok()); +assert!(entries::Group::locate("0").is_ok()); +assert!(entries::Group::locate(root_group).is_ok());

    +

    Structs

    Traits

    Fetch desired entry.

    Functions

    From: <https://man7.org/linux/man-pages/man2/getgroups.2.html>
    The list of group IDs returned from GNU’s groups and GNU’s id --groups starts with the effective group ID (egid). -This is a wrapper for get_groups() to mimic this behavior.

    -
    \ No newline at end of file +This is a wrapper for get_groups() to mimic this behavior.
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/struct.Group.html b/dev/uucore/perms/entries/struct.Group.html index c9e867442..58087ef1b 100644 --- a/dev/uucore/perms/entries/struct.Group.html +++ b/dev/uucore/perms/entries/struct.Group.html @@ -1,23 +1,10 @@ -Group in uucore::perms::entries - Rust

    Fields

    name: String

    AKA group.gr_name

    gid: gid_t

    AKA group.gr_gid

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/struct.Passwd.html b/dev/uucore/perms/entries/struct.Passwd.html index e38270712..f36937fc4 100644 --- a/dev/uucore/perms/entries/struct.Passwd.html +++ b/dev/uucore/perms/entries/struct.Passwd.html @@ -1,19 +1,19 @@ -Passwd in uucore::perms::entries - Rust
    pub struct Passwd {
    -    pub name: String,
    +Passwd in uucore::perms::entries - Rust
    pub struct Passwd {
    +    pub name: String,
         pub uid: uid_t,
         pub gid: gid_t,
    -    pub user_info: Option<String>,
    -    pub user_shell: Option<String>,
    -    pub user_dir: Option<String>,
    -    pub user_passwd: Option<String>,
    -}

    Fields

    name: String

    AKA passwd.pw_name

    + pub user_info: Option<String>, + pub user_shell: Option<String>, + pub user_dir: Option<String>, + pub user_passwd: Option<String>, +}

    Fields

    name: String

    AKA passwd.pw_name

    uid: uid_t

    AKA passwd.pw_uid

    gid: gid_t

    AKA passwd.pw_gid

    -
    user_info: Option<String>

    AKA passwd.pw_gecos

    -
    user_shell: Option<String>

    AKA passwd.pw_shell

    -
    user_dir: Option<String>

    AKA passwd.pw_dir

    -
    user_passwd: Option<String>

    AKA passwd.pw_passwd

    -

    Implementations

    This is a wrapper function for libc::getgrouplist.

    +
    user_info: Option<String>

    AKA passwd.pw_gecos

    +
    user_shell: Option<String>

    AKA passwd.pw_shell

    +
    user_dir: Option<String>

    AKA passwd.pw_dir

    +
    user_passwd: Option<String>

    AKA passwd.pw_passwd

    +

    Implementations

    This is a wrapper function for libc::getgrouplist.

    From: <https://man7.org/linux/man-pages/man3/getgrouplist.3.html>

    If the number of groups of which user is a member is less than or @@ -27,21 +27,8 @@ call getgrouplist().

    not update ngroups if ngroups is too small. Therefore, if not updated by getgrouplist, ngroups needs to be increased in a loop until getgrouplist stops returning -1.

    -

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/perms/entries/trait.Locate.html b/dev/uucore/perms/entries/trait.Locate.html index 6c0f995c1..dc6119276 100644 --- a/dev/uucore/perms/entries/trait.Locate.html +++ b/dev/uucore/perms/entries/trait.Locate.html @@ -1,4 +1,4 @@ -Locate in uucore::perms::entries - Rust
    pub trait Locate<K> {
    -    fn locate(key: K) -> IOResult<Self>
        where
            Self: Sized
    ; +Locate in uucore::perms::entries - Rust
    pub trait Locate<K> {
    +    fn locate(key: K) -> IOResult<Self>
        where
            Self: Sized
    ; }
    Expand description

    Fetch desired entry.

    -

    Required Methods

    Implementors

    \ No newline at end of file +

    Required Methods

    Implementors

    \ No newline at end of file diff --git a/dev/uucore/perms/enum.IfFrom.html b/dev/uucore/perms/enum.IfFrom.html index 329dced1f..ad54231c5 100644 --- a/dev/uucore/perms/enum.IfFrom.html +++ b/dev/uucore/perms/enum.IfFrom.html @@ -1,17 +1,10 @@ -IfFrom in uucore::perms - Rust
    pub enum IfFrom {
    +IfFrom in uucore::perms - Rust
    pub enum IfFrom {
         All,
    -    User(u32),
    -    Group(u32),
    -    UserGroup(u32u32),
    -}

    Variants

    All

    User(u32)

    Group(u32)

    UserGroup(u32u32)

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    + User(u32), + Group(u32), + UserGroup(u32u32), +}

    Variants

    All

    User(u32)

    Group(u32)

    UserGroup(u32u32)

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/perms/enum.TraverseSymlinks.html b/dev/uucore/perms/enum.TraverseSymlinks.html index 490bee5fb..b8600a19f 100644 --- a/dev/uucore/perms/enum.TraverseSymlinks.html +++ b/dev/uucore/perms/enum.TraverseSymlinks.html @@ -1,19 +1,11 @@ -TraverseSymlinks in uucore::perms - Rust
    pub enum TraverseSymlinks {
    +TraverseSymlinks in uucore::perms - Rust
    pub enum TraverseSymlinks {
         None,
         First,
         All,
    -}

    Variants

    None

    First

    All

    Trait Implementations

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Variants

    None

    First

    All

    Trait Implementations

    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/perms/enum.VerbosityLevel.html b/dev/uucore/perms/enum.VerbosityLevel.html index eb2f80ac5..f56944e59 100644 --- a/dev/uucore/perms/enum.VerbosityLevel.html +++ b/dev/uucore/perms/enum.VerbosityLevel.html @@ -1,27 +1,13 @@ -VerbosityLevel in uucore::perms - Rust
    pub enum VerbosityLevel {
    +VerbosityLevel in uucore::perms - Rust
    pub enum VerbosityLevel {
         Silent,
         Changes,
         Verbose,
         Normal,
     }
    Expand description

    The various level of verbosity

    -

    Variants

    Silent

    Changes

    Verbose

    Normal

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Variants

    Silent

    Changes

    Verbose

    Normal

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/perms/fn.chown_base.html b/dev/uucore/perms/fn.chown_base.html index 650ac266a..ded68e9ab 100644 --- a/dev/uucore/perms/fn.chown_base.html +++ b/dev/uucore/perms/fn.chown_base.html @@ -1,7 +1,7 @@ -chown_base in uucore::perms - Rust
    pub fn chown_base(
        command: Command,
        args: impl Args,
        add_arg_if_not_reference: &'static str,
        parse_gid_uid_and_filter: fn(_: &ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)>,
        groups_only: bool
    ) -> UResult<()>
    Expand description

    Base implementation for chgrp and chown.

    +chown_base in uucore::perms - Rust
    pub fn chown_base(
        command: Command,
        args: impl Args,
        add_arg_if_not_reference: &'static str,
        parse_gid_uid_and_filter: fn(_: &ArgMatches) -> UResult<(Option<u32>, Option<u32>, IfFrom)>,
        groups_only: bool
    ) -> UResult<()>
    Expand description

    Base implementation for chgrp and chown.

    An argument called add_arg_if_not_reference will be added to command if args does not contain the --reference option. parse_gid_uid_and_filter will be called to obtain the target gid and uid, and the filter, from ArgMatches. groups_only determines whether verbose output will only mention the group.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/perms/fn.wrap_chown.html b/dev/uucore/perms/fn.wrap_chown.html index 41fb04dcc..e78621494 100644 --- a/dev/uucore/perms/fn.wrap_chown.html +++ b/dev/uucore/perms/fn.wrap_chown.html @@ -1,4 +1,4 @@ -wrap_chown in uucore::perms - Rust
    pub fn wrap_chown<P: AsRef<Path>>(
        path: P,
        meta: &Metadata,
        dest_uid: Option<u32>,
        dest_gid: Option<u32>,
        follow: bool,
        verbosity: Verbosity
    ) -> Result<String, String>
    Expand description

    Perform the change of owner on a path +wrap_chown in uucore::perms - Rust

    pub fn wrap_chown<P: AsRef<Path>>(
        path: P,
        meta: &Metadata,
        dest_uid: Option<u32>,
        dest_gid: Option<u32>,
        follow: bool,
        verbosity: Verbosity
    ) -> Result<String, String>
    Expand description

    Perform the change of owner on a path with the various options and error messages management

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/perms/index.html b/dev/uucore/perms/index.html index 4c6deb2ee..006da9d8e 100644 --- a/dev/uucore/perms/index.html +++ b/dev/uucore/perms/index.html @@ -1,8 +1,4 @@ -uucore::perms - Rust
    Expand description

    Common functions to manage permissions

    -

    Modules

    Get password/group file entry

    -

    Structs

    Enums

    The various level of verbosity

    -

    Functions

    Base implementation for chgrp and chown.

    -

    Perform the change of owner on a path +uucore::perms - Rust

    Expand description

    Common functions to manage permissions

    +

    Modules

    Get password/group file entry

    Structs

    Enums

    The various level of verbosity

    Functions

    Base implementation for chgrp and chown.
    Perform the change of owner on a path with the various options -and error messages management

    -
    \ No newline at end of file +and error messages management
    \ No newline at end of file diff --git a/dev/uucore/perms/options/constant.ARG_FILES.html b/dev/uucore/perms/options/constant.ARG_FILES.html index 10d8630e1..68d1e73a6 100644 --- a/dev/uucore/perms/options/constant.ARG_FILES.html +++ b/dev/uucore/perms/options/constant.ARG_FILES.html @@ -1 +1 @@ -ARG_FILES in uucore::perms::options - Rust
    pub const ARG_FILES: &'static str = "FILE";
    \ No newline at end of file +ARG_FILES in uucore::perms::options - Rust
    pub const ARG_FILES: &'static str = "FILE";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/constant.ARG_GROUP.html b/dev/uucore/perms/options/constant.ARG_GROUP.html index bf632a77a..52edbdc1d 100644 --- a/dev/uucore/perms/options/constant.ARG_GROUP.html +++ b/dev/uucore/perms/options/constant.ARG_GROUP.html @@ -1 +1 @@ -ARG_GROUP in uucore::perms::options - Rust
    pub const ARG_GROUP: &'static str = "GROUP";
    \ No newline at end of file +ARG_GROUP in uucore::perms::options - Rust
    pub const ARG_GROUP: &'static str = "GROUP";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/constant.ARG_OWNER.html b/dev/uucore/perms/options/constant.ARG_OWNER.html index 4ec7d0acd..5527d25b1 100644 --- a/dev/uucore/perms/options/constant.ARG_OWNER.html +++ b/dev/uucore/perms/options/constant.ARG_OWNER.html @@ -1 +1 @@ -ARG_OWNER in uucore::perms::options - Rust
    pub const ARG_OWNER: &'static str = "OWNER";
    \ No newline at end of file +ARG_OWNER in uucore::perms::options - Rust
    pub const ARG_OWNER: &'static str = "OWNER";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/constant.FROM.html b/dev/uucore/perms/options/constant.FROM.html index b885e712b..65bc6094b 100644 --- a/dev/uucore/perms/options/constant.FROM.html +++ b/dev/uucore/perms/options/constant.FROM.html @@ -1 +1 @@ -FROM in uucore::perms::options - Rust
    pub const FROM: &'static str = "from";
    \ No newline at end of file +FROM in uucore::perms::options - Rust
    pub const FROM: &'static str = "from";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/constant.HELP.html b/dev/uucore/perms/options/constant.HELP.html index ca0b77afb..8d9fb4dda 100644 --- a/dev/uucore/perms/options/constant.HELP.html +++ b/dev/uucore/perms/options/constant.HELP.html @@ -1 +1 @@ -HELP in uucore::perms::options - Rust
    pub const HELP: &'static str = "help";
    \ No newline at end of file +HELP in uucore::perms::options - Rust
    pub const HELP: &'static str = "help";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/constant.RECURSIVE.html b/dev/uucore/perms/options/constant.RECURSIVE.html index 3618cac8a..a56294abf 100644 --- a/dev/uucore/perms/options/constant.RECURSIVE.html +++ b/dev/uucore/perms/options/constant.RECURSIVE.html @@ -1 +1 @@ -RECURSIVE in uucore::perms::options - Rust
    pub const RECURSIVE: &'static str = "recursive";
    \ No newline at end of file +RECURSIVE in uucore::perms::options - Rust
    pub const RECURSIVE: &'static str = "recursive";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/constant.REFERENCE.html b/dev/uucore/perms/options/constant.REFERENCE.html index b698a6214..b63d3c450 100644 --- a/dev/uucore/perms/options/constant.REFERENCE.html +++ b/dev/uucore/perms/options/constant.REFERENCE.html @@ -1 +1 @@ -REFERENCE in uucore::perms::options - Rust
    pub const REFERENCE: &'static str = "reference";
    \ No newline at end of file +REFERENCE in uucore::perms::options - Rust
    pub const REFERENCE: &'static str = "reference";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/dereference/constant.DEREFERENCE.html b/dev/uucore/perms/options/dereference/constant.DEREFERENCE.html index 6868fc8e5..d2724cfe0 100644 --- a/dev/uucore/perms/options/dereference/constant.DEREFERENCE.html +++ b/dev/uucore/perms/options/dereference/constant.DEREFERENCE.html @@ -1 +1 @@ -DEREFERENCE in uucore::perms::options::dereference - Rust
    pub const DEREFERENCE: &'static str = "dereference";
    \ No newline at end of file +DEREFERENCE in uucore::perms::options::dereference - Rust
    pub const DEREFERENCE: &'static str = "dereference";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/dereference/constant.NO_DEREFERENCE.html b/dev/uucore/perms/options/dereference/constant.NO_DEREFERENCE.html index 10d420a05..032b373e0 100644 --- a/dev/uucore/perms/options/dereference/constant.NO_DEREFERENCE.html +++ b/dev/uucore/perms/options/dereference/constant.NO_DEREFERENCE.html @@ -1 +1 @@ -NO_DEREFERENCE in uucore::perms::options::dereference - Rust
    pub const NO_DEREFERENCE: &'static str = "no-dereference";
    \ No newline at end of file +NO_DEREFERENCE in uucore::perms::options::dereference - Rust
    pub const NO_DEREFERENCE: &'static str = "no-dereference";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/dereference/index.html b/dev/uucore/perms/options/dereference/index.html index d33e9dbd3..b72be522c 100644 --- a/dev/uucore/perms/options/dereference/index.html +++ b/dev/uucore/perms/options/dereference/index.html @@ -1 +1 @@ -uucore::perms::options::dereference - Rust
    \ No newline at end of file +uucore::perms::options::dereference - Rust
    \ No newline at end of file diff --git a/dev/uucore/perms/options/index.html b/dev/uucore/perms/options/index.html index 8311a53c8..c0a14e423 100644 --- a/dev/uucore/perms/options/index.html +++ b/dev/uucore/perms/options/index.html @@ -1 +1 @@ -uucore::perms::options - Rust
    \ No newline at end of file +uucore::perms::options - Rust
    \ No newline at end of file diff --git a/dev/uucore/perms/options/preserve_root/constant.NO_PRESERVE.html b/dev/uucore/perms/options/preserve_root/constant.NO_PRESERVE.html index 650fa736a..0da35357f 100644 --- a/dev/uucore/perms/options/preserve_root/constant.NO_PRESERVE.html +++ b/dev/uucore/perms/options/preserve_root/constant.NO_PRESERVE.html @@ -1 +1 @@ -NO_PRESERVE in uucore::perms::options::preserve_root - Rust
    pub const NO_PRESERVE: &'static str = "no-preserve-root";
    \ No newline at end of file +NO_PRESERVE in uucore::perms::options::preserve_root - Rust
    pub const NO_PRESERVE: &'static str = "no-preserve-root";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/preserve_root/constant.PRESERVE.html b/dev/uucore/perms/options/preserve_root/constant.PRESERVE.html index eb93caada..9a48754e9 100644 --- a/dev/uucore/perms/options/preserve_root/constant.PRESERVE.html +++ b/dev/uucore/perms/options/preserve_root/constant.PRESERVE.html @@ -1 +1 @@ -PRESERVE in uucore::perms::options::preserve_root - Rust
    pub const PRESERVE: &'static str = "preserve-root";
    \ No newline at end of file +PRESERVE in uucore::perms::options::preserve_root - Rust
    pub const PRESERVE: &'static str = "preserve-root";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/preserve_root/index.html b/dev/uucore/perms/options/preserve_root/index.html index 245493d0a..624223081 100644 --- a/dev/uucore/perms/options/preserve_root/index.html +++ b/dev/uucore/perms/options/preserve_root/index.html @@ -1 +1 @@ -uucore::perms::options::preserve_root - Rust
    \ No newline at end of file +uucore::perms::options::preserve_root - Rust
    \ No newline at end of file diff --git a/dev/uucore/perms/options/traverse/constant.EVERY.html b/dev/uucore/perms/options/traverse/constant.EVERY.html index 59bd344c3..3dc77b79d 100644 --- a/dev/uucore/perms/options/traverse/constant.EVERY.html +++ b/dev/uucore/perms/options/traverse/constant.EVERY.html @@ -1 +1 @@ -EVERY in uucore::perms::options::traverse - Rust
    pub const EVERY: &'static str = "L";
    \ No newline at end of file +EVERY in uucore::perms::options::traverse - Rust
    pub const EVERY: &'static str = "L";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/traverse/constant.NO_TRAVERSE.html b/dev/uucore/perms/options/traverse/constant.NO_TRAVERSE.html index 8fd44e7d6..bd38105c6 100644 --- a/dev/uucore/perms/options/traverse/constant.NO_TRAVERSE.html +++ b/dev/uucore/perms/options/traverse/constant.NO_TRAVERSE.html @@ -1 +1 @@ -NO_TRAVERSE in uucore::perms::options::traverse - Rust
    pub const NO_TRAVERSE: &'static str = "P";
    \ No newline at end of file +NO_TRAVERSE in uucore::perms::options::traverse - Rust
    pub const NO_TRAVERSE: &'static str = "P";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/traverse/constant.TRAVERSE.html b/dev/uucore/perms/options/traverse/constant.TRAVERSE.html index fddbe177f..bdde5a6a0 100644 --- a/dev/uucore/perms/options/traverse/constant.TRAVERSE.html +++ b/dev/uucore/perms/options/traverse/constant.TRAVERSE.html @@ -1 +1 @@ -TRAVERSE in uucore::perms::options::traverse - Rust
    pub const TRAVERSE: &'static str = "H";
    \ No newline at end of file +TRAVERSE in uucore::perms::options::traverse - Rust
    pub const TRAVERSE: &'static str = "H";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/traverse/index.html b/dev/uucore/perms/options/traverse/index.html index 59a2aee35..fa909cb07 100644 --- a/dev/uucore/perms/options/traverse/index.html +++ b/dev/uucore/perms/options/traverse/index.html @@ -1 +1 @@ -uucore::perms::options::traverse - Rust
    \ No newline at end of file +uucore::perms::options::traverse - Rust
    \ No newline at end of file diff --git a/dev/uucore/perms/options/verbosity/constant.CHANGES.html b/dev/uucore/perms/options/verbosity/constant.CHANGES.html index ab5dc7f05..0377d0fec 100644 --- a/dev/uucore/perms/options/verbosity/constant.CHANGES.html +++ b/dev/uucore/perms/options/verbosity/constant.CHANGES.html @@ -1 +1 @@ -CHANGES in uucore::perms::options::verbosity - Rust
    pub const CHANGES: &'static str = "changes";
    \ No newline at end of file +CHANGES in uucore::perms::options::verbosity - Rust
    pub const CHANGES: &'static str = "changes";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/verbosity/constant.QUIET.html b/dev/uucore/perms/options/verbosity/constant.QUIET.html index 08a3db9ee..db1d80524 100644 --- a/dev/uucore/perms/options/verbosity/constant.QUIET.html +++ b/dev/uucore/perms/options/verbosity/constant.QUIET.html @@ -1 +1 @@ -QUIET in uucore::perms::options::verbosity - Rust
    pub const QUIET: &'static str = "quiet";
    \ No newline at end of file +QUIET in uucore::perms::options::verbosity - Rust
    pub const QUIET: &'static str = "quiet";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/verbosity/constant.SILENT.html b/dev/uucore/perms/options/verbosity/constant.SILENT.html index 1c08feffc..614d1102e 100644 --- a/dev/uucore/perms/options/verbosity/constant.SILENT.html +++ b/dev/uucore/perms/options/verbosity/constant.SILENT.html @@ -1 +1 @@ -SILENT in uucore::perms::options::verbosity - Rust
    pub const SILENT: &'static str = "silent";
    \ No newline at end of file +SILENT in uucore::perms::options::verbosity - Rust
    pub const SILENT: &'static str = "silent";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/verbosity/constant.VERBOSE.html b/dev/uucore/perms/options/verbosity/constant.VERBOSE.html index 3461f8cee..904311c16 100644 --- a/dev/uucore/perms/options/verbosity/constant.VERBOSE.html +++ b/dev/uucore/perms/options/verbosity/constant.VERBOSE.html @@ -1 +1 @@ -VERBOSE in uucore::perms::options::verbosity - Rust
    pub const VERBOSE: &'static str = "verbose";
    \ No newline at end of file +VERBOSE in uucore::perms::options::verbosity - Rust
    pub const VERBOSE: &'static str = "verbose";
    \ No newline at end of file diff --git a/dev/uucore/perms/options/verbosity/index.html b/dev/uucore/perms/options/verbosity/index.html index ece83d1ff..d32c637c4 100644 --- a/dev/uucore/perms/options/verbosity/index.html +++ b/dev/uucore/perms/options/verbosity/index.html @@ -1 +1 @@ -uucore::perms::options::verbosity - Rust
    \ No newline at end of file +uucore::perms::options::verbosity - Rust
    \ No newline at end of file diff --git a/dev/uucore/perms/struct.ChownExecutor.html b/dev/uucore/perms/struct.ChownExecutor.html index 0f336ba48..5417e2168 100644 --- a/dev/uucore/perms/struct.ChownExecutor.html +++ b/dev/uucore/perms/struct.ChownExecutor.html @@ -1,22 +1,15 @@ -ChownExecutor in uucore::perms - Rust
    pub struct ChownExecutor {
    -    pub dest_uid: Option<u32>,
    -    pub dest_gid: Option<u32>,
    +ChownExecutor in uucore::perms - Rust
    pub struct ChownExecutor {
    +    pub dest_uid: Option<u32>,
    +    pub dest_gid: Option<u32>,
         pub traverse_symlinks: TraverseSymlinks,
         pub verbosity: Verbosity,
         pub filter: IfFrom,
    -    pub files: Vec<String>,
    -    pub recursive: bool,
    -    pub preserve_root: bool,
    -    pub dereference: bool,
    -}

    Fields

    dest_uid: Option<u32>dest_gid: Option<u32>traverse_symlinks: TraverseSymlinksverbosity: Verbosityfilter: IfFromfiles: Vec<String>recursive: boolpreserve_root: booldereference: bool

    Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    + pub files: Vec<String>, + pub recursive: bool, + pub preserve_root: bool, + pub dereference: bool, +}

    Fields

    dest_uid: Option<u32>dest_gid: Option<u32>traverse_symlinks: TraverseSymlinksverbosity: Verbosityfilter: IfFromfiles: Vec<String>recursive: boolpreserve_root: booldereference: bool

    Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/perms/struct.Verbosity.html b/dev/uucore/perms/struct.Verbosity.html index f97420b8d..502ac1937 100644 --- a/dev/uucore/perms/struct.Verbosity.html +++ b/dev/uucore/perms/struct.Verbosity.html @@ -1,24 +1,10 @@ -Verbosity in uucore::perms - Rust
    pub struct Verbosity {
    -    pub groups_only: bool,
    +Verbosity in uucore::perms - Rust
    pub struct Verbosity {
    +    pub groups_only: bool,
         pub level: VerbosityLevel,
    -}

    Fields

    groups_only: boollevel: VerbosityLevel

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Fields

    groups_only: boollevel: VerbosityLevel

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/pipes/fn.pipe.html b/dev/uucore/pipes/fn.pipe.html index 45ad6398a..31a9b324d 100644 --- a/dev/uucore/pipes/fn.pipe.html +++ b/dev/uucore/pipes/fn.pipe.html @@ -1,4 +1,4 @@ -pipe in uucore::pipes - Rust
    pub fn pipe() -> Result<(File, File)>
    Expand description

    A wrapper around [nix::unistd::pipe] that ensures the pipe is cleaned up.

    +pipe in uucore::pipes - Rust
    pub fn pipe() -> Result<(File, File)>
    Expand description

    A wrapper around [nix::unistd::pipe] that ensures the pipe is cleaned up.

    Returns two File objects: everything written to the second can be read from the first.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/pipes/fn.splice.html b/dev/uucore/pipes/fn.splice.html index b6b9944c2..353eba2fa 100644 --- a/dev/uucore/pipes/fn.splice.html +++ b/dev/uucore/pipes/fn.splice.html @@ -1,8 +1,8 @@ -splice in uucore::pipes - Rust
    pub fn splice(
        source: &impl AsRawFd,
        target: &impl AsRawFd,
        len: usize
    ) -> Result<usize>
    Expand description

    Less noisy wrapper around [nix::fcntl::splice].

    +splice in uucore::pipes - Rust
    pub fn splice(
        source: &impl AsRawFd,
        target: &impl AsRawFd,
        len: usize
    ) -> Result<usize>
    Expand description

    Less noisy wrapper around [nix::fcntl::splice].

    Up to len bytes are moved from source to target. Returns the number of successfully moved bytes.

    At least one of source and target must be some sort of pipe. To get around this requirement, consider splicing from your source into a pipe and then from the pipe into your target (with splice_exact): this is still very efficient.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/pipes/fn.splice_exact.html b/dev/uucore/pipes/fn.splice_exact.html index 9cbef9a16..29d4ea7a3 100644 --- a/dev/uucore/pipes/fn.splice_exact.html +++ b/dev/uucore/pipes/fn.splice_exact.html @@ -1,4 +1,4 @@ -splice_exact in uucore::pipes - Rust
    pub fn splice_exact(
        source: &impl AsRawFd,
        target: &impl AsRawFd,
        len: usize
    ) -> Result<()>
    Expand description

    Splice wrapper which fully finishes the write.

    +splice_exact in uucore::pipes - Rust
    pub fn splice_exact(
        source: &impl AsRawFd,
        target: &impl AsRawFd,
        len: usize
    ) -> Result<()>
    Expand description

    Splice wrapper which fully finishes the write.

    Exactly len bytes are moved from source into target.

    Panics if source runs out of data before len bytes have been moved.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/pipes/fn.vmsplice.html b/dev/uucore/pipes/fn.vmsplice.html index 0a9d3b99d..064779dcc 100644 --- a/dev/uucore/pipes/fn.vmsplice.html +++ b/dev/uucore/pipes/fn.vmsplice.html @@ -1,3 +1,3 @@ -vmsplice in uucore::pipes - Rust
    pub fn vmsplice(target: &impl AsRawFd, bytes: &[u8]) -> Result<usize>
    Expand description

    Copy data from bytes into target, which must be a pipe.

    +vmsplice in uucore::pipes - Rust
    pub fn vmsplice(target: &impl AsRawFd, bytes: &[u8]) -> Result<usize>
    Expand description

    Copy data from bytes into target, which must be a pipe.

    Returns the number of successfully copied bytes.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/pipes/index.html b/dev/uucore/pipes/index.html index b66aeaef7..618ab7efa 100644 --- a/dev/uucore/pipes/index.html +++ b/dev/uucore/pipes/index.html @@ -1,7 +1 @@ -uucore::pipes - Rust

    Functions

    A wrapper around [nix::unistd::pipe] that ensures the pipe is cleaned up.

    -

    Less noisy wrapper around [nix::fcntl::splice].

    -

    Splice wrapper which fully finishes the write.

    -

    Copy data from bytes into target, which must be a pipe.

    -

    Type Definitions

    Nix’s main error type.

    -

    Nix Result Type

    -
    \ No newline at end of file +uucore::pipes - Rust

    Functions

    A wrapper around [nix::unistd::pipe] that ensures the pipe is cleaned up.
    Less noisy wrapper around [nix::fcntl::splice].
    Splice wrapper which fully finishes the write.
    Copy data from bytes into target, which must be a pipe.

    Type Definitions

    Nix’s main error type.
    Nix Result Type
    \ No newline at end of file diff --git a/dev/uucore/pipes/type.Error.html b/dev/uucore/pipes/type.Error.html index 6571a61ec..de8c1eda4 100644 --- a/dev/uucore/pipes/type.Error.html +++ b/dev/uucore/pipes/type.Error.html @@ -1,6 +1,6 @@ -Error in uucore::pipes - Rust

    Type Definition uucore::pipes::Error

    []
    pub type Error = Errno;
    Expand description

    Nix’s main error type.

    +Error in uucore::pipes - Rust

    Type Definition uucore::pipes::Error

    []
    pub type Error = Errno;
    Expand description

    Nix’s main error type.

    It’s a wrapper around Errno. As such, it’s very interoperable with -std::io::Error, but it has the advantages of:

    +std::io::Error, but it has the advantages of:

    • Clone
    • Copy
    • @@ -9,4 +9,4 @@
    • Represents all of the system’s errnos, instead of just the most common ones.
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uucore/pipes/type.Result.html b/dev/uucore/pipes/type.Result.html index 439bcf0f4..e7476f7a8 100644 --- a/dev/uucore/pipes/type.Result.html +++ b/dev/uucore/pipes/type.Result.html @@ -1,2 +1,2 @@ -Result in uucore::pipes - Rust

    Type Definition uucore::pipes::Result

    []
    pub type Result<T> = Result<T, Errno>;
    Expand description

    Nix Result Type

    -
    \ No newline at end of file +Result in uucore::pipes - Rust

    Type Definition uucore::pipes::Result

    []
    pub type Result<T> = Result<T, Errno>;
    Expand description

    Nix Result Type

    +
    \ No newline at end of file diff --git a/dev/uucore/process/enum.ExitStatus.html b/dev/uucore/process/enum.ExitStatus.html index 763b768ad..7f6afb83d 100644 --- a/dev/uucore/process/enum.ExitStatus.html +++ b/dev/uucore/process/enum.ExitStatus.html @@ -1,26 +1,10 @@ -ExitStatus in uucore::process - Rust
    pub enum ExitStatus {
    -    Code(i32),
    -    Signal(i32),
    -}

    Variants

    Code(i32)

    Signal(i32)

    Implementations

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Formats the value using the given formatter. Read more

    -

    Formats the value using the given formatter. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +ExitStatus in uucore::process - Rust
    pub enum ExitStatus {
    +    Code(i32),
    +    Signal(i32),
    +}

    Variants

    Code(i32)

    Signal(i32)

    Implementations

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more
    Formats the value using the given formatter. Read more
    Formats the value using the given formatter. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    Converts the given value to a String. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    Converts the given value to a String. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/process/fn.getegid.html b/dev/uucore/process/fn.getegid.html index 62408c000..ff0a17a53 100644 --- a/dev/uucore/process/fn.getegid.html +++ b/dev/uucore/process/fn.getegid.html @@ -1,2 +1,2 @@ -getegid in uucore::process - Rust
    pub fn getegid() -> gid_t
    Expand description

    getegid() returns the effective group ID of the calling process.

    -
    \ No newline at end of file +getegid in uucore::process - Rust
    pub fn getegid() -> gid_t
    Expand description

    getegid() returns the effective group ID of the calling process.

    +
    \ No newline at end of file diff --git a/dev/uucore/process/fn.geteuid.html b/dev/uucore/process/fn.geteuid.html index aa7ef00f2..5cbc3c5a9 100644 --- a/dev/uucore/process/fn.geteuid.html +++ b/dev/uucore/process/fn.geteuid.html @@ -1,2 +1,2 @@ -geteuid in uucore::process - Rust
    pub fn geteuid() -> uid_t
    Expand description

    geteuid() returns the effective user ID of the calling process.

    -
    \ No newline at end of file +geteuid in uucore::process - Rust
    pub fn geteuid() -> uid_t
    Expand description

    geteuid() returns the effective user ID of the calling process.

    +
    \ No newline at end of file diff --git a/dev/uucore/process/fn.getgid.html b/dev/uucore/process/fn.getgid.html index dfd2daa5c..cf8b3a007 100644 --- a/dev/uucore/process/fn.getgid.html +++ b/dev/uucore/process/fn.getgid.html @@ -1,2 +1,2 @@ -getgid in uucore::process - Rust
    pub fn getgid() -> gid_t
    Expand description

    getgid() returns the real group ID of the calling process.

    -
    \ No newline at end of file +getgid in uucore::process - Rust
    pub fn getgid() -> gid_t
    Expand description

    getgid() returns the real group ID of the calling process.

    +
    \ No newline at end of file diff --git a/dev/uucore/process/fn.getuid.html b/dev/uucore/process/fn.getuid.html index 018f84437..bb2adf6fe 100644 --- a/dev/uucore/process/fn.getuid.html +++ b/dev/uucore/process/fn.getuid.html @@ -1,2 +1,2 @@ -getuid in uucore::process - Rust
    pub fn getuid() -> uid_t
    Expand description

    getuid() returns the real user ID of the calling process.

    -
    \ No newline at end of file +getuid in uucore::process - Rust
    pub fn getuid() -> uid_t
    Expand description

    getuid() returns the real user ID of the calling process.

    +
    \ No newline at end of file diff --git a/dev/uucore/process/index.html b/dev/uucore/process/index.html index 7d2172b4a..d8f7744ce 100644 --- a/dev/uucore/process/index.html +++ b/dev/uucore/process/index.html @@ -1,7 +1,2 @@ -uucore::process - Rust
    Expand description

    Set of functions to manage IDs

    -

    Enums

    Traits

    Missing methods for Child objects

    -

    Functions

    getegid() returns the effective group ID of the calling process.

    -

    geteuid() returns the effective user ID of the calling process.

    -

    getgid() returns the real group ID of the calling process.

    -

    getuid() returns the real user ID of the calling process.

    -
    \ No newline at end of file +uucore::process - Rust
    Expand description

    Set of functions to manage IDs

    +

    Enums

    Traits

    Missing methods for Child objects

    Functions

    getegid() returns the effective group ID of the calling process.
    geteuid() returns the effective user ID of the calling process.
    getgid() returns the real group ID of the calling process.
    getuid() returns the real user ID of the calling process.
    \ No newline at end of file diff --git a/dev/uucore/process/trait.ChildExt.html b/dev/uucore/process/trait.ChildExt.html index 51382b890..b4ef5bbb1 100644 --- a/dev/uucore/process/trait.ChildExt.html +++ b/dev/uucore/process/trait.ChildExt.html @@ -1,10 +1,10 @@ -ChildExt in uucore::process - Rust
    pub trait ChildExt {
    -    fn send_signal(&mut self, signal: usize) -> Result<()>;
    -    fn wait_or_timeout(
            &mut self,
            timeout: Duration
        ) -> Result<Option<ExitStatus>>; +ChildExt in uucore::process - Rust
    pub trait ChildExt {
    +    fn send_signal(&mut self, signal: usize) -> Result<()>;
    +    fn wait_or_timeout(
            &mut self,
            timeout: Duration
        ) -> Result<Option<ExitStatus>>; }
    Expand description

    Missing methods for Child objects

    -

    Required Methods

    Send a signal to a Child process.

    +

    Required Methods

    Send a signal to a Child process.

    Caller beware: if the process already exited then you may accidentally send the signal to an unrelated process that recycled the PID.

    -

    Wait for a process to finish or return after the specified duration. +

    Wait for a process to finish or return after the specified duration. A timeout of zero disables the timeout.

    -

    Implementations on Foreign Types

    Implementors

    \ No newline at end of file +

    Implementations on Foreign Types

    Implementors

    \ No newline at end of file diff --git a/dev/uucore/quoting_style/enum.Quotes.html b/dev/uucore/quoting_style/enum.Quotes.html index 3873dc5f3..9f178f8e8 100644 --- a/dev/uucore/quoting_style/enum.Quotes.html +++ b/dev/uucore/quoting_style/enum.Quotes.html @@ -1,21 +1,9 @@ -Quotes in uucore::quoting_style - Rust
    pub enum Quotes {
    +Quotes in uucore::quoting_style - Rust
    pub enum Quotes {
         None,
         Single,
         Double,
    -}

    Variants

    None

    Single

    Double

    Trait Implementations

    Returns a copy of the value. Read more

    -

    Performs copy-assignment from source. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Variants

    None

    Single

    Double

    Trait Implementations

    Returns a copy of the value. Read more
    Performs copy-assignment from source. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The resulting type after obtaining ownership.

    -

    Creates owned data from borrowed data, usually by cloning. Read more

    -

    Uses borrowed data to replace owned data, usually by cloning. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/quoting_style/enum.QuotingStyle.html b/dev/uucore/quoting_style/enum.QuotingStyle.html index 40ba8e636..394d09601 100644 --- a/dev/uucore/quoting_style/enum.QuotingStyle.html +++ b/dev/uucore/quoting_style/enum.QuotingStyle.html @@ -1,24 +1,17 @@ -QuotingStyle in uucore::quoting_style - Rust
    pub enum QuotingStyle {
    +QuotingStyle in uucore::quoting_style - Rust
    pub enum QuotingStyle {
         Shell {
    -        escape: bool,
    -        always_quote: bool,
    -        show_control: bool,
    +        escape: bool,
    +        always_quote: bool,
    +        show_control: bool,
         },
         C {
             quotes: Quotes,
         },
         Literal {
    -        show_control: bool,
    +        show_control: bool,
         },
    -}

    Variants

    Shell

    Fields

    escape: bool
    always_quote: bool
    show_control: bool

    C

    Fields

    quotes: Quotes

    Literal

    Fields

    show_control: bool

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +}

    Variants

    Shell

    Fields

    escape: bool
    always_quote: bool
    show_control: bool

    C

    Fields

    quotes: Quotes

    Literal

    Fields

    show_control: bool

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/quoting_style/fn.escape_name.html b/dev/uucore/quoting_style/fn.escape_name.html index 3a6a317ce..13bc36bb8 100644 --- a/dev/uucore/quoting_style/fn.escape_name.html +++ b/dev/uucore/quoting_style/fn.escape_name.html @@ -1 +1 @@ -escape_name in uucore::quoting_style - Rust
    pub fn escape_name(name: &OsStr, style: &QuotingStyle) -> String
    \ No newline at end of file +escape_name in uucore::quoting_style - Rust
    pub fn escape_name(name: &OsStr, style: &QuotingStyle) -> String
    \ No newline at end of file diff --git a/dev/uucore/quoting_style/index.html b/dev/uucore/quoting_style/index.html index d77e11a13..7dc65cf3e 100644 --- a/dev/uucore/quoting_style/index.html +++ b/dev/uucore/quoting_style/index.html @@ -1 +1 @@ -uucore::quoting_style - Rust
    \ No newline at end of file +uucore::quoting_style - Rust
    \ No newline at end of file diff --git a/dev/uucore/ranges/fn.complement.html b/dev/uucore/ranges/fn.complement.html index 72a4aac17..645e62171 100644 --- a/dev/uucore/ranges/fn.complement.html +++ b/dev/uucore/ranges/fn.complement.html @@ -1 +1 @@ -complement in uucore::ranges - Rust
    pub fn complement(ranges: &[Range]) -> Vec<Range>
    \ No newline at end of file +complement in uucore::ranges - Rust
    pub fn complement(ranges: &[Range]) -> Vec<Range>
    \ No newline at end of file diff --git a/dev/uucore/ranges/fn.contain.html b/dev/uucore/ranges/fn.contain.html index 1a25f20c9..a91903d9a 100644 --- a/dev/uucore/ranges/fn.contain.html +++ b/dev/uucore/ranges/fn.contain.html @@ -1,16 +1,16 @@ -contain in uucore::ranges - Rust
    pub fn contain(ranges: &[Range], n: usize) -> bool
    Expand description

    Test if at least one of the given Ranges contain the supplied value.

    +contain in uucore::ranges - Rust
    pub fn contain(ranges: &[Range], n: usize) -> bool
    Expand description

    Test if at least one of the given Ranges contain the supplied value.

    Examples:

    -
    let ranges = uucore::ranges::Range::from_list("11,2,6-8").unwrap();
    +
    let ranges = uucore::ranges::Range::from_list("11,2,6-8").unwrap();
     
    -assert!(!uucore::ranges::contain(&ranges, 0));
    -assert!(!uucore::ranges::contain(&ranges, 1));
    -assert!(!uucore::ranges::contain(&ranges, 5));
    -assert!(!uucore::ranges::contain(&ranges, 10));
    +assert!(!uucore::ranges::contain(&ranges, 0));
    +assert!(!uucore::ranges::contain(&ranges, 1));
    +assert!(!uucore::ranges::contain(&ranges, 5));
    +assert!(!uucore::ranges::contain(&ranges, 10));
     
    -assert!(uucore::ranges::contain(&ranges, 2));
    -assert!(uucore::ranges::contain(&ranges, 6));
    -assert!(uucore::ranges::contain(&ranges, 7));
    -assert!(uucore::ranges::contain(&ranges, 8));
    -assert!(uucore::ranges::contain(&ranges, 11));
    -
    \ No newline at end of file +assert!(uucore::ranges::contain(&ranges, 2)); +assert!(uucore::ranges::contain(&ranges, 6)); +assert!(uucore::ranges::contain(&ranges, 7)); +assert!(uucore::ranges::contain(&ranges, 8)); +assert!(uucore::ranges::contain(&ranges, 11));
    +
    \ No newline at end of file diff --git a/dev/uucore/ranges/index.html b/dev/uucore/ranges/index.html index e28db4972..859eb6f0c 100644 --- a/dev/uucore/ranges/index.html +++ b/dev/uucore/ranges/index.html @@ -1,2 +1 @@ -uucore::ranges - Rust

    Structs

    Functions

    Test if at least one of the given Ranges contain the supplied value.

    -
    \ No newline at end of file +uucore::ranges - Rust

    Structs

    Functions

    Test if at least one of the given Ranges contain the supplied value.
    \ No newline at end of file diff --git a/dev/uucore/ranges/struct.Range.html b/dev/uucore/ranges/struct.Range.html index 3545acb0a..38183a0d0 100644 --- a/dev/uucore/ranges/struct.Range.html +++ b/dev/uucore/ranges/struct.Range.html @@ -1,44 +1,25 @@ -Range in uucore::ranges - Rust
    pub struct Range {
    -    pub low: usize,
    -    pub high: usize,
    -}

    Fields

    low: usizehigh: usize

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more

    -

    Parse a string of the form a-b into a Range

    +Range in uucore::ranges - Rust
    pub struct Range {
    +    pub low: usize,
    +    pub high: usize,
    +}

    Fields

    low: usizehigh: usize

    Implementations

    Trait Implementations

    Formats the value using the given formatter. Read more

    Parse a string of the form a-b into a Range

    -
    use std::str::FromStr;
    -use uucore::ranges::Range;
    -assert_eq!(Range::from_str("5"), Ok(Range { low: 5, high: 5 }));
    -assert_eq!(Range::from_str("4-"), Ok(Range { low: 4, high: usize::MAX - 1 }));
    -assert_eq!(Range::from_str("-4"), Ok(Range { low: 1, high: 4 }));
    -assert_eq!(Range::from_str("2-4"), Ok(Range { low: 2, high: 4 }));
    -assert!(Range::from_str("0-4").is_err());
    -assert!(Range::from_str("4-2").is_err());
    -assert!(Range::from_str("-").is_err());
    -assert!(Range::from_str("a").is_err());
    -assert!(Range::from_str("a-b").is_err());
    -

    The associated error which can be returned from parsing.

    -

    This method returns an Ordering between self and other. Read more

    -

    Compares and returns the maximum of two values. Read more

    -

    Compares and returns the minimum of two values. Read more

    -

    Restrict a value to a certain interval. Read more

    -

    This method tests for self and other values to be equal, and is used -by ==. Read more

    -

    This method tests for !=.

    -

    This method returns an ordering between self and other values if one exists. Read more

    -

    This method tests less than (for self and other) and is used by the < operator. Read more

    -

    This method tests less than or equal to (for self and other) and is used by the <= -operator. Read more

    -

    This method tests greater than (for self and other) and is used by the > operator. Read more

    -

    This method tests greater than or equal to (for self and other) and is used by the >= -operator. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +
    use std::str::FromStr;
    +use uucore::ranges::Range;
    +assert_eq!(Range::from_str("5"), Ok(Range { low: 5, high: 5 }));
    +assert_eq!(Range::from_str("4-"), Ok(Range { low: 4, high: usize::MAX - 1 }));
    +assert_eq!(Range::from_str("-4"), Ok(Range { low: 1, high: 4 }));
    +assert_eq!(Range::from_str("2-4"), Ok(Range { low: 2, high: 4 }));
    +assert!(Range::from_str("0-4").is_err());
    +assert!(Range::from_str("4-2").is_err());
    +assert!(Range::from_str("-").is_err());
    +assert!(Range::from_str("a").is_err());
    +assert!(Range::from_str("a-b").is_err());
    +
    The associated error which can be returned from parsing.
    This method returns an Ordering between self and other. Read more
    Compares and returns the maximum of two values. Read more
    Compares and returns the minimum of two values. Read more
    Restrict a value to a certain interval. Read more
    This method tests for self and other values to be equal, and is used +by ==. Read more
    This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason. Read more
    This method returns an ordering between self and other values if one exists. Read more
    This method tests less than (for self and other) and is used by the < operator. Read more
    This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
    This method tests greater than (for self and other) and is used by the > operator. Read more
    This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/ringbuffer/index.html b/dev/uucore/ringbuffer/index.html index 73c67e746..d01fcde1e 100644 --- a/dev/uucore/ringbuffer/index.html +++ b/dev/uucore/ringbuffer/index.html @@ -1,3 +1,2 @@ -uucore::ringbuffer - Rust
    Expand description

    A fixed-size ring buffer.

    -

    Structs

    A fixed-size ring buffer backed by a VecDeque.

    -
    \ No newline at end of file +uucore::ringbuffer - Rust
    Expand description

    A fixed-size ring buffer.

    +

    Structs

    A fixed-size ring buffer backed by a VecDeque.
    \ No newline at end of file diff --git a/dev/uucore/ringbuffer/struct.RingBuffer.html b/dev/uucore/ringbuffer/struct.RingBuffer.html index 349900c4e..17581546f 100644 --- a/dev/uucore/ringbuffer/struct.RingBuffer.html +++ b/dev/uucore/ringbuffer/struct.RingBuffer.html @@ -1,9 +1,9 @@ -RingBuffer in uucore::ringbuffer - Rust
    pub struct RingBuffer<T> {
    -    pub data: VecDeque<T>,
    +RingBuffer in uucore::ringbuffer - Rust
    pub struct RingBuffer<T> {
    +    pub data: VecDeque<T>,
         /* private fields */
     }
    Expand description

    A fixed-size ring buffer backed by a VecDeque.

    If the ring buffer is not full, then calling the push_back -method appends elements, as in a VecDeque. If the ring buffer +method appends elements, as in a VecDeque. If the ring buffer is full, then calling push_back removes the element at the front of the buffer (in a first-in, first-out manner) before appending the new element to the back of the buffer.

    @@ -13,19 +13,19 @@ iterator.

    After exceeding the size limit, the oldest elements are dropped in favor of the newest element:

    -
    let mut buffer: RingBuffer<u8> = RingBuffer::new(2);
    -buffer.push_back(0);
    -buffer.push_back(1);
    -buffer.push_back(2);
    -assert_eq!(vec![1, 2], buffer.data);
    +
    let mut buffer: RingBuffer<u8> = RingBuffer::new(2);
    +buffer.push_back(0);
    +buffer.push_back(1);
    +buffer.push_back(2);
    +assert_eq!(vec![1, 2], buffer.data);

    Take the last n elements from an iterator:

    -
    let iter = [0, 1, 2].iter();
    -let actual = RingBuffer::from_iter(iter, 2).data;
    -let expected = VecDeque::from_iter([1, 2].iter());
    -assert_eq!(expected, actual);
    -

    Fields

    data: VecDeque<T>

    Implementations

    Append a value to the end of the ring buffer.

    -

    If the ring buffer is not full, this method return None. If +

    let iter = [0, 1, 2].iter();
    +let actual = RingBuffer::from_iter(iter, 2).data;
    +let expected = VecDeque::from_iter([1, 2].iter());
    +assert_eq!(expected, actual);
    +

    Fields

    data: VecDeque<T>

    Implementations

    Append a value to the end of the ring buffer.

    +

    If the ring buffer is not full, this method return None. If the ring buffer is full, appending a new element will cause the oldest element to be evicted. In that case this method returns that element, or None.

    @@ -36,27 +36,20 @@ the input is immediately evicted.

    Appending an element when the buffer is full returns the oldest element:

    -
    let mut buf = RingBuffer::new(3);
    -assert_eq!(None, buf.push_back(0));
    -assert_eq!(None, buf.push_back(1));
    -assert_eq!(None, buf.push_back(2));
    -assert_eq!(Some(0), buf.push_back(3));
    +
    let mut buf = RingBuffer::new(3);
    +assert_eq!(None, buf.push_back(0));
    +assert_eq!(None, buf.push_back(1));
    +assert_eq!(None, buf.push_back(2));
    +assert_eq!(Some(0), buf.push_back(3));

    If the size limit is zero, then this method always returns the input value:

    -
    let mut buf = RingBuffer::new(0);
    -assert_eq!(Some(0), buf.push_back(0));
    -assert_eq!(Some(1), buf.push_back(1));
    -assert_eq!(Some(2), buf.push_back(2));
    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +
    let mut buf = RingBuffer::new(0);
    +assert_eq!(Some(0), buf.push_back(0));
    +assert_eq!(Some(1), buf.push_back(1));
    +assert_eq!(Some(2), buf.push_back(2));
    +

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/signals/fn.is_signal.html b/dev/uucore/signals/fn.is_signal.html index 6788537b1..6a5d2fcb6 100644 --- a/dev/uucore/signals/fn.is_signal.html +++ b/dev/uucore/signals/fn.is_signal.html @@ -1 +1 @@ -is_signal in uucore::signals - Rust
    pub fn is_signal(num: usize) -> bool
    \ No newline at end of file +is_signal in uucore::signals - Rust
    pub fn is_signal(num: usize) -> bool
    \ No newline at end of file diff --git a/dev/uucore/signals/fn.signal_by_name_or_value.html b/dev/uucore/signals/fn.signal_by_name_or_value.html index 68a669707..0235f7e15 100644 --- a/dev/uucore/signals/fn.signal_by_name_or_value.html +++ b/dev/uucore/signals/fn.signal_by_name_or_value.html @@ -1 +1 @@ -signal_by_name_or_value in uucore::signals - Rust
    pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option<usize>
    \ No newline at end of file +signal_by_name_or_value in uucore::signals - Rust
    pub fn signal_by_name_or_value(signal_name_or_value: &str) -> Option<usize>
    \ No newline at end of file diff --git a/dev/uucore/signals/fn.signal_name_by_value.html b/dev/uucore/signals/fn.signal_name_by_value.html index 00e255cd4..e37ef133a 100644 --- a/dev/uucore/signals/fn.signal_name_by_value.html +++ b/dev/uucore/signals/fn.signal_name_by_value.html @@ -1 +1 @@ -signal_name_by_value in uucore::signals - Rust
    pub fn signal_name_by_value(signal_value: usize) -> Option<&'static str>
    \ No newline at end of file +signal_name_by_value in uucore::signals - Rust
    pub fn signal_name_by_value(signal_value: usize) -> Option<&'static str>
    \ No newline at end of file diff --git a/dev/uucore/signals/index.html b/dev/uucore/signals/index.html index 677c8387d..50e021cf2 100644 --- a/dev/uucore/signals/index.html +++ b/dev/uucore/signals/index.html @@ -1 +1 @@ -uucore::signals - Rust
    \ No newline at end of file +uucore::signals - Rust
    \ No newline at end of file diff --git a/dev/uucore/signals/static.ALL_SIGNALS.html b/dev/uucore/signals/static.ALL_SIGNALS.html index 7c8404baf..b4ca093ea 100644 --- a/dev/uucore/signals/static.ALL_SIGNALS.html +++ b/dev/uucore/signals/static.ALL_SIGNALS.html @@ -1 +1 @@ -ALL_SIGNALS in uucore::signals - Rust
    pub static ALL_SIGNALS: [&'static str; 32]
    \ No newline at end of file +ALL_SIGNALS in uucore::signals - Rust
    pub static ALL_SIGNALS: [&'static str; 32]
    \ No newline at end of file diff --git a/dev/uucore/signals/static.DEFAULT_SIGNAL.html b/dev/uucore/signals/static.DEFAULT_SIGNAL.html index 419674648..dca14e13f 100644 --- a/dev/uucore/signals/static.DEFAULT_SIGNAL.html +++ b/dev/uucore/signals/static.DEFAULT_SIGNAL.html @@ -1 +1 @@ -DEFAULT_SIGNAL in uucore::signals - Rust
    pub static DEFAULT_SIGNAL: usize
    \ No newline at end of file +DEFAULT_SIGNAL in uucore::signals - Rust
    pub static DEFAULT_SIGNAL: usize
    \ No newline at end of file diff --git a/dev/uucore/trait.Args.html b/dev/uucore/trait.Args.html index b1237da30..d8ee77085 100644 --- a/dev/uucore/trait.Args.html +++ b/dev/uucore/trait.Args.html @@ -1,6 +1,6 @@ -Args in uucore - Rust
    pub trait Args: Iterator<Item = OsString> + Sized {
    -    fn collect_lossy(self) -> Vec<String> { ... }
    -    fn collect_ignore(self) -> Vec<String> { ... }
    -}

    Provided Methods

    Collects the iterator into a Vec<String>, lossily converting the OsStrings to Strings.

    -

    Collects the iterator into a Vec<String>, removing any elements that contain invalid encoding.

    -

    Implementors

    \ No newline at end of file +Args in uucore - Rust
    pub trait Args: Iterator<Item = OsString> + Sized {
    +    fn collect_lossy(self) -> Vec<String> { ... }
    +    fn collect_ignore(self) -> Vec<String> { ... }
    +}

    Provided Methods

    Collects the iterator into a Vec<String>, lossily converting the OsStrings to Strings.

    +

    Collects the iterator into a Vec<String>, removing any elements that contain invalid encoding.

    +

    Implementors

    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.ACCOUNTING.html b/dev/uucore/utmpx/constant.ACCOUNTING.html index 72c68520c..c12dc7d4f 100644 --- a/dev/uucore/utmpx/constant.ACCOUNTING.html +++ b/dev/uucore/utmpx/constant.ACCOUNTING.html @@ -1 +1 @@ -ACCOUNTING in uucore::utmpx - Rust
    pub const ACCOUNTING: i16 = 9; // 9i16
    \ No newline at end of file +ACCOUNTING in uucore::utmpx - Rust
    pub const ACCOUNTING: i16 = 9; // 9i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.BOOT_TIME.html b/dev/uucore/utmpx/constant.BOOT_TIME.html index bb045bac1..2a2de1a6d 100644 --- a/dev/uucore/utmpx/constant.BOOT_TIME.html +++ b/dev/uucore/utmpx/constant.BOOT_TIME.html @@ -1 +1 @@ -BOOT_TIME in uucore::utmpx - Rust
    pub const BOOT_TIME: i16 = 2; // 2i16
    \ No newline at end of file +BOOT_TIME in uucore::utmpx - Rust
    pub const BOOT_TIME: i16 = 2; // 2i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.DEAD_PROCESS.html b/dev/uucore/utmpx/constant.DEAD_PROCESS.html index f783ac91d..fda010502 100644 --- a/dev/uucore/utmpx/constant.DEAD_PROCESS.html +++ b/dev/uucore/utmpx/constant.DEAD_PROCESS.html @@ -1 +1 @@ -DEAD_PROCESS in uucore::utmpx - Rust
    pub const DEAD_PROCESS: i16 = 8; // 8i16
    \ No newline at end of file +DEAD_PROCESS in uucore::utmpx - Rust
    pub const DEAD_PROCESS: i16 = 8; // 8i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.EMPTY.html b/dev/uucore/utmpx/constant.EMPTY.html index a0f6998e2..b1f2d209a 100644 --- a/dev/uucore/utmpx/constant.EMPTY.html +++ b/dev/uucore/utmpx/constant.EMPTY.html @@ -1 +1 @@ -EMPTY in uucore::utmpx - Rust
    pub const EMPTY: i16 = 0; // 0i16
    \ No newline at end of file +EMPTY in uucore::utmpx - Rust
    pub const EMPTY: i16 = 0; // 0i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.INIT_PROCESS.html b/dev/uucore/utmpx/constant.INIT_PROCESS.html index 8181c1d44..529bdb468 100644 --- a/dev/uucore/utmpx/constant.INIT_PROCESS.html +++ b/dev/uucore/utmpx/constant.INIT_PROCESS.html @@ -1 +1 @@ -INIT_PROCESS in uucore::utmpx - Rust
    pub const INIT_PROCESS: i16 = 5; // 5i16
    \ No newline at end of file +INIT_PROCESS in uucore::utmpx - Rust
    pub const INIT_PROCESS: i16 = 5; // 5i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.LOGIN_PROCESS.html b/dev/uucore/utmpx/constant.LOGIN_PROCESS.html index 715c7850c..77cd48360 100644 --- a/dev/uucore/utmpx/constant.LOGIN_PROCESS.html +++ b/dev/uucore/utmpx/constant.LOGIN_PROCESS.html @@ -1 +1 @@ -LOGIN_PROCESS in uucore::utmpx - Rust
    pub const LOGIN_PROCESS: i16 = 6; // 6i16
    \ No newline at end of file +LOGIN_PROCESS in uucore::utmpx - Rust
    pub const LOGIN_PROCESS: i16 = 6; // 6i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.NEW_TIME.html b/dev/uucore/utmpx/constant.NEW_TIME.html index f8240388e..54b9e6b8f 100644 --- a/dev/uucore/utmpx/constant.NEW_TIME.html +++ b/dev/uucore/utmpx/constant.NEW_TIME.html @@ -1 +1 @@ -NEW_TIME in uucore::utmpx - Rust
    pub const NEW_TIME: i16 = 3; // 3i16
    \ No newline at end of file +NEW_TIME in uucore::utmpx - Rust
    pub const NEW_TIME: i16 = 3; // 3i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.OLD_TIME.html b/dev/uucore/utmpx/constant.OLD_TIME.html index 414af2121..4df3d830f 100644 --- a/dev/uucore/utmpx/constant.OLD_TIME.html +++ b/dev/uucore/utmpx/constant.OLD_TIME.html @@ -1 +1 @@ -OLD_TIME in uucore::utmpx - Rust
    pub const OLD_TIME: i16 = 4; // 4i16
    \ No newline at end of file +OLD_TIME in uucore::utmpx - Rust
    pub const OLD_TIME: i16 = 4; // 4i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.RUN_LVL.html b/dev/uucore/utmpx/constant.RUN_LVL.html index ae4d5d79c..765f7d8f2 100644 --- a/dev/uucore/utmpx/constant.RUN_LVL.html +++ b/dev/uucore/utmpx/constant.RUN_LVL.html @@ -1 +1 @@ -RUN_LVL in uucore::utmpx - Rust
    pub const RUN_LVL: i16 = 1; // 1i16
    \ No newline at end of file +RUN_LVL in uucore::utmpx - Rust
    pub const RUN_LVL: i16 = 1; // 1i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.USER_PROCESS.html b/dev/uucore/utmpx/constant.USER_PROCESS.html index 49050583e..dffc2f7f6 100644 --- a/dev/uucore/utmpx/constant.USER_PROCESS.html +++ b/dev/uucore/utmpx/constant.USER_PROCESS.html @@ -1 +1 @@ -USER_PROCESS in uucore::utmpx - Rust
    pub const USER_PROCESS: i16 = 7; // 7i16
    \ No newline at end of file +USER_PROCESS in uucore::utmpx - Rust
    pub const USER_PROCESS: i16 = 7; // 7i16
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.UT_HOSTSIZE.html b/dev/uucore/utmpx/constant.UT_HOSTSIZE.html index 4bebca6d4..652ae62c3 100644 --- a/dev/uucore/utmpx/constant.UT_HOSTSIZE.html +++ b/dev/uucore/utmpx/constant.UT_HOSTSIZE.html @@ -1 +1 @@ -UT_HOSTSIZE in uucore::utmpx - Rust
    pub const UT_HOSTSIZE: usize = 256; // 256usize
    \ No newline at end of file +UT_HOSTSIZE in uucore::utmpx - Rust
    pub const UT_HOSTSIZE: usize = 256; // 256usize
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.UT_IDSIZE.html b/dev/uucore/utmpx/constant.UT_IDSIZE.html index 43f87eff1..93eff4621 100644 --- a/dev/uucore/utmpx/constant.UT_IDSIZE.html +++ b/dev/uucore/utmpx/constant.UT_IDSIZE.html @@ -1 +1 @@ -UT_IDSIZE in uucore::utmpx - Rust
    pub const UT_IDSIZE: usize = 4;
    \ No newline at end of file +UT_IDSIZE in uucore::utmpx - Rust
    pub const UT_IDSIZE: usize = 4;
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.UT_LINESIZE.html b/dev/uucore/utmpx/constant.UT_LINESIZE.html index 92b158d62..b2e1fd618 100644 --- a/dev/uucore/utmpx/constant.UT_LINESIZE.html +++ b/dev/uucore/utmpx/constant.UT_LINESIZE.html @@ -1 +1 @@ -UT_LINESIZE in uucore::utmpx - Rust
    pub const UT_LINESIZE: usize = 32; // 32usize
    \ No newline at end of file +UT_LINESIZE in uucore::utmpx - Rust
    pub const UT_LINESIZE: usize = 32; // 32usize
    \ No newline at end of file diff --git a/dev/uucore/utmpx/constant.UT_NAMESIZE.html b/dev/uucore/utmpx/constant.UT_NAMESIZE.html index 0e649bcbb..64e52a500 100644 --- a/dev/uucore/utmpx/constant.UT_NAMESIZE.html +++ b/dev/uucore/utmpx/constant.UT_NAMESIZE.html @@ -1 +1 @@ -UT_NAMESIZE in uucore::utmpx - Rust
    pub const UT_NAMESIZE: usize = 32; // 32usize
    \ No newline at end of file +UT_NAMESIZE in uucore::utmpx - Rust
    pub const UT_NAMESIZE: usize = 32; // 32usize
    \ No newline at end of file diff --git a/dev/uucore/utmpx/fn.endutxent.html b/dev/uucore/utmpx/fn.endutxent.html index 337d4ae22..e176e85cb 100644 --- a/dev/uucore/utmpx/fn.endutxent.html +++ b/dev/uucore/utmpx/fn.endutxent.html @@ -1 +1 @@ -endutxent in uucore::utmpx - Rust
    pub unsafe extern "C" fn endutxent()
    \ No newline at end of file +endutxent in uucore::utmpx - Rust
    pub unsafe extern "C" fn endutxent()
    \ No newline at end of file diff --git a/dev/uucore/utmpx/fn.getutxent.html b/dev/uucore/utmpx/fn.getutxent.html index b495dffab..880dcf27b 100644 --- a/dev/uucore/utmpx/fn.getutxent.html +++ b/dev/uucore/utmpx/fn.getutxent.html @@ -1 +1 @@ -getutxent in uucore::utmpx - Rust
    pub unsafe extern "C" fn getutxent() -> *mut utmpx
    \ No newline at end of file +getutxent in uucore::utmpx - Rust
    pub unsafe extern "C" fn getutxent() -> *mut utmpx
    \ No newline at end of file diff --git a/dev/uucore/utmpx/fn.setutxent.html b/dev/uucore/utmpx/fn.setutxent.html index a44ffd7e3..9a7d6a6b5 100644 --- a/dev/uucore/utmpx/fn.setutxent.html +++ b/dev/uucore/utmpx/fn.setutxent.html @@ -1 +1 @@ -setutxent in uucore::utmpx - Rust
    pub unsafe extern "C" fn setutxent()
    \ No newline at end of file +setutxent in uucore::utmpx - Rust
    pub unsafe extern "C" fn setutxent()
    \ No newline at end of file diff --git a/dev/uucore/utmpx/fn.utmpxname.html b/dev/uucore/utmpx/fn.utmpxname.html index 5b4c20f0c..05e1a302e 100644 --- a/dev/uucore/utmpx/fn.utmpxname.html +++ b/dev/uucore/utmpx/fn.utmpxname.html @@ -1 +1 @@ -utmpxname in uucore::utmpx - Rust
    pub unsafe extern "C" fn utmpxname(file: *const i8) -> i32
    \ No newline at end of file +utmpxname in uucore::utmpx - Rust
    pub unsafe extern "C" fn utmpxname(file: *const i8) -> i32
    \ No newline at end of file diff --git a/dev/uucore/utmpx/index.html b/dev/uucore/utmpx/index.html index 069346d7c..6f353b520 100644 --- a/dev/uucore/utmpx/index.html +++ b/dev/uucore/utmpx/index.html @@ -1,19 +1,18 @@ -uucore::utmpx - Rust
    Expand description

    Aims to provide platform-independent methods to obtain login records

    +uucore::utmpx - Rust
    Expand description

    Aims to provide platform-independent methods to obtain login records

    ONLY support linux, macos and freebsd for the time being

    Examples:

    -
    use uucore::utmpx::Utmpx;
    -for ut in Utmpx::iter_all_records() {
    -    if ut.is_user_process() {
    -        println!("{}: {}", ut.host(), ut.user())
    +
    use uucore::utmpx::Utmpx;
    +for ut in Utmpx::iter_all_records() {
    +    if ut.is_user_process() {
    +        println!("{}: {}", ut.host(), ut.user())
         }
     }

    Specifying the path to login record:

    -
    use uucore::utmpx::Utmpx;
    -for ut in Utmpx::iter_all_records_from("/some/where/else") {
    -    if ut.is_user_process() {
    -        println!("{}: {}", ut.host(), ut.user())
    +
    use uucore::utmpx::Utmpx;
    +for ut in Utmpx::iter_all_records_from("/some/where/else") {
    +    if ut.is_user_process() {
    +        println!("{}: {}", ut.host(), ut.user())
         }
     }
    -

    Re-exports

    pub extern crate time;

    Structs

    Iterator of login records

    -

    Constants

    Statics

    Functions

    \ No newline at end of file +

    Re-exports

    pub extern crate time;

    Structs

    Iterator of login records

    Constants

    Statics

    Functions

    \ No newline at end of file diff --git a/dev/uucore/utmpx/static.DEFAULT_FILE.html b/dev/uucore/utmpx/static.DEFAULT_FILE.html index 04bb15879..5639a31ef 100644 --- a/dev/uucore/utmpx/static.DEFAULT_FILE.html +++ b/dev/uucore/utmpx/static.DEFAULT_FILE.html @@ -1 +1 @@ -DEFAULT_FILE in uucore::utmpx - Rust
    pub static DEFAULT_FILE: &'static str
    \ No newline at end of file +DEFAULT_FILE in uucore::utmpx - Rust
    pub static DEFAULT_FILE: &'static str
    \ No newline at end of file diff --git a/dev/uucore/utmpx/struct.Utmpx.html b/dev/uucore/utmpx/struct.Utmpx.html index 7eb7c5b18..a95b10a21 100644 --- a/dev/uucore/utmpx/struct.Utmpx.html +++ b/dev/uucore/utmpx/struct.Utmpx.html @@ -1,32 +1,25 @@ -Utmpx in uucore::utmpx - Rust
    pub struct Utmpx { /* private fields */ }

    Implementations

    A.K.A. ut.ut_type

    -

    A.K.A. ut.ut_pid

    -

    A.K.A. ut.ut_id

    -

    A.K.A. ut.ut_user

    -

    A.K.A. ut.ut_host

    -

    A.K.A. ut.ut_line

    -

    A.K.A. ut.ut_tv

    -

    A.K.A. ut.ut_exit

    +Utmpx in uucore::utmpx - Rust
    pub struct Utmpx { /* private fields */ }

    Implementations

    A.K.A. ut.ut_type

    +

    A.K.A. ut.ut_pid

    +

    A.K.A. ut.ut_id

    +

    A.K.A. ut.ut_user

    +

    A.K.A. ut.ut_host

    +

    A.K.A. ut.ut_line

    +

    A.K.A. ut.ut_tv

    +

    A.K.A. ut.ut_exit

    Return (e_termination, e_exit)

    -

    Consumes the Utmpx, returning the underlying C struct utmpx

    -

    Canonicalize host name using DNS

    -

    Iterate through all the utmp records.

    +

    Consumes the Utmpx, returning the underlying C struct utmpx

    +

    Canonicalize host name using DNS

    +

    Iterate through all the utmp records.

    This will use the default location, or the path Utmpx::iter_all_records_from was most recently called with.

    Only one instance of UtmpxIter may be active at a time. This function will block as long as one is still active. Beware!

    -

    Iterate through all the utmp records from a specific file.

    +

    Iterate through all the utmp records from a specific file.

    No failure is reported or detected.

    This function affects subsequent calls to Utmpx::iter_all_records.

    The same caveats as for Utmpx::iter_all_records apply.

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/utmpx/struct.UtmpxIter.html b/dev/uucore/utmpx/struct.UtmpxIter.html index 9145571a9..c9c0a5db0 100644 --- a/dev/uucore/utmpx/struct.UtmpxIter.html +++ b/dev/uucore/utmpx/struct.UtmpxIter.html @@ -1,341 +1,137 @@ -UtmpxIter in uucore::utmpx - Rust
    pub struct UtmpxIter { /* private fields */ }
    Expand description

    Iterator of login records

    -

    Trait Implementations

    Executes the destructor for this type. Read more

    -

    The type of the elements being iterated over.

    -

    Advances the iterator and returns the next value. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_next_chunk)

    Advances the iterator and returns an array containing the next N values. Read more

    -

    Returns the bounds on the remaining length of the iterator. Read more

    -

    Consumes the iterator, counting the number of iterations and returning it. Read more

    -

    Consumes the iterator, returning the last element. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_advance_by)

    Advances the iterator by n elements. Read more

    -

    Returns the nth element of the iterator. Read more

    -

    Creates an iterator starting at the same point, but stepping by -the given amount at each iteration. Read more

    -

    Takes two iterators and creates a new iterator over both in sequence. Read more

    -

    ‘Zips up’ two iterators into a single iterator of pairs. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places a copy of separator between adjacent -items of the original iterator. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_intersperse)

    Creates a new iterator which places an item generated by separator -between adjacent items of the original iterator. Read more

    -

    Takes a closure and creates an iterator which calls that closure on each -element. Read more

    -

    Calls a closure on each element of an iterator. Read more

    -

    Creates an iterator which uses a closure to determine if an element -should be yielded. Read more

    -

    Creates an iterator that both filters and maps. Read more

    -

    Creates an iterator which gives the current iteration count as well as -the next value. Read more

    -

    Creates an iterator which can use the peek and peek_mut methods +UtmpxIter in uucore::utmpx - Rust

    pub struct UtmpxIter { /* private fields */ }
    Expand description

    Iterator of login records

    +

    Trait Implementations

    Executes the destructor for this type. Read more
    The type of the elements being iterated over.
    Advances the iterator and returns the next value. Read more
    🔬This is a nightly-only experimental API. (iter_next_chunk)
    Advances the iterator and returns an array containing the next N values. Read more
    Returns the bounds on the remaining length of the iterator. Read more
    Consumes the iterator, counting the number of iterations and returning it. Read more
    Consumes the iterator, returning the last element. Read more
    🔬This is a nightly-only experimental API. (iter_advance_by)
    Advances the iterator by n elements. Read more
    Returns the nth element of the iterator. Read more
    Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
    Takes two iterators and creates a new iterator over both in sequence. Read more
    ‘Zips up’ two iterators into a single iterator of pairs. Read more
    🔬This is a nightly-only experimental API. (iter_intersperse)
    Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
    Takes a closure and creates an iterator which calls that closure on each +element. Read more
    Calls a closure on each element of an iterator. Read more
    Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
    Creates an iterator that both filters and maps. Read more
    Creates an iterator which gives the current iteration count as well as +the next value. Read more
    Creates an iterator which can use the peek and peek_mut methods to look at the next element of the iterator without consuming it. See -their documentation for more information. Read more

    -

    Creates an iterator that skips elements based on a predicate. Read more

    -

    Creates an iterator that yields elements based on a predicate. Read more

    -

    Creates an iterator that both yields elements based on a predicate and maps. Read more

    -

    Creates an iterator that skips the first n elements. Read more

    -

    Creates an iterator that yields the first n elements, or fewer -if the underlying iterator ends sooner. Read more

    -

    An iterator adapter similar to fold that holds internal state and -produces a new iterator. Read more

    -

    Creates an iterator that works like map, but flattens nested structure. Read more

    -

    Creates an iterator that flattens nested structure. Read more

    -

    Creates an iterator which ends after the first None. Read more

    -

    Does something with each element of an iterator, passing the value on. Read more

    -

    Borrows an iterator, rather than consuming it. Read more

    -

    Transforms an iterator into a collection. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_collect)

    Fallibly transforms an iterator into a collection, short circuiting if -a failure is encountered. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_collect_into)

    Collects all the items from an iterator into a collection. Read more

    -

    Consumes an iterator, creating two collections from it. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_partition_in_place)

    Reorders the elements of this iterator in-place according to the given predicate, -such that all those that return true precede all those that return false. -Returns the number of true elements found. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_is_partitioned)

    Checks if the elements of this iterator are partitioned according to the given predicate, -such that all those that return true precede all those that return false. Read more

    -

    An iterator method that applies a function as long as it returns -successfully, producing a single, final value. Read more

    -

    An iterator method that applies a fallible function to each item in the -iterator, stopping at the first error and returning that error. Read more

    -

    Folds every element into an accumulator by applying an operation, -returning the final result. Read more

    -

    Reduces the elements to a single one, by repeatedly applying a reducing -operation. Read more

    -
    🔬 This is a nightly-only experimental API. (iterator_try_reduce)

    Reduces the elements to a single one by repeatedly applying a reducing operation. If the -closure returns a failure, the failure is propagated back to the caller immediately. Read more

    -

    Tests if every element of the iterator matches a predicate. Read more

    -

    Tests if any element of the iterator matches a predicate. Read more

    -

    Searches for an element of an iterator that satisfies a predicate. Read more

    -

    Applies function to the elements of iterator and returns -the first non-none result. Read more

    -
    🔬 This is a nightly-only experimental API. (try_find)

    Applies function to the elements of iterator and returns -the first true result or the first error. Read more

    -

    Searches for an element in an iterator, returning its index. Read more

    -

    Searches for an element in an iterator from the right, returning its -index. Read more

    -

    Returns the maximum element of an iterator. Read more

    -

    Returns the minimum element of an iterator. Read more

    -

    Returns the element that gives the maximum value from the -specified function. Read more

    -

    Returns the element that gives the maximum value with respect to the -specified comparison function. Read more

    -

    Returns the element that gives the minimum value from the -specified function. Read more

    -

    Returns the element that gives the minimum value with respect to the -specified comparison function. Read more

    -

    Reverses an iterator’s direction. Read more

    -

    Converts an iterator of pairs into a pair of containers. Read more

    -

    Creates an iterator which copies all of its elements. Read more

    -

    Creates an iterator which clones all of its elements. Read more

    -

    Repeats an iterator endlessly. Read more

    -

    Sums the elements of an iterator. Read more

    -

    Iterates over the entire iterator, multiplying all the elements Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Lexicographically compares the elements of this Iterator with those -of another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Lexicographically compares the elements of this Iterator with those -of another with respect to the specified comparison function. Read more

    -

    Determines if the elements of this Iterator are equal to those of -another. Read more

    -
    🔬 This is a nightly-only experimental API. (iter_order_by)

    Determines if the elements of this Iterator are equal to those of -another with respect to the specified equality function. Read more

    -

    Determines if the elements of this Iterator are unequal to those of -another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -less or equal to those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than those of another. Read more

    -

    Determines if the elements of this Iterator are lexicographically -greater than or equal to those of another. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given comparator function. Read more

    -
    🔬 This is a nightly-only experimental API. (is_sorted)

    Checks if the elements of this iterator are sorted using the given key extraction -function. Read more

    -

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    +their documentation for more information. Read more
    Creates an iterator that skips elements based on a predicate. Read more
    Creates an iterator that yields elements based on a predicate. Read more
    Creates an iterator that both yields elements based on a predicate and maps. Read more
    Creates an iterator that skips the first n elements. Read more
    Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
    An iterator adapter similar to fold that holds internal state and +produces a new iterator. Read more
    Creates an iterator that works like map, but flattens nested structure. Read more
    Creates an iterator which ends after the first None. Read more
    Does something with each element of an iterator, passing the value on. Read more
    Borrows an iterator, rather than consuming it. Read more
    Transforms an iterator into a collection. Read more
    🔬This is a nightly-only experimental API. (iter_collect_into)
    Collects all the items from an iterator into a collection. Read more
    Consumes an iterator, creating two collections from it. Read more
    🔬This is a nightly-only experimental API. (iter_is_partitioned)
    Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
    An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
    An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
    Folds every element into an accumulator by applying an operation, +returning the final result. Read more
    Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
    🔬This is a nightly-only experimental API. (iterator_try_reduce)
    Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
    Tests if every element of the iterator matches a predicate. Read more
    Tests if any element of the iterator matches a predicate. Read more
    Searches for an element of an iterator that satisfies a predicate. Read more
    Applies function to the elements of iterator and returns +the first non-none result. Read more
    🔬This is a nightly-only experimental API. (try_find)
    Applies function to the elements of iterator and returns +the first true result or the first error. Read more
    Searches for an element in an iterator, returning its index. Read more
    Returns the element that gives the maximum value from the +specified function. Read more
    Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
    Returns the element that gives the minimum value from the +specified function. Read more
    Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
    Converts an iterator of pairs into a pair of containers. Read more
    Creates an iterator which copies all of its elements. Read more
    Creates an iterator which clones all of its elements. Read more
    🔬This is a nightly-only experimental API. (iter_array_chunks)
    Returns an iterator over N elements of the iterator at a time. Read more
    Sums the elements of an iterator. Read more
    Iterates over the entire iterator, multiplying all the elements Read more
    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    Lexicographically compares the elements of this Iterator with those +of another. Read more
    🔬This is a nightly-only experimental API. (iter_order_by)
    Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
    Determines if the elements of this Iterator are equal to those of +another. Read more
    🔬This is a nightly-only experimental API. (iter_order_by)
    Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
    Determines if the elements of this Iterator are unequal to those of +another. Read more
    Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
    Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
    Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
    Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given comparator function. Read more
    🔬This is a nightly-only experimental API. (is_sorted)
    Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The type of the elements being iterated over.

    -

    Which kind of iterator are we turning this into?

    -

    Creates an iterator from a value. Read more

    -

    Alternate elements from two iterators until both have run out. Read more

    -

    Alternate elements from two iterators until at least one of them has run -out. Read more

    -

    An iterator adaptor to insert a particular value -between each element of the adapted iterator. Read more

    -

    An iterator adaptor to insert a particular value created by a function -between each element of the adapted iterator. Read more

    -

    Create an iterator which iterates over both this and the specified -iterator simultaneously, yielding pairs of two optional elements. Read more

    -

    Create an iterator which iterates over both this and the specified -iterator simultaneously, yielding pairs of elements. Read more

    -

    A “meta iterator adaptor”. Its closure receives a reference to the +From<T> for U chooses to do.

    +
    The type of the elements being iterated over.
    Which kind of iterator are we turning this into?
    Creates an iterator from a value. Read more
    Alternate elements from two iterators until both have run out. Read more
    Alternate elements from two iterators until at least one of them has run +out. Read more
    An iterator adaptor to insert a particular value +between each element of the adapted iterator. Read more
    An iterator adaptor to insert a particular value created by a function +between each element of the adapted iterator. Read more
    Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of two optional elements. Read more
    Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of elements. Read more
    A “meta iterator adaptor”. Its closure receives a reference to the iterator and may pick off as many elements as it likes, to produce the -next iterator element. Read more

    -

    Return an iterable that can group iterator elements. +next iterator element. Read more

    Return an iterable that can group iterator elements. Consecutive elements that map to the same key (“runs”), are assigned -to the same group. Read more

    -

    Return an iterable that can chunk the iterator. Read more

    -

    Return an iterator over all contiguous windows producing tuples of -a specific size (up to 12). Read more

    -

    Return an iterator over all windows, wrapping back to the first +to the same group. Read more

    Return an iterable that can chunk the iterator. Read more
    Return an iterator over all contiguous windows producing tuples of +a specific size (up to 12). Read more
    Return an iterator over all windows, wrapping back to the first elements when the window would otherwise exceed the length of the -iterator, producing tuples of a specific size (up to 12). Read more

    -

    Return an iterator that groups the items in tuples of a specific size -(up to 12). Read more

    -

    Split into an iterator pair that both yield all elements from -the original iterator. Read more

    -
    👎 Deprecated since 0.8.0:

    Use std .step_by() instead

    -

    Return an iterator adaptor that steps n elements in the base iterator -for each iteration. Read more

    -

    Convert each item of the iterator using the Into trait. Read more

    -
    👎 Deprecated since 0.10.0:

    Use .map_ok() instead

    -

    See .map_ok().

    -

    Return an iterator adaptor that applies the provided closure +iterator, producing tuples of a specific size (up to 12). Read more

    Return an iterator that groups the items in tuples of a specific size +(up to 12). Read more
    Split into an iterator pair that both yield all elements from +the original iterator. Read more
    👎Deprecated since 0.8.0:

    Use std .step_by() instead

    +
    Return an iterator adaptor that steps n elements in the base iterator +for each iteration. Read more
    Convert each item of the iterator using the Into trait. Read more
    👎Deprecated since 0.10.0:

    Use .map_ok() instead

    +
    Return an iterator adaptor that applies the provided closure to every Result::Ok value. Result::Err values are -unchanged. Read more

    -

    Return an iterator adaptor that filters every Result::Ok +unchanged. Read more

    Return an iterator adaptor that filters every Result::Ok value with the provided closure. Result::Err values are -unchanged. Read more

    -

    Return an iterator adaptor that filters and transforms every +unchanged. Read more

    Return an iterator adaptor that filters and transforms every Result::Ok value with the provided closure. Result::Err -values are unchanged. Read more

    -

    Return an iterator adaptor that flattens every Result::Ok value into -a series of Result::Ok values. Result::Err values are unchanged. Read more

    -

    Return an iterator adaptor that merges the two base iterators in +values are unchanged. Read more

    Return an iterator adaptor that flattens every Result::Ok value into +a series of Result::Ok values. Result::Err values are unchanged. Read more
    Return an iterator adaptor that merges the two base iterators in ascending order. If both base iterators are sorted (ascending), the -result is sorted. Read more

    -

    Return an iterator adaptor that merges the two base iterators in order. -This is much like .merge() but allows for a custom ordering. Read more

    -

    Create an iterator that merges items from both this and the specified -iterator in ascending order. Read more

    -

    Return an iterator adaptor that flattens an iterator of iterators by -merging them in ascending order. Read more

    -

    Return an iterator adaptor that flattens an iterator of iterators by -merging them according to the given closure. Read more

    -

    Return an iterator adaptor that iterates over the cartesian product of -the element sets of two iterators self and J. Read more

    -

    Return an iterator adaptor that iterates over the cartesian product of -all subiterators returned by meta-iterator self. Read more

    -

    Return an iterator adaptor that uses the passed-in closure to -optionally merge together consecutive elements. Read more

    -

    Remove duplicates from sections of consecutive identical elements. -If the iterator is sorted, all elements will be unique. Read more

    -

    Remove duplicates from sections of consecutive identical elements, +result is sorted. Read more

    Return an iterator adaptor that merges the two base iterators in order. +This is much like .merge() but allows for a custom ordering. Read more
    Create an iterator that merges items from both this and the specified +iterator in ascending order. Read more
    Return an iterator adaptor that flattens an iterator of iterators by +merging them in ascending order. Read more
    Return an iterator adaptor that flattens an iterator of iterators by +merging them according to the given closure. Read more
    Return an iterator adaptor that iterates over the cartesian product of +the element sets of two iterators self and J. Read more
    Return an iterator adaptor that iterates over the cartesian product of +all subiterators returned by meta-iterator self. Read more
    Return an iterator adaptor that uses the passed-in closure to +optionally merge together consecutive elements. Read more
    Remove duplicates from sections of consecutive identical elements. +If the iterator is sorted, all elements will be unique. Read more
    Remove duplicates from sections of consecutive identical elements, determining equality using a comparison function. -If the iterator is sorted, all elements will be unique. Read more

    -

    Remove duplicates from sections of consecutive identical elements, while keeping a count of +If the iterator is sorted, all elements will be unique. Read more

    Remove duplicates from sections of consecutive identical elements, while keeping a count of how many repeated elements were present. -If the iterator is sorted, all elements will be unique. Read more

    -

    Remove duplicates from sections of consecutive identical elements, while keeping a count of +If the iterator is sorted, all elements will be unique. Read more

    Remove duplicates from sections of consecutive identical elements, while keeping a count of how many repeated elements were present. This will determine equality using a comparison function. -If the iterator is sorted, all elements will be unique. Read more

    -

    Return an iterator adaptor that produces elements that appear more than once during the -iteration. Duplicates are detected using hash and equality. Read more

    -

    Return an iterator adaptor that produces elements that appear more than once during the -iteration. Duplicates are detected using hash and equality. Read more

    -

    Return an iterator adaptor that filters out elements that have +If the iterator is sorted, all elements will be unique. Read more

    Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
    Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
    Return an iterator adaptor that filters out elements that have already been produced once during the iteration. Duplicates -are detected using hash and equality. Read more

    -

    Return an iterator adaptor that filters out elements that have -already been produced once during the iteration. Read more

    -

    Return an iterator adaptor that borrows from this iterator and -takes items while the closure accept returns true. Read more

    -

    Return an iterator adaptor that borrows from a Clone-able iterator -to only pick off elements while the predicate accept returns true. Read more

    -

    Return an iterator adaptor that filters Option<A> iterator elements -and produces A. Stops on the first None encountered. Read more

    -

    Return an iterator adaptor that iterates over the combinations of the -elements from an iterator. Read more

    -

    Return an iterator adaptor that iterates over the k-length combinations of -the elements from an iterator. Read more

    -

    Return an iterator that iterates over the k-length combinations of -the elements from an iterator, with replacement. Read more

    -

    Return an iterator adaptor that iterates over all k-permutations of the -elements from an iterator. Read more

    -

    Return an iterator that iterates through the powerset of the elements from an -iterator. Read more

    -

    Return an iterator adaptor that pads the sequence to a minimum length of -min by filling missing elements using a closure f. Read more

    -

    Return an iterator adaptor that wraps each element in a Position to -ease special-case handling of the first or last elements. Read more

    -

    Return an iterator adaptor that yields the indices of all elements -satisfying a predicate, counted from the start of the iterator. Read more

    -

    Return an iterator adaptor that applies a mutating function -to each element before yielding it. Read more

    -

    Advances the iterator and returns the next items grouped in a tuple of -a specific size (up to 12). Read more

    -

    Collects all items from the iterator into a tuple of a specific size -(up to 12). Read more

    -

    Find the position and value of the first element satisfying a predicate. Read more

    -

    Find the value of the first element satisfying a predicate or return the last element, if any. Read more

    -

    Find the value of the first element satisfying a predicate or return the first element, if any. Read more

    -

    Returns true if the given item is present in this iterator. Read more

    -

    Check whether all elements compare equal. Read more

    -

    Check whether all elements are unique (non equal). Read more

    -

    Consume the first n elements from the iterator eagerly, -and return the same iterator again. Read more

    -

    Consume the last n elements from the iterator eagerly, -and return the same iterator again. Read more

    -
    👎 Deprecated since 0.8.0:

    Use .for_each() instead

    -

    Run the closure f eagerly on each element of the iterator. Read more

    -

    Combine all an iterator’s elements into one element by using Extend. Read more

    -

    .collect_vec() is simply a type specialization of Iterator::collect, -for convenience. Read more

    -

    .try_collect() is more convenient way of writing -.collect::<Result<_, _>>() Read more

    -

    Assign to each reference in self from the from iterator, -stopping at the shortest of the two iterators. Read more

    -

    Combine all iterator elements into one String, separated by sep. Read more

    -

    Format all iterator elements, separated by sep. Read more

    -

    Format all iterator elements, separated by sep. Read more

    -
    👎 Deprecated since 0.10.0:

    Use .fold_ok() instead

    -

    See .fold_ok().

    -

    Fold Result values from an iterator. Read more

    -

    Fold Option values from an iterator. Read more

    -
    👎 Deprecated since 0.10.2:

    Use Iterator::reduce instead

    -

    Accumulator of the elements in the iterator. Read more

    -

    Accumulate the elements in the iterator in a tree-like manner. Read more

    -

    An iterator method that applies a function, producing a single, final value. Read more

    -

    Iterate over the entire iterator and add all the elements. Read more

    -

    Iterate over the entire iterator and multiply all the elements. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. Read more

    -

    Sort all iterator elements into a new iterator in ascending order. The key function is -called exactly once per key. Read more

    -

    Sort the k smallest elements into a new iterator, in ascending order. Read more

    -

    Collect all iterator elements into one of two -partitions. Unlike Iterator::partition, each partition may -have a distinct type. Read more

    -

    Partition a sequence of Results into one list of all the Ok elements -and another list of all the Err elements. Read more

    -

    Return a HashMap of keys mapped to Vecs of values. Keys and values -are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more

    -

    Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified -in the closure. Read more

    -

    Constructs a GroupingMap to be used later with one of the efficient -group-and-fold operations it allows to perform. Read more

    -

    Constructs a GroupingMap to be used later with one of the efficient -group-and-fold operations it allows to perform. Read more

    -

    Return all minimum elements of an iterator. Read more

    -

    Return all minimum elements of an iterator, as determined by -the specified function. Read more

    -

    Return all minimum elements of an iterator, as determined by -the specified function. Read more

    -

    Return all maximum elements of an iterator. Read more

    -

    Return all maximum elements of an iterator, as determined by -the specified function. Read more

    -

    Return all minimum elements of an iterator, as determined by -the specified function. Read more

    -

    Return the minimum and maximum elements in the iterator. Read more

    -

    Return the minimum and maximum element of an iterator, as determined by -the specified function. Read more

    -

    Return the minimum and maximum element of an iterator, as determined by -the specified comparison function. Read more

    -

    Return the position of the maximum element in the iterator. Read more

    -

    Return the position of the maximum element in the iterator, as -determined by the specified function. Read more

    -

    Return the position of the maximum element in the iterator, as -determined by the specified comparison function. Read more

    -

    Return the position of the minimum element in the iterator. Read more

    -

    Return the position of the minimum element in the iterator, as -determined by the specified function. Read more

    -

    Return the position of the minimum element in the iterator, as -determined by the specified comparison function. Read more

    -

    Return the positions of the minimum and maximum elements in -the iterator. Read more

    -

    Return the postions of the minimum and maximum elements of an -iterator, as determined by the specified function. Read more

    -

    Return the postions of the minimum and maximum elements of an -iterator, as determined by the specified comparison function. Read more

    -

    If the iterator yields exactly one element, that element will be returned, otherwise +are detected using hash and equality. Read more

    Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Read more
    Return an iterator adaptor that borrows from this iterator and +takes items while the closure accept returns true. Read more
    Return an iterator adaptor that borrows from a Clone-able iterator +to only pick off elements while the predicate accept returns true. Read more
    Return an iterator adaptor that filters Option<A> iterator elements +and produces A. Stops on the first None encountered. Read more
    Return an iterator adaptor that iterates over the combinations of the +elements from an iterator. Read more
    Return an iterator adaptor that iterates over the k-length combinations of +the elements from an iterator. Read more
    Return an iterator that iterates over the k-length combinations of +the elements from an iterator, with replacement. Read more
    Return an iterator adaptor that iterates over all k-permutations of the +elements from an iterator. Read more
    Return an iterator that iterates through the powerset of the elements from an +iterator. Read more
    Return an iterator adaptor that pads the sequence to a minimum length of +min by filling missing elements using a closure f. Read more
    Return an iterator adaptor that wraps each element in a Position to +ease special-case handling of the first or last elements. Read more
    Return an iterator adaptor that yields the indices of all elements +satisfying a predicate, counted from the start of the iterator. Read more
    Return an iterator adaptor that applies a mutating function +to each element before yielding it. Read more
    Advances the iterator and returns the next items grouped in a tuple of +a specific size (up to 12). Read more
    Collects all items from the iterator into a tuple of a specific size +(up to 12). Read more
    Find the position and value of the first element satisfying a predicate. Read more
    Find the value of the first element satisfying a predicate or return the last element, if any. Read more
    Find the value of the first element satisfying a predicate or return the first element, if any. Read more
    Returns true if the given item is present in this iterator. Read more
    Check whether all elements compare equal. Read more
    Check whether all elements are unique (non equal). Read more
    Consume the first n elements from the iterator eagerly, +and return the same iterator again. Read more
    Consume the last n elements from the iterator eagerly, +and return the same iterator again. Read more
    👎Deprecated since 0.8.0:

    Use .for_each() instead

    +
    Run the closure f eagerly on each element of the iterator. Read more
    Combine all an iterator’s elements into one element by using Extend. Read more
    .collect_vec() is simply a type specialization of Iterator::collect, +for convenience. Read more
    .try_collect() is more convenient way of writing +.collect::<Result<_, _>>() Read more
    Assign to each reference in self from the from iterator, +stopping at the shortest of the two iterators. Read more
    Combine all iterator elements into one String, separated by sep. Read more
    Format all iterator elements, separated by sep. Read more
    Format all iterator elements, separated by sep. Read more
    👎Deprecated since 0.10.0:

    Use .fold_ok() instead

    +
    Fold Result values from an iterator. Read more
    Fold Option values from an iterator. Read more
    👎Deprecated since 0.10.2:

    Use Iterator::reduce instead

    +
    Accumulator of the elements in the iterator. Read more
    Accumulate the elements in the iterator in a tree-like manner. Read more
    An iterator method that applies a function, producing a single, final value. Read more
    Iterate over the entire iterator and add all the elements. Read more
    Iterate over the entire iterator and multiply all the elements. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. Read more
    Sort all iterator elements into a new iterator in ascending order. The key function is +called exactly once per key. Read more
    Sort the k smallest elements into a new iterator, in ascending order. Read more
    Collect all iterator elements into one of two +partitions. Unlike Iterator::partition, each partition may +have a distinct type. Read more
    Partition a sequence of Results into one list of all the Ok elements +and another list of all the Err elements. Read more
    Return a HashMap of keys mapped to Vecs of values. Keys and values +are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more
    Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified +in the closure. Read more
    Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
    Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
    Return all minimum elements of an iterator. Read more
    Return all minimum elements of an iterator, as determined by +the specified function. Read more
    Return all minimum elements of an iterator, as determined by +the specified function. Read more
    Return all maximum elements of an iterator. Read more
    Return all maximum elements of an iterator, as determined by +the specified function. Read more
    Return all minimum elements of an iterator, as determined by +the specified function. Read more
    Return the minimum and maximum elements in the iterator. Read more
    Return the minimum and maximum element of an iterator, as determined by +the specified function. Read more
    Return the minimum and maximum element of an iterator, as determined by +the specified comparison function. Read more
    Return the position of the maximum element in the iterator. Read more
    Return the position of the maximum element in the iterator, as +determined by the specified function. Read more
    Return the position of the maximum element in the iterator, as +determined by the specified comparison function. Read more
    Return the position of the minimum element in the iterator. Read more
    Return the position of the minimum element in the iterator, as +determined by the specified function. Read more
    Return the position of the minimum element in the iterator, as +determined by the specified comparison function. Read more
    Return the positions of the minimum and maximum elements in +the iterator. Read more
    Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified function. Read more
    Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified comparison function. Read more
    If the iterator yields exactly one element, that element will be returned, otherwise an error will be returned containing an iterator that has the same output as the input -iterator. Read more

    -

    If the iterator yields no elements, Ok(None) will be returned. If the iterator yields +iterator. Read more

    If the iterator yields no elements, Ok(None) will be returned. If the iterator yields exactly one element, that element will be returned, otherwise an error will be returned -containing an iterator that has the same output as the input iterator. Read more

    -

    An iterator adaptor that allows the user to peek at multiple .next() -values without advancing the base iterator. Read more

    -

    Collect the items in this iterator and return a HashMap which +containing an iterator that has the same output as the input iterator. Read more

    An iterator adaptor that allows the user to peek at multiple .next() +values without advancing the base iterator. Read more
    Collect the items in this iterator and return a HashMap which contains each item that appears in the iterator and the number -of times it appears. Read more

    -

    Collect the items in this iterator and return a HashMap which +of times it appears. Read more

    Collect the items in this iterator and return a HashMap which contains each item that appears in the iterator and the number of times it appears, -determining identity using a keying function. Read more

    -

    Converts an iterator of tuples into a tuple of containers. Read more

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +determining identity using a keying function. Read more
    Converts an iterator of tuples into a tuple of containers. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uucore/version_cmp/fn.version_cmp.html b/dev/uucore/version_cmp/fn.version_cmp.html index 9be5962f4..5bd554936 100644 --- a/dev/uucore/version_cmp/fn.version_cmp.html +++ b/dev/uucore/version_cmp/fn.version_cmp.html @@ -1 +1 @@ -version_cmp in uucore::version_cmp - Rust
    pub fn version_cmp(a: &str, b: &str) -> Ordering
    \ No newline at end of file +version_cmp in uucore::version_cmp - Rust
    pub fn version_cmp(a: &str, b: &str) -> Ordering
    \ No newline at end of file diff --git a/dev/uucore/version_cmp/index.html b/dev/uucore/version_cmp/index.html index f4cdd7931..239a22866 100644 --- a/dev/uucore/version_cmp/index.html +++ b/dev/uucore/version_cmp/index.html @@ -1 +1 @@ -uucore::version_cmp - Rust
    \ No newline at end of file +uucore::version_cmp - Rust
    \ No newline at end of file diff --git a/dev/uucore_procs/all.html b/dev/uucore_procs/all.html index 9edf569cb..1fe641ca5 100644 --- a/dev/uucore_procs/all.html +++ b/dev/uucore_procs/all.html @@ -1 +1 @@ -List of all items in this crate

    List of all items

    Macros

    Attribute Macros

    \ No newline at end of file +List of all items in this crate

    List of all items

    Macros

    Attribute Macros

    \ No newline at end of file diff --git a/dev/uucore_procs/attr.main.html b/dev/uucore_procs/attr.main.html index fef0b5a1e..0ae85893b 100644 --- a/dev/uucore_procs/attr.main.html +++ b/dev/uucore_procs/attr.main.html @@ -1 +1 @@ -main in uucore_procs - Rust

    Attribute Macro uucore_procs::main

    source · []
    #[main]
    \ No newline at end of file +main in uucore_procs - Rust

    Attribute Macro uucore_procs::main

    source · []
    #[main]
    \ No newline at end of file diff --git a/dev/uucore_procs/index.html b/dev/uucore_procs/index.html index 4a0154501..c4a2d6b0c 100644 --- a/dev/uucore_procs/index.html +++ b/dev/uucore_procs/index.html @@ -1,3 +1 @@ -uucore_procs - Rust

    Macros

    Reads a section from a file of the util as a str literal.

    -

    Get the usage from the “Usage” section in the help file.

    -

    Attribute Macros

    \ No newline at end of file +uucore_procs - Rust

    Macros

    Reads a section from a file of the util as a str literal.
    Get the usage from the “Usage” section in the help file.

    Attribute Macros

    \ No newline at end of file diff --git a/dev/uucore_procs/macro.help_section.html b/dev/uucore_procs/macro.help_section.html index 9008e74f2..a71999a0e 100644 --- a/dev/uucore_procs/macro.help_section.html +++ b/dev/uucore_procs/macro.help_section.html @@ -1,4 +1,4 @@ -help_section in uucore_procs - Rust
    help_section!() { /* proc-macro */ }
    Expand description

    Reads a section from a file of the util as a str literal.

    +help_section in uucore_procs - Rust
    help_section!() { /* proc-macro */ }
    Expand description

    Reads a section from a file of the util as a str literal.

    It reads from the file specified as the second argument, relative to the crate root. The contents of this file are read verbatim, without parsing or escaping. The name of the help file should match the name of the util. @@ -13,5 +13,5 @@ Convert numbers from/to human-readable strings # Long help This text will be the long help

    -
    help_section!("about", "numfmt.md");
    -
    \ No newline at end of file +
    help_section!("about", "numfmt.md");
    +
    \ No newline at end of file diff --git a/dev/uucore_procs/macro.help_usage.html b/dev/uucore_procs/macro.help_usage.html index 0e04a5f64..1a3b2e346 100644 --- a/dev/uucore_procs/macro.help_usage.html +++ b/dev/uucore_procs/macro.help_usage.html @@ -1,6 +1,6 @@ -help_usage in uucore_procs - Rust
    help_usage!() { /* proc-macro */ }
    Expand description

    Get the usage from the “Usage” section in the help file.

    +help_usage in uucore_procs - Rust
    help_usage!() { /* proc-macro */ }
    Expand description

    Get the usage from the “Usage” section in the help file.

    The usage is assumed to be surrounded by markdown code fences. It may span multiple lines. The first word of each line is assumed to be the name of the util and is replaced by “{}” so that the output of this function can be used with uucore::format_usage.

    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/dev/uudoc/all.html b/dev/uudoc/all.html index f20e93251..d2d9df94c 100644 --- a/dev/uudoc/all.html +++ b/dev/uudoc/all.html @@ -1 +1 @@ -List of all items in this crate

    List of all items

    Structs

    Functions

    Typedefs

    \ No newline at end of file +List of all items in this crate

    List of all items

    Structs

    Functions

    Typedefs

    \ No newline at end of file diff --git a/dev/uudoc/fn.get_zip_content.html b/dev/uudoc/fn.get_zip_content.html index 199ab6f92..a27dfeae3 100644 --- a/dev/uudoc/fn.get_zip_content.html +++ b/dev/uudoc/fn.get_zip_content.html @@ -1 +1 @@ -get_zip_content in uudoc - Rust
    pub(crate) fn get_zip_content(
        archive: &mut ZipArchive<impl Read + Seek>,
        name: &str
    ) -> Option<String>
    \ No newline at end of file +get_zip_content in uudoc - Rust
    pub(crate) fn get_zip_content(
        archive: &mut ZipArchive<impl Read + Seek>,
        name: &str
    ) -> Option<String>
    \ No newline at end of file diff --git a/dev/uudoc/fn.main.html b/dev/uudoc/fn.main.html index 19038d33e..6120ce37e 100644 --- a/dev/uudoc/fn.main.html +++ b/dev/uudoc/fn.main.html @@ -1 +1 @@ -main in uudoc - Rust

    Function uudoc::main

    source · []
    pub(crate) fn main() -> Result<()>
    \ No newline at end of file +main in uudoc - Rust

    Function uudoc::main

    source · []
    pub(crate) fn main() -> Result<()>
    \ No newline at end of file diff --git a/dev/uudoc/fn.util_map.html b/dev/uudoc/fn.util_map.html index 23a6e43b7..606fa109c 100644 --- a/dev/uudoc/fn.util_map.html +++ b/dev/uudoc/fn.util_map.html @@ -1 +1 @@ -util_map in uudoc - Rust
    pub(crate) fn util_map<T: Args>(
    ) -> Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>
    \ No newline at end of file +util_map in uudoc - Rust
    pub(crate) fn util_map<T: Args>(
    ) -> Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>
    \ No newline at end of file diff --git a/dev/uudoc/index.html b/dev/uudoc/index.html index a123326b6..e6c8bfab1 100644 --- a/dev/uudoc/index.html +++ b/dev/uudoc/index.html @@ -1 +1 @@ -uudoc - Rust
    \ No newline at end of file +uudoc - Rust
    \ No newline at end of file diff --git a/dev/uudoc/struct.MDWriter.html b/dev/uudoc/struct.MDWriter.html index 6bda25d2f..b96320712 100644 --- a/dev/uudoc/struct.MDWriter.html +++ b/dev/uudoc/struct.MDWriter.html @@ -1,25 +1,11 @@ -MDWriter in uudoc - Rust
    pub(crate) struct MDWriter<'a, 'b> {
    -    pub(crate) w: Box<dyn Write>,
    +MDWriter in uudoc - Rust
    pub(crate) struct MDWriter<'a, 'b> {
    +    pub(crate) w: Box<dyn Write>,
         pub(crate) command: Command,
    -    pub(crate) name: &'a str,
    -    pub(crate) tldr_zip: &'b mut Option<ZipArchive<File>>,
    -    pub(crate) utils_per_platform: &'b HashMap<&'b str, Vec<String>>,
    -}

    Fields

    w: Box<dyn Write>command: Commandname: &'a strtldr_zip: &'b mut Option<ZipArchive<File>>utils_per_platform: &'b HashMap<&'b str, Vec<String>>

    Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more

    -

    Immutably borrows from an owned value. Read more

    -

    Mutably borrows from an owned value. Read more

    -

    Returns the argument unchanged.

    -

    Calls U::from(self).

    + pub(crate) name: &'a str, + pub(crate) tldr_zip: &'b mut Option<ZipArchive<File>>, + pub(crate) utils_per_platform: &'b HashMap<&'b str, Vec<String>>, +}

    Fields

    w: Box<dyn Write>command: Commandname: &'a strtldr_zip: &'b mut Option<ZipArchive<File>>utils_per_platform: &'b HashMap<&'b str, Vec<String>>

    Implementations

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more

    Returns the argument unchanged.

    +

    Calls U::from(self).

    That is, this conversion is whatever the implementation of -From<T> for U chooses to do.

    -

    The alignment of pointer.

    -

    The type for initializers.

    -

    Initializes a with the given initializer. Read more

    -

    Dereferences the given pointer. Read more

    -

    Mutably dereferences the given pointer. Read more

    -

    Drops the object pointed to by the given pointer. Read more

    -

    Should always be Self

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -

    The type returned in the event of a conversion error.

    -

    Performs the conversion.

    -
    \ No newline at end of file +From<T> for U chooses to do.

    +
    The alignment of pointer.
    The type for initializers.
    Initializes a with the given initializer. Read more
    Dereferences the given pointer. Read more
    Mutably dereferences the given pointer. Read more
    Drops the object pointed to by the given pointer. Read more
    Should always be Self
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.
    \ No newline at end of file diff --git a/dev/uudoc/type.UtilityMap.html b/dev/uudoc/type.UtilityMap.html index ac795cc43..3daa4b657 100644 --- a/dev/uudoc/type.UtilityMap.html +++ b/dev/uudoc/type.UtilityMap.html @@ -1 +1 @@ -UtilityMap in uudoc - Rust

    Type Definition uudoc::UtilityMap

    source · []
    pub(crate) type UtilityMap<T> = Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>;
    \ No newline at end of file +UtilityMap in uudoc - Rust

    Type Definition uudoc::UtilityMap

    source · []
    pub(crate) type UtilityMap<T> = Map<&'static str, (fn(_: T) -> i32, fn() -> Command)>;
    \ No newline at end of file diff --git a/dev/vdir/all.html b/dev/vdir/all.html index 601b5db22..f879dc4f0 100644 --- a/dev/vdir/all.html +++ b/dev/vdir/all.html @@ -1 +1 @@ -List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file +List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file diff --git a/dev/vdir/fn.main.html b/dev/vdir/fn.main.html index 5a7b59925..4e2e09385 100644 --- a/dev/vdir/fn.main.html +++ b/dev/vdir/fn.main.html @@ -1 +1 @@ -main in vdir - Rust

    Function vdir::main

    source · []
    pub fn main()
    \ No newline at end of file +main in vdir - Rust

    Function vdir::main

    source · []
    pub fn main()
    \ No newline at end of file diff --git a/dev/vdir/index.html b/dev/vdir/index.html index d50c97fee..4db6edc92 100644 --- a/dev/vdir/index.html +++ b/dev/vdir/index.html @@ -1 +1 @@ -vdir - Rust
    \ No newline at end of file +vdir - Rust
    \ No newline at end of file diff --git a/dev/wc/all.html b/dev/wc/all.html index 13f54321b..71943097c 100644 --- a/dev/wc/all.html +++ b/dev/wc/all.html @@ -1 +1 @@ -List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file +List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file diff --git a/dev/wc/fn.main.html b/dev/wc/fn.main.html index a490ea6c3..e6069e0e1 100644 --- a/dev/wc/fn.main.html +++ b/dev/wc/fn.main.html @@ -1 +1 @@ -main in wc - Rust

    Function wc::main

    source · []
    pub fn main()
    \ No newline at end of file +main in wc - Rust

    Function wc::main

    source · []
    pub fn main()
    \ No newline at end of file diff --git a/dev/wc/index.html b/dev/wc/index.html index 85ca39c1b..b0545ecba 100644 --- a/dev/wc/index.html +++ b/dev/wc/index.html @@ -1 +1 @@ -wc - Rust
    \ No newline at end of file +wc - Rust
    \ No newline at end of file diff --git a/dev/who/all.html b/dev/who/all.html index 83f24ad10..52590de41 100644 --- a/dev/who/all.html +++ b/dev/who/all.html @@ -1 +1 @@ -List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file +List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file diff --git a/dev/who/fn.main.html b/dev/who/fn.main.html index 33476f912..c0914d83f 100644 --- a/dev/who/fn.main.html +++ b/dev/who/fn.main.html @@ -1 +1 @@ -main in who - Rust

    Function who::main

    source · []
    pub fn main()
    \ No newline at end of file +main in who - Rust

    Function who::main

    source · []
    pub fn main()
    \ No newline at end of file diff --git a/dev/who/index.html b/dev/who/index.html index ffbb2f08a..aeb04bdb7 100644 --- a/dev/who/index.html +++ b/dev/who/index.html @@ -1 +1 @@ -who - Rust
    \ No newline at end of file +who - Rust
    \ No newline at end of file diff --git a/dev/whoami/all.html b/dev/whoami/all.html index d42d31586..3400535cd 100644 --- a/dev/whoami/all.html +++ b/dev/whoami/all.html @@ -1 +1 @@ -List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file +List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file diff --git a/dev/whoami/fn.main.html b/dev/whoami/fn.main.html index 6f20a963e..2568a7971 100644 --- a/dev/whoami/fn.main.html +++ b/dev/whoami/fn.main.html @@ -1 +1 @@ -main in whoami - Rust

    Function whoami::main

    source · []
    pub fn main()
    \ No newline at end of file +main in whoami - Rust

    Function whoami::main

    source · []
    pub fn main()
    \ No newline at end of file diff --git a/dev/whoami/index.html b/dev/whoami/index.html index 303ebd45f..a7d5d149d 100644 --- a/dev/whoami/index.html +++ b/dev/whoami/index.html @@ -1 +1 @@ -whoami - Rust
    \ No newline at end of file +whoami - Rust
    \ No newline at end of file diff --git a/dev/yes/all.html b/dev/yes/all.html index 0701936e5..718df9249 100644 --- a/dev/yes/all.html +++ b/dev/yes/all.html @@ -1 +1 @@ -List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file +List of all items in this crate

    List of all items

    Functions

    \ No newline at end of file diff --git a/dev/yes/fn.main.html b/dev/yes/fn.main.html index 9eb7c29af..f84fe5082 100644 --- a/dev/yes/fn.main.html +++ b/dev/yes/fn.main.html @@ -1 +1 @@ -main in yes - Rust

    Function yes::main

    source · []
    pub fn main()
    \ No newline at end of file +main in yes - Rust

    Function yes::main

    source · []
    pub fn main()
    \ No newline at end of file diff --git a/dev/yes/index.html b/dev/yes/index.html index fca1fa98c..65866863b 100644 --- a/dev/yes/index.html +++ b/dev/yes/index.html @@ -1 +1 @@ -yes - Rust
    \ No newline at end of file +yes - Rust
    \ No newline at end of file