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 |
|---|---|---|---|---|---|---|---|---|---|
e6a8f2ce3a6ce3f46b59422f5c942a21d90bd56e | src/edge.rs | src/edge.rs | use std::collections::HashMap;
use node;
pub type Index = usize;
pub struct Edge {
pub identifier: String,
pub target: node::Index,
pub attributes: Option<HashMap<String, String>>,
pub next_outgoing_edge: Option<Index>,
}
| use std::collections::HashMap;
use node;
pub type Index = usize;
pub struct Edge {
pub identifier: String,
pub target: node::Index,
pub attributes: Option<HashMap<String, String>>,
pub next_outgoing_edge: Option<Index>,
}
impl Edge {
pub fn equal(&self, edge: Edge) -> bool {
self.identifi... | Add basic total equality matcher for Edge | Add basic total equality matcher for Edge
Fuzzy matcher to come later, which will be more useful.
| Rust | mit | charlieegan3/graph_match |
f1ef88a799c5e1940bd5d613e3a686752ad33a0b | src/main.rs | src/main.rs | #[macro_use]
extern crate error_chain;
#[macro_use]
extern crate serde_derive;
extern crate serde_yaml;
mod config;
use self::config::{Config, Error, ErrorKind};
use std::path::Path;
use std::io::{stderr, Write};
use std::env::home_dir;
fn main() {
let result = home_dir()
.ok_or(Error::from(ErrorKind::N... | #[macro_use]
extern crate error_chain;
#[macro_use]
extern crate serde_derive;
extern crate serde_yaml;
mod config;
use self::config::{Config, Error, ErrorKind};
use std::path::Path;
use std::io::stderr;
use std::io::prelude::*;
use std::env::home_dir;
fn main() {
let result = home_dir()
.ok_or(Error::f... | Use io::prelude instead of manually including io::Write | Use io::prelude instead of manually including io::Write
| Rust | mit | brennie/metabrowser |
bf880ec2280bda1b0a23f54fc251b9acc4995e1f | tests/lib.rs | tests/lib.rs | extern crate littletest;
use littletest::{Runnable, TestResult, TestRunner};
struct TestCase {
result: TestResult
}
impl TestCase {
fn new(result: TestResult) -> TestCase {
TestCase {
result: result
}
}
}
impl Runnable for TestCase {
fn run(&self) -> TestResult {
... | extern crate littletest;
use littletest::{Runnable, TestResult, TestRunner};
struct TestCase {
result: TestResult
}
impl TestCase {
fn new(result: TestResult) -> TestCase {
TestCase {
result: result
}
}
}
impl Runnable for TestCase {
fn run(&self) -> TestResult {
... | Use new clone in the integration tests. | Use new clone in the integration tests.
| Rust | mit | justinlatimer/littletest |
85cd78175683f00f00c403425e0c049aa3007d70 | tests/compile-fail/run_expr_str_ref.rs | tests/compile-fail/run_expr_str_ref.rs | extern crate gluon;
use gluon::{new_vm, Compiler};
fn main() {
let vm = new_vm();
let _ = Compiler::new().run_expr::<&str>(&vm, "", r#" "test" "#);
//~^ mismatched types [E0308]
}
| extern crate gluon;
use gluon::{new_vm, Compiler};
fn main() {
let vm = new_vm();
let _ = Compiler::new().run_expr::<&str>(&vm, "", r#" "test" "#);
//~^ the trait bound `for<'value> &str: gluon::gluon_vm::api::Getable<'_, 'value>` is not satisfied [E0277]
}
| Fix compiletest after updating nightly | Fix compiletest after updating nightly
| Rust | mit | gluon-lang/gluon,gluon-lang/gluon,Marwes/embed_lang,Marwes/embed_lang |
e780ece0b3424b00eb7e2c18bdd1093c4930b09f | src/main.rs | src/main.rs | extern crate rand;
use std::cmp::Ordering;
use rand::Rng;
fn main() {
let width: usize = 10; // FUTURE: can get this value from user
let height: usize = 10; // FUTURE: can get this value from user
let mut board: Vec<Vec<u8>> = vec![vec![0; height]; width];
populate_board_random(&mut board, 20); ... | extern crate rand;
use rand::Rng;
fn main() {
// FUTURE: can get width, height, population density, and num_generations from user:
// width and height hould be greater than 0 and less than 100
let width: usize = 20;
let height: usize = 20;
let num_generations: u8 ... | Print prettier, remove unnecessary match and Ordering dependency | Print prettier, remove unnecessary match and Ordering dependency
| Rust | bsd-3-clause | nathanbw/game-of-life |
ac10bb43e5e6d3b5dbb54299dd4810b1b94b017f | src/tmux/mod.rs | src/tmux/mod.rs | use libc::system;
use std::ffi::CString;
static TMUX_NAME: &'static str = "tmux";
static NEW_SESSION: &'static str = "new -s";
pub fn open(session_name: String) {
let system_call = CString::new(format!("{} {} {}", TMUX_NAME, NEW_SESSION, session_name)).unwrap();
unsafe { system(system_call.as_ptr()); };
}
| use libc::system;
use std::ffi::CString;
static TMUX_NAME: &'static str = "tmux";
fn call(command: String) {
let system_call = CString::new(format!("{} {}", TMUX_NAME, command)).unwrap();
unsafe { system(system_call.as_ptr()); };
}
pub fn open(session_name: String) {
let open_command = format!("new -s {}... | Send all methods through a common call interface. | Send all methods through a common call interface.
Here we could consider logging if we want. It also only requires creating a cstring in one place.
| Rust | mit | brianp/muxed,brianp/muxed |
d6f705dc9036bcb9777530aa259c83ff0e11293d | libimagutil/src/cli_validators.rs | libimagutil/src/cli_validators.rs | //! Functions to be used for clap::Arg::validator()
//! to validate arguments
use std::path::PathBuf;
use boolinator::Boolinator;
pub fn is_file(s: String) -> Result<(), String> {
PathBuf::from(s.clone()).is_file().as_result((), format!("Not a File: {}", s))
}
pub fn is_directory(s: String) -> Result<(), String>... | //! Functions to be used for clap::Arg::validator()
//! to validate arguments
use std::path::PathBuf;
use boolinator::Boolinator;
pub fn is_file(s: String) -> Result<(), String> {
PathBuf::from(s.clone()).is_file().as_result((), format!("Not a File: {}", s))
}
pub fn is_directory(s: String) -> Result<(), String>... | Add is_tag clap validator helper | Add is_tag clap validator helper
| Rust | lgpl-2.1 | matthiasbeyer/imag,matthiasbeyer/imag,mario-kr/imag,mario-kr/imag |
5a9ff052b4879e4ef6748c2f85563a7db0548c0b | src/libcore/benches/lib.rs | src/libcore/benches/lib.rs | #![feature(flt2dec)]
#![feature(test)]
extern crate test;
mod any;
mod ascii;
mod char;
mod fmt;
mod hash;
mod iter;
mod num;
mod ops;
mod pattern;
mod slice;
| // wasm32 does not support benches (no time).
#![cfg(not(target_arch = "wasm32"))]
#![feature(flt2dec)]
#![feature(test)]
extern crate test;
mod any;
mod ascii;
mod char;
mod fmt;
mod hash;
mod iter;
mod num;
mod ops;
mod pattern;
mod slice;
| Disable core benches on wasm (benches not supported). | Disable core benches on wasm (benches not supported).
| Rust | apache-2.0 | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust |
ee91fd8f6d92e09bb1463e0f62fa59be84940fc9 | example/src/main.rs | example/src/main.rs | extern crate futures;
extern crate tokio_inotify;
extern crate tokio_core;
use std::path::Path;
use std::env;
use futures::stream::Stream;
use tokio_inotify::AsyncINotify;
use tokio_core::reactor::Core;
fn home_dir() -> String {
env::var("HOME").unwrap_or_else(|_| {
env::var("USER")
.map(|u| ... | extern crate futures;
extern crate tokio_core;
extern crate tokio_inotify;
use std::path::Path;
use std::env;
use futures::stream::Stream;
use futures::prelude::*;
use tokio_inotify::AsyncINotify;
use tokio_core::reactor::Core;
fn home_dir() -> String {
env::var("HOME").unwrap_or_else(|_| {
env::var("USE... | Make example a bit more interesting. | Make example a bit more interesting.
| Rust | mit | dermesser/tokio-inotify |
0432f63acf5b08c23ad206a87e3ad4a2a171cf7f | src/test/ui/tuple/nested-index.rs | src/test/ui/tuple/nested-index.rs | // run-pass
fn main () {
let n = (1, (2, 3)).1.1;
assert_eq!(n, 3);
}
| // run-pass
fn main () {
let n = (1, (2, 3)).1.1;
assert_eq!(n, 3);
let n = (1, (2, (3, 4))).1.1.1;
assert_eq!(n, 4);
}
| Test even deeper nested indexing | Test even deeper nested indexing
| Rust | apache-2.0 | graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust |
0a3452110c605655e7ab949c0904f053ab0cc71b | src/test/rustdoc/smart-punct.rs | src/test/rustdoc/smart-punct.rs | // ignore-tidy-linelength
#![crate_name = "foo"]
//! This is the "start" of the 'document'! How'd you know that "it's" the start?
//!
//! # Header with "smart punct'"
//!
//! [link with "smart punct'" -- yessiree!][]
//!
//! [link with "smart punct'" -- yessiree!]: https://www.rust-lang.org
//!
//! # Code should not ... | // ignore-tidy-linelength
#![crate_name = "foo"]
//! This is the "start" of the 'document'! How'd you know that "it's" the start?
//!
//! # Header with "smart punct'"
//!
//! [link with "smart punct'" -- yessiree!][]
//!
//! [link with "smart punct'" -- yessiree!]: https://www.rust-lang.org
//!
//! # Code should not ... | Fix `@has` checks "no closing quotation" error | Fix `@has` checks "no closing quotation" error
Apparently `"foo\""` has different behavior from `'foo\''` in Python
shlex. See the [discussion on Zulip][z] for more.
[z]: https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.40has.20checks.20.22no.20closing.20quotation.22
| Rust | apache-2.0 | graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust |
299f5b58f0a7f18919150fa63d01fdab448ab8d8 | fitsio/benches/benchmarks.rs | fitsio/benches/benchmarks.rs | #[macro_use]
extern crate criterion;
use criterion::Criterion;
fn fib(n: u64) -> u64 {
let mut a = 0u64;
let mut b = 1u64;
let mut c = 0u64;
if n == 0 {
return 0
}
for _ in 0..(n+1) {
c = a + b;
a = b;
b = c;
}
b
}
fn criterion_benchmark(c: &mut Crit... | #[macro_use]
extern crate criterion;
extern crate fitsio;
use criterion::Criterion;
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("opening and closing files", |b| b.iter(|| {
let filename = "../testdata/full_example.fits";
{
let f = fitsio::FitsFile::open(filename).unwra... | Swap dummy fib benchmark for opening/closing files | Swap dummy fib benchmark for opening/closing files
| Rust | apache-2.0 | mindriot101/rust-fitsio,mindriot101/rust-fitsio,mindriot101/rust-fitsio,mindriot101/rust-cfitsio,mindriot101/rust-fitsio,mindriot101/rust-cfitsio,mindriot101/rust-fitsio |
811d88024fab449d00682fd6fd0179c153f94fa0 | src/test/run-pass/cfgs-on-items.rs | src/test/run-pass/cfgs-on-items.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 ... | Mark cfg test xfail-fast since check-fast doesn't understand compile-flags. | Mark cfg test xfail-fast since check-fast doesn't understand compile-flags.
| Rust | apache-2.0 | sarojaba/rust-doc-korean,P1start/rust,mihneadb/rust,quornian/rust,kmcallister/rust,AerialX/rust,kwantam/rust,mihneadb/rust,mitsuhiko/rust,jbclements/rust,zachwick/rust,philyoon/rust,LeoTestard/rust,LeoTestard/rust,aidancully/rust,miniupnp/rust,kmcallister/rust,servo/rust,fabricedesre/rust,servo/rust,aidancully/rust,quo... |
4c8a5b51046c0f58f5a4c805794735bcd778eb8d | testing/tests/loops.rs | testing/tests/loops.rs | #[macro_use]
extern crate askama;
use askama::Template;
#[derive(Template)]
#[template(path = "for.html")]
struct ForTemplate<'a> {
strings: Vec<&'a str>,
}
#[test]
fn test_for() {
let s = ForTemplate {
strings: vec!["A", "alfa", "1"],
};
assert_eq!(s.render(), "0. A\n1. alfa\n2. 1\n");
}
#... | #[macro_use]
extern crate askama;
use askama::Template;
#[derive(Template)]
#[template(path = "for.html")]
struct ForTemplate<'a> {
strings: Vec<&'a str>,
}
#[test]
fn test_for() {
let s = ForTemplate {
strings: vec!["A", "alfa", "1"],
};
assert_eq!(s.render(), "0. A\n1. alfa\n2. 1\n");
}
#... | Remove debugging cruft from test_nested_for | Remove debugging cruft from test_nested_for
| Rust | apache-2.0 | djc/askama,djc/askama,djc/askama |
f6431acb1a1a6d652a1625efba40633f99d56ab9 | src/strip_comments_from_a_string.rs | src/strip_comments_from_a_string.rs | // http://rosettacode.org/wiki/Strip_comments_from_a_string
fn strip_comments(str: &str) -> &str {
let markers = ['#', ';'];
str.find(markers.as_slice()).map_or(str, |i| str.slice_to(i)).trim_right()
}
#[test]
fn test_strip_comments() {
let inputs = ["apples, pears # and bananas",
"apple... | // http://rosettacode.org/wiki/Strip_comments_from_a_string
fn strip_comments(str: &str) -> &str {
let markers = ['#', ';'];
str.find(markers.as_slice()).map_or(str, |i| str.slice_to(i)).trim()
}
#[test]
fn test_strip_comments() {
let inputs = ["apples, pears # and bananas",
"apples, pea... | Trim the string from both sides, not just the right side. | Trim the string from both sides, not just the right side.
| Rust | unlicense | magum/rust-rosetta,crespyl/rust-rosetta,crr0004/rust-rosetta,pfalabella/rust-rosetta,JIghtuse/rust-rosetta,ZoomRmc/rust-rosetta,Hoverbear/rust-rosetta,ghotiphud/rust-rosetta,sakeven/rust-rosetta,magum/rust-rosetta |
bb4c538db3c6809eaac3ede6680fb380d57503c9 | _includes/example.rs | _includes/example.rs | #![feature(core)]
// This code is editable and runnable!
fn main() {
// A simple integer calculator:
// `+` or `-` means add or subtract by 1
// `*` or `/` means multiply or divide by 2
let program = "+ + * - /";
let mut accumulator = 0;
for token in program.chars() {
match token {
... | // This code is editable and runnable!
fn main() {
// A simple integer calculator:
// `+` or `-` means add or subtract by 1
// `*` or `/` means multiply or divide by 2
let program = "+ + * - /";
let mut accumulator = 0;
for token in program.chars() {
match token {
'+' => ac... | Fix warning about unknown or unused feature | Fix warning about unknown or unused feature | Rust | apache-2.0 | jFransham/rust-www,ituxbag/rust-www,ituxbag/rust-www,azerupi/rust-www,ituxbag/rust-www,starsep/rust-www,starsep/rust-www,azerupi/rust-www,starsep/rust-www,AndrewBrinker/rust-www,AndrewBrinker/rust-www,AndrewBrinker/rust-www,jFransham/rust-www,starsep/rust-www,AndrewBrinker/rust-www,starsep/rust-www,jFransham/rust-www,A... |
c5d1f742d8af01285033f3e12cad87d9d27a5572 | imap-proto/src/parser/rfc5161.rs | imap-proto/src/parser/rfc5161.rs | //!
//! https://tools.ietf.org/html/rfc5161
//!
//! The IMAP ENABLE Extension
//!
// rustfmt doesn't do a very good job on nom parser invocations.
#![cfg_attr(rustfmt, rustfmt_skip)]
use crate::types::*;
use crate::parser::core::atom;
// The ENABLED response lists capabilities that were enabled in response
// to a E... | //!
//! https://tools.ietf.org/html/rfc5161
//!
//! The IMAP ENABLE Extension
//!
use nom::{
bytes::streaming::tag_no_case,
character::streaming::char,
combinator::map,
multi::many0,
sequence::{preceded, tuple},
IResult,
};
use crate::parser::core::atom;
use crate::types::*;
// The ENABLED re... | Rewrite RFC 5161 parser with function parsers | Rewrite RFC 5161 parser with function parsers
| Rust | apache-2.0 | djc/tokio-imap |
621f077e5ed4f85d7a6ccc3c9300a396462357d4 | src/binary/readln.rs | src/binary/readln.rs | use super::{completer::IonCompleter, InteractiveBinary};
use std::io::ErrorKind;
pub fn readln(binary: &InteractiveBinary) -> Option<String> {
let shell = binary.shell.borrow();
let mut completer = IonCompleter::new(&shell);
let prompt = binary.prompt();
let line = binary.context.borrow_mut().read_line... | use super::{completer::IonCompleter, InteractiveBinary};
use std::io::ErrorKind;
pub fn readln(binary: &InteractiveBinary) -> Option<String> {
let prompt = binary.prompt();
let line = binary.context.borrow_mut().read_line(
prompt,
None,
&mut IonCompleter::new(&binary.shell.borrow()),
... | Fix the panic on start | Fix the panic on start
| Rust | mit | redox-os/ion,redox-os/ion,redox-os/ion |
c9972c4b163367fa02e74e20854683e14fb336d7 | src/lib.rs | src/lib.rs | // 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... | // 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... | Switch to using feature attributes | Switch to using feature attributes
| Rust | apache-2.0 | rust-lang/rustc-serialize,SimonSapin/rustc-serialize,shepmaster/rustc-serialize,DenisKolodin/rustc-serialize,indefini/rustc-serialize,rust-lang-deprecated/rustc-serialize,ajroetker/rustc-serialize,gbersac/rustc-serialize,rust-lang-nursery/rustc-serialize |
06e80ca06d807d445b424513406d10de45def280 | src/lib.rs | src/lib.rs | // Copyright 2014 Dmitry "Divius" Tantsur <divius.inside@gmail.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, ... | // Copyright 2014 Dmitry "Divius" Tantsur <divius.inside@gmail.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, ... | Hide implementation modules from the crate | Hide implementation modules from the crate
| Rust | apache-2.0 | divius/rust-dht,cheme/rust-dht,cheme/rust-dht,divius/rust-dht |
c2e24c2d31bb033f5dab3bfd2b48fef067c2e398 | src/lib.rs | src/lib.rs | //! An implementation of [FLAC](https://xiph.org/flac), free lossless audio
//! codec, written in Rust.
#[macro_use]
extern crate nom;
#[macro_use]
mod utility;
pub mod metadata;
pub mod frame;
pub mod subframe;
pub mod stream;
pub use metadata::{metadata_parser, Metadata};
pub use frame::{frame_parser, Frame};
pub ... | //! 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... | Add top level code sample for FLAC decoding | Add top level code sample for FLAC decoding
| Rust | bsd-3-clause | sourrust/flac |
4c0623e8e41bc7e8a37333a93a648c005945c1db | src/lib.rs | src/lib.rs | extern crate num;
extern crate oxcable;
pub mod adsr;
pub mod delay;
pub mod dynamics;
pub mod reverb;
pub mod tremolo;
| //! Basic audio filters for making music with Rust.
//!
//! This is an extension to the
//! [`oxcable` framework](https://github.com/oxcable/oxcable). These devices are
//! designed to be used with the basic tools provided in the framework. See the
//! core crate for further details.
extern crate num;
extern crate oxc... | Write top level module docs. | Write top level module docs.
| Rust | apache-2.0 | oxcable/basic-devices,oxcable/basic-devices |
3b5a8c8efb165b1a657f6d11025ec5cf787b9956 | src/commands/react_native_gradle.rs | src/commands/react_native_gradle.rs | use clap::{App, ArgMatches};
use prelude::*;
use config::Config;
use utils::ArgExt;
pub fn make_app<'a, 'b: 'a>(app: App<'a, 'b>) -> App<'a, 'b> {
app.about("uploads react-native projects from within a gradle build step")
.org_project_args()
}
pub fn execute<'a>(matches: &ArgMatches<'a>, config: &Config... | use clap::{App, ArgMatches, AppSettings};
use prelude::*;
use config::Config;
use utils::ArgExt;
pub fn make_app<'a, 'b: 'a>(app: App<'a, 'b>) -> App<'a, 'b> {
app.about("uploads react-native projects from within a gradle build step")
.setting(AppSettings::Hidden)
.org_project_args()
}
pub fn ex... | Disable gradle command for now | Disable gradle command for now
| Rust | bsd-3-clause | getsentry/sentry-cli,getsentry/sentry-cli,getsentry/sentry-cli |
e25a304e2240a7ba5df57cecbafdb4a6836d7943 | examples/hello.rs | examples/hello.rs | // Copyright 2020 Google LLC
//
// Use of this source code is governed by an MIT-style license that can be found
// in the LICENSE file or at https://opensource.org/licenses/MIT.
use fleetspeak::client::Packet;
fn main() -> std::io::Result<()> {
fleetspeak::client::startup("0.0.1")?;
loop {
let reque... | // Copyright 2020 Google LLC
//
// Use of this source code is governed by an MIT-style license that can be found
// in the LICENSE file or at https://opensource.org/licenses/MIT.
use std::time::Duration;
use fleetspeak::client::Packet;
fn main() -> std::io::Result<()> {
fleetspeak::client::startup("0.0.1")?;
... | Update the example to use the collection function. | Update the example to use the collection function.
| Rust | mit | google/fleetspeak-rs |
ee9747cb0f5e600e9013755ded962560528e6e38 | tests/test_expr.rs | tests/test_expr.rs | #[macro_use]
mod macros;
use std::str::FromStr;
use proc_macro2::TokenStream;
use syn::{Expr, ExprRange};
#[test]
fn test_expr_parse() {
let code = "..100u32";
let tt = TokenStream::from_str(code).unwrap();
let expr: Expr = syn::parse2(tt.clone()).unwrap();
let expr_range: ExprRange = syn::parse2(tt)... | #[macro_use]
mod macros;
use std::str::FromStr;
use proc_macro2::{Delimiter, Group, TokenStream, TokenTree};
use quote::quote;
use std::iter::FromIterator;
use syn::{Expr, ExprRange};
#[test]
fn test_expr_parse() {
let code = "..100u32";
let tt = TokenStream::from_str(code).unwrap();
let expr: Expr = syn... | Add test for fn call with interpolated fn name | Add test for fn call with interpolated fn name
| Rust | apache-2.0 | dtolnay/syn |
a2fcaf1a526f1b0dd8c00adf60767506df746da4 | collector/benchmarks/script-servo/components/dom_struct/lib.rs | collector/benchmarks/script-servo/components/dom_struct/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/. */
#![feature(proc_macro)]
extern crate proc_macro;
use proc_macro::{TokenStream, quote};
use std::iter;
#[proc_ma... | /* 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/. */
#![feature(proc_macro, proc_macro_non_items)]
extern crate proc_macro;
use proc_macro::{TokenStream, quote};
use... | Update script benchmark for unstable feature change | Update script benchmark for unstable feature change
Hopefully fixes #218 (untested) | Rust | mit | nrc/rustc-perf,nrc/rustc-perf,nrc/rustc-perf |
4aa3ac88645904d15a01d4b4c5f7eb9fa202367f | build.rs | build.rs | #[cfg(feature = "inline_asm")]
fn main() {}
#[cfg(all(not(feature = "inline_asm"), not(feature = "stable")))]
fn check_inline_asm() {
compile_error!("Neither feature \"stable\" nor \"inline_asm\" was set!");
}
#[cfg(all(not(feature = "inline_asm"), feature = "stable"))]
fn main() {
use std::ffi::OsString;
... | #[cfg(feature = "inline_asm")]
fn main() {}
#[cfg(all(not(feature = "inline_asm"), not(feature = "stable")))]
fn main() {
compile_error!("Neither feature \"stable\" nor \"inline_asm\" was set!");
}
#[cfg(all(not(feature = "inline_asm"), feature = "stable"))]
fn main() {
use std::ffi::OsString;
use std::fs... | Improve error message with `--no-default-features` | Improve error message with `--no-default-features`
By naming the function main, only the `compile_check` error occurs (and not a second '`main` function not found' error).
| Rust | mit | phil-opp/rust-x86_64 |
dc304d436802e0a2685daeb33827ac0959da6fbe | src/hal/pin.rs | src/hal/pin.rs | // Zinc, the bare metal stack for rust.
// Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com>
//
// 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.o... | // Zinc, the bare metal stack for rust.
// Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com>
//
// 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.o... | Document each variant of GPIOLevel and GPIODirection | Document each variant of GPIOLevel and GPIODirection
| Rust | apache-2.0 | posborne/zinc,posborne/zinc,aethaniel/zinc,hackndev/zinc,ryankurte/zinc,tempbottle/zinc,hackndev/zinc,ryankurte/zinc,dirvine/zinc,flxo/zinc,dirvine/zinc,ntwyman/zinc,richo/zinc,0xc0170/zinc,aethaniel/zinc,phil-opp/zinc,troplin/zinc,mcoffin/zinc,troplin/zinc,gapry/zinc,richo/zinc,hackndev/zinc,phil-opp/zinc,posborne/zin... |
0dc131d7f138747b99b8a3f0185f343b1647533a | src/ppm/mod.rs | src/ppm/mod.rs | //! Encoding of portable pixmap Images
pub use self::encoder::PPMEncoder as PPMEncoder;
pub use self::decoder::PPMDecoder as PPMDecoder;
mod encoder;
mod decoder;
| //! Encoding of portable pixmap Images
pub use self::encoder::PPMEncoder as PPMEncoder;
pub use self::decoder::PPMDecoder as PPMDecoder;
mod encoder;
mod decoder;
#[cfg(test)]
mod test {
use color::ColorType;
use image::{ImageDecoder, DecodingResult};
#[test]
fn test_roundtrip_ppm() {
// 3x3... | Add a roundtrip test to PPM | Add a roundtrip test to PPM
| Rust | mit | PistonDevelopers/image,mbrubeck/image,nwin/rust-image,PistonDevelopers/image |
53aa5a1113619dda8e1e1b5ebda920ef1adb2395 | src/libstd/sys/sgx/stack_overflow.rs | src/libstd/sys/sgx/stack_overflow.rs | pub struct Handler;
impl Handler {
pub unsafe fn new() -> Handler {
Handler
}
}
#[cfg_attr(test, allow(dead_code))]
pub unsafe fn init() {}
pub unsafe fn cleanup() {}
| #[cfg_attr(test, allow(dead_code))]
pub unsafe fn init() {}
pub unsafe fn cleanup() {}
| Remove unnecessary stack overflow handler stub for sgx. | Remove unnecessary stack overflow handler stub for sgx.
| Rust | apache-2.0 | aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust |
c8bf5ed628c5007bd7c88a2265698d3117cbdc72 | library/core/tests/num/const_from.rs | library/core/tests/num/const_from.rs | #[test]
fn from() {
use core::convert::TryFrom;
use core::num::TryFromIntError;
// From
const FROM: i64 = i64::from(1i32);
assert_eq!(FROM, 1i64);
// Upper bounded
const U8_FROM_U16: Result<u8, TryFromIntError> = u8::try_from(1u16);
assert_eq!(U8_FROM_U16, Ok(1u8));
// Both bounde... | #[test]
fn from() {
use core::convert::TryFrom;
use core::num::TryFromIntError;
// From
const FROM: i64 = i64::from(1i32);
assert_eq!(FROM, 1i64);
// From int to float
const FROM_F64: f64 = f64::from(42u8);
assert_eq!(FROM_F64, 42f64);
// Upper bounded
const U8_FROM_U16: Resul... | Add test for int to float | Add test for int to float
| Rust | apache-2.0 | graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust |
9322a38534c9ad4e6c6a048580ffd68e842d1077 | src/test/compile-fail/issue-37131.rs | src/test/compile-fail/issue-37131.rs | // 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... | // 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... | Use ARM instead of SystemZ for testing not installed targets | Use ARM instead of SystemZ for testing not installed targets
| Rust | apache-2.0 | aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust |
68d5cd65d4d42a625278becf06af0e012cd57303 | src/set1/challenge5.rs | src/set1/challenge5.rs | use std::iter::FromIterator;
use std::iter::repeat;
use set1::challenge2::fixed_xor;
use set1::utils::bytes_to_hex;
fn repeating_xor(text: &[u8], key: &[u8]) -> String {
bytes_to_hex(&fixed_xor(text,
&(repeat(key)
.take(text.len() / 3 + 1)
... | use std::iter::repeat;
use set1::challenge2::fixed_xor;
use set1::utils::bytes_to_hex;
fn repeating_xor(text: &[u8], key: &[u8]) -> String {
bytes_to_hex(&fixed_xor(text,
&(repeat(key)
.take(text.len() / 3 + 1)
.flat_map(|... | Remove unneeded import in challenge 5 | set1: Remove unneeded import in challenge 5
| Rust | mit | rkuska/cryptopals-rs |
08c84d3e92636445f8ddc6f507d0d3020935ecf2 | src/lib.rs | src/lib.rs | pub extern crate fiz_math as math;
mod test{
#[allow(unused_imports)]
use super::math;
#[test]
fn crate_names() {
assert!(math::equal(1.0, 1.0));
}
}
| pub extern crate fiz_math as math;
mod test{
#[allow(unused_imports)]
use super::math::Float;
#[test]
fn crate_names() {
assert!(1.0.equal(1.0));
}
}
| Update to most recent math API changes. | Update to most recent math API changes.
| Rust | bsd-3-clause | fiz3d/fiz |
fcb0113e5619b38314957a378a80f8e144609ac2 | src/main.rs | src/main.rs | use std::env;
mod command;
use command::*;
fn main() {
let args = env::args().skip(1).collect::<Vec<String>>();
if args.is_empty() {
print_usage();
return
}
match args[0].as_ref() {
"help" => print_usage(),
"init" => initialize(),
"set" => set_param... | use std::env;
mod command;
use command::*;
fn main() {
let args = env::args().skip(1).collect::<Vec<String>>();
if args.is_empty() {
print_usage();
return
}
match args[0].as_ref() {
"help" => print_usage(),
"init" => initialize(),
"set" => set_param... | Order commands in help message | Order commands in help message
| Rust | mit | ttokutake/kic,ttokutake/kic,ttokutake/kic |
27b2a5bba4498027deb09497a51101d864a87ef1 | src/main.rs | src/main.rs | fn main() {
println!("Hello World!");
} | use std::env;
use std::fs;
use std::io::Read;
use std::path::Path;
fn main() {
if let Some(rom_file_name) = env::args().nth(1) {
println!("ROM: {}", rom_file_name);
if let Some(rom) = read_rom(rom_file_name) {
println!("{:?}", rom);
return;
} else {
print... | Read ROM file using cli | Read ROM file using cli
| Rust | mit | LokiFaun/chip8-rs |
88e01933c905afd65c263b97d6107e2e0629e3a6 | src/main.rs | src/main.rs | 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... | 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 some simple wrapper code | Add some simple wrapper code
| Rust | mit | graememcc/netStack,graememcc/netStack |
e2fc2b1057ea3c5aa05b04a505212771c70b4978 | src/main.rs | src/main.rs | struct Philosopher {
name: String
}
impl Philosopher {
fn new(name: &str) -> Philosopher {
Philosopher {
name: name.to_string()
}
}
}
fn main() {
}
| struct Philosopher {
name: String
}
impl Philosopher {
fn new(name: &str) -> Philosopher {
Philosopher {
name: name.to_string()
}
}
}
fn main() {
let p1 = Philosopher::new("Judith Butler");
let p2 = Philosopher::new("Gilles Deleuze");
let p3 = Philosopher::new("Karl... | Create 5 variable bindings with 5 philosophers | Create 5 variable bindings with 5 philosophers
| Rust | mit | juliangrosshauser/dining_philosophers |
984182f73d7e7caa6989ce5be9bfa75fe166c432 | src/main.rs | src/main.rs | #[macro_use]
extern crate error_chain;
extern crate reqwest;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json as json;
extern crate toml;
extern crate url;
mod config;
mod crates_io;
mod errors;
mod github;
mod lockfile;
use std::env;
use crates_io::Repository;
use errors::*;
quic... | #[macro_use]
extern crate error_chain;
extern crate reqwest;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json as json;
extern crate toml;
extern crate url;
mod config;
mod crates_io;
mod errors;
mod github;
mod lockfile;
use std::env;
use crates_io::Repository;
use errors::*;
quic... | Remove the file existence check | Remove the file existence check
| Rust | mit | woxtu/cargo-thank-you-stars |
e3e92d74fb62204436f9d02b2c41619393debf0d | src/ucontext.rs | src/ucontext.rs | use libc;
use {Errno, Result};
use std::mem;
#[derive(Clone, Copy)]
pub struct UContext {
context: libc::ucontext_t,
}
impl UContext {
pub fn get() -> Result<UContext> {
let mut context: libc::ucontext_t = unsafe { mem::uninitialized() };
let res = unsafe {
libc::getcontext(&mut co... | use libc;
#[cfg(not(target_env = "musl"))]
use {Errno, Result};
#[cfg(not(target_env = "musl"))]
use std::mem;
#[derive(Clone, Copy)]
pub struct UContext {
context: libc::ucontext_t,
}
impl UContext {
#[cfg(not(target_env = "musl"))]
pub fn get() -> Result<UContext> {
let mut context: libc::uconte... | Exclude UContext::get(),set() on musl, not available from libc. | Exclude UContext::get(),set() on musl, not available from libc.
| Rust | mit | xd009642/nix,nikklassen/nix-rust,geofft/nix-rust,carllerche/nix-rust,nikklassen/nix-rust,xd009642/nix,geofft/nix-rust,MarkusJais/nix-rust,Susurrus/nix,nix-rust/nix,kamalmarhubi/nix-rust,nix-rust/nix,kamalmarhubi/nix-rust,MarkusJais/nix-rust,berkowski/nix,xd009642/nix,carllerche/nix-rust,Susurrus/nix,berkowski/nix,posbo... |
e5fb4ef7e74b9d47d472468eea9d28e8a8f6a718 | build.rs | build.rs | use std::old_io::Command;
use std::env;
fn main() {
let curr_dir = Path::new(env::var("CARGO_MANIFEST_DIR").unwrap().into_string().unwrap());
Command::new("git").arg("submodule").arg("update").arg("--init").cwd(&curr_dir).status().unwrap();
let nvim_dir = curr_dir.join("neovim");
Command::new("make").... | use std::old_io::Command;
use std::env;
fn main() {
let curr_dir = Path::new(env::var("CARGO_MANIFEST_DIR").unwrap());
Command::new("git").arg("submodule").arg("update").arg("--init").cwd(&curr_dir).status().unwrap();
let nvim_dir = curr_dir.join("neovim");
Command::new("make").arg("deps").cwd(&nvim_d... | Update for latest version of Rust | Update for latest version of Rust
| Rust | unlicense | oakes/neovim-rs |
dd1fb78af39510d2b6e69c2b449bee9b7c1da7d8 | src/lib.rs | src/lib.rs | #![feature(plugin)]
#![plugin(json_macros)]
extern crate time;
extern crate rand;
extern crate url;
extern crate sxd_document;
extern crate sxd_xpath;
extern crate rustc_serialize;
extern crate byteorder;
extern crate hyper;
extern crate openssl;
extern crate redis;
extern crate multipart;
#[macro_use]
extern crate lo... | #![feature(plugin)]
#![plugin(json_macros)]
extern crate time;
extern crate rand;
extern crate url;
extern crate sxd_document;
extern crate sxd_xpath;
extern crate rustc_serialize;
extern crate byteorder;
extern crate hyper;
extern crate openssl;
extern crate redis;
extern crate multipart;
#[macro_use]
extern crate lo... | Make parse_message, MessageParser, ReplyRenderer private. | Make parse_message, MessageParser, ReplyRenderer private.
| Rust | mit | messense/wechat-rs |
c86c09b19a7db3749c2c43a9fa964aa45ac13af1 | tests/cargo/mod.rs | tests/cargo/mod.rs | use cargo_metadata::MetadataCommand;
use lazy_static::lazy_static;
use std::env;
use std::path::PathBuf;
lazy_static! {
pub static ref CARGO_TARGET_DIR: PathBuf = {
match env::var_os("CARGO_TARGET_DIR") {
Some(v) => v.into(),
None => MetadataCommand::new().exec().unwrap().target_dir... | use lazy_static::lazy_static;
use std::env;
use std::path::PathBuf;
lazy_static! {
pub static ref CARGO_TARGET_DIR: PathBuf = {
match env::var_os("CARGO_TARGET_DIR") {
Some(v) => v.into(),
None => env::current_dir().unwrap().join("target"),
}
};
pub static ref TARGET... | Use current_dir instead of cargo_metadata | Use current_dir instead of cargo_metadata
Co-Authored-By: lzutao <85091462e78fd40a2da260069fd10aa5bbcf7c19@gmail.com> | Rust | apache-2.0 | aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust |
71251431ace48aac6c59fc003cd47e7e302e5736 | src/js_types/js_type.rs | src/js_types/js_type.rs | use std::cmp::Ordering;
pub struct JsType {
uid: u64,
thing: Box<JsThing>,
}
impl PartialEq for JsType {
fn eq(&self, other: &Self) -> bool {
self.uid == other.uid
}
fn ne(&self, other: &Self) -> bool {
!self.eq(other)
}
}
impl Eq for JsType{}
impl PartialOrd for JsType {
... | use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use uuid::Uuid;
pub struct JsType {
uid: Uuid,
thing: Box<JsThing>,
}
impl JsType {
fn new(thing: Box<JsThing>) -> JsType {
JsType {
uid: Uuid::new_v4(),
thing: thing,
}
}
}
impl PartialEq for JsType {
... | Make JsType Hash instead of Ord | Make JsType Hash instead of Ord
| Rust | mit | rustoscript/french-press |
0fc10cf29f63278b4a64709156726d9ad6e75368 | examples/mutex_map.rs | examples/mutex_map.rs | //! This example shows how to wrap a data structure in a mutex to achieve safe mutability.
#[macro_use(lazy_static)]
extern crate lazy_static;
use std::collections::HashMap;
use std::sync::Mutex;
lazy_static! {
static ref MUTEX_MAP: Mutex<HashMap<u32, &'static str>> = {
let mut m = HashMap::new();
... | //! This example shows how to wrap a data structure in a mutex to achieve safe mutability.
extern crate lazy_static;
use lazy_static::lazy_static;
use std::collections::HashMap;
use std::sync::Mutex;
lazy_static! {
static ref MUTEX_MAP: Mutex<HashMap<u32, &'static str>> = {
let mut m = HashMap::new();
... | Revert "macro_use instead of use" | Revert "macro_use instead of use"
This reverts commit 3ba90796169143e83efdd1a11bde779cbdeca29d.
| Rust | apache-2.0 | rust-lang-nursery/lazy-static.rs |
9233068da58cb6f3e833792aa75ccfdcfa851d4d | src/io/operations/reader.rs | src/io/operations/reader.rs | //! Netherrack-specific reading I/O operations
use io_operations::reader::Reader;
extern crate varint;
extern crate bit_utils;
use self::bit_utils::BitInformation;
pub trait NetherrackReader : Reader {
/// Reads an unsigned 32-bit Varint from this NetherrackReader
fn read_unsigned_varint_32(&mut self) -> R... | //! Netherrack-specific reading I/O operations
use io_operations::reader::Reader;
extern crate varint;
extern crate bit_utils;
use self::bit_utils::BitInformation;
pub trait NetherrackReader : Reader {
/// Reads an unsigned 32-bit Varint from this NetherrackReader
fn read_unsigned_varint_32(&mut self) -> R... | Use matching while reading an unsigned byte instead of an if/else | Use matching while reading an unsigned byte instead of an if/else
| Rust | apache-2.0 | Techern/Netherrack |
942b3ac9e70f7b40b14538973197b8c1f839b77b | src/reference_collection.rs | src/reference_collection.rs | use reference::Reference;
pub struct ReferenceCollection {
pub head: Option<Reference>,
pub local_references: Vec<Reference>,
pub remote_references: Vec<Reference>,
}
impl ReferenceCollection {
fn references(&self) -> Vec<Reference> {
let mut list = self.local_references.clone();
list.... | use reference::Reference;
#[deriving(PartialEq, Show, Clone)]
pub struct ReferenceCollection {
pub head: Option<Reference>,
pub local_references: Vec<Reference>,
pub remote_references: Vec<Reference>,
}
impl ReferenceCollection {
fn references(&self) -> Vec<Reference> {
let mut list = self.loc... | Make ReferenceCollection showable, comparable and cloneable | Make ReferenceCollection showable, comparable and cloneable
| Rust | mit | kaisellgren/rust_git |
ad64091c9d44be8a8e3f60c070a0870bbe8021c7 | src/plist.rs | src/plist.rs | use ffi::h5i::hid_t;
use ffi::h5p::H5Pclose;
use object::{Handle, Object};
#[derive(Clone)]
pub struct PropertyList {
handle: Handle,
}
impl Object for PropertyList {
fn id(&self) -> hid_t {
self.handle.id()
}
fn from_id(id: hid_t) -> PropertyList {
PropertyList { handle: Handle::new... | use ffi::h5i::hid_t;
use object::{Handle, Object};
#[derive(Clone)]
pub struct PropertyList {
handle: Handle,
}
impl Object for PropertyList {
fn id(&self) -> hid_t {
self.handle.id()
}
fn from_id(id: hid_t) -> PropertyList {
PropertyList { handle: Handle::new(id) }
}
}
| Remove Drop impl for PropertyList | Remove Drop impl for PropertyList
| Rust | apache-2.0 | kkirstein/hdf5-rs |
8e248bb47431113616c61bc09b91f10d8ce1e72f | src/preflight.rs | src/preflight.rs | use config::Config;
pub fn check(config: &Config) -> Vec<String> {
let mut warnings = vec!();
if config.gh_token.is_none() {
warnings.push("The GH_TOKEN environment variable is not configured".into());
}
if let Err(ref err) = config.remote {
warnings.push(format!("Could not determine ... | use config::Config;
pub fn check(config: &Config) -> Vec<String> {
let mut warnings = vec!();
if config.gh_token.is_none() {
warnings.push("The GH_TOKEN environment variable is not configured".into());
}
if config.cargo_token.is_none() {
warnings.push("The CARGO_TOKEN environment vari... | Check if CARGO_TOKEN is defined or not | feat: Check if CARGO_TOKEN is defined or not
| Rust | mit | semantic-rs/semantic-rs,semantic-rs/semantic-rs |
649b20eca9a5d2860eb46f6b9e1d99753d4515b7 | src/test/run-pass/issues/issue-45731.rs | src/test/run-pass/issues/issue-45731.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | Allow `unused_variables` lint to placate test failure exposed by macos builders. | Allow `unused_variables` lint to placate test failure exposed by macos builders.
| Rust | apache-2.0 | GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust |
52ad2561db9111a857554c346facf501fe87d18b | benches/bench_stdlibs.rs | benches/bench_stdlibs.rs | #![feature(test)]
extern crate racer_testutils;
extern crate test;
use test::Bencher;
use racer_testutils::*;
#[bench]
fn completes_hashmap(b: &mut Bencher) {
let src = r"
use std::collections::HashM~
";
let mut var = vec![];
b.iter(|| {
var = get_all_completions(src, None);
})
}
#[bench]... | #![feature(test)]
extern crate racer_testutils;
extern crate test;
use test::Bencher;
use racer_testutils::*;
#[bench]
fn completes_hashmap(b: &mut Bencher) {
let src = r"
use std::collections::HashM~
";
let mut var = vec![];
b.iter(|| {
var = get_all_completions(src, None);
})
}
#[bench]... | Add follows_std & follows_collections benchmark | Add follows_std & follows_collections benchmark
| Rust | mit | phildawes/racer,racer-rust/racer,birkenfeld/racer |
ec4a1dc297eb90dde4c22c682a35606aaa50b4d4 | crates/hir_def/src/nameres/tests/block.rs | crates/hir_def/src/nameres/tests/block.rs | use super::*;
#[test]
fn inner_item_smoke() {
check_at(
r#"
//- /lib.rs
struct inner {}
fn outer() {
$0
fn inner() {}
}
"#,
expect![[r#"
block scope
inner: v
crate
inner: t
outer: v
"#]],
);
}
#[test]
fn use_from_crate... | use super::*;
#[test]
fn inner_item_smoke() {
check_at(
r#"
//- /lib.rs
struct inner {}
fn outer() {
$0
fn inner() {}
}
"#,
expect![[r#"
block scope
inner: v
crate
inner: t
outer: v
"#]],
);
}
#[test]
fn use_from_crate... | Add test that merges inner and outer names | Add test that merges inner and outer names
| Rust | apache-2.0 | rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer |
baa4e845343bef037cc4d04db52bc91c38bca4ba | src/main.rs | src/main.rs | fn main(expr: &str) -> i32 {
let result = 0;
for c in expr.chars() {
match c {
'0' ... '9' => println!("number"),
' ' => println!("space"),
'+' => println!("plus"),
_ => panic!("unsupported character")
}
}
return result;
}
#[test]
fn it_adds() {
let result = main("+1 2");
as... | fn main(expr: &str) -> i32 {
let mut result = 0;
let mut stack:Vec<i32> = Vec::new();
for token in expr.split_whitespace() {
let wrapped_operand = token.parse::<i32>();
let is_operator = wrapped_operand.is_err();
if is_operator {
// xxxFlorent: Any way to destructure like this? Not sure of what ... | Make it work for simple additions | Make it work for simple additions
| Rust | mit | fflorent/rust-rpn |
9dd0baeb830ee1385fc7897beac62f089b3d79fd | src/main.rs | src/main.rs | use std::env;
use std::path::PathBuf;
#[macro_use]
extern crate log;
mod git;
fn get_current_dir() -> PathBuf {
env::current_dir().unwrap_or_else(|e| {
panic!("Get current dir expected to succeed. Error: {}", e);
})
}
fn main() {
match git::stash(&get_current_dir()) {
Ok(stash) => printl... | use std::env;
use std::path::PathBuf;
#[macro_use]
extern crate log;
mod git;
fn get_current_dir() -> PathBuf {
env::current_dir().unwrap_or_else(|e| {
panic!("Get current dir expected to succeed. Error: {}", e);
})
}
fn main() {
match git::stash(&get_current_dir()) {
Ok(stash) => printl... | Add sample git command invocation | Add sample git command invocation
| Rust | mit | leonardinius/git-wayback-machine.rs,leonardinius/git-wayback-machine.rs |
4abe342074bcacf7c9e6433846b07b7533bde6d2 | src/elf_symbols.rs | src/elf_symbols.rs |
// Elf section headers have a fixed size.
const ELF_SECTION_HEADER_SIZE: usize = 56;
#[repr(packed)]
struct ElfSymbolTag {
tag_type: u32,
size: u32,
num: u16,
entsize: u16,
shndx: u16,
reserved: u16,
first_section: ElfSectionHeader
}
struct ElfSectionHeader {
sh_name: u32,
sh_typ... | #[repr(packed)]
struct ElfSymbolTag {
tag_type: u32,
size: u32,
num: u16,
entsize: u16,
shndx: u16,
reserved: u16,
first_section: ElfSectionHeader
}
impl ElfSymbolTag {
pub fn elf_sections(&'static self) -> ElfSectionIter {
ElfSectionIter {
current_section: &self.fir... | Add basic support for ELF section parsing. | Add basic support for ELF section parsing.
| Rust | apache-2.0 | stallmanifold/rust-multiboot2 |
bb52edf1e0cf0f2232d725af7afb69fb1ebba7e8 | src/r0/media/get_content.rs | src/r0/media/get_content.rs | //! Endpoints for the media repository.
//! [GET /_matrix/media/r0/download/{serverName}/{mediaId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-media-r0-download-servername-mediaid)
use ruma_api::ruma_api;
ruma_api! {
metadata {
description: "Retrieve content from the media store.",... | //! Endpoints for the media repository.
//! [GET /_matrix/media/r0/download/{serverName}/{mediaId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-media-r0-download-servername-mediaid)
use ruma_api::ruma_api;
ruma_api! {
metadata {
description: "Retrieve content from the media store.",... | Add allow_remote parameter to content fetching endpoint. | Add allow_remote parameter to content fetching endpoint.
Fixes #92.
| Rust | mit | ruma/ruma,ruma/ruma-client-api |
616acd88153e043c5ee22e47bdaa0b312dda11f0 | examples/child_iter.rs | examples/child_iter.rs | extern crate radix_trie;
use radix_trie::Trie;
fn main() {
let mut t = Trie::new();
t.insert("a", 5);
t.insert("b", 6);
t.insert("c", 50);
let sum = t.child_iter().fold(0, |acc, c| {
println!("{:#?}", c);
acc + *c.value().unwrap_or(&0)
});
println!("{}", sum);
}
| extern crate radix_trie;
use radix_trie::Trie;
fn main() {
let mut t = Trie::new();
t.insert("z", 2);
t.insert("aba", 5);
t.insert("abb", 6);
t.insert("abc", 50);
// This is a bit of a hack that relies on knowing the binary representation of
// strings... "abd" works, but "abz" doesn't...... | Add an example of how to iterate through child nodes. | Add an example of how to iterate through child nodes.
| Rust | mit | michaelsproul/rust_radix_trie,roblabla/rust_radix_trie |
841254e28e4d599e22bde8185a27454c0dc49ccb | src/ast/nodes/symbol.rs | src/ast/nodes/symbol.rs | pub struct Symbol {
ns: Option<String>,
name: String,
}
| use std::fmt;
pub struct Symbol {
ns: Option<String>,
name: String,
}
impl fmt::Display for Symbol {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(ref ns) = self.ns {
write!(f, "{}/{}", ns, self.name)
} else {
write!(f, "{}", self.name)
... | Implement Display trait for Symbol struct | Implement Display trait for Symbol struct
| Rust | mit | pavel-v-chernykh/lust |
f3b50ae348306146e342641238c8e21cf0d545bb | src/test/compile-fail/iface-test.rs | src/test/compile-fail/iface-test.rs | iface foo { fn foo(); }
impl of foo for uint {}
impl of foo for uint { fn foo() -> int {} }
impl of int for uint { fn foo() {} } //~ ERROR interface
fn main() {}
| iface foo { fn foo(); }
impl of int for uint { fn foo() {} } //~ ERROR interface
fn main() {}
| Remove failing parts of the failing test (requires intertwining of resolve and typechecking) | test: Remove failing parts of the failing test (requires intertwining of resolve and typechecking)
| Rust | apache-2.0 | aturon/rust,jashank/rust,zachwick/rust,defuz/rust,kwantam/rust,michaelballantyne/rust-gpu,nwin/rust,fabricedesre/rust,aepsil0n/rust,aneeshusa/rust,nwin/rust,stepancheg/rust-ide-rust,jbclements/rust,zubron/rust,XMPPwocky/rust,barosl/rust,carols10cents/rust,LeoTestard/rust,bluss/rand,mihneadb/rust,ktossell/rust,mvdnes/ru... |
172788883b64196728a0a7d1b6c13d9aaa351ebc | src/http/app.rs | src/http/app.rs | use std::path::PathBuf;
use std::process::Child;
use std::process::Command;
pub struct App {
pub name: String,
pub port: u16,
#[allow(dead_code)]
process: Child,
}
impl App {
pub fn new(name: String, port: u16, app_home: &str) -> App {
let mut path_buf = PathBuf::from(app_home);
pa... | use std::path::PathBuf;
use std::process::Child;
use std::process::Command;
pub struct App {
pub name: String,
pub port: u16,
#[allow(dead_code)]
process: Child,
}
impl App {
pub fn new(name: String, port: u16, app_home: &str) -> App {
let mut path_buf = PathBuf::from(app_home);
pa... | Replace format! with to_string for port conversion | refactor: Replace format! with to_string for port conversion
| Rust | mit | juanibiapina/zas,juanibiapina/zas,juanibiapina/zas |
32740ee0fe320bb929189f500e9cde3d336c1aee | src/character/audio.rs | src/character/audio.rs | use std::fs::File;
use std::io::BufReader;
use rodio;
use rodio::Sink;
use game::constants::PISTOL_AUDIO_PATH;
pub struct CharacterAudio {
sink: Sink,
}
impl CharacterAudio {
pub fn new() -> CharacterAudio {
let endpoint = rodio::get_default_endpoint().unwrap();
CharacterAudio {
sink: Sink::new(&end... | use std::fs::File;
use std::io::BufReader;
use rodio;
use rodio::Sink;
use game::constants::PISTOL_AUDIO_PATH;
pub struct CharacterAudio {
sink: Sink,
}
impl CharacterAudio {
pub fn new() -> CharacterAudio {
#[allow(deprecated)]
let endpoint = rodio::get_default_endpoint().unwrap();
CharacterAudio {
... | Allow use of deprecated "get_default_endpoint" | Allow use of deprecated "get_default_endpoint" | Rust | apache-2.0 | Laastine/zombie-shooter,Laastine/zombie-shooter |
558a7e98cef215c3b75859a08d499264d5fc386c | bob/example.rs | bob/example.rs | pub fn reply(message: &str) -> &str {
if is_silence(message) { "Fine. Be that way!" }
else if is_yelling(message) { "Whoa, chill out!" }
else if is_question(message) { "Sure." }
else { "Whatever." }
}
fn is_silence(message: &str) -> bool {
message == ""
}
fn is_yelling(message: &str) -> bool {
... | pub fn reply(message: &str) -> &str {
if is_silence(message) { "Fine. Be that way!" }
else if is_yelling(message) { "Whoa, chill out!" }
else if is_question(message) { "Sure." }
else { "Whatever." }
}
fn is_silence(message: &str) -> bool {
message.is_empty()
}
fn is_yelling(message: &str) -> bool ... | Make checking for the empty string slightly more idiomatic | Make checking for the empty string slightly more idiomatic
| Rust | mit | ekse/exercism-rust,sacherjj/rust,medek/xrust,medek/xrust,spazm/xrust,petertseng/exercism-rust,pminten/xrust,pminten/xrust,ekse/exercism-rust,Rust-Twin-Cities/flaming-octo-wookie,stevejb71/xrust,petertseng/exercism-rust,petertseng/exercism-rust,exercism/xrust,Jeff-Hostetler/xrust,exercism/xrust,spazm/xrust,sacherjj/rust... |
5e433304fac6864d2ef75b3124281d18cd5a35ba | 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)]
include!(concat!(env!("OUT_DIR"), "/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 code generated by bindgen for testing struct layouts | Allow code generated by bindgen for testing struct layouts
| Rust | mpl-2.0 | stratis-storage/stratisd,stratis-storage/stratisd,stratis-storage/stratisd |
0117f5d99d58d5f8005a55358e65d99e6473b211 | src/fs.rs | src/fs.rs | // Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
//
// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.
// and the party accessing this file ("Licensee") apply to Licensee's use of
// the Software until such time that the Software is made available under an
// open source license suc... | // Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
//
// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.
// and the party accessing this file ("Licensee") apply to Licensee's use of
// the Software until such time that the Software is made available under an
// open source license suc... | Purge references to `bldr` in the Supervisor. | [hap-sup] Purge references to `bldr` in the Supervisor.
This change has a few noteworthy points:
* The various structs in the error subsystem have been changed, namely
`ErrorKind` becomes `Error`, `BldrResult` becomes `Result`,
`BldrError` becomes `SupError`, and the `bldr_error!` macro becomes
`sup_error!`. Th... | Rust | apache-2.0 | rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat |
0b5120430cd73059d40145602383cf2a39012030 | src/lib.rs | src/lib.rs | //! Watchexec: the library
//!
//! This is the library version of the CLI tool [watchexec]. The tool is
//! implemented with this library, but the purpose of the watchexec project is
//! to deliver the CLI tool, instead of focusing on the library interface first
//! and foremost. **For this reason, semver guarantees do... | //! Watchexec: the library
//!
//! This is the library version of the CLI tool [watchexec]. The tool is
//! implemented with this library, but the purpose of the watchexec project is
//! to deliver the CLI tool, instead of focusing on the library interface first
//! and foremost. **For this reason, semver guarantees do... | Revise clippy lints to avoid breakage | Revise clippy lints to avoid breakage
| Rust | apache-2.0 | mattgreen/watchexec,mattgreen/watchexec,mattgreen/watchexec,mattgreen/watchexec |
db7448c316cd4470b6678d1df926573970c6b269 | bracket-push/src/lib.rs | bracket-push/src/lib.rs | pub struct Brackets(String);
impl<'a> From<&'a str> for Brackets {
fn from(string: &str) -> Self {
Brackets(string.into())
}
}
impl Brackets {
pub fn are_balanced(&self) -> bool {
let mut stack = Vec::new();
for c in self.0.chars() {
match c {
'[' | '{'... | pub struct Brackets<'a>(&'a str);
impl<'a> From<&'a str> for Brackets<'a> {
fn from(brackets: &'a str) -> Self {
Brackets(brackets)
}
}
impl<'a> Brackets<'a> {
pub fn are_balanced(&self) -> bool {
let mut stack = Vec::new();
for c in self.0.chars() {
match c {
... | Convert Bracket Push solution to store &str instead of String | Convert Bracket Push solution to store &str instead of String
| Rust | mit | attilahorvath/exercism-rust |
5732f5a4bf62af202b2c7413f92d9f7681677999 | src/bin/cargo-git-checkout.rs | src/bin/cargo-git-checkout.rs | #![crate_id="cargo-git-checkout"]
extern crate cargo;
extern crate serialize;
extern crate hammer;
extern crate url;
use hammer::FlagConfig;
use cargo::{execute_main_without_stdin,CLIResult,CLIError,ToResult};
use cargo::sources::git::{GitRemote,GitCheckout};
use url::Url;
#[deriving(Eq,Clone,Decodable)]
struct Opti... | #![crate_id="cargo-git-checkout"]
extern crate cargo;
extern crate serialize;
extern crate hammer;
extern crate url;
use hammer::FlagConfig;
use cargo::{execute_main_without_stdin,CLIResult,CLIError,ToResult};
use cargo::core::source::Source;
use cargo::sources::git::{GitSource,GitRemote};
use url::Url;
#[deriving(E... | Use GitSource in the stub executable | Use GitSource in the stub executable
| Rust | apache-2.0 | blaenk/cargo,youprofit/cargo,Kimundi/cargo,JacobHenner/cargo,mceier/cargo,nipunn1313/cargo,ruud-v-a/cargo,tomaka/cargo,gchp/cargo,ArtemGr/cargo,vojtechkral/cargo,apjanke/cargo,shaleh/cargo,AndiDog/cargo,sbeckeriv/cargo,ArtemGr/cargo,shaleh/cargo,takkanm/cargo,liigo/cargo,gchp/cargo,Gankro/cargo,cmr/cargo,aturon/cargo,i... |
02fd250ddcf79c4467be9940d201235956f17541 | src/state/crosslink_record.rs | src/state/crosslink_record.rs | use super::utils::types::Sha256Digest;
pub struct CrosslinkRecord {
pub epoch: u64,
pub hash: Sha256Digest
}
impl CrosslinkRecord {
pub fn new(epoch: u64, hash: Sha256Digest) -> CrosslinkRecord {
CrosslinkRecord {
epoch: epoch,
hash: hash
}
}
}
#[cfg(test)]
mod... | use super::utils::types::Sha256Digest;
use super::rlp::{ RlpStream, Encodable };
pub struct CrosslinkRecord {
pub epoch: u64,
pub hash: Sha256Digest
}
impl CrosslinkRecord {
pub fn new(epoch: u64, hash: Sha256Digest) -> CrosslinkRecord {
CrosslinkRecord {
epoch: epoch,
hash... | Add RLP encoding for CrosslinkRecord | Add RLP encoding for CrosslinkRecord
| Rust | apache-2.0 | sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse |
a9c4f566eaa620b6cec901f2aa8d533613d65983 | src/http/client/sslclients/mod.rs | src/http/client/sslclients/mod.rs | //! SSL client support.
//!
//! Which particular library is used depends upon the configuration used at
//! compile time; at present it can only be OpenSSL (`--cfg openssl`); without
//! that, you won't be able to use SSL (an attempt to make an HTTPS connection
//! will return an error).
#[cfg(not(nossl))]
pub use sel... | //! SSL client support.
//!
//! Which particular library is used depends upon the configuration used at
//! compile time; at present it can only be OpenSSL (`--cfg openssl`); without
//! that, you won't be able to use SSL (an attempt to make an HTTPS connection
//! will return an error).
#[cfg(not(nossl),not(target_os... | Disable SSL support on android. | Disable SSL support on android.
| Rust | apache-2.0 | Shraddha512/rust-http,Shraddha512/rust-http,servo/rust-http,Shraddha512/rust-http,servo/rust-http,servo/rust-http,servo/rust-http,Shraddha512/rust-http,Shraddha512/rust-http |
8d89ec03e87775048c776a244fd0feeb775b572e | src/fs.rs | src/fs.rs | // Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers
//
// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.
// and the party accessing this file ("Licensee") apply to Licensee's use of
// the Software until such time that the Software is made available under an
// open source license... | // Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers
//
// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.
// and the party accessing this file ("Licensee") apply to Licensee's use of
// the Software until such time that the Software is made available under an
// open source license... | Reduce the number of `/opt/bldr` path occurences. | Reduce the number of `/opt/bldr` path occurences.
This change seeks to remove as many hard-coded references to the
`$BLDR_ROOT` of the Habitat file system tree. Several programs and
utilities require this knowledge but all should now compute all other
paths from this foundational one.
Several occurences of the above ... | Rust | apache-2.0 | habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat |
a62bbb520c7b0e1676c8e82428a6e6e0ad026b6b | rust/berg-compiler/tests/scope.rs | rust/berg-compiler/tests/scope.rs | #[macro_use]
pub mod compiler_test;
compiler_tests! {
child_references_parent: "a = 1; { a + 2 }" => value(3),
child_references_parent_too_early_error: "{ a + 2 }; a = 1" => error(NoSuchField@2),
// child_references_parent_container_error: "a = { a + 1 }; a" => error(NoSuchField@6),
child_references_pa... | #[macro_use]
pub mod compiler_test;
compiler_tests! {
child_references_parent: "a = 1; { a + 2 }" => value(3),
child_references_parent_too_early_error: "{ a + 2 }; a = 1" => error(NoSuchField@2),
child_references_parent_circular_error: "a = { a + 1 }; a" => error(CircularDependency@6),
child_references... | Add tests for lazy eval / circular error | Add tests for lazy eval / circular error
| Rust | mit | berg-lang/berg,berg-lang/berg,jkeiser/berg,berg-lang/berg |
6068cd263dc468beb88e312bf372c672fd4c5477 | src/types/collections/map.rs | src/types/collections/map.rs | use {Type, Error};
use std::collections::HashMap;
use std::io::prelude::*;
use std;
pub type SizeType = u32;
impl<K, V> Type for HashMap<K, V>
where K: Type + std::hash::Hash + Eq,
V: Type
{
fn read(read: &mut Read) -> Result<Self, Error> {
let mut map = HashMap::new();
let length ... | use {Type, Error};
use std::collections::{HashMap, BTreeMap};
use std::hash::Hash;
use std::io::prelude::*;
pub type SizeType = u32;
macro_rules! impl_map_type {
( $ty:ident => K: $( $k_pred:ident ),+ ) => {
impl<K, V> Type for $ty<K, V>
where K: Type + $( $k_pred +)+,
V: T... | Generalize the HashMap Type implementation | Generalize the HashMap Type implementation
| Rust | mit | dylanmckay/protocol,dylanmckay/protocol |
c5bf7332dee2eee19b5f8098784c6e09cc6188b6 | tasks/remove-duplicate-elements/src/main.rs | tasks/remove-duplicate-elements/src/main.rs | use std::collections::HashSet;
use std::hash::Hash;
fn remove_duplicate_elements_hashing<T: Hash + Eq>(elements: &mut Vec<T>) {
let set: HashSet<_> = elements.drain(..).collect();
elements.extend(set.into_iter());
}
fn remove_duplicate_elements_sorting<T: Ord>(elements: &mut Vec<T>) {
elements.sort_unstab... | use std::vec::Vec;
use std::collections::HashSet;
use std::hash::Hash;
use std::cmp::Eq;
fn main() {
let mut sample_elements = vec![0u8, 0, 1, 1, 2, 3, 2];
println!("Before removal of duplicates : {:?}", sample_elements);
remove_duplicate_elements(&mut sample_elements);
println!("After removal of dupli... | Revert "cleanup & add sorting method" | Revert "cleanup & add sorting method"
This reverts commit 98dd45f7d5419ee5189d12e43d9794ef29b816e9.
| Rust | unlicense | Hoverbear/rust-rosetta |
76886e39f98b12b754a8ac33f6ae4d933d0b93de | src/file_saver.rs | src/file_saver.rs | use std::error::Error;
use std::fs::File;
use std::io::{Result, Write};
use std::path::Path;
use chunk::*;
pub trait SaveToFile {
fn save_to_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>;
}
impl<I: Iterator<Item=Chunk>> SaveToFile for I {
fn save_to_file<P: AsRef<Path>>(&mut self, path: P) -> Result... | use std::error::Error;
use std::fs;
use std::fs::File;
use std::io::{Result, Write};
use std::path::Path;
use chunk::*;
pub trait SaveToFile {
fn save_to_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>;
}
impl<I: Iterator<Item=Chunk>> SaveToFile for I {
fn save_to_file<P: AsRef<Path>>(&mut self, path:... | Create backup file, if none | Create backup file, if none
| Rust | mit | insanebits/gir,GuillaumeGomez/gir,GuillaumeGomez/gir,gtk-rs/gir,GuillaumeGomez/gir,EPashkin/gir,gtk-rs/gir,insanebits/gir,gtk-rs/gir,gkoz/gir,gkoz/gir,EPashkin/gir |
dea925018fd63a2fa5fd8dea047dface8c5ef127 | build.rs | build.rs | #[allow(dead_code)]
fn add_xcode_private_framework_path() {
// PrivateFramework dir:
// `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/
let xcode_dir = std::process::Command::new("xcode-select")
.arg("-p")
.output()
.expect("Fai... | #[allow(dead_code)]
fn add_xcode_private_framework_path() {
// PrivateFramework dir:
// `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/
let xcode_dir = std::process::Command::new("xcode-select")
.arg("-p")
.output()
.expect("Fai... | Add another private framework location | Add another private framework location
| Rust | apache-2.0 | mrmekon/rubrail-rs |
c0db2ce610b839f804e8806fd079ba7f6a286f7d | exercises/saddle-points/example.rs | exercises/saddle-points/example.rs | pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
let mut saddle_points = Vec::new();
let width = input.len();
let height = input[0].len();
for i in 0..width {
for j in 0..height {
let column = input.iter().map(|x| x[j]).collect::<Vec<u64>>();
let r... | pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
let (width, height) = match (input.len(), input[0].len()) {
(0, _) | (_, 0) => return Vec::new(),
(n, k) => (n, k),
};
let mut saddle_points = Vec::new();
for i in 0..width {
let row_max = input[i].iter().ma... | Optimize saddle-points; use idiomatic rust | Optimize saddle-points; use idiomatic rust
| Rust | mit | petertseng/exercism-rust,petertseng/exercism-rust,petertseng/exercism-rust,exercism/xrust,exercism/xrust |
c5b286f4c21b655d99549279060dc701b20a6fa6 | src/data.rs | src/data.rs | use std::io::File;
use serialize::hex::ToHex;
use rust_crypto::md5::Md5;
use rust_crypto::digest::Digest;
pub trait DataStore {
fn write(&self, data: &[u8]) -> ();
}
pub struct FileStore{
path: String,
}
impl FileStore{
pub fn new(path: String) -> FileStore {
FileStore {
path: path,
}
}
}
... | use std::io::fs;
use std::io::{File, USER_RWX};
use serialize::hex::ToHex;
use rust_crypto::md5::Md5;
use rust_crypto::digest::Digest;
pub trait DataStore {
fn write(&self, data: &[u8]) -> ();
}
pub struct FileStore{
root: Path,
}
impl FileStore{
pub fn new(path: &str) -> FileStore {
let root ... | Fix FileStore write method, includes : - Create root folders if don't exist - Handles errors and make them verbose | Fix FileStore write method, includes :
- Create root folders if don't exist
- Handles errors and make them verbose
| Rust | mit | jacquesrott/icecore,jacquesrott/icecore |
b92852ed379620355d20adbc6c4573bae24cfb24 | src/main.rs | src/main.rs | extern crate termion;
fn main() {
print!("{}{}Stuff\n", termion::clear::All, termion::cursor::Goto(1, 1));
}
| extern crate termion;
use termion::event::{Event, Key};
use termion::raw::IntoRawMode;
use termion::input::TermRead;
use std::io::{Write, stdin, stdout};
fn main() {
let stdin = stdin();
let mut stdout = stdout().into_raw_mode().unwrap();
write!(stdout, "{}{}Press Ctrl-Q to quit", termion::clear::All, ter... | Write something that actually works | Write something that actually works
| Rust | mit | mathphreak/mfte |
73294755a09b13a1f7823015534473761a8814b9 | tests/compile-fail/run_expr_str_ref.rs | tests/compile-fail/run_expr_str_ref.rs | extern crate gluon;
use gluon::{new_vm, Compiler};
fn main() {
let vm = new_vm();
let _ = Compiler::new().run_expr::<&str>(&vm, "", r#" "test" "#);
//~^ the trait bound `for<'value> &str: gluon::gluon_vm::api::Getable<'_, 'value>` is not satisfied
}
| extern crate gluon;
use gluon::{new_vm, Compiler};
fn main() {
let vm = new_vm();
let _ = Compiler::new().run_expr::<&str>(&vm, "", r#" "test" "#);
//~^ mismatched types [E0308]
}
| Fix compile test from updated nightly | Fix compile test from updated nightly
| Rust | mit | gluon-lang/gluon,Marwes/embed_lang,Marwes/embed_lang,gluon-lang/gluon |
eb689428eb181ae93ea5c0a4163edaa6e411dac8 | src/utils.rs | src/utils.rs | //
// Sysinfo
//
// Copyright (c) 2017 Guillaume Gomez
//
#[cfg(not(target_os = "windows"))]
use std::fs;
#[cfg(not(target_os = "windows"))]
use std::path::{Path, PathBuf};
#[cfg(not(target_os = "windows"))]
use libc::{c_char, lstat, stat, S_IFLNK, S_IFMT};
#[cfg(not(target_os = "windows"))]
pub fn realpath(origina... | //
// Sysinfo
//
// Copyright (c) 2017 Guillaume Gomez
//
#[cfg(not(target_os = "windows"))]
use std::fs;
#[cfg(not(target_os = "windows"))]
use std::path::{Path, PathBuf};
#[cfg(not(target_os = "windows"))]
use libc::{c_char, lstat, stat, S_IFLNK, S_IFMT};
#[cfg(not(target_os = "windows"))]
pub fn realpath(origina... | Fix invalid str to C conversion | Fix invalid str to C conversion
| Rust | mit | GuillaumeGomez/sysinfo,GuillaumeGomez/sysinfo |
99eb39d34212b7fe116acc6e5adb0e0b24434817 | src/bin/json2toml.rs | src/bin/json2toml.rs | extern crate toml;
extern crate serde_json;
use std::io;
use std::io::prelude::*;
// use serde_json::Value;
fn main() {
let stdin = io::stdin();
let mut string = String::new();
stdin.lock().read_to_string(&mut string).expect("Error reading stdin");
let value: serde_json::Value = serde_json::from_str(&s... | extern crate toml;
extern crate serde_json;
use std::io;
use std::io::prelude::*;
fn main() {
let stdin = io::stdin();
let mut string = String::new();
stdin.lock().read_to_string(&mut string).expect("Error reading stdin");
let value: serde_json::Value = serde_json::from_str(&string).expect("Error parsi... | Remove commented out use statement | Remove commented out use statement
| Rust | mit | rabbit-ci/toml2json |
2c86c8eb4cf3688c75e31332ddbd6942dd62c92b | examples/22_stop_parsing_with_--.rs | examples/22_stop_parsing_with_--.rs | extern crate clap;
use clap::{App, Arg};
/// myprog -f -p=bob -- sloppy slop slop
fn main() {
let matches = App::new("myprog")
.arg(Arg::with_name("eff")
.short("f"))
.arg(Arg::with_name("pea")
.short("p")
.takes_value(true))
.arg(Arg::with_name("slop... | extern crate clap;
use clap::{App, Arg};
/// myprog -f -p=bob -- sloppy slop slop
fn main() {
let matches = App::new("myprog")
.arg(Arg::with_name("eff")
.short("f"))
.arg(Arg::with_name("pea")
.short("p")
.takes_value(true))
.arg(Arg::with_name("slop... | Make -- mandatory for the slop example | Make -- mandatory for the slop example
| Rust | apache-2.0 | clap-rs/clap,clap-rs/clap,kbknapp/clap-rs,clap-rs/clap,kbknapp/clap-rs |
4fb651a664b8e287c176e304369cfb5307b337ac | src/wpilib/robot_state.rs | src/wpilib/robot_state.rs | use wpilib::wpilib_hal::*;
pub fn is_browned_out() -> HalResult<bool> {
Ok(hal_call!(HAL_GetBrownedOut())? as bool)
}
pub fn is_system_active() -> HalResult<bool> {
Ok(hal_call!(HAL_GetSystemActive())? as bool)
}
pub fn get_battery_voltage() -> HalResult<f64> {
hal_call!(HAL_GetVinVoltage())
}
| use wpilib::wpilib_hal::*;
use wpilib::hal_call::*;
pub fn is_browned_out() -> HalResult<bool> {
Ok(hal_call!(HAL_GetBrownedOut())? != 0)
}
pub fn is_system_active() -> HalResult<bool> {
Ok(hal_call!(HAL_GetSystemActive())? != 0)
}
pub fn get_battery_voltage() -> HalResult<f64> {
hal_call!(HAL_GetVinVolt... | Fix robot state functions to return correctly | Fix robot state functions to return correctly
| Rust | mit | KyleStach1678/rust-wpilib,robotrs/rust-wpilib |
492d2d9bfcfb495fbe3a29d78a8d8e9b81c9148d | diesel/src/sqlite/mod.rs | diesel/src/sqlite/mod.rs | //! Provides types and functions related to working with SQLite
//!
//! Much of this module is re-exported from database agnostic locations.
//! However, if you are writing code specifically to extend Diesel on
//! SQLite, you may need to work with this module directly.
mod backend;
mod connection;
mod types;
pub mod... | //! Provides types and functions related to working with SQLite
//!
//! Much of this module is re-exported from database agnostic locations.
//! However, if you are writing code specifically to extend Diesel on
//! SQLite, you may need to work with this module directly.
mod backend;
mod connection;
mod types;
pub mod... | Update link to sql_function in documentation | Update link to sql_function in documentation
| Rust | apache-2.0 | sgrif/diesel,diesel-rs/diesel,sgrif/diesel,diesel-rs/diesel |
8df51e4299b6eeb6b500ef15debe136ec5e04d5a | src/main.rs | src/main.rs | extern crate ghoti;
extern crate getopts;
use getopts::Options;
use std::env;
use std::fs::File;
use std::path::Path;
fn print_usage(opts: Options) {
let usage = "Usage: ghoti [options] <filename>";
print!("{}", opts.usage(usage));
}
fn main() {
// Set up CLI options
let mut opts = Options::new();... | extern crate ghoti;
extern crate getopts;
use getopts::Options;
use ghoti::correction;
use std::env;
fn print_usage(opts: Options) {
let usage = "Usage: ghoti [options] <word>";
print!("{}", opts.usage(usage));
}
fn main() {
// Set up CLI options
let mut opts = Options::new();
opts.optflag("h", ... | Check spelling of a word from program CLI | Check spelling of a word from program CLI
| Rust | mit | iKevinY/ghoti.rs |
aff6c39aac619a78bb1007fddf7c913957a79f5e | src/main.rs | src/main.rs | #[cfg(not(windows))]
compile_error!("This demo only runs on Windows.");
extern crate directcomposition;
extern crate winit;
use winit::os::windows::WindowExt;
fn main() {
let mut events_loop = winit::EventsLoop::new();
let window = winit::WindowBuilder::new()
.with_title("Hello, world!")
.wit... | #[cfg(not(windows))]
compile_error!("This demo only runs on Windows.");
extern crate directcomposition;
extern crate winit;
use directcomposition::DirectComposition;
use winit::os::windows::WindowExt;
fn main() {
let mut events_loop = winit::EventsLoop::new();
let window = winit::WindowBuilder::new()
... | Move demo app’s unsafe code into a safe function | Move demo app’s unsafe code into a safe function
| Rust | mpl-2.0 | servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender,servo/webrender |
5efb22ebee128f1ec4a755556230bdd66c3f2026 | test_suite/no_std/src/main.rs | test_suite/no_std/src/main.rs | // Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except accordin... | // Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except accordin... | Format no_std test code with rustfmt 0.4.1 | Format no_std test code with rustfmt 0.4.1
| Rust | apache-2.0 | serde-rs/serde |
8eed6c62f857e456f5a4979d14904205f7054bde | tests/assert.rs | tests/assert.rs |
extern crate ndarray;
extern crate ndarray_numtest;
use ndarray::prelude::*;
use ndarray_numtest::prelude::*;
#[test]
fn allclose_success() {
let a = arr1(&[1.0, 2.0]);
let b = arr1(&[1.0, 2.0 + 1.0e-9]);
b.assert_allclose(&a, 1e-7);
}
#[should_panic]
#[test]
fn allclose_fail() {
let a = arr1(&[1.0,... |
extern crate ndarray;
extern crate num;
extern crate ndarray_numtest;
use ndarray::prelude::*;
use ndarray_numtest::prelude::*;
use num::complex::Complex;
#[allow(non_camel_case_types)]
type c64 = Complex<f64>;
#[test]
fn allclose_success() {
let a = arr1(&[1.0, 2.0]);
let b = arr1(&[1.0, 2.0 + 1.0e-9]);
... | Add test for complex array | Add test for complex array
| Rust | mit | termoshtt/ndarray-numtest |
220923eab13f64cb1915454ab95be2f99c22b29f | tests/stream.rs | tests/stream.rs | extern crate flac;
extern crate crypto;
use crypto::digest::Digest;
use crypto::md5::Md5;
use flac::Stream;
use std::cmp;
fn to_bytes(value: i32, buffer: &mut [u8]) {
buffer[0] = value as u8;
buffer[1] = (value >> 8) as u8;
buffer[2] = (value >> 16) as u8;
buffer[3] = (value >> 24) as u8;
}
fn get_offset(sam... | extern crate flac;
extern crate crypto;
use crypto::digest::Digest;
use crypto::md5::Md5;
use flac::Stream;
use std::cmp;
fn to_bytes(value: i32, buffer: &mut [u8]) {
buffer[0] = value as u8;
buffer[1] = (value >> 8) as u8;
buffer[2] = (value >> 16) as u8;
buffer[3] = (value >> 24) as u8;
}
fn get_offset(sam... | Change to multiple file names | Change to multiple file names
| Rust | bsd-3-clause | sourrust/flac |
f1f7f3e336d41976e62ab5e48eb7c027f8362c1a | src/lib.rs | src/lib.rs | extern crate pest;
#[macro_use]
extern crate pest_derive;
#[macro_use]
extern crate lazy_static;
extern crate ansi_term;
pub mod analysis;
pub mod to_javascript;
pub mod ast;
pub mod error;
pub mod parser;
pub mod compiler;
pub mod stdlib;
| #![feature(box_patterns, box_syntax)]
extern crate pest;
#[macro_use]
extern crate pest_derive;
#[macro_use]
extern crate lazy_static;
extern crate ansi_term;
pub mod analysis;
pub mod to_javascript;
pub mod ast;
pub mod error;
pub mod parser;
pub mod compiler;
pub mod stdlib;
| Add box patterns, syntax feature for deferecning a box | Add box patterns, syntax feature for deferecning a box
| Rust | apache-2.0 | Willifme/robin_core,Willifme/robin_core,Willifme/robin_core |
6c835311bd3cbdfca8254d7654ec67328bfbf9a5 | src/url.rs | src/url.rs | // Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers
//
// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.
// and the party accessing this file ("Licensee") apply to Licensee's use of
// the Software until such time that the Software is made available under an
// open source license... | // Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers
//
// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.
// and the party accessing this file ("Licensee") apply to Licensee's use of
// the Software until such time that the Software is made available under an
// open source license... | Update the `HAB_DEPOT_URL` default from IP to hostname. | Update the `HAB_DEPOT_URL` default from IP to hostname.
I don't want to ruin the joke here so...
http://i.imgur.com/Cm8N2Dt.gif
| Rust | apache-2.0 | habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat |
97d42ee6f20bac4e128a2f17ffcc559d54977714 | src/buffer/mod.rs | src/buffer/mod.rs | //! Memory buffer API
//!
//! The `Buffer` trait defined here allows the memory buffer of the queue to
//! be defined independently from the queue implementation.
pub mod array;
pub mod dynamic;
/// All buffers must implement this trait to be used with any of the queues.
pub trait Buffer<T> {
/// Return the size ... | //! Memory buffer API
//!
//! The `Buffer` trait defined here allows the memory buffer of the queue to
//! be defined independently from the queue implementation.
pub mod array;
pub mod dynamic;
/// All buffers must implement this trait to be used with any of the queues.
pub trait Buffer<T> {
/// Return the size ... | Add blanket Buffer impl for &mut T and Box<T> | Add blanket Buffer impl for &mut T and Box<T>
| Rust | mit | johnshaw/magnetic |
c144538e0541f49f4378662cc56ece161126dec3 | tests/test_expr.rs | tests/test_expr.rs | #[macro_use]
mod macros;
use std::str::FromStr;
use proc_macro2::{Delimiter, Group, TokenStream, TokenTree};
use quote::quote;
use std::iter::FromIterator;
use syn::{Expr, ExprRange};
#[test]
fn test_expr_parse() {
let code = "..100u32";
let tt = TokenStream::from_str(code).unwrap();
let expr: Expr = syn... | #[macro_use]
mod macros;
use std::str::FromStr;
use proc_macro2::{Delimiter, Group, TokenStream, TokenTree};
use quote::quote;
use std::iter::FromIterator;
use syn::{Expr, ExprRange};
#[test]
fn test_expr_parse() {
let code = "..100u32";
let tt = TokenStream::from_str(code).unwrap();
let expr: Expr = syn... | Add snapshot test for group with trailer expr | Add snapshot test for group with trailer expr
| Rust | apache-2.0 | dtolnay/syn |
6b002ccea4b0120dc5eb34c77c15afada915e1cb | src/ray/ray_box.rs | src/ray/ray_box.rs | use nalgebra::na::{AlgebraicVecExt, Rotate, Transform};
use bounding_volume::AABB;
use geom::Box;
use ray::{Ray, RayCast, RayCastWithTransform};
impl<N: Primitive + Orderable + Algebraic,
V: AlgebraicVecExt<N> + Clone>
RayCast<N, V> for Box<N, V> {
#[inline]
fn toi_with_ray(&self, ray: &Ray<V>) -> Option<... | use nalgebra::na::{AlgebraicVecExt, Rotate, Transform, Identity, Cast};
use narrow::algorithm::johnson_simplex::JohnsonSimplex;
use bounding_volume::AABB;
use geom::{HasMargin, Box};
use ray::{Ray, RayCast, RayCastWithTransform};
use ray::ray_implicit::gjk_toi_and_normal_with_ray;
impl<N: Primitive + Orderable + Algeb... | Use the gjk-based ray cast when a box geometry is not 0. | Use the gjk-based ray cast when a box geometry is not 0.
| Rust | bsd-3-clause | sebcrozet/ncollide,MichaelRiss/ncollide,steveklabnik/ncollide,steveklabnik/ncollide,sebcrozet/ncollide,MichaelRiss/ncollide |
c5c64d48b7d96a0ffc2f8181ccf3a27b0d4f62b8 | src/util/strext.rs | src/util/strext.rs | pub trait _StrExt {
fn _is_char_boundary(&self, index: usize) -> bool;
}
impl _StrExt for str {
#[inline]
fn _is_char_boundary(&self, index: usize) -> bool {
if index == self.len() {
return true;
}
match self.as_bytes().get(index) {
None => false,
... | pub trait _StrExt {
fn _is_char_boundary(&self, index: usize) -> bool;
}
impl _StrExt for str {
#[inline]
fn _is_char_boundary(&self, index: usize) -> bool {
if index == self.len() {
return true;
}
self.as_bytes()
.get(index)
.map_or(false, |&b| ... | Use map_or instead of match | Use map_or instead of match
| Rust | apache-2.0 | clap-rs/clap,clap-rs/clap,clap-rs/clap |
86dc04faa4a885f39e664c12c1861c7f4b2270f8 | src/main.rs | src/main.rs | /// Represent the state of the game as a graph. One node for each cell
use macroquad::prelude::*;
#[macroquad::main("BasicShapes")]
async fn main() {
loop {
clear_background(RED);
draw_line(40.0, 40.0, 100.0, 200.0, 15.0, BLUE);
draw_rectangle(screen_width() / 2.0 - 60.0, 100.0, 120.0, ... | use macroquad::prelude::*;
// Represent the state of the game as a graph. One node for each cell. There is an edge between
// two cells if and only if they are the same colour and have a distance of 1 according to the
// Manhattan metric.
//
// The game has only one real operation (i.e. not counting level generation... | Document the way the game state is going to be represented | Document the way the game state is going to be represented
| Rust | mit | yzhs/flood-it |
b76ee41ba152923323512fb5d70b8ad8c1089c0e | src/main.rs | src/main.rs | enum Cell {
Empty,
Wall,
Player
}
fn get_symbol( cell: &Cell ) -> char {
match cell {
Empty => '_',
Wall => '#',
Player => '@'
}
}
fn main() {
let mut game_field = [ [ Cell::Empty, Cell::Wall ],
[ Cell::Empty, Cell::Empty ] ];
// let tmp... | enum Cell {
Empty,
Wall,
Player,
}
fn get_symbol( cell: Cell ) -> char {
match cell {
Cell::Empty => '_',
Cell::Wall => '#',
Cell::Player => '@'
}
}
fn initialize_field( ) -> Vec<Vec<Cell>>{
//ToDo: parse from file
let mut result_field: Vec<Vec<Cell>> = Vec::new()... | Add dynamic array (Vec); fix printing different symbols | Add dynamic array (Vec); fix printing different symbols
| Rust | mit | sborod/pacman-rust |
789acb55b2747f7ba274127c05f8350969ce14e9 | tests/get_focus_callback.rs | tests/get_focus_callback.rs | /* Copyright 2016 Jordan Miner
*
* Licensed under the MIT license <LICENSE or
* http://opensource.org/licenses/MIT>. This file may not be copied,
* modified, or distributed except according to those terms.
*/
#[macro_use]
extern crate clear_coat;
use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT, Ordering};... | /* Copyright 2016 Jordan Miner
*
* Licensed under the MIT license <LICENSE or
* http://opensource.org/licenses/MIT>. This file may not be copied,
* modified, or distributed except according to those terms.
*/
#[macro_use]
extern crate clear_coat;
use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT, Ordering};... | Remove a couple of unused imports | Remove a couple of unused imports
| Rust | mit | jminer/clear-coat |
f5caf16b26b48db58249366b983e2f04148f8075 | 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 philosophers = vec![
Philosopher::new(... | 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(... | Call `eat()` on every philosopher in the vector | Call `eat()` on every philosopher in the vector
| Rust | mit | juliangrosshauser/dining_philosophers |
60158fd6c825954b43db88249f52415f1991b903 | src/main.rs | src/main.rs | use std::io::ErrorKind;
use std::process::Command;
use structopt::StructOpt;
mod commands;
/// Personal CLI.
#[derive(StructOpt)]
enum Commands {
/// Reproduce my computer's configuration.
Setup,
/// Upgrade what's installed on my computer.
Upgrade,
/// Clean up my computer's state.
End,
... | use structopt::StructOpt;
mod commands;
/// Personal CLI.
#[derive(StructOpt)]
enum Commands {
/// Reproduce my computer's configuration.
Setup,
/// Upgrade what's installed on my computer.
Upgrade,
/// Clean up my computer's state.
End,
/// Start a study session.
Study,
}
fn main(... | Remove prerequisite checks covered by being able to run the code | Remove prerequisite checks covered by being able to run the code
| Rust | mit | trevordmiller/shell-scripts,trevordmiller/shell-scripts |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.