diff options
Diffstat (limited to 'mingling_core/src/program')
| -rw-r--r-- | mingling_core/src/program/collection.rs | 6 | ||||
| -rw-r--r-- | mingling_core/src/program/collection/mock.rs | 6 | ||||
| -rw-r--r-- | mingling_core/src/program/exec.rs | 16 | ||||
| -rw-r--r-- | mingling_core/src/program/hook.rs | 4 |
4 files changed, 12 insertions, 20 deletions
diff --git a/mingling_core/src/program/collection.rs b/mingling_core/src/program/collection.rs index 044379c..cbb9363 100644 --- a/mingling_core/src/program/collection.rs +++ b/mingling_core/src/program/collection.rs @@ -7,7 +7,7 @@ use crate::Dispatcher; use crate::{AnyOutput, ChainProcess, Groupped, RenderResult}; #[cfg(feature = "structural_renderer")] -use crate::{StructuralRendererSetting, error::StructuralRendererSerializeError}; +use crate::{error::StructuralRendererSerializeError, StructuralRendererSetting}; #[cfg(feature = "comp")] use crate::{ShellContext, Suggest}; @@ -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..20e6658 100644 --- a/mingling_core/src/program/collection/mock.rs +++ b/mingling_core/src/program/collection/mock.rs @@ -7,7 +7,7 @@ use crate::Dispatcher; use crate::{AnyOutput, ChainProcess, Groupped, ProgramCollect, RenderResult}; #[cfg(feature = "structural_renderer")] -use crate::{StructuralRendererSetting, error::StructuralRendererSerializeError}; +use crate::{error::StructuralRendererSerializeError, StructuralRendererSetting}; #[cfg(feature = "comp")] use crate::{ShellContext, Suggest}; @@ -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..3224c82 100644 --- a/mingling_core/src/program/exec.rs +++ b/mingling_core/src/program/exec.rs @@ -461,18 +461,14 @@ 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 + C::render(any) } _ => C::structural_render(any, &program.structural_renderer_name).unwrap(), } @@ -487,18 +483,14 @@ 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 + 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!() } |
