-
Notifications
You must be signed in to change notification settings - Fork 0
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
Can we remove Box::leak
s?
#17
Comments
When I was following clap examples I could simply return dynamic |
oh, ok. Just checked. clap accepts I tested these, and they work: fn default_editor_command() -> OsStr {
for (command, _) in TO_BE_SEARCHED_EDITOR_LIST.iter() {
if pathsearch::find_executable_in_path(command).is_some() {
return command.into();
}
}
EDITOR_COMMAND_NOT_FOUND.into()
}
fn default_editor_argument_list() -> OsStr {
let default_editor_command = default_editor_command();
for (command_name, argument_list) in TO_BE_SEARCHED_EDITOR_LIST.iter() {
if *command_name == default_editor_command {
let ret = argument_list.join(" ");
return ret.into();
}
}
DEFAULT_EDITOR_ARGUMENTS.into()
} To do so, I needed to enable |
anyway, it's weird to return Or if you face issues, use |
Very good.
If we don't find any editor (list of editors) we show |
Yes, and I think it makes more sense. |
I don't know the use case of the
Box::leak
s we have in the source code.Maybe always convert to
String
.Maybe you can use Cow instead.
The text was updated successfully, but these errors were encountered: