2018ize everything
authoralfadur
Tue, 13 Nov 2018 20:01:43 +0300
changeset 14212 bb2f301d4fe0
parent 14211 257b296169a8
child 14213 87f1054c2333
2018ize everything
rust/fpnum/Cargo.toml
rust/fpnum/src/lib.rs
rust/hedgewars-checker/Cargo.toml
rust/hedgewars-checker/src/main.rs
rust/integral-geometry/Cargo.toml
rust/integral-geometry/src/lib.rs
rust/land2d/Cargo.toml
rust/land2d/src/lib.rs
rust/landgen/Cargo.toml
rust/landgen/src/lib.rs
rust/landgen/src/outline.rs
rust/landgen/src/template_based.rs
rust/lfprng/Cargo.toml
rust/lib-hedgewars-engine/Cargo.toml
rust/lib-hedgewars-engine/src/lib.rs
rust/vec2d/Cargo.toml
rust/vec2d/src/lib.rs
--- a/rust/fpnum/Cargo.toml	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/fpnum/Cargo.toml	Tue Nov 13 20:01:43 2018 +0300
@@ -2,5 +2,6 @@
 name = "fpnum"
 version = "0.1.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
+edition = "2018"
 
 [dependencies]
--- a/rust/fpnum/src/lib.rs	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/fpnum/src/lib.rs	Tue Nov 13 20:01:43 2018 +0300
@@ -1,6 +1,8 @@
-use std::cmp;
-use std::ops;
-use std::ops::Shl;
+use std::{
+    cmp,
+    ops,
+    ops::Shl
+};
 
 #[derive(Clone, Debug, Copy)]
 pub struct FPNum {
--- a/rust/hedgewars-checker/Cargo.toml	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/hedgewars-checker/Cargo.toml	Tue Nov 13 20:01:43 2018 +0300
@@ -2,6 +2,7 @@
 name = "hedgewars-checker"
 version = "1.0.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
+edition = "2018"
 
 [dependencies]
 rust-ini = "0.13"
--- a/rust/hedgewars-checker/src/main.rs	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/hedgewars-checker/src/main.rs	Tue Nov 13 20:01:43 2018 +0300
@@ -1,20 +1,13 @@
-#[macro_use]
-extern crate log;
-extern crate argparse;
-extern crate base64;
-extern crate dirs;
-extern crate ini;
-extern crate netbuf;
-extern crate stderrlog;
-extern crate tempfile;
-
 use argparse::{ArgumentParser, Store};
 use ini::Ini;
 use netbuf::Buf;
-use std::io::Write;
-use std::net::TcpStream;
-use std::process::Command;
-use std::str::FromStr;
+use log::{debug, warn, info};
+use std::{
+    io::Write,
+    net::TcpStream,
+    process::Command,
+    str::FromStr
+};
 
 type CheckError = Box<std::error::Error>;
 
@@ -219,7 +212,7 @@
 
     info!("Using protocol number {}", protocol_number);
 
-    connect_and_run(&username, &password, protocol_number, &exe, &prefix);
+    connect_and_run(&username, &password, protocol_number, &exe, &prefix).unwrap();
 }
 
 #[cfg(test)]
--- a/rust/integral-geometry/Cargo.toml	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/integral-geometry/Cargo.toml	Tue Nov 13 20:01:43 2018 +0300
@@ -2,6 +2,7 @@
 name = "integral-geometry"
 version = "0.1.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
+edition = "2018"
 
 [dependencies]
 fpnum = { path = "../fpnum" }
--- a/rust/integral-geometry/src/lib.rs	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/integral-geometry/src/lib.rs	Tue Nov 13 20:01:43 2018 +0300
@@ -1,7 +1,4 @@
-#[macro_use]
-extern crate fpnum;
-
-use fpnum::{distance, FPNum, FPPoint};
+use fpnum::{distance, FPNum, FPPoint, fp};
 use std::{
     cmp::{max, min},
     ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Range, RangeInclusive, Sub, SubAssign},
@@ -344,7 +341,7 @@
 
     #[inline]
     pub fn height(&self) -> usize {
-        (self.right() - self.left() + 1) as usize
+        (self.bottom() - self.top() + 1) as usize
     }
 
     #[inline]
