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

Move UninitializedFieldError to derive_builder #206

Merged
merged 2 commits into from Apr 21, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/build.yml
Expand Up @@ -49,9 +49,3 @@ jobs:
cargo build ${{ matrix.features }} --verbose
cargo test --no-fail-fast ${{ matrix.features }} --verbose -- --nocapture
cargo doc

- name: no_std tests crate
run: |
cd derive_builder_no_std_tests
cargo build ${{ matrix.features }} --verbose
cargo test --no-fail-fast ${{ matrix.features }} --verbose -- --nocapture
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,2 +1,2 @@
[workspace]
members = ["derive_builder", "derive_builder_macro", "derive_builder_core", "derive_builder_no_std_tests"]
members = ["derive_builder", "derive_builder_macro", "derive_builder_core"]
3 changes: 1 addition & 2 deletions derive_builder/Cargo.toml
Expand Up @@ -18,11 +18,10 @@ readme = "README.md"
[features]
default = ["std"]
std = []
clippy = ["derive_builder_macro/clippy", "derive_builder_core/clippy"]
clippy = ["derive_builder_macro/clippy"]

[dependencies]
derive_builder_macro = { version = "=0.10.1", path = "../derive_builder_macro" }
derive_builder_core = { version = "=0.10.1", path = "../derive_builder_core" }

[dev-dependencies]
pretty_assertions = "0.6.1"
Expand Down
@@ -1,5 +1,9 @@
#[cfg(feature = "std")]
use std::{error::Error, fmt};

#[cfg(not(feature = "std"))]
use core::fmt;

/// Runtime error when a `build()` method is called and one or more required fields
/// do not have a value.
#[derive(Debug, Clone)]
Expand All @@ -23,6 +27,7 @@ impl fmt::Display for UninitializedFieldError {
}
}

#[cfg(feature = "std")]
impl Error for UninitializedFieldError {}

impl From<&'static str> for UninitializedFieldError {
Expand Down
5 changes: 3 additions & 2 deletions derive_builder/src/lib.rs
Expand Up @@ -544,13 +544,14 @@
#[cfg(not(feature = "std"))]
extern crate alloc;

extern crate derive_builder_core;
extern crate derive_builder_macro;

mod error;

pub use derive_builder_macro::Builder;

#[doc(inline)]
pub use derive_builder_core::UninitializedFieldError;
pub use error::UninitializedFieldError;

#[doc(hidden)]
pub mod export {
Expand Down
3 changes: 0 additions & 3 deletions derive_builder_core/src/lib.rs
Expand Up @@ -37,14 +37,11 @@ mod builder;
mod builder_field;
mod deprecation_notes;
mod doc_comment;
mod error;
mod initializer;
mod macro_options;
mod options;
mod setter;

pub use error::UninitializedFieldError;

pub(crate) use block::Block;
pub(crate) use build_method::BuildMethod;
pub(crate) use builder::Builder;
Expand Down
11 changes: 0 additions & 11 deletions derive_builder_no_std_tests/Cargo.toml

This file was deleted.

18 changes: 0 additions & 18 deletions derive_builder_no_std_tests/src/main.rs

This file was deleted.