Skip to content

Commit f41ace0

Browse files
authored
Upgrade project to edition 2018 (#389)
* Run `cargo fix` * Fix edition warnings * Cargo.toml to edition 2018 * Remove all extern crate * Link to mesalink explicitly
1 parent 34322cd commit f41ace0

22 files changed

+57
-98
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ description = "Rust bindings to libcurl for making HTTP requests"
1010
categories = ["api-bindings", "web-programming::http-client"]
1111
readme = "README.md"
1212
autotests = true
13+
edition = "2018"
1314

1415
[badges]
1516
travis-ci = { repository = "alexcrichton/curl-rust" }

curl-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ repository = "https://github.com/alexcrichton/curl-rust"
99
description = "Native bindings to the libcurl library"
1010
documentation = "https://docs.rs/curl-sys"
1111
categories = ["external-ffi-bindings"]
12+
edition = "2018"
1213

1314
[badges]
1415
travis-ci = { repository = "alexcrichton/curl-rust" }

curl-sys/build.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
extern crate cc;
2-
extern crate pkg_config;
3-
#[cfg(target_env = "msvc")]
4-
extern crate vcpkg;
5-
61
use std::env;
72
use std::fs;
83
use std::path::{Path, PathBuf};

curl-sys/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
#![allow(bad_style)]
22
#![doc(html_root_url = "https://docs.rs/curl-sys/0.3")]
33

4-
extern crate libc;
4+
// These `extern crate` are required for conditional linkages of curl.
55
#[cfg(link_libnghttp2)]
66
extern crate libnghttp2_sys;
77
#[cfg(link_libz)]
88
extern crate libz_sys;
99
#[cfg(feature = "mesalink")]
10-
extern crate mesalink; // ensure lib is linked to
10+
extern crate mesalink;
1111
#[cfg(link_openssl)]
1212
extern crate openssl_sys;
13-
#[cfg(windows)]
14-
extern crate winapi;
1513

1614
use libc::c_ulong;
1715
use libc::{c_char, c_double, c_int, c_long, c_short, c_uint, c_void, size_t, time_t};

examples/ssl_cert_blob.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
extern crate anyhow;
2-
extern crate curl;
3-
41
use std::env;
52
use std::fs::File;
63
use std::io::{stdout, Read, Write};

examples/ssl_proxy.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate anyhow;
2-
31
use anyhow::Result;
42

53
fn main() -> Result<()> {

src/easy/form.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::fmt;
33
use std::path::Path;
44
use std::ptr;
55

6+
use crate::easy::{list, List};
7+
use crate::FormError;
68
use curl_sys;
7-
use easy::{list, List};
8-
use FormError;
99

1010
/// Multipart/formdata for an HTTP POST request.
1111
///

src/easy/handle.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ use std::time::Duration;
99
use curl_sys;
1010
use libc::c_void;
1111

12-
use easy::handler::{self, InfoType, ReadError, SeekResult, WriteError};
13-
use easy::handler::{Auth, NetRc, ProxyType, SslOpt};
14-
use easy::handler::{HttpVersion, IpResolve, SslVersion, TimeCondition};
15-
use easy::{Easy2, Handler};
16-
use easy::{Form, List};
17-
use Error;
12+
use crate::easy::handler::{self, InfoType, ReadError, SeekResult, WriteError};
13+
use crate::easy::handler::{Auth, NetRc, ProxyType, SslOpt};
14+
use crate::easy::handler::{HttpVersion, IpResolve, SslVersion, TimeCondition};
15+
use crate::easy::{Easy2, Handler};
16+
use crate::easy::{Form, List};
17+
use crate::Error;
1818

1919
/// Raw bindings to a libcurl "easy session".
2020
///

src/easy/handler.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ use curl_sys;
1212
use libc::{self, c_char, c_double, c_int, c_long, c_ulong, c_void, size_t};
1313
use socket2::Socket;
1414

15-
use easy::form;
16-
use easy::list;
17-
use easy::windows;
18-
use easy::{Form, List};
19-
use panic;
20-
use Error;
15+
use crate::easy::form;
16+
use crate::easy::list;
17+
use crate::easy::windows;
18+
use crate::easy::{Form, List};
19+
use crate::panic;
20+
use crate::Error;
2121

2222
/// A trait for the various callbacks used by libcurl to invoke user code.
2323
///
@@ -581,7 +581,7 @@ impl<H: Handler> Easy2<H> {
581581
/// `perform` and need to be reset manually (or via the `reset` method) if
582582
/// this is not desired.
583583
pub fn new(handler: H) -> Easy2<H> {
584-
::init();
584+
crate::init();
585585
unsafe {
586586
let handle = curl_sys::curl_easy_init();
587587
assert!(!handle.is_null());

src/easy/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::ffi::{CStr, CString};
22
use std::fmt;
33
use std::ptr;
44

5+
use crate::Error;
56
use curl_sys;
6-
use Error;
77

88
/// A linked list of a strings
99
pub struct List {

0 commit comments

Comments
 (0)