From 861baaf584eb3da1bc086d95b8f5ae07eb9f41ed Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Fri, 10 Oct 2014 18:36:15 +0200 Subject: [PATCH 1/2] 'final' is a keyword now --- src/base64/base64.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base64/base64.rs b/src/base64/base64.rs index b79fcedd8..480c52de4 100644 --- a/src/base64/base64.rs +++ b/src/base64/base64.rs @@ -159,9 +159,9 @@ fn encode(input: &mut Reader, line_wrap: uint) { // However, since GNU base64 outputs only LF (presumably because that is // the standard UNIX line ending), we strip CRs from the output to maintain // compatibility. - let final = encoded.replace("\r", ""); + let output = encoded.replace("\r", ""); - println(final.as_slice()); + println(output.as_slice()); } fn help(progname: &str, usage: &str) { From e482abb630ead083271423ab8e869b764613b2cd Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Fri, 10 Oct 2014 18:36:35 +0200 Subject: [PATCH 2/2] static -> const --- src/common/utmpx.rs | 82 ++++++++++++++++++++++---------------------- src/fmt/linebreak.rs | 10 +++--- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/common/utmpx.rs b/src/common/utmpx.rs index 3acf2adb5..b5e525729 100644 --- a/src/common/utmpx.rs +++ b/src/common/utmpx.rs @@ -10,21 +10,21 @@ mod utmpx { pub static DEFAULT_FILE: &'static str = "/var/run/utmp"; - pub static UT_LINESIZE: uint = 32; - pub static UT_NAMESIZE: uint = 32; - pub static UT_IDSIZE: uint = 4; - pub static UT_HOSTSIZE: uint = 256; + pub const UT_LINESIZE: uint = 32; + pub const UT_NAMESIZE: uint = 32; + pub const UT_IDSIZE: uint = 4; + pub const UT_HOSTSIZE: uint = 256; - pub static EMPTY: libc::c_short = 0; - pub static RUN_LVL: libc::c_short = 1; - pub static BOOT_TIME: libc::c_short = 2; - pub static NEW_TIME: libc::c_short = 3; - pub static OLD_TIME: libc::c_short = 4; - pub static INIT_PROCESS: libc::c_short = 5; - pub static LOGIN_PROCESS: libc::c_short = 6; - pub static USER_PROCESS: libc::c_short = 7; - pub static DEAD_PROCESS: libc::c_short = 8; - pub static ACCOUNTING: libc::c_short = 9; + pub const EMPTY: libc::c_short = 0; + pub const RUN_LVL: libc::c_short = 1; + pub const BOOT_TIME: libc::c_short = 2; + pub const NEW_TIME: libc::c_short = 3; + pub const OLD_TIME: libc::c_short = 4; + pub const INIT_PROCESS: libc::c_short = 5; + pub const LOGIN_PROCESS: libc::c_short = 6; + pub const USER_PROCESS: libc::c_short = 7; + pub const DEAD_PROCESS: libc::c_short = 8; + pub const ACCOUNTING: libc::c_short = 9; #[repr(C)] pub struct c_exit_status { @@ -56,21 +56,21 @@ mod utmpx { pub static DEFAULT_FILE: &'static str = "/var/run/utmpx"; - pub static UT_LINESIZE: uint = 32; - pub static UT_NAMESIZE: uint = 256; - pub static UT_IDSIZE: uint = 4; - pub static UT_HOSTSIZE: uint = 256; + pub const UT_LINESIZE: uint = 32; + pub const UT_NAMESIZE: uint = 256; + pub const UT_IDSIZE: uint = 4; + pub const UT_HOSTSIZE: uint = 256; - pub static EMPTY: libc::c_short = 0; - pub static RUN_LVL: libc::c_short = 1; - pub static BOOT_TIME: libc::c_short = 2; - pub static OLD_TIME: libc::c_short = 3; - pub static NEW_TIME: libc::c_short = 4; - pub static INIT_PROCESS: libc::c_short = 5; - pub static LOGIN_PROCESS: libc::c_short = 6; - pub static USER_PROCESS: libc::c_short = 7; - pub static DEAD_PROCESS: libc::c_short = 8; - pub static ACCOUNTING: libc::c_short = 9; + pub const EMPTY: libc::c_short = 0; + pub const RUN_LVL: libc::c_short = 1; + pub const BOOT_TIME: libc::c_short = 2; + pub const OLD_TIME: libc::c_short = 3; + pub const NEW_TIME: libc::c_short = 4; + pub const INIT_PROCESS: libc::c_short = 5; + pub const LOGIN_PROCESS: libc::c_short = 6; + pub const USER_PROCESS: libc::c_short = 7; + pub const DEAD_PROCESS: libc::c_short = 8; + pub const ACCOUNTING: libc::c_short = 9; #[repr(C)] pub struct c_exit_status { @@ -97,20 +97,20 @@ mod utmpx { pub static DEFAULT_FILE : &'static str = ""; - pub static UT_LINESIZE : uint = 16; - pub static UT_NAMESIZE : uint = 32; - pub static UT_IDSIZE : uint = 8; - pub static UT_HOSTSIZE : uint = 128; + pub const UT_LINESIZE : uint = 16; + pub const UT_NAMESIZE : uint = 32; + pub const UT_IDSIZE : uint = 8; + pub const UT_HOSTSIZE : uint = 128; - pub static EMPTY : libc::c_short = 0; - pub static BOOT_TIME : libc::c_short = 1; - pub static OLD_TIME : libc::c_short = 2; - pub static NEW_TIME : libc::c_short = 3; - pub static USER_PROCESS : libc::c_short = 4; - pub static INIT_PROCESS : libc::c_short = 5; - pub static LOGIN_PROCESS : libc::c_short = 6; - pub static DEAD_PROCESS : libc::c_short = 7; - pub static SHUTDOWN_TIME : libc::c_short = 8; + pub const EMPTY : libc::c_short = 0; + pub const BOOT_TIME : libc::c_short = 1; + pub const OLD_TIME : libc::c_short = 2; + pub const NEW_TIME : libc::c_short = 3; + pub const USER_PROCESS : libc::c_short = 4; + pub const INIT_PROCESS : libc::c_short = 5; + pub const LOGIN_PROCESS : libc::c_short = 6; + pub const DEAD_PROCESS : libc::c_short = 7; + pub const SHUTDOWN_TIME : libc::c_short = 8; #[repr(C)] pub struct c_utmp { diff --git a/src/fmt/linebreak.rs b/src/fmt/linebreak.rs index 8152210b7..a7753290f 100644 --- a/src/fmt/linebreak.rs +++ b/src/fmt/linebreak.rs @@ -334,14 +334,14 @@ fn build_best_path<'a>(paths: &Vec>, active: &Vec) -> Vec<(& } // "infinite" badness is more like (1+BAD_INFTY)^2 because of how demerits are computed -static BAD_INFTY: i64 = 10000000; -static BAD_INFTY_SQ: i64 = BAD_INFTY * BAD_INFTY; +const BAD_INFTY: i64 = 10000000; +const BAD_INFTY_SQ: i64 = BAD_INFTY * BAD_INFTY; // badness = BAD_MULT * abs(r) ^ 3 -static BAD_MULT: f32 = 100.0; +const BAD_MULT: f32 = 100.0; // DR_MULT is multiplier for delta-R between lines -static DR_MULT: f32 = 600.0; +const DR_MULT: f32 = 600.0; // DL_MULT is penalty multiplier for short words at end of line -static DL_MULT: f32 = 300.0; +const DL_MULT: f32 = 300.0; #[inline(always)] fn compute_demerits(delta_len: int, stretch: int, wlen: int, prev_rat: f32) -> (i64, f32) {