- Feature Name: eq_statement_warning
- Start Date: 2016-12-07
- RFC PR: (leave this empty)
- Rust Issue: (leave this empty)
Warn by default when encountering a statement which only consists of an equality comparison.
pub use self::{ | |
blend_mode::BlendMode, | |
circle_shape::CircleShape, | |
color::Color, | |
convex_shape::{ConvexShape, ConvexShapePoints}, | |
custom_shape::{CustomShape, CustomShapePoints}, | |
drawable::Drawable, | |
font::{Font, FontRef, Info as FontInfo}, | |
glyph::Glyph, | |
image::Image, |
#![feature(conservative_impl_trait)] | |
fn parse<'a>(input: &'a str) -> impl 'a + Iterator<Item = (u32, u32, u32)> { | |
input.lines().map(|l| { | |
let mut words = l.split_whitespace(); | |
let mut get = || words.next().unwrap().parse().unwrap(); | |
(get(), get(), get()) | |
}) | |
} |
extern crate sdl2; | |
use sdl2::event::Event; | |
use sdl2::keyboard::Keycode; | |
use sdl2::pixels::PixelFormatEnum::RGB24; | |
use sdl2::render::TextureAccess; | |
fn main() { | |
let sdl = sdl2::init().unwrap(); | |
let video = sdl.video().unwrap(); |
use std::fs::File; | |
use std::io::prelude::*; | |
fn main() { | |
let text = { | |
let mut f = File::open("test.txt").unwrap(); | |
let mut buf = String::new(); | |
f.read_to_string(&mut buf).unwrap(); | |
buf | |
}; |
extern crate md5; | |
fn find_number<F: Fn(md5::Digest) -> bool>(key: &str, predicate: F) -> u32 { | |
for n in 0.. { | |
let s = format!("{}{}", key, n); | |
let digest = md5::compute(s.as_bytes()); | |
if predicate(digest) { | |
return n; | |
} | |
} |
#![feature(test, clone_from_slice)] | |
extern "C" { | |
fn memcpy(dest: *mut libc::c_void, src: *const libc::c_void, n: libc::size_t) -> *mut libc::c_void; | |
} | |
extern crate test; | |
extern crate libc; | |
const TEXT: &'static [u8] = |
--- iter.s 2015-05-14 21:14:02.496673255 +0200 | |
+++ while.s 2015-05-14 21:13:58.676673077 +0200 | |
@@ -1,9 +1,9 @@ | |
.text | |
- .file "iter.0.rs" | |
- .section .text._ZN4main20h5cb52da90a7daa0eeaaE,"ax",@progbits | |
+ .file "while.0.rs" | |
+ .section .text._ZN4main20hfa1625d262a55eb2eaaE,"ax",@progbits | |
.align 16, 0x90 | |
- .type _ZN4main20h5cb52da90a7daa0eeaaE,@function |
/// ```rust | |
/// use crusty_chip::{ DISPLAY_WIDTH, VirtualMachine }; | |
/// // Dump the pixels to stdout | |
/// fn dump_pixels(pixels: &[u8]) { | |
/// for (i, px) in pixels.iter().enumerate() { | |
/// match *px { | |
/// 0 => print!(" "), | |
/// _ => print!("#") | |
/// } | |
/// if i % DISPLAY_WIDTH == 0 { |
use std::io::File; | |
fn main() { | |
let args = ::std::os::args(); | |
let string = &args[1]; | |
let replace = &args[2]; | |
let path = &args[3]; | |
assert!(replace.len() == string.len()); | |
println!("Replacing`{}` with `{}` in `{}`...", string, replace, path); | |
let chars: Vec<char> = string.as_slice().chars().collect(); |