Skip to content

Commit 5288561

Browse files
author
Marcin Radomski
committed
cargo clippy --fix
1 parent bde2b63 commit 5288561

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,13 @@ impl Log for AndroidLogger {
178178

179179
let tag: &CStr = if let Some(ref tag) = config.tag {
180180
tag
181+
} else if module_path.len() < tag_bytes.len() {
182+
fill_tag_bytes(&mut tag_bytes, module_path.as_bytes())
181183
} 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()
190188
};
191189

192190
// message must not exceed LOGGING_MSG_MAX_LEN

src/platform_log_writer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ pub mod tests {
191191

192192
#[test]
193193
fn platform_log_writer_init_values() {
194-
let tag = CStr::from_bytes_with_nul(b"tag\0").unwrap();
194+
let tag = c"tag";
195195

196196
let writer = PlatformLogWriter::new(None, Level::Warn, tag);
197197

@@ -301,7 +301,7 @@ pub mod tests {
301301
PlatformLogWriter::new(
302302
None,
303303
Level::Warn,
304-
CStr::from_bytes_with_nul(b"tag\0").unwrap(),
304+
c"tag",
305305
)
306306
}
307307
}

0 commit comments

Comments
 (0)