D8399: rust-chg: upgrade to 2018 edition and remove useless extern crates

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Sat Apr 11 11:24:29 UTC 2020


yuja created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8399

AFFECTED FILES
  rust/chg/Cargo.toml
  rust/chg/build.rs
  rust/chg/src/attachio.rs
  rust/chg/src/lib.rs
  rust/chg/src/locator.rs
  rust/chg/src/main.rs

CHANGE DETAILS

diff --git a/rust/chg/src/main.rs b/rust/chg/src/main.rs
--- a/rust/chg/src/main.rs
+++ b/rust/chg/src/main.rs
@@ -3,12 +3,6 @@
 // This software may be used and distributed according to the terms of the
 // GNU General Public License version 2 or any later version.
 
-extern crate chg;
-extern crate futures;
-extern crate log;
-extern crate tokio;
-extern crate tokio_hglib;
-
 use chg::locator::{self, Locator};
 use chg::procutil;
 use chg::{ChgClientExt, ChgUiHandler};
diff --git a/rust/chg/src/locator.rs b/rust/chg/src/locator.rs
--- a/rust/chg/src/locator.rs
+++ b/rust/chg/src/locator.rs
@@ -6,6 +6,7 @@
 //! Utility for locating command-server process.
 
 use futures::future::{self, Either, Loop};
+use log::debug;
 use std::env;
 use std::ffi::{OsStr, OsString};
 use std::fs::{self, DirBuilder};
diff --git a/rust/chg/src/lib.rs b/rust/chg/src/lib.rs
--- a/rust/chg/src/lib.rs
+++ b/rust/chg/src/lib.rs
@@ -3,17 +3,6 @@
 // This software may be used and distributed according to the terms of the
 // GNU General Public License version 2 or any later version.
 
-extern crate bytes;
-#[macro_use]
-extern crate futures;
-extern crate libc;
-#[macro_use]
-extern crate log;
-extern crate tokio;
-extern crate tokio_hglib;
-extern crate tokio_process;
-extern crate tokio_timer;
-
 mod attachio;
 mod clientext;
 pub mod locator;
diff --git a/rust/chg/src/attachio.rs b/rust/chg/src/attachio.rs
--- a/rust/chg/src/attachio.rs
+++ b/rust/chg/src/attachio.rs
@@ -5,7 +5,7 @@
 
 //! Functions to send client-side fds over the command server channel.
 
-use futures::{Async, Future, Poll};
+use futures::{try_ready, Async, Future, Poll};
 use std::io;
 use std::os::unix::io::AsRawFd;
 use tokio_hglib::codec::ChannelMessage;
diff --git a/rust/chg/build.rs b/rust/chg/build.rs
--- a/rust/chg/build.rs
+++ b/rust/chg/build.rs
@@ -1,5 +1,3 @@
-extern crate cc;
-
 fn main() {
     cc::Build::new()
         .warnings(true)
diff --git a/rust/chg/Cargo.toml b/rust/chg/Cargo.toml
--- a/rust/chg/Cargo.toml
+++ b/rust/chg/Cargo.toml
@@ -4,6 +4,7 @@
 authors = ["Yuya Nishihara <yuya at tcha.org>"]
 description = "Client for Mercurial command server with cHg extension"
 license = "GPL-2.0+"
+edition = "2018"
 
 [dependencies]
 bytes = "0.4"



To: yuja, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list