aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/program
diff options
context:
space:
mode:
Diffstat (limited to 'mingling_core/src/program')
-rw-r--r--mingling_core/src/program/collection.rs4
-rw-r--r--mingling_core/src/program/collection/mock.rs4
-rw-r--r--mingling_core/src/program/exec.rs20
-rw-r--r--mingling_core/src/program/hook.rs4
4 files changed, 10 insertions, 22 deletions
diff --git a/mingling_core/src/program/collection.rs b/mingling_core/src/program/collection.rs
index 044379c..d5aab4b 100644
--- a/mingling_core/src/program/collection.rs
+++ b/mingling_core/src/program/collection.rs
@@ -53,10 +53,10 @@ pub trait ProgramCollect {
fn build_empty_result() -> AnyOutput<Self::Enum>;
/// Render the input [`AnyOutput`](./struct.AnyOutput.html)
- fn render(any: AnyOutput<Self::Enum>, r: &mut RenderResult);
+ fn render(any: AnyOutput<Self::Enum>) -> RenderResult;
/// Render help for Entry
- fn render_help(any: AnyOutput<Self::Enum>, r: &mut RenderResult);
+ fn render_help(any: AnyOutput<Self::Enum>) -> RenderResult;
/// Find a matching chain to continue execution based on the input [AnyOutput](./struct.AnyOutput.html), returning a new [AnyOutput](./struct.AnyOutput.html)
#[cfg(feature = "async")]
diff --git a/mingling_core/src/program/collection/mock.rs b/mingling_core/src/program/collection/mock.rs
index 568000a..9b2e7af 100644
--- a/mingling_core/src/program/collection/mock.rs
+++ b/mingling_core/src/program/collection/mock.rs
@@ -59,11 +59,11 @@ impl ProgramCollect for MockProgramCollect {
unreachable!()
}
- fn render(_any: AnyOutput<Self::Enum>, _r: &mut RenderResult) {
+ fn render(_any: AnyOutput<Self::Enum>) -> RenderResult {
unreachable!()
}
- fn render_help(_any: AnyOutput<Self::Enum>, _r: &mut RenderResult) {
+ fn render_help(_any: AnyOutput<Self::Enum>) -> RenderResult {
unreachable!()
}
diff --git a/mingling_core/src/program/exec.rs b/mingling_core/src/program/exec.rs
index d1983ed..f5bdc2b 100644
--- a/mingling_core/src/program/exec.rs
+++ b/mingling_core/src/program/exec.rs
@@ -461,19 +461,13 @@ pub(crate) fn handle_program_control<C: ProgramCollect<Enum = C>>(
fn render<C: ProgramCollect<Enum = C>>(program: &Program<C>, any: AnyOutput<C>) -> RenderResult {
#[cfg(not(feature = "structural_renderer"))]
{
- let mut render_result = RenderResult::default();
- C::render(any, &mut render_result);
- render_result
+ C::render(any)
}
#[cfg(feature = "structural_renderer")]
{
#[allow(unreachable_patterns)]
match program.structural_renderer_name {
- super::StructuralRendererSetting::Disable => {
- let mut render_result = RenderResult::default();
- C::render(any, &mut render_result);
- render_result
- }
+ super::StructuralRendererSetting::Disable => C::render(any),
_ => C::structural_render(any, &program.structural_renderer_name).unwrap(),
}
}
@@ -487,19 +481,13 @@ fn render_help<C: ProgramCollect<Enum = C>>(
) -> RenderResult {
#[cfg(not(feature = "structural_renderer"))]
{
- let mut render_result = RenderResult::default();
- C::render_help(entry, &mut render_result);
- render_result
+ C::render_help(entry)
}
#[cfg(feature = "structural_renderer")]
{
#[allow(unreachable_patterns)]
match program.structural_renderer_name {
- super::StructuralRendererSetting::Disable => {
- let mut render_result = RenderResult::default();
- C::render_help(entry, &mut render_result);
- render_result
- }
+ super::StructuralRendererSetting::Disable => C::render_help(entry),
_ => RenderResult::default(),
}
}
diff --git a/mingling_core/src/program/hook.rs b/mingling_core/src/program/hook.rs
index 630baae..56d8e0e 100644
--- a/mingling_core/src/program/hook.rs
+++ b/mingling_core/src/program/hook.rs
@@ -718,11 +718,11 @@ mod tests {
unreachable!()
}
- fn render(_any: crate::AnyOutput<MockHookEnum>, _r: &mut crate::RenderResult) {
+ fn render(_any: crate::AnyOutput<MockHookEnum>) -> crate::RenderResult {
unreachable!()
}
- fn render_help(_any: crate::AnyOutput<MockHookEnum>, _r: &mut crate::RenderResult) {
+ fn render_help(_any: crate::AnyOutput<MockHookEnum>) -> crate::RenderResult {
unreachable!()
}