Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mv: allow a single source with --target-directory #3529

Merged
merged 1 commit into from
May 21, 2022

Conversation

ilkecan
Copy link
Contributor

@ilkecan ilkecan commented May 14, 2022

It should be possible to move a single file if target-directory is given.

I couldn't find a way to set min_values conditionally so I set it to 1 and then manually check that it's not 1 unless target-directory is used.

backup_control::BACKUP_CONTROL_LONG_HELP
))
.get_matches_from(args);
let help = format!(
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like an unrelated change, no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That variable is created to avoid "temporary value dropped while borrowed" error:

  --> src/uu/mv/src/mv.rs:79:41
   |
79 |       let mut app = uu_app().after_help(&*format!(
   |  _________________________________________^
80 | |         "{}\n{}",
81 | |         LONG_HELP,
82 | |         backup_control::BACKUP_CONTROL_LONG_HELP
83 | |     ));
   | |     ^ - temporary value is freed at the end of this statement
   | |_____|
   |       creates a temporary which is freed while still in use
84 |       let matches = app
   |                     --- borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value
   = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0716`.
error: could not compile `uu_mv` due to previous error

Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, right, thanks

@sylvestre sylvestre merged commit bda9f9f into uutils:main May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants