Age | Commit message (Collapse) | Author |
|
Add COPYING file and license notices to sources.
|
|
I had used `to_owned()` previously in other projects, but after looking
up the difference (again probably), I decided that it seems better to
use `to_owned()`.
References:
https://users.rust-lang.org/t/to-string-vs-to-owned-for-string-literals/1441/6
http://www.lowlevelmanager.com/2016/02/rust-tostring-vs-toowned-for-string.html
|
|
Now that a bunch of function signatures have been rewritten to take
references, update the tests to pass the correct arguments.
|
|
I had a bunch of compilation errors in this function because I wasn't
borrowing correctly. Fix the errors with borrows by reference, and
copying strings.
Here are the errors for reference:
error[E0373]: closure may outlive the current function, but it borrows `job`, which is owned by the current function
--> src/jenkins.rs:89:27
|
89 | thread::spawn(|| {
| ^^ may outlive borrowed value `job`
...
94 | job.result.commit_status(),
| --- `job` is borrowed here
|
help: to force the closure to take ownership of `job` (and any other referenced variables), use the `move` keyword
|
89 | thread::spawn(move || {
| ^^^^^^^
error[E0373]: closure may outlive the current function, but it borrows `job_url`, which is owned by the current function
--> src/jenkins.rs:89:27
|
89 | thread::spawn(|| {
| ^^ may outlive borrowed value `job_url`
...
96 | job_url.clone(),
| ------- `job_url` is borrowed here
|
help: to force the closure to take ownership of `job_url` (and any other referenced variables), use the `move` keyword
|
89 | thread::spawn(move || {
| ^^^^^^^
error[E0382]: use of moved value: `commit_ref`
--> src/jenkins.rs:88:32
|
88 | if job_for_commit(job, commit_ref) {
| ^^^^^^^^^^ value moved here in previous iteration of loop
|
= note: move occurs because `commit_ref` has type `pull_request::CommitRef`, which does not implement the `Copy` trait
error[E0382]: capture of moved value: `commit_ref`
--> src/jenkins.rs:93:21
|
88 | if job_for_commit(job, commit_ref) {
| ---------- value moved here
...
93 | commit_ref,
| ^^^^^^^^^^ value captured here after move
|
= note: move occurs because `commit_ref` has type `pull_request::CommitRef`, which does not implement the `Copy` trait
error[E0382]: capture of moved value: `job`
--> src/jenkins.rs:89:27
|
88 | if job_for_commit(job, commit_ref) {
| --- value moved here
89 | thread::spawn(|| {
| ^^ value captured here after move
|
= note: move occurs because `job` has type `jenkins::Job`, which does not implement the `Copy` trait
error[E0382]: capture of moved value: `job_url`
--> src/jenkins.rs:89:27
|
85 | let job = request_job(job_url);
| ------- value moved here
...
89 | thread::spawn(|| {
| ^^ value captured here after move
|
= note: move occurs because `job_url` has type `std::string::String`, which does not implement the `Copy` trait
|
|
This field stores the "owner" of the commit on GitHub, in other words, a
user or organisation. Storing that information in this struct makes it
easier to pass around.
|
|
A new af83 module for non-general code.
The `job_name` function will turn a commit reference into a job name
string. This job name corresponds to the names of branch builds in
Jenkins, and is a custom format, specific to af83.
|