Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove no-std-compat dependency #30

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
//! rather than being quite noisy about how the crate version and the tag
//! version do not match up.
#![no_std]
#[cfg(feature = "alloc")]
extern crate alloc;
#[doc(hidden)]
pub extern crate core as __core;
#[doc(hidden)]
pub extern crate git_testament_derive as __derive;
extern crate no_std_compat as std;
use std::prelude::v1::*;

use std::fmt::{self, Display, Formatter};
use core::fmt::{self, Display, Formatter};

// Clippy thinks our fn main() is needless, but it is needed because otherwise
// we cannot have the invocation of the procedural macro (yet)
Expand Down Expand Up @@ -234,7 +234,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 @@ -250,20 +250,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
Loading