From 5d6fe1a533db9ec7fc5c640697b289389dc62221 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Thu, 27 Oct 2011 13:04:06 -0700 Subject: [PATCH] Remove uint::max/min in favor if math::max/min --- src/comp/back/rpath.rs | 3 ++- src/comp/middle/ty.rs | 3 ++- src/fuzzer/fuzzer.rs | 6 +++--- src/lib/uint.rs | 4 ---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/comp/back/rpath.rs b/src/comp/back/rpath.rs index 2098e7343978..048459dfcbf4 100644 --- a/src/comp/back/rpath.rs +++ b/src/comp/back/rpath.rs @@ -3,6 +3,7 @@ import std::fs; import std::os_fs; import std::vec; import std::map; +import std::math; import std::str; import std::uint; import metadata::cstore; @@ -128,7 +129,7 @@ fn get_relative_to(abs1: fs::path, abs2: fs::path) -> fs::path { assert len1 > 0u; assert len2 > 0u; - let max_common_path = uint::min(len1, len2) - 1u; + let max_common_path = math::min(len1, len2) - 1u; let start_idx = 0u; while start_idx < max_common_path && split1[start_idx] == split2[start_idx] { diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 305d05a5b5d8..026630c8706d 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -6,6 +6,7 @@ import std::box; import std::ufind; import std::map; import std::map::hashmap; +import std::math; import std::option; import std::option::none; import std::option::some; @@ -1812,7 +1813,7 @@ mod unify { // Unifies two sets. fn union(cx: @ctxt, set_a: uint, set_b: uint, variance: variance) -> union_result { - ufind::grow(cx.vb.sets, uint::max(set_a, set_b) + 1u); + ufind::grow(cx.vb.sets, math::max(set_a, set_b) + 1u); let root_a = ufind::find(cx.vb.sets, set_a); let root_b = ufind::find(cx.vb.sets, set_b); diff --git a/src/fuzzer/fuzzer.rs b/src/fuzzer/fuzzer.rs index f99bff1cf478..ab07d3ede8e0 100644 --- a/src/fuzzer/fuzzer.rs +++ b/src/fuzzer/fuzzer.rs @@ -1,7 +1,7 @@ use std; use rustc; -import std::{fs, io, getopts, vec, str, int, uint, option}; +import std::{fs, io, getopts, math, vec, str, int, uint, option}; import std::getopts::{optopt, opt_present, opt_str}; import std::io::stdout; @@ -242,9 +242,9 @@ fn check_variants_T( let L = vec::len(things); if L < 100u { - under(uint::min(L, 20u)) {|i| + under(math::min(L, 20u)) {|i| log_err "Replacing... #" + uint::str(i); - under(uint::min(L, 30u)) {|j| + under(math::min(L, 30u)) {|j| log_err "With... " + stringifier(@things[j]); let crate2 = @replacer(crate, i, things[j], cx.mode); // It would be best to test the *crate* for stability, but testing the diff --git a/src/lib/uint.rs b/src/lib/uint.rs index e5eb6a1b182e..cf50b70e1cd8 100644 --- a/src/lib/uint.rs +++ b/src/lib/uint.rs @@ -55,10 +55,6 @@ pure fn ge(x: uint, y: uint) -> bool { ret x >= y; } /* Predicate: gt */ pure fn gt(x: uint, y: uint) -> bool { ret x > y; } -fn max(x: uint, y: uint) -> uint { if x > y { ret x; } ret y; } - -fn min(x: uint, y: uint) -> uint { if x > y { ret y; } ret x; } - /* Function: range