Skip to content

Commit c96f97b

Browse files
committed
refactor(clippy): fix clippy warnings
1 parent df1ad30 commit c96f97b

File tree

2 files changed

+9
-11
lines changed
  • pyroscope_backends

2 files changed

+9
-11
lines changed

pyroscope_backends/pyroscope_pprofrs/src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ impl PprofConfig {
2323
}
2424

2525
pub fn sample_rate(self, sample_rate: u32) -> Self {
26-
PprofConfig {
27-
sample_rate,
28-
..self
29-
}
26+
PprofConfig { sample_rate }
3027
}
3128
}
3229

@@ -213,17 +210,17 @@ impl From<pprof::Symbol> for StackFrameWrapper {
213210
symbol
214211
.filename
215212
.clone()
216-
.unwrap_or(std::path::PathBuf::new())
213+
.unwrap_or_else(std::path::PathBuf::new)
217214
.file_name()
218-
.unwrap_or(OsStr::new(""))
215+
.unwrap_or_else(|| OsStr::new(""))
219216
.to_str()
220217
.unwrap_or("")
221218
.to_string(),
222219
),
223220
Some(
224221
symbol
225222
.filename
226-
.unwrap_or(std::path::PathBuf::new())
223+
.unwrap_or_else(std::path::PathBuf::new)
227224
.to_str()
228225
.unwrap_or("")
229226
.to_string(),

pyroscope_backends/pyroscope_rbspy/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ impl Rbspy {
104104
}
105105
}
106106

107+
// Type aliases
108+
type ErrorSender = Sender<std::result::Result<(), anyhow::Error>>;
109+
type ErrorReceiver = Receiver<std::result::Result<(), anyhow::Error>>;
110+
107111
impl Backend for Rbspy {
108112
fn get_state(&self) -> State {
109113
self.state
@@ -150,10 +154,7 @@ impl Backend for Rbspy {
150154
}
151155

152156
// Channel for Errors generated by the RubySpy Sampler
153-
let (error_sender, error_receiver): (
154-
Sender<std::result::Result<(), anyhow::Error>>,
155-
Receiver<std::result::Result<(), anyhow::Error>>,
156-
) = channel();
157+
let (error_sender, error_receiver): (ErrorSender, ErrorReceiver) = channel();
157158

158159
// This is provides enough space for 100 threads.
159160
// It might be a better idea to figure out how many threads are running and determine the

0 commit comments

Comments
 (0)