From 54fc650742daa8e2d7e4b9191d53eb7e5551fba2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= <kornel@cloudflare.com>
Date: Mon, 25 Mar 2019 17:27:04 +0000
Subject: [PATCH] Edition 2018

---
 Cargo.toml            | 12 ++++++----
 README.md             |  6 ++---
 examples/compare.rs   |  3 ---
 src/flags.rs          |  2 +-
 src/lib.rs            | 56 +++++++++++++++++++++----------------------
 src/mlu.rs            | 10 ++++----
 src/namedcolorlist.rs |  9 ++++---
 src/pipeline.rs       | 19 ++++++++-------
 src/profile.rs        |  2 +-
 src/stage.rs          | 15 ++++++------
 src/tag.rs            |  4 ++--
 src/tonecurve.rs      | 15 ++++++------
 src/transform.rs      |  2 +-
 13 files changed, 77 insertions(+), 78 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 1f156f8..4c9a079 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,16 +3,18 @@ name = "lcms2"
 authors = ["Kornel Lesiński <kornel@geekhood.net>"]
 description = "ICC color profile handling. Rusty wrapper for Little CMS"
 keywords = ["icc", "profile", "color", "lcms"]
-include = ["src/**/*", "tests/**/*", "examples/**/*", "Cargo.toml", "README.md"]
+include = ["src/**/*", "Cargo.toml", "README.md"]
 readme = "README.md"
 license = "MIT"
-documentation = "https://pornel.github.io/rust-lcms2/lcms2/"
-repository = "https://github.com/pornel/rust-lcms2.git"
+homepage = "https://crates.rs/crates/lcms2"
+documentation = "https://kornelski.github.io/rust-lcms2/lcms2/"
+repository = "https://github.com/kornelski/rust-lcms2.git"
 categories = ["multimedia::images", "api-bindings"]
-version = "5.0.1"
+version = "5.1.1"
+edition = "2018"
 
 [dependencies]
-foreign-types = "0.3.0"
+foreign-types = "0.4.0"
 lcms2-sys = "2.4.7"
 
 [features]
diff --git a/README.md b/README.md
index 8b6d1ea..33ee03d 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,9 @@
 
 Convert and apply color profiles with a safe abstraction layer for the LCMS library.
 
