Skip to content

Commit

Permalink
Upgrade derive_more crate to 1.0.0-beta.3 version
Browse files Browse the repository at this point in the history
- bump up MSRV to 1.65.0
  • Loading branch information
tyranron committed Oct 6, 2023
1 parent 4fd32cb commit a943638
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
strategy:
fail-fast: false
matrix:
msrv: ["1.56.0"]
msrv: ["1.65.0"]
os: ["ubuntu", "macOS", "windows"]
runs-on: ${{ matrix.os }}-latest
steps:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ All user visible changes to this project will be documented in this file. This p



## [0.4.0] · 2023-??-?? (unreleased)
[0.4.0]: /../../tree/v0.4.0

[Diff](/../../compare/v0.3.0...v0.4.0)

### BC Breaks

- Set MSRV to [1.65.0](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html).




## [0.3.0] · 2021-10-27
[0.3.0]: /../../tree/v0.3.0

Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "tracerr"
version = "0.3.0"
version = "0.4.0-dev"
edition = "2021"
rust-version = "1.56"
rust-version = "1.65"
description = "Custom compile-time captured error tracing."
authors = ["Instrumentisto Team <developer@instrumentisto.com>"]
license = "BlueOak-1.0.0"
Expand All @@ -15,5 +15,5 @@ categories = ["rust-patterns"]
include = ["/src/", "/CHANGELOG.md", "/LICENSE.md", "/README.md"]

[dependencies]
derive_more = { version = "0.99.8", features = ["as_mut", "as_ref", "display"], default-features = false }
derive_more = { version = "=1.0.0-beta.3", features = ["as_mut", "as_ref", "display"] }
sealed = "0.5"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tracerr
=======

[![crates.io](https://img.shields.io/crates/v/tracerr.svg "crates.io")](https://crates.io/crates/tracerr)
[![Rust 1.56+](https://img.shields.io/badge/rustc-1.56+-lightgray.svg "Rust 1.56+")](https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html)
[![Rust 1.65+](https://img.shields.io/badge/rustc-1.65+-lightgray.svg "Rust 1.65+")](https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html)
[![Unsafe Forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance)
[![CI](https://github.com/instrumentisto/tracerr-rs/workflows/CI/badge.svg?branch=main "CI")](https://github.com/instrumentisto/tracerr-rs/actions?query=workflow%3ACI+branch%3Amain)
[![Rust docs](https://docs.rs/tracerr/badge.svg "Rust docs")](https://docs.rs/tracerr)
Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ pub static DEFAULT_FRAMES_CAPACITY: AtomicUsize = AtomicUsize::new(10);

/// Wrapper for an arbitrary error holding the captured error trace along.
#[derive(AsMut, AsRef, Clone, Debug, Display)]
// TODO: Use "{err}" syntax once MSRV bumps above 1.58, and `derive_more`
// supports it.
#[display(fmt = "{}", err)]
#[display("{err}")]
pub struct Traced<E: ?Sized> {
/// Captured error trace.
trace: Trace,
Expand Down
14 changes: 6 additions & 8 deletions src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ use derive_more::Display;

/// Captured frame of [`Trace`].
#[derive(Clone, Copy, Debug, Display)]
// TODO: Use "{module}\n at {file}:{line}" syntax once MSRV bumps above 1.58,
// and `derive_more` supports it.
#[display(fmt = "{}\n at {}:{}", module, file, line)]
#[display("{module}\n at {file}:{line}")]
pub struct Frame {
/// Name of source file where [`Frame`] is captured.
pub file: &'static str,
Expand Down Expand Up @@ -62,12 +60,11 @@ impl DerefMut for Trace {
}
}

impl fmt::Display for Trace {
impl Display for Trace {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "error trace:")?;
for frame in &self.0 {
// TODO: Use "\n{frame}" syntax once MSRV bumps above 1.58.
write!(f, "\n{}", frame)?;
write!(f, "\n{frame}")?;
}
Ok(())
}
Expand All @@ -84,6 +81,7 @@ mod frame_spec {
line: 32,
module: "main::sub",
};

assert_eq!(frame.to_string(), "main::sub\n at my_file.rs:32");
}
}
Expand Down Expand Up @@ -111,9 +109,9 @@ mod trace_spec {
module: "main::sub3",
},
]);
// TODO: Use "{stack}\n" syntax once MSRV bumps above 1.58.

assert_eq!(
format!("{}\n ", stack),
format!("{stack}\n "),
r#"error trace:
main::sub1
at src/my_file.rs:32
Expand Down

0 comments on commit a943638

Please sign in to comment.