Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forbid priv where it has no effect #8363

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/libextra/fileinput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,27 @@ struct FileInput_ {
`Some(path)` is the file represented by `path`, `None` is
`stdin`. Consumed as the files are read.
*/
priv files: ~[Option<Path>],
files: ~[Option<Path>],
/**
The current file: `Some(r)` for an open file, `None` before
starting and after reading everything.
*/
priv current_reader: Option<@io::Reader>,
priv state: FileInputState,
current_reader: Option<@io::Reader>,
state: FileInputState,

/**
Used to keep track of whether we need to insert the newline at the
end of a file that is missing it, which is needed to separate the
last and first lines.
*/
priv previous_was_newline: bool
previous_was_newline: bool
}

// XXX: remove this when Reader has &mut self. Should be removable via
// "self.fi." -> "self." and renaming FileInput_. Documentation above
// will likely have to be updated to use `let mut in = ...`.
pub struct FileInput {
priv fi: @mut FileInput_
fi: @mut FileInput_
}

impl FileInput {
Expand Down Expand Up @@ -198,7 +198,7 @@ impl FileInput {
FileInput::from_vec(pathed)
}

priv fn current_file_eof(&self) -> bool {
fn current_file_eof(&self) -> bool {
match self.fi.current_reader {
None => false,
Some(r) => r.eof()
Expand Down Expand Up @@ -240,7 +240,7 @@ impl FileInput {
Returns `true` if it had to move to the next file and did
so successfully.
*/
priv fn next_file_if_eof(&self) -> bool {
fn next_file_if_eof(&self) -> bool {
match self.fi.current_reader {
None => self.next_file(),
Some(r) => {
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<A> Drop for Future<A> {
fn drop(&self) {}
}

priv enum FutureState<A> {
enum FutureState<A> {
Pending(~fn() -> A),
Evaluating,
Forced(A)
Expand Down
8 changes: 4 additions & 4 deletions src/libextra/getopts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,9 @@ pub mod groups {
* Fails during iteration if the string contains a non-whitespace
* sequence longer than the limit.
*/
priv fn each_split_within<'a>(ss: &'a str,
lim: uint,
it: &fn(&'a str) -> bool) -> bool {
fn each_split_within<'a>(ss: &'a str,
lim: uint,
it: &fn(&'a str) -> bool) -> bool {
// Just for fun, let's write this as an state machine:

enum SplitWithinState {
Expand Down Expand Up @@ -778,7 +778,7 @@ pub mod groups {
}

#[test]
priv fn test_split_within() {
fn test_split_within() {
fn t(s: &str, i: uint, u: &[~str]) {
let mut v = ~[];
do each_split_within(s, i) |s| { v.push(s.to_owned()); true };
Expand Down
20 changes: 10 additions & 10 deletions src/libextra/num/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ pub mod BigDigit {
pub static bits: uint = 32;

pub static base: uint = 1 << bits;
priv static hi_mask: uint = (-1 as uint) << bits;
priv static lo_mask: uint = (-1 as uint) >> bits;
static hi_mask: uint = (-1 as uint) << bits;
static lo_mask: uint = (-1 as uint) >> bits;


priv fn get_hi(n: uint) -> BigDigit { (n >> bits) as BigDigit }
fn get_hi(n: uint) -> BigDigit { (n >> bits) as BigDigit }

priv fn get_lo(n: uint) -> BigDigit { (n & lo_mask) as BigDigit }
fn get_lo(n: uint) -> BigDigit { (n & lo_mask) as BigDigit }

/// Split one machine sized unsigned integer into two BigDigits.

Expand Down Expand Up @@ -613,15 +613,15 @@ impl BigUint {
}


priv fn shl_unit(&self, n_unit: uint) -> BigUint {
fn shl_unit(&self, n_unit: uint) -> BigUint {
if n_unit == 0 || self.is_zero() { return (*self).clone(); }

return BigUint::new(vec::from_elem(n_unit, ZERO_BIG_DIGIT)
+ self.data);
}


priv fn shl_bits(&self, n_bits: uint) -> BigUint {
fn shl_bits(&self, n_bits: uint) -> BigUint {
if n_bits == 0 || self.is_zero() { return (*self).clone(); }

let mut carry = 0;
Expand All @@ -637,7 +637,7 @@ impl BigUint {
}


priv fn shr_unit(&self, n_unit: uint) -> BigUint {
fn shr_unit(&self, n_unit: uint) -> BigUint {
if n_unit == 0 { return (*self).clone(); }
if self.data.len() < n_unit { return Zero::zero(); }
return BigUint::from_slice(
Expand All @@ -646,7 +646,7 @@ impl BigUint {
}


priv fn shr_bits(&self, n_bits: uint) -> BigUint {
fn shr_bits(&self, n_bits: uint) -> BigUint {
if n_bits == 0 || self.data.is_empty() { return (*self).clone(); }

let mut borrow = 0;
Expand All @@ -661,7 +661,7 @@ impl BigUint {

#[cfg(target_arch = "x86_64")]

priv fn get_radix_base(radix: uint) -> (uint, uint) {
fn get_radix_base(radix: uint) -> (uint, uint) {
assert!(1 < radix && radix <= 16);
match radix {
2 => (4294967296, 32),
Expand All @@ -687,7 +687,7 @@ priv fn get_radix_base(radix: uint) -> (uint, uint) {
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "mips")]

priv fn get_radix_base(radix: uint) -> (uint, uint) {
fn get_radix_base(radix: uint) -> (uint, uint) {
assert!(1 < radix && radix <= 16);
match radix {
2 => (65536, 16),
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl<'self> Stats for &'self [f64] {

// Helper function: extract a value representing the `pct` percentile of a sorted sample-set, using
// linear interpolation. If samples are not sorted, return nonsensical value.
priv fn percentile_of_sorted(sorted_samples: &[f64],
fn percentile_of_sorted(sorted_samples: &[f64],
pct: f64) -> f64 {
assert!(sorted_samples.len() != 0);
if sorted_samples.len() == 1 {
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub mod attr {
}

#[cfg(not(target_os = "win32"))]
priv fn cap_for_attr(attr: attr::Attr) -> &'static str {
fn cap_for_attr(attr: attr::Attr) -> &'static str {
match attr {
attr::Bold => "bold",
attr::Dim => "dim",
Expand Down Expand Up @@ -234,7 +234,7 @@ impl Terminal {
}
}

priv fn dim_if_necessary(&self, color: color::Color) -> color::Color {
fn dim_if_necessary(&self, color: color::Color) -> color::Color {
if color >= self.num_colors && color >= 8 && color < 16 {
color-8
} else { color }
Expand Down
12 changes: 6 additions & 6 deletions src/libextra/terminfo/parm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
}

#[deriving(Eq)]
priv struct Flags {
struct Flags {
width: uint,
precision: uint,
alternate: bool,
Expand All @@ -440,13 +440,13 @@ priv struct Flags {
}

impl Flags {
priv fn new() -> Flags {
fn new() -> Flags {
Flags{ width: 0, precision: 0, alternate: false,
left: false, sign: false, space: false }
}
}

priv enum FormatOp {
enum FormatOp {
FormatDigit,
FormatOctal,
FormatHex,
Expand All @@ -455,7 +455,7 @@ priv enum FormatOp {
}

impl FormatOp {
priv fn from_char(c: char) -> FormatOp {
fn from_char(c: char) -> FormatOp {
match c {
'd' => FormatDigit,
'o' => FormatOctal,
Expand All @@ -465,7 +465,7 @@ impl FormatOp {
_ => fail!("bad FormatOp char")
}
}
priv fn to_char(self) -> char {
fn to_char(self) -> char {
match self {
FormatDigit => 'd',
FormatOctal => 'o',
Expand All @@ -476,7 +476,7 @@ impl FormatOp {
}
}

priv fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
let mut s = match val {
Number(d) => {
match op {
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl Tm {
}
}

priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
fn match_str(s: &str, pos: uint, needle: &str) -> bool {
let mut i = pos;
for ch in needle.byte_iter() {
Expand Down Expand Up @@ -687,7 +687,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
}
}

priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
fn do_strftime(format: &str, tm: &Tm) -> ~str {
fn parse_type(ch: char, tm: &Tm) -> ~str {
//FIXME (#2350): Implement missing types.
let die = || fmt!("strftime: can't understand this format %c ", ch);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/rscope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl region_scope for MethodRscope {
pub struct type_rscope(Option<RegionParameterization>);

impl type_rscope {
priv fn replacement(&self) -> ty::Region {
fn replacement(&self) -> ty::Region {
if self.is_some() {
ty::re_bound(ty::br_self)
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/libstd/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ mod pipesy {

#[allow(non_camel_case_types)]
pub mod oneshot {
priv use std::kinds::Send;
use std::kinds::Send;
use ptr::to_mut_unsafe_ptr;

pub fn init<T: Send>() -> (server::Oneshot<T>, client::Oneshot<T>) {
Expand All @@ -341,7 +341,7 @@ mod pipesy {
#[allow(non_camel_case_types)]
pub mod client {

priv use std::kinds::Send;
use std::kinds::Send;

#[allow(non_camel_case_types)]
pub fn try_send<T: Send>(pipe: Oneshot<T>, x_0: T) ->
Expand Down Expand Up @@ -489,7 +489,7 @@ mod pipesy {

#[allow(non_camel_case_types)]
pub mod streamp {
priv use std::kinds::Send;
use std::kinds::Send;

pub fn init<T: Send>() -> (server::Open<T>, client::Open<T>) {
pub use std::pipes::HasBuffer;
Expand All @@ -501,7 +501,7 @@ mod pipesy {

#[allow(non_camel_case_types)]
pub mod client {
priv use std::kinds::Send;
use std::kinds::Send;

#[allow(non_camel_case_types)]
pub fn try_data<T: Send>(pipe: Open<T>, x_0: T) ->
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/num/strconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,9 @@ pub fn float_to_str_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Float+Round+

// Some constants for from_str_bytes_common's input validation,
// they define minimum radix values for which the character is a valid digit.
priv static DIGIT_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u;
priv static DIGIT_I_RADIX: uint = ('i' as uint) - ('a' as uint) + 11u;
priv static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
static DIGIT_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u;
static DIGIT_I_RADIX: uint = ('i' as uint) - ('a' as uint) + 11u;
static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;

/**
* Parses a byte slice as a number. This is meant to
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,14 +763,14 @@ fn with_dirp<T>(d: Option<&Path>,
}

#[cfg(windows)]
priv fn free_handle(handle: *()) {
fn free_handle(handle: *()) {
unsafe {
libc::funcs::extra::kernel32::CloseHandle(cast::transmute(handle));
}
}

#[cfg(unix)]
priv fn free_handle(_handle: *()) {
fn free_handle(_handle: *()) {
// unix has no process handle object, just a pid
}

Expand Down Expand Up @@ -825,7 +825,7 @@ pub fn process_output(prog: &str, args: &[~str]) -> ProcessOutput {
* operate on a none-existant process or, even worse, on a newer process
* with the same id.
*/
priv fn waitpid(pid: pid_t) -> int {
fn waitpid(pid: pid_t) -> int {
return waitpid_os(pid);

#[cfg(windows)]
Expand Down
20 changes: 10 additions & 10 deletions src/libstd/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ pub fn count_bytes<'b>(s: &'b str, start: uint, n: uint) -> uint {
}

// https://tools.ietf.org/html/rfc3629
priv static UTF8_CHAR_WIDTH: [u8, ..256] = [
static UTF8_CHAR_WIDTH: [u8, ..256] = [
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
Expand Down Expand Up @@ -781,15 +781,15 @@ macro_rules! utf8_acc_cont_byte(
)

// UTF-8 tags and ranges
priv static TAG_CONT_U8: u8 = 128u8;
priv static TAG_CONT: uint = 128u;
priv static MAX_ONE_B: uint = 128u;
priv static TAG_TWO_B: uint = 192u;
priv static MAX_TWO_B: uint = 2048u;
priv static TAG_THREE_B: uint = 224u;
priv static MAX_THREE_B: uint = 65536u;
priv static TAG_FOUR_B: uint = 240u;
priv static MAX_UNICODE: uint = 1114112u;
static TAG_CONT_U8: u8 = 128u8;
static TAG_CONT: uint = 128u;
static MAX_ONE_B: uint = 128u;
static TAG_TWO_B: uint = 192u;
static MAX_TWO_B: uint = 2048u;
static TAG_THREE_B: uint = 224u;
static MAX_THREE_B: uint = 65536u;
static TAG_FOUR_B: uint = 240u;
static MAX_UNICODE: uint = 1114112u;

/// Unsafe operations
pub mod raw {
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/str/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ pub fn to_ascii_lower(string: &str) -> ~str {
}

#[inline]
priv fn map_bytes(string: &str, map: &'static [u8]) -> ~str {
fn map_bytes(string: &str, map: &'static [u8]) -> ~str {
let len = string.len();
let mut result = str::with_capacity(len);
unsafe {
Expand All @@ -298,7 +298,7 @@ pub fn eq_ignore_ascii_case(a: &str, b: &str) -> bool {
|(byte_a, byte_b)| ASCII_LOWER_MAP[*byte_a] == ASCII_LOWER_MAP[*byte_b])
}

priv static ASCII_LOWER_MAP: &'static [u8] = &[
static ASCII_LOWER_MAP: &'static [u8] = &[
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
Expand Down Expand Up @@ -333,7 +333,7 @@ priv static ASCII_LOWER_MAP: &'static [u8] = &[
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
];

priv static ASCII_UPPER_MAP: &'static [u8] = &[
static ASCII_UPPER_MAP: &'static [u8] = &[
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
Expand Down
Loading