~matthiasbeyer/imag

09446b2c7ceae96e8791a545b5ffe262cb58463c — Matthias Beyer a month ago 4fce6f3
Replace redundant closure with function pointer

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
M bin/core/imag-git/src/lib.rs => bin/core/imag-git/src/lib.rs +2 -2
@@ 100,7 100,7 @@ impl ImagApplication for ImagGit {
            .cli()
            .values_of("")
            .map(|vs| vs.map(String::from).collect())
            .unwrap_or_else(|| vec![]);
            .unwrap_or_else(Vec::new);

        debug!("Adding args = {:?}", args);
        command.args(&args);


@@ 110,7 110,7 @@ impl ImagApplication for ImagGit {
            let args = ext_m
                .values_of("")
                .map(|vs| vs.map(String::from).collect())
                .unwrap_or_else(|| vec![]);
                .unwrap_or_else(Vec::new);

            debug!("Adding subcommand '{}' and args = {:?}", external, args);
            command.args(&args);

M bin/domain/imag-todo/src/import.rs => bin/domain/imag-todo/src/import.rs +1 -1
@@ 128,7 128,7 @@ fn import_taskwarrior(rt: &Runtime) -> Result<()> {
                    todo.get_content_mut().push_str(&anno);
                }

                let dependends = task.depends().cloned().unwrap_or_else(|| vec![]);
                let dependends = task.depends().cloned().unwrap_or_else(Vec::new);
                Ok((*task.uuid(), dependends))
            })
            .collect::<Result<HashMap<Uuid, Vec<Uuid>>>>()?

M lib/core/libimagrt/src/runtime.rs => lib/core/libimagrt/src/runtime.rs +2 -2
@@ 530,7 530,7 @@ impl<'a> Runtime<'a> {

        let subcommand_args = args.values_of("")
            .map(|sx| sx.map(String::from).collect())
            .unwrap_or_else(|| vec![]);
            .unwrap_or_else(Vec::new);

        Command::new(&command)
            .stdin(::std::process::Stdio::inherit())


@@ 731,6 731,6 @@ fn get_override_specs(matches: &ArgMatches) -> Vec<String> {
             .map(String::from)
             .collect()
        })
        .unwrap_or_else(|| vec![])
        .unwrap_or_else(Vec::new)
}


M lib/entry/libimagentrylink/src/linkable.rs => lib/entry/libimagentrylink/src/linkable.rs +14 -14
@@ 101,10 101,10 @@ impl Linkable for Entry {

        partial
            .internal
            .unwrap_or_else(|| vec![])
            .unwrap_or_else(Vec::new)
            .into_iter()
            .chain(partial.from.unwrap_or_else(|| vec![]).into_iter())
            .chain(partial.to.unwrap_or_else(|| vec![]).into_iter())
            .chain(partial.from.unwrap_or_else(Vec::new).into_iter())
            .chain(partial.to.unwrap_or_else(Vec::new).into_iter())
            .map(PathBuf::from)
            .map(StoreId::new)
            .map(|r| r.map(Link::from))


@@ 121,7 121,7 @@ impl Linkable for Entry {
            .read_partial::<LinkPartial>()?
            .unwrap_or_else(Default::default)
            .internal
            .unwrap_or_else(|| vec![])
            .unwrap_or_else(Vec::new)
            .into_iter();

        link_string_iter_to_link_iter(iter)


@@ 136,7 136,7 @@ impl Linkable for Entry {
            .read_partial::<LinkPartial>()?
            .unwrap_or_else(Default::default)
            .to
            .unwrap_or_else(|| vec![])
            .unwrap_or_else(Vec::new)
            .into_iter();

        link_string_iter_to_link_iter(iter)


@@ 151,7 151,7 @@ impl Linkable for Entry {
            .read_partial::<LinkPartial>()?
            .unwrap_or_else(Default::default)
            .from
            .unwrap_or_else(|| vec![])
            .unwrap_or_else(Vec::new)
            .into_iter();

        link_string_iter_to_link_iter(iter)


@@ 163,7 163,7 @@ impl Linkable for Entry {
        let right_location = other.get_location().to_str()?;

        alter_linking(self, other, |mut left, mut right| {
            let mut left_internal = left.internal.unwrap_or_else(|| vec![]);
            let mut left_internal = left.internal.unwrap_or_else(Vec::new);
            trace!("left: {:?} <- {:?}", left_internal, right_location);
            left_internal.push(right_location);
            trace!("left: {:?}", left_internal);


@@ 171,7 171,7 @@ impl Linkable for Entry {
            left_internal.sort_unstable();
            left_internal.dedup();

            let mut right_internal = right.internal.unwrap_or_else(|| vec![]);
            let mut right_internal = right.internal.unwrap_or_else(Vec::new);
            trace!("right: {:?} <- {:?}", right_internal, left_location);
            right_internal.push(left_location);
            trace!("right: {:?}", right_internal);


@@ 193,7 193,7 @@ impl Linkable for Entry {
        let right_location = other.get_location().to_str()?;

        alter_linking(self, other, |mut left, mut right| {
            let mut left_internal = left.internal.unwrap_or_else(|| vec![]);
            let mut left_internal = left.internal.unwrap_or_else(Vec::new);
            trace!("left: {:?} retaining {:?}", left_internal, right_location);
            left_internal.retain(|l| *l != right_location);
            trace!("left: {:?}", left_internal);


@@ 201,7 201,7 @@ impl Linkable for Entry {
            left_internal.sort_unstable();
            left_internal.dedup();

            let mut right_internal = right.internal.unwrap_or_else(|| vec![]);
            let mut right_internal = right.internal.unwrap_or_else(Vec::new);
            trace!("right: {:?} retaining {:?}", right_internal, left_location);
            right_internal.retain(|l| *l != left_location);
            trace!("right: {:?}", right_internal);


@@ 234,12 234,12 @@ impl Linkable for Entry {
        let right_location = other.get_location().to_str()?;

        alter_linking(self, other, |mut left, mut right| {
            let mut left_to = left.to.unwrap_or_else(|| vec![]);
            let mut left_to = left.to.unwrap_or_else(Vec::new);
            trace!("left_to: {:?} <- {:?}", left_to, right_location);
            left_to.push(right_location);
            trace!("left_to: {:?}", left_to);

            let mut right_from = right.from.unwrap_or_else(|| vec![]);
            let mut right_from = right.from.unwrap_or_else(Vec::new);
            trace!("right_from: {:?} <- {:?}", right_from, left_location);
            right_from.push(left_location);
            trace!("right_from: {:?}", right_from);


@@ 258,12 258,12 @@ impl Linkable for Entry {
        let right_location = other.get_location().to_str()?;

        alter_linking(self, other, |mut left, mut right| {
            let mut left_to = left.to.unwrap_or_else(|| vec![]);
            let mut left_to = left.to.unwrap_or_else(Vec::new);
            trace!("left_to: {:?} retaining {:?}", left_to, right_location);
            left_to.retain(|l| *l != right_location);
            trace!("left_to: {:?}", left_to);

            let mut right_from = right.from.unwrap_or_else(|| vec![]);
            let mut right_from = right.from.unwrap_or_else(Vec::new);
            trace!("right_from: {:?} retaining {:?}", right_from, left_location);
            right_from.retain(|l| *l != left_location);
            trace!("right_from: {:?}", right_from);