Skip to content

Commit

Permalink
Merge pull request #4 from delta1/updates
Browse files Browse the repository at this point in the history
Update to new stable `#![doc = include_str!]`
  • Loading branch information
hdevalence authored Sep 5, 2021
2 parents 73b8a16 + b2f100d commit 5063d48
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 58 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on: [push, pull_request]

name: Test

jobs:
test:
name: cargo test
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
- 1.54.0
steps:
- name: checkout
uses: actions/checkout@v2
- name: toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: thumbv7em-none-eabi
override: true
- name: test
uses: actions-rs/cargo@v1
with:
command: test
- name: nightly
uses: actions-rs/cargo@v1
with:
command: test
args: --features nightly
- name: no-default-features
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features
- name: std
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features std
- name: std i128
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features "std i128"
- name: no std build
uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features --target thumbv7em-none-eabi
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "subtle-ng"
# - update CHANGELOG
# - update html_root_url
# - update README if necessary by semver
version = "2.4.1"
version = "2.5.0"
authors = ["Isis Lovecruft <isis@patternsinthevoid.net>",
"Henry de Valence <hdevalence@hdevalence.ca>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Documentation is available [here][docs].

## Minimum Supported Rust Version

Rust **1.41** or higher.
Rust **1.54** or higher.

Minimum supported Rust version can be changed in the future, but it will be
done with a minor version bump.
Expand Down
25 changes: 8 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
// - Henry de Valence <hdevalence@hdevalence.ca>

#![no_std]
#![cfg_attr(feature = "nightly", feature(external_doc))]
#![cfg_attr(feature = "nightly", doc(include = "../README.md"))]
#![doc = include_str!("../README.md")]
#![cfg_attr(feature = "nightly", deny(missing_docs))]
#![doc(html_root_url = "https://docs.rs/subtle-ng/2.4.1")]

Expand Down Expand Up @@ -178,7 +177,7 @@ impl From<u8> for Choice {
/// # Example
///
/// ```
/// use subtle::ConstantTimeEq;
/// use subtle_ng::ConstantTimeEq;
/// let x: u8 = 5;
/// let y: u8 = 13;
///
Expand All @@ -194,7 +193,6 @@ pub trait ConstantTimeEq {
///
/// * `Choice(1u8)` if `self == other`;
/// * `Choice(0u8)` if `self != other`.
#[inline]
fn ct_eq(&self, other: &Self) -> Choice;
}

Expand All @@ -210,7 +208,7 @@ impl<T: ConstantTimeEq> ConstantTimeEq for [T] {
/// Since arrays coerce to slices, this function works with fixed-size arrays:
///
/// ```
/// # use subtle::ConstantTimeEq;
/// # use subtle_ng::ConstantTimeEq;
/// #
/// let a: [u8; 8] = [0,1,2,3,4,5,6,7];
/// let b: [u8; 8] = [0,1,2,3,0,1,2,3];
Expand Down Expand Up @@ -304,8 +302,7 @@ pub trait ConditionallySelectable: Copy {
/// # Example
///
/// ```
/// # extern crate subtle;
/// use subtle::ConditionallySelectable;
/// use subtle_ng::ConditionallySelectable;
/// #
/// # fn main() {
/// let x: u8 = 13;
Expand All @@ -317,7 +314,6 @@ pub trait ConditionallySelectable: Copy {
/// assert_eq!(z, y);
/// # }
/// ```
#[inline]
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self;

/// Conditionally assign `other` to `self`, according to `choice`.
Expand All @@ -327,8 +323,7 @@ pub trait ConditionallySelectable: Copy {
/// # Example
///
/// ```
/// # extern crate subtle;
/// use subtle::ConditionallySelectable;
/// use subtle_ng::ConditionallySelectable;
/// #
/// # fn main() {
/// let mut x: u8 = 13;
Expand All @@ -353,8 +348,7 @@ pub trait ConditionallySelectable: Copy {
/// # Example
///
/// ```
/// # extern crate subtle;
/// use subtle::ConditionallySelectable;
/// use subtle_ng::ConditionallySelectable;
/// #
/// # fn main() {
/// let mut x: u8 = 13;
Expand Down Expand Up @@ -467,7 +461,6 @@ pub trait ConditionallyNegatable {
/// unchanged.
///
/// This function should execute in constant time.
#[inline]
fn conditional_negate(&mut self, choice: Choice);
}

Expand Down Expand Up @@ -685,8 +678,7 @@ pub trait ConstantTimeGreater {
/// # Example
///
/// ```
/// # extern crate subtle;
/// use subtle::ConstantTimeGreater;
/// use subtle_ng::ConstantTimeGreater;
///
/// let x: u8 = 13;
/// let y: u8 = 42;
Expand Down Expand Up @@ -769,8 +761,7 @@ pub trait ConstantTimeLess: ConstantTimeEq + ConstantTimeGreater {
/// # Example
///
/// ```
/// # extern crate subtle;
/// use subtle::ConstantTimeLess;
/// use subtle_ng::ConstantTimeLess;
///
/// let x: u8 = 13;
/// let y: u8 = 42;
Expand Down
4 changes: 2 additions & 2 deletions tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
extern crate rand;
extern crate subtle;
extern crate subtle_ng;

use rand::rngs::OsRng;
use rand::RngCore;

use subtle::*;
use subtle_ng::*;

#[test]
#[should_panic]
Expand Down

0 comments on commit 5063d48

Please sign in to comment.