Skip to content

Conversation

@kinggoesgaming
Copy link
Member

I'm submitting a ...

  • bug fix
  • feature enhancement
  • deprecation or removal
  • refactor

Description

uuid now adds cfg-if as a dependency. With this, #[cfg(..)] implementations are easier to understand, as they can be handled in a more logical view because the macro allows us to if statements to make the checks more rustic at the source level

Motivation

Understanding feature gate implementation becomes easier.

Tests

The CI builds passing should be plenty.

Related Issue(s)

#147

* [x] `extern crate`s
* [x] already provided `mod`s

Signed-off-by: Hunar Roop Kahlon <[email protected]>
Signed-off-by: Hunar Roop Kahlon <[email protected]>
Signed-off-by: Hunar Roop Kahlon <[email protected]>
Signed-off-by: Hunar Roop Kahlon <[email protected]>
@kinggoesgaming
Copy link
Member Author

question: should I put various feature gated constructor new functions behind cfg_if` macros aswell or should we wait until a bigger refactor comes along?

@kinggoesgaming
Copy link
Member Author

@uuid-rs/uuid I think this is logical enough for this PR. Should be ready for review and merge

@kinggoesgaming kinggoesgaming changed the title WIP: Use cfg-if to create logical feature gate implementations Use cfg-if to create logical feature gate implementations Mar 14, 2018
Copy link
Member

@KodrAus KodrAus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a lot easier to follow! Just had a quick scan through on mobile

}
}

cfg_if! {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could reduce some duplicated nesting here by conditionally using core as std:

if #[cfg(not(feature = "std"))] {
    use core as std;
}

use std::fmt;
use std::str;

...

What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR was intended to switch to cfg_if. Another PR should make the that part more readable later... which I think I will have ready soon

@Dylan-DPC-zz
Copy link
Member

bors: r+

bors bot added a commit that referenced this pull request Mar 14, 2018
167: Use cfg-if to create logical feature gate implementations r=Dylan-DPC a=kinggoesgaming

<!--
    As we are working towards a stable version of uuid, we require that you 
    open an issue, before submitting a pull request. If the pull request is 
    imcomplete, prepend the Title with WIP: 
-->

**I'm submitting a ...**
  - [ ] bug fix
  - [ ] feature enhancement
  - [ ] deprecation or removal
  - [x] refactor

# Description
`uuid` now adds `cfg-if` as a dependency.  With this, `#[cfg(..)]` implementations are easier to understand, as they can be handled in a more logical view because the macro allows us to `if` statements to make the checks more rustic at the source level

# Motivation
Understanding feature gate implementation becomes easier.

# Tests
The CI builds passing should be plenty.

# Related Issue(s)
#147
@bors
Copy link
Contributor

bors bot commented Mar 14, 2018

Build failed

@kinggoesgaming
Copy link
Member Author

clippy was outdated, cache cleared

bors r+

bors bot added a commit that referenced this pull request Mar 14, 2018
167: Use cfg-if to create logical feature gate implementations r=kinggoesgaming a=kinggoesgaming

<!--
    As we are working towards a stable version of uuid, we require that you 
    open an issue, before submitting a pull request. If the pull request is 
    imcomplete, prepend the Title with WIP: 
-->

**I'm submitting a ...**
  - [ ] bug fix
  - [ ] feature enhancement
  - [ ] deprecation or removal
  - [x] refactor

# Description
`uuid` now adds `cfg-if` as a dependency.  With this, `#[cfg(..)]` implementations are easier to understand, as they can be handled in a more logical view because the macro allows us to `if` statements to make the checks more rustic at the source level

# Motivation
Understanding feature gate implementation becomes easier.

# Tests
The CI builds passing should be plenty.

# Related Issue(s)
#147
@bors
Copy link
Contributor

bors bot commented Mar 14, 2018

Build failed

@kinggoesgaming
Copy link
Member Author

again! wrong cache cleared :(

bors r+

bors bot added a commit that referenced this pull request Mar 14, 2018
167: Use cfg-if to create logical feature gate implementations r=kinggoesgaming a=kinggoesgaming

<!--
    As we are working towards a stable version of uuid, we require that you 
    open an issue, before submitting a pull request. If the pull request is 
    imcomplete, prepend the Title with WIP: 
-->

**I'm submitting a ...**
  - [ ] bug fix
  - [ ] feature enhancement
  - [ ] deprecation or removal
  - [x] refactor

# Description
`uuid` now adds `cfg-if` as a dependency.  With this, `#[cfg(..)]` implementations are easier to understand, as they can be handled in a more logical view because the macro allows us to `if` statements to make the checks more rustic at the source level

# Motivation
Understanding feature gate implementation becomes easier.

# Tests
The CI builds passing should be plenty.

# Related Issue(s)
#147
@bors
Copy link
Contributor

bors bot commented Mar 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants