messages listlengths 2 2 | language stringclasses 8
values | prompt_type stringclasses 2
values | lint_errors int64 0 129 ⌀ | cyclomatic_complexity int64 0 32 ⌀ | license stringclasses 7
values | commit stringlengths 40 40 | repos stringlengths 5 116k | new_file stringlengths 4 220 | status stringclasses 6
values | error stringlengths 26 74 ⌀ | is_valid_syntax bool 2
classes |
|---|---|---|---|---|---|---|---|---|---|---|---|
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// xfail-fast\n// (Not sure why, though -- FIXME (tjc)\nimport to_str::*;\nimport to_str::to_str;\n\nclass cat {\n priv {\n let mut meows : uint;\n fn meow() {\n #error(\"Meow\");\n self.meows += 1u;\n if self.meows % 5u... | rust | edit | null | null | apache-2.0 | aa4fa2611c6d21d104b35f7e585fc32195a2d61d | kmcallister/rust,cllns/rust,fabricedesre/rust,sae-bom/rust,SiegeLord/rust,waynenilsen/rand,GBGamer/rust,Ryman/rust,XMPPwocky/rust,mdinger/rust,stepancheg/rust-ide-rust,andars/rust,aturon/rust,victorvde/rust,krzysz00/rust,pczarn/rust,rohitjoshi/rust,andars/rust,mitsuhiko/rust,dwillmer/rust,barosl/rust,kimroen/rust,jroes... | src/test/run-pass/class-separate-impl.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::collections::HashMap;\nuse std::collections::hash_map::Entry;\n\nconst LIBRARY: [char; 4] = ['A', 'C', 'G', 'T'];\n\npub fn count(c: char, seq: &str) -> Result<usize, String> {\n if LIBRARY.contains(&c) && seq.chars().all(|x| LIBR... | rust | edit | 0 | 5 | mit | f988d29b2f19bc6458a81bd44a9191097e7d6c92 | ragnese/exercism-rust | nucleotide-count/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2013 The Servo Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2... | rust | edit | 0 | 0 | apache-2.0 | e3cee9fcabd8ab60b52512bc5e498350cf00055e | servo/sharegl | lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io;\nuse std::string;\n\npub type Result<T> = ::std::result::Result<T, Error>;\n\n#[derive(Debug)]\npub struct Error {\n pos: u64,\n kind: ErrorKind,\n}\n\nimpl Error {\n pub fn new<K: Into<ErrorKind>>(pos: u64, kind: K) -> ... | rust | edit | 0 | 2 | apache-2.0 | 3d0fc3decc6e46be75870bbfd6b56393d6db016c | l1048576/fbx_direct | src/error.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::error::Error;\nuse std::fmt;\n\n#[derive(Debug, Clone)]\npub enum PngError {\n DeflatedDataTooLong(usize),\n Other(Box<str>),\n}\n\nimpl Error for PngError {\n // deprecated\n fn description(&self) -> &str {\n \"\"... | rust | edit | 0 | 2 | mit | ebd94934a52df0cd4f5ba0b3eb7b0bf2732bcc37 | shssoichiro/oxipng,shssoichiro/oxipng,shssoichiro/oxipng | src/error.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! # CLI\n//!\n//! The command line version of the library. Given a file path argument, it will ingest all the\n//! data into memory, and attempt parsing. If the parsing is successful, JSON is outputted to\n//! stdout, else a non-helpful err... | rust | edit | 0 | 2 | mit | 2825b02abc785d05c80252914573e0702265f9c9 | nickbabcock/boxcars,nickbabcock/boxcars | src/bin/boxcars-cli.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fmt;\n\npub trait FromAscii: Sized {\n type Err;\n\n fn from_ascii(s: &[u8]) -> Result<Self, Self::Err>;\n}\n\n/// An error returned when parsing a `bool` from a ascii string fails.\n#[derive(Debug, Clone, PartialEq)]\npub enum... | rust | edit | 0 | 2 | apache-2.0 | c6adf43f1a66cc6baa55463d8a74589924e97416 | knsd/from-ascii | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::logcat::LoggerEntry;\n\npub enum Event {\n Command(String),\n KeyCode(i32),\n LoggerEntry(LoggerEntry),\n}\n\n```\n\nApply this change: Make Event derive Debug, Eq, PartialEq\n\nMake Event derive a few traits to make it po... | rust | edit | 0 | 0 | mit | d04a0eff5743241a5132d45ea5c8b6aedc1747a1 | amhk/lokatt | src/event.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::ops::{Sub, Div};\n\n#[derive(Copy, Clone)]\npub struct Point {\n pub x: f64,\n pub y: f64,\n}\n\nimpl Point {\n pub fn new(x: f64, y: f64) -> Self {\n Point { x: x, y: y }\n }\n\n pub fn cross(self, other: Point... | rust | edit | 2 | 1 | mit | 3dbe1e90b84191ba88def8a6b0d92a6763ee2b88 | benstreb/astroids-rust | src/point.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/* Sample insertion sort program in Rust.\n Tested to compile with rust-0.6.\n */\nextern mod extra;\nextern mod benchmark;\nuse std::vec;\nuse benchmark::Benchmark;\n\nfn insertion_sort<T:Ord+Copy>(arr: ~[T]) -> ~[T] {\n let mut index =... | rust | edit | null | null | mit | cfa741572abd85993e5c134f071c41ee55e69ba6 | am0d/rust-projects,am0d/rust-projects | sorting/insertion-sort.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate proc_macro2;\nextern crate syn;\n\nuse std::str::FromStr;\n\nuse proc_macro2::TokenStream;\nuse syn::{Expr, ExprRange};\n\n#[test]\nfn test_expr_parse() {\n let code = \"..100u32\";\n let tt = TokenStream::from_str(code).un... | rust | edit | 1 | 1 | apache-2.0 | c2b156941d5db2fe3e22ddb83e9b3ff821201499 | dtolnay/syn | tests/test_expr.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::collections::BTreeMap;\nuse std::ascii::AsciiExt;\n\npub fn transform(input: &BTreeMap<i32, Vec<char>>) -> BTreeMap<char, i32> {\n let mut result: BTreeMap<char, i32> = BTreeMap::new();\n\n for (k, v) in input {\n for c ... | rust | edit | 2 | 1 | bsd-2-clause | ac8b8159f8da6a9776ee58cae0a12db953a69aca | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/etl/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse serde::Serializer;\nuse std::fmt::Display;\n\n/// For the times when the `Display` string is more appropriate than the default serialization\n/// strategy\npub fn display_it<T, S>(data: &T, serializer: S) -> Result<S::Ok, S::Error>\nwhere... | rust | edit | 0 | 2 | mit | d740df46ced14b57af1e251f9b8e7e1c75c4bc5b | nickbabcock/boxcars,nickbabcock/boxcars | src/serde_utils.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse Client;\nuse Error;\n\n#[derive(RustcDecodable, RustcEncodable, Debug)]\npub struct Board {\n pub id: String,\n pub name: String,\n pub desc: String,\n pub pinned: Option<bool>,\n pub starred: Option<bool>,\n pub url: St... | rust | edit | 2 | 1 | mit | d0c783c357efd8571a2a0a377def80f1a0ad20e4 | lipanski/trello-rs | src/board.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod network {\n fn connect() {\n }\n}\n\nmod client {\n fn connect() {\n }\n}\n\n#[cfg(test)]\nmod tests {\n #[test]\n fn it_works() {\n }\n}\n\n```\n\nApply this change: Move client module inside network module"
},
{... | rust | edit | 0 | 1 | mit | ccf3babbebc7857bd6b5253af216c2880bd36ddc | pgrzesik/learning-rust | 16_communicator/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(re_rebalance_coherence)]\n\n// compile-flags:--crate-name=test\n// aux-build:coherence_lib.rs\n\nextern crate coherence_lib as lib;\nuse lib::*;\nuse std::rc::Rc;\n\nstruct Local;\n\nimpl Remote1<u32> for f64 {\n //~^ ERROR only... | rust | edit | 0 | 1 | apache-2.0 | 31b301219f534090690674e43e05c3cbfd2d5005 | graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust | src/test/ui/coherence/impl-foreign[foreign]-for-foreign.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub const MAX_CHANNELS: usize = 8;\n\npub struct Frame {\n pub header: Header,\n pub footer: Footer,\n}\n\n#[derive(Clone, Copy, Debug, PartialEq, Eq)]\npub enum ChannelAssignment {\n Independent = 0,\n LeftSide = 1,\n RightSide = 2... | rust | edit | 0 | 0 | bsd-3-clause | 139ed0b6440e5649785dfba1c300e10a2700cbda | sourrust/flac | src/frame/types.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate clap;\n\nuse clap::Shell;\nuse std::env;\n\ninclude!(\"src/bin/cli.rs\");\n\nfn main() {\n let outdir = match env::var_os(\"PWD\") {\n None => return,\n Some(outdir) => outdir,\n };\n let mut ... | rust | edit | 0 | 2 | bsd-2-clause | ef8843ba31195a1aea9ead9c147dd82f7d0247ae | Nicoretti/xxd-rs | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn last<'a, T>(list: &'a [T]) -> Option<&'a T> {\n match list {\n [] => None,\n [.., ref x] => Some(x)\n }\n}\n\nfn main() {\n let list: ~[char] = ~['a', 'b', 'c'];\n println!(\"{:?}\", last(list));\n println!(\"{... | rust | edit | null | null | cc0-1.0 | c3c5d2290178f8d46057cfa5d1a1ebfb4b2feb20 | Armavica/99-Problems-Rust | 1-10/p01.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub fn maxArray(x: &mut[int, ..65536], y: &[int, ..65536]) {\n for i in range(0u, 65536) {\n if y[i] > x[i] {\n x[i] = y[i];\n }\n }\n}\n\n```\n\nApply this change: Fix warnings in rust example"
},
{
"role": "assistant",
... | rust | edit | null | null | bsd-2-clause | 3ee715691ebe785d5113f84374883234475de2ca | olajep/gcc-explorer,olajep/gcc-explorer,sigma-random/gcc-explorer,dkm/gcc-explorer,dkm/gcc-explorer,dkm/gcc-explorer,olajep/gcc-explorer,sigma-random/gcc-explorer,mattgodbolt/gcc-explorer,mattgodbolt/gcc-explorer,dkm/gcc-explorer,mattgodbolt/compiler-explorer,mcanthony/gcc-explorer,ibuclaw/gcc-explorer,mattgodbolt/gcc-... | examples/rust/max_array.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern mod std;\n\n#[test]\nfn test_tokenize() {\n assert tokenize( ~\"(1 2 3)\" ) == ~[~\"(\", ~\"1\", ~\"2\", ~\"3\", ~\")\"];\n}\n\n#[test]\nfn test_tokenize_empty() {\n assert tokenize( ~\"\" ) == ~[];\n}\n\n#[test]\nfn test_tokeniz... | rust | edit | null | null | mit | 22ae0720c25159554a580d7affc00da0e2727ae7 | martica/rusty | rusty.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse Printer;\nuse vec::Vec2;\nuse view::{View, ViewWrapper};\n\n/// Draws a border around a wrapped view.\npub struct Panel<V: View> {\n view: V,\n}\n\nimpl<V: View> Panel<V> {\n /// Creates a new panel around the given view.\n pub f... | rust | edit | 2 | 2 | mit | 87676295a0d79d57a660ebbc9490abcb74f04c4c | Gyscos/Cursive,ConnyOnny/Cursive-Break | src/views/panel.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[cfg(not(feature = \"serde_macros\"))]\nmod inner {\n extern crate serde_codegen;\n extern crate syntex;\n\n use std::env;\n use std::path::Path;\n\n const MODULES: &'static[&'static str] = &[\n \"error\",\n \"ke... | rust | edit | 0 | 2 | mit | ffbc9b9a22f0c202223a68a5f6f5453b970610da | jimmycuadra/rust-etcd | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(io, core, std_misc)]\n\n#[macro_use] extern crate log;\nextern crate hpack;\n\npub mod http;\npub mod client;\n\nmod tests {\n}\n\n```\n\nApply this change: Remove the `io` feature from the crate root"
},
{
"role": "assista... | rust | edit | 2 | 0 | mit | 55c7d3ba5cf1826abe6f425641c354959d0db9b9 | jinnjuice/solicit,mlalic/solicit,gwicke/solicit,Galvanization/solicit,tempbottle/solicit,stepancheg/solicit | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse std::process::Command;\nuse std::str::{self, FromStr};\n\n// The rustc-cfg strings below are *not* public API. Please let us know by\n// opening a GitHub issue if your build environment requires some way to enable\n// these... | rust | edit | 2 | 4 | apache-2.0 | 91b211fe1c345eca81f0c2b15baf9d478e08f9b8 | dtolnay/syn | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 The syscall.rs Project Developers. See the\n// COPYRIGHT file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICE... | rust | edit | 0 | 0 | apache-2.0 | 0bc5b2a959975de3eb439134a094ff143d706860 | ebfe/syscall.rs,kmcallister/syscall.rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse ron::value::Number;\n\n#[test]\nfn test_large_number() {\n use ron::value::Value;\n let test_var = Value::Number(Number::new(10000000000000000000000.0f64));\n let test_ser = ron::ser::to_string(&test_var).unwrap();\n let test_... | rust | edit | 0 | 1 | apache-2.0 | fe7d2e5df535245839471f6ba48861f68e117af2 | ron-rs/ron | tests/large_number.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\npub fn puzzle(input: &str) -> u32 {\n 0\n}\n\npub fn contains_abba(candidate: &str) -> bool {\n let by_chars: Vec<char> = candidate.chars().collect();\n\n for (i, &c) in by_chars.iter().enumerate() {\n if i + 3 < by_chars.le... | rust | edit | 2 | 6 | mit | 1536833b5d8edba57a2f06f14fc80cf2375c4df4 | carols10cents/adventofcode-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate ndarray;\nextern crate ndarray_linalg;\n\nuse ndarray::*;\nuse ndarray_linalg::*;\n\nfn main() {\n let a = arr2(&[[3.0, 1.0, 1.0], [1.0, 3.0, 1.0], [1.0, 1.0, 3.0]]);\n let (e, vecs): (Array1<_>, Array2<_>) = a.clone().eigh... | rust | edit | 0 | 1 | mit | 7c11c3ff93cef12aae0c790dc0032c380b6d531a | termoshtt/ndarray-linalg | examples/eigh.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::error::Error;\nuse std::panic::UnwindSafe;\n\npub trait AsDynError<'a> {\n fn as_dyn_error(&self) -> &(dyn Error + 'a);\n}\n\nimpl<'a, T: Error + 'a> AsDynError<'a> for T {\n #[inline]\n fn as_dyn_error(&self) -> &(dyn Error... | rust | edit | 0 | 2 | apache-2.0 | 6957309724e3f4030fb41d400a6932ed9a5dad0a | dtolnay/thiserror | src/aserror.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate askama;\nextern crate proc_macro;\nextern crate syn;\n\nuse proc_macro::TokenStream;\n\nfn get_path_from_attrs(attrs: &[syn::Attribute]) -> String {\n let attr = attrs.iter().find(|a| a.name() == \"template\").unwrap();\n i... | rust | edit | 0 | 8 | apache-2.0 | 210ed06bdb2b8042207cb91cfb84ee2e04bb6d11 | djc/askama,djc/askama,djc/askama | askama_derive/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse nom::IResult;\n\npub trait StreamProducer {\n fn parse<F, T>(&mut self, f: F) -> Result<T, ErrorKind>\n where F: FnOnce(&[u8]) -> IResult<&[u8], T>;\n}\n\n```\n\nApply this change: Add `ByteStream` for entire files of a byte slice"
}... | rust | edit | 1 | 5 | bsd-3-clause | 1e6af1563809bbcf375faada1e5c0732d76c2cd9 | sourrust/flac | src/utility/types.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(collections, std_misc, core)]\n\n#![feature(libc)]\nextern crate libc;\n\n#[macro_use]\nextern crate lazy_static;\n\n#[macro_use]\nextern crate bitflags;\n\n#[macro_use]\npub mod macros;\n\n#[allow(non_camel_case_types, non_snake_c... | rust | edit | 3 | 2 | apache-2.0 | 4ea00547130b56456542bfd225f9226287515b14 | kkirstein/hdf5-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Fix point-mutations for newest rust"
},
{
"role": "assistant",
"content": "pub fn hamming_distance(a: &str, b: &str) -> usize {\n a.chars().zip(b.chars()).filter(|&(a, b)| a != b).count()\n}\n"
}
] | rust | new_file | 0 | 1 | mit | 723bc229e8f8155b1ce931fdf14c8f36467f3941 | sacherjj/rust,exercism/xrust,exercism/xrust,Rust-Twin-Cities/flaming-octo-wookie,sacherjj/rust,Rust-Twin-Cities/flaming-octo-wookie,ekse/exercism-rust,ekse/exercism-rust,petertseng/exercism-rust,spazm/xrust,pminten/xrust,petertseng/exercism-rust,sacherjj/rust,stevejb71/xrust,pminten/xrust,Jeff-Hostetler/xrust,petertsen... | point-mutations/example.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(plugin)]\n#![plugin(plague)]\n\nplague! {\n for [ //~ERROR: this function takes 0 parameters but 2 parameters were supplied\n (1, 2),\n ]\n test fn foo() {\n }\n}\n\nfn main() {}\n\n```\n\nApply this change: Fix ... | rust | edit | 0 | 1 | mit | ab899c7690ff1ab30d8f76d9b85fc7beb72e8d1f | mcarton/rust-plague,mcarton/rust-plague | tests/compile-fail/arity-2.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::convert::From;\n\nuse types::Value;\n\nuse super::array::Array;\nuse super::class::Class;\nuse super::fixnum::Fixnum;\nuse super::hash::Hash;\nuse super::string::RString;\n\nuse super::traits::Object;\n\n#[derive(Clone)]\npub struct ... | rust | edit | 1 | 1 | mit | 92fb4cebbd9b2bdf4a6297588be5ce4b2114b084 | d-unseductable/ruru | src/class/any_object.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(unused_macros)]\n\nmacro_rules! gen_hashmap {\n\n {$($key: expr => $value: expr),*} => {\n\n {\n let mut hashmap = HashMap::new();\n\n $(\n hashmap.insert($key, $value);\n )*\... | rust | edit | 0 | 0 | mit | 96f7f2f85abc8de30ceacfb45834b368ae02072c | yinyanlv/runner,yinyanlv/runner,yinyanlv/runner | src/common/macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse syn::Type;\n\n#[test]\nfn test_mut_self() {\n syn::parse_str::<Type>(\"fn(mut self)\").unwrap();\n syn::parse_str::<Type>(\"fn(mut self: ())\").unwrap();\n syn::parse_str::<Type>(\"fn(mut self: ...)\").unwrap_err();\n syn::par... | rust | edit | 1 | 1 | apache-2.0 | d9e61a5ebe2d3bc0b1077f304a31bf377d9c83d0 | dtolnay/syn | tests/test_ty.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! A crate for parsing Markdown in Rust\n#![crate_name = \"markdown\"]\n#![deny(missing_docs)]\n// #![deny(warnings)]\n\n#![cfg_attr(feature=\"clippy\", feature(plugin))]\n#![cfg_attr(feature=\"clippy\", plugin(clippy))]\n\nextern crate rege... | rust | edit | null | null | apache-2.0 | df663fb6c7819a88bc2175fda7cae1be855fc1f1 | johannhof/markdown.rs | src/lib.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse assert_cmd::prelude::*;\nuse std::process::{Command, Stdio};\n\nuse anyhow::{Context, Result};\nuse nix::sys::signal::{kill, Signal};\nuse nix::unistd::Pid;\n\nmod helper;\n\nuse helper::*;\n\n#[cfg(target_os = \"linux\")]\n#[test]\n/// S... | rust | edit | 2 | 6 | mit | 9a9075114c12c89b87e5463da606195cae550674 | Nukesor/Pueue,Nukesor/Pueuew | tests/test_shutdown.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Package up unwind recovery. Note that if you are in some sensitive\n//! place, you can use the `AbortIfPanic` helper to protect against\n//! accidental panics in the rayon code itself.\n\nuse libc;\nuse std::any::Any;\nuse std::panic::{se... | rust | edit | 1 | 2 | apache-2.0 | 3ee6cf2273b1b6697ded93b0d4ba9295a67547b5 | cuviper/rayon,cuviper/rayon | rayon-core/src/unwind.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate xswag_syntax_java as syntax;\nextern crate xswag_base as base;\n\nuse base::diag;\n\n// FIXME: import is currently wrong\nconst SRC: &'static str = \"\\\npackage yolo.swag;\n\nimport AlgoTools.IO;\nimport java.lang-*;\n\npublic p... | rust | edit | 0 | 3 | mit | 1effdc5e95bf6d592949b6c615b4b2bcc646d88a | LukasKalbertodt/xswag-syntax-java | examples/play.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate libc as real_libc;\n#[macro_use]\nextern crate bitflags;\n\n#[cfg(target_os = \"linux\")]\n#[path = \"platform/linux.rs\"]\n#[macro_use]\nmod platform;\n\npub use platform::*;\n\n/// A hack to get the macros to work nicely.\n#[do... | rust | edit | 0 | 0 | apache-2.0 | d9ce862c6a5ea7eb77f68952aca3ee857c225078 | cmr/ioctl,cmr/ioctl | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate ratel;\nextern crate iron;\n\nuse std::io::Read;\nuse iron::prelude::*;\nuse iron::status;\nuse ratel::error::ParseError;\n\nfn compile(source: String, minify: bool) -> Result<String, ParseError> {\n let mut ast = match ratel:... | rust | edit | 0 | 3 | mit | e5866136d3d7f2e6ef0cbf8cd12d6adb23d6d0fd | ratel-rust/ratel-server | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Read token from environment variable"
},
{
"role": "assistant",
"content": "use std::{env, process};\n\nfn main() {\n let token = match env::var(\"GITHUB_SWEEP_TOKEN\") {\n Ok(val) => val,\n Err(e) => {\n ... | rust | new_file | 0 | 2 | mit | f047863be5958a55cbf8891f32d2cc1b8aef9b2f | matt-thomson/github-sweep | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```go\npackage main\n\nimport (\n\tcorelog \"log\"\n\t\"log/syslog\"\n\t\"os\"\n)\n\nvar log *corelog.Logger\n\nfunc init() {\n\tlog = corelog.New(os.Stderr, \"\", 0)\n\tlog.SetFlags(corelog.LstdFlags)\n}\n\nfunc initLogger(slog bool) {\n\tif slog {\n... | go | edit | 0 | 3 | apache-2.0 | ed3efb14fd5eee4a768419ae847ba39dbe6fac79 | couchbaselabs/cbfs,couchbaselabs/cbfs,couchbaselabs/cbfs | logging.go | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::error::Error;\nuse std::fmt;\n\n#[derive(Debug)]\npub struct PngError {\n description: String,\n}\n\nimpl Error for PngError {\n fn description(&self) -> &str {\n &self.description\n }\n}\n\nimpl fmt::Display for PngE... | rust | edit | 0 | 1 | mit | 4da65aef3fc966396a726ba5411c2bd2b121fd6b | shssoichiro/oxipng,shssoichiro/oxipng,shssoichiro/oxipng | src/error.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Handle one instruction that goes one block"
},
{
"role": "assistant",
"content": "pub fn distance(input: &str) -> u32 {\n let mut chars = input.chars();\n if let (Some(turn_dir), Some(num_blocks)) = (chars.next(), chars.next(... | rust | new_file | 1 | 2 | mit | 7e7510774cf32aa7f43eb8ba1b67aff673fcc065 | carols10cents/adventofcode-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(core)]\n\nextern crate interpolate;\nextern crate num;\n\npub mod vector;\npub mod rect;\npub mod circle;\npub mod grid;\npub mod wrapping_grid;\n\npub use vector::Vec2;\npub use rect::Rect;\npub use circle::Circle;\npub use grid::... | rust | edit | 1 | 0 | mit | 6806246fb80e5f1c968786d0764b65272d5561d8 | quvarxa/basic2d,mchesser/basic2d | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate serde;\nextern crate serde_json;\n\nuse hyper::Client;\nuse hyper::client::{Body, Response};\nuse hyper::header::Headers;\nuse hyper::status::StatusCode;\nuse jira_request::*;\nuse std::io::Read;\n\npub fn send<R: JIRARequest, T:... | rust | edit | 0 | 4 | mit | 48e0f22fae27fd895b2c01c706d8255a7e63f0c3 | dorayakikun/alfred_jira_workflow | src/jira_client.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Implementation of the `Synth` struct for basic polyphonic, multi-oscillator envelope synthesis.\n\nextern crate envelope as envelope_lib;\nextern crate gaussian;\npub extern crate instrument;\nextern crate panning;\nextern crate pitch_cal... | rust | edit | 1 | 0 | mit | 5f8693ee078674cb9f299ac29fc5e7c93bf86ee2 | RustAudio/synth | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate time;\nextern crate serde;\nextern crate serde_json;\n\nmod user;\nmod message;\npub mod json;\n\npub use self::user::*;\npub use self::message::*;\n\n```\n\nApply this change: Add stub root module documentation"
},
{
"ro... | rust | edit | 3 | 0 | mit | 43632905df9972114f2f15b92177e7f9b36e4277 | nabijaczleweli/chattium-oxide-lib | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\npub fn edit_distance(a: &str, b: &str) -> i32 {\n\n let row: Vec<i32> = vec![0; b.len() + 1];\n let mut matrix: Vec<Vec<i32>> = vec![row; a.len() + 1];\n\n // initialize string a\n for i in (0..a.len()) {\n matrix[i+1][0]... | rust | edit | 2 | 6 | apache-2.0 | 072aeb60b55cf86f89d62acccefc2baff6d75ad1 | febeling/edit-distance | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, ... | rust | edit | 0 | 1 | apache-2.0 | 61e50e5a72344ee935f8a6ef0363cde627008b12 | endoli/disassemble.rs | src/memory.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add Table type, Read, Write trait"
},
{
"role": "assistant",
"content": "pub mod ascii_writer;\npub mod markdown_writer;\n\npub struct Table {\n rows: Vec<Vec<String>>,\n has_headers: bool,\n}\n\npub struct Error {}\n\npub trait ... | rust | new_file | 1 | 0 | mit | b0d666e6a04ae603af2ae369dfc3c7a1b8ccc85b | naoty/table | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[cfg(feature=\"pkg-config\")]\nextern crate \"pkg-config\" as pkg_config;\n\nfn main() {\n if !build_pkgconfig() {\n println!(\"cargo:rustc-flags=-l SDL2\");\n }\n}\n\n#[cfg(not(feature=\"pkg-config\"))]\nfn build_pkgconfig() -> b... | rust | edit | null | null | mit | 225529f4549dc6b46fe020e435ac1ec01a0c99be | Rust-SDL2/rust-sdl2,crumblingstatue/rust-sdl2,oldmanmike/rust-sdl2,inrustwetrust/rust-sdl2,Cobrand/rust-sdl2,nukep/rust-sdl2,bvssvni/rust-sdl2,AngryLawyer/rust-sdl2,caldwell/rust-sdl2,tempbottle/rust-sdl2,Rust-SDL2/rust-sdl2,wilsoniya/rust-sdl2,Cobrand/rust-sdl2,bfops/rust-sdl2,Rust-SDL2/rust-sdl2,vadixidav/rust-sdl2,C... | sdl2-sys/build.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//use serde::de::Deserialize;\nuse super::super::link::HalLink;\nuse super::super::resource::OneOrMany;\nuse serde_json::{from_str, to_string};\nuse serde::*;\n\n#[derive(Serialize, Deserialize)]\nstruct Boh<T:Clone>\n{\n oom: OneOrMany<T>... | rust | edit | 0 | 1 | mit | ca1651aaf2651d21d5268ba9b7edc016f4c4801f | pduval/rustic_hal | src/tests/one_or_many.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(backtrace)]\n\nmod as_error;\nmod exception;\nmod context;\n\n#[doc(inline)]\n/// Annotations a function that \"throws\" a Result.\n///\n/// Inside functions tagged with `throws`, you can use `?` and the `throw!` macro to return er... | rust | edit | 2 | 0 | apache-2.0 | b47a6fde74f5040d4441a54cf3d7ccaeecd31201 | dtolnay/anyhow | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Implementation of the Micro Transport Protocol.[^spec]\n//!\n//! [^spec]: http://www.bittorrent.org/beps/bep_0029.html\n\n// __________ ____ ____\n// /_ __/ __ \\/ __ \\/ __ \\\n// / / / / / / / / / / / /\n// / / / /_/ / /_/ / /_... | rust | edit | 2 | 0 | apache-2.0 | 3a8fa9325a54a4ca4837cc63a577f4cf9c78056c | dirvine/rust-utp | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/*\n * Copyright (c) 2015-2017 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the Lic... | rust | edit | 1 | 0 | apache-2.0 | 3434585ee4446c072d693e6436919bb74a83c20b | glyn/jvmkill,glyn/jvmkill,glyn/jvmkill,glyn/jvmkill | jvmkill/src/macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! termion is a pure Rust library for reading, manipulating, and handling terminals.\n//!\n//! This crate is not stable, yet. However, if you do want stability, you should specify the\n//! revision (commit hash) in your `Cargo.toml`, this wa... | rust | edit | 1 | 0 | mit | b36e5fa7212a628ca2618fd78391309275a557b2 | Ticki/libterm,ftilde/termion,ticki/termion | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[cfg(doctest)]\nuse num_cpus as _;\n\n#[cfg(test)]\ncompile_error!(\"Miri should not touch me\");\n\n```\n\nApply this change: Use `compile_error!` instead of `use num_cpus`"
},
{
"role": "assistant",
"content": "#[cfg(doctest)]\... | rust | edit | 0 | 0 | apache-2.0 | ffff7ff8a6e0a54443e5bef3eb3c8f4b7aeaf1c6 | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri | test-cargo-miri/subcrate/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate askama;\nextern crate proc_macro;\nextern crate syn;\n\nuse proc_macro::TokenStream;\n\nfn get_path_from_attrs(attrs: &Vec<syn::Attribute>) -> String {\n for attr in attrs {\n if attr.name() == \"template\" {\n ... | rust | edit | 0 | 5 | apache-2.0 | 330e2ef471e07dbb242bf402001f69e5c0cd2701 | djc/askama,djc/askama,djc/askama | askama_derive/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate encoding;\n\nuse std::fmt;\n\nuse self::encoding::types::EncodingRef;\n\n/// ParseOptions allows setting options for parsing MO catalogs.\npub struct ParseOptions {\n force_encoding: Option<EncodingRef>,\n}\n\nimpl ParseOption... | rust | edit | 0 | 1 | mit | e487626b6a98f96fab4948e59a7d41aca2a4032f | justinas/gettext | src/parse_options.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse hyper::Uri as HyperUri;\nuse std::path::Path;\n\n/// A convenience type that can be used to construct Unix Domain Socket URIs\n///\n/// This type implements `Into<hyper::Uri>`.\n///\n/// # Example\n/// ```\n/// use hyperlocal::Uri;\n/// u... | rust | edit | 0 | 1 | mit | b41496f5b65424d5a0ccb36f1d11900f2d203a46 | softprops/hyperlocal | src/uri.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_name = \"kernel\"]\n#![crate_type = \"staticlib\"]\n#![no_std]\n#![feature(asm, lang_items)]\n#![feature(core)]\n\nextern crate core;\nextern crate rlibc;\n\n#[path = \"arch/x86/\"]\npub mod platform {\n\tpub mod vga;\n\tpub mod cpu;... | rust | edit | 9 | 0 | mit | bb90f403aeed1e03015369c139d3f89785879e3e | mvdnes/element76 | kernel_x86.rs | rejected_lint | Too many lint violations: 9 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```go\npackage main\n\nimport (\n\t\"github.com/yuin/gopher-lua\"\n\t\"sync\"\n)\n\n// The LState pool pattern, as recommended by the author of gopher-lua:\n// https://github.com/yuin/gopher-lua#the-lstate-pool-pattern\n\ntype lStatePool struct {\n\tm... | go | edit | 9 | 2 | bsd-3-clause | 792f495e032b8ce7d9bde5fa797eeb94bb95484e | xyproto/algernon,xyproto/algernon,xyproto/algernon,xyproto/algernon | luapool.go | rejected_lint | Too many lint violations: 9 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate nom;\n\nextern crate serde;\n#[macro_use]\nextern crate serde_derive;\n\npub use self::arithmetic::{ArithmeticBase, ArithmeticExpression, ArithmeticOperator};\npub use self::common::{FieldExpression, Literal, Operat... | rust | edit | 2 | 0 | mit | 3a943c6df6a96de52fec357c40e773a8c1e67351 | ms705/nom-sql | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::str::{from_utf8_unchecked, FromStr};\n\npub fn to_string(s: &[u8]) -> &str {\n unsafe { from_utf8_unchecked(s) }\n}\npub fn to_u32(s: &str) -> u32 {\n FromStr::from_str(s).unwrap()\n}\n\npub fn buf_to_u32(s: &[u8]) -> u32 {\n ... | rust | edit | 0 | 1 | mit | 625212de0e04ddf8e96746066d6d04c4e5fbe55a | hoodie/iso8601,badboy/iso8601 | src/helper.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse url::Url;\nuse serde::de::{Deserialize, Deserializer, Error as DeserializeError};\nuse serde::ser::{Serialize, Serializer};\n\n\n/// Unit struct which can be used to serialize a Url.\n///\n/// `#[serde(with = \"UrlDef\")]`\npub struct Url... | rust | edit | 0 | 2 | apache-2.0 | f64a561d0e87d89f675f195e311fab5a8239f976 | portier/portier-broker,portier/portier-broker,portier/portier-broker,portier/portier-broker | src/serde_helpers.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2019 The Exonum Team\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.... | rust | edit | 1 | 0 | apache-2.0 | c42a5da68d09ca3dbb818b7e87bce634e67ec0b4 | exonum/exonum,alekseysidorov/exonum,exonum/exonum,alekseysidorov/exonum,alekseysidorov/exonum,exonum/exonum,exonum/exonum,alekseysidorov/exonum | src/macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate ppbert;\n\nuse std::io;\nuse std::io::Read;\n\nuse ppbert::parser;\nuse ppbert::pretty;\n\nfn main() {\n let mut stdin = io::stdin();\n let mut buf: Vec<u8> = Vec::new();\n\n let _ = stdin.read_to_end(&mut buf);\n let... | rust | edit | 0 | 2 | mit | e6580489daba84f88357d52ea1378c00df86c213 | gnuvince/ppbert,gnuvince/ppbert | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::Write;\n\nextern crate watchexec;\n\nuse watchexec::{cli, error, run};\n\nfn main() -> error::Result<()> {\n run(cli::get_args()?)\n}\n\nfn init_logger(debug: bool) {\n let mut log_builder = env_logger::Builder::new();\n ... | rust | edit | 0 | 2 | apache-2.0 | 03142f5ec1d82fea0e2021c7cdd4220b233919e8 | mattgreen/watchexec,mattgreen/watchexec,mattgreen/watchexec,mattgreen/watchexec | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod diff;\n\nuse std::io;\n\nenum Mode {\n Command,\n Input,\n}\n\nstruct Range {\n start: i32,\n end: i32,\n}\n\n\nfn command_line(line: &String, mode: &mut Mode) {\n match line.trim() {\n \"a\" => *mode = Mode::Input,\... | rust | edit | 0 | 2 | mit | 428e059c4f029f3808244fd369b0d183d4636bd5 | cwandrews/ed | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rand;\n\nuse std::io;\nuse rand::Rng;\n\nfn main() {\n println!(\"Hello in my guessing game!\");\n\n let secret_number = rand::thread_rng().gen_range(1, 101);\n\n println!(\"The secret number is: {}\", secret_number);\n\... | rust | edit | 0 | 2 | mit | aaaae7fa1e527b4b003180aa13be958742140309 | pgrzesik/learning-rust | guessing_game/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate argparse;\n\nuse argparse::{ArgumentParser, StoreTrue, Store, StoreOption, Print};\n\nfn main() {\n let mut debug = false;\n let mut path = \"\".to_string();\n let mut file: Option<String> = None;\n { // block limits ... | rust | edit | 0 | 4 | mit | d65bf55e2874734919e1609476b028375ad2b370 | uptech/alt,cyphactor/alt,cyphactor/alt,uptech/alt | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate sassers;\nextern crate docopt;\n\nuse docopt::Docopt;\nuse std::fs::File;\nuse std::io::Read;\nuse std::path::Path;\n\nfn main() {\n const VERSION: &'static str = env!(\"CARGO_PKG_VERSION\");\n static USAGE: &'static str = ... | rust | edit | 0 | 5 | mit | 9058174b23f381c57c016bfd929cd89a2e1c92fd | carols10cents/sassers | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(io)]\n\nextern crate anymap;\n\nuse std::old_io::net::ip::IpAddr;\nuse anymap::AnyMap;\n\n#[derive(Debug)]\nenum HostAddress {\n DomainName(String),\n Ip(IpAddr),\n}\n\n#[derive(Debug)]\nstruct Port(u32);\n\n#[derive(Debug)]\... | rust | edit | 0 | 4 | mit | 9ac49b5f8dbcd2f7c3f9af29ccf17e7ef72c54a0 | zsiciarz/24daysofrust,folkengine/24daysofrust,folkengine/24daysofrust,zsiciarz/24daysofrust,folkengine/24daysofrust,zsiciarz/24daysofrust | src/day9.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(unstable)]\n\nextern crate getopts;\nextern crate selecta;\n\nuse getopts::{optopt,getopts};\nuse selecta::configuration::Configuration;\nuse selecta::search::Search;\nuse selecta::tty::TTY;\nuse selecta::tty::IO;\nuse selecta::scree... | rust | edit | 0 | 3 | mit | b0161333a270f5deebe88bfb5da6873210e516cf | felipesere/icepick,felipesere/icepick | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod vm;\nmod command;\nmod parse;\nmod program;\n\nuse vm::VM;\nuse std::io::Write;\n\nfn main() {\n let mut vm = VM::new();\n loop {\n print!(\"{}\", \"bf> \");\n std::io::stdout().flush().unwrap();\n\n let mut lin... | rust | edit | 1 | 2 | mit | 35d5cc86558d6d7081990b0a0a28739dc04ef2ad | nafarlee/thoughtfuck | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod raw {\n extern crate libc;\n\n #[allow(non_camel_case_types)]\n pub type wl_display = libc::c_void;\n\n #[link(name = \"wayland-client\")]\n extern {\n pub fn wl_display_connect(name: *const u8) -> *mut wl_display;\n... | rust | edit | 2 | 3 | mit | 2c38ce28ff0c53046a6898ed6a668dee12eeb5cd | eyolfson/eyl-shell | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io;\n\npub use self::posix::PosixInputHandler;\n\nmod posix;\n\nconst CMD_PROMPT: &'static str = \">> \";\n\nenum Key {\n Esc,\n Enter,\n Tab,\n\n Up,\n Down,\n Left,\n Right,\n Home,\n End,\n Insert,\n ... | rust | edit | 1 | 0 | mit | bf69873425a07a2837fa84e8049fff901a88f7dd | opp11/calcr | src/input/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add a function for parsing command-line arguments"
},
{
"role": "assistant",
"content": "extern crate getopts;\nuse getopts::{optopt, optflag, OptGroup};\nuse std::os;\n\n\nuse device_info::{DefaultDevice, DefaultInterface, UserDef... | rust | new_file | 1 | 5 | mit | fa3bada5066ba1a31fe9287f7c38852dd670be62 | graememcc/netStack,graememcc/netStack | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2012 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | 0 | 2 | apache-2.0 | c89afc39718ed7b326f2e4f4ba4dd65a6d160bb3 | aepsil0n/rust,nham/rust,mdinger/rust,cllns/rust,l0kod/rust,XMPPwocky/rust,jashank/rust,avdi/rust,erickt/rust,dwillmer/rust,vhbit/rust,dwillmer/rust,kwantam/rust,pythonesque/rust,jbclements/rust,emk/rust,jashank/rust,kmcallister/rust,bombless/rust,mahkoh/rust,mvdnes/rust,seanrivera/rust,bluss/rand,mitsuhiko/rust,carols1... | src/test/compile-fail/pat-ref-enum.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::{self, Write};\nuse std::fs::File;\n\nuse flac::stream::StreamReader;\nuse flac::metadata::{self, Picture};\n\npub const USAGE: &'static str = \"\nUsage: metadata picture [options] <filename>\n metadata picture --help\n\nOp... | rust | edit | 1 | 5 | bsd-3-clause | 0c4c6517e97c86e407370b8d2fa66387f1fe35b7 | sourrust/flac | examples/commands/picture.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate proptest;\nextern crate chars;\n\nuse chars::human_names;\n\nuse proptest::prelude::*;\nuse proptest::test_runner::Config;\nuse std::fmt::Write;\n\nproptest! {\n#![proptest_config(Config::with_cases(100000))]\n#[tes... | rust | edit | 0 | 1 | mit | 33de0d9783481d19e16086bb6cd12b02de1175e8 | antifuchs/chars,antifuchs/chars | tests/human_names.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse url::Url;\nuse serde::de::{Deserialize, Deserializer, Error as DeserializeError};\nuse serde::ser::{Serialize, Serializer};\n\n\n/// Type which can be used to serialize a Url.\n///\n/// `#[serde(with = \"UrlDef\")]`\npub struct UrlDef(Url... | rust | edit | 0 | 2 | apache-2.0 | f16a6d87f109eb80bad4d9bc67d6100f55ee6811 | portier/portier-broker,portier/portier-broker,portier/portier-broker,portier/portier-broker | src/serde_helpers.rs | rejected_duplicate | Near-duplicate of sample 119934 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::error::Error;\nuse std::env;\nuse std::fs;\nuse std::fs::File;\nuse std::io::prelude::*;\nuse std::path::Path;\n\nfn main() {\n let arg = env::args().nth(1).unwrap_or_else(|| {\n println!(\"Please pass a src directory as th... | rust | edit | 0 | 9 | apache-2.0 | 0bafe766828b566a283a1a1e3f230f34721b8b07 | rust-lang/reference,rust-lang/reference | stable-check/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Here lists all the paths that will be used by wiz\nuse std::path::{ Path, PathBuf };\n\n///\n/// Appends `append` to `path`.\n///\npub trait PathAppend {\n fn append(&mut self, input: &str) -> &Path;\n}\n\nimpl PathAppend for PathBuf {\... | rust | edit | 5 | 2 | bsd-3-clause | ae5227ead608e62c1ed33c697cabb66bc088fed1 | hch12907/wiz | src/paths.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::collections::HashMap;\n\npub fn solve(puzzle: &str) -> Option<HashMap<char, u8>> {\n unimplemented!()\n}\n\n```\n\nApply this change: Remove unused variable from Alphametics stub"
},
{
"role": "assistant",
"content": "... | rust | edit | 0 | 1 | mit | d44df84079a6d26c50b3d3d00c09d0da8f0b3c6f | sacherjj/rust,petertseng/exercism-rust,sacherjj/rust,sacherjj/rust,petertseng/exercism-rust,exercism/xrust,exercism/xrust,petertseng/exercism-rust | exercises/alphametics/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate perl_xs;\n#[macro_use]\nextern crate perl_sys;\n\nuse perl_xs::{ SV, AV, IV, NV };\n\nxs! {\n package XSBench::RS;\n \n sub rs_sum_loop(ctx, param: SV) {\n let array: AV = param.deref_av().expect(\"n... | rust | edit | 0 | 0 | bsd-2-clause | cdc6095829593c0fa1ff8e962e71c905ae8db730 | vickenty/perl-xs,vickenty/perl-xs | bench/rs/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Enable static linking support (similar to openssl-sys)"
},
{
"role": "assistant",
"content": "use std::env;\n\nfn main () {\n if let Some(lib_dir) = env::var(\"SODIUM_LIB_DIR\").ok() {\n \tprintln!(\"cargo:rustc-flags=-L nati... | rust | new_file | 2 | 3 | mit | ac5e82474b14c79393b42467ef6d34efe9460aed | Fraser999/sodiumoxide,markuskobler/sodiumoxide,romanb/sodiumoxide,maidsafe/sodiumoxide | libsodium-sys/build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 Michael Yang. All rights reserved.\n// Use of this source code is governed by a MIT-style\n// license that can be found in the LICENSE file.\n\npub mod ll;\npub mod ops;\n\npub trait BlasVector<T> {\n fn inc(&self) -> i32... | rust | edit | 1 | 2 | mit | 0de9e298b10c1e86704f94b2b5c10f479f87c415 | raineszm/rust-blas,mikkyang/rust-blas | src/vector/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::builder::Builder;\nuse ast::HeadingLevel;\n\n///\n/// HTML generation might need to be customized to invividual use.\n/// A `Format` allows to customize output generation (e.g. custom tags, classes, ...)\n/// TODO: I need some feed... | rust | edit | 0 | 2 | mit | 375c933ff8bcec998d553aadc1e4b1b60a7d2fe0 | squid-lang/squid | src/html/format.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::string::String;\nuse std::vec::Vec;\nuse js_types::js_type::{JsTrait, JsT};\n\n// `undefined`\npub struct JsUndef;\nimpl JsTrait for JsUndef {}\n\n// `null`\npub struct JsNull;\nimpl JsTrait for JsNull {}\n\n// `bool`\npub struct JsB... | rust | edit | 1 | 1 | mit | edb45c4ea8337338b5cd8f6fcb13b5299bccd35e | rustoscript/french-press | src/js_types/js_str.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(proc_macro, proc_macro_non_items)]\nextern crate proc_macro;\n\nuse proc_macro::{TokenStream, quote};\n\n#[proc_macro_derive(ClippyMiniMacroTest)]\npub fn mini_macro(_: TokenStream) -> TokenStream {\n quote!(\n #[allow(un... | rust | edit | 1 | 1 | apache-2.0 | 3246a1f5c0ecd85e53f9d2564305a3f7f063064e | graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust | mini-macro/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | 0 | 1 | apache-2.0 | 7f8ca53669e71481201892e37ec57939e5f1ec85 | jroesch/rust,carols10cents/rust,aidancully/rust,avdi/rust,dinfuehr/rust,zachwick/rust,cllns/rust,kwantam/rust,zubron/rust,ejjeong/rust,bombless/rust,ktossell/rust,ktossell/rust,ruud-v-a/rust,ktossell/rust,zachwick/rust,dwillmer/rust,jashank/rust,reem/rust,AerialX/rust-rt-minimal,jashank/rust,dinfuehr/rust,l0kod/rust,ja... | src/test/compile-fail/issue-17033.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse ::arch::debug;\nuse core::fmt::{Error,Write};\nuse spin::{MutexGuard,StaticMutex,STATIC_MUTEX_INIT};\n\npub struct Writer<'a> {\n _state: MutexGuard<'a, ()>\n}\n\nstatic LOGGING_LOCK: StaticMutex = STATIC_MUTEX_INIT;\n\nimpl<'a> Writer... | rust | edit | 0 | 1 | mit | 9568966068955af317853c7fec411ef1e9e32df5 | 1tgr/rust-os,1tgr/rust-os,1tgr/rust-os,1tgr/rust-os | Kernel/logging.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | 0 | 1 | apache-2.0 | 03b568a846e71d2efac88325534c2142b6c25453 | KokaKiwi/rust,l0kod/rust,kimroen/rust,defuz/rust,mvdnes/rust,miniupnp/rust,richo/rust,bombless/rust,philyoon/rust,ruud-v-a/rust,aepsil0n/rust,zachwick/rust,nwin/rust,quornian/rust,zaeleus/rust,kwantam/rust,nwin/rust,aneeshusa/rust,zubron/rust,sae-bom/rust,pelmers/rust,emk/rust,l0kod/rust,reem/rust,vhbit/rust,ejjeong/ru... | src/test/compile-fail/deriving-no-inner-impl-error-message.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nintrinsics! {\n // Implementation from gcc\n // https://raw.githubusercontent.com/gcc-mirror/gcc/master/libgcc/config/epiphany/mulsi3.c\n pub extern \"C\" fn __mulsi3(a: u32, b: u32) -> u32 {\n let (mut a, mut b) = (a, b);\n ... | rust | edit | 0 | 3 | apache-2.0 | 605b439ad3e5665695eb56efade8ba5bf854a561 | japaric/rustc-builtins,japaric/rustc-builtins | src/riscv32.rs | accepted | null | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.