-See [API reference](https://docs.rs/lcms2/) for Rust functions and the [LCMS2 documentation HTML](https://pornel.github.io/rust-lcms2-sys/)/[PDF](http://www.littlecms.com/LittleCMS2.8%20API.pdf) for more background information about the functions.
+See [API reference](https://docs.rs/lcms2/) for Rust functions and the [LCMS2 documentation HTML](https://kornelski.github.io/rust-lcms2-sys/)/[PDF](http://www.littlecms.com/LittleCMS2.8%20API.pdf) for more background information about the functions.
 
 ```rust
-extern crate rgb;
-extern crate lcms2;
 use lcms2::*;
 
 fn example() -> Result<(), std::io::Error> {
@@ -42,7 +40,7 @@ if b"ICC_PROFILE\0" == &app2_marker_data[0..12] {
 
 There's more in the `examples` directory.
 
-This crate requires Rust 1.20 or later. It's up to date with LCMS 2.8 (should work with 2.6 to 2.9).
+This crate requires Rust 1.33 or later. It's up to date with LCMS 2.9, and should work with 2.6 to 2.9.
 
 ## Threads
 
diff --git a/examples/compare.rs b/examples/compare.rs
index 5c0b81b..e28f827 100644
--- a/examples/compare.rs
+++ b/examples/compare.rs
@@ -1,6 +1,3 @@
-#![feature(iterator_step_by)]
-#![allow(deprecated)]
-
 extern crate lcms2;
 use lcms2::*;
 
diff --git a/src/flags.rs b/src/flags.rs
index 429fbe8..d33b1f5 100644
--- a/src/flags.rs
+++ b/src/flags.rs
@@ -1,4 +1,4 @@
-use ffi;
+use crate::ffi;
 use std::ops;
 
 #[derive(Debug, Copy, Clone)]
diff --git a/src/lib.rs b/src/lib.rs
index 2073ae1..e988bc0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,9 +1,9 @@
-//! See [Little CMS full documentation](https://pornel.github.io/rust-lcms2-sys/) for more in-depth information about LCMS functions.
+//! See [Little CMS full documentation](https://kornelski.github.io/rust-lcms2-sys/) for more in-depth information about LCMS functions.
 //!
 //! The main types you need to use in this crate are `Profile` and `Transform`
 #![allow(dead_code)]
-#![doc(html_logo_url = "https://pornel.github.io/rust-lcms2/lcms_logo.png")]
-#![doc(html_root_url = "https://pornel.github.io/rust-lcms2")]
+#![doc(html_logo_url = "https://kornelski.github.io/rust-lcms2/lcms_logo.png")]
+#![doc(html_root_url = "https://kornelski.github.io/rust-lcms2")]
 
 extern crate lcms2_sys as ffi;
 
@@ -27,36 +27,36 @@ mod tonecurve;
 mod error;
 use std::marker::PhantomData;
 
-pub use profile::*;
-pub use error::*;
-pub use ciecam::*;
-pub use context::{GlobalContext, ThreadContext};
-pub use mlu::*;
-pub use ext::*;
-pub use flags::*;
-pub use locale::*;
-pub use pipeline::*;
-pub use stage::*;
-pub use transform::*;
-pub use tonecurve::*;
-pub use namedcolorlist::*;
+pub use crate::profile::*;
+pub use crate::error::*;
+pub use crate::ciecam::*;
+pub use crate::context::{GlobalContext, ThreadContext};
+pub use crate::mlu::*;
+pub use crate::ext::*;
+pub use crate::flags::*;
+pub use crate::locale::*;
+pub use crate::pipeline::*;
+pub use crate::stage::*;
+pub use crate::transform::*;
+pub use crate::tonecurve::*;
+pub use crate::namedcolorlist::*;
 
-pub use ffi::CIEXYZ;
-pub use ffi::CIELab;
+pub use crate::ffi::CIEXYZ;
+pub use crate::ffi::CIELab;
 #[doc(hidden)]
-pub use ffi::CIExyYTRIPLE;
+pub use crate::ffi::CIExyYTRIPLE;
 #[doc(hidden)]
-pub use ffi::CIExyY;
+pub use crate::ffi::CIExyY;
 #[doc(hidden)]
-pub use ffi::JCh;
+pub use crate::ffi::JCh;
 
-pub use ffi::PixelFormat;
-pub use ffi::InfoType;
-pub use ffi::TagSignature;
-pub use ffi::Intent;
-pub use ffi::ColorSpaceSignature;
-pub use ffi::ProfileClassSignature;
-pub use ffi::ViewingConditions;
+pub use crate::ffi::PixelFormat;
+pub use crate::ffi::InfoType;
+pub use crate::ffi::TagSignature;
+pub use crate::ffi::Intent;
+pub use crate::ffi::ColorSpaceSignature;
+pub use crate::ffi::ProfileClassSignature;
+pub use crate::ffi::ViewingConditions;
 
 #[derive(Debug)]
 /// Value of a tag in an ICC profile
diff --git a/src/mlu.rs b/src/mlu.rs
index b8634d2..199f2b5 100644
--- a/src/mlu.rs
+++ b/src/mlu.rs
@@ -1,7 +1,7 @@
 use super::*;
 use std::fmt;
 use std::ffi::CString;
-use ffi::wchar_t;
+use crate::ffi::wchar_t;
 use std::iter::repeat;
 use std::ptr;
 use std::mem;
@@ -9,12 +9,12 @@ use std::char::{decode_utf16, REPLACEMENT_CHARACTER};
 use foreign_types::{ForeignType, ForeignTypeRef};
 
 foreign_type! {
-    type CType = ffi::MLU;
-    fn drop = ffi::cmsMLUfree;
     /// This represents owned Multi Localized Unicode type. Most methods are implemented on `MLURef`.
-    pub struct MLU;
     /// This is a borrwed Multi Localized Unicode type. It holds Unicode strings associated with `Locale`.
-    pub struct MLURef;
+    pub type MLU {
+        type CType = ffi::MLU;
+        fn drop = ffi::cmsMLUfree;
+    }
 }
 
 impl MLU {
diff --git a/src/namedcolorlist.rs b/src/namedcolorlist.rs
index e2ec2d1..12b8e9e 100644
--- a/src/namedcolorlist.rs
+++ b/src/namedcolorlist.rs
@@ -15,12 +15,11 @@ pub struct NamedColorInfo {
 }
 
 foreign_type! {
-    type CType = ffi::NAMEDCOLORLIST;
-    fn drop = ffi::cmsFreeNamedColorList;
-    /// Owned version of `NamedColorListRef`
-    pub struct NamedColorList;
     /// Palette of colors with names
-    pub struct NamedColorListRef;
+    pub type NamedColorList {
+        type CType = ffi::NAMEDCOLORLIST;
+        fn drop = ffi::cmsFreeNamedColorList;
+    }
 }
 
 impl NamedColorList {
diff --git a/src/pipeline.rs b/src/pipeline.rs
index 4e90059..040253e 100644
--- a/src/pipeline.rs
+++ b/src/pipeline.rs
@@ -1,22 +1,23 @@
 use super::*;
 use std::fmt;
-use stage::*;
+use crate::stage::*;
 use std::ptr;
-use eval::FloatOrU16;
+use crate::eval::FloatOrU16;
 use foreign_types::ForeignTypeRef;
 
 foreign_type! {
-    #[doc(hidden)]
-    type CType = ffi::Pipeline;
-    fn drop = ffi::cmsPipelineFree;
-    fn clone = ffi::cmsPipelineDup;
-    /// This is an owned version of `PipelineRef`.
-    pub struct Pipeline;
     /// Pipelines are a convenient way to model complex operations on image data.
     ///
     /// Each pipeline may contain an arbitrary number of stages. Each stage performs a single operation.
     /// Pipelines may be optimized to be executed on a certain format (8 bits, for example) and can be saved as LUTs in ICC profiles.
-    pub struct PipelineRef;
+    ///
+    /// This is an owned version of `PipelineRef`.
+    #[doc(hidden)]
+    pub type Pipeline {
+        type CType = ffi::Pipeline;
+        fn drop = ffi::cmsPipelineFree;
+        fn clone = ffi::cmsPipelineDup;
+    }
 }
 
 impl Pipeline {
diff --git a/src/profile.rs b/src/profile.rs
index e585d7e..cbfb7a7 100644
--- a/src/profile.rs
+++ b/src/profile.rs
@@ -1,5 +1,5 @@
 use super::*;
-use context::Context;
+use crate::context::Context;
 use std::path::Path;
 use std::ptr;
 use std::io;
diff --git a/src/stage.rs b/src/stage.rs
index 4bdc9b1..6bbf6a6 100644
--- a/src/stage.rs
+++ b/src/stage.rs
@@ -1,22 +1,23 @@
 use super::*;
-use eval::FloatOrU16;
+use crate::eval::FloatOrU16;
 use std::fmt;
 use std::ptr;
 use foreign_types::ForeignTypeRef;
-use context::Context;
+use crate::context::Context;
 
 foreign_type! {
-    type CType = ffi::Stage;
-    fn drop = ffi::cmsStageFree;
-    /// This is an owned version of `Stage`.
-    pub struct Stage;
     /// Stage functions
     ///
     /// Stages are single-step operations that can be chained to create pipelines.
     /// Actual stage types does include matrices, tone curves, Look-up interpolation and user-defined.
     /// There are functions to create new stage types and a plug-in type to allow stages to be saved in multi profile elements tag types.
     /// See the plug-in API for further details.
-    pub struct StageRef;
+    ///
+    /// This is an owned version of `Stage`.
+    pub type Stage {
+        type CType = ffi::Stage;
+        fn drop = ffi::cmsStageFree;
+    }
 }
 
 impl Stage {
diff --git a/src/tag.rs b/src/tag.rs
index 25eb4ac..48060bd 100644
--- a/src/tag.rs
+++ b/src/tag.rs
@@ -10,7 +10,7 @@ impl<'a> Tag<'a> {
     }
 
     pub unsafe fn data_for_signature(&self, sig: TagSignature) -> *const u8 {
-        use TagSignature::*;
+        use crate::TagSignature::*;
         match (sig, self) {
             (RedColorantTag, &Tag::CIEXYZ(data)) |
             (BlueColorantTag, &Tag::CIEXYZ(data)) |
@@ -99,7 +99,7 @@ impl<'a> Tag<'a> {
         if data.is_null() {
             return Tag::None;
         }
-        use TagSignature::*;
+        use crate::TagSignature::*;
         match sig {
             BlueColorantTag |
             GreenColorantTag |
diff --git a/src/tonecurve.rs b/src/tonecurve.rs
index 4bada58..eba5cf1 100644
--- a/src/tonecurve.rs
+++ b/src/tonecurve.rs
@@ -1,19 +1,20 @@
 use super::*;
 use std::fmt;
 use std::ptr;
-use eval::FloatOrU16;
+use crate::eval::FloatOrU16;
 use foreign_types::{ForeignType, ForeignTypeRef};
 
 foreign_type! {
-    type CType = ffi::ToneCurve;
-    fn drop = ffi::cmsFreeToneCurve;
-    fn clone = ffi::cmsDupToneCurve;
-    /// Owned version of `ToneCurveRef`
-    pub struct ToneCurve;
     /// Tone curves are powerful constructs that can contain curves specified in diverse ways.
     ///
     /// The curve is stored in segments, where each segment can be sampled or specified by parameters. A 16.bit simplification of the *whole* curve is kept for optimization purposes. For float operation, each segment is evaluated separately. Plug-ins may be used to define new parametric schemes.
-    pub struct ToneCurveRef;
+    ///
+    /// Owned version of `ToneCurveRef`
+    pub type ToneCurve {
+        type CType = ffi::ToneCurve;
+        fn drop = ffi::cmsFreeToneCurve;
+        fn clone = ffi::cmsDupToneCurve;
+    }
 }
 
 impl ToneCurve {
diff --git a/src/transform.rs b/src/transform.rs
index 329ff6f..51fe584 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -1,5 +1,5 @@
 use super::*;
-use context::Context;
+use crate::context::Context;
 use std::os::raw::c_void;
 use std::marker::PhantomData;
 
-- 
GitLab