Skip to content

Commit

Permalink
fix: Resolve all the nightly clippy lints (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem authored Jun 22, 2021
1 parent 81beee8 commit 970d9ba
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
6 changes: 3 additions & 3 deletions sentry-backtrace/src/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ impl Integration for ProcessStacktraceIntegration {
) -> Option<Event<'static>> {
for exc in &mut event.exception {
if let Some(ref mut stacktrace) = exc.stacktrace {
process_event_stacktrace(stacktrace, &options);
process_event_stacktrace(stacktrace, options);
}
}
for th in &mut event.threads {
if let Some(ref mut stacktrace) = th.stacktrace {
process_event_stacktrace(stacktrace, &options);
process_event_stacktrace(stacktrace, options);
}
}
if let Some(ref mut stacktrace) = event.stacktrace {
process_event_stacktrace(stacktrace, &options);
process_event_stacktrace(stacktrace, options);
}
Some(event)
}
Expand Down
4 changes: 2 additions & 2 deletions sentry-backtrace/src/trim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ where
.iter()
.rev()
.position(|frame| match frame.function {
Some(ref func) => is_well_known(&func) || f(frame, stacktrace),
Some(ref func) => is_well_known(func) || f(frame, stacktrace),
None => false,
});

Expand All @@ -59,5 +59,5 @@ pub fn is_sys_function(func: &str) -> bool {
fn is_well_known(func: &str) -> bool {
WELL_KNOWN_BORDER_FRAMES
.iter()
.any(|m| function_starts_with(&func, m))
.any(|m| function_starts_with(func, m))
}
14 changes: 7 additions & 7 deletions sentry-core/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ mod tests {
assert!(session.duration.unwrap() > 0.01);
assert_eq!(session.errors, 0);
assert_eq!(session.attributes.release, "some-release");
assert_eq!(session.init, true);
assert!(session.init);
} else {
panic!("expected session");
}
Expand Down Expand Up @@ -494,7 +494,7 @@ mod tests {
assert_eq!(session.status, SessionStatus::Ok);
assert_eq!(session.errors, 1);
assert_eq!(session.attributes.release, "some-release");
assert_eq!(session.init, true);
assert!(session.init);
} else {
panic!("expected session");
}
Expand All @@ -504,7 +504,7 @@ mod tests {
if let Some(EnvelopeItem::SessionUpdate(session)) = items.next() {
assert_eq!(session.status, SessionStatus::Exited);
assert_eq!(session.errors, 1);
assert_eq!(session.init, false);
assert!(!session.init);
} else {
panic!("expected session");
}
Expand All @@ -522,7 +522,7 @@ mod tests {
let mut items = envelopes[0].items();
if let Some(EnvelopeItem::SessionUpdate(session)) = items.next() {
assert_eq!(session.status, SessionStatus::Abnormal);
assert_eq!(session.init, true);
assert!(session.init);
} else {
panic!("expected session");
}
Expand Down Expand Up @@ -594,7 +594,7 @@ mod tests {
if let Some(EnvelopeItem::SessionUpdate(session)) = items.next() {
assert_eq!(session.status, SessionStatus::Exited);
assert_eq!(session.errors, 3);
assert_eq!(session.init, false);
assert!(!session.init);
} else {
panic!("expected session");
}
Expand Down Expand Up @@ -635,7 +635,7 @@ mod tests {
if let Some(EnvelopeItem::SessionUpdate(session)) = items.next() {
assert_eq!(session.status, SessionStatus::Ok);
assert_eq!(session.errors, 1);
assert_eq!(session.init, true);
assert!(session.init);
} else {
panic!("expected session");
}
Expand All @@ -655,7 +655,7 @@ mod tests {
if let Some(EnvelopeItem::SessionUpdate(session)) = items.next() {
assert_eq!(session.status, SessionStatus::Exited);
assert_eq!(session.errors, 1);
assert_eq!(session.init, false);
assert!(!session.init);
} else {
panic!("expected session");
}
Expand Down
2 changes: 1 addition & 1 deletion sentry-core/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl TestTransport {
/// Fetches and clears the contained envelopes.
pub fn fetch_and_clear_envelopes(&self) -> Vec<Envelope> {
let mut guard = self.collected.lock().unwrap();
std::mem::replace(&mut *guard, vec![])
std::mem::take(&mut *guard)
}
}

Expand Down
4 changes: 2 additions & 2 deletions sentry-tracing/src/converters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Visit for BTreeMapRecorder {

/// Creates a [`Breadcrumb`] from a given [`tracing_core::Event`]
pub fn breadcrumb_from_event(event: &tracing_core::Event) -> Breadcrumb {
let (message, data) = extract_data(&event);
let (message, data) = extract_data(event);
Breadcrumb {
category: Some(event.metadata().target().to_owned()),
ty: "log".into(),
Expand All @@ -71,7 +71,7 @@ pub fn breadcrumb_from_event(event: &tracing_core::Event) -> Breadcrumb {

/// Creates an [`Event`] from a given [`tracing_core::Event`]
pub fn event_from_event(event: &tracing_core::Event) -> Event<'static> {
let (message, extra) = extract_data(&event);
let (message, extra) = extract_data(event);
Event {
logger: Some(event.metadata().target().to_owned()),
level: convert_tracing_level(event.metadata().level()),
Expand Down
4 changes: 2 additions & 2 deletions sentry/src/transports/curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ impl CurlHttpTransport {

match (scheme, &http_proxy, &https_proxy) {
(Scheme::Https, _, &Some(ref proxy)) => {
handle.proxy(&proxy).unwrap();
handle.proxy(proxy).unwrap();
}
(_, &Some(ref proxy), _) => {
handle.proxy(&proxy).unwrap();
handle.proxy(proxy).unwrap();
}
_ => {}
}
Expand Down
7 changes: 3 additions & 4 deletions sentry/tests/test_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,8 @@ fn test_attached_stacktrace() {

assert_eq!(events.len(), 3);

let stacktraces: Vec<_> = events
let stacktraces = events
.into_iter()
.flat_map(|ev| ev.threads.into_iter().filter_map(|thrd| thrd.stacktrace))
.collect();
assert_eq!(stacktraces.len(), 3);
.flat_map(|ev| ev.threads.into_iter().filter_map(|thrd| thrd.stacktrace));
assert_eq!(stacktraces.count(), 3);
}

0 comments on commit 970d9ba

Please sign in to comment.