Skip to content

Commit c07c8b3

Browse files
committed
split imports to separate lines
Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
1 parent 1a57f04 commit c07c8b3

6 files changed

Lines changed: 29 additions & 22 deletions

File tree

elfcore-sample/src/main.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
//!
1313
1414
#[cfg(target_os = "linux")]
15-
use {
16-
anyhow::Context,
17-
elfcore::{CoreDumpBuilder, LinuxProcessMemoryReader, ProcessView},
18-
std::path::PathBuf,
19-
tracing::Level,
20-
};
15+
use anyhow::Context;
16+
#[cfg(target_os = "linux")]
17+
use elfcore::{CoreDumpBuilder, LinuxProcessMemoryReader, ProcessView};
18+
#[cfg(target_os = "linux")]
19+
use std::path::PathBuf;
20+
#[cfg(target_os = "linux")]
21+
use tracing::Level;
2122

2223
#[cfg(target_os = "linux")]
2324
pub fn main() -> anyhow::Result<()> {

elfcore/src/arch/aarch64.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use crate::CoreError;
1010
use zerocopy::AsBytes;
1111

1212
#[cfg(target_os = "linux")]
13-
use {crate::ptrace::ptrace_get_reg_set, nix::unistd::Pid};
13+
use crate::ptrace::ptrace_get_reg_set;
14+
#[cfg(target_os = "linux")]
15+
use nix::unistd::Pid;
1416

1517
// aarch64 machine
1618
pub const EM_AARCH64: u16 = 183;

elfcore/src/arch/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
//! A Rust helper library with machine-specific code for ELF core dump files.
55
66
#[cfg(target_os = "linux")]
7-
use {
8-
super::linux::ptrace,
9-
crate::{elf::NT_PRFPREG, CoreError},
10-
nix::unistd::Pid,
11-
};
7+
use super::linux::ptrace;
8+
#[cfg(target_os = "linux")]
9+
use crate::{elf::NT_PRFPREG, CoreError};
10+
#[cfg(target_os = "linux")]
11+
use nix::unistd::Pid;
1212

1313
#[cfg(target_arch = "x86_64")]
1414
mod x86_64;

elfcore/src/arch/x86_64.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33

44
//! x86_64 specifics for ELF core dump files.
55
6-
use zerocopy::AsBytes;
76
#[cfg(target_os = "linux")]
8-
use {
9-
super::ArchComponentState, crate::linux::ptrace::ptrace_get_reg_set, crate::CoreError,
10-
nix::unistd::Pid,
11-
};
7+
use super::ArchComponentState;
8+
#[cfg(target_os = "linux")]
9+
use crate::linux::ptrace::ptrace_get_reg_set;
10+
#[cfg(target_os = "linux")]
11+
use crate::CoreError;
12+
#[cfg(target_os = "linux")]
13+
use nix::unistd::Pid;
14+
use zerocopy::AsBytes;
1215

1316
// amd64 machine
1417
pub const EM_X86_64: u16 = 62;

elfcore/src/coredump.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ use std::slice;
2020
use zerocopy::AsBytes;
2121

2222
#[cfg(target_os = "linux")]
23-
use crate::{linux::LinuxProcessMemoryReader, ProcessView};
23+
use crate::linux::LinuxProcessMemoryReader;
24+
#[cfg(target_os = "linux")]
25+
use crate::ProcessView;
2426

2527
const ELF_HEADER_ALIGN: usize = 8;
2628
const ELF_NOTE_ALIGN: usize = 4;

elfcore/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ pub use error::CoreError;
2424

2525
// Linux specific functionality
2626
#[cfg(target_os = "linux")]
27-
pub use {
28-
coredump::write_core_dump,
29-
linux::{LinuxProcessMemoryReader, ProcessView},
30-
};
27+
pub use coredump::write_core_dump;
28+
#[cfg(target_os = "linux")]
29+
pub use linux::{LinuxProcessMemoryReader, ProcessView};
3130

3231
/// Trait for those able to read the process virtual memory.
3332
pub trait ReadProcessMemory {

0 commit comments

Comments
 (0)