Skip to content

Commit 2f731ff

Browse files
committedMar 31, 2025·
gpt_disk_types: Unconditionally implement the Error trait
1 parent 2122e73 commit 2f731ff

File tree

6 files changed

+12
-43
lines changed

6 files changed

+12
-43
lines changed
 

‎gpt_disk_types/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Unreleased
22

33
* MSRV increased to 1.81.
4+
* The `Error` trait is now unconditionally implemented for all error types.
45

56
# 0.16.0
67

‎gpt_disk_types/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ No features are enabled by default.
2020
* `bytemuck`: Implements bytemuck's `Pod` and `Zeroable` traits for many
2121
of the types in this crate. Also enables some methods that rely on
2222
byte access.
23-
* `std`: Provides `std::error::Error` implementations for all of the
24-
error types.
23+
* `std`: Currently has no effect.
2524

2625
## Minimum Supported Rust Version (MSRV)
2726

‎gpt_disk_types/src/lib.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
//! * `bytemuck`: Implements bytemuck's `Pod` and `Zeroable` traits for
4545
//! many of the types in this crate. Also enables some methods that
4646
//! rely on byte access.
47-
//! * `std`: Provides `std::error::Error` implementations for all of the
48-
//! error types. Off by default.
47+
//! * `std`: Currently has no effect.
4948
//!
5049
//! # Examples
5150
//!
@@ -85,7 +84,7 @@
8584
//! };
8685
//! ```
8786
88-
#![cfg_attr(not(feature = "std"), no_std)]
87+
#![no_std]
8988
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
9089
#![warn(missing_copy_implementations)]
9190
#![warn(missing_debug_implementations)]
@@ -107,8 +106,6 @@ mod mbr;
107106
mod num;
108107
mod partition_array;
109108
mod partition_entry;
110-
#[cfg(feature = "std")]
111-
mod std_support;
112109

113110
// Re-export dependencies.
114111
pub use crc;

‎gpt_disk_types/src/partition_array.rs

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ impl Display for GptPartitionEntryArrayError {
145145
}
146146
}
147147

148+
impl core::error::Error for GptPartitionEntryArrayError {}
149+
148150
/// Storage for a GPT partition entry array.
149151
#[allow(missing_debug_implementations)]
150152
pub struct GptPartitionEntryArray<'a> {

‎gpt_disk_types/src/partition_entry.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,6 @@ impl Iterator for GptPartitionNameCharIter<'_> {
241241
}
242242

243243
/// Error type for [`GptPartitionName::set_char`].
244-
///
245-
/// If the `std` feature is enabled, this type implements the [`Error`]
246-
/// trait.
247-
///
248-
/// [`Error`]: std::error::Error
249244
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
250245
pub enum GptPartitionNameSetCharError {
251246
/// Character index is outside the range `0..36`.
@@ -266,6 +261,8 @@ impl Display for GptPartitionNameSetCharError {
266261
}
267262
}
268263

264+
impl core::error::Error for GptPartitionNameSetCharError {}
265+
269266
/// Human readable partition label encoded as a null-terminated UCS-2
270267
/// string.
271268
///
@@ -347,11 +344,6 @@ impl Default for GptPartitionName {
347344
}
348345

349346
/// Error type for [`GptPartitionName::from_str`].
350-
///
351-
/// If the `std` feature is enabled, this type implements the [`Error`]
352-
/// trait.
353-
///
354-
/// [`Error`]: std::error::Error
355347
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
356348
pub enum GptPartitionNameFromStrError {
357349
/// Input string is too long.
@@ -379,6 +371,8 @@ impl From<ucs2::Error> for GptPartitionNameFromStrError {
379371
}
380372
}
381373

374+
impl core::error::Error for GptPartitionNameFromStrError {}
375+
382376
impl FromStr for GptPartitionName {
383377
type Err = GptPartitionNameFromStrError;
384378

@@ -466,11 +460,6 @@ impl Display for GptPartitionEntry {
466460
}
467461

468462
/// Error returned by [`GptPartitionEntrySize::new`].
469-
///
470-
/// If the `std` feature is enabled, this type implements the [`Error`]
471-
/// trait.
472-
///
473-
/// [`Error`]: std::error::Error
474463
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, Ord, PartialOrd)]
475464
pub struct GptPartitionEntrySizeError;
476465

@@ -480,6 +469,8 @@ impl Display for GptPartitionEntrySizeError {
480469
}
481470
}
482471

472+
impl core::error::Error for GptPartitionEntrySizeError {}
473+
483474
/// Size in bytes of entries in the partition entry array.
484475
///
485476
/// A valid partition entry size must be a value of 128×2ⁿ, where n is

‎gpt_disk_types/src/std_support.rs

-21
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.