fix tests

This commit is contained in:
steveklabnik 2018-04-06 15:18:16 -04:00
parent 758a77d46c
commit 142c52f4a3
5 changed files with 29 additions and 27 deletions

View File

@ -7,7 +7,7 @@ depending on how you've configured things.
Here's a small example:
```rust
```bash
$ cat main.rs
fn main() {
let x = 5;

View File

@ -22,7 +22,7 @@ pub fn foo() {}
Compiling this file produces no warnings:
```rust
```bash
$ rustc lib.rs --crate-type=lib
$
```
@ -62,7 +62,7 @@ warning: unused variable: `x`
A 'deny' lint produces an error if you violate it. For example, this code
runs into the `exceeding_bitshifts` lint.
```rust
```rust,ignore
fn main() {
100u8 << 10;
}
@ -215,7 +215,7 @@ pub fn foo() {}
This is the maximum level for all lints. So for example, if we take our
code sample from the "deny" lint level above:
```rust
```rust,ignore
fn main() {
100u8 << 10;
}

View File

@ -336,7 +336,7 @@ This lint is deprecated and no longer used.
This lint guards against `extern crate` items that are never used. Some
example code that triggers this lint:
```rust
```rust,ignore
extern crate semver;
```
@ -359,9 +359,10 @@ code that triggers this lint:
```rust
use test::{A};
mod test {
struct A;
pub mod test {
pub struct A;
}
# fn main() {}
```
When set to 'deny', this will produce:
@ -410,7 +411,7 @@ You can call `bar()` directly, without the `foo::`.
This lint checks for the unused result of an expression in a statement. Some
example code that triggers this lint:
```rust
```rust,no_run
fn foo<T>() -> T { panic!() }
fn main() {

View File

@ -7,7 +7,7 @@ These lints are all set to the 'deny' level by default.
This lint detects that a shift exceeds the type's number of bits. Some
example code that triggers this lint:
```rust
```rust,ignore
1_i32 << 32;
```
@ -27,7 +27,7 @@ error: bitshift exceeds the type's number of bits
This lint detects type parameter default erroneously allowed in invalid location. Some
example code that triggers this lint:
```rust
```rust,ignore
fn foo<T=i32>(t: T) {}
```
@ -51,7 +51,7 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`
visibility rules, and changed the visibility of struct constructors. Some
example code that triggers this lint:
```rust
```rust,ignore
mod m {
pub struct S(u8);
@ -96,7 +96,7 @@ it into its own directory if appropriate.
This lint detects names that resolve to ambiguous glob imports. Some example
code that triggers this lint:
```rust
```rust,ignore
pub struct Foo;
mod bar {
@ -143,7 +143,7 @@ This warning can always be fixed by removing the unused pattern in the
This lint catches transmuting from `&T` to `&mut T` becuase it is undefined
behavior. Some example code that triggers this lint:
```rust
```rust,ignore
unsafe {
let y = std::mem::transmute::<&i32, &mut i32>(&5);
}
@ -168,7 +168,7 @@ Constants do not have their symbols exported, and therefore, this probably
means you meant to use a `static`, not a `const. Some example code that
triggers this lint:
```rust
```rust,ignore
#[no_mangle]
const FOO: i32 = 5;
```
@ -191,7 +191,7 @@ error: const items should never be #[no_mangle]
This lint detects incorrect parentheses. Some example code that triggers this
lint:
```rust
```rust,ignore
let x = 5 as usize();
```
@ -225,7 +225,7 @@ to be accessed in safe code. This lint now catches and denies this kind of code.
This lint detects an unknown crate type found in a `#[crate_type]` directive. Some
example code that triggers this lint:
```rust
```rust,ignore
#![crate_type="lol"]
```

View File

@ -7,7 +7,7 @@ These lints are all set to the 'warn' level by default.
This lint detects an erroneous expression while doing constant evaluation. Some
example code that triggers this lint:
```rust
```rust,ignore
let b = 200u8 + 200u8;
```
@ -413,7 +413,7 @@ impl Trait for i32 {
This lint detects when compiler plugins are used as ordinary library in
non-plugin crate. Some example code that triggers this lint:
```rust
```rust,ignore
#![feature(plugin)]
#![plugin(macro_crate_test)]
@ -425,7 +425,7 @@ extern crate macro_crate_test;
This lint detects detect private items in public interfaces not caught by the old implementation. Some
example code that triggers this lint:
```rust
```rust,ignore
pub trait Trait {
type A;
}
@ -439,6 +439,7 @@ mod foo {
type A = Z;
}
}
# fn main() {}
```
This will produce:
@ -682,7 +683,7 @@ warning: union contains a field with possibly non-trivial drop code, drop code o
This lint detects unrecognized lint attribute. Some
example code that triggers this lint:
```rust
```rust,ignore
#[allow(not_a_real_lint)]
```
@ -702,7 +703,7 @@ warning: unknown lint: `not_a_real_lint`
This lint detects detects unreachable code paths. Some example code that
triggers this lint:
```rust
```rust,no_run
panic!("we never go past here!");
let x = 5;
@ -1020,7 +1021,7 @@ As such, you won't ever trigger this lint in your code directly.
This lint detects `while true { }`. Some example code that triggers this
lint:
```rust
```rust,no_run
while true {
}