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
5f8693ee078674cb9f299ac29fc5e7c93bf86ee2
src/lib.rs
src/lib.rs
//! Implementation of the `Synth` struct for basic polyphonic, multi-oscillator envelope synthesis. extern crate envelope as envelope_lib; extern crate gaussian; pub extern crate instrument; extern crate panning; extern crate pitch_calc as pitch; extern crate time_calc as time; extern crate rand; extern crate rustc_se...
//! Implementation of the `Synth` struct for basic polyphonic, multi-oscillator envelope synthesis. extern crate envelope as envelope_lib; extern crate gaussian; pub extern crate instrument; extern crate panning; extern crate pitch_calc as pitch; extern crate time_calc as time; extern crate rand; extern crate sample; ...
Remove now unused rustc_serialize crate.
Remove now unused rustc_serialize crate.
Rust
mit
RustAudio/synth
48e0f22fae27fd895b2c01c706d8255a7e63f0c3
src/jira_client.rs
src/jira_client.rs
extern crate serde; extern crate serde_json; use hyper::Client; use hyper::client::{Body, Response}; use hyper::header::Headers; use hyper::status::StatusCode; use jira_request::*; use std::io::Read; pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<Vec<T>, String> { let client = Client...
extern crate serde; extern crate serde_json; use hyper::Client; use hyper::client::{Body, Response}; use hyper::header::Headers; use hyper::status::StatusCode; use jira_request::*; use std::io::Read; pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<T, String> { let client = Client::new...
Change the return value to the generic single type
:art: Change the return value to the generic single type
Rust
mit
dorayakikun/alfred_jira_workflow
b36e5fa7212a628ca2618fd78391309275a557b2
src/lib.rs
src/lib.rs
//! termion is a pure Rust library for reading, manipulating, and handling terminals. //! //! This crate is not stable, yet. However, if you do want stability, you should specify the //! revision (commit hash) in your `Cargo.toml`, this way builds are complete reproducible, and won't //! break. #![warn(missing_docs)] ...
//! termion is a pure Rust library for reading, manipulating, and handling terminals. //! //! This crate is not stable, yet. However, if you do want stability, you should specify the //! revision (commit hash) in your `Cargo.toml`, this way builds are complete reproducible, and won't //! break. #![warn(missing_docs)] ...
Fix build with 'nightly' feature
Fix build with 'nightly' feature
Rust
mit
Ticki/libterm,ftilde/termion,ticki/termion
ca1651aaf2651d21d5268ba9b7edc016f4c4801f
src/tests/one_or_many.rs
src/tests/one_or_many.rs
//use serde::de::Deserialize; use super::super::link::HalLink; use super::super::resource::OneOrMany; use serde_json::{from_str, to_string}; use serde::*; #[derive(Serialize, Deserialize)] struct Boh<T:Clone> { oom: OneOrMany<T> } #[test] fn ensure_one_object_gets_serialized_as_one() { let boh: Boh<String> = ...
//use serde::de::Deserialize; use super::super::link::HalLink; use super::super::resource::OneOrMany; use serde_json::{from_str, to_string}; use serde::*; #[derive(Serialize, Deserialize)] struct Boh { oom: OneOrMany<String> } #[test] fn ensure_one_object_gets_serialized_as_one() { let boh = Boh { oom: OneOrM...
Fix the tests for OneOrMany.
Fix the tests for OneOrMany.
Rust
mit
pduval/rustic_hal
43632905df9972114f2f15b92177e7f9b36e4277
src/lib.rs
src/lib.rs
extern crate time; extern crate serde; extern crate serde_json; mod user; mod message; pub mod json; pub use self::user::*; pub use self::message::*;
//! `chattium-oxide-client` and `chattium-oxide-server` common files //! //! chattium-oxide-client: https://github.com/nabijaczleweli/chattium-oxide-client //! chattium-oxide-server: https://github.com/nabijaczleweli/chattium-oxide-server extern crate time; extern crate serde; extern crate serde_json; mod user; mod m...
Add stub root module documentation
Add stub root module documentation
Rust
mit
nabijaczleweli/chattium-oxide-lib
3a8fa9325a54a4ca4837cc63a577f4cf9c78056c
src/lib.rs
src/lib.rs
//! Implementation of the Micro Transport Protocol.[^spec] //! //! [^spec]: http://www.bittorrent.org/beps/bep_0029.html // __________ ____ ____ // /_ __/ __ \/ __ \/ __ \ // / / / / / / / / / / / / // / / / /_/ / /_/ / /_/ / // /_/ \____/_____/\____/ // // - Lossy UDP socket for testing purposes: send and r...
//! Implementation of the Micro Transport Protocol.[^spec] //! //! [^spec]: http://www.bittorrent.org/beps/bep_0029.html //! # Examples //! //! ``` //! extern crate utp; //! //! use utp::UtpStream; //! use std::io::{Read, Write}; //! //! fn main() { //! // Connect to an hypothetical local server running on port 80...
Add example to module documentation.
Add example to module documentation.
Rust
apache-2.0
dirvine/rust-utp
b0d666e6a04ae603af2ae369dfc3c7a1b8ccc85b
src/lib.rs
src/lib.rs
pub mod ascii_writer; pub mod markdown_writer;
pub mod ascii_writer; pub mod markdown_writer; pub struct Table { rows: Vec<Vec<String>>, has_headers: bool, } pub struct Error {} pub trait Read { fn read(&mut self) -> Result<Table, Error>; } pub trait Write { fn write(&self, table: Table) -> Result<(), Error>; }
Add Table type, Read, Write trait
Add Table type, Read, Write trait
Rust
mit
naoty/table
3a943c6df6a96de52fec357c40e773a8c1e67351
src/lib.rs
src/lib.rs
#[macro_use] extern crate nom; extern crate serde; #[macro_use] extern crate serde_derive; pub use self::arithmetic::{ArithmeticBase, ArithmeticExpression, ArithmeticOperator}; pub use self::common::{FieldExpression, Literal, Operator, SqlType, TableKey}; pub use self::column::{Column, ColumnConstraint, ColumnSpecifi...
#[macro_use] extern crate nom; extern crate serde; #[macro_use] extern crate serde_derive; pub use self::arithmetic::{ArithmeticBase, ArithmeticExpression, ArithmeticOperator}; pub use self::common::{FieldExpression, Literal, Operator, SqlType, TableKey}; pub use self::column::{Column, ColumnConstraint, ColumnSpecifi...
Make DeleteStatement and UpdateStatement public
Make DeleteStatement and UpdateStatement public
Rust
mit
ms705/nom-sql
3434585ee4446c072d693e6436919bb74a83c20b
jvmkill/src/macros.rs
jvmkill/src/macros.rs
/* * Copyright (c) 2015-2017 the original author or authors. * * 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 * * Unless required by...
/* * Copyright (c) 2015-2017 the original author or authors. * * 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 * * Unless required by...
Use eprintln from Rust 1.19
Use eprintln from Rust 1.19
Rust
apache-2.0
glyn/jvmkill,glyn/jvmkill,glyn/jvmkill,glyn/jvmkill
330e2ef471e07dbb242bf402001f69e5c0cd2701
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: &Vec<syn::Attribute>) -> String { for attr in attrs { if attr.name() == "template" { match attr.value { syn::MetaItem::List(_, ref inner) => { ...
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...
Simplify code to find template path
Simplify code to find template path
Rust
apache-2.0
djc/askama,djc/askama,djc/askama
ffff7ff8a6e0a54443e5bef3eb3c8f4b7aeaf1c6
test-cargo-miri/subcrate/src/lib.rs
test-cargo-miri/subcrate/src/lib.rs
#[cfg(doctest)] use num_cpus as _; #[cfg(test)] compile_error!("Miri should not touch me");
#[cfg(doctest)] compile_error!("rustdoc should not touch me"); #[cfg(test)] compile_error!("Miri should not touch me");
Use `compile_error!` instead of `use num_cpus`
Use `compile_error!` instead of `use num_cpus`
Rust
apache-2.0
rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri
225529f4549dc6b46fe020e435ac1ec01a0c99be
sdl2-sys/build.rs
sdl2-sys/build.rs
#[cfg(feature="pkg-config")] extern crate "pkg-config" as pkg_config; fn main() { if !build_pkgconfig() { println!("cargo:rustc-flags=-l SDL2"); } } #[cfg(not(feature="pkg-config"))] fn build_pkgconfig() -> bool { false } #[cfg(feature="pkg-config")] fn build_pkgconfig() -> bool { let opts = pk...
#[cfg(feature="pkg-config")] extern crate "pkg-config" as pkg_config; fn main() { if !build_pkgconfig() { println!("cargo:rustc-flags=-l SDL2"); } } #[cfg(not(feature="pkg-config"))] fn build_pkgconfig() -> bool { false } #[cfg(feature="pkg-config")] fn build_pkgconfig() -> bool { if pkg_config...
Use the new pkgconfig API
Use the new pkgconfig API
Rust
mit
Rust-SDL2/rust-sdl2,crumblingstatue/rust-sdl2,oldmanmike/rust-sdl2,inrustwetrust/rust-sdl2,Cobrand/rust-sdl2,nukep/rust-sdl2,bvssvni/rust-sdl2,AngryLawyer/rust-sdl2,caldwell/rust-sdl2,tempbottle/rust-sdl2,Rust-SDL2/rust-sdl2,wilsoniya/rust-sdl2,Cobrand/rust-sdl2,bfops/rust-sdl2,Rust-SDL2/rust-sdl2,vadixidav/rust-sdl2,C...
bb90f403aeed1e03015369c139d3f89785879e3e
kernel_x86.rs
kernel_x86.rs
#![crate_name = "kernel"] #![crate_type = "staticlib"] #![no_std] #![feature(asm, lang_items)] #![feature(core)] extern crate core; extern crate rlibc; #[path = "arch/x86/"] pub mod platform { pub mod vga; pub mod cpu; pub mod mmu; mod io; pub mod keyboard; } pub mod kernel { pub mod main; pub mod interrupts;...
#![crate_name = "kernel"] #![crate_type = "staticlib"] #![no_std] #![feature(asm, lang_items)] #![feature(core)] #[macro_use] extern crate core; extern crate rlibc; #[path = "arch/x86/"] pub mod platform { pub mod vga; pub mod cpu; pub mod mmu; mod io; pub mod keyboard; } pub mod kernel { pub mod main; pub mo...
Add macro_use to allow usages of panic! and sorts
Add macro_use to allow usages of panic! and sorts
Rust
mit
mvdnes/element76
625212de0e04ddf8e96746066d6d04c4e5fbe55a
src/helper.rs
src/helper.rs
use std::str::{from_utf8_unchecked, FromStr}; pub fn to_string(s: &[u8]) -> &str { unsafe { from_utf8_unchecked(s) } } pub fn to_u32(s: &str) -> u32 { FromStr::from_str(s).unwrap() } pub fn buf_to_u32(s: &[u8]) -> u32 { to_u32(to_string(s)) }
use std::str::{self, FromStr}; pub fn buf_to_u32(s: &[u8]) -> u32 { let s = str::from_utf8(s).expect("Invalid data, expected UTF-8 string"); FromStr::from_str(s).expect("Invalid string, expected ASCII reprensation of a number") }
Remove unsafe use of unsafe and instead panic
Remove unsafe use of unsafe and instead panic
Rust
mit
hoodie/iso8601,badboy/iso8601
c42a5da68d09ca3dbb818b7e87bce634e67ec0b4
src/macros.rs
src/macros.rs
// Copyright 2019 The Exonum Team // // 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 // // Unless required by applicable law or agreed to i...
// Copyright 2019 The Exonum Team // // 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 // // Unless required by applicable law or agreed to i...
Add comment to unsafe use.
Add comment to unsafe use.
Rust
apache-2.0
exonum/exonum,alekseysidorov/exonum,exonum/exonum,alekseysidorov/exonum,alekseysidorov/exonum,exonum/exonum,exonum/exonum,alekseysidorov/exonum
e6580489daba84f88357d52ea1378c00df86c213
src/main.rs
src/main.rs
extern crate ppbert; use std::io; use std::io::Read; use ppbert::parser; use ppbert::pretty; fn main() { let mut stdin = io::stdin(); let mut buf: Vec<u8> = Vec::new(); let _ = stdin.read_to_end(&mut buf); let mut parser = parser::Parser::new(buf); match parser.parse() { Ok(ref term) => ...
extern crate ppbert; use std::io; use std::io::Read; use ppbert::parser; use ppbert::pretty; fn main() { let mut stdin = io::stdin(); let mut buf: Vec<u8> = Vec::new(); let _ = stdin.read_to_end(&mut buf); let mut parser = parser::Parser::new(buf); match parser.parse() { Ok(ref term) => ...
Add a newline after pretty printing
Add a newline after pretty printing
Rust
mit
gnuvince/ppbert,gnuvince/ppbert
428e059c4f029f3808244fd369b0d183d4636bd5
src/main.rs
src/main.rs
mod diff; use std::io; enum Mode { Command, Input, } struct Range { start: i32, end: i32, } fn command_line(line: &String, mode: &mut Mode) { match line.trim() { "a" => *mode = Mode::Input, "q" => std::process::exit(0), _ => println!("Command: {}", line), } } fn inp...
mod diff; use std::io; struct Range { start: i32, end: i32, } fn input() -> Vec<String> { let mut lines: Vec<String> = Vec::new(); loop { let mut line = String::new(); io::stdin().read_line(&mut line) .ok() .expect("Error reading line"); match line.trim...
Simplify command parsing; Add input loop
Simplify command parsing; Add input loop
Rust
mit
cwandrews/ed
aaaae7fa1e527b4b003180aa13be958742140309
guessing_game/src/main.rs
guessing_game/src/main.rs
extern crate rand; use std::io; 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); println!("Input your guess, please:"); let mut guess = String::new(); io::stdin...
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); println!("Input your guess, please:"); let mut guess = Strin...
Add comparision between guess and secret_number
Add comparision between guess and secret_number
Rust
mit
pgrzesik/learning-rust
b0161333a270f5deebe88bfb5da6873210e516cf
src/main.rs
src/main.rs
#![allow(unstable)] extern crate getopts; extern crate selecta; use getopts::{optopt,getopts}; use selecta::configuration::Configuration; use selecta::search::Search; use selecta::tty::TTY; use selecta::tty::IO; use selecta::screen::Screen; fn main() { let initial_query = extract_initial_query(); let lines =...
#![allow(unstable)] extern crate getopts; extern crate selecta; use getopts::{optopt,getopts}; use selecta::configuration::Configuration; use selecta::search::Search; use selecta::tty::TTY; use selecta::tty::IO; use selecta::screen::Screen; fn main() { let initial_query = extract_initial_query(); let lines =...
Remove type annotations that can be inferred
Remove type annotations that can be inferred
Rust
mit
felipesere/icepick,felipesere/icepick
2c38ce28ff0c53046a6898ed6a668dee12eeb5cd
src/main.rs
src/main.rs
mod raw { extern crate libc; #[allow(non_camel_case_types)] pub type wl_display = libc::c_void; #[link(name = "wayland-client")] extern { pub fn wl_display_connect(name: *const u8) -> *mut wl_display; pub fn wl_display_disconnect(display: *mut wl_display); } } pub struct Displ...
mod raw { extern crate libc; use self::libc::{c_char, c_void}; #[allow(non_camel_case_types)] pub type wl_display = c_void; #[link(name = "wayland-client")] extern { pub fn wl_display_connect(name: *const c_char) -> *mut wl_display; pub fn wl_display_disconnect(display: *mut w...
Clean up the raw module a bit
Clean up the raw module a bit
Rust
mit
eyolfson/eyl-shell
899bb68f3cda1938d88864d76adad6e169697aa5
src/main.rs
src/main.rs
fn schwefel(solution: &Vec<f64>) -> f64 { return 418.9829_f64 * solution.len() as f64 + solution.iter().fold(0_f64, |sum, x| sum + x * x.abs().sqrt().sin()); } fn main() { println!("Hello, world!"); }
const N: usize = 50; fn schwefel(solution: &[f64; N]) -> f64 { return 418.9829_f64 * N as f64 + solution.iter().fold(0_f64, |sum, x| sum + x * x.abs().sqrt().sin()); } fn main() { println!("Hello, world!"); }
Swap Vec<f64> with [f64, N]
Swap Vec<f64> with [f64, N]
Rust
agpl-3.0
andschwa/rust-genetic-algorithm
35d5cc86558d6d7081990b0a0a28739dc04ef2ad
src/main.rs
src/main.rs
mod vm; mod command; mod parse; mod program; use vm::VM; use std::io::Write; fn main() { let mut vm = VM::new(); loop { print!("{}", "bf> "); std::io::stdout().flush().unwrap(); let mut line = String::new(); let commands = match std::io::stdin().read_line(&mut line) { ...
mod vm; mod command; mod parse; mod program; use vm::VM; use program::Program; use std::io::Write; fn main() { let mut vm = VM::new(); let mut program = Program::new(); loop { print!("{}", "bf> "); std::io::stdout().flush().unwrap(); let mut line = String::new(); let comma...
Change runtime of REPL to proxy through program
Change runtime of REPL to proxy through program
Rust
mit
nafarlee/thoughtfuck
9058174b23f381c57c016bfd929cd89a2e1c92fd
src/main.rs
src/main.rs
extern crate sassers; extern crate docopt; use docopt::Docopt; use std::fs::File; use std::io::Read; use std::path::Path; fn main() { const VERSION: &'static str = env!("CARGO_PKG_VERSION"); static USAGE: &'static str = " Usage: sassers [-t <style>] <inputfile> sassers [-vh] Options: -h, --help ...
extern crate sassers; extern crate docopt; use docopt::Docopt; use std::fs::File; use std::io::Read; use std::path::Path; fn main() { const VERSION: &'static str = env!("CARGO_PKG_VERSION"); static USAGE: &'static str = " Usage: sassers [-t <style>] <inputfile> sassers [-vh] Options: -h, --help ...
Print nicer error messages for myself
Print nicer error messages for myself
Rust
mit
carols10cents/sassers
fa3bada5066ba1a31fe9287f7c38852dd670be62
src/main.rs
src/main.rs
fn main() { println!("Hello, world!") }
extern crate getopts; use getopts::{optopt, optflag, OptGroup}; use std::os; use device_info::{DefaultDevice, DefaultInterface, UserDefinedDevice, UserDefinedName, DeviceInfo}; mod device_info; enum ParseArgsResult { HelpRequested, DevicesObtained(DeviceInfo), CommandLineError(getopts::Fail_) } // Ret...
Add a function for parsing command-line arguments
Add a function for parsing command-line arguments
Rust
mit
graememcc/netStack,graememcc/netStack
455d6e88ed49c62e100b0153474a18b39fa47b48
src/module/bm/header.rs
src/module/bm/header.rs
use storage::file::FileHeaderSpec as FHS; use storage::file::FileHeaderData as FHD; pub fn get_spec() -> FHS { FHS::Map { keys: vec![ url_key(), tags_key() ] } } fn url_key() -> FHS { FHS::Key { name: String::from("URL"), value_type: Box::new(FHS::Text) } } fn tags_key() -> FHS { FHS::Key { name: String:...
use storage::file::FileHeaderSpec as FHS; use storage::file::FileHeaderData as FHD; pub fn get_spec() -> FHS { FHS::Map { keys: vec![ url_key(), tags_key() ] } } fn url_key() -> FHS { FHS::Key { name: String::from("URL"), value_type: Box::new(FHS::Text) } } fn tags_key() -> FHS { FHS::Key { name: String:...
Use real array instead of text array to save tags
Use real array instead of text array to save tags
Rust
lgpl-2.1
matthiasbeyer/imag,mario-kr/imag,mario-kr/imag,matthiasbeyer/imag
f16a6d87f109eb80bad4d9bc67d6100f55ee6811
src/serde_helpers.rs
src/serde_helpers.rs
use url::Url; use serde::de::{Deserialize, Deserializer, Error as DeserializeError}; use serde::ser::{Serialize, Serializer}; /// Type which can be used to serialize a Url. /// /// `#[serde(with = "UrlDef")]` pub struct UrlDef(Url); impl UrlDef { pub fn deserialize<'de, D>(deserializer: D) -> Result<Url, D::Erro...
use url::Url; use serde::de::{Deserialize, Deserializer, Error as DeserializeError}; use serde::ser::{Serialize, Serializer}; /// Unit struct which can be used to serialize a Url. /// /// `#[serde(with = "UrlDef")]` pub struct UrlDef; impl UrlDef { pub fn deserialize<'de, D>(deserializer: D) -> Result<Url, D::Err...
Remove unused parts of UrlDef
Remove unused parts of UrlDef
Rust
apache-2.0
portier/portier-broker,portier/portier-broker,portier/portier-broker,portier/portier-broker
33de0d9783481d19e16086bb6cd12b02de1175e8
tests/human_names.rs
tests/human_names.rs
#[macro_use] extern crate proptest; extern crate chars; use chars::human_names; use proptest::prelude::*; use proptest::test_runner::Config; use std::fmt::Write; proptest! { #![proptest_config(Config::with_cases(100000))] #[test] fn find_any_by_name(ch in prop::char::any()) { let mut chstr = String::new(); c...
#[macro_use] extern crate proptest; extern crate chars; use chars::human_names; use proptest::prelude::*; use std::fmt::Write; proptest! { #[test] fn find_any_by_identity(ch in prop::char::any()) { let mut chstr = String::new(); chstr.write_char(ch).unwrap(); let found = human_names:...
Add a bunch more property tests
Add a bunch more property tests Searching for hex codes, and for control characters.
Rust
mit
antifuchs/chars,antifuchs/chars
0bafe766828b566a283a1a1e3f230f34721b8b07
stable-check/src/main.rs
stable-check/src/main.rs
use std::error::Error; use std::env; use std::fs; use std::fs::File; use std::io::prelude::*; use std::path::Path; fn main() { let arg = env::args().nth(1).unwrap_or_else(|| { println!("Please pass a src directory as the first argument"); std::process::exit(1); }); match check_directory(&P...
// Copyright 2012-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...
Add license to stable check
Add license to stable check so that this passes tidy on rust master
Rust
apache-2.0
rust-lang/reference,rust-lang/reference
ae5227ead608e62c1ed33c697cabb66bc088fed1
src/paths.rs
src/paths.rs
// Here lists all the paths that will be used by wiz use std::path::{ Path, PathBuf }; /// /// Appends `append` to `path`. /// pub trait PathAppend { fn append(&mut self, input: &str) -> &Path; } impl PathAppend for PathBuf { fn append(&mut self, input: &str) -> &Path { self.push(input); self....
// Here lists all the paths that will be used by wiz use std::path::{ Path, PathBuf }; /// /// Appends `append` to `path`. /// pub trait PathAppend { fn append(&self, input: &str) -> PathBuf; } impl PathAppend for PathBuf { fn append(&self, input: &str) -> PathBuf { let mut buf = self.to_path_buf().cl...
Return PathBuf instead of &Path
Return PathBuf instead of &Path
Rust
bsd-3-clause
hch12907/wiz
0de9e298b10c1e86704f94b2b5c10f479f87c415
src/vector/mod.rs
src/vector/mod.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. pub mod ll; pub mod ops; pub trait BlasVector<T> { fn inc(&self) -> i32; fn len(&self) -> i32; fn as_ptr(&self) -> *const T; fn as_mut_ptr(&mut s...
// 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. use std::raw::Repr; pub mod ll; pub mod ops; pub trait BlasVector<T> { fn inc(&self) -> i32; fn len(&self) -> i32; fn as_ptr(&self) -> *const T; ...
Implement BlasVector on Vec and slice
Implement BlasVector on Vec and slice
Rust
mit
raineszm/rust-blas,mikkyang/rust-blas
cdc6095829593c0fa1ff8e962e71c905ae8db730
bench/rs/src/lib.rs
bench/rs/src/lib.rs
#[macro_use] extern crate perl_xs; #[macro_use] extern crate perl_sys; use perl_xs::{ SV, AV, IV, NV }; xs! { package XSBench::RS; sub rs_sum_loop(ctx, param: SV) { let array: AV = param.deref_av().expect("not an array ref"); let mut sum = 0.0; for i in 0..array.top_index() + 1 { ...
#[macro_use] extern crate perl_xs; #[macro_use] extern crate perl_sys; use perl_xs::{ AV, IV, NV }; xs! { package XSBench::RS; sub rs_sum_loop(ctx, array: AV) { let mut sum = 0.0; for i in 0..array.top_index() + 1 { if let Some(val) = array.fetch(i) { sum += va...
Use automatic dereference in benchmark
Use automatic dereference in benchmark
Rust
bsd-2-clause
vickenty/perl-xs,vickenty/perl-xs
9758f93d932ef8583c625eeca5563b03f69143b5
src/lib/misc.rs
src/lib/misc.rs
// Copyright (C) 2016 Élisabeth HENRY. // // This file is part of Crowbook. // // Crowbook is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation, either version 2.1 of the License, or // (at your option) any...
// Copyright (C) 2016 Élisabeth HENRY. // // This file is part of Crowbook. // // Crowbook is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation, either version 2.1 of the License, or // (at your option) any...
Remove current directory from begginnig of displayed paths
Remove current directory from begginnig of displayed paths
Rust
lgpl-2.1
lise-henry/crowbook,lise-henry/crowbook,lise-henry/crowbook,lise-henry/crowbook
ac5e82474b14c79393b42467ef6d34efe9460aed
libsodium-sys/build.rs
libsodium-sys/build.rs
fn main () { println!("cargo:rustc-flags=-l sodium"); }
use std::env; fn main () { if let Some(lib_dir) = env::var("SODIUM_LIB_DIR").ok() { println!("cargo:rustc-flags=-L native={}", lib_dir); } let mode = if env::var_os("SODIUM_STATIC").is_some() { "static" } else { "dylib" }; println!("cargo:rustc-flags=-l {0}=sodium", mode); }
Enable static linking support (similar to openssl-sys)
Enable static linking support (similar to openssl-sys)
Rust
mit
Fraser999/sodiumoxide,markuskobler/sodiumoxide,romanb/sodiumoxide,maidsafe/sodiumoxide
3246a1f5c0ecd85e53f9d2564305a3f7f063064e
mini-macro/src/lib.rs
mini-macro/src/lib.rs
#![feature(proc_macro, proc_macro_non_items)] extern crate proc_macro; use proc_macro::{TokenStream, quote}; #[proc_macro_derive(ClippyMiniMacroTest)] pub fn mini_macro(_: TokenStream) -> TokenStream { quote!( #[allow(unused)] fn needless_take_by_value(s: String) { println!("{}", s.len()); } ) }
#![feature(use_extern_macros, proc_macro_quote, proc_macro_non_items)] extern crate proc_macro; use proc_macro::{TokenStream, quote}; #[proc_macro_derive(ClippyMiniMacroTest)] pub fn mini_macro(_: TokenStream) -> TokenStream { quote!( #[allow(unused)] fn needless_take_by_value(s: String) { println!("{}", ...
Update mini-macro post proc macro stabilization
Update mini-macro post proc macro stabilization https://github.com/rust-lang/rust/pull/52081 stabilized proc macros, but quote is still unstable, so you need to explicitly enable that feature.
Rust
apache-2.0
graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust
7f8ca53669e71481201892e37ec57939e5f1ec85
src/test/compile-fail/issue-17033.rs
src/test/compile-fail/issue-17033.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 where the old infrastructure failed to detect the (applicable) impl of `FnMut` for some reason.
Test where the old infrastructure failed to detect the (applicable) impl of `FnMut` for some reason.
Rust
apache-2.0
jroesch/rust,carols10cents/rust,aidancully/rust,avdi/rust,dinfuehr/rust,zachwick/rust,cllns/rust,kwantam/rust,zubron/rust,ejjeong/rust,bombless/rust,ktossell/rust,ktossell/rust,ruud-v-a/rust,ktossell/rust,zachwick/rust,dwillmer/rust,jashank/rust,reem/rust,AerialX/rust-rt-minimal,jashank/rust,dinfuehr/rust,l0kod/rust,ja...
47cbaf200113403c0cdf3f6cf7153f4320666738
src/result.rs
src/result.rs
//! Module containing `Result` type use std::result::Result as RResult; use error::TaskError; pub type Result<T> = RResult<T, TaskError>;
//! Module containing `Result` type use std::result::Result as RResult; use error::TaskError; /// Result type wrapping the standard std::result::Result type pub type Result<T> = RResult<T, TaskError>;
Add documentation for own Result type
Add documentation for own Result type
Rust
mpl-2.0
matthiasbeyer/task-hookrs
edb45c4ea8337338b5cd8f6fcb13b5299bccd35e
src/js_types/js_str.rs
src/js_types/js_str.rs
use std::string::String; use std::vec::Vec; use js_types::js_type::{JsTrait, JsT}; // `undefined` pub struct JsUndef; impl JsTrait for JsUndef {} // `null` pub struct JsNull; impl JsTrait for JsNull {} // `bool` pub struct JsBool(pub bool); impl JsTrait for JsBool {} // `number` pub struct JsNum(pub f64); impl JsTr...
use std::string::String; use std::vec::Vec; // `string` pub struct JsStrStruct { pub text: String, } impl JsStrStruct { const MAX_STR_LEN: u64 = 9007199254740991; // 2^53 - 1 pub fn new(s: &str) -> JsStrStruct { assert!((s.len() as u64) < JsStrStruct::MAX_STR_LEN); JsStrStruct { text: s.t...
Rename JsStr to JsStrStruct, among other things
Rename JsStr to JsStrStruct, among other things
Rust
mit
rustoscript/french-press
03b568a846e71d2efac88325534c2142b6c25453
src/test/compile-fail/deriving-no-inner-impl-error-message.rs
src/test/compile-fail/deriving-no-inner-impl-error-message.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 error message in compile-fail test
Fix error message in compile-fail test
Rust
apache-2.0
KokaKiwi/rust,l0kod/rust,kimroen/rust,defuz/rust,mvdnes/rust,miniupnp/rust,richo/rust,bombless/rust,philyoon/rust,ruud-v-a/rust,aepsil0n/rust,zachwick/rust,nwin/rust,quornian/rust,zaeleus/rust,kwantam/rust,nwin/rust,aneeshusa/rust,zubron/rust,sae-bom/rust,pelmers/rust,emk/rust,l0kod/rust,reem/rust,vhbit/rust,ejjeong/ru...
d310573553e9caf5bfb23af6ac46ece96e441dff
src/engine/actor.rs
src/engine/actor.rs
use util::units::Point; pub struct Actor { name: String, pos: Point, health: int, max_health: int, repr: char, } impl Actor { pub fn new(name: String, pos: Point, max_health: int, repr: char) -> Actor { Actor { name: name, pos: pos, health: max_heal...
use util::units::Point; pub struct Actor { name: String, pos: Point, health: int, max_health: int, repr: char, } impl Actor { pub fn new(name: String, pos: Point, max_health: int, repr: char) -> Actor { Actor { name: name, pos: pos, health: max_heal...
Remove unused parameter from Actor::kill()
Remove unused parameter from Actor::kill()
Rust
bsd-3-clause
jgilchrist/rslike
ec1ebb96e674cb4213cc4dbf32da34481b131d0f
rust/anagram/src/lib.rs
rust/anagram/src/lib.rs
use std::collections::HashMap; fn anagrams(word: &str) -> HashMap<char, u32> { let mut result: HashMap<char, u32> = HashMap::new(); for k in word.chars() { let v = match result.get(&k) { Some(v) => v + 1, None => 1, }; result.insert(k, v); } result } ...
use std::collections::HashMap; fn anagrams(word: &str) -> HashMap<char, u32> { let mut result: HashMap<char, u32> = HashMap::new(); for k in word.chars() { let v = result.get(&k).map_or(1, |v| v + 1); result.insert(k, v); } result } pub fn anagrams_for(word: &str, input: &[&'static ...
Use map_or to simplify code
Use map_or to simplify code It looks better
Rust
bsd-2-clause
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism
98f4be6ae362fb61d6d977c2b4a7e332b3a8be1d
libindy/src/utils/cstring.rs
libindy/src/utils/cstring.rs
extern crate libc; use self::libc::c_char; use std::ffi::CStr; use std::str::Utf8Error; use std::ffi::CString; pub struct CStringUtils {} impl CStringUtils { pub fn c_str_to_string(cstr: *const c_char) -> Result<Option<String>, Utf8Error> { if cstr.is_null() { return Ok(None) } ...
extern crate libc; use self::libc::c_char; use std::ffi::CStr; use std::str::Utf8Error; use std::ffi::CString; pub struct CStringUtils {} impl CStringUtils { pub fn c_str_to_string(cstr: *const c_char) -> Result<Option<String>, Utf8Error> { if cstr.is_null() { return Ok(None); } ...
Fix parsing empty C string.
Fix parsing empty C string.
Rust
apache-2.0
anastasia-tarasova/indy-sdk,Artemkaaas/indy-sdk,Artemkaaas/indy-sdk,srottem/indy-sdk,srottem/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,peacekeeper/indy-sdk,anastasia-tarasova/indy-sdk,srottem/indy-sdk,anastasia-tarasova/indy-sdk,anastasia-tarasova/...
45d2c609d3d16bf7b89e23644b6773cddc4036cc
src/application.rs
src/application.rs
use nain_events::{EventCategory, KeyPressedEvent}; use nain_log as log; pub trait Application { fn run(&self) { println!("Welcome to the Nain engine!"); let event = KeyPressedEvent::new(2, 5); log::trace!("{}", event); loop {} } }
use nain_events::{Event, EventCategory, KeyPressedEvent}; use nain_log as log; pub trait Application { fn run(&self) { println!("Welcome to the Nain engine!"); let event = KeyPressedEvent::new(2, 5); log::trace!("{}", event); log::trace!("{}", event.get_name()); if event....
Add some logs to test the key pressed event
Add some logs to test the key pressed event
Rust
apache-2.0
Danite/NainEngine
d6b69939eea2cee847bcff926837a43dbe85d4ac
build.rs
build.rs
extern crate glob; use glob::glob; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::fmt; fn main() { let mut output = String::new(); fmt::write( &mut output, format_args!("pub static PATTERNS: &[(&'static str, &'static str)] = &[\n"), ).unwrap(); for line ...
extern crate glob; use glob::glob; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::fmt; use std::env; use std::path::Path; fn main() { let mut output = String::new(); fmt::write( &mut output, format_args!("pub static PATTERNS: &[(&'static str, &'static str)] = &[\...
Build patterns in OUT_DIR only
Build patterns in OUT_DIR only
Rust
apache-2.0
daschl/grok
6fc6f0cb277426dccde1c639f8e32320b0fcc29c
build.rs
build.rs
extern crate crowbook_localize; use crowbook_localize::{Localizer, Extractor}; use std::path::Path; fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=lang/fr.po"); let mut extractor = Extractor::new(); extractor.add_messages_from_dir(concat!(env!("CARGO_MANIFEST...
extern crate crowbook_localize; use crowbook_localize::{Localizer, Extractor}; use std::path::Path; use std::env; fn main() { // println!("cargo:rerun-if-changed=build.rs"); // println!("cargo:rerun-if-changed=lang/fr.po"); let mut extractor = Extractor::new(); extractor.add_messages_from_dir(concat!(e...
Use env::arg instead of env macro
Use env::arg instead of env macro
Rust
lgpl-2.1
lise-henry/crowbook,lise-henry/crowbook,lise-henry/crowbook,lise-henry/crowbook
0c51cef64f7d537e06ced18f12a43b873e2da41f
src/metadata/serialize.rs
src/metadata/serialize.rs
use chrono::{DateTime, FixedOffset}; use serde_derive::Deserialize; #[derive(Deserialize)] pub(super) struct Page { title: Option<String>, subtitle: Option<String>, summary: Option<String>, qualifiers: Option<Qualifiers>, date: Option<DateTime<FixedOffset>>, updated: Option<DateTime<FixedOffset...
use chrono::{DateTime, FixedOffset}; use serde_derive::Deserialize; #[derive(Deserialize)] pub(super) struct Page { title: Option<String>, subtitle: Option<String>, summary: Option<String>, qualifiers: Option<Qualifiers>, date: Option<DateTime<FixedOffset>>, updated: Option<DateTime<FixedOffset...
Add 'Series' to supported metadata
Add 'Series' to supported metadata
Rust
mit
chriskrycho/lightning-rs,chriskrycho/lightning-rs
3c5242e0a33d43b12f52fec76ee27e1a2f01a982
build.rs
build.rs
use std::process::Command; extern crate pkg_config; const C_IN: &'static str = "include/include_ffi.h"; const RS_OUT: &'static str = "src/raw.rs"; fn main() { let libffi = pkg_config::probe_library("libffi").expect("libffi"); let mut command = Command::new("bindgen"); command.arg(format!("--output={}"...
use std::process::Command; extern crate pkg_config; const C_IN: &'static str = "include/include_ffi.h"; const RS_OUT: &'static str = "src/raw.rs"; fn main() { let libffi = pkg_config::probe_library("libffi").expect("libffi"); let mut command = Command::new("bindgen"); command.arg(format!("--output={}"...
Build script tweak: using Path::display() correctly now.
Build script tweak: using Path::display() correctly now.
Rust
apache-2.0
tov/libffi-rs,tov/libffi-rs,tov/libffi-rs,tov/libffi-rs,tov/libffi-rs,tov/libffi-rs
a24414b391b87b3fa71836aa2ce7a91f0fdfeb6b
src/concurrent_computing.rs
src/concurrent_computing.rs
// Implements http://rosettacode.org/wiki/Concurrent_computing // not_tested use std::io::timer::sleep; use std::rand::random; fn main() { let strings = vec!["Enjoy", "Rosetta", "Code"]; for s in strings.move_iter(){ spawn(proc() { // We use a random u8 (so an integer from 0 to 255) ...
// Implements http://rosettacode.org/wiki/Concurrent_computing // not_tested use std::io::timer::sleep; use std::rand::random; use std::time::duration::Duration; fn main() { let strings = vec!["Enjoy", "Rosetta", "Code"]; for s in strings.move_iter(){ spawn(proc() { // We use a random u8 (...
Fix use of sleep function after api change
Fix use of sleep function after api change
Rust
unlicense
sakeven/rust-rosetta,magum/rust-rosetta,crespyl/rust-rosetta,ZoomRmc/rust-rosetta,JIghtuse/rust-rosetta,Hoverbear/rust-rosetta,crr0004/rust-rosetta,magum/rust-rosetta,ghotiphud/rust-rosetta,pfalabella/rust-rosetta
19cc2fffcb42825e4c870323bd8edd0b02276cf8
libsodium-sys/build.rs
libsodium-sys/build.rs
fn main () { println!("cargo:rustc-flags=-l sodium"); }
use std::env; fn main () { if let Some(lib_dir) = env::var("SODIUM_LIB_DIR").ok() { println!("cargo:rustc-flags=-L native={}", lib_dir); } let mode = if env::var_os("SODIUM_STATIC").is_some() { "static" } else { "dylib" }; println!("cargo:rustc-flags=-l {0}=sodium", mode); }
Enable static linking support (similar to openssl-sys)
Enable static linking support (similar to openssl-sys)
Rust
mit
jedisct1/sodiumoxide
0377a633520344c6530f21fffee4d31768c9c447
library/std/src/os/wasi/io/fd/tests.rs
library/std/src/os/wasi/io/fd/tests.rs
use std::mem::size_of; use std::os::wasi::io::RawFd; #[test] fn test_raw_fd_layout() { /// `OwnedFd` and `BorrowedFd` use `rustc_layout_scalar_valid_range_start` /// and `rustc_layout_scalar_valid_range_end`, with values that depend on /// the bit width of `RawFd`. If this ever changes, those values will n...
use crate::mem::size_of; use crate::os::wasi::io::RawFd; #[test] fn test_raw_fd_layout() { // `OwnedFd` and `BorrowedFd` use `rustc_layout_scalar_valid_range_start` // and `rustc_layout_scalar_valid_range_end`, with values that depend on // the bit width of `RawFd`. If this ever changes, those values will ...
Fix syntax for non-doc comments, and use `crate::` instead of `std::`.
Fix syntax for non-doc comments, and use `crate::` instead of `std::`.
Rust
apache-2.0
graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust
130ad0523278080284ffe994a116a2092727691f
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_addspaces() { assert a...
Refactor tokenize to use str::words
Refactor tokenize to use str::words
Rust
mit
martica/rusty
d26c8525f35017e3464ce55b588617424a8593f7
libs/stach_derive/src/lib.rs
libs/stach_derive/src/lib.rs
#![feature(proc_macro)] #![feature(proc_macro_lib)] #![recursion_limit = "128"] #[macro_use] extern crate quote; extern crate proc_macro; extern crate syn; use proc_macro::TokenStream; // Yield mock generated code for template // Hello, {{name}} ({{age}}) #[proc_macro_derive(StacheDisplay)] pub fn stache_displa...
#![feature(proc_macro)] #![feature(proc_macro_lib)] #![recursion_limit = "128"] #[macro_use] extern crate quote; extern crate proc_macro; extern crate syn; use proc_macro::TokenStream; // Yield mock generated code for template // Hello, {{name}} ({{age}}) #[proc_macro_derive(StacheDisplay)] pub fn stache_displa...
Use ast.generics.split_for_impl() to correctly generate impl with any generic parameters
Use ast.generics.split_for_impl() to correctly generate impl with any generic parameters
Rust
mit
maghoff/bart,maghoff/bart
9a2945bd3a9b4604b243beebf4812388404313e2
components/style/properties/longhand/xul.mako.rs
components/style/properties/longhand/xul.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% from data import Method %> // Non-standard properties th...
/* 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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% from data import Method %> // Non-standard properties th...
Add spec links for xul properties
Add spec links for xul properties
Rust
mpl-2.0
szeged/servo,larsbergstrom/servo,paulrouget/servo,sadmansk/servo,avadacatavra/servo,KiChjang/servo,eddyb/servo,cbrewster/servo,cbrewster/servo,eddyb/servo,CJ8664/servo,saneyuki/servo,nnethercote/servo,emilio/servo,saneyuki/servo,peterjoel/servo,rnestler/servo,thiagopnts/servo,jimberlage/servo,mbrubeck/servo,fiji-flo/se...
851d18f194642b1a668bc2fa79a508ba3eb6cbdf
tests/test.rs
tests/test.rs
#[macro_use] extern crate pod_typeinfo; use std::mem; use pod_typeinfo::Type::*; use pod_typeinfo::{Type, TypeInfo}; #[test] fn test_scalar_types() { fn check_type<T: TypeInfo>(ty: Type) { assert_eq!(<T as TypeInfo>::type_info(), ty); assert_eq!(ty.size(), mem::size_of::<T>()); } check_ty...
#[macro_use] extern crate pod_typeinfo; use std::mem; use pod_typeinfo::Type::*; use pod_typeinfo::{Type, TypeInfo}; #[test] fn test_scalar_types() { fn check_scalar_type<T: TypeInfo>(ty: Type) { assert_eq!(<T as TypeInfo>::type_info(), ty); assert_eq!(ty.size(), mem::size_of::<T>()); ass...
Test is_scalar/is_array/is_compound for scalar types
Test is_scalar/is_array/is_compound for scalar types
Rust
apache-2.0
aldanor/typeinfo
57c0da5070bb9ed45e4ac0ddf212307df2046c6e
examples/list_issues.rs
examples/list_issues.rs
extern crate gitlab_api as gitlab; use std::env; #[macro_use] extern crate log; extern crate env_logger; use gitlab::GitLab; // use gitlab::Pagination; use gitlab::issues; fn main() { env_logger::init().unwrap(); info!("starting up"); let hostname = match env::var("GITLAB_HOSTNAME") { Ok(val) ...
extern crate gitlab_api as gitlab; use std::env; #[macro_use] extern crate log; extern crate env_logger; use gitlab::GitLab; // use gitlab::Pagination; use gitlab::issues; fn main() { env_logger::init().unwrap(); info!("starting up"); let hostname = match env::var("GITLAB_HOSTNAME") { Ok(val) ...
Add single listing to issue example.
Add single listing to issue example.
Rust
apache-2.0
nbigaouette/gitlab-api-rs,nbigaouette/gitlab-api-rs
2b31337da4a6ea2bbe27f2e98fd33fe9a6176dd6
diesel_tests/tests/compile-fail/find_requires_correct_type.rs
diesel_tests/tests/compile-fail/find_requires_correct_type.rs
#[macro_use] extern crate diesel; use diesel::*; table! { int_primary_key { id -> Serial, } } table! { string_primary_key { id -> VarChar, } } fn main() { let connection = Connection::establish("").unwrap(); let one = connection.find(int_primary_key::table, "1".to_string()).u...
#[macro_use] extern crate diesel; use diesel::*; table! { int_primary_key { id -> Serial, } } table! { string_primary_key { id -> VarChar, } } fn main() { let connection = Connection::establish("").unwrap(); let one = connection.find(int_primary_key::table, "1".to_string()).u...
Add extra compile fail error
Add extra compile fail error
Rust
apache-2.0
tohou/diesel,diesel-rs/diesel,mcasper/diesel,sgrif/diesel,mcasper/diesel,tohou/diesel,diesel-rs/diesel,SoftwareWarlock/diesel,cascalheira/diesel,cascalheira/diesel,sgrif/diesel,SoftwareWarlock/diesel
a8c770fa2d1146c04cdf49f99cbeaa58ec7b586c
tests/addition.rs
tests/addition.rs
extern crate basiccms; #[cfg(test)] mod tests { use basiccms::*; #[test] #[should_panic] fn you_cannot_add_two_sketches_together_if_they_have_different_hashers () { let mut left = Sketch::new(0.0001, 0.99); let mut right = Sketch::new(0.0001, 0.99); let third = &left + &rig...
extern crate basiccms; #[cfg(test)] mod tests { use basiccms::*; #[test] #[should_panic] fn you_cannot_add_two_sketches_together_if_they_have_different_hashers () { let mut left = Sketch::new(0.0001, 0.99); let mut right = Sketch::new(0.0001, 0.99); left.add(1); right.add(1...
Remove warnings from test project
Remove warnings from test project Amusingly enough I need to add some more dead code to a failing test to get rid of the unused and unnecessarily `mut` warnings.
Rust
mit
kjgorman/basiccms.rs
15a9da7cf696535a51f0aacf04e0fdc9f240a79e
world/src/desc.rs
world/src/desc.rs
/// Entity name and appearance. #[deriving(Clone, Show, Encodable, Decodable)] pub struct Desc { pub name: String, pub icon: uint, } impl Desc { pub fn new(name: String, icon: uint) -> Desc { Desc { name: name, icon: icon, } } }
use calx::Rgb; /// Entity name and appearance. #[deriving(Clone, Show, Encodable, Decodable)] pub struct Desc { pub name: String, pub icon: uint, pub color: Rgb, } impl Desc { pub fn new(name: String, icon: uint, color: Rgb) -> Desc { Desc { name: name, icon: icon, ...
Add color field to Desc component
Add color field to Desc component
Rust
agpl-3.0
rsaarelm/magog,rsaarelm/magog,rsaarelm/magog
0d2e3c4f62878bf800f869764b665b06679821ad
src/shader_utils.rs
src/shader_utils.rs
//! Helper functions for dealing with shaders. // External crates. use gl; use gl::types::{ GLchar, GLenum, GLint, GLuint, }; use std::ptr; /// Compiles a shader. /// /// Returns a shader or a message with the error. pub fn compile_shader( shader_type: GLenum, source: &str ) -> Result<GLuint,...
//! Helper functions for dealing with shaders. // External crates. use gl; use gl::types::{ GLchar, GLenum, GLint, GLuint, }; use std::ptr; /// Compiles a shader. /// /// Returns a shader or a message with the error. pub fn compile_shader( shader_type: GLenum, source: &str ) -> Result<GLuint,...
Fix 'no information log' bug
Fix 'no information log' bug
Rust
mit
aepsil0n/graphics,stjahns/graphics,andrewcsmith/graphics,PistonDevelopers/graphics,Vinatorul/graphics,echochamber/graphics,mitchmindtree/graphics,bvssvni/graphics
e1128d08cb7c8fa423570f90d5d5ac70de40531b
doc/insref/src/main.rs
doc/insref/src/main.rs
#![feature(proc_macro_hygiene)] use std::io::{self, Write}; fn main() { let mut args = std::env::args(); args.next().unwrap(); let opmap = match args.next().expect("Architecture name").as_str() { "x64" => dynasm::dynasm_opmap!(x64), "aarch64" => dynasm::dynasm_opmap!(aarch64), x =...
use std::io::{self, Write}; fn main() { let mut args = std::env::args(); args.next().unwrap(); let opmap = match args.next().expect("Architecture name").as_str() { "x64" => dynasm::dynasm_opmap!(x64), "aarch64" => dynasm::dynasm_opmap!(aarch64), x => panic!("Unknown opmap format '{...
Remove unnecessary feature from instruction reference documentation generation code
Remove unnecessary feature from instruction reference documentation generation code
Rust
mpl-2.0
CensoredUsername/dynasm-rs,CensoredUsername/dynasm-rs,CensoredUsername/dynasm-rs
42f1f36b1e41a64a511eefa2ff3b17c219a04653
src/binomial_coefficients.rs
src/binomial_coefficients.rs
// http://rosettacode.org/wiki/Evaluate_binomial_coefficients fn binomial(n: uint, mut k: uint) -> u64 { // Since binomial(n, k) = binomial(n, n - k), we might as well use // the smaller k to optimize if n - k < k { k = n - k; } // Compute the coefficient let mut res = 1u64; for i ...
// http://rosettacode.org/wiki/Evaluate_binomial_coefficients extern crate num; extern crate core; use num::bigint::BigUint; use core::num::One; fn binomial(n: uint, mut k: uint) -> BigUint { // Since binomial(n, k) = binomial(n, n - k), we might as well use // the smaller k to optimize if n - k < k { ...
Use bigint when computing binomial coefficients
Use bigint when computing binomial coefficients
Rust
unlicense
ghotiphud/rust-rosetta,JIghtuse/rust-rosetta,pfalabella/rust-rosetta,magum/rust-rosetta,magum/rust-rosetta,Hoverbear/rust-rosetta,crespyl/rust-rosetta,ZoomRmc/rust-rosetta,crr0004/rust-rosetta,sakeven/rust-rosetta
863267f6234591f7e140a83b724294d0518f73ae
ruru/src/lib.rs
ruru/src/lib.rs
#![no_std] extern crate ruru; use ruru::VM; use ruru::Hash; use ruru::Fixnum; use ruru::Class; use ruru::types::Argc; use ruru::AnyObject; #[no_mangle] pub extern fn pow_3(argc: Argc, argv: *const AnyObject, _: Fixnum) -> Hash { let argv = VM::parse_arguments(argc, argv); let num = argv[0].as_fixnum().to_i64(...
#![no_std] #[macro_use] extern crate ruru; use ruru::VM; use ruru::Hash; use ruru::Fixnum; use ruru::Class; use ruru::AnyObject; use ruru::types::{Argc, Value}; use ruru::traits::Object; class!(Calculator); methods!( Calculator, itself, pow_3(num: Fixnum) -> Hash { let mut hash = Hash::new(); ...
Use macros for creating ruby methods
Use macros for creating ruby methods
Rust
mit
steveklabnik/rust_example,steveklabnik/rust_example,steveklabnik/rust_example,steveklabnik/rust_example,steveklabnik/rust_example,steveklabnik/rust_example
04b8c418140b245b40cd6b69fe167afe33835398
diesel/src/pg/mod.rs
diesel/src/pg/mod.rs
//! Provides types and functions related to working with PostgreSQL //! //! Much of this module is re-exported from database agnostic locations. //! However, if you are writing code specifically to extend Diesel on //! PostgreSQL, you may need to work with this module directly. pub mod expression; pub mod types; #[dep...
//! Provides types and functions related to working with PostgreSQL //! //! Much of this module is re-exported from database agnostic locations. //! However, if you are writing code specifically to extend Diesel on //! PostgreSQL, you may need to work with this module directly. pub mod expression; pub mod types; #[do...
Add with-deprecated and doc hidden attributes
Add with-deprecated and doc hidden attributes
Rust
apache-2.0
sgrif/diesel,sgrif/diesel,diesel-rs/diesel,diesel-rs/diesel
3b9e5dfda565224e6f007f379ca1cea4623422d9
tests/ui/toplevel_ref_arg.rs
tests/ui/toplevel_ref_arg.rs
// run-rustfix #![warn(clippy::toplevel_ref_arg)] #![allow(unused)] fn main() { // Closures should not warn let y = |ref x| println!("{:?}", x); y(1u8); let ref x = 1; let ref y: (&_, u8) = (&1, 2); let ref z = 1 + 2; let ref mut z = 1 + 2; let (ref x, _) = (1, 2); // ok, not top ...
// run-rustfix #![warn(clippy::toplevel_ref_arg)] #![allow(unused)] fn main() { // Closures should not warn let y = |ref x| println!("{:?}", x); y(1u8); let ref x = 1; let ref y: (&_, u8) = (&1, 2); let ref z = 1 + 2; let ref mut z = 1 + 2; let (ref x, _) = (1, 2); // ok, not top ...
Add regression test for macro expansion
Add regression test for macro expansion
Rust
apache-2.0
graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust
f42dad98250950d0de9c74684fe19f62dc50fd4f
src/lib.rs
src/lib.rs
//! A library implementation of so-called `static_assert` based on a macro which //! conditionally expands into an integer overflow, breaking the compilation. //! //! It can take one or more constant boolean expressions as its parameters. //! When you have multiple conditions to verify, pass them to a single //! invoca...
//! A library implementation of so-called `static_assert` based on a macro which //! conditionally expands into an integer overflow, breaking the compilation. //! //! It can take one or more constant boolean expressions as its parameters. //! When you have multiple conditions to verify, pass them to a single //! invoca...
Add a unit test module
Add a unit test module Doctests seem to suppress warnings (note PR #1 was about the "unused type" warning) Signed-off-by: NODA, Kai <a445972a03eaa731f8b4469e4f864a9a57c01ed3@gmail.com>
Rust
apache-2.0
nodakai/rust-static_assert_macro
11b35f8026e83882dd4a11be14772b1ff59c31fd
scrabble-score/src/lib.rs
scrabble-score/src/lib.rs
pub fn score(word: &str) -> u32 { let mut score = 0; for c in word.chars() { score += match c.to_lowercase().to_string().as_ref() { "a" | "e" | "i" | "o" | "u" | "l" | "n" | "r" | "s" | "t" => 1, "d" | "g" => 2, "b" | "c" | "m" | "p" => 3, "f" | "h" | "v"...
pub fn score(word: &str) -> u32 { word.to_lowercase().chars().map(|c| { match c { 'a' | 'e' | 'i' | 'o' | 'u' | 'l' | 'n' | 'r' | 's' | 't' => 1, 'd' | 'g' => 2, 'b' | 'c' | 'm' | 'p' => 3, 'f' | 'h' | 'v' | 'w' | 'y' => 4, 'k' => 5, 'j...
Improve solution for Scrabble Score
Improve solution for Scrabble Score
Rust
mit
attilahorvath/exercism-rust
33390f257dbc8d614f93354d0c7d3196106ea0bd
src/efficientsorts/quick.rs
src/efficientsorts/quick.rs
//! Quicksort algorithm. //! //! The `efficient` module contains the efficient sorting algorithm "Quicksort". //! //! Source: https://en.wikipedia.org/wiki/Quicksort /// Quicksort /// /// # Details /// /// /// /// # Scaling /// /// /// /// # Optimizations /// /// None /// /// # Notes /// /// The type T of the vector ...
//! Quicksort algorithm. //! //! The `efficient` module contains the efficient sorting algorithm "Quicksort". //! //! Source: https://en.wikipedia.org/wiki/Quicksort /// Quicksort /// /// # Details /// /// /// /// # Scaling /// /// /// /// # Optimizations /// /// None /// /// # Notes /// /// The type T of the vector ...
Implement n = 1, n = 2 special cases
Implement n = 1, n = 2 special cases
Rust
bsd-3-clause
nbigaouette/rust-sorting,nbigaouette/rust-sorting,nbigaouette/rust-sorting
546a92acee0b6cf209f85e7dbebcbcb4135526b4
format/src/buffer/mod.rs
format/src/buffer/mod.rs
mod accreader; pub use self::accreader::AccReader; use std::io::{BufRead, Seek, Cursor}; pub trait Buffered: BufRead + Seek { fn data(&self) -> &[u8]; } impl<'a> Buffered for Cursor<&'a [u8]> { fn data(&self) -> &[u8] { &self.get_ref()[self.position() as usize..] } }
mod accreader; pub use self::accreader::AccReader; use std::io::{BufRead, Seek, Cursor}; pub trait Buffered: BufRead + Seek { fn data(&self) -> &[u8]; }
Drop the easy Buffered implementation for Cursor
format: Drop the easy Buffered implementation for Cursor
Rust
mit
rust-av/rust-av
2d31c2afc4d029a50c50960bdafc8f56e3bc34c7
src/compiletest/common.rs
src/compiletest/common.rs
import option; enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, } type config = { // The library paths required for running the compiler compile_lib_path: ~str, // The library paths required for running compiled programs run_lib_path: ~str, // The rustc executable ru...
import option; enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, } impl mode : cmp::Eq { pure fn eq(&&other: mode) -> bool { other as int == self as int } } type config = { // The library paths required for running the compiler compile_lib_path: ~str, // The libra...
Fix another Eq missing case.
Fix another Eq missing case.
Rust
apache-2.0
gifnksm/rust,stepancheg/rust-ide-rust,nham/rust,kmcallister/rust,0x73/rust,Ryman/rust,zachwick/rust,sae-bom/rust,jbclements/rust,carols10cents/rust,ruud-v-a/rust,victorvde/rust,nwin/rust,LeoTestard/rust,P1start/rust,jashank/rust,philyoon/rust,erickt/rust,jashank/rust,aturon/rust,LeoTestard/rust,achanda/rand,victorvde/r...
deaffd3c73d20ce52a7b128aa25ee59b00692c46
tests/macros.rs
tests/macros.rs
use numeric::Tensor; #[test] fn tensor_1d() { let x = Tensor::new(vec![1, 2, 3, 4, 5, 6]); assert!(x == tensor![1, 2, 3, 4, 5, 6]); assert!(x == tensor![1, 2, 3, 4, 5, 6,]); } #[test] fn tensor_2d() { let x = Tensor::new(vec![1, 2, 3, 4, 5, 6]).reshape(&[3, 2]); assert!(x == tensor![1, 2; 3, 4; 5,...
use numeric::Tensor; #[test] fn tensor_1d() { let x = Tensor::new(vec![1, 2, 3, 4, 5, 6]); assert!(x == tensor![1, 2, 3, 4, 5, 6]); assert!(x == tensor![1, 2, 3, 4, 5, 6,]); } #[test] fn tensor_2d() { let x = Tensor::new(vec![1, 2, 3, 4, 5, 6]).reshape(&[3, 2]); assert!(x == tensor![1, 2; 3, 4; 5,...
Add test for filling tensor! macro
Add test for filling tensor! macro
Rust
mit
gustavla/numeric,numeric-rust/numeric
45b2fb8d431c61f7733cdd3aeaa32166431aa1ea
src/lua/utils.rs
src/lua/utils.rs
//! Utilities to talk to Lua use rlua::{self, Table}; use rustwlc::*; const MOD_NAMES: [&str; 8] = ["Shift", "Caps", "Control", "Alt", "Mod2", "Mod3", "Mod4", "Mod5"]; /// Convert a modifier to the Lua interpretation pub fn mods_to_lua(lua: &rlua::Lua, mut mods: KeyMod) -> rlua::Result<...
//! Utilities to talk to Lua use rlua::{self, Table}; use rustwlc::*; const MOD_NAMES: [&str; 8] = ["Shift", "Caps", "Control", "Alt", "Mod2", "Mod3", "Mod4", "Mod5"]; /// Convert a modifier to the Lua interpretation pub fn mods_to_lua(lua: &rlua::Lua, mut mods: KeyMod) -> rlua::Result<...
Use iterator, not indices, in mods_to_lua
Use iterator, not indices, in mods_to_lua More likely to be optimized by the compiler
Rust
mit
way-cooler/way-cooler,Immington-Industries/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler
c2568468363b4e040ae2633ce102dc2eb7722c11
src/framework.rs
src/framework.rs
use event::Reactor; use render::{Context, GlutinContext, MetaContext}; pub struct Harness<A, C> where A: Application, C: MetaContext { application: A, context: Context<C>, } impl<A> Harness<A, GlutinContext> where A: Application { pub fn with_glutin_context(application: A) -> Self { ...
use glutin::Window; use event::{Event, PollEvents, Reactor}; use render::{Context, GlutinContext, MetaContext}; pub struct Harness<A, C> where A: Application<C>, C: MetaContext { application: A, context: Context<C>, } impl<A> Harness<A, GlutinContext> where A: Application<GlutinContext> { ...
Add basic loop to `Harness`.
Add basic loop to `Harness`.
Rust
mit
olson-sean-k/bismuth
b595d39f02946829b9d75f80f66756206825a42c
src/lib.rs
src/lib.rs
pub mod sequencematcher; pub mod differ; mod utils;
pub mod sequencematcher; pub mod differ; mod utils; use sequencematcher::SequenceMatcher; pub fn get_close_matches<'a>(word: &str, possibilities: Vec<&'a str>, n: usize, cutoff: f32) -> Vec<&'a str> { if !(0.0 <= cutoff && cutoff <= 1.0) { //error } let mut res: Vec<(f32, &str)> = Vec::new(); let mut matcher ...
Add function to get closest word for specified word in words array
Add function to get closest word for specified word in words array
Rust
mit
DimaKudosh/difflib
9b9c39f492782591e876e5547d173009d714cace
src/lib.rs
src/lib.rs
#![crate_name = "quickcheck"] #![crate_type = "lib"] #![license = "UNLICENSE"] #![doc(html_root_url = "http://burntsushi.net/rustdoc/quickcheck")] //! This crate is a port of //! [Haskell's QuickCheck](http://hackage.haskell.org/package/QuickCheck). //! //! For detailed examples, please see the //! [README](https://gi...
#![crate_name = "quickcheck"] #![crate_type = "lib"] #![license = "UNLICENSE"] #![doc(html_root_url = "http://burntsushi.net/rustdoc/quickcheck")] #![experimental] //! This crate is a port of //! [Haskell's QuickCheck](http://hackage.haskell.org/package/QuickCheck). //! //! For detailed examples, please see the //! [R...
Mark the crate as experimental.
Mark the crate as experimental.
Rust
unlicense
bluss/quickcheck,tari/quickcheck,erickt/quickcheck,aepsil0n/quickcheck
9c756f1ec05e854d4b873831035b2556d23ce6c1
test_suite/tests/compiletest.rs
test_suite/tests/compiletest.rs
#[rustc::attr(not(nightly), ignore)] #[test] fn ui() { let t = trybuild::TestCases::new(); t.compile_fail("tests/ui/**/*.rs"); }
#[cfg(not(target_os = "emscripten"))] #[rustc::attr(not(nightly), ignore)] #[test] fn ui() { let t = trybuild::TestCases::new(); t.compile_fail("tests/ui/**/*.rs"); }
Disable ui tests on emscripten
Disable ui tests on emscripten These hit a strange error in our Emscripten builder in Travis as well as locally through cargo web: ERROR: failed to execute cargo: Resource temporarily unavailable (os error 11)
Rust
apache-2.0
serde-rs/serde
a0eeb45c91c9fe14775d02d40c58d8345c0b7f95
sample/rust/clone_dyn_trivial_sample/src/main.rs
sample/rust/clone_dyn_trivial_sample/src/main.rs
#[ allow( unused_imports ) ] use clone_dyn::clone_dyn; fn main() { #[ clone_dyn ] trait Trait1 { } let vec = Vec::< Box< dyn Trait1 > >::new(); let _vec2 = vec.clone(); /* <- it does not work without `clone_dyn` */ }
#[ allow( unused_imports ) ] use clone_dyn::clone_dyn; fn main() { #[ cfg( any( feature = "use_std", feature = "use_alloc" ) ) ] { #[ clone_dyn ] trait Trait1 { } let vec = Vec::< Box< dyn Trait1 > >::new(); let _vec2 = vec.clone(); /* <- it does not work without `clone_dyn` */ } }
Fix sample `clone_dyn_trivial_sample`, add condition
Fix sample `clone_dyn_trivial_sample`, add condition
Rust
mit
Wandalen/wTools,Wandalen/wTools
ebde1656a2bd0e84d3b32c4270f9a385c42a030a
src/lib.rs
src/lib.rs
//! An implementation of [FLAC](https://xiph.org/flac), free lossless audio //! codec, written in Rust. //! //! # Examples //! //! Basic decoding from a file. //! //! ``` //! match flac::Stream::from_file("path/to/file.flac") { //! Ok(mut stream) => { //! // Copy of `StreamInfo` to help convert to a different aud...
//! An implementation of [FLAC](https://xiph.org/flac), free lossless audio //! codec, written in Rust. //! //! # Examples //! //! Basic decoding from a file. //! //! ``` //! match flac::Stream::from_file("path/to/file.flac") { //! Ok(mut stream) => { //! // Copy of `StreamInfo` to help convert to a different aud...
Remove reexport subframe module items
Remove reexport subframe module items
Rust
bsd-3-clause
sourrust/flac
63834ed1b1e43c41eace4206dbc4bf2ddb4b6a15
src/lib.rs
src/lib.rs
//! Detect the language of a string using the [cld2 library][cld2] from the //! Chromium project. //! //! ``` //! use cld2::{detect_language, Format, Reliable, Lang}; //! //! let text = "It is an ancient Mariner, //! And he stoppeth one of three. //! 'By thy long grey beard and glittering eye, //! Now wherefore stopp's...
//! Detect the language of a string using the [cld2 library][cld2] from the //! Chromium project. //! //! ``` //! use cld2::{detect_language, Format, Reliable, Lang}; //! //! let text = "It is an ancient Mariner, //! And he stoppeth one of three. //! 'By thy long grey beard and glittering eye, //! Now wherefore stopp's...
Include C++ dependencies in license metadata
Include C++ dependencies in license metadata
Rust
apache-2.0
emk/rust-cld2,emk/rust-cld2
2e3b33eb43efdb5d8936ed247b746b0f40065687
src/lib.rs
src/lib.rs
#![feature(slicing_syntax)] #![crate_type = "lib"] #![crate_name = "suruga"] #![allow(missing_copy_implementations)] #[macro_use] extern crate log; pub use tls::Tls; pub use client::TlsClient; #[macro_use] pub mod macros; pub mod util; // basic crypto primitives pub mod crypto { pub mod sha2; pub mod p256; ...
#![crate_type = "lib"] #![crate_name = "suruga"] #![allow(missing_copy_implementations)] #![feature(slicing_syntax)] #![allow(unstable)] #[macro_use] extern crate log; pub use tls::Tls; pub use client::TlsClient; #[macro_use] pub mod macros; pub mod util; // basic crypto primitives pub mod crypto { pub mod sh...
Disable unstable warnings for now
Disable unstable warnings for now
Rust
mit
klutzy/suruga
9da87bfc93b8eb42965fea71b0f3e333d96e5321
gl_tests/tests/no_warning.rs
gl_tests/tests/no_warning.rs
#![feature(plugin)] #![allow(unstable)] // TODO: remove this //! Making sure that no warning is generated by code from generate_gl_bindings! #![deny(warnings)] extern crate libc; include!(concat!(env!("OUT_DIR"), "/test_no_warnings.rs"));
//! Making sure that no warning is generated by code from generate_gl_bindings! #![deny(warnings)] extern crate libc; include!(concat!(env!("OUT_DIR"), "/test_no_warnings.rs"));
Update the tests for Rust 1.0
Update the tests for Rust 1.0
Rust
apache-2.0
nicokoch/gl-rs,nicokoch/gl-rs,skligys/gl-rs,jimarnold/gl-rs,skligys/gl-rs,neon64/gl-rs,jimarnold/gl-rs,tomaka/gl-rs,bjz/gl-rs,bjz/gl-rs,tomaka/gl-rs,neon64/gl-rs
be0402423a62d8fb5f4d5908d29f6e7f7e70e0ed
src/main.rs
src/main.rs
use clap::{FromArgMatches, IntoApp}; use casile::cli::{Cli, Subcommand}; use casile::config::CONF; use casile::{make, setup, status}; use casile::{Result, VERSION}; fn main() -> Result<()> { CONF.defaults()?; CONF.merge_env()?; CONF.merge_files()?; let app = Cli::into_app().version(VERSION); let m...
use clap::{FromArgMatches, IntoApp}; use casile::cli::{Cli, Subcommand}; use casile::config::CONF; use casile::{make, setup, status}; use casile::{Result, VERSION}; fn main() -> Result<()> { CONF.defaults()?; CONF.merge_env()?; CONF.merge_files()?; let app = Cli::into_app().version(VERSION); let m...
Update clap usage for new crate requirements
refactor(build): Update clap usage for new crate requirements
Rust
agpl-3.0
alerque/casile,alerque/casile,alerque/casile,alerque/casile,alerque/casile
a5d2baac3f382cef69488657f4edae39172e3f7e
src/rboy.rs
src/rboy.rs
#![crate_name = "rboy"] #![crate_type = "lib" ] #![feature(io, core, path)] #[macro_use] extern crate log; extern crate time; #[cfg(test)] extern crate test; pub use keypad::KeypadKey; pub mod device; mod cpu; mod gbmode; mod gpu; mod keypad; mod mbc; mod mmu; mod register; mod serial; mod sound; mod timer; mod ...
#![crate_name = "rboy"] #![crate_type = "lib" ] #![feature(io, core, path)] #![cfg_attr(test, feature(test, std_misc))] #[macro_use] extern crate log; extern crate time; #[cfg(test)] extern crate test; pub use keypad::KeypadKey; pub mod device; mod cpu; mod gbmode; mod gpu; mod keypad; mod mbc; mod mmu; mod regi...
Add features for when testing
Add features for when testing
Rust
mit
mvdnes/rboy
3ba47e3fba811c073fc0623374f15861191d2edf
testing/tests/methods.rs
testing/tests/methods.rs
#[macro_use] extern crate askama; use askama::Template; #[derive(Template)] #[template(source = "{{ self.get_s() }}", ext = "txt")] struct MethodTemplate<'a> { s: &'a str, } impl<'a> MethodTemplate<'a> { fn get_s(&self) -> &str { self.s } } #[derive(Template)] #[template(source = "{{ self.get_s(...
#[macro_use] extern crate askama; use askama::Template; #[derive(Template)] #[template(source = "{{ self.get_s() }}", ext = "txt")] struct SelfMethodTemplate<'a> { s: &'a str, } impl<'a> SelfMethodTemplate<'a> { fn get_s(&self) -> &str { self.s } } #[test] fn test_self_method() { let t = Sel...
Reformat and rename method testing tests for better organization
Reformat and rename method testing tests for better organization
Rust
apache-2.0
djc/askama,djc/askama,djc/askama
4cfc2ce46d2813f5120053929609de6f9b976cd6
src/librustc_data_structures/macros.rs
src/librustc_data_structures/macros.rs
/// A simple static assertion macro. The first argument should be a unique /// ALL_CAPS identifier that describes the condition. #[macro_export] #[allow_internal_unstable] macro_rules! static_assert { ($name:ident: $test:expr) => { // Use the bool to access an array such that if the bool is false, the acces...
/// A simple static assertion macro. The first argument should be a unique /// ALL_CAPS identifier that describes the condition. #[macro_export] #[cfg_attr(stage0, allow_internal_unstable)] #[cfg_attr(not(stage0), allow_internal_unstable(type_ascription))] macro_rules! static_assert { ($name:ident: $test:expr) => {...
Use `allow_internal_unstable` in rustc itself
Use `allow_internal_unstable` in rustc itself
Rust
apache-2.0
aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust
bb9d210c99ab248e81598d70c39c3968ab9d09eb
src/test/run-pass/over-constrained-vregs.rs
src/test/run-pass/over-constrained-vregs.rs
// Copyright 2012 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 2012 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 shift-overflow in very old run-pass test.
Fix shift-overflow in very old run-pass test.
Rust
apache-2.0
aidancully/rust,mihneadb/rust,cllns/rust,aneeshusa/rust,mvdnes/rust,KokaKiwi/rust,jroesch/rust,l0kod/rust,graydon/rust,avdi/rust,aidancully/rust,cllns/rust,ebfull/rust,gifnksm/rust,aidancully/rust,jroesch/rust,graydon/rust,gifnksm/rust,vhbit/rust,pshc/rust,reem/rust,ebfull/rust,reem/rust,XMPPwocky/rust,dwillmer/rust,cl...
69376078cb14dc30ba45d02608774bc1908e289d
src/args.rs
src/args.rs
use getopts::Options; use std::env::Args; pub struct Arguments { pub program_name: String, pub exit: bool, } fn print_usage(program: &str, opts: Options) { let brief = format!("Usage: {} [options]", program); print!("{}", opts.usage(&*brief)); } pub fn parse_args(arguments: Args) -> Arguments { l...
use getopts::Options; use std::env::Args; pub struct Arguments { pub program_name: String, pub exit: bool, } fn print_usage(program: &str, opts: Options) { let brief = format!("Usage: {} [options]", program); print!("{}", opts.usage(&*brief)); } pub fn parse_args(arguments: Args) -> Arguments { l...
Remove dead argument code for replacement
Remove dead argument code for replacement
Rust
agpl-3.0
jcolag/CommonCalendar
b8dc2377dd5afa9baeab060e55d0fc92fde9bbbc
src/main.rs
src/main.rs
extern crate rand; use std::io; use std::cmp::Ordering; use rand::Rng; fn main() { println!("Hello to the guessing game!"); let std_in = io::stdin(); let number_to_guess = rand::thread_rng().gen_range(1, 101); loop { println!("Please enter a number: "); let mut guess = String::new(...
extern crate rand; use std::io; use std::cmp::Ordering; use rand::Rng; fn main() { println!("Hello to the guessing game!"); let std_in = io::stdin(); let number_to_guess = rand::thread_rng().gen_range(1, 101); loop { println!("Please enter a number: "); let mut guess = String::new(...
Add proper error handling on wrong numbers
Add proper error handling on wrong numbers
Rust
mit
lyuboraykov/rust-exercises
5983884516d839d66d5b9f39cc0c0b0b470e1665
src/main.rs
src/main.rs
fn main() { println!("Hello, world!"); }
extern crate getopts; use getopts::Options; use std::env; use std::fs::File; use std::path::Path; fn print_usage(program: &str, opts: Options) { let usage = format!("Usage: {} [options] <filename>", program); print!("{}", opts.usage(&usage)); } fn main() { let args: Vec<String> = env::args().collect();...
Add initial implementation of CLI
Add initial implementation of CLI
Rust
mit
iKevinY/ghoti.rs
d01018ee5db4b14a7778295f21f67837a5e8370e
src/main.rs
src/main.rs
extern crate clap; use clap::{Arg, App}; use std::fs::File; use std::io; fn main() { let matches = App::new(env!("CARGO_PKG_NAME")) .version(env!("CARGO_PKG_VERSION")) .author("Scott Olson <scott@solson.me>") .about(env!("CARGO_PKG_DESCRIPTION")) .arg(Arg::with_name("INPUT") ...
extern crate clap; use clap::{Arg, App}; use std::ffi::OsStr; use std::fs::File; use std::io; fn main() { let app = App::new(env!("CARGO_PKG_NAME")) .version(env!("CARGO_PKG_VERSION")) .author("Scott Olson <scott@solson.me>") .about(env!("CARGO_PKG_DESCRIPTION")) .arg(Arg::with_nam...
Print help message when given no arguments.
Print help message when given no arguments.
Rust
mit
solson/rin
619cdcb09203e57c06ee21f136ad21d6c5c635b4
src/main.rs
src/main.rs
use std::io; use std::io::prelude::*; use std::collections::HashMap; pub mod parser; fn evaluate(input: &str, env: &mut HashMap<String, f64>) -> Result<f64, String> { let mut p = parser::Parser::new(input); let ast = try!(p.parse()); match ast.eval(env) { Some(result) => Ok(result), None =>...
use std::io; use std::io::prelude::*; use std::collections::HashMap; pub mod parser; fn evaluate(input: &str, env: &mut HashMap<String, f64>) -> Result<f64, String> { let mut p = parser::Parser::new(input); let ast = try!(p.parse()); match ast.eval(env) { Some(result) => Ok(result), None =>...
Exit when ctrl-d is entered
Exit when ctrl-d is entered however, empty lines (e.g. just newline) do not terminate
Rust
mit
andars/rust-calculator
8563e0d4fce801479315392525e5c77dbfaf14b9
libimagdiary/src/is_in_diary.rs
libimagdiary/src/is_in_diary.rs
use libimagstore::store::Entry; use libimagstore::storeid::StoreId; pub trait IsInDiary { fn is_in_diary(&self, name: &str) -> bool; } impl IsInDiary for Entry { fn is_in_diary(&self, name: &str) -> bool { self.get_location().clone().is_in_diary(name) } } impl IsInDiary for StoreId { fn ...
use libimagstore::store::Entry; use libimagstore::storeid::StoreId; pub trait IsInDiary { fn is_in_diary(&self, name: &str) -> bool; } impl IsInDiary for Entry { fn is_in_diary(&self, name: &str) -> bool { self.get_location().clone().is_in_diary(name) } } impl IsInDiary for StoreId { fn ...
Reimplement IsInDiary for StoreId with StoreId::is_in_collection()
Reimplement IsInDiary for StoreId with StoreId::is_in_collection()
Rust
lgpl-2.1
mario-kr/imag,matthiasbeyer/imag,matthiasbeyer/imag,mario-kr/imag
7df7a0a86ebf290f6f2650955f2479aaaa39beef
tests/ui/cfg_attr_lint.rs
tests/ui/cfg_attr_lint.rs
#![feature(tool_lints)] #![warn(clippy::deprecated_cfg_attr)] // This doesn't get linted, see known problems #![cfg_attr(rustfmt, rustfmt_skip)] #[cfg_attr(rustfmt, rustfmt_skip)] fn main() { foo::f(); } mod foo { #![cfg_attr(rustfmt, rustfmt_skip)] pub fn f() {} }
// Copyright 2014-2018 The Rust 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>,...
Add tests from rustfmt::skip test file
Add tests from rustfmt::skip test file
Rust
apache-2.0
aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust
8f0d48c4588928a643a6fef3239339b33630f86a
src/main.rs
src/main.rs
extern crate iron; extern crate staticfile; use iron::Iron; use staticfile::Static; use std::env; fn main() { let port = env::args().nth(1).unwrap_or("80".to_string()); let addr = format!("localhost:{}", port); println!("Listening on port {}", port); Iron::new(Static::new(".")).http(&*addr).unwrap(...
extern crate iron; extern crate staticfile; use iron::Iron; use staticfile::Static; use std::env; fn main() { let default_port = "8080".to_string(); let port = env::args().nth(1).unwrap_or(default_port); let addr = format!("localhost:{}", port); println!("Listening on port {}", port); Iron::new...
Change default port to 8080
Change default port to 8080 Port 80 as a default requires you to run `sudo`. This changes the default port to 8080 which doesn't require sudo privileges to run.
Rust
mit
aochagavia/Serve
37bfa1640f0903c1dc3c71744421554fef98f111
src/main.rs
src/main.rs
mod vm; mod command; mod parse; use std::io::Write; fn main() { loop { print!("{}", "bf> "); std::io::stdout().flush().unwrap(); let mut line = String::new(); match std::io::stdin().read_line(&mut line) { Ok(0) => break, Ok(_) => print!("{}", line), ...
mod vm; mod command; mod parse; use vm::VM; use std::io::Write; fn main() { let mut vm = VM::new(); loop { print!("{}", "bf> "); std::io::stdout().flush().unwrap(); let mut line = String::new(); match std::io::stdin().read_line(&mut line) { Ok(0) => break, ...
Initialize vm on intepreter start
Initialize vm on intepreter start
Rust
mit
nafarlee/thoughtfuck
277e2b6a488f660947e9e58e6d2a2ed837a896af
src/util.rs
src/util.rs
use std::io; use std::io::prelude::*; pub fn parse_update_count(tag: String) -> u64 { tag.split(' ').last().unwrap().parse().unwrap_or(0) } pub fn read_all<R: Read>(r: &mut R, mut buf: &mut [u8]) -> io::Result<()> { while !buf.is_empty() { match r.read(buf) { Ok(0) => return Err(io::Error:...
use std::io; use std::io::prelude::*; pub fn parse_update_count(tag: String) -> u64 { tag.split(' ').last().unwrap().parse().unwrap_or(0) } pub fn read_all<R: Read>(r: &mut R, mut buf: &mut [u8]) -> io::Result<()> { while !buf.is_empty() { match r.read(buf) { Ok(0) => return Err(io::Error:...
Disable rustfmt on a line we don't want changed
Disable rustfmt on a line we don't want changed
Rust
apache-2.0
sfackler/rust-postgres,sfackler/rust-postgres
a5798f4a839192983fadf923136d203f5ffbfc4f
src/arch/x86_common/mod.rs
src/arch/x86_common/mod.rs
use ::xen::StartInfo; pub mod defs; pub mod barrier; pub mod memory; extern { // Start info is not present on all architecture, this is why this // was made a global variable only for x86_* pub static start_info: *const StartInfo; } pub fn init() { unsafe { memory::map_shared_info(); } }
use ::xen::StartInfo; use ::xen::console::console; use ::xen::console::ConsoleInterface; pub mod defs; pub mod barrier; pub mod memory; extern { // Start info is not present on all architecture, this is why this // was made a global variable only for x86_* pub static start_info: *const StartInfo; } pub ...
Add initialization of the console
x86_common: Add initialization of the console
Rust
mit
uni-rs/uni.rs
b1456dac393a81229b3001c701c3bd1e4962c7dc
src/servo/opts.rs
src/servo/opts.rs
//! Configuration options for a single run of the servo application. Created //! from command line arguments. pub type Opts = { urls: ~[~str], render_mode: RenderMode }; pub enum RenderMode { Screen, Png(~str) } #[allow(non_implicitly_copyable_typarams)] pub fn from_cmdline_args(args: &[~str]) -> Opt...
//! Configuration options for a single run of the servo application. Created //! from command line arguments. pub struct Opts { urls: ~[~str], render_mode: RenderMode } pub enum RenderMode { Screen, Png(~str) } #[allow(non_implicitly_copyable_typarams)] pub fn from_cmdline_args(args: &[~str]) -> Opts...
Make Opts no longer a record
Make Opts no longer a record
Rust
mpl-2.0
Shraddha512/servo,dsandeephegde/servo,WriterOfAlicrow/servo,snf/servo,larsbergstrom/servo,codemac/servo,wpgallih/servo,youprofit/servo,seanmonstar/servo,saneyuki/servo,KiChjang/servo,tempbottle/servo,saratang/servo,upsuper/servo,nnethercote/servo,nnethercote/servo,tafia/servo,eddyb/servo,vks/servo,saratang/servo,dhanan...
db462fb203832938e059f913d860073ba5128daf
src/cpu.rs
src/cpu.rs
use vmx; use collections::vec::Vec; use core::sync::atomic::{ATOMIC_U16_INIT, AtomicU16, Ordering}; static CPU_COUNT: AtomicU16 = ATOMIC_U16_INIT; static CPU_ASSIGNMENT: AtomicU16 = ATOMIC_U16_INIT; pub fn init(count: u16) { CPU_COUNT.store(count, Ordering::Relaxed); } pub fn bring_core_online() { let cpu...
use vmx; use collections::vec::Vec; use core::sync::atomic::{ATOMIC_U16_INIT, AtomicU16, Ordering}; use spin; static CPU_COUNT: spin::Once<u16> = spin::Once::new(); static CPU_ASSIGNMENT: AtomicU16 = ATOMIC_U16_INIT; pub fn init(count: u16) { CPU_COUNT.call_once(||{ count }); } pub fn bring_core_online() { ...
Use spin::Once to initialize CPU count
Use spin::Once to initialize CPU count
Rust
mit
iankronquist/rustyvisor,iankronquist/rustyvisor,iankronquist/rustyvisor
34f73812e496b7269a57652c1e04d20404db612b
2.12-arr-vec-slice/src/main.rs
2.12-arr-vec-slice/src/main.rs
fn _12_1(){ println!("guide 12-1"); let a = [1i, 2i, 3i]; let mut m = [2i, 3i, 4i]; let b = [0i, ..20]; // shorthand for array of 20 elements all initialized to 0 println!("{}", b); m = [5i, 6i, 7i]; println!("{}", m); for i in m.iter() { println!("elem {}", i); } let...
fn _12_1(){ println!("guide 12-1"); let a = [1i32, 2i32, 3i32]; let mut m = [2i32, 3i32, 4i32]; if false { println!("{:?} {:?}", a, m); } let b = [0i32; 20]; // shorthand for array of 20 elements all initialized to 0 println!("{:?}", b); m = [5i32, 6i32, 7i32]; println!("{:?}...
Fix format trait errors (breaking change)
Fix format trait errors (breaking change)
Rust
mit
leonardinius/rust-guide
38e0cbf514352521e442b82aae785f91f839b215
src/lib.rs
src/lib.rs
// The shift characters are stored as nulls, as the conversion code doesn't // care what value they have. WRU? maps to ASCII ENQ (\x05), I think. const Ita2Letters = b"\0E\nA SIU\rDRJNFCKTZLWHYPQOBG\0MXV\0"; const Ita2Figures = b"\03\n- \x0787\r\x054',!:(5\")2#6019?&\0./;\0" #[test] fn it_works() { }
// The shift characters are stored as nulls, as the conversion code doesn't // care what value they have. WRU? maps to ASCII ENQ (\x05), I think. const ITA2: (&'static [u8], &'static [u8]) = (b"\0E\nA SIU\rDRJNFCKTZLWHYPQOBG\0MXV\0", b"\03\n- \x0787\r\x054',!:(5\")2#6019?&\0./;\0"); #[test] ...
Stop and think and make it compile first
Stop and think and make it compile first
Rust
mit
mcpherrinm/baudot
65c2dd7257cb4ff4f0849e86b535064cddc4fd4e
src/lib.rs
src/lib.rs
pub mod liblz4; pub mod decoder; pub mod encoder; pub use decoder::Decoder; pub use encoder::Encoder; pub use encoder::EncoderBuilder; pub use liblz4::BlockSize; pub use liblz4::BlockMode; pub use liblz4::ContentChecksum; pub use liblz4::version;
mod liblz4; mod decoder; mod encoder; pub use decoder::Decoder; pub use encoder::Encoder; pub use encoder::EncoderBuilder; pub use liblz4::BlockSize; pub use liblz4::BlockMode; pub use liblz4::ContentChecksum; pub use liblz4::version;
Hide modules from the public API, only the re-exports should be used
Hide modules from the public API, only the re-exports should be used
Rust
mit
bvinc83/lz4-rs,bozaro/lz4-rs