Skip to content

Commit

Permalink
simplify macro examples a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Nov 16, 2021
1 parent f657e5c commit 4e6412d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ define_uuid_macro! {
/// Defining a local variable:
///
/// ```
/// # use uuid::{uuid, Uuid};
/// let uuid: Uuid = uuid!("urn:uuid:F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4");
/// # use uuid::uuid;
/// let uuid = uuid!("urn:uuid:F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4");
/// ```
///
/// ## Compilation Failures
///
/// Invalid UUIDs are rejected:
///
/// ```compile_fail
/// # use uuid::{uuid, Uuid};
/// let uuid: Uuid = uuid!("F9168C5E-ZEB2-4FAA-B6BF-329BF39FA1E4");
/// # use uuid::uuid;
/// let uuid = uuid!("F9168C5E-ZEB2-4FAA-B6BF-329BF39FA1E4");
/// ```
///
/// Enable the feature `macro-diagnostics` to see the error messages below.
Expand All @@ -74,25 +74,25 @@ define_uuid_macro! {
/// ```txt
/// error: invalid character: expected an optional prefix of `urn:uuid:` followed by 0123456789abcdefABCDEF-, found Z at 9
/// |
/// | let id: Uuid = uuid!("F9168C5E-ZEB2-4FAA-B6BF-329BF39FA1E4");
/// | ^
/// | let id = uuid!("F9168C5E-ZEB2-4FAA-B6BF-329BF39FA1E4");
/// | ^
/// ```
///
/// Tokens that aren't string literals are also rejected:
///
/// ```compile_fail
/// # use uuid::{uuid, Uuid};
/// # use uuid::uuid;
/// let uuid_str: &str = "550e8400e29b41d4a716446655440000";
/// let uuid: Uuid = uuid!(uuid_str);
/// let uuid = uuid!(uuid_str);
/// ```
///
/// Provides the following compilation error:
///
/// ```txt
/// error: expected string literal
/// |
/// | let uuid: Uuid = uuid!(uuid_str);
/// | ^^^^^^^^
/// | let uuid = uuid!(uuid_str);
/// | ^^^^^^^^
/// ```
///
/// [uuid::Uuid]: https://docs.rs/uuid/*/uuid/struct.Uuid.html
Expand Down

0 comments on commit 4e6412d

Please sign in to comment.