File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -178,15 +178,13 @@ impl Log for AndroidLogger {
178
178
179
179
let tag: & CStr = if let Some ( ref tag) = config. tag {
180
180
tag
181
+ } else if module_path. len ( ) < tag_bytes. len ( ) {
182
+ fill_tag_bytes ( & mut tag_bytes, module_path. as_bytes ( ) )
181
183
} else {
182
- if module_path. len ( ) < tag_bytes. len ( ) {
183
- fill_tag_bytes ( & mut tag_bytes, module_path. as_bytes ( ) )
184
- } else {
185
- // Tag longer than available stack buffer; allocate.
186
- _owned_tag = CString :: new ( module_path. as_bytes ( ) )
187
- . expect ( "record.module_path() shouldn't contain nullbytes" ) ;
188
- _owned_tag. as_ref ( )
189
- }
184
+ // Tag longer than available stack buffer; allocate.
185
+ _owned_tag = CString :: new ( module_path. as_bytes ( ) )
186
+ . expect ( "record.module_path() shouldn't contain nullbytes" ) ;
187
+ _owned_tag. as_ref ( )
190
188
} ;
191
189
192
190
// message must not exceed LOGGING_MSG_MAX_LEN
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ pub mod tests {
191
191
192
192
#[ test]
193
193
fn platform_log_writer_init_values ( ) {
194
- let tag = CStr :: from_bytes_with_nul ( b "tag\0 " ) . unwrap ( ) ;
194
+ let tag = c "tag" ;
195
195
196
196
let writer = PlatformLogWriter :: new ( None , Level :: Warn , tag) ;
197
197
@@ -301,7 +301,7 @@ pub mod tests {
301
301
PlatformLogWriter :: new (
302
302
None ,
303
303
Level :: Warn ,
304
- CStr :: from_bytes_with_nul ( b "tag\0 " ) . unwrap ( ) ,
304
+ c "tag" ,
305
305
)
306
306
}
307
307
}
You can’t perform that action at this time.
0 commit comments