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 |
|---|---|---|---|---|---|---|---|---|---|
c370b59753df16908a32a1d0a0bd3e5deb5bb919 | build.rs | build.rs | fn main() {
println!("cargo:rustc-link-search=framework=/usr/local/opt/qt5/Frameworks");
println!("cargo:rustc-link-lib=c++");
}
| use std::env;
use std::env::consts;
fn main() {
// We use the QTDIR or QTDIR64 env variables to find the location of
// Qt5. If these are not set, we use the default homebrew install
// location.
let qtdir_variable = match consts::ARCH {
"x86_64" => "QTDIR64",
_ => "QTDIR",
};
... | Make the QT location more dynamic | Make the QT location more dynamic
| Rust | apache-2.0 | w4tson/early-tea |
32ceba8d73c11d879415200d97dca37dec0b4fac | src/initializer.rs | src/initializer.rs | use getopts::{getopts};
use help;
fn verify_command(command: &str) -> bool {
match command {
"new" => true,
"open" => true,
_ => false
}
}
fn run_command(command: &str) {
println!("{}", command);
}
pub fn init(args: Vec<String>) {
let program = args[0].clone();
let o... | use getopts::{getopts};
use help;
fn verify_command(command: &str) -> bool {
match command {
"new" => true,
"open" => true,
_ => false
}
}
fn run_command(command: &str) {
println!("{}", command);
}
pub fn init(args: Vec<String>) {
let program = args[0].clone();
let o... | Print the usage if the command is bad. | Print the usage if the command is bad.
| Rust | mit | brianp/muxed,brianp/muxed |
622c2f1e0cf8eae161f94f3022694332e1f75495 | oee.rs | oee.rs | extern crate rand;
use rand::Rng;
use std::env;
const CYPHERBYTES: usize = 32;
fn main() {
let args: Vec<_> = env::args().collect();
if args.len() != 2 {
println!("usage: {} file-to-encrypt", args[0]);
return
}
let mut rng = rand::thread_rng();
let mut cyphertext = [0u8; CYPHERBY... | extern crate rand;
use rand::Rng;
use std::env;
const CYPHERBYTES: usize = 32;
fn main() {
let args: Vec<_> = env::args().collect();
if args.len() != 2 {
println!("usage: {} file-to-encrypt", args[0]);
return
}
let mut csprng = match rand::OsRng::new() {
Ok(g) => g,
Er... | Use Cryptographically Secure PRNG instead of Rng | Use Cryptographically Secure PRNG instead of Rng
As stated in the Rust documentation:
> An application that requires an entropy source for cryptographic purposes
> must use OsRng, which reads randomness from the source that the operating
> system provides (e.g. /dev/urandom on Unixes or CryptGenRandom() on Windows).
... | Rust | unlicense | veorq/oee |
076232f8ae181ee3a83af8cc3e7c14d68c661263 | src/audio/recorder/writer.rs | src/audio/recorder/writer.rs | // STD Dependencies -----------------------------------------------------------
use std::fs::File;
// Internal Dependencies ------------------------------------------------------
use super::{Chunk, Track};
// Audio Writer Trait ---------------------------------------------------------
pub trait AudioWriter: Send {
... | // STD Dependencies -----------------------------------------------------------
use std::fs::File;
// Internal Dependencies ------------------------------------------------------
use super::{Chunk, Track};
// Audio Writer Trait ---------------------------------------------------------
pub trait AudioWriter: Send {
... | Remove unused arguments for the time being. | Remove unused arguments for the time being.
| Rust | apache-2.0 | BonsaiDen/discord-bot |
14d40f3873d8bc9dca69052c878c0d2ce5665707 | rusoto/credential/tests/instance-profile-test.rs | rusoto/credential/tests/instance-profile-test.rs | extern crate tokio_core;
use rusoto_credential::{InstanceMetadataProvider, ProvideAwsCredentials};
use std::time::Duration;
use tokio_core::reactor::Core;
#[test]
#[ignore]
fn it_fetches_basic_role() {
// set env vars to point to local provider
let mut provider = InstanceMetadataProvider::new();
provider.... | extern crate tokio_core;
use rusoto_credential::{InstanceMetadataProvider, ProvideAwsCredentials};
use std::time::Duration;
use tokio_core::reactor::Core;
// This test is marked ignored because it requires special setup.
// It's run with the `credential_integration_test` Makefile target.
#[test]
#[ignore]
fn it_fetch... | Add note on why integration test is ignored, check token and expiration for instance profile integration test. | Add note on why integration test is ignored, check token and expiration for instance profile integration test.
| Rust | mit | DualSpark/rust-aws,DualSpark/rusoto,rusoto/rusoto,rusoto/rusoto,DualSpark/rust-aws,DualSpark/rusoto,rusoto/rusoto,DualSpark/rust-aws,DualSpark/rusoto |
146c460c4d249a8cc9ca95d6617bfb1cfcbc9fa8 | 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 ... | Rename the Scene constructor to Scene::new | Rename the Scene constructor to Scene::new
| Rust | apache-2.0 | mrobinson/rust-layers,glennw/rust-layers |
5ab4d46e9ada163f7f6025500313d2b51c87f657 | src/test/rustdoc/implementor-stable-version.rs | src/test/rustdoc/implementor-stable-version.rs | #![crate_name = "foo"]
#![feature(staged_api)]
#[stable(feature = "bar", since = "OLD 1.0")]
pub trait Bar {}
#[stable(feature = "baz", since = "OLD 1.0")]
pub trait Baz {}
pub struct Foo;
// @has foo/trait.Bar.html '//div[@id="implementors-list"]//span[@class="since"]' 'NEW 2.0'
#[stable(feature = "foobar", since... | #![stable(feature = "bar", since = "OLD 1.0")]
#![crate_name = "foo"]
#![feature(staged_api)]
#[stable(feature = "bar", since = "OLD 1.0")]
pub trait Bar {}
#[stable(feature = "baz", since = "OLD 1.0")]
pub trait Baz {}
#[stable(feature = "baz", since = "OLD 1.0")]
pub struct Foo;
// @has foo/trait.Bar.html '//div... | Update rustdoc test to make it work with newly added rustc passes | Update rustdoc test to make it work with newly added rustc passes
| Rust | apache-2.0 | graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust |
a05bfc6aeb8e5be70d15b3296cd4ba68d3578e01 | src/test/ui/privacy/pub-priv-dep/pub-priv1.rs | src/test/ui/privacy/pub-priv-dep/pub-priv1.rs | // aux-build:priv_dep.rs
// aux-build:pub_dep.rs
// compile-flags: --extern-private priv_dep
#![deny(exported_private_dependencies)]
// This crate is a private dependency
extern crate priv_dep;
// This crate is a public dependenct
extern crate pub_dep;
use priv_dep::{OtherType, OtherTrait};
use pub_dep::PubType;
... | // aux-build:priv_dep.rs
// aux-build:pub_dep.rs
// compile-flags: --extern-private priv_dep
#![deny(exported_private_dependencies)]
// This crate is a private dependency
extern crate priv_dep;
// This crate is a public dependenct
extern crate pub_dep;
use priv_dep::{OtherType, OtherTrait};
use pub_dep::PubType;
... | Test allowing individual struct field | Test allowing individual struct field
| Rust | apache-2.0 | aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust |
7331f5d649709a15070ef77dcd4ae309d31a4aeb | src/test/mod.rs | src/test/mod.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 ... | Test dynamic and native regexps at stage2. | Test dynamic and native regexps at stage2.
| Rust | apache-2.0 | BurntSushi/regexp,BurntSushi/regexp,BurntSushi/regexp,BurntSushi/regexp |
2c3d47be8d4658b12b75c06f51544eebb2b4ca3a | tests/status.rs | tests/status.rs | #![feature(associated_consts)]
#![feature(type_ascription)]
#![feature(use_extern_macros)]
#![allow(plugin_as_library)]
#[macro_use]
extern crate tapioca;
infer_api!(httpbin, "https://raw.githubusercontent.com/OJFord/tapioca/master/tests/schemata/httpbin.yml");
use httpbin::status;
#[test]
fn ok_err_matching() {
... | #![feature(associated_consts)]
#![feature(type_ascription)]
#![feature(use_extern_macros)]
#![allow(plugin_as_library)]
#[macro_use]
extern crate tapioca;
infer_api!(httpbin, "https://raw.githubusercontent.com/OJFord/tapioca/master/tests/schemata/httpbin.yml");
use httpbin::status_resource;
#[test]
fn ok_err_matchi... | Fix module name for path parameter | Fix module name for path parameter
| Rust | mit | OJFord/tapioca |
d30a08f11a5d2907bebf9d262a5decf110b64334 | 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()
}
fn repl() -> io::Result<()> {
p... | // 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 history and env to repl. | Add history and env to repl.
| Rust | isc | oconnor0/system-zero |
d758c3d1a2a27e6e8ef54a7e7e71d1c01798fb85 | guessing_game/src/main.rs | guessing_game/src/main.rs | extern crate rand;
use std::io;
use std::cmp::Ordering;
use rand::Rng;
fn main() {
println!("Hello in my guessing game!");
let secret_number = rand::thread_rng().gen_range(1, 101);
println!("The secret number is: {}", secret_number);
loop {
println!("Input your guess, please:");
let... | extern crate rand;
use std::io;
use std::cmp::Ordering;
use rand::Rng;
fn main() {
println!("Hello in my guessing game!");
let secret_number = rand::thread_rng().gen_range(1, 101);
loop {
println!("Input your guess, please:");
let mut guess = String::new();
io::stdin().read_lin... | Remove printing the secret number | Remove printing the secret number
| Rust | mit | pgrzesik/learning-rust |
dbad16021cec2a842f5c8d6b9a28ba2039044cb8 | strings/strings3.rs | strings/strings3.rs | // Ok, here are a bunch of values-- some are `Strings`, some are `&strs`. Your
// task is to call one of these two functions on each value depending on what
// you think each value is. That is, add either `string_slice` or `string`
// before the parentheses on each line. If you're right, it will compile!
fn string_sli... | // Ok, here are a bunch of values-- some are `Strings`, some are `&strs`. Your
// task is to call one of these two functions on each value depending on what
// you think each value is. That is, add either `string_slice` or `string`
// before the parentheses on each line. If you're right, it will compile!
fn string_sli... | Add some more common String/&str idioms | Add some more common String/&str idioms
| Rust | mit | ddevlin/rustlings,shaneutt/rustlings,StrongGoat/rustlings,carols10cents/rustlings,carols10cents/rustlings |
b3f71c829c47157ba38831017cbeffaf04df2e02 | lisp/src/repl.rs | lisp/src/repl.rs | use cell_gc;
use parser::parse;
use std::io::{self, Write};
use vm;
pub fn repl() -> io::Result<()> {
cell_gc::with_heap(|hs| {
let env = vm::Value::default_env(hs);
loop {
{
let stdout = io::stdout();
let mut stdout = stdout.lock();
writ... | use cell_gc;
use parser::parse;
use print::print;
use std::io::{self, Write};
use vm;
pub fn repl() -> io::Result<()> {
cell_gc::with_heap(|hs| {
let env = vm::Value::default_env(hs);
loop {
{
let stdout = io::stdout();
let mut stdout = stdout.lock();
... | Use the s-expression printing in the REPL | Use the s-expression printing in the REPL
| Rust | mit | jorendorff/cell-gc,jorendorff/cell-gc |
0e519b65523c20e7f80ef0904eb7f9cf0d7fe295 | src/main.rs | src/main.rs | extern crate json;
extern crate tiled;
extern crate cgmath;
#[macro_use]
extern crate gfx;
extern crate specs;
extern crate genmesh;
extern crate gfx_device_gl;
extern crate gfx_window_glutin;
extern crate glutin;
extern crate image;
extern crate rodio;
mod gfx_app;
mod game;
mod data;
mod critter;
mod graphics;
mod ... | extern crate json;
extern crate tiled;
extern crate cgmath;
#[macro_use]
extern crate gfx;
extern crate specs;
extern crate genmesh;
extern crate gfx_device_gl;
extern crate gfx_window_glutin;
extern crate glutin;
extern crate image;
extern crate rodio;
mod gfx_app;
mod game;
mod data;
mod critter;
mod graphics;
mod ... | Remove print on game exit | Remove print on game exit
| Rust | apache-2.0 | Laastine/zombie-shooter,Laastine/zombie-shooter |
998b9161811cdf69a9f5aa437ae48bcc65a9489f | skat/src/main.rs | skat/src/main.rs | extern crate rand;
use rand::Rng;
use std::io;
enum Card {
ClubsAce,
ClubsTen,
ClubsKing,
ClubsQueen,
ClubsJack,
ClubsNine,
ClubsEight,
ClubsSeven,
SpadesAce,
SpadesTen,
SpadesKing,
SpadesQueen,
SpadesJack,
SpadesNine,
SpadesEight,
SpadesSeven,
Heart... | extern crate rand;
use rand::Rng;
use std::io;
enum Card {
ClubsAce,
ClubsTen,
ClubsKing,
ClubsQueen,
ClubsJack,
ClubsNine,
ClubsEight,
ClubsSeven,
SpadesAce,
SpadesTen,
SpadesKing,
SpadesQueen,
SpadesJack,
SpadesNine,
SpadesEight,
SpadesSeven,
Heart... | Select player first (before entering the loop). | Select player first (before entering the loop).
| Rust | mit | wahn/Rust_Examples |
035c9c6d94db320a7cc820eb50cedd5c3e0f44d0 | src/lib.rs | src/lib.rs | extern crate image;
extern crate libc;
extern crate rust_resemble as resemble;
use libc::{c_double, size_t};
use image::load_from_memory;
use std::mem::forget;
#[no_mangle]
pub extern "C" fn compare_images(img1: *const u8,
img1_length: size_t,
img2: *c... | extern crate image;
extern crate libc;
extern crate rust_resemble as resemble;
use libc::{c_double, size_t};
use image::load_from_memory;
#[no_mangle]
pub extern "C" fn compare_images(img1: *const u8,
img1_length: size_t,
img2: *const u8,
... | Revert "attempt to fix an issue with nodejs 7.6" | Revert "attempt to fix an issue with nodejs 7.6"
This reverts commit a85b1390347d556797d18e2ce12ca22c237c1292.
| Rust | mit | danylaporte/node-rust-resemble,danylaporte/node-rust-resemble |
a1cfd237dd1c2e55d2ef9ee775c570b0830b2eba | src/lib.rs | src/lib.rs | #[test]
fn it_works() {
}
| pub struct Nil;
pub struct Cons<H, T>(pub H, pub T);
#[allow(dead_code)]
pub enum Here {}
#[allow(dead_code)]
pub struct There<T>(std::marker::PhantomData<T>);
impl Nil {
pub fn push<N>(self, item: N) -> Cons<N, Self> {
Cons(item, self)
}
}
impl<H, T> Cons<H, T> {
pub fn push<N>(self, item: N) ->... | Bring code over from prototype, rename DontCare -> Head in recursive case, export types + traits | Bring code over from prototype, rename DontCare -> Head in recursive case, export types + traits
| Rust | mit | Sgeo/hlist |
16fb387bc3fe563f3cf09eb4d3d92ae29026f91a | src/main/main.rs | src/main/main.rs | #![feature(const_fn)]
#![no_main]
#![no_std]
extern crate common;
extern crate support;
extern crate hil;
extern crate process;
extern crate platform;
mod sched;
pub mod syscall;
#[allow(improper_ctypes)]
extern {
static _sapps : usize;
}
#[no_mangle]
pub extern fn main() {
use process::Process;
use pr... | #![feature(const_fn)]
#![no_main]
#![no_std]
extern crate common;
extern crate support;
extern crate hil;
extern crate process;
extern crate platform;
mod sched;
pub mod syscall;
#[allow(improper_ctypes)]
extern {
static _sapps : usize;
}
#[no_mangle]
pub extern fn main() {
use process::Process;
use pr... | Load the platform before apps | Load the platform before apps
That way, if there is an error loading the apps, the console is already
configured and we can panic with useful output
| Rust | apache-2.0 | google/tock-on-titan,google/tock-on-titan,google/tock-on-titan |
e3a4e20e48cf9adc4be701af77259353d73544bf | src/services/membership.rs | src/services/membership.rs | use ::bot::{Bot, Node, RoomEvent};
pub struct Join;
impl Join {
pub fn new() -> Self {
Join
}
}
impl<'a> Node<'a> for Join {
fn handle(&mut self, bot: &Bot, event: RoomEvent) {
let body = &event.raw_event.content["body"].as_str().unwrap();
if body.starts_with("join ") {
... | use ::bot::{Bot, Node, RoomEvent};
pub struct Join;
impl Join {
pub fn new() -> Self {
Join
}
}
impl<'a> Node<'a> for Join {
fn handle(&mut self, bot: &Bot, event: RoomEvent) {
let body = &event.raw_event.content["body"].as_str().unwrap();
if body.starts_with("join ") {
... | Add leave with no args in room leaves current room | Add leave with no args in room leaves current room
| Rust | mit | jpypi/rustix |
df0c172afcf1672c9e8fdee87b247843cc8dbe76 | src/_compat.rs | src/_compat.rs | #[deprecated(note = "Renamed to Value")]
/// Compatibility name to ease the pain of moving
pub type Serialize = Value;
#[deprecated(note = "Renamed to PushFnValue")]
/// Compatibility name to ease the pain of moving
pub type PushLazy<T> = PushFnValue<T>;
#[deprecated(note = "Renamed to PushFnSerializer")]
/// Compati... | #[deprecated(note = "Renamed to Value")]
/// Compatibility name to ease the pain of moving
pub type Serialize = Value;
#[deprecated(note = "Renamed to PushFnValue")]
/// Compatibility name to ease the pain of moving
pub type PushLazy<T> = PushFnValue<T>;
#[deprecated(note = "Renamed to PushFnSerializer")]
/// Compati... | Add compatibility for removed `ser` module | Add compatibility for removed `ser` module
| Rust | mpl-2.0 | dpc/slog-rs |
2f65da5cca0670b3d756abbe56b11dd368d63945 | src/backend.rs | src/backend.rs | //! Generic interface to secret storage backends.
use std::error;
/// A generic error type which can contain any error caused by any of the
/// libraries we call. This is used by our backend APIs for simplicity and
/// extensibility, and because we don't really care very much about why
/// things fail (at least not ... | //! Generic interface to secret storage backends.
use std::error;
/// A generic error type which can contain any error caused by any of the
/// libraries we call. This is used by our backend APIs for simplicity and
/// extensibility, and because we don't really care very much about why
/// things fail (at least not ... | Allow `err!` with no args except format string | Allow `err!` with no args except format string
| Rust | cc0-1.0 | emk/credentials |
6e361e6eca051bc3f0e50d7439e41e59be29bad8 | src/test_helper.rs | src/test_helper.rs | use std::rand::random;
/// Test helper to standardize how random files and directories are generated.
pub fn random_name() -> String {
format!("test_{}", random::<f64>())
}
| use std::rand::random;
use std::io::fs;
/// Test helper to standardize how random files and directories are generated.
pub fn random_name() -> String {
format!("test_{}", random::<f64>())
}
pub fn cleanup_file(path: &Path) {
match fs::unlink(path) {
Ok(()) => (), // succeeded
Err(e) => println... | Add a method to quickly clean up the files created during testing. | Add a method to quickly clean up the files created during testing.
| Rust | mit | brianp/muxed,brianp/muxed |
93348dd720c8386e94a876554d594a9a06be761f | rust/test/publisher/wpublisher_tests.rs | rust/test/publisher/wpublisher_tests.rs |
#[ allow( unused_imports ) ]
use wpublisher as TheModule;
mod inc;
|
#[ allow( unused_imports ) ]
use wpublisher as TheModule;
#[ cfg( feature = "use_std" ) ]
mod inc;
| Fix tests of utility `wpublisher`, setup tests under features | Fix tests of utility `wpublisher`, setup tests under features
| Rust | mit | Wandalen/wTools,Wandalen/wTools |
b17fffa9d926f4a2a805445c68f120c7912f2c57 | src/servo/dom/domparser.rs | src/servo/dom/domparser.rs | use content::content_task::global_content;
use dom::bindings::utils::{DOMString, ErrorResult, WrapperCache, CacheableWrapper};
use dom::bindings::codegen::DOMParserBinding;
use dom::document::Document;
use dom::element::{Element, HTMLHtmlElement, HTMLHtmlElementTypeId};
use dom::node::Node;
use dom::window::Window;
pu... | /* 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/. */
use content::content_task::global_content;
use dom::bindings::codegen::DOMParserBinding;
use dom::bindings::utils:... | Fix code style in DOMParser | Fix code style in DOMParser
| Rust | mpl-2.0 | owaspjocur/servo,nick-thompson/servo,caldwell/servo,codemac/servo,dhananjay92/servo,froydnj/servo,srbhklkrn/SERVOENGINE,michaelwu/servo,evilpie/servo,DominoTree/servo,samfoo/servo,nerith/servo,huonw/servo,zentner-kyle/servo,mattnenterprise/servo,ruud-v-a/servo,szeged/servo,luniv/servo,samfoo/servo,CJ8664/servo,WriterOf... |
a6f0d969307f70b1d0894c2ecfc6dac1800acdc4 | src/lib.rs | src/lib.rs | // Dummy main library
// not_tested
#[allow(dead_code)]
#[cfg(not(test))]
fn main() {
}
| // Dummy main library
// It also contains a test module, which checks if all source files are covered by `Cargo.toml`
#![feature(phase)]
extern crate regex;
#[phase(plugin)] extern crate regex_macros;
#[allow(dead_code)]
#[cfg(not(test))]
fn main() { }
#[cfg(test)]
mod test {
use std::collections::HashSet;
... | Check that source files are covered by Cargo.toml | Check that source files are covered by Cargo.toml
Closes https://github.com/Hoverbear/rust-rosetta/issues/236
| Rust | unlicense | magum/rust-rosetta,crr0004/rust-rosetta,ghotiphud/rust-rosetta,magum/rust-rosetta,Hoverbear/rust-rosetta,ZoomRmc/rust-rosetta,sakeven/rust-rosetta,crespyl/rust-rosetta,pfalabella/rust-rosetta,JIghtuse/rust-rosetta |
eae94f8f6143521e3873d128eb4e673c212afe84 | src/lib.rs | src/lib.rs | // Copyright 2014 Michael Yang. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
#![feature(concat_idents)]
#![feature(libc)]
//! BLAS bindings and wrappers.
//!
//! Bindings are split by BLAS level and contained in a module named `ll`
//! (st... | // Copyright 2014 Michael Yang. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
#![feature(concat_idents)]
#![feature(raw)]
#![feature(libc)]
//! BLAS bindings and wrappers.
//!
//! Bindings are split by BLAS level and contained in a module n... | Add feature gate for raw. | Add feature gate for raw.
| Rust | mit | raineszm/rust-blas,mikkyang/rust-blas |
1e491c18ed2c5fe0c8c79d13d37a9adda7efc872 | src/api.rs | src/api.rs | extern crate iron;
extern crate rustc_serialize;
use iron::prelude::*;
use iron::status;
use diesel::prelude::*;
use rustc_serialize::json;
use database;
pub fn index(request: &mut Request) -> IronResult<Response> {
println!("Started GET \"/api\" for {}", request.remote_addr);
Ok(Response::with((status::Ok, ... | extern crate iron;
extern crate rustc_serialize;
use iron::headers::ContentType;
use iron::prelude::*;
use iron::status;
use diesel::prelude::*;
use rustc_serialize::json;
use database;
pub fn index(request: &mut Request) -> IronResult<Response> {
println!("Started GET \"/api\" for {}", request.remote_addr);
... | Set Content-Type header to application/json | Set Content-Type header to application/json
| Rust | mit | rlustin/lugh,rlustin/lugh,rlustin/lugh |
b6c8a5c300a12c3f00ed09d12cdbf3ce447004d9 | src/lib.rs | src/lib.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/. */
/*!
# Autogard
*/
#![crate_name = "autograd"]
#![crate_type = "rlib"]
#![feature(thread_local)]
pub use context:... | /* 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/. */
/*!
# Autogard
*/
#![crate_name = "autograd"]
#![crate_type = "rlib"]
#![feature(thread_local)]
mod context;
mod... | Move down |pub use| under |mod|. | Move down |pub use| under |mod|.
| Rust | mpl-2.0 | kkimdev/autograd |
550b5b6dcffb1ca1cbb7d8c9d5170cd3d01cce82 | src/libhttp/lib.rs | src/libhttp/lib.rs | #[link(name = "rusthttpserver",
vers = "0.1-pre",
uuid = "d2ad8df0-547a-4ce1-99c6-a9da3b98fb3e",
url = "")];
#[comment = "Rust HTTP server"];
#[license = "MIT/ASL2"];
#[crate_type = "lib"];
#[deny(non_camel_case_types)];
//#[deny(missing_doc)];
extern mod extra;
pub mod buffer;
pub mod server;
... | #[link(name = "http",
vers = "0.1-pre",
uuid = "d2ad8df0-547a-4ce1-99c6-a9da3b98fb3e",
url = "")];
#[comment = "Rust HTTP server"];
#[license = "MIT/ASL2"];
#[crate_type = "lib"];
#[deny(non_camel_case_types)];
//#[deny(missing_doc)];
extern mod extra;
pub mod buffer;
pub mod server;
pub mod me... | Fix http crate link name. | Fix http crate link name.
| Rust | apache-2.0 | servo/rust-http,servo/rust-http,Shraddha512/rust-http,servo/rust-http,chris-morgan/rust-http,Shraddha512/rust-http,Shraddha512/rust-http,Shraddha512/rust-http,chris-morgan/rust-http,chris-morgan/rust-http,Shraddha512/rust-http,chris-morgan/rust-http,servo/rust-http |
b90c96f53022600bc6bbfe3a88823e956cc58047 | src/main.rs | src/main.rs | // Copyright 2020 Google LLC
//
// Use of this source code is governed by an MIT-style license that can be found
// in the LICENSE file or at https://opensource.org/licenses/MIT.
use std::fs::File;
use log::{error, info};
use rrg::action;
use rrg::session;
use rrg::opts::{self, Opts};
fn main() {
let opts = opt... | // Copyright 2020 Google LLC
//
// Use of this source code is governed by an MIT-style license that can be found
// in the LICENSE file or at https://opensource.org/licenses/MIT.
use log::{error, info};
use rrg::action;
use rrg::session;
use rrg::opts::{self, Opts};
fn main() {
let opts = opts::from_args();
... | Use the `env_logger` crate for logging. | Use the `env_logger` crate for logging.
| Rust | mit | google/rrg |
7d5bb8da8fb3f4f1d2c2e6eee681fbb18fe89c8f | src/main.rs | src/main.rs | use std::io::Write;
use std::process::Command;
const FORTUNE: &str = "fortune";
fn main() {
println!("[FORTUNE COOKIE]");
println!("{}", fortune());
}
/// Get a fortune cookie.
fn fortune() -> String {
let output = Command::new(FORTUNE)
.arg("-s") // Short fortunes only
.output()
... | use std::fs;
use std::io;
use std::path::Path;
const FORTUNES: &str = "fortunes";
fn main() {
let fortunes = fortunes_from_file(FORTUNES).expect("Failed to read fortunes");
println!("{}", fortunes[0]);
}
/// Read fortunes from a fortunes text file.
fn fortunes_from_file<P: AsRef<Path>>(path: P) -> io::Resul... | Load fortunes from fortune database. | Load fortunes from fortune database.
| Rust | mit | dcoles/experiments,dcoles/experiments,dcoles/experiments,dcoles/experiments |
3f0d24f751c3fb94699c87ea57b2353e57717ae7 | examples/main.rs | examples/main.rs | #![feature(libc)]
#![feature(collections)]
#![feature(convert)]
#![feature(path_ext)]
extern crate ruroonga;
extern crate libc;
use ruroonga::*;
use std::ffi::CStr;
use std::ffi::CString;
use std::str;
use std::string::String;
use std::path::Path;
use std::fs::PathExt;
use std::mem;
fn main() {
unsafe {
le... | extern crate ruroonga;
use ruroonga::*;
fn main() {
let ctx = groonga_init();
let dbpath = "test.db";
let _ = groonga_db_use(ctx, dbpath);
let command = "table_create Users TABLE_HASH_KEY ShortText";
let _ = groonga_execute_command(ctx, command);
println!("Hello in Ruroonga with Groonga: {}", g... | Remove unused attributes and unsafe block | Remove unused attributes and unsafe block
| Rust | lgpl-2.1 | cosmo0920/ruroonga |
f68b69f37b05b5d6e1b2dcb4202f06bd4b76b98d | rustrelay/src/relay/relay.rs | rustrelay/src/relay/relay.rs | use mio::*;
use super::selector::{EventHandler,Selector};
use super::tunnel_server::TunnelServer;
const TAG: &'static str = "Relay";
pub struct Relay {
port: u16,
}
impl Relay {
pub fn new(port: u16) -> Relay {
Relay {
port: port,
}
}
pub fn start(&self) {
info!(... | use mio::*;
use super::selector::{EventHandler,Selector};
use super::tunnel_server::TunnelServer;
const TAG: &'static str = "Relay";
pub struct Relay {
port: u16,
}
impl Relay {
pub fn new(port: u16) -> Relay {
Relay {
port: port,
}
}
pub fn start(&self) {
info!(... | Move events out of the loop | Move events out of the loop
Do not create a new events storage for every poll().
| Rust | apache-2.0 | WPO-Foundation/gnirehtet,WPO-Foundation/gnirehtet,Genymobile/gnirehtet,WPO-Foundation/gnirehtet,WPO-Foundation/gnirehtet,Genymobile/gnirehtet,Genymobile/gnirehtet |
045a7a6083ec3432ea411bd2b90333d49549598b | src/engine/world.rs | src/engine/world.rs | use std::vec::Vec;
use engine::Actor;
pub struct World {
actors: Vec<Actor>,
}
impl World {
pub fn new() -> World {
World {
actors: Vec::new(),
}
}
}
| use std::vec::Vec;
use engine::Actor;
use util::Point;
pub struct World {
player: Actor,
actors: Vec<Actor>,
}
impl World {
pub fn new() -> World {
World {
player: Actor::new("Player".to_string(), Point::new(1, 1), 100, '@'),
actors: Vec::new(),
}
}
}
| Add the player to World | Add the player to World
| Rust | bsd-3-clause | jgilchrist/rslike |
03d7c5f0b594b492dd5bd80e756388f847039e3c | tests/management.rs | tests/management.rs | use leveldb::management::*;
use leveldb::options::*;
use utils::{open_database,tmpdir};
#[test]
fn test_destroy_database() {
let tmp = tmpdir("destroy");
let database = open_database::<i32>(tmp.path(), true);
drop(database);
let options = Options::new();
let res = destroy(tmp.path(), options);
... | use leveldb::management::*;
use leveldb::options::*;
use utils::{open_database,tmpdir};
#[test]
fn test_destroy_database() {
let tmp = tmpdir("destroy");
let database = open_database::<i32>(tmp.path(), true);
drop(database);
let options = Options::new();
let res = destroy(tmp.path(), options);
... | Remove a test due to library version dependence | Remove a test due to library version dependence
| Rust | mit | skade/leveldb,alekseysidorov/leveldb,alekseysidorov/leveldb |
3937ee938b3de9e5d20bdcf21f79f44563f57b47 | rust/luhn/src/lib.rs | rust/luhn/src/lib.rs | pub fn is_valid(id: &str) -> bool {
// check the length
if id.len() < 2 {
return false;
}
let mut index: u32 = 0;
let mut number: Vec<u32> = Vec::new();
for c in id.chars().rev() {
if c.is_whitespace() {
continue;
}
let mut v: u32;
match c.... | pub fn is_valid(id: &str) -> bool {
// check the length
if id.len() < 2 {
return false;
}
let mut index: u32 = 0;
let mut sum: u32 = 0;
for c in id.chars().rev() {
if c.is_whitespace() {
continue;
}
let mut v: u32;
match c.to_digit(10) {
... | Change luhn code to simplify | Change luhn code to simplify
I still not decide to use the functional style for this case
| Rust | bsd-2-clause | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism |
30e4bfec25060ae20c2537367c13b9f6ecaf79ff | components/plugins/jstraceable.rs | components/plugins/jstraceable.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/. */
use syntax::ast::MetaItem;
use syntax::codemap::Span;
use syntax::ext::base::{Annotatable, ExtCtxt};
use syntax::p... | /* 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/. */
use syntax::ast::MetaItem;
use syntax::codemap::Span;
use syntax::ext::base::{Annotatable, ExtCtxt};
use syntax::p... | Mark DOM interfaces as repr(C) | Mark DOM interfaces as repr(C)
| Rust | mpl-2.0 | anthgur/servo,eddyb/servo,larsbergstrom/servo,KiChjang/servo,fiji-flo/servo,pyfisch/servo,eddyb/servo,dsandeephegde/servo,sadmansk/servo,CJ8664/servo,jimberlage/servo,paulrouget/servo,fiji-flo/servo,dati91/servo,szeged/servo,nnethercote/servo,DominoTree/servo,peterjoel/servo,anthgur/servo,anthgur/servo,splav/servo,Simo... |
46164bc53c7f3c2c5c0717905f82667ae1d3ed23 | src/bin/cargo-git-checkout.rs | src/bin/cargo-git-checkout.rs | #![crate_id="cargo-git-checkout"]
extern crate cargo;
extern crate serialize;
extern crate hammer;
extern crate url;
use hammer::FlagConfig;
use cargo::{execute_main_without_stdin,CLIResult,CLIError,ToResult};
use cargo::sources::git::{GitRemote,GitCheckout};
use url::Url;
#[deriving(Eq,Clone,Decodable)]
struct Opti... | #![crate_id="cargo-git-checkout"]
extern crate cargo;
extern crate serialize;
extern crate hammer;
extern crate url;
use hammer::FlagConfig;
use cargo::{execute_main_without_stdin,CLIResult,CLIError,ToResult};
use cargo::core::source::Source;
use cargo::sources::git::{GitSource,GitRemote};
use url::Url;
#[deriving(E... | Use GitSource in the stub executable | Use GitSource in the stub executable
| Rust | apache-2.0 | erickt/cargo,erickt/cargo |
667ea065d58b381d5de4bcf5643143ba4280b40d | apps/app_blink_k20.rs | apps/app_blink_k20.rs | #![feature(phase)]
#![crate_type="staticlib"]
#![no_std]
extern crate core;
extern crate zinc;
use core::option::Some;
use zinc::hal::k20::pin;
use zinc::hal::pin::GPIO;
use zinc::hal::cortex_m4::systick;
/// Wait the given number of SysTick ticks
pub fn wait(ticks: u32) {
let mut n = ticks;
let mut t = systick:... | #![feature(phase)]
#![crate_type="staticlib"]
#![no_std]
extern crate core;
extern crate zinc;
use core::option::Some;
use zinc::hal::k20::pin;
use zinc::hal::pin::GPIO;
use zinc::hal::cortex_m4::systick;
/// Wait the given number of SysTick ticks
pub fn wait(ticks: u32) {
let mut n = ticks;
// Reset the tick fl... | Modify the K20 example to check the systick flag | Modify the K20 example to check the systick flag
| Rust | apache-2.0 | hackndev/zinc,mcoffin/zinc,farcaller/zinc,troplin/zinc,phil-opp/zinc,posborne/zinc,0xc0170/zinc,ryankurte/zinc,phil-opp/zinc,troplin/zinc,dirvine/zinc,farcaller/zinc,dirvine/zinc,dirvine/zinc,dirvine/zinc,hackndev/zinc,gapry/zinc,ntwyman/zinc,flxo/zinc,hugwijst/zinc,ryankurte/zinc,ntwyman/zinc,tempbottle/zinc,hackndev/... |
3cd05797c4cc3324f28cc21ff34d3682aea9641f | compiler/crates/common/src/perf_logger.rs | compiler/crates/common/src/perf_logger.rs | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
pub trait PerfLogger: Send + Sync {
type PerfLogEvent: PerfLogEvent + Send;
/// Create log event
fn create_event(&self,... | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
pub trait PerfLogger: Send + Sync {
type PerfLogEvent: PerfLogEvent + Send;
/// Create log event
fn create_event(&self,... | Make perf logger thread safe | Make perf logger thread safe
Reviewed By: kassens
Differential Revision: D22188906
fbshipit-source-id: 3d5ebcd80cca07a1209e2034eeb30c64518bff78
| Rust | mit | kassens/relay,xuorig/relay,josephsavona/relay,atxwebs/relay,atxwebs/relay,wincent/relay,xuorig/relay,voideanvalue/relay,facebook/relay,voideanvalue/relay,kassens/relay,atxwebs/relay,kassens/relay,atxwebs/relay,wincent/relay,wincent/relay,facebook/relay,yungsters/relay,kassens/relay,xuorig/relay,josephsavona/relay,faceb... |
bdba6fc5b08397d7647046d037dd9f991532bef3 | examples/serde-syntex-example/src/main.rs | examples/serde-syntex-example/src/main.rs | #![cfg_attr(feature = "serde_derive", feature(proc_macro))]
#[cfg(feature = "serde_derive")]
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
#[cfg(feature = "serde_derive")]
include!("main.rs.in");
#[cfg(not(feature = "serde_derive"))]
include!(concat!(env!("OUT_DIR"), "/main.rs... | #[cfg(feature = "serde_derive")]
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
#[cfg(feature = "serde_derive")]
include!("main.rs.in");
#[cfg(not(feature = "serde_derive"))]
include!(concat!(env!("OUT_DIR"), "/main.rs"));
| Remove the proc_macro feature gate in serde-syntex-example | Remove the proc_macro feature gate in serde-syntex-example
| Rust | apache-2.0 | serde-rs/serde |
21e53319a3ef1719dfda85023e082c0e9d749205 | regex_macros/tests/test_dynamic.rs | regex_macros/tests/test_dynamic.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 ... | Allow testing on stable Rust | Allow testing on stable Rust
| Rust | apache-2.0 | edunham/regex,golddranks/regex,rust-lang-nursery/regex,rust-lang/regex,SeanRBurton/regex,rust-lang/regex,rust-lang/regex,golddranks/regex,rust-lang-nursery/regex,rust-lang-nursery/regex,bluss/regex,SeanRBurton/regex,edunham/regex,SeanRBurton/regex,rust-lang/regex,golddranks/regex,rust-lang-nursery/regex,rust-lang/regex... |
eadade4c0f4ba4e4aebe6b298f5470af1cecc64f | src/panic.rs | src/panic.rs | //! Intrinsics for panic handling
use interrupt;
#[lang = "eh_personality"]
pub extern "C" fn eh_personality() {}
/// Required to handle panics
#[lang = "panic_fmt"]
#[no_mangle]
pub extern "C" fn rust_begin_unwind(fmt: ::core::fmt::Arguments, file: &str, line: u32) -> ! {
println!("PANIC: {}", fmt);
println... | //! Intrinsics for panic handling
use interrupt;
#[lang = "eh_personality"]
#[no_mangle]
pub extern "C" fn rust_eh_personality() {}
/// Required to handle panics
#[lang = "panic_fmt"]
#[no_mangle]
pub extern "C" fn rust_begin_unwind(fmt: ::core::fmt::Arguments, file: &str, line: u32) -> ! {
println!("PANIC: {}",... | Fix for the latest nightly | Fix for the latest nightly
| Rust | mit | redox-os/kernel,redox-os/kernel,AleVul/kernel,redox-os/kernel,AleVul/kernel |
c47196e3e91382faa62200487f07c4014daa7065 | src/lib.rs | src/lib.rs | pub enum Direction {
Forward,
Backward,
}
pub fn transform(data: &mut [f64], _: Direction) {
let n = data.len();
if n < 2 || n & (n - 1) != 0 {
panic!("the data size should be a power of two");
}
}
| #![feature(step_by)]
/// A direction of the Fourier transform.
pub enum Direction {
/// From the time domain to the frequency domain.
Forward,
/// From the frequency domain to the time domain.
Inverse,
}
/// Perform the Fourier transform.
pub fn transform(data: &mut [f64], direction: Direction) {
... | Add an implementation based on Brenner’s (1976) | Add an implementation based on Brenner’s (1976)
| Rust | mit | warricksothr/dft,stainless-steel/fft |
a6c60bbe5de9a090c8da30d5edbd27582f6b19e6 | src/test/ui/consts/const-eval/double_check2.rs | src/test/ui/consts/const-eval/double_check2.rs | // check-pass
// This test exhibits undefined behavior, but it is impossible to prevent generally during
// const eval, even if possible to prevent in the cases here. The reason it's impossible in general
// is that we run into query cycles even *without* UB, just because we're checking for UB.
// We do not detect it ... | // check-pass
// This test exhibits undefined behavior, but it is impossible to prevent generally during
// const eval, even if it could be prevented in the cases here if we added expensive and
// complex checks in rustc.
// The reason it's impossible in general
// is that we run into query cycles even *without* UB, j... | Clarify a statement in UB test | Clarify a statement in UB test
| Rust | apache-2.0 | aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust |
db726faf324c9258c3e93f15d41ada4f9d008f66 | src/test/parse-fail/obsolete-proc.rs | src/test/parse-fail/obsolete-proc.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 ... | Change comment in parse-fail test | Change comment in parse-fail test
| Rust | apache-2.0 | philyoon/rust,TheNeikos/rust,pelmers/rust,zachwick/rust,jashank/rust,GBGamer/rust,pelmers/rust,GBGamer/rust,ruud-v-a/rust,victorvde/rust,KokaKiwi/rust,sae-bom/rust,carols10cents/rust,zachwick/rust,kwantam/rust,andars/rust,andars/rust,AerialX/rust-rt-minimal,graydon/rust,dwillmer/rust,vhbit/rust,nwin/rust,miniupnp/rust,... |
996d10a1780266bbeabbb6d8860c2b5604d708ce | src/context.rs | src/context.rs | use ::handle::Handle;
/// A libudev context.
pub struct Context {
udev: *mut ::ffi::udev,
}
impl Clone for Context {
/// Increments reference count of `libudev` context.
fn clone(&self) -> Self {
Context {
udev: unsafe { ::ffi::udev_ref(self.udev) },
}
}
}
impl Drop for Co... | use ::handle::Handle;
/// A libudev context. Contexts may not be sent or shared between threads. The `libudev(3)` manpage
/// says:
///
/// > All functions require a libudev context to operate. This context can be create via
/// > udev_new(3). It is used to track library state and link objects together. No global stat... | Document !Send and !Sync for Context | Document !Send and !Sync for Context
While reviewing the reference-counting approach for thread-safety
issues, the issue of sharing a context between threads arose, because
the documentation in `libudev(3)` prohibits it:
> a single context must not be accessed by multiple threads in parallel
This means that `Context... | Rust | mit | dcuddeback/libudev-rs |
14bd86a7fba8c94ddad9f8bf2cd154df250ef950 | src/search_command.rs | src/search_command.rs | extern crate alfred;
use config::Config;
use jira_api::SearchIssue;
use jira_client;
use search_response::SearchResponse;
use std::io::{self};
pub struct SearchCommand {
pub config: Config,
}
impl SearchCommand {
pub fn run(&self, keyword: &String) -> Result<(), String> {
let jira_search = SearchIssu... | extern crate alfred;
use config::Config;
use jira_api::SearchIssue;
use jira_client;
use search_response::SearchResponse;
use std::io::{self};
pub struct SearchCommand {
pub config: Config,
}
impl SearchCommand {
pub fn run(&self, keyword: &String) -> Result<(), String> {
let jira_search = SearchIssu... | Make possible to throw Err when write alfred items | :art: Make possible to throw Err when write alfred items
| Rust | mit | dorayakikun/alfred_jira_workflow |
dbf54c0a84221af6704c9c76ad4511c30bb7299b | croaring-sys/build.rs | croaring-sys/build.rs | extern crate bindgen;
extern crate cc;
use std::env;
use std::path::PathBuf;
fn main() {
cc::Build::new()
.flag("-std=c11")
.flag("-march=native")
.flag("-O3")
.file("CRoaring/roaring.c")
.compile("libroaring.a");
let bindings = bindgen::Builder::default()
.bla... | extern crate bindgen;
extern crate cc;
use std::env;
use std::path::PathBuf;
fn main() {
cc::Build::new()
.flag_if_supported("-std=c11")
.flag_if_supported("-march=native")
.flag_if_supported("-O3")
.file("CRoaring/roaring.c")
.compile("libroaring.a");
let bindings = b... | Build CRoaring with flags if compiler supports them | Build CRoaring with flags if compiler supports them
Prevents warning during Windows build. Possibly fixes #36.
| Rust | apache-2.0 | saulius/croaring-rs,saulius/croaring-rs,saulius/croaring-rs |
f8ae3cdcaacb29c7b56e546a9ddab1396b615f8f | src/test/run-pass/extern-pub.rs | src/test/run-pass/extern-pub.rs | use std::libc;
extern {
pub unsafe fn free(p: *libc::c_void);
}
pub fn main() {
}
| extern {
pub unsafe fn free(p: *u8);
}
pub fn main() {
}
| Fix test failure on windows | Fix test failure on windows
This patch ensures that the multiple extern definitions of `free` in the
run-pass tests have the same declaration, working around #7352.
| Rust | apache-2.0 | dwillmer/rust,GBGamer/rust,nham/rust,GBGamer/rust,ruud-v-a/rust,ruud-v-a/rust,LeoTestard/rust,barosl/rust,XMPPwocky/rust,mihneadb/rust,mihneadb/rust,XMPPwocky/rust,zachwick/rust,aneeshusa/rust,gifnksm/rust,aturon/rust,Ryman/rust,sae-bom/rust,quornian/rust,j16r/rust,ktossell/rust,andars/rust,nham/rust,mahkoh/rust,carols... |
e7896eb4ff650089df5526f12e61745783752f50 | tango-build.rs | tango-build.rs | extern crate tango;
extern crate lalrpop;
fn main() {
// I do not want lalrpop and tango to step on each others toes.
// So we will segregate the two source trees.
// lalrpop::process_root().unwrap();
tango::process_root().unwrap();
}
| extern crate tango;
extern crate lalrpop;
use std::env;
fn main() {
// I do not want lalrpop and tango to step on each others toes.
// So we will segregate the two source trees.
let cwd = env::current_dir().unwrap();
let grammar = {
let mut g = cwd.clone(); g.push("src/grammar"); g
};
... | Revise build script to only run tango on source files in `src/lit/src`. | Revise build script to only run tango on source files in `src/lit/src`.
| Rust | apache-2.0 | pnkfelix/mon-artiste |
365ea800bdb95ed91ac92697e5820ef4a5d7104f | src/librustc_back/target/armv5te_unknown_linux_gnueabi.rs | src/librustc_back/target/armv5te_unknown_linux_gnueabi.rs | // Copyright 2016 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 2016 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 ... | Set max_atomic_width to 0 because there's no atomic instructions on ARMv5 | Set max_atomic_width to 0 because there's no atomic instructions on ARMv5
| Rust | apache-2.0 | GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust |
58a4ae3131b7c219b2945a9f5f406533156ad02b | src/lib.rs | src/lib.rs | #[cfg(test)]
mod tests {
#[test]
fn it_works() {
}
}
| use std::ascii::AsciiExt;
struct Rotor<'a> {
rotor: &'a [u8]
}
impl<'a> Rotor<'a> {
pub fn new(rotor: &'a str) -> Rotor<'a> {
Rotor {
rotor: rotor.as_bytes(),
}
}
fn substitute(&self, c: char) -> char {
if !c.is_ascii() || !c.is_alphabetic() {
return c;... | Implement basic Rotor type with substitutions | Implement basic Rotor type with substitutions
| Rust | mit | iKevinY/ultra |
f8e08e75b7933ede962fce741ec1de672993cd99 | src/lib.rs | src/lib.rs | pub mod session_handler {
pub fn create(pName: &str) {
println!("Creating session for profile \"{}\"...", pName);
}
pub fn show() {
println!("Showing sessions...");
}
pub fn refresh() {
println!("Refreshing sessions...");
}
pub fn clean() {
println!("Cleani... | pub mod session_handler {
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
use std::env;
pub fn create(pName: &str) {
println!("Creating session for profile \"{}\"...", pName);
println!("{}",read_aws_config_file());
}
pub fn show() {
println!("Sho... | Add function reads AWS config file | Add function reads AWS config file
| Rust | mit | amongil/bluenine |
db9df3dfc93b6486bf8ba1199a12e7fefc7524cd | src/utils/reader.rs | src/utils/reader.rs | use std::io::{self, Read};
use views::Counter;
/// Wrapper around a `Read` that reports the progress made.
///
/// Used to monitor a file downloading or other slow IO task
/// in a progress bar.
pub struct ProgressReader<R: Read> {
reader: R,
counter: Counter,
}
impl<R: Read> ProgressReader<R> {
/// Cre... | use std::io::{self, Read};
use views::Counter;
/// Wrapper around a `Read` that reports the progress made.
///
/// Used to monitor a file downloading or other slow IO task
/// in a progress bar.
pub struct ProgressReader<R: Read> {
reader: R,
counter: Counter,
}
impl<R: Read> ProgressReader<R> {
/// Cre... | Add `deconstruct` method to `ProgressReader` | Add `deconstruct` method to `ProgressReader`
| Rust | mit | ConnyOnny/Cursive-Break,Gyscos/Cursive |
4fe167adba47478e1a443c7b82e67e020253eac8 | src/librustc_back/target/cloudabi_base.rs | src/librustc_back/target/cloudabi_base.rs | // Copyright 2017 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 2017 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 ... | Use the right TLS model for CloudABI. | Use the right TLS model for CloudABI.
CloudABI doesn't do dynamic linking. For this reason, there is no need
to handle any other TLS model than local-exec. CloudABI's C library
doesn't provide a __tls_get_addr() function to do Dynamic TLS.
By forcing local-exec to be used here, we ensure that we don't generate
functi... | Rust | apache-2.0 | GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust |
b21749f57d58706a2364200deefe51436afe46e0 | src/circt-sys/src/lib.rs | src/circt-sys/src/lib.rs | #![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
pub unsafe fn mlirStringRefCreateFromStr(s: impl AsRef<str>) -> MlirStringRef {
let s = s.as_ref().as_bytes();
MlirStringRef {
data: s.as_ptr() as *const _,
... | #![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
pub unsafe fn mlirStringRefCreateFromStr(s: impl AsRef<str>) -> MlirStringRef {
let s = s.as_ref().as_bytes();
MlirStringRef {
data: s.as_ptr() as *const _,
... | Add helper to go from MlirStringRef to &str | mlir: Add helper to go from MlirStringRef to &str
| Rust | apache-2.0 | fabianschuiki/moore,fabianschuiki/moore,fabianschuiki/moore,fabianschuiki/moore,fabianschuiki/moore |
008721c7a68b50c9897885affdc76d0273705a58 | src/common/api_result.rs | src/common/api_result.rs | // src/common/api_result.rs
/// API Result
/// Represents an API result
/// Value types include Success, Error, Failure
//Import modules
use ::rustc_serialize::{Encodable, json};
use ::common::validation::validation_result::ValidationResult;
pub enum ApiResult<T>{
Success{
result: T
},
Error{
... | // src/common/api_result.rs
/// API Result
/// Represents an API result
/// Value types include Success, Error, Failure
//Import modules
use ::rustc_serialize::{Encodable, json};
use ::common::validation::validation_result::ValidationResult;
pub enum ApiResult<T>{
Success{
result: T
},
Invalid{
... | Add failure and invalid ApiResult types | Add failure and invalid ApiResult types
| Rust | apache-2.0 | bpowers1215/MoneyMap,bpowers1215/MoneyMap,bpowers1215/MoneyMap,bpowers1215/MoneyMap |
e6be738d97d3e91741b4c064bd803fa8822aff96 | src/components/script/dom/windowproxy.rs | src/components/script/dom/windowproxy.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/. */
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
use script_task::page_from_context;
use js::js... | /* 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/. */
use dom::bindings::utils::{Reflectable, Reflector, BindingObject};
use script_task::page_from_context;
use js::js... | Fix infinite-looping reflector() implementation for WindowProxy. | Fix infinite-looping reflector() implementation for WindowProxy.
| Rust | mpl-2.0 | mbrubeck/servo,deokjinkim/servo,nrc/servo,tschneidereit/servo,tschneidereit/servo,CJ8664/servo,froydnj/servo,mattnenterprise/servo,paulrouget/servo,metajack/servo,upsuper/servo,srbhklkrn/SERVOENGINE,boghison/servo,srbhklkrn/SERVOENGINE,samfoo/servo,dsandeephegde/servo,cbrewster/servo,SimonSapin/servo,aweinstock314/serv... |
0cb1dbb18610f64a7f90319333030eafcc639f72 | prob0001_0050/prob0005.rs | prob0001_0050/prob0005.rs | use core::iterator::{ IteratorUtil };
use common::extvec;
use common::prime::{ Prime, factors_to_uint };
use common::monoid::{ mergei_as, Max };
use common::problem::{ Problem };
pub static problem: Problem<'static> = Problem {
id: 5,
answer: "232792560",
solver: solve
};
fn solve() -> ~str {
let mut... | use core::iterator::{ IteratorUtil };
use common::prime::{ Prime, factors_to_uint };
use common::monoid::{ Max, MergeMultiMonoidIterator, Unwrap };
use common::problem::{ Problem };
pub static problem: Problem<'static> = Problem {
id: 5,
answer: "232792560",
solver: solve
};
fn solve() -> ~str {
let ... | Use MergeMultMonoidIterator instead of mergei_as | Use MergeMultMonoidIterator instead of mergei_as
| Rust | mit | tempbottle/ProjectEulerRust,gifnksm/ProjectEulerRust |
2fd2a56063637c4051ee95cf5cb49c629b900aa7 | src/test/compile-fail/regions-in-consts.rs | src/test/compile-fail/regions-in-consts.rs | // xfail-test
const c_x: &blk/int = 22; //~ ERROR only the static region is allowed here
const c_y: &static/int = &22; //~ ERROR only the static region is allowed here
fn main() {
} | const c_x: &blk/int = &22; //~ ERROR only the static region is allowed here
const c_y: &static/int = &22;
fn main() {
} | Update error message and un-xfail test | Update error message and un-xfail test
| Rust | apache-2.0 | zaeleus/rust,kwantam/rust,omasanori/rust,ruud-v-a/rust,zubron/rust,nham/rust,rprichard/rust,dinfuehr/rust,pelmers/rust,vhbit/rust,krzysz00/rust,jbclements/rust,barosl/rust,seanrivera/rust,bombless/rust,zachwick/rust,omasanori/rust,hauleth/rust,erickt/rust,GBGamer/rust,zachwick/rust,seanrivera/rust,pshc/rust,pczarn/rust... |
4a832d32f232a68acdabfd29e526d2a4b6366a1c | src/test/ui/command/command-create-pidfd.rs | src/test/ui/command/command-create-pidfd.rs | // run-pass
// only-linux - pidfds are a linux-specific concept
#![feature(linux_pidfd)]
use std::os::linux::process::{CommandExt, ChildExt};
use std::process::Command;
fn main() {
// We don't assert the precise value, since the standard library
// might have opened other file descriptors before our code runs... | // run-pass
// only-linux - pidfds are a linux-specific concept
#![feature(linux_pidfd)]
#![feature(rustc_private)]
extern crate libc;
use std::io::Error;
use std::os::linux::process::{ChildExt, CommandExt};
use std::process::Command;
fn has_clone3() -> bool {
let res = unsafe { libc::syscall(libc::SYS_clone3, ... | Check whether clone3 syscall exists in pidfd test | Check whether clone3 syscall exists in pidfd test
| Rust | apache-2.0 | aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust |
8b67dd94c9c90a0633f3eebc6f3611bb0bb01e0e | traits/src/lib.rs | traits/src/lib.rs | pub trait Summarizable {
fn summary(&self) -> String;
}
pub struct NewsArticle {
pub headline: String,
pub location: String,
pub author: String,
pub content: String,
}
impl Summarizable for NewsArticle {
fn summary(&self) -> String {
format!("{}, by {} ({})", self.headline, self.author... | pub trait Summarizable {
fn summary(&self) -> String {
String::from("Read more...")
}
}
pub struct NewsArticle {
pub headline: String,
pub location: String,
pub author: String,
pub content: String,
}
impl Summarizable for NewsArticle {
fn summary(&self) -> String {
format!(... | Add default implementation for summary method on Summarizable trait | Add default implementation for summary method on Summarizable trait
| Rust | mit | pgrzesik/learning-rust |
9f7d4a529e190195ebb7f23238d3942616ff68b6 | components/core/src/os/system/linux.rs | components/core/src/os/system/linux.rs | use crate::{error::{Error,
Result},
os::system::Uname};
use errno::errno;
use libc;
use std::{ffi::CStr,
mem};
pub fn uname() -> Result<Uname> { unsafe { uname_libc() } }
unsafe fn uname_libc() -> Result<Uname> {
let mut utsname: libc::utsname = mem::MaybeUninit::uninit()... | use crate::{error::{Error,
Result},
os::system::Uname};
use errno::errno;
use libc;
use std::{ffi::CStr,
mem};
pub fn uname() -> Result<Uname> { unsafe { uname_libc() } }
unsafe fn uname_libc() -> Result<Uname> {
let mut utsname = mem::MaybeUninit::uninit();
let rv = ... | Make the MaybeUninit usage safer | Make the MaybeUninit usage safer
Signed-off-by: Josh Black <2831680e59d3b8be5b278b69b4e783c575edf378@gmail.com>
| Rust | apache-2.0 | rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat |
5617c6aa0f350dfc8bddc6dab3307b08e8053c6d | document/src/bin/open.rs | document/src/bin/open.rs | extern crate document;
use std::cmp::min;
use std::io::File;
use document::parser::Parser;
fn pretty_error(xml: &str, position: uint) -> &str {
let s = xml.slice_from(position);
let l = s.char_len();
s.slice_chars(0, min(l, 15))
}
fn main() {
let mut args = std::os::args();
let filename = args.... | extern crate document;
use std::cmp::min;
use std::io::File;
use std::io::BufferedWriter;
use std::io::stdio::stdout_raw;
use document::parser::Parser;
fn pretty_error(xml: &str, position: uint) -> &str {
let s = xml.slice_from(position);
let l = s.char_len();
s.slice_chars(0, min(l, 15))
}
fn main() {
... | Use a byte-oriented buffer instead of line-oriented | Use a byte-oriented buffer instead of line-oriented
We don't care about interacting with the user here, so lines are an
artifical construct. Instead, just buffer it like anything else.
On a 100MB XML file, this reduced time to open, parse, and output it
to /dev/null by 1.4 seconds (taking 82% of the previous time).
| Rust | mit | shepmaster/sxd-rust |
c024251a956eb82a1d76d4ac9d8d96c79b09964e | protobuf-test/src/v2/test_tokio_bytes_default_value.rs | protobuf-test/src/v2/test_tokio_bytes_default_value.rs | use protobuf::*;
use super::test_tokio_bytes_default_value_pb::*;
#[test]
fn test_default_values() {
assert_eq!(
"sss",
TestTokioBytesDefaultValues::default_instance().get_s()
);
assert_eq!(
b"bbb",
TestTokioBytesDefaultValues::default_instance().get_b()
);
assert_e... | use protobuf::*;
use super::test_tokio_bytes_default_value_pb::*;
#[test]
fn test_default_values() {
assert_eq!("sss", TestTokioBytesDefaultValues::default_instance().s());
assert_eq!(b"bbb", TestTokioBytesDefaultValues::default_instance().b());
assert_eq!(&""[..], &**TestTokioBytesDefaultValues::new().mu... | Fix tests with bytes feature enabled | Fix tests with bytes feature enabled
| Rust | mit | stepancheg/rust-protobuf,stepancheg/rust-protobuf,stepancheg/rust-protobuf |
f988d29b2f19bc6458a81bd44a9191097e7d6c92 | nucleotide-count/src/lib.rs | nucleotide-count/src/lib.rs | use std::collections::HashMap;
use std::collections::hash_map::Entry;
const LIBRARY: [char; 4] = ['A', 'C', 'G', 'T'];
pub fn count(c: char, seq: &str) -> Result<usize, String> {
if LIBRARY.contains(&c) && seq.chars().all(|x| LIBRARY.contains(&x)) {
Ok(seq.chars().filter(|x| x == &c).count())
} else {... | use std::collections::HashMap;
use std::collections::hash_map::Entry;
const LIBRARY: [char; 4] = ['A', 'C', 'G', 'T'];
pub fn count(c: char, seq: &str) -> Result<usize, String> {
if !LIBRARY.contains(&c) {
return Err("Not a nucleotide!".to_owned());
}
let mut count = 0;
for x in seq.chars() {... | Improve nucleotide code by only iterating sequence once instead of twice in count() | Improve nucleotide code by only iterating sequence once instead of twice in count()
| Rust | mit | ragnese/exercism-rust |
216eecc18e47ec6290453d7bd26e67b524cc5162 | src/templates.rs | src/templates.rs | macro_rules! toml_template {
($name: expr) => {
format_args!(r##"
[package]
name = "{0}-fuzz"
version = "0.0.1"
authors = ["Automatically generated"]
publish = false
[package.metadata]
cargo-fuzz = true
[dependencies.{0}]
path = ".."
[dependencies.libfuzzer-sys]
git = "https://github.com/rust-fuzz/libfuzzer-sys.g... | macro_rules! toml_template {
($name: expr) => {
format_args!(r##"
[package]
name = "{0}-fuzz"
version = "0.0.1"
authors = ["Automatically generated"]
publish = false
[package.metadata]
cargo-fuzz = true
[dependencies.{0}]
path = ".."
[dependencies.libfuzzer-sys]
git = "https://github.com/rust-fuzz/libfuzzer-sys.g... | Switch to using libfuzzer macro | Switch to using libfuzzer macro
| Rust | apache-2.0 | rust-fuzz/cargo-fuzz |
e3cee9fcabd8ab60b52512bc5e498350cf00055e | 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: use the new attributes syntax. | Update to current rust: use the new attributes syntax.
| Rust | apache-2.0 | servo/sharegl |
ac8b8159f8da6a9776ee58cae0a12db953a69aca | rust/etl/src/lib.rs | rust/etl/src/lib.rs | use std::collections::BTreeMap;
use std::ascii::AsciiExt;
pub fn transform(input: &BTreeMap<i32, Vec<char>>) -> BTreeMap<char, i32> {
let mut result: BTreeMap<char, i32> = BTreeMap::new();
for (k, v) in input {
for c in v {
result.entry((*c).to_ascii_lowercase()).or_insert(*k);
}
... | use std::collections::BTreeMap;
use std::ascii::AsciiExt;
pub fn transform(input: &BTreeMap<i32, Vec<char>>) -> BTreeMap<char, i32> {
input
.iter()
.flat_map(|(k, v)| v.iter().map(move |x| (x.to_ascii_lowercase(), *k)))
.collect()
}
| Change rust code for etl | Change rust code for etl
I like this functional programming style
| Rust | bsd-2-clause | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism |
c2b156941d5db2fe3e22ddb83e9b3ff821201499 | tests/test_expr.rs | tests/test_expr.rs | extern crate proc_macro2;
extern crate syn;
use std::str::FromStr;
use proc_macro2::TokenStream;
use syn::{Expr, ExprRange};
#[test]
fn test_expr_parse() {
let code = "..100u32";
let tt = TokenStream::from_str(code).unwrap();
let expr: Expr = syn::parse2(tt.clone()).unwrap();
let expr_range: ExprRang... | extern crate proc_macro2;
extern crate syn;
#[macro_use]
mod macros;
use std::str::FromStr;
use proc_macro2::TokenStream;
use syn::{Expr, ExprRange};
#[test]
fn test_expr_parse() {
let code = "..100u32";
let tt = TokenStream::from_str(code).unwrap();
let expr: Expr = syn::parse2(tt.clone()).unwrap();
... | Add snapshot test for parsing await expr | Add snapshot test for parsing await expr
| Rust | apache-2.0 | dtolnay/syn |
d740df46ced14b57af1e251f9b8e7e1c75c4bc5b | src/serde_utils.rs | src/serde_utils.rs | use serde::Serializer;
use std::fmt::Display;
/// For the times when the `Display` string is more appropriate than the default serialization
/// strategy
pub fn display_it<T, S>(data: &T, serializer: S) -> Result<S::Ok, S::Error>
where
T: Display,
S: Serializer,
{
serializer.collect_str(data)
}
| use serde::Serializer;
use std::fmt::Display;
/// For the times when the `Display` string is more appropriate than the default serialization
/// strategy. This function is useful for 64bit integers, as 64bit integers can't be represented
/// wholly in floating point notation, which is how Javascript views all numbers.... | Expand documentation on why 64bit ints are serialized to strings | Expand documentation on why 64bit ints are serialized to strings
| Rust | mit | nickbabcock/boxcars,nickbabcock/boxcars |
ccf3babbebc7857bd6b5253af216c2880bd36ddc | 16_communicator/src/lib.rs | 16_communicator/src/lib.rs | mod network {
fn connect() {
}
}
mod client {
fn connect() {
}
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
}
}
| mod network {
fn connect() {
}
mod client {
fn connect() {
}
}
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
}
}
| Move client module inside network module | Move client module inside network module
| Rust | mit | pgrzesik/learning-rust |
ffbc9b9a22f0c202223a68a5f6f5453b970610da | build.rs | build.rs | #[cfg(not(feature = "serde_macros"))]
mod inner {
extern crate serde_codegen;
extern crate syntex;
use std::env;
use std::path::Path;
const MODULES: &'static[&'static str] = &[
"error",
"keys",
"stats",
"version",
];
pub fn main() {
let out_dir = en... | #[cfg(not(feature = "serde_macros"))]
mod inner {
extern crate serde_codegen;
use std::env;
use std::path::Path;
const MODULES: &'static[&'static str] = &[
"error",
"keys",
"stats",
"version",
];
pub fn main() {
let out_dir = env::var_os("OUT_DIR").unwr... | Fix compilation error due to syntex mismatched types | Fix compilation error due to syntex mismatched types
Error:
build.rs:27:37: 27:50 error: mismatched types:
expected `&mut syntex::Registry`,
found `&mut inner::syntex::Registry`
(expected struct `syntex::Registry`,
found struct `inner::syntex::Registry`) [E0308]
build.rs:27 serde_codegen::register(&mut reg... | Rust | mit | jimmycuadra/rust-etcd |
91b211fe1c345eca81f0c2b15baf9d478e08f9b8 | build.rs | build.rs | use std::env;
use std::process::Command;
use std::str::{self, FromStr};
// The rustc-cfg strings below are *not* public API. Please let us know by
// opening a GitHub issue if your build environment requires some way to enable
// these cfgs other than by executing our build script.
fn main() {
let compiler = match... | use std::env;
use std::process::Command;
use std::str;
// The rustc-cfg strings below are *not* public API. Please let us know by
// opening a GitHub issue if your build environment requires some way to enable
// these cfgs other than by executing our build script.
fn main() {
let compiler = match rustc_version() ... | Remove parsing of rustc minor version | Remove parsing of rustc minor version
| Rust | apache-2.0 | dtolnay/syn |
ebec32eaf6833eb77e43c5d74a30ea42e24c413b | src/lib.rs | src/lib.rs | #![feature(unsafe_destructor, if_let, globs)]
extern crate libc;
pub use udev::udev::Udev;
mod udev;
pub mod hwdb {
pub use udev::hwdb::{
Hwdb,
Query,
HwdbIterator,
};
}
pub mod device {
pub use udev::device::{
Device,
Devnum,
Type,
TagIterator,
... | #![feature(unsafe_destructor, if_let, globs)]
extern crate libc;
pub use udev::udev::Udev;
mod udev;
pub mod hwdb {
pub use udev::hwdb::{
Hwdb,
Query,
HwdbIterator,
};
}
pub mod device {
pub use udev::device::{
Device,
Devnum,
Type,
TagIterator,
... | Move tests into separate module | Move tests into separate module
| Rust | lgpl-2.1 | Stebalien/udev-rs |
fe7d2e5df535245839471f6ba48861f68e117af2 | tests/large_number.rs | tests/large_number.rs | use ron::value::Number;
#[test]
fn test_large_number() {
use ron::value::Value;
let test_var = Value::Number(Number::new(10000000000000000000000.0f64));
let test_ser = ron::ser::to_string(&test_var).unwrap();
let test_deser = ron::de::from_str::<Value>(&test_ser);
assert_eq!(
test_deser.un... | use ron::value::{Number, Value};
#[test]
fn test_large_number() {
let test_var = Value::Number(Number::new(10000000000000000000000.0f64));
let test_ser = ron::ser::to_string(&test_var).unwrap();
let test_deser = ron::de::from_str::<Value>(&test_ser);
assert_eq!(
test_deser.unwrap(),
Va... | Add test for decoding large integer into float | Add test for decoding large integer into float
| Rust | apache-2.0 | ron-rs/ron |
4ea00547130b56456542bfd225f9226287515b14 | src/lib.rs | src/lib.rs | #![feature(collections, std_misc, core)]
#![feature(libc)]
extern crate libc;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate bitflags;
#[macro_use]
pub mod macros;
#[allow(non_camel_case_types, non_snake_case, raw_pointer_derive, dead_code)]
pub mod ffi;
pub mod error;
pub mod sync {
pub fn... | #![feature(collections, std_misc, core)]
#![feature(hash)] // temporarily, because of warnings in bitflags
#![feature(libc)]
extern crate libc;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate bitflags;
#[macro_use]
pub mod macros;
#[allow(non_camel_case_types, non_snake_case, raw_pointer_derive, ... | Update to the latest rustc (temporarily suppress "hash" warnings in bitflags) | Update to the latest rustc (temporarily suppress "hash" warnings in bitflags)
| Rust | apache-2.0 | kkirstein/hdf5-rs |
0bc5b2a959975de3eb439134a094ff143d706860 | src/lib.rs | src/lib.rs | // Copyright 2014 The syscall.rs 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>... | // Copyright 2014 The syscall.rs 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>... | Upgrade to rustc 0.13.0-dev (395901393 2014-11-24 00:46:30 +0000) | Upgrade to rustc 0.13.0-dev (395901393 2014-11-24 00:46:30 +0000)
| Rust | apache-2.0 | ebfe/syscall.rs,kmcallister/syscall.rs |
1536833b5d8edba57a2f06f14fc80cf2375c4df4 | src/lib.rs | src/lib.rs |
pub fn puzzle(input: &str) -> u32 {
0
}
pub fn contains_abba(candidate: &str) -> bool {
let by_chars: Vec<char> = candidate.chars().collect();
for (i, &c) in by_chars.iter().enumerate() {
if i + 3 < by_chars.len() &&
c != by_chars[i + 1] &&
by_chars[i + 1] == by_chars[i + ... |
pub fn puzzle(input: &str) -> u32 {
0
}
pub fn supports_tls(candidate: &str) -> bool {
false
}
pub fn contains_abba(candidate: &str) -> bool {
let by_chars: Vec<char> = candidate.chars().collect();
for (i, &c) in by_chars.iter().enumerate() {
if i + 3 < by_chars.len() &&
c != by_... | Set up some failing tests for the samples | Set up some failing tests for the samples
| Rust | mit | carols10cents/adventofcode-rs |
22ae0720c25159554a580d7affc00da0e2727ae7 | rusty.rs | rusty.rs | extern mod std;
#[test]
fn test_tokenize() {
assert tokenize( ~"(1 2 3)" ) == ~[~"(", ~"1", ~"2", ~"3", ~")"];
}
#[test]
fn test_tokenize_empty() {
assert tokenize( ~"" ) == ~[];
}
#[test]
fn test_tokenize_no_spaces() {
assert tokenize( ~"one" ) == ~[~"one"];
}
#[test]
fn test_addspaces() {
assert a... | extern mod std;
#[test]
fn test_tokenize() {
assert tokenize( ~"(1 2 3)" ) == ~[~"(", ~"1", ~"2", ~"3", ~")"];
}
#[test]
fn test_tokenize_empty() {
assert tokenize( ~"" ) == ~[];
}
#[test]
fn test_tokenize_no_spaces() {
assert tokenize( ~"one" ) == ~[~"one"];
}
#[test]
fn test_pad_parentheses() {
as... | Rename addspaces to pad_parentheses and add tests | Rename addspaces to pad_parentheses and add tests
| Rust | mit | martica/rusty |
1e6af1563809bbcf375faada1e5c0732d76c2cd9 | src/utility/types.rs | src/utility/types.rs | use nom::IResult;
pub trait StreamProducer {
fn parse<F, T>(&mut self, f: F) -> Result<T, ErrorKind>
where F: FnOnce(&[u8]) -> IResult<&[u8], T>;
}
| use nom::{IResult, Needed};
pub enum ErrorKind {
EndOfInput,
Unknown,
}
pub trait StreamProducer {
fn parse<F, T>(&mut self, f: F) -> Result<T, ErrorKind>
where F: FnOnce(&[u8]) -> IResult<&[u8], T>;
}
pub struct ByteStream<'a> {
offset: usize,
bytes: &'a [u8],
}
impl<'a> ByteStream<'a> {
pub fn new(... | Add `ByteStream` for entire files of a byte slice | Add `ByteStream` for entire files of a byte slice
| Rust | bsd-3-clause | sourrust/flac |
6957309724e3f4030fb41d400a6932ed9a5dad0a | src/aserror.rs | src/aserror.rs | use std::error::Error;
use std::panic::UnwindSafe;
pub trait AsDynError<'a> {
fn as_dyn_error(&self) -> &(dyn Error + 'a);
}
impl<'a, T: Error + 'a> AsDynError<'a> for T {
#[inline]
fn as_dyn_error(&self) -> &(dyn Error + 'a) {
self
}
}
impl<'a> AsDynError<'a> for dyn Error + 'a {
#[inlin... | use self::private::Sealed;
use std::error::Error;
use std::panic::UnwindSafe;
pub trait AsDynError<'a>: Sealed {
fn as_dyn_error(&self) -> &(dyn Error + 'a);
}
impl<'a, T: Error + 'a> AsDynError<'a> for T {
#[inline]
fn as_dyn_error(&self) -> &(dyn Error + 'a) {
self
}
}
impl<'a> AsDynError<'... | Add Sealed supertrait to private AsDynError trait | Add Sealed supertrait to private AsDynError trait
| Rust | apache-2.0 | dtolnay/thiserror |
7c11c3ff93cef12aae0c790dc0032c380b6d531a | examples/eigh.rs | examples/eigh.rs | extern crate ndarray;
extern crate ndarray_linalg;
use ndarray::*;
use ndarray_linalg::*;
fn main() {
let a = arr2(&[[3.0, 1.0, 1.0], [1.0, 3.0, 1.0], [1.0, 1.0, 3.0]]);
let (e, vecs): (Array1<_>, Array2<_>) = a.clone().eigh(UPLO::Upper).unwrap();
println!("eigenvalues = \n{:?}", e);
println!("V = \n{... | extern crate ndarray;
extern crate ndarray_linalg;
use ndarray::*;
use ndarray_linalg::*;
fn main() {
let a = arr2(&[[3.0, 1.0, 1.0], [1.0, 3.0, 1.0], [1.0, 1.0, 3.0]]);
let (e, vecs) = a.clone().eigh(UPLO::Upper).unwrap();
println!("eigenvalues = \n{:?}", e);
println!("V = \n{:?}", vecs);
let av ... | Drop type annotation from example | Drop type annotation from example
| Rust | mit | termoshtt/ndarray-linalg |
ab899c7690ff1ab30d8f76d9b85fc7beb72e8d1f | tests/compile-fail/arity-2.rs | tests/compile-fail/arity-2.rs | #![feature(plugin)]
#![plugin(plague)]
plague! {
for [ //~ERROR: this function takes 0 parameters but 2 parameters were supplied
(1, 2),
]
test fn foo() {
}
}
fn main() {}
| #![feature(plugin)]
#![plugin(plague)]
plague! {
for [
(1, 2), //~ERROR: this function takes 0 parameters but 2 parameters were supplied
]
test fn foo() {
}
}
fn main() {}
| Fix a test that broke on a recent nightly | Fix a test that broke on a recent nightly
| Rust | mit | mcarton/rust-plague,mcarton/rust-plague |
210ed06bdb2b8042207cb91cfb84ee2e04bb6d11 | askama_derive/src/lib.rs | askama_derive/src/lib.rs | extern crate askama;
extern crate proc_macro;
extern crate syn;
use proc_macro::TokenStream;
fn get_path_from_attrs(attrs: &[syn::Attribute]) -> String {
let attr = attrs.iter().find(|a| a.name() == "template").unwrap();
if let syn::MetaItem::List(_, ref inner) = attr.value {
if let syn::NestedMetaIte... | extern crate askama;
extern crate proc_macro;
extern crate syn;
use proc_macro::TokenStream;
struct TemplateMeta {
path: String,
}
fn get_path_from_attrs(attrs: &[syn::Attribute]) -> TemplateMeta {
let mut path = None;
let attr = attrs.iter().find(|a| a.name() == "template").unwrap();
if let syn::Met... | Define struct to represent template metadata | Define struct to represent template metadata
| Rust | apache-2.0 | djc/askama,djc/askama,djc/askama |
dd3ca0adaf1c94ce1b5ce7495e0eae2bfc1dc793 | rubbem/src/main.rs | rubbem/src/main.rs | extern crate gtk;
use gtk::traits::*;
fn main() {
if !gtk::init_check() {
println!("Cannot start because GTK is not working / available");
return;
}
match gtk::Window::new(gtk::WindowType::TopLevel) {
None => println!("Unable to create a GTK window."),
Some(window) => {
... | extern crate gtk;
use gtk::traits::*;
fn main() {
match gtk::init() {
Err(_) => println!("Cannot start because GTK is not working / available."),
Ok(_) => gtk_main()
}
}
fn gtk_main()
{
match gtk::Window::new(gtk::WindowType::TopLevel) {
None => println!("Unable to create a GTK wi... | Use new version of gtk:init() that returns a Result | CG: Use new version of gtk:init() that returns a Result
| Rust | agpl-3.0 | cjgreenaway/rubbem |
92fb4cebbd9b2bdf4a6297588be5ce4b2114b084 | src/class/any_object.rs | src/class/any_object.rs | use std::convert::From;
use types::Value;
use super::array::Array;
use super::class::Class;
use super::fixnum::Fixnum;
use super::hash::Hash;
use super::string::RString;
use super::traits::Object;
#[derive(Clone)]
pub struct AnyObject {
value: Value
}
impl AnyObject {
pub fn as_array(&self) -> Array {
... | use types::Value;
use super::array::Array;
use super::boolean::Boolean;
use super::class::Class;
use super::fixnum::Fixnum;
use super::hash::Hash;
use super::string::RString;
use super::symbol::Symbol;
use super::traits::Object;
#[derive(Clone)]
pub struct AnyObject {
value: Value
}
impl AnyObject {
pub fn ... | Add as_boolean and as_symbol to AnyObject | Add as_boolean and as_symbol to AnyObject
| Rust | mit | d-unseductable/ruru |
d9e61a5ebe2d3bc0b1077f304a31bf377d9c83d0 | tests/test_ty.rs | tests/test_ty.rs | use syn::Type;
#[test]
fn test_mut_self() {
syn::parse_str::<Type>("fn(mut self)").unwrap();
syn::parse_str::<Type>("fn(mut self: ())").unwrap();
syn::parse_str::<Type>("fn(mut self: ...)").unwrap_err();
syn::parse_str::<Type>("fn(mut self: mut self)").unwrap_err();
syn::parse_str::<Type>("fn(mut s... | #[macro_use]
mod macros;
use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree};
use quote::quote;
use std::iter::FromIterator;
use syn::Type;
#[test]
fn test_mut_self() {
syn::parse_str::<Type>("fn(mut self)").unwrap();
syn::parse_str::<Type>("fn(mut self: ())").unwrap();
... | Add test for Type containing macro metavariable | Add test for Type containing macro metavariable
| Rust | apache-2.0 | dtolnay/syn |
96f7f2f85abc8de30ceacfb45834b368ae02072c | src/common/macros.rs | src/common/macros.rs | #![allow(unused_macros)]
macro_rules! gen_hashmap {
{$($key: expr => $value: expr),*} => {
{
let mut hashmap = HashMap::new();
$(
hashmap.insert($key, $value);
)*
hashmap
}
}
} | #![allow(unused_macros)]
macro_rules! gen_hashmap {
(@single $($e: tt)*) => (());
(@count $($e: expr)*) => (<[()]>::len(&[$(gen_hashmap!(@single $e)),*]));
($($key: expr => $value: expr,)+) => (gen_hashmap!($($key => $value),+));
{$($key: expr => $value: expr),*} => {
{
let cou... | Fix gen_hashmap! and improve it's performance | Fix gen_hashmap! and improve it's performance | Rust | mit | yinyanlv/runner,yinyanlv/runner,yinyanlv/runner |
89e244930fe01288703aba3e2ef57a8c4e360b21 | src/quiz/dao.rs | src/quiz/dao.rs | extern crate dotenv;
extern crate diesel;
use self::dotenv::dotenv;
use std::env;
use self::diesel::prelude::*;
use self::diesel::pg::PgConnection;
pub fn establish_connection() -> PgConnection {
dotenv().ok();
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
PgConnection::... | extern crate dotenv;
extern crate diesel;
use self::dotenv::dotenv;
use std::env;
use self::diesel::prelude::*;
use self::diesel::pg::PgConnection;
use super::model::*;
type Result<T> = self::diesel::QueryResult<T>;
pub struct Dao {
conn: PgConnection,
}
impl Dao {
pub fn new() -> Self {
Dao { conn:... | Add DAO functionality to add category | Add DAO functionality to add category
| Rust | agpl-3.0 | SirRade/homepage,SirRade/homepage,SirRade/homepage |
3ee6cf2273b1b6697ded93b0d4ba9295a67547b5 | rayon-core/src/unwind.rs | rayon-core/src/unwind.rs | //! Package up unwind recovery. Note that if you are in some sensitive
//! place, you can use the `AbortIfPanic` helper to protect against
//! accidental panics in the rayon code itself.
use libc;
use std::any::Any;
use std::panic::{self, AssertUnwindSafe};
use std::io::stderr;
use std::io::prelude::*;
use std::thread... | //! Package up unwind recovery. Note that if you are in some sensitive
//! place, you can use the `AbortIfPanic` helper to protect against
//! accidental panics in the rayon code itself.
#[cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))]
use libc;
#[cfg(all(target_arch = "wasm32", not(target_os = "emsc... | Use process::abort() instead of libc::abort() for wasm32 | Use process::abort() instead of libc::abort() for wasm32
| Rust | apache-2.0 | cuviper/rayon,cuviper/rayon |
9a9075114c12c89b87e5463da606195cae550674 | tests/test_shutdown.rs | tests/test_shutdown.rs | use assert_cmd::prelude::*;
use std::process::{Command, Stdio};
use anyhow::{Context, Result};
use nix::sys::signal::{kill, Signal};
use nix::unistd::Pid;
mod helper;
use helper::*;
#[cfg(target_os = "linux")]
#[test]
/// Spin up the daemon and send a SIGTERM shortly afterwards.
/// This should trigger the graceful... | use assert_cmd::prelude::*;
use std::process::{Command, Stdio};
use anyhow::{Context, Result};
mod helper;
use helper::*;
#[cfg(target_os = "linux")]
#[test]
/// Spin up the daemon and send a SIGTERM shortly afterwards.
/// This should trigger the graceful shutdown and kill the process.
fn test_ctrlc() -> Result<()... | Fix unix import in tests for windows | bug: Fix unix import in tests for windows
| Rust | mit | Nukesor/Pueue,Nukesor/Pueuew |
a6fd3c2ee8cc7025dea3a8fbbf7da1285f613b96 | src/main.rs | src/main.rs | use std::io;
use std::collections::HashSet;
extern crate syn;
extern crate clap;
use clap::{Arg, App};
mod rust_lib;
mod bindgen;
fn main() {
let matches = App::new("cbindgen")
.version("0.1.0")
.about("Generate C bindings for a Rust library")
.arg(Arg... | use std::io;
use std::fs::File;
use std::collections::HashSet;
extern crate syn;
extern crate clap;
use clap::{Arg, App};
mod rust_lib;
mod bindgen;
fn main() {
let matches = App::new("cbindgen")
.version("0.1.0")
.about("Generate C bindings for a Rust library")
... | Allow specifying an output file on the command line | Allow specifying an output file on the command line
| Rust | mpl-2.0 | eqrion/cbindgen,rlhunt/cbindgen,rlhunt/cbindgen,eqrion/cbindgen,eqrion/cbindgen |
e5866136d3d7f2e6ef0cbf8cd12d6adb23d6d0fd | src/main.rs | src/main.rs | extern crate ratel;
extern crate iron;
use std::io::Read;
use iron::prelude::*;
use iron::status;
use ratel::error::ParseError;
fn compile(source: String, minify: bool) -> Result<String, ParseError> {
let mut ast = match ratel::parser::parse(source) {
Ok(ast) => ast,
Err(error) => return Err(er... | extern crate ratel;
extern crate iron;
use std::io::Read;
use iron::prelude::*;
use iron::status;
use ratel::error::ParseError;
const DEFAULT_PORT: u16 = 3000;
fn compile(source: String, minify: bool) -> Result<String, ParseError> {
let mut ast = match ratel::parser::parse(source) {
Ok(ast) => ast,
... | Allow for the port to be set by env variable | Allow for the port to be set by env variable
| Rust | mit | ratel-rust/ratel-server |
f047863be5958a55cbf8891f32d2cc1b8aef9b2f | src/main.rs | src/main.rs | fn main() {
println!("Hello, world!");
}
| use std::{env, process};
fn main() {
let token = match env::var("GITHUB_SWEEP_TOKEN") {
Ok(val) => val,
Err(e) => {
println!("Error reading GITHUB_SWEEP_TOKEN environment variable: {}", e);
process::exit(1)
}
};
println!("{}", token);
}
| Read token from environment variable | Read token from environment variable
| Rust | mit | matt-thomson/github-sweep |
d9ce862c6a5ea7eb77f68952aca3ee857c225078 | src/lib.rs | src/lib.rs | extern crate libc as real_libc;
#[macro_use]
extern crate bitflags;
#[cfg(target_os = "linux")]
#[path = "platform/linux.rs"]
#[macro_use]
mod platform;
pub use platform::*;
/// A hack to get the macros to work nicely.
#[doc(hidden)]
pub use real_libc as libc;
extern "C" {
pub fn ioctl(fd: libc::c_int, req: lib... | extern crate libc as real_libc;
#[macro_use]
extern crate bitflags;
#[cfg(target_os = "linux")]
#[path = "platform/linux.rs"]
#[macro_use]
mod platform;
pub use platform::*;
/// A hack to get the macros to work nicely.
#[doc(hidden)]
pub use real_libc as libc;
extern "C" {
#[doc(hidden)]
pub fn ioctl(fd: li... | Hide the ioctl FFI declaration | [doc] Hide the ioctl FFI declaration
| Rust | apache-2.0 | cmr/ioctl,cmr/ioctl |
df663fb6c7819a88bc2175fda7cae1be855fc1f1 | src/lib.rs | src/lib.rs | //! A crate for parsing Markdown in Rust
#![crate_name = "markdown"]
#![deny(missing_docs)]
// #![deny(warnings)]
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
extern crate regex;
#[macro_use]
extern crate pipeline;
use std::fs::File;
use std::path::Path;
use std::io... | //! A crate for parsing Markdown in Rust
#![crate_name = "markdown"]
#![deny(missing_docs)]
// #![deny(warnings)]
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
extern crate regex;
#[macro_use]
extern crate pipeline;
use std::fs::File;
use std::path::Path;
use std::io... | Replace match blocks with try! macro | Replace match blocks with try! macro
| Rust | apache-2.0 | johannhof/markdown.rs |
7e7510774cf32aa7f43eb8ba1b67aff673fcc065 | src/lib.rs | src/lib.rs | pub fn distance(input: &str) -> i32 {
3
} | pub fn distance(input: &str) -> u32 {
let mut chars = input.chars();
if let (Some(turn_dir), Some(num_blocks)) = (chars.next(), chars.next()) {
let num_blocks: u32 = num_blocks.to_string()
.parse()
.expect("Cannot parse");
... | Handle one instruction that goes one block | Handle one instruction that goes one block
| Rust | mit | carols10cents/adventofcode-rs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.