Skip to content

Commit

Permalink
Remove no-std-compat dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Kijewski committed Sep 6, 2023
1 parent 985af34 commit 46fcccc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ include = ["src", "tests", "test-template"]
members = ["git-testament-derive"]

[dependencies]
no-std-compat = { version = "0.4" }
git-testament-derive = { version = "0.1.14", path = "git-testament-derive" }

[dev-dependencies]
Expand All @@ -25,5 +24,5 @@ regex = "1"
lazy_static = "1"

[features]
alloc = ["no-std-compat/alloc"]
alloc = []
default = ["alloc"]
17 changes: 9 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
//! rather than being quite noisy about how the crate version and the tag
//! version do not match up.
#![no_std]
extern crate no_std_compat as std;
use std::prelude::v1::*;

#[cfg(feature = "alloc")]
extern crate alloc;

pub use git_testament_derive::{git_testament, git_testament_macros};
use std::fmt::{self, Display, Formatter};
use core::fmt::{self, Display, Formatter};

/// A modification to a working tree, recorded when the testament was created.
#[derive(Debug)]
Expand Down Expand Up @@ -116,7 +117,7 @@ impl<'a> GitTestament<'a> {
&self,
pkg_version: &str,
trusted_branch: Option<&'static str>,
) -> String {
) -> alloc::string::String {
match self.commit {
CommitKind::FromTag(tag, hash, date, _) => {
let trusted = match trusted_branch {
Expand All @@ -132,20 +133,20 @@ impl<'a> GitTestament<'a> {
if trusted {
// We trust our branch, so construct an equivalent
// testament to render
format!(
alloc::format!(
"{}",
GitTestament {
commit: CommitKind::FromTag(pkg_version, hash, date, 0),
..*self
}
)
} else if tag.contains(pkg_version) {
format!("{self}")
alloc::format!("{self}")
} else {
format!("{pkg_version} :: {self}")
alloc::format!("{pkg_version} :: {self}")
}
}
_ => format!("{self}"),
_ => alloc::format!("{self}"),
}
}
}
Expand Down

0 comments on commit 46fcccc

Please sign in to comment.