Skip to content

Commit fda4139

Browse files
committed
chore: cargo fmt
1 parent 338d525 commit fda4139

File tree

7 files changed

+34
-19
lines changed

7 files changed

+34
-19
lines changed

src/error.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ pub enum PyroscopeError {
1515
AdHoc(String),
1616

1717
#[error("{msg}: {source:?}")]
18-
Compat{ msg: String, #[source] source: Box<dyn std::error::Error + Send + Sync + 'static> },
18+
Compat {
19+
msg: String,
20+
#[source]
21+
source: Box<dyn std::error::Error + Send + Sync + 'static>,
22+
},
1923

2024
#[error(transparent)]
2125
Reqwest(#[from] reqwest::Error),
@@ -37,7 +41,10 @@ impl PyroscopeError {
3741
}
3842

3943
/// Create a new instance of PyroscopeError with source
40-
pub fn new_with_source<E>(msg: &str, source: E) -> Self where E: std::error::Error + Send + Sync + 'static {
44+
pub fn new_with_source<E>(msg: &str, source: E) -> Self
45+
where
46+
E: std::error::Error + Send + Sync + 'static,
47+
{
4148
PyroscopeError::Compat {
4249
msg: msg.to_string(),
4350
source: Box::new(source),

src/pyroscope.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use crate::{
1616

1717
const LOG_TAG: &str = "Pyroscope::Agent";
1818

19-
2019
/// Pyroscope Agent Configuration. This is the configuration that is passed to the agent.
2120
/// # Example
2221
/// ```
@@ -287,7 +286,10 @@ impl Drop for PyroscopeAgent {
287286
// Stop the SessionManager
288287
match self.session_manager.push(SessionSignal::Kill) {
289288
Ok(_) => log::trace!(target: LOG_TAG, "Sent kill signal to SessionManager"),
290-
Err(_) => log::error!(target: LOG_TAG, "Error sending kill signal to SessionManager"),
289+
Err(_) => log::error!(
290+
target: LOG_TAG,
291+
"Error sending kill signal to SessionManager"
292+
),
291293
}
292294

293295
if let Some(handle) = self.session_manager.handle.take() {
@@ -306,7 +308,7 @@ impl Drop for PyroscopeAgent {
306308
}
307309
}
308310

309-
log::debug!(target: LOG_TAG, "Agent Dropped");
311+
log::debug!(target: LOG_TAG, "Agent Dropped");
310312
}
311313
}
312314

src/session.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ impl Session {
124124
/// session.send()?;
125125
/// ```
126126
pub fn send(self) -> Result<()> {
127-
log::info!(target: LOG_TAG, "Sending Session: {} - {}", self.from, self.until);
127+
log::info!(
128+
target: LOG_TAG,
129+
"Sending Session: {} - {}",
130+
self.from,
131+
self.until
132+
);
128133

129134
// Check if the report is empty
130135
if self.report.is_empty() {

src/timer/kqueue.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ impl Timer {
5858
return Ok(());
5959
}
6060

61-
6261
// Get current time
6362
let from = get_time_range(0)?.from;
6463

src/timer/mod.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// https://www.apache.org/licenses/LICENSE-2.0>. This file may not be copied, modified, or distributed
55
// except according to those terms.
66

7-
87
/// A signal sent to the timer.
98
///
109
/// Either schedules another wake-up, or asks
@@ -26,12 +25,18 @@ impl std::fmt::Display for TimerSignal {
2625
}
2726
}
2827
// Possibly: ios, netbsd, openbsd, freebsd
29-
#[cfg(target_os = "macos")] pub mod kqueue;
30-
#[cfg(target_os = "macos")] pub use kqueue::Timer;
28+
#[cfg(target_os = "macos")]
29+
pub mod kqueue;
30+
#[cfg(target_os = "macos")]
31+
pub use kqueue::Timer;
3132

3233
// Possibly: android
33-
#[cfg(target_os = "linux")] pub mod epoll;
34-
#[cfg(target_os = "linux")] pub use epoll::Timer;
34+
#[cfg(target_os = "linux")]
35+
pub mod epoll;
36+
#[cfg(target_os = "linux")]
37+
pub use epoll::Timer;
3538

36-
#[cfg(not(any(target_os = "linux", target_os = "macos")))] pub mod sleep;
37-
#[cfg(not(any(target_os = "linux", target_os = "macos")))] pub use sleep::Timer;
39+
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
40+
pub mod sleep;
41+
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
42+
pub use sleep::Timer;

tests/session.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ use pyroscope::{
22
pyroscope::PyroscopeConfig,
33
session::{Session, SessionManager, SessionSignal},
44
};
5-
use std::{
6-
collections::HashMap,
7-
time::Duration,
8-
};
5+
use std::{collections::HashMap, time::Duration};
96

107
#[test]
118
fn test_session_manager_new() {

tests/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use pyroscope::timer::{TimerSignal, Timer};
21
use assert_matches::assert_matches;
2+
use pyroscope::timer::{Timer, TimerSignal};
33

44
#[test]
55
fn test_timer() {

0 commit comments

Comments
 (0)