Skip to content

Commit

Permalink
Merge pull request #23 from mgeisler/rust-2018
Browse files Browse the repository at this point in the history
Switch to Rust 2018
  • Loading branch information
mgeisler authored Mar 30, 2019
2 parents ca4e6b0 + 3107e3f commit 61ca688
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: rust

rust:
- 1.31.0
- stable
- beta
- nightly
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ readme = "README.md"
keywords = ["smawk", "matrix", "optimization", "dynamic-programming"]
categories = ["algorithms", "science"]
license = "MIT"
edition = "2018"

[badges]
travis-ci = { repository = "mgeisler/smawk" }
Expand All @@ -24,4 +25,4 @@ rand = "0.3"
rand_derive = "0.3"

[dev-dependencies]
version-sync = "0.3"
version-sync = "0.8"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![](https://img.shields.io/crates/v/smawk.svg)][crates-io]
[![](https://docs.rs/smawk/badge.svg)][api-docs]
[![](https://img.shields.io/badge/rustc-1.31.0-blue.svg)][rust-2018]
[![](https://travis-ci.org/mgeisler/smawk.svg)][travis-ci]
[![](https://ci.appveyor.com/api/projects/status/github/mgeisler/smawk?branch=master&svg=true)][appveyor]
[![](https://codecov.io/gh/mgeisler/smawk/branch/master/graph/badge.svg)][codecov]
Expand Down Expand Up @@ -54,6 +55,11 @@ so `minima[0] == 1` since the minimum value in the first column is 2

This is a changelog describing the most important changes per release.

### Unreleased

Switched to [Rust 2018][rust-2018], which means that the minimum
supported Rust version is 1.31.0.

### Version 0.1.0 — August 7th, 2018

First release with the classical offline SMAWK algorithm as well as a
Expand All @@ -71,4 +77,5 @@ Contributions will be accepted under the same license.
[codecov]: https://codecov.io/gh/mgeisler/smawk
[smawk]: https://en.wikipedia.org/wiki/SMAWK_algorithm
[api-docs]: https://docs.rs/smawk/
[rust-2018]: https://doc.rust-lang.org/edition-guide/rust-2018/
[mit]: LICENSE
3 changes: 0 additions & 3 deletions benches/comparison.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#![feature(test)]

extern crate ndarray;
extern crate rand;
extern crate smawk;
extern crate test;

use ndarray::Array2;
Expand Down
14 changes: 4 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,16 @@
#![doc(html_root_url = "https://docs.rs/smawk/0.1.0")]

#[macro_use(s)]
extern crate ndarray;
extern crate num_traits;
extern crate rand;
#[macro_use]
extern crate rand_derive;

use ndarray::{Array2, ArrayView1, ArrayView2, Axis, Si};
use ndarray::{s, Array2, ArrayView1, ArrayView2, Axis, Si};
use num_traits::{NumOps, PrimInt};
use rand::{Rand, Rng};
use rand_derive::Rand;

/// Compute lane minimum by brute force.
///
/// This does a simple scan through the lane (row or column).
#[inline]
fn lane_minimum<T: Ord>(lane: ArrayView1<T>) -> usize {
fn lane_minimum<T: Ord>(lane: ArrayView1<'_, T>) -> usize {
lane.iter()
.enumerate()
.min_by_key(|&(idx, elem)| (elem, idx))
Expand Down Expand Up @@ -171,7 +165,7 @@ enum Direction {
/// and optimized away and the result is that the compiler generates
/// differnet code for finding row and column minima.
fn recursive_inner<T: Ord, F: Fn() -> Direction>(
matrix: ArrayView2<T>,
matrix: ArrayView2<'_, T>,
dir: &F,
offset: usize,
minima: &mut [usize],
Expand Down
8 changes: 2 additions & 6 deletions tests/complexity.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
extern crate ndarray;
extern crate rand;
extern crate smawk;

use ndarray::{Array1, Array2, Axis};
use ndarray::{Array1, Array2, Axis, LinalgScalar};
use rand::XorShiftRng;
use smawk::{online_column_minima, random_monge_matrix};
use std::borrow::Borrow;
Expand All @@ -24,7 +20,7 @@ macro_rules! squared {
/// Compute the mean of a 1-dimensional array.
fn mean<T, A>(a: A) -> T
where
T: ndarray::LinalgScalar,
T: LinalgScalar,
A: Borrow<Array1<T>>,
{
a.borrow().mean_axis(Axis(0))[[]]
Expand Down
14 changes: 9 additions & 5 deletions tests/version-numbers.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#[macro_use]
extern crate version_sync;

#[test]
fn test_readme_deps() {
assert_markdown_deps_updated!("README.md");
version_sync::assert_markdown_deps_updated!("README.md");
}

#[test]
fn test_minimum_rustc_version() {
let version = r"1\.31\.0";
version_sync::assert_contains_regex!(".travis.yml", &format!(r"^ - {}", version));
version_sync::assert_contains_regex!("README.md", &format!("badge/rustc-{}", version));
}

#[test]
fn test_html_root_url() {
assert_html_root_url_updated!("src/lib.rs");
version_sync::assert_html_root_url_updated!("src/lib.rs");
}

0 comments on commit 61ca688

Please sign in to comment.