1
Fork 0

Deprecate the bytes!() macro.

Replace its usage with byte string literals, except in `bytes!()` tests.
Also add a new snapshot, to be able to use the new b"foo" syntax.

The src/etc/2014-06-rewrite-bytes-macros.py script automatically
rewrites `bytes!()` invocations into byte string literals.
Pass it filenames as arguments to generate a diff that you can inspect,
or `--apply` followed by filenames to apply the changes in place.
Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
This commit is contained in:
Simon Sapin 2014-06-18 20:25:36 +02:00 committed by Alex Crichton
parent abf7e933df
commit 108b8b6dc7
42 changed files with 497 additions and 354 deletions

View file

@ -602,7 +602,7 @@ fn mkdir(path: &Path) -> io::IoResult<()> {
// FIXME (#9639): The closure should deal with &[u8] instead of &str
fn clean_srcpath(src: &[u8], f: |&str|) {
let p = Path::new(src);
if p.as_vec() != bytes!(".") {
if p.as_vec() != b"." {
for c in p.str_components().map(|x|x.unwrap()) {
if ".." == c {
f("up");
@ -714,7 +714,7 @@ impl<'a> SourceCollector<'a> {
});
cur.push(Vec::from_slice(p.filename().expect("source has no filename"))
.append(bytes!(".html")));
.append(b".html"));
let mut w = BufferedWriter::new(try!(File::create(&cur)));
let title = format!("{} -- source", cur.filename_display());