@@ -40,7 +40,7 @@ pub fn register_render_layer<S: BnStrCompatible, T: RenderLayer>(
4040pub trait RenderLayer : Sized {
4141 /// Apply this Render Layer to a Flow Graph.
4242 fn apply_to_flow_graph ( & self , graph : & mut FlowGraph ) {
43- for node in graph. nodes ( ) {
43+ for node in & graph. nodes ( ) {
4444 if let Some ( block) = node. basic_block ( NativeBlock :: new ( ) ) {
4545 let new_lines = self . apply_to_block ( & block, node. lines ( ) . to_vec ( ) ) ;
4646 node. set_lines ( new_lines) ;
@@ -113,19 +113,18 @@ pub trait RenderLayer: Sized {
113113 let probe_line = line_block. first ( ) ?;
114114 Some ( ( probe_line. ty , probe_line. basic_block . to_owned ( ) , line_block) )
115115 } )
116- . map ( |( line_ty, basic_block, lines) | {
116+ . flat_map ( |( line_ty, basic_block, lines) | {
117117 match line_ty {
118118 LinearDisassemblyLineType :: CodeDisassemblyLineType => {
119119 // Dealing with code lines.
120120 let block = basic_block. expect ( "Code line has no basic block" ) ;
121121 let function = block. function ( ) ;
122122 let text_lines = lines. into_iter ( ) . map ( |line| line. contents ) . collect ( ) ;
123123 let new_text_lines = self . apply_to_block ( & block, text_lines) ;
124- let new_lines = new_text_lines
124+ new_text_lines
125125 . into_iter ( )
126126 . map ( |line| text_to_lines ( & function, & block, line) )
127- . collect ( ) ;
128- new_lines
127+ . collect ( )
129128 }
130129 _ => {
131130 // Dealing with misc lines.
@@ -138,7 +137,6 @@ pub trait RenderLayer: Sized {
138137 }
139138 }
140139 } )
141- . flatten ( )
142140 . collect ( )
143141 }
144142
@@ -262,7 +260,7 @@ impl CoreRenderLayer {
262260 pub fn render_layer_by_name < S : BnStrCompatible > ( name : S ) -> Option < CoreRenderLayer > {
263261 let name_raw = name. into_bytes_with_nul ( ) ;
264262 let result = unsafe { BNGetRenderLayerByName ( name_raw. as_ref ( ) . as_ptr ( ) as * const c_char ) } ;
265- NonNull :: new ( result) . map ( |x| Self :: from_raw ( x ) )
263+ NonNull :: new ( result) . map ( Self :: from_raw)
266264 }
267265
268266 pub fn default_enable_state ( & self ) -> RenderLayerDefaultEnableState {
0 commit comments