commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
55ec26d4c6a07fdc845b4cd7cd8100a4f65f0d6e
src/bin/aux2bib.rs
src/bin/aux2bib.rs
#[macro_use(crate_version, crate_authors)] extern crate clap; use clap::{App, Arg}; fn main() { let matches = App::new("aux2bib") .version(crate_version!()) .author(crate_authors!(",\n")) .about("gets BibTeX keys from Inspire") ...
#[macro_use(crate_version, crate_authors)] extern crate clap; use clap::{App, Arg}; use std::fs::File; use std::io::{Read, BufReader}; fn main() { let matches = App::new("aux2bib") .version(crate_version!()) .author(crate_authors!(",\n")) ....
Add rough handling of input
Add rough handling of input Would be nice to move creation and use of reader out of the `match`.
Rust
apache-2.0
musoke/inspirer,musoke/inspirer
1ad775f5e4fb9dd70071b87b887744171cd17e63
src/xc2bit/build.rs
src/xc2bit/build.rs
use std::io::Write; fn main() { let out_dir = std::env::var("OUT_DIR").unwrap(); let destination = std::path::Path::new(&out_dir).join("reftests.rs"); let mut f = std::fs::File::create(&destination).unwrap(); let files = std::fs::read_dir("../../tests/xc2bit/reftests").unwrap(); for file in files...
use std::io::Write; fn main() { let out_dir = std::env::var("OUT_DIR").unwrap(); let destination = std::path::Path::new(&out_dir).join("reftests.rs"); let mut f = std::fs::File::create(&destination).unwrap(); let root_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); let reftests_dir = std::path...
Use CARGO_MANIFEST_DIR rather than assuming the cwd
xc2bit: Use CARGO_MANIFEST_DIR rather than assuming the cwd
Rust
lgpl-2.1
rqou/openfpga,rqou/openfpga,rqou/openfpga,azonenberg/openfpga,azonenberg/openfpga,azonenberg/openfpga,azonenberg/openfpga,rqou/openfpga,azonenberg/openfpga,rqou/openfpga
77dc2f313920abc72d0dfa2bfa0cb2929aa77b04
src/lib/rand.rs
src/lib/rand.rs
/** * Bindings the runtime's random number generator (ISAAC). */ native "rust" mod rustrt { type rctx; fn rand_new() -> rctx; fn rand_next(c: rctx) -> u32; fn rand_free(c: rctx); } type rng = obj { fn next() -> u32 ; }; fn mk_rng() -> rng { obj rt_rng(c: rustrt::rctx) { ...
/** * Bindings the runtime's random number generator (ISAAC). */ native "rust" mod rustrt { type rctx; fn rand_new() -> rctx; fn rand_next(c: rctx) -> u32; fn rand_free(c: rctx); } type rng = obj { fn next() -> u32; }; resource rand_res(c: rustrt::rctx) { rustrt::rand_free(c); } fn mk_rng() ...
Replace obj dtors with resources in stdlib and rustc
Replace obj dtors with resources in stdlib and rustc
Rust
apache-2.0
rust-lang/rand
3a188b634c0c59db4594eb59f908edc6f5f7765e
src/lib.rs
src/lib.rs
#[test] fn it_works() { }
#![feature(no_std)] #![no_std] pub unsafe fn load(address: usize) -> &'static Multiboot { let multiboot = &*(address as *const Multiboot); assert!(multiboot.has_valid_end_tag()); multiboot } #[repr(C)] pub struct Multiboot { pub total_size: u32, _reserved: u32, // tags } impl Multiboot { ...
Add basic types and a `load` function
Add basic types and a `load` function
Rust
apache-2.0
phil-opp/multiboot2-elf64
6e9a9e5b418e3023a59c3256525856c2c842a180
src/lib.rs
src/lib.rs
#![crate_id = "rust_js"] #![crate_type = "lib"] #![comment = "Rust Javascript parsing and interpretation library"] #![license = "MIT"] #![deny(deprecated_owned_vector)] #![deny(non_uppercase_statics)] #![deny(missing_doc)] #![deny(unnecessary_parens)] #![deny(unrecognized_lint)] #![deny(unreachable_code)] #![deny(unnec...
#![crate_id = "rust_js"] #![crate_type = "lib"] #![comment = "Rust Javascript parsing and interpretation library"] #![license = "MIT"] #![deny(non_uppercase_statics)] #![deny(missing_doc)] #![deny(unnecessary_parens)] #![deny(unrecognized_lint)] #![deny(unreachable_code)] #![deny(unnecessary_allocation)] #![deny(unnece...
Remove lint for managed vectors so JSON can be parsed
Remove lint for managed vectors so JSON can be parsed
Rust
mit
synlestidae/js.rs,synlestidae/js.rs,TomBebbington/js.rs,new-mind/js.rs,TomBebbington/js.rs,new-mind/js.rs
e488c1932930543ebc93a243bd87b18ecf9433a0
src/main.rs
src/main.rs
#[macro_use] extern crate error_chain; extern crate reqwest; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json as json; extern crate toml; extern crate url; mod config; mod crates_io; mod errors; mod github; mod lockfile; use std::env; use crates_io::Repository; use errors::*; quic...
#[macro_use] extern crate error_chain; extern crate reqwest; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json as json; extern crate toml; extern crate url; mod config; mod crates_io; mod errors; mod github; mod lockfile; use std::env; use crates_io::Repository; use errors::*; quic...
Print errors to stderr instead of stdout
Print errors to stderr instead of stdout
Rust
mit
woxtu/cargo-thank-you-stars
1e22b2088466eb0e19a58aefcbdaa29858af68e4
src/test/run-pass-fulldeps/roman-numerals-macro.rs
src/test/run-pass-fulldeps/roman-numerals-macro.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
Fix a test that fails when cross compiling
test: Fix a test that fails when cross compiling Hopefully unblocks a snapshot
Rust
apache-2.0
zaeleus/rust,aepsil0n/rust,mahkoh/rust,AerialX/rust-rt-minimal,TheNeikos/rust,ebfull/rust,XMPPwocky/rust,jroesch/rust,dinfuehr/rust,sae-bom/rust,reem/rust,ejjeong/rust,untitaker/rust,pelmers/rust,ebfull/rust,dwillmer/rust,victorvde/rust,reem/rust,kimroen/rust,XMPPwocky/rust,aidancully/rust,bombless/rust,emk/rust,KokaKi...
457608170301692afef2d5981c9c5f0574f157ba
src/util.rs
src/util.rs
use std::fmt::{Display, Formatter, Result as FmtResult}; /// Encode a string as xtext pub struct XText<'a>(pub &'a str); impl<'a> Display for XText<'a> { fn fmt(&self, f: &mut Formatter) -> FmtResult { let mut rest = self.0; while let Some(idx) = rest.find(|c| { c < '!' || c == '+' ||...
use std::fmt::{Display, Formatter, Result as FmtResult}; /// Encode a string as xtext pub struct XText<'a>(pub &'a str); impl<'a> Display for XText<'a> { fn fmt(&self, f: &mut Formatter) -> FmtResult { let mut rest = self.0; while let Some(idx) = rest.find(|c| { c < '!' || c == '+' ||...
Fix xtext encoder infinite loop.
Fix xtext encoder infinite loop.
Rust
mit
stephank/tokio-smtp
347ac44480c2a784a059abab589b6ef386c952b8
src/main.rs
src/main.rs
//! Muxed. A tmux project manager with no runtime dependencies. extern crate getopts; extern crate libc; use std::os; use std::io::{println}; mod help; mod arg_parse; mod creator { mod io { } } /// The main execution method. /// Uses getopts to fetch arguments and pass them to the initializer for /// inspection. /...
//! Muxed. A tmux project manager with no runtime dependencies. extern crate getopts; extern crate libc; use std::os; use std::io::{println}; mod help; mod arg_parse; mod creator { mod io { } } /// The main execution method. /// Uses getopts to fetch arguments and pass them to the initializer for /// inspection. /...
Swap the logic so version can easily be printed.
Swap the logic so version can easily be printed.
Rust
mit
brianp/muxed,brianp/muxed
053480b4e8292fe16a3271f9af568e810461d168
src/main.rs
src/main.rs
extern crate bson; extern crate mongodb; use mongodb::{Client, ThreadedClient}; use mongodb::db::ThreadedDatabase; use mongodb::coll::options::{FindOptions, CursorType}; fn main() { let client = Client::connect("localhost", 27017) .ok().expect("Failed to connect to MongoDB."); let coll = client.db("l...
extern crate bson; extern crate mongodb; use mongodb::{Client, ThreadedClient}; use mongodb::cursor::Cursor; use mongodb::db::ThreadedDatabase; use mongodb::coll::options::{FindOptions, CursorType}; struct Oplog { cursor: Cursor, } impl Iterator for Oplog { type Item = bson::Document; fn next(&mut self)...
Implement an Iterator abstraction over the oplog
Implement an Iterator abstraction over the oplog
Rust
unknown
mudge/oplog,mudge/tailspin
b41585fb8b5a1abbfb227d31e3ffcaca569f5427
src/main.rs
src/main.rs
enum Mnemonic { Add, Call, Cls, Drw, Jp, Ld, Or, Ret, Rnd, Se, Shl, Shr, Sknp, Skp, Sne, Sub, Subn, Sys, Xor, } enum Register { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, Va, Vb, Vc, Vd, Ve, Vf, Sp, Pc, I, St, Dt, } enum Token { Opcode(Mnemonic), Reg(Register), ImmAddr...
use std::fs::File; enum Mnemonic { Add, Call, Cls, Drw, Jp, Ld, Or, Ret, Rnd, Se, Shl, Shr, Sknp, Skp, Sne, Sub, Subn, Sys, Xor, } enum Register { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, Va, Vb, Vc, Vd, Ve, Vf, Sp, Pc, I, St, Dt, } enum Token { Opcode(Mnemonic), Reg(R...
Add input file field to the Stream struct
Add input file field to the Stream struct
Rust
mit
francis36012/c8asm
6f978cabd6f20dad1f2915b0d95412b61fd7a423
src/fake_extctxt.rs
src/fake_extctxt.rs
use syntax; use syntax::codemap::DUMMY_SP; use syntax::ext::base::ExtCtxt; /// Create a fake ExtCtxt to perform macro quasiquotes outside of rustc plugins pub fn with_fake_extctxt<T, F: Fn(&ExtCtxt) -> T>(f: F) -> T { let ps = syntax::parse::ParseSess::new(); let mut cx = syntax::ext::base::ExtCtxt::new(&ps, Vec:...
use syntax; use syntax::codemap::DUMMY_SP; use syntax::ext::base::ExtCtxt; use syntax::feature_gate::GatedCfg; /// Create a fake ExtCtxt to perform macro quasiquotes outside of rustc plugins pub fn with_fake_extctxt<T, F: Fn(&ExtCtxt) -> T>(f: F) -> T { let ps = syntax::parse::ParseSess::new(); let mut fg_cfg = Ve...
Add newly-required additional argument to ExtCtxt::new().
Add newly-required additional argument to ExtCtxt::new().
Rust
mit
tempbottle/rust-peg,loganmhb/rust-peg,a-wortman/rust-peg,a-wortman/rust-peg,kevinmehall/rust-peg,tempbottle/rust-peg,daramos/rust-peg,jsgf/rust-peg,loganmhb/rust-peg,kevinmehall/rust-peg,jsgf/rust-peg,daramos/rust-peg
2ce4d334b4c1317a2eb03331f748d7fdf8ca5173
.imag-documentation/src/lib.rs
.imag-documentation/src/lib.rs
#[cfg(test)] mod tests { #[test] fn it_works() { } }
//! # imag //! //! This is the _developer_ documentation for the imag personal information management suite for the //! commandline. //! //! For the user documentation, have a look //! [at the 'doc' subtree in the repository](http://git.imag-pim.org/imag/tree/doc) //! which can be compiled to HTML or PDF using [pandoc]...
Add module-documentation for the documentation crate
Add module-documentation for the documentation crate
Rust
lgpl-2.1
mario-kr/imag,matthiasbeyer/imag,mario-kr/imag,matthiasbeyer/imag
737d6e1ee57e3a4955319e422f06071abd9f9e18
src/lib.rs
src/lib.rs
//! **rosc** is an implementation of the [OSC 1.0](http://opensoundcontrol.org/spec-1_0) protocol in pure Rust. //! extern crate byteorder; extern crate regex; extern crate nom; /// Crate specific error types. mod errors; /// OSC data types, see [OSC 1.0 specification](http://opensoundcontrol.org/spec-1_0) for detail...
//! **rosc** is an implementation of the [OSC 1.0](http://opensoundcontrol.org/spec-1_0) protocol in pure Rust. //! extern crate byteorder; extern crate regex; extern crate nom; /// Crate specific error types. mod errors; /// OSC data types, see [OSC 1.0 specification](https://opensoundcontrol.stanford.edu/spec-1_0.h...
Update link to Open Sound Control 1.0 spec
Update link to Open Sound Control 1.0 spec
Rust
apache-2.0
klingtnet/rosc
1e7b6c301e7650294e2eb9befa9abec85dd598b4
src/lib.rs
src/lib.rs
//! A parser for OpenType fonts. //! //! ## Example //! //! ``` //! extern crate opentype; //! extern crate truetype; //! //! use opentype::File; //! use truetype::NamingTable; //! //! # fn main() { //! let path = "SourceSerifPro-Regular.otf"; //! # let path = "tests/fixtures/SourceSerifPro-Regular.otf"; //! let file =...
//! A parser for OpenType fonts. //! //! ## Example //! //! ``` //! extern crate opentype; //! extern crate truetype; //! //! use opentype::File; //! use truetype::NamingTable; //! //! # fn main() { //! let path = "SourceSerifPro-Regular.otf"; //! # let path = "tests/fixtures/SourceSerifPro-Regular.otf"; //! let file =...
Simplify the declaration of Result
Simplify the declaration of Result
Rust
mit
stainless-steel/opentype
879bd24d4e892da317cff1fdcece9af0765b87a9
src/lib.rs
src/lib.rs
extern crate mio; use std::io; use std::result; use std::net::{SocketAddr, ToSocketAddrs}; use mio::{EventLoop, Handler, Token}; use mio::tcp::{TcpListener, TcpStream}; #[derive(Debug)] pub struct HttpError; pub type Result<T> = result::Result<T, HttpError>; pub struct HttpConnection { tcp_stream: TcpStream, }...
extern crate mio; use std::io::Result; use std::net::{SocketAddr, ToSocketAddrs}; use mio::{EventLoop, Handler, Token}; use mio::tcp::{TcpListener, TcpStream}; pub struct HttpConnection { tcp_stream: TcpStream, } impl HttpConnection { pub fn local_addr(&self) -> Result<SocketAddr> { self.tcp_stream.l...
Use io::Error instead of custom error type
Use io::Error instead of custom error type
Rust
mit
krsnik02/rust-http,krsnik02/rust-http2
86c25a1e129f5e2191b98b51bb51487ef0134930
src/lib.rs
src/lib.rs
//! Frunk: generic functional programming toolbelt for Rust //! //! Aims to be a collection of functional programming abstractions implemented in Rust //! in effective, useful, and idiomatic ways. //! //! Here is a small taste of what Frunk has to offer: //! //! ``` //! # #[macro_use] extern crate frunk; use frunk::hli...
#![doc(html_playground_url = "https://play.rust-lang.org/")] //! Frunk: generic functional programming toolbelt for Rust //! //! Aims to be a collection of functional programming abstractions implemented in Rust //! in effective, useful, and idiomatic ways. //! //! Here is a small taste of what Frunk has to offer: //!...
Add playpen url for docs
Add playpen url for docs
Rust
mit
lloydmeta/frunk
a31dafb1ef59e0b6db8177ea321ece7d708f812d
src/lib.rs
src/lib.rs
#![crate_name = "zipWith"] #![crate_type = "lib"] use std::iter::{ Iterator, IntoIterator }; #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub struct ZipWith<A, B, C> { left: A, right: B, zipper: C } impl<A, B, C, D> Iterator for ZipWith<A, B, C> where A: ...
#![crate_name = "zipWith"] #![crate_type = "lib"] use std::iter::{ Iterator, IntoIterator }; #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] pub struct ZipWith<A, B, C> { left: A, right: B, zipper: C } impl<A, B, C, D> Iterator for ZipWith<A, B, C> where A: ...
Simplify type refinement of `IntoZipWith`
Simplify type refinement of `IntoZipWith` Extend `IntoIterator` rather than require it as a type bound.
Rust
mit
kjgorman/zipWith.rs
b0f186923e838c20cc9f4fd082e4db1ca8e96a15
tests/threadsafe.rs
tests/threadsafe.rs
extern crate ratelimit_meter; use ratelimit_meter::{GCRA, Threadsafe, Limiter, Decider, Decision}; use std::thread; #[test] fn simple_operation() { let mut lim = Limiter::new() .capacity(5) .weight(1) .build::<Threadsafe<GCRA>>() .unwrap(); assert_eq!(Decision::Yes, lim.check()...
extern crate ratelimit_meter; use ratelimit_meter::{GCRA, Threadsafe, Limiter, Decider, Decision}; use std::thread; use std::time::{Instant, Duration}; #[test] fn simple_operation() { let mut lim = Limiter::new() .capacity(5) .weight(1) .build::<Threadsafe<GCRA>>() .unwrap(); a...
Test that the threaded rate-limiter is actually doing its work
Test that the threaded rate-limiter is actually doing its work (It does! \o/)
Rust
mit
antifuchs/ratelimit_meter
8223f86dc9f48e9203ea194feac64144e073c78f
src/http/transport.rs
src/http/transport.rs
//! The module contains implementations of the transport layer functionality //! that HTTP/2 requires. It exposes APIs that allow the HTTP/2 connection to //! use the transport layer without requiring it to know which exact //! implementation they are using (i.e. a clear-text TCP connection, a TLS //! protected connect...
//! The module contains implementations of the transport layer functionality //! that HTTP/2 requires. It exposes APIs that allow the HTTP/2 connection to //! use the transport layer without requiring it to know which exact //! implementation they are using (i.e. a clear-text TCP connection, a TLS //! protected connect...
Implement the TransportStream trait for TcpStream
Implement the TransportStream trait for TcpStream This makes it possible to use the raw `TcpStream` in an HTTP/2 connection. This is valid under the HTTP/2 spec when a clear-text TCP connection is established (either through a direct connection given prior knowledge of the server's HTTP/2 capability or through an HTTP...
Rust
mit
mlalic/solicit,Galvanization/solicit,stepancheg/solicit,gwicke/solicit,jinnjuice/solicit,tempbottle/solicit
79296f7e616f46829cff2de8970d3d5a628046b2
src/structures/paging/mod.rs
src/structures/paging/mod.rs
//! Abstractions for page tables and other paging related structures. //! //! Page tables translate virtual memory “pages” to physical memory “frames”. pub use self::frame::PhysFrame; pub use self::frame_alloc::{FrameAllocator, FrameDeallocator}; #[cfg(target_arch = "x86_64")] pub use self::mapper::RecursivePageTable;...
//! Abstractions for page tables and other paging related structures. //! //! Page tables translate virtual memory “pages” to physical memory “frames”. pub use self::frame::PhysFrame; pub use self::frame_alloc::{FrameAllocator, FrameDeallocator}; #[cfg(target_arch = "x86_64")] #[doc(no_inline)] pub use self::mapper::{...
Mark paging::{MappedPageTable, RecursivePageTable} re-exports as doc(no_inline)
Mark paging::{MappedPageTable, RecursivePageTable} re-exports as doc(no_inline) Without the attribute the structs don't show up in the reexports section because their original definition is inside a private module. See https://doc.rust-lang.org/rustdoc/the-doc-attribute.html#docno_inlinedocinline
Rust
mit
phil-opp/rust-x86_64
048ab12ec24b913b01574196798236880b9b0ffe
src/subscription.rs
src/subscription.rs
use consumer::*; /// Represents a subscription to a `Stream` pub struct Subscription { closed: bool, } impl Subscription { /// Closes the `Subscription` pub fn close(mut self) { self.closed = true; } pub fn new() -> Self { Subscription { closed: false } } } impl<T> Consumer<T...
use consumer::*; /// Represents a subscription to a `Stream` pub struct Subscription; /// Represents a subscription to a `Stream` based on an action pub struct SubscriptionAction<F> { f: F, } /// Represents a subscription to a `Stream` based on a func pub struct SubscriptionFunc<F> { predicate: F, } impl<F>...
Add Subscription funct operator and remove close since it was not possible to be used correctly anyway
Add Subscription funct operator and remove close since it was not possible to be used correctly anyway
Rust
mit
danylaporte/rust-asyncplify
1c463de97e748228ed0bd018e7db05c45e2195c6
src/operation/uninstallation.rs
src/operation/uninstallation.rs
use std::error::Error; use std::fs; use std::path::Path; use package::find; use operation::selection; use paths::{ self, PathAppend }; pub fn uninstall(input: &str, base_path: &Path) -> Result<bool, String> { let package_list_dir = get!(fs::read_dir(base_path.to_path_buf().append(paths::PACKAGE_LIST_DIR)), ""); ...
use std::error::Error; use std::fs; use std::path::Path; use package::{ find, version }; use operation::selection; use paths::{ self, PathAppend }; fn uninstall_package(input: Package, base_path: &Path) -> Result<bool, String> { let installation_path = base_path.to_path_buf().append(&(paths::PACKAGE_INSTALL_DIR.t...
Split the function into two.
Split the function into two.
Rust
bsd-3-clause
hch12907/wiz
db5b64a484dbea09f1f39e0640662b50c6e934cd
src/test/rustdoc/issue-89852.rs
src/test/rustdoc/issue-89852.rs
// edition:2018 #![no_core] #![feature(no_core)] // @count issue_89852/index.html '//*[@class="macro"]' 2 // @has - '//*[@class="macro"]/@href' 'macro.repro.html' #[macro_export] macro_rules! repro { () => {}; } // @!has issue_89852/macro.repro.html '//*[@class="macro"]/@content' 'repro2' pub use crate::repro as...
// edition:2018 #![no_core] #![feature(no_core)] // @matches 'issue_89852/sidebar-items.js' '"repro"' // @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"' #[macro_export] macro_rules! repro { () => {}; } pub use crate::repro as repro2;
Rework the equivalent test to work with sidebar-items.js
Rework the equivalent test to work with sidebar-items.js
Rust
apache-2.0
aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust
a93d007cde36a3370d25e7a7bf9646f266875601
tests/test_uname.rs
tests/test_uname.rs
use common::util::*; #[test] fn test_uname_compatible() { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg("-a").run(); assert!(result.success); } #[test] fn test_uname_name() { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg("-n").run(); assert!(result.success); }
use common::util::*; #[test] fn test_uname_compatible() { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg("-a").run(); assert!(result.success); } #[test] fn test_uname_name() { let (_, mut ucmd) = at_and_ucmd!(); let result = ucmd.arg("-n").run(); assert!(result.success); } #[test...
Add a test for the -o/--operating-system flag
test(uname): Add a test for the -o/--operating-system flag
Rust
mit
uutils/coreutils,uutils/coreutils,uutils/coreutils
e341ab5d94ebe2834f272cc634be55ec7eb234c5
rebind_plugins/src/lib.rs
rebind_plugins/src/lib.rs
#![feature(rustc_private, plugin_registrar)] extern crate syntax; extern crate rustc; mod derive_action; use rustc::plugin::Registry; use syntax::parse::token::intern; use syntax::ext::base::SyntaxExtension; use derive_action::expand_derive_action_annotation; #[plugin_registrar] #[doc(hidden)] pub fn plugin_regist...
#![feature(rustc_private, plugin_registrar)] extern crate rustc; extern crate syntax; mod derive_action; use rustc::plugin::Registry; use syntax::parse::token::intern; use syntax::ext::base::SyntaxExtension; use derive_action::expand_derive_action_annotation; #[plugin_registrar] #[doc(hidden)] pub fn plugin_regist...
Reorder `extern crate` declarations to be alphabetical
Reorder `extern crate` declarations to be alphabetical
Rust
mit
burtonageo/rebind
d1066f7cc588eef67f0d32e3524294a676e9c0e5
benches/buffer_tokens.rs
benches/buffer_tokens.rs
#![feature(test)] extern crate test; extern crate scribe; use test::Bencher; use scribe::Workspace; use std::path::PathBuf; #[bench] fn bench_tokens(b: &mut Bencher) { // Create a workspace with this benchmark test as a buffer. let mut workspace = Workspace::new(PathBuf::from(".")); let path = PathBuf::f...
#![feature(test)] extern crate test; extern crate scribe; use test::Bencher; use scribe::Workspace; use std::path::PathBuf; #[bench] fn bench_tokens(b: &mut Bencher) { // Create a workspace with this benchmark test as a buffer. let mut workspace = Workspace::new(PathBuf::from(".")); let path = PathBuf::f...
Update tokens benchmark to exhaust iterator
Update tokens benchmark to exhaust iterator
Rust
mit
jmacdonald/scribe
710806cd0a20b16f66faaf35e485138c4a0091e5
src/main.rs
src/main.rs
use camera::Camera; use vector::Vector; use std::fs::File; use std::io::prelude::*; mod sphere; mod ray; mod colour; mod vector; mod camera; fn main() { let width = 640; let height = 480; let campos = Vector::new(1.0,1.0,1.0); let camlook = Vector::empty(); let camup = Vector::new(0.0, 1.0,0.0); let camera = C...
#![feature(fs,io)] use camera::Camera; use vector::Vector; use std::fs::File; use std::io::prelude::*; mod sphere; mod ray; mod colour; mod vector; mod camera; fn main() { let width = 640; let height = 480; let campos = Vector::new(1.0,1.0,1.0); let camlook = Vector::empty(); let camup = Vector::new(0.0, 1.0,0.0...
Remove warnings from using unstable fs and io
Remove warnings from using unstable fs and io
Rust
mit
faineance/rust-tracer
a7bfd1377aad2553b0b39cd92eb7fa5315f6cbf4
src/main.rs
src/main.rs
extern crate dotenv; extern crate schani_store; fn main() { dotenv::dotenv().unwrap(); let app = schani_store::StoreWebApp::new("http://127.0.0.1:9100".parse().unwrap()); app.run(); }
extern crate dotenv; extern crate schani_store; fn main() { if dotenv::dotenv().is_err() { println!("No .env found, relying solely on env vars."); } let app = schani_store::StoreWebApp::new("http://127.0.0.1:9100".parse().unwrap()); app.run(); }
Fix panic if .env is missing
Fix panic if .env is missing Signed-off-by: Christoph Wurst <7abde52c298496fa169fb750f91f213a282142af@winzerhof-wurst.at>
Rust
agpl-3.0
schani-rs/schani_store
401511e6a3457be06c9052c9b012b910d7eb31fd
src/main.rs
src/main.rs
fn main() { let home = std::env::home_dir().unwrap(); let mut sbt_jar = std::path::PathBuf::from(home); sbt_jar.push(".sbt/launchers/0.13.13/sbt-launch.jar"); let sbt_jar = sbt_jar; use std::os::unix::process::CommandExt; let err = std::process::Command::new("java") .args(&["-Xms512m", "...
use std::ffi::{OsStr, OsString}; fn exec_runner<S: AsRef<OsStr>>(args: &[S]) { use std::os::unix::process::CommandExt; let err = std::process::Command::new(&args[0]).args(&args[1..]).exec(); println!("error: {}", err); if let Some(err) = err.raw_os_error() { std::process::exit(err); } s...
Define arg groups & extract exec_runner
Define arg groups & extract exec_runner
Rust
apache-2.0
dwijnand/sbtl,dwijnand/sbtl
31fb55ab77417796b654407af456250c36b5f654
challenge_2/rust/josephpd3/tests/single_count.rs
challenge_2/rust/josephpd3/tests/single_count.rs
extern crate josephpd3; use josephpd3::*; #[test] fn lonely_hearts_club() { let v = vec!['1', '1', '2', 'a', 'b', 'b', 'b', 'c', 'c']; assert_eq!(get_lonely_items(&v), vec!['2', 'a']); }
extern crate josephpd3; use josephpd3::*; #[test] fn lonely_hearts_club() { let v = vec!['1', '1', '2', 'a', 'b', 'b', 'b', 'c', 'c']; assert_eq!(get_lonely_items(&v), vec!['2', 'a']); } #[test] fn for_never_alone() { let v = vec!['1', '1', '2', '2', 'a', 'a', 'b', 'b', 'b', 'c', 'c']; assert_eq!(get...
Add test for vector with no lonely elements
Add test for vector with no lonely elements
Rust
mit
DakRomo/2017Challenges,DakRomo/2017Challenges,mindm/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,mindm/2017Challenges,m181190/2017Challenges,mindm/2017Challenges,erocs/2017Challenges,mindm/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,mindm/2017Challenges,mindm/2017C...
c879d70414782c33c5403f65f005c4dbd433cafe
src/parser.rs
src/parser.rs
use nom::{IResult, alpha, alphanumeric}; use std::vec::Vec; use template::Chunk; fn rest(i: &[u8]) -> IResult<&[u8], &[u8]> { IResult::Done(&[], i) } named!(var_name<&[u8], Vec<u8>>, map!( recognize!( do_parse!( alpha >> many0!(alt!(alphanumeric | tag!("_")...
use nom::{IResult, alpha, alphanumeric, rest}; use std::vec::Vec; use template::Chunk; named!(var_name<&[u8], Vec<u8>>, map!( recognize!( do_parse!( alpha >> many0!(alt!(alphanumeric | tag!("_"))) >> () ) ), Vec::from ) );...
Use nom's built-in rest implementation
Use nom's built-in rest implementation
Rust
mit
artemshitov/stamp
1a124be93283524e09f7ef49196af6ee9bd451f8
examples/rust/max_array.rs
examples/rust/max_array.rs
pub fn max_array(x: &mut[int, ..65536], y: &[int, ..65536]) { for i in range(0u, 65536) { if y[i] > x[i] { x[i] = y[i]; } } }
pub fn max_array(x: &mut[i32; 65536], y: &[i32; 65536]) { for i in (0..65536) { if y[i] > x[i] { x[i] = y[i]; } } }
Fix up rust example for 1.0
Fix up rust example for 1.0
Rust
bsd-2-clause
sigma-random/gcc-explorer,dkm/gcc-explorer,ibuclaw/gcc-explorer,dkm/gcc-explorer,sigma-random/gcc-explorer,olajep/gcc-explorer,mcanthony/gcc-explorer,mattgodbolt/compiler-explorer,ibuclaw/gcc-explorer,dkm/gcc-explorer,sigma-random/gcc-explorer,olajep/gcc-explorer,sigma-random/gcc-explorer,zengyuleo/gcc-explorer,mattgod...
c5bd0dfdb585d5506a8b81da11809d51ce934d5b
src/lib.rs
src/lib.rs
//! An implementation of [FLAC](https://xiph.org/flac), free lossless audio //! codec, written in Rust. #[macro_use] extern crate nom; #[macro_use] mod utility; pub mod metadata; pub mod frame; pub mod subframe; pub mod stream; pub use metadata::Metadata; pub use frame::{frame_parser, Frame}; pub use subframe::{subf...
//! An implementation of [FLAC](https://xiph.org/flac), free lossless audio //! codec, written in Rust. #[macro_use] extern crate nom; #[macro_use] mod utility; pub mod metadata; pub mod frame; pub mod subframe; mod stream; pub use metadata::{metadata_parser, Metadata}; pub use frame::{frame_parser, Frame}; pub use ...
Fix the re-exporting of parsers
Fix the re-exporting of parsers
Rust
bsd-3-clause
sourrust/flac
5011a8fa66e9da0c74639d7ba6cf6aea3f75e713
src/lib.rs
src/lib.rs
/// # toml-query /// /// A crate to help executing queries on toml data structures inside Rust code. /// // external crates #[macro_use] extern crate error_chain; #[macro_use] extern crate is_match; #[macro_use] extern crate lazy_static; extern crate regex; extern crate toml; #[cfg(test)] #[macro_use] extern crate q...
#![recursion_limit = "1024"] // We need this for error_chain, unfortunately. /// # toml-query /// /// A crate to help executing queries on toml data structures inside Rust code. /// // external crates #[macro_use] extern crate error_chain; #[macro_use] extern crate is_match; #[macro_use] extern crate lazy_static; ex...
Add recursion_limit setting for crate
Add recursion_limit setting for crate We need more recurision for error_chain, unfortunately. Hopefully we can remove this when refactoring.
Rust
mpl-2.0
matthiasbeyer/toml-query
b7fe3e4be2fc281689a7c38d60c163c84e78d7fd
rustoleum.rs
rustoleum.rs
use std::io::{stdin, File, timer}; use std::io::buffered::BufferedReader; use std::str::{from_utf8}; fn main () { let p = Path::new("data/example.txt"); let contents = File::open(&p).read_to_end(); let mut string_iter = from_utf8(contents).split_str(" "); let mut reader = BufferedReader::new(stdin()); printl...
use std::io::{stdin, File, timer}; use std::io::buffered::BufferedReader; use std::str::{from_utf8}; use std::vec::ChunkIter; use std::vec::OwnedStr; fn main () { let p = Path::new("data/example.txt"); let contents = File::open(&p).read_to_end(); let mut string_iter = from_utf8(contents).split_str(" "); let mu...
Add first draft of multiple word display
Add first draft of multiple word display
Rust
mit
lord/rustoleum
5d6d120b8d9ea28bfb00d31d9f4f32facfb26c66
rayon-demo/src/join_microbench.rs
rayon-demo/src/join_microbench.rs
//! Some microbenchmarks that stress test a pure `join` path. use rayon; use rayon::prelude::*; use test::Bencher; #[bench] fn increment_all(b: &mut Bencher) { let mut big_vec = vec![0_usize; 100*1024]; b.iter(|| { big_vec.par_iter_mut() .for_each(|p| *p = p.wrapping_add(1)); }); } ...
//! Some microbenchmarks that stress test a pure `join` path. use rayon; use rayon::prelude::*; use test::Bencher; #[bench] fn increment_all(b: &mut Bencher) { let mut big_vec = vec![0_usize; 100*1024]; b.iter(|| { big_vec.par_iter_mut() .for_each(|p| *p = p.wrapping_add(1)); }); } ...
Add quick benchmarks of min/max len
Add quick benchmarks of min/max len
Rust
apache-2.0
cuviper/rayon,cuviper/rayon
0baa1206f82bbfebeb74169802071aab85bda3f7
exercises/hamming/tests/hamming.rs
exercises/hamming/tests/hamming.rs
extern crate hamming as dna; #[test] fn test_no_difference_between_empty_strands() { assert_eq!(dna::hamming_distance("", "").unwrap(), 0); } #[test] #[ignore] fn test_no_difference_between_identical_strands() { assert_eq!(dna::hamming_distance("GGACTGA", "GGACTGA").unwrap(), 0); } #[test] #[ignore] fn test_...
extern crate hamming as dna; #[test] fn test_no_difference_between_empty_strands() { assert_eq!(dna::hamming_distance("", "").unwrap(), 0); } #[test] #[ignore] fn test_no_difference_between_identical_strands() { assert_eq!(dna::hamming_distance("GGACTGA", "GGACTGA").unwrap(), 0); } #[test] #[ignore] fn test_...
Make error checking identical to other tests
Make error checking identical to other tests
Rust
mit
sacherjj/rust,exercism/xrust,sacherjj/rust,petertseng/exercism-rust,petertseng/exercism-rust,petertseng/exercism-rust,exercism/xrust,sacherjj/rust
783c25a1fe17270f86e86595ba90d850d2007ab5
examples/zguide/helloworld-server/main.rs
examples/zguide/helloworld-server/main.rs
#![crate_name = "helloworld-server"] #![feature(old_io, std_misc)] /// Hello World server in Rust /// Binds REP socket to tcp://*:5555 /// Expects "Hello" from client, replies with "World" extern crate zmq; use std::old_io; use std::time::Duration; fn main() { let mut context = zmq::Context::new(); let mut ...
#![crate_name = "helloworld-server"] #![feature(std_misc, thread_sleep)] /// Hello World server in Rust /// Binds REP socket to tcp://*:5555 /// Expects "Hello" from client, replies with "World" extern crate zmq; use std::thread; use std::time::Duration; fn main() { let mut context = zmq::Context::new(); le...
Use thread::sleep() in order to finally get rid of old_io
Use thread::sleep() in order to finally get rid of old_io
Rust
apache-2.0
jedisct1/rust-zmq,dginev/rust-zmq,alexkamp/rust-zmq,erickt/rust-zmq,pfernie/rust-zmq,tempbottle/rust-zmq,pblasucci/rust-zmq,petehayes102/rust-zmq
1574b3224cf6f48dedc1c991d3f81882b3c0e52e
src/lib.rs
src/lib.rs
pub fn puzzle(input: &str) -> u32 { 0 } pub fn is_a_triangle(a: u32, b: u32, c: u32) -> bool { a + b > c && b + c > a && c + a > b } #[cfg(test)] mod test { use super::*; #[test] fn equilateral_triangle() { assert!(is_a_triangle(3, 3, 3)); } #[test] fn not_a_triangle() { ...
pub fn puzzle(input: &str) -> u32 { 0 } pub fn is_a_triangle(a: u32, b: u32, c: u32) -> bool { a + b > c && b + c > a && c + a > b } #[cfg(test)] mod test { use super::*; #[test] fn equilateral_triangle() { assert!(is_a_triangle(3, 3, 3)); } #[test] fn isoceles_triangle() { ...
Add some more triangle characterization tests
Add some more triangle characterization tests
Rust
mit
carols10cents/adventofcode-rs
da8e99da02f03f586c70e7565ab2a6577c4ec55b
src/lib.rs
src/lib.rs
//! This crate currently provides pull parser for Binary FBX. //! //! FBX data consists of generic node and node properties, and it requires interpretation to use as //! 3D contents. //! It is similar to relation of XML and COLLADA. COLLADA is represented using XML, but XML DOM is //! difficult to use directly as COLLA...
//! This crate currently provides pull parser for Binary FBX. //! //! FBX data consists of generic node and node properties, and it requires interpretation to use as //! 3D contents. //! It is similar to relation of XML and COLLADA. COLLADA is represented using XML, but XML DOM is //! difficult to use directly as COLLA...
Remove a nonsence test function
Remove a nonsence test function
Rust
apache-2.0
l1048576/fbx_direct
936537ea84934469a82ce768510966fd95f7977b
test/vecs.rs
test/vecs.rs
#![feature(custom_attribute)] #![allow(dead_code, unused_attributes)] #[miri_run] fn make_vec() -> Vec<i32> { let mut v = Vec::with_capacity(4); v.push(1); v.push(2); v } #[miri_run] fn make_vec_macro() -> Vec<i32> { vec![1, 2] }
#![feature(custom_attribute)] #![allow(dead_code, unused_attributes)] #[miri_run] fn make_vec() -> Vec<i32> { let mut v = Vec::with_capacity(4); v.push(1); v.push(2); v } #[miri_run] fn make_vec_macro() -> Vec<i32> { vec![1, 2] } #[miri_run] fn vec_int_iter() -> i32 { vec![1, 2, 3, 4].into_it...
Add vec::IntoIter and fold test.
Add vec::IntoIter and fold test.
Rust
apache-2.0
aidancully/rust,tsion/miri,graydon/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,rust-lang/miri,GBGamer/rust,rust-lang/miri,GBGamer/rust,aidancully/rust,graydon/rust,rust-lang/miri,aidancully/rust,rust-lang/miri,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,...
ef77e70f289e7df6ecd8c757a80252533ae0d678
src/libuni/src/thread/mod.rs
src/libuni/src/thread/mod.rs
//! Scheduling primitives for Uni.rs.
//! Scheduling primitives for Uni.rs. use alloc::boxed::Box; use intrusive::link::Link; use intrusive::list::{Node, Owner}; const DEFAULT_STACK_SIZE: usize = 8192; pub struct Thread { t_impl: Box<ThreadImpl>, } impl Thread { pub fn spawn<F>(fun: F) -> Thread where F: Fn() -> () { Builder::new().spa...
Add definition of some thread related types
libuni: Add definition of some thread related types
Rust
mit
uni-rs/uni.rs
ebbd11f594b5214fa37b1e551fff95d9b87c41a2
src/arithmetic_mean.rs
src/arithmetic_mean.rs
// Implements http://rosettacode.org/wiki/Averages/Arithmetic_mean // The mean is not defined for an empty list, so we must return an Option fn mean(list: &[f64]) -> Option<f64> { match list.len() { 0 => None, n => { let sum = list.iter().fold(0 as f64, |acc, &x| acc + x); S...
// Implements http://rosettacode.org/wiki/Averages/Arithmetic_mean use std::iter::AdditiveIterator; // The mean is not defined for an empty list, so we must return an Option fn mean(list: &[f64]) -> Option<f64> { match list.len() { 0 => None, n => { let sum = list.iter().map(|&x| x).sum...
Use `AdditiveIterator`'s `sum()` instead of normal `fold()`.
Use `AdditiveIterator`'s `sum()` instead of normal `fold()`.
Rust
unlicense
crespyl/rust-rosetta,sakeven/rust-rosetta,crr0004/rust-rosetta,pfalabella/rust-rosetta,magum/rust-rosetta,magum/rust-rosetta,JIghtuse/rust-rosetta,Hoverbear/rust-rosetta,ghotiphud/rust-rosetta,ZoomRmc/rust-rosetta
92436805885c28cfee7cb52d2b2fe742e4c3cb4f
tests/compile-fail/getrandom.rs
tests/compile-fail/getrandom.rs
// only-linux #![feature(rustc_private)] extern crate libc; fn main() { let mut buf = [0u8; 5]; unsafe { libc::syscall(libc::SYS_getrandom, buf.as_mut_ptr() as *mut libc::c_void, 5 as libc::size_t, 0 as libc::c_uint); //~^ ERROR constant evaluation error: miri does not support random number ge...
// ignore-macos // ignore-windows #![feature(rustc_private)] extern crate libc; fn main() { let mut buf = [0u8; 5]; unsafe { libc::syscall(libc::SYS_getrandom, buf.as_mut_ptr() as *mut libc::c_void, 5 as libc::size_t, 0 as libc::c_uint); //~^ ERROR constant evaluation error: miri does not supp...
Use 'ignore-' instead of 'only-'
Use 'ignore-' instead of 'only-' Apparently 'ignore-' doesn't work with compiletest_rs
Rust
apache-2.0
rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri,tsion/miri
ad536e62bacad46f1e90705aa40d63bdc82ab978
src/tmux/mod.rs
src/tmux/mod.rs
use libc::system; use std::ffi::CString; static TMUX_NAME: &'static str = "tmux"; fn call(command: String) { let system_call = CString::new(format!("{} {}", TMUX_NAME, command)).unwrap(); unsafe { system(system_call.as_ptr()); }; } pub fn open(session_name: String) -> () { call(format!("attach -t {}", se...
use libc::system; use std::ffi::CString; static TMUX_NAME: &'static str = "tmux"; fn call(command: String) -> () { let line = format!("{} {}", TMUX_NAME, command); let system_call = CString::new(line.clone()).unwrap(); //println!("{}", line.clone()); unsafe { system(system_call.as_ptr()); }; } pub fn...
Break the single line out in to multiple.
Break the single line out in to multiple. This was strictly for debugging purposes. Having the ability to println the command being executed. In the future this will be helpful for loggin as well.
Rust
mit
brianp/muxed,brianp/muxed
6ee9cfd152c0de76fdb868b30a1e1d6ec3d9547c
benches/file.rs
benches/file.rs
// $ cargo bench --features full --bench file #![feature(rustc_private, test)] #![recursion_limit = "1024"] #![allow(clippy::missing_panics_doc, clippy::must_use_candidate)] extern crate test; #[macro_use] #[path = "../tests/macros/mod.rs"] mod macros; #[path = "../tests/common/mod.rs"] mod common; #[path = "../tes...
// $ cargo bench --features full --bench file #![feature(rustc_private, test)] #![recursion_limit = "1024"] #![allow( clippy::items_after_statements, clippy::missing_panics_doc, clippy::must_use_candidate )] extern crate test; #[macro_use] #[path = "../tests/macros/mod.rs"] mod macros; #[path = "../test...
Add a benchmark of TokenBuffer::inner_new
Add a benchmark of TokenBuffer::inner_new
Rust
apache-2.0
dtolnay/syn
592ae6b4d2b4745704dfb3ed10bbc5a60d3cacfc
src/util.rs
src/util.rs
use std::fs::remove_file; use std::process::{Command, Output}; const RUSTC_COLOR_ARGS: &[&str] = &["--color", "always"]; pub fn compile_test_cmd(filename: &str) -> Output { Command::new("rustc") .args(&["--test", filename, "-o", "temp"]) .args(RUSTC_COLOR_ARGS) .output() .expect("f...
use std::fs::remove_file; use std::process::{self, Command, Output}; const RUSTC_COLOR_ARGS: &[&str] = &["--color", "always"]; fn temp_file() -> String { format!("./temp_{}", process::id()) } pub fn compile_test_cmd(filename: &str) -> Output { Command::new("rustc") .args(&["--test", filename, "-o", &...
Add process id to temp file name
Add process id to temp file name
Rust
mit
carols10cents/rustlings,carols10cents/rustlings
6322895acb2d1a2171155736ca79ba0773663ec3
src/binlink.rs
src/binlink.rs
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unl...
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unl...
Use /usr/local/bin as default bin link dir
Use /usr/local/bin as default bin link dir On newish macs /bin is a protected driectory this change makes binlinks go into /usr/local/bin. Signed-off-by: Jon Morrow <464b701a872e97467242b8318ff1f8e7672cc0e8@chef.io>
Rust
apache-2.0
habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat
f8a5b27ca6932cb433643fbe4971cac2e6a00667
src/program.rs
src/program.rs
use command::Command; use vm::VM; pub struct Program { instructions : Vec<Command>, instruction_pointer: Option<usize>, is_seeking: bool, current_depth: u64, goal_depth: Option<u64>, } impl Program { pub fn new () -> Program { Program { instructions: Vec::new(), ...
use command::Command; use vm::VM; pub struct Program { instructions : Vec<Command>, instruction_pointer: Option<usize>, is_seeking: bool, current_depth: u64, goal_depth: Option<u64>, } impl Program { pub fn new () -> Program { Program { instructions: Vec::new(), ...
Adjust depth when jump commands are seen
Adjust depth when jump commands are seen
Rust
mit
nafarlee/thoughtfuck
4d3479291d73668e6ade66382c8dcc042afb8b3e
src/module/helpers/content.rs
src/module/helpers/content.rs
mod markdown { use pulldown_cmark::Parser; use pulldown_cmark::Event; use pulldown_cmark::Tag; pub struct MarkdownParser<'a> { text: &'a String } impl<'a> MarkdownParser<'a> { pub fn new(s: &'a String) -> MarkdownParser { MarkdownParser { text: s ...
mod markdown { use pulldown_cmark::Parser; use pulldown_cmark::Event; use pulldown_cmark::Tag; pub struct MarkdownParser<'a> { text: &'a String } impl<'a> MarkdownParser<'a> { pub fn new(s: &'a String) -> MarkdownParser { MarkdownParser { text: s ...
Refactor custom functionality in helper function
Refactor custom functionality in helper function
Rust
lgpl-2.1
mario-kr/imag,mario-kr/imag,matthiasbeyer/imag,matthiasbeyer/imag
48cad460bc664d110c013b02a21ede7612f1a8e6
src/test/ui/macros/issue-68058.rs
src/test/ui/macros/issue-68058.rs
// check-pass macro_rules! def_target { ($target: expr) => { #[target_feature(enable=$target)] unsafe fn f() { #[target_feature(enable=$target)] () } }; } def_target!("avx2"); fn main() {}
// check-pass macro_rules! foo { ($doc: expr) => { fn f() { #[doc = $doc] () } }; } foo!("doc"); fn main() {}
Fix test not to depend on environment
Fix test not to depend on environment
Rust
apache-2.0
aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust
7bad85e815346dfbfabab8179a941b6f4031ea91
src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs
src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs
// This test ensures that rustdoc does not panic on inherented associated types // that are referred to without fully-qualified syntax. #![feature(inherent_associated_types)] #![allow(incomplete_features)] pub struct Struct; impl Struct { pub type AssocTy = usize; pub const AssocConst: Self::AssocTy = 42; ...
// This test ensures that rustdoc does not panic on inherented associated types // that are referred to without fully-qualified syntax. #![feature(inherent_associated_types)] #![allow(incomplete_features)] pub struct Struct; impl Struct { pub type AssocTy = usize; pub const AssocConst: Self::AssocTy = 42; ...
Remove FIXME since there is nothing to be fixed.
Remove FIXME since there is nothing to be fixed. The errors are deduplicated when displayed to users. They only appear multiple times in UI tests.
Rust
apache-2.0
aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust
560f3d90102a3077bbeb557efb66ae202ced8af0
src/examples/zguide/weather-server/main.rs
src/examples/zguide/weather-server/main.rs
/// Weather update server /// Binds PUB socket to tcp://*:5556 and ipc://weather.ipc /// Publishes random weather updates extern crate zmq; use std::rand::Rng; fn main() { let mut context = zmq::Context::new(); let mut publisher = context.socket(zmq::PUB).unwrap(); assert!(publisher.bind("tcp://*:5556")...
/// Weather update server /// Binds PUB socket to tcp://*:5556 and ipc://weather.ipc /// Publishes random weather updates extern crate zmq; extern crate rand; use rand::Rng; fn main() { let mut context = zmq::Context::new(); let mut publisher = context.socket(zmq::PUB).unwrap(); assert!(publisher.bind("...
Use new librand in weather-server example.
Use new librand in weather-server example.
Rust
apache-2.0
dginev/rust-zmq,tempbottle/rust-zmq,pblasucci/rust-zmq,alexkamp/rust-zmq,erickt/rust-zmq,petehayes102/rust-zmq,jedisct1/rust-zmq,cristicbz/rust-zmq,pfernie/rust-zmq
971132a46bfb64e03c52d64be4f333e61c8cf9fd
examples/ssl.rs
examples/ssl.rs
extern crate tiny_http; #[cfg(not(feature = "ssl"))] fn main() { println!("This example requires the `ssl` feature to be enabled"); } #[cfg(feature = "ssl")] fn main() { use tiny_http::{Server, Response}; let server = Server::https("0.0.0.0:8000", tiny_http::SslConfig { certificate: include_bytes!("s...
extern crate tiny_http; #[cfg(not(feature = "ssl"))] fn main() { println!("This example requires the `ssl` feature to be enabled"); } #[cfg(feature = "ssl")] fn main() { use tiny_http::{Server, Response}; let server = Server::https("0.0.0.0:8000", tiny_http::SslConfig { certificate: include_bytes!("s...
Add small note about certificate in example
Add small note about certificate in example
Rust
apache-2.0
frewsxcv/tiny-http,frewsxcv/tiny-http,tiny-http/tiny-http
92f3170bf07444163a0a5929e5707b003351e317
src/wasm.rs
src/wasm.rs
#![allow(unused_variables)] #![allow(bad_style)] use std::path::Path; use std::{fs, io}; use FileTime; pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { unimplemented!() } pub fn set_symlink_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { unimple...
#![allow(unused_variables)] #![allow(bad_style)] use std::path::Path; use std::{fs, io}; use FileTime; pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { Err(io::Error::new(io::ErrorKind::Other, "Wasm not implemented")) } pub fn set_symlink_file_times(p: &Path, atime: FileTime,...
Return an Err instead of panicking
Return an Err instead of panicking
Rust
apache-2.0
alexcrichton/filetime
9673403f0580222da1d54aec39435996d2185702
src/main.rs
src/main.rs
use std::io::Write; // need it to flush stdout static PROMPT: &'static str = "> "; fn main() { // we allocate a String for the user input let mut input: String = String::new(); loop { print!("{}", PROMPT); // the print! macro line buffers and doesn't automatically flush std::io:...
use std::io; use std::io::Write; // need it to flush stdout static PROMPT: &'static str = "$ "; fn execute(cmd: &String) { println!("you entered [{}]", cmd); } fn main() { // we allocate a String for the user input let mut input: String = String::new(); loop { print!("{}", PROMPT); ...
Add error checks, change prompt, add execute fn
Add error checks, change prompt, add execute fn
Rust
mit
mossberg/relish
78568c481b094259bc62f960f5ffe92ac99c6e39
szi/src/main.rs
szi/src/main.rs
// Copyright (c) 2016, Matthew O'Connor extern crate system_zero_core; use std::io; use std::io::{BufRead, Write}; use system_zero_core::*; use system_zero_core::ast::*; const PROMPT: &'static str = "> "; fn prompt() -> () { print!("{}", PROMPT); io::stdout().flush().unwrap() } type Env = Vec<Def>; fn repl() -...
// Copyright (c) 2016, Matthew O'Connor extern crate system_zero_core; use std::io; use std::io::{BufRead, Write}; use system_zero_core::*; use system_zero_core::ast::*; const PROMPT: &'static str = "> "; fn prompt() -> () { print!("{}", PROMPT); io::stdout().flush().unwrap() } type Env = Vec<Def>; fn repl() -...
Add :env :history :quit special commands to repl.
Add :env :history :quit special commands to repl.
Rust
isc
oconnor0/system-zero
a94f684129dbf8cb4c87abe69ff45765cf24e501
src/librustc_trans/diagnostics.rs
src/librustc_trans/diagnostics.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
Add error explanation for E0515
Add error explanation for E0515
Rust
apache-2.0
GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,graydon/rust,graydon/rust
d7ae0370396cf76e3e057ec7da83504f7a7673f4
src/js_types/mod.rs
src/js_types/mod.rs
mod js_obj; mod js_type; use std::string::String; pub struct JsUndef; pub struct JsNull; pub struct JsBool(bool); pub struct JsNum(f64); pub struct JsSym(String); pub struct JsStr { text: String, } impl JsStr { const MAX_STR_LEN: u64 = 9007199254740991; // 2^53 - 1 fn new(s: &str) -> JsStr { as...
mod js_obj; mod js_type; use std::string::String; use std::vec::Vec; pub struct JsUndef; pub struct JsNull; pub struct JsBool(bool); pub struct JsNum(f64); pub struct JsSym(String); pub struct JsStr { text: String, } impl JsStr { const MAX_STR_LEN: u64 = 9007199254740991; // 2^53 - 1 fn new(s: &str) ->...
Add type alias for JsArr
Add type alias for JsArr
Rust
mit
rustoscript/french-press
fec416f9634b22add475d5f7825f3eb89d51c54c
src/rust/src/lib.rs
src/rust/src/lib.rs
extern crate libc; use std::os::raw::c_char; use libc::size_t; use libc::strncpy; #[test] fn add_i_i() { let actual_value = _add("I", "I"); assert_eq!("II", actual_value); } #[test] fn add_i_ii() { let actual_value = _add("I", "II"); assert_eq!("III", actual_value); } #[no_mangle] pub extern fn rn...
extern crate libc; use std::ffi::CStr; use std::os::raw::c_char; use libc::size_t; use libc::strncpy; #[test] fn add_i_i() { let actual_value = _add("I", "I"); assert_eq!("II", actual_value); } #[test] fn add_i_ii() { let actual_value = _add("I", "II"); assert_eq!("III", actual_value); } #[no_mang...
Fix compile errors in rust wrapper
Fix compile errors in rust wrapper
Rust
mit
ben--/kata-rnc,ben--/kata-rnc,ben--/kata-rnc
9b77956324057f73dbdaa74966610c44e4f46a93
src/repl/repl.rs
src/repl/repl.rs
use std::io; use std::io::prelude::*; use job::jobs; use agent::client; pub fn start() { let mut stdout = io::stdout(); loop { write!(&mut stdout, "builr> "); stdout.flush(); let input = &mut String::new(); match io::stdin().read_line(input) { Ok(x)=> { ...
use std::io; use std::io::prelude::*; use std::process; use job::jobs; use agent::client; pub fn start() { let mut stdout = io::stdout(); loop { write!(&mut stdout, "builr> "); stdout.flush(); let input = &mut String::new(); match io::stdin().read_line(input) { ...
Exit if quit or exit are entered on the REPL
Exit if quit or exit are entered on the REPL
Rust
mit
evadnoob/rustoleum
e8166739d469098b0a7f0d44bb30cd460dec6357
rust/test/time/inc/now_test.rs
rust/test/time/inc/now_test.rs
#[ allow( unused_imports ) ] use super::*; // tests_impls! { #[ cfg( any( feature = "chrono", feature = "time_chrono" ) ) ] #[ test ] fn basic() { use TheModule::*; // test.case( "time::now" ); let got = time::now(); assert!( got > 0 ); // test.case( "time::ms::now" ); let got1 = t...
#[ allow( unused_imports ) ] use super::*; // tests_impls! { #[ cfg( any( feature = "chrono", feature = "time_chrono" ) ) ] fn basic() { use TheModule::*; // test.case( "time::now" ); let got = time::now(); a_true!( got > 0 ); // test.case( "time::ms::now" ); let got1 = time::now(); ...
Fix tests of module `time_tools`, add time delta to test checks
Fix tests of module `time_tools`, add time delta to test checks
Rust
mit
Wandalen/wTools,Wandalen/wTools
ac87f8153a4958b9fca9299c5c030a5b43135b1e
tests/video.rs
tests/video.rs
extern crate sdl2; #[test] fn display_name_no_segfault() { let sdl_context = sdl2::init().unwrap(); let video_subsystem = sdl_context.video().unwrap(); // hopefully no one has a 100 screen to see this test pass let r = video_subsystem.display_name(99); assert!(r.is_err()); }
extern crate sdl2; #[test] fn display_name_no_segfault() { let sdl_context = sdl2::init().unwrap(); let video_subsystem = sdl_context.video(); match video_subsystem { Ok(video_subsystem) => { // hopefully no one has a 100 screen to see this test pass let r = video_subsystem....
Fix travis with new display_name test
Fix travis with new display_name test
Rust
mit
Rust-SDL2/rust-sdl2,Cobrand/rust-sdl2,Rust-SDL2/rust-sdl2,Cobrand/rust-sdl2,Cobrand/rust-sdl2,AngryLawyer/rust-sdl2,Rust-SDL2/rust-sdl2
06f15e9cff03e784120a113c249cbf8a9f25723a
tests/compile-fail/complex_binop.rs
tests/compile-fail/complex_binop.rs
#![feature(plugin)] #![plugin(eq_op)] #[deny(eq_op)] fn main() { //((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); // does not work with compiletest yet due to multiple errors (1 + 2) * 3 - 5 < 3 * (2 + 1) - 5; //~ERROR }
#![feature(plugin)] #![plugin(eq_op)] #[deny(eq_op)] fn main() { ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1)); //~^ ERROR //~^^ ERROR //~^^^ ERROR (1 + 2) * 3 - 5 < 3 * (2 + 1) - 5; //~ERROR }
Use multi-error compiletest (thanks to laumann)
Use multi-error compiletest (thanks to laumann)
Rust
mit
llogiq/extra_lints
75c663a8aa85c636145d436eead80c48cfad0115
blog/src/lib.rs
blog/src/lib.rs
pub struct Post { state: Option<Box<State>>, content: String } impl Post { pub fn new() -> Post { Post { state: Some(Box::new(Draft {})), content: String::new() } } pub fn add_text(&mut self, text: &str) { self.content.push_str(text); } pub ...
pub struct Post { state: Option<Box<State>>, content: String } impl Post { pub fn new() -> Post { Post { state: Some(Box::new(Draft {})), content: String::new() } } pub fn add_text(&mut self, text: &str) { self.content.push_str(text); } pub ...
Implement method approve on post
Implement method approve on post
Rust
mit
pgrzesik/learning-rust
42e09b612189f0a0edfdb9b60eb09a543147eb7b
build.rs
build.rs
extern crate cheddar; fn main() { // Generate mp4parse.h. cheddar::Cheddar::new().expect("could not read manifest") .module("capi").expect("invalid module path") .insert_code("// This Source Code Form is subject to the terms of the Mozilla Public\n") .insert_code("// License, v. 2.0. If...
extern crate cheddar; fn main() { // Generate mp4parse.h. cheddar::Cheddar::new().expect("could not read manifest") .module("capi").expect("invalid module path") .insert_code("// THIS FILE IS AUTOGENERATED BY mp4parse-rust/build.rs - DO NOT EDIT\n\n") .insert_code("// This Source Code F...
Add warning about hand-editing mp4parse.h.
Add warning about hand-editing mp4parse.h.
Rust
mpl-2.0
kinetiknz/mp4parse-rust,mozilla/mp4parse-rust,kinetiknz/mp4parse-rust
79ad0fe2839bc5488917c95d57aba3500eff8a6e
scene.rs
scene.rs
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at ...
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at ...
Remove the unused Scene::set_transform method
Remove the unused Scene::set_transform method
Rust
apache-2.0
mrobinson/rust-layers,glennw/rust-layers
a06b8e1eb33a0b9b1bc66bd10005f2f41837b57c
src/lib.rs
src/lib.rs
#![cfg(any(target_arch="x86", target_arch="x86_64"))] #![no_std] #![crate_name="cpu"] #![crate_type="rlib"] #![feature(asm)] #[allow(unstable)] #[macro_use] extern crate core; pub use cpu::*; #[macro_use] mod bitflags; #[cfg(target_arch="x86")] #[path = "x86.rs"] mod cpu; #[cfg(target_arch="x86_64")] #[path = "x86...
#![cfg(any(target_arch="x86", target_arch="x86_64"))] #![no_std] #![crate_name="cpu"] #![crate_type="rlib"] #![feature(asm)] #[allow(unstable)] #[macro_use] extern crate core; pub use cpu::*; #[macro_use] mod bitflags; #[cfg(target_arch="x86")] #[path = "x86.rs"] mod cpu; #[cfg(target_arch="x86_64")] #[path = "x86...
Use a simpler way to create the faux-std module
Use a simpler way to create the faux-std module
Rust
mit
Tobba/libcpu,rexlunae/redox,rexlunae/redox,phil-opp/rust-x86_64,gz/rust-x86,rexlunae/redox,gz/rust-x86,RustOS-Fork-Holding-Ground/libcpu
e39de3416f2c5cdaaf8ac30a1a5e935228917ec0
src/plugin/ss_plugin.rs
src/plugin/ss_plugin.rs
use super::{PluginConfig, PluginMode}; use crate::config::ServerAddr; use log::trace; use std::{net::SocketAddr, process::Stdio}; use tokio::process::Command; pub fn plugin_cmd(plugin: &PluginConfig, remote: &ServerAddr, local: &SocketAddr, _mode: PluginMode) -> Command { trace!( "Starting plugin \"{}\", o...
use super::{PluginConfig, PluginMode}; use crate::config::ServerAddr; use log::trace; use std::{net::SocketAddr, process::Stdio}; use tokio::process::Command; pub fn plugin_cmd(plugin: &PluginConfig, remote: &ServerAddr, local: &SocketAddr, _mode: PluginMode) -> Command { trace!( "Starting plugin \"{}\", o...
Remove the VPN option hack
Remove the VPN option hack
Rust
mit
shadowsocks/shadowsocks-rust,shadowsocks/shadowsocks-rust,zonyitoo/shadowsocks-rust,shadowsocks/shadowsocks-rust,shadowsocks/shadowsocks-rust
aa17e4d3df4c363a9389ae4c5ad4ea34044e0227
src/bin/main.rs
src/bin/main.rs
extern crate exa; use exa::Exa; use std::env::args_os; use std::io::{stdout, stderr, Write, ErrorKind}; use std::process::exit; fn main() { let args = args_os().skip(1); match Exa::new(args, &mut stdout()) { Ok(mut exa) => { match exa.run() { Ok(exit_status) => exit(exit_st...
extern crate exa; use exa::Exa; use std::env::args_os; use std::io::{stdout, stderr, Write, ErrorKind}; use std::process::exit; fn main() { let args = args_os().skip(1); match Exa::new(args, &mut stdout()) { Ok(mut exa) => { match exa.run() { Ok(exit_status) => exit(exit_s...
Make a common module of exit statuses
Make a common module of exit statuses
Rust
mit
ogham/exa,ogham/exa
9d8d80bd811811067c6bae4f13cbdea152550887
syntax/mangle.rs
syntax/mangle.rs
use crate::syntax::namespace::Namespace; use crate::syntax::ExternFn; pub fn extern_fn(namespace: &Namespace, efn: &ExternFn) -> String { let receiver_type = match &efn.receiver { Some(receiver) => receiver.ident.to_string(), None => "_".to_string(), }; format!("{}cxxbridge02${}${}", namesp...
use crate::syntax::namespace::Namespace; use crate::syntax::ExternFn; pub fn extern_fn(namespace: &Namespace, efn: &ExternFn) -> String { let receiver = match &efn.receiver { Some(receiver) => receiver.ident.to_string() + "$", None => String::new(), }; format!("{}cxxbridge02${}{}", namespac...
Remove '_' segment from symbol of non-associated functions
Remove '_' segment from symbol of non-associated functions
Rust
apache-2.0
dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx
137fb7171664b486fc91ed8fa24f23e18d81ed9d
src/http/app.rs
src/http/app.rs
use std::path::PathBuf; use std::process::Child; use std::process::Command; pub struct App { pub name: String, pub port: u16, #[allow(dead_code)] process: Child, } impl App { pub fn new(name: &str, port: u16, app_home: &str) -> App { let mut path_buf = PathBuf::from(app_home); path...
use std::path::PathBuf; use std::process::Child; use std::process::Command; pub struct App { pub port: u16, #[allow(dead_code)] process: Child, } impl App { pub fn new(name: &str, port: u16, app_home: &str) -> App { let mut path_buf = PathBuf::from(app_home); path_buf.push(&name); ...
Remove unused App struct field
refactor: Remove unused App struct field
Rust
mit
juanibiapina/zas,juanibiapina/zas,juanibiapina/zas
61af13fb9f43f31b6455cf29beecd98ac7b2048f
src/bin/rustpn.rs
src/bin/rustpn.rs
extern crate rustpn; use rustpn::parse; use rustpn::vm::Vm; use std::io::{stdin, BufRead}; fn main() { let mut vm = Vm::<i64>::new_with_builtins(); let stdin = stdin(); for program in stdin.lock().lines() { let program = program.unwrap(); match parse::parse(&*program) { Ok(ref ...
extern crate rustpn; extern crate num; use rustpn::parse; use rustpn::vm::Vm; use std::io::{stdin, BufRead}; use num::bigint::BigInt; fn main() { let mut vm = Vm::<BigInt>::new_with_builtins(); let stdin = stdin(); for program in stdin.lock().lines() { let program = program.unwrap(); match...
Switch to BigInt in example binary
Switch to BigInt in example binary
Rust
unlicense
scott-linder/rustpn
e89f9a83b4c55ac20ee6d1dd1a7deef3599b3e9d
src/quickcheck.rs
src/quickcheck.rs
extern crate quickcheck; use self::quickcheck::{Gen, Arbitrary}; use { Graph, EdgeType, }; use graph::{ IndexType, }; impl<N, E, Ty, Ix> Arbitrary for Graph<N, E, Ty, Ix> where N: Arbitrary, E: Arbitrary, Ty: EdgeType + Send + 'static, Ix: IndexType + Send, { fn arbi...
extern crate quickcheck; use self::quickcheck::{Gen, Arbitrary}; use { Graph, EdgeType, }; use graph::{ IndexType, }; /// `Arbitrary` for `Graph` creates a graph by selecting a node count /// and a probability for each possible edge to exist. /// /// The result will be simple graph or digraph, with possi...
Add doc for Arbitrary impl
Add doc for Arbitrary impl
Rust
apache-2.0
bluss/petulant-avenger-graphlibrary,petgraph/petgraph,Kha/petulant-avenger-graphlibrary
592f19bcddfb1814ba37213472c98a6912e93a9f
seahash/benches/gigabyte.rs
seahash/benches/gigabyte.rs
#![feature(test)] extern crate test; extern crate seahash; #[bench] fn gigabyte(b: &mut test::Bencher) { b.iter(|| { let mut x = 0; let mut buf = [15; 4096]; for _ in 0..250000 { x ^= seahash::hash(&buf); buf[x as usize % 4096] += 1; } x }) }
#![feature(test)] extern crate test; extern crate seahash; #[bench] fn gigabyte(b: &mut test::Bencher) { b.iter(|| { let mut x = 0; let mut buf = [15; 4096]; for _ in 0..250000 { x ^= seahash::hash(&buf); buf[0] += buf[0].wrapping_add(1); } x }...
Make the benchmarking cheaper (more accurate).
Make the benchmarking cheaper (more accurate).
Rust
mit
ticki/tfs,redox-os/tfs
fdd60b2d75006ab63530182f120e63f1f9b4eb89
src/buffer/position.rs
src/buffer/position.rs
pub struct Position { pub line: u64, pub offset: u64, }
#[derive(Copy, Clone)] pub struct Position { pub line: u64, pub offset: u64, }
Implement Copy and Clone traits for Position.
Implement Copy and Clone traits for Position.
Rust
mit
jmacdonald/scribe
45748a3be4275258ada5ca23b09c6b2f0122ca3f
src/lib/box.rs
src/lib/box.rs
export ptr_eq; native "rust" mod rustrt { fn rust_ptr_eq[T](@T a, @T b) -> int; } fn ptr_eq[T](@T a, @T b) -> bool { ret rustrt::rust_ptr_eq[T](a, b) != 0; }
export ptr_eq; fn ptr_eq[T](&@T a, &@T b) -> bool { let uint a_ptr = unsafe::reinterpret_cast(a); let uint b_ptr = unsafe::reinterpret_cast(b); ret a_ptr == b_ptr; }
Implement ptr_eq in Rust. Shaves 4 s off compile time.
rustc: Implement ptr_eq in Rust. Shaves 4 s off compile time.
Rust
apache-2.0
KokaKiwi/rust,krzysz00/rust,krzysz00/rust,zubron/rust,richo/rust,AerialX/rust-rt-minimal,sae-bom/rust,emk/rust,pythonesque/rust,pshc/rust,avdi/rust,mvdnes/rust,untitaker/rust,l0kod/rust,cllns/rust,rprichard/rust,seanrivera/rust,omasanori/rust,philyoon/rust,nham/rust,ebfull/rand,jbclements/rust,nwin/rust,mdinger/rust,kr...
13c35f4ddba9ffbee5c3c522727f0ebe93f42cdb
src/program.rs
src/program.rs
use color::Color; pub struct Program { image: Vec<Vec<Color>>, } impl Program { pub fn get(coords: (usize, usize)) -> Option<Color> { unimplemented!(); } pub fn neighbors(coords: (usize, usize)) -> &[Color] { unimplemented!(); } pub fn neighbors_with_coords(coords: (usize, us...
use color::Color; pub struct Program { image: Vec<Vec<Color>>, } impl Program { pub fn get(&self, coords: (usize, usize)) -> Option<Color> { unimplemented!(); } pub fn neighbors(&self, coords: (usize, usize)) -> &[Color] { unimplemented!(); } pub fn neighbors_with_coords(&sel...
Add missing `&self` parameters to `Program` methods
Add missing `&self` parameters to `Program` methods D'oh.
Rust
mit
ijks/piet-rs
13f672cb8efc7da228e77e8a4515dcd65b34b771
src/build.rs
src/build.rs
use std::{fmt::format, path::PathBuf}; use json5; use crate::config::Config; pub fn build(in_dir: PathBuf) -> Result<(), String> { let data_file = in_dir.join("_data/config.json5"); let data = std::fs::read_to_string(&data_file) .map_err(|e| format!("could not read '{}'\n{}", &data_file.to_string_los...
use std::path::PathBuf; use json5; use crate::config::Config; pub fn build(in_dir: PathBuf) -> Result<(), String> { let data_file = in_dir.join("_data/config.json5"); let data = std::fs::read_to_string(&data_file) .map_err(|e| format!("could not read '{}'\n{}", &data_file.to_string_lossy(), e))?; ...
Load all Markdown contents from file system
Load all Markdown contents from file system
Rust
mit
chriskrycho/lightning-rs,chriskrycho/lightning-rs
80b723cb4b647d301260a91f51bb20fb715805ae
src/prob5.rs
src/prob5.rs
use common::math::lcm; /// Returns the smallest number than can divided by all numbers between one and `target` fn smallest_multiple(target: uint) -> uint { range(1, target).fold(1, |a, b| { lcm(a, b) }) } #[cfg(test)] mod test { use super::smallest_multiple; #[test] fn provided_example() { a...
use common::math::lcm; /// Returns the smallest number than can divided by all numbers between one and `target` fn smallest_multiple(target: uint) -> uint { range(1, target).fold(1, |a, b| { lcm(a, b) }) } #[cfg(test)] mod test { extern crate test; use super::smallest_multiple; use self::test::Benche...
Add benchmark for problem 5
Add benchmark for problem 5
Rust
mit
niax/euler-rust
724fb86c9d70369eef1a9a84f78354495c436115
src/system/tww.rs
src/system/tww.rs
use Addr; use std::mem::transmute; use system::memory::{read, write}; pub fn random() -> f64 { let random = unsafe { transmute::<Addr, extern "C" fn() -> f64>(0x80243b40) }; random() } pub fn cdyl_init_async() { let cdyl_init_async = unsafe { transmute::<Addr, extern "C" fn()>(0x80022A88) }; cdyl_init...
use Addr; use std::mem::transmute; use system::memory::{read, write}; pub fn random() -> f64 { let random = unsafe { transmute::<Addr, extern "C" fn() -> f64>(0x80243b40) }; random() } pub fn cdyl_init_async() { let cdyl_init_async = unsafe { transmute::<Addr, extern "C" fn()>(0x80022A88) }; cdyl_init...
Add wrapper function for Rupee Init method
Add wrapper function for Rupee Init method
Rust
mit
CryZe/libtww,CryZe/libtww,CryZe/libtww,CryZe/libtww,CryZe/libtww,CryZe/libtww
04e32c7ab09920be8406e33581ba483e9c322409
components/script/dom/bindings/num.rs
components/script/dom/bindings/num.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! The `Finite<T>` struct. use core::nonzero::Zeroable; use num::Float; use std::ops::Deref; /// Encapsulates t...
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! The `Finite<T>` struct. use num::Float; use std::ops::Deref; /// Encapsulates the IDL restricted float type....
Remove the Zeroable definition for Finite<T>.
Remove the Zeroable definition for Finite<T>. I have no idea why it was added, and it appears to be unused.
Rust
mpl-2.0
eddyb/servo,SimonSapin/servo,mbrubeck/servo,DominoTree/servo,peterjoel/servo,ConnorGBrewster/servo,nnethercote/servo,DominoTree/servo,saneyuki/servo,larsbergstrom/servo,rnestler/servo,dsandeephegde/servo,dsandeephegde/servo,canaltinova/servo,dsandeephegde/servo,cbrewster/servo,cbrewster/servo,SimonSapin/servo,notriddle...
721035f467be745761df0d2d3c6068eb1f7b673c
lib.rs
lib.rs
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at ...
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at ...
Update to current rust: import the logging macros.
Update to current rust: import the logging macros.
Rust
apache-2.0
mbrubeck/rust-geom,ruud-v-a/rust-geom,servo/rust-geom
33d56ca9d1c8d6c3fdb791d8e0b8093ef88c2a9d
tests/test_path.rs
tests/test_path.rs
use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree}; use std::iter::FromIterator; use syn::{Expr, Type}; #[test] fn parse_interpolated_leading_component() { // mimics the token stream corresponding to `$mod::rest` let tokens = TokenStream::from_iter(vec![ TokenTree:...
#[macro_use] mod macros; use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree}; use std::iter::FromIterator; use syn::{Expr, Type}; #[test] fn parse_interpolated_leading_component() { // mimics the token stream corresponding to `$mod::rest` let tokens = TokenStream::from_ite...
Add snapshot tests for interpolated leading component
Add snapshot tests for interpolated leading component
Rust
apache-2.0
dtolnay/syn
33a96c201871c2b33dc211f3dd1660850592825f
src/lib.rs
src/lib.rs
#[macro_use] extern crate solicit; extern crate rustc_serialize; extern crate time; extern crate openssl; pub mod provider; pub mod notification; pub mod payload; pub mod device_token; pub mod response; pub use provider::{Provider, AsyncResponse}; pub use notification::{Notification, NotificationOptions}; pub use pay...
#[macro_use] extern crate solicit; extern crate rustc_serialize; extern crate time; extern crate openssl; pub mod provider; pub mod notification; pub mod payload; pub mod device_token; pub mod response; pub use provider::{Provider, AsyncResponse}; pub use notification::{Notification, NotificationOptions}; pub use pay...
Make APNSError and APNSStatus public
Make APNSError and APNSStatus public
Rust
mit
pimeys/apns2,pimeys/apns2,tkabit/apns2,polyitan/apns2
0cc206726550c06796f86f27a98d5671d7bd41a8
src/lib.rs
src/lib.rs
#[macro_use] extern crate bitflags; extern crate gl as gl_lib; #[cfg(feature = "cgmath")] extern crate cgmath as cgmath_lib; #[cfg(feature = "image")] extern crate image as image_lib; mod ref_into; #[macro_use] mod macros; mod context; mod buffer; mod shader; mod program; mod framebuffer; mod renderbuffer; mod textur...
#[macro_use] extern crate bitflags; extern crate gl as gl_lib; #[cfg(feature = "cgmath")] extern crate cgmath as cgmath_lib; #[cfg(feature = "image")] extern crate image as image_lib; mod ref_into; #[macro_use] mod macros; mod context; mod buffer; mod shader; mod program; mod framebuffer; mod renderbuffer; mod textur...
Add `BufferContext` traits to the prelude module
Add `BufferContext` traits to the prelude module
Rust
apache-2.0
kylewlacy/glitter,kylewlacy/glitter
4709e67bfdf68ebd20a2d349c09e68f4ee523a3e
src/lib.rs
src/lib.rs
mod evaluation; pub use self::evaluation::*; pub mod species; mod types; pub use self::types::*;
mod evaluation; pub use self::evaluation::*; pub mod species; pub use species::PokeSpecies; mod types; pub use self::types::*;
Make PokeSpecies a top-level export
Make PokeSpecies a top-level export
Rust
mit
adamhammes/pokemon_go_data,adamhammes/pokemon_go_data,adamhammes/pokemon_go_data
2a5d5b63f9ae9e588b217971d2debe276619c841
diesel_compile_tests/tests/compile-fail/cannot_mix_aggregate_and_non_aggregate_selects.rs
diesel_compile_tests/tests/compile-fail/cannot_mix_aggregate_and_non_aggregate_selects.rs
#[macro_use] extern crate diesel; use diesel::*; use diesel::dsl::count_star; table! { users { id -> Integer, } } fn main() { use self::users::dsl::*; let source = users.select((id, count_star())); //~^ ERROR MixedAggregates }
#[macro_use] extern crate diesel; use diesel::dsl::count_star; use diesel::sql_types::{Integer, Nullable}; use diesel::*; table! { users { id -> Integer, nullable_int_col -> Nullable<Integer>, } } sql_function!(fn f(x: Nullable<Integer>, y: Nullable<Integer>) -> Nullable<Integer>); fn main()...
Add a few more compile fail tests for mixed selects
Add a few more compile fail tests for mixed selects Just adds the test cases from #1586 to our compile test suite to verify that the `ValidGrouping<G>` rewrite fixed those issues. Closes #1586
Rust
apache-2.0
sgrif/diesel,diesel-rs/diesel,diesel-rs/diesel,sgrif/diesel
74dd4dcc2ca9f8ef3185341bf6ea66c08e8e84f1
extractor/build.rs
extractor/build.rs
use std::path::PathBuf; fn main() { let dir: PathBuf = ["../tree-sitter-ruby", "src"].iter().collect(); let mut build = cc::Build::new(); build .include(&dir) .file(&dir.join("parser.c")) .file(&dir.join("scanner.cc")); if !cfg!(windows) { build.cpp(true).compiler("clang...
use std::path::PathBuf; fn main() { let src_dir: PathBuf = ["..", "tree-sitter-ruby", "src"].iter().collect(); let mut c_config = cc::Build::new(); c_config.include(&src_dir); c_config .flag_if_supported("-Wno-unused-parameter") .flag_if_supported("-Wno-unused-but-set-variable") ...
Build parser.c and scanner.cc separately
Build parser.c and scanner.cc separately
Rust
mit
github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql
44b34e29a724adfd09482d0e7b2fe04bdf7e014a
src/main.rs
src/main.rs
mod domain; use std::fs::File; use std::io::prelude::*; use chrono::prelude::*; use clap::{App, Arg}; use dotenv::dotenv; use serde_derive::{Deserialize, Serialize}; use self::domain::{ Entry, EntryId, EntryKind, Project, ProjectHeadwayEntry, ProjectId, ProjectStatus, }; #[derive(Serialize, Deserialize)] pub st...
#[macro_use] extern crate clap; mod domain; use std::fs::File; use std::io::prelude::*; use chrono::prelude::*; use clap::{App, Arg}; use dotenv::dotenv; use serde_derive::{Deserialize, Serialize}; use self::domain::{ Entry, EntryId, EntryKind, Project, ProjectHeadwayEntry, ProjectId, ProjectStatus, }; #[deriv...
Use crate version and author
Use crate version and author
Rust
mit
maxdeviant/scribe
cbf7dce7ceecc45c08c438b906afae12cc5f8a69
src/main.rs
src/main.rs
use std::env; extern crate shaman; extern crate libc; extern crate nix; extern crate rand; extern crate rustc_serialize; extern crate env_logger; extern crate argparse; extern crate quire; extern crate time; extern crate unshare; extern crate signal; #[macro_use] extern crate log; #[macro_use] extern crate quick_error...
use std::env; extern crate shaman; extern crate libc; extern crate nix; extern crate rand; extern crate rustc_serialize; extern crate env_logger; extern crate argparse; extern crate quire; extern crate time; extern crate unshare; extern crate signal; #[macro_use] extern crate log; #[macro_use] extern crate quick_error...
Set `warn` log level by default
Set `warn` log level by default
Rust
mit
tailhook/vagga,popravich/vagga,popravich/vagga,rrader/vagga,popravich/vagga,popravich/vagga,rrader/vagga,tailhook/vagga,tailhook/vagga,rrader/vagga,tailhook/vagga
0e5cd25c1d231c231e7a428c6058daaaa74cdf83
src/main.rs
src/main.rs
use std::io::{Write, BufWriter}; use std::fs::File; mod vector; use vector::Vec3; fn main() { let v = Vec3 { i: 200f64, j: 200f64, k: 255f64 }; let nx = 200; let ny = 200; let data = format!("{}\n{} {}\n{}\n", "P3", v.i, v.j, v.k); let f = File::create("target/image.ppm").expect("Unable to create file"); l...
use std::io::{Write, BufWriter}; use std::fs::File; mod vector; use vector::Vec3; fn main() { let nx = 300; let ny = 200; let data = format!("{}\n{} {}\n{}\n", "P3", nx, ny, 255); let f = File::create("target/image.ppm").expect("Unable to create file"); let mut f = BufWriter::new(f); f.write_all(data.as_by...
Remove vector used for testing
Remove vector used for testing
Rust
mit
corragon/rust-raytracer
4a4df29d6fa12c303e3991f0e0e3677342c4787c
src/test/ui/issues/issue-23477.rs
src/test/ui/issues/issue-23477.rs
// build-pass // compile-flags: -g pub struct Dst { pub a: (), pub b: (), pub data: [u8], } pub unsafe fn borrow(bytes: &[u8]) -> &Dst { let dst: &Dst = std::mem::transmute((bytes.as_ptr(), bytes.len())); dst } fn main() {}
// build-pass // ignore-asmjs wasm2js does not support source maps yet // compile-flags: -g pub struct Dst { pub a: (), pub b: (), pub data: [u8], } pub unsafe fn borrow(bytes: &[u8]) -> &Dst { let dst: &Dst = std::mem::transmute((bytes.as_ptr(), bytes.len())); dst } fn main() {}
Add ignore-asmjs to new test
Add ignore-asmjs to new test
Rust
apache-2.0
graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust
44ce6fdcc7375938d4020d0f796a34b6bd44dde9
src/chips/hotel/src/chip.rs
src/chips/hotel/src/chip.rs
use cortexm3; use main::Chip; use usb; pub struct Hotel { mpu: cortexm3::mpu::MPU, systick: &'static cortexm3::systick::SysTick, } impl Hotel { pub unsafe fn new() -> Hotel { Hotel { mpu: cortexm3::mpu::MPU::new(), systick: cortexm3::systick::SysTick::new(), } }...
use cortexm3; use main::Chip; use usb; pub struct Hotel { mpu: cortexm3::mpu::MPU, systick: &'static cortexm3::systick::SysTick, } impl Hotel { pub unsafe fn new() -> Hotel { Hotel { mpu: cortexm3::mpu::MPU::new(), systick: cortexm3::systick::SysTick::new(), } }...
Simplify Hotel interrupt service routine
Simplify Hotel interrupt service routine According to @yuriks suggestions
Rust
apache-2.0
google/tock-on-titan,google/tock-on-titan,google/tock-on-titan
8d0fbd17c7e924c32c1b75f4634ba1f9165dfcf0
rust/atbash-cipher/src/lib.rs
rust/atbash-cipher/src/lib.rs
#![feature(ascii_ctype)] use std::ascii::AsciiExt; pub fn encode(message: &str) -> String { let mut index = 0; message .chars() .filter_map(|c| match c { _ if c.is_ascii_digit() => Some(c), _ if c.is_ascii_uppercase() => { let v = b'z' - c.to_ascii_lowerc...
#![feature(ascii_ctype)] use std::ascii::AsciiExt; const LA: u8 = b'a'; const LZ: u8 = b'z'; pub fn encode(message: &str) -> String { let mut index = 0; message .chars() .filter_map(|c| match c { _ if c.is_ascii_digit() => Some(c), _ if c.is_ascii_uppercase() => { ...
Use const instead of magic number
Use const instead of magic number It looks better
Rust
bsd-2-clause
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism
5022dd3b854792dd72d396e1586aa5b5c09975b2
src/test/rustdoc/remove-url-from-headings.rs
src/test/rustdoc/remove-url-from-headings.rs
#![crate_name = "foo"] // @has foo/fn.foo.html // !@has - '//a[@href="http://a.a"]' // @has - '//a[@href="#implementing-stuff-somewhere"]' 'Implementing stuff somewhere' /// fooo /// /// # Implementing [stuff](http://a.a) somewhere /// /// hello pub fn foo() {}
#![crate_name = "foo"] // @has foo/fn.foo.html // !@has - '//a[@href="http://a.a"]' // @has - '//a[@href="#implementing-stuff-somewhere"]' 'Implementing stuff somewhere' // @has - '//a[@href="#another-one-urg"]' 'Another one urg' /// fooo /// /// # Implementing [stuff](http://a.a) somewhere /// /// hello /// /// # An...
Extend url in titles test
Extend url in titles test
Rust
apache-2.0
aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust
38e1f8a9e438d5621b59bf36d9d716e7537e3b89
examples/main.rs
examples/main.rs
extern crate ruroonga; use ruroonga::*; use std::ffi::CStr; use std::str; fn main() { unsafe { let ctx = groonga_init(); println!("Hello in Ruroonga with Groonga: {}", get_groonga_version()); let _ = groonga_fin(ctx); } }
#![feature(libc)] #![feature(collections)] #![feature(convert)] extern crate ruroonga; extern crate libc; use ruroonga::*; use std::ffi::CStr; use std::ffi::CString; use std::str; use std::string::String; fn main() { unsafe { let ctx = groonga_init(); let mut string = "test.db".to_string(); ...
Convert Rust string type to C char type with unstable feature.... :<
Convert Rust string type to C char type with unstable feature.... :<
Rust
lgpl-2.1
cosmo0920/ruroonga
3a288cca93bc510ba30ce402c23bbf93d996d724
examples/example.rs
examples/example.rs
extern crate rustyline; use rustyline::completion::FilenameCompleter; use rustyline::error::ReadlineError; use rustyline::Editor; fn main() { let c = FilenameCompleter::new(); let mut rl = Editor::new(); rl.set_completer(Some(&c)); if let Err(_) = rl.load_history("history.txt") { println!("No ...
extern crate rustyline; use rustyline::completion::FilenameCompleter; use rustyline::error::ReadlineError; use rustyline::Editor; fn main() { let c = FilenameCompleter::new(); let mut rl = Editor::new(); rl.set_completer(Some(&c)); if let Err(_) = rl.load_history("history.txt") { println!("No ...
Make the prompt bold with ANSI escape code.
Make the prompt bold with ANSI escape code.
Rust
mit
dubrowgn/rustyline,dubrowgn/rustyline,gwenn/rustyline,cavedweller/rustyline,kkawakam/rustyline
86357c37d26db32a1064a5d955f43c82452c9588
src/test/compile-fail/issue-5035.rs
src/test/compile-fail/issue-5035.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
Fix test to reflect new note
Fix test to reflect new note
Rust
apache-2.0
graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust