diff --git a/.travis.yml b/.travis.yml index 857d16f622..5475915c40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ cache: - target/debug/build script: + - ./.travis/readme.py - cargo build --verbose $FEATURES - cargo test --verbose $FEATURES - 'if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo bench --no-run; fi' diff --git a/.travis/readme.py b/.travis/readme.py new file mode 100755 index 0000000000..d1cf57bede --- /dev/null +++ b/.travis/readme.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import re + +f = open('README.md', 'r') +raw = f.read() + +for (i, code) in enumerate(re.findall(r'```rust([^`]*)```', raw, re.M)): + with open('examples/readme_%s.rs' % i, 'w') as f: + f.write('#![deny(warnings)]%s' % code) diff --git a/README.md b/README.md index d76fb7bc18..6c9e977b05 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ use hyper::header::Connection; fn main() { // Create a client. - let mut client = Client::new(); + let client = Client::new(); // Creating an outgoing request. let mut res = client.get("http://rust-lang.org/")