--- a/rust/land2d/Cargo.toml	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/land2d/Cargo.toml	Tue Nov 13 20:01:43 2018 +0300
@@ -2,6 +2,7 @@
 name = "land2d"
 version = "0.1.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
+edition = "2018"
 
 [dependencies]
 vec2d = { path = "../vec2d" }
--- a/rust/land2d/src/lib.rs	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/land2d/src/lib.rs	Tue Nov 13 20:01:43 2018 +0300
@@ -1,6 +1,3 @@
-extern crate integral_geometry;
-extern crate vec2d;
-
 use std::{
     cmp,
     ops::Index
--- a/rust/landgen/Cargo.toml	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/landgen/Cargo.toml	Tue Nov 13 20:01:43 2018 +0300
@@ -2,6 +2,7 @@
 name = "landgen"
 version = "0.1.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
+edition = "2018"
 
 [dependencies]
 integral-geometry = { path = "../integral-geometry" }
--- a/rust/landgen/src/lib.rs	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/landgen/src/lib.rs	Tue Nov 13 20:01:43 2018 +0300
@@ -2,10 +2,6 @@
 pub mod outline_template;
 pub mod template_based;
 
-extern crate integral_geometry;
-extern crate itertools;
-extern crate land2d;
-
 pub struct LandGenerationParameters<T> {
     zero: T,
     basic: T,
--- a/rust/landgen/src/outline.rs	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/landgen/src/outline.rs	Tue Nov 13 20:01:43 2018 +0300
@@ -4,7 +4,7 @@
 use integral_geometry::{Line, Ray, Point, Polygon, Rect, Size};
 use land2d::Land2D;
 
-use outline_template::OutlineTemplate;
+use crate::outline_template::OutlineTemplate;
 
 pub struct OutlinePoints {
     pub islands: Vec<Polygon>,
--- a/rust/landgen/src/template_based.rs	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/landgen/src/template_based.rs	Tue Nov 13 20:01:43 2018 +0300
@@ -1,10 +1,11 @@
 use integral_geometry::{Point, Size};
 use land2d::Land2D;
-use LandGenerationParameters;
-use LandGenerator;
-
-use outline::OutlinePoints;
-use outline_template::OutlineTemplate;
+use crate::{
+    LandGenerationParameters,
+    LandGenerator,
+    outline::OutlinePoints,
+    outline_template::OutlineTemplate
+};
 
 pub struct TemplatedLandGenerator {
     outline_template: OutlineTemplate,
--- a/rust/lfprng/Cargo.toml	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/lfprng/Cargo.toml	Tue Nov 13 20:01:43 2018 +0300
@@ -2,5 +2,6 @@
 name = "lfprng"
 version = "0.1.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
+edition = "2018"
 
 [dependencies]
--- a/rust/lib-hedgewars-engine/Cargo.toml	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/lib-hedgewars-engine/Cargo.toml	Tue Nov 13 20:01:43 2018 +0300
@@ -2,6 +2,7 @@
 name = "lib-hedgewars-engine"
 version = "0.1.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
+edition = "2018"
 
 [dependencies]
 gfx = "0.17"
--- a/rust/lib-hedgewars-engine/src/lib.rs	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/lib-hedgewars-engine/src/lib.rs	Tue Nov 13 20:01:43 2018 +0300
@@ -1,10 +1,3 @@
-extern crate integral_geometry;
-extern crate land2d;
-extern crate landgen;
-extern crate lfprng;
-extern crate gfx;
-extern crate gfx_device_gl;
-
 mod world;
 mod command;
 
--- a/rust/vec2d/Cargo.toml	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/vec2d/Cargo.toml	Tue Nov 13 20:01:43 2018 +0300
@@ -2,6 +2,7 @@
 name = "vec2d"
 version = "0.1.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
+edition = "2018"
 
 [dependencies]
 integral-geometry = { path = "../integral-geometry" }
--- a/rust/vec2d/src/lib.rs	Tue Nov 13 16:54:40 2018 +0100
+++ b/rust/vec2d/src/lib.rs	Tue Nov 13 20:01:43 2018 +0300
@@ -1,7 +1,7 @@
-extern crate integral_geometry;
-
-use std::ops::{Index, IndexMut};
-use std::slice::SliceIndex;
+use std::{
+    ops::{Index, IndexMut},
+    slice::SliceIndex
+};
 use integral_geometry::Size;
 
 pub struct Vec2D<T> {