diff options
| author | bors <bors@rust-lang.org> | 2015-01-20 23:03:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-01-20 23:03:09 +0000 |
| commit | 29bd9a06efd2f8c8a7b1102e2203cc0e6ae2dcba (patch) | |
| tree | 98824cc18b1c65ff09f383438d79ad2d0a0e2ea8 /src/etc | |
| parent | 583c5c589ed02e5b6b14a576e35e0ce68988d949 (diff) | |
| parent | 631896dc1996d239a532b0ce02d5fe886660149e (diff) | |
| download | rust-29bd9a06efd2f8c8a7b1102e2203cc0e6ae2dcba.tar.gz rust-29bd9a06efd2f8c8a7b1102e2203cc0e6ae2dcba.zip | |
Auto merge of #21439 - alexcrichton:rollup, r=alexcrichton
Continuation of https://github.com/rust-lang/rust/pull/21428
Diffstat (limited to 'src/etc')
| -rwxr-xr-x | src/etc/generate-deriving-span-tests.py | 16 | ||||
| -rw-r--r-- | src/etc/kate/rust.xml | 2 | ||||
| -rw-r--r-- | src/etc/nano/rust.nanorc | 35 | ||||
| -rw-r--r-- | src/etc/tidy.py | 20 | ||||
| -rwxr-xr-x | src/etc/unicode.py | 2 |
5 files changed, 55 insertions, 20 deletions
diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py index 1e5d5ccf339..eeb1b89472b 100755 --- a/src/etc/generate-deriving-span-tests.py +++ b/src/etc/generate-deriving-span-tests.py @@ -12,8 +12,8 @@ """ This script creates a pile of compile-fail tests check that all the -derivings have spans that point to the fields, rather than the -#[deriving(...)] line. +derives have spans that point to the fields, rather than the +#[derive(...)] line. sample usage: src/etc/generate-deriving-span-tests.py """ @@ -46,7 +46,7 @@ fn main() {{}} """ ENUM_STRING = """ -#[deriving({traits})] +#[derive({traits})] enum Enum {{ A( Error {errors} @@ -54,7 +54,7 @@ enum Enum {{ }} """ ENUM_STRUCT_VARIANT_STRING = """ -#[deriving({traits})] +#[derive({traits})] enum Enum {{ A {{ x: Error {errors} @@ -62,13 +62,13 @@ enum Enum {{ }} """ STRUCT_STRING = """ -#[deriving({traits})] +#[derive({traits})] struct Struct {{ x: Error {errors} }} """ STRUCT_TUPLE_STRING = """ -#[deriving({traits})] +#[derive({traits})] struct Struct( Error {errors} ); @@ -80,14 +80,14 @@ def create_test_case(type, trait, super_traits, number_of_errors): string = [ENUM_STRING, ENUM_STRUCT_VARIANT_STRING, STRUCT_STRING, STRUCT_TUPLE_STRING][type] all_traits = ','.join([trait] + super_traits) super_traits = ','.join(super_traits) - error_deriving = '#[deriving(%s)]' % super_traits if super_traits else '' + error_deriving = '#[derive(%s)]' % super_traits if super_traits else '' errors = '\n'.join('//~%s ERROR' % ('^' * n) for n in range(error_count)) code = string.format(traits = all_traits, errors = errors) return TEMPLATE.format(year = YEAR, error_deriving=error_deriving, code = code) def write_file(name, string): - test_file = os.path.join(TEST_DIR, 'deriving-span-%s.rs' % name) + test_file = os.path.join(TEST_DIR, 'derives-span-%s.rs' % name) # set write permission if file exists, so it can be changed if os.path.exists(test_file): diff --git a/src/etc/kate/rust.xml b/src/etc/kate/rust.xml index 925034eaa00..3ceec0f250a 100644 --- a/src/etc/kate/rust.xml +++ b/src/etc/kate/rust.xml @@ -249,7 +249,7 @@ <DetectChar char="=" attribute="Normal Text" context="#pop"/> <DetectChar char="<" attribute="Normal Text" context="#pop"/> </context> - <context attribute="String" lineEndContext="#stay" name="String"> + <context attribute="String" lineEndContext="#pop" name="String"> <LineContinue attribute="String" context="#stay"/> <DetectChar char="\" attribute="CharEscape" context="CharEscape"/> <DetectChar attribute="String" context="#pop" char="""/> diff --git a/src/etc/nano/rust.nanorc b/src/etc/nano/rust.nanorc new file mode 100644 index 00000000000..1217769096d --- /dev/null +++ b/src/etc/nano/rust.nanorc @@ -0,0 +1,35 @@ +# Nano configuration for Rust +# Copyright 2015 The Rust Project Developers. +# +# NOTE: Rules are applied in order: later rules re-colorize matching text. +syntax "rust" "\.rs" + +# function definition +color magenta "fn [a-z0-9_]+" + +# Reserved words +color yellow "\<(abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\>" + +# macros +color red "[a-z_]+!" + +# Constants +color magenta "[A-Z][A-Z_]+" + +# Traits/Enums/Structs/Types/etc. +color magenta "[A-Z][a-z]+" + +# Strings +color green "\".*\"" +color green start="\".*\\$" end=".*\"" +# NOTE: This isn't accurate but matching "#{0,} for the end of the string is too liberal +color green start="r#+\"" end="\"#+" + +# Comments +color blue "//.*" + +# Attributes +color magenta start="#!\[" end="\]" + +# Some common markers +color brightcyan "(XXX|TODO|FIXME|\?\?\?)" diff --git a/src/etc/tidy.py b/src/etc/tidy.py index 3d44c27a16e..536ab7f30b9 100644 --- a/src/etc/tidy.py +++ b/src/etc/tidy.py @@ -8,7 +8,7 @@ # option. This file may not be copied, modified, or distributed # except according to those terms. -import sys, fileinput, subprocess, re +import sys, fileinput, subprocess, re, os from licenseck import * import snapshot @@ -58,20 +58,20 @@ try: for line in fileinput.input(file_names, openhook=fileinput.hook_encoded("utf-8")): - if fileinput.filename().find("tidy.py") == -1: - if line.find(cr_flag) != -1: + if "tidy.py" not in fileinput.filename(): + if cr_flag in line: check_cr = False - if line.find(tab_flag) != -1: + if tab_flag in line: check_tab = False - if line.find(linelength_flag) != -1: + if linelength_flag in line: check_linelength = False - if line.find("TODO") != -1: + if "TODO" in line: report_err("TODO is deprecated; use FIXME") match = re.match(r'^.*/(\*|/!?)\s*XXX', line) if match: report_err("XXX is no longer necessary, use FIXME") match = re.match(r'^.*//\s*(NOTE.*)$', line) - if match: + if match and "TRAVIS" not in os.environ: m = match.group(1) if "snap" in m.lower(): report_warn(match.group(1)) @@ -86,10 +86,10 @@ try: if "SNAP" in line: report_warn("unmatched SNAP line: " + line) - if check_tab and (line.find('\t') != -1 and - fileinput.filename().find("Makefile") == -1): + if check_tab and ('\t' in line and + "Makefile" not in fileinput.filename()): report_err("tab character") - if check_cr and not autocrlf and line.find('\r') != -1: + if check_cr and not autocrlf and '\r' in line: report_err("CR character") if line.endswith(" \n") or line.endswith("\t\n"): report_err("trailing whitespace") diff --git a/src/etc/unicode.py b/src/etc/unicode.py index 63f1b3dcd44..4a0bb992fd9 100755 --- a/src/etc/unicode.py +++ b/src/etc/unicode.py @@ -392,7 +392,7 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats): use core::slice; #[allow(non_camel_case_types)] - #[deriving(Clone)] + #[derive(Clone)] pub enum GraphemeCat { """) for cat in grapheme_cats + ["Any"]: |
