Skip to content

Commit e99eff1

Browse files
alexcrichtonemberian
authored andcommitted
Forbid priv where it has no effect
This is everywhere except struct fields and enum variants.
1 parent 8964fcc commit e99eff1

File tree

17 files changed

+81
-64
lines changed

17 files changed

+81
-64
lines changed

src/libextra/fileinput.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -129,27 +129,27 @@ struct FileInput_ {
129129
`Some(path)` is the file represented by `path`, `None` is
130130
`stdin`. Consumed as the files are read.
131131
*/
132-
priv files: ~[Option<Path>],
132+
files: ~[Option<Path>],
133133
/**
134134
The current file: `Some(r)` for an open file, `None` before
135135
starting and after reading everything.
136136
*/
137-
priv current_reader: Option<@io::Reader>,
138-
priv state: FileInputState,
137+
current_reader: Option<@io::Reader>,
138+
state: FileInputState,
139139

140140
/**
141141
Used to keep track of whether we need to insert the newline at the
142142
end of a file that is missing it, which is needed to separate the
143143
last and first lines.
144144
*/
145-
priv previous_was_newline: bool
145+
previous_was_newline: bool
146146
}
147147

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

155155
impl FileInput {
@@ -198,7 +198,7 @@ impl FileInput {
198198
FileInput::from_vec(pathed)
199199
}
200200

201-
priv fn current_file_eof(&self) -> bool {
201+
fn current_file_eof(&self) -> bool {
202202
match self.fi.current_reader {
203203
None => false,
204204
Some(r) => r.eof()
@@ -240,7 +240,7 @@ impl FileInput {
240240
Returns `true` if it had to move to the next file and did
241241
so successfully.
242242
*/
243-
priv fn next_file_if_eof(&self) -> bool {
243+
fn next_file_if_eof(&self) -> bool {
244244
match self.fi.current_reader {
245245
None => self.next_file(),
246246
Some(r) => {

src/libextra/future.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<A> Drop for Future<A> {
4646
fn drop(&self) {}
4747
}
4848

49-
priv enum FutureState<A> {
49+
enum FutureState<A> {
5050
Pending(~fn() -> A),
5151
Evaluating,
5252
Forced(A)

src/libextra/getopts.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,9 @@ pub mod groups {
708708
* Fails during iteration if the string contains a non-whitespace
709709
* sequence longer than the limit.
710710
*/
711-
priv fn each_split_within<'a>(ss: &'a str,
712-
lim: uint,
713-
it: &fn(&'a str) -> bool) -> bool {
711+
fn each_split_within<'a>(ss: &'a str,
712+
lim: uint,
713+
it: &fn(&'a str) -> bool) -> bool {
714714
// Just for fun, let's write this as an state machine:
715715

716716
enum SplitWithinState {
@@ -778,7 +778,7 @@ pub mod groups {
778778
}
779779

780780
#[test]
781-
priv fn test_split_within() {
781+
fn test_split_within() {
782782
fn t(s: &str, i: uint, u: &[~str]) {
783783
let mut v = ~[];
784784
do each_split_within(s, i) |s| { v.push(s.to_owned()); true };

src/libextra/num/bigint.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ pub mod BigDigit {
5959
pub static bits: uint = 32;
6060

6161
pub static base: uint = 1 << bits;
62-
priv static hi_mask: uint = (-1 as uint) << bits;
63-
priv static lo_mask: uint = (-1 as uint) >> bits;
62+
static hi_mask: uint = (-1 as uint) << bits;
63+
static lo_mask: uint = (-1 as uint) >> bits;
6464

6565

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

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

7070
/// Split one machine sized unsigned integer into two BigDigits.
7171
@@ -613,15 +613,15 @@ impl BigUint {
613613
}
614614

615615

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

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

623623

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

627627
let mut carry = 0;
@@ -637,7 +637,7 @@ impl BigUint {
637637
}
638638

639639

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

648648

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

652652
let mut borrow = 0;
@@ -661,7 +661,7 @@ impl BigUint {
661661

662662
#[cfg(target_arch = "x86_64")]
663663

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

690-
priv fn get_radix_base(radix: uint) -> (uint, uint) {
690+
fn get_radix_base(radix: uint) -> (uint, uint) {
691691
assert!(1 < radix && radix <= 16);
692692
match radix {
693693
2 => (65536, 16),

src/libextra/stats.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl<'self> Stats for &'self [f64] {
223223

224224
// Helper function: extract a value representing the `pct` percentile of a sorted sample-set, using
225225
// linear interpolation. If samples are not sorted, return nonsensical value.
226-
priv fn percentile_of_sorted(sorted_samples: &[f64],
226+
fn percentile_of_sorted(sorted_samples: &[f64],
227227
pct: f64) -> f64 {
228228
assert!(sorted_samples.len() != 0);
229229
if sorted_samples.len() == 1 {

src/libextra/term.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub mod attr {
7575
}
7676

7777
#[cfg(not(target_os = "win32"))]
78-
priv fn cap_for_attr(attr: attr::Attr) -> &'static str {
78+
fn cap_for_attr(attr: attr::Attr) -> &'static str {
7979
match attr {
8080
attr::Bold => "bold",
8181
attr::Dim => "dim",
@@ -234,7 +234,7 @@ impl Terminal {
234234
}
235235
}
236236

237-
priv fn dim_if_necessary(&self, color: color::Color) -> color::Color {
237+
fn dim_if_necessary(&self, color: color::Color) -> color::Color {
238238
if color >= self.num_colors && color >= 8 && color < 16 {
239239
color-8
240240
} else { color }

src/libextra/terminfo/parm.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
430430
}
431431

432432
#[deriving(Eq)]
433-
priv struct Flags {
433+
struct Flags {
434434
width: uint,
435435
precision: uint,
436436
alternate: bool,
@@ -440,13 +440,13 @@ priv struct Flags {
440440
}
441441

442442
impl Flags {
443-
priv fn new() -> Flags {
443+
fn new() -> Flags {
444444
Flags{ width: 0, precision: 0, alternate: false,
445445
left: false, sign: false, space: false }
446446
}
447447
}
448448

449-
priv enum FormatOp {
449+
enum FormatOp {
450450
FormatDigit,
451451
FormatOctal,
452452
FormatHex,
@@ -455,7 +455,7 @@ priv enum FormatOp {
455455
}
456456

457457
impl FormatOp {
458-
priv fn from_char(c: char) -> FormatOp {
458+
fn from_char(c: char) -> FormatOp {
459459
match c {
460460
'd' => FormatDigit,
461461
'o' => FormatOctal,
@@ -465,7 +465,7 @@ impl FormatOp {
465465
_ => fail!("bad FormatOp char")
466466
}
467467
}
468-
priv fn to_char(self) -> char {
468+
fn to_char(self) -> char {
469469
match self {
470470
FormatDigit => 'd',
471471
FormatOctal => 'o',
@@ -476,7 +476,7 @@ impl FormatOp {
476476
}
477477
}
478478

479-
priv fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
479+
fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
480480
let mut s = match val {
481481
Number(d) => {
482482
match op {

src/libextra/time.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl Tm {
254254
}
255255
}
256256

257-
priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
257+
fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
258258
fn match_str(s: &str, pos: uint, needle: &str) -> bool {
259259
let mut i = pos;
260260
for ch in needle.byte_iter() {
@@ -687,7 +687,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
687687
}
688688
}
689689

690-
priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
690+
fn do_strftime(format: &str, tm: &Tm) -> ~str {
691691
fn parse_type(ch: char, tm: &Tm) -> ~str {
692692
//FIXME (#2350): Implement missing types.
693693
let die = || fmt!("strftime: can't understand this format %c ", ch);

src/librustc/middle/typeck/rscope.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl region_scope for MethodRscope {
215215
pub struct type_rscope(Option<RegionParameterization>);
216216

217217
impl type_rscope {
218-
priv fn replacement(&self) -> ty::Region {
218+
fn replacement(&self) -> ty::Region {
219219
if self.is_some() {
220220
ty::re_bound(ty::br_self)
221221
} else {

src/libstd/comm.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ mod pipesy {
314314

315315
#[allow(non_camel_case_types)]
316316
pub mod oneshot {
317-
priv use std::kinds::Send;
317+
use std::kinds::Send;
318318
use ptr::to_mut_unsafe_ptr;
319319

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

344-
priv use std::kinds::Send;
344+
use std::kinds::Send;
345345

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

490490
#[allow(non_camel_case_types)]
491491
pub mod streamp {
492-
priv use std::kinds::Send;
492+
use std::kinds::Send;
493493

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

502502
#[allow(non_camel_case_types)]
503503
pub mod client {
504-
priv use std::kinds::Send;
504+
use std::kinds::Send;
505505

506506
#[allow(non_camel_case_types)]
507507
pub fn try_data<T: Send>(pipe: Open<T>, x_0: T) ->

src/libstd/num/strconv.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,9 @@ pub fn float_to_str_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Float+Round+
422422

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

429429
/**
430430
* Parses a byte slice as a number. This is meant to

src/libstd/run.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -761,14 +761,14 @@ fn with_dirp<T>(d: Option<&Path>,
761761
}
762762

763763
#[cfg(windows)]
764-
priv fn free_handle(handle: *()) {
764+
fn free_handle(handle: *()) {
765765
unsafe {
766766
libc::funcs::extra::kernel32::CloseHandle(cast::transmute(handle));
767767
}
768768
}
769769

770770
#[cfg(unix)]
771-
priv fn free_handle(_handle: *()) {
771+
fn free_handle(_handle: *()) {
772772
// unix has no process handle object, just a pid
773773
}
774774

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

829829
#[cfg(windows)]

src/libstd/str.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ pub fn count_bytes<'b>(s: &'b str, start: uint, n: uint) -> uint {
738738
}
739739

740740
// https://tools.ietf.org/html/rfc3629
741-
priv static UTF8_CHAR_WIDTH: [u8, ..256] = [
741+
static UTF8_CHAR_WIDTH: [u8, ..256] = [
742742
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
743743
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F
744744
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@@ -781,15 +781,15 @@ macro_rules! utf8_acc_cont_byte(
781781
)
782782

783783
// UTF-8 tags and ranges
784-
priv static TAG_CONT_U8: u8 = 128u8;
785-
priv static TAG_CONT: uint = 128u;
786-
priv static MAX_ONE_B: uint = 128u;
787-
priv static TAG_TWO_B: uint = 192u;
788-
priv static MAX_TWO_B: uint = 2048u;
789-
priv static TAG_THREE_B: uint = 224u;
790-
priv static MAX_THREE_B: uint = 65536u;
791-
priv static TAG_FOUR_B: uint = 240u;
792-
priv static MAX_UNICODE: uint = 1114112u;
784+
static TAG_CONT_U8: u8 = 128u8;
785+
static TAG_CONT: uint = 128u;
786+
static MAX_ONE_B: uint = 128u;
787+
static TAG_TWO_B: uint = 192u;
788+
static MAX_TWO_B: uint = 2048u;
789+
static TAG_THREE_B: uint = 224u;
790+
static MAX_THREE_B: uint = 65536u;
791+
static TAG_FOUR_B: uint = 240u;
792+
static MAX_UNICODE: uint = 1114112u;
793793

794794
/// Unsafe operations
795795
pub mod raw {

src/libstd/str/ascii.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ pub fn to_ascii_lower(string: &str) -> ~str {
274274
}
275275

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

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

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

0 commit comments

Comments
 (0)