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
15f9c2dc0683adb07cb05a1bf3d4ef0f98603b04
tests/testsuite/init/formats_source/mod.rs
tests/testsuite/init/formats_source/mod.rs
use cargo_test_support::compare::assert_ui; use cargo_test_support::prelude::*; use cargo_test_support::Project; use cargo_test_support::curr_dir; #[cargo_test(requires_rustfmt)] fn formats_source() { let project = Project::from_template(curr_dir!().join("in")); let project_root = &project.root(); snapbo...
use cargo_test_support::compare::assert_ui; use cargo_test_support::prelude::*; use cargo_test_support::{process, Project}; use cargo_test_support::curr_dir; #[cargo_test] fn formats_source() { // This cannot use `requires_rustfmt` because rustfmt is not available in // the rust-lang/rust environment. Additio...
Fix formats_source test requiring rustfmt.
Fix formats_source test requiring rustfmt.
Rust
apache-2.0
rust-lang/cargo,nipunn1313/cargo,rustyhorde/cargo,nipunn1313/cargo,eminence/cargo,eminence/cargo,rustyhorde/cargo,rust-lang/cargo,rust-lang/cargo,eminence/cargo,rust-lang/cargo,nipunn1313/cargo,rustyhorde/cargo,eminence/cargo,nipunn1313/cargo,rustyhorde/cargo
07c82020aee9dba55598419ee5b35c24b03aa538
src/engine/world.rs
src/engine/world.rs
use std::vec::Vec; use engine::{Actor, Map}; use engine::builders::MapFromString; use util::units::{Direction, Point}; pub struct World { pub player: Actor, pub actors: Vec<Actor>, pub map: Map, } impl World { pub fn new() -> World { World { player: Actor::new("Player".to_string(...
use std::vec::Vec; use engine::{Actor, Map}; use engine::builders::MapFromString; use util::units::{Direction, Point}; pub struct World { pub player: Actor, pub actors: Vec<Actor>, pub map: Map, } impl World { pub fn new() -> World { World { player: Actor::new("Player".to_string(...
Fix walking considering the current cell instead of the destination
Fix walking considering the current cell instead of the destination
Rust
bsd-3-clause
jgilchrist/rslike
06a52cab16e9355fd5619d682dd2770d9ec6ebe2
src/search_command.rs
src/search_command.rs
extern crate alfred; use config::Config; use issue::Issue; use jira_api::SearchIssue; use jira_client; struct SearchCommand { pub config: Config, } impl SearchCommand { pub fn run(&self, keyword: &String) -> Result<String, String> { let jira_search = SearchIssue{ config: self.config.clone...
extern crate alfred; use config::Config; use jira_api::SearchIssue; use jira_client; use search_response::SearchResponse; struct SearchCommand { pub config: Config, } impl SearchCommand { pub fn run(&self, keyword: &String) -> Result<String, String> { let jira_search = SearchIssue{ config...
Change return value to the type SearchResponse
:art: Change return value to the type SearchResponse
Rust
mit
dorayakikun/alfred_jira_workflow
0822bf2304bf73be0ec64edef60e1b598a88e462
src/lib.rs
src/lib.rs
#[macro_use] extern crate bitflags; extern crate gl as gl_lib; #[cfg(feature = "cgmath")] extern crate cgmath as cgmath_lib; #[cfg(feature = "image")] extern crate image as image_lib; mod ref_into; #[macro_use] mod macros; mod context; mod buffer; mod shader; mod program; mod framebuffer; mod renderbuffer; mod textur...
#[macro_use] extern crate bitflags; extern crate gl as gl_lib; #[cfg(feature = "cgmath")] extern crate cgmath as cgmath_lib; #[cfg(feature = "image")] extern crate image as image_lib; mod ref_into; #[macro_use] mod macros; mod context; mod buffer; mod shader; mod program; mod framebuffer; mod renderbuffer; mod textur...
Add `FramebufferContext` to the prelude
Add `FramebufferContext` to the prelude
Rust
apache-2.0
kylewlacy/glitter,kylewlacy/glitter
95bd0211c01da0f912102bcff8ca99ce640236a1
tests/lib.expand.rs
tests/lib.expand.rs
#![feature(prelude_import)] #![doc = " Test"] #[prelude_import] use std::prelude::v1::*; #[macro_use] extern crate std; #[doc = " Test"] pub fn test() {}
#![feature(prelude_import)] //! Test #[prelude_import] use std::prelude::v1::*; #[macro_use] extern crate std; /// Test pub fn test() {}
Update expected output with normalize_doc_attributes = true
Update expected output with normalize_doc_attributes = true Rustfmt supports this configuration on nightly only.
Rust
apache-2.0
dtolnay/cargo-expand
53dae58999f1866cf01d64a0e94b7055756679d7
src/counter.rs
src/counter.rs
pub struct StdCounter { pub value: i64 } pub trait Counter { fn clear(&mut self); fn dec(&mut self, value: i64); fn inc(&mut self, value: i64); fn snapshot(&self) -> Self; } impl Counter for StdCounter { fn clear(&mut self) { self.value = 0; } fn dec(&mut self, value: i64) { ...
use metric::Metric; pub struct StdCounter { pub value: i64 } pub trait Counter : Metric { fn clear(&mut self); fn dec(&mut self, value: i64); fn inc(&mut self, value: i64); fn snapshot(&self) -> Self; fn new() -> Self; } impl Counter for StdCounter { fn clear(&mut self) { se...
Use metric and cleanup a bit
Use metric and cleanup a bit
Rust
apache-2.0
ekarlso/rust-metrics,ekarlso/rust-metrics
e59ce64872c30c283289db332a9d284626a96eee
src/lib.rs
src/lib.rs
#[macro_use] extern crate nom; extern crate ansi_term; pub mod parser; pub mod ast; pub mod error;
extern crate pest; #[macro_use] extern crate pest_derive; extern crate ansi_term; pub mod ast; pub mod error; /// For some reason, Pest cannot find the grammar file if listed in parser/mod.rs, so I listed it here pub mod parser { const _GRAMMAR: &'static str = include_str!("grammar/grammar.pest"); #[derive...
Remove old crates and add inline parser module
Remove old crates and add inline parser module
Rust
apache-2.0
Willifme/robin_core,Willifme/robin_core,Willifme/robin_core
8a3a6fb1013e9e15bbb085091c4cc65f87d58f5a
test_suite/tests/compiletest.rs
test_suite/tests/compiletest.rs
#[cfg_attr(target_os = "emscripten", ignore)] #[rustversion::attr(not(nightly), ignore)] #[test] fn ui() { let t = trybuild::TestCases::new(); t.compile_fail("tests/ui/**/*.rs"); }
#[cfg_attr(target_os = "emscripten", ignore)] #[rustversion::attr(not(nightly), ignore)] #[cfg_attr(miri, ignore)] #[test] fn ui() { let t = trybuild::TestCases::new(); t.compile_fail("tests/ui/**/*.rs"); }
Disable ui test on miri
Disable ui test on miri
Rust
apache-2.0
serde-rs/serde
d391523c0ec4bda1d3940255f3a52770906371d0
src/net/if_.rs
src/net/if_.rs
//! Network interface name resolution. //! //! Uses Linux and/or POSIX functions to resolve interface names like "eth0" //! or "socan1" into device numbers. use libc::{c_uint, if_nametoindex}; use std::ffi::{CString, NulError}; use ::{Result, Error}; /// Resolve an interface into a interface number. pub fn name_to_in...
//! Network interface name resolution. //! //! Uses Linux and/or POSIX functions to resolve interface names like "eth0" //! or "socan1" into device numbers. use libc; use libc::c_uint; use std::ffi::{CString, NulError}; use ::{Result, Error}; /// Resolve an interface into a interface number. pub fn if_nametoindex(nam...
Use function name as it is used in C.
Use function name as it is used in C.
Rust
mit
posborne/rust-nix,nikklassen/nix-rust,geofft/nix-rust,asomers/nix,xd009642/nix,posborne/rust-nix,nikklassen/nix-rust,berkowski/nix,carllerche/nix-rust,geofft/nix-rust,carllerche/nix-rust,nikklassen/nix-rust,nix-rust/nix,berkowski/nix,nix-rust/nix,MarkusJais/nix-rust,berkowski/nix,carllerche/nix-rust,Susurrus/nix,geofft...
14d721388b1317eb85dd79210c03e303f9ab95aa
src/test/run-pass/const-extern-function.rs
src/test/run-pass/const-extern-function.rs
// Copyright 2013 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 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
Add test case for change in 039bfe
Add test case for change in 039bfe
Rust
apache-2.0
emk/rust,aturon/rust,stepancheg/rust-ide-rust,seanrivera/rust,barosl/rust,vhbit/rust,stepancheg/rust-ide-rust,dinfuehr/rust,quornian/rust,kimroen/rust,mihneadb/rust,nwin/rust,gifnksm/rust,stepancheg/rust-ide-rust,P1start/rust,kimroen/rust,servo/rust,robertg/rust,stepancheg/rust-ide-rust,0x73/rust,jbclements/rust,sae-bo...
b7f32273b8b0cb1979e144058d27cb2d1fa1c912
immutabillity/src/main.rs
immutabillity/src/main.rs
fn main() { let subject = "world"; println!("Hello, {}!", subject); println!("Goodbye, {}!", subject); }
fn main() { let mut subject = "world"; println!("Hello, {}!", subject); println!("Goodbye, {}!", subject); subject = "moon"; println!("Hello, {}!", subject); println!("Goodbye, {}!", subject); }
Save code after episode is recorded
Save code after episode is recorded
Rust
mit
bits-of-rust/episode-005
b4766f80775a2635c026626070201356f33d2700
src/test/ui/feature-gates/feature-gate-is_sorted.rs
src/test/ui/feature-gates/feature-gate-is_sorted.rs
fn main() { // Assert `Iterator` methods are feature gated assert!([1, 2, 2, 9].iter().is_sorted()); //^ ERROR: use of unstable library feature 'is_sorted' assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs())); //^ ERROR: use of unstable library feature 'is_sorted' // Assert `[T]` me...
fn main() { // Assert `Iterator` methods are feature gated assert!([1, 2, 2, 9].iter().is_sorted()); //~^ ERROR: use of unstable library feature 'is_sorted': new API assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs())); //~^ ERROR: use of unstable library feature 'is_sorted': new API ...
Correct error location indicated by comments
Correct error location indicated by comments
Rust
apache-2.0
aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust
84a9dbf8e44bd9825eaa4cc6cac18e6e40f8e8f7
protos/build.rs
protos/build.rs
extern crate protoc_grpcio; fn main() { let proto_root = "src/"; println!("cargo:rerun-if-changed={}", proto_root); protoc_grpcio::compile_grpc_protos(&["services.proto"], &[proto_root], &proto_root) .expect("Failed to compile gRPC definitions!"); }
extern crate protoc_grpcio; fn main() { let proto_root = &format!("{}{}", "src", std::path::MAIN_SEPARATOR); println!("cargo:rerun-if-changed={}", proto_root); protoc_grpcio::compile_grpc_protos(&["services.proto"], &[proto_root], &proto_root) .expect("Failed to compile gRPC definitions!"); }
Fix hardcoded string to use system constant for directory separator
Fix hardcoded string to use system constant for directory separator
Rust
apache-2.0
sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse
7154349695db804f5d6cab439e07386ca2ab49cb
src/init/mod.rs
src/init/mod.rs
//! This module initializes a project. use std::{fs, io, error}; use git2::Repository; #[derive(Debug)] pub enum InitError<'a> { Io(io::Error), FolderNotEmpty(&'a str, usize), TodoErr } impl error::Error for InitError { fn description(&self) -> &str { match self { Io(err) => form...
//! This module initializes a project. use std::fs; use std::io::{Result, Error, ErrorKind}; use git2::Repository; /// Creates a folder. The folder must not exist or must be empty. /// /// Impure. pub fn make_project_folder(root: &str) -> Result<()> { // Make the folder - ignore error. let _ = fs::create_dir...
Revert "A bunch of error handling thats just too much"
Revert "A bunch of error handling thats just too much" This reverts commit 16dc6f02599d33b0cc7069b0d340df6a038d7da8.
Rust
mit
ProtonLights/cli,ProtonLights/proton-cli
34dc6a1ba568853663d5e0bbecefaff148265c71
lib/umbrella/src/lib.rs
lib/umbrella/src/lib.rs
//! Cretonne umbrella crate, providing a convenient one-line dependency. #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces, unstable_features)] #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(feature = "cargo-clippy", ...
//! Cretonne umbrella crate, providing a convenient one-line dependency. #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![warn(unused_import_braces, unstable_features)] #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(feature = "cargo-clippy", ...
Add settings::Configurable and isa to the prelude.
Add settings::Configurable and isa to the prelude. These are useful for API users that customize the TargetIsa.
Rust
apache-2.0
stoklund/cretonne,stoklund/cretonne,stoklund/cretonne
2d5897bfe7daac00a761693e9b62e0ca642249a8
src/bin/main.rs
src/bin/main.rs
// this is just a test binary that can be hooked up to Instruments extern crate lonlat_bng; use lonlat_bng::{convert_to_bng_threaded, convert_to_bng_threaded_nocopy, Array}; extern crate rand; use rand::distributions::{IndependentSample, Range}; extern crate libc; fn main() { let num_coords = 10000000; let b...
// this is just a test binary that can be hooked up to Instruments extern crate lonlat_bng; use lonlat_bng::{convert_to_bng_threaded, convert_to_bng_threaded_nocopy, Array}; extern crate rand; use rand::distributions::{IndependentSample, Range}; extern crate libc; fn main() { let num_coords = 10000000; let b...
Use F64 values for testing
Use F64 values for testing
Rust
mit
urschrei/rust_bng,urschrei/lonlat_bng,urschrei/lonlat_bng,urschrei/lonlat_bng,urschrei/rust_bng
f4f23735b213127c829726e2b88c5843e02474c5
tests/trait_impl.rs
tests/trait_impl.rs
#![no_std] #[macro_use] extern crate static_assertions; assert_impl!(byte; u8, Send, Sync); #[cfg(feature = "failure")] assert_impl!(ptr; *const u8, Send, Sync); #[test] fn str_impl() { assert_impl!(str, Send, Sync, AsRef<[u8]>); }
#![no_std] #[macro_use] extern crate static_assertions; assert_impl!(byte; u8, Send, Sync); assert_impl!(slice; [u8], Send, Sync, AsRef<[u8]>); #[cfg(feature = "failure")] assert_impl!(ptr; *const u8, Send, Sync); #[test] fn str_impl() { assert_impl!(str, Send, Sync, AsRef<[u8]>); }
Check assert_impl against byte slice
[Tests] Check assert_impl against byte slice
Rust
apache-2.0
nvzqz/static-assertions-rs
9eefda9c43c0780cc28c922f4f2a1b08e8132df9
src/back/instsel/mod.rs
src/back/instsel/mod.rs
use back::machine::MachineCode; use middle::ir; struct InstructionSelector<'a> { ir: &'a ir::Program, code: MachineCode } impl<'a> InstructionSelector<'a> { fn new(ir: &'a ir::Program) -> InstructionSelector<'a> { InstructionSelector { ir: ir, code: MachineCod...
//! The instruction selector //! //! Note: For now this will be the simplest instruction selector possible. //! I'll be able to improve it later, but I need something that works //! before I can get there. use back::machine::MachineCode; use middle::ir; struct InstructionSelector<'a> { ir:...
Add note about instruction selector
Add note about instruction selector
Rust
mit
msiemens/RusTiny,msiemens/RusTiny
3aafc75c991548a468631c6aa6e6b20d60632de1
src/systemd/bindings.rs
src/systemd/bindings.rs
#![allow(dead_code)] #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(clippy::redundant_static_lifetimes)] #![allow(clippy::unreadable_literal)] #![allow(clippy::missing_safety_doc)] // This allow should be removed once bindgen finds a way to // generate struct alignm...
#![allow(dead_code)] #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(clippy::redundant_static_lifetimes)] #![allow(clippy::unreadable_literal)] #![allow(clippy::missing_safety_doc)] // This allow should be removed once bindgen finds a way to // generate struct alignm...
Allow lint in order to cover our lowest supported toolchain
Allow lint in order to cover our lowest supported toolchain This would be unnecessary if it were a clippy lint, but it is a regular compiler lint. Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>
Rust
mpl-2.0
stratis-storage/stratisd,stratis-storage/stratisd,stratis-storage/stratisd
6ac551cd706d6b17a791fdfeb08e0d8a3ed4d00a
src/vector.rs
src/vector.rs
//! Define trait for vectors use ndarray::{LinalgScalar, Array, Ix1}; use num_traits::float::Float; /// Methods for vectors pub trait Vector { type Scalar; /// L-2 norm fn norm(&self) -> Self::Scalar; } impl<A: Float + LinalgScalar> Vector for Array<A, Ix1> { type Scalar = A; fn norm(&self) -> Se...
//! Define trait for vectors use std::iter::Sum; use ndarray::{LinalgScalar, ArrayBase, Data, Dimension}; use num_traits::float::Float; /// Methods for vectors pub trait Vector { type Scalar; /// rename of norm_l2 fn norm(&self) -> Self::Scalar { self.norm_l2() } /// L-1 norm fn norm_l...
Add norm_{l1,l2,max} in Vector crate
Add norm_{l1,l2,max} in Vector crate
Rust
mit
termoshtt/ndarray-linalg
89c34e74ef1e25112f7167a47ce74e0afb1d7759
libimagentryfilter/src/builtin/header/field_isempty.rs
libimagentryfilter/src/builtin/header/field_isempty.rs
use libimagstore::store::Entry; use builtin::header::field_path::FieldPath; use filter::Filter; use toml::Value; pub struct FieldIsEmpty { header_field_path: FieldPath, } impl FieldIsEmpty { pub fn new(path: FieldPath) -> FieldIsEmpty { FieldIsEmpty { header_field_path: path, } ...
use libimagstore::store::Entry; use builtin::header::field_path::FieldPath; use filter::Filter; use toml::Value; pub struct FieldIsEmpty { header_field_path: FieldPath, } impl FieldIsEmpty { pub fn new(path: FieldPath) -> FieldIsEmpty { FieldIsEmpty { header_field_path: path, } ...
Fix semantics if is-empty filter
Fix semantics if is-empty filter
Rust
lgpl-2.1
mario-kr/imag,matthiasbeyer/imag,matthiasbeyer/imag,mario-kr/imag
c0acc44074089194ddcfdca118420967dc03b455
src/interface/mod.rs
src/interface/mod.rs
mod terminal; pub struct Interface { choices: Vec<String> } impl Interface { /// Creates a new Interface with the provided input choices. pub fn with_choices(choices: Vec<String>) -> Interface { Interface { choices: choices } } // Starts the interface pub fn run(&m...
mod terminal; use std::io::Write; use self::terminal::{Terminal, Event, Key}; pub struct Interface { choices: Vec<String>, terminal: Terminal } impl Interface { /// Creates a new Interface with the provided input choices. pub fn with_choices(choices: Vec<String>) -> Interface { let mut term =...
Add terminal to Interface, use for printing, events
Add terminal to Interface, use for printing, events
Rust
mit
stewart/rff,stewart/rff
7f96b7e9e4859832e848edac658ff42ca73b7ad7
src/net/mod.rs
src/net/mod.rs
//! TCP/UDP bindings for `tokio-core` //! //! This module contains the TCP/UDP networking types, similar to the standard //! library, which can be used to implement networking protocols. mod tcp; mod udp; pub use self::tcp::{TcpStream, TcpStreamNew}; pub use self::tcp::{TcpListener, Incoming}; pub use self::udp::{Udp...
//! TCP/UDP bindings for `tokio-core` //! //! This module contains the TCP/UDP networking types, similar to the standard //! library, which can be used to implement networking protocols. mod tcp; mod udp; pub use self::tcp::{TcpStream, TcpStreamNew}; pub use self::tcp::{TcpListener, Incoming}; pub use self::udp::{Udp...
Add some more public exports
Add some more public exports
Rust
mit
tokio-rs/tokio,tokio-rs/tokio
2f3e3f206b87c961ff7c735eb3335b8b959f25a8
src/engine/game.rs
src/engine/game.rs
use engine::World; use engine::log; use util::units::Direction; /// The entire game state. pub struct Game { pub world: World, } pub enum Command { Walk(Direction), } impl Game { /// Creates a new game. pub fn new() -> Game { Game { world: World::new(), } } pub f...
use engine::World; use util::units::Direction; /// The entire game state. pub struct Game { pub world: World, } pub enum Command { Walk(Direction), } impl Game { /// Creates a new game. pub fn new() -> Game { Game { world: World::new(), } } pub fn do_command(&mu...
Remove an unused import to prevent a warning
Remove an unused import to prevent a warning
Rust
bsd-3-clause
jgilchrist/rslike
35984028e008e86d3ed57489b46112e05f2c86e5
src/arch/x86/cpu.rs
src/arch/x86/cpu.rs
// // SOS: the Stupid Operating System // by Hawk Weisman (hi@hawkweisman.me) // // Copyright (c) 2015 Hawk Weisman // Released under the terms of the MIT license. See `LICENSE` in the root // directory of this repository for more information. // //! Code for interacting with the x86 CPU. //! //! Currently this mo...
// // SOS: the Stupid Operating System // by Hawk Weisman (hi@hawkweisman.me) // // Copyright (c) 2015 Hawk Weisman // Released under the terms of the MIT license. See `LICENSE` in the root // directory of this repository for more information. // //! Code for interacting with the x86 CPU. //! //! Currently this mo...
Fix import of 32-bit PIC module
Fix import of 32-bit PIC module
Rust
apache-2.0
rachlmac/sos-kernel,hawkw/sos-kernel,rachlmac/sos-kernel,hawkw/sos-kernel,rachlmac/sos-kernel,hawkw/sos-kernel
b3687c02905ecb3eda12f1763e28d2d9e6763139
tests/features/mod.rs
tests/features/mod.rs
macro_rules! hide_from_rustfmt { ($($tt:tt)*) => { $($tt)* }; } #[cfg(not(all( feature = "derive", feature = "full", feature = "parsing", feature = "printing", feature = "visit", feature = "visit-mut", feature = "fold", feature = "clone-impls", feature = "extra-trait...
#[allow(unused_macros)] macro_rules! hide_from_rustfmt { ($mod:item) => { $mod }; } #[cfg(not(all( feature = "derive", feature = "full", feature = "parsing", feature = "printing", feature = "visit", feature = "visit-mut", feature = "fold", feature = "clone-impls", fe...
Hide warning when tests/features/error is not triggered
Hide warning when tests/features/error is not triggered
Rust
apache-2.0
dtolnay/syn
6167b90964d8d89afdcdd27b192ea71205868694
src/ui/mod.rs
src/ui/mod.rs
extern crate sdl2; pub use self::screen::Screen; mod screen; /// Abstract object that can be created to initialize and access the UI pub struct UI; impl UI { /// Create an abstract UI object (initializes SDL2 until dropped) pub fn new () -> UI { match sdl2::init([sdl2::InitVideo]) { false => fail!("ui: Faile...
extern crate sdl2; pub use self::screen::Screen; mod screen; /// Abstract object that can be created to initialize and access the UI pub struct UI; impl UI { /// Create an abstract UI object (initializes SDL2 until dropped) pub fn new () -> UI { match sdl2::init([sdl2::InitVideo]) { false => fail!("ui: Faile...
Allow closure for UI loop to return false to break the loop
Allow closure for UI loop to return false to break the loop
Rust
mit
zargony/rusty64,zargony/rusty64
eece68b15d01f1e1ef53605bacaa58da80da7288
yaqb/src/types/ord.rs
yaqb/src/types/ord.rs
use types::{self, NativeSqlType}; pub trait SqlOrd {} impl SqlOrd for types::SmallInt {} impl SqlOrd for types::Integer {} impl SqlOrd for types::BigInt {} impl SqlOrd for types::Float {} impl SqlOrd for types::Double {} impl SqlOrd for types::VarChar {} impl SqlOrd for types::Text {} impl<T: SqlOrd + NativeSqlType> ...
use types::{self, NativeSqlType}; pub trait SqlOrd {} impl SqlOrd for types::SmallInt {} impl SqlOrd for types::Integer {} impl SqlOrd for types::BigInt {} impl SqlOrd for types::Float {} impl SqlOrd for types::Double {} impl SqlOrd for types::VarChar {} impl SqlOrd for types::Text {} impl SqlOrd for types::Date {} i...
Implement `SqlOrd` for date and time types
Implement `SqlOrd` for date and time types I missed this when I added them, but they can definitely be ordered.
Rust
apache-2.0
mcasper/diesel,SoftwareWarlock/diesel,diesel-rs/diesel,tohou/diesel,diesel-rs/diesel,sgrif/diesel,cascalheira/diesel,mcasper/diesel,tohou/diesel,sgrif/diesel,cascalheira/diesel,SoftwareWarlock/diesel
382142f35b35f7a371e2c671b9a1ab26c9d5b81a
src/macros.rs
src/macros.rs
macro_rules! unwrap { ($expr:expr, $fail_body:block) => ( match $expr { ::std::option::Option::Some(val) => val, ::std::option::Option::None => $fail_body } ); } macro_rules! is_none { ($expr:expr) => ( match $expr { ::std::option::Option::None => true, _ => false, } ); } macro_rules! is_some ...
macro_rules! unwrap { ($expr:expr, $fail_body:block) => ( match $expr { ::std::option::Option::Some(val) => val, ::std::option::Option::None => $fail_body } ); } macro_rules! matches { ($expr:expr, $($pattern:tt)+) => ( match $expr { $($pattern)+ => true, _ => false, } ); } #[cfg(feature="trac...
Fix warning 'unused macro definition'
Fix warning 'unused macro definition'
Rust
mit
dubrowgn/tcalc,dubrowgn/tcalc
4e85d198ac72408bd65be795ff55cc0be43bbec7
scratchapixel/src/geometry/vector.rs
scratchapixel/src/geometry/vector.rs
use std::ops::{Mul,Add}; pub struct Vec3<T: Mul<T, Output = T> + Add<T, Output = T> + Copy + Clone> { x: T, y: T, z: T, } impl <T: Mul<T, Output = T> + Add<T, Output = T> + Copy + Clone> Vec3<T> { pub fn norm(self) -> T { (self.x * self.x + self.y * self.y + self.z * self.z) } } #[cfg(tes...
use std::ops::{Mul,Add}; pub struct Vec3<T> where T: Mul<T, Output = T> + Add<T, Output = T> + Copy + Clone { x: T, y: T, z: T, } impl <T> Vec3<T> where T : Mul<T, Output = T> + Add<T, Output = T> + Copy + Clone { pub fn norm(self) -> T { (self.x * self.x + self.y * self.y + self.z * self.z) ...
Use where clauses for type bounds
Use where clauses for type bounds
Rust
mit
Chair-of-Indefinite-Studies/scratchapixel
1a18c659f86cc6d2d2b69052891fc563f6904a3f
src/inline_lazy.rs
src/inline_lazy.rs
// Copyright 2016 lazy-static.rs Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except accor...
// Copyright 2016 lazy-static.rs Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except accor...
Patch obscure soundness issue in the inline lazy impl.
Patch obscure soundness issue in the inline lazy impl.
Rust
apache-2.0
Kimundi/lazy-static.rs,rust-lang-nursery/lazy-static.rs
1a0e2e1056eb8bccd50f7c7e07b58cb3e4e0ef53
src/frame/decoder.rs
src/frame/decoder.rs
use frame::ChannelAssignment; pub fn decode(channel_assignment: ChannelAssignment, buffer: &mut [i32]) { match channel_assignment { ChannelAssignment::Independent => return, ChannelAssignment::LeftSide => unimplemented!(), ChannelAssignment::RightSide => unimplemented!(), ChannelAssignment::Midd...
use frame::ChannelAssignment; fn decode_left_side(buffer: &mut [i32]) { let block_size = buffer.len() / 2; for i in 0..block_size { let left = buffer[i]; let side = buffer[i + block_size]; // right channel buffer[i + block_size] = left - side; } } pub fn decode(channel_assignment: ChannelAssig...
Add implementation for `LeftSide` decoding
Add implementation for `LeftSide` decoding
Rust
bsd-3-clause
sourrust/flac
7b99aee552d95f0df4d4550ff2dec873a963e620
src/module/helpers/content.rs
src/module/helpers/content.rs
pub fn extract_links(s: &String) -> Vec<String> { use pulldown_cmark::Parser; use pulldown_cmark::Event; use pulldown_cmark::Tag; Parser::new(&s[..]) .filter_map(|e| { match e { Event::Start(t) => Some(t), Event::End(t) => Some(t), ...
mod markdown { use pulldown_cmark::Parser; use pulldown_cmark::Event; use pulldown_cmark::Tag; pub struct MarkdownParser<'a> { text: &'a String } impl<'a> MarkdownParser<'a> { pub fn new(s: &'a String) -> MarkdownParser { MarkdownParser { text: s ...
Rewrite markdown parsing, so we can extract links and quotes (and maybe more)
Rewrite markdown parsing, so we can extract links and quotes (and maybe more)
Rust
lgpl-2.1
mario-kr/imag,matthiasbeyer/imag,mario-kr/imag,matthiasbeyer/imag
3d44328314890e4e88315c91b582297bb73b2d6f
tests/cli_tests.rs
tests/cli_tests.rs
#[test] #[cfg(feature = "syntax-highlight")] fn cli_tests() { trycmd::TestCases::new().case("tests/cmd/*.md"); }
#[test] #[cfg(feature = "syntax-highlight")] fn cli_tests() { let t = trycmd::TestCases::new(); t.case("tests/cmd/*.md"); #[cfg(not(feature = "serve"))] { t.skip("tests/cmd/errors.md"); } }
Increase CLI test coverage under different feature sets
test: Increase CLI test coverage under different feature sets
Rust
mit
cobalt-org/cobalt.rs,cobalt-org/cobalt.rs,cobalt-org/cobalt.rs,cobalt-org/cobalt.rs
5ad5fd3b8f57976050f3f1a94d9c63bd94d6f9cd
src/fake_extctxt.rs
src/fake_extctxt.rs
use syntax; use syntax::codemap::DUMMY_SP; use syntax::ext::base::{ ExtCtxt, DummyMacroLoader }; /// Create a fake ExtCtxt to perform macro quasiquotes outside of rustc plugins pub fn with_fake_extctxt<T, F: Fn(&ExtCtxt) -> T>(f: F) -> T { let ps = syntax::parse::ParseSess::new(); let mut fg_cfg = Vec::new(); le...
use syntax; use syntax::codemap::DUMMY_SP; use syntax::ext::base::{ ExtCtxt, DummyMacroLoader }; /// Create a fake ExtCtxt to perform macro quasiquotes outside of rustc plugins pub fn with_fake_extctxt<T, F: Fn(&ExtCtxt) -> T>(f: F) -> T { let ps = syntax::parse::ParseSess::new(); let mut loader = DummyMacroLoader...
Support ExtCtxt::new changes in nightly
Support ExtCtxt::new changes in nightly Compatibility with rust-lang/rust@2cd6ccf.
Rust
mit
tempbottle/rust-peg,tempbottle/rust-peg,kevinmehall/rust-peg,kevinmehall/rust-peg
554b81d636adbfff787e71e1b2e66f565d636bed
serde_macros/tests/compile-fail/reject-unknown-attributes.rs
serde_macros/tests/compile-fail/reject-unknown-attributes.rs
#![feature(custom_attribute, custom_derive, plugin)] #![plugin(serde_macros)] extern crate serde; #[derive(Serialize)] #[serde(abc="xyz")] //~ unknown serde container attribute `abc = "xyz"` struct Foo { x: u32, } #[derive(Deserialize)] #[serde(abc="xyz")] //~ unknown serde container attribute `abc = "xyz"` stru...
#![feature(custom_attribute, custom_derive, plugin)] #![plugin(serde_macros)] extern crate serde; #[derive(Serialize)] #[serde(abc="xyz")] //~ unknown serde container attribute `abc = "xyz"` struct A { x: u32, } #[derive(Deserialize)] #[serde(abc="xyz")] //~ unknown serde container attribute `abc = "xyz"` struct...
Fix compiletest error in newest nightly
Fix compiletest error in newest nightly
Rust
apache-2.0
oli-obk/rust-serde,serde-rs/serde,erickt/serde
9add5812e219b86b1ad422876a00d8922a1dc618
serde_test/build.rs
serde_test/build.rs
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 minor = match rustc_minor_version...
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 minor = match rustc_minor_version...
Update track_caller cfg link to show what version it's in
Update track_caller cfg link to show what version it's in
Rust
apache-2.0
serde-rs/serde
b246b1c40dbe9a311e35acc1591bfaee3f1afe1b
src/core/map.rs
src/core/map.rs
// Todo: Add tile metadata // use models::*; use core::{Vec2}; struct Entity; struct Player; /// The tiles pub enum Tile { Water, Grass, Tree, None, } /// A block: a field consisting of three layers, containing tiles. pub struct Block { background: Tile, ground: Tile, foreground: Tile, } impl Block {...
// Todo: Add tile metadata // use models::*; use core::{Vec2, Entity}; use models::{Player}; /// The tiles pub enum Tile { Water, Grass, Tree, None, } /// A block: a field consisting of three layers, containing tiles. pub struct Block { background: Tile, ground: Tile, foreground: Tile, } impl Block { ...
Make use of core in Map.rs
Make use of core in Map.rs
Rust
mit
Ticki/Open-Sea
502fd29bd91cdee6b03ea548f012db9a0163b62c
24_iterators/src/lib.rs
24_iterators/src/lib.rs
struct Counter { count: u32 } impl Counter { fn new() -> Counter { Counter { count: 0 } } } impl Iterator for Counter { type Item = u32; fn next(&mut self) -> Option<Self::Item> { self.count += 1; if self.count < 6 { Some(self.count) } else { ...
struct Counter { count: u32 } impl Counter { fn new() -> Counter { Counter { count: 0 } } } impl Iterator for Counter { type Item = u32; fn next(&mut self) -> Option<Self::Item> { self.count += 1; if self.count < 6 { Some(self.count) } else { ...
Implement test showing that we can also use other iter methods
Implement test showing that we can also use other iter methods
Rust
mit
pgrzesik/learning-rust
4f7f4b8023325efeb76ac3172c349fc47d7cf84b
src/xmpstring.rs
src/xmpstring.rs
use ::c; use std::str; use std::ffi::{CStr}; pub struct XmpString { ptr: *mut c::XmpString } impl XmpString { pub fn new() -> XmpString { XmpString { ptr: unsafe { c::xmp_string_new() } } } pub fn is_null(&self) -> bool { self.ptr.is_null() } pub fn as_ptr(&self) -> *const c...
use ::c; use std::str; use std::ffi::{CStr}; pub struct XmpString { ptr: *mut c::XmpString } impl XmpString { pub fn new() -> XmpString { XmpString { ptr: unsafe { c::xmp_string_new() } } } pub fn is_null(&self) -> bool { self.ptr.is_null() } pub fn as_ptr(&self) -> *const c...
Implement Eq trait for XmpString
Implement Eq trait for XmpString
Rust
bsd-2-clause
hfiguiere/exempi-rs
38383017d6bf22ded0af1875e164f0f154285f2f
library/core/src/slice/specialize.rs
library/core/src/slice/specialize.rs
use crate::mem::{size_of, transmute_copy}; use crate::ptr::write_bytes; pub(super) trait SpecFill<T> { fn spec_fill(&mut self, value: T); } impl<T: Clone> SpecFill<T> for [T] { default fn spec_fill(&mut self, value: T) { if let Some((last, elems)) = self.split_last_mut() { for el in elems ...
pub(super) trait SpecFill<T> { fn spec_fill(&mut self, value: T); } impl<T: Clone> SpecFill<T> for [T] { default fn spec_fill(&mut self, value: T) { if let Some((last, elems)) = self.split_last_mut() { for el in elems { el.clone_from(&value); } *last...
Remove size_of == 1 case from `fill` specialization.
Remove size_of == 1 case from `fill` specialization.
Rust
apache-2.0
aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust
d007d44dad08aa4239a2e85ce00a0466f32a4440
src/test/compile-fail/issue-14366.rs
src/test/compile-fail/issue-14366.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 ...
Revise DST test to not require duplicate errors.
Revise DST test to not require duplicate errors.
Rust
apache-2.0
andars/rust,l0kod/rust,0x73/rust,zubron/rust,mvdnes/rust,hauleth/rust,reem/rust,gifnksm/rust,XMPPwocky/rust,kwantam/rust,jashank/rust,jashank/rust,bombless/rust,victorvde/rust,mihneadb/rust,mdinger/rust,carols10cents/rust,aepsil0n/rust,aneeshusa/rust,gifnksm/rust,rprichard/rust,barosl/rust,AerialX/rust-rt-minimal,TheNe...
b3ae27e22eeecfd4bd5bf7739b94789d56c9854a
build.rs
build.rs
extern crate cc; fn main() { cc::Build::new() .file("libmikktspace/mikktspace.c") .file("libmikktspace/mikktspace.c") .compile("mikktspace"); println!("cargo:rustc-link-lib=static=mikktspace"); }
extern crate cc; fn main() { cc::Build::new() .file("libmikktspace/mikktspace.c") .file("libmikktspace/mikktspace.c") .compile("mikktspace"); }
Remove redundant rustc link directive
Remove redundant rustc link directive
Rust
apache-2.0
gltf-rs/mikktspace
c07645ef058868bcd824487caa7536ec99660abc
rusoto/services/cloudfront/src/custom/custom_tests.rs
rusoto/services/cloudfront/src/custom/custom_tests.rs
extern crate rusoto_mock; use crate::generated::{CloudFront, CloudFrontClient, ListDistributionsRequest}; use rusoto_core::Region; use self::rusoto_mock::*; #[test] fn should_list_distributions() { let body = MockResponseReader::read_response("test_resources/generated/valid", "cloudfront-list-distributions.xml")...
extern crate rusoto_mock; use crate::generated::{CloudFront, CloudFrontClient, ListDistributionsRequest}; use rusoto_core::Region; use self::rusoto_mock::*; #[test] fn should_list_distributions() { let body = MockResponseReader::read_response("test_resources/generated/valid", "cloudfront-list-distributions.xml")...
Fix custom test for Cloudfront.
Fix custom test for Cloudfront.
Rust
mit
rusoto/rusoto,DualSpark/rusoto,rusoto/rusoto,DualSpark/rust-aws,DualSpark/rust-aws,DualSpark/rusoto,rusoto/rusoto,DualSpark/rusoto,DualSpark/rust-aws
3c58b124a8ad6b84a3082844fa33833cd6fc3c82
protocol/src/lib.rs
protocol/src/lib.rs
extern crate byteorder; pub mod ber; pub mod error; use ber::common; use ber::types::ASNType; pub type Result<T> = std::result::Result<T, error::LDAPError>; pub fn build_envelope(msgid: i32, protocolOp: common::Tag, controls: Option<common::Tag>) -> common::Tag { let msgidtag = msgid.into_ber_universal(); ...
extern crate byteorder; pub mod ber; pub mod error; use ber::common; use ber::types::ASNType; pub type Result<T> = std::result::Result<T, error::LDAPError>; pub fn construct_envelope(msgid: i32, protocolOp: common::Tag, controls: Option<common::Tag>) -> common::Tag { let msgidtag = msgid.into_ber_universal(); ...
Use if let because why not
Use if let because why not
Rust
apache-2.0
inejge/ldap3,inejge/ldap3,inejge/rust-ldap,Dean4Devil/rust-ldap,dequbed/rust-ldap
f7ed9c5c446c6ec9b29c05291433f93a50ea1f37
crates/ruma-federation-api/src/lib.rs
crates/ruma-federation-api/src/lib.rs
#![doc(html_favicon_url = "https://www.ruma.io/favicon.ico")] #![doc(html_logo_url = "https://www.ruma.io/images/logo.png")] //! (De)serializable types for the [Matrix Server-Server API][federation-api]. //! These types are used by server code. //! //! [federation-api]: https://matrix.org/docs/spec/server_server/r0.1.4...
#![doc(html_favicon_url = "https://www.ruma.io/favicon.ico")] #![doc(html_logo_url = "https://www.ruma.io/images/logo.png")] //! (De)serializable types for the [Matrix Server-Server API][federation-api]. //! These types are used by server code. //! //! [federation-api]: https://matrix.org/docs/spec/server_server/r0.1.4...
Enable doc_cfg feature under cfg(docsrs)
federation-api: Enable doc_cfg feature under cfg(docsrs)
Rust
mit
ruma/ruma
125c44cf7948a642859e51a9ecc3dbd8541166d6
rust/wtools/vector.rs
rust/wtools/vector.rs
use std::cmp::PartialEq; // pub fn append_vectors_once<'a, T : PartialEq + Copy, F : FnMut(T)>( dst : &'a mut Vec<T>, src : &'a Vec<Vec<T>>, on_evaluate : Option<F> ) -> &'a mut Vec<T> { if on_evaluate.is_none() { for vec in src { for el in vec { if !dst.contains( el ) { ...
use std::cmp::PartialEq; // pub fn append_vectors_once<'a, T : PartialEq + Copy, F : FnMut(T)>( dst : &'a mut Vec<T>, src : &'a Vec<Vec<T>>, on_evaluate : Option<F> ) -> &'a mut Vec<T> { if on_evaluate.is_none() { for vec in src { for el in vec { if !dst.contains( el ) { ...
Extend routine `left_index` by implementation for equalizer
Extend routine `left_index` by implementation for equalizer
Rust
mit
Wandalen/wTools,Wandalen/wTools
4d7b930d886812a0b91227879d831ead98f1c5d3
src/librustc_back/target/arm_linux_androideabi.rs
src/librustc_back/target/arm_linux_androideabi.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 ...
Enable vfp3-d16 for ARMv7 Android target
Enable vfp3-d16 for ARMv7 Android target Android's [armeabi-v7a ABI][1] guarantees at least VFPv3-d16 hardware FPU support, so Rust should include this in the default features for the arm-linux-androideabi target. [1]: https://developer.android.com/ndk/guides/abis.html
Rust
apache-2.0
GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,GBGamer/rust
889b9ad3f05da1a02275b9c2c6a2b7386136a8b2
components/profile_traits/lib.rs
components/profile_traits/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/. */ //! This module contains APIs for the `profile` crate used generically in the //! rest of Servo. These APIs are he...
/* 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/. */ //! This module contains APIs for the `profile` crate used generically in the //! rest of Servo. These APIs are he...
Allow unsafe code for energy module (build failure otherwise)
Allow unsafe code for energy module (build failure otherwise)
Rust
mpl-2.0
splav/servo,anthgur/servo,cbrewster/servo,anthgur/servo,rnestler/servo,canaltinova/servo,dsandeephegde/servo,cbrewster/servo,mbrubeck/servo,CJ8664/servo,rnestler/servo,mattnenterprise/servo,CJ8664/servo,emilio/servo,szeged/servo,larsbergstrom/servo,dati91/servo,nnethercote/servo,ConnorGBrewster/servo,mbrubeck/servo,pet...
e2b375822083cfbe3925ed50bed3f25b72e5d1a6
src/faker/phone_number.rs
src/faker/phone_number.rs
use ::helper::*; use ::Fake; pub trait PhoneNumber { fn phone_number() -> String; fn phone_number_with_format<S: Into<String>>(format: S) -> String; fn cell_number() -> String; } impl<T: Fake> PhoneNumber for T { #[inline] default fn phone_number() -> String { let len = T::PHONE_NUMBER_FOR...
use ::helper::*; use ::Fake; pub trait PhoneNumber { fn phone_number() -> String; fn phone_number_with_format<S: AsRef<str>>(format: S) -> String; fn cell_number() -> String; } impl<T: Fake> PhoneNumber for T { #[inline] default fn phone_number() -> String { let len = T::PHONE_NUMBER_FORMA...
Use ´AsRef<str>` instead of `Into<String>`
Use ´AsRef<str>` instead of `Into<String>` Avoids unused allocations
Rust
apache-2.0
cksac/fake-rs
953cd5c4896559e714d5cb454541737fc0d354b3
build.rs
build.rs
use std::str; use std::path::Path; use std::process::{self, Command}; extern crate capnpc; fn main() { // CAPNP_INCLUDE_DIR=$(shell dirname $(shell which capnp))/../include let prefix = { let output = Command::new("which") .arg("capnp") .outp...
use std::str; use std::path::Path; use std::process::{self, Command}; extern crate capnpc; fn main() { // CAPNP_INCLUDE_DIR=$(shell dirname $(shell which capnp))/../include let prefix = { let output = Command::new("which") .arg("capnp") .outp...
Update to modern Path api
Update to modern Path api
Rust
mit
dwrensha/capnp-rpc-rust,tempbottle/capnproto-rust,placrosse/capnproto-rust,dwrensha/capnproto-rust,dwrensha/capnp-rpc-rust
2a5d18339e0fe3095a55143b8b679446f8a1e9c0
src/lib.rs
src/lib.rs
extern crate perl_sys; mod context; mod pushable; mod handle; mod scalar; #[macro_use] mod macros; pub mod raw { pub use perl_sys::types::*; pub use perl_sys::funcs::*; pub use perl_sys::consts::*; } pub use context::Context; pub use raw::{ IV, UV, NV }; pub use handle::{ SV, AV, HV }; pub use handle::{...
extern crate perl_sys; pub mod context; pub mod pushable; pub mod handle; pub mod scalar; #[macro_use] mod macros; pub mod raw { pub use perl_sys::types::*; pub use perl_sys::funcs::*; pub use perl_sys::consts::*; } pub use context::Context; pub use raw::{ IV, UV, NV }; pub use handle::{ SV, AV, HV }; p...
Make modules with public stuff public too.
Make modules with public stuff public too.
Rust
bsd-2-clause
vickenty/perl-xs,vickenty/perl-xs
ec8275c364493b938357a3615216e3f30c60a443
src/libstd/sys/wasm/stack_overflow.rs
src/libstd/sys/wasm/stack_overflow.rs
pub struct Handler; impl Handler { pub unsafe fn new() -> Handler { Handler } } pub unsafe fn init() {} pub unsafe fn cleanup() {}
pub unsafe fn init() {} pub unsafe fn cleanup() {}
Remove stack overflow handler stub for wasm.
Remove stack overflow handler stub for wasm.
Rust
apache-2.0
aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust
24a315065dd3a7a9faefc8cf4a0137dcde7b61df
yaqb/src/connection/cursor.rs
yaqb/src/connection/cursor.rs
use Queriable; use db_result::DbResult; use types::{NativeSqlType, FromSqlRow}; use std::marker::PhantomData; pub struct Cursor<ST, T> { current_row: usize, db_result: DbResult, _marker: PhantomData<(ST, T)>, } impl<ST, T> Cursor<ST, T> { pub fn new(db_result: DbResult) -> Self { Cursor { ...
use Queriable; use db_result::DbResult; use types::{NativeSqlType, FromSqlRow}; use std::marker::PhantomData; /// The type returned by various [`Connection`](struct.Connection.html) methods. /// Acts as an iterator over `T`. pub struct Cursor<ST, T> { current_row: usize, db_result: DbResult, _marker: Phan...
Add a short description of `Cursor`, hide internal functions
Add a short description of `Cursor`, hide internal functions
Rust
apache-2.0
cascalheira/diesel,sgrif/diesel,sgrif/diesel,diesel-rs/diesel,SoftwareWarlock/diesel,diesel-rs/diesel,tohou/diesel,SoftwareWarlock/diesel,mcasper/diesel,cascalheira/diesel,mcasper/diesel,tohou/diesel
19c3e1e39a9ddc929dd3acbbed03a145770974f2
src/class/vm.rs
src/class/vm.rs
use std::slice; use binding::vm::init; use class::object::Object; use types::{Argc, Value}; use class::traits::RawObject; pub struct VM; impl VM { pub fn init() { init(); } pub fn parse_arguments(argc: Argc, arguments: *const Object) -> Vec<Object> { unsafe { slice::from_raw...
use std::slice; use binding::vm::init; use class::object::Object; use types::{Argc, Value}; pub struct VM; impl VM { pub fn init() { init(); } pub fn parse_arguments(argc: Argc, arguments: *const Object) -> Vec<Object> { unsafe { slice::from_raw_parts(arguments, argc as usize...
Remove unused RawObject import from class:VM
Remove unused RawObject import from class:VM
Rust
mit
d-unseductable/ruru
5540201236d923008d57929f403d55c58ef0a696
contrib/src/templates/tera_templates.rs
contrib/src/templates/tera_templates.rs
extern crate tera; use std::path::PathBuf; use super::serde::Serialize; use super::{TemplateInfo, TEMPLATE_DIR}; lazy_static! { static ref TERA: tera::Tera = { let path: PathBuf = [&*TEMPLATE_DIR, "**", "*.tera"].iter().collect(); tera::Tera::new(path.to_str().unwrap()) }; } pub const EXT: &...
extern crate tera; use std::path::PathBuf; use super::serde::Serialize; use super::{TemplateInfo, TEMPLATE_DIR}; lazy_static! { static ref TERA: Result<tera::Tera, String> = { let path: PathBuf = [&*TEMPLATE_DIR, "**", "*.tera"].iter().collect(); tera::Tera::new(path.to_str().unwrap()).map_err(|e...
Fix fallout from Tera dependency update.
Fix fallout from Tera dependency update.
Rust
apache-2.0
impowski/Rocket,gsquire/Rocket,antonpirker/Rocket,shssoichiro/Rocket,antonpirker/Rocket,shssoichiro/Rocket,gsquire/Rocket,impowski/Rocket,impowski/Rocket,antonpirker/Rocket,shssoichiro/Rocket,gsquire/Rocket
4d32e1c030d29d3a9c0ed4e5e6379acaef29f9b8
src/force_generator/force_generator.rs
src/force_generator/force_generator.rs
#![allow(missing_docs)] // for downcast. use downcast_rs::Downcast; use na::RealField; use crate::object::BodySet; use crate::solver::IntegrationParameters; /// The handle of a force generator. pub type ForceGeneratorHandle = usize; /// A persistent force generator. /// /// A force generator applies a force to one...
#![allow(missing_docs)] // for downcast. use downcast_rs::Downcast; use na::RealField; use crate::object::BodySet; use crate::solver::IntegrationParameters; /// The handle of a force generator. pub type ForceGeneratorHandle = usize; /// A persistent force generator. /// /// A force generator applies a force to one...
Update documentation for `ForceGenerator` trait
Update documentation for `ForceGenerator` trait
Rust
bsd-3-clause
sebcrozet/nphysics,sebcrozet/nphysics
a53569007d115252c6afea9ca014cb400974dade
third_party/libtock-drivers/src/lib.rs
third_party/libtock-drivers/src/lib.rs
#![no_std] pub mod buttons; pub mod console; pub mod led; pub mod nfc; pub mod result; pub mod rng; pub mod timer; pub mod usb_ctap_hid; pub mod util;
#![no_std] pub mod buttons; pub mod console; pub mod led; #[cfg(feature = "with_nfc")] pub mod nfc; pub mod result; pub mod rng; pub mod timer; pub mod usb_ctap_hid; pub mod util;
Hide NFC behind feature flag
Hide NFC behind feature flag
Rust
apache-2.0
google/OpenSK,google/OpenSK,google/OpenSK
8fc45b446dd8e13feca154d03bc83499780dd100
tests/support/mod.rs
tests/support/mod.rs
/*! Test supports module. */ use glutin; use glium::{mod, DisplayBuild}; use std::os; /// Builds a headless display for tests. pub fn build_display() -> glium::Display { if os::getenv("HEADLESS_TESTS").is_some() { glutin::HeadlessRendererBuilder::new(1024, 768).build_glium().unwrap() } else { ...
/*! Test supports module. */ use glutin; use glium::{mod, DisplayBuild}; use std::os; /// Builds a headless display for tests. pub fn build_display() -> glium::Display { if os::getenv("HEADLESS_TESTS").is_some() { glutin::HeadlessRendererBuilder::new(1024, 768).build_glium().unwrap() } else { ...
Fix unsupported texture type in blitting test
Fix unsupported texture type in blitting test
Rust
apache-2.0
glium/glium,TyOverby/glium,cpjreynolds/glium,acolley/glium,msiglreith/glium,rozaliev/glium,caldwell/glium,carbidegames/glium,nicokoch/glium,bvssvni/glium,sdotz/glium,christopheraugustus/glium,binsoftware/glium,tomaka/glium
4ddf66187aeca3ad1d44e239c794ecf4be95c5bf
src/libcore/num/int_macros.rs
src/libcore/num/int_macros.rs
#![doc(hidden)] macro_rules! doc_comment { ($x:expr, $($tt:tt)*) => { #[doc = $x] $($tt)* }; } macro_rules! int_module { ($T:ident) => (int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]);); ($T:ident, #[$attr:meta]) => ( doc_comment! { concat!("The small...
#![doc(hidden)] macro_rules! doc_comment { ($x:expr, $($tt:tt)*) => { #[doc = $x] $($tt)* }; } macro_rules! int_module { ($T:ident) => (int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]);); ($T:ident, #[$attr:meta]) => ( doc_comment! { concat!("The small...
Define module level int consts from assoc consts
Define module level int consts from assoc consts
Rust
apache-2.0
aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust
ca2171f1c94763b777791ca1a9c55a9179f96ce0
src/main.rs
src/main.rs
extern crate mprovision; extern crate clap; use std::fs; use clap::{Arg, App, AppSettings, SubCommand}; fn main() { let count_subcommand = SubCommand::with_name("count") .about("Counts provisioning profiles in a directory.") .arg(Arg::with_name("DIRECTORY") .short("d") .lo...
extern crate mprovision; extern crate clap; use std::fs; use clap::{Arg, App, AppSettings, SubCommand}; fn main() { let count_subcommand = SubCommand::with_name("count") .about("Counts provisioning profiles in a directory.") .arg(Arg::with_name("DIRECTORY") .help("Directory where to c...
Remove unnecessary arg name for 'count' subcommand.
Remove unnecessary arg name for 'count' subcommand.
Rust
mit
zummenix/mprovision
2f8d78dc78e2bd0eee456541d4e57e3f7bd23c6b
src/main.rs
src/main.rs
use std::env; use std::io; use std::io::Write; #[macro_use] mod macros; mod buffered_iterator; mod ast; mod scanning; mod parsing; mod running; use ast::*; fn main() { for arg in env::args() { println!("{}", arg); } loop { let mut line = String::new(); print!("> "); io::stdout().flush().expect("Could n...
use std::env; use std::io; use std::io::Write; #[macro_use] mod macros; mod buffered_iterator; mod ast; mod scanning; mod parsing; mod running; use ast::*; fn parse_args() { for arg in env::args().skip(1) { match parsing::parse(&arg) { Some(Ast::Expression(expr)) => { match expr.run() { Ok(v) => prin...
Add support for passing equations via args
Add support for passing equations via args $ tcalc 1+1 2
Rust
mit
dubrowgn/tcalc,dubrowgn/tcalc
02676f5d21524255b15fe69aeffe1194f994fe9c
engine/src/conversion/codegen_rs/impl_item_creator.rs
engine/src/conversion/codegen_rs/impl_item_creator.rs
// Copyright 2020 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
// Copyright 2020 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
Add SharedPtr and WeakPtr support.
Add SharedPtr and WeakPtr support.
Rust
apache-2.0
google/autocxx,google/autocxx,google/autocxx,google/autocxx
f39a09507a8766993d784733549918e533f2a960
examples/knock_knock.rs
examples/knock_knock.rs
extern crate anybar; use anybar::*; fn main() { println!("Knock knock!"); if let Ok(is_open) 0 get_buerostatus() { if is_open { println!("Who's there?"); } else { println!("..."); } } }
extern crate buerostatus; use buerostatus::*; fn main() { println!("Knock knock!"); if let Ok(is_open) = get_buerostatus() { if is_open { println!("Who's there?"); } else { println!("..."); } } }
Fix 'typo' in crate name
Fix 'typo' in crate name
Rust
mit
Feliix42/buerostatus-rs
7f5b5fdb1ba8339aac46144c782bf6848a7815b6
src/object_id.rs
src/object_id.rs
#[deriving(PartialEq, Show)] pub struct ObjectId { pub hash: &'static str, bytes: Vec<u8> } impl ObjectId { pub fn new(hash: &'static str) -> ObjectId { ObjectId { hash: hash, bytes: Vec::new() } } }
use conversion; pub static RAW_SIZE: uint = 20; pub static HEX_SIZE: uint = 40; #[deriving(PartialEq, Show)] pub struct ObjectId { pub hash: String, bytes: Vec<u8> } impl ObjectId { pub fn from_string(hash: &str) -> ObjectId { ObjectId { hash: hash.to_string(), ...
Make sure ObjectId always has the hash version and the raw version
Make sure ObjectId always has the hash version and the raw version
Rust
mit
kaisellgren/rust_git
7fc8b0bc06f8170e3fc34c95385073648d0379c2
nested/build.rs
nested/build.rs
use std::env; use std::fs::File; use std::io::Write; use std::iter; use std::path::Path; /* #[doc(hidden)] #[macro_export] macro_rules! count { () => { proc_macro_call_0!() }; (!) => { proc_macro_call_1!() }; (!!) => { proc_macro_call_2!() }; ... } */ fn main() { let out_dir = env::var("OUT_DIR")....
use std::env; use std::fs::File; use std::io::Write; use std::iter; use std::path::Path; /* #[doc(hidden)] #[macro_export] macro_rules! count { () => { proc_macro_call_0!() }; (!) => { proc_macro_call_1!() }; (!!) => { proc_macro_call_2!() }; ... } */ fn main() { let out_dir = env::var("OUT_DIR")....
Add error message for nested macros above the limit
Add error message for nested macros above the limit error: this macro does not support >64 nested macro invocations --> src/main.rs:13:9 | 13 | / select! { 14 | | _ = next_msg => { 15 | | println!("1"); 16 | | println!("2"); ... ...
Rust
apache-2.0
dtolnay/proc-macro-hack
2f7f8ebcab920c8455826c48bd19701bfb8bcbd1
nmk/src/nmk/platform.rs
nmk/src/nmk/platform.rs
use once_cell::sync::Lazy; #[allow(dead_code)] #[derive(PartialEq, Clone)] pub enum PlatformType { Unknown, OSX, Linux, Arch, Alpine, } pub fn is_alpine() -> bool { *PLATFORM == PlatformType::Alpine } pub fn is_arch() -> bool { *PLATFORM == PlatformType::Arch } pub fn is_mac() -> bool { ...
use once_cell::sync::Lazy; #[allow(dead_code)] #[derive(PartialEq, Clone, Copy)] pub enum PlatformType { Unknown, OSX, Linux, Arch, Alpine, } pub fn is_alpine() -> bool { *PLATFORM == PlatformType::Alpine } pub fn is_arch() -> bool { *PLATFORM == PlatformType::Arch } pub fn is_mac() -> b...
Use Path to check file existence
Use Path to check file existence
Rust
mit
nuimk/nmk,nuimk/nmk,nuimk/nmk,nuimk/nmk
0a7e050447536e74e9ea607ce06da4a391b6b870
src/hitable.rs
src/hitable.rs
use vector::Vec3; use ray::Ray; #[derive(Debug, Copy, Clone, PartialEq)] pub struct HitRecord { pub t : f64, pub p : Vec3, pub normal : Vec3, } impl HitRecord { pub fn new(time : f64, point : Vec3, norm : Vec3) -> HitRecord { HitRecord { t: time, p: point, normal: norm } } } pub trait Hitable { fn hi...
use vector::Vec3; use ray::Ray; pub struct HitRecord { pub t : f64, pub p : Vec3, pub normal : Vec3, } impl HitRecord { pub fn new(time : f64, point : Vec3, norm : Vec3) -> HitRecord { HitRecord { t: time, p: point, normal: norm } } } pub trait Hitable { fn hit(&self, r: Ray, t_min: f64, t_max: f64, ...
Remove trait derive for now In order to implement material on hit record, we will likely need to use Box, which makes implementing copy & clone difficult
Remove trait derive for now In order to implement material on hit record, we will likely need to use Box, which makes implementing copy & clone difficult
Rust
mit
corragon/rust-raytracer
10a3bd31222f34e990dd7016acb4e3ee0e330483
src/bin/open.rs
src/bin/open.rs
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.chars().count(); s.slice_chars(0, min(l, 15)) } #[allow...
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.chars().count(); s.slice_chars(0, min(l, 15)) } #[allow...
Remove no longer returns an Option
Remove no longer returns an Option
Rust
mit
shepmaster/sxd-document,shepmaster/sxd-document
ab0d62002516562829151ec207c1c5bb9a7d6d6d
src/components/main/css/select.rs
src/components/main/css/select.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 extra::url::Url; use style::Stylesheet; use style::Stylist; use style::selector_matching::UserAgentOrigin; 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 style::Stylesheet; use style::Stylist; use style::selector_matching::UserAgentOrigin; pub fn new_stylist() ->...
Remove the 'border-width: 0' hack.
Remove the 'border-width: 0' hack. This was to work-around a netsurfcss quirk.
Rust
mpl-2.0
bjwbell/servo,youprofit/servo,dati91/servo,froydnj/servo,pgonda/servo,pyecs/servo,GreenRecycleBin/servo,jgraham/servo,steveklabnik/servo,wpgallih/servo,ruud-v-a/servo,nrc/servo,upsuper/servo,saratang/servo,brendandahl/servo,seanmonstar/servo,dvberkel/servo,juzer10/servo,g-k/servo,mukilan/servo,canaltinova/servo,tafia/s...
9506c5c963fd880b4fcd006246c700b5e7f52ed9
examples/button_test.rs
examples/button_test.rs
extern crate kiss_ui; use kiss_ui::button::Button; use kiss_ui::container::Horizontal; use kiss_ui::callback::OnClick; use kiss_ui::dialog::Dialog; use kiss_ui::text::Label; fn main() { kiss_ui::show_gui(|| Dialog::new(Horizontal::new(|builder|{ builder.add_child( Button::new()...
extern crate kiss_ui; use kiss_ui::button::Button; use kiss_ui::container::Horizontal; use kiss_ui::callback::{OnClick, CallbackStatus}; use kiss_ui::dialog::Dialog; use kiss_ui::text::Label; fn main() { kiss_ui::show_gui(|| Dialog::new(Horizontal::new(|builder|{ builder.add_child( ...
Add close button to button test dialog
Add close button to button test dialog
Rust
mit
tempbottle/kiss-ui,cybergeek94/kiss-ui,KISS-UI/kiss-ui,KISS-UI/kiss-ui,tempbottle/kiss-ui,cybergeek94/kiss-ui
07c47087bbbb08f68bb7338c2aa5b6d1634fb1f0
examples/placeholders_string.rs
examples/placeholders_string.rs
#![feature(phase)] #[phase(plugin)] extern crate static_fragments; extern crate fragments; template! greeting {"Hello, [[:name]]!"} fn main() { let mut template = greeting::new(); //Insert something into the `name` placeholder template.insert_name("Peter"); //Templates can be printed as they are ...
#![feature(plugin)] #[plugin] #[no_link] extern crate static_fragments; extern crate fragments; template! greeting {"Hello, [[:name]]!"} fn main() { let mut template = greeting::new(); //Insert something into the `name` placeholder template.insert_name("Peter"); //Templates can be printed as they a...
Update example for macro reform
Update example for macro reform
Rust
mit
Ogeon/static_fragments
13e7a901517873e8122605fa729bb0aea54c06e9
tests/test_backtrace.rs
tests/test_backtrace.rs
#![cfg(not(miri))] #[rustversion::not(nightly)] #[ignore] #[test] fn test_backtrace() {} #[rustversion::nightly] #[test] fn test_backtrace() { use anyhow::anyhow; let error = anyhow!("oh no!"); let _ = error.backtrace(); }
#[rustversion::not(nightly)] #[ignore] #[test] fn test_backtrace() {} #[rustversion::nightly] #[test] fn test_backtrace() { use anyhow::anyhow; let error = anyhow!("oh no!"); let _ = error.backtrace(); }
Revert "Disable backtrace test on miri"
Revert "Disable backtrace test on miri" Fixed in nightly-2022-07-26. Closes #246. This reverts commit 8d25d6b2c9bb04c9f0d222ed6b900f696c0e7ebe.
Rust
apache-2.0
dtolnay/anyhow
35bada57c2025e79ca0057e03daadb7d37e21b78
0001-0050/prob0012.rs
0001-0050/prob0012.rs
use euler; import iter::*; import euler::prime; fn gen_triangles(&trigs: [uint]) { alt vec::len(trigs) { 0u { trigs = [1u]; } x { trigs += [trigs[x - 1u] + x + 1u]; } } } fn num_factors(num: u64, primes: prime::prime) -> u64 { let mut prod = 1u; prime::factors(num, primes) { |f| ...
use euler; import euler::prime; fn each_triangles(f: fn(&&uint) -> bool) { let mut idx = 0u; let mut t = 1u; loop { if !f(t) { break; } idx += 1u; t += idx + 1u; } } fn num_factors(num: u64, primes: prime::prime) -> u64 { let mut prod = 1u; prim...
Modify methods for generating triangle numbers.
Modify methods for generating triangle numbers.
Rust
mit
gifnksm/ProjectEulerRust,tempbottle/ProjectEulerRust
132b84eeb4b951bb88376d170b9110636efa77bf
src/cli.rs
src/cli.rs
use getopts; pub fn run(args: Vec<String>) -> Result<String, String> { let options = getopts::Options::new(); let matches = match options.parse(args.iter().skip(1)) { Ok(matches) => matches, Err(fail) => return Err(fail.to_err_msg()) }; let usage = Ok(options.usage("Usage: corectl COMMA...
use getopts; const USAGE: &'static str = "Usage: corectl [OPTIONS] COMMAND [COMMAND OPTIONS] Commands: deploy Deploy fleet units help Output this help message version Output corectl's version number"; pub fn run(args: Vec<String>) -> Result<String, String> { let mut options = getopts:...
Improve help output, add version command, add stub deploy command.
Improve help output, add version command, add stub deploy command.
Rust
mit
kbknapp/corectl
46a4e2d0b96b42be2d2f31b5a14863891f093f26
src/main.rs
src/main.rs
fn main() { println!("Hello, world!"); }
use std::string::String; use std::collections::HashMap; use std::vec::Vec; use std::fs::{File}; use std::env; use std::path::{Path}; use std::io::{self, BufReader, BufRead}; type Bag = HashMap<usize, usize>; fn load_bags<P: AsRef<Path>>(path: P) -> io::Result<(Vec<usize>, Vec<Bag>)> { let mut bags = Vec::new(); ...
Add functions to load dataset
Add functions to load dataset
Rust
mit
yuttie/tilda
be509f499b0281b32ba9bc8ab1b97766f29ee5a9
src/main.rs
src/main.rs
extern crate gauge_rs; use std::env; fn help() { println!("Rust language runner for Gauge. Version: {}", gauge_rs::version()); println!("\nAvailable commands:"); println!(" --init - Create a new Gauge project with Rust language runner in the current \ directory"); println!("...
extern crate gauge_rs; use std::env; fn help() { println!("Rust language runner for Gauge. Version: {}", gauge_rs::version()); println!("\nAvailable commands:"); println!(" --init - Create a new Gauge project with Rust language runner in the current \ directory"); println...
Add support to print --version
Add support to print --version Signed-off-by: Kaustav Das Modak <ba1ce5b1e09413a89404909d8d270942c5dadd14@yahoo.co.in>
Rust
mit
getgauge-contrib/gauge-rs,getgauge-contrib/gauge-rs,kaustavdm/gauge-rs,kaustavdm/gauge-rs
1686117153d692d9482c4d4c16aaa01cea1672dd
src/main.rs
src/main.rs
extern crate mio_websocket; extern crate env_logger; use std::net::SocketAddr; use mio_websocket::interface::*; fn main() { env_logger::init().unwrap(); let mut ws = WebSocket::new("0.0.0.0:10000".parse::<SocketAddr>().unwrap()); loop { match ws.next() { WebSocketEvent::Connect(tok...
extern crate mio_websocket; extern crate env_logger; use std::net::SocketAddr; use mio_websocket::interface::*; fn main() { env_logger::init().unwrap(); let mut ws = WebSocket::new("0.0.0.0:10000".parse::<SocketAddr>().unwrap()); loop { match ws.next() { (tok, WebSocketEvent::Conne...
Update to use latest mio-websocket
Update to use latest mio-websocket
Rust
mit
nbaksalyar/rust-chat
4b3c35509b7bd75c0b4712bb45440955d997ae75
src/librustc_mir/lib.rs
src/librustc_mir/lib.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 ...
Mark the crate as unstable
rustc_mir: Mark the crate as unstable Wouldn't want to be able to link to this on stable Rust!
Rust
apache-2.0
aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust
e840c69d8b7b02ef5b1a4995ac0214c3a9df232a
utils/src/asn1-spec-dump.rs
utils/src/asn1-spec-dump.rs
extern crate asn1_parse; #[macro_use] extern crate nom; extern crate argparse; use std::io; use std::io::Read; use std::fs; use std::path::Path; use asn1_parse::parse::spec::asn1_spec; use argparse::{ArgumentParser, StoreOption}; fn main() { let opts = parse_args(); let bytes: Result<Vec<_>, _> = match opts.file...
extern crate asn1_parse; extern crate nom; extern crate argparse; use std::io; use std::io::Read; use std::fs; use std::path::Path; use asn1_parse::parse::spec::asn1_spec; use argparse::{ArgumentParser, StoreOption}; fn main() { let opts = parse_args(); let bytes: Result<Vec<_>, _> = match opts.file { Some(r...
Remove many0! from dump util, so errors get reported
Remove many0! from dump util, so errors get reported
Rust
apache-2.0
keeperofdakeys/asn1-parse,keeperofdakeys/asn1-parse
9d93cf61d5a9473f6fd54e30b8943d4d38496d72
src/char_class.rs
src/char_class.rs
#[inline] pub fn alpha(term: u8) -> bool { (term >= 0x41 && term <= 0x5A) || (term >= 0x61 && term <= 0x7A) } #[inline] pub fn digit(term: u8) -> bool { term >= 0x30 && term <= 0x39 } #[inline] pub fn alphanum(term: u8) -> bool { alpha(term) || digit(term) } #[inline] pub fn hex_digit(term: u8) -> bool { (term ...
/// Recognises an alphabetic character, `a-zA-Z`. #[inline] pub fn alpha(term: u8) -> bool { (term >= 0x41 && term <= 0x5A) || (term >= 0x61 && term <= 0x7A) } /// Recognises a decimal digit, `0-9`. #[inline] pub fn digit(term: u8) -> bool { term >= 0x30 && term <= 0x39 } /// Recognises an alphanumeric character, `...
Add space and multispace char classes
Add space and multispace char classes
Rust
mit
J-F-Liu/pom
b23cfc383f8ce3fe4f0ed0023c01ce4731569833
src/exit_codes.rs
src/exit_codes.rs
pub enum ExitCode { Success, GeneralError, KilledBySigint, } impl Into<i32> for ExitCode { fn into(self) -> i32 { match self { Self::Success => 0, Self::GeneralError => 1, Self::KilledBySigint => 130, } } } impl ExitCode { pub fn error_if_any...
pub enum ExitCode { Success, GeneralError, KilledBySigint, } impl Into<i32> for ExitCode { fn into(self) -> i32 { match self { ExitCode::Success => 0, ExitCode::GeneralError => 1, ExitCode::KilledBySigint => 130, } } } impl ExitCode { pub fn ...
Switch back from Self to ExitCode
Switch back from Self to ExitCode
Rust
apache-2.0
sharkdp/fd,sharkdp/fd
fa0694dd53583bae9b534bde6429a3135617b91b
src/main.rs
src/main.rs
struct Philosopher { name: String } impl Philosopher { fn new(name: &str) -> Philosopher { Philosopher { name: name.to_string() } } fn eat(&self) { println!("{} is done eating.", self.name); } } fn main() { let p1 = Philosopher::new("Judith Butler"); le...
struct Philosopher { name: String } impl Philosopher { fn new(name: &str) -> Philosopher { Philosopher { name: name.to_string() } } fn eat(&self) { println!("{} is done eating.", self.name); } } fn main() { let philosophers = vec![ Philosopher::new(...
Move the 5 philosophers into a vector
Move the 5 philosophers into a vector
Rust
mit
juliangrosshauser/dining_philosophers
3d192ace34bcb13d3c033735cd7415260040c252
library/std/src/sys/unsupported/rwlock.rs
library/std/src/sys/unsupported/rwlock.rs
use crate::cell::UnsafeCell; pub struct RWLock { mode: UnsafeCell<isize>, } unsafe impl Send for RWLock {} unsafe impl Sync for RWLock {} // no threads on this platform impl RWLock { pub const fn new() -> RWLock { RWLock { mode: UnsafeCell::new(0) } } #[inline] pub unsafe fn read(&self) ...
#![deny(unsafe_op_in_unsafe_fn)] use crate::cell::Cell; pub struct RWLock { mode: Cell<isize>, } unsafe impl Send for RWLock {} unsafe impl Sync for RWLock {} // no threads on this platform impl RWLock { pub const fn new() -> RWLock { RWLock { mode: Cell::new(0) } } #[inline] pub unsafe...
Remove unsafety from unsupported/rwlosck.rs by using a Cell.
Remove unsafety from unsupported/rwlosck.rs by using a Cell. Replacing the UnsafeCell by a Cell makes it all safe.
Rust
apache-2.0
aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust
53fb23d1591afa06aec64a3292bc43cde9df0fa6
rust/phone-number/src/lib.rs
rust/phone-number/src/lib.rs
#![feature(ascii_ctype)] use std::ascii::AsciiExt; fn check_countrycode(mut phone: Vec<u8>) -> Option<String> { println!("{:?}", phone); if phone[0] != b'1' { return None; } String::from_utf8(phone.drain(1..).collect()).ok() } pub fn number(phone: &str) -> Option<String> { let result = ...
#![feature(ascii_ctype)] use std::ascii::AsciiExt; pub fn number<S>(phone: S) -> Option<String> where S: Into<String> { let result = phone .into() .chars() .filter(|x| x.is_ascii_digit()) .collect::<String>(); match result.len() { 11 if result.starts_with('1') => Some(r...
Improve rust code for phone-number
Improve rust code for phone-number The Into trait help with &str and String case, map_or simplify the code
Rust
bsd-2-clause
gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism
c038da2f6b1de2780e02fd1850ab25626225ca7b
tests/service.rs
tests/service.rs
#![cfg(feature="inline-systemd")] extern crate specinfra; use specinfra::backend; #[test] fn service_resource_with_inline_provider() { let b = backend::direct::Direct::new(); let s = specinfra::new(&b).unwrap(); test_service_resource(s); } fn test_service_resource(s: specinfra::Specinfra) { let dbus ...
#![cfg(feature="inline-systemd")] extern crate specinfra; use specinfra::backend; use specinfra::Specinfra; use specinfra::provider::service::inline::null::Null; #[test] fn service_resource_with_inline_provider() { let b = backend::direct::Direct::new(); let s = specinfra::new(&b).unwrap(); test_service_r...
Add test for shell systemd provider
Add test for shell systemd provider
Rust
mit
libspecinfra/specinfra,libspecinfra/specinfra
5066ab16d191db6f076ddad15e9bfd6ed0deae33
crates/core_arch/src/mips/mod.rs
crates/core_arch/src/mips/mod.rs
//! MIPS mod msa; pub use self::msa::*; #[cfg(test)] use stdarch_test::assert_instr; /// Generates the trap instruction `BREAK` #[cfg_attr(test, assert_instr(break))] #[inline] pub unsafe fn break_() -> ! { crate::intrinsics::abort() }
//! MIPS // Building this module (even if unused) for non-fp64 targets such as the Sony // PSP fails with an LLVM error. There doesn't seem to be a good way to detect // fp64 support as it is sometimes implied by the target cpu, so // `#[cfg(target_feature = "fp64")]` will unfortunately not work. This is a // fairly c...
Fix building libcore for the Sony PSP
Fix building libcore for the Sony PSP Building the MIPS MSA module for non-fp64 targets fails with an LLVM error. This commit blacklists PSP targets from MSA support in order to fix building libcore.
Rust
apache-2.0
rust-lang/stdarch,rust-lang/stdarch,rust-lang/stdarch,rust-lang/stdarch,rust-lang/stdarch
63806cc919593a5a163458bc5427bbcffcfb45ba
compiler/rustc_expand/src/lib.rs
compiler/rustc_expand/src/lib.rs
#![feature(bool_to_option)] #![feature(crate_visibility_modifier)] #![feature(decl_macro)] #![feature(or_patterns)] #![feature(proc_macro_diagnostic)] #![feature(proc_macro_internals)] #![feature(proc_macro_span)] #![feature(try_blocks)] #[macro_use] extern crate rustc_macros; extern crate proc_macro as pm; mod plac...
#![feature(crate_visibility_modifier)] #![feature(decl_macro)] #![feature(or_patterns)] #![feature(proc_macro_diagnostic)] #![feature(proc_macro_internals)] #![feature(proc_macro_span)] #![feature(try_blocks)] #[macro_use] extern crate rustc_macros; extern crate proc_macro as pm; mod placeholders; mod proc_macro_ser...
Remove redundant bool_to_option feature gate
Remove redundant bool_to_option feature gate
Rust
apache-2.0
aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust
fac8b25a2590ffc1fca971d71ff037288af422f2
src/rust_vec.rs
src/rust_vec.rs
use crate::vector::VectorTarget; #[repr(C)] pub struct RustVec<T: VectorTarget<T>> { repr: Vec<T>, } impl<T: VectorTarget<T>> RustVec<T> { pub fn from(v: Vec<T>) -> Self { RustVec { repr: v } } pub fn from_ref(v: &Vec<T>) -> &Self { unsafe { std::mem::transmute::<&Vec<T>, &RustVec<T>>...
use crate::vector::VectorTarget; #[repr(C)] pub struct RustVec<T: VectorTarget<T>> { repr: Vec<T>, } impl<T: VectorTarget<T>> RustVec<T> { pub fn from(v: Vec<T>) -> Self { RustVec { repr: v } } pub fn from_ref(v: &Vec<T>) -> &Self { unsafe { &*(v as *const Vec<T> as *const RustVec<T>)...
Update RustVec::from_ref to match RustString::from_ref
Update RustVec::from_ref to match RustString::from_ref
Rust
apache-2.0
dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx
c65b16f42d27daab392a035e41eca80054122f2a
src/interrupts/mod.rs
src/interrupts/mod.rs
mod idt;
mod idt; lazy_static! { static ref IDT: idt::Idt = { let mut idt = idt::Idt::new(); idt.set_handler(14, page_fault_handler); idt }; } pub fn init() { IDT.load(); } extern "C" fn page_fault_handler() -> ! { println!("EXCEPTION: PAGE FAULT"); loop {} }
Create a static IDT with a page fault handler function
Create a static IDT with a page fault handler function
Rust
apache-2.0
phil-opp/blogOS,phil-opp/blog_os,phil-opp/blog_os,phil-opp/blog_os,phil-opp/blogOS,phil-opp/blog_os
e75c2927f0c636233310c5230d4bf682d50eeebe
src/controllers/site_metadata.rs
src/controllers/site_metadata.rs
use super::prelude::*; /// Returns the JSON representation of the current deployed commit sha. /// /// The sha is contained within the `HEROKU_SLUG_COMMIT` environment variable. /// If `HEROKU_SLUG_COMMIT` is not set, returns `"unknown"`. pub fn show_deployed_sha(req: &mut dyn Request) -> CargoResult<Response> { l...
use super::prelude::*; /// Returns the JSON representation of the current deployed commit sha. /// /// The sha is contained within the `HEROKU_SLUG_COMMIT` environment variable. /// If `HEROKU_SLUG_COMMIT` is not set, returns `"unknown"`. pub fn show_deployed_sha(req: &mut dyn Request) -> CargoResult<Response> { l...
Make crates.io compatible with whatsdeployed.io
Make crates.io compatible with whatsdeployed.io
Rust
apache-2.0
rust-lang/crates.io,rust-lang/crates.io,rust-lang/crates.io,rust-lang/crates.io
901faf48e2a4444d5fc54a422e92d22b751aada3
src/target/machine/avr/select.rs
src/target/machine/avr/select.rs
use {Pattern, PatternNode, PatternOperand}; use machine::avr::registers; use machine; use select; use mir; macro_rules! pattern { ($node:expr) => { Pattern { root: $node } } } macro_rules! node { ($opcode:ident, $operands:expr) => { PatternNode { opcode: mir::OpCode::$opcode, ...
use {Pattern, PatternNode, PatternOperand}; use machine::avr::registers; use machine; use select; use mir; macro_rules! pattern { ($node:expr) => { Pattern { root: $node } } } macro_rules! node { ($opcode:ident, $operands:expr) => { PatternNode { opcode: mir::OpCode::$opcode, ...
Add pattern for the AVR add with immediate instruction
Add pattern for the AVR add with immediate instruction
Rust
mit
dylanmckay/compiler
3f0c483594e8560cacdb28170e703695d8e74c49
src/test/run-pass-fulldeps/roman-numerals-macro.rs
src/test/run-pass-fulldeps/roman-numerals-macro.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
Disable the Roman numerals test on Android due to cross-compile issues
Disable the Roman numerals test on Android due to cross-compile issues
Rust
apache-2.0
mdinger/rust,andars/rust,XMPPwocky/rust,barosl/rust,AerialX/rust-rt-minimal,zubron/rust,aneeshusa/rust,victorvde/rust,miniupnp/rust,zachwick/rust,XMPPwocky/rust,zaeleus/rust,pshc/rust,krzysz00/rust,philyoon/rust,defuz/rust,quornian/rust,barosl/rust,pelmers/rust,victorvde/rust,omasanori/rust,victorvde/rust,rohitjoshi/ru...
33355071a219e525e0a388452b1f908df2bb8b35
src/engine/map.rs
src/engine/map.rs
use engine::{IntoMap, Tile}; use util::units::{Point, Size}; use std::path::AsPath; use std::fs::File; use std::io::Read; pub struct Map { pub tiles: Vec<Vec<Tile>>, pub size: Size, } impl Map { pub fn new<T>(mappish: T) -> Map where T: IntoMap { let result = mappish.as_map(); let map =...
use engine::{IntoMap, Tile}; use util::units::{Point, Size}; use std::path::AsPath; use std::fs::File; use std::io::Read; pub struct Map { pub tiles: Vec<Vec<Tile>>, pub size: Size, } impl Map { pub fn new<T>(mappish: T) -> Map where T: IntoMap { let result = mappish.as_map(); let map =...
Add height and width methods to Map
Add height and width methods to Map
Rust
bsd-3-clause
jgilchrist/rslike
fec27d67f57e9f1d8006d8cf4169ea20549a9bde
3.4-ownership/car-ref/src/main.rs
3.4-ownership/car-ref/src/main.rs
struct Car { name : String, } struct Whhel { size : i32, owner : Car, } fn main () { let car = Car {name: "DeLorean".to_string() }; for _ in range(0, 4) { Wheel { size : 360, owner : car }; } }
use std::rc::Rc; #[derive(Show)] struct Car { name : String, } #[derive(Show)] struct Wheel<'a> { size : i32, owner : &'a Car, } fn main () { let car = Rc::new(Car {name: "DeLorean".to_string() }); let mut v : Vec<Wheel> = Vec::new(); for _ in range(0, 4) { let c = Wheel { size : 36...
Fix car by ref example
Fix car by ref example &, Rc and Vec
Rust
mit
leonardinius/rust-guide
f8a0d2b22279a2e5b3b8346b9bdaceb16c763fa6
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) { let param: SV = ctx.st_fetch(0); let array: AV = param.deref_av().expect("not an array ref"); let mut sum = 0.0; for i ...
#[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 { ...
Update benchmarks to use signatures.
Update benchmarks to use signatures.
Rust
bsd-2-clause
vickenty/perl-xs,vickenty/perl-xs
02769f7c15923ec2c99b315290ee4d4a0f37641c
benches/generate.rs
benches/generate.rs
#![feature(test)] extern crate identicon; extern crate openssl; extern crate test; use openssl::crypto::hash::{hash, Type}; use test::Bencher; use identicon::Identicon; #[bench] fn generate(x: &mut Bencher) { let source = "42".to_string(); let input = source.as_bytes(); x.iter(|| { let bytes = ...
#![feature(test)] extern crate identicon; extern crate openssl; extern crate test; use openssl::hash::{hash2, MessageDigest}; use test::Bencher; use identicon::Identicon; #[bench] fn generate(x: &mut Bencher) { let input = "42".as_bytes(); let md5 = MessageDigest::md5(); x.iter(|| match hash2(md5, inpu...
Update digest usage in benchmark
Update digest usage in benchmark
Rust
mit
dgraham/identicon
63a0fc19d843d00c01d7f9bcc1fee7cb528b8861
build.rs
build.rs
extern crate gcc; fn main() { let litend = if cfg!(target_endian = "little") { "1" } else { "0" }; gcc::Config::new() .include("decNumber") .file("decNumber/decContext.c") .file("decNumber/decDouble.c") .file("decNumber/decNumber.c") .file("decNum...
extern crate gcc; fn main() { let litend = if cfg!(target_endian = "little") { "1" } else { "0" }; gcc::Config::new() .include("decNumber") .file("decNumber/decContext.c") .file("decNumber/decDouble.c") .file("decNumber/decNumber.c") .file("decNum...
Remove bad defined and useless file from c library.
Remove bad defined and useless file from c library.
Rust
apache-2.0
alkis/decimal,alkis/decimal,alkis/decimal
1249ebed803993078f4c11e5d2565477bdaeccf5
examples/window.rs
examples/window.rs
extern crate init = "gl-init-rs"; extern crate libc; extern crate gl; fn main() { use std::default::Default; let window = init::Window::new(None, "Hello world!", &Default::default(), None).unwrap(); window.make_current(); gl::load_with(|symbol| window.get_proc_address(symbol) as *const libc::c_void)...
extern crate init = "gl-init-rs"; extern crate libc; extern crate gl; fn main() { use std::default::Default; let window = init::Window::new(None, "Hello world!", &Default::default(), None).unwrap(); window.make_current(); gl::load_with(|symbol| window.get_proc_address(symbol) as *const libc::c_void)...
Remove printing position in example
Remove printing position in example
Rust
apache-2.0
kornholi/glutin,paulrouget/glutin,robertknight/glutin,TimNN/glutin,nc4rrillo/glutin,christopheraugustus/glutin,Jayflux/glutin,retep998/glutin,ecoal95/glutin,jdm/glutin,aepsil0n/glutin,fkaa/glutin,vvuk/glutin,tomaka/glutin,mbrubeck/glutin,servo/glutin,vberger/glutin,mbrubeck/glutin,ozkriff/glutin,akiss77/glutin,mitchmin...
c68fe59905a4fd428f80b880841a8d2669d2c361
rust/plugin/src/lib.rs
rust/plugin/src/lib.rs
// Copyright (c) 2014-2015 Michael J. Sullivan // Use of this source code is governed by an MIT-style license that can be // found in the LICENSE file. #![feature(plugin_registrar, rustc_private)] extern crate rustc; use rustc::plugin::Registry; extern crate rustc_llvm; use std::ffi::CString; use std::process::Comman...
// Copyright (c) 2014-2015 Michael J. Sullivan // Use of this source code is governed by an MIT-style license that can be // found in the LICENSE file. #![feature(plugin_registrar, rustc_private)] extern crate rustc; use rustc::plugin::Registry; extern crate rustc_llvm; use std::ffi::{CString,CStr}; use std::process:...
Make the rust plugin report the llvm error when it fails
Make the rust plugin report the llvm error when it fails
Rust
mit
msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler,msullivan/rmc-compiler