Skip to content

Commit 6599946

Browse files
committed
Auto merge of #57520 - alexreg:tidy-copyright-lint, r=Mark-Simulacrum
Add lint for copyright headers to 'tidy' tool r? @Mark-Simulacrum CC @Centril
2 parents 722b4d6 + 4d18023 commit 6599946

31 files changed

+165
-207
lines changed

src/doc/book

Submodule book updated 176 files

src/doc/reference

src/libcore/slice/memchr.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//
2-
// Original implementation taken from rust-memchr
1+
// Original implementation taken from rust-memchr.
32
// Copyright 2015 Andrew Gallant, bluss and Nicolas Koch
43

54
use cmp;
@@ -8,13 +7,13 @@ use mem;
87
const LO_U64: u64 = 0x0101010101010101;
98
const HI_U64: u64 = 0x8080808080808080;
109

11-
// use truncation
10+
// Use truncation.
1211
const LO_USIZE: usize = LO_U64 as usize;
1312
const HI_USIZE: usize = HI_U64 as usize;
1413

15-
/// Return `true` if `x` contains any zero byte.
14+
/// Returns whether `x` contains any zero byte.
1615
///
17-
/// From *Matters Computational*, J. Arndt
16+
/// From *Matters Computational*, J. Arndt:
1817
///
1918
/// "The idea is to subtract one from each of the bytes and then look for
2019
/// bytes where the borrow propagated all the way to the most significant
@@ -36,7 +35,7 @@ fn repeat_byte(b: u8) -> usize {
3635
(b as usize) * (::usize::MAX / 255)
3736
}
3837

39-
/// Return the first index matching the byte `x` in `text`.
38+
/// Returns the first index matching the byte `x` in `text`.
4039
pub fn memchr(x: u8, text: &[u8]) -> Option<usize> {
4140
// Scan for a single byte value by reading two `usize` words at a time.
4241
//
@@ -77,18 +76,18 @@ pub fn memchr(x: u8, text: &[u8]) -> Option<usize> {
7776
}
7877
}
7978

80-
// find the byte after the point the body loop stopped
79+
// Find the byte after the point the body loop stopped.
8180
text[offset..].iter().position(|elt| *elt == x).map(|i| offset + i)
8281
}
8382

84-
/// Return the last index matching the byte `x` in `text`.
83+
/// Returns the last index matching the byte `x` in `text`.
8584
pub fn memrchr(x: u8, text: &[u8]) -> Option<usize> {
8685
// Scan for a single byte value by reading two `usize` words at a time.
8786
//
88-
// Split `text` in three parts
89-
// - unaligned tail, after the last word aligned address in text
90-
// - body, scan by 2 words at a time
91-
// - the first remaining bytes, < 2 word size
87+
// Split `text` in three parts:
88+
// - unaligned tail, after the last word aligned address in text,
89+
// - body, scanned by 2 words at a time,
90+
// - the first remaining bytes, < 2 word size.
9291
let len = text.len();
9392
let ptr = text.as_ptr();
9493
type Chunk = usize;
@@ -105,7 +104,7 @@ pub fn memrchr(x: u8, text: &[u8]) -> Option<usize> {
105104
return Some(offset + index);
106105
}
107106

108-
// search the body of the text, make sure we don't cross min_aligned_offset.
107+
// Search the body of the text, make sure we don't cross min_aligned_offset.
109108
// offset is always aligned, so just testing `>` is sufficient and avoids possible
110109
// overflow.
111110
let repeated_x = repeat_byte(x);
@@ -116,7 +115,7 @@ pub fn memrchr(x: u8, text: &[u8]) -> Option<usize> {
116115
let u = *(ptr.offset(offset as isize - 2 * chunk_bytes as isize) as *const Chunk);
117116
let v = *(ptr.offset(offset as isize - chunk_bytes as isize) as *const Chunk);
118117

119-
// break if there is a matching byte
118+
// Break if there is a matching byte.
120119
let zu = contains_zero_byte(u ^ repeated_x);
121120
let zv = contains_zero_byte(v ^ repeated_x);
122121
if zu || zv {
@@ -126,6 +125,6 @@ pub fn memrchr(x: u8, text: &[u8]) -> Option<usize> {
126125
offset -= 2 * chunk_bytes;
127126
}
128127

129-
// find the byte before the point the body loop stopped
128+
// Find the byte before the point the body loop stopped.
130129
text[..offset].iter().rposition(|elt| *elt == x)
131130
}

src/libserialize/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Rust JSON serialization library
1+
// Rust JSON serialization library.
22
// Copyright (c) 2011 Google Inc.
33

44
#![forbid(non_camel_case_types)]

src/libstd/memchr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//
2-
// Original implementation taken from rust-memchr
1+
// Original implementation taken from rust-memchr.
32
// Copyright 2015 Andrew Gallant, bluss and Nicolas Koch
43

54
/// A safe interface to `memchr`.

src/libstd/sys/cloudabi/abi/cloudabi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016-2017 Nuxi (https://nuxi.nl/) and contributors.
1+
// Copyright (c) 2016-2017 Nuxi <https://nuxi.nl/> and contributors.
22
//
33
// Redistribution and use in source and binary forms, with or without
44
// modification, are permitted provided that the following conditions

src/libstd/sys/redox/memchr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//
2-
// Original implementation taken from rust-memchr
1+
// Original implementation taken from rust-memchr.
32
// Copyright 2015 Andrew Gallant, bluss and Nicolas Koch
43

54
pub use core::slice::memchr::{memchr, memrchr};

src/libstd/sys/unix/memchr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//
2-
// Original implementation taken from rust-memchr
1+
// Original implementation taken from rust-memchr.
32
// Copyright 2015 Andrew Gallant, bluss and Nicolas Koch
43

54
pub fn memchr(needle: u8, haystack: &[u8]) -> Option<usize> {

src/libstd/sys/windows/memchr.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
//
2-
// Original implementation taken from rust-memchr
1+
// Original implementation taken from rust-memchr.
32
// Copyright 2015 Andrew Gallant, bluss and Nicolas Koch
43

5-
// Fallback memchr is fastest on windows
4+
// Fallback memchr is fastest on Windows.
65
pub use core::slice::memchr::{memchr, memrchr};

src/libsyntax/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! The format of the JSON output should be considered *unstable*. For now the
88
//! structs at the end of this file (Diagnostic*) specify the error format.
99
10-
// FIXME spec the JSON output properly.
10+
// FIXME: spec the JSON output properly.
1111

1212
use source_map::{SourceMap, FilePathMapping};
1313
use syntax_pos::{self, MacroBacktrace, Span, SpanLabel, MultiSpan};

0 commit comments

Comments
 (0)